public static function singleton($args = NULL) { $name = __CLASS__; if (!self::$instance) { self::$instance = new $name($args); } return self::$instance; }
function controller_models($args) { $ret = $this->GetComponentResponse("./orm_models.tpl"); /* $user = User::singleton(); if (!($user->isLoggedIn() && $user->HasRole("ORM"))) // display the access violation message $ret->SetTemplate("access_violation.tpl"); */ $orm = OrmManager::singleton(); $ret["models"] = $orm->getModels(); $ret["model"] = $args["model"]; return $ret; }
function App($rootdir, $args) { Profiler::StartTimer("WebApp", 1); Profiler::StartTimer("WebApp::Init", 1); Profiler::StartTimer("WebApp::TimeToDisplay", 1); $GLOBALS["webapp"] = $this; register_shutdown_function(array('Logger', 'processShutdown')); ob_start(); $this->rootdir = $rootdir; $this->debug = !empty($args["debug"]); $this->getAppVersion(); Logger::Info("WebApp Initializing (" . $this->appversion . ")"); Logger::Info("Path: " . get_include_path()); $this->initAutoLoaders(); Logger::Info("Turning Pandora flag on"); if (class_exists("PandoraLog")) { $pandora = PandoraLog::singleton(); $pandora->setFlag(true); } $this->locations = array("scripts" => "htdocs/scripts", "css" => "htdocs/css", "tmp" => "tmp", "config" => "config"); $this->request = $this->ParseRequest(NULL, $args); $this->locations["basedir"] = $this->request["basedir"]; $this->locations["scriptswww"] = $this->request["basedir"] . "/scripts"; $this->locations["csswww"] = $this->request["basedir"] . "/css"; $this->locations["imageswww"] = $this->request["basedir"] . "/images"; $this->InitProfiler(); $this->cfg = ConfigManager::singleton($rootdir); $this->InitProfiler(); // reinitialize after loading the config $this->locations = array_merge($this->locations, $this->cfg->locations); $this->data = DataManager::singleton($this->cfg); set_error_handler(array($this, "HandleError"), error_reporting()); DependencyManager::init($this->locations); if ($this->initialized()) { try { $this->session = SessionManager::singleton(); // Set sticky debug flag if (isset($this->request["args"]["debug"])) { $this->debug = $_SESSION["debug"] = $this->request["args"]["debug"] == 1; } else { if (!empty($_SESSION["debug"])) { $this->debug = $_SESSION["debug"]; } } $this->cobrand = $this->GetRequestedConfigName($this->request); $this->cfg->GetConfig($this->cobrand, true, $this->cfg->role); $this->ApplyConfigOverrides(); $this->locations = DependencyManager::$locations = $this->cfg->locations; // And the google analytics flag if (isset($this->request["args"]["GAalerts"])) { $this->GAalerts = $this->session->temporary["GAalerts"] = $this->request["args"]["GAalerts"] == 1 ? 1 : 0; } else { if (!empty($this->session->temporary["GAalerts"])) { $this->GAalerts = $this->session->temporary["GAalerts"]; } else { $this->GAalerts = 0; } } $this->apiversion = any($this->request["args"]["apiversion"], ConfigManager::get("api.version.default"), 0); $this->tplmgr = TemplateManager::singleton($this->rootdir); $this->tplmgr->assign_by_ref("webapp", $this); $this->components = ComponentManager::singleton($this); $this->orm = OrmManager::singleton(); //$this->tplmgr->SetComponents($this->components); } catch (Exception $e) { print $this->HandleException($e); } } else { $fname = "./templates/uninitialized.tpl"; if (($path = file_exists_in_path($fname, true)) !== false) { print file_get_contents($path . "/" . $fname); } } $this->user = User::singleton(); $this->user->InitActiveUser($this->request); // Merge permanent user settings from the URL if (!empty($this->request["args"]["settings"])) { foreach ($this->request["args"]["settings"] as $k => $v) { $this->user->SetPreference($k, $v, "user"); } } // ...and then do the same for session settings if (!empty($this->request["args"]["sess"])) { foreach ($this->request["args"]["sess"] as $k => $v) { $this->user->SetPreference($k, $v, "temporary"); } } // And finally, initialize abtests if (class_exists(ABTestManager)) { Profiler::StartTimer("WebApp::Init - abtests", 2); $this->abtests = ABTestmanager::singleton(array("cobrand" => $this->cobrand, "v" => $this->request["args"]["v"])); Profiler::StopTimer("WebApp::Init - abtests"); } Profiler::StopTimer("WebApp::Init"); }
public function init() { OrmManager::LoadModel("vrcade"); $cfg = ConfigManager::singleton(); $cfg->current["page"]["theme"] = "dark"; }
function init() { $this->conn = Outlet::getInstance(); $orm = OrmManager::singleton(); $orm->LoadModel("supercritical_navigation"); }
function LoadModel($model) { $ormmgr = OrmManager::singleton(); $ormmgr->LoadModel($model); }
public function init() { OrmManager::LoadModel("internetVRchive"); }
/** * Similar to the above function, but uses Elation's Zend Framework integration, * specifically Zend_Form and associated components to created the form from the JSON * .model file, validate/filter it, and display it. * * @param object $args * @param object $output [optional] * @return object ComponentResponse */ public function controller_create_postZend($args, $output = "inline") { $vars["args"] = $args; $vars["blogname"] = $args["blogname"]; if (!empty($args["blog"])) { $vars["blog"] = $args["blog"]; $vars["blogname"] = $vars["blog"]->blogname; } else { if (!empty($args["blogname"])) { $vars["blogname"] = $args["blogname"]; try { $vars["blog"] = OrmManager::load("Blog", $vars["blogname"]); } catch (Exception $e) { } } } if (empty($vars["blog"])) { $vars["blogs"] = OrmManager::select("Blog"); $ret = $this->GetComponentResponse("./select.tpl", $vars); } else { $vars["formname"] = $formname = "blogpost"; $form = new Elation_Form(array('file' => 'components/blog/blog.model', 'class' => 'Blog', 'variables' => array('[[validator1]]' => 'Alnum', '[[validator2]]' => 'Alpha')), Elation_Form::ELATION_OPTIONS_ZEND); $blogName = new Zend_Form_Element_Hidden(array("name" => 'blogname', "value" => $vars["blogname"])); $form->addElement($blogName); $vars['blogForm'] = $form->render('blog.form', $args); //use a component to route the form through //$vars['blogForm'] = $form->render(); //or use the default Zend_Form renderer if (!empty($args["blogpost"])) { if ($form->isValid($args)) { $args["blogpost"]["timestamp"] = new DateTime(); $blogpost = $vars[$formname] = new BlogPost($args["blogpost"]); $blogpost->SetBlog($vars["blog"]); if ($blogpost->isValid()) { if ($blogpost->Save()) { // FIXME - make configurable //Perhaps redirect back to this controller so we can show success header("Location: ?blogname=" . urlencode($vars["blogname"]) . "#blog_posts_create_success:" . $blogpost->blogpostid); } } } else { $vars['formError'] = true; $formErrors = $form->getMessages(); $vars['subjectErrors'] = $formErrors['subject']; $vars['contentErrors'] = $formErrors['content']; } } $ret = $this->GetComponentResponse("./create_postZend.tpl", $vars); } return $ret; }
public function init() { OrmManager::LoadModel("demos"); }
function App($rootdir, $args) { Profiler::StartTimer("WebApp", 1); Profiler::StartTimer("WebApp::Init", 1); Profiler::StartTimer("WebApp::TimeToDisplay", 1); // disable notices by default. This should probably be a config option... error_reporting(error_reporting() ^ E_NOTICE); // FIXME - xdebug recursion limit causes problems in some components... ini_set('xdebug.max_nesting_level', 250); $GLOBALS["webapp"] = $this; register_shutdown_function(array($this, 'shutdown')); ob_start(); $this->rootdir = $rootdir; $this->debug = !empty($args["debug"]); $this->getAppVersion(); Logger::Info("WebApp Initializing (" . $this->appversion . ")"); Logger::Info("Path: " . get_include_path()); $this->initAutoLoaders(); if (class_exists("PandoraLog")) { Logger::Info("Turning Pandora flag on"); $pandora = PandoraLog::singleton(); $pandora->setFlag(true); } $this->InitProfiler(); $this->request = $this->ParseRequest(NULL, $args); $this->cfg = ConfigManager::singleton(array("rootdir" => $rootdir, "basedir" => $this->request["basedir"])); $this->locations = ConfigManager::getLocations(); $this->InitProfiler(); // reinitialize after loading the config Profiler::StartTimer("WebApp::Init - handleredirects", 1); $this->request = $this->ApplyRedirects($this->request); Profiler::StopTimer("WebApp::Init - handleredirects"); $this->data = DataManager::singleton($this->cfg); set_error_handler(array($this, "HandleError"), error_reporting()); DependencyManager::init($this->locations); if ($this->initialized()) { try { $this->session = SessionManager::singleton(); // Set sticky debug flag if (isset($this->request["args"]["debug"])) { $this->debug = $_SESSION["debug"] = $this->request["args"]["debug"] == 1; } else { if (!empty($_SESSION["debug"])) { $this->debug = $_SESSION["debug"]; } } $this->cobrand = $this->GetRequestedConfigName($this->request); if (isset($this->request["args"]["_role"])) { $this->role = $this->request["args"]["_role"]; } else { if (isset($this->cfg->servers["role"])) { $this->role = $this->cfg->servers["role"]; } else { $this->role = "dev"; } } $this->cfg->GetConfig($this->cobrand, true, $this->role); $this->ApplyConfigOverrides(); $this->locations = DependencyManager::$locations = $this->cfg->locations; // And the google analytics flag if (isset($this->request["args"]["GAalerts"])) { $this->GAalerts = $this->session->temporary["GAalerts"] = $this->request["args"]["GAalerts"] == 1 ? 1 : 0; } else { if (!empty($this->session->temporary["GAalerts"])) { $this->GAalerts = $this->session->temporary["GAalerts"]; } else { $this->GAalerts = 0; } } $this->apiversion = isset($this->request["args"]["apiversion"]) ? $this->request["args"]["apiversion"] : ConfigManager::get("api.version.default", 0); $this->tplmgr = TemplateManager::singleton($this->locations); $this->tplmgr->assign_by_ref("webapp", $this); $this->components = ComponentManager::singleton($this); if (class_exists("OrmManager")) { $this->orm = OrmManager::singleton($this->locations); } //$this->tplmgr->SetComponents($this->components); } catch (Exception $e) { print $this->HandleException($e); } } else { $fname = "components/elation/templates/uninitialized.html"; if (($path = file_exists_in_path($fname, true)) !== false) { print file_get_contents($path . "/" . $fname); } } $this->user = User::singleton(); $this->user->InitActiveUser($this->request); // Merge permanent user settings from the URL if (!empty($this->request["args"]["settings"])) { foreach ($this->request["args"]["settings"] as $k => $v) { $this->user->SetPreference($k, $v, "user"); } } // ...and then do the same for session settings if (!empty($this->request["args"]["sess"])) { foreach ($this->request["args"]["sess"] as $k => $v) { $this->user->SetPreference($k, $v, "temporary"); } } // And finally, initialize abtests if (class_exists("ABTestManager")) { Profiler::StartTimer("WebApp::Init - abtests", 2); $this->abtests = ABTestmanager::singleton(array("cobrand" => $this->cobrand, "v" => $this->request["args"]["v"])); Profiler::StopTimer("WebApp::Init - abtests"); } Profiler::StopTimer("WebApp::Init"); }
function controller_test($args) { $foo = OrmManager::create(); }
function init() { $this->orm = OrmManager::singleton(); $this->orm->LoadModel("mail"); }
public function init() { OrmManager::LoadModel("share"); }
public static function get($usertype, $userid) { $user = OrmManager::load("UserModel", array($usertype, $userid)); if (!empty($user)) { $user->credentials = false; // strip out credentials return new User($user); } return false; }
public function init() { OrmManager::LoadModel("hack"); ConfigManager::set("page.theme", false); }
public function init() { OrmManager::LoadModel("window"); }
public function init() { OrmManager::LoadModel("desktop"); }
public function init() { OrmManager::LoadModel("user"); }
public function init() { OrmManager::LoadModel("bball"); }