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


PHP Filter::string方法代码示例

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


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

示例1: __construct

 public function __construct($name)
 {
     $name = Filter::string($name);
     $this->_error = $_FILES[$name]["error"];
     $this->_name = $_FILES[$name]["name"];
     $this->_type = $_FILES[$name]["type"];
     $this->_size = $_FILES[$name]["size"];
     $this->_tmp_name = $_FILES[$name]["tmp_name"];
 }
开发者ID:almamuncsit,项目名称:Own-MVC,代码行数:9,代码来源:upload.php

示例2: listAction

 /**
  * 列表
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-06-07 11:09:51
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     if (!in_array($sort, $this->_getDbFields())) {
         $log = __METHOD__ . ': ' . __LINE__ . ',' . L('QUERY,CONTROLLER_NAME,%。,ORDER,COLUMN') . $sort . L('NOT_EXIST');
         C('TRIGGER_ERROR', array($log));
         $this->_model->addLog($log, LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false, L('SERVER_ERROR'));
     }
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //开始时间
     $date_end = Filter::string('date_end', 'get');
     //结束时间
     $template_id = Filter::int('template_id', 'get');
     //
     $column = Filter::string('column', 'get');
     //搜索字段
     $where = array();
     if ('' !== $keyword && in_array($column, array('subject', 'content', 'email'))) {
         $where[$column] = $this->_buildMatchQuery($column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['add_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['add_time'][] = array('ELT', $date_end);
     }
     if (isset($where['add_time']) && count($where['add_time']) == 1) {
         $where['add_time'] = $where['add_time'][0];
     }
     if ($template_id) {
         $where['template_id'] = $template_id;
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $templates = $this->_getCache(false, 'Mail');
     foreach ($data as &$v) {
         $v['template_name'] = isset($templates[$id = $v['template_id']]) ? $templates[$id]['template_name'] : '';
     }
     $this->_ajaxReturn(true, '', $data, $total);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:65,代码来源:MailHistory.class.php

示例3: listAction

 /**
  * 列表管理
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2012-07-19 12:40:43
  * @lastmodify      2013-01-28 11:22:55 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $column = Filter::string('column', 'get');
     //搜索字段
     $keyword = Filter::string('keyword', 'get');
     //搜索关键字
     $area_id = Filter::int('node', 'get');
     //地区id
     //搜索 by mrmsl on 2012-07-24 18:02:02
     if (!$area_id && $column && $keyword && in_array($column, array('area_name', 'area_code'))) {
         $this->_queryTree($column, $keyword);
     } elseif ($area_id) {
         $this->_ajaxReturn(true, '', $this->_getTreeData($area_id, false));
     }
     $data = $this->_getCache(0, CONTROLLER_NAME . '_tree');
     $this->_ajaxReturn(true, '', $data, count($this->_getCache()));
 }
开发者ID:yunsite,项目名称:yablog,代码行数:26,代码来源:Area.class.php

示例4: listAction

 /**
  * 列表
  *
  * @author          mrmsl <msl-138@163.com>
  * @lastmodify      2013-01-22 10:40:26 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = 'a.' . $sort;
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //开始时间
     $date_end = Filter::string('date_end', 'get');
     //结束时间
     $column = Filter::string('column', 'get');
     //搜索字段
     $where = array();
     if ($keyword !== '' && in_array($column, array('username', 'realname', 'admin_id'))) {
         $where['b.' . $column] = $this->_buildMatchQuery('b.' . $column, $keyword, Filter::string('match_mode', 'get'), 'admin_id');
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['a.login_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['a.login_time'][] = array('ELT', $date_end);
     }
     if (isset($where['a.login_time']) && count($where['a.login_time']) == 1) {
         $where['a.login_time'] = $where['a.login_time'][0];
     }
     $where && $this->_model->join('JOIN ' . TB_ADMIN . ' AS b ON a.admin_id=b.admin_id');
     $total = $this->_model->alias('a')->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->alias('a')->join('JOIN ' . TB_ADMIN . ' AS b ON a.admin_id=b.admin_id')->where($where)->field('a.*,b.username,b.realname,INET_NTOA(a.login_ip) AS login_ip')->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:52,代码来源:AdminLoginHistoryController.class.php

示例5: listAction

 /**
  * 列表
  *
  * @author          mrmsl <msl-138@163.com>
  * @lastmodify      2013-01-22 10:40:26 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $this->_getDbFields()) ? $sort : $this->_pk_field;
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //注册开始时间
     $date_end = Filter::string('date_end', 'get');
     //注册结束时间
     $log_type = Filter::int('log_type', 'get');
     //日志类型
     $where = $log_type != LOG_TYPE_ALL ? array('log_type' => $log_type) : array();
     if ($keyword !== '') {
         $where['content'] = $this->_buildMatchQuery('content', $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['log_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['log_time'][] = array('ELT', $date_end);
     }
     if (isset($where['log_time']) && count($where['log_time']) == 1) {
         $where['log_time'] = $where['log_time'][0];
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_LOG') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->field('*,INET_NTOA(user_ip) AS user_ip')->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_LOG') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:51,代码来源:Log.class.php

示例6: packAction

 /**
  * 压缩
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2012-06-15 16:35:42
  * @lastmodify      2013-01-22 10:53:56 by mrmsl
  *
  * @return void 无返回值
  */
 public function packAction()
 {
     $this->_js_file = (include APP_PATH . 'include/required_js.php');
     $file = Filter::string('file');
     !$file && $this->_ajaxReturn(false, L('FILENAME,IS_EMPTY'));
     if ($file == 'all') {
         require CORE_PATH . 'functions/dir.php';
         $file = list_dir(PACKER_JS_PATH);
         foreach ($file as $v) {
             is_file($v) && '.js' == substr($v, -3) && false === strpos($v, '.min.js') && $this->_packFile($v);
         }
         $this->_merge();
     } else {
         $this->_denyDirectory($file);
         $file = explode(',', $file);
         $merge = false;
         foreach ($file as $v) {
             if (!is_file($filename = PACKER_JS_PATH . $v) || strpos($v, '.min.') || '.js' != substr($v, -3)) {
                 continue;
             }
             $basename = basename($v);
             if (!$merge && (isset($this->_js_file[$basename]) || 'base.js' == $basename)) {
                 $merge = true;
             }
             $this->_packFile($filename);
         }
         $merge && $this->_merge();
     }
     $this->_model->addLog(L('COMPRESS,%js,FILENAME,%:') . join(',', $file));
     $this->_ajaxReturn(true, L('COMPRESS,SUCCESS'));
 }
开发者ID:yunsite,项目名称:yablog,代码行数:40,代码来源:PackerController.class.php

示例7: _checkPasswordIsCorrect

 /**
  * 验证用户密码是否正确
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2012-07-12 09:12:50
  * @lastmodify      2013-01-22 11:48:48 by mrmsl
  *
  * @param array  $admin_arr   所有管理员
  * @param array  $admin_info  管理员信息
  * @param string $password    密码
  * @param string $mac_address 网卡信息
  *
  * @return bool true密码正确,否则false
  */
 private function _checkPasswordIsCorrect(&$admin_arr, $admin_info, $password, $mac_address)
 {
     if ($admin_info['password'] == $password) {
         //密码正确
         $verifycode = Filter::string('_verify_code');
         if ('' === $verifycode) {
             return L('PLEASE_ENTER,VERIFY_CODE');
         }
         C('T_VERIFYCODE_ORDER', $admin_info['verify_code_order']);
         $check_verifycode = $this->_checkVerifycode($verifycode, 'module_admin');
         if (true !== $check_verifycode) {
             return $check_verifycode;
         }
         $admin_id = $admin_info['admin_id'];
         $user_ip = get_client_ip();
         //登陆ip
         $time = time();
         //登陆时间
         $mac = $admin_info['is_restrict'] && !$admin_info['mac_address'] ? ",mac_address='{$mac_address}'" : '';
         //网卡信息为空,更新
         //更新管理员最后登陆时间,最后登陆ip,登陆次数
         $this->getDb()->execute('UPDATE ' . TB_ADMIN . " SET login_num=login_num+1,last_login_time={$time},last_login_ip='{$user_ip}'{$mac},lock_start_time=0,lock_end_time=0,lock_memo='' WHERE admin_id={$admin_id}");
         //记录管理员登陆历史
         $this->getDb()->execute('INSERT INTO ' . TB_ADMIN_LOGIN_HISTORY . "(admin_id,login_time,login_ip) VALUES({$admin_id},{$time}," . get_client_ip(1) . ')');
         $this->_module->setAdminSession($admin_info);
         //设置session
         //管理员日志
         $this->addLog(L('LOGIN,SUCCESS') . ".{$admin_info['username']}({$admin_info['realname']})", LOG_TYPE_ADMIN_LOGIN_INFO);
         $admin_arr[$admin_id]['login_num']++;
         $admin_arr[$admin_id]['last_login_time'] = $time;
         $admin_arr[$admin_id]['last_login_ip'] = $user_ip;
         $admin_arr[$admin_id]['is_lock'] = 0;
         $admin_arr[$admin_id]['lock_start_time'] = 0;
         $admin_arr[$admin_id]['lock_end_time'] = 0;
         $admin_arr[$admin_id]['lock_memo'] = '';
         if ($mac) {
             //网卡信息有变更
             $admin_arr[$admin_id]['mac_address'] = $mac_address;
         }
         $this->_setCache($admin_arr, 'Admin');
         //缓存
         clear_verifycoe('module_admin');
         //清空验证码
         return true;
     }
     return false;
 }
开发者ID:yunsite,项目名称:yablog,代码行数:61,代码来源:Login.class.php

示例8: get

 public static function get($key)
 {
     $key = Filter::string($key);
     return $_SESSION[$key];
 }
开发者ID:almamuncsit,项目名称:Own-MVC,代码行数:5,代码来源:session.php

示例9: _getPairsData

 /**
  * 根据两字段组合值获取数据,如id及add_time匹配才能获取到数据,而不仅仅根据id
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-06-14 16:22:53
  *
  * @param string|array $field_arr   组合字段,通常为array('id','add_time')
  * @param string $data 组合信息,默认null=$_POST['data'],格式:id1|add_time1,id2|add_time2,...
  * @param string $field 选取字段,默认*
  * @param string $table ,默认null
  *
  * @return array 数据
  */
 protected function _getPairsData($field_arr, $data = null, $field = '*', $pk_field = null, $table = null)
 {
     $data = null === $data ? Filter::string('data') : $data;
     $return_arr = array();
     if (!$data) {
         return $return_arr;
     }
     $data = explode(',', $data);
     foreach ($data as $k => $v) {
         $v_arr = explode('|', $v);
         if (isset($v_arr[0], $v_arr[1]) && ($column_1 = intval($v_arr[0])) && ($column_2 = intval($v_arr[1]))) {
             $return_arr[$column_1] = $column_2;
         }
     }
     if (!$return_arr) {
         $error = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . L('INVALID_PARAM') . var_export($data, true);
         trigger_error($error, E_USER_ERROR);
         return $return_arr;
     }
     $column_1_arr = array_keys($return_arr);
     $column_2_arr = array_values($return_arr);
     $pk_field = $pk_field ? $pk_field : $this->_pk_field;
     $field_arr = is_array($field_arr) ? $field_arr : explode(',', $field_arr);
     $table && $this->_model->table($table);
     $data = $this->_model->where(array($field_arr[0] => array('IN', $column_1_arr), $field_arr[1] => array('IN', $column_2_arr)))->field($field)->index($pk_field)->select();
     $un_match = count($data) == count($return_arr) ? '' : 'data count not match.';
     foreach ($data as $k => $v) {
         if ($return_arr[$k] != $v[$field_arr[1]]) {
             //id与时间不匹配
             $un_match .= ",{$k}({$return_arr[$k]}) => {$k}({$v[$field_arr[1]]})[correct]";
             unset($data[$k]);
         }
     }
     if ($un_match) {
         $error = get_method_line(__METHOD__, __LINE__, LOG_NORMAL_ERROR) . L('PAIRS_DATA_UN_MATCH') . $un_match;
         trigger_error($error, E_USER_ERROR);
     }
     return $data;
 }
开发者ID:yunsite,项目名称:yablog,代码行数:52,代码来源:Controller.class.php

示例10: viewAction

 /**
  * 查看文件
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-06-28 11:22:40
  *
  * @return void 无返回值
  */
 public function viewAction()
 {
     $filename = Filter::string('filename', 'get');
     //文件名
     $path = LOG_PATH . trim($filename, '/');
     $data = array('filename' => $filename);
     if (!is_file($path)) {
         //文件不存在
         $this->_model->addLog(L('LOG,FILE') . $path . L('NOT_EXIST'), LOG_TYPE_INVALID_PARAM);
         $data['content'] = L('LOG,FILE') . $filename . L('NOT_EXIST');
     } else {
         $content = file_get_contents($path);
         $replace = false;
         $find = array('error', 'eval', 'invalid', 'failed');
         foreach (array('error', 'eval', 'invalid', 'failed') as $v) {
             if (stripos($content, $v)) {
                 $replace = true;
                 break;
             }
         }
         $content = $replace ? preg_replace('/(.+(' . join('|', $find) . ').+)/i', '<span style="color: red">\\1</span>', $content) : $content;
         $data['content'] = nl2br($content);
     }
     $this->_ajaxReturn(true, '', $data);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:33,代码来源:Filelog.class.php

示例11: _getPairsData

 /**
  * 根据两字段组合值获取数据,如id及add_time匹配才能获取到数据,而不仅仅根据id
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-06-14 16:22:53
  *
  * @param string|array $field_arr   组合字段,通常为array('id','add_time')
  * @param string $data 组合信息,默认null=$_POST['data'],格式:id1|add_time1,id2|add_time2,...
  * @param string $field 选取字段,默认*
  * @param string $table ,默认null
  *
  * @return array 数据
  */
 protected function _getPairsData($field_arr, $data = null, $field = '*', $pk_field = null, $table = null)
 {
     $data = null === $data ? Filter::string('data') : $data;
     $return_arr = array();
     if (!$data) {
         return $return_arr;
     }
     $data = explode(',', $data);
     foreach ($data as $k => $v) {
         $v_arr = explode('|', $v);
         if (isset($v_arr[0], $v_arr[1]) && ($column_1 = intval($v_arr[0])) && ($column_2 = intval($v_arr[1]))) {
             $return_arr[$column_1] = $column_2;
         }
     }
     if (!$return_arr) {
         $log = __METHOD__ . ': ' . __LINE__ . ',' . L('INVALID_PARAM') . var_export($data, true);
         C('TRIGGER_ERROR', array($log));
         $this->_model->addLog($log, LOG_TYPE_INVALID_PARAM);
         return $return_arr;
     }
     $column_1_arr = array_keys($return_arr);
     $column_2_arr = array_values($return_arr);
     $pk_field = $pk_field ? $pk_field : $this->_pk_field;
     $field_arr = is_array($field_arr) ? $field_arr : explode(',', $field_arr);
     $table && $this->_model->table($table);
     $data = $this->_model->where(array($field_arr[0] => array('IN', $column_1_arr), $field_arr[1] => array('IN', $column_2_arr)))->field($field)->key_column($pk_field)->select();
     $un_match = count($data) == count($return_arr) ? '' : 'data count not match.';
     foreach ($data as $k => $v) {
         if ($return_arr[$k] != $v[$field_arr[1]]) {
             //id与时间不匹配
             $un_match .= ",{$k}({$return_arr[$k]}) => {$k}({$v[$field_arr[1]]})[correct]";
             unset($data[$k]);
         }
     }
     if ($un_match) {
         $log = __METHOD__ . ': ' . __LINE__ . ',' . $un_match;
         C('TRIGGER_ERROR', array($log, E_USER_WARNING));
         $this->_model->addLog($log, LOG_TYPE_INVALID_PARAM);
     }
     return $data;
 }
开发者ID:yunsite,项目名称:yablog,代码行数:54,代码来源:BaseController.class.php

示例12: listAction

 /**
  * 列表
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2012-12-28 11:48:07
  * @lastmodify      2013-01-22 11:00:14 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $data = array_values($this->cache());
     $this->_unshift && array_unshift($data, array($this->_pk_field => 0, $this->_name_column => isset($_POST['emptyText']) ? Filter::string('emptyText') : L('PLEASE_SELECT')));
     $this->_ajaxReturn(true, '', $data);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:15,代码来源:RoleController.class.php

示例13: deleteBlogHtmlAction

 /**
  * 后台删除博客,微博静态文件
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-05-17 10:51:07
  *
  * @return void 无返回值
  */
 public function deleteBlogHtmlAction()
 {
     $pk_value = Filter::string($pk_field = $this->_pk_field);
     $pk_value = map_int($pk_value, true);
     if ($pk_value) {
         $error = '';
         $log = '';
         $name_column = empty($this->_name_column) ? '' : $this->_name_column;
         $field = $pk_field . ',link_url' . ($name_column ? ',' . $name_column : '');
         $data = $this->_model->field($field)->index($pk_field)->where(array($pk_field => array('IN', $pk_value)))->select();
         $delete = array();
         foreach ($pk_value as $v) {
             if (isset($data[$v])) {
                 $delete[] = array('link_url' => $data[$v]['link_url']);
                 $log .= ',' . ($name_column ? ",{$data[$v][$name_column]}({$v})" : $v);
             } else {
                 $error .= ',' . $v;
             }
         }
         if ($error) {
             $log_content = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . L('CONTROLLER_NAME') . $error . L('NOT_EXIST');
             trigger_error($log_content, E_USER_ERROR);
         }
         if ($log) {
             $this->_deleteBlogHtml($delete);
             $this->_model->addLog(L('DELETE,CONTROLLER_NAME,STATIC_PAGE') . substr($log, 1) . L('SUCCESS'));
             $this->_ajaxReturn(true, L('DELETE,SUCCESS'));
         } else {
             $log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . L('DELETE,CONTROLLER_NAME,STATIC_PAGE,FAILURE,%: ,INVALID_PARAM,%:,CONTROLLER_NAME') . $error . L('NOT_EXIST');
             trigger_error($log, E_USER_ERROR);
         }
     }
     if (empty($error)) {
         $log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . L("DELETE,CONTROLLER_NAME,STATIC_PAGE,FAILURE,%: ,INVALID_PARAM,%:,CONTROLLER_NAME,%{$this->_pk_field},IS_EMPTY");
         trigger_error($log, E_USER_ERROR);
     }
     $this->_ajaxReturn(false, L('DELETE,FAILURE'));
 }
开发者ID:yunsite,项目名称:yablog,代码行数:46,代码来源:CommonController.class.php

示例14: metaInfoAction

 /**
  * ajax异步获取博客,微博元数据,包括点击量,评论数等
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-05-02 16:21:34
  * @lastmodify      2013-05-03 08:41:05 by mrmsl
  *
  * @return void 无返回值
  */
 public function metaInfoAction()
 {
     /*foreach (array(TB_BLOG, TB_MINIBLOG) as $table) {
     
                 foreach($this->_model->table($table)->select() as $v) {
                     $sql = sprintf('UPDATE %s SET hits=%d,comments=%d,diggs=%d WHERE blog_id=%d', $table, rand(1, 1000), rand(1, 50), rand(1, 20), $v['blog_id']);
                     $this->_model->execute($sql);
                 }
             }*/
     $this->_updateHits();
     //统计点击
     $blog = Filter::string('blog');
     $miniblog = Filter::string('miniblog');
     if (!$blog && !$miniblog) {
         //空数据
         $this->triggerError($log = __METHOD__ . ': ' . __LINE__ . ',' . L('INVALID_PARAM'));
         $this->_model->addLog($log, LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false);
     }
     $blog = 0 === strpos($blog, ',') ? substr($blog, 1) : $blog;
     $miniblog = 0 === strpos($miniblog, ',') ? substr($miniblog, 1) : $miniblog;
     $field_arr = 'blog_id,add_time';
     $field = 'blog_id,add_time,hits,comments,diggs';
     $miniblog_data = $this->_getPairsData($field_arr, $miniblog, $field, 'blog_id', TB_MINIBLOG);
     $blog_data = $this->_getPairsData($field_arr, $blog, $field, 'blog_id', TB_BLOG);
     $this->_ajaxReturn(array('blog' => $blog_data, 'miniblog' => $miniblog_data, 'success' => true));
 }
开发者ID:yunsite,项目名称:yablog,代码行数:36,代码来源:Ajax.class.php

示例15: listAction

 /**
  * 列表
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-05-13 15:54:17
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $db_fields = $this->_getDbFields();
     //表字段
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $db_fields) ? $sort : 'sort_order';
     $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
     //排序
     $order = toggle_order($order);
     $data = $this->_model->order($sort . ' ' . $order)->select();
     false === $data && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:23,代码来源:HtmlController.class.php


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