Ejemplo n.º 1
0
 function index()
 {
     $model = new Model_Content();
     $content = $model->getContent();
     $this->template->vars('content', $content);
     $this->template->view('index');
 }
Ejemplo n.º 2
0
 public function action_news()
 {
     $slug = $this->request->param('slug');
     $pageData = $this->newsModel->findNews(null, null, $slug == 'all' ? null : $slug, 'all');
     $content = $this->contentModel->getContent('news', $pageData);
     $footer = View::factory('footer')->set('pagesImgs', []);
     $this->template->set('content', $content)->set('footer', $footer);
     $this->response->body($this->template);
 }
Ejemplo n.º 3
0
 public function action_project()
 {
     $slug = $this->request->param('id');
     $pageData = Arr::get($this->contentModel->findPortfolioProject(null, null, $slug), 0, []);
     $view = 'page';
     $content = $this->contentModel->getContent($view, $pageData)->set('projectGalleryImgs', $this->contentModel->findProjectImgs(Arr::get($pageData, 'id'), null, null, 1));
     $footer = '';
     $this->template->set('content', $content)->set('footer', $footer);
     $this->response->body($this->template);
 }
Ejemplo n.º 4
0
 public function action_index()
 {
     $data["trial"] = Model_Content::find("all", ["where" => [["type_id", -1], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $data["enchant"] = Model_Content::find("all", ["where" => [["type_id", 0], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $view = View::forge("teachers/textbooks", $data);
     $this->template->content = $view;
 }
Ejemplo n.º 5
0
 /**
  * action product goal after buying
  * @return void 
  */
 public function action_goal()
 {
     if (!Auth::instance()->logged_in()) {
         $this->redirect(Route::get('oc-panel')->uri());
     }
     $user = Auth::instance()->get_user();
     $order = new Model_Order();
     $order->where('id_order', '=', $this->request->param('id'))->where('id_user', '=', $user->id_user)->limit(1)->find();
     if ($order->loaded()) {
         $product = $order->product;
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
         Breadcrumbs::add(Breadcrumb::factory()->set_title($product->category->name)->set_url(Route::url('list', array('category' => $product->category->seoname))));
         Breadcrumbs::add(Breadcrumb::factory()->set_title($product->title)->set_url(Route::url('product', array('seotitle' => $product->seotitle, 'category' => $product->category->seoname))));
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Thanks')));
         $this->template->title = $product->title . ' - ' . $product->category->name;
         $this->template->meta_description = $product->description;
         $thanks_message = NULL;
         if (core::config('payment.thanks_page') != '') {
             $thanks_message = Model_Content::get_by_title(core::config('payment.thanks_page'));
         }
         $this->template->bind('content', $content);
         $this->template->content = View::factory('pages/product/goal', array('product' => $product, 'thanks_message' => $thanks_message, 'order' => $order, 'price_paid' => $order->amount));
     } else {
         Alert::set(Alert::INFO, __('Order not found.'));
         $this->redirect(Route::url('default'));
     }
 }
Ejemplo n.º 6
0
 public function action_index()
 {
     $data["trial"] = Model_Content::find("all", ["where" => [["type_id", -1], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $data["enchantJS"] = Model_Content::find("all", ["where" => [["type_id", 0], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $data["count_text_enchant"] = Model_Content::find("all", ["where" => [["type_id", 0], ["deleted_at", 0], ["text_type_id", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $data["user"] = $this->user;
     $data["count_enchant"] = Model_Lessontime::count(["where" => [["language", 0], ["student_id", $this->user->id], ["status", 2], ["deleted_at", 0]]]);
     $data["done_html"] = Model_Lessontime::count(["where" => [["student_id", $this->user->id], ["status", 2], ["language", 0]]]);
     $data["pasts"] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", 0)], ["deleted_at", 0]]]);
     $data["donetrial"] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", -1)], ["deleted_at", 0]]]);
     $view = View::forge("students/textbooks", $data);
     $this->template->content = $view;
 }
Ejemplo n.º 7
0
 /**
  * This function will upgrate DB that didn't existed in verisons below 2.0.5 
  * changes added: subscription widget, new email content, map zoom, paypal seller etc..  
  */
 public function action_205()
 {
     // build array with new (missing) configs
     $configs = array(array('config_key' => 'paypal_seller', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'map_zoom', 'group_name' => 'advertisement', 'config_value' => '16'), array('config_key' => 'center_lon', 'group_name' => 'advertisement', 'config_value' => '3'), array('config_key' => 'center_lat', 'group_name' => 'advertisement', 'config_value' => '40'), array('config_key' => 'new_ad_notify', 'group_name' => 'email', 'config_value' => '0'));
     $contents = array(array('order' => '0', 'title' => 'Advertisement `[AD.TITLE]` is created on [SITE.NAME]!', 'seotitle' => 'ads.subscribers', 'description' => "Hello [USER.NAME],\n\nYou may be interested in this one [AD.TITLE]!\n\nYou can visit this link to see advertisement [URL.AD]", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'Advertisement `[AD.TITLE]` is created on [SITE.NAME]!', 'seotitle' => 'ads.to_admin', 'description' => "Click here to visit [URL.AD]", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'));
     // returns TRUE if some config is saved
     $return_conf = Model_Config::config_array($configs);
     $return_cont = Model_Content::content_array($contents);
     $prefix = Database::instance()->table_prefix();
     $config_db = Kohana::$config->load('database');
     $charset = $config_db['default']['charset'];
     /*
       @todo NOT DINAMIC, get charset
     */
     mysql_query("CREATE TABLE IF NOT EXISTS `" . $prefix . "subscribers` (\n                    `id_subscribe` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                    `id_user` int(10) unsigned NOT NULL,\n                    `id_category` int(10) unsigned NOT NULL DEFAULT '0',\n                    `id_location` int(10) unsigned NOT NULL DEFAULT '0',\n                    `min_price` decimal(14,3) NOT NULL DEFAULT '0',\n                    `max_price` decimal(14,3) NOT NULL DEFAULT '0',\n                    `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n                    PRIMARY KEY (`id_subscribe`)\n                  ) ENGINE=MyISAM DEFAULT CHARSET=" . $charset . ";");
     // remove INDEX from content table
     mysql_query("ALTER TABLE `" . $prefix . "content` DROP INDEX `" . $prefix . "content_UK_seotitle`");
 }
Ejemplo n.º 8
0
 /**
  *
  * Display single faq
  * @throws HTTP_Exception_404
  */
 public function action_view($seotitle)
 {
     $faq = Model_Content::get_by_title($seotitle, 'help');
     if ($faq->loaded()) {
         Breadcrumbs::add(Breadcrumb::factory()->set_title($faq->title));
         $this->template->title = $faq->title . ' - ' . __(' Frequently Asked Questions - FAQ');
         $this->template->meta_description = $faq->description . ' - ' . __(' Frequently Asked Questions - FAQ');
         $this->template->bind('content', $content);
         if ($faq->status == 1 and strlen(core::config('general.faq_disqus')) > 0) {
             $disqus = View::factory('pages/disqus', array('disqus' => core::config('general.faq_disqus')));
         } else {
             $disqus = '';
         }
         $this->template->content = View::factory('pages/faq/single', array('faq' => $faq, 'disqus' => $disqus));
     } else {
         //throw 404
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
Ejemplo n.º 9
0
 /**
  *
  * Display single page
  * @throws HTTP_Exception_404
  */
 public function action_view()
 {
     $seotitle = $this->request->param('seotitle', NULL);
     if ($seotitle !== NULL) {
         $page = Model_Content::get_by_title($seotitle);
         if ($page->loaded()) {
             Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
             Breadcrumbs::add(Breadcrumb::factory()->set_title($page->title));
             $this->template->title = $page->title;
             $this->template->meta_description = $page->description;
             $this->template->bind('content', $content);
             $this->template->content = View::factory('page', array('page' => $page));
         } else {
             //throw 404
             throw HTTP_Exception::factory(404, __('Page not found'));
         }
     } else {
         //throw 404
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
Ejemplo n.º 10
0
 /**
  * affiliate configuration can be configured here
  * @return [view] Renders view with form inputs
  */
 public function action_affiliates()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Affiliates')));
     $this->template->title = __('Affiliates');
     $this->template->scripts['footer'][] = 'js/jquery.validate.min.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/settings.js';
     // all form config values
     $paymentconf = new Model_Config();
     $config = $paymentconf->where('group_name', '=', 'affiliate')->find_all();
     // save only changed values
     if ($this->request->post()) {
         $validation = Validation::factory($this->request->post())->rule('active', 'range', array(':value', 0, 1))->rule('cookie', 'not_empty')->rule('cookie', 'digit')->rule('payment_days', 'not_empty')->rule('payment_days', 'digit')->rule('payment_min', 'not_empty')->rule('payment_min', 'digit');
         if ($validation->check()) {
             foreach ($config as $c) {
                 $config_res = $this->request->post($c->config_key);
                 if ($config_res != $c->config_value) {
                     $c->config_value = $config_res;
                     try {
                         $c->save();
                     } catch (Exception $e) {
                         echo $e;
                     }
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
             }
             $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'affiliates')));
         }
         Alert::set(Alert::SUCCESS, __('Affiliate Configuration updated'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'affiliates')));
     }
     $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/affiliates', array('config' => $config, 'pages' => $pages));
 }
Ejemplo n.º 11
0
<?php

defined('SYSPATH') or die('No direct script access.');
if (!isset($_COOKIE['accept_terms']) and core::config('general.alert_terms') != '') {
    ?>
<div id="accept_terms_modal" class="modal fade" data-backdrop="static">
	<?php 
    $content = Model_Content::get_by_title(core::config('general.alert_terms'));
    ?>
	<div class="modal-dialog">
	    <div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" onclick='location.href="http://www.google.com"' aria-hidden="true">&times;</button>
				<h1><?php 
    echo $content->title;
    ?>
</h1>
			</div>
			<div class="modal-body">
				<div class="text-description"><?php 
    echo Text::bb2html($content->description, TRUE, FALSE);
    ?>
</div>
			</div>
			<div class="modal-footer">
				<a name="decline_terms" class="btn btn-default" onclick='location.href="http://www.google.com"' ><?php 
    echo __('No');
    ?>
</a>
				<a name="accept_terms" class="btn btn-success" onclick='setCookie("accept_terms",1,10000)' data-dismiss="modal" aria-hidden="true"><?php 
    echo __('I accept');
Ejemplo n.º 12
0
            <div class="form-group">
                <?php 
echo FORM::label($forms['contact']['key'], __('Contact form'), array('class' => 'control-label col-sm-3', 'for' => $forms['contact']['key']));
?>
                <div class="col-sm-4">
                    <?php 
echo FORM::select($forms['contact']['key'], array(FALSE => "FALSE", TRUE => "TRUE"), $forms['contact']['value'], array('placeholder' => "", 'class' => 'tips form-control', 'id' => $forms['contact']['key'], 'data-content' => __("Enables Contact Form"), 'data-trigger' => "hover", 'data-placement' => "right", 'data-toggle' => "popover", 'data-original-title' => __("Contact form appears int he ad.")));
?>
 
                </div>
            </div>
			<?php 
$pages = array('' => __('Deactivated'));
?>
			<?php 
foreach (Model_Content::get_pages() as $key => $value) {
    $pages[$value->seotitle] = $value->title;
}
?>
			<div class="form-group">
				<?php 
echo FORM::label($forms['tos']['key'], "<a target='_blank' href='http://open-classifieds.com/2013/08/13/how_to_add_pages/'>" . __('Terms of Service') . "</a>", array('class' => 'control-label col-sm-3', 'for' => $forms['tos']['key']));
?>
				<div class="col-sm-4">
					<?php 
echo FORM::select($forms['tos']['key'], $pages, $forms['tos']['value'], array('placeholder' => "http://foo.com/", 'class' => 'tips form-control', 'id' => $forms['tos']['key'], 'data-content' => __("If you choose to use terms of service, you can select activate. And to edit content, select link 'Content' on your admin panel sidebar. Find page named 'Terms of service' click 'Edit'. In section 'Description' add content that suits you."), 'data-trigger' => "hover", 'data-placement' => "right", 'data-toggle' => "popover", 'data-original-title' => __("Terms of Service")));
?>
 
				</div>
			</div>
			<div class="form-group">
Ejemplo n.º 13
0
            echo $reservation->number;
            ?>
 / 12 Lessons
						<?php 
        } else {
            ?>
							<span class="icon-course1"><?php 
            echo Model_Lessontime::getCourse($reservation->language);
            ?>
</span>
						<?php 
        }
        ?>
					</div>
					<?php 
        $text = Model_Content::find("first", ["where" => [["number", $reservation->number], ["type_id", $reservation->language], ["text_type_id", 0], ["deleted_at", 0]]]);
        if ($text != null) {
            ?>
					<p class="textbook"><?php 
            echo Html::anchor("contents/{$text->path}", '<i class="fa fa-fw fa-book"></i> ', ["target" => "_blank"]);
            ?>
</p>
					<?php 
        }
        ?>
				</li>
				<?php 
    }
    ?>
			</ul>
			<?php 
Ejemplo n.º 14
0
 public function getByNid($nid)
 {
     $model = new Model_Content();
     return $model->getByNid($nid);
 }
Ejemplo n.º 15
0
 /**
  * action: DELETE
  */
 public function action_delete()
 {
     $this->auto_render = FALSE;
     $id = $this->request->param('id');
     $content = new Model_Content($id);
     $type = $content->type;
     $locale = $content->locale;
     if ($content->loaded()) {
         try {
             $content->delete();
             Cache::instance()->delete_all();
             $this->template->content = 'OK';
             Alert::set(Alert::SUCCESS, __('Content is deleted'));
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
     } else {
         Alert::set(Alert::INFO, __('Content is not deleted'));
     }
     Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'list')) . '?type=' . $type . '&locale_select=' . $locale);
 }
Ejemplo n.º 16
0
 /**
  * saves the content in a specific order
  * @return void 
  */
 public function action_saveorder()
 {
     $this->auto_render = FALSE;
     $this->template = View::factory('js');
     $locale = core::get('locale_select', core::config('i18n.locale'));
     if ($contents = Model_Content::get_contents(core::get('type'), $locale)) {
         $order = Core::get('order');
         //using order they send us
         foreach ($order as $key => $value) {
             $c = new Model_Content($value);
             $c->order = $key;
             $c->save();
         }
         Core::delete_cache();
         $this->template->content = __('Saved');
     } else {
         $this->template->content = __('Error');
     }
 }
Ejemplo n.º 17
0
 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     $this->page_items = Model_Content::get_pages();
 }
Ejemplo n.º 18
0
 /**
  * This function will upgrade configs that didn't existed in versions prior to 2.0.3 
  */
 public function action_203()
 {
     // build array with new (missing) configs
     $configs = array(array('config_key' => 'watermark', 'group_name' => 'image', 'config_value' => '0'), array('config_key' => 'watermark_path', 'group_name' => 'image', 'config_value' => ''), array('config_key' => 'watermark_position', 'group_name' => 'image', 'config_value' => '0'), array('config_key' => 'ads_in_home', 'group_name' => 'advertisement', 'config_value' => '0'));
     $contents = array(array('order' => '0', 'title' => 'Hello [USER.NAME]!', 'seotitle' => 'user-profile-contact', 'description' => "User [EMAIL.SENDER] [EMAIL.FROM], have a message for you: \n\n [EMAIL.SUBJECT] \n\n[EMAIL.BODY]. \n\n Regards!", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'));
     // returns TRUE if some config is saved
     $return_conf = Model_Config::config_array($configs);
     $return_cont = Model_Content::content_array($contents);
 }
Ejemplo n.º 19
0
 /**
  * sends an email using content from model_content
  * @param  string $to        
  * @param  string $to_name   
  * @param  string $from      
  * @param  string $from_name 
  * @param  string $content   seotitle from Model_Content
  * @param  array $replace   key value to replace at subject and body
  * @param  array $file      file to attach to email
  * @return boolean            s
  */
 public static function content($to, $to_name = '', $from = NULL, $from_name = NULL, $content, $replace, $file = NULL)
 {
     $email = Model_Content::get_by_title($content, 'email');
     //content found
     if ($email->loaded()) {
         if ($replace === NULL) {
             $replace = array();
         }
         if ($from === NULL) {
             $from = $email->from_email;
         }
         if ($from_name === NULL) {
             $from_name = core::config('general.site_name');
         }
         if (isset($file) and self::is_valid_file($file)) {
             $file_upload = $file;
         } else {
             $file_upload = NULL;
         }
         //adding extra replaces
         $replace += array('[SITE.NAME]' => core::config('general.site_name'), '[SITE.URL]' => core::config('general.base_url'), '[USER.NAME]' => $to_name);
         if (!is_array($to)) {
             $replace += array('[USER.EMAIL]' => $to);
         }
         //adding anchor tags to any [URL.* match
         foreach ($replace as $key => $value) {
             if (strpos($key, '[URL.') === 0 or $key == '[SITE.URL]' and $value != '') {
                 $replace[$key] = '<a href="' . $value . '">' . parse_url($value, PHP_URL_HOST) . '</a>';
             }
         }
         $subject = str_replace(array_keys($replace), array_values($replace), $email->title);
         $body = str_replace(array_keys($replace), array_values($replace), $email->description);
         return Email::send($to, $to_name, $subject, $body, $from, $from_name, $file_upload);
     } else {
         return FALSE;
     }
 }
Ejemplo n.º 20
0
 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     $pages = new Model_Content();
     $pages = $pages->select('seotitle', 'title')->where('type', '=', 'page')->where('status', '=', 1)->order_by('order', 'asc')->cached()->find_all();
     $this->page_items = Model_Content::get_pages();
 }
Ejemplo n.º 21
0
 public function post_changecontenttype()
 {
     $code = 0;
     $message = "ok";
     if ($this->auth_status) {
         $content = Model_Content::find(Input::post("id", 0));
         if ($content != null) {
             $content->type_id = Input::post("type_id", 0);
             $content->text_type_id = Input::post("text_type_id", 0);
             $content->exam = NULL;
             $content->save();
         } else {
             $code = 404;
             $message = "Content not found.";
         }
     } else {
         $code = 500;
         $message = "Auth error.";
     }
     $this->response(array('code' => $code, 'message' => $message));
 }
Ejemplo n.º 22
0
 public static function copy($from_locale, $to_locale, $type)
 {
     //get the contents for type locale
     $contents = Model_Content::get_contents($type, $to_locale);
     //only if theres no existent content
     if (count($contents) == 0) {
         $prefix = Database::instance()->table_prefix();
         $query = "INSERT INTO " . $prefix . "content (locale,`order`,title,seotitle,description,from_email,type,status)\n                        SELECT '" . $to_locale . "',`order`,title,seotitle,description,from_email,type,status\n                        FROM " . $prefix . "content\n                        WHERE type='" . $type . "' AND locale='" . $from_locale . "'";
         try {
             DB::query(Database::DELETE, $query)->execute();
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 23
0
 /**
  * This function will upgrade configs  
  */
 public function action_12()
 {
     //coupons product
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "coupons` ADD  `id_product` INT NULL DEFAULT NULL AFTER  `id_coupon`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "orders` ADD  `notes` VARCHAR( 245 ) NULL DEFAULT NULL")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "users` ADD  `signature` VARCHAR( 245 ) NULL DEFAULT NULL")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "visits` DROP  `contacted`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ADD  `id_post_parent` INT NULL DEFAULT NULL AFTER  `id_user`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ENGINE = MYISAM ")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "products` ADD `rate` FLOAT( 4, 2 ) NULL DEFAULT NULL ;")->execute();
     } catch (exception $e) {
     }
     DB::query(Database::UPDATE, "CREATE TABLE IF NOT EXISTS  `" . self::$db_prefix . "forums` (\n                      `id_forum` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                      `name` varchar(145) NOT NULL,\n                      `order` int(2) unsigned NOT NULL DEFAULT '0',\n                      `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n                      `id_forum_parent` int(10) unsigned NOT NULL DEFAULT '0',\n                      `parent_deep` int(2) unsigned NOT NULL DEFAULT '0',\n                      `seoname` varchar(145) NOT NULL,\n                      `description` varchar(255) NULL,\n                      PRIMARY KEY (`id_forum`) USING BTREE,\n                      UNIQUE KEY `" . self::$db_prefix . "forums_IK_seo_name` (`seoname`)\n                    ) ENGINE=MyISAM")->execute();
     DB::query(Database::UPDATE, "CREATE TABLE IF NOT EXISTS " . self::$db_prefix . "reviews (\n                    id_review int(10) unsigned NOT NULL AUTO_INCREMENT,\n                    id_user int(10) unsigned NOT NULL,\n                    id_order int(10) unsigned NOT NULL,\n                    id_product int(10) unsigned NOT NULL,\n                    rate int(2) unsigned NOT NULL DEFAULT '0',\n                    description varchar(1000) NOT NULL,\n                    created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                    ip_address float DEFAULT NULL,\n                    status tinyint(1) NOT NULL DEFAULT '0',\n                    PRIMARY KEY (id_review) USING BTREE,\n                    KEY " . self::$db_prefix . "reviews_IK_id_user (id_user),\n                    KEY " . self::$db_prefix . "reviews_IK_id_order (id_order),\n                    KEY " . self::$db_prefix . "reviews_IK_id_product (id_product)\n                    ) ENGINE=MyISAM;")->execute();
     // build array with new (missing) configs
     $configs = array(array('config_key' => 'minify', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'stripe_public', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'stripe_private', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'stripe_address', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'alternative', 'group_name' => 'payment', 'config_value' => ''), array('config_key' => 'related', 'group_name' => 'product', 'config_value' => '5'), array('config_key' => 'faq', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'faq_disqus', 'group_name' => 'general', 'config_value' => ''), array('config_key' => 'forums', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'reviews', 'group_name' => 'product', 'config_value' => '0'), array('config_key' => 'demo_theme', 'group_name' => 'product', 'config_value' => 'yeti'), array('config_key' => 'demo_resize', 'group_name' => 'product', 'config_value' => '1'));
     $contents = array(array('order' => '0', 'title' => '[EMAIL.SENDER] wants to contact you!', 'seotitle' => 'contact-admin', 'description' => "Hello Admin,\n\n [EMAIL.SENDER]: [EMAIL.FROM], have a message for you:\n\n [EMAIL.BODY] \n\n Regards!", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'Ticket assigned to you: [TITLE]', 'seotitle' => 'assign-agent', 'description' => '[URL.QL]\\n\\n[DESCRIPTION]', 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'New review for [TITLE] [RATE]', 'seotitle' => 'review-product', 'description' => '[URL.QL]\\n\\n[RATE]\\n\\n[DESCRIPTION]', 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'New support ticket created `[TITLE]`', 'seotitle' => 'new-ticket', 'description' => 'We have received your support inquiry. We will try to answer you within the next 24 working hours, thank you for your patience.\\n\\n[URL.QL]', 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'));
     // returns TRUE if some config is saved
     $return_conf = Model_Config::config_array($configs);
     $return_cont = Model_Content::content_array($contents);
 }
Ejemplo n.º 24
0
 /**
  * thanks for publish
  * @return [type] [description]
  */
 public function action_thanks()
 {
     $ad = new Model_Ad($this->request->param('id'));
     if ($ad->loaded()) {
         $page = Model_Content::get_by_title(Core::config('advertisement.thanks_page'));
         //template header
         $this->template->title = $page->loaded() ? $page->title : __('Thanks');
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
         Breadcrumbs::add(Breadcrumb::factory()->set_title($ad->title)->set_url(Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle))));
         Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
         $this->template->bind('content', $content);
         $this->template->content = View::factory('pages/ad/thanks', array('ad' => $ad, 'page' => $page));
     } else {
         //throw 404
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
Ejemplo n.º 25
0
    @media screen and (min-width: 768px) {
      /* Remove the bottom border on the jumbotron for visual effect */
      .jumbotron {
        border-bottom: 0;
      }
    }
    </style>

    <div class="container">

      <div class="jumbotron">
        <?php 
if (core::config('general.private_site_page') != '') {
    ?>
      <?php 
    $content = Model_Content::get_by_title(core::config('general.private_site_page'));
    ?>
      <div class="page-header">
        <h1><?php 
    echo $content->title;
    ?>
</h1>
      </div>
      <div class="text-description"><?php 
    echo $content->description;
    ?>
</div>
      <br>
    <?php 
} else {
    ?>
Ejemplo n.º 26
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()));
 }
Ejemplo n.º 27
0
<?php

defined('SYSPATH') or die('No direct script access.');
?>

<?php 
if (core::config('general.contact_page') != '') {
    ?>
	<?php 
    $content = Model_Content::get_by_title(core::config('general.contact_page'));
    ?>
	<div class="page-header">
		<h1><?php 
    echo $content->title;
    ?>
</h1>
	</div>
	<?php 
    echo $content->description;
    ?>
	<br>
<?php 
} else {
    ?>
	<div class="page-header">
		<h1><?php 
    echo __('Contact Us');
    ?>
</h1>
	</div>
<?php 
Ejemplo n.º 28
0
 /**
  * renders a modal with alternative paymethod instructions
  * @return string 
  */
 public function alternative_pay_button()
 {
     if ($this->loaded()) {
         if (core::config('payment.alternative') != '') {
             $content = Model_Content::get_by_title(core::config('payment.alternative'));
             return View::factory('pages/alternative_payment', array('content' => $content))->render();
         }
     }
     return FALSE;
 }
Ejemplo n.º 29
0
 public function action_index()
 {
     if (Input::post("t_id", 0) != 0) {
         $content = Model_Content::find(Input::post("t_id", 0));
         if ($content != null) {
             $content->text_type_id = Input::post("text_type_id", 0);
             $content->save();
         }
     }
     if (Input::post("n_id", 0) != 0) {
         $content = Model_Content::find(Input::post("n_id", 0));
         if ($content != null) {
             $content->number = Input::post("number", 0);
             $content->save();
         }
     }
     if (Input::post("e_id", 0) != 0) {
         $content = Model_Content::find(Input::post("e_id", 0));
         if ($content != null) {
             $content->exam = Input::post("course_val", 0);
             $content->text_type_id = 2;
             $content->save();
         }
     }
     // add
     if (Input::post("type", null) != null and Security::check_token()) {
         if (is_uploaded_file($_FILES["file"]["tmp_name"])) {
             $ext = explode(".", $_FILES["file"]["name"]);
             if (strtolower($ext[1]) == "pdf" or strtolower($ext[1]) == "doc" or strtolower($ext[1]) == "docx") {
                 $filename = str_replace("/", "", $_FILES["file"]["name"]);
                 $filepath = DOCROOT . "contents/" . $filename;
                 if (move_uploaded_file($_FILES["file"]["tmp_name"], $filepath)) {
                     chmod($filepath, 0644);
                     // save
                     $cs = Input::post("course");
                     $courses = NULL;
                     if (null != Input::post("course")) {
                         foreach ($cs as $course) {
                             $courses = $courses . $course;
                         }
                         $content = Model_Content::forge();
                         $content->path = $filename;
                         $content->type_id = Input::post("type");
                         $content->number = 0;
                         $content->text_type_id = 2;
                         $content->exam = $courses;
                         $content->save();
                     } else {
                         $content = Model_Content::forge();
                         $content->path = $filename;
                         $content->type_id = Input::post("type");
                         $content->number = Input::post("number");
                         $content->text_type_id = Input::post("text_type");
                         $content->exam = NULL;
                         $content->save();
                     }
                 } else {
                     Response::redirect("/admin/contents/?e=1");
                 }
             } else {
                 Response::redirect("/admin/contents/?e=1");
             }
         }
     }
     $where = [["deleted_at", 0]];
     if (Input::get("search_type", 0) != 0) {
         array_push($where, ["type_id" => Input::get("search_type", 0) - 1]);
     }
     $data["contents"] = Model_Content::find("all", ["where" => $where, "order_by" => [["type_id", "asc"], ["number", "asc"], ["text_type_id", "asc"]]]);
     $config = array('pagination_url' => "?search_type=" . Input::get("search_type", 0), 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 100, 'total_items' => count($data["contents"]));
     $data["pager"] = Pagination::forge('mypagination', $config);
     $data["contents"] = array_slice($data["contents"], $data["pager"]->offset, $data["pager"]->per_page);
     $view = View::forge("admin/contents/index", $data);
     $this->template->content = $view;
 }