'url' => $url,
'frametester' => FRAMETESTER($url),
'uid' => $uid,
- 'reward' => $reward,
- 'status' => $status
+ 'reward' => TRANSLATE_COMMA($reward),
+ 'status' => SURFBAR_TRANSLATE_STATUS($status)
);
// Insert the URL into database
$content['insert_id'] = SURFBAR_INSERT_URL_BY_ARRAY($content);
// If in reg-mode we notify admin
- if ($addMode == "reg") {
- // Notify admin of newly added URL in surfbar
- SURFBAR_NOTIFY_ADMIN("url_reg", $content);
- } elseif ($_CONFIG['surfbar_notify_admin_unlock'] == "Y") {
+ if (($addMode == "reg") || ($_CONFIG['surfbar_notify_admin_unlock'] == "Y")) {
// Notify admin even when he as unlocked an email
- SURFBAR_NOTIFY_ADMIN("url_unlock", $content);
- }
+ SURFBAR_NOTIFY_ADMIN("url_{$addMode}", $content);
+ } // END - if
// Send mail to user
SURFBAR_NOTIFY_USER("url_{$addMode}", $content);
// Inserts an url by given data array and return the insert id
function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
// Just run the insert query for now
- /*
SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_urls (userid, url, reward, status) VALUES(%s, '%s', %s, '%s')",
array(
- bigintval($urlData['userid']),
+ bigintval($urlData['uid']),
bigintval($urlData['url']),
(float)$urlData['reward'],
$urlData['status']
), __FILE__, __LINE__
);
- */
// Return insert id
return SQL_INSERTID();
// Notify admin(s) with a selected message and content
function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
// Prepare template name
- $template = sprintf("admin_surfbar_%s", $messageType);
+ $templateName = sprintf("admin_surfbar_%s", $messageType);
+
+ // Prepare subject
+ $eval = sprintf("\$subject = ADMIN_SURFBAR_NOTIFY_%s_SUBJECT;",
+ strtoupper($messageType)
+ );
+ eval($eval);
+
+ // Send the notification out
+ SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
+}
+// Notify the user about the performed action
+function SURFBAR_NOTIFY_USER ($messageType, $content) {
+ // Prepare template name
+ $templateName = sprintf("member_surfbar_%s", $messageType);
+
+ // Prepare subject
+ $eval = sprintf("\$subject = MEMBER_SURFBAR_NOTIFY_%s_SUBJECT;",
+ strtoupper($messageType)
+ );
+ eval($eval);
+
+ // Load template
+ $mailText = LOAD_EMAIL_TEMPLATE($templateName, $content);
+
+ // Send the email
+ SEND_EMAIL($content['uid'], $subject, $mailText);
+}
+// Translate the URL status
+function SURFBAR_TRANSLATE_STATUS ($status) {
+ // Create constant name
+ $constantName = sprintf("SURFBAR_URL_STATUS_%s", strtoupper($status));
+
+ // Set default translated status
+ $statusTranslated = "!".$constantName."!";
+
+ // Generate eval() command
+ if (defined($constantName)) {
+ $eval = "\$statusTranslated = ".$constantName.";";
+ eval($eval);
+ } // END - if
+
+ // Return result
+ return $statusTranslated;
}
//
?>