require SYS_DIR . 'logincheck.php'; // now you have access to all CMS API // define a helper function function delete_cache_log($id) { // delete cached file $cacheQuery = "id='" . $id . "'"; $page = db_select(TBL_PREFIX . TBL_CACHE, "file", $cacheQuery); if (is_file(CACHE_DIR . $page['file'])) { unlink(CACHE_DIR . $page['file']); } // now delete cache log $success = db_delete(TBL_PREFIX . TBL_CACHE, $cacheQuery); return $success ? 'Deleted!' : 'Error!'; } // delete single cached log if (!empty($_GET['pid'])) { $id = (int) $_GET['pid']; $msg = delete_cache_log($id); // here we are using the SetupCMS.deleteTrackingButtons() echo '{"success":' . (bool) $msg . ',"response":"' . $msg . '"}'; } else { if (!empty($_POST)) { $ids = explode(",", $_POST['id']); foreach ($ids as $id) { $msg = delete_cache_log($id); } // if everything went ok, display the $_notifyMsg["SAVED"] string. Otherwise, use a custom error message. notify_request("orphanlogs", (bool) $msg, $msg); } }
$incoming = strtolower($_POST["Body"]); $outgoing; $command = ""; $parameters = ""; if (gettype(strpos($incoming, " ")) != "boolean") { $command = substr($incoming, 0, strpos($incoming, " ")); $parameters = substr($incoming, strpos($incoming, " ") + 1); } else { $command = $incoming; $parameters = ""; } switch ($command) { case $commands[0]: $outgoing = stock($parameters); break; case $commands[1]: $outgoing = update($parameters); break; default: $outgoing = notify_request($command); break; } header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <Response> <Message><?php echo $outgoing; ?> </Message> </Response>
} if (isset($_POST['create'])) { // insert new role with allowed sections $success = db_insert(TBL_PREFIX . TBL_ROLES, "name,ext_allowed", "'" . $role_name . "', '" . implode(",", $exts) . "'"); } else { if (isset($_POST['update'])) { $success = db_update(TBL_PREFIX . TBL_ROLES, "ext_allowed='" . implode(",", $exts) . "'", "id='" . $role_id . "'"); } else { if (isset($_POST['delete'])) { $success = db_delete(TBL_PREFIX . TBL_ROLES, "id='" . $role_id . "'"); } } } } else { if ($form == "describe") { $description = $_POST['description']; // form array $name = $_POST['name']; // form array if (!isset($_POST['check'])) { // nothing to change... notify_request($form, false, "You should check at least one role to describe."); } foreach ($_POST['check'] as $id) { $success = db_update(TBL_PREFIX . TBL_ROLES, "name='" . $name[$id] . "', description='" . $description[$id] . "'", "id='" . $id . "'"); } } } // ---------------------------------------------------------------- redirect --- notify_request($form, $success);
// save? if (!isset($_POST['reset'])) { $_SESSION[$key] = ${$key}; } else { if (isset($_SESSION[$key])) { unset($_SESSION[$key]); } } } } // parse date $from = $_POST['from']; $to = $_POST['to']; $pattern = "/\\d{2}\\/\\d{2}\\/\\d{4}\\s\\d{2}:\\d{2}\\s(a|p)m{1}/i"; if (!empty($from) && !preg_match($pattern, $from) || !empty($to) && !preg_match($pattern, $to)) { notify_request("mine", false, "Please use this date format: <em>mm/dd/yyyy hh:mm (a|p)m</em> → example: <em>07/23/2009 11:30 am</em>"); } // date range $sfrom = !empty($from) ? strtotime($from) : strtotime("last year"); $sto = !empty($to) ? strtotime($to) : strtotime("now"); // +1 day? $fromdate = date("Y-m-d H:i:s", $sfrom); $todate = date("Y-m-d H:i:s", $sto); $sql .= " AND (sess_date BETWEEN '{$fromdate}' AND '{$todate}')"; // time range $sql .= " AND (sess_time BETWEEN " . $mintime . " AND " . $maxtime . ")"; // grouping if (!empty($groupby)) { $sql .= " GROUP BY " . $groupby; } else { unset($_SESSION['groupby']);
// now you have access to all CMS API // only root user can backup the database if (!is_root()) { die_msg($_loginMsg["NOT_ALLOWED"]); } require SYS_DIR . 'class.db.backup.php'; // load maintenance configuration require 'config.php'; $backup = new MySQL_Backup(); $backup->server = DB_HOST; $backup->username = DB_USER; $backup->password = DB_PASSWORD; $backup->database = DB_NAME; // backup all tables on 'backup' dir $backup->tables = array(); $backup->backup_dir = BACKUPDIR; $backup->fname_format = 'Ymd-His'; $task = (int) $_GET['task']; $run = $backup->Execute($task); if (!$run) { $output = $backup->error; } else { $output = 'Operation completed successfully at <strong>' . date('H:i:s') . '</strong><em> (Local Server Time)</em>.'; if ($task == MSB_SAVE) { notify_request("backup", (bool) $run, $output); } else { if ($task == MSB_STRING) { echo $output . '<br /><pre>' . $run . '</pre>'; } } }