Example #1
0
function jz_db_cache($type, $sql, $val = false)
{
    global $enable_query_cache;
    static $jz_query_cache = array();
    if ($enable_query_cache != "true") {
        return false;
    }
    if ($val === false) {
        if (isset($jz_query_cache[$type][$sql])) {
            return $jz_query_cache[$type][$sql];
        } else {
            return false;
        }
    } else {
        if (false !== stripos($sql, "select") && false === stripos($sql, jz_db_rand_function())) {
            $jz_query_cache[$type][$sql] = $val;
        }
    }
}
Example #2
0
 /**
  * Removes this node from the featured list.
  * 
  * @author Ben Dodson
  * @version 6/8/04
  * @since 6/8/04
  */
 function getFeatured($distance = -1, $limit = 1)
 {
     global $sql_type, $sql_pw, $sql_usr, $sql_socket, $sql_db;
     if ($distance === false) {
         $distance = $this->getNaturalDepth();
     }
     $slash = $this->getLevel() == 0 ? "" : "/";
     $path = jz_db_escape($this->getPath("String"));
     if ($path != "") {
         $path .= "/";
     }
     if ($limit > 0) {
         $lim = " LIMIT {$limit}";
     } else {
         $lim = "";
     }
     if ($distance <= 0) {
         $dis = "";
     } else {
         $level = $this->getLevel();
         $level += $distance;
         $dis = "AND level = '{$level}'";
     }
     $query = "SELECT * FROM jz_nodes WHERE path LIKE '{$path}%' AND featured = 'true' {$dis} ORDER BY " . jz_db_rand_function();
     $query .= " " . $lim;
     return jz_db_object_query($query);
 }