Beispiel #1
0
 public static function boot($APPPATH, $RUNTIMEPATH)
 {
     define('ENVIRONMENT', 'TEST');
     Autoloader::initialize($APPPATH, $RUNTIMEPATH);
     static::$Input = Core\Loader::model('sys/Input');
     Core\Session::boot();
 }
Beispiel #2
0
 public function process()
 {
     $Session = new Core\Session();
     $key = 'admincp_flavor_' . $this->request()->get('id');
     if ($flavor = $this->request()->get('flavor')) {
         $Session->set($key, $flavor);
     }
     $Theme = $this->template()->theme()->get($this->request()->get('id'));
     if ($flavor = $Session->get($key)) {
         $Theme->setFlavor($flavor);
     }
     if ($default = $this->request()->get('default')) {
         return $Theme->setDefault();
     } else {
         if ($flavorId = $this->request()->get('flavor-delete')) {
             $Session->remove($key);
             $Theme->deleteFlavor($flavorId);
             $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Flavor successfully deleted.');
         } else {
             if ($this->request()->get('export')) {
                 $Theme->export();
             } else {
                 if ($this->request()->get('merge')) {
                     $Theme->merge();
                     $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Successfully merged the theme.');
                 } else {
                     if ($this->request()->get('rebuild')) {
                         $Theme->rebuild();
                         $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Successfully merged the theme.');
                     }
                 }
             }
         }
     }
     $Service = new Core\Theme\Service($Theme);
     if ($design = $this->request()->get('design')) {
         $Service->design()->set($design);
         return ['posted' => true];
     }
     $Request = $this->request();
     if ($Request->getHeader('X-File-Name')) {
         $dir = PHPFOX_DIR_FILE . 'logos/';
         if (!is_dir($dir)) {
             mkdir($dir);
         }
         $file = uniqid() . '.' . \Phpfox_File::instance()->extension($Request->getHeader('X-File-Name'));
         if (isset($_FILES['ajax_upload'])) {
             $_FILES['image'] = $_FILES['ajax_upload'];
             file_put_contents($dir . $file, file_get_contents($_FILES['image']['tmp_name']));
         } else {
             file_put_contents($dir . $file, file_get_contents('php://input'));
         }
         $url = str_replace(['/index.php', 'http://'], ['', '//'], \Phpfox::getParam('core.path')) . 'PF.Base/file/logos/' . $file;
         return ['run' => "\$('input[name=\"design[logoUrl]\"]').val(\"'{$url}'\").trigger('change');"];
     }
     if ($load = $this->request()->get('load')) {
         if ($this->request()->isPost()) {
             $content = $this->request()->get('content');
             switch ($load) {
                 case 'html':
                     $Service->html()->set($content);
                     break;
                 case 'css':
                     $Service->css()->set($content);
                     break;
                 case 'javascript':
                     $Service->js()->set($content);
                     break;
             }
             return ['posting' => true];
         }
         $data = '';
         switch ($load) {
             case 'html':
                 $data = $Service->html()->get();
                 break;
             case 'css':
                 $data = $Service->css()->get();
                 break;
             case 'javascript':
                 $data = $Service->js()->get();
                 break;
         }
         return ['ace' => $data, 'run' => "\$AceEditor.mode('{$load}'); " . (string) j('.ace_editor')->data('ace-mode', $load)->data('ace-save', $this->url()->makeUrl('admincp.theme.manage', ['id' => $this->request()->get('id'), 'load' => $load]))];
     } else {
         $this->template()->assign('design', $Service->design()->get());
     }
     $this->template()->setTitle('Theme Manager');
     $this->template()->setTemplate('blank');
     $this->template()->setHeader(['colorpicker.css' => 'style_css', 'colorpicker/js/colpick.js' => 'static_script']);
     $this->template()->assign(['theme' => $Theme, 'flavors' => $Theme->flavors()]);
 }
Beispiel #3
0
<?php

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require 'config.php';
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], Config::$base) !== 0) {
    http_response_code(404) && exit;
}
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') {
    http_response_code(500) && exit;
}
header('Strict-Transport-Security: max-age=86400');
spl_autoload_register();
Core\Session::start();
Core\CSRF::handle();
Core\Router::getURI();
date_default_timezone_set('UTC');
Core\DB::connect();
define('BASEPATH', __DIR__ . '/');
Core\Router::controller('open');
if (!\Core\Session::authenticated()) {
    header('Location: ' . Config::$base . 'auth/login') || exit;
}
Core\Router::controller();
http_response_code(404) && exit;
Beispiel #4
0
 public function process()
 {
     $Session = new Core\Session();
     $key = 'admincp_flavor_' . $this->request()->get('id');
     if ($flavor = $this->request()->get('flavor')) {
         $Session->set($key, $flavor);
     }
     $Theme = $this->template()->theme()->get($this->request()->get('id'));
     if ($flavor = $Session->get($key)) {
         $Theme->setFlavor($flavor);
     }
     if ($default = $this->request()->get('default')) {
         return $Theme->setDefault();
     } else {
         if ($this->request()->get('export')) {
             $Theme->export();
         } else {
             if ($this->request()->get('merge')) {
                 $Theme->merge();
                 $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Successfully merged the theme.');
             }
         }
     }
     $Service = new Core\Theme\Service($Theme);
     if ($design = $this->request()->get('design')) {
         $Service->design()->set($design);
         return ['posted' => true];
     }
     if ($load = $this->request()->get('load')) {
         if ($this->request()->isPost()) {
             $content = $this->request()->get('content');
             switch ($load) {
                 case 'html':
                     $Service->html()->set($content);
                     break;
                 case 'css':
                     $Service->css()->set($content);
                     break;
                 case 'javascript':
                     $Service->js()->set($content);
                     break;
             }
             return ['posting' => true];
         }
         $data = '';
         switch ($load) {
             case 'html':
                 $data = $Service->html()->get();
                 break;
             case 'css':
                 $data = $Service->css()->get();
                 break;
             case 'javascript':
                 $data = $Service->js()->get();
                 break;
         }
         return ['ace' => $data, 'run' => "\$AceEditor.mode('{$load}'); " . (string) j('.ace_editor')->data('ace-mode', $load)->data('ace-save', $this->url()->makeUrl('admincp.theme.manage', ['id' => $this->request()->get('id'), 'load' => $load]))];
     } else {
         $this->template()->assign('design', $Service->design()->get());
     }
     $this->template()->setTitle('Theme Manager');
     $this->template()->setTemplate('blank');
     $this->template()->setHeader(['colorpicker.css' => 'style_css', 'colorpicker/js/colpick.js' => 'static_script']);
     $this->template()->assign(['theme' => $Theme, 'flavors' => $Theme->flavors()]);
 }