Example #1
0
 /**
  * 渲染表单主函数
  * @param $field            字段
  * @param $type             类型
  * @param int $parent       父级  //对内容无用
  * @param int $catid        栏目ID
  * @param string $action    行为
  * @param bool $id          内容的ID
  */
 public function fieldToForm($field, $type, $parent = 0, $catid = 0, $action = 'add', $id = false)
 {
     $field = model()->stripslashes($field);
     if ($action == 'edit') {
         if ($type == 'category' || $type == 'page') {
             $category = model('category')->where('cid', $catid)->getOne('catetable,catid');
             $cid = $catid;
             $catid = $category['catid'];
             //转存cid
             $catetable = $category['catetable'];
             $content = model('category')->leftJoin($catetable, $catetable . '.id', 'category.catid')->where(Config::database('table_pre') . 'category.catid', $catid)->where(Config::database('table_pre') . 'category.cid', $cid)->getOne();
             $this->content = model()->stripslashes($content);
             unset($content);
         } elseif ($type == 'content') {
             $category = model('category')->where('cid', $catid)->getOne('contable,catid,show_view');
             //var_dump($category);
             $contable = $category['contable'];
             $content = model($contable)->where('id', $id)->getOne();
             if (empty($content)) {
                 $content['show_view'] = $category['show_view'];
             }
             $this->content = model()->stripslashes($content);
             $this->content['show_view'] = $this->content['template'];
             unset($this->content['template']);
         }
     }
     //var_dump($field);
     $form = '<table class="control-group"><tbody>';
     if ($type == 'category' || $type == 'page') {
         $form .= $this->select_category($parent);
     }
     foreach ($field as $ff) {
         $ff = model('model_field')->parseSetting($ff);
         if ($ff['formtype'] == 'text') {
             $form .= $this->text($ff);
         } elseif ($ff['formtype'] == 'textarea') {
             $form .= $this->textarea($ff);
         } elseif ($ff['formtype'] == 'title') {
             $form .= $this->text($ff);
         } elseif ($ff['formtype'] == 'editor') {
             $form .= $this->editor($ff);
         } elseif ($ff['formtype'] == 'picture') {
             $form .= $this->picture($ff);
         } elseif ($ff['formtype'] == 'pictures') {
             $form .= $this->pictures($ff);
         } elseif ($ff['formtype'] == 'file') {
             $form .= $this->file($ff);
         } elseif ($ff['formtype'] == 'files') {
             $form .= $this->files($ff);
         } elseif ($ff['formtype'] == 'date') {
             $form .= $this->date($ff);
         } elseif ($ff['formtype'] == 'areaSelect') {
             $form .= $this->areaSelect($ff);
         } else {
             echo $ff['formtype'] . '不存在!';
         }
     }
     $form .= $this->template($type, $catid);
     echo $form .= '</table>';
 }
Example #2
0
 public static function get_instance()
 {
     if (self::$instance === NULL) {
         self::$instance = new PDO('mysql:host=' . Config::database_server() . ';dbname=' . Config::database(), Config::database_username(), Config::database_password(), array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8, character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'"));
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         self::$instance->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
     }
     return self::$instance;
 }
Example #3
0
 public static function init()
 {
     if (!isset(self::$bInit)) {
         $data = parse_ini_file(BASE_DIR . '/admin/configuration.ini', true);
         self::$database = (object) $data['database'];
         self::$settings = (object) $data['settings'];
         self::$bInit = 'y';
     }
 }
Example #4
0
 function connect()
 {
     $mysqli = mysqli_connect(Config::database('host') . ':' . Config::database('port'), Config::database('user'), Config::database('pass'), Config::database('name'));
     if ($mysqli->connect_error) {
         Debug::add('连接数据库失败:<font color=red>' . $mysqli->connect_error . '</font>');
         exit('连接数据库失败:<font color=red>' . $mysqli->connect_error . '</font>');
     } else {
         $this->mysqli = $mysqli;
         $this->exec('set names ' . Config::database('charset'));
         return true;
     }
 }
Example #5
0
 static function load($config = array())
 {
     self::$config = $config;
     self::$mode = $config['mode'];
     self::$appsDir = $config['appsDir'];
     self::$pluginsDir = $config['pluginsDir'];
     self::$helpersDir = $config['helpersDir'];
     self::$mainApp = $config['mainApp'];
     self::$disabledApps = $config['disabledApps'];
     self::$database = $config['database'];
     self::init();
 }
Example #6
0
 public function __construct($connection = 'default')
 {
     $config = Config::database();
     $this->config = $config[$connection];
     $driverNamespace = 'Drivers\\Database\\' . ucwords($this->config['driver']);
     if (isset($this->config['pdo'])) {
         if ($this->config['pdo']) {
             $driverNamespace = 'Drivers\\Database\\PanadaPDO';
         }
     }
     $this->driver = new $driverNamespace($this->config, $connection);
 }
Example #7
0
 function connect()
 {
     $con = @mysql_connect(Config::database('host') . ':' . Config::database('port'), Config::database('user'), Config::database('pass'));
     if ($con) {
         $r = mysql_select_db(Config::database('name'), $con) or Debug::add('连接数据库失败:<font color=red>' . mysql_error() . '</font>');
         if ($r === true) {
             $this->con = $con;
             $this->exec('set names ' . Config::database('charset'));
             return true;
         }
     } else {
         Debug::add('连接Mysql服务器失败:,' . mysql_error());
     }
     return false;
 }
Example #8
0
 public function connect()
 {
     try {
         $this->db = new pdo(config::database('DSN'), Config::database('user'), Config::database('pass'));
         $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         Debug::add('<font color="red">' . $e->getMessage() . '</font>');
     }
     if (!$this->db) {
         return false;
     } else {
         $this->exec('set names ' . Config::database('charset'));
         return true;
     }
 }
 public function initialize()
 {
     Config::database();
     //加载数据库配置
     Loader::func('gouwanmei');
     //引入全局函数
     Config::set(array('cache' => 1), 'database');
     if (!isset($_SERVER['REQUEST_URI'])) {
         $_SERVER['REQUEST_URI'] = '';
     }
     //var_dump($_SERVER);
     $this->cacheKey = $_SERVER['REQUEST_URI'];
     //获取站点配置
     $setting = model('website')->where('siteid', 1)->getOne();
     $this->setting = $setting;
     $data['SEO'] = array();
     $data['SEO']['title'] = $setting['title'];
     $data['SEO']['keywords'] = $setting['keywords'];
     $data['SEO']['description'] = $setting['description'];
     $template = $setting['template'];
     //站点配置中的前台模板
     $data['website'] = $setting;
     $data['page'] = isset($_GET['page']) ? $_GET['page'] : 1;
     $data['user'] = Module('member')->isLogin($data['website']['membertokentype']);
     //用户登录状态
     $this->assign($data);
     unset($setting);
     Config::template();
     //载入模板配置,防止将所有的配置替换
     //==配置模板风格和静态缓存生存时间
     //==配置模板风格和静态缓存生存时间
     Config::set(array('view_name' => $template, 'template_parse' => 'template_parse', 'view_cache' => Config::cms('view_cache'), 'leftDelim' => Config::cms('tpl_leftDelim'), 'rightDelim' => Config::cms('tpl_rightDelim'), 'img_path' => Config::cms('img_path'), 'js_path' => Config::cms('js_path'), 'css_path' => Config::cms('css_path')), 'template');
     //如果使用手机进入则会用mobile模板
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         if (preg_match('/mobile/i', $_SERVER['HTTP_USER_AGENT'])) {
             Config::set(array('view_name' => 'mobile'), 'template');
         }
     }
     Config::set(array('debug' => Config::cms('debug')), 'config');
 }
Example #10
0
 protected function desc($table_name)
 {
     return $this->execute('SHOW TABLES FROM `' . Config::database()->schema . '` LIKE \'' . $table_name . '\';')->fetchAll();
     // return $this->execute('DESCRIBE `' . $table_name . '`;')->fetchAll();
 }
Example #11
0
 public function getConfigParams()
 {
     //$doctype_str = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
     $doctype_str = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
     self::$doctype = $doctype_str;
     $godaddy_analytics_str = "<!--GODADDY ANALYTICS:--><script type=\"text/javascript\">\nvar gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTracker(\"UA-15905158-1\");\npageTracker._trackPageview();\n} catch(err) {}\n</script>\n<script type=\"text/JavaScript\">var TFN='';var TFA='';var TFI='0';var TFL='0';var tf_RetServer=\"rt.trafficfacts.com\";\nvar tf_SiteId=\"14120g9493f85cbde65e99dd8c83e9c3f3473b29529d1fh10\";\nvar tf_ScrServer=document.location.protocol+\"//rt.trafficfacts.com/tf.php?k=14120g9493f85cbde65e99dd8c83e9c3f3473b29529d1fh10;c=s;v=5\";\ndocument.write(unescape('%3Cscript type=\"text/JavaScript\" src=\"'+tf_ScrServer+'\">%3C/script>'));</script>\n<noscript>\n<img src=\"http://rt.trafficfacts.com/ns.php?k=14120g9493f85cbde65e99dd8c83e9c3f3473b29529d1fh10\" height=\"1\" width=\"1\" alt=\"\"/>\n</noscript>";
     $google_analytics_str = "<!--GOOGLE ANALYTICS:--><script type=\"text/javascript\">\n  var _gaq = _gaq || [];\n  _gaq.push(['_setAccount', 'UA-15905158-1']);\n  _gaq.push(['_trackPageview']);\n\n  (function() {\n    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n  })();\n</script>";
     self::$docroot = $_SERVER['DOCUMENT_ROOT'];
     if (self::$server_name == 'twextra') {
         self::$godaddy_analytics = $godaddy_analytics_str;
         self::$google_analytics = '';
         self::$hostname = "http://twextra.com";
         //self::$cookie_name = "tw_tok";
         self::$cookie_name = "tw_user_id";
         self::$hostdb = '173.201.185.107';
         self::$database = 'twextra';
         self::$userdb = 'twextra';
         self::$pwdb = 'Spearmint1';
         self::$linkedin_access = 'U6zyYyGUwE5o0zvIkMnGosw2WpQusl-Pa4JNQyIy9IDdsDLKdp2by6qzwFM7H6Rv';
         //linkedin-twextra
         self::$linkedin_secret = 'GB-ssm8NUpUVD2h1X2dNxv2eESi8Tgc57hxciklT8-KsSPwNC9KcbOP1drSHSNUL';
         //linkedin-twextra
         self::$consumer_key = 'OIWt7zoGUChqHkELTyYx8g';
         //twitter-twextra
         self::$consumer_secret = 'oqLgz87EFUCNZYxNr7yEeZqHwTTPwv4CcwWS2K7YIg';
         //twitter-twextra
         self::$oauth_callback = self::$hostname . "/twitter/page2.php";
         //twitter-twextra
         self::$fb_app_id = '144934438868111';
     } else {
         if (self::$server_name == 'twetest') {
             self::$godaddy_analytics = '';
             self::$google_analytics = '';
             self::$hostname = "http://twetest.com";
             //self::$cookie_name = "tw_tok";
             self::$cookie_name = "tw_user_id";
             self::$hostdb = '173.201.217.33';
             self::$database = 'twetest';
             self::$userdb = 'twetest';
             self::$pwdb = 'Spearmint1';
             self::$linkedin_access = 'YMKaHlPF6xv8YTMs_FftnoC1tq_0Fgoz9Y8me0PvcR1Sm9WxzuPI18hZr2yP3fFq';
             //linkedin-twetest
             self::$linkedin_secret = 'PuKdmBOQFdR1vibAe0LX3yRkKhu-NWlZaqC3EwnsiiMw1OL0EZ_J_rmh5PjzHXfg';
             //linkedin-twetest
             self::$consumer_key = 'JBRzgN0LeUJFzCo2K1koGw';
             //twitter-twetest
             self::$consumer_secret = '1DuqRvKXXGHSs77XlkYFUiIqWaL0XFgymL1iprZV8';
             //twitter-twetest
             self::$oauth_callback = self::$hostname . "/twitter/page2.php";
             //twitter-twetest
             self::$fb_app_id = '138321036207048';
             //$auth_header = header('WWW-Authenticate: Basic realm="My Realm"',true,401); //
             //self::$doctype = $auth_header.self::$doctype; //
         } else {
             exit("Error: server not found");
         }
     }
     //..........................................................................
     if (isset($_SESSION['useragent']) && $_SESSION['useragent'] == 'device') {
         self::$css = "/scripts/main.css";
         //docroot not included for href tags..
     } else {
         self::$css = "/scripts/main.css";
         //docroot not included for href tags..
     }
     //.............................................................................
     //..........................................................................
     self::$footer = '';
     self::$footer .= "\n<div class='footer'>\nViewista, Inc. &#169; 2010  <br /> \n<a href='http://twitter.com/twextradotcom'>Follow On Twitter</a> |\n<a href='" . self::$hostname . "/contact.php'>Contact</a> |\n<a href='" . self::$hostname . "/about.php'>About</a> |\n<a href='" . self::$hostname . "/privacy.php'>Privacy Policy</a> |\n<a href='" . self::$hostname . "/terms.php'>Terms</a> |\n<a href='" . self::$hostname . "/faqs.php'>FAQs</a> |\n<a href='http://twitter.com/twextradotcom'>Blog</a> |\n<a href='" . self::$hostname . "/api_support.php'>API Support</a>\n</div>";
     //..........................................................................
     $config_params = array('debug' => self::$debug, 'docroot' => self::$docroot, 'watch_demo' => self::$watch_demo, 'tweet_size_max' => self::$tweet_size_max, 'tweet_size_max_google' => self::$tweet_size_max_google, 'session_time_max' => self::$session_time_max, 'prefix_size_max' => self::$prefix_size_max, 'doctype' => self::$doctype, 'html_attribute' => self::$html_attribute, 'google_analytics' => self::$google_analytics, 'godaddy_analytics' => self::$godaddy_analytics, 'hostname' => self::$hostname, 'cookie_name' => self::$cookie_name, 'hostdb' => self::$hostdb, 'database' => self::$database, 'userdb' => self::$userdb, 'pwdb' => self::$pwdb, 'linkedin_access' => self::$linkedin_access, 'linkedin_secret' => self::$linkedin_secret, 'consumer_key' => self::$consumer_key, 'consumer_secret' => self::$consumer_secret, 'oauth_callback' => self::$oauth_callback, 'css' => self::$css, 'docroot' => $_SERVER['DOCUMENT_ROOT'], 'footer' => self::$footer, 'twitter_embedded_token_max' => self::$twitter_embedded_token_max, 'ep4' => self::$ep4, 'fb_app_id' => self::$fb_app_id);
     return $config_params;
 }
Example #12
0
 public final function query($sql = false)
 {
     if (!$sql) {
         $this->compile();
     }
     $sql = $sql ? $sql : $this->sql;
     //print_r($this);
     //echo Config::database('table_pre').Config::cache('table');
     if (Config::database('cache') && preg_match('/^SELECT/i', $sql) && (Config::database('table_pre') . Config::cache('table') != $this->table || Config::cache('driver') != 'dbCache')) {
         //echo '开启缓存';
         if (!Cache::is_cache(md5($sql), Config::database('cache_dir') . '/' . $this->section['table'])) {
             $data = $this->_query($sql);
             $cdata = '<?php exit;/*' . serialize($data) . '*/';
             Cache::set(md5($sql), $cdata, Config::database('cache_dir') . '/' . $this->section['table']);
             //Cache::$cache->writeCache($sql,$data,(Config::database('cache_dir').'/'.$this->section['table']));
             Debug::add('DB:Update Cache ' . $sql, 2);
         } else {
             //$data=Cache::$cache->readCache($sql,(Config::database('cache_dir').'/'.$this->section['table']));
             $data = unserialize(substr(Cache::get(md5($sql), Config::database('cache_dir') . '/' . $this->section['table']), 13, -2));
             //exit();
             Debug::add('DB:Read Cache' . $sql, 2);
         }
         $this->_reset();
         if ($data == null) {
             //防止直接返回Null
             $data = array();
         }
         return $data;
     } else {
         Debug::add($sql, 2);
         $this->_reset();
         $data = $this->_query($sql);
         if ($data == null) {
             //防止直接返回Null
             $data = array();
         }
         return $data;
     }
 }
Example #13
0
 /**
  * 获取一个栏目
  * @param $cid
  * @return mixed
  */
 public function category($cid)
 {
     //===判断是否已经放入内存
     if (isset($this->category[$cid])) {
         return $this->category[$cid];
     }
     $category = model('category')->where('cid', intval($cid))->getOne('catetable,cat_modelid');
     $catetable = $category['catetable'];
     $mid = $category['cat_modelid'];
     if (empty($catetable)) {
         return array();
     }
     $category = model($catetable)->leftJoin('category', $catetable . '.id', 'category.catid')->where(Config::database('table_pre') . 'category.cid', intval($cid))->getOne();
     if (empty($category)) {
         return array();
     }
     $parent = $category['parent'];
     $view = $this->getCatView($category, $mid);
     $category = model('model_field')->parse($mid, $category);
     $category['pid'] = $parent;
     unset($parent);
     $category['cid'] = $cid;
     $category['view'] = $view;
     unset($view);
     $category['url'] = $this->getCategoryUrl($cid, $mid);
     $this->category[$category['cid']] = $category;
     return $category;
 }
Example #14
0
 public function table($table = '')
 {
     $this->db->table = Config::database('table_pre') . Config::database($table);
     return $this;
 }
 public function delete_field($fid)
 {
     if (is_array($fid)) {
         foreach ($fid as $id) {
             return $this->delete_field($id);
         }
     } else {
         $field = $this->where('fieldid', intval($fid))->leftJoin('model', 'model.modelid', 'model_field.modelid')->getOne(array('model.tablename as tablename', 'model_field.name as fieldname', 'model_field.is_system as is_system'));
         if ($field['is_system'] == 1) {
             return false;
         }
         //print_r($field);
         $table = Config::database('table_pre') . 'module_' . $field['tablename'];
         $sql = 'ALTER TABLE ' . $table . ' DROP COLUMN ' . $field['fieldname'];
         if ($this->exec($sql) !== false) {
             return $this->where('fieldid', intval($fid))->delete();
         } else {
             return false;
         }
     }
     return true;
 }
Example #16
0
 /**
  * 获取可以添加子栏目的栏目
  * @param int $catid
  * @param int $n
  * @return string
  */
 public function select_category_option1($catid = 0, $n = -1)
 {
     $category = model('category')->leftjoin('model', 'model.modelid', 'category.cat_modelid')->where(Config::database('table_pre') . 'category.parent', $catid)->where(Config::database('table_pre') . 'model.is_page', 0)->orderby('category.listorder asc')->query();
     //首先获取到栏目
     $ii = 0;
     $options = '';
     $n++;
     foreach ($category as $cate) {
         $ii++;
         $options .= '<option value="' . $cate['cid'] . '">';
         for ($i = 0; $i < $n; $i++) {
             if ($i > 0) {
                 $options .= '┃';
             } else {
                 $options .= '&nbsp;';
             }
         }
         $cate['catname'] = model($cate['catetable'])->where('id', $cate['catid'])->getOne('catname');
         $cate['catname'] = $cate['catname'][0];
         if ($n != 0) {
             $options .= count($category) == $ii ? '┗' : '┣';
         }
         $options .= ' ' . $cate['catname'] . '</option>';
         $cate['children'] = !is_null($cate['children']) ? unserialize($cate['children']) : array();
         if (!empty($cate['children'])) {
             $options .= $this->select_category_option1(intval($cate['cid']), $n);
         }
     }
     return $options;
 }
Example #17
0
                    <td class="text-right">缓存驱动:</td>
                    <td colspan="2" class="text-left"><?php 
echo Config::cache('driver');
?>
</td>
                </tr>
                <tr>
                    <td class="text-right">路由驱动:</td>
                    <td colspan="2" class="text-left">
                        <?php 
echo Config::router('driver');
?>
                    </td>
                    <td class="text-right">数据库驱动:</td>
                    <td colspan="2" class="text-left"><?php 
echo Config::database('driver');
?>
</td>
                </tr>
                <tr>
                    <td class="text-right">版权所有:</td>
                    <td colspan="2" class="text-left">济宁亿佰网络</td>
                    <td class="text-right">作 者:</td>
                    <td colspan="2" class="text-left">PGF</td>
                </tr>
                <tr>
                    <td class="text-right">程序版本:</td>
                    <td colspan="2" class="text-left">1.0</td>
                    <td class="text-right">register_globals:</td>
                    <td colspan="2" class="text-left">
                        <?php 
Example #18
0
 /**
  * 链接数据库
  * @return Object
  */
 public static function database()
 {
     $load = self::init();
     //判断是否连接过数据库
     if (!is_object($load->database)) {
         if (!class_exists('Db')) {
             $load->core('Db');
         }
         $drive = Config::database('driver');
         if ($load->driver('databases', $drive)) {
             $database = new $drive();
             if ($database->connect()) {
                 Debug::add('Loader:Database connection success.');
                 return $load->database = $database;
             } else {
                 Debug::add('Loader:Database connection failure.');
                 exit;
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return clone $load->database;
     }
 }
Example #19
0
<?php

require 'vendor/autoload.php';
/**
 * @var \Slim\Slim
 */
$app = new \Slim\Slim(array('debug' => false, 'log.enabled' => true, 'log.level' => \Slim\Log::DEBUG));
/**
 * @var medoo
 */
$db = new medoo(Config::database());
$db->query('SET SQL_MODE=ANSI_QUOTES');
/**
 * @var Session
 */
$session = new Session();
function checkAuth()
{
    global $session, $app;
    if (!$session->getUserId()) {
        Helpers::sendJson(array('error' => array('error_code' => 'unauthorized', 'error_msg' => 'Для виконання цієї діх необхідно авторизуватися')));
        return false;
    }
    return true;
}
function checkAdminAuth()
{
    if (!checkAuth()) {
        return false;
    }
    global $session, $app;
Example #20
0
 /**
  * @param $type 要清理的缓存存放的空间
  */
 public function flush_cache($type)
 {
     //可以以后再加
     $cachetype = array('db', 'view_c', 'admin', 'cms');
     if ($type == 'db') {
         echo '正在清理数据库缓存。。。。。。<br>';
         ob_flush();
         flush();
         echo (cache::flush(Config::database('cache_dir')) ? '后台数据库缓存清理完成。' : '后台数据库缓存清理失败!') . '<br>';
         ob_flush();
         flush();
     } else {
         if ($type == 'view_c') {
             echo '正在清理后台模板缓存。。。。。。<br>';
             ob_flush();
             flush();
             echo (cache::flush(Config::template('view_c_dir')) ? '后台数据库缓存清理完成。' : '后台数据库缓存清理失败!') . '<br>';
             ob_flush();
             flush();
             echo '正在清理前台缓存。。。。。。<br/>';
             ob_flush();
             flush();
             echo (cache::flush(Config::cms('cms_app_name')) ? '前台缓存清理完成。' : '前台缓存清理失败!') . '<br>';
             ob_flush();
             flush();
         } else {
             if ($type == 'admin') {
                 echo '正在清理后台缓存。。。。。。<br>';
                 ob_flush();
                 flush();
                 echo (cache::flush('admin') ? '后台缓存清理完成。' : '后台缓存清理失败!') . '<br>';
                 ob_flush();
                 flush();
             } else {
                 if ($type == 'all') {
                     foreach ($cachetype as $type) {
                         $this->flush_cache($type);
                     }
                     echo '缓存清理完毕!';
                 }
             }
         }
     }
 }
Example #21
0
 public function _flush($space)
 {
     if ($space != Config::database('cache_dir') . '/' . $this->model->db->table) {
         $space = $this->model->addslashes($space);
         if ($this->model->where('cachespace like \'' . $space . '%\'')->delete() !== false) {
             return true;
         } else {
             return false;
         }
     }
     return false;
 }