From f57a35bd04e18d9484b7b0e33c7d5ea68819a876 Mon Sep 17 00:00:00 2001 From: secretr Date: Thu, 8 Oct 2009 10:53:02 +0000 Subject: [PATCH] comment_menu - 0.8 aware --- e107_plugins/comment_menu/comment_menu.php | 65 ++++++++++--------- .../comment_menu/comment_menu_shortcodes.php | 45 +++++++------ .../comment_menu/comment_menu_template.php | 27 ++++---- e107_plugins/comment_menu/config.php | 54 ++++++++------- 4 files changed, 101 insertions(+), 90 deletions(-) diff --git a/e107_plugins/comment_menu/comment_menu.php b/e107_plugins/comment_menu/comment_menu.php index f3a5622b2..b9dd96cbf 100644 --- a/e107_plugins/comment_menu/comment_menu.php +++ b/e107_plugins/comment_menu/comment_menu.php @@ -1,47 +1,54 @@ -getCommentData(intval($menu_pref['comment_display'])); $text = ''; // no posts yet .. -if(empty($data) || !is_array($data)){ +if (empty($data) || !is_array($data)) +{ $text = CM_L1; } -global $row; -foreach($data as $row){ +foreach ($data as $row) +{ + e107::setRegistry('plugin/comment_menu/current', $row); $text .= $tp->parseTemplate($COMMENT_MENU_TEMPLATE, true, $comment_menu_shortcodes); } +e107::setRegistry('plugin/comment_menu/current', null); -$ns->tablerender($menu_pref['comment_caption'], $text, 'comment'); - +e107::getRender()->tablerender($menu_pref['comment_caption'], $text, 'comment_menu'); ?> \ No newline at end of file diff --git a/e107_plugins/comment_menu/comment_menu_shortcodes.php b/e107_plugins/comment_menu/comment_menu_shortcodes.php index 352472b58..0d7b2157e 100644 --- a/e107_plugins/comment_menu/comment_menu_shortcodes.php +++ b/e107_plugins/comment_menu/comment_menu_shortcodes.php @@ -1,25 +1,23 @@ e_sc -> parse_scbatch(__FILE__); - +e107::getRegistry('plugin/comment_menu/current'); /* SC_BEGIN CM_ICON //TODO review bullet @@ -36,38 +34,39 @@ return $bullet; SC_END SC_BEGIN CM_DATESTAMP -global $row; +$row = e107::getRegistry('plugin/comment_menu/current'); $gen = new convert; return $gen->convert_date($row['comment_datestamp'], "short"); SC_END SC_BEGIN CM_HEADING -global $row; +$row = e107::getRegistry('plugin/comment_menu/current'); return $row['comment_title']; SC_END SC_BEGIN CM_URL_PRE -global $row; +$row = e107::getRegistry('plugin/comment_menu/current'); return ($row['comment_url'] ? "" : ""); SC_END SC_BEGIN CM_URL_POST -global $row; +$row = e107::getRegistry('plugin/comment_menu/current'); return ($row['comment_url'] ? "" : ""); SC_END SC_BEGIN CM_TYPE -global $row; +$row = e107::getRegistry('plugin/comment_menu/current'); return $row['comment_type']; SC_END SC_BEGIN CM_AUTHOR -global $row; +$row = e107::getRegistry('plugin/comment_menu/current'); return $row['comment_author']; SC_END SC_BEGIN CM_COMMENT -global $row, $menu_pref, $pref, $tp; +global $menu_pref, $pref, $tp; +$row = e107::getRegistry('plugin/comment_menu/current'); $COMMENT = ''; if($menu_pref['comment_characters']>0) { diff --git a/e107_plugins/comment_menu/comment_menu_template.php b/e107_plugins/comment_menu/comment_menu_template.php index 24258de21..544aa55a0 100644 --- a/e107_plugins/comment_menu/comment_menu_template.php +++ b/e107_plugins/comment_menu/comment_menu_template.php @@ -1,20 +1,17 @@ getPref(); + + $tp = e107::getParser(); while (list($key, $value) = each($_POST)) { if ($value != CM_L9) { - $temp[$key] = $value; + $temp[$tp->toDB($key)] = $tp->toDB($value); } } if (!$_POST['comment_title']) { $temp['comment_title'] = 0; } - if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_04')) - { - $tmp = addslashes(serialize($menu_pref)); - $sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='menu_pref' "); - } - $ns->tablerender("", "
".CM_L10."
"); -} + $menu_config->setPref($temp); + if ($admin_log->logArrayDiffs($old, $menu_config->getPref(), 'MISC_04')) + { + if($menu_config->save(false)) + { + e107::getMessage()->add(CM_L10, E_MESSAGE_SUCCESS); + } + } + else + { + e107::getMessage()->add(LAN_NO_CHANGE); + } +} + +// TODO - 0.8 aware markup, e_form usage $text = "
-
+ @@ -97,6 +104,7 @@ $text .= " />
".CM_L3.": - + get('comment_caption')."\" maxlength=\"100\" />
".CM_L4.": - + get('comment_display')."\" maxlength=\"2\" />
".CM_L5.": - + get('comment_characters')."\" maxlength=\"4\" />
".CM_L6.": - + get('comment_postfix')."\" maxlength=\"200\" />
".CM_L7.": - get('comment_title') ? ' checked="checked"' : '')." />
"; -$ns->tablerender(CM_L8, $text); + +e107::getRender()->tablerender(CM_L8, e107::getMessage()->render().$text); require_once(e_ADMIN."footer.php"); ?> \ No newline at end of file