Ejemplo n.º 1
0
 private static function dispatch()
 {
     $route = Utils::get('appDispatch');
     if (!$route instanceof Container) {
         context()->is404();
         $route = container()->getRoute();
     }
     if (true !== container()->getIsDispatched()) {
         if (true !== $route->getCache()) {
             context()->dispatch($route);
         } else {
             $redis = context()->redis();
             $key = sha1(serialize($route->assoc())) . '::routeCache';
             $cached = $redis->get($key);
             if (!strlen($cached)) {
                 ob_start();
                 context()->dispatch($route);
                 $cached = ob_get_contents();
                 ob_end_clean();
                 $redis->set($key, $cached);
                 $ttl = Config::get('application.route.cache', 7200);
                 $redis->expire($key, $ttl);
             }
             echo $cached;
         }
     }
 }
Ejemplo n.º 2
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     //  Create the form
     $form = new FlipTurnEditHomePageForm("Home Edit", null, '100%');
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Add the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         //$container->add($form->get_action_message()) ;
         //  Add the Form Processor to the container.
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }
Ejemplo n.º 3
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     //  Create the form
     $form = new ResultsQueuePurgeForm("Purge Results Queue", $_SERVER['PHP_SELF'], 600);
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Add the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         //$container->add($form->get_action_message()) ;
         //  Add the Form Processor to the container.
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }
Ejemplo n.º 4
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     //  Create the form
     if ($this->user_is_logged_in()) {
         $form = new FlipTurnAdminLogoutForm("Admin Flip Turn Logout", null, 350);
     } else {
         $form = new FlipTurnAdminLoginForm("Admin Flip Turn Login", null, 350);
     }
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Add the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some a welcome message.
     if ($fp->is_action_successful()) {
         //  Redirect to Member page on successful login
         //die($_SERVER['PHP_SELF']) ;
         $url = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php';
         header("Location: {$url}");
         exit;
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }
Ejemplo n.º 5
0
Archivo: Sql.php Proyecto: schpill/thin
 public function close()
 {
     $configs = container()->getConfig()->getDb();
     $config = isAke($configs, $this->entity);
     if (empty($config)) {
         throw new Exception("Database configuration does not exist.");
     }
     $username = $config->getUsername();
     if (empty($username)) {
         throw new Exception("Username is mandatory to connect database.");
     }
     $adapter = $config->getAdapter();
     $password = $config->getPassword();
     $dbName = $config->getDatabase();
     $host = $config->getHost();
     $dsn = $config->getDsn();
     if (!empty($dsn)) {
         $adapter = 'mysql';
     }
     $connexions = Utils::get('SQLConnexions');
     if (null === $connexions) {
         $connexions = array();
     }
     $keyConnexion = sha1(serialize(array("{$adapter}:dbname={$dbName};host={$host}", $username, $password)));
     if (Arrays::exists($keyConnexion, $connexions)) {
         $connexions[$keyConnexion] = null;
         Utils::set('SQLConnexions', $connexions);
     }
     $this->_isConnected = false;
     return $this;
 }
 /**
  * Este metodo construye el formulario en sí.
  */
 function form()
 {
     $ret_val = container();
     $table =& html_table($this->_width, 0, 3);
     $table->set_class("mainInterfaceWidth");
     //$table->set_style("border: 1px solid");
     $row = html_tr("");
     $col1 = html_td("");
     $col1->set_tag_attribute("align", "right");
     $col1->add(html_b(agt("Idioma")));
     $col2 = html_td("");
     $col2->set_tag_attribute("align", "left");
     $col2->add($this->element_form("miguel_lang"));
     $row->add($col1, $col2);
     $table->add($row);
     $ret_val->add($table);
     $ret_val->add(html_br(2));
     $table =& html_table($this->_width, 0, 0);
     $table->set_class("table100 main-info-cell");
     $row = html_tr("");
     $col1 = html_td("");
     $col1->set_tag_attribute("align", "left");
     $col1->add($this->element_form("Salir"));
     $col2 = html_td("");
     $col2->set_tag_attribute("align", "right");
     $col2->add($this->element_form("Siguiente"));
     $row->add($col1, $col2);
     $table->add($row);
     $ret_val->add($table);
     return $ret_val;
 }
Ejemplo n.º 7
0
 function content_block()
 {
     //  Add the InfoTableCSS so the tables look right
     $this->add_head_css(new InfoTableCSS());
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     //  Create the form
     $form = new SDIFFileUploadForm("Upload SDIF File", $_SERVER['PHP_SELF'], 600);
     $form->setUploadFileLabel("SDIF Filename");
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         $sd3fileinfo = $form->get_file_info();
         $container->add($fp, $form->get_file_info_table());
     } else {
         //  Add the Form Processor to the container.
         $container->add($fp);
     }
     return $container;
 }
 /**
  * Este metodo construye el formulario en sí.
  */
 function form()
 {
     $ret_val = container();
     $table =& html_table($this->_width, 0, 2);
     $table->set_class("table100 main-info-cell");
     $row0 = html_tr("");
     $col0 = html_td("");
     $col0->set_tag_attribute("align", "center");
     $col0->set_tag_attribute("colspan", "2");
     $col0->add($this->element_form("Licence"));
     $row0->add($col0);
     $table->add($row0);
     $row00 = html_tr("");
     $col00 = html_td("");
     $col00->set_tag_attribute("align", "center");
     $col00->set_tag_attribute("colspan", "2");
     $col00->add(html_a(Util::app_urlPath('install/include/gpl_print.txt'), agt('Versión Imprimible')));
     $row00->add($col00);
     $table->add($row00);
     $row = html_tr("");
     $col1 = html_td("");
     $col1->set_tag_attribute("align", "left");
     $col1->add($this->element_form("Salir"));
     $container = container();
     $container->add($this->element_form("Regresar"));
     $container->add($this->element_form("Acepto"));
     $col2 = html_td("");
     $col2->set_tag_attribute("align", "right");
     $col2->add($container);
     $row->add($col1, $col2);
     $table->add($row);
     $ret_val->add($table);
     return $ret_val;
 }
Ejemplo n.º 9
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     $sdifqueue = new SDIFResultsQueue();
     if (!$sdifqueue->ValidateQueue()) {
         $msgs = $sdifqueue->get_status_message();
         foreach ($msgs as $msg) {
             $container->add($this->status_message($msg['msg'], $msg['severity']));
         }
         return $container;
     }
     //  Create the form
     $form = new SDIFQueueProcessForm("Process SDIF Queue", $_SERVER['PHP_SELF'], 600);
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Add the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         //$container->add($form->get_action_message()) ;
         //  Add the Form Processor to the container.
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }
Ejemplo n.º 10
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     //  Create the form
     $form = new SwimmerAddForm("Add Swimmer", null, 600);
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Add the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         //  Add the InfoTableCSS so the tables look right
         $this->add_head_css(new DefaultGUIDataListCSS());
         $swimmers = new SwimmersDataList("Swimmers", '100%', "swimmerid");
         $div = html_div();
         $div->set_id("swimmersgdl");
         $div->add($swimmers);
         $container->add($div);
         //  Add the Form Processor to the container.
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }
Ejemplo n.º 11
0
 public function init()
 {
     $this->_url = $this->view->_url = context('url');
     $this->action = container()->getRoute()->getAction();
     $this->view->isLogged = false;
     $this->can();
 }
Ejemplo n.º 12
0
 function content_block()
 {
     //  Add the InfoTableCSS so the tables look right
     $this->add_head_css(new DefaultGUIDataListCSS());
     //  This allows passing arguments eithers as a GET or a POST
     $scriptargs = array_merge($_GET, $_POST);
     //  The swimteamid is the argument which must be
     //  dealt with differently for GET and POST operations
     if (array_key_exists("swimteamid", $scriptargs)) {
         $swimteamid = $scriptargs["swimteamid"];
     } else {
         if (array_key_exists("_swimteamid", $scriptargs)) {
             $swimteamid = $scriptargs["_swimteamid"];
         } else {
             if (array_key_exists(FT_DB_PREFIX . "radio", $scriptargs)) {
                 $swimteamid = $scriptargs[FT_DB_PREFIX . "radio"][0];
             } else {
                 $swimteamid = null;
             }
         }
     }
     $container = container();
     $it = new SwimTeamInfoTable("Swim Team Details");
     $it->setSwimTeamId($swimteamid);
     $it->BuildInfoTable();
     $container->add($it);
     $container->add(FlipTurnGUIButtons::getBackHomeButtons());
     return $container;
 }
 function form()
 {
     $table = html_table('100%', 0, 1, 3);
     $elem = html_td('color1-bg', 'left', container(html_b('Ruta del archivo CSV'), $this->element_form('path'), $this->add_action('Procesar')));
     $elem->set_id('identification');
     $table->add_row($elem);
     return $table;
 }
Ejemplo n.º 14
0
 /**
  * Resolve a factory. Keep in mind that factory would be resolved via container method.
  * So make sure if the accessor is an alias, register it on a container by calling:
  *
  * ```php
  * container()->alias('FooClass', 'foo');
  * ```
  *
  * @param string $factory Name of your registered factory
  *
  * @return mixed
  */
 public function factory($factory)
 {
     if ($this->hasFactory($factory)) {
         if (!$this->factoryHasBeenResolved($factory)) {
             $this->resolvedFactories[$factory] = container($this->factories[$factory]);
         }
         return $this->resolvedFactories[$factory];
     }
 }
Ejemplo n.º 15
0
 /**
  * Create a root-relative url.
  *
  * @param string $path
  * @param array $queryParams Optional query string parameters
  * @return string
  */
 function url($path = '', array $queryParams = [])
 {
     $uri = container('request')->getUri();
     $url = $uri->getBasePath() . '/' . ltrim($path, '/');
     if ($queryParams) {
         $url .= '?' . http_build_query($queryParams);
     }
     return $url;
 }
 /**
  * Get all Service Providers
  * @return ServiceProvider[]
  */
 public function getProviders()
 {
     $providers = (require CONFIG_PATH . '/providers.php');
     $return = [];
     foreach ($providers as $provider) {
         $return = container()->make($provider);
     }
     return $providers;
 }
 /**
  * this function returns the contents
  * of the left block.  It is already wrapped
  * in a TD
  *
  * @return HTMLTag object
  */
 function right_block()
 {
     $ret_val = container();
     $titulo = html_p("Nuevo Contacto");
     $titulo->set_tag_attribute('class', 'ptabla01');
     $ret_val->add($titulo);
     $ret_val->add($this->addForm('contact', 'miguel_contactForm'));
     return $ret_val;
 }
 function right_block()
 {
     $ret_val = container();
     $ret_val->add(html_br());
     $ret_val->add($this->add_mainMenu());
     $ret_val->add(html_br());
     $ret_val->add($this->_courseplanList());
     return $ret_val;
 }
Ejemplo n.º 19
0
 /**
  * Register application component.
  */
 protected function registerApplicationComponents()
 {
     Yii::app()->setComponent('container', new Container());
     container()->bind('app', function () {
         return Yii::app();
     });
     container()->bindIf('Docolight\\Http\\ResponseFactory', 'Docolight\\Http\\ResponseFactory', true);
     Yii::app()->setComponent('response', container('Docolight\\Http\\ResponseFactory'));
     container()->alias('Docolight\\Http\\ResponseFactory', 'response');
 }
Ejemplo n.º 20
0
/**
 * Create a dependency injection container function.
 *
 * @return the dependency injection container function
 */
function dependency_injection_container() : callable
{
    $container = sequence(decorate(container(), function (array $args) use(&$container) {
        if (is_callable($definition = $args[1] ?? null) && !($args[2] ?? false)) {
            $args[1] = call_once(set_args($definition, $container));
        }
        return $args;
    }), conditionally(is_callable, call_user_func, pass_through));
    return $container;
}
 function right_block()
 {
     $ret_val = container();
     $div = html_div();
     $titulo = html_p(agt('miguel_NewCourse'));
     $titulo->set_tag_attribute('class', 'ptabla01');
     $div->add($titulo);
     $div->add($this->addForm('newCourse', 'miguel_newCourseForm'));
     $ret_val->add($div);
     return $ret_val;
 }
 function form()
 {
     $table =& html_table($this->_width, 0, 3);
     $table->set_class("mainInterfaceWidth");
     //$table->set_style("border: 1px solid");
     $table->add_row($this->_tableRow("Nuevo nombre"));
     $elem = html_td('ptabla03', '', container($this->element_form("Aceptar")));
     $elem->set_tag_attribute('colspan', '9');
     $table->add_row($elem);
     return $table;
 }
Ejemplo n.º 23
0
 function content_block()
 {
     //  Add the InfoTableCSS so the tables look right
     $this->add_head_css(new DefaultGUIDataListCSS());
     $container = container();
     $results = new SwimResultsAdminDataList("Swim Results", '100%', "swimmer_name, swim_date");
     $div = html_div();
     $div->set_id("resultsgdl");
     $div->add($results);
     $container->add($div);
     return $container;
 }
Ejemplo n.º 24
0
 function content_block()
 {
     //  Add the InfoTableCSS so the tables look right
     $this->add_head_css(new DefaultGUIDataListCSS());
     $container = container();
     $swimmers = new SwimmersDataList("Swimmers", '100%', "swimmerid");
     $div = html_div();
     $div->set_id("swimmersgdl");
     $div->add($swimmers);
     $container->add($div);
     return $container;
 }
 function form()
 {
     $table =& html_table($this->_width, 0, 3);
     $table->set_class("mainInterfaceWidth");
     //$table->set_style("border: 1px solid");
     $table->add_row($this->_tableRow("Nombre del archivo"));
     $this->set_form_tabindex("fileZip", '15');
     $elem = html_td('ptabla03', '', container($this->element_form("fileZip"), _HTML_SPACE, $this->element_form("Aceptar")));
     $elem->set_tag_attribute('colspan', '9');
     $table->add_row($elem);
     return $table;
 }
Ejemplo n.º 26
0
 function content_block()
 {
     //  Add the InfoTableCSS so the tables look right
     $this->add_head_css(new DefaultGUIDataListCSS());
     $container = container();
     $sdifqueue = new SDIFQueueDataList("SDIF Queue", '100%', "sdifrecordid");
     $div = html_div();
     $div->set_id("sdifqueuegdl");
     $div->add($sdifqueue);
     $container->add($div);
     return $container;
 }
Ejemplo n.º 27
0
 public function __construct($config = null)
 {
     if (is_null($config)) {
         $configs = container()->getConfig()->getDb();
         $config = isAke($configs, 'db');
         if (empty($config)) {
             throw new Exception("The database configuration is empty.");
         }
     }
     $this->config = $config;
     $this->connect();
     $this->check();
 }
Ejemplo n.º 28
0
 /**
  * Renders a given view.
  *
  * @param null $view
  * @param array $params
  * @return $this
  */
 public function render($view = null, array $params = [])
 {
     if (is_null($view) && !isset($this->defaultView)) {
         throw new \LogicException("Cannot resolve the view to be rendered.", 500);
     }
     if (isset($this->defaultView)) {
         $view = $this->defaultView;
     }
     $view = str_replace(container("twig_views_file_extension"), "", $view);
     $view = str_replace(".", DIRECTORY_SEPARATOR, $view) . container("twig_views_file_extension");
     $this->twig->display($view, $params);
     return $this;
 }
 /**
  * Este metodo construye el formulario en sí.
  */
 function form()
 {
     $table =& html_table($this->_width, 0, 2, 2);
     //$table->set_style("border: 1px solid");
     $elem = html_td("colorLogin-bg", "", container("Nombre de usuario", html_br(), $this->element_form("Nombre de usuario")));
     $elem->set_id("identification");
     $table->add_row($elem);
     $elem = html_td("colorLogin-bg", "", container("Clave de acceso", html_br(), $this->element_form("Clave de acceso")));
     $elem->set_id("identification");
     $table->add_row($elem);
     $table->add_row($this->add_action("Entrar"), _HTML_SPACE);
     return $table;
 }
Ejemplo n.º 30
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     //  This allows passing arguments eithers as a GET or a POST
     $scriptargs = array_merge($_GET, $_POST);
     //  The swimteamid is the argument which must be
     //  dealt with differently for GET and POST operations
     if (array_key_exists("swimteamid", $scriptargs)) {
         $swimteamid = $scriptargs["swimteamid"];
     } else {
         if (array_key_exists("_swimteamid", $scriptargs)) {
             $swimteamid = $scriptargs["_swimteamid"];
         } else {
             if (array_key_exists(FT_DB_PREFIX . "radio", $scriptargs)) {
                 $swimteamid = $scriptargs[FT_DB_PREFIX . "radio"][0];
             } else {
                 $swimteamid = null;
             }
         }
     }
     //  Create the form
     //$form = new SwimTeamUpdateForm("Update Swim Team", $_SERVER['PHP_SELF'], 600) ;
     $form = new SwimTeamUpdateForm("Update Swim Team", null, 600);
     $form->setSwimTeamId($swimteamid);
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Update the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         //  Add the InfoTableCSS so the tables look right
         $this->add_head_css(new DefaultGUIDataListCSS());
         $swimteams = new SwimTeamsDataList("Swim Teams", '100%', "swimteamid");
         $div = html_div();
         $div->set_id("swimteamsgdl");
         $div->add($swimteams);
         $container->add($div);
         //  Update the Form Processor to the container.
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }