diff --git a/e107_admin/comment.php b/e107_admin/comment.php index 9bfc06f8e..318883879 100644 --- a/e107_admin/comment.php +++ b/e107_admin/comment.php @@ -86,6 +86,7 @@ class comments_admin_ui extends e_admin_ui // optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName); protected $prefs = array( + 'comments_engine' => array('title'=>"Engine", 'type'=>'dropdown', 'writeParms'=>array()), 'comments_disabled' => array('title'=>PRFLAN_161, 'type'=>'boolean', 'writeParms'=>'inverse=1'), // Same as 'writeParms'=>'reverse=1&enabled=LAN_DISABLED&disabled=LAN_ENABLED' 'anon_post' => array('title'=>PRFLAN_32, 'type'=>'boolean'), 'comments_icon' => array('title'=>PRFLAN_89, 'type'=>'boolean'), @@ -95,6 +96,40 @@ class comments_admin_ui extends e_admin_ui ); + public function init() + { + $engine = e107::pref('core', 'comments_engine'); + + if($engine != 'e107') // Hide all other prefs. + { + $this->prefs = array( + 'comments_engine' => array('title'=>"Engine", 'type'=>'dropdown', 'writeParms'=>array()), + 'comments_disabled' => array('title'=>PRFLAN_161, 'type'=>'boolean', 'writeParms'=>'inverse=1'), + ); + + } + + + + $this->prefs['comments_engine']['writeParms']['optArray'] = array('e107'=>'e107'); + + $addons = e107::getAddonConfig('e_comment'); + foreach($addons as $plugin=>$config) + { + foreach($config as $val) + { + $id = $plugin."::".$val['function']; + $this->prefs['comments_engine']['writeParms']['optArray'][$id] = $val['name']; + } + } + + + + + // print_a($addons); + } + + public function afterUpdate($new_data, $old_data, $id) { if(($new_data['comment_type'] == 0 || $new_data['comment_type'] == 'news' )) diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index 8a19a0efe..988b233bd 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -51,6 +51,8 @@ class comment private $table = null; + private $engine = 'e107'; + function __construct() { @@ -58,7 +60,12 @@ class comment { $this->moderator = true; } - + + $this->engine = e107::pref('core', 'comments_engine', 'e107'); + + + + //TODO - add a pref for comments per page. // $this->commentsPerPage = pref; @@ -133,6 +140,11 @@ class comment function replyComment($id) // Ajax Reply. { + if($this->engine != 'e107') + { + return null; + } + $sql = e107::getDb(); if($sql->db_Select("comments","*","comment_id= ".intval($id)." LIMIT 1")) { @@ -165,20 +177,18 @@ class comment { //rating : boolean, to show rating system in comment - - $pref = e107::getPref(); $sql = e107::getDb(); $tp = e107::getParser(); - - if(vartrue($pref['comments_disabled'])) + + if(vartrue($pref['comments_disabled']) || $this->engine != 'e107') { - return; + return null; } if ($user_func = e107::getOverride()->check($this,'form_comment')) { - return call_user_func($user_func); + return call_user_func($user_func, array('action'=>$action, 'table'=>$table, 'id'=>$id, 'subject'=>$subject, 'content_type'=>$content_type, 'return'=>$return, 'rating'=>$rating, 'tablerender'=>$tablerender, 'pid'=>$pid)); } // require_once(e_HANDLER."ren_help.php"); @@ -361,9 +371,14 @@ class comment function render_comment($row, $table, $action, $id, $width, $subject, $addrating = FALSE) { + if($this->engine != 'e107') + { + return null; + } + if ($user_func = e107::getOverride()->check($this,'render_comment')) { - return call_user_func($user_func); + return call_user_func($user_func, array('row'=>$row, 'table'=>$table, 'action'=>$action, 'id'=>$id, 'width'=>$width, 'subject'=>$subject, 'addrating'=>$addrating)); } //addrating : boolean, to show rating system in rendered comment @@ -546,6 +561,12 @@ class comment function deleteComment($id) // delete a single comment by comment id. { + + if($this->engine != 'e107') + { + return null; + } + if(!getperms('0') && !getperms("B")) { return; @@ -566,6 +587,11 @@ class comment function updateComment($id,$comment) { + if($this->engine != 'e107') + { + return null; + } + $tp = e107::getParser(); $comment = trim($comment); @@ -609,6 +635,11 @@ class comment function enter_comment($data, $comment='', $table='', $id='', $pid='', $subject='', $rateindex = FALSE) { //rateindex : the posted value from the rateselect box (without the urljump) (see function rateselect()) + if($this->engine != 'e107') + { + return; + } + if(is_array($data)) { @@ -638,7 +669,7 @@ class comment if ($user_func = e107::getOverride()->check($this,'enter_comment')) { - return call_user_func($user_func); + return call_user_func($user_func, array('data'=>$data, 'comment'=>$comment, 'table'=>$table, 'id'=>$id, 'pid'=>$pid, 'subject'=>$subject, 'rateindex'=>$rateindex)); } @@ -915,7 +946,8 @@ class comment */ function getCommentPermissions() { - global $pref; + + $pref = e107::pref('core'); if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE) { @@ -951,14 +983,10 @@ class comment */ function compose_comment($table, $action, $id, $width, $subject, $rate = FALSE, $return = FALSE, $tablerender = TRUE) { - - - //compose comment : single call function will render the existing comments and show the form_comment //rate : boolean, to show/hide rating system in comment, default FALSE global $totcc; - - + $tp = e107::getParser(); $ns = e107::getRender(); @@ -966,9 +994,41 @@ class comment if ($this->getCommentPermissions() === FALSE) return; + $params = array('method'=>'compose_comment', 'table'=>$table, 'action'=>$action, 'id'=>$id, 'width'=>$width, 'subject'=>$subject, 'rate'=>$rate, 'return'=>$return, 'tablerender'=>$tablerender); + + if($this->engine != 'e107') + { + list($plugin,$method) = explode("::", $this->engine); + $obj = e107::getAddon($plugin,'e_comment'); + $text = e107::callMethod($obj, $method, $params); + + if(!$return) + { + if ($tablerender) + { + echo $ns->tablerender(null, $text, 'comment', true); + } + else + { + echo $text; + } + } + else + { + $ret['comment'] = $text; + $ret['comment_form'] = ''; + $ret['caption'] = ''; + + return (!$return) ? "" : $ret; + } + + return ''; + } + + if ($user_func = e107::getOverride()->check($this,'compose_comment')) { - return call_user_func($user_func); + return call_user_func($user_func, $params); } // ------------- TODO move the 'listing' into separate function so that ajax can access it easily. @@ -1228,6 +1288,12 @@ class comment function get_e_comment() { + + if($this->engine != 'e107') + { + return null; + } + $data = getcachedvars('e_comment'); if ($data !== FALSE) { @@ -1288,6 +1354,12 @@ class comment function getCommentData($amount = '', $from = '', $qry = '', $cdvalid = FALSE, $cdreta = FALSE) { + + if($this->engine != 'e107') + { + return null; + } + global $pref,$sql,$sql2,$tp; $from1 = ($from ? $from : '0'); $amount1 = ($amount ? $amount : '10'); diff --git a/e107_languages/English/English.php b/e107_languages/English/English.php index 2b3c27f1c..daa1bd06d 100644 --- a/e107_languages/English/English.php +++ b/e107_languages/English/English.php @@ -76,5 +76,8 @@ define("LAN_IP", "IP Address"); define("LAN_AUTHOR", "Author"); define("LAN_CATEGORY", "Category"); define("LAN_GUEST", "Guest"); +define("LAN_NEXT", "Next"); +define("LAN_PREVIOUS", "Previous"); + ?> \ No newline at end of file diff --git a/e107_plugins/download/download_shortcodes.php b/e107_plugins/download/download_shortcodes.php index 2f206d7f8..e6da85d6a 100644 --- a/e107_plugins/download/download_shortcodes.php +++ b/e107_plugins/download/download_shortcodes.php @@ -844,7 +844,7 @@ class download_shortcodes extends e_shortcode $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-left') : '<<'; - return "".$icon." ".LAN_dl_33."\n"; + return "".$icon." ".LAN_PREVIOUS."\n"; // return "<< ".LAN_dl_33." [".$dlrowrow['download_name']."]\n"; } @@ -871,7 +871,7 @@ class download_shortcodes extends e_shortcode $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-right') : '>>'; - return "".LAN_dl_34." ".$icon."\n"; + return "".LAN_NEXT." ".$icon."\n"; // return "[".$dlrowrow['download_name']."] ".LAN_dl_34." >>\n"; }