Exemplo n.º 1
0
 /**
  * 得到菜单
  * @return mixed
  */
 public function getMenu()
 {
     $menu = fast_cache('model_menu', '', APP_PATH . '/Common/Conf/');
     if (!is_array($menu)) {
         return array();
     }
     return $menu;
 }
Exemplo n.º 2
0
 /**
  * 更新站点信息
  * @return
  */
 public function siteUpdate()
 {
     if (!isset($_POST['site'])) {
         return $this->errorReturn('无效的操作!');
     }
     $confName = 'system_config';
     $conf = fast_cache($confName, '', C('COMMON_CONF_PATH'));
     $conf['SITE_TITLE'] = $_POST['site']['title'];
     $conf['SITE_KEYWORD'] = $_POST['site']['keyword'];
     $conf['SITE_DESCRIPTION'] = $_POST['site']['description'];
     if (false === fast_cache($confName, $conf, C('COMMON_CONF_PATH'))) {
         return $this->errorReturn('站点信息更新失败!');
     }
     return $this->successReturn('站点信息更新成功!');
 }
Exemplo n.º 3
0
function uuid($prefix = '')
{
    $str = md5(uniqid(mt_rand(), true));
    $uuid = substr($str, 0, 8) . '-';
    $uuid .= substr($str, 8, 4) . '-';
    $uuid .= substr($str, 12, 4) . '-';
    $uuid .= substr($str, 16, 4) . '-';
    $uuid .= substr($str, 20, 12);
    return $prefix . $uuid;
}
/**
* 生成datetime
* @return string
*/
function datetime()
{
    return date('Y-m-d H:i:s');
}
// 得到已经注册的已定义函数
$customFill = get_registry_fill();
if (!isset($customFill) || !is_array($customFill)) {
    $customFill = array();
}
$fill = array('uuid', 'datetime');
foreach ($fill as $item) {
    if (!in_array($item, $customFill)) {
        $customFill[] = $item;
    }
}
fast_cache(FILL_NAME, $customFill, FUNC_CONF_DIR_PATH);
Exemplo n.º 4
0
        $content = stripslashes($content);
        $content = str_replace('\\%', '%', $content);
        // 转义%
        $content = str_replace('\\_', '_', $content);
        // 转义_
        $content = stripslashes($content);
    }
    return $content;
}
/**
* 过滤特殊字符
* @param  string $src
* @return string
*/
function filter_special_chars($src)
{
    return sql_injection(htmlspecialchars($src));
}
// 得到已经注册的已定义函数
$customFilter = get_registry_filter();
if (!isset($customFilter) || !is_array($customFilter)) {
    $customFilter = array();
}
$filters = array('sql_injection', 'strip_sql_injection', 'filter_special_chars');
foreach ($filters as $filter) {
    if (!in_array($filter, $customFilter)) {
        $customFilter[] = $filter;
    }
}
fast_cache(FILTER_NAME, $customFilter, FUNC_CONF_DIR_PATH);
Exemplo n.º 5
0
/**
 * 得到填充函数
 * @return mixed
 */
function get_registry_fill()
{
    return fast_cache(FILL_NAME, '', FUNC_CONF_DIR_PATH);
}
Exemplo n.º 6
0
 /**
  * 确保控制器对应的菜单存在
  * @return
  */
 protected function ensureExistContoller()
 {
     $menu = fast_cache('model_menu', '', APP_PATH . '/Common/Conf/');
     if (!array_key_exists(CONTROLLER_NAME, $menu)) {
         return $this->_empty();
     }
 }