* -------------------------------------------------------------------- *
* Kurzbeschreibung : Spezielle Funktion fuer rallye-Erweiterung *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2008 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
}
//
-function RALLYE_AUTOSTART_RALLYES($result)
-{
+function RALLYE_AUTOSTART_RALLYES ($result) {
// Global data array for LOAD_EMAIL_TEMPLATE()
- $DATA = array();
global $DATA;
+ $DATA = array();
// Load all rallyes (usally we have only one rallye active per time!
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
// Run this function only when a new member has confirmed his email address!
function RALLYE_AUTOADD_USER ($uid) {
global $DATA;
- $ADD = "";
+ $add = "";
// Updated extension?
if (GET_EXT_VERSION("rallye") >= "0.2.0") {
- $ADD .= ", min_users, min_prices";
+ $add .= ", min_users, min_prices";
} // END - if
// Check for an auto-add rallye
- $result = SQL_QUERY("SELECT id, title, start_time, end_time, send_notify".$ADD." FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE is_active='Y' AND notified='Y' AND auto_add_new_user='Y' AND expired='N' LIMIT 1", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT id, title, start_time, end_time, send_notify".$add." FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE is_active='Y' AND notified='Y' AND auto_add_new_user='Y' AND expired='N' LIMIT 1", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Init variables
$min_users = 0; $min_prices = 0;
} // END - if
} // END - if
}
+
//
-function RALLYE_EXPIRE_RALLYES($result)
-{
+function RALLYE_EXPIRE_RALLYES ($result) {
global $DATA;
// Load rallye data
$DATA['now_t'] = MAKE_DATETIME(time(), "1");
// Just count...
- $TOTAL = 0;
+ $total = 0;
foreach($prices['uid'] as $key => $uid) {
// Check status
// active = 1: account is still confirmed
// Allow valid and active users with at least one ref to get points
if (($uid > 0) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) {
- $TOTAL++;
+ $total++;
} // END - if
} // END - foreach
- if (($TOTAL < $min_prices) || ($TOTAL == 0)) {
+ if (($total < $min_prices) || ($total == 0)) {
// Do not end this rallye!
unset($DATA);
return;
// Generate table
$OUT = LOAD_TEMPLATE("guest_rallye_expired_header", true);
$SW = 2;
- for ($idx = 0; $idx < $prices; $idx++)
- {
+ for ($idx = 0; $idx < $prices; $idx++) {
// Check status
// active = 1: account is still confirmed
// active = 0: account is deleted or locked
SQL_FREERESULT($result_active);
if (empty($DATA['uid'][$idx])) $DATA['uid'][$idx] = "---";
- if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == 0) || ($active == 0) || ("".round($DATA['cpoints'][$idx])."" == "0") || (empty($DATA['cpoints'][$idx])))
- {
+ if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == 0) || ($active == 0) || ("".round($DATA['cpoints'][$idx])."" == "0") || (empty($DATA['cpoints'][$idx]))) {
// Allow valid and active users with at least one ref to get points
$DATA['ref'][$idx] = "---";
$DATA['uid'][$idx] = "---";
}
- if (!empty($DATA['info'][$idx]))
- {
+
+ if (!empty($DATA['info'][$idx])) {
// Take direct infos
$DATA['infos'][$idx] = $DATA['info'][$idx];
- }
- else
- {
+ } else {
// Take ppints
$DATA['infos'][$idx] = $DATA['points'][$idx]." {!POINTS!}";
}
// Add row
- $ADD = "";
+ $add = "";
$OUT .= "<tr>
- <td class=\"switch_sw".$SW." bottom2".$ADD."\"> ".($idx+1).".</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2".$ADD."\">";
+ <td class=\"switch_sw".$SW." bottom2".$add."\"> ".($idx+1).".</td>
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2".$add."\">";
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "<strong>";
$OUT .= $DATA['uid'][$idx];
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "</strong>";
$OUT .= "</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2".$ADD."\">";
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2".$add."\">";
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "<strong>";
$OUT .= $DATA['ref'][$idx];
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "</strong>";
$OUT .= "</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2".$ADD."\">";
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2".$add."\">";
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "<strong>";
$OUT .= $DATA['infos'][$idx];
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "</strong>";
</tr>\n";
$SW = 3 - $SW;
}
+
// Add footer
$OUT .= LOAD_TEMPLATE("guest_rallye_expired_footer", true);
// Free memory
SQL_FREERESULT($result_rallye);
}
+
//
-function RALLYE_TEMPLATE_SELECTION($name="template", $default="")
-{
+function RALLYE_TEMPLATE_SELECTION ($name="template", $default="") {
// Check templates directory
$OUT = ""; $ral = array();
$BASE = sprintf("%stemplates/%s/html/rallye/", constant('PATH'), GET_LANGUAGE());
$dir = opendir($BASE);
- while ($read = readdir($dir))
- {
+ while ($read = readdir($dir)) {
// If it is no dir (so a file)
- if (!is_dir($BASE.$read))
- {
+ if (!isDirectory($BASE.$read)) {
// Accept only templates matching with rallye_????.tpl.xx
if (eregi("^rallye_.*\.tpl", $read))
{
// Return selection
return $OUT;
}
+
//
function RALLYE_GET_REFCOUNT ($uid, $old=0) {
// Check current refs
// Remove old refs
//* DEBUG: */ echo "+".$cnt."/".$old."+<br />";
$cnt -= $old;
- }
+ } // END - if
} else {
// Load current refs from database
$result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(s.counter) AS cnt