[geeklog-cvs] geeklog: Made the meta tag handling somewhat more consistent

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Oct 3 15:18:36 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/82e167a0e3a4
changeset: 7354:82e167a0e3a4
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Oct 03 21:15:34 2009 +0200
description:
Made the meta tag handling somewhat more consistent

diffstat:

 plugins/staticpages/functions.inc               |   4 ++--
 plugins/staticpages/services.inc.php            |  11 +++++++----
 public_html/admin/plugins/polls/index.php       |  19 +++++++++----------
 public_html/admin/plugins/staticpages/index.php |  13 +++++++------
 public_html/admin/topic.php                     |  31 ++++++++++++++-----------------
 5 files changed, 39 insertions(+), 39 deletions(-)

diffs (179 lines):

diff -r 566b2b4b5535 -r 82e167a0e3a4 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sat Oct 03 20:40:08 2009 +0200
+++ b/plugins/staticpages/functions.inc	Sat Oct 03 21:15:34 2009 +0200
@@ -276,8 +276,8 @@
 
     // Meta Tags
     If ($_SP_CONF['meta_tags'] > 0) {
-        $meta_description  = stripslashes ($A['meta_description']);
-        $meta_keywords  = stripslashes ($A['meta_keywords']);
+        $meta_description  = $A['meta_description'];
+        $meta_keywords  = $A['meta_keywords'];
         $headercode .= COM_createMetaTags($meta_description, $meta_keywords);
     }
 
diff -r 566b2b4b5535 -r 82e167a0e3a4 plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php	Sat Oct 03 20:40:08 2009 +0200
+++ b/plugins/staticpages/services.inc.php	Sat Oct 03 21:15:34 2009 +0200
@@ -563,15 +563,18 @@
         }
         $sql = array();
         $sql['mysql'] = "SELECT sp_title,sp_content,sp_hits,sp_date,sp_format,"
-                      . "commentcode,meta_description,meta_keywords,owner_id,group_id,perm_owner,perm_group,"
+                      . "commentcode,meta_description,meta_keywords,owner_id,"
+                      . "group_id,perm_owner,perm_group,"
                       . "perm_members,perm_anon,sp_tid,sp_help,sp_php,"
                       . "sp_inblock FROM {$_TABLES['staticpage']} "
                       . "WHERE (sp_id = '$page')" . $perms;
         $sql['mssql'] = "SELECT sp_title,"
                       . "CAST(sp_content AS text) AS sp_content,sp_hits,"
-                      . "sp_date,sp_format,commentcode,owner_id,group_id,"
-                      . "perm_owner,perm_group,perm_members,perm_anon,sp_tid,"
-                      . "sp_help,sp_php,sp_inblock "
+                      . "sp_date,sp_format,commentcode,"
+                      . "CAST(meta_description AS text) AS meta_description,"
+                      . "CAST(meta_keywords AS text) AS meta_keywords,"
+                      . "owner_id,group_id,perm_owner,perm_group,perm_members,"
+                      . "perm_anon,sp_tid,sp_help,sp_php,sp_inblock "
                       . "FROM {$_TABLES['staticpage']} WHERE (sp_id = '$page')"
                       . $perms;
         $result = DB_query ($sql);
diff -r 566b2b4b5535 -r 82e167a0e3a4 public_html/admin/plugins/polls/index.php
--- a/public_html/admin/plugins/polls/index.php	Sat Oct 03 20:40:08 2009 +0200
+++ b/public_html/admin/plugins/polls/index.php	Sat Oct 03 21:15:34 2009 +0200
@@ -164,8 +164,8 @@
     list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
 
     $topic = COM_stripslashes($topic);
-    $meta_description = COM_stripslashes($meta_description);
-    $meta_keywords = COM_stripslashes($meta_keywords);
+    $meta_description = strip_tags(COM_stripslashes($meta_description));
+    $meta_keywords = strip_tags(COM_stripslashes($meta_keywords));
     $pid = COM_sanitizeID($pid);
     $old_pid = COM_sanitizeID($old_pid);
     if (empty($pid)) {
@@ -249,9 +249,9 @@
     DB_delete($_TABLES['pollanswers'], 'pid', $del_pid);
     DB_delete($_TABLES['pollquestions'], 'pid', $del_pid);
 
-    $topic = addslashes ($topic);
-    $meta_description = addslashes ($meta_description);
-    $meta_keywords = addslashes ($meta_keywords);
+    $topic = addslashes($topic);
+    $meta_description = addslashes($meta_description);
+    $meta_keywords = addslashes($meta_keywords);
 
     $k = 0; // set up a counter to make sure we do assign a straight line of question id's
     $v = 0; // re-count votes sine they might have been changed
@@ -305,9 +305,7 @@
     $sql .= ",'$statuscode','$commentcode',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon";
 
     // Save poll topic
-    DB_save($_TABLES['polltopics'],"pid, topic, meta_description, meta_keywords, voters, questions, date, display, "
-           . "is_open, hideresults, statuscode, commentcode, owner_id, group_id, "
-           . "perm_owner, perm_group, perm_members, perm_anon",$sql);
+    DB_save($_TABLES['polltopics'], "pid, topic, meta_description, meta_keywords, voters, questions, date, display, is_open, hideresults, statuscode, commentcode, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon", $sql);
 
     if (empty($old_pid) || ($old_pid == $pid)) {
         PLG_itemSaved($pid, 'polls');
@@ -618,8 +616,9 @@
             $hideresults = COM_applyFilter ($_POST['hideresults']);
         }
         $display .= savepoll ($pid, $old_pid, $_POST['question'], $mainpage,
-                        $_POST['topic'], $_POST['meta_description'], $_POST['meta_keywords'], 
-                        $statuscode, $open, $hideresults,
+                        $_POST['topic'], $_POST['meta_description'],
+                        $_POST['meta_keywords'], $statuscode, $open,
+                        $hideresults,
                         COM_applyFilter ($_POST['commentcode'], true),
                         $_POST['answer'], $_POST['votes'], $_POST['remark'],
                         COM_applyFilter ($_POST['owner_id'], true),
diff -r 566b2b4b5535 -r 82e167a0e3a4 public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php	Sat Oct 03 20:40:08 2009 +0200
+++ b/public_html/admin/plugins/staticpages/index.php	Sat Oct 03 21:15:34 2009 +0200
@@ -551,12 +551,13 @@
 * @param sp_inblock      string  Flag: wrap page in a block (or not)
 *
 */
-function submitstaticpage ($sp_id, $sp_uid, $sp_title, $sp_content, $sp_hits,
-                           $sp_format, $sp_onmenu, $sp_label, $commentcode,
-                           $owner_id, $group_id, $perm_owner, $perm_group,
-                           $perm_members, $perm_anon, $sp_php, $sp_nf,
-                           $sp_old_id, $sp_centerblock, $sp_help, $sp_tid,
-                           $sp_where, $sp_inblock, $postmode, $meta_description, $meta_keywords)
+function submitstaticpage($sp_id, $sp_uid, $sp_title, $sp_content, $sp_hits,
+                          $sp_format, $sp_onmenu, $sp_label, $commentcode,
+                          $owner_id, $group_id, $perm_owner, $perm_group,
+                          $perm_members, $perm_anon, $sp_php, $sp_nf,
+                          $sp_old_id, $sp_centerblock, $sp_help, $sp_tid,
+                          $sp_where, $sp_inblock, $postmode, $meta_description,
+                          $meta_keywords)
 {
     global $_CONF, $_TABLES, $LANG12, $LANG_STATIC, $_SP_CONF;
 
diff -r 566b2b4b5535 -r 82e167a0e3a4 public_html/admin/topic.php
--- a/public_html/admin/topic.php	Sat Oct 03 20:40:08 2009 +0200
+++ b/public_html/admin/topic.php	Sat Oct 03 21:15:34 2009 +0200
@@ -178,16 +178,12 @@
                               $LANG_ADMIN['meta_description']);
     $topic_templates->set_var('lang_metakeywords',
                               $LANG_ADMIN['meta_keywords']);
-    $desc = '';
     if (! empty($A['meta_description'])) {
-        $desc = $A['meta_description'];
+        $topic_templates->set_var('meta_description', $A['meta_description']);
     }
-    $keywords = '';
     if (! empty($A['meta_keywords'])) {
-        $keywords = $A['meta_keywords'];
+        $topic_templates->set_var('meta_keywords', $A['meta_keywords']);
     }
-    $topic_templates->set_var('meta_description', $desc);
-    $topic_templates->set_var('meta_keywords', $keywords);
 
     $topic_templates->set_var ('lang_defaulttopic', $LANG27[22]);
     $topic_templates->set_var ('lang_defaulttext', $LANG27[23]);
@@ -249,7 +245,7 @@
 * @param    string  $is_archive     'on' if this is the archive topic
 * @return   string                  HTML redirect or error message
 */
-function savetopic($tid,$topic,$imageurl,$meta_description, $meta_keywords,$sortnum,$limitnews,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_default,$is_archive)
+function savetopic($tid,$topic,$imageurl,$meta_description,$meta_keywords,$sortnum,$limitnews,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_default,$is_archive)
 {
     global $_CONF, $_TABLES, $LANG27, $MESSAGE;
 
@@ -258,7 +254,7 @@
     // Convert array values to numeric permission values
     list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
 
-    $tid = COM_sanitizeID ($tid);
+    $tid = COM_sanitizeID($tid);
 
     $access = 0;
     if (DB_count ($_TABLES['topics'], 'tid', $tid) > 0) {
@@ -608,15 +604,16 @@
     if (isset($_POST['is_archive'])) {
         $is_archive = $_POST['is_archive'];
     }
-    $display .= savetopic (COM_applyFilter ($_POST['tid']), $_POST['topic'],
-                           $imageurl, $_POST['meta_description'], $_POST['meta_keywords'],
-                           COM_applyFilter ($_POST['sortnum'], true),
-                           COM_applyFilter ($_POST['limitnews'], true),
-                           COM_applyFilter ($_POST['owner_id'], true),
-                           COM_applyFilter ($_POST['group_id'], true),
-                           $_POST['perm_owner'], $_POST['perm_group'],
-                           $_POST['perm_members'], $_POST['perm_anon'],
-                           $is_default, $is_archive);
+    $display .= savetopic(COM_applyFilter($_POST['tid']), $_POST['topic'],
+                          $imageurl, $_POST['meta_description'],
+                          $_POST['meta_keywords'],
+                          COM_applyFilter($_POST['sortnum'], true),
+                          COM_applyFilter($_POST['limitnews'], true),
+                          COM_applyFilter($_POST['owner_id'], true),
+                          COM_applyFilter($_POST['group_id'], true),
+                          $_POST['perm_owner'], $_POST['perm_group'],
+                          $_POST['perm_members'], $_POST['perm_anon'],
+                          $is_default, $is_archive);
 } else if ($mode == 'edit') {
     $display .= COM_siteHeader('menu', $LANG27[1]);
     $tid = '';



More information about the geeklog-cvs mailing list