public function init() { parent::init(); $this->getResponse()->setHeader('Content-Type', 'application/xml; charset="UTF-8"'); if (preg_match('/(uploadimage)/', $this->getRequest()->getActionName())) { return $this; } $this->_current_device_id = $this->getRequest()->getParam('device_id'); $this->_current_app = Application_Model_Application::getInstance(); if ($customer_id = $this->getRequest()->getParam('customer_id')) { $customer->find($customer_id); if (!$customer->getId()) { $error = true; } else { $this->_current_customer = $customer; } } else { $this->_current_customer = $customer; } if (!$customer->getId()) { $error = true; } if ($error) { $this->_sendError(); } }
public function setPathInfo($pathInfo = null) { parent::setPathInfo($pathInfo); $path = $this->_pathInfo; $paths = explode('/', trim($path, '/')); $language = !empty($paths[0]) ? $paths[0] : ''; if (in_array($language, Core_Model_Language::getLanguageCodes())) { $this->_language_code = $language; unset($paths[array_search($language, $paths)]); $paths = array_values($paths); } if (!$this->isInstalling()) { if (!empty($paths[0]) and $paths[0] == Application_Model_Application::OVERVIEW_PATH) { $this->_is_application = true; $this->_use_application_key = true; unset($paths[0]); } if (Application_Model_Application::getInstance()->getDomain() == $this->getHttpHost()) { $this->_is_application = true; $this->_use_application_key = false; } } $paths = array_diff($paths, Core_Model_Language::getLanguageCodes()); $paths = array_values($paths); $this->_pathInfo = '/' . implode('/', $paths); return $this; }
public function getApplications() { if (!$this->_applications) { $this->_applications = array(Application_Model_Application::getInstance()); } return $this->_applications; }
public function findAction() { $application = Application_Model_Application::getInstance(); $admin = new Admin_Model_Admin(); if (Siberian_Version::is("sae")) { $admins = $admin->findAll()->toArray(); $admin_owner = $admin; $admin_owner->setData(current($admins)); } else { $admins = $admin->getAllApplicationAdmins($this->getRequest()->getParam("app_id")); $admin_owner = $application->getOwner(); } $admin_list = array(); foreach ($admins as $admin) { $admin_list[] = $admin; } $admin = array("name" => $admin_owner->getFirstname() . " " . $admin_owner->getLastname(), "email" => $admin_owner->getEmail(), "company" => $admin_owner->getCompany(), "phone" => $admin_owner->getPhone()); $store_categories = Application_Model_Device_Ios::getStoreCategeories(); $devices = array(); foreach ($application->getDevices() as $device) { $device->setName($device->getName()); $device->setBrandName($device->getBrandName()); $device->setStoreName($device->getStoreName()); $device->setHasMissingInformation(!$device->getUseOurDeveloperAccount() && (!$device->getDeveloperAccountUsername() || !$device->getDeveloperAccountPassword())); $devices[] = $device->getData(); } $data = array('admin' => $admin, 'admin_list' => $admin_list, 'app_store_icon' => $application->getAppStoreIcon(), 'google_play_icon' => $application->getGooglePlayIcon(), 'devices' => $devices, 'url' => $application->getUrl(), 'has_ios_certificate' => Push_Model_Certificate::getiOSCertificat() !== null); foreach ($store_categories as $name => $store_category) { if ($store_category->getId() == $application->getMainCategoryId()) { $data['main_category_name'] = $name; } else { if ($store_category->getId() == $application->getSecondaryCategoryId()) { $data['secondary_category_name'] = $name; } } } $folder_name = $application->getDevice(2)->getTmpFolderName(); $apk_path = null; $date_mod = null; if ($folder_name != "") { $apk_base_path = Core_Model_Directory::getBasePathTo("var/tmp/applications/android/{$folder_name}/Siberian/app/build/outputs/apk/app-release.apk"); } if (file_exists($apk_base_path)) { $apk_path = Core_Model_Directory::getPathTo("var/tmp/applications/android/{$folder_name}/Siberian/app/build/outputs/apk/app-release.apk"); $date = new Zend_Date(filemtime($apk_base_path), Zend_Date::TIMESTAMP); $date_mod = $date->toString($this->_("MM/dd/y 'at' hh:mm a")); } $data["bundle_id"] = $application->getBundleId(); $data["is_active"] = $application->isActive(); $data["is_locked"] = $application->isLocked(); $data["can_be_published"] = $application->canBePublished(); if ($application->getFreeUntil()) { $date = new Zend_Date($application->getFreeUntil(), Zend_Date::ISO_8601); $data["free_until"] = $date->toString("MM/dd/yyyy"); } $data["apk"] = array("link" => $apk_path, 'date' => $date_mod); $application->addData($data); $data = array("application" => $application->getData(), 'statuses' => Application_Model_Device::getStatuses()); $this->_sendHtml($data); }
public function findbyadminAction() { $data = array("app_ids" => array(), "is_allowed_to_add_pages" => array()); $application = new Application_Model_Application(); if (!Siberian_Version::is("sae")) { $applications = $application->findAllByAdmin($this->getRequest()->getParam("admin_id")); } else { $applications = array(Application_Model_Application::getInstance()); } foreach ($applications as $application) { $data["app_ids"][] = $application->getId(); if ($application->getIsAllowedToAddPages()) { $data["is_allowed_to_add_pages"][] = $application->getId(); } } $this->_sendHtml($data); }
protected function _prepareBlocks() { if ($this->_request->isApplication()) { Core_View_Mobile_Default::setBlocks(Application_Model_Application::getInstance()->getDesignBlocks()); } }
public function getOptionDatas($option_id) { $fields = array_keys($this->_db->describeTable('application_option')); $fields = array_combine($fields, $fields); $fields['tabbar_name'] = new Zend_Db_Expr('name'); $fields['use_homepage_background_image'] = new Zend_Db_Expr((int) Application_Model_Application::getInstance()->getUseHomepageBackgroundImageInSubpages()); $select = $this->_db->select()->from(array('ao' => 'application_option'), $fields)->where('ao.option_id = ?', $option_id); return $this->_db->fetchRow($select); }
public function getApplication() { return Application_Model_Application::getInstance(); }
protected function _initApplication($paths) { if (!empty($paths[0]) and $paths[0] == Application_Model_Application::OVERVIEW_PATH) { $this->_is_application = true; $this->_use_application_key = true; unset($paths[0]); } else { if ($this->getHttpHost() == Application_Model_Application::getInstance()->getDomain()) { $this->_is_application = true; $this->_use_application_key = false; } } return $paths; }