// Current SVN revision
//define('CURR_SVN_REVISION', getActualVersion(0));
-define('CURR_SVN_REVISION', "812");
+define('CURR_SVN_REVISION', "813");
define('CURR_SVN_DATE' , getActualVersion(1));
define('CURR_SVN_VERSION' , getActualVersion(2));
// Debug output
//* DEBUG: */ print "Query=<pre>".$sql_string."</pre>, affected=<strong>".SQL_AFFECTEDROWS()."</strong>, numrows=<strong>".SQL_NUMROWS($result)."</strong><br />\n";
-
if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && (isDebugModeEnabled()) && (isBooleanConstantAndTrue('DEBUG_SQL'))) {
//
// Debugging stuff...
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":{$ext_name}/{$EXT_LOAD_MODE}");
if (($ext_name == "sql_patches") && (($EXT_LOAD_MODE == "register") || ($EXT_LOAD_MODE == "remove")) && (!$dry_run) && ($test)) {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
- if ($logout) {
+ if ($logout === true) {
// Then redirect to logout
LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches");
} else {
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
// Is the extension there?
if (SQL_NUMROWS($result) == 1) {
// Load all active filers
$result = SQL_QUERY("SELECT `filter_name`, `filter_function`, `filter_active`".$ADD."
FROM `{!_MYSQL_PREFIX!}_filters`
-ORDER BY `filter_id` ASC", __FILE__, __LINE__);
+ORDER BY `filter_id` ASC", __FUNCTION__, __LINE__);
// Are there entries?
if (SQL_NUMROWS($result) > 0) {
// Filter for running SQL commands
function FILTER_RUN_SQLS ($data) {
+ // Debug message
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Entered!");
+
// Is the array there?
if ((IS_SQLS_VALID()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
// Run SQL commands
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Found ".COUNT_SQLS()." queries to run.");
foreach (GET_SQLS() as $sql) {
+ // Trim spaces away
$sql = trim($sql);
+
+ // Is there still a query left?
if (!empty($sql)) {
// Do we have an "ALTER TABLE" command?
if (substr(strtolower($sql), 0, 11) == "alter table") {
// Analyse the alteration command
- SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Alterting table: {$sql}");
+ SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__);
} else {
// Run regular SQL command
- $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Running regular query: {$sql}");
+ $result = SQL_QUERY($sql, __FUNCTION__, __LINE__, false);
}
} // END - if
} // END - foreach
} // END - if
+
+ // Debug message
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
}
// Filter for updating/validating login data
// Load last module and last online time
$result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
+ array($GLOBALS['userid']), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Update last module / online time
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_module='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
- array($GLOBALS['what'], GET_REMOTE_ADDR(), $GLOBALS['userid']), __FILE__, __LINE__);
+ array($GLOBALS['what'], GET_REMOTE_ADDR(), $GLOBALS['userid']), __FUNCTION__, __LINE__);
} else {
// Destroy session, we cannot update!
destroy_user_session();
// Display message
LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
}
-} elseif ((REQUEST_ISSET_POST('del')) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0))))) {
+} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Delete categories
$SW = 2; $OUT = "";
foreach (REQUEST_POST('sel') as $id => $value) {
// Load main template
LOAD_TEMPLATE("admin_del_cats");
-} elseif ((REQUEST_ISSET_POST('edit')) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0))))) {
+} elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Edit categories
$SW = 2; $OUT = "";
foreach (REQUEST_POST('sel') as $id => $value)
// Display message
LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
}
-} elseif ((REQUEST_ISSET_POST('del')) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0))))) {
+} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Delete entries
$SW = 2; $OUT = "";
foreach (REQUEST_POST('sel') as $id => $value)
// Load main template
LOAD_TEMPLATE("admin_config_email_del");
-} elseif ((REQUEST_ISSET_POST('edit')) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0))))) {
+} elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Edit entries
$SW = 2; $OUT = "";
foreach (REQUEST_POST('sel') as $id => $value) {
// Load template
LOAD_TEMPLATE("admin_config_point_settings");
} elseif (REQUEST_GET('sub') == "ref") {
- // 12 3 32 2 3 32 23 4 5 54 3 3 4 4321
- if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST('sel', 0)))) {
+ // 12 3 32 2 3 32 2 3 4 43 21
+ if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Delete entries
$SW = 2; $OUT = "";
foreach (REQUEST_POST('sel') as $id => $value) {
// Load main template
LOAD_TEMPLATE("admin_points_del");
- } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0)))) {
+ } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
// Edit entries
$SW = 2; $OUT = "";
foreach (REQUEST_POST('sel') as $id => $value) {
$result_normal = SQL_QUERY($sql, __FILE__, __LINE__);
// Set offset an current page to default values
-if (!REQUEST_ISSET_GET(('page'))) REQUEST_GET('page') = "1";
-if (!REQUEST_ISSET_GET(('offset'))) REQUEST_SET_GET('offset', getConfig('mails_page'));
+if (!REQUEST_ISSET_GET('page')) REQUEST_SET_GET('page', "1");
+
+if (!REQUEST_ISSET_GET('offset')) {
+ if (isConfigEntrySet('mails_page')) {
+ // Set config entry
+ REQUEST_SET_GET('offset', getConfig('mails_page'));
+ } else {
+ // Set default one
+ REQUEST_SET_GET('offset', 10);
+ }
+} // END - if
// Add limitation to SQL string
if (!REQUEST_ISSET_GET(('mid'))) {
if ((!empty($SQL2)) && ($WHO == _ALL)) $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
// Calculate pages
-$PAGES = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.3);
+$PAGES = 0;
+if (isConfigEntrySet('mails_page')) {
+ $PAGES = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.3);
+} // END - if
+
+// Free result
SQL_FREERESULT($result_normal);
$MAIL = false;
require("inc/functions.php");
// Load more function libraries or includes
-foreach (array('request-functions', 'session-functions', 'config-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks', 'session') as $lib) {
+foreach (array('request-functions', 'session-functions', 'config-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks') as $lib) {
// Load special functions
LOAD_INC_ONCE(sprintf("inc/%s.php", $lib));
} // END - foreach
// Load configuration stuff
loadConfiguration();
+ // Init session
+ LOAD_INC_ONCE("inc/session.php");
+
// Load "databases" aka static arrays
LOAD_INC_ONCE("inc/databases.php");
// Set other missing variables
if (!isset($GLOBALS['output_mode'])) $GLOBALS['output_mode'] = "0";
+ // Init session
+ LOAD_INC_ONCE("inc/session.php");
+
// Include databases.php
LOAD_INC_ONCE("inc/databases.php");
function IS_SQLS_VALID () {
return (
(IS_SQLS_INITIALIZED()) &&
- (COUNT_SQLS() > 0) &&
- (!empty($GLOBALS['sqls'][0]))
+ (COUNT_SQLS() > 0)
);
}