Nucleus CMS日本語版SVNをgit-svnしたもの。リポジトリの変換作業用
Revisão | 80c657aaa1b8c5c67b1900523cc798767b3852c3 (tree) |
---|---|
Hora | 2011-03-21 11:10:30 |
Autor | sakamocchi <sakamocchi@1ca2...> |
Commiter | sakamocchi |
Just reviewing code formatting.
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1171 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -84,17 +84,19 @@ class COMMENTACTIONS extends BaseActions { | ||
84 | 84 | function setParser(&$parser) { |
85 | 85 | $this->parser =& $parser; |
86 | 86 | } |
87 | - | |
87 | + | |
88 | 88 | function setCommentsObj(&$commentsObj) { |
89 | 89 | $this->commentsObj =& $commentsObj; |
90 | 90 | } |
91 | - | |
91 | + | |
92 | 92 | function setTemplate($template) { |
93 | 93 | $this->template =& $template; |
94 | 94 | } |
95 | - | |
95 | + | |
96 | 96 | function setCurrentComment(&$comment) { |
97 | + | |
97 | 98 | global $manager; |
99 | + | |
98 | 100 | // begin if: member comment |
99 | 101 | if ($comment['memberid'] != 0) |
100 | 102 | { |
@@ -102,9 +104,9 @@ class COMMENTACTIONS extends BaseActions { | ||
102 | 104 | |
103 | 105 | $mem =& $manager->getMember($comment['memberid']); |
104 | 106 | $comment['user'] = $mem->getDisplayName(); |
105 | - | |
107 | + | |
106 | 108 | // begin if: member URL exists, set it as the userid |
107 | - if ($mem->getURL()) | |
109 | + if ($mem->getURL() ) | |
108 | 110 | { |
109 | 111 | $comment['userid'] = $mem->getURL(); |
110 | 112 | } |
@@ -113,7 +115,7 @@ class COMMENTACTIONS extends BaseActions { | ||
113 | 115 | { |
114 | 116 | $comment['userid'] = $mem->getEmail(); |
115 | 117 | } // end if |
116 | - | |
118 | + | |
117 | 119 | $comment['userlinkraw'] = createLink( |
118 | 120 | 'member', |
119 | 121 | array( |
@@ -121,15 +123,19 @@ class COMMENTACTIONS extends BaseActions { | ||
121 | 123 | 'name' => $mem->getDisplayName(), |
122 | 124 | 'extra' => $this->commentsObj->itemActions->linkparams |
123 | 125 | ) |
124 | - ); | |
126 | + ); | |
127 | + | |
125 | 128 | } |
126 | 129 | // else: non-member comment |
127 | 130 | else |
128 | 131 | { |
132 | + | |
129 | 133 | // create smart links |
134 | + | |
130 | 135 | // begin if: comment userid is not empty |
131 | 136 | if (!empty($comment['userid']) ) |
132 | 137 | { |
138 | + | |
133 | 139 | // begin if: comment userid has either "http://" or "https://" at the beginning |
134 | 140 | if ( (strpos($comment['userid'], 'http://') === 0) || (strpos($comment['userid'], 'https://') === 0) ) |
135 | 141 | { |
@@ -140,6 +146,7 @@ class COMMENTACTIONS extends BaseActions { | ||
140 | 146 | { |
141 | 147 | $comment['userlinkraw'] = 'http://' . $comment['userid']; |
142 | 148 | } // end if |
149 | + | |
143 | 150 | } |
144 | 151 | // else if: comment email is valid |
145 | 152 | else if (isValidMailAddress($comment['email']) ) |
@@ -151,7 +158,9 @@ class COMMENTACTIONS extends BaseActions { | ||
151 | 158 | { |
152 | 159 | $comment['userlinkraw'] = 'mailto:' . $comment['userid']; |
153 | 160 | } // end if |
161 | + | |
154 | 162 | } // end if |
163 | + | |
155 | 164 | $this->currentComment =& $comment; |
156 | 165 | global $currentcommentid, $currentcommentarray; |
157 | 166 | $currentcommentid = $comment['commentid']; |
@@ -220,7 +229,7 @@ class COMMENTACTIONS extends BaseActions { | ||
220 | 229 | function parse_date($format = '') { |
221 | 230 | echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE'], $this->commentsObj->itemActions->blog); |
222 | 231 | } |
223 | - | |
232 | + | |
224 | 233 | /** |
225 | 234 | * Parse templatevar email |
226 | 235 | */ |
@@ -351,14 +360,20 @@ class COMMENTACTIONS extends BaseActions { | ||
351 | 360 | |
352 | 361 | /** |
353 | 362 | * Parse templatevar user |
363 | + * @param string $mode | |
354 | 364 | */ |
355 | - function parse_user($mode='') { | |
365 | + function parse_user($mode = '') | |
366 | + { | |
356 | 367 | global $manager; |
357 | - if ($mode == 'realname' && $this->currentComment['memberid'] > 0) { | |
368 | + | |
369 | + if ( $mode == 'realname' && $this->currentComment['memberid'] > 0 ) | |
370 | + { | |
358 | 371 | $member =& $manager->getMember($this->currentComment['memberid']); |
359 | 372 | echo $member->getRealName(); |
360 | - } else { | |
361 | - echo htmlspecialchars($this->currentComment['user'],ENT_QUOTES); | |
373 | + } | |
374 | + else | |
375 | + { | |
376 | + echo htmlspecialchars($this->currentComment['user'], ENT_QUOTES); | |
362 | 377 | } |
363 | 378 | } |
364 | 379 |
@@ -410,7 +425,7 @@ class COMMENTACTIONS extends BaseActions { | ||
410 | 425 | function parse_userlinkraw() { |
411 | 426 | echo $this->currentComment['userlinkraw']; |
412 | 427 | } |
413 | - | |
428 | + | |
414 | 429 | /** |
415 | 430 | * Parse templatevar userwebsite |
416 | 431 | */ |
@@ -418,7 +433,7 @@ class COMMENTACTIONS extends BaseActions { | ||
418 | 433 | if (!(strpos($this->currentComment['userlinkraw'], 'http://') === false)) |
419 | 434 | echo $this->currentComment['userlinkraw']; |
420 | 435 | } |
421 | - | |
436 | + | |
422 | 437 | /** |
423 | 438 | * Parse templatevar userwebsitelink |
424 | 439 | */ |
@@ -429,9 +444,9 @@ class COMMENTACTIONS extends BaseActions { | ||
429 | 444 | echo $this->currentComment['user']; |
430 | 445 | } |
431 | 446 | } |
432 | - | |
447 | + | |
433 | 448 | // function to enable if-else-elseif-elseifnot-ifnot-endif to comment template fields |
434 | - | |
449 | + | |
435 | 450 | /** |
436 | 451 | * Checks conditions for if statements |
437 | 452 | * |
@@ -480,7 +495,7 @@ class COMMENTACTIONS extends BaseActions { | ||
480 | 495 | break; |
481 | 496 | case 'archivenextexists': |
482 | 497 | $condition = ($archivenextexists == true); |
483 | - break; | |
498 | + break; | |
484 | 499 | case 'skintype': |
485 | 500 | $condition = ($name == $this->skintype); |
486 | 501 | break; */ |
@@ -492,8 +507,8 @@ class COMMENTACTIONS extends BaseActions { | ||
492 | 507 | break; |
493 | 508 | } |
494 | 509 | return $condition; |
495 | - } | |
496 | - | |
510 | + } | |
511 | + | |
497 | 512 | /** |
498 | 513 | * Different checks for a category |
499 | 514 | */ |
@@ -517,16 +532,16 @@ class COMMENTACTIONS extends BaseActions { | ||
517 | 532 | |
518 | 533 | return false; |
519 | 534 | } |
520 | - | |
521 | - | |
535 | + | |
536 | + | |
522 | 537 | /** |
523 | 538 | * Different checks for an author |
524 | 539 | */ |
525 | 540 | function _ifAuthor($name = '', $value='') { |
526 | 541 | global $member, $manager; |
527 | - | |
542 | + | |
528 | 543 | if ($this->currentComment['memberid'] == 0) return false; |
529 | - | |
544 | + | |
530 | 545 | $mem =& $manager->getMember($this->currentComment['memberid']); |
531 | 546 | $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid'])); |
532 | 547 | $citem =& $manager->getItem($this->currentComment['itemid'],1,1); |
@@ -539,26 +554,26 @@ class COMMENTACTIONS extends BaseActions { | ||
539 | 554 | // check comment author name |
540 | 555 | if ($name == 'name') { |
541 | 556 | $value = trim(strtolower($value)); |
542 | - if ($value == '') | |
557 | + if ($value == '') | |
543 | 558 | return false; |
544 | 559 | if ($value == strtolower($mem->getDisplayName())) |
545 | 560 | return true; |
546 | 561 | } |
547 | 562 | |
548 | 563 | // check if comment author is admin |
549 | - if ($name == 'isadmin') { | |
550 | - $blogid = intval($b->getID()); | |
564 | + if ($name == 'isadmin') { | |
565 | + $blogid = intval($b->getID()); | |
551 | 566 | if ($mem->isAdmin()) |
552 | 567 | return true; |
553 | - | |
568 | + | |
554 | 569 | return $mem->isBlogAdmin($blogid); |
555 | 570 | } |
556 | - | |
571 | + | |
557 | 572 | // check if comment author is item author |
558 | - if ($name == 'isauthor') { | |
573 | + if ($name == 'isauthor') { | |
559 | 574 | return (intval($citem['authorid']) == intval($this->currentComment['memberid'])); |
560 | 575 | } |
561 | - | |
576 | + | |
562 | 577 | // check if comment author is on team |
563 | 578 | if ($name == 'isonteam') { |
564 | 579 | return $mem->teamRights(intval($b->getID())); |
@@ -566,13 +581,13 @@ class COMMENTACTIONS extends BaseActions { | ||
566 | 581 | |
567 | 582 | return false; |
568 | 583 | } |
569 | - | |
584 | + | |
570 | 585 | /** |
571 | 586 | * Different checks for a category |
572 | 587 | */ |
573 | 588 | function _ifItemCategory($name = '', $value='') { |
574 | 589 | global $catid, $manager; |
575 | - | |
590 | + | |
576 | 591 | $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid'])); |
577 | 592 | $citem =& $manager->getItem($this->currentComment['itemid'],1,1); |
578 | 593 | $icatid = $citem['catid']; |
@@ -580,7 +595,7 @@ class COMMENTACTIONS extends BaseActions { | ||
580 | 595 | // when no parameter is defined, just check if a category is selected |
581 | 596 | if (($name != 'catname' && $name != 'catid') || ($value == '')) |
582 | 597 | return $b->isValidCategory($icatid); |
583 | - | |
598 | + | |
584 | 599 | // check category name |
585 | 600 | if ($name == 'catname') { |
586 | 601 | $value = $b->getCategoryIdFromName($value); |
@@ -595,15 +610,15 @@ class COMMENTACTIONS extends BaseActions { | ||
595 | 610 | return false; |
596 | 611 | } |
597 | 612 | |
598 | - | |
613 | + | |
599 | 614 | /** |
600 | 615 | * Checks if a member is on the team of a blog and return his rights |
601 | 616 | */ |
602 | 617 | function _ifOnTeam($blogName = '') { |
603 | 618 | global $blog, $member, $manager; |
604 | - | |
619 | + | |
605 | 620 | $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid'])); |
606 | - | |
621 | + | |
607 | 622 | // when no blog found |
608 | 623 | if (($blogName == '') && (!is_object($b))) |
609 | 624 | return 0; |
@@ -626,7 +641,7 @@ class COMMENTACTIONS extends BaseActions { | ||
626 | 641 | global $blog, $member, $manager; |
627 | 642 | |
628 | 643 | $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid'])); |
629 | - | |
644 | + | |
630 | 645 | // when no blog found |
631 | 646 | if (($blogName == '') && (!is_object($b))) |
632 | 647 | return 0; |
@@ -642,7 +657,7 @@ class COMMENTACTIONS extends BaseActions { | ||
642 | 657 | return $member->isBlogAdmin($blogid); |
643 | 658 | } |
644 | 659 | |
645 | - | |
660 | + | |
646 | 661 | /** |
647 | 662 | * hasplugin,PlugName |
648 | 663 | * -> checks if plugin exists |
@@ -687,5 +702,6 @@ class COMMENTACTIONS extends BaseActions { | ||
687 | 702 | |
688 | 703 | return call_user_func_array(array(&$plugin, 'doIf'), $params); |
689 | 704 | } |
705 | + | |
690 | 706 | } |
691 | 707 | ?> |
\ No newline at end of file |