// Remove cache file(s) if extension is active
runFilterChain('post_extension_installed', array('ext_name' => EXT_GET_CURR_NAME(), 'task_id' => $task_id));
+ // Remove all SQL commands
+ UNSET_SQLS();
+
// In normal mode return a true on success
$ret = true;
} elseif ($dry_run) {
+ // Init SQLs and transfer ext->generic
+ INIT_SQLS();
+ SET_SQLS(GET_EXT_SQLS());
+
// Rewrite SQL command to keep { and } inside for dry-run
foreach (GET_SQLS() as $key => $sql) {
$sql = str_replace('{', "{", str_replace('}', "}", $sql));
// Set current SQL name
EXT_SET_CURR_NAME($ext_name);
+ // Init EXT_UPDATE_DEPENDS
+ EXT_INIT_UPDATE_DEPENDS();
+
// Init array
INIT_EXT_SQLS();
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":ext_name[{$ext_id}]={EXT_GET_CURR_NAME()}");
LOAD_EXTENSION(EXT_GET_CURR_NAME(), $load_mode, "", false);
+ // Init these SQLs
+ INIT_SQLS();
+ SET_SQLS(GET_EXT_SQLS());
+
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQLs::count=".COUNT_SQLS()."");
if ((IS_SQLS_VALID() && (COUNT_SQLS() > 0))) {
// Run SQL commands...
LOAD_EXTENSION(EXT_GET_CURR_NAME(), "update", $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], $dry_run);
if (EXT_GET_UPDATE_DEPENDS() != "") {
- // Backup current SQL queries
- $GLOBALS['cache_array']['update_sqls'][EXT_GET_CURR_NAME()] = GET_SQLS();
-
// Is the extension there?
if (GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()) != "") {
// Update another extension first!
// Register new extension
$test = REGISTER_EXTENSION(EXT_GET_UPDATE_DEPENDS(), 0, $dry_run, false);
}
-
- // Restore previous SQL queries
- SET_SQLS($GLOBALS['cache_array']['update_sqls'][EXT_GET_CURR_NAME()]);
- unset($GLOBALS['cache_array']['update_sqls'][EXT_GET_CURR_NAME()]);
} // END - if
// Add notes
unset($GLOBALS['cache_array']['inc_pool'][EXT_GET_CURR_NAME()]);
} // END - if
+ // Init these SQLs
+ INIT_SQLS();
+ SET_SQLS(GET_EXT_SQLS());
+
// Run SQLs
runFilterChain('run_sqls', array('dry_run' => $dry_run));
// Setter for EXT_ALWAYS_ACTIVE flag
function EXT_SET_ALWAYS_ACTIVE ($active) {
- $GLOBALS['ext_always_active'] = (string) $active;
+ $GLOBALS['ext_always_active'][EXT_GET_CURR_NAME()] = (string) $active;
}
// Getter for EXT_ALWAYS_ACTIVE flag
function EXT_GET_ALWAYS_ACTIVE () {
- return $GLOBALS['ext_always_active'];
+ return $GLOBALS['ext_always_active'][EXT_GET_CURR_NAME()];
}
// Setter for EXT_VERSION flag
function EXT_SET_VERSION ($version) {
- $GLOBALS['ext_version'] = (float) $version;
+ $GLOBALS['ext_version'][EXT_GET_CURR_NAME()] = (float) $version;
}
// Getter for EXT_VERSION flag
function EXT_GET_VERSION () {
- return $GLOBALS['ext_version'];
+ return $GLOBALS['ext_version'][EXT_GET_CURR_NAME()];
}
// Setter for EXT_DEPRECATED flag
function EXT_SET_DEPRECATED ($deprecated) {
- $GLOBALS['ext_deprecated'] = (string) $deprecated;
+ $GLOBALS['ext_deprecated'][EXT_GET_CURR_NAME()] = (string) $deprecated;
}
// Getter for EXT_DEPRECATED flag
function EXT_GET_DEPRECATED () {
- return $GLOBALS['ext_deprecated'];
+ return $GLOBALS['ext_deprecated'][EXT_GET_CURR_NAME()];
}
// Setter for EXT_UPDATE_DEPENDS flag
// Getter for EXT_UPDATE_DEPENDS flag
function EXT_GET_UPDATE_DEPENDS () {
- print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
+ //* DEBUG: */ print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
return $GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()];
}
// Getter for next iterator depency
function EXT_GET_ITERATOR_UPDATE_DEPENDS () {
- print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
+ //* DEBUG: */ print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
return ($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()][EXT_GET_UPDATE_ITERATOR()]);
}
// Counter for extension update depencies
function EXT_COUNT_UPDATE_DEPENDS () {
- print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
+ //* DEBUG: */ print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
return count($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()]);
}
// Init iterator for update depencies
function EXT_INIT_UPDATE_ITERATOR () {
- print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
+ //* DEBUG: */ print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()] = 0;
}
if (!isset($GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()])) EXT_INIT_UPDATE_ITERATOR();
// Return it
- print __FUNCTION__.":".EXT_GET_CURR_NAME()."/".$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]."<br />\n";
+ //* DEBUG: */ print __FUNCTION__.":".EXT_GET_CURR_NAME()."/".$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]."<br />\n";
return $GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()];
}
// Increments the update iterator
function EXT_INCREMENT_UPDATE_INTERATOR () {
- print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
+ //* DEBUG: */ print __FUNCTION__.":".EXT_GET_CURR_NAME()."<br />\n";
$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]++;
}
// Init SQLs array for current extension
function INIT_EXT_SQLS () {
- $GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()] = array();
+ // Auto-init the array now...
+ if (!isset($GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()])) {
+ $GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()] = array();
+ } // END - if
}
// Adds SQLs to the SQLs array but "assigns" it with current extension name
// Set unset variable
if (empty($check)) $check = "";
- if (isInstalling()) {
+ if ((isInstalling()) || (!isInstalled())) {
// While we are installing ouput other header than while it is installed... :-)
$OUT = "";
foreach (getFatalArray() as $key => $value) {
INIT_SQLS();
// Are we installing?
- if (isInstalling()) {
+ if ((isInstalling()) || (!isInstalled())) {
// Then silently skip this filter
return true;
} // END - if
}
// Add (maybe) found theme.php file to inclusion list
- $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE($ret));
+ $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($ret));
// Try to load the requested include file
- if (FILE_READABLE($theme)) ADD_INC_TO_POOL($theme);
+ if (INCLUDE_READABLE($INC)) ADD_INC_TO_POOL($INC);
// Return theme value
return $ret;
if (SQL_IS_LINK_UP()) {
// Close link
SQL_CLOSE(__FILE__, __LINE__);
- } elseif (!isInstalling()) {
+ } elseif ((!isInstalling()) && (isInstalled())) {
// No database link
addFatalMessage(__FILE__, __LINE__, getMessage('NO_DB_LINK_SHUTDOWN'));
}
// Special logout redirect for installation of given extension
LOAD_TEMPLATE(sprintf("admin_logout_%s_install", $register));
- } elseif (REQUEST_ISSET_GET(('remove'))) {
+ } elseif (REQUEST_ISSET_GET('remove')) {
// Secure input
- $remove = REQUEST_GET(('remove'));
+ $remove = REQUEST_GET('remove');
// Special logout redirect for removal of given extension
LOAD_TEMPLATE(sprintf("admin_logout_%s_remove", $remove));
if ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Edit account(s)
ADMINS_EDIT_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
-} elseif ((REQUEST_ISSET_POST(('change'))) && (count(REQUEST_POST('login')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('change')) && (count(REQUEST_POST('login')) > 0)) {
// Change admin accounts
ADMINS_CHANGE_ADMIN_ACCOUNT(REQUEST_POST_ARRAY());
} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Show admin accounts for deletetion
ADMINS_DELETE_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
} else {
- if ((REQUEST_ISSET_POST(('remove'))) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+ if ((REQUEST_ISSET_POST('remove')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Remove accounts now
ADMINS_REMOVE_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
}
if (SQL_NUMROWS($result) > 0) {
// Shall I change entries?
- if (REQUEST_ISSET_POST(('change'))) {
+ if (REQUEST_ISSET_POST('change')) {
// Init SQLs
INIT_SQLS();
// Load main template
LOAD_TEMPLATE("admin_config_admins_edit");
-} elseif ((REQUEST_ISSET_POST(('change'))) && ($SEL > 0)) {
+} elseif ((REQUEST_ISSET_POST('change')) && ($SEL > 0)) {
// Change entries
foreach (REQUEST_POST('sel') as $id => $selected) {
// Secure ID
// Load main template
LOAD_TEMPLATE("admin_config_admins_del");
-} elseif ((REQUEST_ISSET_POST(('remove'))) && ($SEL > 0)) {
+} elseif ((REQUEST_ISSET_POST('remove')) && ($SEL > 0)) {
// Remove entries
foreach (REQUEST_POST('sel') as $id => $selected) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE id=%s LIMIT 1",
// Display message
LOAD_TEMPLATE("admin_settings_saved", false, $content);
-} elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('do')))) {
+} elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_GET('do'))) {
// Change or delete entries...
$TEXT = "";
foreach (REQUEST_POST('id') as $id => $value) {
// Remove maybe confusing data
REQUEST_UNSET_POST('edit');
- REQUEST_UNSET_POST(('change'));
+ REQUEST_UNSET_POST('change');
}
-} elseif (REQUEST_ISSET_POST(('change'))) {
+} elseif (REQUEST_ISSET_POST('change')) {
// Init SQLs
INIT_SQLS();
break;
case "ref":
- if (REQUEST_ISSET_GET(('do'))) {
+ if (REQUEST_ISSET_GET('do')) {
if (((!REQUEST_ISSET_POST(('lvl'))) || (!REQUEST_ISSET_POST(('perc')))) && (REQUEST_GET('do') == "add")) {
REQUEST_UNSET_POST('ok');
}
LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_PRICE_ALREADY_FOUND'));
}
}
- } elseif (REQUEST_ISSET_POST(('remove'))) {
+ } elseif (REQUEST_ISSET_POST('remove')) {
// Check if at last one line is selected
$SEL = SELECTION_COUNT(REQUEST_POST('sel'));
if ($SEL > 0) {
} else {
LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_ENTRIES_NOT_DELETED'));
}
- } elseif (REQUEST_ISSET_POST(('change'))) {
+ } elseif (REQUEST_ISSET_POST('change')) {
// Change entries
foreach (REQUEST_POST('level') as $id => $level) {
// Secure ID
// We are about to register a new extension
$do = "register"; $ext_id = bigintval(REQUEST_GET('reg_ext'));
// The ID comes from task management and it is - of course - *not* the extension's name!
-} elseif ((REQUEST_ISSET_POST(('change'))) && ($SEL > 0) && (!IS_DEMO())) {
+} elseif ((REQUEST_ISSET_POST('change')) && ($SEL > 0) && (!IS_DEMO())) {
// De-/activate extensions
foreach (REQUEST_POST('sel') as $ext_id => $active) {
// Shall we keep the extension always active?
LOAD_TEMPLATE("admin_extensions_edit");
$do = "edit";
}
-} elseif ((REQUEST_ISSET_POST(('delete'))) && ($SEL > 0) && (!IS_DEMO())) {
+} elseif ((REQUEST_ISSET_POST('delete')) && ($SEL > 0) && (!IS_DEMO())) {
// List extensions and when verbose is enabled SQL statements which will be executed
$OUT = ""; $SW = 2;
foreach (REQUEST_POST('sel') as $ext_id => $sel) {
// Load template
LOAD_TEMPLATE("admin_extensions_delete");
$do = "delete";
-} elseif ((REQUEST_ISSET_POST(('remove'))) && ($SEL > 0) && (!IS_DEMO())) {
+} elseif ((REQUEST_ISSET_POST('remove')) && ($SEL > 0) && (!IS_DEMO())) {
// Remove extensions from DB (you have to delete all files manually!)
$cache_update = 0;
foreach (REQUEST_POST('sel') as $ext_id => $active) {
EXTENSION_RUN_SQLS($ext_id, "remove");
} // END - if
} // END - foreach
-} elseif (REQUEST_ISSET_GET(('do')) && (!IS_DEMO())) {
+} elseif ((REQUEST_ISSET_GET('do')) && (!IS_DEMO())) {
// Other things to do
$do = SQL_ESCAPE(strip_tags(REQUEST_GET('do')));
-} elseif (REQUEST_ISSET_GET(('do'))) {
+} elseif (REQUEST_ISSET_GET('do')) {
// Demo mode active!
$do = "demo";
}
$show = true;
if ((REQUEST_ISSET_POST(('id'))) && (is_array(REQUEST_POST('id'))) && (count(REQUEST_POST('id')) > 0)) {
// Okay, which button was pressed?
- if (REQUEST_ISSET_POST(('change'))) {
+ if (REQUEST_ISSET_POST('change')) {
// Change permissions
ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "bank_packages", "package_active");
} elseif (REQUEST_ISSET_POST('edit')) {
} elseif (REQUEST_ISSET_POST(('do_edit'))) {
// Delete entries (with confirmation)
ADMIN_EDIT_ENTRIES_CONFIRM(REQUEST_POST('id'), "bank_packages", array(), array(), array(), true);
- } elseif (REQUEST_ISSET_POST(('delete'))) {
+ } elseif (REQUEST_ISSET_POST('delete')) {
// Delete entries (with confirmation)
ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), "bank_packages", array("id", "title", "description", "account_fee"), array("bigintval", "", "", "TRANSLATE_COMMA"), array("", "", "", ""));
$show = false;
- } elseif (REQUEST_ISSET_POST(('remove'))) {
+ } elseif (REQUEST_ISSET_POST('remove')) {
// Delete entries (with confirmation)
ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), "bank_packages", array(), array(), array(), true);
}
// Display message
LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
-} elseif ((REQUEST_ISSET_POST(('change'))) && (REQUEST_ISSET_POST(('id')))) {
+} elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST(('id')))) {
// Change all status
ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "countries", "is_active");
'url' => "modules.php?module=admin&what=list_country",
'title' => getMessage('ADMIN_COUNTRY_ACTIVATION_NEXT_LINK')
));
-} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST(('delete')))) && (REQUEST_ISSET_POST(('id')))) {
+} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('delete'))) && (REQUEST_ISSET_POST(('id')))) {
if (count(REQUEST_POST('id')) > 0) {
if (REQUEST_ISSET_POST('edit')) {
// Edit template
// Create message
$MSG = getMessage('ADMIN_COUNTRIES_MODIFIED');
- } elseif ((REQUEST_ISSET_POST(('remove'))) && (REQUEST_ISSET_POST(('id')))) {
+ } elseif ((REQUEST_ISSET_POST('remove')) && (REQUEST_ISSET_POST(('id')))) {
// Remove
$IDs = implode(",", array_keys(REQUEST_POST('id')));
ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_countries` WHERE id IN (".$IDs.") LIMIT ".count(REQUEST_POST('id'))."");
LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_FAILED_OBTAIN_TASK_ID'));
}
} else {
- if (!REQUEST_ISSET_GET(('do'))) REQUEST_SET_GET('do', "");
+ if (!REQUEST_ISSET_GET('do')) REQUEST_SET_GET('do', "");
if (REQUEST_GET('do') == "delete") {
// Delete all requests
// Run SQL command
runFilterChain('run_sqls');
-} elseif (REQUEST_ISSET_POST(('remove'))) {
+} elseif (REQUEST_ISSET_POST('remove')) {
// Delete rallyes
$SEL = SELECTION_COUNT(REQUEST_POST('sel'));
if ($SEL > 0) {
// No rallye selected to delete!
$MSG = getMessage('RALLYE_DELETE_NOTHING_SELECTED');
}
-} elseif (REQUEST_ISSET_POST(('change'))) {
+} elseif (REQUEST_ISSET_POST('change')) {
// Change rallye
$SEL = SELECTION_COUNT(REQUEST_POST('title'));
if ($SEL > 0) {
if ((REQUEST_POST('pay_min_count') == 0) || (!REQUEST_ISSET_POST(('pay_min_count')))) REQUEST_UNSET_POST(('add'));
if (!REQUEST_ISSET_POST(('pay_currency'))) REQUEST_UNSET_POST(('add'));
-} elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del')) || (REQUEST_ISSET_POST(('change'))) || (REQUEST_ISSET_POST(('remove')))) {
+} elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del')) || (REQUEST_ISSET_POST('change')) || (REQUEST_ISSET_POST('remove'))) {
// Check if at least one entry was selected
if (!REQUEST_ISSET_POST(('id'))) {
// Nothing selected for editing / deleting???
REQUEST_UNSET_POST('edit');
REQUEST_UNSET_POST('del');
- REQUEST_UNSET_POST(('change'));
- REQUEST_UNSET_POST(('remove'));
- } elseif (REQUEST_ISSET_POST(('change'))) {
+ REQUEST_UNSET_POST('change');
+ REQUEST_UNSET_POST('remove');
+ } elseif (REQUEST_ISSET_POST('change')) {
// Change entries here...
foreach (REQUEST_POST('id') as $id => $sel) {
// Secure ID
// Generate message
$MSG = getMessage('SPONSOR_PAY_ENTRIES_CHANGED');
- } elseif (REQUEST_ISSET_POST(('remove'))) {
+ } elseif (REQUEST_ISSET_POST('remove')) {
// Remove entries here...
foreach (REQUEST_POST('id') as $id => $sel) {
// Remove entry
array(),
true
);
-} elseif (REQUEST_ISSET_POST(('delete'))) {
+} elseif (REQUEST_ISSET_POST('delete')) {
// Show entries for deletion
ADMIN_DELETE_ENTRIES_CONFIRM(
REQUEST_POST('id'),
} elseif (REQUEST_ISSET_POST(('sent'))) {
// Sent mail
YOOMEDIA_SEND_BONUS_MAIL(REQUEST_POST_ARRAY(), "normal");
-} elseif (REQUEST_ISSET_POST(('remove'))) {
+} elseif (REQUEST_ISSET_POST('remove')) {
// Add mail to exclude list
YOOMEDIA_EXCLUDE_MAIL(REQUEST_POST_ARRAY(), "normal");
} elseif (REQUEST_ISSET_POST(('unlist'))) {
// Add description as navigation point
ADD_DESCR("admin", __FILE__);
-if (((!REQUEST_ISSET_POST(('t_wait'))) || (!REQUEST_ISSET_POST(('payment')))) && (REQUEST_ISSET_GET(('do'))) && (REQUEST_GET('do') == "add")) {
+if (((!REQUEST_ISSET_POST(('t_wait'))) || (!REQUEST_ISSET_POST(('payment')))) && (REQUEST_ISSET_GET('do')) && (REQUEST_GET('do') == "add")) {
REQUEST_UNSET_POST('ok');
}
} else {
// Now we load all CSS files from css.php!
OUTPUT_HTML("<link rel=\"stylesheet\" type=\"text/css\" href=\"{!URL!}/css.php", false);
- if (isInstalling()) {
+ if ((isInstalling()) || (!isInstalled())) {
// Default theme first
- $NEW_THEME = "default";
- if (REQUEST_ISSET_GET(('theme'))) $NEW_THEME = REQUEST_GET(('theme'));
- if (REQUEST_ISSET_POST(('theme'))) $NEW_THEME = SQL_ESCAPE(REQUEST_POST('theme'));
- OUTPUT_HTML("?theme=".$NEW_THEME."&installing=1", false);
+ $newTheme = "default";
+ if (REQUEST_ISSET_GET(('theme'))) $newTheme = REQUEST_GET(('theme'));
+ if (REQUEST_ISSET_POST(('theme'))) $newTheme = SQL_ESCAPE(REQUEST_POST('theme'));
+ OUTPUT_HTML("?theme=".$newTheme."&installing=1", false);
} // END - if
OUTPUT_HTML("\" />");
}