Exemple #1
0
 public function run()
 {
     Bundle::start('messages');
     $twoweeks = date('Y-m-d', strtotime('+2 weeks'));
     $week = date('Y-m-d', strtotime('+1 weeks'));
     $tomorrow = date('Y-m-d', strtotime('+1 day'));
     $rooms = Room::where_del_date($tomorrow)->or_where('del_date', '=', $week)->or_where('del_date', '=', $twoweeks)->get();
     foreach ($rooms as $room) {
         switch ($room->del_date) {
             case $twoweeks:
                 $expire_date = "over twee weken";
                 break;
             case $week:
                 $expire_date = "over een week";
                 break;
             case $tomorrow:
                 $expire_date = "morgen";
                 break;
         }
         Message::send(function ($message) use($room, $expire_date) {
             $message->to($room->email);
             $message->from('*****@*****.**', 'Kamergenood');
             $message->subject('Verleng de kameradvertentie: "' . $room->title . '"');
             $message->body('view: emails.extend');
             $message->body->id = $room->id;
             $message->body->title = $room->title;
             $message->body->url = $room->url;
             $message->body->delkey = $room->delkey;
             $message->body->expire_date = $expire_date;
             $message->html(true);
         });
     }
 }
 /**
  * Setup the test environment.
  */
 public function setUp()
 {
     Bundle::start('oneauth');
     Config::set('application.url', 'http://localhost');
     Config::set('application.index', '');
     Config::set('oneauth::urls', array('registration' => 'auth/register', 'login' => 'auth/login', 'callback' => 'auth/callback', 'registered' => 'auth/home', 'logged_in' => 'auth/account'));
 }
Exemple #3
0
 public function __destruct()
 {
     Bundle::disable('email');
     Bundle::disable('settings');
     Bundle::disable('modules');
     Bundle::disable('navigation');
 }
 /**
  * Destroy the testing environment.
  */
 public function tearDown()
 {
     Bundle::$started = array();
     Bundle::$routed = array();
     Router::$names = array();
     Router::$routes = array();
 }
Exemple #5
0
 /**
  * Build a multi-array of parent > children.
  *
  * @return array An array representing the page tree.
  */
 public function get_links_tree()
 {
     if (\Bundle::exists('pages')) {
         $all_links = Link::with('page')->order_by('order', 'asc')->get(array('id', 'group_id', 'title', 'class'));
     } else {
         $all_links = Link::order_by('order', 'asc')->get(array('id', 'group_id', 'title', 'class'));
     }
     // First, re-index the array.
     foreach ($all_links as $row) {
         $pages[$row->id] = array('id' => $row->id, 'li_id' => 'link_', 'link_type' => $row->link_type, 'rel' => $row->navigation_group_id, 'parent_id' => $this->id, 'title' => $row->title, 'url' => $row->url, 'target' => $row->target, 'class' => $row->class);
     }
     unset($all_links);
     // Build a multidimensional array of parent > children.
     foreach ($pages as $row) {
         if (array_key_exists($row['parent_id'], $pages)) {
             // Add this page to the children array of the parent page.
             $pages[$row['parent_id']]['children'][] =& $pages[$row['id']];
         }
         // This is a root page.
         if ($row['parent_id'] == 0) {
             $page_array[] =& $pages[$row['id']];
         }
     }
     return $page_array;
 }
 public function testIssues()
 {
     Bundle::start('flyswatter');
     // Seed Database
     Controller::call('flyswatter::seed@seed');
     $issue = Issue::find(1);
     $this->assertNotNull($issue->id);
 }
Exemple #7
0
 /**
  * @return array of paths that we can find seeds
  */
 protected function _getSeedFolders()
 {
     $bins = array(path('app') . 'seeds' . DIRECTORY_SEPARATOR);
     foreach (Bundle::$bundles as $bundle) {
         $bins[] = Bundle::path($bundle['location']) . 'seeds' . DIRECTORY_SEPARATOR;
     }
     return $bins;
 }
Exemple #8
0
 public function users()
 {
     if (\Bundle::exists('permissions')) {
         return $this->has_many('Users\\Model\\User');
     } else {
         throw new \Exception('Permissions module is not installed. To call goups with users you must install the permissions module.');
     }
 }
Exemple #9
0
 /**
  * Sends an email
  *
  * @param string  $email
  * @param string  $title
  * @param string $content
  * @return boolean
  */
 public static function send($email, $title, $content)
 {
     Bundle::start('swiftmailer');
     $transporter = Swift_SmtpTransport::newInstance('smtp.googlemail.com', Config::get('gotin::gotin.smtp_port'), 'ssl')->setUsername(Config::get('gotin::gotin.smtp_user'))->setPassword(Config::get('gotin::gotin.smtp_password'));
     $mailer = Swift_Mailer::newInstance($transporter);
     $message = Swift_Message::newInstance($title)->setFrom(array(Config::get('gotin::gotin.from_email') => Config::get('gotin::gotin.from_title')))->setTo(array($email => $email))->setBody($content, 'text/html');
     return $mailer->send($message);
 }
Exemple #10
0
 public function group()
 {
     if (\Bundle::exists('groups')) {
         return $this->belongs_to('Groups\\Model\\Group');
     } else {
         throw new \Exception('Groups module is not installed. To call users with group you must install the groups module.');
     }
 }
 /**
  * Get the path to a view on disk.
  *
  * @param $view
  *
  * @return string
  * @throws \Exception
  */
 protected function path($view)
 {
     $root = \Bundle::path(\Bundle::name($view)) . 'views';
     $path = $root . DS . \Bundle::element($view);
     if (file_exists($path)) {
         return $path;
     }
     throw new \Exception("View [{$view}] does not exist.");
 }
Exemple #12
0
 public function get_new()
 {
     $this->data['section_bar_active'] = __('email::lang.Send Email')->get(ADM_LANG);
     $this->data['groups_dropdown'] = null;
     if (Bundle::exists('groups')) {
         $this->data['groups_dropdown'] = Groups\Model\Group::all();
     }
     $this->data['email_templates'] = Email\Model\Template::all();
     return $this->theme->render('email::email.new', $this->data);
 }
 private function getUsers($name)
 {
     try {
         $users = $this->model->getUsersWithName($name);
         $this->values->users = $users;
         $this->values->name = $name;
     } catch (NoResultException $e) {
         $this->request->error = Bundle::get('friends.users.not.found', $name);
     }
 }
Exemple #14
0
 public function post_process()
 {
     Log::write('PayPal', 'Trying to process IPN');
     Bundle::start('paypal-ipn');
     $listener = new IpnListener();
     //        $listener->use_sandbox = true;
     try {
         $listener->requirePostMethod();
         $verified = $listener->processIpn();
     } catch (Exception $e) {
         Log::info($e->getMessage());
     }
     if ($verified) {
         Log::write('PayPal', 'IPN payment looks verified');
         $data = Input::get();
         $settings = IniHandle::readini();
         if (!in_array($data['payment_status'], array('Completed', 'COMPLETED', 'completed'))) {
             Log::write('PayPal', 'payment not completed');
             return View::make('msg.error')->with('error', 'PayPal: payment not completed');
         }
         if (strtolower($data['receiver_email']) != strtolower($settings['ppemail'])) {
             Log::write('PayPal', 'receive email not same as set in settings. Settings: ' . $settings['ppemail'] . ' ||| PayPal email: ' . $data['receiver_email']);
             return View::make('msg.error')->with('error', 'PayPal: receive email not same as set in settings');
         }
         if (Payment::where('transaction_id', '=', $data['txn_id'])->count() != 0) {
             Log::write('PayPal', 'transaction ID already exists');
             return View::make('msg.error')->with('error', 'PayPal: transaction ID already exists');
         }
         if (strtolower($data['mc_currency']) != strtolower($settings['ppcurrency'])) {
             Log::write('PayPal', 'Currencies do not match');
             return View::make('msg.error')->with('error', 'PayPal: currencies do not match');
         }
         Log::write('PayPal', 'Got past all PLAN controller checks now going into CUSTOM');
         if (strtolower($data['custom']) == 'plan') {
             $result = Payment::verifyPlan($data);
             if (!$result) {
                 return $result;
             }
         } elseif (strtolower($data['custom']) == 'blacklist_skype' || strtolower($data['custom']) == 'blacklist_ip') {
             $result = Payment::verifyBlacklist($data);
             if (!$result) {
                 return $result;
             }
         } else {
             Log::write('PayPal', 'Custom not found, can\'t verify anything');
             return View::make('msg.error')->with('error', 'Fraudulent payment?');
         }
         Log::write('PayPal', 'Now trying to add Payment info to DB');
         $payment = Payment::create(array('user_id' => $data['option_selection1'], 'token' => $data['ipn_track_id'], 'date' => date('Y-m-d H:i:s', time()), 'ack' => $data['payment_status'], 'transaction_id' => $data['txn_id'], 'amount' => $data['mc_gross'], 'paypal_fee' => $data['mc_fee'], 'status' => $data['payment_status'], 'description' => $data['custom']));
         Log::write('PayPal', 'Successful payment, DB id: ' . $payment->id);
     } else {
         Log::write('PayPal', 'IPN listener returns false on check');
     }
     return 'handled';
 }
 /**
  * Create requested Form Object.
  * @author anza
  * @param string $form Name of Form Object to be created.
  * @throws FormNotFoundException When impossible to find class of Form Object.
  * @return New Form Object if its class exists.
  */
 public static function build($form)
 {
     try {
         $fo = $form . self::FO;
         if (class_exists($fo)) {
             return new $fo();
         }
     } catch (LogicException $e) {
         throw new FormNotFoundException(Bundle::get('form.validation.form.not.found', $fo));
     }
 }
 private function prepareMainLinks()
 {
     $friendsLink = DOMFactory::getLink($this->url->getCustomActionURL('friends'), Bundle::get('link.header.friends.link'))->addClass('bold tahoma-13');
     $friendsFindLink = DOMFactory::getLink($this->url->getCustomActionURL('friends', 'find'), Bundle::get('link.header.friends.find.link'))->addClass('bold tahoma-13');
     $videoLink = DOMFactory::getLink($this->url->getCustomActionURL('video'), Bundle::get('link.header.video'))->addClass('bold tahoma-13');
     $addVideoLink = DOMFactory::getLink($this->url->getCustomActionURL('video', 'add'), Bundle::get('link.header.video.add'))->addClass('bold tahoma-13');
     $this->template->friendsLink = DOMFactory::getLi($friendsLink);
     $this->template->friendsFindLink = DOMFactory::getLi($friendsFindLink);
     $this->template->videoLink = DOMFactory::getLi($videoLink);
     $this->template->addVideoLink = DOMFactory::getLi($addVideoLink);
 }
Exemple #17
0
 static function start()
 {
     Bundle::start('htmlki');
     error_reporting(-1);
     static::$logged = array();
     assert_options(ASSERT_BAIL, 1);
     if (!static::$attached) {
         static::$attached = true;
         \Event::listen('laravel.log', array(get_called_class(), 'onLog'));
     }
 }
Exemple #18
0
 /**
  * Start the generation process.
  *
  * @return void
  */
 public function __construct($args)
 {
     parent::__construct($args);
     // we need a controller name
     if ($this->lower == null) {
         Common::error('You must specify a bundle name.');
     }
     // add the directory copy to the writer
     $this->writer->copy_directory('Bundle', $this->lower, Bundle::path('bob') . 'templates/bundle', path('bundle') . $this->lower);
     $this->writer->write();
 }
Exemple #19
0
 public static function refresh()
 {
     $default_data = array('service' => null, 'timestamp' => time(), 'ip' => self::ip(), 'city' => null, 'state' => null, 'state_code' => null, 'country' => null, 'country_code' => null, 'zipcode' => null, 'lat' => null, 'lng' => null);
     foreach (Config::get('locate::options.service_priority') as $service) {
         require_once Bundle::path('locate') . 'services/' . strtolower($service) . '.php';
         $data = $service::run();
         if ($data !== false) {
             $default_data['service'] = $service;
             break;
         }
     }
     Session::put('locate', isset($data) && is_array($data) ? array_merge($default_data, $data) : $default_data);
 }
Exemple #20
0
 public function __construct()
 {
     parent::__construct();
     $this->filter('before', 'auth');
     $this->filter('before', 'mwi.admin_controller_start', array($this));
     // $this->filter('before', 'check_rule:admin');
     $this->filter('before', 'csrf')->on('post');
     $this->data['installed_and_active_modules'] = Modules\Model\Module::where('enabled', '=', 1)->get(array('name', 'menu'));
     if (Bundle::exists('themes')) {
         $this->theme->set_theme(Config::get('settings::core.backend_theme'), 'backend');
         $this->theme->set_layout(Config::get('settings::core.backend_layout'), 'backend');
         $this->theme->_theme_data = $this->data;
     }
 }
 public static function listRole()
 {
     Bundle::start('datagrid');
     $rolelist = Admin_UserRole::where('roleid', '<>', 1)->get();
     $datagrid = new Datagrid();
     $datagrid->setFields(array('roleid' => 'Role Id', 'role' => 'User Role Description'));
     $datagrid->setAction('edit', 'editRoleModal', true, array('roleid'));
     //false,array('id'=>'roleid','data-toggle'=>'modal'));
     $datagrid->setAction('delete', 'deleteRole', true, array('roleid'));
     $datagrid->setContainer('list01', 'span12');
     $datagrid->setTable('users', 'table table-bordered table-hover table-striped table-condensed');
     $datagrid->build($rolelist, 'roleid');
     return $datagrid->render();
 }
 public function post_upload($galleryID)
 {
     $path = path('public') . 'images/' . $galleryID;
     Fineuploader::init($path);
     $name = Fineuploader::getName();
     $fuResponse = Fineuploader::upload($name);
     if (isset($fuResponse['success']) && $fuResponse['success'] == true) {
         $file = Fineuploader::getUploadName();
         Bundle::start('resizer');
         $success = Resizer::open($file)->resize(300, 300, 'landscape')->save($path . '/thumbs/' . $name, 90);
         Images::create($galleryID, $name);
     }
     return Response::json($fuResponse);
 }
Exemple #23
0
function assetPath($url)
{
    $url = asset($url);
    $base = rtrim(\URL::to_asset(''), '/') . '/';
    if (S::unprefix($url, $base)) {
        if (strtok($url, '/') === 'bundles') {
            $bundle = strtok('/');
            $path = strtok(null);
            return \Bundle::path($bundle) . 'public' . DS . ltrim($path, '\\/');
        } else {
            return \path('public') . ltrim($url, '\\/');
        }
    }
}
 public function add(AbstractController $controller, $redirect)
 {
     try {
         $fo = FOFactory::build('comment');
         if (!$fo->isSent()) {
             $this->redirectToCaller($redirect);
         }
         $this->model->add($fo, $fo->getType(), $fo->getId());
         $this->redirectToCaller($redirect);
     } catch (FormValidationException $e) {
         $this->values->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
         $controller->setAction($redirect);
     }
 }
Exemple #25
0
 /**
  * Parse a language key into its bundle, file, and line segments.
  *
  * Language lines follow a {bundle}::{file}.{line} naming convention.
  *
  * @param  string  $key
  * @return array
  */
 protected function parse($key)
 {
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     // If there are not at least two segments in the array, it means that
     // the developer is requesting the entire language line array to be
     // returned. If that is the case, we'll make the item "null".
     if (count($segments) >= 2) {
         $line = implode('.', array_slice($segments, 1));
         return array($bundle, $segments[0], $line);
     } else {
         return array($bundle, $segments[0], null);
     }
 }
Exemple #26
0
 public function __construct()
 {
     parent::__construct();
     $this->data['site_name'] = Config::get('settings::core.site_name');
     $this->data['meta_title'] = '';
     $this->data['meta_description'] = '';
     $this->data['meta_keywords'] = '';
     if (Bundle::exists('themes')) {
         $this->theme = IoC::resolve('Theme');
     }
     // @TODO add fallback if themes module for
     // some reason is not installed/enabled
     $this->filter('before', 'mwi.base_controller_start', array($this));
 }
 /**
  * Creates a new instance for the specified Campaign Monitor API class
  *
  * @param	string		$class
  * @param	string		$arguments
  * @return 	CS_REST_$class Object
  */
 public static function __callStatic($class, $arguments)
 {
     // Reset any string formatting
     $class = strtolower($class);
     // Include the class file
     require_once Bundle::path('campaignmonitor') . 'vendor/csrest_' . $class . '.php';
     $options = array(Config::get('campaignmonitor.api_key'));
     if (isset($arguments[0])) {
         array_unshift($options, $arguments[0]);
     }
     // Load the class
     $class = 'CS_REST_' . ucfirst($class);
     $instance = new ReflectionClass($class);
     return $instance->newInstanceArgs($options);
 }
Exemple #28
0
 static function configure(\ThumbGen $thumb, array $input, array $options = null)
 {
     $options === null and $options = \Config::get('vanemart::thumb');
     extract($options, EXTR_SKIP);
     $thumb->temp(\Bundle::path('vanemart') . 'public/thumbs')->type($type, $quality)->remoteCacheTTL($remoteCacheTTL)->size(array_get($input, 'width', 0), array_get($input, 'height', 0))->restrict('width', $widthMin, $widthMax)->restrict('height', $heightMin, $heightMax)->step($step, array_get($input, 'up'))->fill(array_get($input, 'fill'));
     if ($watermark) {
         if ($watermark['count'] == 1) {
             $thumb->watermark($watermark['file'], $watermark['y'], $watermark['x']);
         } else {
             $thumb->watermarks($watermark['count'], $watermark['file'], $watermark['x']);
         }
     }
     Event::fire('thumb.configure', array($thumb, compact('input', 'options')));
     return $thumb;
 }
Exemple #29
0
 function __construct()
 {
     parent::__construct();
     if (Bundle::exists('themes')) {
         $this->theme->set_theme(Config::get('settings::core.frontend_theme'));
         $this->theme->set_layout(Config::get('settings::core.frontend_layout'));
     }
     $maintenance = Config::get('settings::core.site_maintenance');
     if ($maintenance == 'yes') {
         echo View::make('admin::frontend.maintenance');
         die;
     }
     $this->filter('before', 'mwi.private_controller_start', array($this));
     $this->filter('before', 'auth');
     $this->filter('before', 'csrf')->on('post');
 }
Exemple #30
0
 function __construct()
 {
     parent::__construct();
     if (Bundle::exists('themes')) {
         $this->theme->set_theme(Config::get('settings::core.frontend_theme', 'frontend'));
         $this->theme->set_layout(Config::get('settings::core.frontend_layout'));
     }
     $maintenance = Config::get('settings::core.site_maintenance');
     if ($maintenance == 'yes') {
         $this->data['site_name'] = Config::get('settings::core.site_name');
         echo $this->theme->render('admin::frontend.maintenance', $this->data);
         die;
     }
     $this->filter('before', 'mwi.public_controller_start', array($this));
     $this->filter('before', 'csrf')->on('post');
 }