Beispiel #1
0
 if ($memcache = new Memcache()) {
     if ($memcache->connect('localhost', 11211, 3)) {
         try {
             if ($json->status == 'OK') {
                 $session = verify_session($memcache, $sessionId, $_SERVER, __DOMAIN__);
                 if (!empty($session)) {
                     if (!empty($session->admin) || !empty($session->developer) || !empty($session->content_creator)) {
                         if (!empty($_POST['roothtml'])) {
                             xcopy(DOCUMENT_ROOT . $_POST['roothtml'], DOCUMENT_ROOT);
                         }
                         if (!empty($_POST['rootemail'])) {
                             $dirparts = explode('/', $_POST['rootemail']);
                             $lastdir = $dirparts[sizeof($dirparts) - 1];
                             xcopy(DOCUMENT_ROOT . $_POST['rootemail'], DOCUMENT_ROOT . '/' . $lastdir);
                         }
                         delete_folder_recursive($_SERVER['DOCUMENT_ROOT'] . '/unpacked');
                     }
                 } else {
                     $json->status = 'ERROR';
                     $json->message = 'Invalid session';
                 }
             }
         } catch (PDOException $e) {
             error_log(__FILE__ . ' : ' . $e->getMessage());
             $json->status = 'ERROR';
             $json->message = 'PDOException: ' . $e->getMessage();
         } catch (MemcacheException $e) {
             error_log(__FILE__ . ' : ' . $e->getMessage());
             $json->status = 'ERROR';
             $json->message = 'MEMCACHEException: ' . $e->getMessage();
         } catch (Exception $e) {
Beispiel #2
0
             if (!empty($session->admin) || !empty($session->developer) || !empty($session->content_creator)) {
                 // clean app root but leave the template, engine and htaccess intact
                 $json->status = 'ERROR';
                 $exclude = array('engine', '.htaccess');
                 $exclude[] = $_POST['uuid'];
                 if (empty($_POST['keep'])) {
                     delTree($_SERVER['DOCUMENT_ROOT'], $exclude, false);
                 }
                 //unzip the file to the extracted directory
                 $zip = new ZipArchive();
                 $res = $zip->open($_SERVER['DOCUMENT_ROOT'] . '/' . $_POST['uuid'] . '/' . $_POST['filename']);
                 if ($res === true) {
                     $zip->extractTo($_SERVER['DOCUMENT_ROOT'] . '/unpacked');
                     $zip->close();
                     // delete the uploaded template and dir
                     delete_folder_recursive($_SERVER['DOCUMENT_ROOT'] . '/' . $_POST['uuid']);
                     $json->status = 'OK';
                 } else {
                     $json->message = 'unable to open zip file';
                 }
             }
         } else {
             $json->status = 'ERROR';
             $json->message = 'Invalid session';
         }
     }
 } catch (PDOException $e) {
     error_log(__FILE__ . ' : ' . $e->getMessage());
     $json->status = 'ERROR';
     $json->message = 'PDOException: ' . $e->getMessage();
 } catch (MemcacheException $e) {