/**
  * @throws \Exception
  */
 public function dispatch()
 {
     if ($this->router == null) {
         //TODO
         throw new \Exception('No valid router found', 500);
     }
     $_uri = $this->router->getURI();
     $routes = \GF\App::getInstance()->getConfig()->routes;
     $rc = null;
     if (is_array($routes) && count($routes) > 0) {
         foreach ($routes as $key => $val) {
             if (stripos($_uri, $key) === 0 && ($_uri == $key || stripos($_uri, $key . '/') === 0) && $val['namespace']) {
                 $this->namespace = $val['namespace'];
                 $_uri = substr($_uri, strlen($key) + 1);
                 $rc = $val;
                 break;
             }
         }
     } else {
         //TODO
         throw new \Exception('Default route missing', 500);
     }
     if ($this->namespace == null && $routes['*']['namespace']) {
         $this->namespace = $routes['*']['namespace'];
         $rc = $routes['*'];
     } else {
         if ($this->namespace == null && !$routes['*']['namespace']) {
             //TODO
             throw new \Exception('Default router is missing', 500);
         }
     }
     $input = \GF\InputData::getInstance();
     $params = explode('/', $_uri);
     if ($params[0]) {
         $this->controller = strtolower($params[0]);
         if ($params[1]) {
             $this->method = strtolower($params[1]);
             uset($params[0], $params[1]);
             $input->setGet(array_values($params));
         } else {
             $this->method = $this->getDefaultMethod();
         }
     } else {
         $this->controller = $this->getDefaultController();
         $this->method = $this->getDefaultMethod();
     }
     if (is_array($rc) && $rc['controllers']) {
         if ($rc['controllers'][$this->controller]['method'][$this->method]) {
             $this->method = strtolower($rc['controllers'][$this->controller]['method'][$this->method]);
         }
         if (isset($rc['controllers'][$this->controller]['to'])) {
             $this->controller = strtolower($rc['controllers'][$this->controller]['to']);
         }
     }
     $input->setPost($this->router->getPost());
     //TODO Fix it
     $f = $this->namespace . '\\' . ucfirst($this->controller);
     $newController = new $f();
     $newController->{$this->method}();
 }
Example #2
0
function douserset($data, $user)
{
    $err = '';
    $chg = getparam('Change', false);
    $api = false;
    switch ($chg) {
        case 'API Key':
            $ans = getAtts($user, 'KAPIKey.str,KAPIKey.dateexp');
            if ($ans['STATUS'] != 'ok') {
                dbdown();
            }
            // Should be no other reason?
            if (isset($ans['KAPIKey.dateexp']) && $ans['KAPIKey.dateexp'] == 'N') {
                $err = 'You can only change it once a day';
                if (isset($ans['KAPIKey.str'])) {
                    $api = $ans['KAPIKey.str'];
                }
            } else {
                $ran = $ans['STAMP'] . $user . rand(100000000, 999999999);
                $api = hash('md4', $ran);
                $day = 60 * 60 * 24;
                $ans = setAtts($user, array('ua_KAPIKey.str' => $api, 'ua_KAPIKey.date' => "now+{$day}"));
                if ($ans['STATUS'] != 'ok') {
                    syserror();
                }
            }
            break;
    }
    if ($api === false) {
        $ans = getAtts($user, 'KAPIKey.str');
        if ($ans['STATUS'] != 'ok') {
            dbdown();
        }
        // Should be no other reason?
        if (isset($ans['KAPIKey.str'])) {
            $api = $ans['KAPIKey.str'];
        }
    }
    $pg = uset($data, $user, $api, $err);
    return $pg;
}
Example #3
0
optionen
	advancedMode[]expertMode[]
zugriff auf folgende categorien
	csw[2] write 
	csr[2] read
mulselect zugriff auf mediapool
	media[2]
mulselect module
- liste der module
	module[2]module[3]
*/
if ($user_id != "") {
    $sql = new sql();
    $sql->setQuery("select * from rex_user where user_id='{$user_id}'");
    if ($sql->getRows() != 1) {
        uset($user_id);
    }
}
// Allgemeine Permissions setzen
$sel_all = new select();
$sel_all->multiple(1);
$sel_all->set_style("width:250px; height: 130px;");
$sel_all->set_size(10);
$sel_all->set_name("userperm_all[]");
$sel_all->set_id("userperm_all");
for ($i = 0; $i < count($REX[PERM]); $i++) {
    if ($i == 0) {
        reset($REX[PERM]);
    }
    $sel_all->add_option(current($REX[PERM]), current($REX[PERM]));
    next($REX[PERM]);
Example #4
0
 function remove($pos)
 {
     uset($this->_data[$pos]);
 }
*
* \author PortaMx - Portal Management Extension
* \author Copyright 2008-2015 by PortaMx - http://portamx.com
* \version Virgo 2.0 Beta 2
* \date 14.09.2015
*/
if (!defined('SMF')) {
    die('This Portamx file can\'t be run without SMF');
}
// load portal files
require_once $sourcedir . '/PortaMx/PortaMx.php';
require_once $sourcedir . '/PortaMx/SubsCompat.php';
require_once $sourcedir . '/PortaMx/SubsCache.php';
// shoutbox reload request?
if (!empty($_SESSION['pmx_shoutreload'])) {
    uset($_SESSION['pmx_shoutreload']);
    exit;
}
// get cookie host & path if not set
if (!isset($modSettings['pmx_cookparts']) || !is_array($modSettings['pmx_cookparts'])) {
    pmx_getCookieparts();
}
// handle ajax xml requests
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'xml') {
    pmx_handle_xml();
} else {
    require_once $sourcedir . '/PortaMx/LoadData.php';
    require_once $sourcedir . '/PortaMx/PortaMxIntegrate.php';
    if (!empty($modSettings['integrate_pre_load']) && strpos($modSettings['integrate_pre_load'], 'pmxsef_convertSEF') !== false) {
        require_once $sourcedir . '/PortaMx/PortaMxSEF.php';
    } elseif (isset($_GET['q'])) {