Esempio n. 1
0
        return false;
    }
    // inside "@"
    $vs = array('message' => $msg, 'file' => $file, 'line' => $line, 'nr' => $nr, 'backtrace' => debug_backtrace(0));
    error_report($vs);
    //return false;
}, E_ALL | E_STRICT);
// fatal errors
register_shutdown_function(function () {
    // what about errors occurring in other shutdown_functions?
    $error = error_get_last();
    if ($error !== null) {
        $fatals = array(E_USER_ERROR => 'Fatal Error', E_ERROR => 'Fatal Error', E_PARSE => 'Parse Error', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning');
        if (isset($fatals[$error['type']])) {
            $error['message'] = $fatals[$error['type']] . ': ' . $error['message'];
            error_report($error);
        }
    }
    ini_set("log_errors", 1);
});
ini_set("log_errors", 0);
qg::on('deliverHtml', function () {
    if (G()->SET['error_report']['javascript']->v) {
        html::$compressJs = false;
        if (G()->SET['error_report']['javascript TraceKit']->v) {
            html::addJsFile(sysURL . 'error_report/pub/tracekit/tracekit.js', 'core');
            // tracekit needs jquery
        }
        html::addJsFile(sysURL . 'error_report/pub/main.js', 'core');
    }
});
Esempio n. 2
0
            }
        }
        return (string) $this->value;
    }
    function set($v)
    {
        cache('textpro', $this->lang, $this->Text->id)->remove();
        $this->value = null;
        return D()->text->ensure(array('text' => $v, 'id' => $this->Text->id, 'lang' => $this->lang));
    }
    function __toString()
    {
        return $this->get();
    }
}
function cmsTextReplaceLinks($treffer)
{
    $P = Page($treffer[1]);
    return $P->url();
}
$removeCache = function ($e) {
    extract($e, EXTR_REFS);
    // Table, id, data
    if ($Table->_name === 'text') {
        cache('textpro', $data['lang'], $data['id'])->remove();
    }
};
qg::on('dbTable::update-after', $removeCache);
qg::on('dbTable::delete-after', $removeCache);
qg::on('dbTable::insert-after', $removeCache);
Esempio n. 3
0
<?php

qg::on('deliverHtml', function () {
    if (G()->SET['m']['js.webshims']['enable']->setType('bool')->v) {
        $url = sysURL . 'js.webshims/js-webshim/minified/';
        html::addJsFile($url . 'polyfiller.js', 'core');
        html::$js .= "\$.webshims.cfg.basePath = '" . $url . "shims/';";
        html::$js .= "\$.webshims.polyfill('forms forms-ext');";
    }
});
Esempio n. 4
0
<?php

qg::on('action', function () {
    if (strpos(appRequestUri, 'editor/') === 0 && isset($_GET['file'])) {
        /* wird bereits geprüft zzz
        			if (!isset($_GET['file'])) {
                      echo 'no file'; exit();
                    }
                    */
        $file = urldecode($_GET['file']);
        if (!isset($_SESSION['fileEditor']['allow'][$file]) && !Usr()->superuser) {
            echo 'no access';
            exit;
        }
        !is_dir(dirname($file)) && mkdir(dirname($file));
        !is_file($file) && touch($file);
        if ($ask = G()->ASK) {
            $done = 0;
            if (isset($ask['save']) && is_file($file)) {
                copy($file, appPATH . 'cache/tmp/pri/fileEditorBackup_' . urlencode($file) . '_' . date('dmYhi'));
                if (file_put_contents($file, $ask['save']) && is_writable($file)) {
                    $done = 1;
                }
            }
            Answer($done);
        }
        globalTemplate(sysPATH . 'fileEditor/view/html-template.php');
        include sysPATH . 'fileEditor/view/codemirror.php';
        exit;
    }
});
Esempio n. 5
0
    extract($e, EXTR_REFS);
    // Table, id, data
    if ($Table->Db->{'_vers_' . $Table->_name}) {
        D()->query(" REPLACE INTO _vers_" . $Table->_name . " " . " SELECT *, " . liveLog::$id . " AS _vers_log, " . vers::$space . " AS _vers_space, 0 AS _vers_deleted " . " FROM " . $Table->_name . " WHERE " . $Table->entryId2where($id));
    }
});
qg::on('dbTable::delete-after', function ($e) {
    extract($e, EXTR_REFS);
    // Table, id, data
    if ($Table->Db->{'_vers_' . $Table->_name}) {
        D()->query(" REPLACE INTO _vers_" . $Table->_name . " " . " SET " . $Table->valuesToSet($Table->entryId2Array($id)) . ", _vers_log = " . liveLog::$id . ", _vers_space = " . vers::$space . ", _vers_deleted = 1 ");
    }
});
qg::on('table', function ($e) {
    if (vers::$log) {
        $e['table'] = vers::table($e['table']);
    }
});
class vers
{
    static $db = array();
    static $space = 0;
    static $log = 0;
    static $cacheEnabledBefore = 1;
    static function setLog($log = 0)
    {
        $log = (int) $log;
        if ($log) {
            self::$cacheEnabledBefore = cache::$enabled;
            cache::$enabled = false;
        } else {
Esempio n. 6
0
<?php

namespace qg;

qg::on('action', function () {
    // use 'render' ? would be .5 miliseconds slower :(
    if (strpos(appRequestUri, 'dbFile/') === 0) {
        $request = substr(appRequestUri, 7);
        dbFile::output($request);
    }
    File::uploadListener();
    if (isset($_GET['qgha'])) {
        $ok = hashAction::fire($_GET['qgha']);
    }
    if (isset(G()->ASK['serverInterface'])) {
        foreach (G()->ASK['serverInterface'] as $id => $vs) {
            $ret['serverInterface'][$id] = Api::call($vs['fn'], $vs['args']);
        }
        Answer($ret);
    }
});
/*
 qg::on('deliverHtml', function() {
 		html::addJSFile(sysURL.'core/js/c1.js','core');

 		// old ie
 		$matches = preg_match('/MSIE ([0-9.]+)/',$_SERVER['HTTP_USER_AGENT'], $match);
 		if (isset($match[1]) && $match[1] < 9) {
 		html::addJSFile(sysURL.'core/js/jQuery1.js','core');
 		} else {
 		html::addJSFile(sysURL.'core/js/jQuery.js','core');
Esempio n. 7
0
qg::on('action', function () {
    // use 'render' ? would be .5 miliseconds slower :(
    liveSess::$maxpause = G()->SET['qg']['session']['maxpause']->v;
    liveSess::init();
    G()->win = isset(G()->ASK['rTicket']) ? G()->ASK['rTicket'] : (isset($_GET['rTicket']) ? $_GET['rTicket'] : null);
    if (G()->win && !rTicket::check(G()->win)) {
        Answer(array('info' => 'rTicket nicht gültig'));
    }
    if (!G()->win) {
        G()->win = rTicket::get();
    }
    L::init();
    liveLog::init();
    // todo: country from ip?
    $l_country = 'ch';
    if (Usr()->is()) {
        $values = Usr()->getVs();
        if (isset($values['country']) && $values['country']) {
            $l_country = $values['country'];
        }
    }
    $winCountryTranslate = array('ch' => 's', 'at' => 'a', 'de' => 'u', 'it' => 'a', 'fr' => 'a', 'pl' => 'k');
    setLocale(LC_ALL, L() . '_' . strtoupper($l_country) . '.utf8', L() . $winCountryTranslate[strtolower($l_country)], L());
    if (strpos(appRequestUri, 'dbFile/') === 0) {
        $request = substr(appRequestUri, 7);
        dbFile::output($request);
    }
    File::uploadListener();
    if (isset($_GET['qgha'])) {
        $ok = hashAction::fire($_GET['qgha']);
    }
    if (isset(G()->ASK['serverInterface'])) {
        foreach (G()->ASK['serverInterface'] as $id => $vs) {
            $ret['serverInterface'][$id] = Api::call($vs['fn'], $vs['args']);
        }
        Answer($ret);
    }
});
Esempio n. 8
0
            exit('no files');
        }
        $Zip = new Zip();
        $tmpfname = appPATH . 'cache/tmp/pri/' . randString() . '.zip';
        $Zip->open($tmpfname, Zip::CREATE);
        foreach ($P->Files() as $File) {
            $Zip->addFile($File->path, $File->name());
        }
        $Zip->close();
        $filename = isset($_GET['filename']) ? $_GET['filename'] : 'files_' . $P . '.zip';
        header('Content-Type: application/zip');
        header('Content-Disposition: attachment; filename=' . $filename);
        header('Content-Length: ' . filesize($tmpfname));
        readfile($tmpfname);
        unlink($tmpfname);
        exit;
    }
});
qg::on('dbFile::access', function ($e) {
    if ($e['access']) {
        return;
    }
    foreach (D()->query("SELECT page_id FROM page_file WHERE file_id = " . $e['File']) as $vs) {
        $P = Page($vs['page_id']);
        if ($P->is() && $P->access()) {
            // todo: better $P->isReadable() ?
            $e['access'] = 1;
            return;
        }
    }
});
Esempio n. 9
0
<?php

namespace qg;

qg::on('action', function () {
    if (!isset($_GET['file']) || strpos(appRequestUri, 'editor') !== 0) {
        return;
    }
    $file = urldecode($_GET['file']);
    if (!isset($_SESSION['fileEditor']['allow'][$file]) && !Usr()->superuser) {
        echo 'no access';
        exit;
    }
    !is_dir(dirname($file)) && mkdir(dirname($file));
    !is_file($file) && touch($file);
    if ($ask = G()->ASK) {
        $done = 0;
        if (isset($ask['save']) && is_file($file)) {
            copy($file, appPATH . 'cache/tmp/pri/fileEditorBackup_' . urlencode($file) . '_' . date('dmYhi'));
            if (file_put_contents($file, $ask['save']) && is_writable($file)) {
                $done = 1;
            }
        }
        Answer($done);
    }
    /* neu */
    $T = new template(array('file' => $file));
    echo $T->get(sysPATH . 'fileEditor/view/codemirror.php');
    exit;
});
Esempio n. 10
0
qg::on('deliverHtml', function () {
    if (isset($_GET['qgCmsNoFrontend'])) {
        return;
    }
    if (Page()->edit) {
        html::addJSFile(sysURL . 'core/js/c1.js', 'core');
        // old ie
        $matches = preg_match('/MSIE ([0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $match);
        if (isset($match[1]) && $match[1] < 9) {
            html::addJSFile(sysURL . 'core/js/jQuery1.js', 'cms/edit');
        } else {
            html::addJSFile(sysURL . 'core/js/jQuery.js', 'cms/edit');
        }
        $matches && header('X-UA-Compatible: IE=Edge,chrome=1');
        html::addJSFile(sysURL . 'core/js/qg/divers.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms/pub/js/cms.js', 'cms/edit');
        html::addJsFile(sysURL . 'core/js/c1.js', 'cms/edit');
        html::addJsFile(sysURL . 'core/js/c1/fix.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qg/fakeSelect.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/jQuery/ui.js', 'cms/edit');
        //html::addJSFile( sysURL.'core/js/jQuery/ui.touch-punch.js',   'cms/edit');
        html::addJSFile(sysURL . 'core/js/qg/fileHelpers.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgRte/crossbrowser.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgRte/htmlparser.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgRte/helpers.js', 'cms/edit');
        html::addCSSFile(sysURL . 'core/js/qgRte/main.css', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgRte/Rte.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgRte/Rte.ui.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgRte/Rte.ui.items.js', 'cms/edit');
        html::addJsFile(sysURL . 'core/js/jQuery/fn/dynatree.js', 'cms/edit');
        html::addCSSFile(sysURL . 'core/js/jQuery/fn/dynatree/skin-vista/ui.dynatree.css', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgCalendar/date_extend.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgCalendar/qgCalendar.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgCalendar/qgDatePicker.js', 'cms/edit');
        html::addJSFile(sysURL . 'core/js/qgCalendar/timepicker/nogray_time_picker.js', 'cms/edit');
        html::addCSSFile(sysURL . 'core/js/qgCalendar/calendar.css', 'cms/edit');
        html::addJsFile(sysURL . 'core/js/qg/tableHandles.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms/pub/js/rte.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms/pub/js/dropPaste.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms/pub/js/dropPasteHelper.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms.frontend.0/pub/js/frontend.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms.frontend.0/pub/js/ddConts.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms.frontend.0/pub/js/panel.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms.frontend.0/pub/js/tree.js', 'cms/edit');
        html::addJSFile(sysURL . 'cms.frontend.0/pub/js/contextmenu.js', 'cms/edit');
        //html::addJSFile( sysURL.'cms/pub/js/help.js',                 'cms/edit');
        html::addCSSFile(sysURL . 'core/css/q1Rst.css', 'cms/edit');
        html::addCSSFile(sysURL . 'cms.frontend.0/pub/css/main.css', 'cms/edit');
        html::addCSSFile(sysURL . 'cms.frontend.0/pub/css/panel.css', 'cms/edit');
        html::addCSSFile(sysURL . 'cms.frontend.0/pub/css/tree.css', 'cms/edit');
    } else {
        html::addCSSFile(sysURL . 'cms.frontend.0/pub/css/off.css', 'cms/noEdit');
    }
});
Esempio n. 11
0
            }
            if (G()->SET['cms']['pages']->has($Cont->id)) {
                // todo: old settings are cached for other pages
                $Cont->SET->get();
            } else {
                $Cont->_SET = array();
            }
        };
        vers::setLog($_GET['qgCmsVersLog']);
        $generate($pid);
        vers::setLog(0);
    }
});
qg::on('deliverHtml', function () {
    if (Page()->edit && !isset($_GET['qgVers'])) {
        html::addJsFile(sysURL . 'cms.versions/pub/vers.js');
    }
});
class serverInterface_cms_vers
{
    static function rollBackCont($pid, $log)
    {
        $Cont = Page($pid);
        if ($Cont->access() < 2) {
            return false;
        }
        backToLog($pid, $log);
    }
}
function backtoLog($pid, $log)
{
Esempio n. 12
0
    function getImages()
    {
        $path = $this->customPath() . 'img/';
        !is_dir($path) && mkdir($path);
        $url = path2uri($path);
        $ret = array();
        foreach (scanDir($path) as $f) {
            if (!is_file($path . $f)) {
                continue;
            }
            $ret[] = $url . $f;
        }
        return $ret;
    }
}
qg::on('action', function () {
    // deprecated?
    if (isset($_GET['mCmsLayouter3_uploadPid'])) {
        $pid = (int) $_GET['mCmsLayouter3_uploadPid'];
        $Cont = Page($pid);
        $Layouter = new cmsLayouter3($Cont->vs['module']);
        $Layouter->init();
        $LPage = $Layouter->getLayoutPage();
        if ($LPage->access() < 2) {
            exit(0);
        }
        $File = $_FILES['file'];
        move_uploaded_file($File['tmp_name'], $Layouter->customPath() . 'img/' . $File['name']);
        exit(1);
    }
});
Esempio n. 13
0
    html::addJSFile(sysURL . 'core/js/c1.js', 'core');
    /* old ie */
    $matches = preg_match('/MSIE ([0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $match);
    if (isset($match[1]) && $match[1] < 9) {
        html::addJSFile(sysURL . 'core/js/jQuery1.js', 'core');
    } else {
        html::addJSFile(sysURL . 'core/js/jQuery.js', 'core');
    }
    $matches && header('X-UA-Compatible: IE=Edge,chrome=1');
    html::addJSFile(sysURL . 'core/js/qg/divers.js', 'core');
    html::addJSFile(sysURL . 'core/js/qg/remote.js', 'core');
});
qg::on('action', function () {
    // use 'render' ? would be .5 miliseconds slower :(
    if (strpos(appRequestUri, 'dbFile/') === 0) {
        $request = substr(appRequestUri, 7);
        dbFiles::output($request);
    }
    rTicket::captchaListener();
    Files::uploadListener();
    if (isset($_GET['qgha'])) {
        require_once sysPATH . 'core/lib/system/hashAction.php';
        $ok = hashAction::fire($_GET['qgha']);
    }
    if (isset(G()->ASK['serverInterface'])) {
        foreach (G()->ASK['serverInterface'] as $id => $vs) {
            $ret['serverInterface'][$id] = qgApi::call($vs['fn'], $vs['args']);
        }
        Answer($ret);
    }
});