Example #1
0
 function done($locator)
 {
     $response = $locator->get('Response');
     $url = new URL('action');
     $response->setRedirect($url->getURL('foo'));
     #		echo 'Form1View: DoneHandler: STATE DONE<br/>';
 }
Example #2
0
 public function alterar(URL $url)
 {
     $where = "WHERE " . self::ID . " = '" . $url->getId() . "'";
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::URL, $url->getURL(), $where);
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::TABELA, $url->tabela, $where);
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::CAMPO, $url->campo, $where);
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::VALOR, $url->valor, $where);
 }
Example #3
0
 /**
  * Get FROB URL
  *
  * @param   &com.flickr.xmlrpc.Client client
  * @return  string url
  */
 public function getFrobURL($client)
 {
     $arguments = array('frob' => $this->getFrobValue(), 'perms' => 'read');
     $arguments = $client->signArray($arguments);
     $url = new URL('http://flickr.com/services/auth');
     $url->addParams($arguments);
     return $url->getURL();
 }
Example #4
0
 /**
  * Constructor
  *
  * @param   util.cmd.ParamString args
  */
 public function __construct(ParamString $args)
 {
     $url = new URL($args->value(0));
     // If protocol string does not contain port number, set default.
     if (self::ESDL_PORT === $url->getPort(self::ESDL_PORT)) {
         $url->setPort(self::ESDL_PORT);
     }
     // Check given URL to inform user if invalid port used.
     if (self::ESDL_PORT !== $url->getPort()) {
         Console::$err->writeLine('Notice: using non-standard port ' . $url->getPort() . ', ESDL services are usually available at port 6449.');
     }
     $this->remote = Remote::forName($url->getURL());
     $this->jndi = $args->value(1);
     $this->processor = new DomXSLProcessor();
     $this->processor->setXSLBuf($this->getClass()->getPackage()->getResource($args->value('lang', 'l', 'xp5') . '.xsl'));
 }
 /**
  * Extract a ".ar" file into a given target directory
  *
  * @param   string base
  * @param   string ar
  * @param   io.Folder target
  * @throws  lang.IllegalStateException in case the target is not found
  * @throws  lang.FormatException in case the .ar-file is not parseable
  */
 protected function extract($base, $ar, Folder $target)
 {
     // Open a HTTP connection
     $url = new URL($base . $ar . '.ar');
     $r = create(new HttpConnection($url))->get();
     if (HttpConstants::STATUS_OK != $r->getStatusCode()) {
         throw new IllegalStateException(sprintf('Unexpected response %d:%s for %s', $r->getStatusCode(), $r->getMessage(), $url->getURL()));
     }
     $in = new BufferedInputStream($r->getInputStream());
     do {
         // Seach for first section header, --[LENGTH]:[FILENAME]-- and parse it
         do {
             $line = $this->readLine($in);
             if (!$in->available()) {
                 throw new FormatException('Cannot locate section header');
             }
         } while (2 !== sscanf($line, '--%d:%[^:]--', $length, $filename));
         // Calculate target file
         $file = new File($target, $filename);
         $folder = new Folder($file->getPath());
         $folder->exists() || $folder->create();
         Console::writef('     >> [%-10s] %s (%.2f kB) [%s]%s', $ar, $filename, $length / 1024, str_repeat('.', self::PROGRESS_INDICATOR_WIDTH), str_repeat("", self::PROGRESS_INDICATOR_WIDTH + 1));
         // Transfer length bytes into file
         $c = 0;
         $out = $file->getOutputStream();
         $size = 0;
         while ($size < $length) {
             $chunk = $in->read(min(0x1000, $length - $size));
             $size += strlen($chunk);
             $out->write($chunk);
             // Update progress
             $d = ceil($size / $length * self::PROGRESS_INDICATOR_WIDTH);
             if ($d == $c) {
                 continue;
             }
             Console::write(str_repeat('#', $d - $c));
             $c = $d;
         }
         $out->close();
         Console::writeLine();
     } while ($in->available() > 0);
     $in->close();
 }
Example #6
0
        $lastUrl = "users";
    } else {
        if (URL::getURL(1) == "config") {
            $lastUrl = "config";
        } else {
            if (URL::getURL(1) == "modulos") {
                $lastUrl = "modulos";
            }
        }
    }
}
if (URL::getURL(0) == "perfil") {
    $lastUrl = "perfil";
}
if (URL::getURL(0) == "modulos") {
    $lastUrl = URL::getURL(1);
}
?>
		    <li><a <?php 
if ($lastUrl === 'perfil') {
    echo 'class="active"';
}
?>
 href="<?php 
echo URL::getBase();
?>
perfil/"><i class="fa fa-fw fa-book"></i><span class="title">Perfil</span></a></li>
		    <li>
			<a <?php 
if ($lastUrl === 'modulo') {
    echo 'class="active"';
Example #7
0
                     if ($stmt->num_rows > 0) {
                         if (file_exists(MODULOS . "_modulos/_{$modulo}/" . $app . ".php")) {
                             //carrega a pagina
                             require_once MODULOS . "_modulos/_{$modulo}/" . $app . ".php";
                         } else {
                             require_once "erro404.php";
                         }
                     } else {
                         require_once "erro503admin.php";
                     }
                 }
             }
         }
     }
 } else {
     $system = URL::getURL(3);
     if ($system == null) {
         $system = "index";
     }
     if ($privilegio === 'administrador') {
         //carrega a pagina indicada na url
         if (file_exists(MODULOS . "_modulos/_{$modulo}/_{$app}/" . $system . ".php")) {
             //carrega a pagina
             require_once MODULOS . "_modulos/_{$modulo}/_{$app}/" . $system . ".php";
         } else {
             require_once "erro404.php";
         }
     } else {
         //carrega os menu dos modulos de acordo com a permissão do susuário
         if ($stmt = $mysqli->prepare("SELECT codigo, nome FROM modulo INNER JOIN modulo_permissao mp ON (mp.codigo_modulo = modulo.codigo) WHERE mp.codigo_usuario = ? AND modulo.codigo = 1 AND `modulo`.`status` = 'ativo' ")) {
             $stmt->bind_param('i', $user_id);
Example #8
0
 <?php 
$systemUser = URL::getURL(2);
if ($systemUser == null) {
    $systemUser = "******";
}
//carrega a pagina indicada na url
if (file_exists(MODULOS . "_administrador/_users/" . $systemUser . ".php")) {
    //carrega a pagina
    require_once MODULOS . "_administrador/_users/" . $systemUser . ".php";
} else {
    require_once "erro404admin.php";
}
Example #9
0
    /*Processo precisa ser adicionado manualmente*/
    if ($ajaxsubmodulo != "app") {
        //pasta administrador
        if ($ajaxsubmodulo == "users" || $ajaxsubmodulo == "modulos" || $ajaxsubmodulo == "config") {
            $pathAjax = "_administrador/";
        }
        //referente ao perfil
        if ($ajaxsubmodulo == "perfil") {
            $pathAjax = "_perfil/";
        }
        /*Os modulos serгo ordenados por numeraзгo. Cada vez que um mуdulo for adicionado, incrementar com o seu devido diretуrio*/
        //carrega a pagina indicada na url
        if (file_exists(MODULOS . $pathAjax . $ajaxsubmodulo . ".php")) {
            //carrega a pagina
            require_once MODULOS . $pathAjax . $ajaxsubmodulo . ".php";
        } else {
            require_once "erro404admin.php";
        }
    } else {
        $pathAjax = "_modulos/";
        $pathModulo = "_" . URL::getURL(2) . "/";
        $pathApp = "_" . URL::getURL(3) . "/";
        $ajaxApp = URL::getURL(4);
        if (file_exists(MODULOS . $pathAjax . $pathModulo . $pathApp . $ajaxApp . ".php")) {
            //carrega a pagina
            require_once MODULOS . $pathAjax . $pathModulo . $pathApp . $ajaxApp . ".php";
        } else {
            require_once "erro404admin.php";
        }
    }
}
 public function doCreate()
 {
     $req = $this->newRequest('GET', new URL('http://localhost/'));
     $res = new HttpScriptletResponse();
     $s = newinstance('scriptlet.xml.XMLScriptlet', array(), '{
     public function needsSession($request) { return TRUE; }
   }');
     $s->service($req, $res);
     $this->assertEquals(HttpConstants::STATUS_FOUND, $res->statusCode);
     // Check URL from Location: header contains the session ID
     with($redirect = new URL(substr($res->headers[0], strlen('Location: '))));
     $this->assertEquals('http', $redirect->getScheme());
     $this->assertEquals('localhost', $redirect->getHost());
     $this->assertEquals(sprintf('/xml/psessionid=%s/static', session_id()), $redirect->getPath());
     $this->assertEquals(array(), $redirect->getParams(), $redirect->getURL());
 }
Example #11
0
 <?php 
$systemModule = URL::getURL(2);
if ($systemModule == null) {
    $systemModule = "config";
}
//carrega a pagina indicada na url
if (file_exists(MODULOS . "_administrador/_config/" . $systemModule . ".php")) {
    //carrega a pagina
    require_once MODULOS . "_administrador/_config/" . $systemModule . ".php";
} else {
    require_once "erro404admin.php";
}
Example #12
0
 <?php 
$perfilUser = URL::getURL(2);
if ($perfilUser == null) {
    $perfilUser = "******";
}
//carrega a pagina indicada na url
if (file_exists(MODULOS . "_perfil/_perfil/" . $perfilUser . ".php")) {
    //carrega a pagina
    require_once MODULOS . "_perfil/_perfil/" . $perfilUser . ".php";
} else {
    require_once "erro404admin.php";
}
Example #13
0
<?php

$submodulo = URL::getURL(1);
if ($submodulo == null) {
    $submodulo = "perfil";
}
//carrega a pagina indicada na url
if (file_exists(MODULOS . "_perfil/" . $submodulo . ".php")) {
    //carrega a pagina
    require_once MODULOS . "_perfil/" . $submodulo . ".php";
} else {
    require_once "erro404admin.php";
}
 /**
  * Returns string representation for the URL
  *
  * The URL is build by using sprintf() and the following
  * parameters:
  * <pre>
  * Ord Fill            Example
  * --- --------------- --------------------
  *   1 scheme          http
  *   2 host            host.foo.bar
  *   3 path            /foo/bar/index.html
  *   4 dirname(path)   /foo/bar/
  *   5 basename(path)  index.html
  *   6 query           a=b&b=c
  *   7 session id      cb7978876218bb7
  *   8 fraction        #test
  * </pre>
  *
  * @return string
  */
 public function getURL()
 {
     $sessionId = $this->getSessionId();
     if ($sessionId) {
         $cloned = clone $this;
         $cloned->setParam('psessionid', $sessionId);
         $cloned->setSessionId(NULL);
         return $cloned->getURL();
     }
     return parent::getURL();
 }
Example #15
0
<?php

require_once "load.php";
sec_session_start();
//verifica se ja foi logado
$mysqli = conectabd(BD_PRINCIPAL);
$modulo = URL::getURL(0);
//qualquer url direcionada no admin voltara para o login se n�o estiver logado
if (!login_check($mysqli) && $modulo != null) {
    header("Location: " . URL::getBase());
}
//verifica se foi autenticado
if (login_check($mysqli)) {
    if ($modulo == null) {
        $modulo = "index";
    }
    if ($modulo == "ajax" && file_exists(MODULOS . $modulo . ".php")) {
        require_once MODULOS . $modulo . ".php";
    } else {
        if (file_exists(MODULOS . $modulo . ".php")) {
            //carrega o header
            require_once MODULOS . 'header.php';
            //carrega a pagina
            require_once MODULOS . $modulo . ".php";
            //carrega o footer
            require_once MODULOS . 'footer.php';
        } else {
            require_once "erro404admin.php";
        }
    }
} else {
Example #16
0
 function display_prev()
 {
     $from = $this->from();
     $to = $this->to();
     $incr = $this->incr();
     $max = $this->max();
     $class = $this->cssclass();
     $url = new URL();
     $nfrom = $from + $incr;
     $nto = $to + $incr;
     $url->initCurURL();
     $url->setGet('to', $nto);
     $url->setGet('from', $nfrom);
     $next = $url->getURL();
     $pfrom = $from - $incr;
     $pto = $from;
     $url->initCurURL();
     $url->setGet('to', $pto);
     $url->setGet('from', $pfrom);
     $previous = $url->getURL();
     if ($pfrom >= 0 && $pto >= 0) {
         echo '<a class="' . $class . '_prev" href="' . $previous . '">';
     }
     echo '&lt;- Prev';
     if ($pfrom >= 0 && $pto >= 0) {
         echo ' (' . $pfrom . ')';
     }
     if ($pfrom >= 0 && $pto >= 0) {
         echo '</a>';
     }
 }
Example #17
0
 public function setArrayParam()
 {
     $u = new URL('http://localhost/');
     $u->setParam('x', array('y', 'z'));
     $this->assertEquals('http://localhost/?x[]=y&x[]=z', $u->getURL());
 }
 public function createSession()
 {
     $this->newRequest('GET', new URL('http://localhost/'));
     $s = newinstance('scriptlet.HttpScriptlet', array(), '{
     public function needsSession($request) { return TRUE; }
   }');
     $response = $s->process();
     $this->assertEquals(HttpConstants::STATUS_FOUND, $response->statusCode);
     // Check URL from Location: header contains the session ID
     with($redirect = new URL(substr($response->headers[0], strlen('Location: '))));
     $this->assertEquals('http', $redirect->getScheme());
     $this->assertEquals('localhost', $redirect->getHost());
     $this->assertEquals('/', $redirect->getPath());
     $this->assertEquals(session_id(), $redirect->getParam('psessionid', ''), $redirect->getURL());
 }