[geeklog-hg] geeklog: Use COM_showMessage functions everywhere instead of COM...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Apr 1 07:30:29 EDT 2013


changeset 9021:d86b0d64a73e
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/d86b0d64a73e
user: Kenji ITO <mystralkk at gmail.com>
date: Mon Apr 01 20:27:20 2013 +0900
description:
Use COM_showMessage functions everywhere instead of COM_startBlock/_endBlock with the _msg_block template (feature request #0001369)

diffstat:

 plugins/calendar/functions.inc                  |  11 +----
 plugins/links/functions.inc                     |  20 +++--------
 plugins/polls/functions.inc                     |  31 +++++++----------
 plugins/staticpages/functions.inc               |   9 +----
 plugins/staticpages/services.inc.php            |  16 +-------
 public_html/admin/plugins/calendar/index.php    |  30 +++--------------
 public_html/admin/plugins/links/index.php       |  10 +----
 public_html/admin/plugins/polls/index.php       |  17 ++-------
 public_html/admin/plugins/staticpages/index.php |   5 +--
 public_html/article.php                         |   5 +--
 public_html/calendar/event.php                  |   4 +-
 public_html/lib-common.php                      |  20 +++++++++++-
 public_html/links/index.php                     |   5 +--
 public_html/polls/index.php                     |   6 +--
 public_html/profiles.php                        |  11 +-----
 public_html/stats.php                           |  16 ++-------
 public_html/submit.php                          |  29 +++-------------
 public_html/users.php                           |  36 +++++++--------------
 public_html/usersettings.php                    |  42 ++++++++----------------
 system/lib-comment.php                          |  15 +-------
 system/lib-story.php                            |  14 +------
 21 files changed, 107 insertions(+), 245 deletions(-)

diffs (truncated from 807 to 300 lines):

diff -r 58cad0780cfa -r d86b0d64a73e plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc	Sun Mar 31 09:16:22 2013 -0400
+++ b/plugins/calendar/functions.inc	Mon Apr 01 20:27:20 2013 +0900
@@ -438,11 +438,8 @@
 
     // check for missing textfields
     if (empty ($A['title']) || empty ($A['start_month']) || empty ($A['start_day']) || empty ($A['start_year'])) {
-        $retval .= COM_startBlock ($LANG12[22], '',
-                           COM_getBlockTemplate ('_msg_block', 'header'))
-            . $LANG12[23]
-            . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'))
-            . plugin_submit_calendar ($A['calendar_type']);
+        $retval .= COM_showMessageText($LANG12[23], $LANG12[22])
+                .  plugin_submit_calendar($A['calendar_type']);
         $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_CAL_1[27]));
 
         return $retval;
@@ -1394,9 +1391,7 @@
         }
         $display .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
     } else {
-        $display .= COM_startBlock($LANG_CAL_1[47]);
-        $display .= $LANG_CAL_1[49];
-        $display .= COM_endBlock();
+        $display .= COM_showMessageText($LANG_CAL_1[49], $LANG_CAL_1[47]);
     }
 
     return $display;
diff -r 58cad0780cfa -r d86b0d64a73e plugins/links/functions.inc
--- a/plugins/links/functions.inc	Sun Mar 31 09:16:22 2013 -0400
+++ b/plugins/links/functions.inc	Mon Apr 01 20:27:20 2013 +0900
@@ -330,11 +330,9 @@
                                 'hits' => $hits
                           );
         }
-        $retval .= ADMIN_simpleList ('', $header_arr, $text_arr, $data_arr);
+        $retval .= ADMIN_simpleList('', $header_arr, $text_arr, $data_arr);
     } else {
-        $retval .= COM_startBlock ($LANG_LINKS_STATS['stats_headline']);
-        $retval .= $LANG_LINKS_STATS['stats_no_hits'];
-        $retval .= COM_endBlock ();
+        $retval .= COM_showMessageText($LANG_LINKS_STATS['stats_no_hits'], $LANG_LINKS_STATS['stats_headline']);
     }
 
     return $retval;
@@ -984,11 +982,8 @@
             && ($A['url'] != 'http://')) {
         $retval = plugin_save_submit_links($A);
     } else {
-        $retval .= COM_startBlock ($LANG12[22], '',
-                           COM_getBlockTemplate ('_msg_block', 'header'))
-            . $LANG12[23]
-            . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'))
-            . plugin_submit_links();
+        $retval .= COM_showMessageText($LANG12[23], $LANG12[22])
+                .  plugin_submit_links();
         $retval = COM_createHTMLDocument($retval);
     }
 
@@ -1080,11 +1075,8 @@
         }
     }
     if (!$validcat) {
-        $retval .= COM_startBlock($LANG12[22], '',
-                       COM_getBlockTemplate('_msg_block', 'header'))
-                . $LANG12[23]
-                . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'))
-                . submissionform('links');
+        $retval .= COM_showMessageText($LANG12[23], $LANG12[22])
+                .  submissionform('links');
         $retval = COM_createHTMLDocument($retval);
 
         return $retval;
diff -r 58cad0780cfa -r d86b0d64a73e plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Sun Mar 31 09:16:22 2013 -0400
+++ b/plugins/polls/functions.inc	Mon Apr 01 20:27:20 2013 +0900
@@ -248,11 +248,9 @@
             $voters = COM_NumberFormat ($A['voters']);
             $data_arr[] = array ('pid' => $pid, 'voters' => $voters);
         }
-        $retval .= ADMIN_simpleList ('', $header_arr, $text_arr, $data_arr);
+        $retval .= ADMIN_simpleList('', $header_arr, $text_arr, $data_arr);
     } else {
-        $retval .= COM_startBlock ($LANG_POLLS['stats_top10']);
-        $retval .= $LANG_POLLS['stats_none'];
-        $retval .= COM_endBlock ();
+        $retval .= COM_showMessageText($LANG_POLLS['stats_none'], $LANG_POLLS['stats_top10']);
     }
 
     return $retval;
@@ -736,13 +734,12 @@
 
     // This always does an insert so no need to provide key_field and key_value args
     DB_query("INSERT INTO {$_TABLES['pollvoters']} (ipaddress,date,pid) VALUES ('{$_SERVER['REMOTE_ADDR']}'," . time() . ",'$pid')");
-    $retval .= COM_startBlock ($LANG_POLLS['savedvotetitle'], '',
-                       COM_getBlockTemplate ('_msg_block', 'header'))
-        . $LANG_POLLS['savedvotemsg'] . ' "'
-        . DB_getItem ($_TABLES['polltopics'], 'topic', "pid = '{$pid}'")
-        . '"'
-        . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'))
-        . POLLS_pollResults($pid);
+    $retval .= COM_showMessageText(
+                  $LANG_POLLS['savedvotemsg'] . ' "'
+                  . DB_getItem($_TABLES['polltopics'], 'topic', "pid = '{$pid}'") . '"',
+                  $LANG_POLLS['savedvotetitle']
+               )
+            .  POLLS_pollResults($pid);
 
     return $retval;
 }
@@ -1016,14 +1013,12 @@
                 (SEC_hasAccess ($A['owner_id'], $A['group_id'],
                     $A['perm_owner'], $A['perm_group'], $A['perm_members'],
                     $A['perm_anon']) == 3));
-        $retval .= CMT_userComments ($id, $title, 'polls', $order, $format,
-                                     $cid, $page, $view, $delete_option,
-                                     $A['commentcode']);
+        $retval .= CMT_userComments($id, $title, 'polls', $order, $format,
+                                    $cid, $page, $view, $delete_option,
+                                    $A['commentcode']);
     } else {
-        $retval .= COM_startBlock ($LANG_ACCESS['accessdenied'], '',
-                        COM_getBlockTemplate ('_msg_block', 'header'))
-                . $LANG_POLLS['deny_msg']
-                . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $retval .= COM_showMessageText($LANG_POLLS['deny_msg'], $LANG_ACCESS['accessdenied'])
+                .  COM_endBlock(COM_getBlockTemplate ('_msg_block', 'footer'));
     }
 
     return $retval;
diff -r 58cad0780cfa -r d86b0d64a73e plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sun Mar 31 09:16:22 2013 -0400
+++ b/plugins/staticpages/functions.inc	Mon Apr 01 20:27:20 2013 +0900
@@ -179,10 +179,7 @@
                                      $cid, $page, $view, $delete_option,
                                      $A['commentcode']);
     } else {
-        $retval .= COM_startBlock ($LANG_ACCESS['accessdenied'], '',
-                        COM_getBlockTemplate ('_msg_block', 'header'))
-                . $LANG_STATIC['deny_msg']
-                . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $retval .= COM_showMessageText($LANG_STATIC['deny_msg'], $LANG_ACCESS['accessdenied']);
     }
 
     return $retval;
@@ -736,9 +733,7 @@
         }
         $retval .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
     } else {
-        $retval .= COM_startBlock($LANG_STATIC['stats_headline']);
-        $retval .= $LANG_STATIC['stats_no_hits'];
-        $retval .= COM_endBlock();
+        $retval .= COM_showMessageText($LANG_STATIC['stats_no_hits'], $LANG_STATIC['stats_headline']);
     }
 
     return $retval;
diff -r 58cad0780cfa -r d86b0d64a73e plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php	Sun Mar 31 09:16:22 2013 -0400
+++ b/plugins/staticpages/services.inc.php	Mon Apr 01 20:27:20 2013 +0900
@@ -69,10 +69,7 @@
     $output = '';
 
     if (!SEC_hasRights('staticpages.edit')) {
-        $output .= COM_startBlock($LANG_STATIC['access_denied'], '',
-                                  COM_getBlockTemplate('_msg_block', 'header'));
-        $output .= $LANG_STATIC['access_denied_msg'];
-        $output .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
+        $output .= COM_showMessageText($LANG_STATIC['access_denied_msg'], $LANG_STATIC['access_denied']);
         $output = COM_createHTMLDocument($output, array('pagetitle' => $LANG_STATIC['access_denied']));
 
         return PLG_RET_AUTH_FAILED;
@@ -563,10 +560,7 @@
     $sp_id = $args['sp_id'];
 
     if (!SEC_hasRights ('staticpages.delete')) {
-        $output .= COM_startBlock ($LANG_STATIC['access_denied'], '',
-                                    COM_getBlockTemplate ('_msg_block', 'header'));
-        $output .= $LANG_STATIC['access_denied_msg'];
-        $output .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $output .= COM_showMessageText($LANG_STATIC['access_denied_msg'], $LANG_STATIC['access_denied']);
         $output = COM_createHTMLDocument($output, array('pagetitle' => $LANG_STATIC['access_denied']));
         if ($_USER['uid'] > 1) {
             return PLG_RET_PERMISSION_DENIED;
@@ -787,11 +781,7 @@
                         $output = COM_createHTMLDocument($output, array('rightblock' => true));
                     }
                 } else {
-                    $output .= COM_startBlock($LANG_ACCESS['accessdenied'], '',
-                                COM_getBlockTemplate('_msg_block', 'header'));
-                    $output .= $LANG_STATIC['deny_msg'];
-                    $output .= COM_endBlock(COM_getBlockTemplate('_msg_block',
-                                                                 'footer'));
+                    $output .= COM_showMessageText($LANG_STATIC['deny_msg'], $LANG_ACCESS['accessdenied']);
                     if ($mode !== 'autotag') {
                         $output = COM_createHTMLDocument($output, array('rightblock' => true));
                     }
diff -r 58cad0780cfa -r d86b0d64a73e public_html/admin/plugins/calendar/index.php
--- a/public_html/admin/plugins/calendar/index.php	Sun Mar 31 09:16:22 2013 -0400
+++ b/public_html/admin/plugins/calendar/index.php	Mon Apr 01 20:27:20 2013 +0900
@@ -97,10 +97,7 @@
     $retval = '';
 
     if (!empty ($msg)) {
-        $retval .= COM_startBlock ($LANG_CAL_ADMIN[2], '',
-                        COM_getBlockTemplate ('_msg_block', 'header'));
-        $retval .= $msg;
-        $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2]);
     }
 
     $event_templates = COM_newTemplate($_CONF['path'] . 'plugins/calendar/templates/admin');
@@ -114,10 +111,7 @@
         $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
         if ($access == 0 OR $access == 2) {
             // Uh, oh!  User doesn't have access to this object
-            $retval .= COM_startBlock ($LANG_ACCESS['accessdenied'], '',
-                               COM_getBlockTemplate ('_msg_block', 'header'));
-            $retval .= $LANG_CAL_ADMIN[17];
-            $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+            $retval .= COM_showMessageText($LANG_CAL_ADMIN[17], $LANG_ACCESS['accessdenied']);
             COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event $eid.");
             return $retval;
         }
@@ -445,10 +439,7 @@
                              $start_year, $start_month, $start_day);
         $timestart = $start_hour . ':' . $start_minute . ':00';
     } else {
-        $retval .= COM_startBlock ($LANG_CAL_ADMIN[2], '',
-                            COM_getBlockTemplate ('_msg_block', 'header'));
-        $retval .= $LANG_CAL_ADMIN[23];
-        $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $retval .= COM_showMessageText($LANG_CAL_ADMIN[23], $LANG_CAL_ADMIN[2]);
         $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_CAL_ADMIN[2]));
 
         return $retval;
@@ -457,20 +448,14 @@
         $dateend = sprintf('%4d-%02d-%02d', $end_year, $end_month, $end_day);
         $timeend = $end_hour . ':' . $end_minute . ':00';
     } else {
-        $retval .= COM_startBlock ($LANG_CAL_ADMIN[2], '',
-                            COM_getBlockTemplate ('_msg_block', 'header'));
-        $retval .= $LANG_CAL_ADMIN[24];
-        $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $retval .= COM_showMessageText($LANG_CAL_ADMIN[24], $LANG_CAL_ADMIN[2]);
         $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_CAL_ADMIN[2]));
 
         return $retval;
     }
     if ($allday == 0) {
         if ($dateend < $datestart) {
-            $retval .= COM_startBlock ($LANG_CAL_ADMIN[2], '',
-                                COM_getBlockTemplate ('_msg_block', 'header'));
-            $retval .= $LANG_CAL_ADMIN[25];
-            $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+            $retval .= COM_showMessageText($LANG_CAL_ADMIN[25], $LANG_CAL_ADMIN[2]);
             $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_CAL_ADMIN[2]));
 
             return $retval;
@@ -577,10 +562,7 @@
             17
         );
     } else {
-        $retval .= COM_startBlock ($LANG_CAL_ADMIN[2], '',
-                            COM_getBlockTemplate ('_msg_block', 'header'));
-        $retval .= $LANG_CAL_ADMIN[10];
-        $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        $retval .= COM_showMessageText($LANG_CAL_ADMIN[10], $LANG_CAL_ADMIN[2]);
         $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_CAL_ADMIN[2]));
 
         return $retval;
diff -r 58cad0780cfa -r d86b0d64a73e public_html/admin/plugins/links/index.php
--- a/public_html/admin/plugins/links/index.php	Sun Mar 31 09:16:22 2013 -0400
+++ b/public_html/admin/plugins/links/index.php	Mon Apr 01 20:27:20 2013 +0900
@@ -108,19 +108,13 @@
     if ($mode <> 'editsubmission' AND !empty($lid)) {
         $result = DB_query("SELECT * FROM {$_TABLES['links']} WHERE lid ='$lid'");
         if (DB_numRows($result) !== 1) {
-            $msg = COM_startBlock ($LANG_LINKS_ADMIN[24], '',
-                COM_getBlockTemplate ('_msg_block', 'header'));
-            $msg .= $LANG_LINKS_ADMIN[25];
-            $msg .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+            $msg = COM_showMessageText($LANG_LINKS_ADMIN[25], $LANG_LINKS_ADMIN[24]);
             return $msg;
         }
         $A = DB_fetchArray($result);
         $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
         if ($access == 0 OR $access == 2) {
-            $retval .= COM_startBlock($LANG_LINKS_ADMIN[16], '',
-                               COM_getBlockTemplate ('_msg_block', 'header'));
-            $retval .= $LANG_LINKS_ADMIN[17];
-            $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+            $retval .= COM_showMessageText($LANG_LINKS_ADMIN[17], $LANG_LINKS_ADMIN[16]);
             COM_accessLog("User {$_USER['username']} tried to illegally submit or edit link $lid.");
             return $retval;
         }
diff -r 58cad0780cfa -r d86b0d64a73e public_html/admin/plugins/polls/index.php
--- a/public_html/admin/plugins/polls/index.php	Sun Mar 31 09:16:22 2013 -0400
+++ b/public_html/admin/plugins/polls/index.php	Mon Apr 01 20:27:20 2013 +0900
@@ -179,10 +179,7 @@
     // check if any question was entered



More information about the geeklog-cvs mailing list