define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "393");
+define('CURR_SVN_REVISION', "394");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
}
// Exclude webmaster from doubling...
- if ($uid != $_CONFIG['doubler_uid'])
- {
+ if ($uid != $_CONFIG['doubler_uid']) {
// Add points
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array($points, bigintval($uid)), __FILE__, __LINE__);
-
- // Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
- // Update database
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $points);
- }
- }
+ ADD_POINTS_REFSYSTEM($uid, $points, false, "0", false, "direct");
+ } // END - if
// Set entry as "payed"
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_doubler SET completed='Y' WHERE id=%s LIMIT 1",
$OUTPUT = ob_get_contents();
// Clear output buffer for later output
+ die();
ob_end_clean();
// Extension "rewrite" installed?
$REMOTE_ADDR = getenv('REMOTE_ADDR');
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
+ // Default admin
$ADMIN = MAIN_TITLE;
- if (isSessionVariableSet('admin_login')) {
+
+ // Is the admin logged in?
+ if (IS_ADMIN()) {
// Load Admin data
- $result = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
- array(get_session('admin_login')), __FILE__, __LINE__);
- list($ADMIN) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ $ADMIN = GET_ADMIN_EMAIL(get_session('admin_login'));
} // END - if
// Neutral email address is default
array(bigintval($UID)), __FILE__, __LINE__);
} else {
//* DEBUG: */ echo __FUNCTION__.":NO-NICK!<br />\n";
- // Load normal data
+ /// Load normal data
$result = SQL_QUERY_ESC("SELECT surname, family, gender, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
array(bigintval($UID)), __FILE__, __LINE__);
}
// Run code
$tmpl_file = "\$newContent=html_entity_decode(\"".COMPILE_CODE($tmpl_file)."\");";
- eval($tmpl_file);
+ @eval($tmpl_file);
} elseif (!empty($template)) {
// Template file not found!
$newContent = TEMPLATE_404.": ".$template."<br />
// Is there some content?
if (empty($newContent)) {
// Compiling failed
- $newContent = "Compiler error for template {$template}!";
+ $newContent = "Compiler error for template {$template}!\nUncompiled content:\n".$tmpl_file;
+ if (function_exists('error_get_last')) $newContent .= "\n--------------------------------------\nDebug:\n".print_r(error_get_last(), true)."--------------------------------------\nPlease don't alter these informations!\nThanx.";
} // END - if
// Return compiled content
// BEFORE 0.2.1 : Not used
// WITH 0.2.1+ : Data constants
$code = str_replace('{!','".', str_replace("!}", '."', $code));
- }
+ } // END - if
// Compile QUOT and other non-HTML codes
foreach ($ARRAY['to'] as $k => $to) {
// Do the reversed thing as in inc/libs/security_functions.php
$code = str_replace($to, $ARRAY['from'][$k], $code);
- }
+ } // END - foreach
// But shall I keep simple quotes for later use?
if ($simple) $code = str_replace("\'", '{QUOT}', $code);
// Replace all matches
$matchesFound = array();
foreach ($matches[0] as $key => $match) {
- // Avoid replacing matches multiple times
- if (!isset($matchesFound[$match])) {
- // Not yet replaced!
- $code = str_replace($match, "\".".$match.".\"", $code);
- $matchesFound[$match] = 1;
- } // END - if
+ // Fuzzy look has failed by default
+ $fuzzyFound = false;
+
+ // Fuzzy look on match if already found
+ foreach ($matchesFound as $found => $set) {
+ // Get test part
+ $test = substr($found, 0, strlen($match));
+
+ // Does this entry exist?
+ //* DEBUG: */ echo __FUNCTION__.":found={$found},match={$match},set={$set}<br />\n";
+ if ($test == $match) {
+ // Match found!
+ //* DEBUG: */ echo __FUNCTION__.":fuzzyFound!<br />\n";
+ $fuzzyFound = true;
+ break;
+ } // END - if
+ } // END - foreach
+
+ // Skip this entry?
+ if ($fuzzyFound) continue;
// Take all string elements
- if ((is_string($matches[4][$key])) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) {
+ if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) {
// Replace it in the code
+ //* DEBUG: */ echo __FUNCTION__.":key={$key},match={$match}<br />\n";
$newMatch = str_replace("[".$matches[4][$key]."]", "['".$matches[4][$key]."']", $match);
- $code = str_replace($match, $newMatch, $code);
+ $code = str_replace($match, "\".".$newMatch.".\"", $code);
$matchesFound[$key."_".$matches[4][$key]] = 1;
- } // END - if
- }
- }
+ $matchesFound[$match] = 1;
+ } elseif (!isset($matchesFound[$match])) {
+ // Not yet replaced!
+ //* DEBUG: */ echo __FUNCTION__.":match={$match}<br />\n";
+ $code = str_replace($match, "\".".$match.".\"", $code);
+ $matchesFound[$match] = 1;
+ }
+ } // END - foreach
+ } // END - if
// Return compiled code
return $code;
define('RALLYE_END_PRICES_2', "Plaetze belegt sind!");
define('RALLYE_LIMITATIONS', "Einschränkungen an der Dauer der Rallye");
define('RALLYE_REMOVE_PRICES', "Rallye-Preis(e) entfernen");
+define('RALLYE_NO_TEMPLATES_FOUND', "Keine Templates gefunden!");
+
//
?>
$_CONFIG['cache_hits']++;
} elseif (!is_object($cacheInstance)) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
- array(get_session('admin_login')), __FILE__, __LINE__);
- list($default) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ $default = GET_ADMIN_DEFAULT_ACL(get_session('admin_login'));
}
// Get admin's ID
// Update password cookie
set_session("admin_md5", $hash);
}
-
- }
+ } // END - if
// Get default ACL from admin to check if we can allow him to change the default ACL
- $result = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
- array(get_session('admin_login')), __FILE__, __LINE__);
- list($default) = SQL_FETCHROW($result);
-
- // Free result
- SQL_FREERESULT($result);
+ $default = GET_ADMIN_DEFAULT_ACL(get_session('admin_login'));
// Update admin account
if ($default == "allow") {
$DATA['title'] = $title;
$DATA['id'] = $id; // ID for the rallye details link
- if ($min_users == 0)
- {
+ if ($min_users == 0) {
// Rallye ends without user limitation
$DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION;
- }
- else
- {
+ } else {
// Rallye ends when X members are totally in your exchange
$DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2;
}
- if ($min_prices == 0)
- {
+
+ if ($min_prices == 0) {
// Rallye ends without user limitation
$DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION;
- }
- else
- {
+ } else {
// Rallye ends when X members are totally in your exchange
$DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2;
}
$prices = RALLYE_ADD_PRICES($id);
// Let's begin with the userids...
- while (list($uid) = SQL_FETCHROW($result_user))
- {
+ while (list($uid) = SQL_FETCHROW($result_user)) {
$un = false;
// Get refs by userid
// Check if line is already included...
$result_ref = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%s AND userid=%s LIMIT 1",
array(bigintval($id), bigintval($uid)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result_ref) == 0)
- {
+ if (SQL_NUMROWS($result_ref) == 0) {
// Free memory
SQL_FREERESULT($result_ref);
// Add info line
$result_ref = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_rallye_users (rallye_id, userid, refs, curr_points)
-VALUES ('%s', '%s', '%s', '%s')",
+VALUES ('%s','%s','%s','%s')",
array(bigintval($id), bigintval($uid), bigintval($cnt), $cpoints), __FILE__, __LINE__);
$un = true;
- }
+ } // END - if
// Ignored but for the template required refs (made before start of rallye)
$DATA['refs'] = $cnt;
// Shall I notify this member?
- if (($notify == "Y") && ($un))
- {
+ if (($notify == "Y") && ($un)) {
// Load email template and send it to the user
- $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", $prices, $uid);
+ $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
SEND_EMAIL($uid, RALLYE_MEMBER_NOTIFY.$title, $msg);
- }
- }
+ } // END - if
+ } // END - while
// Choose the right admin template
$templ = "admin_rallye_no_notify";
{
// Add userid and his ref count to table
$result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_rallye_users (rallye_id, userid, refs)
-VALUES ('%s', '%s', '0')",
+VALUES ('%s','%s','0')",
array(bigintval($id), bigintval($uid)), __FILE__, __LINE__);
}
else
$prices = RALLYE_ADD_PRICES($id);
// Send notification to member
- $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", $prices, $uid);
+ $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
SEND_EMAIL($uid, RALLYE_MEMBER_NOTIFY.$title, $msg);
}
}
$DATA['info'] = $prices['info'][$key];
$DATA['ref'] = $prices['ref'][$key];
- if ($DATA['points'] > 0)
- {
+ if ($DATA['points'] > 0) {
// Add points directly to user's account
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array($DATA['points'], bigintval($uid)), __FILE__, __LINE__);
-
- // Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
- // Update database
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $DATA['points']);
- }
+ ADD_POINTS_REFSYSTEM($uid, $DATA['points'], false, "0", false, "direct");
}
- if ($notify == "Y")
- {
+ if ($notify == "Y") {
// Prepare infos for the mail template
- if (!empty($DATA['info']))
- {
+ if (!empty($DATA['info'])) {
// Take direct infos
$DATA['infos'] = $DATA['info'];
- }
- else
- {
+ } else {
// Take points
$DATA['infos'] = $DATA['points']." ".POINTS;
}
// Add suffix to template name
$template = "member_rallye_expired";
- if ($DATA['level'] == 1)
- {
+ if ($DATA['level'] == 1) {
// The winner!
$template .= "_gold";
- }
- elseif ($DATA['level'] == 2)
- {
+ } elseif ($DATA['level'] == 2) {
// The vice winner!
$template .= "_silver";
- }
- elseif ($DATA['level'] == 3)
- {
+ } elseif ($DATA['level'] == 3) {
// The bronce winner
$template .= "_bronce";
}
// Load template
$msg = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
SEND_EMAIL($uid, RALLYE_MEMBER_EXPIRED.": ".$DATA['level']." "._RALLYE_PRICE, $msg);
- }
+ } // END - if
// Count userid
$cnt++;
}
// Select template depending on notfication is switch on / off
- if ($notify == "Y")
- {
+ if ($notify == "Y") {
$templ = "admin_rallye_expired";
- }
- elseif (is_array($users['uid']))
- {
+ } elseif (is_array($users['uid'])) {
$templ = "admin_rallye_expired_no";
$cnt = RALLYE_LOAD_USER_DATA($users);
}
// Add task
$result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (status, task_type, subject, text, task_created)
-VALUES ('NEW', 'RALLYE_EXPIRED', '".RALLYE_ADMIN_EXPIRED.": %s', '".RALLYE_ADMIN_EXPIRED_TEXT."', UNIX_TIMESTAMP())",
+VALUES ('NEW','RALLYE_EXPIRED','".RALLYE_ADMIN_EXPIRED.": %s','".RALLYE_ADMIN_EXPIRED_TEXT."',UNIX_TIMESTAMP())",
array($title), __FILE__, __LINE__);
// All work done here...
// Add task
$result_task = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (status, task_type, subject, text, task_created)
-VALUES ('NEW', 'RALLYE_PURGED', '".RALLYE_ADMIN_PURGED.": %s', '".RALLYE_ADMIN_PURGED_TEXT."', UNIX_TIMESTAMP())",
+VALUES ('NEW','RALLYE_PURGED','".RALLYE_ADMIN_PURGED.": %s','".RALLYE_ADMIN_PURGED_TEXT."',UNIX_TIMESTAMP())",
array($title), __FILE__, __LINE__);
}
{
// Check templates directory
$OUT = ""; $ral = array();
- $BASE = sprintf("%stemplates/%s/html", PATH, GET_LANGUAGE());
+ $BASE = sprintf("%stemplates/%s/html/rallye/", PATH, GET_LANGUAGE());
$dir = opendir($BASE);
while ($read = readdir($dir))
{
// Do not recreate cache file when it's switched off!
if (($cacheMode == "init") && ($_CONFIG['cache_exts'] == "N")) $cacheMode = "skip";
-
- // Load language
- if ($cacheMode == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php");
} else {
// Cache extension not active
$cacheMode = "no";
}
if ($cacheMode == "load") {
+ // Init include array
+ $EXT_POOL = array();
+
// Re-initialize handler
$cacheInstance->cache_file("extensions", true);
// Load Language file
if ($EXT_DUMMY['ext_lang'][$k] == "Y") {
$INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE());
- if (FILE_READABLE($INC)) require_once($INC);
+ if (FILE_READABLE($INC)) {
+ // Add it
+ $EXT_POOL[] = $INC;
+ }
} // END - if
// Load CSS file
// Load extension file itself
if (($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) {
- require_once(PATH."inc/extensions/ext-".$name.".php");
+ $EXT_POOL[] = sprintf("%sinc/extensions/ext-%s.php", PATH, $name);
} // END - if
// Version number
// Load more cache files (like admins)
require_once(PATH."inc/load_cache.php");
+
+ // Load all extension files
+ foreach ($EXT_POOL as $inc) {
+ require_once($inc);
+ } // END - foreach
+
+ // Remove array
+ unset($EXT_POOL);
} else {
// If current user is not admin load only activated extensions
// The admin shall use every available extension for testing purposes
function CHECK_ADMIN_COOKIES ($admin_login, $password) {
global $cacheArray, $_CONFIG;
$ret = "404"; $pass = "";
- if (!empty($cacheArray['admins']['aid'][$admin_login])) {
- // Get password from cache
- $pass = $cacheArray['admins']['password'][$admin_login];
- $ret = "pass";
- $_CONFIG['cache_hits']++;
- } elseif (GET_EXT_VERSION("cache") == "") {
- // Get password from DB
- $result = SQL_QUERY_ESC("SELECT password FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
- array($admin_login), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // Entry found
- $ret = "pass";
-
- // Fetch password
- list($pass) = SQL_FETCHROW($result);
- }
- // Free result
- SQL_FREERESULT($result);
- }
+ // Get hash
+ $pass = GET_ADMIN_HASH($admin_login);
+ if ($pass != "-1") $ret = "pass";
//* DEBUG: */ echo __FUNCTION__.":".generatePassString($pass)."(".strlen($pass).")/".$password."(".strlen($password).")<br />\n";
if ((isset($_POST['ok'])) && (!empty($_POST['points']))) {
// Ok, add points and send an email to him...
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+(%s) WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array($_POST['points'], bigintval($uid)), __FILE__, __LINE__);
-
- // Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
- // Update database
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $_POST['points']);
- }
+ ADD_POINTS_REFSYSTEM($uid, bigintval($_POST['points']), false, "0", false, "direct");
// Prepare content
$content = array(
if ((isset($_POST['ok'])) && (!empty($_POST['points']))) {
// Ok, add points and send an email to him...
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+(%s) WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array($_POST['points'], bigintval($_GET['u_id'])), __FILE__, __LINE__);
+ ADD_POINTS_REFSYSTEM(bigintval($_GET['u_id']), bigintval($_POST['points']), false, "0", false, "direct");
// Prepare content
$content = array(
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-if ((isset($_POST['ok'])) && (!empty($_GET['admin'])))
-{
+if ((isset($_POST['ok'])) && (!empty($_GET['admin']))) {
// Send mail or message
- if ((EXT_IS_ACTIVE("msg")) && ($_POST['type'] == "msg"))
- {
+ if ((EXT_IS_ACTIVE("msg")) && ($_POST['type'] == "msg")) {
// Add message
$msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", $_POST['text'], "0");
SEND_ADMIN_MESSAGE($_GET['admin'], ADMINS_MSG_FROM_ADMIN, $msg);
- }
- else
- {
+ } else {
// Load admin's email address
- $result = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
- array(bigintval($_GET['admin'])), __FILE__, __LINE__);
- list($email) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ $email = GET_ADMIN_EMAIL(GET_ADMIN_LOGIN(bigintval($_GET['admin'])));
// Load email template and send the mail to the admin
$msg = LOAD_EMAIL_TEMPLATE("admins_mail_contct_admin", $_POST['text'], "0");
SEND_EMAIL($email, ADMINS_MSG_FROM_ADMIN, $msg);
}
+
// Mail / message dropped
LOAD_TEMPLATE("admin_settings_saved", false, ADMINS_ADMIN_CONTACTED);
-}
- elseif (!empty($_GET['admin']))
-{
+} elseif (!empty($_GET['admin'])) {
// Load contact form template
define('__ADMIN', $_GET['admin']);
- if (EXT_IS_ACTIVE("msg"))
- {
+ if (EXT_IS_ACTIVE("msg")) {
// Add option to select between mail and message
define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_select", true));
- }
- else
- {
+ } else {
// Outout hidden input
define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_default", true));
}
LOAD_TEMPLATE("admin_admins_contct_form");
-}
- else
-{
+} else {
// Please select an admin!
LOAD_TEMPLATE("admin_settings_saved", false, ADMINS_SELECT_ADMIN);
}
+
//
?>
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ADMINS_ENTRIES_DELETED);
} elseif (isset($_POST['add'])) {
// Check if everything is fine...
- $result = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
- array(bigintval($_POST['admin_id'])), __FILE__, __LINE__);
- list($mode) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ $mode = GET_ADMIN_DEFAULT_ACL(GET_ADMIN_LOGIN(bigintval($_POST['admin_id'])));
// Default ACL is false
$ACL = false;
$aid = SPONSOR_NO_ADMIN;
} else {
// Load admin's email address for contact
- $result_aid = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id='%s' LIMIT 1",
- array(bigintval($aid)), __FILE__, __LINE__);
- list($aid) = SQL_FETCHROW($result_aid);
- SQL_FREERESULT($result_aid);
-
- // Check if admin login is still in db
- if (empty($aid)) $aid = ADMIN_NOT_FOUND;
+ $aid = GET_ADMIN_EMAIL(GET_ADMIN_LOGIN(($aid));
}
// Transfer data to array
__FILE__, __LINE__);
// Add points to account *directly* ...
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array(bigintval($_POST['points']), bigintval($_POST['to_uid'])), __FILE__, __LINE__);
+ ADD_POINTS_REFSYSTEM(bigintval($_POST['to_uid']), bigintval($_POST['points']), false, "0", false, "direct");
// ... and add it to current user's used points
SUB_POINTS($GLOBALS['userid'], $_POST['points']);
}
// Get ID number from administrator's login name
function GET_ADMIN_ID($login) {
- global $cacheArray;
+ global $cacheArray, $_CONFIG;
$ret = "-1";
if (!empty($cacheArray['admins']['aid'][$login])) {
// Check cache
$ret = $cacheArray['admins']['aid'][$login];
- if (empty($ret)) $ret = "-1";
- } else {
+
+ // Update cache hits
+ $_CONFIG['cache_hits']++;
+ } elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
array($login), __FILE__, __LINE__);
// Get password hash from administrator's login name
function GET_ADMIN_HASH($login)
{
- global $cacheArray;
+ global $cacheArray, $_CONFIG;
$ret = "-1";
- if (!empty($cacheArray['admins']['password'][$login]))
- {
+ if (!empty($cacheArray['admins']['password'][$login])) {
// Check cache
$ret = $cacheArray['admins']['password'][$login];
- if (empty($ret)) $ret = "-1";
- }
- else
- {
+
+ // Update cache hits
+ $_CONFIG['cache_hits']++;
+ } elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT password FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
array($login), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch data
list($ret) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+
+ // Set cache
+ $cacheArray['admins']['password'][$login] = $ret;
}
+
+ // Free result
+ SQL_FREERESULT($result);
}
return $ret;
}
//
function GET_ADMIN_LOGIN ($aid) {
- global $cacheArray;
+ global $cacheArray, $_CONFIG;
$ret = "***";
- if (!empty($cacheArray['admins']['login'])) {
- // Check cache
- if (!empty($cacheArray['admins']['login'][$aid])) {
- $ret = $cacheArray['admins']['login'][$aid];
- } // END - if
- if (empty($ret)) $ret = "***";
- } else {
+ if (!empty($cacheArray['admins']['login'][$aid])) {
+ // Get cache
+ $ret = $cacheArray['admins']['login'][$aid];
+
+ // Update cache hits
+ $_CONFIG['cache_hits']++;
+ } elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT login FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
- array(bigintval($aid)), __FILE__, __LINE__);
+ array(bigintval($aid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Fetch data
list($ret) = SQL_FETCHROW($result);
// Set cache
$cacheArray['admins']['login'][$aid] = $ret;
- }
+ } // END - if
// Free memory
SQL_FREERESULT($result);
}
return $ret;
}
+// Get email address of admin id
+function GET_ADMIN_EMAIL ($aid) {
+ global $cacheArray, $_CONFIG;
+
+ $ret = "***";
+ if (!empty($cacheArray['admins']['email'])) {
+ // Get cache
+ $ret = $cacheArray['admins']['email'][$aid];
+
+ // Update cache hits
+ $_CONFIG['cache_hits']++;
+ } elseif (!EXT_IS_ACTIVE("cache")) {
+ // Load from database
+ $result_aid = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
+ array(bigintval($ret)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // Get data
+ list($ret) = SQL_FETCHROW($result_aid);
+
+ // Set cache
+ $cacheArray['admins']['email'][$aid] = $ret;
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result_aid);
+ }
+
+ // Return email
+ return $ret;
+}
+// Get default ACL of admin id
+function GET_ADMIN_DEFAULT_ACL ($aid) {
+ global $cacheArray, $_CONFIG;
+
+ $ret = "***";
+ if (!empty($cacheArray['admins']['def_acl'])) {
+ // Use cache
+ $ret = $cacheArray['admins']['def_acl'][$aid];
+
+ // Update cache hits
+ $_CONFIG['cache_hits']++;
+ } else {
+ // Load from database
+ $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
+ array(bigintval($ret)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch data
+ list($ret) = SQL_FETCHROW($result_aid);
+
+ // Set cache
+ $cacheArray['admins']['def_acl'][$aid] = $ret;
+ }
+
+ // Free result
+ SQL_FREERESULT($result_aid);
+ }
+
+ // Return email
+ return $ret;
+}
//
function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") {
$ret = "";
$ret .= "<OPTION value=\"".$value."\"";
if ($default == $value) $ret .= " selected checked";
$ret .= ">".$name[$idx]."</OPTION>\n";
- }
- }
+ } // END - foreach
+ } // END - if
} else {
// Data from database
$SPEC = ", ".$id;
if ($default == $value) $ret .= " selected checked";
if (!empty($add)) $add = " (".$add.")";
$ret .= ">".$title.$add."</OPTION>\n";
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
// Return - hopefully - the requested data
return $ret;
}
-// Aiut
+// Activate exchange (DEPERECATED???)
function activateExchange() {
global $_CONFIG;
$result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__);
{
// User does not exists, pay points back
$points = GET_PAY_POINTS($DATA[5]);
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array($points, bigintval($DATA[1])), __FILE__, __LINE__);
-
- // Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
- // Update database
- //* DEBUG: */ echo "*MEDIA/L:".__LINE__."/".$points."*<br />";
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $points);
- }
+ ADD_POINTS_REFSYSTEM($DATA[1], $points, false, "0", false, "direct");
// Add points together and remove user
$points_BACK[$DATA[1]] += $points;
-Hallo $content[surname] $content[family],
+Hallo $content[gender] $content[surname] $content[family],
------------------------------
Ihre Mitglied-ID lautet: $UID
-Hallo $content[surname] $content[family],
+Hallo $content[gender] $content[surname] $content[family],
------------------------------
Ihre Mitglied-ID lautet: $UID
-Hallo $content[surname] $content[family],
+Hallo $content[gender] $content[surname] $content[family],
------------------------------
Ihre Mitglied-ID lautet: $UID
-Hallo $content[surname] $content[family],
+Hallo $content[gender] $content[surname] $content[family],
------------------------------
Ihre Mitglied-ID lautet: $UID
-Hallo $content[surname] $content[family],
+Hallo $content[gender] $content[surname] $content[family],
------------------------------
Ihre Mitglied-ID lautet: $content[u_id]
-Hallo $content[surname] $content[family],
+Hallo $content[gender] $content[surname] $content[family],
------------------------------
Ihre Mitglied-ID lautet: $UID
Ende der Rallye: $DATA[end] Uhr
Server-Zeit: $DATA[now_t] Uhr
------------------------------
-$content
+$content[prices]
Ihr Werbelink zum Werben neuer Mitglieder:
{!URL!}/ref.php?refid=$UID
------------------------------