Beispiel #1
0
 /**
  * Testing GET variables exist.
  *
  * @access public
  */
 public function testGetVariables()
 {
     // A variable that exists
     $this->assertEquals(Core\Request::get('bar'), 'foobar');
     // A variable that does not exist
     $this->assertNull(Core\Request::get('doesNotExist'));
     // A variable that does not exist with a default return value
     $this->assertEquals(Core\Request::get('doesNotExist', 'foo'), 'foo');
 }
Beispiel #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;
 }