Example #1
0
 /**
  * Testing SERVER variables exist.
  *
  * @access public
  */
 public function testServerVariables()
 {
     // A variable that exists
     $this->assertEquals(Core\Request::server('foobar'), 'barfoo');
     // A variable that does not exist
     $this->assertNull(Core\Request::server('doesNotExist'));
     // A variable that does not exist with a default return value
     $this->assertEquals(Core\Request::server('doesNotExist', 'foo'), 'foo');
 }
Example #2
0
 public function install($response)
 {
     $Request = new \Core\Request();
     $Url = new \Core\Url();
     $zip = PHPFOX_DIR_FILE . 'static/' . uniqid() . '.zip';
     file_put_contents($zip, file_get_contents($response->download));
     switch ($Request->get('type')) {
         case 'isAppInstalled':
             echo "OK";
             break;
         case 'language':
             $file = PHPFOX_DIR_FILE . 'static/' . uniqid() . '/';
             mkdir($file);
             $Zip = new \ZipArchive();
             $Zip->open($zip);
             $Zip->extractTo($file);
             $Zip->close();
             // $xml = \Phpfox::getLib('xml.parser')->parse($file . 'phpfox-language-import.xml');
             $name = false;
             $fullPath = $file . 'upload/include/';
             foreach (scandir($fullPath . 'xml/language/') as $dir) {
                 if (file_exists($fullPath . 'xml/language/' . $dir . '/phpfox-language-import.xml')) {
                     $name = $dir;
                 }
             }
             if (!$name) {
                 throw new \Exception('Not a valid language package to install.');
             }
             \Language_Service_Process::instance()->installPackFromFolder($name, $fullPath . 'xml/language/' . $name . '/');
             $Url->send('admincp/language/import', ['dir' => base64_encode($fullPath . 'xml/language/' . $name . '/')]);
             break;
         default:
             $Theme = new \Core\Theme();
             $Theme->import($zip, ['image' => $response->image, 'id' => $response->internal_id, 'version' => $response->internal_version]);
             $Url->send('admincp/theme', null, 'Theme successfully installed!');
             break;
     }
     exit;
 }
Example #3
0
 * HTTPS support:
 * Use HTTPS connection when necessary, needs to config apache/nginx manually
 */
define('HTTPS_SUPPORT', true);
/**
 * Enable debug mode:
 * Disable debug mode will hide backtrace information, which is helpful for developer
 */
define('DEBUG_ENABLE', true);
/**
 * Real time mode:
 * This option will disable i18n / router / template cache, development only.
 * DO NOT TURN ON THIS OPTION IN PRODUCTION!!!
 */
define('REAL_TIME_MODE', false);
/**
 * Base URL:
 * To manually config this, uncomment the following line and change the URL
 * To use auto detect, keep this commented
 */
// define('BASE_URL', 'http://www.kookxiang.com');
Core\Request::autoDetectBaseURL();
/**
 * Set i18n translation file
 * If you don't need this, simply comment out the following line
 */
Core\I18N::setTranslationFile(LIBRARY_PATH . 'Language/en-US.yml');
/**
 * Database Connection:
 */
Core\Database::initialize('mysql:dbname=test;host=localhost;charset=UTF8', 'root', '');