Пример #1
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new baseView();
     }
     return self::$instance;
 }
Пример #2
0
 function __construct()
 {
     shitbugs("<b>baseModel:</b> Creating new instance");
     $this->registry = baseRegistry::getInstance();
     $this->dbHandle = mysql_connect(DB_HOST, DB_USER, DB_PASSWD);
     mysql_select_db(DB_NAME);
     // Get names for sections, etc
     if (empty($this->registry->section_byname)) {
         shitbugs("Loading Sections!");
         $result = $this->dbSelect('SELECT * FROM sections');
         while ($section = mysql_fetch_assoc($result)) {
             $section_byname[$section['name']] = $section;
             $section_byid[$section['section_id']] = $section;
         }
         $this->registry->section_byname = $section_byname;
         $this->registry->section_byid = $section_byid;
         $post['section_id'] = "2";
         baseView::makelink('section', $post['section_id'], $this->registry->section_byid[$post['section_id']]['name']);
     }
     if (empty($this->registry->category_byname)) {
         shitbugs("Loading Categories!");
         $result = $this->dbSelect('SELECT * FROM categories');
         while ($category = mysql_fetch_assoc($result)) {
             $category_byname[$category['name']] = $category;
             $category_byid[$category['category_id']] = $category;
         }
         $this->registry->category_byname = $category_byname;
         $this->registry->category_byid = $category_byid;
         $post['section_id'] = "2";
         baseView::makelink('section', $post['section_id'], $this->registry->section_byid[$post['section_id']]['name']);
     }
 }
Пример #3
0
 function __construct($registry)
 {
     $this->registry = $registry;
     $this->model = baseModel::getInstance();
     $this->view = baseView::getInstance();
     $this->request = request::getInstance();
     $this->init();
 }