// Some security stuff...
if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
}
array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
// We currently don't want to install an extension so let's find out if we need...
- $EXT_LOAD_MODE = "register";
- $JOBS_DONE = true;
+ $EXT_LOAD_MODE = 'register';
+ $jobsDone = true;
// Open the extension directory
- $handle = opendir(constant('PATH')."inc/extensions/") or mxchange_die("Cannot read extension directory!");
- while ($file = readdir($handle)) {
+ $extensionList = GET_DIR_AS_ARRAY("inc/extensions/", "ext-", false, false);
+ foreach ($extensionList as $file) {
// Is this file an extension?
if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) {
//* DEBUG: */ echo $file."<br />\n";
if (isset($GLOBALS['cache_array']['active_extensions'][$ext_name])) {
// Maybe we want to keept the current extension active?
- if (($GLOBALS['cache_array']['active_extensions'][$ext_name] == "Y") && (!EXT_IS_ACTIVE($ext_name))) {
+ if (($GLOBALS['cache_array']['active_extensions'][$ext_name] == 'Y') && (!EXT_IS_ACTIVE($ext_name))) {
// Reactivate this extension!
ACTIVATE_EXTENSION($ext_name);
} // END - if
} // END - if
}
} // END - if
- } // END - while
-
- // Close directory handle
- closedir($handle);
+ } // END - foreach
// At last - but not least - check for own and new unassigned tasks...
$result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created
if (SQL_NUMROWS($result_tasks) > 0) {
// New jobs found!
- $JOBS_DONE = false;
+ $jobsDone = false;
} // END - if
// Free the result
SQL_FREERESULT($result);
// Return status
- return $JOBS_DONE;
+ return $jobsDone;
}
// Outputs selected tasks
function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
- global $NOTES;
if ((isset($POST['assign'])) && (count($POST['task']) > 0)) {
// Assign / do tasks
- $OUT = ""; $SW = 2;
+ $OUT = ''; $SW = 2;
foreach ($POST['task'] as $id => $sel) {
$result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND `status`='NEW')) LIMIT 1",
array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
array(GET_CURRENT_ADMIN_ID(), bigintval($tid)), __FILE__, __LINE__);
} // END - if
- $ADD = "";
+ $add = '';
if ($type == "SUPPORT_MEMBER") {
$mode = substr($text, 0, strpos($text, ":"));
$text = substr($text, strpos($text, ":") + 1);
- $ADD = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
+ $add = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
} // END - if
if ($uid > 0) {
if (SQL_NUMROWS($result_user) == 1) {
list($gender, $sname, $fname, $email) = SQL_FETCHROW($result_user);
SQL_FREERESULT($result_user);
- $ADD = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
+ $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
} // END - if
} // END - if
$text = LOAD_TEMPLATE("admin_extensions_text", true, $text);
// Initialize variables (no title for SQL commands by default)
- $ext_name = "";
+ $ext_name = '';
$title = getMessage('TASK_NO_TITLE');
// Shall I list SQL commands assigned to an extension installation or update task?
- if (((GET_EXT_VERSION("sql_patches") != '') && (getConfig('verbose_sql') == "Y")) || (!EXT_IS_ACTIVE("sql_patches"))) {
+ if (((GET_EXT_VERSION('sql_patches') != '') && (getConfig('verbose_sql') == 'Y')) || (!EXT_IS_ACTIVE('sql_patches'))) {
$ext_name = substr($subj, 1, strpos($subj, ":") - 1);
if ($type == "EXTENSION") {
// Load SQL commands for registering
- SET_SQLS(EXTENSION_REGISTER($ext_name, $id, true));
+ REGISTER_EXTENSION($ext_name, $id, true);
// Add notes to text
- $text .= $NOTES;
+ $text .= EXT_GET_NOTES();
// Set title
$title = getMessage('ADMIN_SQLS_EXECUTED_ON_REGISTER');
EXTENSION_UPDATE($ext_name, $ext_ver, true);
// Add notes to text
- $text .= $NOTES;
+ $text .= EXT_GET_NOTES();
// Set title
$title = getMessage('ADMIN_SQLS_EXECUTED_ON_UPDATE');
} else {
// Remove extension's name
- $ext_name = "";
+ $ext_name = '';
}
// Add SQLs to a table
if (!IS_SQLS_VALID()) INIT_SQLS();
- if (empty($title)) $title = "";
- if ((!empty($ext_name)) && (GET_EXT_VERSION("sql_patches")) && (getConfig('verbose_sql') == "Y")) {
+ if (empty($title)) $title = '';
+ if ((!empty($ext_name)) && (GET_EXT_VERSION('sql_patches')) && (getConfig('verbose_sql') == 'Y')) {
// Add verbose SQL table
$text .= EXTENSION_VERBOSE_TABLE($title, " class=\"admin_table top2 left2 right2\"", true, "100%")."<br />\n";
} // END - if
} else {
// Run SQL commands in dry mode but only return the notes
EXTENSION_UPDATE($ext_name, $ext_ver, true);
- $text .= $NOTES;
+ $text .= EXT_GET_NOTES();
}
// Prepare array for the template
$content = array(
'sw' => $SW,
'subj' => $subj,
- 'add' => $ADD,
+ 'add' => $add,
'text' => $text,
'created' => MAKE_DATETIME($created, "1"),
'extension' => $ext_name
{
default: // @TODO Unknown support mode
DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown support mode %s detected. This part is under construction!", $mode));
- $OUT .= "<div class=\"admin_failed medium\">".ADMIN_UNKNOWN_SUPPORT_MODE_1.$mode.ADMIN_UNKNOWN_SUPPORT_MODE_2."</div>\n";
+ $OUT .= "<div class=\"admin_failed medium\">".sprintf(getMessage('ADMIN_UNKNOWN_SUPPORT_MODE'), $mode)."</div>\n";
break;
}
break;
case "PAYOUT_REQUEST": // Payout requests
- if (EXT_IS_ACTIVE("payout")) {
+ if (EXT_IS_ACTIVE('payout')) {
// Extension is installed so let him send a notification to the user
$result_pay = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE userid=%s AND payout_timestamp=%s LIMIT 1",
array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
break;
case "WERNIS_REQUEST": // Wernis requests
- if (EXT_IS_ACTIVE("wernis")) {
+ if (EXT_IS_ACTIVE('wernis')) {
// Extension is installed so let him send a notification to the user
$result_pay = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_wernis` WHERE userid=%s AND wernis_timestamp=%s LIMIT 1",
array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
default: // Unknown task type
DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown task type %s detected.", $type));
- $OUT .= "<div class=\"admin_failed medium\">".ADMIN_UNKNOWN_TASK_TYPE_1.$type.ADMIN_UNKNOWN_TASK_TYPE_2.$id.ADMIN_UNKNOWN_TASK_TYPE_3."</div>\n";
+ $OUT .= "<div class=\"admin_failed medium\">".sprintf(getMessage('ADMIN_UNKNOWN_TASK_TYPE'), $type, $id)."</div>\n";
break;
}
$OUT .= " </td>
} // END - if
// There are uncompleted jobs!
- // @TODO Rewrite this to one template and use $OUT = ...
- LOAD_TEMPLATE("admin_overview_header");
- $OUT = ""; $SW = 2;
+ $OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result_tasks)) {
// Init infos
- $content['infos'] = "---";
+ $content['infos'] = '---';
// Generate assign link
$content['assigned_admin'] = GENERATE_AID_LINK($content['assigned_admin']);
// Do we have extension task?
if (($content['task_type'] == "EXTENSION") && (GET_EXT_VERSION($content['infos']) == "")) {
// Load extension row template
- // @TODO Rewrite this to $OUT .= ..., true, ...
- LOAD_TEMPLATE("admin_overview_list_ext_rows", false, $content);
+ $OUT .= LOAD_TEMPLATE("admin_overview_list_ext_rows", true, $content);
} else {
// Load default row template
- // @TODO Rewrite this to $OUT .= ..., true, ...
- LOAD_TEMPLATE("admin_overview_list_rows", false, $content);
+ $OUT .= LOAD_TEMPLATE("admin_overview_list_rows", true, $content);
}
// Switch color
SQL_FREERESULT($result_tasks);
// Load footer template
- LOAD_TEMPLATE("admin_overview_footer");
+ LOAD_TEMPLATE("admin_overview_table", false, $OUT);
}
}
//