public static function getBlog() { $cacheFile = cache::getFileName(0, 'rpBlog'); // every 12 hours if (cache::exist($cacheFile, 43200)) { $content = json_decode(cache::read($cacheFile), true); } else { $content = apiserver::getBlogFile(); cache::write($content, $cacheFile); } $return = []; foreach ($content as $blog) { $return[] = ' <div class="item"> <div class="circle"></div> <div class="text"> <p><a target="_blank" href="' . $blog['link'] . '">' . $blog['name'] . '</a></p> <small>' . date(lang::get('dateformat'), strtotime($blog['date'])) . '</small> </div> </div> '; } return implode(PHP_EOL, $return); }
$cacheid = cache::cacheIdFromUUID($_REQUEST['uuid']); } else { if (isset($_REQUEST['wp'])) { $cacheid = cache::cacheIdFromWP($_REQUEST['wp']); } } } // important: when the domain does not fit the api key, you must be redirected to the correct domain if ($opt['lib']['garmin']['domain'] != $_SERVER['HTTP_HOST'] && !isset($_REQUEST['redirect'])) { $redirect = $opt['lib']['garmin']['redirect']; $redirect = str_replace('{cacheid}', $cacheid, $redirect); $tpl->redirect($redirect); exit; } $cache = new cache($cacheid); if ($cache->exist() == false) { $tpl->error(ERROR_CACHE_NOT_EXISTS); } if ($cache->allowView() == false) { $tpl->error(ERROR_NO_ACCESS); } $bCrypt = isset($_REQUEST['nocrypt']) ? $_REQUEST['nocrypt'] != 1 : true; $tpl->assign('crypt', $bCrypt); if (isset($_REQUEST['desclang'])) { $sPreferedDescLang = $_REQUEST['desclang'] . ',' . $opt['template']['locale'] . ',EN'; } else { $sPreferedDescLang = $opt['template']['locale'] . ',EN'; } //get cache record $rs = sql("SELECT\t`caches`.`cache_id` AS `cacheid`,\n\t\t\t\t`caches`.`user_id` AS `userid`,\n\t\t\t\t`caches`.`status` AS `status`,\n\t\t\t\t`caches`.`latitude` AS `latitude`,\n\t\t\t\t`caches`.`longitude` AS `longitude`,\n\t\t\t\t`caches`.`name` AS `name`,\n\t\t\t\t`caches`.`type` AS `type`,\n\t\t\t\t`caches`.`size` AS `size`,\n\t\t\t\t`caches`.`search_time` AS `searchtime`,\n\t\t\t\t`caches`.`way_length` AS `waylength`,\n\t\t\t\t`caches`.`country` AS `countryCode`,\n\t\t\t\tIFNULL(`ttCountry`.`text`, `countries`.`name`) AS `country`, \n\t\t\t\t`caches`.`logpw` AS `logpw`,\n\t\t\t\t`caches`.`date_hidden` AS `datehidden`,\n\t\t\t\t`caches`.`wp_oc` AS `wpoc`,\n\t\t\t\t`caches`.`wp_gc` AS `wpgc`,\n\t\t\t\t`caches`.`wp_nc` AS `wpnc`,\n\t\t\t\t`caches`.`date_created` AS `datecreated`,\n\t\t\t\t`caches`.`difficulty` AS `difficulty`,\n\t\t\t\t`caches`.`terrain` AS `terrain`,\n\t\t\t\t`cache_desc`.`language` AS `desclanguage`,\n\t\t\t\t`cache_desc`.`short_desc` AS `shortdesc`,\n\t\t\t\t`cache_desc`.`desc` AS `desc`,\n\t\t\t\t`cache_desc`.`hint` AS `hint`,\n\t\t\t\t`cache_desc`.`desc_html` AS `deschtml`,\n\t\t\t\tIFNULL(`stat_caches`.`found`, 0) AS `found`,\n\t\t\t\tIFNULL(`stat_caches`.`notfound`, 0) AS `notfound`,\n\t\t\t\tIFNULL(`stat_caches`.`note`, 0) AS `note`,\n\t\t\t\tIFNULL(`stat_caches`.`will_attend`, 0) AS `willattend`,\n\t\t\t\tIFNULL(`stat_caches`.`watch`, 0) AS `watcher`,\n\t\t\t\t`caches`.`desc_languages` AS `desclanguages`,\n\t\t\t\tIFNULL(`stat_caches`.`ignore`, 0) AS `ignorercount`,\n\t\t\t\tIFNULL(`stat_caches`.`toprating`, 0) AS `topratings`,\n\t\t\t\tIFNULL(`cache_visits`.`count`, 0) AS `visits`,\n\t\t\t\t`user`.`username` AS `username`,\n\t\t\t\tIFNULL(`cache_location`.`code1`, '') AS `code1`,\n\t\t\t\tIFNULL(`cache_location`.`adm1`, '') AS `adm1`,\n\t\t\t\tIFNULL(`cache_location`.`adm2`, '') AS `adm2`,\n\t\t\t\tIFNULL(`cache_location`.`adm3`, '') AS `adm3`,\n\t\t\t\tIFNULL(`cache_location`.`adm4`, '') AS `adm4`\n\t\t FROM `caches`\n\t\t INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n\t\t INNER JOIN `cache_desc` ON `caches`.`cache_id`=`cache_desc`.`cache_id` AND `cache_desc`.`language`=PREFERED_LANG(`caches`.`desc_languages`, '&3')\n\t\t LEFT JOIN `countries` ON `caches`.`country`=`countries`.`short`\n\t\t LEFT JOIN `sys_trans` AS `tCountry` ON `countries`.`trans_id`=`tCountry`.`id` AND `countries`.`name`=`tCountry`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttCountry` ON `tCountry`.`id`=`ttCountry`.`trans_id` AND `ttCountry`.`lang`='&2'\n\t\t LEFT JOIN `cache_visits` ON `cache_visits`.`cache_id`=`caches`.`cache_id` AND `user_id_ip`='0'\n\t\t LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`\n\t\t LEFT JOIN `cache_location` ON `caches`.`cache_id` = `cache_location`.`cache_id`\n\t\t WHERE `caches`.`cache_id`='&1'", $cacheid, $opt['template']['locale'], $sPreferedDescLang, $login->userid); $rCache = sql_fetch_assoc($rs);
<?php if (type::get('checkversion', 'int', 0) == 1) { $cacheFile = cache::getFileName(0, 'dynaoVersion'); cache::exist($cacheFile, 0); echo message::success(lang::get('connection_again'), true); } if (ajax::is()) { if (type::super('text')) { $mail = mail('*****@*****.**', 'Neue Idee', type::super('text'), 'From: ' . dyn::get('user')->get('firstname') . ' ' . dyn::get('user')->get('name') . '<' . dyn::get('user')->get('email') . '>'); if ($mail) { ajax::addReturn(message::success(lang::get('idea_send'))); } else { ajax::addReturn(message::danger(lang::get('idea_error'))); } } else { ajax::addReturn(message::danger(lang::get('idea_empty'))); } } $versionCheck = dyn::checkDynVersion(); if ($versionCheck === lang::get('version_fail_connect')) { $message = lang::get('version_fail_connect'); $message .= '<br /><a href="' . url::backend('dashboard', ['subpage' => 'overview', 'checkversion' => 1]) . '">' . lang::get('try_again') . '</a>'; echo message::danger($message, true); } elseif ($versionCheck) { echo message::danger($versionCheck, true); } $stats = []; $sql = sql::factory(); $numPages = $sql->num('SELECT * FROM ' . sql::table('structure')); $sql = sql::factory();
function cancelRequest($cacheid, $userid) { global $tpl, $login; // cache exists? $cache = new cache($cacheid); if ($cache->exist() == false) { $tpl->error(ERROR_CACHE_NOT_EXISTS); } if ($cache->allowEdit() == false && $login->userid != $userid) { $tpl->error(ERROR_NO_ACCESS); } if ($cache->cancelAdoption($userid) == false) { $tpl->error(ERROR_UNKNOWN); } if ($userid == $login->userid) { $tpl->redirect('adoptcache.php'); } else { $tpl->redirect('adoptcache.php?action=listbycache&cacheid=' . $cacheid); } }
function getValidLogTypes() { $cache = new cache($this->getCacheId()); if ($cache->exist() == false) { return array(); } // if ($cache->allowLog() == false) // return array(); // Logic Error - log types are still valid when no NEW logs are allowed for the cache. // (Would e.g. block admin logs and log-type restoring for locked caches.) return get_cache_log_types($this->getCacheId(), $this->getType()); // depends on userid }
public static function getModules() { $cacheFile = cache::getFileName(0, 'dynaoModules'); // jeden halben Tag if (cache::exist($cacheFile, 43200)) { $content = json_decode(cache::read($cacheFile), true); } else { $content = apiserver::getModulesFile(); cache::write($content, $cacheFile); } $table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]); $table->addCollsLayout('60, 140, *, 110'); $table->addRow()->addCell(lang::get('vote'))->addCell(lang::get('name'))->addCell(lang::get('description'))->addCell(); $table->addSection('tbody'); if (is_null($content) || !$content) { $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]); } else { foreach ($content as $addon) { $perc = round($addon['rate_sum'] / $addon['rate_ppl'] * 10); if ($perc < 33) { $class = 'danger'; } elseif ($perc < 66) { $class = 'warning'; } else { $class = 'success'; } $table->addRow()->addCell('<span class="label label-' . $class . '">' . $perc . '%</span>')->addCell($addon['title'])->addCell($addon['description'])->addCell('<a href="' . $addon['link'] . '" target="_blank" class="btn btn-sm btn-default">' . lang::get('import') . '</a>'); } } return $table->show(); }
/** * Den Cache laden */ protected static function loadCache() { $cacheFile = cache::getFileName(0, 'autoloadcache'); if (!cache::exist($cacheFile, 3600)) { return; } list(self::$classes, self::$dirs) = json_decode(cache::read($cacheFile), true); }
public static function exist($id, $time = false, $type = 'article') { $file = self::getFileName($id, $type); return parent::exist(self::FOLDER . DIRECTORY_SEPARATOR . $file, $time); }
public static function getAddons() { $cacheFile = cache::getFileName(0, 'dynaoAddons'); // jeden halben Tag if (cache::exist($cacheFile, 43200)) { $content = json_decode(cache::read($cacheFile), true); } else { $server = 'http://api.dynao.de/addons.json'; $ch = curl_init($server); curl_setopt($ch, CURLOPT_PORT, 80); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla (Statuscheck-Script)'); curl_setopt($ch, CURLOPT_TIMEOUT, 0); curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 300); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $curl = curl_exec($ch); curl_close($ch); $content = json_decode($curl, true); cache::write($content, $cacheFile); } $table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]); $table->addCollsLayout('60, 140, *, 110'); $table->addRow()->addCell(lang::get('vote'))->addCell(lang::get('name'))->addCell(lang::get('description'))->addCell(); $table->addSection('tbody'); if (is_null($content)) { $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]); } else { foreach ($content as $addon) { $perc = round($addon['rate_sum'] / $addon['rate_ppl'] * 10); if ($perc < 33) { $class = 'danger'; } elseif ($perc < 66) { $class = 'warning'; } else { $class = 'success'; } $table->addRow()->addCell('<span class="label label-' . $class . '">' . $perc . '%</span>')->addCell($addon['title'])->addCell($addon['description'])->addCell('<a href="' . $addon['link'] . '" target="_blank" class="btn btn-sm btn-default">' . lang::get('download') . '</a>'); } } return $table->show(); }
function getValidLogTypes() { $cache = new cache($this->getCacheId()); if ($cache->exist() == false) { return array(); } if ($cache->allowLog() == false) { return array(); } $nTypes = array(); $rs = sql("SELECT `log_type_id` FROM `cache_logtype` WHERE `cache_type_id`='&1'", $cache->getType()); while ($r = sql_fetch_assoc($rs)) { $nTypes[] = $r['log_type_id']; } sql_free_result($rs); return $nTypes; }