Esempio n. 1
1
 function __construct($header)
 {
     //TODO use https when loggin in
     // use ssh for login
     //		$host = "https://" . OLIV_SSH_HOST . "/" . OLIV_BASE . "index.php";
     $host = "http://" . system::OLIV_SSH_HOST() . "/" . system::OLIV_BASE() . "index.php";
     // load login content xml
     $this->content = OLIVModule::load_content($header);
     // select template for logged of not logged
     if (status::OLIV_USER()) {
         $header->param->template = "logged";
         $this->content->username = OLIVUser::getName(status::OLIV_USER());
         if (status::OLIV_SU()) {
             $this->content->su = status::OLIV_SU();
         } else {
             $this->content->user_groups = OLIVUser::getGroupName(status::OLIV_USER());
         }
     } else {
         // check if wrong login
         if (argv::action() == "login") {
             $header->param->template = "incorrect";
         }
     }
     // load correct template
     $this->template = OLIVModule::load_template($header);
 }
Esempio n. 2
0
 public function proc()
 {
     //reg::setKey('/users/errorCountCapcha', system::POST('errorCountCapcha'));
     reg::setKey('/users/errorCountBlock', system::POST('errorCountBlock'));
     reg::setKey('/users/reg', system::POST('reg', isBool));
     reg::setKey('/users/activation', system::POST('activation', isBool));
     reg::setKey('/users/confirm', system::POST('confirm', isBool));
     reg::setKey('/users/ask_email', system::POST('ask_email', isBool));
     //авторизация чере соц. сети
     reg::setKey('/users/twitter_bool', system::POST('twitter_bool'), isBool);
     reg::setKey('/users/twitter_id', system::POST('twitter_id'), isString);
     reg::setKey('/users/twitter_secret', system::POST('twitter_secret'), isString);
     reg::setKey('/users/vk_bool', system::POST('vk_bool'), isBool);
     reg::setKey('/users/vk_id', system::POST('vk_id'), isString);
     reg::setKey('/users/vk_secret', system::POST('vk_secret'), isString);
     reg::setKey('/users/ok_bool', system::POST('ok_bool'), isBool);
     reg::setKey('/users/ok_id', system::POST('ok_id'), isString);
     reg::setKey('/users/ok_public', system::POST('ok_public'), isString);
     reg::setKey('/users/ok_secret', system::POST('ok_secret'), isString);
     reg::setKey('/users/facebook_bool', system::POST('facebook_bool'), isBool);
     reg::setKey('/users/facebook_id', system::POST('facebook_id'), isString);
     reg::setKey('/users/facebook_secret', system::POST('facebook_secret'), isString);
     reg::setKey('/users/yandex_bool', system::POST('yandex_bool'), isBool);
     reg::setKey('/users/google_bool', system::POST('google_bool'), isBool);
     ui::MessageBox(lang::get('CONFIG_SAVE_OK'), lang::get('CONFIG_SAVE_OK_MSG'));
     reg::clearCache();
     system::log(lang::get('CONFIG_LOG_SAVE'), warning);
     system::redirect('/users/settings');
 }
Esempio n. 3
0
 static function gallery_shutdown()
 {
     // Every 500th request, do a pass over var/logs and var/tmp and delete old files.
     // Limit ourselves to deleting a single file so that we don't spend too much CPU
     // time on it.  As long as servers call this at least twice a day they'll eventually
     // wind up with a clean var/logs directory because we only create 1 file a day there.
     // var/tmp might be stickier because theoretically we could wind up spamming that
     // dir with a lot of files.  But let's start with this and refine as we go.
     if (!(rand() % 500)) {
         // Note that this code is roughly duplicated in gallery_task::file_cleanup
         $threshold = time() - 1209600;
         // older than 2 weeks
         foreach (array("logs", "tmp") as $dir) {
             $dir = VARPATH . $dir;
             if ($dh = opendir($dir)) {
                 while (($file = readdir($dh)) !== false) {
                     if ($file[0] == ".") {
                         continue;
                     }
                     // Ignore directories for now, but we should really address them in the long term.
                     if (is_dir("{$dir}/{$file}")) {
                         continue;
                     }
                     if (filemtime("{$dir}/{$file}") <= $threshold) {
                         unlink("{$dir}/{$file}");
                         break;
                     }
                 }
             }
         }
     }
     // Delete all files marked using system::delete_later.
     system::delete_marked_files();
 }
Esempio n. 4
0
 public function restore()
 {
     if (system::issetUrl(2) && is_numeric(system::url(2))) {
         // Одиночное востановление
         $obj = new ormObject(system::url(2));
         if ($obj->isInheritor('section')) {
             $obj = new ormPage(system::url(2));
         }
         $obj->restore();
         echo 'delete';
     } else {
         if (isset($_POST['objects'])) {
             // Множественное востановление
             while (list($id, $val) = each($_POST['objects'])) {
                 if (is_numeric($id)) {
                     $obj = new ormObject($id);
                     if ($obj->isInheritor('section')) {
                         $obj = new ormPage($id);
                     }
                     $obj->restore();
                 }
             }
             echo 'delete';
         }
     }
     ormPages::clearCache();
     system::stop();
 }
Esempio n. 5
0
 public static function get($id)
 {
     $class = false;
     if (!empty($id) && !is_array($id)) {
         self::init();
         // Проверяем переданные данные, определяем ID
         if (is_numeric($id)) {
             $id = system::checkVar($id, isInt);
         } else {
             if (!is_array($id)) {
                 $sname = system::checkVar($id, isVarName);
                 if (!empty($sname) && array_key_exists($sname, self::$cl_names)) {
                     $id = self::$cl_names[$sname];
                 }
             }
         }
         // Загрузка класса
         if (is_numeric($id) && isset(self::$classes[$id])) {
             $class = self::$classes[$id];
         } else {
             if (isset(self::$classes_data[$id])) {
                 $class = new ormClass(self::$classes_data[$id]);
                 if (!$class->issetErrors()) {
                     self::$classes[$class->id()] = $class;
                 } else {
                     $class = false;
                 }
             }
         }
     }
     if ($class) {
         return $class;
     }
 }
 public function temp_filename_test()
 {
     $filename = system::temp_filename("file", "ext");
     $this->assert_true(file_exists($filename), "File not created");
     unlink($filename);
     $this->assert_pattern($filename, "|/file.*\\.ext\$|");
 }
Esempio n. 7
0
 function index()
 {
     system::setParam("page", "globalSearch");
     if (!empty($_GET["text"])) {
         $words = htmlspecialchars(addslashes($_GET["text"]));
         $offset = 0;
         if (isset($this->get["offset"])) {
             $offset = intval($this->get["offset"]);
         }
         $cacheID = "SEARCH_RES|{$words}|blogsearchoffset_{$offset}";
         $this->smarty->assign("searchWord", $words);
         if (mb_strlen($words) <= 2) {
             $this->smarty->assign("smallWord", true);
             return false;
         }
         $this->smarty->setCacheID($cacheID);
         if (!$this->smarty->isCached()) {
             $res = search::searchWithType($words, "blog");
             if ($res->getNumRows() > 0) {
                 $posts = $res->fetchAll();
                 $this->smarty->assign("searchRes", $posts);
             }
         }
     } else {
         system::redirect('/');
     }
 }
Esempio n. 8
0
 /**
  * Create full copy of www dir and mysql database
  */
 public function make()
 {
     system::getInstance()->createPrivateDirectory(root . '/backup/');
     $file_mainname = system::getInstance()->toDate(time(), 'd') . "_backup";
     $this->zipCreate(root, root . "/backup/" . $file_mainname . "_www.zip");
     $this->mysqlDump("/backup/" . $file_mainname . "_sql.sql.gz");
 }
Esempio n. 9
0
 public function __construct()
 {
     require_once 'Mobile_Detect.php';
     require_once 'Config.php';
     self::$config = new Config('./etc/config.ini');
     // $this->page = '';
 }
Esempio n. 10
0
 /**
  * Log message to system information. Types: logger::LEVEL_ERR, logger::LEVEL_WARN, logger::LEVEL_NOTIFY
  * @param string $type
  * @param string $message
  */
 public function log($type, $message)
 {
     system::getInstance()->createPrivateDirectory(root . '/log/');
     $iface = defined('loader') ? loader : 'unknown';
     $compile_message = "=>[" . $iface . ":" . $type . "](" . system::getInstance()->toDate(time(), 's') . "): " . $message . "\n";
     @file_put_contents(root . "/log/" . system::getInstance()->toDate(time(), 'd') . ".log", $compile_message, FILE_APPEND | LOCK_EX);
 }
Esempio n. 11
0
 public function rotate($id, $dir)
 {
     access::verify_csrf();
     $item = model_cache::get("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     $degrees = 0;
     switch ($dir) {
         case "ccw":
             $degrees = -90;
             break;
         case "cw":
             $degrees = 90;
             break;
     }
     if ($degrees) {
         $tmpfile = system::temp_filename("rotate", pathinfo($item->file_path(), PATHINFO_EXTENSION));
         gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees), $item);
         $item->set_data_file($tmpfile);
         $item->save();
     }
     if (Input::instance()->get("page_type") == "collection") {
         json::reply(array("src" => $item->thumb_url(), "width" => $item->thumb_width, "height" => $item->thumb_height));
     } else {
         json::reply(array("src" => $item->resize_url(), "width" => $item->resize_width, "height" => $item->resize_height));
     }
 }
Esempio n. 12
0
 private function processSection($keyName, $sectionArray)
 {
     $test = "";
     foreach ($sectionArray as $sectionName => $value) {
         $test = isset($this->core->{$keyName}) ? $this->core->{$keyName} : "";
         if (is_array($value)) {
             $this->processSection($sectionName, $value);
             continue;
         }
         if (method_exists($test, $sectionName)) {
             $test->{$sectionName}($value);
             continue;
         }
         if (isset($this->core->config["{$keyName}Config"])) {
             $this->core->config["{$keyName}Config"][$sectionName] = $value;
             continue;
         }
         $test = isset($this->core->{$keyName}->{$sectionName}) ? $this->core->{$keyName}->{$sectionName} : null;
         if ($test) {
             $this->core->{$keyName}->{$sectionName} = $value;
         } else {
             system::setParam($sectionName, $value);
         }
     }
     //print_r ($conf);
 }
Esempio n. 13
0
 public function proc_upd()
 {
     if (system::issetUrl(2)) {
         $obj = new ormField();
         $obj->setGroupId(system::url(2));
     } else {
         if (system::action() == "proc_upd") {
             $obj = new ormField($_POST['obj_id']);
         } else {
             if (system::action() == "proc_add") {
                 $obj = new ormField();
                 $obj->setGroupId($_POST['obj_id']);
             }
         }
     }
     if (!empty($_POST['fname'])) {
         $obj->setName($_POST['fname']);
     }
     if (!empty($_POST['max_size'])) {
         $obj->setMaxSize($_POST['max_size']);
     } else {
         $obj->setMaxSize(0);
     }
     $obj->setType(0);
     $obj->setInherit(1);
     $obj_id = $obj->save();
     if ($obj_id === false) {
         echo json_encode(array('error' => 1, 'data' => $obj->getErrorListText(' ')));
     } else {
         $tree = new ormFieldsTree();
         $forUpd = system::action() == "proc_add" ? 0 : 1;
         echo json_encode(array('error' => 0, 'data' => $tree->getFieldHTML($obj, $forUpd)));
     }
     system::stop();
 }
Esempio n. 14
0
 function get_slider($limit, $name_file)
 {
     $sql = 'select * from splash where status=1 order by sort limit ' . $limit;
     $result = mysql::query($sql, 0);
     // выполняем tpl
     return system::show_tpl(array('splash' => $result), $name_file);
 }
Esempio n. 15
0
 public function init()
 {
     if (database::getInstance()->isDown() || !property::getInstance()->get('collect_statistic')) {
         return;
     }
     $realip = system::getInstance()->getRealIp();
     $visittime = time();
     $browser = self::user_browser($_SERVER['HTTP_USER_AGENT']);
     $os = self::user_os($_SERVER['HTTP_USER_AGENT']);
     $cookie = $_COOKIE['source'] ?: '';
     $userid = user::getInstance()->get('id');
     if ($userid == null) {
         $userid = 0;
     }
     if ($cookie == null) {
         $settime = $visittime + 365 * 24 * 60 * 60;
         setcookie('source', system::getInstance()->md5random(), $settime, '/');
         $cookie = '';
     }
     $referer = $_SERVER['HTTP_REFERER'] ?: '';
     $path = $_SERVER['REQUEST_URI'] ?: '';
     $query = "INSERT INTO " . property::getInstance()->get('db_prefix') . "_statistic (ip, cookie, browser, os, time, referer, path, reg_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?)";
     $stmt = database::getInstance()->con()->prepare($query);
     $stmt->bindParam(1, $realip, \PDO::PARAM_STR);
     $stmt->bindParam(2, $cookie, \PDO::PARAM_STR, 32);
     $stmt->bindParam(3, $browser, \PDO::PARAM_STR);
     $stmt->bindParam(4, $os, \PDO::PARAM_STR);
     $stmt->bindParam(5, $visittime, \PDO::PARAM_INT);
     $stmt->bindParam(6, $referer, \PDO::PARAM_STR);
     $stmt->bindParam(7, $path, \PDO::PARAM_STR);
     $stmt->bindParam(8, $userid, \PDO::PARAM_INT);
     $stmt->execute();
 }
Esempio n. 16
0
 public function process($page)
 {
     global $_PLUGIN;
     //echoall($page);
     // call plugins
     //		$pageXml = olivxml_create($page,"page");
     if ($page) {
         $pageXml = OLIVPlugin::call(new simpleXmlElement($page), "render");
         //------------------------------------------------------------------------------
         // convert page xml to html
         if (sessionfile_exists(system::OLIV_TEMPLATE_PATH() . "post.xslt")) {
             $postStylesheet = sessionxml_load_file(system::OLIV_TEMPLATE_PATH() . "post.xslt");
         } else {
             OLIVError::fire("postprocessor.php::process - post.xslt file not found");
             die;
         }
         $htmlProcessor = new XSLTProcessor();
         $htmlProcessor->importStylesheet($postStylesheet);
         $pageString = $htmlProcessor->transformToXML($pageXml);
         //echoall($pageXml->asXML());
         //------------------------------------------------------------------------------
         // run markup parser
         $pageString = $this->markup($pageString);
         return $pageString;
     }
 }
Esempio n. 17
0
 public static function writePost($post)
 {
     if (self::postExist("slug", $post["slug"])) {
         system::registerEvent("error", "slug", "Такой адрес поста уже занят", "URL");
     }
     if (!self::checkPostErrors($post)) {
         return false;
     }
     $post["author"] = $_SESSION["user"]["nick"];
     $post["userID"] = $_SESSION["user"]["userID"];
     $content = array();
     foreach ($post as $k => $v) {
         $v = self::$db->escapeString($v);
         $content[$k] = "`{$k}`='{$v}'";
     }
     $content['dt'] = "`dt`='" . date("Y-m-d") . "'";
     $new_picture_name = time();
     file_put_contents(ROOT_PATH . "/content/videoPreview/" . $new_picture_name . '.jpg', file_get_contents($post['pictures']));
     $content['pictures'] = "`pictures`='" . $new_picture_name . ".jpg" . "'";
     unset($content['savePost'], $content['url']);
     //        echo "INSERT INTO `content` SET ".implode (", ", $content);
     //        echo '<pre>'.print_r($post,1).'</pre>';
     //        exit;
     self::$db->query("INSERT INTO `video` SET " . implode(", ", $content));
     $id = self::$db->insert_id();
     self::$smarty->clearCache(null, "MAINPAGE|offset_0");
     self::$smarty->clearCache(null, "mainpage|offset_0");
     self::$smarty->clearCache(null, "MODULE_VIDEO");
     self::$smarty->clearCache(null, "SEARCH_RES");
     self::$smarty->clearCache(null, "RSS");
     return 'test';
 }
 function indexAction()
 {
     if (isset($_POST['check'])) {
         if ($_POST['FORM']['ua'] == 'on') {
             $_POST['FORM']['ua'] = 1;
         } else {
             $_POST['FORM']['ua'] = 0;
         }
         if ($_POST['FORM']['en'] == 'on') {
             $_POST['FORM']['en'] = 1;
         } else {
             $_POST['FORM']['en'] = 0;
         }
         if ($_POST['FORM']['fr'] == 'on') {
             $_POST['FORM']['fr'] = 1;
         } else {
             $_POST['FORM']['fr'] = 0;
         }
         if ($_POST['FORM']['esp'] == 'on') {
             $_POST['FORM']['esp'] = 1;
         } else {
             $_POST['FORM']['esp'] = 0;
         }
         if ($_POST['FORM']['ger'] == 'on') {
             $_POST['FORM']['ger'] = 1;
         } else {
             $_POST['FORM']['ger'] = 0;
         }
         forms::multy_update_form($this->tablename, 1, 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
     }
     $sql = "SELECT * FROM languages";
     $res = mysql::query_one($sql, 0);
     return system::show_tpl(array('obj' => $res, 'msg' => $this->msg, '_status' => isset($_POST['status']) ? $_POST['status'] : 2, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/index.php');
 }
Esempio n. 19
0
 public function proc()
 {
     reg::setKey(ormPages::getPrefix() . '/minitext');
     function changeText($id, $obj)
     {
         if (!empty($id)) {
             reg::setKey($id, $obj['text'], $obj['description']);
         } else {
             if (!empty($obj['text'])) {
                 reg::addToList(ormPages::getPrefix() . '/minitext', $obj['text'], $obj['description']);
             }
         }
         return true;
     }
     function delText($id)
     {
         reg::delKey($id);
     }
     $form = new uiMultiForm('change');
     $form->process('changeText', 'delText');
     ormPages::clearCache();
     if ($_POST['parram'] == 'apply') {
         system::redirect('/structure/minitext');
     } else {
         if ($_SESSION['STRUCTURE_LIST_FLAG']) {
             system::redirect('/structure/list');
         } else {
             system::redirect('/structure/tree');
         }
     }
 }
Esempio n. 20
0
 private static function init()
 {
     if (empty(self::$cur_lang)) {
         $lang_id = reg::getKey('/core/cur_lang/id');
         if (!empty($lang_id)) {
             // Если язык в системе один, загружаем его данные из реестра
             $lang_prefix = reg::getKey('/core/cur_lang/prefix');
             self::$langs[$lang_id] = array('l_id' => $lang_id, 'l_name' => reg::getKey('/core/cur_lang/name'), 'l_prefix' => $lang_prefix, 'id' => $lang_id);
             self::$langs_rel[$lang_prefix] = $lang_id;
         } else {
             // Языков много, определяем язык по URL`y
             if (system::issetUrl(0) && strlen(system::url(0)) < 6) {
                 self::$cur_lang = self::get(system::url(0));
                 if (self::$cur_lang instanceof language) {
                     system::clipUrl();
                     self::$isCliped = true;
                 }
             }
         }
         if (!self::$cur_lang instanceof language) {
             self::$cur_lang = self::get(domains::curDomain()->getDefLang());
         }
         if (!self::$cur_lang instanceof language) {
             die('не могу определить язык');
         }
     }
 }
Esempio n. 21
0
 static function tpl($group = 'home')
 {
     //基本配置
     $tpl = self::get_instance();
     self::process_view_config($group, $tpl);
     //网站元信息
     $tpl->assign(config(null, 'site'));
     //设置目录常量
     $tpl->assign('url', U_R_L);
     $dir_data = system::set_url_dir(true);
     $tpl->assign('dir', $dir_data);
     //注册全局组件
     foreach (array('function', 'modifier') as $type) {
         $class = 'p_' . $type;
         include PATH_ROOT . 'plugin/' . $class . '.php';
         if (class_exists($class)) {
             $method_data = get_class_methods($class);
             foreach ($method_data as $method) {
                 $tpl->registerPlugin($type, $method, array($class, $method));
             }
         }
     }
     //处理分组业务
     if (defined('GROUP_NAME')) {
         self::process_group($tpl);
     }
     return $tpl;
 }
Esempio n. 22
0
 public function defAction()
 {
     // Формируем список классов для быстрого добавления
     $types = ormClasses::get('user')->getAllInheritors();
     if (count($types) > 1) {
         $class_list = '';
         while (list($id, $name) = each($types)) {
             $bclass = ormClasses::get($id);
             $class_list .= '<li><a href="' . system::au() . '/users/user_add/0/' . $bclass->getSName() . '" >' . $bclass->getName() . '</a></li>';
         }
         $java = '<script> $("#usel").parent().css("width", "150px"); </script>';
         ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add", 'class_list', '<ul id="usel">' . $class_list . '</ul>' . $java);
     } else {
         ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add");
     }
     ui::newButton(lang::get('BTN_NEW_UGROUP'), "/users/group_add");
     $sel = new ormSelect('user_group');
     $sel->orderBy('name', asc);
     $table = new uiTable($sel);
     $table->showSearch(true);
     $table->addColumn('name', lang::get('USERS_TABLE_FIELD_5'), 0, true);
     $table->addColumn('children', lang::get('USERS_TABLE_FIELD_6'), 0, true, true, 'count');
     $table->defaultRight('userlist');
     $table->addRight('userlist', 'users', single);
     $table->addRight('group_upd', 'edit', single);
     $table->addRight('group_act', 'active', multi);
     $table->addRight('group_del', 'drop', multi);
     $table->setDelMessage(lang::get('USERS_DEL_TITLE2'), lang::get('USERS_DEL_TEXT2'));
     $table->setMultiDelMessage(lang::get('USERS_DEL_TITLE_MULTI2'), lang::get('USERS_DEL_TEXT_MULTI2'));
     return $table->getHTML();
 }
Esempio n. 23
0
 /**
  * Check if user is permament banned in database and display ban.tpl theme
  */
 public function init()
 {
     $ip = system::getInstance()->getRealIp();
     $time = time();
     $userid = user::getInstance()->get('id');
     if ($userid > 0) {
         $stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE (user_id = ? or ip = ?) AND (express > ? OR express = 0)");
         $stmt->bindParam(1, $userid, \PDO::PARAM_INT);
         $stmt->bindParam(2, $ip, \PDO::PARAM_STR);
         $stmt->bindParam(3, $time, \PDO::PARAM_INT);
         $stmt->execute();
     } else {
         $stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE ip = ? AND (express > ? OR express = 0)");
         $stmt->bindParam(1, $ip, \PDO::PARAM_STR);
         $stmt->bindParam(2, $time, \PDO::PARAM_INT);
         $stmt->execute();
     }
     $rowFetch = $stmt->fetch();
     $count = $rowFetch[0];
     if ($count > 0) {
         // block founded in db
         $content = template::getInstance()->twigRender('ban.tpl', array('local' => array('admin_email' => property::getInstance()->get('mail_from'))));
         template::getInstance()->justPrint($content);
     }
 }
Esempio n. 24
0
 function indexAction()
 {
     // товары
     $this->catalog_status = mysql::query_findpole('select status from menu where id=59', 'status');
     $this->catalog_inctive = dbh::get_count_status_off('catalog');
     // заказы
     $this->order_inctive = dbh::get_count_status_off('order_number');
     // отзывы
     $this->gb_status = mysql::query_findpole('select status from menu where id=8', 'status');
     $this->gb_inctive = dbh::get_count_status_off('guestbook');
     // новости
     $this->news_status = mysql::query_findpole('select status from menu where id=1', 'status');
     $this->news_inctive = dbh::get_count_status_off('news');
     // комментарии к новостям
     $this->news_gb_status = mysql::query_findpole('select status from menu where id=232', 'status');
     $this->news_gb_inctive = dbh::get_count_status_off('news_gb');
     // пользователи
     $this->users_status = mysql::query_findpole('select status from menu where id=26', 'status');
     $this->users_inctive = dbh::get_count_status_off('users');
     // контентовые разделы
     $this->content_status = mysql::query_findpole('select status from menu where id=89', 'status');
     // галерея
     $this->gallery_status = mysql::query_findpole('select status from menu where id=3', 'status');
     // голосование
     $this->voting_status = mysql::query_findpole('select status from menu where id=102', 'status');
     // настройки
     $this->config_status = mysql::query_findpole('select status from menu where id=80', 'status');
     // CEO
     $this->ceo_status = mysql::query_findpole('select status from menu where id=11', 'status');
     return system::show_tpl((array) $this, 'mainmenu/mainpage.php');
 }
Esempio n. 25
0
 public static function writePost($post)
 {
     if (self::postExist("slug", $post["slug"])) {
         system::registerEvent("error", "slug", "Такой адрес поста уже занят", "URL");
     }
     if (!self::checkPostErrors($post)) {
         return false;
     }
     unset($post['savePost']);
     $post["author"] = $_SESSION["user"]["nick"];
     $post["userID"] = $_SESSION["user"]["userID"];
     $content = array();
     foreach ($post as $k => $v) {
         $v = self::$db->escapeString($v);
         $content[$k] = "`{$k}`='{$v}'";
     }
     $content['dt'] = "`dt`='" . date("Y-m-d") . "'";
     self::$db->query("INSERT INTO `photo` SET " . implode(", ", $content));
     $id = self::$db->insert_id();
     self::$smarty->clearCache(null, "MAINPAGE|offset_0");
     self::$smarty->clearCache(null, "mainpage|offset_0");
     self::$smarty->clearCache(null, "MODULE_PHOTO");
     self::$smarty->clearCache(null, "SEARCH_RES");
     self::$smarty->clearCache(null, "RSS");
     return $id;
 }
Esempio n. 26
0
 public static function start()
 {
     system::$display = false;
     header("Content-Type: text/xml, charset=utf-8");
     // IE cache fix
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Pragma: no-cache");
 }
Esempio n. 27
0
 public function criticalError()
 {
     if (!empty($this->coreErrors)) {
         system::setParam("page", "coreErrorPage");
         return $this->coreErrors;
     }
     return false;
 }
Esempio n. 28
0
 public static function getInstance($dbconn, $system_id = null)
 {
     if (!isset(self::$instance)) {
         $className = __CLASS__;
         self::$instance = new $className($dbconn, $system_id = null);
     }
     return self::$instance;
 }
Esempio n. 29
0
 public function defAction()
 {
     $file = @fopen(ROOT_DIR . "/revue.log", "w");
     @fclose($file);
     db::q('DELETE FROM <<revue>>');
     echo 'delete';
     system::stop();
 }
Esempio n. 30
0
 /**
  * Return the path to the gs binary if one exists and is executable, or null.
  * (ref: movie::find_ffmpeg())
  */
 static function find_gs()
 {
     if (!($gs_path = module::get_var("pdf", "gs_path")) || !@is_executable($gs_path)) {
         $gs_path = system::find_binary("gs", module::get_var("gallery", "graphics_toolkit_path"));
         module::set_var("pdf", "gs_path", $gs_path);
     }
     return $gs_path;
 }