Ejemplo n.º 1
0
 function wf()
 {
     $this->models = WRA_ENV::models();
     for ($i = 0; $i < count($this->models); $i++) {
         require_once WRA_Path . '/' . $this->models[$i]->path;
     }
     $this->routes = wfroute::routetable();
     if (session_id() == '') {
         session_start();
     }
     if (WRA_CONF::$offline == 1) {
         WRA::e(WRA_CONF::$offline_text);
         WRA::nicedie();
     }
     $this->opendb();
     //$this->languages=wra_lang::getlist();
     // $this->loadoptions();
     // $this->options = wra_options::loadoptions();
     $this->cp = new wra_page();
     $this->isloged = wra_userscontext::isloged($this);
     if ($this->isloged) {
         $this->user = new wra_users();
         $userid = wra_userscontext::curuser();
         $this->user->load($userid);
         // WRA::debug($this->user);
     }
     $this->requestedpage = strtolower(WRA::getfullnoquestion());
     $this->requestedpage = ltrim(rtrim(str_replace(WRA_CONF::$rootpath, '', $this->requestedpage), '/'), '/');
     if ($this->requestedpage == '') {
         $this->requestedpage = 'index';
     }
     //$meta = new wra_meta();
     //$meta->getbypage($this->requestedpage);
     // WRA::debug($this->requestedpage);
     /*   
          if (!empty($meta->id)) {
              $this->cp->keywords = $meta->meta_keywords;
              $this->cp->description = $meta->meta_description;
              $this->cp->ogimage = $meta->og_image;
          } else {
              $this->cp->keywords = WRA_CONF::$keywords;
              $this->cp->description = WRA_CONF::$description;
              $this->cp->ogimage = WRA::base_url()."images/post.png";                            
          }
     */
     $cachename = 'link_' . $this->realpage . $this->cp->language;
     if (!wra_cacheflow::cacheexist($cachename)) {
         $this->realpage = $this->requestedpage;
         $this->ext0 = WRA::file_extension($this->requestedpage);
         $fileextimage = array('jpg', 'jpeg', 'png', 'gif');
         if (in_array($this->ext0, $fileextimage)) {
             WRA::htmlpic('/images/pixel.png');
             $this->nicedie();
         }
     } else {
         $this->requestedpage = 'proj';
     }
     if ($this->is404()) {
         $this->set404();
     } else {
         header('Status: 200 OK');
         if ($this->requestedpage == '/contacts' || strpos($this->requestedpage, 'admin') >= 0) {
             $this->caching = false;
         }
         $cachename = 'link_' . $this->realpage . $this->cp->language;
         $cache0 = new wra_cacheflow($cachename, $this->caching);
         if ($cache0->begin()) {
             $this->prepare();
             if (!$this->item->dont) {
                 if (!$this->item->noheader) {
                     if (!empty($meta->id)) {
                         $this->cp->pagehead = $meta->title;
                     }
                     include 'template/parts/_header.php';
                 }
                 $this->show();
                 if (!$this->item->nofooter) {
                     include 'template/parts/_footer.php';
                 }
             }
         }
         $cache0->end();
     }
     $this->closedb();
 }