OSDN Git Service

Just reviewing code formatting.
authorsakamocchi <sakamocchi@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 21 Mar 2011 02:10:30 +0000 (02:10 +0000)
committersakamocchi <sakamocchi@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 21 Mar 2011 02:10:30 +0000 (02:10 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1171 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/libs/COMMENTACTIONS.php

index 5e69eed..56be73e 100644 (file)
@@ -84,17 +84,19 @@ class COMMENTACTIONS extends BaseActions {
        function setParser(&$parser) {
                $this->parser =& $parser;
        }
-       
+
        function setCommentsObj(&$commentsObj) {
                $this->commentsObj =& $commentsObj;
        }
-       
+
        function setTemplate($template) {
                $this->template =& $template;
        }
-       
+
        function setCurrentComment(&$comment) {
+
                global $manager;
+
                // begin if: member comment
                if ($comment['memberid'] != 0)
                {
@@ -102,9 +104,9 @@ class COMMENTACTIONS extends BaseActions {
 
                        $mem =& $manager->getMember($comment['memberid']);
                        $comment['user'] = $mem->getDisplayName();
-                       
+
                        // begin if: member URL exists, set it as the userid
-                       if ($mem->getURL())
+                       if ($mem->getURL() )
                        {
                                $comment['userid'] = $mem->getURL();
                        }
@@ -113,7 +115,7 @@ class COMMENTACTIONS extends BaseActions {
                        {
                                $comment['userid'] = $mem->getEmail();
                        } // end if
-                       
+
                        $comment['userlinkraw'] = createLink(
                                                                                'member',
                                                                                array(
@@ -121,15 +123,19 @@ class COMMENTACTIONS extends BaseActions {
                                                                                        'name' => $mem->getDisplayName(),
                                                                                        'extra' => $this->commentsObj->itemActions->linkparams
                                                                                )
-                                                                         );
+                                                                       );
+
                }
                // else: non-member comment
                else
                {
+
                        // create smart links
+
                        // begin if: comment userid is not empty
                        if (!empty($comment['userid']) )
                        {
+
                                // begin if: comment userid has either "http://" or "https://" at the beginning
                                if ( (strpos($comment['userid'], 'http://') === 0) || (strpos($comment['userid'], 'https://') === 0) )
                                {
@@ -140,6 +146,7 @@ class COMMENTACTIONS extends BaseActions {
                                {
                                        $comment['userlinkraw'] = 'http://' . $comment['userid'];
                                } // end if
+
                        }
                        // else if: comment email is valid
                        else if (isValidMailAddress($comment['email']) )
@@ -151,7 +158,9 @@ class COMMENTACTIONS extends BaseActions {
                        {
                                $comment['userlinkraw'] = 'mailto:' . $comment['userid'];
                        } // end if
+
                } // end if
+
                $this->currentComment =& $comment;
                global $currentcommentid, $currentcommentarray;
                $currentcommentid = $comment['commentid'];
@@ -220,7 +229,7 @@ class COMMENTACTIONS extends BaseActions {
        function parse_date($format = '') {
                echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE'], $this->commentsObj->itemActions->blog);
        }
-       
+
        /**
         * Parse templatevar email
         */
@@ -351,14 +360,20 @@ class COMMENTACTIONS extends BaseActions {
 
        /**
         * Parse templatevar user
+        * @param string $mode
         */
-       function parse_user($mode='') {
+       function parse_user($mode = '')\r
+       {
                global $manager;
-               if ($mode == 'realname' && $this->currentComment['memberid'] > 0) {
+\r
+               if ( $mode == 'realname' && $this->currentComment['memberid'] > 0 )\r
+               {
                        $member =& $manager->getMember($this->currentComment['memberid']);
                        echo $member->getRealName();
-               } else {
-                       echo htmlspecialchars($this->currentComment['user'],ENT_QUOTES);
+               }\r
+               else\r
+               {
+                       echo htmlspecialchars($this->currentComment['user'], ENT_QUOTES);
                }
        }
 
@@ -410,7 +425,7 @@ class COMMENTACTIONS extends BaseActions {
        function parse_userlinkraw() {
                echo $this->currentComment['userlinkraw'];
        }
-       
+
        /**
         * Parse templatevar userwebsite
         */
@@ -418,7 +433,7 @@ class COMMENTACTIONS extends BaseActions {
                if (!(strpos($this->currentComment['userlinkraw'], 'http://') === false))
                        echo $this->currentComment['userlinkraw'];
        }
-       
+
        /**
         * Parse templatevar userwebsitelink
         */
@@ -429,9 +444,9 @@ class COMMENTACTIONS extends BaseActions {
                        echo $this->currentComment['user'];
                }
        }
-       
+
        // function to enable if-else-elseif-elseifnot-ifnot-endif to comment template fields
-       
+
        /**
         * Checks conditions for if statements
         *
@@ -480,7 +495,7 @@ class COMMENTACTIONS extends BaseActions {
                                break;
                        case 'archivenextexists':
                                $condition = ($archivenextexists == true);
-                               break; 
+                               break;
                        case 'skintype':
                                $condition = ($name == $this->skintype);
                                break; */
@@ -492,8 +507,8 @@ class COMMENTACTIONS extends BaseActions {
                                break;
                }
                return $condition;
-       }       
-       
+       }
+
        /**
         *  Different checks for a category
         */
@@ -517,16 +532,16 @@ class COMMENTACTIONS extends BaseActions {
 
                return false;
        }
-       
-               
+
+
        /**
         *  Different checks for an author
         */
        function _ifAuthor($name = '', $value='') {
                global $member, $manager;
-               
+
                if ($this->currentComment['memberid'] == 0) return false;
-               
+
                $mem =& $manager->getMember($this->currentComment['memberid']);
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
                $citem =& $manager->getItem($this->currentComment['itemid'],1,1);
@@ -539,26 +554,26 @@ class COMMENTACTIONS extends BaseActions {
                // check comment author name
                if ($name == 'name') {
                        $value = trim(strtolower($value));
-                       if ($value == '') 
+                       if ($value == '')
                                return false;
                        if ($value == strtolower($mem->getDisplayName()))
                                return true;
                }
 
                // check if comment author is admin
-               if ($name == 'isadmin') {                       
-                       $blogid = intval($b->getID());                  
+               if ($name == 'isadmin') {
+                       $blogid = intval($b->getID());
                        if ($mem->isAdmin())
                                return true;
-                               
+
                        return $mem->isBlogAdmin($blogid);
                }
-               
+
                // check if comment author is item author
-               if ($name == 'isauthor') {                      
+               if ($name == 'isauthor') {
                        return (intval($citem['authorid']) == intval($this->currentComment['memberid']));
                }
-               
+
                // check if comment author is on team
                if ($name == 'isonteam') {
                        return $mem->teamRights(intval($b->getID()));
@@ -566,13 +581,13 @@ class COMMENTACTIONS extends BaseActions {
 
                return false;
        }
-       
+
        /**
         *  Different checks for a category
         */
        function _ifItemCategory($name = '', $value='') {
                global $catid, $manager;
-               
+
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
                $citem =& $manager->getItem($this->currentComment['itemid'],1,1);
                $icatid = $citem['catid'];
@@ -580,7 +595,7 @@ class COMMENTACTIONS extends BaseActions {
                // when no parameter is defined, just check if a category is selected
                if (($name != 'catname' && $name != 'catid') || ($value == ''))
                        return $b->isValidCategory($icatid);
-                       
+
                // check category name
                if ($name == 'catname') {
                        $value = $b->getCategoryIdFromName($value);
@@ -595,15 +610,15 @@ class COMMENTACTIONS extends BaseActions {
                return false;
        }
 
-       
+
        /**
         *  Checks if a member is on the team of a blog and return his rights
         */
        function _ifOnTeam($blogName = '') {
                global $blog, $member, $manager;
-               
+
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
-               
+
                // when no blog found
                if (($blogName == '') && (!is_object($b)))
                        return 0;
@@ -626,7 +641,7 @@ class COMMENTACTIONS extends BaseActions {
                global $blog, $member, $manager;
 
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
-               
+
                // when no blog found
                if (($blogName == '') && (!is_object($b)))
                        return 0;
@@ -642,7 +657,7 @@ class COMMENTACTIONS extends BaseActions {
                return $member->isBlogAdmin($blogid);
        }
 
-       
+
        /**
         *      hasplugin,PlugName
         *         -> checks if plugin exists
@@ -687,5 +702,6 @@ class COMMENTACTIONS extends BaseActions {
 
                return call_user_func_array(array(&$plugin, 'doIf'), $params);
        }
+
 }
 ?>
\ No newline at end of file