/** * Tests an immediate end after a verbatim. */ public function testVerbatimThenEof() { $parser = new JBBCode\Parser(); $parser->addBBCode('verbatim', '{param}', false, false); $parser->parse('[verbatim]'); $this->assertEquals('', $parser->getAsHtml()); }
/** * Test over nesting. */ public function testOverNesting() { $parser = new JBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->addBBCode('quote', '<blockquote>{param}</blockquote>', false, true, 2); $bbcode = '[quote][quote][quote]wut[/quote] huh?[/quote] i don\'t know[/quote]'; $parser->parse($bbcode); $expectedBbcode = '[quote][quote] huh?[/quote] i don\'t know[/quote]'; $expectedHtml = '<blockquote><blockquote> huh?</blockquote> i don\'t know</blockquote>'; $this->assertEquals($expectedBbcode, $parser->getAsBBCode()); $this->assertEquals($expectedHtml, $parser->getAsHtml()); }
echo $lang['mod/delete']; ?> </td> </tr> </thead> <tbody> <?php require_once "libs/jbbcode/Parser.php"; $parser = new \JBBCode\Parser(); $bbcode = $conn->query("SELECT * FROM bbcodes;"); while ($row = $bbcode->fetch_assoc()) { $parser->addBBCode($row['name'], $row['code']); } $qID = $conn->real_escape_string($_GET['id']); $qBoard = $conn->real_escape_string($_GET['board']); $getPass = $conn->query("SELECT password FROM posts WHERE board='" . $qBoard . "' AND id='" . $qID . "' "); $rPass = $getPass->fetch_row(); $posts = $conn->query("SELECT * FROM posts WHERE password='******'"); while ($row = $posts->fetch_assoc()) { echo "<tr><td class='text-center text-nowrap'>"; if ($row['resto'] == 0) { echo "<a href='./" . $row['board'] . "/res/" . $row['id'] . ".html'>/" . $row['board'] . "/" . $row['id'] . ".html</a>"; } else { echo "<a href='./" . $row['board'] . "/res/" . $row['resto'] . ".html#p" . $row['id'] . "'>/" . $row['board'] . "/" . $row['resto'] . ".html#p" . $row['id'] . "</a>"; } echo "</td><td class='text-center'>"; $trip = "";
public function comment() { $ver = VERSION; if (!defined('SCP_VERSION')) { define('SCP_VERSION', $ver[0]); } $this->config->set("blog_work", true); if (SCP_VERSION > 1) { $this->load->controller('common/seoblog'); } else { $this->getChild('common/seoblog'); } if (isset($this->request->get['prefix'])) { $this->data['prefix'] = $this->request->get['prefix']; } else { if ($this->registry->get("prefix") != '') { $this->data['prefix'] = $this->registry->get("prefix"); } else { $this->data['prefix'] = ''; } } $this->load->model('setting/setting'); if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) { $settings_admin = $this->model_setting_setting->getSetting('ascp_admin', 'ascp_admin_https_admin_path'); } else { $settings_admin = $this->model_setting_setting->getSetting('ascp_admin', 'ascp_admin_http_admin_path'); } foreach ($settings_admin as $key => $value) { $this->data['admin_path'] = $value; } /* ?????????????????????????????????????? $this->load->model('setting/setting'); if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) { $settings_admin = $this->model_setting_setting->getSetting('ascp_admin', 'ascp_admin_https_admin_path'); } else { $settings_admin = $this->model_setting_setting->getSetting('ascp_admin', 'ascp_admin_http_admin_path'); } foreach ($settings_admin as $key => $value) { $this->data['admin_path'] = $value; } */ /* if (!class_exists('User')) { require_once(DIR_SYSTEM . 'library/user.php'); $this->registry->set('user', new User($this->registry)); } */ $this->load->library('user'); $this->user = new User($this->registry); if ($this->user->isLogged()) { $this->data['userLogged'] = true; } else { $this->data['userLogged'] = false; } if (isset($this->request->get['ascp_widgets_position'])) { $this->data['cmswidget'] = $this->request->get['cmswidget'] = (int) $this->request->get['ascp_widgets_position']; } if (isset($this->request->post['thislist']) || isset($this->request->get['thislist'])) { if (isset($this->request->get['thislist'])) { $str = base64_decode($this->request->get['thislist']); } else { $str = base64_decode($this->request->post['thislist']); } //$this->data['cmswidget'] = unserialize($str); } else { $numargs = func_num_args(); if ($numargs >= 1) { $this->data['cmswidget'] = func_get_arg(0); } else { $this->data['cmswidget'] = false; } } $this->data['http_image'] = getHttpImage($this); $this->data['config_language_id'] = $this->config->get('config_language_id'); $this->data['ascp_widgets'] = $this->config->get('ascp_widgets'); $this->data['thislist'] = $this->data['ascp_widgets'][$this->data['cmswidget']]; $this->language->load('product/product'); $this->language->load('record/blog'); $this->language->load('record/record'); if (isset($this->data['thislist']['langfile']) && $this->data['thislist']['langfile'] != '') { $this->language->load($this->data['thislist']['langfile']); } if (isset($this->request->get['product_id']) || isset($this->request->get['record_id']) || isset($this->data['thislist']['recordid'])) { $comments_settings = array(); $record_info = array(); $record_info['comment'] = array(); $this->data['mark'] = false; if (isset($this->request->get['product_id'])) { $this->data['mark'] = 'product_id'; $this->data['product_id'] = $this->request->get['product_id']; $mark_route = 'product/product'; } if (isset($this->request->get['record_id'])) { $this->data['mark'] = 'record_id'; $this->data['product_id'] = $this->request->get['record_id']; $mark_route = 'record/record'; } if (isset($this->data['thislist']['recordid']) && $this->data['thislist']['recordid'] != '') { $this->data['mark'] = 'record_id'; $this->data['product_id'] = $this->data['thislist']['recordid']; $mark_route = 'record/record'; $this->load->model('catalog/record'); $this->data['record'] = $this->data['mark_info'] = $this->model_catalog_record->getRecord($this->data['product_id']); } else { $this->data['record'] = ''; } $this->data['url'] = $this->url->link($mark_route, $this->data['mark'] . '=' . $this->data['product_id']); $this->data['mark_id'] = $this->data['product_id']; $this->data['entry_sorting'] = $this->language->get('entry_sorting'); $this->data['text_sorting_desc'] = $this->language->get('text_sorting_desc'); $this->data['text_sorting_asc'] = $this->language->get('text_sorting_asc'); $this->data['text_rollup'] = $this->language->get('text_rollup'); $this->data['text_rollup_down'] = $this->language->get('text_rollup_down'); $this->data['text_no_comments'] = $this->language->get('text_no_comments'); $this->data['text_reply_button'] = $this->language->get('text_reply_button'); $this->data['text_signer_answer'] = $this->language->get('text_signer_answer'); $this->data['text_signer_answer_email'] = $this->language->get('text_signer_answer_email'); /* todo $this->data['text_edit_button'] = $this->language->get('text_edit_button'); $this->data['text_delete_button'] = $this->language->get('text_delete_button'); */ if ($this->customer->isLogged()) { $this->data['text_login'] = $this->customer->getFirstName() . " " . $this->customer->getLastName(); $this->data['captcha_status'] = false; $this->data['customer_id'] = $this->customer->getId(); } else { $this->data['text_login'] = $this->language->get('text_anonymus'); $this->data['captcha_status'] = true; $this->data['customer_id'] = false; } $this->load->model('catalog/treecomments'); $this->load->model('catalog/product'); $this->load->model('catalog/record'); $this->load->model('catalog/blog'); if ($this->data['mark'] == 'product_id') { $mark_path = $this->model_catalog_treecomments->getPathByProduct($this->data['mark_id']); $mark_info = $this->model_catalog_product->getProduct($this->data['mark_id']); } if ($this->data['mark'] == 'record_id') { $mark_path = $this->model_catalog_blog->getPathByRecord($this->data['mark_id']); $record_info = $mark_info = $this->model_catalog_record->getRecord($this->data['mark_id']); } $category_path = $mark_path['path']; if (isset($category_path)) { $array_path = explode('_', $category_path); $category_id = end($array_path); } if (!isset($category_id)) { $category_id = 0; } $category_info = $this->model_catalog_treecomments->getCategory($category_id, $this->data['mark']); if ($this->config->get('ascp_settings') != '') { $this->data['settings_general'] = $this->config->get('ascp_settings'); } else { $this->data['settings_general'] = array(); } if (isset($category_info['design']) && $category_info['design'] != '') { $this->data['category_design'] = unserialize($category_info['design']); } else { $this->data['category_design'] = array(); } if (!isset($this->data['settings_general']['colorbox_theme'])) { $this->data['settings_general']['colorbox_theme'] = 0; } $get = $this->request->get; if (isset($this->data['settings_general']['get_pagination'])) { $get_pagination = $this->data['settings_general']['get_pagination']; } else { $get_pagination = 'tracking'; } if (isset($get['ascp_widgets_position'])) { $this->data['ascp_widgets_position'] = $get['ascp_widgets_position']; } else { $this->data['ascp_widgets_position'] = $this->registry->get('ascp_widgets_position'); } $cmswidget = $this->data['ascp_widgets_position']; $cmswidget_flag = false; if (isset($get[$get_pagination])) { $tracking = $get[$get_pagination]; } else { $tracking = ''; } if ($tracking != '') { $parts = explode('_', trim(utf8_strtolower($tracking))); foreach ($parts as $num => $val) { $aval = explode("-", $val); if (isset($aval[0]) && $aval[0] == 'cmswidget') { if (isset($aval[1]) && $aval[1] == $cmswidget) { $cmswidget_flag = true; } } } if ($cmswidget_flag) { foreach ($parts as $num => $val) { $aval = explode("-", $val); if (isset($aval[0])) { $getquery = $aval[0]; if (isset($aval[1])) { $getpar = $aval[1]; $get[$getquery] = $getpar; } } } } } if (isset($get['wpage']) && isset($get['cmswidget']) && $get['cmswidget'] == $cmswidget) { $page = $get['wpage']; } else { $page = 1; } if (isset($get['ajax']) && $get['ajax'] == '1' && isset($get['page'])) { $page = $get['wpage'] = $get['page']; } $this->data['wpage'] = $this->data['page'] = $page; if (isset($record_info['comment']) && !empty($record_info['comment'])) { $comments_settings_record = unserialize($record_info['comment']); } else { $comments_settings_record = array(); } $comments_settings = $comments_settings_record + $this->data['thislist']; $this->data['sorting'] = 'desc'; $comments_order = 'comment_id'; if (isset($comments_settings['order_ad']) && $comments_settings['order_ad'] != '') { $this->data['sorting'] = strtolower($comments_settings['order_ad']); } if (isset($comments_settings['order']) && $comments_settings['order'] != '') { $this->data['order'] = strtolower($comments_settings['order']); } if (isset($this->data['order']) && $this->data['order'] == 'sort') { $comments_order = 'comment_id'; } if (isset($this->data['order']) && $this->data['order'] == 'date') { $comments_order = 'date_available'; } if (isset($this->data['order']) && $this->data['order'] == 'rating') { $comments_order = 'rating'; } if (isset($this->data['order']) && $this->data['order'] == 'rate') { $comments_order = 'delta'; } if (isset($get['sorting'])) { if ($get['sorting'] == 'none') { $this->data['sorting'] = $this->data['sorting']; } else { $this->data['sorting'] = $get['sorting']; } } if (isset($this->data['thislist']['view_captcha']) && $this->data['thislist']['view_captcha'] == 0) { $this->data['captcha_status'] = false; } if (isset($this->data['thislist']['visual_editor']) && isset($this->data['thislist']['comment_must']) && $this->data['thislist']['comment_must'] && $this->data['thislist']['visual_editor'] || !isset($this->data['thislist']['visual_editor'])) { $this->data['visual_editor'] = true; $this->document->addScript('catalog/view/javascript/wysibb/jquery.wysibb.min.js'); $this->document->addStyle('catalog/view/javascript/wysibb/theme/default/wbbtheme.css'); $this->document->addScript('catalog/view/javascript/blog/blog.bbimage.js'); $this->document->addScript('catalog/view/javascript/blog/rating/jquery.rating.js'); $this->document->addStyle('catalog/view/javascript/blog/rating/jquery.rating.css'); } else { $this->data['visual_editor'] = false; } $thislist = $this->data['thislist']; $this->data['record_comment'] = $thislist; if (isset($thislist['order_ad']) && $thislist['order_ad'] != '') { $this->data['sorting'] = strtolower($thislist['order_ad']); } if (isset($get['sorting'])) { if ($get['sorting'] == 'none') { $this->data['sorting'] = $this->data['sorting']; } else { $this->data['sorting'] = $get['sorting']; } } $this->data['comments'] = array(); if (isset($thislist['status_language'])) { if ($thislist['status_language']) { $this->registry->set("status_language", true); } else { $this->registry->set("status_language", false); } } else { $this->registry->set("status_language", true); } $this->data['comment_total'] = $comment_total = $this->model_catalog_treecomments->getTotalCommentsByMarkId($this->data['mark_id'], $this->data['mark'], $this->data['thislist']); if (isset($thislist['number_comments'])) { $this->data['number_comments'] = $thislist['number_comments']; } else { $this->data['number_comments'] = ''; } if ($this->data['number_comments'] == '') { $this->data['number_comments'] = 10; } if (isset($_COOKIE["karma_" . $this->data['mark']])) { $karma_cookie = unserialize(base64_decode($_COOKIE["karma_" . $this->data['mark']])); } else { $karma_cookie = array(); } $mark = $this->data['mark']; if (!isset($this->data['settings_general']['complete_status'])) { $this->data['settings_general']['complete_status'] = false; } $data = array('status' => $this->data['settings_general']['complete_status'], $mark => $this->data['mark_id'], 'start' => ($page - 1) * $this->data['number_comments'], 'limit' => $this->data['number_comments']); /***********************************************************************************************************/ $results = $this->model_catalog_treecomments->getCommentsByMarkId($data, $mark, $this->data['thislist']); if (isset($this->data['thislist']['admin_name']) && $this->data['thislist']['admin_name'] != '') { $this->data['admin_name'] = array_flip(explode(";", trim($this->data['thislist']['admin_name']))); } else { $this->data['admin_name'] = array(); } if ($this->customer->isLogged()) { $customer_id = $this->customer->getId(); } else { $customer_id = false; } $this->data[$this->data['mark']] = $this->data['mark_id']; $results_rates = $this->model_catalog_treecomments->getRatesByMarkId($this->data['mark_id'], $customer_id, $this->data['mark']); if (!$customer_id == -1) { $customer_id = false; } if (count($results) > 0) { $resa = NULL; foreach ($results as $num => $res1) { $resa[$num] = $res1; if (isset($results_rates[$res1['review_id']])) { $resa[$num]['delta'] = $results_rates[$res1['review_id']]['rate_delta']; $resa[$num]['rate_count'] = $results_rates[$res1['review_id']]['rate_count']; $resa[$num]['rate_count_blog_plus'] = $results_rates[$res1['review_id']]['rate_delta_blog_plus']; $resa[$num]['rate_count_blog_minus'] = $results_rates[$res1['review_id']]['rate_delta_blog_minus']; $resa[$num]['customer_delta'] = $results_rates[$res1['review_id']]['customer_delta']; } else { $resa[$num]['customer_delta'] = 0; $resa[$num]['delta'] = 0; $resa[$num]['rate_count'] = 0; $resa[$num]['rate_count_blog_plus'] = 0; $resa[$num]['rate_count_blog_minus'] = 0; } $resa[$num]['hsort'] = ''; $mmm = NULL; $kkk = ''; $wh = strlen($res1['sorthex']) / 4; for ($i = 0; $i < $wh; $i++) { $mmm[$i] = str_pad(dechex(65535 - hexdec(substr($res1['sorthex'], $i * 4, 4))), 4, "F", STR_PAD_LEFT); $sortmy = substr($res1['sorthex'], $i * 4, 4); $kkk = $kkk . $sortmy; } $ssorthex = ''; if (is_array($mmm)) { foreach ($mmm as $num1 => $val) { $ssorthex = $ssorthex . $val; } } if ($this->data['sorting'] != 'asc') { $resa[$num]['sorthex'] = $ssorthex; } else { $resa[$num]['sorthex'] = $kkk; } $resa[$num]['hsort'] = $kkk; } $results = NULL; $results = $resa; uasort($results, 'sdesc'); $this->data['fields'] = array(); if (isset($thislist['addfields'])) { usort($thislist['addfields'], 'comp_field'); $this->data['fields'] = $thislist['addfields']; } $this->load->model('catalog/fields'); $fields_db = $this->model_catalog_fields->getFieldsDBlang(); foreach ($this->data['fields'] as $num => $field) { foreach ($fields_db as $num_db => $field_db) { if ($field['field_name'] == $field_db['field_name']) { foreach ($field_db as $num_1 => $field_1) { if (!isset($this->data['fields'][$num][$num_1]) || $field_db[$num_1] == '') { $this->data['fields'][$num][$num_1] = $field_1; } else { } } } } } $i = 0; foreach ($results as $num => $result) { $f = 0; $addfields = array(); foreach ($result as $field_key => $field) { foreach ($this->data['fields'] as $num_db => $field_db) { if (trim($field_key) == trim($field_db['field_name'])) { $field_db['value'] = $field_db['text'] = $result[$field_key]; $addfields[$f] = $field_db; break; } else { } } $f++; } usort($addfields, 'comp_field'); if (!isset($result['date_available'])) { $result['date_available'] = $result['date_added']; } if (isset($this->data['settings_general']['format_date'])) { } else { $this->data['settings_general']['format_date'] = $this->language->get('text_date'); } if (isset($this->data['settings_general']['format_hours'])) { } else { $this->data['settings_general']['format_hours'] = $this->language->get('text_hours'); } if (isset($this->data['settings_general']['format_time']) && $this->data['settings_general']['format_time'] && date($this->data['settings_general']['format_date']) == date($this->data['settings_general']['format_date'], strtotime($result['date_added']))) { $date_str = $this->language->get('text_today'); } else { $date_str = rdate($this, $this->data['settings_general']['format_date'], strtotime($result['date_added'])); } $date_added = $date_str . rdate($this, $this->data['settings_general']['format_hours'], strtotime($result['date_added'])); $text = strip_tags($result['text']); $text = nl2br($text); if ($this->data['visual_editor']) { if (isset($this->data['thislist']['bbwidth']) && $this->data['thislist']['bbwidth'] != '') { $width = $this->data['thislist']['bbwidth']; } else { $width = '160px'; } require_once DIR_SYSTEM . 'library/bbcode/Parser.php'; $parser = new JBBCode\Parser(); $parser->addBBCode("quote", '<div class="quote">{param}</div>', true, true); $parser->addBBCode("quote", '<div class="quote">{param}</div>', false, false); $parser->addBBCode("size", '<span style="font-size:{option}%;">{param}</span>', true, true); $parser->addBBCode("code", '<pre class="code">{param}</pre>', false, false, 1); $parser->addBBCode("video", '<div style="overflow:hidden; "><iframe width="300" height="200" src="http://www.youtube.com/embed/{param}" frameborder="0" allowfullscreen></iframe></div>', false, false, 1); $parser->addBBCode("img", '<a href="{param}" class="imagebox" rel="imagebox" style="overflow: hidden;"><img class="bbimage" alt="" width="' . $width . '" src="{param}"></a>'); $parser->addBBCode("url", '<a href="{param}" target="_blank" rel="nofollow">{param}</a>', false, false); $parser->addBBCode("url", '<a href="{option}" target="_blank" rel="nofollow">{param}</a>', true, true); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->parse($text); $text = $parser->getAsHtml(); } $this->data['voted'] = false; if (!$customer_id) { if (!empty($karma_cookie)) { if (isset($karma_cookie[$result['review_id']])) { $this->data['voted'] = true; } } } if ($customer_id) { $this->data['voted'] = $result['customer_delta']; } if (!isset($result['buyproduct'])) { $result['buyproduct'] = false; } if (isset($result['avatar'])) { $this->data['avatar'] = $result['avatar']; } else { $this->data['avatar'] = ''; } if (isset($this->data['thislist']['avatar_width']) && $this->data['thislist']['avatar_width'] != '') { $width = $this->data['thislist']['avatar_width']; } else { if (isset($this->data['settings_general']['avatar_width']) && $this->data['settings_general']['avatar_width'] != '') { $width = $this->data['settings_general']['avatar_width']; } else { $width = '100'; } } if (isset($this->data['thislist']['avatar_height']) && $this->data['thislist']['avatar_height'] != '') { $height = $this->data['thislist']['avatar_height']; } else { if (isset($this->data['settings_general']['avatar_height']) && $this->data['settings_general']['avatar_height'] != '') { $height = $this->data['settings_general']['avatar_height']; } else { $height = '100'; } } $this->data['avatar_width'] = $width; $this->data['avatar_height'] = $height; $this->load->model('tool/image'); if ($this->data['avatar'] == '') { if (file_exists(DIR_IMAGE . 'no_image.jpg')) { $no_image = 'no_image.jpg'; } if (file_exists(DIR_IMAGE . 'no_image.png')) { $no_image = 'no_image.png'; } if (isset($this->data['settings_general']['avatar_admin']) && $this->data['settings_general']['avatar_admin'] != '' && isset($this->data['admin_name'][trim($result['author'])])) { $this->data['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_admin'], $this->data['avatar_width'], $this->data['avatar_height']); } else { if (isset($this->data['settings_general']['avatar_buyproduct']) && $this->data['settings_general']['avatar_buyproduct'] != '' && isset($result['buyproduct']) && $result['buyproduct'] != '') { $this->data['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_buyproduct'], $this->data['avatar_width'], $this->data['avatar_height']); } else { if (isset($this->data['settings_general']['avatar_buy']) && $this->data['settings_general']['avatar_buy'] != '' && isset($result['buy']) && $result['buy'] != '') { $this->data['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_buy'], $this->data['avatar_width'], $this->data['avatar_height']); } else { if (isset($this->data['settings_general']['avatar_reg']) && $this->data['settings_general']['avatar_reg'] != '' && isset($result['customer_id']) && $result['customer_id'] > 0) { $this->data['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_reg'], $this->data['avatar_width'], $this->data['avatar_height']); } else { if (isset($this->data['settings_general']['avatar_default']) && $this->data['settings_general']['avatar_default'] != '') { $this->data['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_default'], $this->data['avatar_width'], $this->data['avatar_height']); } else { $this->data['avatar'] = $this->model_tool_image->resizeme($no_image, $this->data['avatar_width'], $this->data['avatar_height']); } } } } } } else { $this->data['avatar'] = $this->model_tool_image->resizeme($this->data['avatar'], $this->data['avatar_width'], $this->data['avatar_height']); } if ($result['rating_mark'] != '0') { $result['rating'] = 0; } $this->data['comments'][] = array('comment_id' => $result['review_id'], 'avatar' => $this->data['avatar'], 'sorthex' => $result['sorthex'], 'buy' => $result['buy'], 'buyproduct' => $result['buyproduct'], 'customer_id' => $result['customer_id'], 'customer' => $customer_id, 'voted' => $this->data['voted'], 'customer_delta' => $result['customer_delta'], 'level' => strlen($result['sorthex']) / 4 - 1, 'parent_id' => $result['parent_id'], 'author' => $result['author'], 'text' => $text, 'rating' => (int) $result['rating'], 'rating_mark' => (int) $result['rating_mark'], 'hsort' => $result['hsort'], 'myarray' => $mmm, 'fields' => $addfields, 'delta' => $result['delta'], 'rate_count' => $result['rate_count'], 'rate_count_blog_plus' => $result['rate_count_blog_plus'], 'rate_count_blog_minus' => $result['rate_count_blog_minus'], 'comments' => sprintf($this->language->get('text_comments'), (int) $comment_total), 'date_added' => $date_added, 'date_available' => $result['date_available']); $i++; } } if (!function_exists('my_sort_div_mark')) { function my_sort_div_mark($data, $parent = 0, $sorting, $field, $lev = -1) { $arr = $data[$parent]; usort($arr, array(new cmp_my_comment($field, $sorting), "my_cmp")); $lev = $lev + 1; for ($i = 0; $i < count($arr); $i++) { $arr[$i]['level'] = $lev; $z[] = $arr[$i]; $z[count($z) - 1]['flag_start'] = 1; $z[count($z) - 1]['flag_end'] = 0; if (isset($data[$arr[$i]['comment_id']])) { $m = my_sort_div_mark($data, $arr[$i]['comment_id'], $sorting, $field, $lev); $z = array_merge($z, $m); } if (isset($z[count($z) - 1]['flag_end'])) { $z[count($z) - 1]['flag_end']++; } else { $z[count($z) - 1]['flag_end'] = 1; } } return $z; } } if (count($this->data['comments']) > 0) { for ($i = 0, $c = count($this->data['comments']); $i < $c; $i++) { $new_arr[$this->data['comments'][$i]['parent_id']][] = $this->data['comments'][$i]; } $mycomments = my_sort_div_mark($new_arr, 0, $this->data['sorting'], $comments_order); $i = 0; foreach ($mycomments as $num => $result) { if ($i >= ($page - 1) * $this->data['number_comments'] && $i < ($page - 1) * $this->data['number_comments'] + $this->data['number_comments']) { $this->data['mycomments'][$i] = $result; } $i++; } } else { $this->data['mycomments'] = array(); } if (!isset($this->data['mycomments'])) { $this->data['mycomments'] = array(); } $this->data['karma_voted'] = false; if (!$customer_id) { if (isset($_COOKIE["karma_" . $this->data['mark']])) { $karma_cookie = unserialize(base64_decode($_COOKIE["karma_" . $this->data['mark']])); } else { $karma_cookie = array(); } if (!empty($karma_cookie)) { foreach ($karma_cookie as $id => $mark_id) { if (isset($mark_id['id'])) { if ($mark_id['id'] == $this->data['mark_id']) { $this->data['karma_voted'] = true; } } else { setcookie("karma_" . $this->data['mark'], '', time() + 60 * 60 * 24 * 555, '/', $this->request->server['HTTP_HOST']); } } } } else { $check_rate_num = $this->model_catalog_treecomments->checkRateNum($this->data, $this->data['mark']); foreach ($check_rate_num as $id => $mark_id) { if ($id == $this->data['mark'] && $mark_id == $this->data['mark_id']) { $this->data['karma_voted'] = true; } } } $url_end = ""; foreach ($this->request->get as $get_key => $get_val) { if ($get_key != 'route' && $get_key != 'prefix' && $get_key != '_route_' && $get_key != 'wpage' && $get_key != 'cmswidget' && $get_key != $get_pagination) { $url_end .= "&" . (string) $get_key . "=" . (string) $get_val; } } $this->data['cmswidget'] = $cmswidget; $link_url = $this->url->link($mark_route, $this->data['mark'] . '=' . $this->data['mark_id'] . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_sorting-' . $this->data['sorting'] . '_wpage-{page}' . '#cmswidget-' . $cmswidget); $pagination = new Pagination(); $pagination->total = $comment_total; $pagination->page = $page; $pagination->limit = $this->data['number_comments']; $pagination->text = $this->language->get('text_pagination'); $pagination->url = $link_url; $this->data['pagination'] = $pagination->render(); $data_statistics = $this->ratingStatistics($this->data); $template = 'rozetka.tpl'; if (isset($thislist['blog_template_comment']) && $thislist['blog_template_comment'] != '') { $template = $thislist['blog_template_comment']; } if (isset($this->data['category_design']['blog_template_comment']) && $this->data['category_design']['blog_template_comment'] != '') { $template = $this->data['category_design']['blog_template_comment']; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/agootemplates/module/treecomments/' . $template)) { $this_template = $this->config->get('config_template') . '/template/agootemplates/module/treecomments/' . $template; } else { if (file_exists(DIR_TEMPLATE . 'default/template/agootemplates/module/treecomments/' . $template)) { $this_template = 'default/template/agootemplates/module/treecomments/' . $template; } else { $this_template = 'default/template/agootemplates/module/treecomments/rozetka.tpl'; } } $this->data['text_signer_answer'] = $this->language->get('text_signer_answer'); $this->data['text_signer_answer_email'] = $this->language->get('text_signer_answer_email'); $this->data['text_signer'] = $this->language->get('text_signer'); $this->data['text_write_review'] = $this->language->get('text_write_review'); $this->data['text_write'] = $this->language->get('text_write'); $this->data['hide_block'] = $this->language->get('hide_block'); $this->data['error_register'] = $this->language->get('error_register'); $this->data['entry_name'] = $this->language->get('entry_name'); $this->data['text_customer_enter'] = $this->language->get('text_customer_enter'); $this->data['entry_comment'] = $this->language->get('entry_comment'); $this->data['text_note'] = $this->language->get('text_note'); $this->data['entry_rating_review'] = $this->language->get('entry_rating_review'); $this->data['entry_bad'] = $this->language->get('entry_bad'); $this->data['entry_good'] = $this->language->get('entry_good'); $this->data['entry_captcha_title'] = $this->language->get('entry_captcha_title'); $this->data['entry_captcha'] = $this->language->get('entry_captcha'); $this->data['text_voted_blog_plus'] = $this->language->get('text_voted_blog_plus'); $this->data['text_voted_blog_minus'] = $this->language->get('text_voted_blog_minus'); $this->data['text_vote_will_reg'] = $this->language->get('text_vote_will_reg'); $this->data['text_vote_blog_plus'] = $this->language->get('text_vote_blog_plus'); $this->data['text_vote_blog_minus'] = $this->language->get('text_vote_blog_minus'); $this->data['text_review_yes'] = $this->language->get('text_review_yes'); $this->data['text_review_no'] = $this->language->get('text_review_no'); $this->data['text_review_karma'] = $this->language->get('text_review_karma'); $this->data['tab_review'] = $this->language->get('tab_review'); $this->data['text_all'] = $this->language->get('text_all'); $this->data['text_admin'] = $this->language->get('text_admin'); $this->data['text_buyproduct'] = $this->language->get('text_buyproduct'); $this->data['text_buy'] = $this->language->get('text_buy'); $this->data['text_registered'] = $this->language->get('text_registered'); $this->data['text_buy_ghost'] = $this->language->get('text_buy_ghost'); $this->data['button_write'] = $this->language->get('button_write'); $this->data['text_wait'] = $this->language->get('text_wait'); $this->data['theme'] = $this->config->get('config_template'); $this->data['ascp_widgets'] = $this->config->get('ascp_widgets'); $this->data['settings_widget'] = $this->data['thislist']; $this->data['theme_stars'] = $this->getThemeStars('image/blogstars-1.png'); if (isset($this->session->data['token'])) { $this->data['token'] = $this->session->data['token']; } else { $this->data['token'] = ''; } $this->template = $this_template; $this->data['language'] = $this->language; if (SCP_VERSION < 2) { $html = $this->render(); } else { if (!is_array($this->data)) { $this->data = array(); } $html = $this->load->view($this->template, $this->data); } if (isset($get['ajax']) && $get['ajax'] == 1) { $this->response->setOutput($html); //return $html; } else { return $html; } } }
?> </div> </div> <div id="all-container"> <?php $notice_query = mysqli_query($mysql, "SELECT * FROM ms_pengumuman WHERE peng_status = 1 AND peng_text != ''"); if (mysqli_num_rows($notice_query) > 0) { ?> <div id="notice"> <?php while ($data = mysqli_fetch_array($notice_query)) { $parser = new JBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->addBBCode("sup", '<sup>{param}</sup>'); $parser->addBBCode("sub", '<sub>{param}</sub>'); $parser->addBBCode("s", '<strike>{param}</strike>'); $parser->parse(htmlentities($data['peng_text'], ENT_QUOTES)); $pengumuman = str_replace("\n", "<br />", $parser->getAsHtml()); if ($pengumuman == "") { continue; } ?> <div id="notice-title">PENGUMUMAN</div> <div id="notice-content"><?php echo $pengumuman; ?> </div> <div id="notice-timestamp" class="hide"><?php echo strtotime($data['peng_lastedit']);
<?php require_once "/path/to/jbbcode/Parser.php"; $parser = new JBBCode\Parser(); $parser->addBBCode("quote", '<div class="quote">{param}</div>'); $parser->addBBCode("code", '<pre class="code">{param}</pre>', false, false, 1);
$staffData = $staffQuery->fetch_assoc(); foreach ($staffData as $arrayIndex => $arrayValue) { if ($arrayValue > $permissions[$arrayIndex]) { $permissions[$arrayIndex] = $arrayValue ? $arrayValue : 0; } } } } } $userAvatarStyle = "style='max-width: " . $permissions['maxavatarwidth'] . "px; max-height: " . $permissions['maxavatarheight'] . "px;'"; date_default_timezone_set($timezoneList[strpos($user['timezone'], ".0") ? round($user['timezone']) : $user['timezone']]); $mysql->query("UPDATE `accounts` SET `ip` = '" . $_SERVER['REMOTE_ADDR'] . "', `lastactivity` = '" . time() . "' WHERE `id` = '" . $_SESSION['accountid'] . "'"); } $bbParser = new JBBCode\Parser(); $bbParser->loadDefaultCodes(); $bbParser->addBBCode("quote", "<div class='quote'>{param}</div> <br>"); $bbParser->addBBCode("left", "<div align='left'>{param}</div>"); $bbParser->addBBCode("center", "<div align='center'>{param}</div>"); $bbParser->addBBCode("right", "<div align='right'>{param}</div>"); $bbParser->addBBCode("email", "<a href='mailto:{param}'>{param}</a>"); $bbParser->addBBCode("font", "<span style='font-family: {option};'>{param}</span>", true); $bbParser->addBBCode("size", "<span style='font-size: {option}px;'>{param}</span>", true); $bbParser->addBBCode("list", "<ul>{param}</ul>"); $bbParser->addBBCode("nlist", "<ol>{param}</ol>"); $bbParser->addBBCode("li", "<li>{param}</li>"); $bbParser->addBBCode("mention", "<span data-user='******' class='mentionUser bold'>{param}</span>"); ?> <script> $(document).ready(function() {
function serializeThread($board, $thread_id) { if ($this->mitsuba->common->isBoard($board)) { $thread = $this->conn->query("SELECT * FROM posts WHERE board='" . $board . "' AND id=" . $thread_id . " AND deleted=0"); if ($thread->num_rows == 1) { $row = $thread->fetch_assoc(); require_once "libs/jbbcode/Parser.php"; $parser = new \JBBCode\Parser(); $boarddata = $this->mitsuba->common->getBoardData($board); if ($boarddata['bbcode'] == 1) { $bbcode = $this->conn->query("SELECT * FROM bbcodes;"); while ($row = $bbcode->fetch_assoc()) { $parser->addBBCode($row['name'], $row['code']); } } $api_posts = array(); $api_posts[] = $this->serializePost($row, $boarddata, $parser); $posts = $this->conn->query("SELECT * FROM posts WHERE board='" . $board . "' AND resto=" . $thread_id); while ($row2 = $posts->fetch_assoc()) { $api_posts[] = $this->serializePost($row2, $boarddata, $parser); } $api_handle = fopen("./" . $board . "/res/" . $thread_id . ".json", "w"); $api['posts'] = $api_posts; fwrite($api_handle, json_encode($api)); fclose($api_handle); } } }
<?php require_once __DIR__ . '/bb/Parser.php'; $parser = new JBBCode\Parser(); $parser->loadDefaultCodes(); //Images $parser->addBBCode("avatar", '<img src="//' . $domain . '/avatar/{param}"/>'); $parser->addBBCode("card", '<img src="//' . $domain . '/card/{param}"/>'); $parser->addBBCode("stats", '<img src="//' . $domain . '/infopic/{param}"/>'); //Links $parser->addBBCode("player", '<a href="//' . $domain . '/player/{param}">{param}<sup>(character)</sup></a>'); //Various $parser->addBBCode("br", '<br />');
public function signer($product_id, $record_info, $settings, $mark_id) { $record_settings = $settings; $pointer_answer = ''; $this->load->model('agoo/signer/signer'); $this->load->model('catalog/fields'); if ($this->config->get('ascp_settings') != '') { $this->data['settings_general'] = $this->config->get('ascp_settings'); } else { $this->data['settings_general'] = array(); } if (!isset($record_info['name'])) { $record_info['name'] = ''; } if (isset($record_info['comment_id'])) { $comment_info = $this->model_agoo_signer_signer->getComment($record_info['comment_id'], $mark_id); } else { $comment_info = array(); } if (isset($this->request->post['notify']) && $this->request->post['notify'] && $this->validateDelete()) { $notify_status = true; } else { $notify_status = false; } $this->data['comment_id'] = $record_info['comment_id']; if ($settings['signer'] || $settings['signer_answer'] || $notify_status || $settings['comments_email'] != '') { $this->data['product_id'] = $product_id; $this->data['record_info'] = $record_info; if ($mark_id == 'product_id') { $route = 'product/product'; if ($settings['signer_answer']) { $pointer_answer = 'review_id'; $pointer_id = $comment_info['parent_id']; } } if ($mark_id == 'record_id') { $route = 'record/record'; if ($settings['signer_answer']) { $pointer_answer = 'comment_id'; $pointer_id = $comment_info['parent_id']; } } if ($this->registry->get('admin_work')) { if ($mark_id == 'record_id') { require_once DIR_CATALOG . 'controller/common/seoblog.php'; $seoUrl = new ControllerCommonSeoBlog($this->registry); } else { $seo_type = $this->config->get('config_seo_url_type'); if (!$seo_type) { $seo_type = 'seo_url'; } require_once DIR_CATALOG . 'controller/common/' . $seo_type . '.php'; $classSeo = 'ControllerCommon' . str_replace('_', '', $seo_type); $seoUrl = new $classSeo($this->registry); } $urlToCatalog = new Url(HTTP_CATALOG, $this->config->get('config_secure') ? HTTPS_CATALOG : HTTP_CATALOG); $urlToCatalog->addRewrite($seoUrl); $correct_URL = $urlToCatalog->link($route, '&' . $mark_id . '=' . $this->data['product_id']); $pos = strpos($correct_URL, 'http'); if ($pos === false) { $correct_URL = ($this->config->get('config_secure') ? HTTPS_CATALOG : HTTP_CATALOG) . $correct_URL; } $this->data['record_info']['link'] = $correct_URL; } else { if (SCP_VERSION > 1) { $this->load->controller('common/seoblog'); } else { $this->getChild('common/seoblog'); } $this->data['record_info']['link'] = $this->url->link($route, '&' . $mark_id . '=' . $this->data['product_id']); } if (!class_exists('Customer')) { require_once DIR_SYSTEM . 'library/customer.php'; } $obj = $this->registry->get('customer'); if (!is_object($obj)) { $this->registry->set('customer', new Customer($this->registry)); } unset($obj); $this->language->load('agoo/signer/signer'); if (isset($settings['langfile']) && $settings['langfile'] != '') { $this->language->load($settings['langfile']); } $this->data['login'] = $this->customer->getFirstName() . " " . $this->customer->getLastName(); $this->data['customer_id'] = $this->customer->getId(); if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) { $this->data['logo'] = $this->getHttpImage() . $this->config->get('config_logo'); } else { $this->data['logo'] = false; } if (isset($this->request->post['text'])) { $this->request->post['text'] = strip_tags($this->request->post['text']); } else { $this->request->post['text'] = ''; } $text = $this->request->post['text']; $text = nl2br(strip_tags($text)); $width = '160px'; require_once DIR_SYSTEM . 'library/bbcode/Parser.php'; $parser = new JBBCode\Parser(); $parser->addBBCode("quote", '<div class="quote">{param}</div>', true, true); $parser->addBBCode("quote", '<div class="quote">{param}</div>', false, false); $parser->addBBCode("size", '<span style="font-size:{option}%;">{param}</span>', true, true); $parser->addBBCode("code", '<pre class="code">{param}</pre>', false, false, 1); $parser->addBBCode("video", '<div style="overflow:hidden; "><iframe width="300" height="200" src="http://www.youtube.com/embed/{param}" frameborder="0" allowfullscreen></iframe></div>', false, false, 1); $parser->addBBCode("img", '<a href="{param}" class="imagebox" rel="imagebox" style="overflow: hidden;"><img class="bbimage" alt="" width="' . $width . '" src="{param}"></a>'); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->parse($text); $text = $parser->getAsHtml(); /* if (rdate($this,$this->language->get('text_date')) == rdate($this,$this->language->get('text_date'), strtotime(date($this->language->get('text_date').$this->language->get('text_hours'))))) { $date_str = $this->language->get('text_today'); } else { $date_str = rdate($this,$this->language->get('text_date'), strtotime(date($this->language->get('text_date').$this->language->get('text_hours')))); } $date_added = $date_str.(rdate($this, $this->language->get('text_hours'), strtotime(date($this->language->get('text_date').$this->language->get('text_hours'))))); */ if (isset($this->data['settings_general']['format_date'])) { } else { $this->data['settings_general']['format_date'] = $this->language->get('text_date'); } if (isset($this->data['settings_general']['format_hours'])) { } else { $this->data['settings_general']['format_hours'] = $this->language->get('text_hours'); } if (isset($this->data['settings_general']['format_time']) && $this->data['settings_general']['format_time']) { $date_str = $this->language->get('text_today'); } else { $date_str = rdate($this, $this->data['settings_general']['format_date'], strtotime(date($this->data['settings_general']['format_date'] . $this->data['settings_general']['format_hours']))); } $date_added = $date_str . rdate($this, $this->data['settings_general']['format_hours'], strtotime(date($this->data['settings_general']['format_date'] . $this->data['settings_general']['format_hours']))); $fields = array(); if (isset($this->request->post['af'])) { /* print_r("<PRE>"); print_r($this->request->post['af']); print_r("</PRE>"); */ $addfields = $this->model_catalog_fields->getFieldsDesc(); $f_name = ''; foreach ($this->request->post['af'] as $num => $value) { if (trim($value) != '') { if (trim($value) != '0') { if (isset($record_settings['addfields'])) { foreach ($addfields as $nm => $vl) { if ($vl['field_name'] == $num) { $f_name = $vl['field_description']; } } } else { $field_info = $this->model_catalog_fields->getFieldByName($num); $f_name = $field_info['field_description']; } $fields[$this->db->escape(strip_tags($num))]['field_name'] = $f_name; $fields[$this->db->escape(strip_tags($num))]['text'] = $this->db->escape(strip_tags($value)); } } } } $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name')); $answer_signers = array(); $record_signers = array(); $admin_signers = array(); if (isset($record_settings['status_now']) && $record_settings['status_now'] || $notify_status) { $record_signers = $this->model_agoo_signer_signer->getStatusId($this->data['product_id'], $mark_id); if ($settings['signer_answer']) { $answer_signers = $this->model_agoo_signer_signer->getStatusId($pointer_id, $pointer_answer); } $record_signers = array_merge($record_signers, $answer_signers); } else { $record_signers = array(); } $this->data['answer_signers'] = $answer_signers; $this->data['record_signers'] = $record_signers; if (isset($settings['comments_email']) && $settings['comments_email'] != '') { $comments_email = explode(";", $settings['comments_email']); foreach ($comments_email as $num => $email) { $email = trim($email); array_push($admin_signers, array('id' => $this->data['product_id'], 'pointer' => $mark_id, 'customer_id' => $email, 'admin' => true)); } } if (!empty($admin_signers)) { foreach ($admin_signers as $par => $singers) { $template = '/template/agootemplates/module/blog_signer_mail.tpl'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $template)) { $this->template = $this->config->get('config_template') . $template; } else { $this->template = 'default' . $template; } $this->data['theme'] = $this->config->get('config_template'); if (isset($singers['admin']) && $singers['admin']) { $customer['email'] = $singers['customer_id']; $customer['firstname'] = 'admin'; $customer['lastname'] = ''; } else { $customer['email'] = ''; $customer['firstname'] = ''; $customer['lastname'] = ''; } $this->data['data'] = array('text' => $text, 'settings' => $record_settings, 'fields' => $fields, 'comment' => $this->request->post, 'comment_db' => $comment_info, 'record' => $this->data['record_info'], 'date' => $date_added, 'shop' => $this->config->get('config_name'), 'signers' => serialize($singers), 'signer_customer' => $customer); $this->data['language'] = $this->language; if (SCP_VERSION < 2) { $html = $this->render(); } else { if (!is_array($this->data)) { $this->data = array(); } $html = $this->load->view($this->template, $this->data); } $message = $html; $data_mail['customer_email'] = $customer['email']; $data_mail['message'] = $message; $data_mail['subject'] = $subject; $this->send_mail($data_mail); unset($data_mail); } } if (!empty($record_signers)) { $customer_email_array = array(); foreach ($record_signers as $par => $singers) { $template = '/template/agootemplates/module/blog_signer_mail.tpl'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $template)) { $this->template = $this->config->get('config_template') . $template; } else { $this->template = 'default' . $template; } $this->data['theme'] = $this->config->get('config_template'); if ($singers['customer_id'] == "0") { $customer['email'] = $singers['email']; $customer['firstname'] = $this->language->get('text_ghost'); $customer['lastname'] = ''; } else { $customer = $this->model_agoo_signer_signer->getCustomer($singers['customer_id']); } $this->data['data'] = array('text' => $text, 'settings' => $record_settings, 'fields' => $fields, 'comment' => $this->request->post, 'comment_db' => $comment_info, 'record' => $this->data['record_info'], 'date' => $date_added, 'shop' => $this->config->get('config_name'), 'signers' => serialize($singers), 'signer_customer' => $customer); $this->data['language'] = $this->language; if (SCP_VERSION < 2) { $html = $this->render(); } else { if (!is_array($this->data)) { $this->data = array(); } $html = $this->load->view($this->template, $this->data); } $message = $html; $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name')); if (isset($comment_info['status']) && $comment_info['status'] && (isset($record_settings['comment_signer']) && $record_settings['comment_signer']) && $singers['customer_id'] != $this->data['customer_id'] && isset($customer['email']) || $notify_status) { if (!isset($customer_email_array[$customer['email']])) { $data_mail['customer_email'] = $customer['email']; $data_mail['message'] = $message; $data_mail['subject'] = $subject; $this->send_mail($data_mail); unset($data_mail); $customer_email_array[$customer['email']] = $customer['email']; } } } } } }
private function getBlogsReviews($thislist, $type = 'reviews') { //$this->load->helper('utf8blog'); require_once DIR_SYSTEM . 'helper/utf8blog.php'; if (file_exists(DIR_IMAGE . 'no_image.jpg')) { $no_image = 'no_image.jpg'; } if (file_exists(DIR_IMAGE . 'no_image.png')) { $no_image = 'no_image.png'; } $this->data['settings'] = $thislist; $hash = md5(serialize($thislist)); $this->data['settings_hash'] = $hash; if ($this->customer->isLogged()) { $this->data['customer_group_id'] = $this->customer_group_id; } else { $this->data['customer_group_id'] = $this->config->get('config_customer_group_id'); } $rate = array(); $this->language->load('record/blog'); $this->load->model('catalog/comment'); $this->load->model('catalog/blog'); $this->load->model('catalog/fields'); $this->load->model('tool/image'); $this->data['text_manufacturer'] = $this->language->get('text_manufacturer'); $this->data['text_karma'] = $this->language->get('text_karma'); if (isset($thislist['title_list_latest'][$this->config->get('config_language_id')])) { $this->data['heading_title'] = $thislist['title_list_latest'][$this->config->get('config_language_id')]; } else { $this->data['heading_title'] = ""; } $this->data['text_comments'] = $this->language->get('text_comments'); $this->data['text_viewed'] = $this->language->get('text_viewed'); $row = $this->cache->get('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $this->data['customer_group_id'] . '.' . $hash); if (0 == 0 || empty($row)) { $this->data['fields'] = $this->model_catalog_fields->getFieldsDBlang(); $comments = $this->model_catalog_comment->getCommentsByBlogsIN($thislist, 3); if (isset($comments) && count($comments) > 0) { foreach ($comments as $comment) { if ($comment['type'] == 'blogs') { $blog_href = $this->model_catalog_blog->getPathByBlog($comment['blog_id']); $blog_link = $this->url->link('record/blog', 'blog_id=' . $blog_href['path']); $record_link = $this->url->link('record/record', 'record_id=' . $comment['record_id']); $rate = $this->model_catalog_comment->getRatesByCommentId($comment['comment_id']); $this->data['text_category'] = $this->language->get('text_blog'); $this->data['text_record'] = $this->language->get('text_record'); $comment['mark'] = 'record_id'; } if ($comment['type'] == 'categories') { $comment['mark'] = 'product_id'; if (isset($comment['review_id'])) { $comment['comment_id'] = $comment['review_id']; } else { $comment['comment_id'] = ''; } if (isset($comment['commentid'])) { $comment['comment_id'] = $comment['commentid']; } else { $comment['comment_id'] = ''; } if (isset($comment['product_id'])) { $comment['record_id'] = $comment['product_id']; } else { if (!isset($comment['record_id'])) { $comment['record_id'] = ''; } } } if ($comment['type'] == 'categories') { $blog_href = $this->model_catalog_blog->getPathByCategory($comment['blog_id']); $blog_link = $this->url->link('product/category', 'path=' . $blog_href['path']); $record_link = $this->url->link('product/product', 'product_id=' . $comment['record_id'] . "&path=" . $blog_href['path']); $rate = array(); $this->data['text_category'] = $this->language->get('text_category'); $this->data['text_record'] = $this->language->get('text_product'); } $comment_total = $comment['total']; $rate_count = 0; $rate_delta = 0; $rate_delta_blog_plus = 0; $rate_delta_blog_minus = 0; foreach ($rate as $r) { $rate_count = $r['rate_count']; $rate_delta = $r['rate_delta']; $rate_delta_blog_plus = $r['rate_delta_blog_plus']; $rate_delta_blog_minus = $r['rate_delta_blog_minus']; } $this->load->model('tool/image'); if ($comment) { if ($comment['image']) { if (isset($this->data['settings']['image']['width']) && isset($this->data['settings']['image']['height']) && $this->data['settings']['image']['width'] != "" && $this->data['settings']['image']['height'] != "") { $thumb = $this->model_tool_image->resizeme($comment['image'], $this->data['settings']['image']['width'], $this->data['settings']['image']['height'], $this->data['settings']['image_adaptive_status']); } else { $thumb = $this->model_tool_image->resizeme($comment['image'], 150, 150, $this->data['settings']['image_adaptive_status']); } } else { $thumb = ''; } } else { $thumb = ''; } if (!isset($comment['text'])) { $comment['text'] = ''; } $text = ''; if ($comment['text'] != '') { $flag_desc = 'none'; if ($thislist['desc_symbols'] != '') { $amount = $thislist['desc_symbols']; $flag_desc = 'symbols'; } if ($thislist['desc_words'] != '') { $amount = $thislist['desc_words']; $flag_desc = 'words'; } if ($thislist['desc_pred'] != '') { $amount = $thislist['desc_pred']; $flag_desc = 'pred'; } //if ($flag_desc != 'none') //$comment['text'] = preg_replace('/\[(.*?)\]/', '', $comment['text']); switch ($flag_desc) { case 'symbols': $limit = $amount; $source = strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')); $counter = 0; $matches = array(); utf8_preg_match_all('/(?:\\[.*\\].*\\[\\/.*\\])|(.)/Usiu', $source, $matches, PREG_OFFSET_CAPTURE); foreach ($matches[1] as $num => $val) { if (is_array($val)) { $counter++; if ($counter == $limit) { $source = utf8_substr_replace($source, '', $val[1] + 1); break; } } } $text = $source; //$pattern = ('/((.*?)\S){0,' . $amount . '}/isu'); //preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out); //$text = $out[0][0]; break; case 'words': $limit = $amount; $source = strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')); $counter = 0; $matches = array(); utf8_preg_match_all('/(?:\\[.*\\].*\\[\\/.*\\])|(\\x20)/Usiu', $source, $matches, PREG_OFFSET_CAPTURE); foreach ($matches[1] as $num => $val) { if (is_array($val)) { $counter++; if ($counter == $limit) { $source = utf8_substr_replace($source, '', $val[1] + 1); break; } } } $text = $source; /* $pattern = ('/((.*?)\x20){0,' . $amount . '}/isu'); preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out); $text = $out[0][0];*/ break; case 'pred': $limit = $amount; $source = strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')); $counter = 0; $matches = array(); utf8_preg_match_all('/(?:\\[.*\\].*\\[\\/.*\\])|(\\.)/Usiu', $source, $matches, PREG_OFFSET_CAPTURE); foreach ($matches[1] as $num => $val) { if (is_array($val)) { $counter++; if ($counter == $limit) { $source = utf8_substr_replace($source, '', $val[1] + 1); break; } } } $text = $source; /* $pattern = ('/((.*?)\.){0,' . $amount . '}/isu'); preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out); $text = $out[0][0]; */ break; case 'none': $text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8'); break; } } if ($text == '') { $text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8'); } if (isset($this->data['settings_general']['format_date'])) { } else { $this->data['settings_general']['format_date'] = $this->language->get('text_date'); } if (isset($this->data['settings_general']['format_hours'])) { } else { $this->data['settings_general']['format_hours'] = $this->language->get('text_hours'); } if (isset($this->data['settings_general']['format_time']) && $this->data['settings_general']['format_time'] && date($this->data['settings_general']['format_date']) == date($this->data['settings_general']['format_date'], strtotime($comment['date_added']))) { $date_str = $this->language->get('text_today'); } else { $date_str = rdate($this, $this->data['settings_general']['format_date'], strtotime($comment['date_added'])); } $date_available = $date_str . rdate($this, $this->data['settings_general']['format_hours'], strtotime($comment['date_added'])); require_once DIR_SYSTEM . 'library/bbcode/Parser.php'; $text = nl2br(strip_tags($text)); $width = '160px'; require_once DIR_SYSTEM . 'library/bbcode/Parser.php'; $parser = new JBBCode\Parser(); $parser->addBBCode("quote", '<div class="quote">{param}</div>', true, true); $parser->addBBCode("quote", '<div class="quote">{param}</div>', false, false); $parser->addBBCode("size", '<span style="font-size:{option}%;">{param}</span>', true, true); $parser->addBBCode("code", '<pre class="code">{param}</pre>', false, false, 1); $parser->addBBCode("video", '<div style="overflow:hidden; "><iframe width="300" height="200" src="http://www.youtube.com/embed/{param}" frameborder="0" allowfullscreen></iframe></div>', false, false, 1); $parser->addBBCode("img", '<a href="{param}" class="imagebox" rel="imagebox" style="overflow: hidden;"><img class="bbimage" alt="" width="' . $width . '" src="{param}"></a>'); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->parse($text); $text = $parser->getAsHtml(); $data = array('review_id' => $comment['comment_id'], 'mark' => $comment['mark']); $fields = $this->model_catalog_fields->getFields($data); $fields_new = array(); foreach ($fields as $num => $field) { foreach ($field as $pole => $val) { if ($pole != 'review_id' && $pole != 'mark') { if ($val != '') { $fields_new[$pole]['field_value'] = $val; $fields_new[$pole]['value'] = $val; foreach ($this->data['fields'] as $n => $value) { if ($value['field_name'] == $pole) { $fields_new[$pole]['field_description'] = ''; if ($value['field_description'][(int) $this->config->get('config_language_id')] != '') { $fields_new[$pole]['field_description'] = $value['field_description']; $fields_new[$pole]['field_name'] = $value['field_name']; $fields_new[$pole]['field'] = $value['field']; $fields_new[$pole]['field_image'] = $value['field_image']; $fields_new[$pole]['field_type'] = $value['field_type']; $fields_new[$pole]['field_order'] = $value['field_order']; $fields_new[$pole]['field_status'] = $value['field_status']; break; } } } } } } } if (isset($fields_new) && !empty($fields_new)) { usort($fields_new, 'comp_field'); } $comment['info'] = ''; if ($this->data['settings_widget']['buyer_status'] || $this->data['settings_widget']['avatar_status'] || $this->data['settings_widget']['karma_status'] || $this->data['settings_widget']['manufacturer_status']) { if ($comment['type'] == 'blogs') { $table = 'record'; } if ($comment['type'] == 'categories') { $table = 'product'; } if (isset($this->data['settings_widget']['admin_name']) && $this->data['settings_widget']['admin_name'] != '') { $this->data['admin_name'] = array_flip(explode(";", trim($this->data['settings_widget']['admin_name']))); } else { $this->data['admin_name'] = array(); } if (isset($this->data['settings_widget']['avatar_width']) && $this->data['settings_widget']['avatar_width'] != '') { $width = $this->data['settings_widget']['avatar_width']; } else { if (isset($this->data['settings_general']['avatar_width']) && $this->data['settings_general']['avatar_width'] != '') { $width = $this->data['settings_general']['avatar_width']; } else { $width = '100'; } } if (isset($this->data['settings_widget']['avatar_height']) && $this->data['settings_widget']['avatar_height'] != '') { $height = $this->data['settings_widget']['avatar_height']; } else { if (isset($this->data['settings_general']['avatar_height']) && $this->data['settings_general']['avatar_height'] != '') { $height = $this->data['settings_general']['avatar_height']; } else { $height = '100'; } } $this->data['avatar_width'] = $width; $this->data['avatar_height'] = $height; $comment['info'] = $this->getAvatarComment($comment, $table, $this->data); if ($comment['info']['avatar'] == '') { if (isset($this->data['settings_general']['avatar_admin']) && $this->data['settings_general']['avatar_admin'] != '' && isset($this->data['admin_name'][trim($comment['author'])])) { $comment['info']['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_admin'], $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } else { if (isset($this->data['settings_general']['avatar_buyproduct']) && $this->data['settings_general']['avatar_buyproduct'] != '' && isset($comment['info']['buyproduct']) && $comment['info']['buyproduct'] != '') { $comment['info']['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_buyproduct'], $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } else { if (isset($this->data['settings_general']['avatar_buy']) && $this->data['settings_general']['avatar_buy'] != '' && isset($comment['info']['buy']) && $comment['info']['buy'] != '') { $comment['info']['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_buy'], $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } else { if (isset($this->data['settings_general']['avatar_reg']) && $this->data['settings_general']['avatar_reg'] != '' && isset($comment['info']['customer_id']) && $comment['info']['customer_id'] > 0) { $comment['info']['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_reg'], $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } else { if (isset($this->data['settings_general']['avatar_default']) && $this->data['settings_general']['avatar_default'] != '') { $comment['info']['avatar'] = $this->model_tool_image->resizeme($this->data['settings_general']['avatar_default'], $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } else { $comment['info']['avatar'] = $this->model_tool_image->resizeme($no_image, $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } } } } } } else { $comment['info']['avatar'] = $this->model_tool_image->resizeme($comment['info']['avatar'], $this->data['avatar_width'], $this->data['avatar_height'], $this->data['settings']['image_adaptive_status']); } if (isset($comment['info']['manufacturer_id']) && $comment['info']['manufacturer_id']) { $comment['info']['manufacturer_url'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $comment['info']['manufacturer_id']); } } if ($comment['rating_mark'] != '0') { $comment['rating'] = 0; } $this->data['comments'][] = array('comment_id' => $comment['comment_id'], 'fields' => $fields_new, 'parent_id' => $comment['parent_id'], 'blog_id' => $comment['blog_id'], 'blog_name' => $comment['blog_name'], 'blog_href' => $blog_link, 'blog_path' => $blog_href['path'], 'record_id' => $comment['record_id'], 'cmswidget' => $comment['cmswidget'], 'record_comments' => $comment['record_comments'], 'record_viewed' => $comment['record_viewed'], 'record_name' => $comment['record_name'], 'record_rating' => (int) $comment['rating_avg'], 'record_href' => $record_link, 'customer_id' => $comment['customer_id'], 'author' => $comment['author'], 'text' => $text, 'rating' => (int) $comment['rating'], 'rate_count' => $rate_count, 'rate_delta' => $rate_delta, 'rate_delta_blog_plus' => $rate_delta_blog_plus, 'rate_delta_blog_minus' => $rate_delta_blog_minus, 'date' => $date_available, 'image' => $comment['image'], 'thumb' => $thumb, 'text_category' => $this->data['text_category'], 'text_record' => $this->data['text_record'], 'info' => $comment['info']); } $this->data['comment_total'] = $comment_total; } $this->cache->set('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $this->data['customer_group_id'] . '.' . $hash, $this->data); } else { $this->data = $row; } return $this->data; }