shmel010201
Освоившийся
Дата регистрации:
03.05.2016 17:31:25
Сообщений: 23
Warning: session_start() [http://guruphp.com.us/function.session-start]: Cannot send session cookie - headers already sent by (output started at
Z:\home\guruphp.com.us\www\lib\database_class.php:162) in Z:\home\guruphp.com.us\www\lib\modules_class.php on line 22
Warning: session_start() [http://guruphp.com.us/function.session-start]: Cannot send session cache limiter - headers already sent (output
started at Z:\home\guruphp.com.us\www\lib\database_class.php:162) in Z:\home\guruphp.com.us\www\lib\modules_class.php on line 22
Fatal error: Call to a member function getAll() on a non-object in Z:\home\guruphp.com.us\www\lib\global_class.php on line 49
Посмотрите код и помогите
Modules_class.php
<?php
require_once "config_class.php";
require_once "article_class.php";
require_once "section_class.php";
require_once "user_class.php";
require_once "menu_class.php";
require_once "banners_class.php";
require_once "message_class.php";
abstract class Modules {
protected $config;
protected $article;
protected $section;
protected $user;
protected $menu;
protected $banner;
protected $message;
protected $data;
public function __construct($db){
session_start();
$this->config=new Config();
$this->article=new Article($db);
$this->section=new Section($db);
$this->user=new User($db);
$this->menu=new Menu($db);
$this->banner=new Banners($db);
$this->message=new Message();
$this->data=$this->secureData($_GET);
}
public function getContent() {
$sr["title"] = $this->getTitle();
$sr["meta_desc"] = $this->getDescription();
$sr["meta_key"] = $this->getKeywords();
$sr["menu"] = $this->getMenu();
$sr["auth_user"] = $this->getAuthUser();
$sr["banners"] = $this->getBanners();
$sr["top"] = $this->getTop();
$sr["middle"] = $this->getMiddle();
$sr["bottom"] = $this->getBottom();
return $this->getReplaceTemplate($sr, "main"
}
abstract protected function getTitle();
abstract protected function getDescription();
abstract protected function getKeywords();
abstract protected function getMiddle();
protected function getMenu() {
$menu = $this->menu->getAll();
for ($i=0; $i < count($menu); $i++) {
$sr["title"] = $menu[$i]["title"];
$sr["link"] = $menu[$i]["link"];
$text .= $this->getReplaceTemplate($sr, "menu_item"
}
return $text;
}
protected function getAuthUser() {
$sr["message_auth"] = "";
return $this->getReplaceTemplate($sr, "form_auth"
}
protected function getBanners() {
$banners = $this->banner->getAll();
for ($i=0; $i < count($banner); $i++) {
$sr["code"] = $banner[$i]["code"];
$text .= $this->getReplaceTemplate($sr, "banner"
}
return $text;
}
protected function getTop() {
return "";
}
protected function getBottom() {
return "";
}
private function secureData($data) {
foreach ($data as $key => $value) {
if(is_array($value)) $this->secureData($value);
else $data[$key] = htmlspecialchars($value);
}
return $data;
}
protected function getTemplate($name) {
$text = file_get_contents($this->config->dir_tmpl.$name.".tpl"
return str_replace("%address%", $this->config->address, $text);
}
protected function getReplaceTemplate($sr, $template) {
return $this->getReplaceContent($sr, $this->getTemplate($template));
}
private function getReplaceContent($sr, $content) {
$search = array();
$replace = array();
$i = 0;
foreach ($sr as $key => $value) {
$search[$i] = $key;
$replace[$i] = $value;
$i++;
}
return str_replace($search, $replace, $content);
}
}
?>
global_class.php
<?php
require_once "config_class.php";
require_once "checkvalid_class.php";
require_once "database_class.php";
abstract class GlobalClass {
private $db;
private $table_name;
protected $config;
protected $valid;
protected function __construct($table_name, $db) {
$this->db = $db;
$this->table_name = $table_name;
$this->config = new Config();
$this->valid = new CheckValid();
}
protected function add($new_values) {
return $this->db->insert($this->table_name, $new_values);
}
protected function edit($id, $upd_fields) {
return $this->db->updateOnID($this->table_name, $id, $upd_fields);
}
public function delete($id) {
return $this->db->deleteOnID($this->table_name, $id);
}
public function deleteAll() {
return $this->db->deleteAll($this->table_name);
}
protected function getField($field_out, $field_in, $value_in) {
return $this->db->getField($this->table_name, $field_out, $field_in, $value_in);
}
protected function getFieldOnID($id, $field, $value) {
return $this->db->getFieldOnID($this->table_name, $id, $field, $value);
}
public function get($id) {
return $this->db->getElementOnID($this->table_name, $id);
}
public function getAll($order = "", $up = true) {
return $this->db->getAll($this->table_name, $order, $up);
}
protected function getAllOnField($field, $value, $order = "", $up = true) {
return $this->db->getAllOnField($this->table_name, $field, $value, $order, $up);
}
public function getRandomElement($count) {
return $this->db->getRandomElement($this->table_name, $count);
}
public function getLastID() {
return $this->db->getLastID($this->table_name);
}
public function getCount() {
return $this->db->getCount($this->table_name);
}
public function isExists($field, $value) {
return $this->db->isExists($this->table_name, $field, $value);
}
}
?>
Вот в чем моя ошибка???
Скажите Пожалуйста