Example #1
2
 /**
  * Callback for sorting inputs by date then value
  *
  * @param  Input $a
  * @param  Input $b
  * @return int
  */
 protected function sortInputs($a, $b)
 {
     if ($a->getDate() == $b->getDate()) {
         if ($a->getValue() == $b->getValue()) {
             return 0;
         }
         // Positive values come first, so same-day start/ends are
         // incremented before they are decremented
         return $a->getValue() > $b->getValue() ? -1 : 1;
     }
     return $a->getDate() < $b->getDate() ? -1 : 1;
 }
Example #2
1
 public function addInput($value, $type_sensor)
 {
     $new_input = new Input();
     $new_input->setInformation($value);
     $new_input->setType($type_sensor);
     $this->setInput($new_input);
 }
 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     if ($input->post('FORM_SUBMIT') == 'tl_composer_migrate_undo') {
         /** @var RootPackage $rootPackage */
         $rootPackage = $this->composer->getPackage();
         $requires = $rootPackage->getRequires();
         foreach (array_keys($requires) as $package) {
             if ($package != 'contao-community-alliance/composer') {
                 unset($requires[$package]);
             }
         }
         $rootPackage->setRequires($requires);
         $lockPathname = preg_replace('#\\.json$#', '.lock', $this->configPathname);
         /** @var DownloadManager $downloadManager */
         $downloadManager = $this->composer->getDownloadManager();
         $downloadManager->setOutputProgress(false);
         $installer = Installer::create($this->io, $this->composer);
         if (file_exists(TL_ROOT . '/' . $lockPathname)) {
             $installer->setUpdate(true);
         }
         if ($installer->run()) {
             $_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
         } else {
             $_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
             $this->redirect('contao/main.php?do=composer&migrate=undo');
         }
         // load config
         $json = new JsonFile(TL_ROOT . '/' . $this->configPathname);
         $config = $json->read();
         // remove migration status
         unset($config['extra']['contao']['migrated']);
         // write config
         $json->write($config);
         // disable composer client and enable repository client
         $inactiveModules = deserialize($GLOBALS['TL_CONFIG']['inactiveModules']);
         $inactiveModules[] = '!composer';
         foreach (array('rep_base', 'rep_client', 'repository') as $module) {
             $pos = array_search($module, $inactiveModules);
             if ($pos !== false) {
                 unset($inactiveModules[$pos]);
             }
         }
         if (version_compare(VERSION, '3', '>=')) {
             $skipFile = new \File('system/modules/!composer/.skip');
             $skipFile->write('Remove this file to enable the module');
             $skipFile->close();
         }
         if (file_exists(TL_ROOT . '/system/modules/repository/.skip')) {
             $skipFile = new \File('system/modules/repository/.skip');
             $skipFile->delete();
         }
         $this->Config->update("\$GLOBALS['TL_CONFIG']['inactiveModules']", serialize($inactiveModules));
         $this->redirect('contao/main.php?do=repository_manager');
     }
     $template = new \BackendTemplate('be_composer_client_migrate_undo');
     $template->composer = $this->composer;
     $template->output = $_SESSION['COMPOSER_OUTPUT'];
     unset($_SESSION['COMPOSER_OUTPUT']);
     return $template->parse();
 }
Example #4
1
 /**
  * Add an Input object to the form
  *
  * @param Input $input
  */
 public function addInput(Input $input)
 {
     if ($this->disableWrappers()) {
         $input->disableWrapper();
     }
     $this->inputs[] = $input;
 }
 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $removeNames = $input->post('packages') ? explode(',', $input->post('packages')) : array($input->post('remove'));
     // filter undeletable packages
     $removeNames = array_filter($removeNames, function ($removeName) {
         return !in_array($removeName, InstalledController::$UNDELETABLE_PACKAGES);
     });
     // skip empty
     if (empty($removeNames)) {
         $this->redirect('contao/main.php?do=composer');
     }
     // make a backup
     copy(TL_ROOT . '/' . $this->configPathname, TL_ROOT . '/' . $this->configPathname . '~');
     // update requires
     $json = new JsonFile(TL_ROOT . '/' . $this->configPathname);
     $config = $json->read();
     if (!array_key_exists('require', $config)) {
         $config['require'] = array();
     }
     foreach ($removeNames as $removeName) {
         unset($config['require'][$removeName]);
     }
     $json->write($config);
     $_SESSION['TL_INFO'][] = sprintf($GLOBALS['TL_LANG']['composer_client']['removeCandidate'], implode(', ', $removeNames));
     $_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
     $this->redirect('contao/main.php?do=composer');
 }
 /**
  * {@inheritdoc}
  *
  * @SuppressWarnings(PHPMD.LongVariable)
  */
 public function handle(\Input $input)
 {
     $packageName = $input->get('install');
     if ($packageName == 'contao/core') {
         $this->redirect('contao/main.php?do=composer');
     }
     if ($input->post('version')) {
         $version = base64_decode(rawurldecode($input->post('version')));
         // make a backup
         copy(TL_ROOT . '/' . $this->configPathname, TL_ROOT . '/' . $this->configPathname . '~');
         // update requires
         $json = new JsonFile(TL_ROOT . '/' . $this->configPathname);
         $config = $json->read();
         if (!array_key_exists('require', $config)) {
             $config['require'] = array();
         }
         $config['require'][$packageName] = $version;
         ksort($config['require']);
         $json->write($config);
         Messages::addInfo(sprintf($GLOBALS['TL_LANG']['composer_client']['added_candidate'], $packageName, $version));
         $_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
         $this->redirect('contao/main.php?do=composer');
     }
     $installationCandidates = $this->searchPackage($packageName);
     if (empty($installationCandidates)) {
         Messages::addError(sprintf($GLOBALS['TL_LANG']['composer_client']['noInstallationCandidates'], $packageName));
         $_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
         $this->redirect('contao/main.php?do=composer');
     }
     $template = new \BackendTemplate('be_composer_client_install');
     $template->composer = $this->composer;
     $template->packageName = $packageName;
     $template->candidates = $installationCandidates;
     return $template->parse();
 }
 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $this->handleRunOnce();
     // PATCH
     if ($input->post('FORM_SUBMIT') == 'database-update') {
         $count = 0;
         $sql = deserialize($input->post('sql'));
         if (is_array($sql)) {
             foreach ($sql as $key) {
                 if (isset($_SESSION['sql_commands'][$key])) {
                     $this->Database->query(str_replace('DEFAULT CHARSET=utf8;', 'DEFAULT CHARSET=utf8 COLLATE ' . $GLOBALS['TL_CONFIG']['dbCollation'] . ';', $_SESSION['sql_commands'][$key]));
                     $count++;
                 }
             }
         }
         $_SESSION['sql_commands'] = array();
         Messages::addConfirmation(sprintf($GLOBALS['TL_LANG']['composer_client']['databaseUpdated'], $count));
         $this->reload();
     }
     /** @var \Contao\Database\Installer $installer */
     $installer = \System::importStatic('Database\\Installer');
     $form = $installer->generateSqlForm();
     if (empty($form)) {
         Messages::addInfo($GLOBALS['TL_LANG']['composer_client']['databaseUptodate']);
         $this->redirect('contao/main.php?do=composer');
     }
     $form = preg_replace('#(<label for="sql_\\d+")>(CREATE TABLE)#', '$1 class="create_table">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` ADD)#', '$1 class="alter_add">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` DROP)#', '$1 class="alter_drop">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(DROP TABLE)#', '$1 class="drop_table">$2', $form);
     $template = new \BackendTemplate('be_composer_client_update');
     $template->composer = $this->composer;
     $template->form = $form;
     return $template->parse();
 }
Example #8
1
 public function testCanReplaceInputVlues()
 {
     $newInputs = ["get" => ["foo" => "Hello"], "post" => ["bar" => "World"]];
     $input = new Input();
     $input->replace($newInputs);
     $this->assertEquals($newInputs["get"]["foo"], $input->get("foo"));
     $this->assertEquals($newInputs["post"]["bar"], $input->post("bar"));
 }
Example #9
1
 public function testCanReplaceInputValues()
 {
     $newInputs = array('get' => array('foo' => 'hello'), 'post' => array('bar' => 'World'));
     $input = new Input();
     $input->replace($newInputs);
     $this->assertEquals($newInputs['get']['foo'], $input->get('foo'));
     $this->assertEquals($newInputs['post']['bar'], $input->post('bar'));
 }
Example #10
1
 /**
  * Define o alvo do label.
  * @param	Input $input
  * @return	Label Uma referência ao próprio component.
  * @see		Component::setAttribute()
  */
 public function setFor(Input $input)
 {
     $id = $input->getId();
     if ($id == null) {
         $id = $input->generateId()->getId();
     }
     return $this->setAttribute('for', $id);
 }
Example #11
1
 function cuadroAsociado()
 {
     $cuadroTexto = new Input();
     $this->atributos[self::TIPO] = self::HIDDEN;
     $this->atributos["obligatorio"] = false;
     $this->atributos[self::ETIQUETA] = "";
     $this->atributos[self::VALOR] = "false";
     return $cuadroTexto->cuadro_texto($this->atributos);
 }
 /**
  * @return $this
  */
 protected function addTokenInput()
 {
     $input = new Input('token');
     // Filter
     $filterManager = $this->getFactory()->getDefaultFilterChain()->getPluginManager();
     $input->getFilterChain()->attach($filterManager->get('stringtrim'));
     $this->add($input);
     return $this;
 }
Example #13
1
 public function testFilterZendFilterAsArray()
 {
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager', [], [], '', false);
     $inputFilter = new Input($objectManagerMock);
     /** This filter should be applied to 'field1' field value only */
     $inputFilter->setFilters(array('field1' => array(array('zend' => 'StringToUpper', 'args' => array('encoding' => 'utf-8')))));
     /** Execute SUT and ensure that array items were filtered correctly */
     $inputArray = ['field1' => 'value1', 'field2' => 'value2'];
     $expectedOutput = ['field1' => 'VALUE1', 'field2' => 'value2'];
     $this->assertEquals($expectedOutput, $inputFilter->filter($inputArray), 'Array was filtered incorrectly.');
 }
Example #14
0
 public function validate()
 {
     $input = new Input();
     $input->minMax($this->name, 1, 32, 'Company Name');
     $input->minMax($this->address, 1, 64, 'Address');
     $input->minMax($this->city, 1, 32, 'City');
     $input->minMax($this->state, 1, 32, 'State');
     $input->minMax($this->zip, 1, 14, 'Zip Code');
     $input->phone($this->phone, 'Telephone Number');
     $input->digits($this->zip, 'Zip Code');
     $input->maximum($this->phone, 32, 'Telephone Number');
     $input->maximum($this->logo, 128, 'Logo URL');
     return true;
 }
Example #15
0
 public function update()
 {
     if (!$this->app['sentry']->getUser()->hasAccess('superuser')) {
         return new Response($this->app['translator']->trans('noPermissionsGeneric'), 403);
     }
     foreach ($this->input->all() as $name => $value) {
         $option = $this->setting->where('name', $name)->first();
         if ($option) {
             $this->setting->where('name', $name)->update(array('value' => $value));
         } else {
             $this->setting->insert(array('name' => $name, 'value' => $value));
         }
     }
     return new Response($this->app['translator']->trans('settingsUpdated'), 201);
 }
 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $configFile = new \File($this->configPathname);
     if ($input->post('save')) {
         $tempPathname = $this->configPathname . '~';
         $tempFile = new \File($tempPathname);
         $config = $input->postRaw('config');
         $config = html_entity_decode($config, ENT_QUOTES, 'UTF-8');
         $tempFile->write($config);
         $tempFile->close();
         $validator = new ConfigValidator($this->io);
         list($errors, $publishErrors, $warnings) = $validator->validate(TL_ROOT . '/' . $tempPathname);
         if (!$errors && !$publishErrors) {
             $_SESSION['TL_CONFIRM'][] = $GLOBALS['TL_LANG']['composer_client']['configValid'];
             $this->import('Files');
             $this->Files->rename($tempPathname, $this->configPathname);
         } else {
             $tempFile->delete();
             $_SESSION['COMPOSER_EDIT_CONFIG'] = $config;
             if ($errors) {
                 foreach ($errors as $message) {
                     $_SESSION['TL_ERROR'][] = 'Error: ' . $message;
                 }
             }
             if ($publishErrors) {
                 foreach ($publishErrors as $message) {
                     $_SESSION['TL_ERROR'][] = 'Publish error: ' . $message;
                 }
             }
         }
         if ($warnings) {
             foreach ($warnings as $message) {
                 $_SESSION['TL_ERROR'][] = 'Warning: ' . $message;
             }
         }
         $this->reload();
     }
     if (isset($_SESSION['COMPOSER_EDIT_CONFIG'])) {
         $config = $_SESSION['COMPOSER_EDIT_CONFIG'];
         unset($_SESSION['COMPOSER_EDIT_CONFIG']);
     } else {
         $config = $configFile->getContent();
     }
     $template = new \BackendTemplate('be_composer_client_editor');
     $template->composer = $this->composer;
     $template->config = $config;
     return $template->parse();
 }
Example #17
0
 /**
  * Attempts to load a view and pre-load view data.
  *
  * @throws  Kohana_Exception  if the requested view cannot be found
  * @param   string  $name view name
  * @param   string  $page_type page type: album, photo, tags, etc
  * @param   string  $theme_name view name
  * @return  void
  */
 public function __construct($name, $page_type)
 {
     $theme_name = module::get_var("gallery", "active_site_theme");
     if (!file_exists("themes/{$theme_name}")) {
         module::set_var("gallery", "active_site_theme", "default");
         theme::load_themes();
         Kohana::log("error", "Unable to locate theme '{$theme_name}', switching to default theme.");
     }
     parent::__construct($name);
     $this->theme_name = module::get_var("gallery", "active_site_theme");
     if (user::active()->admin) {
         $this->theme_name = Input::instance()->get("theme", $this->theme_name);
     }
     $this->item = null;
     $this->tag = null;
     $this->set_global("theme", $this);
     $this->set_global("user", user::active());
     $this->set_global("page_type", $page_type);
     $this->set_global("page_title", null);
     if ($page_type == "album") {
         $this->set_global("thumb_proportion", $this->thumb_proportion());
     }
     $maintenance_mode = Kohana::config("core.maintenance_mode", false, false);
     if ($maintenance_mode) {
         message::warning(t("This site is currently in maintenance mode"));
     }
 }
Example #18
0
 /**
  * เรียกใช้งาน Class แบบสามารถเรียกได้ครั้งเดียวเท่านั้น
  *
  * @param array $config ค่ากำหนดของ แอพพลิเคชั่น
  * @return Singleton
  */
 public function __construct()
 {
     /* display error */
     if (defined('DEBUG') && DEBUG === true) {
         /* ขณะออกแบบ แสดง error และ warning ของ PHP */
         ini_set('display_errors', 1);
         ini_set('display_startup_errors', 1);
         error_reporting(-1);
     } else {
         /* ขณะใช้งานจริง */
         error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
     }
     /* config */
     self::$cfg = \Config::create();
     /* charset default UTF-8 */
     ini_set('default_charset', self::$char_set);
     if (extension_loaded('mbstring')) {
         mb_internal_encoding(self::$char_set);
     }
     /* inint Input */
     Input::normalizeRequest();
     // template ที่กำลังใช้งานอยู่
     Template::inint(Input::get($_GET, 'skin', self::$cfg->skin));
     /* time zone default Thailand */
     @date_default_timezone_set(self::$cfg->timezone);
 }
Example #19
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     // Also check owner (see #126)
     if (($objOrder = Order::findOneBy('uniqid', (string) \Input::get('uid'))) === null || FE_USER_LOGGED_IN === true && $objOrder->member > 0 && \FrontendUser::getInstance()->id != $objOrder->member) {
         $this->Template = new \Isotope\Template('mod_message');
         $this->Template->type = 'error';
         $this->Template->message = $GLOBALS['TL_LANG']['ERR']['orderNotFound'];
         return;
     }
     // Order belongs to a member but not logged in
     if (TL_MODE == 'FE' && $this->iso_loginRequired && $objOrder->member > 0 && FE_USER_LOGGED_IN !== true) {
         global $objPage;
         $objHandler = new $GLOBALS['TL_PTY']['error_403']();
         $objHandler->generate($objPage->id);
         exit;
     }
     Isotope::setConfig($objOrder->getRelated('config_id'));
     $objTemplate = new \Isotope\Template($this->iso_collectionTpl);
     $objTemplate->linkProducts = true;
     $objOrder->addToTemplate($objTemplate, array('gallery' => $this->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->iso_orderCollectionBy)));
     $this->Template->collection = $objOrder;
     $this->Template->products = $objTemplate->parse();
     $this->Template->info = deserialize($objOrder->checkout_info, true);
     $this->Template->date = Format::date($objOrder->locked);
     $this->Template->time = Format::time($objOrder->locked);
     $this->Template->datim = Format::datim($objOrder->locked);
     $this->Template->orderDetailsHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['orderDetailsHeadline'], $objOrder->document_number, $this->Template->datim);
     $this->Template->orderStatus = sprintf($GLOBALS['TL_LANG']['MSC']['orderStatusHeadline'], $objOrder->getStatusLabel());
     $this->Template->orderStatusKey = $objOrder->getStatusAlias();
 }
Example #20
0
 public function postIndex()
 {
     if (\Auth::attempt(array('email' => \Input::get('email'), 'password' => \Input::get('password')))) {
         return \Redirect::intended('/');
     }
     return \Redirect::to('/?errors=true');
 }
 public function saveprefs()
 {
     // Process the admin form.
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     // Save user specified settings to the database.
     $str_slideshow_url = Input::instance()->post("slideshow_url");
     module::set_var("minislideshow", "slideshow_url", $str_slideshow_url);
     $str_slideshow_shuffle = Input::instance()->post("shuffle");
     module::set_var("minislideshow", "shuffle", $str_slideshow_shuffle);
     $str_slideshow_dropshadow = Input::instance()->post("dropshadow");
     module::set_var("minislideshow", "dropshadow", $str_slideshow_dropshadow);
     $str_slideshow_show_title = Input::instance()->post("show_title");
     module::set_var("minislideshow", "show_title", $str_slideshow_show_title);
     $str_slideshow_trans_in_type = Input::instance()->post("trans_in_type");
     module::set_var("minislideshow", "trans_in_type", $str_slideshow_trans_in_type);
     $str_slideshow_trans_out_type = Input::instance()->post("trans_out_type");
     module::set_var("minislideshow", "trans_out_type", $str_slideshow_trans_out_type);
     $str_slideshow_mask = Input::instance()->post("mask");
     module::set_var("minislideshow", "mask", $str_slideshow_mask);
     $str_slideshow_use_full_image = Input::instance()->post("use_full_image");
     module::set_var("minislideshow", "use_full_image", $str_slideshow_use_full_image);
     $str_slideshow_delay = Input::instance()->post("delay");
     module::set_var("minislideshow", "delay", $str_slideshow_delay);
     // Display a success message and load the admin screen.
     message::success(t("Your Settings Have Been Saved."));
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_minislideshow.html");
     $view->content->minislideshow_form = $this->_get_admin_form();
     print $view;
 }
Example #22
0
 public function index()
 {
     $view = new Admin_View("admin.html");
     $view->page_title = t("Users and groups");
     $view->page_type = "collection";
     $view->page_subtype = "admin_users";
     $view->content = new View("admin_users.html");
     // @todo: add this as a config option
     $page_size = module::get_var("user", "page_size", 10);
     $page = Input::instance()->get("page", "1");
     $builder = db::build();
     $user_count = $builder->from("users")->count_records();
     // Pagination info
     $view->page = $page;
     $view->page_size = $page_size;
     $view->children_count = $user_count;
     $view->max_pages = ceil($view->children_count / $view->page_size);
     $view->content->pager = new Pagination();
     $view->content->pager->initialize(array("query_string" => "page", "total_items" => $user_count, "items_per_page" => $page_size, "style" => "classic"));
     // Make sure that the page references a valid offset
     if ($page < 1) {
         url::redirect(url::merge(array("page" => 1)));
     } else {
         if ($page > $view->content->pager->total_pages) {
             url::redirect(url::merge(array("page" => $view->content->pager->total_pages)));
         }
     }
     // Join our users against the items table so that we can get a count of their items
     // in the same query.
     $view->content->users = ORM::factory("user")->order_by("users.name", "ASC")->find_all($page_size, $view->content->pager->sql_offset);
     $view->content->groups = ORM::factory("group")->order_by("name", "ASC")->find_all();
     print $view;
 }
Example #23
0
 public function faqSend()
 {
     $question = new Question();
     $input = Input::all();
     $captcha_string = Input::get('g-recaptcha-response');
     $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string);
     $captcha_json = json_decode($captcha_response);
     if ($captcha_json->success) {
         $rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"];
         $messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"];
         $validator = Validator::make(Input::all(), $rules, $messages);
         if ($validator->fails()) {
             $messages = $validator->messages();
             Session::flash('flash_msg', "Certains champs spécifiés sont incorrects.");
             Session::flash('flash_type', "fail");
             return Redirect::to(URL::previous())->withErrors($validator);
         } else {
             $question->fill($input)->save();
             Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu.");
             Session::flash('flash_type', "success");
             return Redirect::to(URL::previous());
         }
     } else {
         Session::flash('flash_msg', "Champ de vérification incorrect ou non coché.");
         Session::flash('flash_type', "fail");
         return Redirect::to(URL::previous());
     }
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newslist_plus'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $this->news_featured = 'featured';
     // unset search string for highlighted section
     \Input::setGet('searchKeywords', null);
     $this->objArticles = NewsPlusModel::findPublishedByPids($this->news_archives, array(), array(), $this->news_featured == 'featured', $this->numberOfItems, 0);
     if ($this->objArticles === null) {
         return '';
     }
     return parent::generate();
 }
 /**
  * Generate the content element
  */
 public function compile()
 {
     global $container;
     /** @var SubscriptionManager $subscriptionManager */
     $subscriptionManager = $container['avisota.subscription'];
     /** @var EventDispatcher $eventDispatcher */
     $eventDispatcher = $container['event-dispatcher'];
     $token = (array) \Input::get('token');
     if (count($token)) {
         $subscriptions = $subscriptionManager->confirmByToken($token);
         \Session::getInstance()->set('AVISOTA_LAST_SUBSCRIPTIONS', $subscriptions);
         if ($this->avisota_activation_confirmation_page) {
             $event = new GetPageDetailsEvent($this->avisota_activation_confirmation_page);
             $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GET_PAGE_DETAILS, $event);
             $event = new GenerateFrontendUrlEvent($event->getPageDetails());
             $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
             $event = new RedirectEvent($event->getUrl());
             $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $event);
         }
         $this->Template->confirmed = $subscriptions;
     } else {
         if ($this->avisota_activation_redirect_page) {
             $event = new GetPageDetailsEvent($this->avisota_activation_redirect_page);
             $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GET_PAGE_DETAILS, $event);
             $event = new GenerateFrontendUrlEvent($event->getPageDetails());
             $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
             $event = new RedirectEvent($event->getUrl());
             $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $event);
         }
     }
 }
Example #26
0
 public static function addMedia($fileName, $objType, $user_id, $route)
 {
     $file = Input::file($fileName);
     $currentMo = date('Y_M');
     $destination = "uploads/{$currentMo}";
     $filename = $file->getClientOriginalName();
     $filename = Exhibit::string_convert($filename);
     // $cleanFilename = Exhibit::permalink($filename);
     // Move the new file into the uploads directory
     $uploadSuccess = $file->move($destination, "{$filename}");
     $imgOrigDestination = $destination . '/' . $filename;
     // Check to make sure that upload was successful and add the content
     if ($uploadSuccess) {
         $imageMinDestination = $destination . '/min_' . $filename;
         $imageMin = Image::make($imgOrigDestination)->crop(250, 250, 10, 10)->save($imageMinDestination);
         // Saves the media and adds the appropriate foreign keys for the exhibit
         $media = $objType->media()->create(['user_id' => $user_id, 'img_min' => $imageMinDestination, 'img_big' => $imgOrigDestination]);
         $objType->media()->save($media);
         return $media->id;
     } else {
         if ($route == 'back') {
             return Redirect::back()->with('status', 'alert-error')->with('global', 'Something went wrong with uploading your photos.');
         }
         return Redirect::route($route)->with('status', 'alert-error')->with('global', 'Something went wrong with uploading your photos.');
     }
 }
Example #27
0
 public function test_it_handles_filtering()
 {
     \Input::merge(['dvs-filters' => ['slug' => '/admin/media-manager/category']]);
     $pages = \DvsPage::paginate();
     // are pages filtered?
     // assertCount(2, $pages);
 }
Example #28
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $a = new Task();
     $a->fill(\Input::all());
     $a->save();
     return redirect()->back();
 }
 public function getIndex()
 {
     if ($this->access['is_view'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     // Filter sort and order for query
     $sort = !is_null(Input::get('sort')) ? Input::get('sort') : '';
     $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc';
     // End Filter sort and order for query
     // Filter Search for query
     $filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
     // End Filter Search for query
     $page = Input::get('page', 1);
     $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
     // Get Query
     $results = $this->model->getRows($params);
     // Build pagination setting
     $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
     $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']);
     $this->data['rowData'] = $results['rows'];
     // Build Pagination
     $this->data['pagination'] = $pagination;
     // Build pager number and append current param GET
     $this->data['pager'] = $this->injectPaginate();
     // Row grid Number
     $this->data['i'] = $page * $params['limit'] - $params['limit'];
     // Grid Configuration
     $this->data['tableGrid'] = $this->info['config']['grid'];
     $this->data['tableForm'] = $this->info['config']['forms'];
     $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']);
     // Group users permission
     $this->data['access'] = $this->access;
     // Render into template
     $this->layout->nest('content', 'rinvoices.index', $this->data)->with('menus', SiteHelpers::menus());
 }
Example #30
0
 public function postDelete()
 {
     $id = Input::get('id');
     $delpro = Program::find($id);
     $delpro->delete();
     return 1;
 }