function listRss() { header("Content-Type: application/xml; charset=UTF-8"); $location = Url::rss(); if ($match = Uri::match('^(.*?)$')) { $location = ROOT_URL . $match[1]; $reLocation = base64_encode($location); if ($loadData = Cache::loadKey($reLocation, 60)) { $loadData = json_decode($loadData, true); return $loadData; } } $inputData = array('limitShow' => 15, 'limitPage' => 0); if ($match = Uri::match('\\/page\\/(\\d+)')) { $inputData['limitPage'] = $match[1]; } if ($match = Uri::match('\\/category\\/(\\d+)')) { $id = $match[1]; $inputData['where'] = "where catid='{$id}'"; } if ($match = Uri::match('rss\\/products')) { $loadData = Products::get($inputData); } else { $loadData = Post::get($inputData); } $reLocation = base64_encode($location); Cache::saveKey($reLocation, json_encode($loadData)); return $loadData; }
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 = "id,parentid,date_added,title,url,status,sort_order"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by id desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "links {$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/link/' . $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['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if (isset($row['url']) && !preg_match('/^http/i', $row['url'])) { if (preg_match('/^\\/(.*?)$/i', $row['url'], $matches)) { $tmp = $matches[1]; $row['urlFormat'] = System::getUrl() . $tmp; } } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/link/' . $md5Query, serialize($result)); // end save return $result; }
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 = "userid,groupid,username,firstname,lastname,image,email,password,userdata,ip,verify_code,parentid,date_added,forgot_code,forgot_date"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by date_added desc'; $result = array(); $prefix = ''; $prefixall = Database::isPrefixAll(); if ($prefixall != false || $prefixall == 'no') { $prefix = Database::getPrefix(); } $command = "select {$selectFields} from " . $prefix . "users {$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/user/' . $md5Query, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } // echo $queryCMD;die(); $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if (isset($row['image'])) { $row['imageFormat'] = self::getAvatar($row['image']); } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/user/' . $md5Query, serialize($result)); // end save return $result; }
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 = "userid,company,firstname,lastname,address_1,address_2,city,state,postcode,country,phone,fax"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by userid desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "address {$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/address/' . $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['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/address/' . $md5Query, serialize($result)); // end save return $result; }
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,catid"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by date_added desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "post_categories {$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/postcategory/' . $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)) { $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/postcategory/' . $md5Query, serialize($result)); // end save return $result; }
public static function saveCache() { $loadData = PluginsMeta::get(array('cacheTime' => 1, 'where' => "where status='1'", 'orderby' => "order by zonename asc")); $resultData = array(); // print_r($loadData);die(); if (isset($loadData[0]['zonename'])) { $total = count($loadData); for ($i = 0; $i < $total; $i++) { $theZone = $loadData[$i]['zonename']; $resultData[$theZone][] = $loadData[$i]; } Cache::saveKey('listZones', serialize($resultData)); return $resultData; } else { Cache::removeKey('listZones'); } }
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 = "metaid,foldername,func,zonename,layoutname,layoutposition,content,status,type"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by metaid desc'; $result = array(); $command = "select {$selectFields} from plugins_meta {$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'] : 15; $md5Query = md5($queryCMD); if ($cache == 'yes') { // Load dbcache $loadCache = Cache::loadKey('dbcache/system/pluginmeta/' . $md5Query, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/pluginmeta/' . $md5Query, serialize($result)); // end save return $result; }
public static function parseData($path) { $resultPath = $path; // $loadData=file_get_contents($path); // die($loadData); $fileMD5 = md5_file($path); $md5Path = ROOT_PATH . 'application/caches/templates/' . $fileMD5 . '.php'; if (Cache::hasKey('templates/' . $fileMD5, -1, '.php')) { $resultPath = $md5Path; return $resultPath; } $loadData = file_get_contents($path); $loadData = self::parseExtends($loadData); $loadData = self::parseFriendlyFunction($loadData); $replace = array('/\\{\\{assign var="(\\w+)" value="(.*?)"\\}\\}/i' => '<?php $$1="$2";?>', '/\\{\\{\\$(.*?)=(.*?)\\}\\}/i' => '<?php $$1=$2;?>', '/\\{\\{(.*?)=(.*?)\\}\\}/i' => '<?php $$1=$2;?>', '/\\{\\{(\\w+)=(.*?)\\}\\}/i' => '<?php $$1=$2;?>', '/\\{\\{\\$(.*?) (.*?)\\}\\}/i' => '<?php $$1 $2;?>', '/\\{\\{\\$(.*?)\\}\\}/i' => '<?php echo $$1;?>', '/\\{\\{([a-zA-Z0-9_\\-\\_]+)\\}\\}/i' => '<?php echo $1;?>', '/\\{\\{(\\w+)::(\\w+)\\((.*?)\\)\\}\\}/i' => '<?php $1::$2($3);?>', '/\\{\\{if (.*?)\\}\\}/i' => '<?php if($1){ ?>', '/\\{\\{elseif (.*?)\\}\\}/i' => '<?php }elseif($1){ ?>', '/\\{\\{else\\}\\}/i' => '<?php }else{ ?>', '/\\{\\{\\/if\\}\\}/i' => '<?php } ?>', '/\\<\\?=(.*?)\\?\\>/i' => '<?php echo $1 ?>', '/\\{\\{loop total=(\\d+)\\}\\}/i' => '<?php for($i=1;$i<=$1;$i++){ ?>', '/\\{\\{loop:(\\d+)\\}\\}/i' => '<?php for($i=1;$i<=$1;$i++){ ?>', '/\\{\\{\\/loop\\}\\}/i' => '<?php } ?>', '/\\{\\{foreach (\\w+) as (\\w+)\\}\\}/i' => '<?php foreach($$1 as $$2){ ?>', '/\\{\\{endfor\\}\\}/i' => '<?php } ?>', '/\\(\\{\\{(\\w+)\\.(\\w+)\\}\\}\\)/i' => '$$1["$2"]', '/\\(\\{\\{(\\w+)\\.(\\w+)\\.(\\w+)\\}\\}\\)/i' => '$$1["$2"]["$3"]', '/\\(\\{\\{(\\w+)\\.(\\w+)\\.(\\w+)\\.(\\w+)\\}\\}\\)/i' => '$$1["$2"]["$3"]["$4"]', '/\\{\\{(\\w+)\\.(\\w+)\\}\\}/i' => '<?php echo $$1["$2"];?>', '/\\{\\{(\\w+)\\.(\\w+)\\.(\\w+)\\}\\}/i' => '<?php echo $$1["$2"]["$3"];?>', '/\\{\\{(\\w+)\\.(\\w+)\\.(\\w+)\\.(\\w+)\\}\\}/i' => '<?php echo $$1["$2"]["$3"]["$4"];?>', '/\\{\\{(\\w+) or (.*?)\\}\\}/i' => '<?php $$1=isset($$1[0])?$$1:$2; echo $$1;?>', '/\\{\\{(\\$\\w+) or (.*?)\\}\\}/i' => '<?php $1=isset($1[0])?$1:$2; echo $1;?>', '/\\{\\{block .*?\\}\\}.*?\\{\\{\\/block\\}\\}/i' => ''); $loadData = preg_replace(array_keys($replace), array_values($replace), $loadData); Cache::saveKey('templates/' . $fileMD5, $loadData, '.php'); // die($loadData); $resultPath = ROOT_PATH . 'application/caches/templates/' . $fileMD5 . '.php'; return $resultPath; }
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 = "commentid,postid,type,fullname,email,parentid,date_added,status,content"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by commentid desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "comments {$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/comment/' . $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['fullname'])) { $row['fullname'] = String::decode($row['fullname']); } if (isset($row['content'])) { $row['content'] = String::decode($row['content']); } if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if ($inputData['isHook'] == 'yes') { if (isset($row['content'])) { $row['content'] = Shortcode::toHTML($row['content']); } } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/comment/' . $md5Query, serialize($result)); // end save return $result; }
public static function toHTML($str) { $hash = md5($str); $filePath = CACHES_PATH . 'dbcache/system/bbcode/' . $hash . '.cache'; if (file_exists($filePath)) { $loadData = unserialize(file_get_contents($filePath)); return $loadData; } $str = trim($str); $str = html_entity_decode($str); $str = String::clearSpace($str); $str = preg_replace('/[\\s]+\\]/i', ']', $str); $str = str_replace("\n", '<br/>', $str); // BBcode array $find = array('~\\[b\\](.*?)\\[/b\\]~s' => '<strong>$1</strong>', '~\\[i\\](.*?)\\[/i\\]~s' => '<i>$1</i>', '~\\[u\\](.*?)\\[/u\\]~s' => '<span style="text-decoration:underline;">$1</span>', '~\\[quote\\](.*?)\\[/quote\\]~s' => '<pre>$1</pre>', '~\\[size=(.*?)\\](.*?)\\[/size\\]~s' => '<span style="font-size:$1px;">$2</span>', '~\\[color=(.*?)\\](.*?)\\[/color\\]~s' => '<span style="color:$1;">$2</span>', '~\\[label class="(.*?)"\\](.*?)\\[\\/label\\]~s' => '<span class="label label-default $1">$2</span>', '~\\[alert class="(.*?)"\\](.*?)\\[\\/alert\\]~s' => '<div class="alert alert-default $1">$2</div>', '~\\[panelbody\\](.*?)\\[\\/panelbody\\]~s' => '<div class="panel-body">$1</div>', '~\\[paneltitle\\](.*?)\\[\\/paneltitle\\]~s' => '<div class="panel-heading">$1</div>', '~\\[panel\\](.*?)\\[\\/panel\\]~s' => '<div class="panel panel-default">$1</div>', '~\\[panel (.*?)\\](.*?)\\[\\/panel\\]~s' => '<div $1>$2</div>', '~\\[taburl:active id="(.*?)"\\](.*?)\\[\\/taburl\\]~s' => '<li role="presentation" class="active"><a href="#$1" aria-controls="$1" role="tab" data-toggle="tab">$2</a></li>', '~\\[taburl id="(.*?)"\\](.*?)\\[\\/taburl\\]~s' => '<li role="presentation"><a href="#$1" aria-controls="$1" role="tab" data-toggle="tab">$2</a></li>', '~\\[navtabs\\](.*?)\\[\\/navtabs\\]~s' => '<ul class="nav nav-tabs" role="tablist">$1</ul>', '~\\[tabpanel:active id="(.*?)"\\](.*?)\\[\\/tabpanel\\]~s' => '<div role="tabpanel" class="tab-pane active" id="$1">$2</div>', '~\\[tabpanel id="(.*?)"\\](.*?)\\[\\/tabpanel\\]~s' => '<div role="tabpanel" class="tab-pane" id="$1">$2</div>', '~\\[tabcontent\\](.*?)\\[\\/tabcontent\\]~s' => '<div class="tab-content">$1</div>', '~\\[tab\\](.*?)\\[\\/tab\\]~s' => '<div role="tabpanel">$1</div>', '~\\[row\\](.*?)\\[\\/row\\]~s' => '<div class="row">$1</div>', '~\\[row class="(.*?)"\\](.*?)\\[\\/row\\]~s' => '<div class="row $1">$2</div>', '~\\[row id="(.*?)"\\](.*?)\\[\\/row\\]~s' => '<div class="row" id="$1">$2</div>', '~\\[row class="(.*?)" id="(.*?)"\\](.*?)\\[\\/row\\]~s' => '<div class="row $1" id="$2">$3</div>', '~\\[row id="(.*?)" class="(.*?)"\\](.*?)\\[\\/row\\]~s' => '<div class="row $2" id="$1">$3</div>', '~\\[col\\](.*?)\\[\\/col\\]~s' => '<div class="col-lg-12">$1</div>', '~\\[col class="(.*?)"\\](.*?)\\[\\/col\\]~s' => '<div class="col-lg-12 $1">$2</div>', '~\\[col id="(.*?)"\\](.*?)\\[\\/col\\]~s' => '<div class="col-lg-12" id="$1">$2</div>', '~\\[col class="(.*?)" id="(.*?)"\\](.*?)\\[\\/col\\]~s' => '<div class="col-lg-12 $1" id="$2">$3</div>', '~\\[col id="(.*?)" class="(.*?)"\\](.*?)\\[\\/col\\]~s' => '<div class="col-lg-12 $2" id="$1">$3</div>', '~\\[dropdown\\](.*?)\\[\\/dropdown\\]~s' => '<div class="dropdown">$1</div>', '~\\[drbutton class="(.*?)"\\](.*?)\\[\\/drbutton\\]~s' => '<button class="btn btn-default $1 dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">$2<span class="caret"></span></button>', '~\\[drmenu\\](.*?)\\[\\/drmenu\\]~s' => '<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">$1</ul>', '~\\[drlink href="(.*?)"\\](.*?)\\[\\/drlink\\]~i' => '<li role="presentation"><a role="menuitem" tabindex="-1" href="$1">$2</a></li>', '~\\[bxslider\\](.*?)\\[\\/bxslider\\]~s' => '<ul class="bxslider">$1</ul><script>$(document).ready(function(){$(\'.bxslider\').bxSlider({auto: true});});</script>', '~\\[bximg src="(.*?)"\\]~s' => '<li><img src="$1" alt="Image" /></li>', '~\\[bximg class="(.*?)" src="(.*?)"\\]~s' => '<li><img class="$1" alt="Image" src="$2" /></li>', '~\\[button class="(.*?)"\\](.*?)\\[\\/button\\]~s' => '<button type="button" class="btn btn-default $1">$2</button>', '~\\[button id="(.*?)"\\](.*?)\\[\\/button\\]~s' => '<button type="button" class="btn btn-default" id="$1">$2</button>', '~\\[button class="(.*?)" id="(.*?)"\\](.*?)\\[\\/button\\]~s' => '<button type="button" class="btn btn-default $1" id="$2">$3</button>', '~\\[button id="(.*?)" class="(.*?)"\\](.*?)\\[\\/button\\]~s' => '<button type="button" id="$1" class="btn btn-default $2">$3</button>', '~\\[button (.*?)\\](.*?)\\[\\/button\\]~s' => '<button $1>$2</button>', '~\\[progress (.*?)\\](.*?)\\[\\/progress\\]~s' => '<div class="progress"><div class="progress-bar" role="progressbar" aria-valuenow="$2" aria-valuemin="0" aria-valuemax="100" style="width: $2%;" $1><span class="sr-only">$2% Complete</span></div></div>', '~\\[progress:success (.*?)\\](.*?)\\[\\/progress\\]~s' => '<div class="progress"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="$2" aria-valuemin="0" aria-valuemax="100" style="width: $2%;" $1><span class="sr-only">$2% Complete</span></div></div>', '~\\[progress:primary (.*?)\\](.*?)\\[\\/progress\\]~s' => '<div class="progress"><div class="progress-bar progress-bar-primary" role="progressbar" aria-valuenow="$2" aria-valuemin="0" aria-valuemax="100" style="width: $2%;" $1><span class="sr-only">$2% Complete</span></div></div>', '~\\[progress:warning (.*?)\\](.*?)\\[\\/progress\\]~s' => '<div class="progress"><div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="$2" aria-valuemin="0" aria-valuemax="100" style="width: $2%;" $1><span class="sr-only">$2% Complete</span></div></div>', '~\\[progress:danger (.*?)\\](.*?)\\[\\/progress\\]~s' => '<div class="progress"><div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="$2" aria-valuemin="0" aria-valuemax="100" style="width: $2%;" $1><span class="sr-only">$2% Complete</span></div></div>', '~\\[badge\\](.*?)\\[\\/badge\\]~s' => '<span class="badge">$1</span>', '~\\[badge (.*?)\\](.*?)\\[\\/badge\\]~s' => '<span class="badge" $1>$2</span>', '~\\[icon:(.*?)\\]~i' => '<span class="glyphicon glyphicon-$1" aria-hidden="true"></span>', '~\\[root_url\\]~i' => ROOT_URL, '~\\[site_url\\]~i' => ROOT_URL); $replaces = array('[unordered_list]' => '<ul>', '[/unordered_list]' => '</ul>', '[list]' => '<ul>', '[/list]' => '</ul>', '[ul]' => '<ul>', '[/ul]' => '</ul>', '[ordered_list]' => '<ol>', '[/ordered_list]' => '</ol>', '[ol]' => '<ol>', '[/ol]' => '</ol>', '[list_item]' => '<li>', '[/list_item]' => '</li>', '[li]' => '<li>', '[/li]' => '</li>', '[*]' => '<li>', '[/*]' => '</li>', '[code]' => '<code>', '[/code]' => '</code>', '[code]' => '<pre>', '[/code]' => '</pre>', '[code]' => '<pre>', '[/code]' => '</pre>', '[heading1]' => '<h1>', '[/heading1]' => '</h1>', '[heading2]' => '<h2>', '[/heading2]' => '</h2>', '[heading3]' => '<h3>', '[/heading3]' => '</h3>', '[h1]' => '<h1>', '[/h1]' => '</h1>', '[h2]' => '<h2>', '[/h2]' => '</h2>', '[h3]' => '<h3>', '[/h3]' => '</h3>', '[p]' => '<p>', '[/p]' => '</p>', '[para]' => '<p>', '[/para]' => '</p>', '[p]' => '<p>', '[/p]' => '</p>', '[p][p]' => '', '[p][p][p]' => '', '[p][p][p][p]' => '', '[/p][/p]' => '', '[/p][/p][/p]' => '', '[/p][/p][/p][/p]' => '', '[b]' => '<b>', '[/b]' => '</b>', '[b]' => '<strong>', '[/b]' => '</strong>', '<newline>' => "\r\n", '[br]' => '<br/>'); $str = preg_replace(array_keys($find), array_values($find), $str); $str = str_replace(array_keys($replaces), array_values($replaces), $str); // $find = array("<br>", "<br/>", "<br />"); // $str = str_replace($find, "\r\n", $str); // $str = trim(strip_tags($str)); Cache::saveKey('dbcache/system/bbcode/' . $hash, serialize($str)); return $str; }
public static function update($listID, $post = array(), $whereQuery = '', $addWhere = '') { if (isset($post['groupdata']) && !is_array($post['groupdata'])) { $post['groupdata'] = self::lineToArray($post['groupdata']); } if (is_numeric($listID)) { $catid = $listID; unset($listID); $listID = array($catid); } $listIDs = "'" . implode("','", $listID) . "'"; $keyNames = array_keys($post); $total = count($post); $setUpdates = ''; for ($i = 0; $i < $total; $i++) { $keyName = $keyNames[$i]; $setUpdates .= "{$keyName}='{$post[$keyName]}', "; } $setUpdates = substr($setUpdates, 0, strlen($setUpdates) - 2); $whereQuery = isset($whereQuery[5]) ? $whereQuery : "groupid in ({$listIDs})"; $addWhere = isset($addWhere[5]) ? $addWhere : ""; $prefix = ''; $prefixall = Database::isPrefixAll(); if ($prefixall != false || $prefixall == 'no') { $prefix = Database::getPrefix(); } Database::query("update " . $prefix . "usergroups set {$setUpdates} where {$whereQuery} {$addWhere}"); // DBCache::removeDir('system/usergroup'); // DBCache::removeCache($listIDs,'system/usergroup'); if (!($error = Database::hasError())) { $loadData = self::get(array('where' => "where groupid IN ({$listIDs})")); $total = count($loadData); for ($i = 0; $i < $total; $i++) { $loadData[$i]['groupdata'] = self::lineToArray($loadData[$i]['groupdata']); Cache::saveKey($prefix . 'userGroup_' . $loadData[$i]['groupid'], serialize($loadData[$i])); } return true; } return false; }
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; }
public static function make($keyName, $inputData = array(), $addPath = '') { if (self::$enable == 'no') { return false; } // $inputData=base64_encode(serialize($inputData)); $inputData = serialize($inputData); // print_r($keyName); // die(); // Cache::setPath(CACHES_PATH.'dbcache/'); Cache::saveKey('dbcache/' . $addPath . '/' . $keyName, $inputData); // Cache::setPath(CACHES_PATH); return true; }
public static function saveCache($path) { if (self::$hasCache == 'yes') { $viewsData = ob_get_contents(); ob_end_clean(); $md5Data = md5($path); Cache::saveKey($md5Data, $viewsData); } }