/** * Output all needed JavaScript * * @author Andreas Gohr <*****@*****.**> */ function js_out() { global $conf; global $lang; global $config_cascade; // The generated script depends on some dynamic options $cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js'); $cache->_event = 'JS_CACHE_USE'; // load minified version for some files $min = $conf['compress'] ? '.min' : ''; // array of core files $files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir() . 'script.js'); // add possible plugin scripts and userscript $files = array_merge($files, js_pluginscripts()); if (isset($config_cascade['userscript']['default'])) { $files[] = $config_cascade['userscript']['default']; } $cache_files = array_merge($files, getConfigFiles('main')); $cache_files[] = __FILE__; // check cache age & handle conditional request // This may exit if a cache can be used $cache_ok = $cache->useCache(array('files' => $cache_files)); http_cached($cache->cache, $cache_ok); // start output buffering and build the script ob_start(); // add some global variables print "var DOKU_BASE = '" . DOKU_BASE . "';"; print "var DOKU_TPL = '" . tpl_basedir() . "';"; // FIXME: Move those to JSINFO print "var DOKU_UHN = " . (int) useHeading('navigation') . ";"; print "var DOKU_UHC = " . (int) useHeading('content') . ";"; // load JS specific translations $json = new JSON(); $lang['js']['plugins'] = js_pluginstrings(); echo 'LANG = ' . $json->encode($lang['js']) . ";\n"; // load toolbar toolbar_JSdefines('toolbar'); // load files foreach ($files as $file) { echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n"; js_load($file); echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n"; } // init stuff if ($conf['locktime'] != 0) { js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")"); } // init hotkeys - must have been done after init of toolbar # disabled for FS#1958 js_runonstart('initializeHotkeys()'); // end output buffering and get contents $js = ob_get_contents(); ob_end_clean(); // compress whitespace and comments if ($conf['compress']) { $js = js_compress($js); } $js .= "\n"; // https://bugzilla.mozilla.org/show_bug.cgi?id=316033 http_cached_finish($cache->cache, $js); }
public function template($c) { $conn = $this->conn($c); // connection $cache = new cache(); $data["homepage_general"] = $cache->index($c, "homepage_general"); $data["homepage_files"] = $cache->index($c, "homepage_files"); /* languages */ $languages = $cache->index($c, "languages"); $data["languages"] = json_decode($languages); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* website menu header & footer */ $menu_array = $cache->index($c, "main_menu"); $menu_array = json_decode($menu_array); if ($menu_array) { $model_template_main_menu = new model_template_main_menu(); $data["main_menu"] = $model_template_main_menu->nav($menu_array, "header"); $data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer"); } /* components */ $components = $cache->index($c, "components"); $data["components"] = json_decode($components); /* multimedia */ $multimedia = $cache->index($c, "multimedia"); $data["multimedia"] = json_decode($multimedia); $news = $cache->index($c, "news"); $data["news"] = json_decode($news); $events = $cache->index($c, "events"); $data["events"] = json_decode($events); @(include $c["website.directory"] . "/homepage.php"); }
private function show_alert($index) { if (valid_input($index, VALIDATE_NUMBERS, VALIDATE_NONEMPTY) == false) { return; } else { if ($index >= count($this->alerts)) { return; } } list($title, $type, $column) = $this->alerts[(int) $index]; $cache = new cache($this->db, "dashboard_" . $this->user->username); if (($list = $cache->{$column}) === NULL) { $function = "get_" . $type . "_statistics"; $list = $this->model->{$function}($column); $cache->store($column, $list, $this->settings->dashboard_page_refresh * 60 - 1); } if ($list == false) { return; } $this->output->open_tag("list", array("title" => $title)); foreach ($list as $name => $item) { $this->output->add_tag("item", $name, array("count" => $item["today"], "change" => $item["change"])); } $this->output->close_tag(); }
public function archive_cache($cache_id, $comment, $months = 0) { global $opt, $login, $translate; $log = cachelog::createNew($cache_id, $login->userid); if ($log === false) { echo $this->name . ": cannot create log for cache {$cache_id}\n"; } else { $cache = new cache($cache_id); if (!$cache->setStatus(3) || !$cache->save()) { echo $this->name . ": cannot change status of cache {$cache_id}\n"; } else { // create log $log->setType(cachelog::LOGTYPE_ARCHIVED, true); $log->setOcTeamComment(true); $log->setDate(date('Y-m-d')); // Log without time, so that owner reactions will always appear AFTER // the system log, no matter if logged with or without date. // create log text in appropriate language $translated_comment = $translate->t($comment, '', '', 0, '', 1, $cache->getDefaultDescLanguage()); $translated_comment = str_replace('%1', $months, $translated_comment); $log->setText('<p>' . $translated_comment . '</p>'); $log->setTextHtml(1); if (!$log->save()) { echo $this->name . ": could not save archive log for cache {$cache_id}\n"; } } } }
public function execute() { if ($_SERVER["REQUEST_METHOD"] == "POST") { /* Update menu */ if ($this->model->menu_oke($_POST["menu"]) == false) { $this->show_menu_form($_POST["menu"]); } else { if ($this->model->update_menu($_POST["menu"]) == false) { $this->output->add_tag("result", "Error while updating menu."); } else { $this->output->add_tag("result", "The menu has been updated."); $this->user->log_action("menu updated"); header("X-Hiawatha-Cache-Remove: all"); $cache = new cache($this->db, "menu"); $cache->store("last_updated", time(), 365 * DAY); } } } else { /* Show menu */ if (($menu = $this->model->get_menu()) === false) { $this->output->add_tag("result", "Error loading menu."); } else { $this->show_menu_form($menu); } } }
public function template($c, $page) { $conn = $this->conn($c); $cache = new cache(); $text_general = $cache->index($c, "text_general"); $data["text_general"] = json_decode($text_general, true); $welcomepage_categories = $cache->index($c, "welcomepage_categories"); $data["welcomepage_categories"] = json_decode($welcomepage_categories, true); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); $sql = 'SELECT `namelname`,`picture` FROM `studio404_users` WHERE `id`=:id'; $prepare = $conn->prepare($sql); $prepare->execute(array(":id" => $_SESSION["batumi_id"])); if ($prepare->rowCount() > 0) { $fetch = $prepare->fetch(PDO::FETCH_ASSOC); $data["userdata"] = $fetch; } else { redirect::url(WEBSITE); } /* catalog list */ $userlist = $cache->index($c, "userlist"); $data['userlist'] = json_decode($userlist, true); $include = WEB_DIR . "/momxmareblismarTva.php"; if (file_exists($include)) { @(include $include); } else { $controller = new error_page(); } }
public function template($c, $page) { $conn = $this->conn($c); $cache = new cache(); $text_general = $cache->index($c, "text_general"); $data["text_general"] = json_decode($text_general, true); $welcomepage_categories = $cache->index($c, "welcomepage_categories"); $data["welcomepage_categories"] = json_decode($welcomepage_categories, true); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* Upload Users profile picture */ if (isset($_FILES["profileimage"]["name"])) { $model_template_upload_user_logo = new model_template_upload_user_logo(); $upload = $model_template_upload_user_logo->upload($c); } $sql = 'SELECT `username`,`user_type`,`namelname`,`dob`,`email`,`mobile`,`address`,`picture` FROM `studio404_users` WHERE `id`=:id'; $prepare = $conn->prepare($sql); $prepare->execute(array(":id" => $_SESSION["batumi_id"])); if ($prepare->rowCount() > 0) { $fetch = $prepare->fetch(PDO::FETCH_ASSOC); $data["userdata"] = $fetch; } else { redirect::url(WEBSITE); } $include = WEB_DIR . "/profilisredaqtireba.php"; if (file_exists($include)) { @(include $include); } else { $controller = new error_page(); } }
public function index() { $data = ['text' => "tolga"]; $cache = new cache(); $cache->cacheStart(); _log_("heder.txt"); self::view('home/index', $data); $cache->cacheEnd(); }
public function template($c) { $conn = $this->conn($c); // connection $cache = new cache(); $team_general = $cache->index($c, "team_general"); $data["team_general"] = json_decode($team_general, true); $team_list = $cache->index($c, "team_list"); $data["team_list"] = json_decode($team_list); /* languages */ $languages = $cache->index($c, "languages"); $data["languages"] = json_decode($languages); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* website menu header & footer */ $menu_array = $cache->index($c, "main_menu"); $menu_array = json_decode($menu_array); $model_template_main_menu = new model_template_main_menu(); $data["main_menu"] = $model_template_main_menu->nav($menu_array, "header"); $data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer"); /* website left menu */ $left_menu = $cache->index($c, "left_menu"); $left_menu = json_decode($left_menu); $data["left_menu"] = $model_template_main_menu->left($left_menu); /* breadcrups */ $breadcrups = $cache->index($c, "breadcrups"); $data["breadcrups"] = json_decode($breadcrups); /* components */ $components = $cache->index($c, "components"); $data["components"] = json_decode($components); @(include $c["website.directory"] . "/team.php"); }
public function nav($menu_array, $type) { // echo "<pre>"; // print_r($menu_array); // echo "</pre>"; $get_slug_from_url = new get_slug_from_url(); $slug = $get_slug_from_url->slug(); if ($type == "header") { $o = '<ul class="nav navbar-nav">'; for ($x = 0; $x < count($menu_array->date); $x++) { $active = $menu_array->slug[$x] == $slug ? 'active' : ''; if ($menu_array->sub[$x]) { $o .= '<li class="dropdown ' . $active . '">'; $o .= '<a href="' . MAIN_DIR . $menu_array->slug[$x] . '?v=<?=$menu_array->idx[$x]?>" class="sub_menu_arrow dropdown-toggle" data-toggle="dropdown">' . $menu_array->title[$x] . '</a>'; $o .= $this->sub($menu_array->sub[$x], $slug, "header"); $o .= '</li>'; } else { $o .= '<li class="' . $active . '"><a href="' . MAIN_DIR . $menu_array->slug[$x] . '?v=' . $menu_array->idx[$x] . '">' . $menu_array->title[$x] . '</a></li>'; } } $o .= '</ul>'; } else { if ($type == "footer") { $o = ''; for ($x = 0; $x < count($menu_array->date); $x++) { if ($menu_array->sub[$x]) { // if($x==1){ $offset = ' col-sm-offset-1'; }else{ $offset=""; } // $o .= '<div class="col-sm-2'.$offset.'"><ul class="text_formats_blue">'; $o .= '<div class="col-sm-2"><ul class="text_formats_blue">'; $o .= '<li>'; //'.MAIN_DIR.$menu_array->slug[$x].' $o .= '<a href="javascript:;"><span>' . $menu_array->title[$x] . '</span></a>'; $o .= '</li>'; $o .= $this->sub($menu_array->sub[$x], $slug, "footer"); $o .= '</ul></div>'; } } $o .= '<div class="col-sm-2"><ul class="text_formats_blue">'; $o .= '<li>'; $contactname = LANG == "en" ? 'Contact us' : 'კონტაქტი'; $o .= '<a href="' . MAIN_DIR . 'contact-us"><span>' . $contactname . '</span></a>'; $o .= '</li>'; /* language variables */ $cache = new cache(); $language_data = $cache->index($_SESSION["c"], "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); $o .= '<li>' . $data["language_data"]["hotlinelabel"] . '</li>'; $o .= '<li>' . $data["language_data"]["hotlinevalue"] . '</li>'; $o .= '</ul></div>'; } } return $o; }
public function template($c) { $conn = $this->conn($c); // connection $cache = new cache(); $homepage_general = $cache->index($c, "homepage_general"); $data["homepage_general"] = json_decode($homepage_general); $text_general = $cache->index($c, "text_general"); $data["text_general"] = json_decode($text_general, true); $photo_gallery_list = $cache->index($c, "photo_gallery_list"); $data["photo_gallery_list"] = json_decode($photo_gallery_list); /* languages */ $languages = $cache->index($c, "languages"); $data["languages"] = json_decode($languages); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* website menu header & footer */ $menu_array = $cache->index($c, "main_menu"); $menu_array = json_decode($menu_array); $model_template_main_menu = new model_template_main_menu(); $data["main_menu"] = $model_template_main_menu->nav($menu_array, "header"); $data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer"); /* website left menu */ /* fotogallery */ $fotogallery = $cache->index($c, "files_"); $data["fotogallery"] = json_decode($fotogallery); /* components */ $components = $cache->index($c, "components"); $data["components"] = json_decode($components); @(include $c["website.directory"] . "/photogallery.php"); }
public function index($name = '') { $data = ['text' => $name]; $cache = new cache(); $cache->app_url = "core"; $cache->caching = false; $cache->cacheStart(); _log_("heder.txt"); $this->view('home/index', $data); $cache->cacheEnd(); }
public function template($c, $page) { $conn = $this->conn($c); $cache = new cache(); $text_general = $cache->index($c, "text_general"); $data["text_general"] = json_decode($text_general, true); /* categories list */ $welcomepage_categories = $cache->index($c, "welcomepage_categories"); $data["welcomepage_categories"] = json_decode($welcomepage_categories, true); /* all columns catalog table */ $catalog_table_columns = $cache->index($c, "catalog_table_columns"); $data["catalog_table_columns"] = json_decode($catalog_table_columns, true); /* all columns catalog table */ // $select_form = $cache->index($c,"select_form"); // $data["select_form"] = json_decode($select_form,true); $cid = Input::method("GET", "parent"); $select_form = new select_form(); $data["select_form"] = $select_form->form($c, $cid, LANG_ID); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); $sql = 'SELECT `namelname`,`picture` FROM `studio404_users` WHERE `id`=:id'; $prepare = $conn->prepare($sql); $prepare->execute(array(":id" => $_SESSION["batumi_id"])); if ($prepare->rowCount() > 0) { $fetch = $prepare->fetch(PDO::FETCH_ASSOC); $data["userdata"] = $fetch; } else { redirect::url(WEBSITE); } if (Input::method("GET", "parent") != "") { $parent = 'SELECT `idx`,`title` FROM `studio404_pages` WHERE `idx`=:idx AND `cid`=4 AND `status`!=1 AND `lang`=:lang'; $prepareParent = $conn->prepare($parent); $prepareParent->execute(array(":idx" => Input::method("GET", "parent"), ":lang" => LANG_ID)); if ($prepareParent->rowCount() > 0) { $parent_fetch = $prepareParent->fetch(PDO::FETCH_ASSOC); $data["parent_idx"] = $parent_fetch["idx"]; $data["parent_title"] = $parent_fetch["title"]; } else { redirect::url(WEBSITE . LANG . "/katalogis-marTva"); } } else { redirect::url(WEBSITE . LANG . "/katalogis-marTva"); } $include = WEB_DIR . "/formismarTva.php"; if (file_exists($include)) { @(include $include); } else { $controller = new error_page(); } }
public function template($c, $page) { $conn = $this->conn($c); // connection $cache = new cache(); $welcomepage_categories = $cache->index($c, "welcomepage_categories"); $data["welcomepage_categories"] = json_decode($welcomepage_categories, true); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); $sql = 'SELECT `namelname`,`picture` FROM `studio404_users` WHERE `id`=:id'; $prepare = $conn->prepare($sql); $prepare->execute(array(":id" => $_SESSION["batumi_id"])); if ($prepare->rowCount() > 0) { $fetch = $prepare->fetch(PDO::FETCH_ASSOC); $data["userdata"] = $fetch; } else { redirect::url(WEBSITE); } $sql2 = 'SELECT `studio404_messages`.*, `studio404_users`.`namelname` AS fromusername FROM `studio404_messages`, `studio404_users` WHERE `studio404_messages`.`fromuser`="' . $_SESSION["batumi_id"] . '" AND `studio404_messages`.`draft`=1 AND NOT FIND_IN_SET("' . $_SESSION["batumi_id"] . '",`studio404_messages`.`status`) AND `studio404_messages`.`tousers`=`studio404_users`.`id` ORDER BY `studio404_messages`.`date` DESC LIMIT 20'; $prepare2 = $conn->prepare($sql2); $prepare2->execute(); if ($prepare2->rowCount() > 0) { $fetch2 = $prepare2->fetchAll(PDO::FETCH_ASSOC); $data["messages"] = $fetch2; } else { $data["messages"] = array(); } $catalog_general = $cache->index($c, "catalog_general"); $data["catalog_general"] = json_decode($catalog_general, true); $catalogitemsnovisiable = $cache->index($c, "catalogitemsnovisiable"); $data["catalogitems"] = json_decode($catalogitemsnovisiable, true); $include = WEB_DIR . "/draft.php"; if (file_exists($include)) { @(include $include); } else { $controller = new error_page(); } }
public function select_all($c) { $cache = new cache(); $footernavigation = $cache->index($c, "footernavigation"); $out["footernavigation"] = json_decode($footernavigation, true); $o = ''; foreach ($out["footernavigation"] as $value) { $o .= '<ul>'; $o .= '<span>' . $value['title'] . ': </span> '; $o .= $this->select_sub($c, $value['idx']); $o .= '</ul>'; } return $o; }
public function template($c) { $cache = new cache(); $text_general = $cache->index($c, "text_general"); $data["text_general"] = json_decode($text_general, true); /* languages */ $languages = $cache->index($c, "languages"); $data["languages"] = json_decode($languages); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* website menu header & footer */ $menu_array = $cache->index($c, "main_menu"); $menu_array = json_decode($menu_array); $model_template_main_menu = new model_template_main_menu(); $data["main_menu"] = $model_template_main_menu->nav($menu_array, "header"); $data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer"); /* website left menu */ $left_menu = $cache->index($c, "left_menu"); $left_menu = json_decode($left_menu); $data["left_menu"] = $model_template_main_menu->left($left_menu); /* breadcrups */ $breadcrups = $cache->index($c, "breadcrups"); $data["breadcrups"] = json_decode($breadcrups); /* components */ $components = $cache->index($c, "components"); $data["components"] = json_decode($components); $include = WEB_DIR . "/loadmap.php"; if (file_exists($include)) { @(include $include); } }
public function template($c) { $conn = $this->conn($c); // connection $cache = new cache(); // $text_general = $cache->index($c,"text_general"); // $data["text_general"] = json_decode($text_general,true); $files_ = $cache->index($c, "files_"); $data["files_"] = json_decode($files_); /* breadcrups */ $breadcrups = $cache->index($c, "breadcrups"); $data["breadcrups"] = json_decode($breadcrups); @(include $c["website.directory"] . "/gallery.php"); }
public function template($c, $page) { $conn = $this->conn($c); // connection $cache = new cache(); $homepage_general = $cache->index($c, "homepage_general"); $data["homepage_general"] = json_decode($homepage_general); $text_files = $cache->index($c, "text_files"); $data["text_files"] = json_decode($text_files); $text_documents = $cache->index($c, "text_documents"); $data["text_documents"] = json_decode($text_documents); /* languages */ $languages = $cache->index($c, "languages"); $data["languages"] = json_decode($languages); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* website menu header & footer */ $menu_array = $cache->index($c, "main_menu"); $menu_array = json_decode($menu_array); $model_template_main_menu = new model_template_main_menu(); $data["main_menu"] = $model_template_main_menu->nav($menu_array, "header"); $data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer"); /* components */ $components = $cache->index($c, "components"); $data["components"] = json_decode($components); $include = WEB_DIR . "/epigraphy.php"; if (file_exists($include)) { @(include $include); } else { $controller = new error_page(); } }
public function template($c, $page) { $conn = $this->conn($c); // connection $cache = new cache(); $text_general = $cache->index($c, "text_general"); $data["text_general"] = json_decode($text_general, true); $structure = $cache->index($c, "structure"); $structure = json_decode($structure); $structure_array = new structure_array(); $data["structure"] = $structure_array->mk($structure); $data["structure_m"] = $structure; /* contact_page_data */ $contact_page_data = $cache->index($c, "contact_page_data"); $data["contact_data"] = json_decode($contact_page_data, true); /* languages */ $languages = $cache->index($c, "languages"); $data["languages"] = json_decode($languages); /* language variables */ $language_data = $cache->index($c, "language_data"); $language_data = json_decode($language_data); $model_template_makevars = new model_template_makevars(); $data["language_data"] = $model_template_makevars->vars($language_data); /* website menu header & footer */ $menu_array = $cache->index($c, "main_menu"); $menu_array = json_decode($menu_array); $model_template_main_menu = new model_template_main_menu(); $data["main_menu"] = $model_template_main_menu->nav($menu_array, "header"); $data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer"); /* website left menu */ $left_menu = $cache->index($c, "left_menu"); $left_menu = json_decode($left_menu); $data["left_menu"] = $model_template_main_menu->left($left_menu); /* breadcrups */ $breadcrups = $cache->index($c, "breadcrups"); $data["breadcrups"] = json_decode($breadcrups); /* components */ $components = $cache->index($c, "components"); $data["components"] = json_decode($components); $include = WEB_DIR . "/struqtura.php"; if (file_exists($include)) { /* ** Here goes any code developer wants to */ @(include $include); } else { $controller = new error_page(); } }
function loadPHPBB3($path) { global $phpbb_root_path, $phpEx; global $db, $user, $auth, $template, $cache, $config, $phpbb_hook, $sql_db; if (!defined('IN_PHPBB')) { define('IN_PHPBB', true); } if (!defined('STRIP')) { define('STRIP', get_magic_quotes_gpc() ? true : false); } if (!defined('JPATH_FORUM')) { define('JPATH_FORUM', $path); } // Create the JConfig object require_once JPATH_FORUM . DS . 'configuration.php'; $config = new JConfigForum(); $phpbb_root_path = JPATH_ROOT . DS . $config->phpbb_path . DS; $phpEx = substr(strrchr(__FILE__, '.'), 1); //Load configuration require $phpbb_root_path . 'config.php'; // Include files require_once $phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.php'; require_once $phpbb_root_path . 'includes/cache.php'; require_once $phpbb_root_path . 'includes/template.php'; require_once $phpbb_root_path . 'includes/session.php'; require_once $phpbb_root_path . 'includes/auth.php'; require_once $phpbb_root_path . 'includes/functions.php'; require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'includes/db/' . $dbms . '.php'; require_once JPATH_FORUM . DS . 'includes' . DS . 'utf8.php'; // Instantiate some basic classes $user = new user(); $auth = new auth(); $template = new template(); $cache = new cache(); $db = new $sql_db(); // Connect to DB $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); // We do not need this any longer, unset for safety purposes unset($dbpasswd); // Grab global variables, re-cache if necessary $config = $cache->obtain_config(); // Add own hook handler require_once $phpbb_root_path . 'includes/hooks/index.' . $phpEx; $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); foreach ($cache->obtain_hooks() as $hook) { @(include $phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } }
private function _accessToken() { require_once 'class.cacheFile.php'; $cache = new cache(); $access_token = $cache->get('access_token'); if ($access_token === NULL) { $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . APPID . "&secret=" . AppSecrect; $status = $this->_httpRequest($url); $status = json_decode($status, true); //将对象转为数组 $access_token = $status['access_token']; $cache->set('access_token', $access_token, 7200); } return $access_token; }
public function template($c) { $conn = $this->conn($c); // connection $cache = new cache(); /* contact_page_data */ $contact_page_data = $cache->index($c, "contact_page_data"); $data["contact_data"] = json_decode($contact_page_data, true); $files_ = $cache->index($c, "files_"); $data["files_"] = json_decode($files_); /* breadcrups */ $breadcrups = $cache->index($c, "breadcrups"); $data["breadcrups"] = json_decode($breadcrups); @(include $c["website.directory"] . "/gallery.php"); }
/** * Подсчёт кол-ва контента в данном месяце и в данном году * @param int $month данный месяц * @param int $year данный год * @return string JS массив кол-ва торрентов по дням */ public function count_content($month = null, $year = null) { $month = !$month ? date("n") : $month; $year = !$year ? date("Y") : $year; if (!($r = cache::o()->read('calendar/c' . $month . '-' . $year))) { $year_after = $month == 12 ? $year + 1 : $year; $month_after = $month < 12 ? $month + 1 : 1; $from = mktime(null, null, null, $month, 1, $year); $to = mktime(null, null, null, $month_after, 1, $year_after); $datas = db::o()->p($from, $to)->query('SELECT posted_time FROM content WHERE posted_time BETWEEN ? AND ?'); //$count = count($datas); $content = array(); while ($data = db::o()->fetch_assoc($datas)) { $day = date("j", $data["posted_time"]); $content[$day]++; } $ncontent = ""; for ($i = 0; $i <= 31; $i++) { $ncontent .= ($ncontent !== "" ? ", " : "") . longval($content[$i]); } $r = array("new Array(" . $ncontent . ")"); cache::o()->write($r); } return $r[0]; }
public final function show() { if (func_num_args() > 0) { $args = func_get_args(); if (count($args) == 1 && is_array($args[0])) { $this->setValues($args[0]); } else { $this->setValues($args); } } if ($this->nocache) { echo $this->generate(); return; } $fname = get_class($this) . '->show'; $sname = base64_encode(gzcompress(serialize(array(get_class($this), spl_object_hash($this), 'show', $this->values)))); $value = cache::checkFunc($fname, $sname, $result); if ($result === true) { if (strlen($value['output']) > 0) { echo $value['output']; } return $value['result']; } $r = null; ob_start(); echo $this->generate(); $output = ob_get_contents(); ob_end_flush(); return cache::func($fname, $sname, $r, $output); }
/** * 重构find方法,增加缓存的调用. * * @author 笨笨天才@20101127 * * $params['cache']=array('use'=>true,'config'=>'short'); * short是core.php定义的Cache:Config,默认为null * * @param string $type 输入类型 * @param mixed $params 输入参数 * @param bool $params['cache']['use'] 是否使用缓存标志 * @param string $params['cache']['config'] 缓存类型 * * @return mixed $data 返回值 */ public function find($type, $params = array()) { //!isset($params['cache']) if (isset($params['cache']) && $params['cache']['use'] !== false) { //判断是否不读取缓存数据 $cache_config = isset($params['cache']['config']) ? $params['cache']['config'] : null; $model = isset($this->name) ? '_' . $this->name : 'appmodel'; $paramsHash = md5(serialize($params)); $cache_key = $model . '_' . $type . '_' . $this->locale . '_' . $paramsHash; //根据模型名称,type参数,多语言,params组成缓存唯一序号 // echo $params['cache']['config']."----".$cache_key."<br />"; //pr($cache_config); $data = cache::read($cache_key, $cache_config); //print_r($params); if ($data) { // echo "cached:".$cache_key."<br /><pre>"; return $data; } else { //echo "not find cached:".$cache_key."<br /><pre>"; //print_r($params); $data = parent::find($type, $params); cache::write($cache_key, $data, $cache_config); //将数据库的值写入缓存 return $data; } } else { //echo "no cache:".$cache_key."<br /><pre>"; return parent::find($type, $params); } }
public function prepare() { global $settings; $this->template = "players"; $this->tab = "player"; $this->title = "Player search"; if ($this->request['search']) { // Split out URLs! :x $str = trim($this->request['search']); $str_array = explode('/', $str); $sbit = $str_array[count($str_array) - 1]; if (!$sbit) { $sbit = $str_array[count($str_array) - 2]; } header('Location: /player/' . $sbit); } else { @(include 'cache/valve_employees.php'); global $VALVE_EMPLOYEES; $views = cache::Memcached()->get('player_views'); if ($views === false) { $json = file_get_contents($settings['cache']['folder'] . 'player_views.json'); $views = json_decode($json, true); cache::Memcached()->set('player_views', $views, time() + 60 * 15); } $this->params['views'] = $views; $this->params['valve_employees'] = $VALVE_EMPLOYEES; } }
/** * Check whether the filter matches the specified tour and/or context. * * @param tour $tour The tour to check * @param context $context The context to check * @return boolean */ public static function filter_matches(tour $tour, context $context) { global $USER; $values = $tour->get_filter_values(self::get_filter_name()); if (empty($values)) { // There are no values configured. // No values means all. return true; } if (is_siteadmin()) { return true; } // Presence within the array is sufficient. Ignore any value. $values = array_flip($values); $cache = \cache::make_from_params(\cache_store::MODE_REQUEST, 'tool_usertours', 'filter_role'); $cachekey = "{$USER->id}_{$context->id}"; $userroles = $cache->get($cachekey); if ($userroles === false) { $userroles = get_user_roles_with_special($context); $cache->set($cachekey, $userroles); } foreach ($userroles as $role) { if (isset($values[$role->roleid])) { return true; } } return false; }
private function lookup_constituency($postcode) { $cache = cache::factory(); $cached = $cache->get('twfy' . $postcode); if (isset($cached) && $cached !== false && $cached != '') { return $cached; } else { if (COUNTRY_CODE_TLD == "uk") { $twfy = factory::create('twfy'); $twfy_constituency = $twfy->query('getConstituency', array('output' => 'php', 'postcode' => $postcode, 'future' => 'yes_please')); $twfy_constituency = unserialize($twfy_constituency); $success = $cache->set('twfy' . $postcode, $twfy_constituency); $twfy_constituency = array($twfy_constituency["name"]); } else { if (COUNTRY_CODE_TLD == "au") { $australian_postcode = factory::create("australian_postcode"); return $australian_postcode->lookup_constituency_names($postcode); } else { $success = false; } } if ($success && isset($twfy_constituency) && $twfy_constituency != '' && $twfy_constituency != false) { return $twfy_constituency; } else { return false; } } }
/** * Get the unique cache instance * * @param array $cfg Config for the cache instance * @return cache_abstract The instance */ public static function getInstance(array $cfg = array()) { if (!self::$cfg) { self::$cfg = new config(factory::loadCfg(__CLASS__)); } return factory::get('cache_' . self::$cfg->use, $cfg); }
function get_id64($player_id) { global $db, $settings; if (!is_id64($player_id)) { $url = sprintf("http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=%s&vanityurl=%s", $settings['api_key'], $player_id); } else { return $player_id; } // Try the easy way $i = $db->query_first("SELECT id64 FROM tf2_players WHERE custom_url = %s", array($player_id)); if ($i['id64']) { return $i['id64']; } require_once 'classes/cache.php'; $json_string = cache::get($url); try { $rgResult = json_decode($json_string, true); $rgResponse = $rgResult['response']; } catch (Exception $e) { // Bad XML data. Purge and throw an error cache::purge($url); $bad_xml = true; return false; //echo "BAD XML!!!: ".$url; } if ($rgResponse['success'] == k_EResultOK) { $id64 = $rgResponse['steamid']; // Update this in the db $db->query("UPDATE tf2_players SET custom_url=%s WHERE id64=%s", array($player_id, $id64)); } return $id64; }