function display() { $md = \Modl\Modl::getInstance(); $supported = $md->getSupportedDatabases(); $this->view->assign('dbconnected', $md->_connected); $this->view->assign('dbinfos', sizeof($md->check())); }
function display() { $md = \modl\Modl::getInstance(); $supported = $md->getSupportedDatabases(); $cd = new \Modl\ConfigDAO(); $config = $cd->get(); $this->view->assign('dbconnected', $md->_connected); $this->view->assign('dbtype', $supported[$config->type]); $this->view->assign('dbinfos', sizeof($md->check())); $this->view->assign('websocketurl', $config->websocketurl); }
static function loadModel($name) { try { $db = Modl::getInstance(); $base = $db->modelspath . '/'; $datafolder = $base . strtolower($name) . '/'; require_once $datafolder . $name . '.php'; require_once $datafolder . $name . 'DAO.php'; $db->addModel($name); } catch (Exception $e) { echo 'Error importing new data : ' . $e->getMessage(); } }
protected function execute(InputInterface $input, OutputInterface $output) { $md = \Modl\Modl::getInstance(); if ($input->getOption('set')) { $md->check(true); $output->writeln('<info>Database updated</info>'); } else { $toDo = $md->check(); if ($toDo != null) { $output->writeln('<comment>The database needs to be updated</comment>'); foreach ($toDo as $do) { $output->writeln('<question>' . $do . '</question>'); } } else { $output->writeln('<info>Nothing to do here</info>'); } } }
function display() { $md = \modl\Modl::getInstance(); $infos = $md->check(); $errors = ''; $this->view->assign('infos', $infos); $this->view->assign('db_update', $this->call('ajaxUpdateDatabase') . "this.className='button color loading';"); try { $md->connect(); } catch (Exception $e) { $errors = $e->getMessage(); } if (file_exists(DOCUMENT_ROOT . '/config/db.inc.php')) { require DOCUMENT_ROOT . '/config/db.inc.php'; } $supported = $md->getSupportedDatabases(); $this->view->assign('connected', $md->_connected); $this->view->assign('conf', $conf); $this->view->assign('dbtype', $supported[$conf['type']]); $this->view->assign('errors', $errors); }
/** * Constructor of class Handler. * * @return void */ public static function handle($child) { $_instances = 'empty'; $user = new \User(); $db = \Modl\Modl::getInstance(); $db->setUser($user->getLogin()); $id = ''; $element = ''; // Id verification in the returned stanza if (in_array($child->getName(), array('iq', 'presence', 'message'))) { $id = (string) $child->attributes()->id; } $sess = \Session::start(); if ($id != '' && $sess->get($id) == false || $id == '') { Utils::log("Handler : Memory instance not found for {$id}"); Utils::log('Handler : Not an XMPP ACK'); Handler::handleNode($child); foreach ($child->children() as $s1) { Handler::handleNode($s1, $child); foreach ($s1->children() as $s2) { Handler::handleNode($s2, $child); } } } elseif ($id != '' && $sess->get($id) != false) { // We search an existent instance Utils::log("Handler : Memory instance found for {$id}"); $instance = $sess->get($id); $action = unserialize($instance->object); $error = false; // Handle specific query error if ($child->query->error) { $error = $child->query->error; } elseif ($child->error) { $error = $child->error; } // XMPP returned an error if ($error) { $errors = $error->children(); $errorid = Handler::formatError($errors->getName()); $message = false; if ($error->text) { $message = (string) $error->text; } Utils::log('Handler : ' . get_class($action) . ' ' . $id . ' - ' . $errorid); /* If the action has defined a special handler * for this error */ if (method_exists($action, $errorid)) { $action->method($errorid); $action->{$errorid}($errorid, $message); } // We also call a global error handler if (method_exists($action, 'error')) { Utils::log('Handler : Global error - ' . $id . ' - ' . $errorid); $action->method('error'); $action->error($errorid, $message); } } else { // We launch the object handle $action->method('handle'); $action->handle($child); } // We clean the object from the cache $sess->remove($id); } }
private function startingSession() { $s = \Sessionx::start(); $s->load(); $user = new \User(); $db = \Modl\Modl::getInstance(); $db->setUser($user->getLogin()); }