Пример #1
0
 static function getnewkeyimpr($table)
 {
     // better variant
     $result = 1;
     $wd = new wra_db();
     $wd->query = 'select value from ' . WRA_CONF::$db_prefix . "keys where tablename='{$table}'";
     $wd->executereader();
     if ($wd->error == '' && $wd->rows_count != 0) {
         if ($u0 = $wd->read()) {
             $result = $u0[0] + 1;
         }
         $wd->query = "SELECT GetNewKey('{$table}')";
         //echo $wd->query;
         $wd->executereader();
         $u0 = $wd->readresult(0, 0);
         //echo $u0;
         echo 'boom';
         WRA::nicedie();
     } else {
         WRA::insertkey($table);
     }
     $wd->close();
     return $result;
 }
Пример #2
0
 function doedit($wf)
 {
     $thisclass_string = wra_adminmenu::getbaseclass();
     if ($thisclass_string != '') {
         eval('$thisclass=new ' . $thisclass_string . '($wf);');
         if (!true) {
             WRA::gotopage('admin');
             return;
         }
         if (wra_adminpage::isedit()) {
             $backurl = wra_adminmenu::getassoc(WRA::getcurpage());
             if (!WRA::ir('id')) {
                 WRA::gotopage($backurl);
                 WRA::nicedie();
             }
             if (!WRA::ir('type')) {
                 $code = '$isexist=' . $thisclass_string . '::isexist($wf,' . WRA::r('id') . ');';
             } else {
                 $pid_class = wra_adminmenu::getclass(wra_adminmenu::getassoc(WRA::r('mod')) . '_' . WRA::r('type'));
                 //   echo $pid_class;
                 $code = '$isexist=' . $pid_class . '::isexist($wf,' . WRA::r('id') . ');';
             }
             eval($code);
             if (!$isexist && WRA::r('id') != -1) {
                 WRA::gotopage($backurl);
                 WRA::nicedie();
             }
         } else {
             $backurl = WRA::getcurpage();
             if (WRA::ir('pid')) {
                 if (!WRA::ir('type')) {
                     $code = '$isexist=' . $thisclass_string . '::isexist($wf,' . WRA::r('pid') . ');';
                 } else {
                     $pid_class = wra_adminmenu::getclass(WRA::r('mod') . '_' . WRA::r('type'));
                     // echo $pid_class;
                     $code = '$isexist=' . $pid_class . '::isexist($wf,' . WRA::r('pid') . ');';
                 }
                 eval($code);
                 if (!$isexist) {
                     WRA::gotopage($backurl);
                     WRA::nicedie();
                 }
             }
         }
         $this->deletebyId($wf, $thisclass, $thisclass_string);
     }
 }
Пример #3
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();
 }