/** * Draw admin page * */ function print_admin_page() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $options = $this->config->get_admin_options(); $wizard = new WizardController($this->config); if (!empty($_POST['start_wizard']) || empty($options['sphinx_conf']) && 'false' == $options['wizard_done']) { $this->view->menu = 'wizard'; $wizard->start_action(); } if (!empty($_GET['menu'])) { switch ($_GET['menu']) { case 'terms_editor': $terms_editor = new TermsEditorController($this->config); $terms_editor->index_action(); $this->view->menu = 'terms_editor'; //return; break; case 'stats': $stats = new StatsController($this->config); $stats->index_action(); $this->view->menu = 'stats'; //return; break; case 'search_settings': $this->view->menu = 'search_settings'; break; } } $sphinxService = new SphinxService($this->config); $res = false; $error_message = $success_message = ''; if (!empty($_POST['reindex_sphinx'])) { $res = $sphinxService->reindex(); $success_message = 'Sphinx successfully reindexed.'; } else { if (!empty($_POST['start_sphinx'])) { $res = $sphinxService->start(); $success_message = 'Sphinx successfully started.'; } elseif (!empty($_POST['stop_sphinx'])) { $res = $sphinxService->stop(); $success_message = 'Sphinx successfully stopped.'; } elseif (isset($_POST['update_SphinxSearchSettings'])) { $this->update_options(); $success_message = 'Settings updated.'; } } if (is_array($res)) { $error_message = $res['err']; } $this->view->assign('index_modify_time', $sphinxService->get_index_modify_time()); if (!empty($error_message)) { $this->view->assign('error_message', $error_message); } if (!empty($success_message)) { $this->view->assign('success_message', $success_message); } $devOptions = $this->config->get_admin_options(); //update options $this->view->assign('devOptions', $devOptions); //load admin panel template $this->view->assign('header', 'Sphinx Search for Wordpress'); $this->view->assign('is_sphinx_path_secure', $this->_isSphinxPathSecure()); if ('true' != $devOptions['check_stats_table_column_status']) { global $table_prefix; $this->view->assign('error_message', "{$table_prefix}sph_stats table required an update.<br>\n Please run the following command in MySQL client to update the table: <br>\n alter table {$table_prefix}sph_stats add `status` tinyint(1) NOT NULL DEFAULT '0';\n <br><br>\n This update will allow to use Sphinx Search for Top/Related and Latest search terms widgets!"); } $this->view->render('admin/layout.phtml'); }
<?php function check_logged_in() { BaseController::check_logged_in(); } function check_admin_logged_in() { BaseController::check_admin_logged_in(); } // Stats $routes->get('/', function () { StatsController::stats(); }); $routes->get('/stats', function () { StatsController::stats(); }); // Radat // Ratojen listaussivu $routes->get('/course', 'check_logged_in', function () { CourseController::index(); }); // Radan lisääminen tietokantaan $routes->post('/course', 'check_logged_in', function () { CourseController::store(); }); // Radan lisäyssivu $routes->get('/course/new', 'check_logged_in', function () { CourseController::create(); }); // Radan esittelysivu