Esempio n. 1
0
 public static function queryAllWithDBCache($query, $prefix = null, $type = 'both', $count = -1)
 {
     $cache = queryCache::getInstance();
     $cache->reset($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::queryAllWithCache($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }
Esempio n. 2
0
function getCategories($blogid, $format = 'tree')
{
    global $database;
    global $__gCacheCategoryTree, $__gCacheCategoryRaw;
    if ($format == 'tree' && !empty($__gCacheCategoryTree)) {
        return $__gCacheCategoryTree;
    } else {
        if ($format == 'raw' && !empty($__gCacheCategoryRaw)) {
            return $__gCacheCategoryRaw;
        }
    }
    $rows = POD::queryAllWithCache("SELECT *\n\t\t\tFROM {$database['prefix']}Categories\n\t\t\tWHERE blogid = {$blogid}\n\t\t\t\tAND id >= 0\n\t\t\tORDER BY parent, priority");
    $categories = array();
    if (empty($rows)) {
        $rows = array();
    }
    if ($format == 'raw') {
        foreach ($rows as $category) {
            $categories[$category['id']] = $category;
        }
        $__gCacheCategoryRaw = $categories;
        return $categories;
    }
    foreach ($rows as $category) {
        if ($category['parent'] == null) {
            $category['children'] = array();
            $categories[$category['id']] = $category;
        } else {
            if (isset($categories[$category['parent']])) {
                array_push($categories[$category['parent']]['children'], $category);
            }
        }
    }
    $__gCacheCategoryTree = $categories;
    return $categories;
}
Esempio n. 3
0
function getCurrentSetting($name)
{
    global $database, $activePlugins;
    global $pluginSetting;
    if (!in_array($name, $activePlugins)) {
        return false;
    }
    if (empty($pluginSetting)) {
        $settings = POD::queryAllWithCache("SELECT name, settings \n\t\t\t\tFROM {$database['prefix']}Plugins \n\t\t\t\tWHERE blogid = " . getBlogId(), MYSQL_NUM);
        foreach ($settings as $k => $v) {
            $pluginSetting[$v[0]] = $v[1];
        }
    }
    if (isset($pluginSetting[$name])) {
        return $pluginSetting[$name];
    }
    return null;
}
Esempio n. 4
0
 function queryAllWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1)
 {
     $cache = new queryCache($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::queryAllWithCache($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }
Esempio n. 5
0
 function queryAllWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1)
 {
     //		requireComponent('Needlworks.Cache.PageCache');
     $cache = new queryCache($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::queryAllWithCache($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }