public function process() { // $Apps = new Core\App(); $Home = new Core\Home(PHPFOX_LICENSE_ID, PHPFOX_LICENSE_KEY); $response = $Home->admincp(['return' => $this->url()->makeUrl('admincp.app.add')]); if (!isset($response->token)) { // throw error($response->error); // return Phpfox_Error::set($response->error); exit($response->error); } $load = $this->request()->get('load'); $token = $response->token; if ($open = $this->request()->get('open')) { $token .= '&search=' . $open; } if ($upgrade = $this->request()->get('upgrade')) { header('Location: ' . Core\Home::store() . 'product/' . $upgrade . '/install.json/installing?iframe-mode=' . $token . '&is-upgrade=true'); exit; } if ($upgrade = $this->request()->get('install')) { header('Location: ' . Core\Home::store() . 'product/' . $upgrade . '/install.json/installing?iframe-mode=' . $token); exit; } $this->template()->setSectionTitle('<a href="' . $this->url()->current() . '">Store</a>'); $this->template()->assign(['token' => $token, 'load' => $load]); }
public function process() { if ($iDeleteId = $this->request()->getInt('delete')) { if (Phpfox::getService('theme.process')->delete($iDeleteId)) { $this->url()->send('admincp.theme', null, Phpfox::getPhrase('theme.theme_successfully_deleted')); } } $themes = []; $default = []; $rows = $this->template()->theme()->all(); foreach ($rows as $row) { if ($row->is_default) { $default = $row; continue; } $themes[] = $row; } $themes = array_merge([$default], $themes); $Home = new Core\Home(PHPFOX_LICENSE_ID, PHPFOX_LICENSE_KEY); $products = $Home->downloads(['type' => 2]); $newInstalls = []; if (is_object($products)) { foreach ($products as $product) { foreach ($themes as $theme) { if (isset($theme->internal_id) && isset($product->id) && $theme->internal_id == $product->id) { continue 2; } } $newInstalls[] = (array) $product; } } $this->template()->setTitle(Phpfox::getPhrase('theme.themes'))->setSectionTitle('Themes')->setActionMenu(['New Theme' => ['url' => $this->url()->makeUrl('admincp.theme.add'), 'class' => 'popup light'], 'Find More Themes' => ['url' => $this->url()->makeUrl('admincp.store', ['load' => 'themes']), 'class' => '']])->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme'))->assign(array('newInstalls' => $newInstalls, 'themes' => $themes)); }
public function process() { $Apps = new Core\App(); if ($token = $this->request()->get('m9token')) { $response = (new Core\Home(PHPFOX_LICENSE_ID, PHPFOX_LICENSE_KEY))->token(['token' => $token]); if ($response->token) { $file = PHPFOX_DIR_SETTINGS . 'license.sett.php'; $content = file_get_contents($file); $content = preg_replace('!define\\(\'PHPFOX_LICENSE_ID\', \'(.*?)\'\\);!s', 'define(\'PHPFOX_LICENSE_ID\', \'techie_' . $this->request()->get('m9id') . '\');', $content); $content = preg_replace('!define\\(\'PHPFOX_LICENSE_KEY\', \'(.*?)\'\\);!s', 'define(\'PHPFOX_LICENSE_KEY\', \'techie_' . $this->request()->get('m9key') . '\');', $content); file_put_contents($file, $content); $this->template()->assign('vendorCreated', true); } } if (defined('PHPFOX_IS_TECHIE') && PHPFOX_IS_TECHIE) { $this->template()->setActionMenu(['New App' => ['url' => $this->url()->makeUrl('admincp/app/add'), 'class' => 'popup light'], 'Find More Apps' => ['url' => $this->url()->makeUrl('admincp.store', ['load' => 'apps']), 'class' => '']]); } $allApps = $Apps->all('__remove_core'); $Home = new Core\Home(PHPFOX_LICENSE_ID, PHPFOX_LICENSE_KEY); $products = $Home->downloads(['type' => 0]); $newInstalls = []; if (is_object($products)) { foreach ($products as $product) { foreach ($allApps as $app) { if (isset($app->internal_id) && isset($product->id) && $app->internal_id == $product->id) { continue 2; } } $newInstalls[] = (array) $product; } } $this->template()->setSectionTitle('Apps'); $this->template()->assign(['apps' => $allApps, 'newInstalls' => $newInstalls]); }
public function process() { // $Apps = new Core\App(); $Home = new Core\Home(PHPFOX_LICENSE_ID, PHPFOX_LICENSE_KEY); $response = $Home->admincp(['return' => $this->url()->makeUrl('admincp.app.add')]); if (!isset($response->token)) { var_dump($response); exit; } $this->template()->setSectionTitle('<a href="' . $this->url()->current() . '">Store</a>'); $this->template()->assign(['token' => $response->token, 'load' => $this->request()->get('load')]); }
private function _key() { /* if (file_exists($this->_sSessionFile)) { fclose($this->_hFile); @unlink($this->_sSessionFile); $this->_hFile = fopen($this->_sSessionFile, 'a'); } unset($_SESSION[Phpfox::getParam('core.session_prefix')]['installer']); if (defined('PHPFOX_SKIP_INSTALL_KEY')) { $this->_pass('license'); } */ /* $byPass = false; if ($this->_bUpgrade && defined('PHPFOX_LICENSE_ID') && defined('PHPFOX_LICENSE_KEY')) { $byPass = true; } */ $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => array('license_id' => 'Provide a license ID.', 'license_key' => 'Provide a license key.'))); if ($aVals = $this->_oReq->getArray('val')) { /* if ($byPass) { $aVals['license_id'] = PHPFOX_LICENSE_ID; $aVals['license_key'] = PHPFOX_LICENSE_KEY; } */ $response = new stdClass(); // $response->valid = true; if ($oValid->isValid($aVals)) { if ($aVals['license_id'] == 'techie' && $aVals['license_key'] == 'techie') { $response = new stdClass(); $response->valid = true; } else { try { $Home = new Core\Home($aVals['license_id'], $aVals['license_key']); $response = $Home->verify(['url' => $this->getHostPath()]); } catch (\Exception $e) { $response = new stdClass(); $response->error = $e->getMessage(); } } // Connect to phpFox and verify the license if (isset($response->valid)) { // $this->_pass('license'); $data = "<?php define('PHPFOX_LICENSE_ID', '{$aVals['license_id']}'); define('PHPFOX_LICENSE_KEY', '{$aVals['license_key']}');"; if (isset($aVals['is_trial']) && $aVals['is_trial']) { $data .= " define('PHPFOX_TRIAL', '" . Phpfox::getTime() . "');"; } file_put_contents(PHPFOX_DIR_SETTINGS . 'license.php', $data); if ($this->_bUpgrade) { return ['message' => 'Updating', 'next' => 'update']; } return ['message' => 'Verifying license', 'next' => 'configuration']; } else { if (!is_object($response)) { $info = $response; $response = new stdClass(); $response->error = $info; } Phpfox_Error::set($response->error); $this->_oTpl->assign(array('sError' => $response->error)); } } } // $this->_oTpl->setTitle('PHPfox ' . Phpfox::getVersion()); $this->_oTpl->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bHasCurl' => function_exists('curl_init') ? true : false)); }