/** * Save action */ public function saveAction() { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); try { $model = Fox::getModel('member/member'); $model->load($data['email_id'], 'email_id'); if ($model->getId()) { if ($data['password'] == $data['c_password']) { $model->setPassword(md5($data['password'])); $model->save(); $model->sendPasswordChangedMail($data['password']); Fox::getHelper('core/message')->setInfo('Password was successfully changed.'); } else { throw new Exception('Password must match confirm password.'); } } else { throw new Exception('Email Id was not found.'); } } catch (Exception $e) { Fox::getModel('core/session')->setFormData($data); Fox::getHelper('core/message')->setError($e->getMessage()); } } $this->sendRedirect('*/*/change-password'); }
/** * Page not found action */ public function pageNotFoundAction() { $this->getResponse()->setHeader('HTTP/1.1', '404 Not Found'); $this->getResponse()->setHeader('Status', '404 File not found'); if (!Fox::getHelper('core/router')->routKey($this, 'no-page-404')) { $this->_forward('nothing'); } }
/** * Fetches and writes analytics data to cache and database */ public function saveAnalyticsData() { try { if (!$this->isTodaysFileExists()) { $dayTimeStamp = 24 * 60 * 60; $prevDateTimeStamp = time(); $dataArray = array(); $fromDate = date('Y-m-d', $prevDateTimeStamp - 30 * $dayTimeStamp); $toDate = date('Y-m-d', $prevDateTimeStamp - $dayTimeStamp); $analyticsData = Fox::getModel('admin/analytics')->getAnalyticsData($fromDate, $toDate); $model = Fox::getModel('admin/analytics'); $ga_profile_id = $this->getProfileId(); for ($i = 30; $i >= 1; $i--) { $date = date('Y-m-d', $prevDateTimeStamp - $i * $dayTimeStamp); $value = Fox_Core_Model_Date::__toLocaleDate(strtotime($date), "d-M-Y"); $total_results = 0; $page_views = 0; $visits = 0; if (false && array_key_exists($date, $analyticsData)) { $total_results = $analyticsData[$date]['page_views']; $page_views = $analyticsData[$date]['total_results']; $visits = $analyticsData[$date]['total_visits']; } else { $results = $this->requestReportData($ga_profile_id, $date, $date); if (count($results) > 0) { $page_views = $results['page_views']; $visits = $results['visits']; } $model->setDateValue($date); $model->setTotalResults($total_results); $model->setPageViews($page_views); $model->setTotalVisits($visits); $model->save(); $model->unsetData(); } $dataArray[$i]['value'] = $value; $dataArray[$i]['page_views'] = $page_views; $dataArray[$i]['total_visits'] = $visits; } $this->writeData($dataArray); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } }
/** * Save action */ function saveAction() { if ($this->getRequest()->isPost()) { try { $data = $this->getRequest()->getPost(); // Uni_Core_ModuleManager::runSqlUpgrade('News', 'Fox', 'core'); // exit; Uni_Core_ModuleManager::installModules(); Uni_Core_ModuleManager::updateModuleStatus($data); Uni_Core_Preferences::loadPreferences(TRUE); Uni_Core_CacheManager::clearLayoutCache(); Uni_Core_CacheManager::clearModuleCache(); Fox::getHelper('core/message')->setInfo('Modules successfully saved.'); } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } } $this->sendRedirect('*/*/'); }
/** * Index action */ public function indexAction() { if ($this->getRequest()->isPost()) { try { $data = $this->getRequest()->getPost(); $model = Fox::getModel('contact/contact'); $data['status'] = Fox_Contact_Model_Contact::STATUS_UNREAD; $data['contact_date'] = Fox_Core_Model_Date::getCurrentDate('Y-m-d H:i:s'); $model->setData($data); $model->save(); try { Fox::getHelper('core/message')->setInfo("Your request was successfully sent."); $modelTemplate = Fox::getModel('core/email/template'); $modelTemplate->sendTemplateMail(Fox::getPreference('contact/receiver/email_template'), Fox::getPreference('contact/receiver/email'), array('sender_name' => $data['name'], 'sender_email' => $data['email']), $data); } catch (Exception $e) { } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } } $this->loadLayout(); $this->renderLayout(); }
/** * Change password action * * Member is redirected to change password interface from the link sent via email for forgot password */ public function changePasswordAction() { $code = $this->getRequest()->getParam('code', FALSE); try { $model = Fox::getModel('member/password'); if (!$code) { $this->sendRedirect('*/account/login'); } else { $model->load($code, 'code'); if (!$model->getId()) { throw new Exception('Change password link was incorrect or expired.'); } } if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($data['password'] == $data['c_password']) { $memberModel = Fox::getModel('member/member'); $memberModel->load($model->getMemId()); if ($memberModel->getId()) { $memberModel->setPassword(md5($data['password'])); $memberModel->save(); $memberModel->sendPasswordChangedMail($data['password']); $model->delete(); Fox::getHelper('core/message')->setInfo('Password was successfully changed.'); $this->sendRedirect('*/account/login'); } } else { Fox::getHelper('core/message')->setError('New password must match confirm new password.'); } } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); $this->sendRedirect('*/account/login'); } $this->loadLayout(); $this->renderLayout(); }
/** * Get member registration url * * @return string */ function getRegisterUrl() { return Fox::getHelper('member/data')->getRegisterUrl(); }
/** * Bulk delete action */ public function groupDeleteAction() { try { $model = Fox::getModel('eav/attribute'); $ids = $this->getGroupActionIds($model); $totalIds = count($ids); if ($totalIds) { $model->delete($model->getPrimaryField() . ' IN (' . implode(',', $ids) . ')'); } Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' record(s) successfully deleted.'); } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/'))); }
/** * Admin panel configuration action */ public function administratorAction() { Fox::getModel('installer/session')->setCurrentStep(4); try { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); Fox::getModel('installer/session')->setBackend($data); if (!$data['password'] || $data['password'] != $data['confirm_password']) { throw new Exception('Password and Confirm Password do not match'); } Uni_Core_Installer::finishSetup(); $this->sendRedirect('*/*/finish'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } $this->loadLayout(); $this->renderLayout(); }
/** * Delete action */ public function deleteAction() { if ($id = $this->getRequest()->getParam('id')) { try { $model = Fox::getModel('core/email/template'); $model->load($id); if ($model->getId()) { $model->delete(); Fox::getHelper('core/message')->setInfo('"' . $model->getName() . '" was successfully deleted.'); } } catch (Exception $e) { Fox::getHelper('core/message')->addError($e->getMessage()); $this->sendRedirect('*/*/edit', array('id' => $id)); } } $this->sendRedirect('*/*/'); }
/** * Finish Upgrade Action */ public function finishUpgradeAction() { $result = array('html' => '', 'success' => false); if (!$this->isAjax()) { $this->_forward('error'); return; } $package = $this->getPackage(); $config = $package->getConfig(); $packageKey = Fox::getHelper("extensionmanager/data")->decrypt($this->getRequest()->getPost("key")); $filePath = $config->getInstalledPkgPath() . DS . $packageKey . '.xml'; if (!is_dir($filePath) && file_exists($filePath)) { @unlink($filePath); } $result["success"] = true; $result["state"] = "Upgrading Done"; $result["update"] = $this->_getUpdatedSection(); $this->getResponse()->setBody(Zend_Json::encode($result)); return; }
/** * Unsubscribe action */ public function unsubscribeAction() { $id = $this->getRequest()->getParam('id', FALSE); $code = $this->getRequest()->getParam('code', FALSE); if ($id && $code) { try { $subscriber = Fox::getModel('newsletter/subscriber'); $subscriber->load($id); if ($code == $subscriber->getCode()) { if ($subscriber->unsubscribe()) { Fox::getHelper('core/message')->setInfo('You have been successfully unsubscribed.'); } } else { Fox::getHelper('core/message')->setError('Invalid subscription confirmation code'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError('There was a problem with the un-subscription.'); } } $this->sendRedirect(''); }
/** * Bulk status update action */ public function groupStatusAction() { try { $model = Fox::getModel('core/cache'); $codes = $this->getGroupActionIds($model); $totalIds = count($codes); $updateType = ''; $dependentParams = $this->getRequest()->getParam('dependents', array()); if (isset($dependentParams['status'])) { if ($dependentParams['status'] == Fox_Core_Model_Cache::STATUS_CLEAR) { $updateType = 'cleared'; if (in_array(Fox_Core_Model_Cache::CACHE_CODE_PREFERENCE, $codes)) { Uni_Core_Preferences::loadPreferences(TRUE); Fox::initializePreferences(); } if (in_array(Fox_Core_Model_Cache::CACHE_CODE_LAYOUT, $codes)) { Uni_Core_CacheManager::clearLayoutCache(); } } else { if ($dependentParams['status'] == Fox_Core_Model_Cache::STATUS_ENABLED) { $updateType = 'enabled'; } else { if ($dependentParams['status'] == Fox_Core_Model_Cache::STATUS_DISABLED) { $updateType = 'disabled'; } } $cacheCodes = '\'' . implode('\',\'', $codes) . '\''; $model->update(array('status' => $dependentParams['status']), 'cache_code IN (' . $cacheCodes . ')'); } Uni_Core_CacheManager::createCacheSettings(); Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' cache(s) successfully ' . $updateType . '.'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/'))); }
/** * Prepares final menu html * * @param DOMElement $menu */ protected function getFinalMenuTree($menu) { if (NULL == $this->mnuPaths) { $this->mnuPaths = array(); } $sourceQueue = array(array('menu' => $menu, 'path' => 'root')); $targetQueue = array($this->root); while (count($sourceQueue) > 0) { $mnuItem = array_shift($sourceQueue); $menu = $mnuItem['menu']; $parentPath = $mnuItem['path']; $parent = array_shift($targetQueue); if ($mChs = $menu->childNodes) { foreach ($mChs as $mCh) { if ($mCh->nodeName == 'item') { if (Fox::getHelper('admin/acl')->isAllowed($mCh->getAttribute('action'))) { $node = Uni_Data_XDOMDocument::createNode('item', array('action' => $mCh->getAttribute('action'), 'order' => ($order = $mCh->getAttribute('order')) ? $order : '0'), $this->finalMenuTree); $node->appendChild($this->finalMenuTree->createTextNode($mCh->nodeValue)); $parent->appendChild($node); } } else { if ($mCh->nodeName == 'menu') { $label = $mCh->getAttribute('label'); $menuPath = $parentPath . '/' . str_replace('/', '_', $label); if (isset($this->mnuPaths[$menuPath])) { $item = $this->mnuPaths[$menuPath]; } else { $item = Uni_Data_XDOMDocument::createNode('menu', array('label' => $label, 'order' => ($order = $mCh->getAttribute('order')) ? $order : '0'), $this->finalMenuTree); $parent->appendChild($item); $this->mnuPaths[$menuPath] = $item; } $targetQueue[] = $item; $sourceQueue[] = array('menu' => $mCh, 'path' => $menuPath); } } } } } }
/** * Bulk status update action */ public function groupStatusAction() { try { $model = Fox::getModel('navigation/menu'); $ids = $this->getGroupActionIds($model); $totalIds = count($ids); $dependentParams = $this->getRequest()->getParam('dependents', array()); if (isset($dependentParams['status'])) { if ($totalIds) { $model->update(array('status' => $dependentParams['status']), $model->getPrimaryField() . ' IN (' . implode(',', $ids) . ')'); } Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' record(s) successfully updated.'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/'))); }
/** * Create database backup file */ public function createBackup() { $this->getAdapter()->beginTransaction(); try { $this->setFileName('DB_' . time() . '.' . self::FILE_EXTENSION . '.' . self::BACKUP_EXTENSION); $this->openStream(); $this->write($this->getHeader()); $tables = $this->getTables(); $limit = 1; foreach ($tables as $table) { $this->write($this->getTableHeader($table) . $this->getTableDropSql($table) . "\n"); $this->write($this->getTableCreateSql($table, false) . "\n"); $this->write($this->getTableDataBeforeSql($table)); $totalRows = (int) $this->getAdapter()->fetchOne('SELECT COUNT(*) FROM ' . $this->getAdapter()->quoteIdentifier($table)); for ($i = 0; $i < $totalRows; $i++) { $this->write($this->getTableDataSql($table, $limit, $i * $limit)); } $this->write($this->getTableDataAfterSql($table)); } $this->write($this->getTableForeignKeysSql()); $this->write($this->getFooter()); $this->closeStream(); $this->setFileSize($this->getBackupSize()); $this->setBackupDate(Fox_Core_Model_Date::getCurrentDate('Y-m-d H:i:s')); $this->save(); $this->getAdapter()->commit(); Fox::getHelper('core/message')->setInfo('Backup was successfully created.'); } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); $this->getAdapter()->rollback(); $this->closeStream(); } }
/** * Get remove image url * * @return string */ function getRemoveImageUrl() { return Fox::getHelper('member/data')->getRemoveImageUrl(); }
/** * Change passwod action * * User is redirected to change password interface from the link sent via email for forget password */ public function changePasswordAction() { if (Fox::getModel('admin/session')->getLoginData()) { $this->sendRedirect('*/dashboard/'); } $userId = $this->getRequest()->getParam('user_id'); $code = $this->getRequest()->getParam('code'); $forgetPasswordModel = Fox::getModel('admin/forgetPassword'); $forgetPasswordModel->load($userId, 'user_id'); try { if ($forgetPasswordModel->getCode() == $code) { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($data['password'] && $data['password'] == $data['cpassword']) { $model = Fox::getModel('admin/user'); $pwd = md5($data['password']); $model->load($userId); $model->setPassword($pwd); $model->save(); $forgetPasswordModel->delete(); Fox::getHelper('core/message')->setInfo('Your password was successfully changed.'); $this->sendRedirect('*/*/'); } else { throw new Exception('New password must match confirm password.'); } } } else { Fox::getHelper('core/message')->setError('Change password link was incorrect or expired.'); $this->sendRedirect('*/*/'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } $this->loadLayout(); $this->renderLayout(); }
/** * Controller predispatch method * * Called before action method */ function preDispatch() { parent::preDispatch(); if (!Fox::getModel('admin/session')->getLoginData()) { if (!('admin' === strtolower($this->getRequest()->getModuleName()) && 'index' === strtolower($this->getRequest()->getControllerName()) && 'index' === strtolower($this->getRequest()->getActionName())) && !('admin' === strtolower($this->getRequest()->getModuleName()) && 'index' === strtolower($this->getRequest()->getControllerName()) && 'change-password' === strtolower($this->getRequest()->getActionName())) && !('admin' === strtolower($this->getRequest()->getModuleName()) && 'index' === strtolower($this->getRequest()->getControllerName()) && 'forget-password' === strtolower($this->getRequest()->getActionName())) && !('admin' === strtolower($this->getRequest()->getModuleName()) && 'index' === strtolower($this->getRequest()->getControllerName()) && 'logout' === strtolower($this->getRequest()->getActionName()))) { setcookie('requested_uri', $this->getRequestUriAfterBaseUrl(), time() + 3600 * 24, $this->getFrontController()->getBaseUrl()); if ($this->getRequest()->getParam('isAjax', FALSE)) { echo '<script type="text/javascript">window.location.reload();</script>'; exit; } else { $this->sendRedirect('admin'); } } } else { if (isset($_COOKIE['requested_uri'])) { $redirect = $_COOKIE['requested_uri']; $path = explode('/', $redirect); if (count($path) == 3 && !$path[2]) { $redirect = $redirect . 'index'; } else { if (count($path) == 2) { if (!$path[1]) { $redirect .= 'index'; } $redirect = $redirect . '/index'; } else { if (count($path) == 1) { $redirect = $redirect . '/index/index'; } } } $paths = explode('/', $redirect); $moduleName = $paths[0]; $controllerName = strtolower($paths[1]); $actionName = strtolower($paths[2]); setcookie('requested_uri', '', time() - 3600 * 24, $this->getFrontController()->getBaseUrl()); if (!('admin' === $moduleName && 'access-denied' === $controllerName && $actionName === 'index') && !('admin' === $moduleName && 'index' === $controllerName && 'logout' === $actionName) && !Fox::getHelper('admin/acl')->isAllowed($moduleName . '/' . $controllerName . '/' . $actionName)) { if ($this->getRequest()->getParam('isAjax', FALSE)) { echo '<script type="text/javascript">window.location.href=' . Fox::getUrl('*/access-denied/') . ';</script>'; exit; } else { $this->sendRedirect('*/access-denied/'); } } else { $this->sendRedirect($redirect); } } else { $moduleName = strtolower($this->getRequest()->getModuleName()); $controllerName = strtolower($this->getRequest()->getControllerName()); $actionName = strtolower($this->getRequest()->getActionName()); if (!('admin' === $moduleName && 'access-denied' === $controllerName && $actionName === 'index') && !('admin' === $moduleName && 'index' === $controllerName && 'logout' === $actionName) && !Fox::getHelper('admin/acl')->isAllowed($moduleName . '/' . $controllerName . '/' . $actionName)) { if ($this->getRequest()->getParam('isAjax', FALSE)) { echo '<script type="text/javascript">window.location.href=\'' . Fox::getUrl('*/access-denied/') . '\';</script>'; exit; } else { $this->sendRedirect('*/access-denied/'); } } } } }
/** * Set data to package * * @param array $data Package data. * @throws Exception If Invalid package data */ public function setData(array $data) { try { if ($data) { if (!(isset($data["name"]) && $data["name"] && isset($data["description"]) && $data["description"] && isset($data["summary"]) && $data["summary"] && isset($data["license"]) && $data["license"] && isset($data["version"]) && $data["version"] && isset($data["stability"]) && $data["stability"])) { throw new Exception("Invalid package data"); } if (!Fox::getHelper("extensionmanager/data")->validateVersion($data["version"])) { throw new Exception("Version field must contain value like x.x.x.x"); } $this->setVersion($data["version"]); $this->setName($data["name"]); $this->setDescription($data["description"]); $this->setSummary($data["summary"]); $this->setLicense($data["license"]); if (isset($data["license_url"])) { $this->setLicenseUrl($data["license_url"]); } $this->setStability($data["stability"]); if (isset($data["release_note"])) { $this->setReleaseNote($data["release_note"]); } if (isset($data['providers']) && $data['providers']) { $this->setProviders($data['providers']); } else { throw new Exception("Invalid provider."); } if (isset($data['provider_note'])) { $this->setProviderNote($data['provider_note']); } if (isset($data['content_tree_data']) && $data['content_tree_data']) { $this->setContentTreeData($data['content_tree_data']); } else { throw new Exception("Invalid package content"); } $this->hasData = TRUE; } else { throw new Exception("Invalid package data."); } } catch (Exception $e) { $this->errors[] = $e->getMessage(); } }
/** * Download action */ public function downloadAction() { try { $package = $this->getPackage(); $packageName = str_replace(' ', '_', trim($this->getRequest()->getParam("package"))) . '-' . trim($this->getRequest()->getParam("version")) . '.zip'; $filename = $package->getGeneratedPkgCompressedDir() . DS . $packageName; if (!is_dir($filename) && file_exists($filename)) { header('Cache-Control: private; must-revalidate'); header('Pragma: no-cache'); header("Content-Type: application/zip"); header('Content-Length: ' . filesize($filename)); header('Content-Disposition: attachement; filename="' . $packageName . '"'); header('Content-Transfer-Encoding: binary'); readfile($filename); } else { Fox::getHelper('core/message')->addError("Package is not generated yet."); $this->sendRedirect('*/*/'); } } catch (Exception $e) { Fox::getHelper('core/message')->addError($e->getMessage()); $this->sendRedirect('*/*/'); } }
/** * * @param string $code */ public function addHead($code) { Fox::getHelper('core/head')->addHTML($code); }
/** * Save action */ public function saveAction() { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); $preferenceModel = Fox::getModel('core/preference'); $preferenceModel->getAdapter()->beginTransaction(); try { if (!empty($_FILES)) { $path = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER; if (!file_exists($path)) { if (!@mkdir($path, 0777, TRUE)) { throw new Exception('uploads directory was not found.'); } @chmod($path, 0777); } foreach ($_FILES as $mainKey => $value) { if (is_array($value) && isset($value['name']) || isset($value['tmp_name'])) { $i = 0; foreach ($value as $section => $field) { foreach ($field as $key => $fieldValue) { if ($section == 'name') { foreach ($fieldValue as $fieldName => $fileField) { $fieldKey = $mainKey . '/' . $key . '/' . $fieldName; $preferenceModel->load($fieldKey, 'name'); if (isset($_FILES[$mainKey]) && isset($_FILES[$mainKey]['name']) && isset($_FILES[$mainKey]['name'][$key]) && isset($_FILES[$mainKey]['name'][$key][$fieldName])) { $fileName = $_FILES[$mainKey]['name'][$key][$fieldName]; if (($pos = strrpos($fileName, '.')) > -1) { if (file_exists($path . DIRECTORY_SEPARATOR . $preferenceModel->getValue())) { @unlink($path . DIRECTORY_SEPARATOR . $preferenceModel->getValue()); } $ext = substr($fileName, $pos + 1); $fileName = 'FILE-' . time() . $i++ . '.' . $ext; $filePath = $path . DIRECTORY_SEPARATOR . $fileName; move_uploaded_file($_FILES[$mainKey]['tmp_name'][$key][$fieldName], $filePath); @chmod($filePath, 0777); $preferenceModel->setName($fieldKey); $preferenceModel->setValue($fileName); $preferenceModel->save(); $preferenceModel->unsetData(); } } } } } } } } } foreach ($data as $mainKey => $value) { if (is_array($value)) { foreach ($value as $section => $field) { foreach ($field as $key => $fieldValue) { $fieldKey = $mainKey . '/' . $section . '/' . $key; $preferenceModel->load($fieldKey, 'name'); $preferenceModel->setName($fieldKey); if (is_array($fieldValue)) { $val = implode(',', $fieldValue); } else { $val = $fieldValue; } $preferenceModel->setValue($val); $preferenceModel->save(); $preferenceModel->unsetData(); } } } } $preferenceModel->getAdapter()->commit(); Uni_Core_Preferences::loadPreferences(TRUE); Fox::initializePreferences(); Fox::getHelper('core/message')->setInfo('Data was successfully saved.'); } catch (Exception $e) { Fox::getModel('core/session')->setFormData($data); Fox::getHelper('core/message')->setError($e->getMessage()); $preferenceModel->getAdapter()->rollback(); $this->sendRedirect('*/*/edit', array('item' => $mainKey)); } } if (isset($mainKey)) { $this->sendRedirect('*/*/edit', array('item' => $mainKey)); } else { $this->sendRedirect('*/*/'); } }
/** * Bulk unsubscribe action */ public function groupUnsubscribeAction() { try { $model = Fox::getModel('newsletter/subscriber'); $ids = $this->getGroupActionIds($model); $totalIds = count($ids); $count = 0; if ($totalIds) { for ($i = 0; $i < $totalIds; $i++) { $model->load($ids[$i]); if ($model->getId() && $model->unsubscribe()) { $count++; } $model->unsetData(); } Fox::getHelper('core/message')->setInfo('Total ' . $count . ' record(s) successfully unsubscribed.'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/'))); }
/** * Set header text * * @param string $headerText */ public function setHeaderText($headerText) { Fox::getHelper('core/head')->addTitle($headerText, FALSE); $this->headerText = $headerText; }
/** * * @return Uni_Core_Helper */ public function getHeadHelper() { if (NULL == $this->headHelper) { $this->headHelper = Fox::getHelper('core/head'); } return $this->headHelper; }
/** * Get meta description * * @return string */ public function getMetaDescription() { $metaDescription = Fox::getHelper('core/head')->getMetaDescription(); if (!$metaDescription) { $metaDescription = Fox::getPreference('web/head/default_description'); } return $metaDescription; }
/** * Get page title * * @return string */ public function getTitle() { $helper = Fox::getHelper('core/head'); $title = $helper->getTitle(); return htmlspecialchars(html_entity_decode(implode($this->_titleSeparartor, $title))); }
/** * Bulk delete action */ public function groupDeleteAction() { try { $model = Fox::getModel('backup/backup'); $ids = $this->getGroupActionIds($model); $totalIds = count($ids); $filePath = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . Fox_Backup_Model_Backup::BACKUP_PATH . DIRECTORY_SEPARATOR; if ($totalIds) { foreach ($ids as $d) { $model->load($d); @unlink($filePath . $model->getFileName()); $model->unSetData(); } $model->delete($model->getPrimaryField() . ' IN (' . implode(',', $ids) . ')'); } Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' record(s) successfully deleted.'); } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/'))); }
/** * Send newsletter action */ public function sendAction() { $id = $this->getRequest()->getParam('id'); if ($id) { try { $model = Fox::getModel('newsletter/template'); $model->load($id); if ($model->getId()) { $model->sendNewsletter(); Fox::getHelper('core/message')->setInfo('"' . $model->getName() . '" was successfully sent.'); } else { Fox::getHelper('core/message')->setError('Newsletter template was not found.'); } } catch (Exception $e) { Fox::getHelper('core/message')->setError($e->getMessage()); } } $this->sendRedirect('*/*/'); }