************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
+} elseif (!EXT_IS_ACTIVE("task")) {
+ ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "task");
+ return;
}
+
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
{
$SEL = 0;
if (isset($_POST['task'])) $SEL = SELECTION_COUNT($_POST['task']);
- if ((isset($_POST['assign'])) && ($SEL > 0))
- {
+ if ((isset($_POST['assign'])) && ($SEL > 0)) {
// Assign / do tasks
require_once(PATH."inc/modules/admin/overview-inc.php");
if (empty($dmy)) $dmy = "";
OUTPUT_SELECTED_TASKS($_POST, $dmy);
- }
- else
- {
+ } else {
// Start listing tasks matching selected filter
$result_tasks = SQL_QUERY("SELECT id, assigned_admin, userid, task_type, subject, text, task_created
FROM "._MYSQL_PREFIX."_task_system
WHERE ".$whereStatement."
ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __LINE__);
- if (($SEL > 0) && (!IS_DEMO()))
- {
+ if (($SEL > 0) && (!IS_DEMO())) {
// Only unassign / delete tasks when there are selected tasks posted
- if (isset($_POST['unassign']))
- {
+ if (isset($_POST['unassign'])) {
// Unassign from tasks
- foreach ($_POST['task'] as $id=>$sel)
- {
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='0' WHERE id=%d AND assigned_admin='%s' LIMIT 1",
+ foreach ($_POST['task'] as $id => $sel) {
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin=0 WHERE id=%s AND assigned_admin=%s LIMIT 1",
array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
}
- }
- elseif (isset($_POST['del']))
- {
+ } elseif (isset($_POST['del'])) {
// Delete tasks
- foreach ($_POST['task'] as $id=>$sel)
- {
- if ($_GET['type'] == "deleted")
- {
+ foreach ($_POST['task'] as $id => $sel) {
+ if ($_GET['type'] == "deleted") {
// Delete task immediately
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%d LIMIT 1",
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s LIMIT 1",
array(bigintval($id)),__FILE__, __LINE__);
- }
- else
- {
+ } else {
// Mark task as to be deleted (purged by autppurge extension)
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='DELETED' WHERE id=%d LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ ADMIN_DELETE_TASK($id);
}
}
}