本文整理匯總了PHP中Zend_Session::namespaceIsset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Session::namespaceIsset方法的具體用法?PHP Zend_Session::namespaceIsset怎麽用?PHP Zend_Session::namespaceIsset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::namespaceIsset方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _init
/**
* Initialize feedback, sets feedback_id from UUID value
* This value can be provided via the url or a cookie and
* will be stored in a session
*
* If no valid feedback code is found in the request string, the cookie
* or in the session (also a cookie) then return false
*
* @return integer feeback_id
*/
private function _init()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$conference = Zend_Registry::get('conference');
$sessionNs = $conference['abbreviation'] . '_feedback';
// check if feedback deadline has passed
if (isset($conference['feedback_end'])) {
if (Zend_Date::now()->isLater($conference['feedback_end'])) {
return false;
}
}
// check if session is set
if (Zend_Session::namespaceIsset($sessionNs)) {
$session = new Zend_Session_Namespace($sessionNs, true);
return $this->_feedback_id = $session->feedback_id;
}
// for uuid parameter, first try Request value, if not available use Cookie value
$uuid = $request->getParam('uuid', $request->getCookie('feedback_code'));
// use parameter to set session and cookie
if ($uuid) {
if ($feedback = $this->getFeedbackByUuid($uuid)) {
$session = new Zend_Session_Namespace($sessionNs, true);
// cookie expires in 14 days
if ($request->getParam('uuid')) {
// only set cookie if it is not already set
setcookie('feedback_code', $uuid, time() + 14 * 3600 * 24, '/', $conference['hostname']);
}
return $this->_feedback_id = $session->feedback_id = (int) $feedback->code_id;
}
}
// If no UUID is found in Request, Cookie or Session then return
return false;
}
示例2: isLoggedIn
/**
* function that checks if a user session is set
* @author lekha
* @date 3/22/2012
*
*/
public function isLoggedIn()
{
if (Zend_Session::namespaceIsset('UserSession')) {
return 1;
} else {
return 0;
}
}
示例3: isLoggedin
function isLoggedin()
{
foreach (array('user', 'advertiser', 'administrator') as $person) {
if (Zend_Session::namespaceIsset($person)) {
return true;
}
}
return false;
}
示例4: preDispatch
public function preDispatch()
{
$controller = $this->getRequest()->getControllerName();
$action = $this->getRequest()->getActionName();
$authNamespace = new Zend_Session_Namespace('Zend_Auth');
// print_r($controller);die;
if ($this->filter($controller, $action)) {
if (!Zend_Auth::getInstance()->hasIdentity()) {
$config = Zend_Registry::get('config');
$lang = $this->_request->getParam('lang');
if (isset($lang) && $lang != null) {
$langNamespace = new Zend_Session_Namespace('Lang');
$langNamespace->lang = $lang;
}
if (substr($action, 0, 5) == 'admin') {
$this->_redirector = $this->_helper->getHelper('Redirector');
$this->_redirector->gotoUrl('/admin?url=' . $this->getRequest()->getPathInfo());
} else {
if (substr($action, 0, 6) == 'client') {
$this->_helper->redirector('login', 'client');
} else {
$this->_redirector = $this->_helper->getHelper('Redirector');
$this->_redirector->gotoUrl('/index/index?url=' . $this->getRequest()->getPathInfo());
}
}
} else {
//2011-04-08 ham.bao separate the sessions with admin
if (substr($action, 0, 5) == 'admin' && $this->_currentAdmin->getTableClass() != 'Admin') {
//$this->_helper->redirector('login','admin');
$this->_redirector = $this->_helper->getHelper('Redirector');
$this->_redirector->gotoUrl('/admin?url=' . $this->getRequest()->getPathInfo());
} else {
if (substr($action, 0, 6) == 'client') {
//$this->_helper->redirector('login','client');
//2011-04-08 ham.bao separate the sessions with client
//if ($this->_currentUser->getTableClass() != 'Client'){
if ($this->_currentClient->getTableClass() != 'Client') {
$this->_redirector = $this->_helper->getHelper('Redirector');
$this->_redirector->gotoUrl('/client?url=' . $this->getRequest()->getPathInfo());
} else {
//check client new message count
if (Zend_Session::namespaceIsset("ClientMessage")) {
$namespace = new Zend_Session_Namespace('ClientMessage');
$attrName = "count_" . $this->_currentUser->id;
if ($namespace->{$attrName} > 0) {
$this->view->client_message_count = "(" . $namespace->{$attrName} . ")";
}
}
}
}
}
}
}
}
示例5: getPerson
function getPerson()
{
Zend_Session::start();
$person = 'visitor';
foreach (Site::getPersons() as $who) {
if (Zend_Session::namespaceIsset($who)) {
$session = new Zend_Session_Namespace($who);
if ($session->{$who} != null) {
$person = $who;
break;
}
}
}
return $person;
}
示例6: init
/**
*
*/
public function init()
{
if (Zend_Session::isStarted() && Zend_Session::namespaceIsset('SwIRS_Web')) {
$session = Zend_Session::namespaceGet('SwIRS_Web');
$this->getRequest()->setParam('CustomerState', $session['customerState']);
$this->getRequest()->setParam('CustomerUserId', $session['customerUserId']);
$this->getRequest()->setParam('CustomerAccountId', $session['customerAccountId']);
$this->getRequest()->setParam('SecondaryCustomerAccountId', $session['secondaryCustomerAccountId']);
$this->getRequest()->setParam('Profile', $session['profile']);
$webservice = $this->getResource('webservice');
$webservice->setAuth(array('user' => $session['username'], 'password' => $session['password']));
}
$front = $this->getResource('FrontController');
$front->setRequest($this->getRequest());
}
示例7: generatePageMessage
/**
* Generates the page messages to display on client browser
*
* Note: The default level for message is sets to 'info'.
* See the {@link set_page_message()} function for more information.
*
* @param iMSCP_pTemplate $tpl iMSCP_pTemplate instance
* @return void
*/
function generatePageMessage($tpl)
{
$namespace = new Zend_Session_Namespace('pageMessages');
if (Zend_Session::namespaceIsset('pageMessages')) {
foreach (array('success', 'error', 'warning', 'info', 'static_success', 'static_error', 'static_warning', 'static_info') as $level) {
if (isset($namespace->{$level})) {
$tpl->assign(array('MESSAGE_CLS' => $level, 'MESSAGE' => $namespace->{$level}));
$tpl->parse('PAGE_MESSAGE', '.page_message');
}
}
Zend_Session::namespaceUnset('pageMessages');
} else {
$tpl->assign('PAGE_MESSAGE', '');
}
}
示例8: switchBackAction
public function switchBackAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$session = new Zend_Session_Namespace('superadmin');
if (!isset($session->identity)) {
$session = new Zend_Session_Namespace('groupadmin');
}
if (Zend_Session::namespaceIsset('superadmin')) {
if (isset($session->identity)) {
$auth->getStorage()->write(unserialize($session->identity));
Zend_Session::namespaceUnset('superadmin');
$this->_redirect('/admin/list-organisation');
} else {
$this->_redirect('/wep/dashboard');
}
} elseif (Zend_Session::namespaceIsset('groupadmin')) {
if (isset($session->identity)) {
$auth->getStorage()->write(unserialize($session->identity));
Zend_Session::namespaceUnset('groupadmin');
$this->_redirect('/group/list-organisation');
} else {
$this->_redirect('/group/dashboard');
}
} else {
$this->_redirect('/wep/dashboard');
}
}
}
示例9: client_saveDnsRecord
/**
* Check and save DNS record
*
* @throws iMSCP_Exception_Database
* @param int $dnsRecordId DNS record unique identifier (0 for new record)
* @return bool TRUE on success, FALSE otherwise
*/
function client_saveDnsRecord($dnsRecordId)
{
$mainDmnProps = get_domain_default_props($_SESSION['user_id']);
$mainDmnId = $mainDmnProps['domain_id'];
$errorString = '';
$dnsRecordName = '';
$dnsRecordClass = client_getPost('class');
$dnsRecordType = client_getPost('type');
if ($dnsRecordClass != 'IN' || !in_array($dnsRecordType, array('A', 'AAAA', 'CNAME', 'SRV', 'TXT'))) {
showBadRequestErrorPage();
}
$dnsRecordData = '';
if (!$dnsRecordId) {
if ($_POST['domain_id'] == 0) {
$domainName = $mainDmnProps['domain_name'];
$domainId = 0;
} else {
$stmt = exec_query('SELECT alias_id, alias_name FROM domain_aliasses WHERE alias_id = ? AND domain_id = ?', array($_POST['domain_id'], $mainDmnId));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
$domainName = $stmt->fields['alias_name'];
$domainId = $stmt->fields['alias_id'];
}
} else {
$stmt = exec_query('
SELECT
t1.*, IFNULL(t3.alias_name, t2.domain_name) domain_name,
IFNULL(t3.alias_status, t2.domain_status) domain_status
FROM
domain_dns AS t1
LEFT JOIN
domain AS t2 USING(domain_id)
LEFT JOIN
domain_aliasses AS t3 USING (alias_id)
WHERE
domain_dns_id = ?
AND
t1.domain_id = ?
', array($dnsRecordId, $mainDmnId));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);
$domainId = $row['alias_id'] ? $row['alias_id'] : $row['domain_id'];
$domainName = $row['domain_name'];
$dnsRecordName = $row['domain_dns'];
}
$nameValidationError = '';
if (in_array($dnsRecordType, array('A', 'AAAA', 'CNAME'))) {
if (!client_validate_NAME(client_getPost('dns_name'), $domainName, $nameValidationError)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $nameValidationError), 'error');
}
}
if (!Zend_Session::namespaceIsset('pageMessages')) {
switch ($dnsRecordType) {
case 'CNAME':
$cname = client_getPost('dns_cname');
$newName = encode_idna(substr(client_getPost('dns_name'), -1) == '.' ? client_getPost('dns_name') : client_getPost('dns_name') . '.' . $domainName);
$oldName = $dnsRecordName != '' ? substr($dnsRecordName, -1) == '.' ? $dnsRecordName : $dnsRecordName . '.' . $domainName : '';
if (!client_validate_CNAME($cname, $domainName, $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
} elseif ($newName != $oldName && !client_checkConflict($newName, 'CNAME', $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
} elseif ($newName != $oldName && !client_checkConflict($newName, 'A', $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
} elseif ($newName != $oldName && !client_checkConflict($newName, 'AAAA', $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
}
$dnsRecordName = encode_idna(client_getPost('dns_name'));
if ($cname != '@') {
$dnsRecordData = encode_idna($cname);
} else {
$dnsRecordData = $cname;
}
break;
case 'A':
$ip = client_getPost('dns_A_address');
$newName = encode_idna(substr(client_getPost('dns_name'), -1) == '.' ? client_getPost('dns_name') : client_getPost('dns_name') . '.' . $domainName);
if (!client_validate_A($ip, $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
} elseif (!client_checkConflict($newName, 'CNAME', $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
} elseif (!client_checkConflict($newName, 'A', $errorString)) {
set_page_message(sprintf(tr("Cannot validate record: %s"), $errorString), 'error');
}
$dnsRecordName = encode_idna(client_getPost('dns_name'));
$dnsRecordData = $ip;
break;
case 'AAAA':
$ip = client_getPost('dns_AAAA_address');
$newName = encode_idna(substr(client_getPost('dns_name'), -1) == '.' ? client_getPost('dns_name') : client_getPost('dns_name') . '.' . $domainName);
if (!client_validate_AAAA(client_getPost('dns_AAAA_address'), $errorString)) {
//.........這裏部分代碼省略.........
示例10: thankyouAction
function thankyouAction()
{
$adminAddSession = Zend_Session::namespaceGet("adminAddSession");
$id = (int) $this->_request->getParam('survey', 0);
$currentTime = date("Y-m-d H:i:s");
$code = $this->_request->getParam('c');
if (isset($adminAddSession['consumer'])) {
$consumer_id = $adminAddSession['consumer'];
} else {
$consumer = $this->_currentUser;
$consumer_id = $consumer->id;
// $id = 266;
if ($consumer->getTableClass() == 'Admin') {
// if admin get report from session (sms report)
if (Zend_Session::namespaceIsset("AgentReports")) {
$session = Zend_Session::namespaceGet("AgentReports");
if (isset($session[$code]) && $session[$code] != null) {
$consumer_id = $session[$code];
$session[$code] = null;
// delete this accesscode
$this->view->adminredirect = true;
// for admin redirect
}
}
}
}
$reportModel = new Report();
$duplicatedReport = $reportModel->fetchAll('report.accesscode = "' . $code . '"');
$campaignModel = new Campaign();
$campaign = $campaignModel->fetchRow("i2_survey_id =" . $id . " or " . "i2_survey_id_en =" . $id);
//create a record in report table
if (count($duplicatedReport) == 0) {
$report = $reportModel->createRow();
$report->consumer_id = $consumer_id;
$report->campaign_id = $campaign->id;
$report->create_date = $currentTime;
$session = Zend_Session::namespaceGet("AgentReports");
if (isset($session[$code]) && $session[$code] != null) {
$report->source = $session[$code . '_source'];
$session[$code . '_source'] = null;
}
//ham.bao 2011/04/29 admin add the report
$adminAddSession = Zend_Session::namespaceGet("adminAddSession");
if (isset($adminAddSession['consumer'])) {
$this->view->adminredirect = true;
$report->source = $adminAddSession['source'];
$report->consumer_id = $adminAddSession['consumer'];
$report->campaign_id = $adminAddSession['campaign'];
}
$report->state = 'NEW';
$report->accesscode = $code;
$reportId = $report->save();
$this->view->reportId = $reportId;
if ($this->view->adminredirect) {
//ham.bao 2010-10-13 update the incoming_email state
if (Zend_Session::namespaceIsset("IncomingEmail")) {
$emailSession = new Zend_Session_Namespace('IncomingEmail');
$incomingEmailModel = new IncomingEmail();
$incomingEmailModel->update(array('report_id' => $reportId), 'id=' . $emailSession->id);
$this->_helper->redirector('successconvert', 'email');
}
//ham.bao 2011/04/29 admin add the report
if (isset($adminAddSession['consumer'])) {
$this->_helper->redirector('successconvert', 'email');
}
}
//change state in campaign_particpation table
// $invitationModel = new CampaignInvitation();
// $invitation = $invitationModel->fetchRow("campaign_id =".$campaign->id." and consumer_id=".$consumer->id);
//
// $participationModel = new CampaignParticipation();
// $participation = $participationModel->fetchRow('campaign_invitation_id = '.$invitation->id);
// $participation->state = 'REPORT SUBMITTED';
// $participation->save();
} else {
$this->view->reportId = $duplicatedReport[0]['id'];
}
$option = array($this->view->reportId, $consumer_id);
$form = new ReportForm($option);
$this->view->form = $form;
if ($this->_request->isPost()) {
$image = $form->getValue('image');
if ($image != '') {
$reportImage = new ReportImages();
$row = $reportImage->createRow();
$row->name = $image;
$row->consumer = $consumer_id;
$row->report = $this->view->reportId;
$row->crdate = date('Y-m-d H:i:s');
$row->save();
$this->view->saved = 1;
} else {
$this->view->saved = -1;
}
//var_dump($image);die;
}
$this->view->consumer = $consumer_id;
$this->view->title = $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("Thanks_For_report");
}
示例11: checkInputData
//.........這裏部分代碼省略.........
set_page_message(tr('Incorrect email account limit.'), 'error');
$errFieldsStack[] = 'mail';
}
if (!resellerHasFeature('ftp')) {
$ftp = '-1';
} elseif (!imscp_limit_check($ftp, -1)) {
set_page_message(tr('Incorrect FTP account limit.'), 'error');
$errFieldsStack[] = 'ftp';
}
if (!resellerHasFeature('sql_db')) {
$sqld = '-1';
} elseif (!imscp_limit_check($sqld, -1)) {
set_page_message(tr('Incorrect SQL database limit.'), 'error');
$errFieldsStack[] = 'sql_db';
} elseif ($sqlu != -1 && $sqld == -1) {
set_page_message(tr('SQL user limit is <i>disabled</i>.'), 'error');
$errFieldsStack[] = 'sql_db';
$errFieldsStack[] = 'sql_user';
}
if (!resellerHasFeature('sql_user')) {
$sqlu = '-1';
} elseif (!imscp_limit_check($sqlu, -1)) {
set_page_message(tr('Incorrect SQL user limit.'), 'error');
$errFieldsStack[] = 'sql_user';
} elseif ($sqlu == -1 && $sqld != -1) {
set_page_message(tr('SQL database limit is not <i>disabled</i>.'), 'error');
$errFieldsStack[] = 'sql_user';
$errFieldsStack[] = 'sql_db';
}
if (!imscp_limit_check($traffic, null)) {
set_page_message(tr('Incorrect monthly traffic limit.'), 'error');
$errFieldsStack[] = 'traff';
}
if (!imscp_limit_check($diskSpace, null)) {
set_page_message(tr('Incorrect disk space limit.'), 'error');
$errFieldsStack[] = 'disk';
}
if (!imscp_limit_check($mailQuota, null)) {
set_page_message(tr('Wrong syntax for the mail quota value.'), 'error');
$errFieldsStack[] = 'mail_quota';
} elseif ($diskSpace != 0 && $mailQuota > $diskSpace) {
set_page_message(tr('Email quota cannot be bigger than disk space limit.'), 'error');
$errFieldsStack[] = 'mail_quota';
} elseif ($diskSpace != 0 && $mailQuota == 0) {
set_page_message(tr('Email quota cannot be unlimited. Max value is %d MiB.', $diskSpace), 'error');
$errFieldsStack[] = 'mail_quota';
}
$phpini = iMSCP_PHPini::getInstance();
if (isset($_POST['php_ini_system']) && $php != '_no_' && $phpini->resellerHasPermission('phpiniSystem')) {
$phpini->setClientPermission('phpiniSystem', clean_input($_POST['php_ini_system']));
if ($phpini->clientHasPermission('phpiniSystem')) {
if (isset($_POST['phpini_perm_allow_url_fopen'])) {
$phpini->setClientPermission('phpiniAllowUrlFopen', clean_input($_POST['phpini_perm_allow_url_fopen']));
}
if (isset($_POST['phpini_perm_display_errors'])) {
$phpini->setClientPermission('phpiniDisplayErrors', clean_input($_POST['phpini_perm_display_errors']));
}
if (isset($_POST['phpini_perm_disable_functions'])) {
$phpini->setClientPermission('phpiniDisableFunctions', clean_input($_POST['phpini_perm_disable_functions']));
}
if (isset($_POST['phpini_perm_mail_function'])) {
$phpini->setClientPermission('phpiniMailFunction', clean_input($_POST['phpini_perm_mail_function']));
}
if (isset($_POST['memory_limit'])) {
// Must be set before phpiniPostMaxSize
$phpini->setDomainIni('phpiniMemoryLimit', clean_input($_POST['memory_limit']));
}
if (isset($_POST['post_max_size'])) {
// Must be set before phpiniUploadMaxFileSize
$phpini->setDomainIni('phpiniPostMaxSize', clean_input($_POST['post_max_size']));
}
if (isset($_POST['upload_max_filesize'])) {
$phpini->setDomainIni('phpiniUploadMaxFileSize', clean_input($_POST['upload_max_filesize']));
}
if (isset($_POST['max_execution_time'])) {
$phpini->setDomainIni('phpiniMaxExecutionTime', clean_input($_POST['max_execution_time']));
}
if (isset($_POST['max_input_time'])) {
$phpini->setDomainIni('phpiniMaxInputTime', clean_input($_POST['max_input_time']));
}
} else {
$phpini->loadClientPermissions();
// Reset client PHP permissions to default values
$phpini->loadDomainIni();
// Reset domain PHP configuration options to default values
}
} else {
$phpini->loadClientPermissions();
// Reset client PHP permissions to default values
$phpini->loadDomainIni();
// Reset domain PHP configuration options to default values
}
if (!Zend_Session::namespaceIsset('pageMessages')) {
return true;
}
if (!empty($errFieldsStack)) {
iMSCP_Registry::set('errFieldsStack', $errFieldsStack);
}
return false;
}
示例12: admin_validatesService
/**
* Validates a service port and sets an appropriate message on error.
*
* @param string $name Service name
* @param string $ip Ip address
* @param int $port Port
* @param string $protocol Protocle
* @param bool $show Tell whether or not service must be show on status page
* @param string $index Item index on update, empty value otherwise
* @return bool TRUE if valid, FALSE otherwise
*/
function admin_validatesService($name, $ip, $port, $protocol, $show, $index = '')
{
/** @var $dbConfig iMSCP_Config_Handler_Db */
$dbConfig = iMSCP_Registry::get('dbConfig');
// Get a reference to the array that contain all error fields ids
$errorFieldsIds =& iMSCP_Registry::get('errorFieldsIds');
$dbServiceName = "PORT_{$name}";
$ip = $ip == 'localhost' ? '127.0.0.1' : $ip;
// Check for service name syntax
if (!is_basicString($name)) {
set_page_message(tr("Error with '{$name}': Only letters, numbers, dash and underscore are allowed for services names."), 'error');
$errorFieldsIds[] = "name{$index}";
}
// Check for IP syntax
if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
set_page_message(tr(' Wrong IP address.'), 'error');
$errorFieldsIds[] = "ip{$index}";
}
// Check for port syntax
if (!is_number($port) || $port < 1 || $port > 65535) {
set_page_message(tr('Only numbers in range from 0 to 65535 are allowed.'), 'error');
$errorFieldsIds[] = "port{$index}";
}
// Check for service port existences
if (!is_int($index) && isset($dbConfig[$dbServiceName])) {
set_page_message(tr('Service name already exists.'), 'error');
$errorFieldsIds[] = "name{$index}";
}
// Check for protocol and show option
if ($protocol != 'tcp' && $protocol != 'udp' || $show != '0' && $show != '1') {
showBadRequestErrorPage();
}
return Zend_Session::namespaceIsset('pageMessages') ? false : true;
}
示例13: delete
/**
* Delete
*
* @param array $params Request data
* @access public
* @return mixed Result of dao execution
*/
public function delete(array $params)
{
if ($this->_before(__FUNCTION__) === false) {
return false;
}
$this->setRules('deleteRules', $params);
if ($this->isValid($params) === false) {
return false;
}
$ret = $this->_delete($params);
if ($ret === false) {
$this->setMessages($this->_apptranslate->_('Fail to update.'));
return false;
}
if ($this->_after(__FUNCTION__) === false) {
return false;
}
$namespace = $this->_session->getNamespace();
if (Zend_Session::namespaceIsset($namespace) === true) {
$this->_session->remove($namespace);
}
return $ret;
}
示例14: admin_checkAndUpdateData
/**
* Check and updates reseller data
*
* @throws iMSCP_Exception_Database
* @param int $resellerId Reseller unique identifier
* @return bool TRUE on success, FALSE otherwise
*/
function admin_checkAndUpdateData($resellerId)
{
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onBeforeEditUser, array('userId' => $resellerId));
$errFieldsStack = array();
$data =& admin_getData($resellerId, true);
$db = iMSCP_Database::getInstance();
try {
$db->beginTransaction();
// check for password (if needed)
if ($data['password'] !== '' && $data['pasword_confirmation'] !== '') {
if ($data['password'] !== $data['password_confirmation']) {
set_page_message(tr('Passwords do not match.'), 'error');
}
checkPasswordSyntax($data['password']);
if (Zend_Session::namespaceIsset('pageMessages')) {
$errFieldsStack[] = 'password';
$errFieldsStack[] = 'password_confirmation';
}
}
// Check for email address
if (!chk_email($data['email'])) {
set_page_message(tr('Incorrect syntax for email address.'), 'error');
$errFieldsStack[] = 'email';
}
// Check for ip addresses
$resellerIps = array();
foreach ($data['server_ips'] as $serverIpData) {
if (in_array($serverIpData['ip_id'], $data['reseller_ips'], true)) {
$resellerIps[] = $serverIpData['ip_id'];
}
}
$resellerIps = array_unique(array_merge($resellerIps, $data['used_ips']));
sort($resellerIps);
if (empty($resellerIps)) {
set_page_message(tr('You must assign at least one IP to this reseller.'), 'error');
}
// Check for max domains limit
if (imscp_limit_check($data['max_dmn_cnt'], null)) {
$rs = admin_checkResellerLimit($data['max_dmn_cnt'], $data['current_dmn_cnt'], $data['nbDomains'], '0', tr('domains'));
} else {
set_page_message(tr('Incorrect limit for %s.', tr('domain')), 'error');
$rs = false;
}
if (!$rs) {
$errFieldsStack[] = 'max_dmn_cnt';
}
// Check for max subdomains limit
if (imscp_limit_check($data['max_sub_cnt'])) {
$rs = admin_checkResellerLimit($data['max_sub_cnt'], $data['current_sub_cnt'], $data['nbSubdomains'], $data['unlimitedSubdomains'], tr('subdomains'));
} else {
set_page_message(tr('Incorrect limit for %s.', tr('subdomains')), 'error');
$rs = false;
}
if (!$rs) {
$errFieldsStack[] = 'max_sub_cnt';
}
// check for max domain aliases limit
if (imscp_limit_check($data['max_als_cnt'])) {
$rs = admin_checkResellerLimit($data['max_als_cnt'], $data['current_als_cnt'], $data['nbDomainAliases'], $data['unlimitedDomainAliases'], tr('domain aliases'));
} else {
set_page_message(tr('Incorrect limit for %s.', tr('domain aliases')), 'error');
$rs = false;
}
if (!$rs) {
$errFieldsStack[] = 'max_als_cnt';
}
// Check for max mail accounts limit
if (imscp_limit_check($data['max_mail_cnt'])) {
$rs = admin_checkResellerLimit($data['max_mail_cnt'], $data['current_mail_cnt'], $data['nbMailAccounts'], $data['unlimitedMailAccounts'], tr('mail'));
} else {
set_page_message(tr('Incorrect limit for %s.', tr('email accounts')), 'error');
$rs = false;
}
if (!$rs) {
$errFieldsStack[] = 'max_mail_cnt';
}
// Check for max ftp accounts limit
if (imscp_limit_check($data['max_ftp_cnt'])) {
$rs = admin_checkResellerLimit($data['max_ftp_cnt'], $data['current_ftp_cnt'], $data['nbFtpAccounts'], $data['unlimitedFtpAccounts'], tr('Ftp'));
} else {
set_page_message(tr('Incorrect limit for %s.', tr('Ftp accounts')), 'error');
$rs = false;
}
if (!$rs) {
$errFieldsStack[] = 'max_ftp_cnt';
}
// Check for max Sql databases limit
if (!($rs = imscp_limit_check($data['max_sql_db_cnt']))) {
set_page_message(tr('Incorrect limit for %s.', tr('SQL databases')), 'error');
} elseif ($data['max_sql_db_cnt'] == -1 && $data['max_sql_user_cnt'] != -1) {
set_page_message(tr('SQL database limit is disabled but SQL user limit is not.'), 'error');
$rs = false;
} else {
//.........這裏部分代碼省略.........
示例15: _initLocale
protected function _initLocale()
{
if (Zend_Session::namespaceIsset('language') && !isset($_GET['lan'])) {
$sess = new Zend_Session_Namespace('language');
$ssLan = $sess->language;
} else {
$ssLan = isset($_GET['lan']) ? $_GET['lan'] : 'en';
$sess = new Zend_Session_Namespace('language');
$sess->language = $ssLan;
}
// define locale
//$ssLan=(isset($_GET['lan']))?$_GET['lan']:'fr';
$locale = new Zend_Locale($ssLan);
// register it so that it can be used all over the website
Zend_Registry::set('Zend_Locale', $locale);
}