Fixed "unapproved" status taking precedence over "spam" flag in comment submit and some display related bugs in comments.js
authorDan
Sat, 20 Mar 2010 16:05:38 -0400
changeset 1223 7dca925b0209
parent 1222 d1ded7b4c775
child 1224 a54e149f4a78
Fixed "unapproved" status taking precedence over "spam" flag in comment submit and some display related bugs in comments.js
includes/clientside/static/comments.js
includes/comment.php
includes/functions.php
--- a/includes/clientside/static/comments.js	Wed Mar 17 14:21:46 2010 -0400
+++ b/includes/clientside/static/comments.js	Sat Mar 20 16:05:38 2010 -0400
@@ -399,7 +399,7 @@
   }
   if ( data.approved && data.approved != '1' )
   {
-    document.getElementById('subject_' + data.id).innerHTML += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
+    document.getElementById('subject_' + data.id).innerHTML += ' <span style="color: #D84308">' + ( data.approved == '2' ? $lang.get('comment_msg_note_spam') : $lang.get('comment_msg_note_unapp') ) + '</span>';
   }
   if ( data.approved && ( typeof(data.approve_updated) == 'string' && data.approve_updated == 'yes' ) )
   {
@@ -495,7 +495,7 @@
     tplvars.NAME = '<a href="' + makeUrlNS('User', data.name) + '">' + data.name + '</a>';
   
   if ( data.approved != '1' )
-    tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
+    tplvars.SUBJECT += ' <span style="color: #D84308">' + ( data.approved == '2' ? $lang.get('comment_msg_note_spam') : $lang.get('comment_msg_note_unapp') ) + '</span>';
   
   // Name
   tplvars.NAME = data.name;
@@ -520,10 +520,10 @@
     tplvars.USER_LEVEL += $lang.get(data.rank_data.rank_title);
   
   // Send PM link
-  tplvars.SEND_PM_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
+  tplvars.SEND_PM_LINK=(data.user_id>1)?'<a class="abutton icon abutton_blue" style="background-image: url(' + cdnPath + '/images/icons/send_pm.png);" onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br /><br />':'';
   
   // Add buddy link
-  tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':'';
+  tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a class="abutton icon abutton_green" style="background-image: url(' + cdnPath + '/images/icons/add_buddy.png);" onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':'';
   
   // Edit link
   tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">' + $lang.get('comment_btn_edit') + '</a>';
--- a/includes/comment.php	Wed Mar 17 14:21:46 2010 -0400
+++ b/includes/comment.php	Sat Mar 20 16:05:38 2010 -0400
@@ -340,7 +340,7 @@
           $sql_text = $db->escape($text);
           $text = RenderMan::render($text);
           $appr = ( getConfig('approve_comments', '0') == '1' ) ? COMMENT_UNAPPROVED : COMMENT_APPROVED;
-          if ( $appr === COMMENT_APPROVED && $spam_policy === 'moderate' && !$spamcheck )
+          if ( $spam_policy === 'moderate' && !$spamcheck )
             $appr = COMMENT_SPAM;
           $time = time();
           $date = enano_date(ED_DATE | ED_TIME, $time);
--- a/includes/functions.php	Wed Mar 17 14:21:46 2010 -0400
+++ b/includes/functions.php	Sat Mar 20 16:05:38 2010 -0400
@@ -221,7 +221,15 @@
 
 function get_server_url()
 {
-  return 'http' . ( $GLOBALS['is_https'] ) . '://' . $_SERVER['HTTP_HOST'];
+  $server_name = false;
+  if ( isset($_SERVER['HTTP_HOST']) )
+  	$server_name = $_SERVER['HTTP_HOST'];
+  else if ( isset($_SERVER['SERVER_NAME']) )
+  	$server_name = $_SERVER['SERVER_NAME'];
+  else
+    $server_name = 'localhost';
+  
+  return 'http' . ( $GLOBALS['is_https'] ) . '://' . $server_name;
 }
 
 /**