// Some security stuff...
if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
}
// Is the lock reason empty?
if (empty($urlData['lock_reason'])) {
// Fix it to three dashes
- $urlData['lock_reason'] = "---";
+ $urlData['lock_reason'] = '---';
} // END - if
// Include fields only for action 'edit'
if ($action == "edit") {
// Default is not limited
- $urlData['limited_yes'] = "";
- $urlData['limited_no'] = " checked=\"checked\"";
+ $urlData['limited_yes'] = '';
+ $urlData['limited_no'] = ' chkecked="checked"';
$urlData['limited'] = "false";
// Is this URL limited?
if ($urlData['views_max'] > 0) {
// Then rewrite form data
- $urlData['limited_yes'] = " checked=\"checked\"";
- $urlData['limited_no'] = "";
+ $urlData['limited_yes'] = ' chkecked="checked"';
+ $urlData['limited_no'] = '';
$urlData['limited'] = "true";
} // END - if
} // END - if
$executed = false;
// Is limitation "no" and "limit" is > 0?
- if ((isset($urlData[$action]['limited'])) && ($urlData[$action]['limited'] == "N") && ((isset($urlData[$action]['limit'])) && ($urlData[$action]['limit'] > 0)) || (!isset($urlData[$action]['limit']))) {
+ if ((isset($urlData[$action]['limited'])) && ($urlData[$action]['limited'] == 'N') && ((isset($urlData[$action]['limit'])) && ($urlData[$action]['limit'] > 0)) || (!isset($urlData[$action]['limit']))) {
// Set it to unlimited
$urlData[$action]['limit'] = 0;
} // END - if
// Load URL data by given search term and column
function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add="") {
- global $lastUrlData;
-
// By default nothing is found
- $lastUrlData = array();
+ $GLOBALS['last_url_data'] = array();
// Is the column an id number?
- if (($column == "id") || ($column == "userid")) {
+ if (($column == "id") || ($column == 'userid')) {
// Extra secure input
$searchTerm = bigintval($searchTerm);
} // END - if
// If the column is "id" there can be only one entry
- $limit = "";
+ $limit = '';
if ($column == "id") {
$limit = "LIMIT 1";
} // END - if
// Shall we group these results?
if ($group == "id") {
// Add the row by id as index
- $lastUrlData[$dataRow['id']] = $dataRow;
+ $GLOBALS['last_url_data'][$dataRow['id']] = $dataRow;
} else {
// Group entries
- $lastUrlData[$dataRow[$group]][$dataRow['id']] = $dataRow;
+ $GLOBALS['last_url_data'][$dataRow[$group]][$dataRow['id']] = $dataRow;
}
} // END - while
} // END - if
SQL_FREERESULT($result);
// Return the result
- return $lastUrlData;
+ return $GLOBALS['last_url_data'];
}
// Registers an URL with the surfbar. You should have called SURFBAR_LOOKUP_BY_URL() first!
$content['limit'] = SURFBAR_TRANSLATE_LIMIT($content['limit']);
// If in reg-mode we notify admin
- if (($addMode == "reg") || (getConfig('surfbar_notify_admin_unlock') == "Y")) {
+ if (($addMode == "reg") || (getConfig('surfbar_notify_admin_unlock') == 'Y')) {
// Notify admin even when he as unlocked an email
SURFBAR_NOTIFY_ADMIN("url_{$addMode}", $content);
} // END - if
// Check wether the user is allowed to book more URLs
function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
// Is this admin and userid is zero or does the user has some URLs left to book?
- return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid, "", array("REJECTED")) < getConfig('surfbar_max_order')));
+ return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid, '', array("REJECTED")) < getConfig('surfbar_max_order')));
}
// Get total amount of URLs of given status for current user
function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="",$exclude="") {
}
// Default is all URLs
- $add = "";
+ $add = '';
// Is the status set?
if (is_array($status)) {
if ($length == 0) $length = 10;
// Generate a code until the length matches
- $valCode = "";
+ $valCode = '';
while (strlen($valCode) != $length) {
// Is the salt set?
if (empty($salt)) {
$code = SURFBAR_GENERATE_VALIDATION_CODE($urlId, $salt);
// Return result of checking hashes and salts
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "---".$code."|".$check."---", false);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, '---'.$code."|".$check.'---', false);
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++", false);
return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
}
// Updates the statistics of current URL/userid
function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
// Init add
- $add = "";
+ $add = '';
// Get allowed views
$allowed = SURFBAR_GET_VIEWS_ALLOWED();
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Get total users
- $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
+ $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
// Get online users
$onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE();
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Get total users
- $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
+ $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
// Calculate addon
$addon += abs($max * $percent * $totalUsers);
$USE = SURFBAR_GET_LOCK_IDS();
// Shall we add some URL ids to ignore?
- $add = "";
+ $add = '';
if (count($USE) > 0) {
// Ignore some!
$add = " AND sbu.id NOT IN (";
if (is_null($GLOBALS['cache_array']['surfbar']['last_salt'])) {
// Then repair it wit the static!
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_salt - FIXED!", false);
- $GLOBALS['cache_array']['surfbar']['last_salt'] = "";
+ $GLOBALS['cache_array']['surfbar']['last_salt'] = '';
} // END - if
// Fix missing last_surfed