1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

comment_menu - 0.8 aware

This commit is contained in:
secretr
2009-10-08 10:53:02 +00:00
parent 885a966161
commit f57a35bd04
4 changed files with 101 additions and 90 deletions

View File

@@ -1,47 +1,54 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Comment menu
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu.php,v $
| * $Revision: 1.2 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu.php,v $ * $Date: 2009-10-08 10:53:02 $
| $Revision: 1.1.1.1 $ * $Author: secretr $
| $Date: 2006-12-02 04:34:52 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT'))
{
exit;
}
require_once(e_PLUGIN."comment_menu/comment_menu_shortcodes.php"); require_once (e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
require_once(e_HANDLER."comment_class.php");
$cobj = new comment;
if (file_exists(THEME."comment_menu_template.php")){ $cobj = e107::getObject('comment');
require_once(THEME."comment_menu_template.php"); //require_once (e_HANDLER."comment_class.php");
}else{ //$cobj = new comment;
require_once(e_PLUGIN."comment_menu/comment_menu_template.php");
if (file_exists(THEME."comment_menu_template.php"))
{
require_once (THEME."comment_menu_template.php");
}
else
{
require_once (e_PLUGIN."comment_menu/comment_menu_template.php");
} }
$data = $cobj->getCommentData(intval($menu_pref['comment_display'])); $data = $cobj->getCommentData(intval($menu_pref['comment_display']));
$text = ''; $text = '';
// no posts yet .. // no posts yet ..
if(empty($data) || !is_array($data)){ if (empty($data) || !is_array($data))
{
$text = CM_L1; $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); $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');
?> ?>

View File

@@ -1,25 +1,23 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Comment menu shortcodes
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_shortcodes.php,v $
| * $Revision: 1.5 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_shortcodes.php,v $ * $Date: 2009-10-08 10:53:02 $
| $Revision: 1.4 $ * $Author: secretr $
| $Date: 2009-08-23 10:57:51 $
| $Author: marj_nl_fr $
+----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
global $tp; global $tp;
$comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__); $comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
e107::getRegistry('plugin/comment_menu/current');
/* /*
SC_BEGIN CM_ICON SC_BEGIN CM_ICON
//TODO review bullet //TODO review bullet
@@ -36,38 +34,39 @@ return $bullet;
SC_END SC_END
SC_BEGIN CM_DATESTAMP SC_BEGIN CM_DATESTAMP
global $row; $row = e107::getRegistry('plugin/comment_menu/current');
$gen = new convert; $gen = new convert;
return $gen->convert_date($row['comment_datestamp'], "short"); return $gen->convert_date($row['comment_datestamp'], "short");
SC_END SC_END
SC_BEGIN CM_HEADING SC_BEGIN CM_HEADING
global $row; $row = e107::getRegistry('plugin/comment_menu/current');
return $row['comment_title']; return $row['comment_title'];
SC_END SC_END
SC_BEGIN CM_URL_PRE SC_BEGIN CM_URL_PRE
global $row; $row = e107::getRegistry('plugin/comment_menu/current');
return ($row['comment_url'] ? "<a href='".$row['comment_url']."'>" : ""); return ($row['comment_url'] ? "<a href='".$row['comment_url']."'>" : "");
SC_END SC_END
SC_BEGIN CM_URL_POST SC_BEGIN CM_URL_POST
global $row; $row = e107::getRegistry('plugin/comment_menu/current');
return ($row['comment_url'] ? "</a>" : ""); return ($row['comment_url'] ? "</a>" : "");
SC_END SC_END
SC_BEGIN CM_TYPE SC_BEGIN CM_TYPE
global $row; $row = e107::getRegistry('plugin/comment_menu/current');
return $row['comment_type']; return $row['comment_type'];
SC_END SC_END
SC_BEGIN CM_AUTHOR SC_BEGIN CM_AUTHOR
global $row; $row = e107::getRegistry('plugin/comment_menu/current');
return $row['comment_author']; return $row['comment_author'];
SC_END SC_END
SC_BEGIN CM_COMMENT SC_BEGIN CM_COMMENT
global $row, $menu_pref, $pref, $tp; global $menu_pref, $pref, $tp;
$row = e107::getRegistry('plugin/comment_menu/current');
$COMMENT = ''; $COMMENT = '';
if($menu_pref['comment_characters']>0) if($menu_pref['comment_characters']>0)
{ {

View File

@@ -1,20 +1,17 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Comment menu default template
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_template.php,v $
| * $Revision: 1.2 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_template.php,v $ * $Date: 2009-10-08 10:53:02 $
| $Revision: 1.1.1.1 $ * $Author: secretr $
| $Date: 2006-12-02 04:34:52 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/ */
$sc_style['CM_TYPE']['pre'] = "["; $sc_style['CM_TYPE']['pre'] = "[";

View File

@@ -9,9 +9,9 @@
* Plugin Administration - Comment menu * Plugin Administration - Comment menu
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/config.php,v $
* $Revision: 1.2 $ * $Revision: 1.3 $
* $Date: 2008-12-21 12:53:48 $ * $Date: 2009-10-08 10:53:02 $
* $Author: e107steved $ * $Author: secretr $
* *
*/ */
$eplug_admin = TRUE; $eplug_admin = TRUE;
@@ -26,68 +26,75 @@ if (!getperms("1"))
} }
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN."auth.php");
$menu_config = e107::getConfig('menu');
if (isset($_POST['update_menu'])) if (isset($_POST['update_menu']))
{ {
$temp = array(); $temp = $old = $menu_config->getPref();
$tp = e107::getParser();
while (list($key, $value) = each($_POST)) while (list($key, $value) = each($_POST))
{ {
if ($value != CM_L9) if ($value != CM_L9)
{ {
$temp[$key] = $value; $temp[$tp->toDB($key)] = $tp->toDB($value);
} }
} }
if (!$_POST['comment_title']) if (!$_POST['comment_title'])
{ {
$temp['comment_title'] = 0; $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("", "<div style=\"text-align:center\"><b>".CM_L10."</b></div>");
}
$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 = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<form method=\"post\" action=\"".e_SELF."?".e_QUERY."\" name=\"menu_conf_form\"> <form method=\"post\" action=\"".e_SELF."?".e_QUERY."\" id=\"plugin-menu-config-form\">
<table style=\"width:85%\" class=\"fborder\" > <table style=\"width:85%\" class=\"fborder\" >
<tr> <tr>
<td style=\"width:40%\" class='forumheader3'>".CM_L3.": </td> <td style=\"width:40%\" class='forumheader3'>".CM_L3.": </td>
<td style=\"width:60%\" class='forumheader3'> <td style=\"width:60%\" class='forumheader3'>
<input class=\"tbox\" type=\"text\" name=\"comment_caption\" size=\"20\" value=\"".$menu_pref['comment_caption']."\" maxlength=\"100\" /> <input class=\"tbox\" type=\"text\" name=\"comment_caption\" size=\"20\" value=\"".$menu_config->get('comment_caption')."\" maxlength=\"100\" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style=\"width:40%\" class='forumheader3'>".CM_L4.": </td> <td style=\"width:40%\" class='forumheader3'>".CM_L4.": </td>
<td style=\"width:60%\" class='forumheader3'> <td style=\"width:60%\" class='forumheader3'>
<input class=\"tbox\" type=\"text\" name=\"comment_display\" size=\"20\" value=\"".$menu_pref['comment_display']."\" maxlength=\"2\" /> <input class=\"tbox\" type=\"text\" name=\"comment_display\" size=\"20\" value=\"".$menu_config->get('comment_display')."\" maxlength=\"2\" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style=\"width:40%\" class='forumheader3'>".CM_L5.": </td> <td style=\"width:40%\" class='forumheader3'>".CM_L5.": </td>
<td style=\"width:60%\" class='forumheader3'> <td style=\"width:60%\" class='forumheader3'>
<input class=\"tbox\" type=\"text\" name=\"comment_characters\" size=\"20\" value=\"".$menu_pref['comment_characters']."\" maxlength=\"4\" /> <input class=\"tbox\" type=\"text\" name=\"comment_characters\" size=\"20\" value=\"".$menu_config->get('comment_characters')."\" maxlength=\"4\" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style=\"width:40%\" class='forumheader3'>".CM_L6.": </td> <td style=\"width:40%\" class='forumheader3'>".CM_L6.": </td>
<td style=\"width:60%\" class='forumheader3'> <td style=\"width:60%\" class='forumheader3'>
<input class=\"tbox\" type=\"text\" name=\"comment_postfix\" size=\"30\" value=\"".$menu_pref['comment_postfix']."\" maxlength=\"200\" /> <input class=\"tbox\" type=\"text\" name=\"comment_postfix\" size=\"30\" value=\"".$menu_config->get('comment_postfix')."\" maxlength=\"200\" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style=\"width:40%\" class='forumheader3'>".CM_L7.": </td> <td style=\"width:40%\" class='forumheader3'>".CM_L7.": </td>
<td style=\"width:60%\" class='forumheader3'> <td style=\"width:60%\" class='forumheader3'>
<input type=\"checkbox\" name=\"comment_title\" value=\"1\""; <input type=\"checkbox\" name=\"comment_title\" value=\"1\"".($menu_config->get('comment_title') ? ' checked="checked"' : '')." />
if ($menu_pref['comment_title']) {
$text .= " checked ";
}
$text .= " />
</td> </td>
</tr> </tr>
@@ -97,6 +104,7 @@ $text .= " />
</table> </table>
</form> </form>
</div>"; </div>";
$ns->tablerender(CM_L8, $text);
e107::getRender()->tablerender(CM_L8, e107::getMessage()->render().$text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
?> ?>