* $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 - 2009 by Roland Haeder *
- * Copyright (c) 2009, 2010 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// -----------------------------------------------------------------------------
// Admin functions
$executed = SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['url_status'], $urlData['new_status'], array($urlData['id'] => $urlData));
} // END - if
} else {
- // Not found!
+ // Not found
addFatalMessage(__FUNCTION__, __LINE__, '{--MEMBER_SURFBAR_EXECUTE_ACTION_404--}', $functionName);
}
$return = '{--MEMBER_SURFBAR_UNLIMITED_VIEWS--}';
} else {
// Translate comma
- $return = translateComma($limit);
+ $return = '{%pipe,translateComma=' . $limit . '%}';
}
// Return value
);
// Fetch row
- list($cnt) = SQL_FETCHROW($result);
+ list($count) = SQL_FETCHROW($result);
// Free result
SQL_FREERESULT($result);
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'cnt=' . $cnt);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'cnt=' . $count);
// Return result
- return $cnt;
+ return $count;
}
// Check wether the user is allowed to book more URLs
}
// Get amount from database
- $cnt = countSumTotalData($userid, 'surfbar_urls', 'url_id', 'url_userid', true, $add);
+ $count = countSumTotalData($userid, 'surfbar_urls', 'url_id', 'url_userid', true, $add);
// Return result
- return $cnt;
+ return $count;
}
// Generate a validation code for the given id number
$GLOBALS['surfbar_cache']['salt'] = 'INVALID';
// Get code length from config
- $length = getConfig('code_length');
+ $length = getCodeLength();
// Fix length to 10
if ($length == '0') $length = 10;
}
// ... and now the validation code
- $valCode = generateRandomCode($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getMemberId());
+ $valCode = generateRandomCode($length, sha1(SURFBAR_GET_SALT() . getEncryptSeperator() . $urlId), getMemberId());
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'valCode='.valCode.'', false);
} // END - while
subtractPoints(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
} // END - if
- // Book it to the user
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.getMemberId().',reward='.SURFBAR_GET_REWARD().'', false);
- addPointsThroughReferalSystem(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getMemberId(), SURFBAR_GET_DATA('reward'));
+ // @TODO Try to rewrite the following unset()
+ unset($GLOBALS['ref_level']);
+
+ // Book it to the user
+ addPointsThroughReferalSystem(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getMemberId(), SURFBAR_GET_REWARD());
}
// Updates the statistics of current URL/userid
), __FUNCTION__, __LINE__);
// Was that update okay?
- if (SQL_AFFECTEDROWS() < 1) {
+ if (SQL_HASZEROAFFECTED()) {
// No, then insert entry
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`, `stats_url_id`, `stats_count`) VALUES (%s,%s,1)",
array(
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt='.SURFBAR_GET_SALT().',id='.SURFBAR_GET_ID().',userid='.getMemberId().'', false);
// Was that okay?
- if (SQL_AFFECTEDROWS() < 1) {
+ if (SQL_HASZEROAFFECTED()) {
// Insert missing entry!
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` (`salts_url_id`, `salts_userid`, `salts_last_salt`) VALUES (%s, %s, '%s')",
array(SURFBAR_GET_ID(), getMemberId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'affectedRows='.SQL_AFFECTEDROWS().'', false);
// Return if the update was okay
- return (SQL_AFFECTEDROWS() == 1);
+ return (!SQL_HASZEROAFFECTED());
}
// Check if the reload lock is active for given id
);
// Fetch counter
- list($cnt) = SQL_FETCHROW($result);
+ list($count) = SQL_FETCHROW($result);
// Free result
SQL_FREERESULT($result);
// Return check
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'cnt=' . $cnt . ',' . SURFBAR_GET_SURF_LOCK() . '', false);
- return ($cnt == 1);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'cnt=' . $count . ',' . SURFBAR_GET_SURF_LOCK() . '', false);
+ return ($count == 1);
}
// Determine which user hash no more points left
`stats_userid` ASC', __FUNCTION__, __LINE__);
// Fetch count
- $cnt = SQL_NUMROWS($result);
+ $count = SQL_NUMROWS($result);
// Free result
SQL_FREERESULT($result);
// Return result
- return $cnt;
+ return $count;
}
// Determine waiting time for one URL
// Prepare content for notification routines
$data[$urlId]['url_userid'] = $data[$urlId]['url_userid'];
- $data[$urlId]['frametester'] = generateFrametesterUrl($data[$urlId]['url']);
- $data[$urlId]['reward'] = translateComma(getConfig('surfbar_static_reward'));
- $data[$urlId]['costs'] = translateComma(getConfig('surfbar_static_costs'));
+ $data[$urlId]['frametester'] = '{%pipe,generateFrametesterUrl=' . $data[$urlId]['url'] . '%}';
+ $data[$urlId]['reward'] = '{%config,translateComma=surfbar_static_reward%}';
+ $data[$urlId]['costs'] = '{%config,translateComma=surfbar_static_costs%}';
// Do some dirty fixing here:
if (($data[$urlId]['url_status'] == 'STOPPED') && ($newStatus == 'pending')) {
}
// Determine next id for surfbar or get data for given id, always call this before you call other
-// getters below this function!!!
+// getters below this function!
function SURFBAR_DETERMINE_NEXT_ID ($urlId = '0') {
// Default is no id and no random number
$nextId = '0';