public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "requestid,userid,total_request,date_added,status,comments"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by requestid desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "request_payments {$whereQuery}"; $command .= " {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes'; $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : 1; if ($cache == 'yes') { // Load dbcache $loadCache = DBCache::get($queryCMD, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes'; if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['comments'])) { $row['comments'] = String::decode($row['comments']); } if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if ($inputData['isHook'] == 'yes') { if (isset($row['comments'])) { $row['comments'] = Shortcode::load($row['comments']); } } $result[] = $row; } } else { return false; } // Save dbcache DBCache::make(md5($queryCMD), $result); // end save return $result; }
public static function parse($viewName = '', $viewData = array(), $timeLive = 10) { $path = self::getPath() . $viewName . '.php'; if (!file_exists($path)) { return false; } $pathMd5 = md5($path); if (!Cache::hasKey('templates/' . $pathMd5, $timeLive, '.php')) { $fileData = file_get_contents($path); $fileData = Shortcode::loadInTemplate($fileData); $fileData = Shortcode::toHTML($fileData); $fileData = Shortcode::load($fileData); // $fileMd5=md5($fileData); Cache::saveKey('templates/' . $pathMd5, $fileData, '.php'); } $path = ROOT_PATH . 'application/caches/templates/'; self::setPath($path); self::make($pathMd5, $viewData); self::resetPath(); }
public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "postid,title,catid,userid,parentid,image,sort_order,date_added,views,content,type,keywords,friendly_url,is_featured,date_featured,expires_date,rating,allowcomment,status"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by postid desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "post {$whereQuery}"; $command .= " {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes'; $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1; $md5Query = md5($queryCMD); if ($cache == 'yes') { // Load dbcache $loadCache = Cache::loadKey('dbcache/system/post/' . $md5Query, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes'; if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['title'])) { $row['title'] = String::decode($row['title']); } if (isset($row['friendly_url'])) { $row['url'] = self::url($row); } if (isset($row['content'])) { $row['content'] = String::decode($row['content']); // die($row['content']); } if (isset($row['date_added'])) { $row['date_addedReal'] = $row['date_added']; $row['date_added'] = Render::dateFormat($row['date_added']); } if ($inputData['isHook'] == 'yes') { if (isset($row['content'])) { $row['content'] = String::decode($row['content']); $row['content'] = html_entity_decode($row['content']); $row['content'] = Shortcode::loadInTemplate($row['content']); $row['content'] = Shortcode::load($row['content']); $row['content'] = Shortcode::toHTML($row['content']); } } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/post/' . $md5Query, serialize($result)); // end save return $result; }