Esempio n. 1
0
 public function post_subscribe()
 {
     \Fuel\Core\Lang::load("global");
     $email = Input::json("email");
     if ($email !== null && preg_match("/^[a-zA-Z0-9.!#\$%&\"*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\$/", $email) === 1) {
         // Call API
         $api = new \Libraries\Api();
         $return = $api->executeAPIMethod("POST", "newsletters", array("email" => $email));
         // Success/error
         if ($return["code"] == 200) {
             // Success
             $this->jsonSuccess(\Fuel\Core\Lang::get("subscribe_to_newsletter.success"), array("apiReturn" => $return));
         } else {
             if ($return["code"] == 412) {
                 $this->jsonSuccess(\Fuel\Core\Lang::get("subscribe_to_newsletter.already_subscribed"));
             } else {
                 // Error...
                 $this->jsonError(\Fuel\Core\Lang::get("subscribe_to_newsletter.error"));
             }
         }
     } else {
         // Error, not valid...
         $this->jsonError(\Fuel\Core\Lang::get("subscribe_to_newsletter.error"));
     }
 }
Esempio n. 2
0
 public static function bootstrap()
 {
     //Make sure orm is loaded first as we need this
     \Fuel\Core\Package::load('orm');
     //For fuel v1 add to the finder path
     if (class_exists('\\Fuel\\Core\\Finder')) {
         \Fuel\Core\Finder::instance()->add_path(__DIR__ . DS . '..' . DS . '..');
     }
     \Fuel\Core\Config::load('ethanol', true);
     \Fuel\Core\Config::load('ethanol_permissions', true);
     \Fuel\Core\Lang::load('ethanol', 'ethanol');
     Auth::instance()->register_driver(array('database', 'facebook'));
 }
Esempio n. 3
0
 public function before()
 {
     $this->controller = Request::active()->controller;
     $this->action = Request::active()->action;
     static::$method = $this->controller . '/' . $this->action;
     $this->data['success'] = false;
     Lang::load('app');
     $this->render_template();
     parent::before();
     $this->set_title();
     $this->set_path();
     $this->init();
 }
Esempio n. 4
0
 public function before()
 {
     $parentReturn = parent::before();
     \Fuel\Core\Lang::load("global");
     \Fuel\Core\Lang::load("share");
     $this->template->jsVars = new JsVars();
     $this->template->jsVars->addVar("wsUrl", rtrim(Router::get("ws_" . $this->lang), "/") . "/");
     $this->template->jsVars->addVar("baseUrl", \Fuel\Core\Uri::base(FALSE));
     $this->template->css = array("fonts.css", "normalize.css", "definitions.css", "template.css", "sprites/generic.css");
     $this->template->js = array("libs/jquery-2.1.3.min.js", "libs/jquery-ui.min.js", "libs/mustache.js", "template.js");
     $this->template->header = "front_header";
     $this->template->set_global(array("menu_selected" => ""));
     $this->template->footer = "front_footer";
     $this->template->footer_options = array();
     $fbShare = array("share" => FALSE, "siteName" => '', "title" => '', "description" => '', "image" => '');
     $this->template->fbShare = $fbShare;
     return $parentReturn;
 }
Esempio n. 5
0
<?php

//Make sure orm is loaded first as we need this
\Fuel\Core\Package::load('orm');
//For fuel v1 add to the finder path
if (class_exists('\\Finder')) {
    \Fuel\Core\Finder::instance()->add_path(__DIR__ . DS . '..' . DS . '..');
}
\Fuel\Core\Config::load('ethanol', true);
\Fuel\Core\Config::load('ethanol_permissions', true);
\Fuel\Core\Lang::load('ethanol', 'ethanol');
Ethanol\Auth::instance()->register_driver(array('database', 'facebook'));