Ejemplo n.º 1
0
});
$app->get('/admin/_connect.html', function () {
    global $app, $smarty;
    if (get('error', 0) > 0) {
        $sPage = Data::get('home');
    } else {
        $sPage = strpos(server('HTTP_REFERER'), server('HTTP_HOST')) !== false ? str_replace('http://' . server('HTTP_HOST') . '/', '', server('HTTP_REFERER')) : Data::get('home');
    }
    $oParser = DomParser::getInstance();
    $oParser->init(ROOT . $sPage, new Infos($sPage));
    $oParser->displayConnectBox($sPage, get('error', 0));
    die;
});
$app->get('/admin/:page.html', 'admin_middleware', function ($sPage) {
    global $app, $smarty;
    $oParser = DomParser::getInstance();
    $oParser->init(ROOT . $sPage . '.html', new Infos($sPage . '.html'));
    $oParser->display($sPage);
    die;
});
$app->post('/admin/save/:ref/', 'admin_middleware', function ($sRef) use($app) {
    $oBrick = Brick::get($sRef);
    switch ($oBrick->type) {
        case 'list':
            $oBrick->content = array_purge(explode(',', post('content')));
            break;
        case 'gallery':
            for ($i = 0; $i < intval($oBrick->size); $i++) {
                if (array_access(files('member_' . $i . '_file'), 'error') != 4) {
                    if (array_access(files('member_' . $i . '_file'), 'error') > 0) {
                        die('Error transmitting file !');