OSDN Git Service

add <%user(realname)%>
authorshizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 19 Mar 2007 10:20:24 +0000 (10:20 +0000)
committershizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 19 Mar 2007 10:20:24 +0000 (10:20 +0000)
fix <%useremail%>

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk/utf8@228 1ca29b6e-896d-4ea0-84a5-967f57386b96

nucleus/libs/COMMENTACTIONS.php

index 2d3dd16..83874bc 100644 (file)
@@ -14,7 +14,7 @@
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2007 The Nucleus Group
- * @version $Id: COMMENTACTIONS.php,v 1.3 2007-02-04 06:28:46 kimitake Exp $
+ * @version $Id: COMMENTACTIONS.php,v 1.4 2007-03-19 10:20:24 shizuki Exp $
  * @version $NucleusJP: COMMENTACTIONS.php,v 1.2 2006/07/20 08:01:52 kimitake Exp $
  */
 
@@ -110,12 +110,20 @@ class COMMENTACTIONS extends BaseActions {
                } else {
 
                        // create smart links
-                       if (isValidMailAddress($comment['userid']))
+/*                     if (isValidMailAddress($comment['userid']))
                                $comment['userlinkraw'] = 'mailto:'.$comment['userid'];
                        elseif (strstr($comment['userid'],'http://') != false)
                                $comment['userlinkraw'] = $comment['userid'];
                        elseif (strstr($comment['userid'],'www') != false)
+                               $comment['userlinkraw'] = 'http://'.$comment['userid'];*/
+                       if (strstr($comment['userid'],'http://') != false)
+                               $comment['userlinkraw'] = $comment['userid'];
+                       elseif (strstr($comment['userid'],'www') != false)
                                $comment['userlinkraw'] = 'http://'.$comment['userid'];
+                       elseif (isValidMailAddress($comment['email']))
+                               $comment['userlinkraw'] = 'mailto:'.$comment['userid'];
+                       elseif (isValidMailAddress($comment['userid']))
+                               $comment['userlinkraw'] = 'mailto:'.$comment['email'];
                }
 
                $this->currentComment =& $comment;
@@ -201,8 +209,15 @@ class COMMENTACTIONS extends BaseActions {
                echo $this->currentComment['blogid'];
        }
 
-       function parse_user() {
+//     function parse_user() {
+       function parse_user($mode='') {
+               global $manager;
+               if ($mode == 'realname' && $this->currentComment['memberid'] > 0) {
+                       $member =& $manager->getMember($this->currentComment['memberid']);
+                       echo $member->getRealName();
+               } else {
                        echo $this->currentComment['user'];
+               }
        }
        
        function parse_userid() {
@@ -239,8 +254,12 @@ class COMMENTACTIONS extends BaseActions {
                }
                else
                {
-                       if (!(strpos($this->currentComment['userlinkraw'], 'mailto:') === false))
-                               echo str_replace('mailto:', '', $this->currentComment['userlinkraw']);
+                       if (isValidMailAddress($this->currentComment['email']))
+                               echo $this->currentComment['email'];
+                       elseif (isValidMailAddress($this->currentComment['userid']))
+                               echo $this->currentComment['userid'];
+//                     if (!(strpos($this->currentComment['userlinkraw'], 'mailto:') === false))
+//                             echo str_replace('mailto:', '', $this->currentComment['userlinkraw']);
                }
        }
 
@@ -296,4 +315,4 @@ class COMMENTACTIONS extends BaseActions {
                call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);
        }
 }
-?>
+?>
\ No newline at end of file