public function action_index() { //if they want to see a single post $seotitle = $this->request->param('seotitle', NULL); if ($seotitle !== NULL) { return $this->action_view($seotitle); } //template header $this->template->title = __('Blog'); $this->template->meta_description = core::config('general.site_name') . ' ' . __('blog section.'); $posts = new Model_Post(); $posts->where('status', '=', Model_Post::STATUS_ACTIVE)->where('id_forum', 'IS', NULL); if (($search = Core::get('search')) !== NULL and strlen(Core::get('search')) >= 3) { $posts->where_open()->where('title', 'like', '%' . $search . '%')->or_where('description', 'like', '%' . $search . '%')->where_close(); } $res_count = clone $posts; $res_count = $res_count->count_all(); // check if there are some post if ($res_count > 0) { // pagination module $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action())); Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page)); //we sort all ads with few parameters $posts = $posts->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); } else { $posts = NULL; $pagination = NULL; } $this->template->bind('content', $content); $this->template->content = View::factory('pages/blog/listing', array('posts' => $posts, 'pagination' => $pagination, 'user' => Auth::instance()->get_user())); }
/** * * Initializes the php-gettext * Remember to load first php-gettext * @param string $locale * @param string $charset * @param string $domain */ public static function initialize($locale = 'en_UK', $charset = 'utf-8', $domain = 'messages') { /** * setting the statics so later we can access them from anywhere */ //we allow to choose lang from the url if (Core::config('i18n.allow_query_language') == 1) { if (Core::get('language') !== NULL) { $locale = Core::get('language'); } elseif (Cookie::get('user_language') !== NULL) { $locale = Cookie::get('user_language'); } Cookie::set('user_language', $locale, Core::config('auth.lifetime')); } self::$lang = $locale; //used in i18n kohana self::$locale = $locale; self::$charset = $charset; self::$domain = $domain; //time zone set in the config date_default_timezone_set(Kohana::$config->load('i18n')->timezone); //Kohana core charset, used in the HTML templates as well Kohana::$charset = self::$charset; /** * In Windows LC_MESSAGES are not recognized by any reason. * So we check if LC_MESSAGES is defined to avoid bugs, * and force using gettext */ if (defined('LC_MESSAGES')) { $locale_res = setlocale(LC_MESSAGES, self::$locale); } else { $locale_res = FALSE; } // used with a function money_format setlocale(LC_MONETARY, self::$locale); /** * check if gettext exists if not uses gettext dropin */ if (!function_exists('_') or $locale_res === FALSE or empty($locale_res)) { /** * gettext override * v 1.0.11 * https://launchpad.net/php-gettext/ * We load php-gettext here since Kohana_I18n tries to create the function __() function when we extend it. * PHP-gettext already does this. */ require Kohana::find_file('vendor', 'php-gettext/gettext', 'inc'); T_setlocale(LC_MESSAGES, self::$locale); T_bindtextdomain(self::$domain, DOCROOT . 'languages'); T_bind_textdomain_codeset(self::$domain, self::$charset); T_textdomain(self::$domain); //force to use the gettext dropin self::$dropin = TRUE; } else { bindtextdomain(self::$domain, DOCROOT . 'languages'); bind_textdomain_codeset(self::$domain, self::$charset); textdomain(self::$domain); } }
public static function write($message) { //формируем строку лога $string = date('Y.m.d, H:i:s') . '::' . $message . "\n"; //определяем файл $logFile = Core::get()->CONFIG['path']['root'] . 'log.txt'; //записываем file_put_contents($logFile, $string, FILE_APPEND); }
public function action_status() { if ($this->request->param('id') !== NULL and is_numeric($id_msg_thread = $this->request->param('id')) and is_numeric(Core::get('status'))) { if (Model_Message::status_thread($id_msg_thread, $this->user, Core::get('status'))) { Alert::set(Alert::SUCCESS, __('Done')); } } else { Alert::set(Alert::ERROR, __('Message not found')); } $this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index'))); }
/** * saves the category in a specific order and change the parent * @return void */ public function action_saveorder() { $this->auto_render = FALSE; $this->template = View::factory('js'); if (Menu::change_order(Core::get('order'))) { Core::delete_cache(); $this->template->content = __('Saved'); } else { $this->template->content = __('Error'); } }
/** * saves the category in a specific order and change the parent * @return void */ public function action_saveorder() { $this->auto_render = FALSE; $this->template = View::factory('js'); if (Menu::change_order(Core::get('order'))) { Cache::instance()->delete_all(); Theme::delete_minified(); $this->template->content = __('Saved'); } else { $this->template->content = __('Error'); } }
function menu_page() { $user = Core::get()->getLoggedInUser(); Core::get()->setActiveTemplate("menu"); $output = ' <h4>Velkommen (' . $user->navn . ') ' . $user->username . '</h4> <a href="index.php?q=order_new" data-transition="slide" data-icon="new" data-role="button" data-iconpos="right">Ny ordre</a> <a href="index.php?q=logout" data-transition="slide" data-icon="back" data-role="button" data-iconpos="right">Log ud</a> '; return $output; }
function logout_page() { // Unset some cookie shit // Say bye Core::get()->loggedIn(false); $output = ' <h3>Du er nu logget ud - tak for besøget</h3> <form id="login_again" action="index.php?q=login" method="post"> <button type="submit" data-theme="a">Login igen</button> </form> '; return $output; }
/** * API that return the products. * Allows api/products/<category_optional>?order1=rate&sort=asc&order2=version&sort=desc * @return [type] [description] */ public function action_products() { $this->auto_render = FALSE; $sort_allowed = array('asc', 'desc'); $order_allowed = array('id_category', 'created', 'updated', 'price', 'title', 'rate'); $order1 = Core::get('order1'); //default value if (!in_array($order1, $order_allowed) or $order1 === NULL) { $order1 = 'id_category'; } $sort1 = Core::get('sort1'); //default value if (!in_array($sort1, $sort_allowed) or $sort1 === NULL) { $sort1 = 'asc'; } $order2 = Core::get('order2'); //default value if (!in_array($order2, $order_allowed) or $order2 === NULL) { $order2 = 'price'; } $sort2 = Core::get('sort2'); //default value if (!in_array($sort2, $sort_allowed) or $sort2 === NULL) { $sort2 = 'asc'; } $items = array(); //products filtered $products = new Model_Product(); $products = $products->where('status', '=', Model_Product::STATUS_ACTIVE)->order_by($order1, $sort1)->order_by($order2, $sort2); //filter by category $seo_category = $this->request->param('id'); if ($seo_category !== NULL) { $category = new Model_Category(); $category->where('seoname', '=', $seo_category)->limit(1)->find(); if ($category->loaded()) { $products->where('id_category', '=', $category->id_category); } } $products = $products->cached()->find_all(); $i = 0; foreach ($products as $p) { $url = Route::url('product', array('seotitle' => $p->seotitle, 'category' => $p->category->seoname)); $urlmin = Route::url('product-minimal', array('seotitle' => $p->seotitle, 'category' => $p->category->seoname)); $in_offer = Date::mysql2unix($p->offer_valid) > time() ? TRUE : FALSE; $items[] = array('id_product' => $p->id_product, 'order' => $i, 'title' => $p->title, 'seoname' => $p->seotitle, 'skins' => $p->skins, 'url_more' => $url, 'url_buy' => $url, 'url_demo' => !empty($p->url_demo) ? Route::url('product-demo', array('seotitle' => $p->seotitle, 'category' => $p->category->seoname)) : '', 'url_screenshot' => URL::base() . $p->get_first_image('image'), 'type' => $p->category->seoname, 'price' => $p->price, 'currency' => $p->currency, 'price_offer' => $in_offer === TRUE ? $p->price_offer : NULL, 'offer_valid' => $in_offer === TRUE ? $p->offer_valid : NULL, 'rate' => $p->rate, 'created' => $p->created, 'updated' => $p->updated, 'version' => $p->version, 'description' => Text::removebbcode(preg_replace('/&(?!\\w+;)/', '&', $p->description))); $i++; } $this->response->headers('Content-type', 'application/javascript'); $this->response->body(json_encode($items)); }
public function getArticleById($id) { // выполняем запрос // Один запрос к БД лучше чем два, поэтому сразу вытягиваем и username из таблицы Users $predicates[] = Core::get()->db->predicate('articleid', $id); //делаем join на таблицу Users $join = Core::get()->db->join('Users', 'userid', 'Articles', 'userid'); $article = Core::get()->db->select('Articles', array('title', 'filename', 'Users.username'), $predicates, $join)[0]; //если ничего не вернул, возвращаем false if (is_null($article)) { return false; } //достаем из файла текст статьи $article['text'] = file_get_contents(Core::get()->CONFIG['path']['root'] . $article['filename']); return $article; }
function settings_page() { Core::get()->setActiveTemplate("app"); $output = ' <form id="settings" data-ajax="false" action="index.php?q=menu" method="post"> <h2>Indstillinger:</h2> <div data-role="fieldcontain"> <label for="test">Test</label> <input data-inline="true" type="checkbox" id="test" name="test" class="custom" /> </div> </form> '; return $output; }
public function action_index() { require_once Kohana::find_file('vendor', 'php-googlemap/GoogleMap', 'php'); $this->before('/pages/maps'); $this->template->title = __('Map'); $height = Core::get('height', '100%'); $width = Core::get('width', '100%'); $map = new GoogleMapAPI(); $map->setWidth($width); $map->setHeight($height); $map->disableSidebar(); $map->setMapType('map'); $map->setZoomLevel(Core::get('zoom', core::config('advertisement.map_zoom'))); //$map->mobile = TRUE; $atributes = array("target='_blank'"); if (core::get('controls') == 0) { $map->disableMapControls(); $map->disableTypeControls(); $map->disableScaleControl(); $map->disableZoomEncompass(); $map->disableStreetViewControls(); $map->disableOverviewControl(); } //only 1 marker if (core::get('address') != '') { $map->addMarkerByAddress(core::get('address'), core::get('address')); } else { //last ads, you can modify this value at: general.feed_elements $ads = DB::select('a.seotitle')->select(array('c.seoname', 'category'), 'a.title', 'a.published', 'a.address')->from(array('ads', 'a'))->join(array('categories', 'c'), 'INNER')->on('a.id_category', '=', 'c.id_category')->where('a.status', '=', Model_Ad::STATUS_PUBLISHED)->where('a.address', 'IS NOT', NULL)->order_by('published', 'desc')->limit(Core::config('general.map_elements'))->as_object()->cached()->execute(); foreach ($ads as $a) { //d($a); if (strlen($a->address) > 3) { $url = Route::url('ad', array('category' => $a->category, 'seotitle' => $a->seotitle)); $map->addMarkerByAddress($a->address, $a->title, HTML::anchor($url, $a->title, $atributes)); } } //only center if not a single ad $map->setCenterCoords(Core::get('lon', core::config('advertisement.center_lon')), Core::get('lat', core::config('advertisement.center_lat'))); } $this->template->map = $map; }
public function action_index() { //force update check reload if (Core::get('reload') == 1) { Core::get_updates(TRUE); } $versions = core::config('versions'); if (Core::get('json') == 1) { $this->auto_render = FALSE; $this->template = View::factory('js'); $this->template->content = json_encode($versions); } else { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Updates'))); $this->template->title = __('Updates'); //check if we have latest version of OC if (key($versions) != core::version) { Alert::set(Alert::ALERT, __('You are not using latest version of OC, please update.') . '<br/><br/><a class="btn btn-primary update_btn" href="' . Route::url('oc-panel', array('controller' => 'update', 'action' => 'latest')) . '"> ' . __('Update') . '</a>'); } //pass to view from local versions.php $this->template->content = View::factory('oc-panel/pages/tools/versions', array('versions' => $versions, 'latest_version' => key($versions))); } }
protected function addModel($modelName) { //имя модели с большой буквы $modelName = mb_strtoupper(mb_substr($modelName, 0, 1)) . mb_strtolower(mb_substr($modelName, 1, mb_strlen($modelName) - 1)); //проверяем, возможно модель уже загружена if (isset($this->model[$modelName])) { return true; } else { //файл модели $modelFile = Core::get()->CONFIG['path']['model'] . 'model' . $modelName . '.php'; if (is_file($modelFile)) { require_once $modelFile; //класс модели $modelClass = 'Model' . $modelName; //создаем объект модели и кладем его в массив доступных моделей данного контроллера $this->model[$modelName] = new $modelClass(); //возвращаем запрашиваемую модель для использования return $this->model[$modelName]; } else { $this->setError(404, 'Model ' . $modelName . ' not found'); return false; } } }
/** * initialize theme * @param string $theme forcing theme to load used in the admin * @return void */ public static function initialize($theme = NULL) { //we are not forcing the view of other theme if ($theme === NULL) { //first we check if it's a mobile device if (($mobile_theme = self::is_mobile()) !== FALSE) { $theme = $mobile_theme; } else { $theme = Core::config('appearance.theme'); } //if we allow the user to select the theme, perfect for the demo if (Core::config('appearance.allow_query_theme') == '1') { if (Core::get('theme') !== NULL) { $theme = Core::get('theme'); } elseif (Cookie::get('theme') !== '') { $theme = Cookie::get('theme'); } } //we save the cookie for next time Cookie::set('theme', $theme, Core::config('auth.lifetime')); } //check the theme exists.. if (!file_exists(self::theme_init_path($theme))) { $theme = Core::config('appearance.theme'); } //load theme init.php like in module, to load default JS and CSS for example self::$theme = $theme; Kohana::load(self::theme_init_path(self::$theme)); self::load(); }
/** * Tickets Closed * */ public function action_tickets_closed() { $this->template->title = __('Tickets Closed'); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)->set_url(Route::url('oc-panel', array('controller' => 'stats', 'action' => 'tickets_closed')) . '?' . http_build_query(['rel' => ''] + Request::current()->query()))); $this->template->bind('content', $content); $content = View::factory('oc-panel/pages/stats/details'); $content->title = $this->template->title; // Getting the dates and range $from_date = Core::post('from_date', Core::get('from_date', strtotime('-1 month'))); $to_date = Core::post('to_date', Core::get('to_date', time())); //we assure is a proper time stamp if not we transform it if (is_string($from_date) === TRUE) { $from_date = strtotime($from_date); } if (is_string($to_date) === TRUE) { $to_date = strtotime($to_date); } $from_datetime = new DateTime(); $to_datetime = new DateTime(); //all products $products = new Model_Product(); $products = $products->cached()->find_all(); // Dates displayed $content->from_date = date('Y-m-d', $from_date); $content->to_date = date('Y-m-d', $to_date); $content->days_ago = $from_datetime->setTimestamp($from_date)->diff($to_datetime->setTimestamp($to_date))->format("%a"); $content->current_by_date = $this->tickets_closed_by_date($from_date, $to_date); $content->current_total = $this->tickets_closed_total($from_date, $to_date); $content->past_total = $this->tickets_closed_total($from_date, $to_date, TRUE); $content->month_ago_total = $this->tickets_closed_total(strtotime('-1 months'), time()); $content->past_month_ago_total = $this->tickets_closed_total(strtotime('-1 months'), time(), TRUE); $content->three_months_ago_total = $this->tickets_closed_total(strtotime('-3 months'), time()); $content->past_three_months_ago_total = $this->tickets_closed_total(strtotime('-3 months'), time(), TRUE); $content->six_months_ago_total = $this->tickets_closed_total(strtotime('-6 months'), time()); $content->past_six_months_ago_total = $this->tickets_closed_total(strtotime('-6 months'), time(), TRUE); $content->twelve_months_ago_total = $this->tickets_closed_total(strtotime('-12 months'), time()); $content->twelve_six_months_ago_total = $this->tickets_closed_total(strtotime('-12 months'), time(), TRUE); $content->num_format = 'INTEGER'; }
public function action_index() { //if not god redirect him to the normal profile page if (Auth::instance()->get_user()->id_role != Model_Role::ROLE_ADMIN) { HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index'))); } Core::ocacu(); $this->template->title = __('Welcome'); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)); $this->template->bind('content', $content); $content = View::factory('oc-panel/home'); /////////////////////RSS//////////////////////////////// //try to get the RSS from the cache $rss_url = 'http://feeds.feedburner.com/OpenClassifieds'; $content->rss = Feed::parse($rss_url, 10); /////////////////////ADS//////////////////////////////// $content->res = new Model_Ad(); //filter ads by status $content->res = $content->res->where('status', '=', Core::get('status', Model_Ad::STATUS_PUBLISHED)); $content->res = $content->res->order_by('created', 'desc')->limit(10)->find_all(); /////////////////////STATS//////////////////////////////// //Getting the dates and range $from_date = Core::post('from_date', strtotime('-1 month')); $to_date = Core::post('to_date', time()); //we assure is a proper time stamp if not we transform it if (is_string($from_date) === TRUE) { $from_date = strtotime($from_date); } if (is_string($to_date) === TRUE) { $to_date = strtotime($to_date); } //mysql formated dates $my_from_date = Date::unix2mysql($from_date); $my_to_date = Date::unix2mysql($to_date); //dates range we are filtering $dates = Date::range($from_date, $to_date, '+1 day', 'Y-m-d', array('date' => 0, 'count' => 0), 'date'); //dates displayed in the form $content->from_date = date('Y-m-d', $from_date); $content->to_date = date('Y-m-d', $to_date); //ads published last XX days $query = DB::select(DB::expr('DATE(published) date'))->select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('published', 'between', array($my_from_date, $my_to_date))->group_by(DB::expr('DATE( published )'))->order_by('date', 'asc')->execute(); $ads_dates = $query->as_array('date'); //Today $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where(DB::expr('DATE( created )'), '=', DB::expr('CURDATE()'))->group_by(DB::expr('DATE( published )'))->order_by('published', 'asc')->execute(); $ads = $query->as_array(); $content->ads_today = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //Yesterday $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where(DB::expr('DATE( created )'), '=', date('Y-m-d', strtotime('-1 day')))->group_by(DB::expr('DATE( published )'))->order_by('published', 'asc')->execute(); $ads = $query->as_array(); $content->ads_yesterday = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //Last 30 days ads $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('published', 'between', array(date('Y-m-d', strtotime('-30 day')), date::unix2mysql()))->execute(); $ads = $query->as_array(); $content->ads_month = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //total ads $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->execute(); $ads = $query->as_array(); $content->ads_total = isset($ads[0]['count']) ? $ads[0]['count'] : 0; /////////////////////VISITS STATS//////////////////////////////// //visits created last XX days $query = DB::select(DB::expr('DATE(created) date'))->select(DB::expr('COUNT(id_visit) count'))->from('visits')->where('created', 'between', array($my_from_date, $my_to_date))->group_by(DB::expr('DATE( created )'))->order_by('date', 'asc')->execute(); $visits = $query->as_array('date'); $stats_daily = array(); foreach ($dates as $date) { $count_views = isset($visits[$date['date']]['count']) ? $visits[$date['date']]['count'] : 0; $count_ads = isset($ads_dates[$date['date']]['count']) ? $ads_dates[$date['date']]['count'] : 0; $stats_daily[] = array('date' => $date['date'], 'views' => $count_views, 'ads' => $count_ads); } $content->stats_daily = $stats_daily; //Today $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->where(DB::expr('DATE( created )'), '=', DB::expr('CURDATE()'))->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute(); $ads = $query->as_array(); $content->visits_today = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //Yesterday $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->where(DB::expr('DATE( created )'), '=', date('Y-m-d', strtotime('-1 day')))->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute(); $ads = $query->as_array(); $content->visits_yesterday = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //Last 30 days visits $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->where('created', 'between', array(date('Y-m-d', strtotime('-30 day')), date::unix2mysql()))->execute(); $visits = $query->as_array(); $content->visits_month = isset($visits[0]['count']) ? $visits[0]['count'] : 0; //total visits $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->execute(); $visits = $query->as_array(); $content->visits_total = isset($visits[0]['count']) ? $visits[0]['count'] : 0; /////////////////////ORDERS STATS//////////////////////////////// //orders created last XX days $query = DB::select(DB::expr('DATE(created) date'))->select(DB::expr('COUNT(id_order) count'))->select(DB::expr('SUM(amount) total'))->from('orders')->where('created', 'between', array($my_from_date, $my_to_date))->where('status', '=', Model_Order::STATUS_PAID)->group_by(DB::expr('DATE( created )'))->order_by('date', 'asc')->execute(); $orders = $query->as_array('date'); $stats_orders = array(); foreach ($dates as $date) { $count_orders = isset($orders[$date['date']]['count']) ? $orders[$date['date']]['count'] : 0; $count_sum = isset($orders[$date['date']]['total']) ? $orders[$date['date']]['total'] : 0; $stats_orders[] = array('date' => $date['date'], '#orders' => $count_orders, '$' => $count_sum); } $content->stats_orders = $stats_orders; //Today $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where(DB::expr('DATE( created )'), '=', DB::expr('CURDATE()'))->where('status', '=', Model_Order::STATUS_PAID)->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute(); $ads = $query->as_array(); $content->orders_yesterday = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //Yesterday $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where(DB::expr('DATE( created )'), '=', date('Y-m-d', strtotime('-1 day')))->where('status', '=', Model_Order::STATUS_PAID)->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute(); $ads = $query->as_array(); $content->orders_today = isset($ads[0]['count']) ? $ads[0]['count'] : 0; //Last 30 days orders $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where('created', 'between', array(date('Y-m-d', strtotime('-30 day')), date::unix2mysql()))->where('status', '=', Model_Order::STATUS_PAID)->execute(); $orders = $query->as_array(); $content->orders_month = isset($orders[0]['count']) ? $orders[0]['count'] : 0; //total orders $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where('status', '=', Model_Order::STATUS_PAID)->execute(); $orders = $query->as_array(); $content->orders_total = isset($orders[0]['count']) ? $orders[0]['count'] : 0; }
/** * Payment deatails and paypal configuration can be configured here * @return [view] Renders view with form inputs */ public function action_payment() { //delete featured plan if (is_numeric(Core::get('delete_plan'))) { Model_Order::delete_featured_plan(Core::get('delete_plan')); $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment'))); } Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Payments'))); $this->template->title = __('Payments'); // all form config values $paymentconf = new Model_Config(); $config = $paymentconf->where('group_name', '=', 'payment')->find_all(); // save only changed values if ($this->request->post()) { if (is_numeric(Core::request('featured_days')) and is_numeric(Core::request('featured_price'))) { Model_Order::set_featured_plan(Core::request('featured_days'), Core::request('featured_price'), Core::request('featured_days_key')); Alert::set(Alert::SUCCESS, __('Featured plan updated')); $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment'))); } $validation = Validation::factory($this->request->post())->rule('pay_to_go_on_top', 'not_empty')->rule('pay_to_go_on_top', 'numeric')->rule('stripe_appfee', 'numeric')->rule('stripe_appfee', 'range', array(':value', 0, 100))->rule('to_featured', 'range', array(':value', 0, 1))->rule('to_top', 'range', array(':value', 0, 1))->rule('sandbox', 'range', array(':value', 0, 1))->rule('paypal_seller', 'range', array(':value', 0, 1))->rule('stock', 'range', array(':value', 0, 1))->rule('authorize_sandbox', 'range', array(':value', 0, 1))->rule('stripe_address', 'range', array(':value', 0, 1)); //not updatable fields $do_nothing = array('featured_days', 'pay_to_go_on_feature', 'featured_plans'); if ($validation->check()) { foreach ($config as $c) { $config_res = $this->request->post($c->config_key); if (!in_array($c->config_key, $do_nothing) and $config_res != $c->config_value) { if ($c->config_key == 'pay_to_go_on_top') { $config_res = str_replace(',', '.', $config_res); } $c->config_value = $config_res; try { $c->save(); } catch (Exception $e) { throw HTTP_Exception::factory(500, $e->getMessage()); } } } } else { $errors = $validation->errors('config'); foreach ($errors as $error) { Alert::set(Alert::ALERT, $error); } $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment'))); } Alert::set(Alert::SUCCESS, __('Payments Configuration updated')); $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment'))); } $pages = array('' => __('Deactivated')); foreach (Model_Content::get_pages() as $key => $value) { $pages[$value->seotitle] = $value->title; } $this->template->content = View::factory('oc-panel/pages/settings/payment', array('config' => $config, 'pages' => $pages, 'featured_plans' => Model_Order::get_featured_plans())); }
/** * [action_form] generates the form to pay at paypal */ public function action_3d() { $this->auto_render = FALSE; $id_order = $this->request->param('id'); //retrieve info for the item in DB $order = new Model_Order(); $order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find(); if ($order->loaded()) { //dr($_GET); if (Core::get('status') == 'succeeded' and Core::get('id') != NULL and ($customer_id = Session::instance()->get('customer_id')) != NULL) { try { StripeKO::init(); // Create the charge on Stripe's servers - this will charge the user's card $charge = \Stripe\Charge::create(array("amount" => StripeKO::money_format($order->amount), "currency" => $order->currency, 'customer' => $customer_id, "description" => $order->description, "metadata" => array("id_order" => $order->id_order))); } catch (Exception $e) { // The card has been declined Kohana::$log->add(Log::ERROR, 'Stripe The card has been declined'); Alert::set(Alert::ERROR, 'The card has been declined'); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } //its a plan product if ($order->id_product >= 100) { //save the stripe user id to be able to charge them later on renewal $order->user->stripe_agreement = $customer_id; $order->user->save(); } //mark as paid $order->confirm_payment('stripe', $charge->id); //redirect him to his ads Alert::set(Alert::SUCCESS, __('Thanks for your payment!')); $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders'))); } else { Alert::set(Alert::INFO, __('Please fill your card details.')); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } } else { Alert::set(Alert::INFO, __('Order could not be loaded')); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } }
?> ?<?php echo Core::get('compare_products') == 1 ? http_build_query(['rel' => ''] + ['compare_products' => ''] + Request::current()->query()) : http_build_query(['rel' => ''] + ['compare_products' => 1] + Request::current()->query()); ?> " > <i class="fa fa-fw fa-clone"></i> <?php echo __('Compare Plans'); ?> </a> </span> <?php } ?> <?php if (Core::get('compare_products') == 1) { ?> <span class="statcard-desc"><?php echo $title; ?> </span> <h2 class="statcard-number"> <?php echo __('Compare Plans'); ?> </h2> <?php } else { ?> <span class="statcard-desc"><?php echo $title;
/** * Fill in default values for our properties before rendering the output. */ public function after() { //ajax request if (Core::get('rel') == 'ajax') { // Add defaults to template variables. $this->template->styles = $this->template->styles; $this->template->scripts = array_reverse($this->template->scripts); $this->response->body($this->template->render()); } else { parent::after(); } }
<!DOCTYPE html> <?php header("Content-Security-Policy: img-src 'self'; font-src 'self' http://fonts.gstatic.com; style-src 'self' 'unsafe-inline' http://fonts.googleapis.com; connect-src 'self' http://fonts.googleapis.com; frame-src 'none'; media-src 'none'; object-src 'none'; script-src 'self';"); ?> <html lang="ru"> <head> <meta charset="UTF-8" /> <meta name="Keywords" content="Сайт находится в разработке" /> <title><?php echo $initializator->core->setting_app_name; ?> - <?php echo Core::get('html_title'); ?> </title> <link rel="stylesheet" href="/static/css/me.css" /> <link rel="stylesheet" href="/static/css/tooltip.css" /> <script src="/static/js/jquery.min.js" type="text/javascript"></script> <script src="/static/js/jquery.tools.min.js" type="text/javascript"></script> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <body> <p align="center"><font face="Arial" size=5>Сайт находится в разработке</font> <br> <br> <tt> <font size=3><b>[Global] - Настройка CMS - 2%</b></font><br> <font size=2> {#} Глобальные настройки - 61%</font>
/** * Returns the {@link Core} instance. * * @return Core * * @throws CoreNotInstantiated if the core has not been instantiated yet. */ function app() { $app = Core::get(); if (!$app) { throw new CoreNotInstantiated(); } return $app; }
"> <?php echo $order->coupon->name; ?> </a> </td> <td><?php echo $order->paymethod; ?> </td> <td><?php echo $order->pay_date; ?> </td> <?php if (Core::get('print') != 1) { ?> <td width="80" style="width:80px;"> <?php if ($controller->allowed_crud_action('update')) { ?> <a title="<?php echo __('Edit'); ?> " class="btn btn-primary" href="<?php echo Route::url('oc-panel', array('controller' => Request::current()->controller(), 'action' => 'update', 'id' => $order->pk())); ?> "> <i class="glyphicon glyphicon-edit"></i> </a> <?php
/** * Import multiple locations from geonames * @return void */ public function action_geonames() { $this->template->title = __('Geonames'); $this->template->scripts['footer'][] = URL::base('http') . 'themes/default/js/oc-panel/locations-geonames.js'; $location = NULL; if (intval(Core::get('id_location')) > 0) { $location = new Model_Location(Core::get('id_location')); if ($location->loaded()) { Breadcrumbs::add(Breadcrumb::factory()->set_title($location->name)->set_url(Route::url('oc-panel', array('controller' => 'location', 'action' => 'geonames')) . '?id_location=' . $location->id_location)); } else { Alert::set(Alert::ERROR, __('You are selecting a location that does not exist')); $this->redirect(Route::get($this->_route_name)->uri(array('controller' => Request::current()->controller()))); } } //update the elements related to that ad if (core::post('geonames_locations') !== "") { $geonames_locations = json_decode(core::post('geonames_locations')); if (count($geonames_locations) > 0) { $obj_location = new Model_Location(); $locations_array = array(); $insert = DB::insert('locations', array('name', 'seoname', 'id_location_parent', 'latitude', 'longitude', 'id_geoname', 'fcodename_geoname', 'order')); $i = 1; $execute = FALSE; foreach ($geonames_locations as $location) { if (!empty($location->name) and !in_array($location->seoname = $obj_location->gen_seoname($location->name), $locations_array)) { $execute = TRUE; $insert = $insert->values(array($location->name, $location->seoname, Core::get('id_location', 1), isset($location->lat) ? $location->lat : NULL, isset($location->long) ? $location->long : NULL, isset($location->id_geoname) ? $location->id_geoname : NULL, isset($location->fcodename_geoname) ? $location->fcodename_geoname : NULL, $i)); $locations_array[] = $location->seoname; $i++; } } // Insert everything with one query. if ($execute == TRUE) { $insert->execute(); Core::delete_cache(); } HTTP::redirect(Route::url('oc-panel', array('controller' => 'location', 'action' => 'index')) . '?id_location=' . Core::get('id_location', 1)); } } else { Alert::set(Alert::INFO, __('Select some locations first.')); } $this->template->content = View::factory('oc-panel/pages/locations/geonames', array('location' => $location)); }
/** * construct mime email and send it out. * * @param string transport backend */ public function send($via = '') { //! allow temporarly override backend. Only url allowed, not array if (!empty($via)) { $this->getBackEnd(@parse_url($via)); } //! sanity checks if (empty($this->via)) { throw new EmailException(L('Mailer backend not configured!')); } if (empty($this->message)) { throw new EmailException(L('Empty message!')); } if (empty($this->header['Subject'])) { throw new EmailException(L('No subject given!')); } if (empty($this->header['To'])) { throw new EmailException(L('No recipient given!')); } if (count($this->header['To']) > 64) { // @codeCoverageIgnoreStart throw new EmailException(L('Too many recipients!')); } // @codeCoverageIgnoreEnd $this->address(self::$sender, 'From'); $local = @explode('@', array_keys($this->header['From'])[0])[1]; if (empty($local)) { $local = 'localhost'; } $id = sha1(uniqid()) . '_' . microtime(true) . '@' . $local; //! message type $isHtml = preg_match('/<html/i', $this->message); //! *** handle transport backends that does not require mime message *** if ($this->via == 'db') { //! mail queue in database if (empty(DS::db())) { throw new EmailException(L('DB queue backend without configured datasource!')); } return DS::exec('INSERT INTO email_queue (data,created) VALUES (?,?);', [$this->get(), Core::$core->now]) > 0 ? true : false; } elseif ($this->via == 'phpmailer') { //! PHP Mailer if (!ClassMap::has('PHPMailer')) { throw new EmailException(L('PHPMailer not installed!')); } // @codeCoverageIgnoreStart $mail = new \PHPMailer(); $mail->Subject = $this->header['Subject']; $mail->SetFrom(implode(', ', $this->header['From'])); if (!empty($this->header['Reply-To'])) { $mail->AddReplyTo($this->header['Reply-To']); } foreach (['To', 'Cc', 'Bcc'] as $type) { foreach ($this->header[$type] as $rcpt => $full) { list($name) = explode('<', $full); $mail->SetAddress(self::$forge ? self::$forge : $rcpt, trim($name)); } } foreach ($this->attach as $attach) { $mail->AddAttachment($attach['file']); } $mail->MsgHTML($this->message); return $mail->Send(); // @codeCoverageIgnoreEnd } //! *** build mime message *** //! mime headers $headers['MIME-Version'] = '1.0'; $headers['Content-Class'] = 'urn:content-classes:message'; $headers['Content-Type'] = 'text/plain;charset=utf-8'; $headers['Content-Transfer-Encoding'] = '8bit'; $headers['Sender'] = implode(', ', $this->header['From']); $headers['Message-ID'] = '<' . $id . '>'; $headers['Date'] = date('r', Core::$core->now); $headers['X-Mailer'] = 'PHPPE ' . VERSION; foreach ($this->header as $k => $v) { $headers[$k] = is_array($v) ? implode(', ', $v) : $v; } //! mime body if (!$isHtml) { //! plain text email $message = wordwrap($this->message, 78); } else { $boundary = uniqid(); //! html email with a plain text alternative $headers['Content-Type'] = "multipart/alternative;\n boundary=\"" . $boundary . '"'; $message = "This is a multi-part message in MIME format.\r\n"; $message .= '--' . $boundary . "\n" . "Content-type: text/plain;charset=utf-8\n" . "Content-Transfer-Encoding: 8bit\n\n" . wordwrap(preg_replace("/\\<.*?\\>/m", '', strtr($this->message, ['</h1>' => "\n\n", '</h2>' => "\n\n", '</h3>' => "\n\n", '</h4>' => "\n\n", '</h5>' => "\n\n", '</h6>' => "\n\n", '</p>' => "\n\n", '</td>' => "\t", '</tr>' => "\n", '</table>' => "\n", '<br>' => "\n", '<br/>' => "\n"])), 78) . "\r\n"; //! look for images in html, if found, we have to create a multipart/related block if (preg_match_all("/(http|images\\/|data\\/).*?\\.(gif|png|jpe?g)/mis", $this->message, $m, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { $boundary2 = uniqid(); $diff = 0; foreach ($m as $k => $c) { //if it's a absolute url, don't replace it if ($c[1][0] == 'http') { unset($m[$k]); continue; } //generate a cid $m[$k][3] = uniqid(); //get local path for filename if ($c[1][0] == 'data/' && file_exists($c[0][0])) { $m[$k][4] = $c[0][0]; } elseif (file_exists('public/' . $c[0][0])) { $m[$k][4] = 'public/' . $c[0][0]; } else { foreach (['vendor/phppe/*/', 'vendor/*/', 'vendor/*/*/'] as $d) { if ($m[$k][4] = @glob($d . $c[0][0])[0]) { break; } } } //replace image url in message $new = 'cid:' . $m[$k][3]; $this->message = substr($this->message, 0, $c[0][1] + $diff) . $new . substr($this->message, $c[0][1] + $diff + strlen($c[0][0])); $diff -= strlen($c[0][0]) - strlen($new); } } if (!empty($m)) { //! add the html part as related $message .= '--' . $boundary . "\n" . "Content-type: multipart/related;\n boundary=\"" . $boundary2 . "\"\n\n" . "This is a multi-part message in MIME format.\r\n--" . $boundary2 . "\n" . "Content-Type: text/html;charset=utf-8\n" . "Content-Transfer-Encoding: 8bit\n\n" . wordwrap($this->message, 78) . "\r\n"; foreach ($m as $c) { $data = empty($c[4]) ? '' : (substr($c[4], 0, 4) == 'http' ? Core::get($c[4]) : file_get_contents($c[4])); if (!$data) { continue; } //get content $message .= '--' . $boundary2 . "\n" . 'Content-Type: image/' . ($c[2][0] == 'jpg' ? 'jpeg' : $c[2][0]) . "\n" . "Content-Transfer-Encoding: base64\n" . "Content-Disposition: inline\n" . 'Content-ID: <' . $c[3] . ">\n\n" . chunk_split(base64_encode($data), 78, "\n"); } $message .= '--' . $boundary2 . "--\n"; } else { $message .= '--' . $boundary . "\n" . "Content-type: text/html;charset=utf-8\n" . "Content-Transfer-Encoding: 8bit\n\n" . wordwrap($this->message, 78) . "\r\n"; } $message .= '--' . $boundary . "--\n"; } if (!empty($this->attach)) { $boundary = uniqid(); $headers['Content-Type'] = "multipart/mixed;\n boundary=\"" . $boundary . '"'; $message = "This is a multi-part message in MIME format.\r\n--" . $boundary . "\n" . $message; foreach ($this->attach as $attach) { $data = !empty($attach['data']) ? $attach['data'] : (substr($attach['file'], 0, 4) == 'http' ? Core::get($attach['file']) : file_get_contents(substr($attach['file'], 0, 6) == 'images' ? @glob('vendor/phppe/*/' . $attach['file'])[0] : $attach['file'])); if (!$data) { continue; } $message .= '--' . $boundary . "\n" . 'Content-type: ' . (!empty($attach['mime']) ? $attach['mime'] : 'application-octet-stream') . "\n" . 'Content-Disposition: attachment' . (!empty($attach['file']) ? ";\n filename=\"" . basename($attach['file']) . '"' : '') . "\n" . "Content-Transfer-Encoding: base64\n\n" . chunk_split(base64_encode($data), 78, "\n"); } $message .= '--' . $boundary . "--\n"; } //! flat headers $header = ''; //! redirect message to a specific address (for testing) if (!empty(self::$forge)) { // @codeCoverageIgnoreStart $headers['To'] = self::$forge; $headers['Cc'] = ''; $headers['Bcc'] = ''; // @codeCoverageIgnoreEnd } foreach ($headers as $k => $v) { $header .= $k . ': ' . $v . "\r\n"; } //! log that we are sending a mail Core::log('I', 'To: ' . $headers['To'] . ', Subject: ' . $headers['Subject'] . ', ID: ' . $id, 'email'); //if email directory exists, save the full mime message as well for debug @file_put_contents('data/log/email/' . $id, 'Backend: ' . $this->via . ' ' . self::$user . ':' . self::$pass . '@' . self::$host . ':' . self::$port . "\r\n\r\n" . $header . "\r\n" . $message); //! *** handle transport backends *** switch ($this->via) { //! only log and possibly save message in file, do not send for real. Nothing left to do case 'log': break; //! return constructed mime message //! return constructed mime message case 'mime': return $header . "\r\n" . $message; break; //! use php's mail() //! use php's mail() case 'mail': $to = $headers['To']; $subj = $headers['Subject']; unset($headers['To']); unset($headers['Subject']); $header = ''; foreach ($headers as $k => $v) { $header .= $k . ': ' . $v . "\r\n"; } if (!mail($to, $subj, $message, $header)) { Core::log('E', 'mail() failed, To: ' . $to . ', Subject: ' . $subj . ', ID: ' . $id, 'email'); return false; } // @codeCoverageIgnoreStart break; //! sendmail through pipe //! sendmail through pipe case 'sendmail': $f = @popen('/usr/sbin/sendmail -t -i', 'w'); if ($f) { fputs($f, $header . "\r\n" . $message); pclose($f); } else { Core::log('E', 'mail() failed, To: ' . $headers['To'] . ', Subject: ' . $headers['Subject'] . ', ID: ' . $id, 'email'); return false; } break; //! this is how real programmers do it, let's speak smtp directly! //! this is how real programmers do it, let's speak smtp directly! default: //open socket $s = @fsockopen(self::$host, self::$port, $en, $es, 5); $l = ''; //get welcome message if ($s) { stream_set_timeout($s, 5); $l = fgets($s, 1024); } if (!$s || substr($l, 0, 3) != '220') { Core::log('E', 'connection error to ' . self::$host . ':' . self::$port . ', ' . trim($l), 'email'); return false; } //we silently assume we got 8BITMIME here, it's a safe assumption as of 2016 while ($l[3] == '-') { $l = fgets($s, 1024); } //greet remote fputs($s, 'EHLO ' . $local . "\r\n"); $l = fgets($s, 1024); while ($l[3] == '-') { $l = fgets($s, 1024); } //tell who are sending fputs($s, 'MAIL FROM: <' . array_keys($this->header['From'])[0] . ">\r\n"); $l = fgets($s, 1024); if (substr($l, 0, 3) != '250') { PPHPE3::log('E', 'from error: ' . trim($l), 'email'); return false; } //to whom $addresses = array_merge(array_keys($this->header['To']), array_keys($this->header['Cc']), array_keys($this->header['Bcc'])); foreach ($addresses as $a) { fputs($s, 'RCPT TO: <' . $a . ">\r\n"); $l = fgets($s, 1024); if (substr($l, 0, 3) != '250') { Core::log('E', 'recipient error: ' . trim($l), 'email'); } } //the message fputs($s, "DATA\r\n"); $l = fgets($s, 1024); if (substr($l, 0, 3) != '250') { Core::log('E', 'data error: ' . trim($l), 'email'); return false; } fputs($header . "\r\n" . str_replace(array("\n.\n", "\n.\r"), array("\n..\n", "\n..\r"), $message) . "\r\n.\r\n"); $l = fgets($s, 1024); if (substr($l, 0, 3) != '250') { Core::log('E', 'data send error: ' . trim($l), 'email'); return false; } //say bye fputs($s, "QUIT\r\n"); fclose($s); // @codeCoverageIgnoreEnd } return true; }
href="<?php echo Route::url('oc-panel', array('controller' => 'ad', 'action' => 'spam')); ?> " onclick="return confirm('<?php echo __('Spam?'); ?> ');" rel="tooltip" title="<?php echo __('Spam'); ?> "> <i class="glyphicon glyphicon-fire"></i> </a> <?endif?> <?if(Core::get('status') != Model_Ad::STATUS_UNAVAILABLE):?> <a class="deactivate btn btn-warning " href="<?php echo Route::url('oc-panel', array('controller' => 'ad', 'action' => 'deactivate')); ?> " onclick="return confirm('<?php echo __('Deactivate?'); ?> ');" rel="tooltip" title="<?php echo __('Deactivate'); ?> "> <i class="glyphicon glyphicon-remove"></i> </a>
<input id="user_password_new" type="password" name="user_password_new" pattern=".{6,}" required autocomplete="off" /> <br> <label for="user_password_repeat">Pakartokite slaptažodį<span class="reqfield">*</span></label> <input id="user_password_repeat" type="password" name="user_password_repeat" pattern=".{6,}" required autocomplete="off" /> <br> <br> <?php if (isset($_GET['juridinis'])) { ?> <label for="user_orgname">Pavadinimas<span class="reqfield">*</span></label> <input id="user_orgname" type="text" maxlength="128" name="user_orgname" required /> <br> <label for="user_legalstatus">Teisinė forma<span class="reqfield">*</span></label> <select id="user_legalstatus" name="user_legalstatus"><?php $Core = new Core(); $legalStatuses = $Core->get('legalStatuses'); foreach ($legalStatuses as $key => $legalStatus) { echo '<option value="' . $key . '">' . htmlspecialchars($legalStatus, ENT_QUOTES, CHARSET) . '</option>'; } ?> </select> <br> <label for="user_code1">Įmonės kodas<span class="reqfield">*</span></label> <input id="user_code1" type="text" maxlength="9" name="user_code1" required /> <br> <label for="user_code2">PVM mokėtojo kodas</label> <input id="user_code2" type="text" maxlength="14" name="user_code2" /> <br> <label for="user_reg">Registras</label> <input id="user_reg" type="text" maxlength="128" name="user_reg" />
/** * remove category from custom field * @return void */ public function action_remove_category() { if (Core::get('id_category')) { $name = $this->request->param('id'); $field = new Model_Field(); $field_data = $field->get($name); $category = new Model_Category(Core::get('id_category')); // category or custom field not found if (!$category->loaded() or !$field_data) { $this->redirect(Route::get('oc-panel')->uri(array('controller' => Request::current()->controller(), 'action' => 'index'))); } // remove current category from custom field categories if (is_array($field_data['categories']) and ($key = array_search($category->id_category, $field_data['categories'])) !== FALSE) { unset($field_data['categories'][$key]); } try { // update custom field categories if ($field->update($name, $field_data['values'], $field_data['categories'], $field_data)) { Core::delete_cache(); Alert::set(Alert::SUCCESS, sprintf(__('Field %s removed'), $name)); } else { Alert::set(Alert::ERROR, sprintf(__('Field %s cannot be removed'), $name)); } } catch (Exception $e) { throw HTTP_Exception::factory(500, $e->getMessage()); } $this->redirect(Route::get('oc-panel')->uri(array('controller' => 'category', 'action' => 'update', 'id' => $category->id_category))); } $this->redirect(Route::get('oc-panel')->uri(array('controller' => Request::current()->controller(), 'action' => 'index'))); }
function lili3($item, $key, $cats) { ?> <div class="accordion-group"> <div class="accordion-heading"> <?php if (count($item) > 0) { ?> <div class="radio"> <label> <input <?php echo $cats[$key]['seoname'] == Core::get('category') ? 'checked' : ''; ?> type="radio" id="radio_<?php echo $cats[$key]['seoname']; ?> " name="id_category" value="<?php echo $cats[$key]['id']; ?> " required> <a class="btn btn-primary btn-xs" data-toggle="collapse" type="button" data-target="#acc_<?php echo $cats[$key]['seoname']; ?> "> <i class=" glyphicon glyphicon-plus"></i> <?php echo $cats[$key]['name']; ?> </a> </label> </div> <?php } else { ?> <div class="radio"> <label> <input <?php echo $cats[$key]['seoname'] == Core::get('category') ? 'checked' : ''; ?> type="radio" id="radio_<?php echo $cats[$key]['seoname']; ?> " name="id_category" value="<?php echo $cats[$key]['id']; ?> " required> <a class="btn btn-xs btn-primary" data-toggle="collapse" type="button" data-target="#acc_<?php echo $cats[$key]['seoname']; ?> "> <?php echo $cats[$key]['name']; ?> </a> </label> </div> <?php } ?> </div> <?php if (count($item) > 0) { ?> <div id="acc_<?php echo $cats[$key]['seoname']; ?> " class="accordion-body collapse <?php echo $cats[$key]['seoname'] == Core::get('category') ? 'in' : ''; ?> "> <div class="accordion-inner"> <?php if (is_array($item)) { array_walk($item, 'lili3', $cats); } ?> </div> </div> <?php } ?> </div> <?php }