function storeDelegate(&$event)
 {
     $aView = $event->getArgument('view');
     $view = implode(':', $aView);
     $config =& zmgFactory::getConfig();
     $events =& zmgFactory::getEvents();
     $request =& zmgFactory::getRequest();
     switch ($view) {
         case "admin:settings:store":
             $request->setResult($config->update($_POST, false));
             break;
         case stristr($view, "admin:settings:plugins:autodetect"):
             $tool = trim($aView[count($aView) - 1]);
             if ($tool == "autodetect") {
                 $tool = "all";
             } else {
                 $tool = array($tool);
             }
             $events->fire('onautodetect', false, $tool);
             break;
         case stristr($view, "admin:update:mediacount"):
             $filter = intval(array_pop($aView));
             $zoom =& zmgFactory::getEvents()->fire('ongetcore');
             $request->setResult($zoom->getMediumCount($filter));
             break;
         case "admin:galleryedit:store":
             zmgimport('org.zoomfactory.var.plugins.datastore.stores.galleryStore');
             zmgGalleryStore::process();
             break;
         case "admin:galleryedit:delete":
             zmgimport('org.zoomfactory.var.plugins.datastore.stores.galleryStore');
             zmgGalleryStore::delete();
             break;
         case "admin:mediumedit:store":
             zmgimport('org.zoomfactory.var.plugins.datastore.stores.mediumStore');
             zmgMediumStore::process();
             break;
         case stristr($view, "admin:mediaupload:store"):
             //SWFUpload needs HTTP headers to signal the user...
             $method = stristr($view, "jupload") ? "jupload" : "swfupload";
             $events->fire('onupload', false, $method);
             //exit;
             break;
         case stristr($view, "admin:mediaupload:update"):
             $gid = array_pop($aView);
             $events->fire('onuploadupdate', false, $gid);
             break;
         case stristr($view, "admin:update:mediacount"):
             $gid = intval(array_pop($aView));
             $zoom =& zmgFactory::getEvents()->fire('ongetcore');
             echo $zoom->getMediumCount($gid);
             break;
         default:
             break;
     }
 }
 function throwError($message)
 {
     if (true) {
         //!zmgEnv::isRPC()) {
         return zmgError::throwError($message);
     } else {
         return zmgFactory::getRequest()->sendHeaders($this->_viewtype, true, $message);
     }
 }
 function getResult()
 {
     $request =& zmgFactory::getRequest();
     return $request->getResult();
 }
defined('_ZMG_EXEC') or die('Restricted access');
include 'zmgFunctions.php';
//make the object factory available for all other classes
zmgimport('org.zoomfactory.lib.zmgFactory');
//load the error handling base class
zmgimport('org.zoomfactory.lib.zmgError');
//initialize Smarty template engine
zmgimport('org.zoomfactory.lib.smarty.Smarty');
//import other useful stuff
zmgimport('org.zoomfactory.lib.zmgHTML');
if (!class_exists('InputFilter')) {
    zmgimport('org.zoomfactory.lib.phpinputfilter.inputfilter');
}
$config =& zmgFactory::getConfig();
$events =& zmgFactory::getEvents();
$request =& zmgFactory::getRequest();
$view =& zmgFactory::getView();
$events->fire('onstartup');
$events->fire('onstarted');
if (!$config->isInstalled()) {
    $config->firstRun();
}
$view->setViewType(zmgEnv::getViewType());
//set error handling options
zmgError::setErrorHandling($config->get('app/errors/defaultmode'), $config->get('app/errors/defaultoption'));
//load php-gettext (used in zoom in 'fallback mode')
zmgimport('org.zoomfactory.lib.phpgettext.gettext_inc');
// gettext setup
T_setlocale(LC_ALL, $config->get('locale/default'));
// Set the text domain as 'messages'
$domain = $config->get('locale/domain');