/**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function button(Model_Order $order)
 {
     if (Core::config('payment.stripe_private') != '' and Core::config('payment.stripe_public') != '' and Theme::get('premium') == 1) {
         return View::factory('pages/stripe/button', array('order' => $order));
     }
     return '';
 }
Exemple #2
0
 /**
  * Attach theme paths to a local Url. The Url must be a resource located on the asset path
  * of the current theme or it's parents. 
  *
  * @param  string $url
  * @return string
  */
 public function url($url)
 {
     // return external URLs unmodified
     if (preg_match('/^((http(s?):)?\\/\\/)/i', $url)) {
         return $url;
     }
     // Is it on AWS? Dont lookup parent themes...
     if (preg_match('/^((http(s?):)?\\/\\/)/i', $this->assetPath)) {
         return $this->assetPath . '/' . ltrim($url, '/');
     }
     // Lookup asset in current's theme asset path
     $fullUrl = (empty($this->assetPath) ? '' : '/') . $this->assetPath . '/' . ltrim($url, '/');
     if (file_exists($fullPath = public_path($fullUrl))) {
         return $fullUrl;
     }
     // If not found then lookup in parent's theme asset path
     if ($this->getParent()) {
         return $this->getParent()->url($url);
     }
     // Asset not found at all. Error handling
     $action = \Config::get('themes.asset_not_found', 'LOG_ERROR');
     if ($action == 'THROW_EXCEPTION') {
         throw new themeException("Asset not found [{$url}]");
     } elseif ($action == 'LOG_ERROR') {
         \Log::warning("Asset not found [{$url}] in Theme [" . \Theme::get() . "]");
     }
 }
Exemple #3
0
 public function action_index()
 {
     //template header
     $this->template->title = '';
     // $this->template->meta_keywords    = 'keywords';
     $this->template->meta_description = Core::config('general.site_description');
     //setting main view/template and render pages
     // swith to decide on ads_in_home
     $ads = new Model_Ad();
     $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
     switch (core::config('advertisement.ads_in_home')) {
         case 2:
             $id_ads = array_keys(Model_Visit::popular_ads());
             if (count($id_ads) > 0) {
                 $ads->where('id_ad', 'IN', $id_ads);
             }
             break;
         case 1:
             $ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc');
             break;
         case 0:
         default:
             $ads->order_by('published', 'desc');
             break;
     }
     //if ad have passed expiration time dont show
     if (core::config('advertisement.expire_date') > 0) {
         $ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', DB::expr('NOW()'));
     }
     $ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all();
     $this->ads = $ads;
     $categs = Model_Category::get_category_count();
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs));
 }
Exemple #4
0
 /**
  * generates HTML form
  * @param  Model_Product $order 
  * @return string                 
  */
 public static function form(Model_Order $order)
 {
     if (Core::config('payment.authorize_login') != '' and Core::config('payment.authorize_key') != '' and Auth::instance()->logged_in() and $order->loaded() and Theme::get('premium') == 1) {
         return View::factory('pages/authorize/form', array('order' => $order));
     }
     return '';
 }
 /**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function button(Model_Order $order)
 {
     if (Core::config('payment.bitpay_apikey') != '' and Theme::get('premium') == 1 and Auth::instance()->logged_in() and $order->loaded()) {
         return View::factory('pages/bitpay/button', array('order' => $order));
     }
     return '';
 }
Exemple #6
0
 /**
  * Initialize properties before running the controller methods (actions),
  * so they are available to our action.
  * @param  string $template view to use as template
  * @return void           
  */
 public function before($template = NULL)
 {
     Theme::checker();
     $this->maintenance();
     if ($this->auto_render === TRUE) {
         // Load the template
         $this->template = $template === NULL ? 'oc-panel/main' : $template;
         $this->template = View::factory($this->template);
         // Initialize empty values
         $this->template->title = __('Panel') . ' - ' . core::config('general.site_name');
         $this->template->meta_keywords = '';
         $this->template->meta_description = '';
         $this->template->meta_copywrite = 'Open Classifieds ' . Core::version;
         $this->template->header = View::factory('oc-panel/header');
         $this->template->content = '';
         $this->template->footer = View::factory('oc-panel/footer');
         $this->template->styles = array();
         $this->template->scripts = array();
         $this->template->user = Auth::instance()->get_user();
         //other color
         if (Theme::get('admin_theme') != 'bootstrap' and Theme::get('admin_theme') != '') {
             Theme::$styles = array('http://netdna.bootstrapcdn.com/bootswatch/3.0.0/' . Theme::get('admin_theme') . '/bootstrap.min.css' => 'screen', 'http://cdn.jsdelivr.net/bootstrap/2.3.2/css/bootstrap-responsive.min.css' => 'screen', 'http://cdn.jsdelivr.net/chosen/1.0.0/chosen.css' => 'screen', 'http://cdn.jsdelivr.net/sceditor/1.4.3/themes/default.min.css' => 'screen', 'css/admin-styles.css' => 'screen');
         } else {
             Theme::$styles = array('http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css' => 'screen', 'http://cdn.jsdelivr.net/sceditor/1.4.3/themes/default.min.css' => 'screen', 'http://cdn.jsdelivr.net/chosen/1.0.0/chosen.css' => 'screen', 'css/admin-styles.css' => 'screen');
         }
         Theme::$scripts['footer'] = array('http://code.jquery.com/jquery-1.10.2.min.js', 'js/jquery.sceditor.min.js', 'http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js', 'http://cdn.jsdelivr.net/chosen/1.0.0/chosen.jquery.min.js', 'js/oc-panel/theme.init.js?v=2.1', 'js/oc-panel/sidebar.js');
     }
 }
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/theme');
     if ($match = Uri::match('\\/theme\\/(\\w+)')) {
         if (method_exists("controlTheme", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     if ($match = Uri::match('\\/activate\\/(\\w+)')) {
         $theName = $match[1];
         try {
             Theme::setActivate($theName);
             $post['alert'] = '<div class="alert alert-success">Change theme success</div>';
             Redirect::to(ADMINCP_URL . 'theme');
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     $post['listThemes'] = Theme::get();
     $post['theme'] = Theme::getDefault();
     System::setTitle('Theme list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('themeList', $post);
     View::make('admincp/footer');
 }
 /**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function button(Model_Order $order)
 {
     if (Core::config('payment.paymill_private') != '' and Core::config('payment.paymill_public') != '' and Theme::get('premium') == 1 and $order->loaded()) {
         return View::factory('pages/paymill/button', array('order' => $order));
     }
     return '';
 }
Exemple #9
0
 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     if (Theme::get('premium') != 1) {
         Alert::set(Alert::INFO, __('Upgrade your Open Classifieds site to activate this feature.'));
     }
     parent::__construct($request, $response);
 }
Exemple #10
0
 /**
  * This function will upgrade DB that didn't existed in versions prior to 3.0.0
  */
 public function action_300()
 {
     //new configs
     $configs = array(array('config_key' => 'hide_homepage_categories', 'group_name' => 'general', 'config_value' => '{}'), array('config_key' => 'paguelofacil_cclw', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'paguelofacil_testing', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'mercadopago_client_id', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'mercadopago_client_secret', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'contact_price', 'group_name' => 'advertisement', 'config_value' => '1'), array('config_key' => 'report', 'group_name' => 'advertisement', 'config_value' => '1'), array('config_key' => 'stripe_3d_secure', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'vat_country', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'vat_number', 'group_name' => 'payment', 'config_value' => ''));
     //get theme license and add it to the config
     if (Theme::get('license') !== NULL) {
         $configs[] = array('config_key' => 'date', 'group_name' => 'license', 'config_value' => Theme::get('license_date'));
         $configs[] = array('config_key' => 'number', 'group_name' => 'license', 'config_value' => Theme::get('license'));
     }
     try {
         DB::query(Database::UPDATE, "UPDATE " . self::$db_prefix . "content SET description='Hello Admin,\n\n [EMAIL.SENDER]: [EMAIL.FROM], have a message for you:\n\n [EMAIL.SUBJECT]\n\n [EMAIL.BODY] \n\n Regards!' WHERE seotitle='contact-admin'")->execute();
     } catch (exception $e) {
     }
     //crontab renew subscription
     try {
         DB::query(Database::UPDATE, "INSERT INTO `" . self::$db_prefix . "crontab` (`name`, `period`, `callback`, `params`, `description`, `active`) VALUES\n                                    ('Notify new updates', '0 9 * * 1', 'Cron_Update::notify', NULL, 'Notify by email of new site updates.', 1);")->execute();
     } catch (exception $e) {
     }
     //stripe agreement
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "users` ADD `stripe_agreement` varchar(40) DEFAULT NULL")->execute();
     } catch (exception $e) {
     }
     //VAT
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "orders` ADD `VAT` varchar(20) DEFAULT NULL")->execute();
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "orders` ADD `VAT_country` varchar(20) DEFAULT NULL")->execute();
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "orders` ADD `VAT_number` varchar(20) DEFAULT NULL")->execute();
     } catch (exception $e) {
     }
     Model_Config::config_array($configs);
 }
 /**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function form(Model_Order $order)
 {
     if (Core::config('payment.twocheckout_sid') != '' and Core::config('payment.twocheckout_secretword') != '' and Theme::get('premium') == 1) {
         $form_action = Core::config('payment.twocheckout_sandbox') == 1 ? self::url_sandbox_gateway : self::url_gateway;
         return View::factory('pages/twocheckout/form', array('order' => $order, 'form_action' => $form_action));
     }
     return '';
 }
Exemple #12
0
 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     if (Theme::get('premium') != 1) {
         Alert::set(Alert::INFO, __('Upgrade your Open Classifieds site to activate this feature.'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'market')));
     }
     parent::__construct($request, $response);
 }
 function __construct(Request $request, Response $response)
 {
     if (Theme::get('premium') != 1) {
         Alert::set(Alert::INFO, __('Upgrade your Yclas site to activate this feature.'));
     }
     $this->_filter_fields = array('id_user' => 'INPUT', 'expire_date' => 'DATE', 'created' => 'DATE', 'id_plan' => array('type' => 'SELECT', 'table' => 'plans', 'key' => 'id_plan', 'value' => 'seoname'), 'status' => array(0 => 'Inactive', 1 => 'Active'));
     parent::__construct($request, $response);
 }
Exemple #14
0
 /**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function button_connect(Model_Order $order)
 {
     if (!empty($order->ad->user->stripe_user_id) and Core::config('payment.stripe_connect') == TRUE and Core::config('payment.stripe_private') != '' and Core::config('payment.stripe_public') != '' and Theme::get('premium') == 1) {
         if ($order->ad->price != NULL and $order->ad->price > 0 and (core::config('payment.stock') == 0 or $order->ad->stock > 0 and core::config('payment.stock') == 1)) {
             return View::factory('pages/stripe/button_connect', array('order' => $order));
         }
     }
     return '';
 }
 public function action_index()
 {
     if (core::config('general.auto_locate')) {
         Theme::$scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7';
         Theme::$scripts['footer'][] = '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js';
     }
     //template header
     $this->template->title = '';
     // $this->template->meta_keywords    = 'keywords';
     if (core::config('general.site_description') != '') {
         $this->template->meta_description = core::config('general.site_description');
     } else {
         $this->template->meta_description = core::config('general.site_name') . ' ' . __('official homepage, get your post listed now.');
     }
     //setting main view/template and render pages
     // swith to decide on ads_in_home
     $ads = new Model_Ad();
     $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
     $ads_in_home = core::config('advertisement.ads_in_home');
     //in case we do not count visits we cant show popular
     if (core::config('advertisement.count_visits') == 0 and $ads_in_home == 2) {
         $ads_in_home = 0;
     }
     switch ($ads_in_home) {
         case 2:
             $id_ads = array_keys(Model_Visit::popular_ads());
             if (count($id_ads) > 0) {
                 $ads->where('id_ad', 'IN', $id_ads);
             }
             break;
         case 1:
             $ads->where('featured', 'IS NOT', NULL)->where('featured', '>=', Date::unix2mysql())->order_by('featured', 'desc');
             break;
         case 4:
             $ads->where('featured', 'IS NOT', NULL)->where('featured', '>=', Date::unix2mysql())->order_by(DB::expr('RAND()'));
             break;
         case 0:
         default:
             $ads->order_by('published', 'desc');
             break;
     }
     //if ad have passed expiration time dont show
     if (core::config('advertisement.expire_date') > 0) {
         $ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', Date::unix2mysql());
     }
     $ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all();
     $categs = Model_Category::get_category_count();
     $locats = Model_Location::get_location_count();
     $auto_locats = NULL;
     if (core::config('general.auto_locate') and Model_User::get_userlatlng()) {
         $auto_locats = new Model_Location();
         $auto_locats = $auto_locats->select(array(DB::expr('degrees(acos(sin(radians(' . $_COOKIE['mylat'] . ')) * sin(radians(`latitude`)) + cos(radians(' . $_COOKIE['mylat'] . ')) * cos(radians(`latitude`)) * cos(radians(abs(' . $_COOKIE['mylng'] . ' - `longitude`))))) * 111.321'), 'distance'))->where('latitude', 'IS NOT', NULL)->where('longitude', 'IS NOT', NULL)->having('distance', '<=', '100')->order_by('distance', 'desc')->find_all()->as_array();
     }
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs, 'locats' => $locats, 'auto_locats' => $auto_locats));
 }
Exemple #16
0
 public function action_index()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Newsletter')));
     $this->template->title = __('Newsletter');
     //count all users
     $user = new Model_User();
     $user->where('status', '=', Model_User::STATUS_ACTIVE);
     $count_all_users = $user->count_all();
     //count support expired
     $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where('status', '=', Model_Order::STATUS_PAID)->where('support_date', '<', Date::unix2mysql())->execute();
     $count_support_expired = $query->as_array();
     $count_support_expired = $count_support_expired[0]['count'];
     //count license expired
     $query = DB::select(DB::expr('COUNT(id_license) count'))->from('licenses')->where('valid_date', 'IS NOT', NULL)->where('valid_date', '<', Date::unix2mysql())->execute();
     $count_license_expired = $query->as_array();
     $count_license_expired = $count_license_expired[0]['count'];
     //orders per product, not accuarate since 1 user could buy more than 1 product but will do
     $query = DB::select(DB::expr('COUNT(id_order) count'))->select('p.title')->select('p.id_product')->from(array('products', 'p'))->join(array('orders', 'o'))->using('id_product')->where('o.status', '=', Model_Order::STATUS_PAID)->group_by('p.id_product')->execute();
     $products = $query->as_array();
     //post done sending newsletter
     if ($this->request->post() and Core::post('subject') != NULL) {
         $users = array();
         if (core::post('send_all') == 'on') {
             $query = DB::select('email')->select('name')->from('users')->where('status', '=', Model_User::STATUS_ACTIVE)->execute();
             $users = array_merge($users, $query->as_array());
         }
         if (Theme::get('premium') == 1) {
             if (core::post('send_expired_support') == 'on') {
                 $query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.status', '=', Model_Order::STATUS_PAID)->where('o.support_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
                 $users = array_merge($users, $query->as_array());
             }
             if (core::post('send_expired_license') == 'on') {
                 $query = DB::select('email')->select('name')->from(array('licenses', 'l'))->join(array('users', 'u'))->using('id_user')->where('l.valid_date', 'IS NOT', NULL)->where('l.valid_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
                 $users = array_merge($users, $query->as_array());
             }
             if (is_numeric(core::post('send_product'))) {
                 $query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.id_product', '=', core::post('send_product'))->where('o.status', '=', Model_Order::STATUS_PAID)->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
                 $users = array_merge($users, $query->as_array());
             }
         }
         //NOTE $users may have duplicated emails, but phpmailer takes care of not sending the email 2 times to same recipient
         //sending!
         if (count($users) > 0) {
             if (!Email::send($users, '', Core::post('subject'), Kohana::$_POST_ORIG['description'], Core::post('from'), Core::post('from_email'))) {
                 Alert::set(Alert::ERROR, __('Error on mail delivery, not sent'));
             } else {
                 Alert::set(Alert::SUCCESS, __('Email sent'));
             }
         } else {
             Alert::set(Alert::ERROR, __('Mail not sent'));
         }
     }
     $this->template->content = View::factory('oc-panel/pages/newsletter', array('count_all_users' => $count_all_users, 'count_support_expired' => $count_support_expired, 'count_license_expired' => $count_license_expired, 'products' => $products));
 }
 public function before()
 {
     parent::before();
     if (Theme::get('premium') != 1) {
         $this->_error('You need a premium theme to use the API', 401);
     }
     $key = Core::request('apikey');
     //try normal api key not user
     if ($key != Core::config('general.api_key')) {
         $this->_error(__('Wrong Api Key'), 401);
     }
 }
Exemple #18
0
 /**
  * returns the product array
  * @return string          
  */
 public static function products()
 {
     $products = array(self::PRODUCT_CATEGORY => __('Post in paid category'), self::PRODUCT_TO_TOP => __('Top up ad'), self::PRODUCT_TO_FEATURED => __('Feature ad'), self::PRODUCT_AD_SELL => __('Buy product'), self::PRODUCT_APP_FEE => __('Application Fee'));
     if (Core::config('general.subscriptions') == TRUE and Theme::get('premium') == 1) {
         $plans = new Model_Plan();
         $plans = $plans->where('status', '=', 1)->cached()->find_all();
         foreach ($plans as $plan) {
             $products[$plan->id_plan] = $plan->name;
         }
     }
     return $products;
 }
 /**
  * renders the widget view with the data
  * @return string HTML 
  */
 public function render()
 {
     //only on views disctict to home if map_active is TRUE
     if (Theme::get('premium') == 1 and (!Core::Config('appearance.map_active') or strtolower(Request::current()->controller()) != 'home')) {
         $this->before();
         //get the view file (check if exists in the theme if not default), and inject the widget
         $out = View::factory('widget/' . strtolower(get_class($this)), array('widget' => $this));
         $this->after();
         return $out;
     }
     return FALSE;
 }
 public function before()
 {
     parent::before();
     if (Theme::get('premium') != 1) {
         $this->_error('You need a premium theme to use the API', 401);
     }
     $key = Core::request('user_token');
     //try authenticate the user
     if ($key == NULL or ($this->user = Auth::instance()->api_login($key)) == FALSE) {
         $this->_error(__('Wrong Api User Token'), 401);
     }
 }
Exemple #21
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string  $themeName
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->is('admin') || $request->is('admin/*')) {
         $theme_locale = 'backend/';
     } else {
         $theme_locale = 'frontend/';
     }
     $themeName = Session::get('themeName') != '' ? $theme_locale . Session::get('themeName') : \Theme::get();
     //if(Theme::exists($themeName)){
     \Theme::set($themeName);
     //}
     return $next($request);
 }
Exemple #22
0
 /**
  * get the affiliate from the query or from the cookie
  * @return Model_Affiliate
  */
 public static function get_affiliate()
 {
     $id_affiliate = core::request('aff', Cookie::get(self::$_cookie_name));
     $affiliate = new Model_User();
     if (Core::config('affiliate.active') == 1 and is_numeric($id_affiliate) and Theme::get('premium') == 1) {
         $affiliate = new Model_User($id_affiliate);
         //the user exists so we set again the cookie, just in case it's a different user or to renew it
         if ($affiliate->loaded()) {
             Cookie::set(self::$_cookie_name, $id_affiliate, time() + 24 * 60 * 60 * Core::config('affiliate.cookie'));
         }
     }
     return $affiliate;
 }
Exemple #23
0
 /**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function button(Model_Order $order)
 {
     if (Core::config('payment.mercadopago_client_id') != '' and Core::config('payment.mercadopago_client_secret') != '' and Theme::get('premium') == 1) {
         // Include Mercadopago library
         require Kohana::find_file('vendor/mercadopago', 'mercadopago');
         // Create an instance with your MercadoPago credentials (CLIENT_ID and CLIENT_SECRET):
         $mp = new MP(core::config('payment.mercadopago_client_id'), core::config('payment.mercadopago_client_secret'));
         $preference_data = array("items" => array(array("id" => $order->id_order, "title" => $order->product->title, "currency_id" => $order->currency, "picture_url" => $order->product->get_first_image(), "description" => Text::limit_chars(Text::removebbcode($order->product->description), 30, NULL, TRUE), "category_id" => $order->product->category->name, "quantity" => 1, "unit_price" => self::money_format($order->amount))), "payer" => array("name" => Auth::instance()->get_user()->name, "email" => Auth::instance()->get_user()->email), "back_urls" => array("success" => Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')), "failure" => Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))), "auto_return" => "approved", "notification_url" => Route::url('default', array('controller' => 'mercadopago', 'action' => 'ipn', 'id' => $order->id_order)), "expires" => false);
         $preference = $mp->create_preference($preference_data);
         $link = $preference["response"]["init_point"];
         return View::factory('pages/mercadopago/button', array('link' => $link));
     }
     return '';
 }
 public function action_index()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Interactive map')));
     $this->template->title = __('Interactive map');
     $this->template->styles = array('css/map-generator.css' => 'screen');
     $this->template->scripts['footer'][] = '//www.google.com/jsapi';
     $this->template->scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false';
     $this->template->scripts['footer'][] = 'js/oc-panel/map/jscolor.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/map/map-generator.js';
     $map_active = Core::post('map_active', Core::Config('appearance.map_active'));
     $map_settings = Core::post('current_settings', Core::Config('appearance.map_settings'));
     // change map
     if (Theme::get('premium') == 1 and Core::post('jscode')) {
         Model_Config::set_value('appearance', 'map_active', Core::post('map_active'));
         Model_Config::set_value('appearance', 'map_settings', Core::post('current_settings'));
         Model_Config::set_value('appearance', 'map_jscode', Kohana::$_POST_ORIG['jscode']);
         Core::delete_cache();
         Alert::set(Alert::SUCCESS, __('Map saved.'));
     }
     $this->template->content = View::factory('oc-panel/pages/map', array('map_active' => $map_active, 'map_settings' => $map_settings));
 }
 public function action_logs()
 {
     $this->template->title = __('System logs');
     Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
     //local files
     if (Theme::get('cdn_files') == FALSE) {
         $this->template->styles = array('css/datepicker.css' => 'screen');
         $this->template->scripts['footer'] = array('js/bootstrap-datepicker.js', 'js/oc-panel/logs.js');
     } else {
         $this->template->styles = array('//cdn.jsdelivr.net/bootstrap.datepicker/0.1/css/datepicker.css' => 'screen');
         $this->template->scripts['footer'] = array('//cdn.jsdelivr.net/bootstrap.datepicker/0.1/js/bootstrap-datepicker.js', 'js/oc-panel/logs.js');
     }
     $date = core::get('date', date('Y-m-d'));
     $file = APPPATH . 'logs/' . str_replace('-', '/', $date) . '.php';
     if (file_exists($file)) {
         $log = file_get_contents($file);
     } else {
         $log = NULL;
     }
     $this->template->content = View::factory('oc-panel/pages/tools/logs', array('file' => $file, 'log' => $log, 'date' => $date));
 }
Exemple #26
0
 public function action_index()
 {
     //template header
     $this->template->title = '';
     // $this->template->meta_keywords    = 'keywords';
     $this->template->meta_description = Core::config('general.site_name') . ' ' . __('official homepage for the online store');
     $products = new Model_Product();
     $products->where('status', '=', Model_Product::STATUS_ACTIVE);
     switch (core::config('product.products_in_home')) {
         case 3:
             $id_products = Model_Review::best_rated();
             $array_ids = array();
             foreach ($id_products as $id => $id_product) {
                 $array_ids = $id_product;
             }
             if (count($id_products) > 0) {
                 $products->where('id_product', 'IN', $array_ids);
             }
             break;
         case 2:
             $id_products = array_keys(Model_Visit::popular_products());
             if (count($id_products) > 0) {
                 $products->where('id_product', 'IN', $id_products);
             }
             break;
         case 1:
             $products->where('featured', 'IS NOT', NULL)->where('featured', '>', Date::unix2mysql())->order_by('featured', 'desc');
             break;
         case 0:
         default:
             $products->order_by('created', 'desc');
             break;
     }
     $products = $products->limit(Theme::get('num_home_products', 21))->cached()->find_all();
     $categs = Model_Category::get_category_count();
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/home', array('products' => $products, 'categs' => $categs));
 }
Exemple #27
0
        $ci = 0;
        foreach ($categs as $chi) {
            ?>
											<?php 
            if ($chi['id_category_parent'] == $c['id_category']) {
                ?>
												<li class="list-group-item">
													<a title="<?php 
                echo HTML::chars($chi['name']);
                ?>
" href="<?php 
                echo Route::url('list', array('category' => $chi['seoname'], 'location' => $user_location ? $user_location->seoname : NULL));
                ?>
">
													<?php 
                if (Theme::get('category_badge') != 1) {
                    ?>
														<span class="pull-right badge badge-success"><?php 
                    echo number_format($chi['count']);
                    ?>
</span>
													<?php 
                }
                echo $chi['name'];
                ?>
													</a>
												</li>
												<?php 
                $ci++;
                if ($ci == 3) {
                    ?>
Exemple #28
0
 
    <?php 
echo Theme::scripts($scripts);
?>
    <?php 
echo core::config('general.html_head');
?>
    <?php 
echo View::factory('analytics');
?>
    <style type="text/css">
        <?php 
if (Theme::get('upper_banner_image')) {
    ?>
            .index-head {background-image:url('<?php 
    echo Theme::get('upper_banner_image');
    ?>
');}
        <?php 
}
?>
    </style>
</head>
<body data-spy="scroll" data-target=".subnav" data-offset="100">
<?php 
echo View::factory('alert_terms');
echo $header;
?>
<div id="content" class="container-fluid">
	<div class="row">
		<div class="container">
</h1>
    <?php 
} else {
    ?>
        <h1><?php 
    echo __('Listings');
    ?>
</h1>
    <?php 
}
?>
</div>

<div class="well" id="recomentadion">
    <?php 
if (Controller::$image !== NULL and Theme::get('hide_description_icon') != 1) {
    ?>
        <img src="<?php 
    echo Controller::$image;
    ?>
" class="img-responsive" alt="<?php 
    echo $category !== NULL ? HTML::chars($category->name) : (($location !== NULL and $category === NULL) ? HTML::chars($location->name) : NULL);
    ?>
">
    <?php 
}
?>

    <p>
        <?php 
if ($category !== NULL) {
    ?>
"/>
<meta property="logbee:addr" content="<?php 
    echo Model_Ad::current()->address;
    ?>
"/>
<meta property="logbee:email" content="<?php 
    echo Model_Ad::current()->user->email;
    ?>
"/>
<meta property="logbee:phone" content="<?php 
    echo Model_Ad::current()->phone;
    ?>
"/>
<meta property="logbee:price" content="<?php 
    echo i18n::money_format(Model_Ad::current()->price);
    ?>
"/>
<meta property="logbee:imgurl" content="<?php 
    echo Controller::$image;
    ?>
"/>
<?php 
}
?>
 

<link rel="shortcut icon" href="<?php 
echo Theme::get('favicon_url') != '' ? Theme::get('favicon_url') : core::config('general.base_url') . 'images/favicon.ico';
?>
">