示例#1
0
文件: users.php 项目: hungnv0789/vhtm
	/**
	* Process
	* Works out what's going on.
	* The API does the loading, saving, updating - this page just displays the right form(s), checks password validation and so on.
	* After that, it'll print a success/failure message depending on what happened.
	* It also checks to make sure that you're an admin before letting you add or delete.
	* It also checks you're not going to delete your own account.
	* If you're not an admin user, it won't let you edit anyone elses account and it won't let you delete your own account either.
	*
	* @see PrintHeader
	* @see ParseTemplate
	* @see IEM::getDatabase()
	* @see GetUser
	* @see GetLang
	* @see User_API::Set
	* @see PrintEditForm
	* @see CheckUserSystem
	* @see PrintManageUsers
	* @see User_API::Find
	* @see User_API::Admin
	* @see PrintFooter
	*
	* @return Void Doesn't return anything, passes control over to the relevant function and prints that functions return message.
	*/
	function Process()
	{
		$action = (isset($_GET['Action'])) ? strtolower($_GET['Action']) : '';

		if (!in_array($action, $this->PopupWindows)) {
			$this->PrintHeader();
		}

		$thisuser    = IEM::getCurrentUser();
		$checkaction = $action;
		
		if ($action == 'generatetoken') {
			$checkaction = 'manage';
		}
		
		if (!$thisuser->HasAccess('users', $checkaction)) {
			$this->DenyAccess();
		}

		if ($action == 'processpaging') {
			$this->SetPerPage($_GET['PerPageDisplay']);
			
			$action = '';
		}

		switch ($action) {
			case 'generatetoken':
				$check_fields = array('username', 'fullname', 'emailaddress');
				foreach ($check_fields as $field) {
					if (!isset($_POST[$field])) {
						exit;
					}
					$$field = $_POST[$field];
				}
				$user = GetUser();
				echo htmlspecialchars(sha1($username . $fullname . $emailaddress . GetRealIp(true) . time() . microtime()), ENT_QUOTES, SENDSTUDIO_CHARSET);
				exit;
			break;

			case 'save':
				$userid = (isset($_GET['UserID']))
					? $_GET['UserID']
					: 0;
				
				if (empty($_POST)) {
					$GLOBALS['Error']   = GetLang('UserNotUpdated');
					$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
					
					$this->PrintEditForm($userid);
					
					break;
				}

				$user     = GetUser($userid);
				$username = false;
				
				if (isset($_POST['username'])) {
					$username = $_POST['username'];
				}
				
				$userfound = $user->Find($username);
				$error     = false;
				$template  = false;

				$duplicate_username = false;
				
				if ($userfound && $userfound != $userid) {
					$duplicate_username = true;
					$error = GetLang('UserAlreadyExists');
				}

				$warnings           = array();
				$GLOBALS['Message'] = '';

				if (!$duplicate_username) {
					$to_check = array();
					
					foreach (array('status' => 'isLastActiveUser', 'admintype' => 'isLastSystemAdmin') as $area => $desc) {
						if (!isset($_POST[$area])) {
							$to_check[] = $desc;
						}
						
						if (isset($_POST[$area]) && $_POST[$area] == '0') {
							$to_check[] = $desc;
						}
					}

					if ($user->isAdmin()) {
						$to_check[] = 'isLastSystemAdmin';
					}

					$error = $this->CheckUserSystem($userid, $to_check);
                    
					if (!$error) {
						$smtptype = (isset($_POST['smtptype']))
							? $_POST['smtptype'] 
							: 0;

						// Make sure smtptype is eiter 0 or 1
						if ($smtptype != 1) {
							$smtptype = 0;
						}

						/**
						 * This was added, because User's API uses different names than of the HTML form names.
						 * HTML form names should stay the same to keep it consistant throught the application
						 *
						 * This will actually map HTML forms => User's API fields
						 */
						$areaMapping = array(
							'trialuser'                    => 'trialuser',
							'groupid'                      => 'groupid',
							'username'                     => 'username',
							'fullname'                     => 'fullname',
							'emailaddress'                 => 'emailaddress',
							'status'                       => 'status',
							'admintype'                    => 'admintype',
							'listadmintype'                => 'listadmintype',
							'segmentadmintype'             => 'segmentadmintype',
							'templateadmintype'            => 'templateadmintype',
							'editownsettings'              => 'editownsettings',
							'usertimezone'                 => 'usertimezone',
							'textfooter'                   => 'textfooter',
							'htmlfooter'                   => 'htmlfooter',
							'infotips'                     => 'infotips',
							'smtp_server'                  => 'smtpserver',
							'smtp_u'                       => 'smtpusername',
							'smtp_p'                       => 'smtppassword',
							'smtp_port'                    => 'smtpport',
							'usewysiwyg'                   => 'usewysiwyg',
							'usexhtml'                     => 'usexhtml',
							'enableactivitylog'            => 'enableactivitylog',
							'xmlapi'                       => 'xmlapi',
							'xmltoken'                     => 'xmltoken',
							'googlecalendarusername'       => 'googlecalendarusername',
							'googlecalendarpassword'       => 'googlecalendarpassword',
							'user_language'                => 'user_language',
							'adminnotify_email'            => 'adminnotify_email',
							'adminnotify_send_flag'        => 'adminnotify_send_flag',
							'adminnotify_send_threshold'   => 'adminnotify_send_threshold',
							'adminnotify_send_emailtext'   => 'adminnotify_send_emailtext',
							'adminnotify_import_flag'      => 'adminnotify_import_flag',
							'adminnotify_import_threshold' => 'adminnotify_import_threshold',
							'adminnotify_import_emailtext' => 'adminnotify_import_emailtext'
						);
						
						$group           = API_USERGROUPS::getRecordById($_POST['groupid']);
						$totalEmails     = (int) $group['limit_totalemailslimit'];
						$unlimitedEmails = $totalEmails == 0;
						
						// set fields
						foreach ($areaMapping as $p => $area) {
							$val = (isset($_POST[$p])) ? $_POST[$p] : '';
							
							if (in_array($area, array('status', 'editownsettings'))) {
								if ($userid == $thisuser->userid) {
									$val = $thisuser->$area;
								}
							}
							
							$user->Set($area, $val);
						}

						// activity type
						$activity = IEM::requestGetPOST('eventactivitytype', '', 'trim');
						
						if (!empty($activity)) {
							$activity_array = explode("\n", $activity);
							
							for ($i = 0, $j = count($activity_array); $i < $j; ++$i) {
								$activity_array[$i] = trim($activity_array[$i]);
							}
						} else {
							$activity_array = array();
						}
						
						$user->Set('eventactivitytype', $activity_array);

						// the 'limit' things being on actually means unlimited. so check if the value is NOT set.
						foreach (array('permonth', 'perhour', 'maxlists') as $p => $area) {
							$limit_check = 'limit' . $area;
							$val         = 0;
							
							if (!isset($_POST[$limit_check])) {
								$val = (isset($_POST[$area])) 
									? $_POST[$area]
									: 0;
							}
							
							$user->Set($area, $val);
						}

						if (SENDSTUDIO_MAXHOURLYRATE > 0) {
							if ($user->Get('perhour') == 0 || ($user->Get('perhour') > SENDSTUDIO_MAXHOURLYRATE)) {
								$user_hourly = $this->FormatNumber($user->Get('perhour'));
								
								if ($user->Get('perhour') == 0) {
									$user_hourly = GetLang('UserPerHour_Unlimited');
								}
								
								$warnings[] = sprintf(GetLang('UserPerHourOverMaxHourlyRate'), $this->FormatNumber(SENDSTUDIO_MAXHOURLYRATE), $user_hourly);
							}
						}

						if ($smtptype == 0) {
							$user->Set('smtpserver', '');
							$user->Set('smtpusername', '');
							$user->Set('smtppassword', '');
							$user->Set('smtpport', 25);
						}

						if ($_POST['ss_p'] != '') {
							if ($_POST['ss_p_confirm'] != '' && $_POST['ss_p_confirm'] == $_POST['ss_p']) {
								$user->Set('password', $_POST['ss_p']);
							} else {
								$error = GetLang('PasswordsDontMatch');
							}
						}
					}

					if (!$error) {
						$user->RevokeAccess();

						$temp = array();
						
						if (!empty($_POST['permissions'])) {
							foreach ($_POST['permissions'] as $area => $p) {
								foreach ($p as $subarea => $k) {
									$temp[$subarea] = $user->GrantAccess($area, $subarea);
								}
							}
						}
					}
				}

				if (!$error) {
					$result = $user->Save();

					if ($result) {
						FlashMessage(GetLang('UserUpdated'), SS_FLASH_MSG_SUCCESS, IEM::urlFor('Users'));
					} else {
						$GLOBALS['Message'] = GetFlashMessages();
						$GLOBALS['Error'] = GetLang('UserNotUpdated');
						$GLOBALS['Message'] .= $this->ParseTemplate('ErrorMsg', true, false);
					}
				} else {
					$GLOBALS['Error'] = $error;
					$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
				}

				if (!empty($warnings)) {
					$GLOBALS['Warning'] = implode('<br/>', $warnings);
					$GLOBALS['Message'] .= $this->ParseTemplate('WarningMsg', true, false);
				}

				$this->PrintEditForm($userid);
			break;

			case 'add':
				$temp = get_available_user_count();
				if ($temp['normal'] == 0 && $temp['trial'] == 0) {
					$this->PrintManageUsers();
					break;
				}

				$this->PrintEditForm(0);
			break;

			case 'delete':
				$users = IEM::requestGetPOST('users', array(), 'intval');
				$deleteData = (IEM::requestGetPOST('deleteData', 0, 'intval') == 1);

				$this->DeleteUsers($users, $deleteData);
			break;

			case 'create':
				$user     = New User_API();
				$warnings = array();
				$fields   = array(
					'trialuser', 'username', 'fullname', 'emailaddress',
					'status', 'admintype', 'editownsettings',
					'listadmintype', 'segmentadmintype', 'usertimezone',
					'textfooter', 'htmlfooter', 'templateadmintype',
					'infotips', 'smtpserver',
					'smtpusername', 'smtpport', 'usewysiwyg',
					'enableactivitylog', 'xmlapi', 'xmltoken',
					'googlecalendarusername','googlecalendarpassword',
					'adminnotify_email','adminnotify_send_flag','adminnotify_send_threshold',
					'adminnotify_send_emailtext','adminnotify_import_flag','adminnotify_import_threshold',
					'adminnotify_import_emailtext'
				);

				if (!$user->Find($_POST['username'])) {
					foreach ($fields as $p => $area) {
						$val = (isset($_POST[$area]))
							? $_POST[$area]
							: '';

						$user->Set($area, $val);
					}

					// activity type
					$activity = IEM::requestGetPOST('eventactivitytype', '', 'trim');
					
					if (!empty($activity)) {
						$activity_array = explode("\n", $activity);
						
						for ($i = 0, $j = count($activity_array); $i < $j; ++$i) {
							$activity_array[$i] = trim($activity_array[$i]);
						}
					} else {
						$activity_array = array();
					}
					
					$user->Set('eventactivitytype', $activity_array);

					// the 'limit' things being on actually means unlimited. so check if the value is NOT set.
					foreach (array('permonth', 'perhour', 'maxlists') as $p => $area) {
						$limit_check = 'limit' . $area;
						$val         = 0;
						
						if (!isset($_POST[$limit_check])) {
							$val = (isset($_POST[$area])) 
								? $_POST[$area]
								: 0;
						}
						
						$user->Set($area, $val);
					}

					if (SENDSTUDIO_MAXHOURLYRATE > 0) {
						if ($user->Get('perhour') == 0 || ($user->Get('perhour') > SENDSTUDIO_MAXHOURLYRATE)) {
							$user_hourly = $this->FormatNumber($user->Get('perhour'));
							
							if ($user->Get('perhour') == 0) {
								$user_hourly = GetLang('UserPerHour_Unlimited');
							}
							
							$warnings[] = sprintf(GetLang('UserPerHourOverMaxHourlyRate'), $this->FormatNumber(SENDSTUDIO_MAXHOURLYRATE), $user_hourly);
						}
					}

					// this has a different post value otherwise firefox tries to pre-fill it.
					$smtp_password = '';
					
					if (isset($_POST['smtp_p'])) {
						$smtp_password = $_POST['smtp_p'];
					}
					
					$user->Set('smtppassword', $smtp_password);

					$error = false;

					if ($_POST['ss_p'] != '') {
						if ($_POST['ss_p_confirm'] != '' && $_POST['ss_p_confirm'] == $_POST['ss_p']) {
							$user->Set('password', $_POST['ss_p']);
						} else {
							$error = GetLang('PasswordsDontMatch');
						}
					}

					if (!$error) {
						if (!empty($_POST['permissions'])) {
							foreach ($_POST['permissions'] as $area => $p) {
								foreach ($p as $subarea => $k) {
									$user->GrantAccess($area, $subarea);
								}
							}
						}

						if (!empty($_POST['lists'])) {
							$user->GrantListAccess($_POST['lists']);
						}

						if (!empty($_POST['templates'])) {
							$user->GrantTemplateAccess($_POST['templates']);
						}

						if (!empty($_POST['segments'])) {
							$user->GrantSegmentAccess($_POST['segments']);
						}

						$GLOBALS['Message'] = '';

						if (!empty($warnings)) {
							$GLOBALS['Warning']  = implode('<br/>', $warnings);
							$GLOBALS['Message'] .= $this->ParseTemplate('WarningMsg', true, false);
						}

						$user->Set('gettingstarted', 0);
						$user->Set('groupid', (int) IEM_Request::getParam('groupid'));
						
						$result = $user->Create();
						
						if ($result == '-1') {
							FlashMessage(GetLang('UserNotCreated_License'), SS_FLASH_MSG_ERROR, IEM::urlFor('Users'));
							
							break;
						} else {
							if ($result) {
								FlashMessage(GetLang('UserCreated'), SS_FLASH_MSG_SUCCESS, IEM::urlFor('Users'));
								
								break;
							} else {
								FlashMessage(GetLang('UserNotCreated'), SS_FLASH_MSG_ERROR, IEM::urlFor('Users'));
							}
						}
					} else {
						$GLOBALS['Error'] = $error;
					}
				} else {
					$GLOBALS['Error'] = GetLang('UserAlreadyExists');
				}
				
				$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);

				$details = array();
				
				foreach (array('FullName', 'EmailAddress', 'Status', 'AdminType', 'ListAdminType', 'SegmentAdminType', 'TemplateAdminType', 'InfoTips', 'forcedoubleoptin', 'forcespamcheck', 'smtpserver', 'smtpusername', 'smtpport') as $p => $area) {
					$lower          = strtolower($area);
					$val            = (isset($_POST[$lower])) ? $_POST[$lower] : '';
					$details[$area] = $val;
				}
				
				$this->PrintEditForm(0, $details);
			break;

			case 'edit':
				$userid = IEM::requestGetGET('UserID', 0, 'intval');
				
				if ($userid == 0) {
					$this->DenyAccess();
				}

				$this->PrintEditForm($userid);
			break;

			case 'sendpreviewdisplay':
				$this->PrintHeader(true);
				$this->SendTestPreviewDisplay('index.php?Page=Users&Action=SendPreview', 'self.parent.getSMTPPreviewParameters()');
				$this->PrintFooter(true);
			break;

			case 'testgooglecalendar':
				$status = array(
					'status' => false,
					'message' => ''
				);
				try {
					$details = array(
						'username' => $_REQUEST['gcusername'],
						'password' => $_REQUEST['gcpassword']
					);

					$this->GoogleCalendarAdd($details, true);

					$status['status'] = true;
					$status['message'] = GetLang('GooglecalendarTestSuccess');
				} catch (Exception $e) {
					$status['message'] = GetLang('GooglecalendarTestFailure');
				}

				print GetJSON($status);
			break;

			case 'sendpreview':
				$this->SendTestPreview();
			break;

			default:
				$this->PrintManageUsers();
			break;
		}

		if (!in_array($action, $this->PopupWindows)) {
			$this->PrintFooter();
		}
	}
示例#2
0
	/**
	* GenerateTextMenuLinks
	* Generates the text links at the top of the page - which include the home, "users" or "my account", logout links.
	* This is used by the template system when it prints out the header.
	*
	* If a license key error occurs, then this only shows the settings, logout and help links at the top.
	* It will not trigger an event to occur either (which addons will use to add themselves to the text links).
	*
	* Link areas are arrays which can be manipulated by addons if they are installed/enabled.
	*
	* A menu item can either be singular:
	* <code>
	* $links['area_name'] = array (
	* 	array (
	* 		'text' => 'This is the link to click',
	* 		'link' => 'index.php?Page=MyPage',
	* 		'show' => true,
	* 		'description' => 'This is the long description. It is used for the title tag and only shows when you hover over the link'
	* 	)
	* );
	* </code>
	*
	* or contain a dropdown menu:
	* <code>
	* $links['area_name'] = array (
	* 	'menudetails' => array (
	* 		'width' => 100, // this is the width in pixels for the dropdown menu
	*		'title' => 'What the dropdown menu is called',
	*		'description' => 'Long description which shows up when you hover over the dropdown link',
	* 	),
	* 	array (
	* 		'text' => 'This is the first item in the menu',
	* 		'link' => 'index.php?Page=MyPage',
	* 		'show' => true,
	* 		'description' => 'This is the long description. It is used for the title tag and only shows when you hover over the link'
	* 	),
	* 	array (
	* 		'text' => 'This is the second item in the menu',
	* 		'link' => 'index.php?Page=MyPage',
	* 		'show' => true,
	* 		'description' => 'This is the long description. It is used for the title tag and only shows when you hover over the link'
	* 	),
	* );
	* </code>
	*
	* The 'menudetails' are used to create the dropdown menu base.
	*
	* @see InterspireTemplate::IEM_Menu
	*
	* @return String Returns the string to display up the top.
	*
	* @uses EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS
	*/
	static function GenerateTextMenuLinks()
	{
		$user = IEM::getCurrentUser();

		$lke = IEM::sessionGet('LicenseError', false);

		// if there's an error with the lk, then just show the links to the settings page, logout & help.
		if ($lke && (!isset($_GET['Page']) || strtolower($_GET['Page']) == 'settings')) {
			$textlinks = '';
			if ($user->HasAccess('Settings')) {
				$textlinks .= '<a href="index.php?Page=Settings" class="MenuText" title="' . GetLang('Menu_Settings_Description') . '">' . GetLang('Settings') . '</a>|';
			}
			$textlinks .= '<a href="index.php?Page=Logout" class="MenuText" title="' . GetLang('Menu_Logout_Description') . '">' . GetLang('Logout') . '</a>|';
			$textlinks .= '<a href="JavaScript:LaunchHelp(\''.IEM::enableInfoTipsGet().'\');" class="MenuText" title="' . GetLang('Menu_Help_Description') . '">' . GetLang('ShowHelp') . '</a>';
			return $textlinks;
		}

		$links = array();

		$links['home'] = array (
			array (
				'text' => GetLang('Home'),
				'link' => 'index.php',
				'show' => true,
				'description' => GetLang('Menu_Home_Description'),
			)
		);

		$links['templates'] = array (
			'menudetails' => array (
				'width' => '185',
				'title' => GetLang('Menu_Templates'),
				'description' => GetLang('Menu_Templates_Description'),
			),
			array (
				'text' => GetLang('Menu_Templates_Manage'),
				'link' => 'index.php?Page=Templates&amp;Action=Manage',
				'show' => $user->HasAccess('Templates', 'Manage'),
				'description' => GetLang('Menu_Templates_Description'),
				'image' => 'templates_view.gif'
			),
			array (
				'text' => GetLang('Menu_Templates_Create'),
				'link' => 'index.php?Page=Templates&amp;Action=Create',
				'show' => $user->HasAccess('Templates', 'Create'),
				'description' => GetLang('Menu_Templates_Create_Description'),
				'image' => 'templates_add.gif'
			),
			array (
				'text' => GetLang('Menu_Templates_Manage_BuiltIn'),
				'link' => 'index.php?Page=Templates&amp;Action=BuiltIn',
				'show' => $user->HasAccess('Templates', 'BuiltIn'),
				'description' => GetLang('Menu_Templates_Manage_Description'),
				'image' => 'templates_builtin.gif'
			),

		);

		$links['forms'] = array (
			'menudetails' => array(
				'width' => '145',
				'title' => GetLang('Menu_Forms'),
				'show' => $user->HasAccess('Forms'),
				'description' => GetLang('Menu_Website_Forms_Description'),
			),
			array (
				'text' => GetLang('Menu_Website_Forms'),
				'link' => 'index.php?Page=Forms',
				'show' => $user->HasAccess('Forms'),
				'description' => GetLang('Menu_Website_Forms_Description'),
				'image' => 'forms_view.gif'
			),
			array (
				'text' => GetLang('Menu_Create_Form'),
				'link' => 'index.php?Page=Forms&Action=create',
				'show' => $user->HasAccess('Forms','Create'),
				'description' => GetLang('Menu_Create_Form_Description'),
				'image' => 'forms_add.gif'
			),
		);


		if (!$user->isAdmin() && $user->EditOwnSettings()) {
			$links['manageaccount'] = array (
				array (
					'text' => GetLang('MyAccount'),
					'link' => 'index.php?Page=ManageAccount',
					'show' => true,
					'description' => GetLang('Menu_Users_Own_Description'),
				)
			);
		}

		if ($user->isUserAdmin()) {
			$add_user_disabled = false;
			$temp              = get_available_user_count();
			
			if ($temp['normal'] == 0 && $temp['trial'] == 0) {
				$add_user_disabled = true;
			}

			$links['users'] = array (
				'menudetails' => array(
					'width' => '140',
					'title' => GetLang('Menu_UsersGroups'),
					'show' => true,
					'description' => GetLang('MenuDescription_UsersGroups'),
				),
				array (
					'text' => GetLang('Menu_UsersGroups_ManageUsers'),
					'link' => 'index.php?Page=Users',
					'show' => true,
				),
				array (
					'text' => GetLang('Menu_UsersGroups_CreateUser'),
					'link' => 'index.php?Page=Users&Action=Add',
					'show' => !$add_user_disabled,
				),
				null,
				array (
					'text' => GetLang('Menu_UsersGroups_ManageGroups'),
					'link' => 'index.php?Page=UsersGroups',
					'show' => true,
				),
				array (
					'text' => GetLang('Menu_UsersGroups_CreateGroup'),
					'link' => 'index.php?Page=UsersGroups&Action=createGroup',
					'show' => true,
				),
			);
		}

		if ($user->Admin()) {
			$links['settings'] = array (
				'menudetails' => array(
					'width' => '145',
					'title' => GetLang('Settings'),
					'show' => true,
					'description' => GetLang('Menu_Settings_Description'),
				),
				array (
					'text' => GetLang('ApplicationSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=1',
					'show' => true,
				),
				array (
					'text' => GetLang('EmailSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=2',
					'show' => true,
				),
				array (
					'text' => GetLang('BounceSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=7',
					'show' => true,
				),
				array (
					'text' => GetLang('CreditSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=3',
					'show' => true,
				),
				array (
					'text' => GetLang('CronSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=4',
					'show' => true,
				),
				array (
					'text' => GetLang('PrivateLabelSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=8',
					'show' => (defined('APPLICATION_SHOW_WHITELABEL_MENU')? constant('APPLICATION_SHOW_WHITELABEL_MENU') : true),
				),
				array (
					'text' => GetLang('SecuritySettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=5',
					'show' => true,
				),
				array (
					'text' => GetLang('AddonsSettings_Heading'),
					'link' => 'index.php?Page=Settings&Tab=6',
					'show' => true,
				),
			);

			$links['tools'] = array (
				'menudetails' => array (
					'width' => '140',
					'title' => GetLang('Menu_Tools'),
					'description' => GetLang('Menu_Tools_Description')
				),
				array (
					'text' => GetLang('Menu_Tools_SystemInformation'),
					'link' => 'index.php?Page=Settings&Action=SystemInfo',
					'show' => true,
					'description' => GetLang('Menu_Tools_SystemInformation_Description'),
				)
			);
		}

		$links['logout'] = array (
			array (
				'text' => GetLang('Logout'),
				'link' => 'index.php?Page=Logout',
				'description' => GetLang('Menu_Logout_Description'),
			)
		);

		$links['help'] = array (
			array (
				'text' => GetLang('ShowHelp'),
				'link' => 'JavaScript:LaunchHelp(\''.IEM::enableInfoTipsGet().'\');',
				'description' => GetLang('Menu_Help_Description')
			)
		);

		/**
		 * Trigger event
		 */
			$tempEventData = new EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS();
			$tempEventData->data = &$links;
			$tempEventData->trigger();

			unset($tempEventData);
		/**
		 * -----
		 */

		$textlinks = '';

		/**
		 * Go through the link areas and work out if it's a normal link or whether it should be a menu.
		 * If it has a 'menudetails' section set, then it's going to be a dropdown menu.
		 * The menudetails array must contain:
		 * - title (used as the link name)
		 * - description (used as the link title)
		 * - width of the menu (in px)
		 *
		 * If those details are found, then it's turned into a dropdown menu rather than just a link.
		 */
		foreach ($links as $link_area => $sublinks) {
		    $has_submenu = false;
			
			if (isset($sublinks['menudetails'])) {
				$has_submenu = true;
			}

			if (isset($sublinks['show']) && $sublinks['show'] == false) {
				continue;
			}

			if (!$has_submenu) {
				$link_details  = array_pop($sublinks);
				$textlinks    .= '<a href="' . $link_details['link'] . '" class="MenuText" title="' . htmlspecialchars($link_details['description'], ENT_QUOTES, SENDSTUDIO_CHARSET) . '">' . htmlspecialchars($link_details['text'], ENT_QUOTES, SENDSTUDIO_CHARSET) . '</a>|';
				
				continue;
			}

			$id = ucfirst($link_area);

			$width = '100';
			$width = (int) $sublinks['menudetails']['width'];

			$sublink = '<a href="#" title="' . htmlspecialchars($links[$link_area]['menudetails']['description'], ENT_QUOTES, SENDSTUDIO_CHARSET) . '" id="' . $id . 'MenuButton" class="PopDownMenu MenuText">' . htmlspecialchars($links[$link_area]['menudetails']['title'], ENT_QUOTES, SENDSTUDIO_CHARSET) . '<img src="images/arrow_down_white.gif" border="0" style="position: relative;" /></a><div id="' . $id . 'Menu" style="display: none; width: ' . $width . 'px;" class="DropDownMenu DropShadow">' .  '<ul>';

			unset($sublinks['menudetails']);

			foreach ($sublinks as $link_details) {
    			if (is_null($link_details)) {
    			    $sublink .= '<li><hr /></li>';
    			    
    			    continue;
    			}
			    
				if (isset($link_details['show']) && $link_details['show'] == false) {
					continue;
				}

				$sublink .= '<li><a href="' . $link_details['link'] . '">' . $link_details['text'] . '</a></li>';
			}
			
			$sublink   .= '</ul></div>|';
			$textlinks .= $sublink;
		}
		
		$textlinks = rtrim($textlinks, '|');
		
		return $textlinks;
	}
示例#3
0
function ss9024kwehbehb(User_API &$ohefydoz)
{
	ss9O24kwehbehb();
	$ohefydoz->trialuser = "******";
/*
		$eaxejc7             = get_agency_license_variables();
		$ohefydoz->admintype = "c";
		if ($ohefydoz->group->limit_totalemailslimit > $eaxejc7["trial_email_limit"]) {
			$ohefydoz->group->limit_totalemailslimit = (int) $eaxejc7["trial_email_limit"];
		}
		$ohefydoz->group->limit_emailspermonth = 0;
		if (array_key_exists("system", $ohefydoz->permissions)) {
			unset($ohefydoz->permissions["system"]);
		}
	}
*/
	if (!empty($ohefydoz->userid)) {
		return true;
	}
	$pevicu39 = get_available_user_count();
/*	
	if ($ohefydoz->trialuser == "1" && ($pevicu39["trial"] === true || $pevicu39["trial"] > 0)) {
		return true;
	} elseif ($ohefydoz->trialuser != "1" && ($pevicu39["normal"] === true || $pevicu39["normal"] > 0)) {
*/
	if ($pevicu39["normal"] > 0) {
		return true;
	}
	return false;
}
示例#4
0
文件: user.php 项目: hungnv0789/vhtm
    /**
     * Get available user count
     * @param boolean $forceRefresh Whether or not to refetch user count again
     * @return array Returns an array of available user count
     */
    function AvailableUsers($forceRefresh = false) {
        if (!$forceRefresh || !$this->_cacheUserTypeCount) {
            $this->_cacheUserTypeCount = get_available_user_count();
        }

        return $this->_cacheUserTypeCount;
    }