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); }
<?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();
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 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(); }