public function listAll($title) { if ($title == "siteSettings") { $settingsArray = array(); $languages = languages::get(); foreach ($languages as $language) { $settingsArray['languages'][$language->id] = $language->languageTitle; } $settings = settings::get(); foreach ($settings as $setting) { $settingsArray['settings'][$setting->fieldName] = $setting->fieldValue; } $settingsArray['settings']['activatedModules'] = json_decode($settingsArray['settings']['activatedModules'], true); if (!is_array($settingsArray['settings']['activatedModules'])) { $settingsArray['settings']['activatedModules'] = array(); } $settingsArray['settings']['officialVacationDay'] = json_decode($settingsArray['settings']['officialVacationDay'], true); if (!is_array($settingsArray['settings']['officialVacationDay'])) { $settingsArray['settings']['officialVacationDay'] = array(); } $settingsArray['settings']['daysWeekOff'] = json_decode($settingsArray['settings']['daysWeekOff'], true); if (!is_array($settingsArray['settings']['daysWeekOff'])) { $settingsArray['settings']['daysWeekOff'] = array(); } $settingsArray['smsProvider'] = json_decode($this->panelInit->settingsArray['smsProvider']); $settingsArray['mailProvider'] = json_decode($this->panelInit->settingsArray['mailProvider']); return $settingsArray; } if ($title == "terms") { $settings = settings::where('fieldName', 'schoolTerms')->first()->toArray(); $settings['fieldValue'] = htmlspecialchars_decode($settings['fieldValue'], ENT_QUOTES); return $settings; } }
function view() { events::observe('save', 'pages', 'settings', 'save'); events::observer(); $settings = settings::get('pages'); f::set($settings); }
function view() { events::observe('save', 'feedback'); events::observer(); $settings = settings::get('feedback'); f::set($settings); }
public function showMCServer($id) { if (count(DB::table('mcservers')->where('mcs_id', '=', $id)->first())) { $title = settings::get("siteName") . " - Servidor De Minecraft"; return View::make('index.MCServer')->with('title', $title)->with('id', $id); } else { return Redirect::to(URL::to('/minecraft')); } }
function sendFeedback() { $mail_content = params::get('message'); $email = params::get('email'); if (!empty($mail_content) && !empty($email)) { mail::from($email); mail::html($mail_content); mail::subject(settings::get('feedback', 'feedback_subject')); mail::send(settings::get('feedback', 'feedback_email')); headers::url('/contacts/success/'); } }
$varcache[$id] = $value; db_execquery($sql); } $setctl = new settings(); if (db_gconnect()) { define('DBCONNECTION', true); if (UTF8MODE) { db_execquery('SET NAMES utf8 COLLATE utf8_unicode_ci'); } $setctl->load(); if ($resetconfiguration) { $setctl->defaults(); echo 'Configuration has been reset. Set $resetconfiguration = false; and reload.'; die; } if (!$setctl->get('bundleconfigured')) { if (isset($bundleconfig) && is_array($bundleconfig)) { foreach ($bundleconfig as $name => $val) { $tval = $setctl->get($name); if (strlen($tval) == 0 || $tval == false || $tval == 0) { $setctl->set($name, $val); } } $setctl->set('bundleconfigured', 1); } } } else { define('DBCONNECTION', false); if (!$cfg['installerenabled']) { echo 'Can\'t connect to the database and the installer is disabled. (If you need to re-install switch $cfg[\'installerenabled\'] to true.)'; die;
public function showMinecraftList() { $title = settings::get("siteName") . " - Minecraft"; return View::make('index.minecraftList')->with('title', $title); }
public function __construct() { $this->panelItems = array("dashboard" => array("title" => "dashboard", "icon" => "fa fa-dashboard", "url" => URL::to('#'), "permissions" => array('admin', 'teacher', 'student', 'parent')), "staticContent" => array("title" => "staticPages", "icon" => "fa fa-file-text", "activated" => "staticpagesAct", "url" => "", "permissions" => array('admin', 'teacher', 'student', 'parent'), "children" => array("controlStatic" => array("title" => "controlPages", "url" => URL::to('#static'), "icon" => "fa fa-cog", "permissions" => array('admin')))), "messages" => array("title" => "Messages", "url" => URL::to('#messages'), "icon" => "fa fa-envelope", "permissions" => array('admin', 'teacher', 'student', 'parent')), "calender" => array("title" => "Calender", "url" => URL::to('#calender'), "icon" => "fa fa-calendar", "permissions" => array('admin', 'teacher', 'student', 'parent')), "classSchedule" => array("title" => "classSch", "url" => URL::to('#classschedule'), "icon" => "fa fa-list", "permissions" => array('admin', 'teacher', 'student', 'parent')), "attendance" => array("title" => "Attendance", "url" => "", "icon" => "fa fa-bar-chart", "activated" => "attendanceAct", "permissions" => array('admin', 'teacher'), "children" => array("controlAttendance" => array("title" => "Attendance", "url" => URL::to('#attendance'), "icon" => "fa fa-check", "permissions" => array('admin', 'teacher')), "statsAttendance" => array("title" => "attendanceStats", "url" => URL::to('#attendanceStats'), "icon" => "fa fa-bar-chart", "permissions" => array('admin', 'teacher')))), "vacation" => array("title" => "Vacation", "url" => URL::to('#vacation'), "icon" => "fa fa-coffee", "activated" => "vacationAct", "permissions" => array('teacher', 'student')), "myAttendance" => array("title" => "Attendance", "url" => URL::to('#attendanceStats'), "icon" => "fa fa-bar-chart", "activated" => "attendanceAct", "permissions" => array('student', 'parent')), "staffAttendance" => array("title" => "staffAttendance", "url" => URL::to('#staffAttendance'), "icon" => "fa fa-check", "activated" => "staffAttendanceAct", "permissions" => array('admin')), "library" => array("title" => "Library", "url" => URL::to('#library'), "icon" => "fa fa-folder-open", "activated" => "bookslibraryAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "media" => array("title" => "mediaCenter", "url" => URL::to('#media'), "icon" => "fa fa-video-camera", "activated" => "mediaAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "teachers" => array("title" => "teachers", "url" => URL::to('#teachers'), "icon" => "fa fa-suitcase", "permissions" => array('admin')), "students" => array("title" => "students", "url" => URL::to('#students'), "icon" => "fa fa-users", "permissions" => array('admin', 'teacher', 'parent')), "parents" => array("title" => "parents", "url" => URL::to('#parents'), "icon" => "fa fa-user", "permissions" => array('admin')), "gradelevels" => array("title" => "gradeLevels", "url" => URL::to('#gradeLevels'), "icon" => "fa fa-check-square-o", "permissions" => array('admin')), "materials" => array("title" => "studyMaterial", "url" => URL::to('#materials'), "icon" => "fa fa-book", "activated" => "materialsAct", "permissions" => array('admin', 'teacher', 'student')), "assignments" => array("title" => "Assignments", "url" => URL::to('#assignments'), "icon" => "fa fa-file-pdf-o", "activated" => "assignmentsAct", "permissions" => array('admin', 'teacher', 'student')), "examslist" => array("title" => "examsList", "url" => URL::to('#examsList'), "icon" => "fa fa-graduation-cap", "permissions" => array('admin', 'teacher', 'student', 'parent')), "onlineexams" => array("title" => "onlineExams", "url" => URL::to('#onlineExams'), "icon" => "fa fa-graduation-cap", "activated" => "onlineexamsAct", "permissions" => array('admin', 'teacher', 'student')), "newsboard" => array("title" => "newsboard", "url" => URL::to('#newsboard'), "icon" => "fa fa-bullhorn", "activated" => "newsboardAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "events" => array("title" => "events", "url" => URL::to('#events'), "icon" => "fa fa-clock-o", "activated" => "eventsAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "controlPayments" => array("title" => "Payments", "url" => URL::to('#payments'), "icon" => "fa fa-money", "activated" => "paymentsAct", "permissions" => array('admin', 'student', 'parent')), "transportations" => array("title" => "Transportation", "url" => URL::to('#transports'), "icon" => "fa fa-bus", "activated" => "transportAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "classes" => array("title" => "classes", "url" => URL::to('#classes'), "icon" => "fa fa-sitemap", "permissions" => array('admin')), "subjects" => array("title" => "Subjects", "url" => URL::to('#subjects'), "icon" => "fa fa-book", "permissions" => array('admin')), "reports" => array("title" => "Reports", "url" => URL::to('#reports'), "icon" => "fa fa-pie-chart", "activated" => "reportsAct", "permissions" => array('admin')), "adminTasks" => array("title" => "adminTasks", "url" => "", "icon" => "fa fa-cog", "permissions" => array('admin'), "children" => array("permissions" => array("title" => "permissions", "url" => URL::to('#permissions'), "icon" => "fa fa-male", "permissions" => array('admin')), "academicyear" => array("title" => "academicyears", "url" => URL::to('#academicYear'), "icon" => "fa fa-calendar-check-o", "permissions" => array('admin')), "promotion" => array("title" => "Promotion", "url" => URL::to('#promotion'), "icon" => "fa fa-arrow-up", "permissions" => array('admin')), "mailsms" => array("title" => "mailsms", "url" => URL::to('#mailsms'), "icon" => "fa fa-send", "permissions" => array('admin')), "mailsmsTemplates" => array("title" => "mailsmsTemplates", "url" => URL::to('#mailsmsTemplates'), "icon" => "fa fa-envelope-o", "permissions" => array('admin')), "polls" => array("title" => "Polls", "url" => URL::to('#polls'), "icon" => "fa fa-tasks", "activated" => "pollsAct", "permissions" => array('admin')), "dormitories" => array("title" => "Dormitories", "url" => URL::to('#dormitories'), "icon" => "fa fa-building-o", "permissions" => array('admin')), "siteSettings" => array("title" => "generalSettings", "url" => URL::to('#settings'), "icon" => "fa fa-cog", "permissions" => array('admin')), "languages" => array("title" => "Languages", "url" => URL::to('#languages'), "icon" => "fa fa-font", "permissions" => array('admin')), "admins" => array("title" => "Administrators", "url" => URL::to('#admins'), "icon" => "fa fa-gears", "permissions" => array('admin')), "terms" => array("title" => "schoolTerms", "url" => URL::to('#terms'), "icon" => "fa fa-file-text-o", "permissions" => array('admin'))))); $settings = settings::get(); foreach ($settings as $setting) { $this->settingsArray[$setting->fieldName] = $setting->fieldValue; } if ($this->settingsArray['lastUpdateCheck'] + 86400 < time()) { $sb = $this->sbApi(); if ($sb == "err") { exit; } $latestUpdate = @file_get_contents("http://cr-house.com/apps/schoex/latest"); $latestUpdate = @json_decode($latestUpdate, true); $settings = settings::where('fieldName', 'lastUpdateCheck')->first(); $settings->fieldValue = time(); $settings->save(); if (is_array($latestUpdate)) { $settings = settings::where('fieldName', 'latestVersion')->first(); $settings->fieldValue = $latestUpdate['v']; $settings->save(); } } $staticPages = staticPages::where('pageActive', '1')->get(); foreach ($staticPages as $pages) { $this->panelItems['staticContent']['children'][md5(uniqid())] = array("title" => $pages->pageTitle, "url" => URL::to('#static') . "/" . $pages->id, "icon" => "fa fa-file-text", "permissions" => array('admin', 'teacher', 'student', 'parent')); } //Languages $defLang = $defLang_ = $this->settingsArray['languageDef']; if (isset($this->settingsArray['languageAllow']) and $this->settingsArray['languageAllow'] == "1" and !Auth::guest() and \Auth::user()->defLang != 0) { $defLang = \Auth::user()->defLang; } //Theme $this->defTheme = $this->settingsArray['layoutColor']; if (isset($this->settingsArray['layoutColorUserChange']) and $this->settingsArray['layoutColorUserChange'] == "1" and !Auth::guest() and \Auth::user()->defTheme != "") { $this->defTheme = \Auth::user()->defTheme; } $language = languages::whereIn('id', array($defLang, 1))->get(); if (count($language) == 0) { $language = languages::whereIn('id', array($defLang_, 1))->get(); } foreach ($language as $value) { if ($value->id == 1) { $this->language = json_decode($value->languagePhrases, true); } else { $this->isRTL = $value->isRTL; $phrases = json_decode($value->languagePhrases, true); while (list($key, $value) = each($phrases)) { $this->language[$key] = $value; } } } //Selected academicYear if (Session::has('selectAcYear')) { $this->selectAcYear = Session::get('selectAcYear'); } else { $currentAcademicYear = academicYear::where('isDefault', '1')->first(); $this->selectAcYear = $currentAcademicYear->id; Session::put('selectAcYear', $this->selectAcYear); } $this->baseURL = Request::url('index.php'); if (strpos($this->baseURL, 'index.php') == false) { $this->baseURL = URL::to('index.php'); } }
return "Hello, {$name}"; } } configure(function () { $test = 'test'; set(array('views' => dirname(__FILE__) . '/templates')); set(array('extension' => function () { return '.' . end(explode('.', __FILE__)); })); }); after(function () { echo ". Good bye!"; }); get("/", function () { echo "Welcome to Frank"; echo settings::get('extension'); }); get("/template", function () { render('template', array('locals' => array('name' => 'template'))); }); template("template", function ($locals) { echo 'Hello from ' . $locals['name']; }); post("/post", function () { echo "post"; }); put("/put", function () { echo "put"; }); delete("/delete", function () { echo "delete";
public function main() { ?> <div id="main"> <?php $settings = settings::get(session::get(RUDE_SESSION_USER_ID)); ?> <table class="ui table segment square-corners celled"> <thead> <tr class="header"> <!--<th class="numeric">#</th>--> <th>Параметр</th> <th>Значение</th> </tr> </thead> <tbody> <tr id="setting-rector"> <td>Ректор</td> <td> <?php foreach ($settings as $parametr) { if ($parametr->name === 'rector') { ?> <div class="field"> <div class="ui left labeled input"> <input class="rector" name="value" type="text" value="<?php echo $parametr->value; ?> " placeholder="Значение"> </div> </div> <div class="field" hidden> <div class="ui left labeled input"> <input class="rector_id" name="rector_id" type="text" value="<?php echo $parametr->id; ?> " placeholder="Значение"> </div> </div> <?php } } ?> </td> </tr> <tr id="setting-rector"> <td>Отображать всплывающие окна</td> <td> <?php foreach ($settings as $parametr) { if ($parametr->name === 'popup') { ?> <div class="ui toggle checkbox"> <input type="checkbox" class="popup" <?php if ($parametr->value == 'true') { echo "checked='checked'"; } ?> > <label> </label> </div> <div class="field" hidden> <div class="ui left labeled input"> <input class="popup_id" name="popup_id" type="text" value="<?php echo $parametr->id; ?> " placeholder="Значение"> </div> </div> <?php } } ?> </td> </tr> </tbody> </table> <div class="ui blue submit button" value="add" onclick="save();">Сохранить</div> </div> <div id="done" class="ui small modal"> <i class="close icon"></i> <div class="header"> Выполнено успешно </div> <div class="content"> <p class="justify">Сохранение выполнено успешно.</p> </div> <div class="actions"> <div class="ui positive right labeled icon button"> Ок <i class="checkmark icon"></i> </div> </div> </div> <script> function save(){ var popup = $('.popup').prop('checked'); var popup_id = $('.popup_id').val(); var rector = $('.rector').val(); var rector_id = $('.rector_id').val(); $.post('/?page=settings&task=save&popup='+popup+'&popup_id='+popup_id+'&rector='+rector+'&rector_id='+rector_id+'&ajax=true') .done(function() { $('#done').modal('show');}); return false; } </script> <?php }
/** * Renders a template * * @param string $name Name of the template * @param array $options Options to control template rendering */ public static function render_template($name, $options) { $locals = isset($options['locals']) ? $options['locals'] : array(); $view_path = settings::get('views'); if (isset(self::$templates[$name])) { $template = self::$templates[$name]; ob_start(); call_user_func($template, $locals); $result = ob_get_contents(); ob_end_clean(); } elseif (file_exists($view_path . '/' . $name)) { $template = create_function('$path, $locals', 'require($path);'); ob_start(); $template($view_path . '/' . $name, $locals); $result = ob_get_contents(); ob_end_clean(); } if (isset($options['layout']) || settings::get('layout') !== false) { $layout = create_function('$path,$yield', 'require($path);'); if (isset($options['layout'])) { $file = $view_path . '/' . $options['layout']; } else { $file = $view_path . '/' . settings::get('layout'); } ob_start(); $layout($file, $result); $result = ob_get_contents(); ob_end_clean(); } self::$body .= $result; }
<?php //CloudFlare Proxys Request::setTrustedProxies(array('199.27.128.0/21', '173.245.48.0/20', '103.21.244.0/22', '103.22.200.0/22', '103.31.4.0/22', '141.101.64.0/18', '108.162.192.0/18', '190.93.240.0/20', '188.114.96.0/20', '197.234.240.0/22', '198.41.128.0/17', '162.158.0.0/15', '104.16.0.0/12')); //Pagina De Erro App::missing(function ($exception) { $title = settings::get("siteName") . " - 404"; return View::make('login.404')->with('title', $title); }); App::error(function (\Illuminate\Session\TokenMismatchException $exception) { return Redirect::route('login')->withErrors('A tua sessão expirou, faz login outra vez para continuar.'); }); //index Route::group(array('domain' => 'www.serverlist.pt'), function () { //Paginas Publicas Route::get('/', 'BaseController@showIndex'); Route::get('/minecraft', 'BaseController@showMinecraftList'); Route::get('/csgo', 'BaseController@showCSGOList'); Route::get('/cron', 'BaseController@cron'); Route::get('/dcron', 'BaseController@dcron'); Route::get('/embed/vote', 'EmbedController@showVote'); Route::get('/user/{id}', 'IndexController@showUser')->where(array('id' => '[0-9]+')); Route::get('/minecraft/{id}', 'IndexController@showMCServer')->where(array('id' => '[0-9]+')); Route::get('/communities', 'IndexController@showCommunitiesList'); //posts publicos Route::post('vote', array('before' => 'csrf', 'as' => 'vote', 'uses' => 'BaseController@postVote')); //não se pode estar logado para poder ver Route::group(array('before' => 'guest'), function () { //Paginas Route::get('/login', 'LoginController@showLogin'); Route::get('/activate', 'LoginController@showActivate');
function add() { events::observe('add', 'pages', 'addPage'); events::observer(); if (events::detect('add')) { return true; } if (events::detect('parent')) { $parent = events::get('parent'); db::table('pages'); db::where('page_id', $parent); db::update('page_child', '1'); f::set('page_parent', $parent); } admin::components('tabs', 'validator', 'upload'); if (settings::get('pages', 'redactor')) { admin::components('redactor'); s::section('redactor'); } appPages::getPagesSelect(ADMIN_SITE_ID); appPages::getParentPages(ADMIN_SITE_ID, true); appTemplates::getTmpls(ADMIN_SITE_ID); // test reserved db::table('admin_reserved'); db::where('`table`', 'pages'); db::where('user_id', ADMIN_USER_ID); $page_id = db::get('id'); if (db::rows() == 0) { db::table('pages'); $array = array('page_date' => 'NOW()', 'page_pub' => '2', 'page_handler' => '0', 'page_dynamic' => '0', 'page_cache' => '0', 'page_map' => '0', 'page_child' => '0', 'page_level' => 0, 'site_id' => ADMIN_SITE_ID); db::smartInsert($array); $page_id = mysql_insert_id(); db::table('admin_reserved'); db::insert('', 'pages', $page_id, ADMIN_USER_ID); } f::set('page_id', $page_id); }
function pageSettings($page) { $page_keywords_check = settings::get('pages', 'global_page_keywords_check'); $page_description_check = settings::get('pages', 'global_page_description_check'); if ($page_keywords_check === true) { $page['page_keywords'] = settings::get('pages', 'global_page_keywords'); } if ($page_description_check === true) { $page['page_description'] = settings::get('pages', 'global_page_description'); } $row['global_page_title'] = settings::get('pages', 'global_page_title'); if (empty($page['page_header'])) { $page['page_header'] = $page['page_title']; } return $page; }
public function showRecovery() { $title = settings::get("siteName") . " - Recuperar Conta"; return View::make('login.recovery')->with('title', $title); }