/**
  * [action_form] generates the form to pay at paypal
  */
 public function action_pay()
 {
     $this->auto_render = FALSE;
     //sandobx doesnt do the x_receipt_link_url redirect so in sanbbox instead we put the order id
     $id_order = Core::config('payment.twocheckout_sandbox') == 1 ? Core::request('x_receipt_link_url') : $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()) {
         //its a fraud...lets let him know
         if ($order->is_fraud() === TRUE) {
             Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.'));
             $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
         }
         if (($order_id = twocheckout::validate_passback($order)) !== FALSE) {
             //mark as paid
             $order->confirm_payment('2checkout', $order_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)));
     }
 }
示例#2
0
 public function action_social()
 {
     $user = FALSE;
     $provider_name = Core::request('social_network');
     $identifier = Core::request('token');
     $email = Core::request('email');
     $name = Core::request('name');
     $user = Auth::instance()->social_login($provider_name, $identifier);
     //not found in database
     if ($user == FALSE) {
         //register the user in DB
         Model_User::create_social($email, $name, $provider_name, $identifier);
         //log him in
         $user = Auth::instance()->social_login($provider_name, $identifier);
     }
     if ($user !== FALSE and $user->loaded()) {
         //save device id only if its different
         if (Core::request('device_id') !== NULL and $user->device_id != Core::request('device_id')) {
             $user->device_id = Core::request('device_id');
             try {
                 $user->save();
             } catch (Kohana_HTTP_Exception $khe) {
             }
         }
         $this->rest_output(array('user' => self::get_user_array($user)));
     }
 }
 public function action_result()
 {
     $this->auto_render = FALSE;
     $id_order = Core::request('id_order');
     //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()) {
         //its a fraud...lets let him know
         if ($order->is_fraud() === TRUE) {
             Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.'));
             $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
         }
         //correct payment?
         if (($result = paguelofacil::check_result()) === TRUE) {
             //mark as paid
             $order->confirm_payment('paguelofacil', Core::request('Oper'));
             //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, __('Transaction not successful!'));
             $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)));
     }
 }
示例#4
0
 /**
  * Handle GET requests.
  */
 public function action_login()
 {
     // If the passwords match, perform a login
     if (($user = Auth::instance()->email_login(Core::request('email'), Core::request('password'))) !== FALSE) {
         if ($user->loaded()) {
             //save device id only if its different
             if (Core::request('device_id') !== NULL and $user->device_id != Core::request('device_id')) {
                 $user->device_id = Core::request('device_id');
                 try {
                     $user->save();
                 } catch (Kohana_HTTP_Exception $khe) {
                 }
             }
             $res = $user->as_array();
             $res['user_token'] = $user->api_token();
             $res['image'] = $user->get_profile_image();
             //I do not want to return this fields...
             $hidden_fields = array('password', 'token', 'hybridauth_provider_uid', 'token_created', 'token_expires', 'user_agent');
             //all fields
             $this->_return_fields = array_keys($res);
             //remove the hidden fields
             foreach ($this->_return_fields as $key => $value) {
                 if (in_array($value, $hidden_fields)) {
                     unset($this->_return_fields[$key]);
                 }
             }
             $this->rest_output(array('user' => $res));
         }
     } else {
         $this->_error(__('Wrong user name or password'), 401);
     }
 }
示例#5
0
 /**
  * List all Advertisements (PUBLISHED)
  */
 public function action_index()
 {
     //template header
     $this->template->title = __('Advertisements');
     $this->template->meta_description = __('Advertisements');
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List')));
     $this->template->scripts['footer'][] = 'js/jquery.toolbar.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/moderation.js';
     $ads = new Model_Ad();
     $fields = array('title', 'id_ad', 'published', 'created', 'id_category', 'id_location', 'status');
     //filter ads by status
     $status = is_numeric(Core::get('status')) ? Core::get('status') : Model_Ad::STATUS_PUBLISHED;
     $ads = $ads->where('status', '=', $status);
     // sort ads by search value
     if ($q = $this->request->query('search')) {
         $ads = $ads->where('title', 'like', '%' . $q . '%');
         if (core::config('general.search_by_description') == TRUE) {
             $ads = $ads->or_where('description', 'like', '%' . $q . '%');
         }
     }
     if (is_numeric(Core::request('filter__id_user'))) {
         $ads = $ads->where('id_user', '=', Core::request('filter__id_user'));
     }
     $ads_count = clone $ads;
     $res_count = $ads_count->count_all();
     if ($res_count > 0) {
         $pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $res_count, 'items_per_page' => 50))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
         $ads = $ads->order_by(core::get('order', 'published'), core::get('sort', 'desc'))->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
         $this->template->content = View::factory('oc-panel/pages/ad', array('res' => $ads, 'pagination' => $pagination, 'fields' => $fields));
     } else {
         $this->template->content = View::factory('oc-panel/pages/ad', array('res' => NULL, 'fields' => $fields));
     }
 }
示例#6
0
 public function action_process()
 {
     $this->auto_render = FALSE;
     $this->template = View::factory('js');
     //finished?
     if ($this->amount_ads_import() === 0) {
         /*Alert::set(Alert::SUCCESS,__('All ads are processed! Congrats!'));
           $this->redirect(Route::url('oc-panel',array('controller'=>'import','action'=>'index')));*/
         $this->template->content = json_encode('OK');
     } else {
         //how many ads we process in each request? pass get/post
         $limit_process = Core::request('limit', 5);
         $ads_import = DB::select()->from('adsimport')->where('processed', '=', '0')->limit($limit_process)->as_object()->execute();
         $i = 0;
         foreach ($ads_import as $adi) {
             if ($this->create_ad($adi) === TRUE) {
                 $i++;
             }
         }
         $todo = $this->amount_ads_import();
         $done = $this->amount_ads_import(1);
         $total = $todo + $done;
         $this->template->content = json_encode(round(100 - $todo * 100 / $total));
         //$this->redirect(Route::url('oc-panel',array('controller'=>'import','action'=>'process')));
     }
 }
示例#7
0
 function __construct(Request $request, Response $response)
 {
     parent::__construct($request, $response);
     //forcing a filter
     if (Core::request('filter__id_forum') === NULL) {
         $this->_filter_post['id_forum'] = 'NOT NULL';
     }
 }
示例#8
0
 public function before()
 {
     parent::before();
     $key = Core::request('apikey');
     //try normal api key not user
     if ($key != Core::config('general.api_key')) {
         $this->_error(__('Wrong Api Key'), 401);
     }
 }
示例#9
0
 public function before()
 {
     parent::before();
     $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);
     }
 }
示例#10
0
 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);
     }
 }
示例#11
0
 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);
     }
 }
示例#12
0
 /**
  * validate the return
  * see https://www.2checkout.com/documentation/checkout/
  * @param  Model_Order $order 
  * @return order number or FALSE if not match             
  */
 public static function validate_passback(Model_Order $order)
 {
     $hashSecretWord = Core::config('payment.twocheckout_secretword');
     //2Checkout Secret Word
     $hashSid = Core::config('payment.twocheckout_sid');
     //2Checkout account number
     $hashTotal = self::money_format($order->amount);
     //Sale total to validate against
     $hashOrder = Core::request('order_number');
     //2Checkout Order Number
     $StringToHash = strtoupper(md5($hashSecretWord . $hashSid . $hashOrder . $hashTotal));
     return $StringToHash == Core::request('key') ? $hashOrder : FALSE;
 }
示例#13
0
 public function action_index()
 {
     $this->template->title = __('Stats');
     $this->template->bind('content', $content);
     $content = View::factory('oc-panel/pages/stats/dashboard');
     $content->title = $this->template->title;
     // Getting the dates and range
     $from_date = Core::request('from_date', date('Y-m-d', strtotime('-1 month')));
     $to_date = Core::request('to_date', date('Y-m-d', strtotime('+1 day')));
     // 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();
     // 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");
     // Ads
     $content->ads = $this->ads_by_date($from_date, $to_date);
     $content->ads_total = $this->ads_total($from_date, $to_date);
     $content->ads_total_past = $this->ads_total($from_date, $to_date, TRUE);
     // Users
     $content->users = $this->users_by_date($from_date, $to_date);
     $content->users_total = $this->users_total($from_date, $to_date);
     $content->users_total_past = $this->users_total($from_date, $to_date, TRUE);
     // Visits
     $content->visits = $this->visits_by_date($from_date, $to_date);
     $content->visits_total = $this->visits_total($from_date, $to_date);
     $content->visits_total_past = $this->visits_total($from_date, $to_date, TRUE);
     // Contacts
     $content->contacts = $this->contacts_by_date($from_date, $to_date);
     $content->contacts_total = $this->contacts_total($from_date, $to_date);
     $content->contacts_total_past = $this->contacts_total($from_date, $to_date, TRUE);
     // Paid Orders
     $content->paid_orders = $this->paid_orders_by_date($from_date, $to_date);
     $content->paid_orders_total = $this->paid_orders_total($from_date, $to_date);
     $content->paid_orders_total_past = $this->paid_orders_total($from_date, $to_date, TRUE);
     // Sales
     $content->sales = $this->sales_by_date($from_date, $to_date);
     $content->sales_total = $this->sales_total($from_date, $to_date);
     $content->sales_total_past = $this->sales_total($from_date, $to_date, TRUE);
     $content->chart_config = array('height' => 94, 'width' => 378, 'options' => array('responsive' => true, 'scales' => array('xAxes' => array(array('display' => false)), 'yAxes' => array(array('display' => false, 'ticks' => array('min' => 0)))), 'legend' => array('display' => false)));
     $content->chart_colors = array(array('fill' => 'rgba(33,150,243,.1)', 'stroke' => 'rgba(33,150,243,.8)', 'point' => 'rgba(33,150,243,.8)', 'pointStroke' => 'rgba(33,150,243,.8)'));
 }
示例#14
0
 /**
  *
  * Loads a basic list info
  * @param string $view template to render 
  */
 public function action_index($view = NULL)
 {
     $this->template->title = __('Orders');
     $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/crud/index.js', 'js/oc-panel/stats/dashboard.js');
     $orders = new Model_Order();
     $orders = $orders->where('status', '=', Model_Order::STATUS_PAID);
     //filter email
     if (core::request('email') !== NULL) {
         $user = new Model_User();
         $user->where('email', '=', core::request('email'))->limit(1)->find();
         if ($user->loaded()) {
             $orders = $orders->where('id_user', '=', $user->id_user);
         }
     }
     //filter date
     if (!empty(Core::request('from_date')) and !empty(Core::request('to_date'))) {
         //Getting the dates range
         $from_date = Core::request('from_date', strtotime('-1 month'));
         $to_date = Core::request('to_date', time());
         $orders = $orders->where('pay_date', 'between', array($from_date, $to_date));
     }
     //filter coupon
     if (is_numeric(core::request('id_coupon'))) {
         $orders = $orders->where('id_coupon', '=', core::request('id_coupon'));
     }
     //filter product
     if (is_numeric(core::request('id_product'))) {
         $orders = $orders->where('id_product', '=', core::request('id_product'));
     }
     //filter status
     if (is_numeric(core::request('status'))) {
         $orders = $orders->where('status', '=', core::request('status'));
     }
     //order by paid if we are filtering paid....
     if (core::request('status') == Model_Order::STATUS_PAID) {
         $orders->order_by('pay_date', 'desc');
     } else {
         $orders->order_by('id_order', 'desc');
     }
     $items_per_page = core::request('items_per_page', 10);
     $pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $orders->count_all(), 'items_per_page' => $items_per_page))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
     $pagination->title($this->template->title);
     $orders = $orders->limit($items_per_page)->offset($pagination->offset)->find_all();
     $pagination = $pagination->render();
     $products = new Model_Product();
     $products = $products->find_all();
     $this->render('oc-panel/pages/order/index', array('orders' => $orders, 'pagination' => $pagination, 'products' => $products));
 }
示例#15
0
 /**
  * Handle GET requests.
  */
 public function action_device()
 {
     try {
         $result = FALSE;
         if (($license = $this->request->param('id')) != NULL) {
             $device_id = Core::request('device_id');
             if ($license != NULL and $device_id != NULL) {
                 $result = Model_License::verify_device($license, $device_id);
             }
         }
         $this->rest_output(array('valid' => $result));
     } catch (Kohana_HTTP_Exception $khe) {
         $this->_error($khe);
     }
 }
示例#16
0
 public function action_fail()
 {
     $this->auto_render = FALSE;
     $id_order = Core::request('InvId');
     //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()) {
         // The card has been declined
         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'));
     }
 }
示例#17
0
 /**
  * action to download a zip file directly form the API
  * @return [type] [description]
  */
 public function action_download()
 {
     $this->auto_render = FALSE;
     $license = $this->request->param('id');
     $domain = Core::request('domain');
     if ($license != NULL and $domain != NULL) {
         //ok, let's download the zip file if validated license
         if (Model_License::verify($license, $domain) === TRUE) {
             $license = Model_License::get_license($license);
             if ($license->loaded()) {
                 $license->order->download();
             }
         }
     }
     //by default return false since downlaod could not be done
     $this->response->headers('Content-type', 'application/javascript');
     $this->response->body(json_encode(FALSE));
 }
示例#18
0
 public static function view($tpl_folder, $tpl_file, $display = true)
 {
     global $_LANG;
     if ($tpl_folder == 'admin') {
         $tpl_folder = PATH . '/app/components/' . self::$component . '/backend/views';
     } else {
         $is_exists_tpl_file = file_exists(TEMPLATE_DIR . $tpl_folder . '/' . $tpl_file);
         $tpl_folder = $is_exists_tpl_file ? TEMPLATE_DIR . $tpl_folder : DEFAULT_TEMPLATE_DIR . $tpl_folder;
     }
     $fenom = new RenderTemplate(new Fenom\Provider($tpl_folder));
     $fenom->setCompileDir(PATH . '/cache');
     $fenom->setCompileId(TEMPLATE . '_');
     $fenom->setOptions(array('strip' => true, 'auto_reload' => true));
     $fenom->addPluginsDir(__DIR__ . '/plugins/')->addPluginsDir(PATH . '/core/tpl_classes/plugins/fenom');
     $fenom->assignAll(['LANG' => $_LANG, 'is_ajax' => \Core::isAjax(), 'is_admin' => \User::getInstance()->is_admin, 'is_user' => \User::getInstance()->id, 'component' => \Core::getInstance()->component, 'do' => \Core::getInstance()->do, 'seo_link' => \Core::request('seolink', 'str', ''), 'site_cfg' => \Config::getInstance()->getConfig(), 'component_already' => \Page::getInstance()->page_body ? true : false, 'template' => TEMPLATE, 'template_dir' => trim(TEMPLATE_DIR, '/')]);
     if ($display) {
         $fenom->display($tpl_file, self::$tpl_vars);
     } else {
         return $fenom->fetch($tpl_file, self::$tpl_vars);
     }
 }
示例#19
0
 /**
  * Generates the redirect form input
  * @uses    Form
  * @param   string  url to redirect optional
  * @return  string  generated HTML
  */
 public static function redirect($url = NULL)
 {
     if ($url == NULL) {
         $url = Core::request('auth_redirect', URL::current());
     }
     if (Request::current()->controller() == 'auth') {
         $url = Request::current()->referrer();
     }
     //if (Session::instance()->get('auth_redirect')==NULL)
     Session::instance()->set('auth_redirect', $url);
     return Form::hidden('auth_redirect', $url);
 }
示例#20
0
						<dt><?php 
echo FORM::label('subject', __('Subject'), array('class' => 'control-label', 'for' => 'subject'));
?>
</dt>
						<dd><?php 
echo FORM::input('subject', Core::request('subject'), array('placeholder' => __('Subject'), 'class' => 'form-control', 'id' => 'subject'));
?>
</dd>
					</dl>
					<dl class="form-group">
						<dt><?php 
echo FORM::label('message', __('Message'), array('class' => 'control-label', 'for' => 'message'));
?>
</dt>
						<dd><?php 
echo FORM::textarea('message', Core::request('message'), array('class' => 'form-control', 'placeholder' => __('Message'), 'name' => 'message', 'id' => 'message', 'rows' => 7, 'required'));
?>
</dd>
					</dl>

					<?php 
if (core::config('advertisement.captcha') != FALSE) {
    ?>
						<dl class="form-group">
							<div class="captcha_box">
								<?php 
    if (Core::config('general.recaptcha_active')) {
        ?>
									<?php 
        echo Captcha::recaptcha_display();
        ?>
示例#21
0
 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     parent::__construct($request, $response);
     //filter fields filling the data for arrays
     foreach ($this->_filter_fields as $field => $value) {
         if (is_array($value) and isset($value['table']) and isset($value['type'])) {
             if ($value['type'] == 'DISTINCT') {
                 $result = array();
                 $query = DB::select($value['field'])->distinct(TRUE)->from($value['table'])->execute();
                 foreach ($query->as_array() as $k => $v) {
                     $result[current($v)] = current($v);
                 }
             } elseif ($value['type'] == 'SELECT') {
                 $key = $value['key'];
                 $val = $value['value'];
                 $result = array();
                 $query = DB::select($key)->select($val)->from($value['table'])->execute();
                 foreach ($query->as_array() as $k => $v) {
                     $k = $v[$key];
                     $result[$k] = $v[$val];
                 }
             }
             $this->_filter_fields[$field] = $result;
         }
     }
     //get the filters
     foreach (array_merge($_GET, $_POST) as $key => $value) {
         //with values
         if (isset($value) and $value != '') {
             //date between
             if (strpos($key, 'filter__from__') !== FALSE) {
                 $var = str_replace('filter__from__', '', $key);
                 $from = Core::request('filter__from__' . $var);
                 $to = Core::request('filter__to__' . $var);
                 //add it to the filter
                 if ($from != NULL and $to != NULL) {
                     $this->_filter_post[$var] = array($from, $to);
                 }
             } elseif (strpos($key, 'filter__') !== FALSE and strpos($key, 'filter__to__') === FALSE) {
                 $this->_filter_post[str_replace('filter__', '', $key)] = $value;
             }
         }
     }
 }
示例#22
0
                                    <button type="submit" class="btn btn-xs btn-danger">
                                        <span class="glyphicon glyphicon-minus"></span>
                                        <?php 
    echo __('Delete coupon');
    ?>
 '<?php 
    echo $order->coupon->name;
    ?>
'
                                    </button>
                                <?php 
} else {
    ?>
                                    <div class="form-group">
                                        <input class="form-control" type="text" name="coupon" value="<?php 
    echo Core::request('coupon');
    ?>
" placeholder="<?php 
    echo __('Coupon Name');
    ?>
">          
                                    </div>
                                        <button type="submit" class="btn btn-primary"><?php 
    echo __('Add');
    ?>
</button>
                                <?php 
}
?>
       
                            </form>
示例#23
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()));
 }
示例#24
0
 /**
  * [action_to_featured] [pay to go in featured]
  *
  */
 public function action_to_featured()
 {
     //check pay to featured top is enabled
     if (core::config('payment.to_featured') == FALSE) {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
     $id_product = Model_Order::PRODUCT_TO_FEATURED;
     //check ad exists
     $id_ad = $this->request->param('id');
     //how many days
     if (!is_numeric($days = Core::request('featured_days'))) {
         $plans = Model_Order::get_featured_plans();
         $days = array_keys($plans);
         $days = reset($days);
     }
     //get price for the days
     $amount = Model_Order::get_featured_price($days);
     $ad = new Model_Ad($id_ad);
     if ($ad->loaded()) {
         //case when payment is set to 0,gets featured for free...
         if ($amount <= 0) {
             $ad->featured = Date::unix2mysql(time() + $days * 24 * 60 * 60);
             try {
                 $ad->save();
             } catch (Exception $e) {
                 throw HTTP_Exception::factory(500, $e->getMessage());
             }
             $this->redirect(Route::url('list'));
         }
         $currency = core::config('payment.paypal_currency');
         $order = Model_Order::new_order($ad, $ad->user, $id_product, $amount, $currency, NULL, $days);
         // redirect to payment
         $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
     } else {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
示例#25
0
 public function action_replace()
 {
     $search = Core::request('search');
     $replace = Core::request('replace');
     $where = Core::request('where', 'original');
     $language = $this->language_fix($this->request->param('id'));
     //read original mo file to get the full array
     //read translated mo
     //get the translated ad not translated.
     //merge original with translated
     list($translation_array, $untranslated_array) = $this->get_translation($language);
     //array of new translations
     $data_translated = array();
     //for each item search
     foreach ($translation_array as $key => $values) {
         //replace if theres a match
         list($id, $original, $translated) = array_values($values);
         switch ($where) {
             case 'translation':
                 //found in the translated
                 if (strpos($translated, $search) !== FALSE) {
                     //add it to the new translations
                     $data_translated[$id] = str_replace($search, $replace, $translated);
                 }
                 break;
             case 'original':
                 //found in the original
                 if (strpos($original, $search) !== FALSE) {
                     //add it to the new translations
                     $data_translated[$id] = str_replace($search, $replace, $original);
                 }
                 break;
         }
     }
     if ($this->save_translation($language, $translation_array, $data_translated)) {
         Alert::set(Alert::SUCCESS, $language . ' ' . __('Language saved'));
     } else {
         Alert::set(Alert::ALERT, $language);
     }
     $this->redirect(Route::url('oc-panel', array('controller' => 'translations', 'action' => 'edit', 'id' => $language)));
 }
示例#26
0
    ?>
</dd>
													</dl>
												<?php 
}
?>
												<?php 
if (core::config('general.messaging') != TRUE) {
    ?>
													<dl class="form-group">
														<dt><?php 
    echo FORM::label('subject', _e('Subject'), array('class' => 'control-label', 'for' => 'subject'));
    ?>
</dt>
														<dd><?php 
    echo FORM::input('subject', Core::request('subject'), array('placeholder' => __('Subject'), 'class' => 'form-control', 'id' => 'subject'));
    ?>
</dd>
													</dl>
												<?php 
}
?>
												<dl class="form-group">
													<dt><?php 
echo FORM::label('message', _e('Message'), array('class' => 'control-label', 'for' => 'message'));
?>
</dt>
													<dd><?php 
echo FORM::textarea('message', Core::post('subject'), array('class' => 'form-control', 'placeholder' => __('Message'), 'name' => 'message', 'id' => 'message', 'rows' => 4, 'required'));
?>
</dd>
示例#27
0
 /**
  * 
  * NEW ADVERTISEMENT 
  * 
  */
 public function action_index()
 {
     //Detect early spam users, show him alert
     if (core::config('general.black_list') == TRUE and Model_User::is_spam(Core::post('email')) === TRUE) {
         Alert::set(Alert::ALERT, __('Your profile has been disable for posting, due to recent spam content! If you think this is a mistake please contact us.'));
         $this->redirect('default');
     }
     //advertisement.only_admin_post
     if (Core::config('advertisement.only_admin_post') == 1 and (!Auth::instance()->logged_in() or Auth::instance()->logged_in() and Auth::instance()->get_user()->id_role != Model_Role::ROLE_ADMIN)) {
         $this->redirect('default');
     }
     if (Core::post('ajaxValidateCaptcha')) {
         $this->auto_render = FALSE;
         $this->template = View::factory('js');
         if (captcha::check('publish_new', TRUE)) {
             $this->template->content = 'true';
         } else {
             $this->template->content = 'false';
         }
         return;
     }
     //template header
     $this->template->title = __('Publish new advertisement');
     $this->template->meta_description = __('Publish new advertisement');
     $this->template->styles = array('css/jquery.sceditor.default.theme.min.css' => 'screen', 'css/jasny-bootstrap.min.css' => 'screen', '//cdn.jsdelivr.net/sweetalert/0.1.2/sweet-alert.min.css' => 'screen');
     $this->template->scripts['footer'][] = 'js/jquery.sceditor.bbcode.min.js';
     $this->template->scripts['footer'][] = 'js/jasny-bootstrap.min.js';
     $this->template->scripts['footer'][] = 'js/jquery.chained.min.js';
     $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/sweetalert/0.1.2/sweet-alert.min.js';
     $this->template->scripts['footer'][] = '//cdnjs.cloudflare.com/ajax/libs/ouibounce/0.0.10/ouibounce.min.js';
     if (core::config('advertisement.map_pub_new')) {
         $this->template->scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7';
         $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js';
     }
     $this->template->scripts['footer'][] = 'js/new.js?v=' . Core::VERSION;
     // redirect to login, if conditions are met
     if (core::config('advertisement.login_to_post') == TRUE and !Auth::instance()->logged_in()) {
         Alert::set(Alert::INFO, __('Please, login before posting advertisement!'));
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'auth', 'action' => 'login')));
     }
     //find all, for populating form select fields
     $categories = Model_Category::get_as_array();
     $order_categories = Model_Category::get_multidimensional();
     $order_parent_deep = Model_Category::get_by_deep();
     // NO categories redirect ADMIN to categories panel
     if (count($order_categories) == 0) {
         if (Auth::instance()->logged_in() and Auth::instance()->get_user()->id_role == Model_Role::ROLE_ADMIN) {
             Alert::set(Alert::INFO, __('Please, first create some categories.'));
             $this->redirect(Route::url('oc-panel', array('controller' => 'category', 'action' => 'index')));
         } else {
             Alert::set(Alert::INFO, __('Posting advertisements is not yet available.'));
             $this->redirect('default');
         }
     }
     //get locations
     $locations = Model_Location::get_as_array();
     $order_locations = Model_Location::get_multidimensional();
     $loc_parent_deep = Model_Location::get_by_deep();
     // bool values from DB, to show or hide this fields in view
     $form_show = array('captcha' => core::config('advertisement.captcha'), 'website' => core::config('advertisement.website'), 'phone' => core::config('advertisement.phone'), 'location' => core::config('advertisement.location'), 'address' => core::config('advertisement.address'), 'price' => core::config('advertisement.price'));
     $id_category = NULL;
     $selected_category = new Model_Category();
     //if theres a category by post or by get
     if (Core::request('category') !== NULL) {
         if (is_numeric(Core::request('category'))) {
             $selected_category->where('id_category', '=', core::request('category'))->limit(1)->find();
         } else {
             $selected_category->where('seoname', '=', core::request('category'))->limit(1)->find();
         }
         if ($selected_category->loaded()) {
             $id_category = $selected_category->id_category;
         }
     }
     $id_location = NULL;
     $selected_location = new Model_Location();
     //if theres a location by post or by get
     if (Core::request('location') !== NULL) {
         if (is_numeric(Core::request('location'))) {
             $selected_location->where('id_location', '=', core::request('location'))->limit(1)->find();
         } else {
             $selected_location->where('seoname', '=', core::request('location'))->limit(1)->find();
         }
         if ($selected_location->loaded()) {
             $id_location = $selected_location->id_location;
         }
     }
     //render view publish new
     $this->template->content = View::factory('pages/ad/new', array('categories' => $categories, 'order_categories' => $order_categories, 'order_parent_deep' => $order_parent_deep, 'locations' => $locations, 'order_locations' => $order_locations, 'loc_parent_deep' => $loc_parent_deep, 'form_show' => $form_show, 'id_category' => $id_category, 'selected_category' => $selected_category, 'id_location' => $id_location, 'selected_location' => $selected_location, 'fields' => Model_Field::get_all()));
     if ($this->request->post()) {
         if (captcha::check('publish_new')) {
             $data = $this->request->post();
             $validation = Validation::factory($data);
             //validate location since its optional
             if (core::config('advertisement.location')) {
                 if (count($locations) > 1) {
                     $validation = $validation->rule('location', 'not_empty')->rule('location', 'digit');
                 }
             }
             //user is not logged in validate input
             if (!Auth::instance()->logged_in()) {
                 $validation = $validation->rule('email', 'not_empty')->rule('email', 'email')->rule('name', 'not_empty')->rule('name', 'min_length', array(':value', 2))->rule('name', 'max_length', array(':value', 145));
             }
             if ($validation->check()) {
                 // User detection, if doesnt exists create
                 if (!Auth::instance()->logged_in()) {
                     $user = Model_User::create_email(core::post('email'), core::post('name'));
                 } else {
                     $user = Auth::instance()->get_user();
                 }
                 //to make it backward compatible with older themes: UGLY!!
                 if (isset($data['category']) and is_numeric($data['category'])) {
                     $data['id_category'] = $data['category'];
                     unset($data['category']);
                 }
                 if (isset($data['location']) and is_numeric($data['location'])) {
                     $data['id_location'] = $data['location'];
                     unset($data['location']);
                 }
                 //lets create!!
                 $return = Model_Ad::new_ad($data, $user);
                 //there was an error on the validation
                 if (isset($return['validation_errors']) and is_array($return['validation_errors'])) {
                     foreach ($return['validation_errors'] as $f => $err) {
                         Alert::set(Alert::ALERT, $err);
                     }
                 } elseif (isset($return['error'])) {
                     Alert::set($return['error_type'], $return['error']);
                 } elseif (isset($return['message']) and isset($return['ad'])) {
                     $new_ad = $return['ad'];
                     // IMAGE UPLOAD
                     $filename = NULL;
                     for ($i = 0; $i < core::config('advertisement.num_images'); $i++) {
                         if (isset($_FILES['image' . $i])) {
                             $filename = $new_ad->save_image($_FILES['image' . $i]);
                         }
                         if ($filename) {
                             $new_ad->has_images++;
                         }
                     }
                     //since theres images save the ad again...
                     if ($new_ad->has_images > 0) {
                         try {
                             $new_ad->save();
                         } catch (Exception $e) {
                             throw HTTP_Exception::factory(500, $e->getMessage());
                         }
                     }
                     Alert::set(Alert::SUCCESS, $return['message']);
                     //redirect user
                     if (isset($return['checkout_url']) and !empty($return['checkout_url'])) {
                         $this->redirect($return['checkout_url']);
                     } else {
                         $this->redirect(Route::url('default', array('action' => 'thanks', 'controller' => 'ad', 'id' => $new_ad->id_ad)));
                     }
                 }
             } else {
                 $errors = $validation->errors('ad');
                 foreach ($errors as $f => $err) {
                     Alert::set(Alert::ALERT, $err);
                 }
             }
         } else {
             Alert::set(Alert::ALERT, __('Captcha is not correct'));
         }
     }
 }
示例#28
0
文件: files.php 项目: novayadi85/CBR
 function find_all_files($dir)
 {
     $root = scandir($dir);
     $req = false;
     $request = Core::request();
     // print_r($request);
     if ($request) {
         $from = $request['from'] ? $request['from'] : '2000';
         $to = $request['to'] ? $request['to'] : date("Y");
         $jenis = $request['jenis'];
         $penulis = strtolower($request['penulis']);
         $aSql = array();
         // if($tahun != 0){
         // $aSql[]= " `year` = $tahun ";
         // }
         if ($penulis) {
             $aSql[] = " `writer_1` LIKE '%{$penulis}' OR `writer_2` LIKE '%{$penulis}'";
         }
         if ($jenis) {
             $aSql[] = " `jenis` = '{$jenis}' ";
         }
         // print_r($aSql);
         $ndb = new DB();
         $sql = "SELECT `filetext` FROM `jurnals`";
         if (count($aSql)) {
             $where_clause = implode(' AND ', $aSql);
             $where_clause .= " AND `year` between {$from} and {$to}";
             $sql .= " WHERE " . $where_clause;
         } else {
             $where_clause .= " `year` between {$from} and {$to}";
             $sql .= " WHERE " . $where_clause;
         }
         // echo $sql;
         // exit();
         $Jurnals = $ndb->query($sql);
         $_Jurnals = $Jurnals;
         if (!empty($_Jurnals)) {
             foreach ($_Jurnals as $k => $_Jurnal) {
                 $filetext[] = $_Jurnal['filetext'];
             }
         }
     }
     // echo '<pre>';
     // print_r($filetext);
     // echo '</pre>';
     // exit();
     foreach ($root as $value) {
         if ($value === '.' || $value === '..') {
             continue;
         }
         if (!in_array($value, $filetext)) {
             continue;
         }
         if (is_file("{$dir}/{$value}")) {
             $result[] = "{$dir}/{$value}";
             continue;
         }
         foreach ($this->find_all_files("{$dir}/{$value}") as $value) {
             $result[] = $value;
         }
     }
     // echo '<pre>';
     // print_r($result);
     // echo '</pre>';
     return $result;
 }
示例#29
0
 /**
  * 
  * NEW ADVERTISEMENT 
  * 
  */
 public function action_index()
 {
     //advertisement.only_admin_post
     if (Core::config('advertisement.only_admin_post') == TRUE and (!Auth::instance()->logged_in() or Auth::instance()->logged_in() and !$this->user->is_admin())) {
         $this->redirect(Route::url('default'));
     } elseif ((Core::config('advertisement.login_to_post') == TRUE or Core::config('payment.stripe_connect') == TRUE or Core::config('general.subscriptions') == TRUE) and !Auth::instance()->logged_in()) {
         Alert::set(Alert::INFO, __('Please, login before posting advertisement!'));
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'auth', 'action' => 'login')) . '?auth_redirect=' . URL::current());
     } elseif (core::config('general.black_list') == TRUE and Model_User::is_spam(Core::post('email')) === TRUE) {
         Alert::set(Alert::ALERT, __('Your profile has been disable for posting, due to recent spam content! If you think this is a mistake please contact us.'));
         $this->redirect(Route::url('default'));
     } elseif (Core::config('payment.stripe_connect') == TRUE and empty($this->user->stripe_user_id)) {
         Alert::set(Alert::INFO, __('Please, connect with Stripe'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'edit')));
     } elseif (Core::config('general.subscriptions') == TRUE and Theme::get('premium') == TRUE) {
         $subscription = $this->user->subscription();
         //if theres no subscription or expired or without free ads
         if (!$subscription->loaded() or $subscription->loaded() and (Date::mysql2unix($subscription->expire_date) < time() or $subscription->amount_ads_left == 0)) {
             Alert::set(Alert::INFO, __('Please, choose a plan first'));
             HTTP::redirect(Route::url('pricing'));
         }
     }
     //validates captcha
     if (Core::post('ajaxValidateCaptcha')) {
         $this->auto_render = FALSE;
         $this->template = View::factory('js');
         if (captcha::check('publish_new', TRUE)) {
             $this->template->content = 'true';
         } else {
             $this->template->content = 'false';
         }
         return;
     }
     Controller::$full_width = TRUE;
     //template header
     $this->template->title = __('Publish new advertisement');
     $this->template->meta_description = __('Publish new advertisement');
     $this->template->styles = array('css/jquery.sceditor.default.theme.min.css' => 'screen', 'css/jasny-bootstrap.min.css' => 'screen', '//cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.1/css/selectize.bootstrap3.min.css' => 'screen', '//cdn.jsdelivr.net/sweetalert/1.1.3/sweetalert.css' => 'screen');
     $this->template->scripts['footer'][] = 'js/jquery.sceditor.bbcode.min.js';
     $this->template->scripts['footer'][] = 'js/jasny-bootstrap.min.js';
     $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/sweetalert/1.1.3/sweetalert.min.js';
     $this->template->scripts['footer'][] = '//cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.1/js/standalone/selectize.min.js';
     $this->template->scripts['footer'][] = '//cdnjs.cloudflare.com/ajax/libs/ouibounce/0.0.10/ouibounce.min.js';
     $this->template->scripts['footer'][] = 'js/canvasResize.js';
     if (core::config('advertisement.map_pub_new')) {
         $this->template->scripts['async_defer'][] = '//maps.google.com/maps/api/js?libraries=geometry&v=3&key=' . core::config("advertisement.gm_api_key") . '&callback=initLocationsGMap';
     }
     $this->template->scripts['footer'][] = 'js/new.js?v=' . Core::VERSION;
     $categories = new Model_Category();
     $categories = $categories->where('id_category_parent', '=', '1');
     // NO categories redirect ADMIN to categories panel
     if ($categories->count_all() == 0) {
         if (Auth::instance()->logged_in() and Auth::instance()->get_user()->is_admin()) {
             Alert::set(Alert::INFO, __('Please, first create some categories.'));
             $this->redirect(Route::url('oc-panel', array('controller' => 'category', 'action' => 'index')));
         } else {
             Alert::set(Alert::INFO, __('Posting advertisements is not yet available.'));
             $this->redirect(Route::url('default'));
         }
     }
     //get locations
     $locations = new Model_Location();
     $locations = $locations->where('id_location', '!=', '1');
     // bool values from DB, to show or hide this fields in view
     $form_show = array('captcha' => core::config('advertisement.captcha'), 'website' => core::config('advertisement.website'), 'phone' => core::config('advertisement.phone'), 'location' => core::config('advertisement.location'), 'description' => core::config('advertisement.description'), 'address' => core::config('advertisement.address'), 'price' => core::config('advertisement.price'));
     $id_category = NULL;
     $selected_category = new Model_Category();
     //if theres a category by post or by get
     if (Core::request('category') !== NULL) {
         if (is_numeric(Core::request('category'))) {
             $selected_category->where('id_category', '=', core::request('category'))->limit(1)->find();
         } else {
             $selected_category->where('seoname', '=', core::request('category'))->limit(1)->find();
         }
         if ($selected_category->loaded()) {
             $id_category = $selected_category->id_category;
         }
     }
     $id_location = NULL;
     $selected_location = new Model_Location();
     //if theres a location by post or by get
     if (Core::request('location') !== NULL) {
         if (is_numeric(Core::request('location'))) {
             $selected_location->where('id_location', '=', core::request('location'))->limit(1)->find();
         } else {
             $selected_location->where('seoname', '=', core::request('location'))->limit(1)->find();
         }
         if ($selected_location->loaded()) {
             $id_location = $selected_location->id_location;
         }
     }
     //render view publish new
     $this->template->content = View::factory('pages/ad/new', array('form_show' => $form_show, 'id_category' => $id_category, 'selected_category' => $selected_category, 'id_location' => $id_location, 'selected_location' => $selected_location, 'fields' => Model_Field::get_all()));
     if ($this->request->post()) {
         if (captcha::check('publish_new')) {
             $data = $this->request->post();
             $validation = Validation::factory($data);
             //validate location since its optional
             if (core::config('advertisement.location')) {
                 if ($locations->count_all() > 1) {
                     $validation = $validation->rule('location', 'not_empty')->rule('location', 'digit');
                 }
             }
             //user is not logged in validate input
             if (!Auth::instance()->logged_in()) {
                 $validation = $validation->rule('email', 'not_empty')->rule('email', 'email')->rule('email', 'email_domain')->rule('name', 'not_empty')->rule('name', 'min_length', array(':value', 2))->rule('name', 'max_length', array(':value', 145));
             }
             // Optional banned words validation
             if (core::config('advertisement.validate_banned_words')) {
                 $validation = $validation->rule('title', 'no_banned_words');
                 $validation = $validation->rule('description', 'no_banned_words');
             }
             if ($validation->check()) {
                 // User detection, if doesnt exists create
                 if (!Auth::instance()->logged_in()) {
                     $user = Model_User::create_email(core::post('email'), core::post('name'));
                 } else {
                     $user = Auth::instance()->get_user();
                 }
                 //to make it backward compatible with older themes: UGLY!!
                 if (isset($data['category']) and is_numeric($data['category'])) {
                     $data['id_category'] = $data['category'];
                     unset($data['category']);
                 }
                 if (isset($data['location']) and is_numeric($data['location'])) {
                     $data['id_location'] = $data['location'];
                     unset($data['location']);
                 }
                 //lets create!!
                 $return = Model_Ad::new_ad($data, $user);
                 //there was an error on the validation
                 if (isset($return['validation_errors']) and is_array($return['validation_errors'])) {
                     foreach ($return['validation_errors'] as $f => $err) {
                         Alert::set(Alert::ALERT, $err);
                     }
                 } elseif (isset($return['error'])) {
                     Alert::set($return['error_type'], $return['error']);
                 } elseif (isset($return['message']) and isset($return['ad'])) {
                     $new_ad = $return['ad'];
                     // IMAGE UPLOAD
                     $filename = NULL;
                     for ($i = 0; $i < core::config('advertisement.num_images'); $i++) {
                         if (Core::post('base64_image' . $i)) {
                             $filename = $new_ad->save_base64_image(Core::post('base64_image' . $i));
                         } elseif (isset($_FILES['image' . $i])) {
                             $filename = $new_ad->save_image($_FILES['image' . $i]);
                         }
                     }
                     Alert::set(Alert::SUCCESS, $return['message']);
                     //redirect user
                     if (isset($return['checkout_url']) and !empty($return['checkout_url'])) {
                         $this->redirect($return['checkout_url']);
                     } else {
                         $this->redirect(Route::url('default', array('action' => 'thanks', 'controller' => 'ad', 'id' => $new_ad->id_ad)));
                     }
                 }
             } else {
                 $errors = $validation->errors('ad');
                 foreach ($errors as $f => $err) {
                     Alert::set(Alert::ALERT, $err);
                 }
             }
         } else {
             Alert::set(Alert::ALERT, __('Captcha is not correct'));
         }
     }
 }
示例#30
0
">
                    <i class="glyphicon glyphicon-home"></i> <?php 
    echo _e('Visit Site');
    ?>
                </a>
            </li>
            <?php 
    if (Auth::instance()->get_user()->is_admin() or Auth::instance()->get_user()->is_moderator() or Auth::instance()->get_user()->is_translator()) {
        ?>
                <li class="divider"></li>
                <li class="dropdown-header"><?php 
        echo _e('Live translator');
        ?>
</li>
                <?php 
        if (Core::request('edit_translation') == '1') {
            ?>
                    <li>
                        <a href="?edit_translation=0">
                            <i class="fa fa-globe"></i> <?php 
            echo __('Disable');
            ?>
                        </a>
                    </li>
                <?php 
        } else {
            ?>
                    <li>
                        <a href="?edit_translation=1">
                            <i class="fa fa-globe"></i> <?php 
            echo __('Enable');