Exemplo n.º 1
0
function smarty_block_iflocation($params, $content, &$view, &$repeat)
{
    if (empty($content) || empty($params['get'])) {
        return '';
    }
    $pattern = Url::trim($params['get']);
    $needed = Url::resource($pattern, $params);
    if (empty($needed)) {
        return '';
    }
    $resource = Url::trim(\Pina\Core::resource());
    if (strpos($resource, $needed) === 0) {
        return $content;
    }
    return '';
}
Exemplo n.º 2
0
function smarty_block_iflocation($params, $content, &$view, &$repeat)
{
    if (empty($content) || empty($params['get'])) {
        return '';
    }
    $pattern = Url::trim($params['get']);
    $needed = Route::resource($pattern, $params);
    if (empty($needed)) {
        return '';
    }
    $resource = Url::trim(\Pina\Core::resource());
    if (strpos($resource, $needed) !== 0) {
        return '';
    }
    list($preg, $map) = Url::preg($params['get']);
    $data = \Pina\Core::getRequestData();
    unset($params['get']);
    $params = array_diff_key($params, array_flip($map));
    unset($data['get']);
    if (array_diff_assoc($data, $params) || array_diff_assoc($params, $data)) {
        return '';
    }
    return $content;
}
Exemplo n.º 3
0
 public function update()
 {
     $addTables = $this->findAddTables();
     if (is_array($addTables) && count($addTables) > 0) {
         foreach ($addTables as $table) {
             $tableUpdateDomain = Core::domain("Core::TableUpdate");
             $tableUpdateDomain->init(Core::table($this->tableGatewayList[$table]));
             $tableUpdateDomain->createTable();
         }
     }
     $editTables = $this->findEditTables();
     foreach ($editTables as $table => $value) {
         $tableUpdateDomain = Core::domain("Core::TableUpdate");
         $tableUpdateDomain->init(Core::table($this->tableGatewayList[$table]));
         $tableUpdateDomain->editTable();
     }
 }