define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "283");
+define('CURR_SVN_REVISION', "284");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
array($ext_name, $EXT_LANG_PREFIX, $EXT_ALWAYS_ACTIVE, $EXT_VERSION), __FILE__, __LINE__);
// Update task management
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ ADMIN_SOLVE_TASK($id);
// In normal mode return a true on success
$ret = true; unset($SQLs);
// Delete only when it's not your own account!
if (($del == 1) && (GET_ADMIN_ID(get_session('admin_login')) != $id)) {
// Rewrite his tasks to all admins
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='0' WHERE assigned_admin='%s'",
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin=0 WHERE assigned_admin=%s",
array($id), __FILE__, __LINE__);
// Remove account
// Return output
return ADMIN_PASSWORD_RESET_DONE;
}
+// Solves a task by given id number
+function ADMIN_SOLVE_TASK ($id) {
+ // Update the task data
+ ADMIN_UPDATE_TASK_DATA($id, "status", "SOLVED");
+}
+// Marks a given task as deleted
+function ADMIN_DELETE_TASK ($id) {
+ // Update the task data
+ ADMIN_UPDATE_TASK_DATA($id, "status", "DELETED");
+}
+// Function to update task data
+function ADMIN_UPDATE_TASK_DATA ($id, $row, $data) {
+ // Update the task
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET %s='%s' WHERE id=%s LIMIT 1",
+ array($row, $data, bigintval($id)), __FILE__, __LINE__);
+}
//
?>
$OUT .= "<FONT class=\"admin_failed\">".ADMIN_EXT_ALREADY_REGISTERED."</FONT>\n";
// Close task but not already closes or deleted or update tasks
- if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE"))
- {
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%s LIMIT 1",
- array(bigintval($tid)), __FILE__, __LINE__);
+ if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE")) {
+ ADMIN_SOLVE_TASK($tid);
}
}
break;
// Close task
if (($status != "CLOSED") && ($status != "DELETED")) {
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%s LIMIT 1",
- array(bigintval($tid)), __FILE__, __LINE__);
+ // Solve the task
+ ADMIN_SOLVE_TASK($tid);
}
break;
// Unassign from tasks
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",
+ $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__);
}
}
// Delete tasks
foreach ($_POST['task'] as $id=>$sel)
{
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND (assigned_admin='%s' OR assigned_admin='0') LIMIT 1",
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND assigned_admin IN (%s,0) LIMIT 1",
array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
}
}
// Update query
- $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' OR (assigned_admin='0' AND status='NEW') ORDER BY task_created DESC",
+ $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin=%s OR (assigned_admin=0 AND status='NEW') ORDER BY task_created DESC",
array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
}
array(bigintval($_POST['uid'])), __FILE__, __LINE__);
// Next the task system...
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%s LIMIT 1",
- array(bigintval($_POST['id'])), __FILE__, __LINE__);
+ ADMIN_SOLVE_TASK($_POST['id']);
// Send mail to user
$msg = LOAD_EMAIL_TEMPLATE("member_newsletter_done", true, bigintval($_POST['uid']));
if ($ret[0] == $eok)
{
// Clear task
- if ($task > 0)
- {
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%s LIMIT 1",
- array(bigintval($task)),__FILE__, __LINE__);
+ if ($task > 0) {
+ ADMIN_SOLVE_TASK($task);
}
// Clear payout request
// Ok, now we can output the form or execute rejecting
if (isset($_POST['ok']))
{
- if ($task > 0)
- {
+ if ($task > 0) {
// Clear task
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%s LIMIT 1",
- array(bigintval($task)), __FILE__, __LINE__);
+ ADMIN_SOLVE_TASK($task);
}
// Clear payout request
{
$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=%s 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=%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=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ ADMIN_DELETE_TASK($id);
}
}
}