<?php include 'inc/init.php'; fAuthorization::requireLoggedIn(); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'ackAll', 'notifyAll')); $result_id = fRequest::get('result_id', 'integer'); $check_id = fRequest::get('check_id', 'integer'); $manage_url = $_SERVER['SCRIPT_NAME']; /*------------------------------------*/ if ($action == 'ackAll') { try { $check = new Check($check_id); if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); //$check->acknowledgeCheck(); Check::acknowledgeCheck($check, NULL, true); fMessaging::create('success', $manage_url, 'The alerts for ' . $check->getName() . ' were successfully acknowledged'); //fURL::redirect($manage_url); } } catch (fNotFoundException $e) { fMessaging::create('error', $manage_url, 'The check requested, ' . fHTML::encode($check_id) . ', could not be found'); fURL::redirect($manage_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/ackAll_results.php'; } else { if ($action == 'notifyAll') { try { $check = new Check($check_id); $subject_mail = fRequest::get('subject_mail');
/** * Gets the current sort direction * * @param string $default_direction The default direction, `'asc'` or `'desc'` * @return string The direction, `'asc'` or `'desc'` */ public static function getSortDirection($default_direction) { // Reset value if requested if (self::wasResetRequested()) { self::setPreviousSortDirection(NULL); return; } if (self::getPreviousSortDirection() && !fRequest::check('dir')) { self::$sort_direction = self::getPreviousSortDirection(); self::$loaded_values['dir'] = self::$sort_direction; } else { self::$sort_direction = fRequest::getValid('dir', array($default_direction, $default_direction == 'asc' ? 'desc' : 'asc')); self::setPreviousSortDirection(self::$sort_direction); } return self::$sort_direction; }
<?php include 'inc/init.php'; fRequest::overrideAction(); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'settings', 'delete')); if ($action != 'add') { fAuthorization::requireLoggedIn(); } $user_id = fRequest::get('user_id', 'integer'); if ('edit' == $action) { try { $user = new User($user_id); if (fRequest::isPost()) { $user->populate(); if ($GLOBALS['ALLOW_HTTP_AUTH'] && $user->getUserId() != 1) { $password = '******'; } else { $password = fCryptography::hashPassword($user->getPassword()); $user->setPassword($password); } fRequest::validateCSRFToken(fRequest::get('token')); $user->store(); fMessaging::create('affected', User::makeUrl('list'), $user->getUsername()); fMessaging::create('success', User::makeUrl('list'), 'The user ' . $user->getUsername() . ' was successfully updated'); fURL::redirect(User::makeUrl('list')); } } catch (fNotFoundException $e) { fMessaging::create('error', User::makeUrl('list'), 'The user requested, ' . fHTML::encode($user_id) . ', could not be found'); fURL::redirect(User::makeUrl('list')); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage());
if (fRequest::isPost()) { try { // Try to validate options $validator = new fValidation(); $validator->addOneOrMoreRule('col_c', 'col_y', 'col_m', 'col_k'); $validator->overrideFieldName(array('col_c' => 'Colour (Cyan)', 'col_y' => 'Colour (Yellow)', 'col_m' => 'Colour (Magenta)', 'col_k' => 'Colour (Black)')); $validator->validate(); // Populat and save consumable object from form values $c->populate(); $c->linkModels(); $c->store(); // Set status message fMessaging::create('affected', fURL::get(), $c->getName()); fMessaging::create('success', fURL::get(), 'The consumable ' . $c->getName() . ' was successfully added.'); // Redirect $next = fRequest::getValid('next', array('index', 'add')); if ($next === 'index') { fURL::redirect(fURL::get()); } elseif ($next === 'add') { fURL::redirect(fURL::get() . '?action=add'); } } catch (fValidationException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } } // Get manufacturers also for drop-down box #$manufacturers = fRecordSet::build('Manufacturer', NULL, array('name' => 'asc')); // Get list of models $models = Model::getSimple($db);
$breadcrumbs[] = array('name' => 'Dashboards', 'url' => Dashboard::makeUrl('list', $filter_group_id), 'active' => false); if (!isset($dashboard_id)) { $dashboard_id = fRequest::get('dashboard_id', 'integer'); } if (!isset($action)) { $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'view', 'export', 'mass_export', 'import')); } // Don't require login for tv monitors that just need to view the dashboards. Will add a public/private feature for dashboards as phase two if ($action != 'view') { fAuthorization::requireLoggedIn(); } if (!isset($full_screen)) { $full_screen = fRequest::get('full_screen', 'boolean', false); } $sort = fRequest::getValid('sort', array('name'), 'name'); $sortby = fRequest::getValid('sortby', array('asc', 'desc'), 'asc'); // --------------------------------- // if ('edit' == $action) { try { $dashboard = new Dashboard($dashboard_id); $graphs = Graph::findAll($dashboard_id); if (fRequest::isPost()) { $dashboard->populate(); fRequest::validateCSRFToken(fRequest::get('token')); $dashboard->store(); fMessaging::create('affected', fURL::get(), $dashboard->getName()); fMessaging::create('success', fURL::get(), 'The Dashboard ' . $dashboard->getName() . ' was successfully updated'); } } catch (fNotFoundException $e) { fMessaging::create('error', Dashboard::makeUrl('list'), 'The Dashboard requested ' . fHTML::encode($dashboard_id) . 'could not be found'); fURL::redirect(Dashboard::makeUrl('list'));
it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Print Master is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Print Master. If not, see <http://www.gnu.org/licenses/>. */ // Include initialisation file include_once 'inc/init.php'; // Get action from query string $action = fRequest::getValid('action', array('list')); /** * Default action - show report of consumable installation */ if ($action == 'list') { // Set the users to be sortable by name or email, defaulting to name $sort = fCRUD::getSortColumn(array('events.date', 'models.name', 'printers.name', 'consumables.name')); // Set the sorting to default to ascending $dir = fCRUD::getSortDirection('desc'); // Redirect the user if one of the values was loaded from the session fCRUD::redirectWithLoadedValues(); // Get recordset object from tables $sql = "SELECT\n\t\t\t\tCAST(CONCAT(manufacturers.name, ' ', models.name) AS CHAR) AS model,\n\t\t\t\tprinters.name AS printer_name,\n\t\t\t\tprinters.ipaddress,\n\t\t\t\tconsumables.name AS consumable_name,\n\t\t\t\tconsumables.col_c, consumables.col_y, consumables.col_m, consumables.col_k, \n\t\t\t\tevents.*\n\t\t\tFROM events\n\t\t\tLEFT JOIN consumables ON events.consumable_id = consumables.id\n\t\t\tLEFT JOIN printers ON events.printer_id = printers.id\n\t\t\tLEFT JOIN models ON printers.model_id = models.id\n\t\t\tLEFT JOIN manufacturers ON models.manufacturer_id = manufacturers.id\n\t\t\t{where}\n\t\t\tORDER BY {$sort} {$dir}"; // Get potential printer ID $printer_id = fRequest::get('printer_id', 'integer?'); if ($printer_id == NULL) {
Graph::cloneGraph($graph_id, $dashboard_dest_id); $url_redirect = Dashboard::makeURL('list'); fMessaging::create('affected', $url_redirect, $graph_to_clone->getName()); fMessaging::create('success', "/" . $url_redirect, 'The Graph "' . $graph_to_clone->getName() . '" was successfully cloned into the Dashboard "' . $dashboard->getName() . '"'); fURL::redirect($url_redirect); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } } include VIEW_PATH . '/list_dashboards.php'; } elseif ('reorder' == $action) { $drag_order = fRequest::get('drag_order'); $error = false; if (empty($drag_order)) { // In this case, the user clicks on the arrow $move = fRequest::getValid('move', array('previous', 'next')); $graph_to_move = new Graph($graph_id); $dashboard_id = $graph_to_move->getDashboardId(); $graphs_in_dashboard = Graph::findAll($dashboard_id); $number_of_graphs = $graphs_in_dashboard->count(TRUE); $skip_next = false; for ($i = 0; $i < $number_of_graphs; $i++) { if (!$skip_next) { $current_graph = $graphs_in_dashboard[$i]; if ($current_graph->getGraphId() != $graph_id) { // This isn't the concerned graph $current_graph->setWeight($i); } else { if ('previous' == $move) { if ($i > 0) { $current_graph->setWeight($i - 1);
<?php include 'inc/init.php'; fAuthorization::requireLoggedIn(); fRequest::overrideAction(); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'view')); $dashboard_id = fRequest::get('dashboard_id', 'integer?'); $graph_id = fRequest::get('graph_id', 'integer?'); $manage_url = $_SERVER['SCRIPT_NAME']; // --------------------------------- // if ('edit' == $action) { try { $graph = new Graph($graph_id); $dashboard = new Dashboard($graph->getDashboardId()); $lines = Line::findAll($graph_id); if (fRequest::isPost()) { $graph->populate(); fRequest::validateCSRFToken(fRequest::get('token')); $graph->store(); fMessaging::create('affected', fURL::get(), $graph->getName()); fMessaging::create('success', fURL::getWithQueryString(), 'The Graph ' . $graph->getName() . ' was successfully updated'); fURL::redirect(Dashboard::makeUrl('edit', $dashboard)); } } catch (fNotFoundException $e) { fMessaging::create('error', $manage_url, 'The Graph requested, ' . fHTML::encode($graph_id) . ', could not be found'); fURL::redirect($manage_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/add_edit_graph.php'; // --------------------------------- //
<?php define('TATTLE_ROOT', '../..'); define('JS_CACHE', TATTLE_ROOT . '/js_cache/'); include '../includes.php'; include TATTLE_ROOT . '/inc/functions.php'; include TATTLE_ROOT . '/inc/config.php'; $filter_text = fRequest::get('filter_text', 'string'); $check_type = fRequest::getValid('type', array('predictive', 'threshold')); $filter_group_id = fRequest::get('filter_group_id', 'integer'); if (empty($filter_group_id) || $filter_group_id < 0) { $filter_group_id = -1; } ?> <script type="text/javascript"> var filter = $("#filter_text").val(); var reg = new RegExp(filter, "i"); $(".highlight").each(function() { if (filter != '') { if ($(this).html().match(reg) != null) { $(this).addClass('success'); } else { $(this).removeClass('success'); } } }); $(".name a").each(function() { if (filter != '') { if ($.trim($(this).html()).match(reg) != null) { $(this).parent().addClass('success');
<?php include 'inc/init.php'; fAuthorization::requireLoggedIn(); fRequest::overrideAction(); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'view')); $setting_name = fRequest::get('setting_name', 'string'); $setting_type = fRequest::getValid('setting_type', array('system', 'user')); $user_id = fRequest::get('user_id', 'integer'); if ($setting_type == 'user') { if ($user_id > 0) { $owner_id = $user_id; } else { $owner_id = fSession::get('user_id'); } } else { $owner_id = 0; } if ('delete' == $action) { $class_name = 'Setting'; try { $obj = new Setting(array('name' => $setting_name, 'owner_id' => $owner_id)); $delete_text = 'Are you sure you want to delete this setting : <strong>' . $obj->getFriendlyName() . '</strong>?'; if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $obj->delete(); fMessaging::create('success', fURL::get(), 'The setting ' . $obj->getFriendlyName() . ' was successfully deleted'); fURL::redirect(Setting::makeUrl('list', $setting_type, NULL, $owner_id)); } } catch (fNotFoundException $e) { fMessaging::create('error', fURL::get(), 'The setting requested could not be found');
it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Print Master is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Print Master. If not, see <http://www.gnu.org/licenses/>. */ // Include initialisation file include_once 'inc/init.php'; // Get action from query string $action = fRequest::getValid('action', array('install')); $redirect = fRequest::get('redirect', 'string'); // Get IDs $consumable_id = fRequest::get('consumable_id', 'integer?'); $printer_id = fRequest::get('printer_id', 'integer?'); if ($action == 'install') { // Install consumable into printer try { // Get objects matching the printer/consumable $printer = new Printer($printer_id); $consumable = new Consumable($consumable_id); // Try to install it $installed = $consumable->installTo($printer); // Check status of installation if ($installed == FALSE) { fMessaging::create('error', $redirect, $consumable->err);