Example #1
0
 function add()
 {
     //добавление нового объекта
     if (!isset($this->creator_id)) {
         $this->creator_id = wra_userscontext::curuser();
     }
     $wd = new wra_db();
     if (!isset($this->id)) {
         $this->id = WRA::getnewkey('' . WRA_CONF::$db_prefix . 'usersrights');
     }
     $wd->query = "INSERT INTO `" . WRA_CONF::$db_prefix . "usersrights` (\n             `id`,\n             `user_id`,\n             `right_id`\n             )VALUES(\n             '{$this->id}',\n             '{$this->user_id}',\n             '{$this->right_id}'\n             )";
     $wd->execute();
     if (!WRA_CONF::$usegetkey) {
         $this->id = $wd->getlastkey();
     }
     $wd->close();
     unset($wd);
 }
Example #2
0
 function delete()
 {
     //удаление пользователя
     if (wra_userscontext::curuser() != $this->id) {
         $wd = new wra_db($wf);
         $wd->query = 'DELETE FROM `' . WRA_CONF::$db_prefix . "users`\n    \t\t    WHERE `id`='{$this->id}' \n\t\t\t\t    ";
         $wd->execute();
         $wd->close();
         unset($wd);
         return true;
     }
     return false;
 }
Example #3
0
 function add()
 {
     //добавление нового объекта
     if (!isset($this->creator_id)) {
         $this->creator_id = wra_userscontext::curuser();
     }
     $wd = new wra_db();
     $this->id = WRA::getnewkey("" . WRA_CONF::$db_prefix . 'virtualpage');
     $wd->query = "INSERT INTO `" . WRA_CONF::$db_prefix . "virtualpage` (\n `id`,\n `header`,\n `content`,\n `link`,\n `menuid`,\n `infoid`\n )VALUES(\n '{$this->id}',\n '{$this->header}',\n '{$this->content}',\n '{$this->link}',\n '{$this->menuid}',\n '{$this->infoid}'\n )";
     $wd->execute();
     if (!WRA_CONF::$usegetkey) {
         $this->id = $wd->getlastkey();
     }
     $wd->close();
     unset($wd);
     $this->currentobjid = wra_objects::addnewobject("wra_virtualpage", $this->id, $this->objectadres);
 }
Example #4
0
 static function curuser()
 {
     // возвращаем текущего пользователя
     return wra_userscontext::curuser();
 }
Example #5
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();
 }
Example #6
0
 function add()
 {
     //добавление нового объекта
     if (!isset($this->creator_id)) {
         $this->creator_id = wra_userscontext::curuser();
     }
     $reg_date = time();
     $wd = new wra_db();
     $this->id = WRA::getnewkey("" . WRA_CONF::$db_prefix . 'fbu');
     $wd->query = 'INSERT INTO `' . WRA_CONF::$db_prefix . "fbu` (\n             `id`,\n             `userid`,\n             `fbuserid`,\n             `display_name`,\n             `regdate`,\n             `username`,\n             `usersurname`,\n             `link`,\n             `gender`,\n             `photo`,\n             `points`,\n             `access_token`,\n             `email`,\n             `phone`,\n             `adres`,\n             `reg_date`\n             )VALUES(\n             '{$this->id}',\n             '{$this->userid}',\n             '{$this->fbuserid}',\n             '{$this->display_name}',\n             '{$this->regdate}',\n             '{$this->username}',\n             '{$this->usersurname}',\n             '{$this->link}',\n             '{$this->gender}',\n             '{$this->photo}',\n             '{$this->points}',\n             '{$this->access_token}',\n             '{$this->email}',\n             '{$this->phone}',\n             '{$this->adres}',\n             '{$reg_date}'\n             )";
     $wd->execute();
     if (!WRA_CONF::$usegetkey) {
         $this->id = $wd->getlastkey();
     }
     $wd->close();
     // $this->currentobjid = wra_objects::addnewobject('wra_fbu', $this->id, $this->objectadres);
     unset($wd);
 }