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); }
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(); }
echo message::danger(lang::get('module_in_use')); } else { $sql->setTable('module'); $sql->setWhere('id=' . $id); $sql->delete(); echo message::success(lang::get('module_deleted')); } $action = ''; } if ($action == 'export') { module::sendExport($id); echo message::success(lang::get('module_export')); $action = ''; } if ($action == 'import') { $content = (array) apiserver::getModuleFile(); if ($id && isset($content[$id])) { $sql = sql::factory(); $sql->setTable('module'); $sql->addPost('name', $content[$id]['name']); $sql->addPost('input', $content[$id]['install']['input']); $sql->addPost('output', $content[$id]['install']['output']); $sql->addPost('blocks', $content[$id]['install']['blocks']); $sql->save(); echo message::success(sprintf(lang::get('module_install_success'), $content[$id]['name']), true); } if (ajax::is()) { $file = type::files('file'); $fileDir = dir::generated('modul_temp.json'); move_uploaded_file($file['tmp_name'], $fileDir); $string = file_get_contents($fileDir);