当前位置: 首页>>代码示例>>PHP>>正文


PHP system类代码示例

本文整理汇总了PHP中system的典型用法代码示例。如果您正苦于以下问题:PHP system类的具体用法?PHP system怎么用?PHP system使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了system类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gallery_shutdown

 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();
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:34,代码来源:gallery_event.php

示例2: proc

 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');
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:29,代码来源:__settings.php

示例3: get

 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;
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:34,代码来源:ormClassesCollection.php

示例4: restore

 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();
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:28,代码来源:__object.php

示例5: index

 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('/');
     }
 }
开发者ID:ygres,项目名称:sblog,代码行数:27,代码来源:search.php

示例6: temp_filename_test

 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\$|");
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:7,代码来源:System_Helper_Test.php

示例7: make

 /**
  * 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");
 }
开发者ID:ZerGabriel,项目名称:ffcms,代码行数:10,代码来源:dumper.class.php

示例8: rotate

 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));
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:27,代码来源:quick.php

示例9: log

 /**
  * 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);
 }
开发者ID:ZerGabriel,项目名称:ffcms,代码行数:12,代码来源:logger.class.php

示例10: processSection

 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);
 }
开发者ID:ygres,项目名称:sblog,代码行数:26,代码来源:class.config.php

示例11: proc_upd

 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();
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:35,代码来源:__separator.php

示例12: get_slider

 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);
 }
开发者ID:AngelWayfarer,项目名称:prizvanie,代码行数:7,代码来源:splash.class.php

示例13: __construct

 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);
 }
开发者ID:nibble-arts,项目名称:oliv,代码行数:26,代码来源:login.php

示例14: init

 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();
 }
开发者ID:ZerGabriel,项目名称:ffcms,代码行数:33,代码来源:robot.class.php

示例15: process

 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;
     }
 }
开发者ID:nibble-arts,项目名称:oliv,代码行数:26,代码来源:postprocessor.php


注:本文中的system类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。