global $_CONFIG;
// Init variables/arrays
- $EXTRAS = ""; $OUT = ""; $SQLs = array(); $WHATs = array(); $DESCRs = array(); $TITLEs = array();
+ $EXTRAS = "";
+ $OUT = "";
+ $SQLs = array();
+ $WHATs = array();
+ $DESCRs = array();
+ $TITLEs = array();
// Chheck for new extensions and updates
$JOBS_DONE = OUTPUT_STANDARD_OVERVIEW($result_main);
if (!$JOBS_DONE) {
// New extensions or updates found
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' AND status='NEW' AND task_type='EXTENSION_UPDATE'",
- array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
-
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA(GET_ADMIN_ID(get_session('admin_login')), "task_system", "id", "assigned_admin", true, " AND status='NEW' AND task_type='EXTENSION_UPDATE'");
if ($value > 0) {
define('__TASK_UPDATE_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task&type=updates\">".$value."</A>");
// First check for all account status seperately
//
// Confirmed accounts
- $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
if ($value > 0) {
define('__CONFIRMED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_user&status=confirmed\">".$value."</A>");
}
// Unconfirmed accounts
- $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='UNCONFIRMED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("UNCONFIRMED", "user_data", "userid", "status", true);
if ($value > 0) {
define('__UNCONFIRMED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=chk_regs\">".$value."</A>");
}
// And locked accounts
- $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='LOCKED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("LOCKED", "user_data", "userid", "status", true);
if ($value > 0) {
define('__LOCKED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_user&status=locked\">".$value."</A>");
//
// Unassigned tasks
//
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='0' AND status != 'DELETED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("0", "task_system", "id", "assigned_admin", true, " AND `status` != 'DELETED'");
if ($value > 0) {
define('__TASK_NEW_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task&type=unassigned\">".$value."</A>");
//
// Closed tasks
//
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE status = 'CLOSED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("CLOSED", "task_system", "id", "status", true);
if ($value > 0) {
define('__TASK_CLOSED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task&type=closed\">".$value."</A>");
//
// Deleted tasks
//
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE status = 'DELETED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("DELETED", "task_system", "id", "status", true);
if ($value > 0) {
define('__TASK_DELETED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task&type=deleted\">".$value."</A>");
//
// Solved tasks
//
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE status = 'SOLVED' AND assigned_admin='%s'",
- array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("DELETED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_ADMIN_ID(get_session('admin_login'))));
if ($value > 0) {
define('__TASK_SOLVED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task&type=solved\">".$value."</A>");
//
// Your tasks
//
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' AND status = 'NEW' AND task_type != 'EXTENSION_UPDATE'",
- array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA(GET_ADMIN_ID(get_session('admin_login')), "task_system", "id", "assigned_admin", true, " AND status = 'NEW' AND task_type != 'EXTENSION_UPDATE'");
if ($value > 0) {
define('__TASK_YOUR_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task\">".$value."</A>");
//
// Mails waiting to be approved
//
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='ADMIN'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("ADMIN", "pool", "id", "data_type", true);
if ($value > 0) {
define('__MAIL_ADMIN_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=unlock_emails\">".$value."</A>");
//
// Unfinished mail orders
//
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='TEMP'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("TEMP", "pool", "id", "data_type", true);
if ($value > 0) {
define('__MAIL_TEMP_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=email_details\">".$value."</A>");
//
// Sent mail orders
//
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='SEND'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ $value = GET_TOTAL_DATA("SEND", "pool", "id", "data_type", true);
if ($value > 0) {
define('__MAIL_SEND_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=email_archiv\">".$value."</A>");
// Autopurged mails
//
if (EXT_IS_ACTIVE("autopurge")) {
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ // Get auto-purged mails
+ $value = GET_TOTAL_DATA("DELETED", "pool", "id", "data_type", true);
if ($value > 0) {
define('__MAIL_DELETED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=email_details\">".$value."</A>");
// Autopurged bonus mails
//
if (GET_EXT_VERSION("bonus") >= "0.1.8") {
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE data_type='DELETED'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ // Get auto-purged bonus mails
+ $value = GET_TOTAL_DATA("DELETED", "bonus", "id", "data_type", true);
if ($value > 0) {
define('__MAIL_BONUS_AP_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=email_details\">".$value."</A>");
// Sent bonus mails
//
if (GET_EXT_VERSION("bonus") >= "0.1.8") {
- $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE data_type='SEND' AND is_notify='N'", __FILE__, __LINE__);
- $value = SQL_NUMROWS($result);
- SQL_FREERESULT($result);
+ // Get sent bonus mails (but not notifications)
+ $value = GET_TOTAL_DATA("SEND", "bonus", "id", "data_type", true, " AND is_notify='N'");
if ($value > 0) {
define('__MAIL_BONUS_SEND_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=email_details\">".$value."</A>");
}
// Add links for selecting some users
-function alpha($sortby, $colspan, $return=false)
-{
+function alpha($sortby, $colspan, $return=false) {
global $_CONFIG;
if (empty($_GET['offset'])) $_GET['offset'] = 0;
$ADD = "&page=".SQL_ESCAPE($_GET['page'])."&offset=".SQL_ESCAPE($_GET['offset']);
$alphabet = array(_ALL2,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",_OTHERS);
$num = count($alphabet) - 1;
$OUT = "";
- while (list($counter, $ltr) = each($alphabet))
- {
- if ($_GET['letter'] == $ltr)
- {
+ while (list($counter, $ltr) = each($alphabet)) {
+ if ($_GET['letter'] == $ltr) {
// Current letter is letter from URL
$OUT .= "<STRONG>".$ltr."</STRONG>";
- }
- else
- {
+ } else {
// Output link to letter
$OUT .= "<A href=\"".URL."/modules.php?module=admin&what=".$GLOBALS['what'];
if (!empty($_GET['mode'])) $OUT .= "&mode=".SQL_ESCAPE($_GET['mode']);
$OUT .= "&letter=".$ltr."&sortby=".$sortby.$ADD."\">".$ltr."</A>";
}
- if ((($counter / $_CONFIG['user_alpha']) == round($counter / $_CONFIG['user_alpha'])) && ($counter > 0))
- {
+
+ if ((($counter / $_CONFIG['user_alpha']) == round($counter / $_CONFIG['user_alpha'])) && ($counter > 0)) {
$OUT .= " ]<br />[ ";
- }
- elseif ( $counter != $num )
- {
+ } elseif ( $counter != $num ) {
$OUT .= " | ";
}
- }
+ } // END - while
+
define('__ALPHA_LIST', $OUT);
// Load template
$OUT = LOAD_TEMPLATE("admin_list_user_alpha", true);
- if ($return)
- {
+ if ($return) {
// Return generated code
return $OUT;
- }
- else
- {
+ } else {
// Output generated code
OUTPUT_HTML($OUT);
}
}
// Add links for sorting
-function SortLinks($letter, $sortby, $colspan, $return=false)
-{
+function SortLinks($letter, $sortby, $colspan, $return=false) {
$OUT = "";
if (empty($_GET['offset'])) $_GET['offset'] = 0;
if (empty($_GET['page'])) $_GET['page'] = 0;
} else {
$OUT .= "<A href=\"".URL."/modules.php?module=admin&what=list_user&letter=".$letter."&sortby=".$sort.$ADD."\">".$title."</a> | ";
}
- }
+ } // END - foreach
+
define('__SORT_LIST', substr($OUT, 0, -13));
// Load template
$OUT = LOAD_TEMPLATE("admin_list_user_sort", true);
- if ($return)
- {
+ if ($return) {
// Return code
return $OUT;
- }
- else
- {
+ } else {
// Output code
OUTPUT_HTML($OUT);
}
}
// Add page navigation
-function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false)
-{
+function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) {
if (!$show_form) {
// Empty row
define('__FORM_HEADER', "<TR><TD colspan=\"".$colspan."\" class=\"seperator\"> </TD></TR>");
// Letter and so on
$OUT .= "&letter=".SQL_ESCAPE($_GET['letter'])."&sortby=".SQL_ESCAPE($_GET['sortby'])."&page=".$page."&offset=".$offset."\">";
}
+
$OUT .= $page;
- if (($page == $_GET['page']) || ((empty($_GET['page'])) && ($page == "1")))
- {
+
+ if (($page == $_GET['page']) || ((empty($_GET['page'])) && ($page == "1"))) {
$OUT .= "-</STRONG>";
- }
- else
- {
+ } else {
$OUT .= "</A>";
}
+
if ($page < $PAGES) $OUT .= " | ";
- }
+ } // END - for
+
define('__PAGENAV_LIST', $OUT);
// Load template
$OUT = LOAD_TEMPLATE("admin_list_user_pagenav", true);
- if ($return)
- {
+ if ($return) {
// Return code
return $OUT;
- }
- else
- {
+ } else {
// Output code
OUTPUT_HTML($OUT);
}
}
// Create email link to user's account
-function USER_CREATE_EMAIL_LINK($email, $mod="admin")
-{
+function USER_CREATE_EMAIL_LINK($email, $mod="admin") {
+ // Show contact link only if user is confirmed by default
$locked = " AND status='CONFIRMED'";
+
+ // But admins shall always see it
if (IS_ADMIN()) $locked = "";
+
$result = SQL_QUERY_ESC("SELECT userid
FROM "._MYSQL_PREFIX."_user_data
WHERE email='%s'".$locked." LIMIT 1",
array($email), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
// Load userid
list($uid) = SQL_FETCHROW($result);
// Rewrite email address to contact link
$email = URL."/modules.php?module=".$mod."&what=user_contct&u_id=".bigintval($uid);
- }
+ } // END - if
// Free memory
SQL_FREERESULT($result);