コード例 #1
0
ファイル: Value.php プロジェクト: bklein01/siberian_cms_2
 public function getDummy()
 {
     $color = str_replace('#', '', $this->getApplication()->getBlock('tabbar')->getImageColor());
     $option = new Application_Model_Option();
     $option->find('newswall', 'code');
     $dummy = new self();
     $dummy->addData($option->getData())->setTabbarName('Sample')->setIsDummy(1)->setIsActive(1)->setIconUrl(Core_Model_Url::create("template/block/colorize", array('id' => $dummy->getIconId(), 'color' => $color)))->setId(0);
     return $dummy;
 }
コード例 #2
0
 public function checkcnameAction()
 {
     if ($this->getRequest()->isPost()) {
         try {
             $code = 1;
             $application = $this->getApplication();
             if ($application->getDomain() and Core_Model_Url::checkCname($application->getDomain())) {
                 $code = 0;
             }
         } catch (Exception $e) {
             $code = 1;
         }
         $html = Zend_Json::encode(array('code' => $code));
         $this->getLayout()->setHtml($html);
     }
 }
コード例 #3
0
 public function checkcnameAction()
 {
     if ($this->getRequest()->isPost()) {
         try {
             $code = 1;
             $application = $this->getApplication();
             if ($application->getDomain() and Core_Model_Url::checkCname($application->getDomain(), $this->getRequest()->getServer('SERVER_ADDR'))) {
                 $code = 0;
             }
         } catch (Exception $e) {
             Zend_Debug::dump($e->getMessage());
             die;
         }
         $html = Zend_Json::encode(array('code' => $code));
         $this->getLayout()->setHtml($html);
     }
 }
コード例 #4
0
ファイル: Default.php プロジェクト: bklein01/siberian_cms_2
 protected function _redirect($url, array $options = array())
 {
     $url = Core_Model_Url::create($url, $options);
     parent::_redirect($url, $options);
 }
コード例 #5
0
ファイル: Default.php プロジェクト: bklein01/siberian_cms_2
 public function getCurrentUrl($withParams = true, $locale = null)
 {
     return Core_Model_Url::current($withParams, $locale);
 }
コード例 #6
0
ファイル: Android.php プロジェクト: bklein01/siberian_cms_2
 protected function _generateApk()
 {
     $output = array();
     $alias = $this->getDevice()->getAlias();
     $store_password = $this->getDevice()->getStorePass();
     $key_password = $this->getDevice()->getKeyPass();
     $src = "var/tmp/applications/android/{$this->_folder_name}/Siberian";
     // Generates the keystore
     $keystore_base_path = Core_Model_Directory::getBasePathTo('var/apps/android/keystore/' . $this->getApplication()->getId() . '.pks');
     if (!file_exists($keystore_base_path)) {
         $organization = preg_replace('/[,\\s]+/', " ", System_Model_Config::getValueFor("company_name"));
         if (!$organization) {
             $organization = "Default";
         }
         exec('keytool -genkey -noprompt -alias ' . $alias . ' -dname "CN=' . $organization . ', O=' . $organization . '" -keystore ' . $keystore_base_path . ' -storepass ' . $store_password . ' -keypass ' . $key_password . ' -validity 36135 2>&1', $output);
     }
     // Adds the URL called at the end of the gradlew
     $gradlew_path = Core_Model_Directory::getBasePathTo("{$src}/app/gradlew");
     $gradlew_content = file_get_contents($gradlew_path);
     $url = Core_Model_Url::create("application/device/apkisgenerated", array("app_name" => $this->_folder_name));
     $gradlew_content .= 'wget "' . $url . '"';
     file_put_contents($gradlew_path, $gradlew_content);
     // Sets the Android SDK path
     $data = 'sdk.dir=' . Core_Model_Directory::getBasePathTo("var/apps/android/sdk");
     file_put_contents("{$src}/local.properties", $data);
     // Updates the build.gradle
     $content = file_get_contents("{$src}/app/build.gradle.save");
     $arraySearch = array('my_storePassword', 'my_keyAlias', 'my_keyPassword', 'my_packageName', 'my_keystore_path');
     $arrayReplace = array($store_password, $alias, $key_password, $this->_package_name, $keystore_base_path);
     $content = str_replace($arraySearch, $arrayReplace, $content);
     file_put_contents("{$src}/app/build.gradle", $content);
     // Changes the current directory
     chdir(Core_Model_Directory::getBasePathTo("{$src}/app"));
     // Creates a environment variable
     putenv('GRADLE_USER_HOME=' . Core_Model_Directory::getBasePathTo("var/tmp/applications/android/gradle"));
     // Executes gradlew
     exec('bash gradlew build 2>&1', $output);
     if (in_array('BUILD SUCCESSFUL', $output)) {
         return Core_Model_Directory::getBasePathTo("{$src}/app/build/outputs/apk/app-release.apk");
     } else {
         Zend_Registry::get("logger")->sendException(print_r($output, true), "apk_generation_", false);
         return false;
     }
 }
コード例 #7
0
ファイル: Application.php プロジェクト: BeamlabsTigre/Webapp
 public function getUrl($uri = null, $params = array(), $forceKey = false, $locale = null)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $useKey = (bool) $request->useApplicationKey();
     if (!$this->getDomain()) {
         $forceKey = true;
     }
     if ($forceKey) {
         $request->useApplicationKey(true);
         $url = Core_Model_Url::create($uri, $params, $locale);
         $request->useApplicationKey($useKey);
     } else {
         $url = Core_Model_Url::createCustom('http://' . $this->getDomain(), $uri, $params, $locale);
     }
     return $url;
 }
コード例 #8
0
 public function getUrl($url = '', array $params = array(), $locale = null, $forceKey = false)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     if (!$this->getDomain()) {
         $forceKey = true;
     }
     if ($forceKey) {
         $use_key = $request->useApplicationKey();
         $request->useApplicationKey(true);
         $url = Core_Model_Url::create($url, $params, $locale);
         $request->useApplicationKey($use_key);
     } else {
         $url = Core_Model_Url::createCustom('http://' . $this->getDomain(), $url, $params, $locale);
     }
     if (substr($url, strlen($url) - 1, 1) != "/") {
         $url .= "/";
     }
     return $url;
 }