Beispiel #1
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;
    }
});
Beispiel #2
0
         $image = imagerotate($image, $rotations[$ori], 0);
         imagejpeg($image, $filename, 94);
     };
     $Page = Page(isset($_POST['cmspid']) ? $_POST['cmspid'] : $_GET['cmspid']);
     if ($Page->access() > 1) {
         $_FILES['cmsPageFile']['name'] = str_replace('%', '%25', $_FILES['cmsPageFile']['name']);
         $image_fix_orientation($_FILES['cmsPageFile']['tmp_name']);
         if (isset($_GET['replace']) && $_GET['replace']) {
             $File = $Page->File($_GET['replace']);
         } else {
             $File = dbFile::add();
             $Page->addDbFile($File);
         }
         $File->replaceFromUpload($_FILES['cmsPageFile']);
         $res = array('id' => (string) $File, 'url' => $File->url() . '/' . $File->vs['name']);
         Answer($res);
     }
 }
 if (isset($_GET['qgCms_page_files_as_zip'])) {
     $P = Page($_GET['qgCms_page_files_as_zip']);
     if (!$P->access() > 1) {
         exit('no access');
     }
     if (!$P->Files()) {
         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());
Beispiel #3
0
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');
 		}
 		$matches && header('X-UA-Compatible: IE=Edge,chrome=1');
Beispiel #4
0
!D()->qg_setting && qg::install('core');
// todo, better solution?
G()->SET = new settingArray();
G()->ASK = isset($_POST['askJSON']) ? json_decode($_POST['askJSON'], true) : null;
foreach (explode(',', G()->SET['qg']['langs']->v) as $l) {
    $l = trim($l);
    if ($l) {
        L::$all[$l] = $l;
    }
}
L::$def = reset(L::$all);
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();
}
if (isset($_GET['qgSetting'])) {
    foreach ($_GET['qgSetting'] as $id => $value) {
        $S = settingArray::getSetting($id);
        $S && $S->setUser($value);
    }
}
L::init();
liveLog::init();
// todo: country from ip?
$l_country = 'ch';
if (Usr()->is()) {