コード例 #1
0
ファイル: demo.class.php プロジェクト: lev1976g/core
 public function process()
 {
     if (!defined('PHPFOX_ALLOW_MODE')) {
         exit;
     }
     $demoId = 0;
     if ($demoId = $this->request()->get('id')) {
         $Themes = new Core\Theme($demoId);
         Phpfox::setCookie('flavor_id', $demoId);
         $this->url()->send('');
     }
     /*
     else {
     	$this->url()->send('');
     }
     */
     Core\View::$template = 'blank';
     $Themes = new Core\Theme();
     $flavors = [];
     foreach ($Themes->all() as $Theme) {
         foreach ($Theme->flavors() as $Flavor) {
             $flavors[] = $Flavor;
         }
     }
     $this->template()->assign(['flavors' => $flavors, 'demoId' => $demoId]);
 }
コード例 #2
0
ファイル: add.class.php プロジェクト: lev1976g/core
 /**
  * Controller
  */
 public function process()
 {
     if ($val = $this->request()->getArray('val')) {
         $Theme = new Core\Theme();
         $newTheme = $Theme->make($val);
         Phpfox::addMessage('Theme successfully created.');
         return ['redirect' => $this->url()->makeUrl('admincp.theme.manage', ['id' => $newTheme->theme_id])];
     }
     $this->template()->setBreadcrumb('Create a Theme', $this->url()->makeUrl('current'), true)->assign(array());
 }
コード例 #3
0
ファイル: Run.php プロジェクト: lev1976g/core
 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;
 }
コード例 #4
0
ファイル: 4.0.0rc1.php プロジェクト: nima7r/phpfox-dist
<?php

return function (Phpfox_Installer $Installer) {
    $Installer->db->delete(':menu', 'menu_id > 0');
    $Installer->db->delete(':block', 'block_id > 0');
    $Installer->db->delete(':block_source', 'block_id > 0');
    $Installer->db->delete(':theme', 'theme_id > 0');
    $Installer->db->delete(':theme_style', 'style_id > 0');
    if (!$Installer->db->select('COUNT(*)')->from(':product')->where(['product_id' => 'phpfox'])->execute('getField')) {
        $Installer->db->insert(':product', ['product_id' => 'phpfox', 'is_core' => 1, 'title' => 'Core', 'is_active' => 1]);
    }
    if (!$Installer->db->select('COUNT(*)')->from(':language')->where(['language_id' => 'en'])->execute('getField')) {
        $Installer->db->insert(':language', ['language_id' => 'en', 'title' => 'English', 'direction' => 'ltr', 'charset' => 'UTF-8', 'time_stamp' => PHPFOX_TIME, 'is_default' => 1, 'is_master' => 1]);
    }
    $themeId = $Installer->db->insert(Phpfox::getT('theme'), ['name' => 'Default', 'folder' => 'default', 'created' => PHPFOX_TIME, 'is_active' => 1, 'is_default' => 0]);
    $Installer->db->insert(Phpfox::getT('theme_style'), ['theme_id' => $themeId, 'is_active' => 1, 'is_default' => 1, 'name' => 'Default', 'folder' => 'default', 'created' => PHPFOX_TIME]);
    $Theme = new Core\Theme();
    $newTheme = $Theme->make(['name' => 'Neutron']);
    $Installer->db->update(Phpfox::getT('theme'), ['is_default' => 1], ['theme_id' => $newTheme->theme_id]);
    if (!$Installer->db->select('COUNT(*)')->from(':country')->execute('getField')) {
        Core_Service_Country_Process::instance()->importForInstall(Phpfox::getLib('xml.parser')->parse(PHPFOX_DIR_XML . 'country' . PHPFOX_XML_SUFFIX));
    }
    return ['reset' => true];
};
コード例 #5
0
ファイル: 4.1.0.php プロジェクト: Goudarzi-hahram/phpfox
<?php

return function (Phpfox_Installer $Installer) {
    //https://github.com/moxi9/phpfox/issues/633
    $Installer->db->query("UPDATE " . Phpfox::getT('setting') . " SET `module_id` = 'user' WHERE `group_id` = 'registration' AND `var_name`='global_genders';");
    $Installer->db->query("DELETE FROM " . Phpfox::getT('setting') . " WHERE `module_id`='friend' AND `var_name`='birthdays_cache_time_out';");
    $Installer->db->query("DELETE FROM " . Phpfox::getT('user_group_setting') . " WHERE `module_id`='photo' AND `name`='can_rate_on_photos';");
    //Make bootstrap theme
    $iCnt = $Installer->db->select('COUNT(*)')->from(':theme')->where('name="bootstrap" OR folder="bootstrap"')->count();
    if ($iCnt == 0 || empty($iCnt)) {
        $Theme = new Core\Theme();
        $Theme->make(['name' => 'Bootstrap'], null, false, 'bootstrap');
    }
};
コード例 #6
0
ファイル: add.class.php プロジェクト: nima7r/phpfox-dist
 public function process()
 {
     $Theme = new Core\Theme();
     $file = null;
     if ($this->request()->get('type') == 'language') {
         $dir = PHPFOX_DIR_FILE . 'static/' . uniqid() . '/';
         mkdir($dir);
         $file = $dir . 'import.zip';
         file_put_contents($file, file_get_contents($this->request()->get('download')));
         register_shutdown_function(function () use($dir) {
             // Phpfox_File::instance()->delete_directory($dir);
         });
         $Zip = new \ZipArchive();
         $Zip->open($file);
         $Zip->extractTo($dir);
         $Zip->close();
         $pack = '';
         $path = $dir . 'upload/include/xml/language/';
         foreach (scandir($path) as $newDir) {
             if ($newDir == '.' || $newDir == '..') {
                 continue;
             }
             $pack = $newDir;
             $path .= $newDir . '/';
             break;
         }
         \Language_Service_Process::instance()->installPackFromFolder($pack, $path);
         echo '<script>window.top.location.href = \'' . $this->url()->makeUrl('admincp.language.import', ['dir' => base64_encode($path)]) . '\';</script>';
         exit;
     }
     if ($this->request()->get('type') == 'theme') {
         $dir = PHPFOX_DIR_FILE . 'static/' . uniqid() . '/';
         mkdir($dir);
         $file = $dir . 'import.zip';
         file_put_contents($file, file_get_contents($this->request()->get('download')));
         register_shutdown_function(function () use($dir) {
             Phpfox_File::instance()->delete_directory($dir);
         });
         Phpfox::addMessage('Theme successfully installed.');
         $id = $Theme->import($file);
         // $this->url()->send('admincp.theme');
         echo '<script>window.top.location.href = \'' . $this->url()->makeUrl('admincp.theme') . '\';</script>';
         exit;
     }
     if (isset($_SERVER['HTTP_X_FILE_NAME']) || $this->request()->get('download')) {
         $App = (new Core\App())->import($this->request()->get('download'), $this->request()->get('download') ? true : false);
         if ($this->request()->get('download')) {
             // $this->url()->send('admincp.app', ['id' => $App->id]);
             echo '<script>window.top.location.href = \'' . $this->url()->makeUrl('admincp.app', ['id' => $App->id]) . '\';</script>';
             exit;
         }
         return ['redirect' => $this->url()->makeUrl('admincp.app', ['id' => $App->id])];
     }
     if ($token = $this->request()->get('m9token')) {
         (new Core\App())->vendor($token);
         d($token);
         exit;
     }
     if ($val = $this->request()->getArray('val')) {
         $App = (new Core\App())->make($val['name']);
         Phpfox::addMessage('App successfully created.');
         return ['redirect' => $this->url()->makeUrl('admincp.app', ['id' => $App->id])];
     }
     $this->template()->setBreadCrumb('New App', $this->url()->current(), true);
 }
コード例 #7
0
 private function _language()
 {
     $this->_db()->insert(Phpfox::getT('language'), array('language_id' => 'en', 'title' => 'English (US)', 'user_select' => '1', 'language_code' => 'en', 'charset' => 'UTF-8', 'direction' => 'ltr', 'flag_id' => 'png', 'time_stamp' => '1184048203', 'created' => 'N/A (Core)', 'site' => '', 'is_default' => '1', 'is_master' => '1'));
     // Phpfox::getService('language.process')->import(Phpfox::getLib('xml.parser')->parse(PHPFOX_DIR_XML . 'installer' . PHPFOX_XML_SUFFIX), 'phpfox_installer', true, true);
     $themeId = $this->_db()->insert(Phpfox::getT('theme'), ['name' => 'Default', 'folder' => 'default', 'created' => PHPFOX_TIME, 'is_active' => 1, 'is_default' => 0]);
     $this->_db()->insert(Phpfox::getT('theme_style'), ['theme_id' => $themeId, 'is_active' => 1, 'is_default' => 1, 'name' => 'Default', 'folder' => 'default', 'created' => PHPFOX_TIME]);
     $Theme = new Core\Theme();
     $newTheme = $Theme->make(['name' => 'Neutron']);
     $this->_db()->update(Phpfox::getT('theme'), ['is_default' => 1], ['theme_id' => $newTheme->theme_id]);
     /*
     $this->_pass();
     $this->_oTpl->assign(array(
     		'sMessage' => 'Language package imported...',
     		'sNext' => $this->_step('module')
     	)
     );
     */
     return ['message' => 'Setting up apps', 'next' => 'module'];
 }
コード例 #8
0
ファイル: import.class.php プロジェクト: lev1976g/core
 public function process()
 {
     $Theme = new Core\Theme();
     $id = $Theme->import();
     return ['redirect' => $this->url()->makeUrl('admincp.theme.manage', ['id' => $id])];
 }