コード例 #1
0
ファイル: functions.php プロジェクト: hzhou9/coupon_deal
function add_extra_head()
{
    $cache = new \cache\main();
    if ($show_from_cache = $cache->check('admin_head')) {
        return $show_from_cache;
    } else {
        $head = '';
        foreach (\query\others::while_head_lines(array_merge(array('max' => 0, 'show' => 'admin', 'orderby' => 'date desc'))) as $line) {
            $head .= \site\plugin::replace_constant($line->text) . "\n";
        }
        $cache->add('admin_head', $head);
        return $head;
    }
}
コード例 #2
0
ファイル: admin.php プロジェクト: hzhou9/coupon_deal
 public static function set_option($opt = array())
 {
     global $db;
     if (!$GLOBALS['me']->is_admin) {
         return false;
     }
     $opt = array_map('trim', $opt);
     $stmt = $db->stmt_init();
     $stmt->prepare("UPDATE " . DB_TABLE_PREFIX . "options SET option_value = ? WHERE option_name = ?");
     foreach ($opt as $k => $v) {
         $stmt->bind_param("ss", $v, $k);
         $stmt->execute();
         $cache = new cache\main();
         $cache->update('options_' . $k, $v);
     }
     $stmt->close();
     return true;
 }
コード例 #3
0
function add_extra_head()
{
    $cache = new \cache\main();
    if ($show_from_cache = $cache->check('theme_head')) {
        return $show_from_cache;
    } else {
        $head = '';
        foreach (\query\others::while_head_lines(array_merge(array('max' => 0, 'show' => 'theme', 'orderby' => 'date desc'))) as $line) {
            $head .= \site\plugin::replace_constant($line->text) . "\n";
        }
        if (file_exists(COMMON_LOCATION . '/head.html')) {
            $head .= @file_get_contents(COMMON_LOCATION . '/head.html');
            $head .= "\n";
        }
        $cache->add('theme_head', $head);
        return $head;
    }
}
コード例 #4
0
ファイル: main.php プロジェクト: hzhou9/coupon_deal
 public static function get_option($option = '')
 {
     global $db;
     if (empty($option)) {
         $stmt = $db->stmt_init();
         $stmt->prepare("SELECT option_name, option_value FROM " . DB_TABLE_PREFIX . "options");
         $stmt->execute();
         $stmt->bind_result($name, $value);
         $params = array();
         while ($stmt->fetch()) {
             $params[$name] = $value;
         }
         $stmt->close();
         return (object) $params;
     } else {
         $cache = new \cache\main();
         if ($show_from_cache = $cache->check('options_' . $option)) {
             return $show_from_cache;
         } else {
             $stmt = $db->stmt_init();
             $stmt->prepare("SELECT COUNT(*), option_value FROM " . DB_TABLE_PREFIX . "options WHERE option_name = ?");
             $stmt->bind_param("s", $option);
             $stmt->execute();
             $stmt->bind_result($count, $value);
             $stmt->fetch();
             $stmt->close();
             if (empty($count)) {
                 return false;
             }
             $cache->add('options_' . $option, $value);
             return $value;
         }
     }
 }