本文整理汇总了PHP中IEM::requestGetPOST方法的典型用法代码示例。如果您正苦于以下问题:PHP IEM::requestGetPOST方法的具体用法?PHP IEM::requestGetPOST怎么用?PHP IEM::requestGetPOST使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEM
的用法示例。
在下文中一共展示了IEM::requestGetPOST方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page_disguise
/**
* Disguise action
*
* Administrator is able to disguise (and login) as other users.
* This method will facilitate this functionalities.
*
* TODO better PHPDOC
*/
public function page_disguise()
{
// newUserID variable need to be passed in as a POST variable
$reqUserID = IEM::requestGetPOST('newUserID', 0, 'intval');
if (empty($reqUserID)) {
IEM::redirectTo('index');
return false;
}
// Attempt to login user with different ID
if (!IEM::userLogin($reqUserID, false)) {
IEM::redirectTo('index');
return false;
}
IEM::redirectTo('index');
return true;
}
示例2: PrintEditForm
//.........这里部分代码省略.........
$GLOBALS['SmtpPort'] = $user->Get('smtpport');
// Log this to "User Activity Log"
IEM::logUserActivity(IEM::urlFor('users', array('Action' => 'Edit', 'UserID' => $userid)), 'images/user.gif', $user->username);
} else {
$timezone = (isset($details['timezone'])) ? $details['timezone'] : SENDSTUDIO_SERVERTIMEZONE;
$GLOBALS['TimeZoneList'] = $this->TimeZoneList($timezone);
$activity = $thisuser->defaultEventActivityType;
if (!is_array($activity)) {
$activity = array();
}
$GLOBALS['EventActivityType'] = implode("\n", $activity);
$GLOBALS['FormAction'] = 'Action=Create';
if (!empty($details)) {
foreach ($details as $area => $val) {
$GLOBALS[$area] = $val;
}
}
$GLOBALS['Heading'] = GetLang('CreateUser');
$GLOBALS['Help_Heading'] = GetLang('Help_CreateUser');
$listadmintype = 'c';
$segmentadmintype = 'c';
$admintype = 'c';
$templateadmintype = 'c';
$GLOBALS['DisplayMaxLists'] = 'none';
$GLOBALS['DisplayEmailsPerHour'] = 'none';
$GLOBALS['DisplayEmailsPerMonth'] = 'none';
$GLOBALS['DisplayEmailsMaxEmails'] = 'none';
$GLOBALS['MaxLists'] = '0';
$GLOBALS['PerHour'] = '0';
$GLOBALS['PerMonth'] = '0';
$GLOBALS['MaxEmails'] = '0';
$GLOBALS['StatusChecked'] = ' CHECKED';
$GLOBALS['ForceDoubleOptInChecked'] = '';
$GLOBALS['ForceSpamCheckChecked'] = '';
$GLOBALS['InfoTipsChecked'] = ' CHECKED';
$GLOBALS['EditOwnSettingsChecked'] = ' CHECKED';
$GLOBALS['LimitListsChecked'] = ' CHECKED';
$GLOBALS['LimitPerHourChecked'] = ' CHECKED';
$GLOBALS['LimitPerMonthChecked'] = ' CHECKED';
$GLOBALS['LimitMaximumEmailsChecked'] = ' CHECKED';
$GLOBALS['UseWysiwyg'] = ' CHECKED';
$GLOBALS['EnableLastViewed'] = '';
$GLOBALS['UseXHTMLCheckbox'] = ' CHECKED';
$GLOBALS['HTMLFooter'] = GetLang('Default_Global_HTML_Footer');
$GLOBALS['TextFooter'] = GetLang('Default_Global_Text_Footer');
$GLOBALS['EnableActivityLog'] = ' CHECKED';
$GLOBALS['Xmlapi'] = '';
$GLOBALS['XMLTokenDisplay'] = ' style="display:none;"';
$admin = $listadmin = $segmentadmin = $templateadmin = false;
$permissions = array();
$area_access = array('lists' => array(), 'templates' => array(), 'segments' => array());
$GLOBALS['AdminNotifyEmailAddress'] = constant('SENDSTUDIO_EMAIL_ADDRESS');
$GLOBALS['UseNotifySend'] = "style=display:none;";
$GLOBALS['UseNotifyImport'] = "style=display:none;";
$GLOBALS['SendLimit'] = 1000;
$GLOBALS['ImportLimit'] = 1000;
$GLOBALS['AdminNotifications_Send_Email'] = GetLang('AdminNotifications_Send_Email');
$GLOBALS['AdminNotifications_Import_Email'] = GetLang('AdminNotifications_Import_Email');
}
$agencyid = defined('IEM_SYSTEM_LICENSE_AGENCY') ? IEM_SYSTEM_LICENSE_AGENCY : '';
$available_users = $user->AvailableUsers();
$template = GetTemplateSystem();
$template->Assign('UserID', $user->userid);
$template->Assign('groupid', $user->groupid);
$template->Assign('canChangeUserGroup', !$user->isLastAdmin());
$template->Assign('AgencyEdition', get_agency_license_variables());
$template->Assign('EditOwn', ($user->userid != 0 && $user->userid == $thisuser->userid));
$template->Assign('TrialUser', $user->trialuser);
$template->Assign('EditMode', !empty($user->userid));
$template->Assign('AvailableNormalUsers', isset($available_users['normal']) ? $available_users['normal'] : 0);
$template->Assign('AvailableTrialUsers', isset($available_users['trial']) ? $available_users['trial'] : 0);
$template->Assign('AvailableGroups', $all_groups);
$template->Assign('record_groupid', $user->groupid);
$template->Assign('DefaultIdTab', IEM::requestGetPOST('id_tab_num', 1, 'intval'));
$template->Assign('showSmtpInfo', (bool) $user->smtpserver);
$template->ParseTemplate('User_Form');
}
示例3: Process
//.........这里部分代码省略.........
case 'step3':
if (empty($_POST)) {
$this->ImportSubscribers_Step2(GetLang('FileNotUploadedSuccessfully_TooBig'));
break;
}
$importinfo = IEM::sessionGet('ImportInfo');
$importinfo['Status'] = $_POST['status'];
$importinfo['Confirmed'] = $_POST['confirmed'];
$importinfo['Format'] = $_POST['format'];
$importinfo['Type'] = $_POST['importtype'];
$importinfo['Overwrite'] = (isset($_POST['overwrite'])) ? 1 : 0;
$importinfo['Autoresponder'] = (isset($_POST['autoresponder'])) ? 1 : 0;
$importinfo['Headers'] = (isset($_POST['headers'])) ? 1 : 0;
$importinfo['FieldEnclosed'] = (isset($_POST['fieldenclosed'])) ? $_POST['fieldenclosed'] : false;
$importinfo['FieldSeparator'] = $_POST['fieldseparator'];
IEM::sessionSet('ImportInfo', $importinfo);
$upload_status = false;
switch (strtolower($importinfo['Type'])) {
case 'file':
$upload_status = $this->HandleImportFile();
break;
}
if ($upload_status) {
$this->LinkFields();
}
break;
case 'step4':
$linkfields = IEM::requestGetPOST('LinkField', array());
if (!in_array('E', $linkfields)) {
$GLOBALS['Error'] = GetLang('EmailAddressNotLinked');
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->LinkFields();
break;
}
$importinfo = IEM::sessionGet('ImportInfo');
$requiredFieldNames = array();
if (isset($importinfo['RequiredFields']) && is_array($importinfo['RequiredFields'])) {
foreach ($importinfo['RequiredFields'] as $requiredFieldID => $requiredFieldName) {
if (!in_array($requiredFieldID, $linkfields)) {
$requiredFieldNames[] = $requiredFieldName;
break;
}
}
}
if (!empty($requiredFieldNames)) {
$GLOBALS['Error'] = sprintf(GetLang('RequireFieldNotLinked'), htmlspecialchars(implode(', ', $requiredFieldNames), ENT_QUOTES, SENDSTUDIO_CHARSET) );
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->LinkFields();
break;
}
$importinfo['LinkFields'] = $linkfields;
IEM::sessionSet('ImportInfo', $importinfo);
$GLOBALS['ImportTotalSubscribers'] = $importinfo['TotalSubscribers'];
$GLOBALS['ImportTotalSubscribersMessage'] = $this->PrintStatusReport(true);
示例4: Admin_Action_SaveResponse
/**
* saveResponseAction
* Save the actual save response action
*
* @return void
*
*/
public function Admin_Action_SaveResponse()
{
$surveyId = (int) IEM::requestGetPOST('formId');
// check permission here
$this->_checkSurveyAccess($surveyId);
$responseId = IEM::requestGetPOST('responseId');
$responseNumber = IEM::requestGetPOST('responseNumber');
$postWidgets = IEM::requestGetPOST('widget');
$errors = 0;
if ($postWidgets || $_FILES) {
// If there are files, take the values and place them in the $postWidgets array so they can
// get validated and entered into the response values in the same manner. Uploads will be
// handled separately.
if (isset($_FILES['widget'])) {
foreach ($_FILES['widget']['name'] as $widgetId => $widget) {
foreach ($widget as $fields) {
foreach ($fields as $fieldId => $field) {
if ($field['value']) {
$postWidgets[$widgetId]['field'][$fieldId]['value'] = 'file_' . $field['value'];
}
}
}
}
}
$survey_api = $this->getApi();
$survey_api->Load($surveyId);
$widgets = $survey_api->getWidgets();
$widgetErrors = array();
foreach ($widgets as $widget) {
if (!isset($widgetErrors[$widget['id']])) {
$widgetErrors[$widget['id']] = array();
}
// validate required fields
if ($widget['is_required']) {
// the widget is assumed blank until one of it's fields is found not blank
$isBlank = true;
$isOther = false;
// make sure the required widget was even posted
if (isset($postWidgets[$widget['id']])) {
foreach ($postWidgets[$widget['id']]['field'] as $field) {
if (isset($field['value'])) {
// get the value of an "other" field if it is one, otherwise just grab
// the normal value
if ($field['value'] == '__other__') {
$isOther = true;
$value = $field['other'];
} else {
$value = $field['value'];
}
// make sure the value isn't blank
if (!$this->_validateIsBlank($value)) {
$isBlank = false;
}
}
}
}
// if the widget is blank, flag an error
if ($isBlank) {
if ($isOther) {
$error = GetLang('Addon_Surveys_ErrorRequiredOther');
} else {
$error = GetLang('Addon_Surveys_ErrorRequired');
}
$widgetErrors[$widget['id']][] = $error;
$errors++;
}
}
// validate file types
if (isset($postWidgets[$widget['id']]) && $widget['allowed_file_types']) {
$typeArr = preg_split('/\\s*,\\s*/', strtolower($widget['allowed_file_types']));
$invalidType = false;
// foreach of the passed fields (most likely 1) check and see if they are valid file types
foreach ($postWidgets[$widget->id]['field'] as $field) {
$parts = explode('.', $field['value']);
$ext = strtolower(end($parts));
// only if the field has a value we will test its file type
if (trim($field['value']) != '' && !in_array($ext, $typeArr)) {
$invalidType = true;
}
}
// if the a file is not a valid file type, then the whole widget fails validation
if ($invalidType) {
$lastFileType = '<em>.' . array_pop($typeArr) . '</em>';
$firstFileTypes = '<em>.' . implode('</em>, <em>.', $typeArr) . '</em>';
$widgetErrors[$widget->id][] = sprintf(GetLang('errorInvalidFileType'), $firstFileTypes, $lastFileType);
$errors++;
}
}
}
// if there were errors, redirect back and display the errors
if ($errors) {
echo '<pre style="border: 1px solid red";><b style="color:RED;">YUDI_DEBUG:' . __FILE__ . ' ON LINE: ' . __LINE__ . '</b><br />';
print_r($widgetErrors);
//.........这里部分代码省略.........
示例5: Process
/**
* Process
* Works out what you're trying to do and takes appropriate action. Validates data where needed.
*
* @param String $action Action to perform. This is usually 'step1', 'step2', 'step3' etc. This gets passed in by the Subscribers::Process function.
*
* @see Subscribers::Process
* @see GetApi
* @see Subscribers_API::IsSubscriberOnList
* @see Subscribers_API::AddToList
* @see Subscribers_API::SaveSubscriberCustomField
* @see Lists_API::GetCustomFields
* @see CustomFields_API::IsRequired
* @see CustomFields_API::ValidData
* @see CustomFields_API::GetFieldName
* @see AddSubscriber_Step2
*
* @return Void Prints out the step, doesn't return anything.
*/
function Process($action=null)
{
switch (strtolower($action)) {
case 'step2':
$listid = (isset($_POST['list'])) ? (int)$_POST['list'] : $_GET['list'];
$this->AddSubscriber_Step2($listid);
break;
case 'saveadd':
case 'save':
$user = GetUser();
$listid = (isset($_GET['list'])) ? (int)$_GET['list'] : 0;
if (!$user->HasAccess('Subscribers', 'Add')) {
$this->DenyAccess();
return;
}
$user_lists = $user->GetLists();
/**
* Check if user have access to the list
*/
if (!array($user_lists) || empty($user_lists)) {
$this->DenyAccess();
return;
}
$temp = array_keys($user_lists);
if (!in_array($listid, $temp)) {
$this->DenyAccess();
return;
}
/**
* -----
*/
$subscriber = $this->GetApi('Subscribers');
$email = IEM::requestGetPOST('emailaddress', '', 'trim');
if (empty($email) || !$subscriber->ValidEmail($email)) {
$GLOBALS['Error'] = sprintf(GetLang('SubscriberAddFail_InvalidEmailAddress'), htmlspecialchars($email));
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->AddSubscriber_Step2($listid);
break;
}
$duplicate = $subscriber->IsSubscriberOnList($_POST['emailaddress'], $listid);
if ($duplicate) {
$unsubscribed_check = $subscriber->IsUnSubscriber(false, $listid, $duplicate);
if ($unsubscribed_check) {
$GLOBALS['Error'] = sprintf(GetLang('SubscriberAddFail_Unsubscribed'), $_POST['emailaddress']);
} else {
$GLOBALS['Error'] = sprintf(GetLang('SubscriberAddFail_Duplicate'), $_POST['emailaddress']);
}
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->AddSubscriber_Step2($listid);
break;
}
list($banned, $msg) = $subscriber->IsBannedSubscriber($_POST['emailaddress'], $listid, false);
if ($banned) {
$GLOBALS['Error'] = sprintf(GetLang('SubscriberAddFail_Banned'), $_POST['emailaddress']);
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->AddSubscriber_Step2($listid);
break;
}
$ListApi = $this->GetApi('Lists');
$ListApi->Load($listid);
$ListCustomFields = $ListApi->GetCustomFields($listid);
$customfield_errors = array();
foreach (array('emailaddress', 'format', 'confirmed') as $p => $area) {
$subscriber->Set($area, $_POST[$area]);
}
$CustomFieldsValid = true;
//.........这里部分代码省略.........
示例6: Process
//.........这里部分代码省略.........
break;
case 'testbouncesettings':
$this->TestBounceSettings();
break;
case 'save':
if (empty($_POST)) {
$this->ShowSettingsPage();
break;
}
$api = $this->GetApi();
$result = false;
$errors = array();
// Make sure that Contact email is filled in
if (!isset($_POST['email_address']) || trim($_POST['email_address']) == '') {
array_push($errors, GetLang('ErrorAlertMessage_BlankContactEmail'));
}
// Make sure that license key is filled in
if (!isset($_POST['licensekey']) || trim($_POST['licensekey']) == '') {
array_push($errors, GetLang('ErrorAlertMessage_BlankLicenseKey'));
}
// Make sure that application name is filled in
if (!isset($_POST['lng_applicationtitle']) || trim($_POST['lng_applicationtitle']) == '') {
array_push($errors, GetLang('ErrorAlertMessage_BlankApplicationName'));
}
$agencyId = get_agency_license_variables();
if(!empty($agencyId['agencyid'])) {
$temp = IEM::requestGetPOST('lng_accountupgrademessage', '', 'trim');
if (empty($temp)) {
array_push($errors, GetLang('ErrorAlertMessage_BlankAccountUpgradeMessage'));
}
$temp = IEM::requestGetPOST('lng_freetrial_expiry_login', '', 'trim');
if (empty($temp)) {
array_push($errors, GetLang('ErrorAlertMessage_BlankExpiredLogin'));
}
}
if ($api && count($errors) == 0) {
do {
$settings = array();
// fix up the database settings first.
$all_areas = $api->Areas;
$LK = (isset($_POST['licensekey'])) ? $_POST['licensekey'] : false;
if (defined('APPLICATION_SHOW_WHITELABEL_MENU') && constant('APPLICATION_SHOW_WHITELABEL_MENU')) {
foreach ($all_areas['whitelabel'] as $area) {
$val = IEM::requestGetPOST(strtolower($area), false);
$temp = strtolower($area);
switch ($temp) {
// Special case for handling logo image
case 'application_logo_image':
$val = IEM::requestGetPOST('existing_app_logo_image', false);
if (isset($_FILES['Application_Logo_Image']) && !empty($_FILES['Application_Logo_Image']['name'])) {
if ($_FILES['Application_Logo_Image']['error'] != 0 || !@is_uploaded_file($_FILES['Application_Logo_Image']['tmp_name'])) {
array_push($errors, GetLang('ErrorAlertMessage_ErrorApplicationLogoImage'));
示例7: Process
/**
* Process
* Lets a user manage their own account - to a certain extent.
* The API itself manages saving and updating, this just works out displaying of forms etc.
*
* @see PrintHeader
* @see ParseTemplate
* @see IEM::getDatabase()
* @see GetUser
* @see User_API::Set
* @see GetLang
* @see PrintEditForm
* @see PrintFooter
*
* @return Void Doesn't return anything, hands the processing off to the appropriate subarea and lets it do the work.
*/
function Process()
{
$action = (isset($_GET['Action'])) ? strtolower($_GET['Action']) : '';
if (!in_array($action, $this->PopupWindows)) {
$this->PrintHeader();
}
$user = IEM::getCurrentUser();
$db = IEM::getDatabase();
switch ($action) {
case 'save':
if (!$user->EditOwnSettings()) {
$this->DenyAccess();
}
$smtptype = 0;
if ($user->HasAccess('User', 'SMTP')) {
$smtptype = (isset($_POST['smtptype'])) ? $_POST['smtptype'] : 0;
}
// Make sure smtptype is eiter 0 or 1
if ($smtptype != 1) {
$smtptype = 0;
}
// ----- 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);
// -----
/**
* 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(
'fullname' => 'fullname',
'emailaddress' => 'emailaddress',
'usertimezone' => 'usertimezone',
'textfooter' => 'textfooter',
'htmlfooter' => 'htmlfooter',
'infotips' => 'infotips',
'usewysiwyg' => 'usewysiwyg',
'enableactivitylog' => 'enableactivitylog',
'usexhtml' => 'usexhtml',
'googlecalendarusername' => 'googlecalendarusername',
'googlecalendarpassword' => 'googlecalendarpassword'
);
if ($user->HasAccess('User', 'SMTP')) {
$areaMapping['smtp_server'] = 'smtpserver';
$areaMapping['smtp_u'] = 'smtpusername';
$areaMapping['smtp_p'] = 'smtppassword';
$areaMapping['smtp_port'] = 'smtpport';
}
foreach ($areaMapping as $p => $area) {
$val = (isset($_POST[$p])) ? $_POST[$p] : '';
$user->Set($area, $val);
}
/**
* -----
*/
if ($user->HasAccess('User', 'SMTP')) {
if ($smtptype == 0) {
$user->Set('smtpserver', '');
$user->Set('smtpusername', '');
$user->Set('smtppassword', '');
$user->Set('smtpport', 0);
}
}
//.........这里部分代码省略.........
示例8: page_saveRecord
public function page_saveRecord()
{
$record = IEM::requestGetPOST('record', array());
$record['groupname'] = htmlspecialchars($record['groupname']);
$created = ((IEM::ifsetor($record['groupid'], 0, 'intval') == 0) ? true : false);
/*
* Transform the permission so that it will be recognized by the API
*/
$permissions = IEM::ifsetor($record['permissions'], array());
$new_permissions = array();
if (!is_array($permissions)) {
$permissions = array();
}
if (!empty($permissions)) {
foreach ($permissions as $each) {
$temp = explode('.', $each);
// This can only handle 2 level permissions,
// ie. autoresponders.create, autoresponders.delete, autoresponders.edit
// will become $permissions['autoresponders'] = array('create', 'delete', 'edit');
if (count($temp) != 2) {
continue;
}
if (!isset($new_permissions[$temp[0]])) {
$new_permissions[$temp[0]] = array();
}
$new_permissions[$temp[0]][] = $temp[1];
}
}
$record['permissions'] = $new_permissions;
if (empty($record)) {
return $this->page_createGroup($record);
}
// Check if "Request Token" matches
// This tries to prevent CSRF
$token = IEM::sessionGet('UsersGroups_Editor_RequestToken', false);
if (!$token || $token != IEM::requestGetPOST('requestToken', false)) {
return $this->page_createGroup($record);
}
$status = API_USERGROUPS::saveRecord($record);
if (!$status) {
FlashMessage(GetLang('UsersGroups_From_Error_CannotSave'), SS_FLASH_MSG_ERROR);
return $this->printEditor($record);
}
$messageVariable = 'UsersGroups_From_Success_Saved';
if ($created) {
$messageVariable = 'UsersGroups_From_Success_Created';
}
FlashMessage(GetLang($messageVariable), SS_FLASH_MSG_SUCCESS, IEM::urlFor('UsersGroups'));
}
示例9: _handleSubmitAction
private function _handleSubmitAction()
{
// don't escape
$template_dir = SENDSTUDIO_BASE_DIRECTORY . '/addons/surveys/templates';
$this->_template = GetTemplateSystem($template_dir);
$this->_template->DefaultHtmlEscape = false;
$formId = (int) IEM::requestGetGET('formId');
$postWidgets = IEM::requestGetPOST('widget');
// If there are files, take the values and place them in the $postWidgets array so they can
// get validated and entered into the response values in the same manner. Uploads will be
// handled separately.
if (isset($_FILES['widget'])) {
foreach ($_FILES['widget']['name'] as $widgetId => $widget) {
foreach ($widget as $fields) {
foreach ($fields as $fieldId => $field) {
$postWidgets[$widgetId]['field'][$fieldId]['value'] = 'file_' . $field['value'];
}
}
}
}
// If the form and widgets weren't posted in the format we require then redirect back
if (!$formId) {
$this->redirectToReferer();
}
$surveyApi = $this->getApi();
$surveyApi->Load($formId);
$surveyData = $surveyApi->GetData();
$errors = 0;
$widgets = $surveyApi->getWidgets($formId);
$widgetErrors = array();
/**** START OF ERROR VALIDATION ****/
// compile a list of widget ids so we can check the posted widgets against a list of
// valid widget ids
foreach ($widgets as $widgetKey => $widget) {
if (!isset($widgetErrors[$widget['id']])) {
$widgetErrors[$widget['id']] = array();
}
// validate required fields
if ($widget['is_required']) {
// the widget is assumed blank until one of it's fields is found not blank
$isBlank = true;
$isOther = false;
// make sure the required widget was even posted
if (isset($postWidgets[$widget['id']])) {
foreach ($postWidgets[$widget['id']]['field'] as $field) {
if (isset($field['value'])) {
$values = (array) $field['value'];
foreach ($values as $value) {
// get the value of an "other" field if it is one, otherwise just grab
// the normal value
if ($value == '__other__') {
$isOther = true;
$value = $field['other'];
}
// make sure the value isn't blank
if ($this->_validateIsBlank($value) !== true) {
$isBlank = false;
}
}
}
}
}
// if the widget is blank, flag an error
if ($isBlank) {
if ($isOther) {
$error = GetLang('Addon_Surveys_ErrorRequiredOther');
} else {
$error = GetLang('Addon_Surveys_ErrorRequired');
}
$widgetErrors[$widget['id']][] = $error;
$errors++;
}
if ($widget['type'] == 'file') {
foreach ($postWidgets[$widget['id']]['field'] as $fieldid) {
if (isset($fieldid['value'])) {$uploaded_file = $fieldid['value'];break;}
}
if (empty($uploaded_file) || $uploaded_file == "file_") {
$error = GetLang('Addon_Surveys_ErrorRequired');
//.........这里部分代码省略.........
示例10: ShowLoginForm
/**
* ShowLoginForm
* This shows the login form.
* If there is a template to use in the data/templates folder it will use that as the login form.
* Otherwise it uses the default one below. If you pass in a message it will show that message above the login form.
*
* @param String $template Uses the template passed in for the message (eg success / error).
* @param String $msg Prints the message passed in above the login form (eg unsuccessful attempt).
*
* @see FetchTemplate
* @see PrintHeader
* @see PrintFooter
*
* @return Void Doesn't return anything, just prints the login form.
*/
function ShowLoginForm($template=false, $msg=false)
{
if (!IEM::getCurrentUser()) {
$this->GlobalAreas['InfoTips'] = '';
}
$this->PrintHeader(true);
$GLOBALS['Message'] = GetLang('Help_Login');
if ($template && $msg) {
switch ($template) {
case 'login_error':
$GLOBALS['Error'] = $msg;
break;
case 'login_success':
$this->GlobalAreas['Success'] = $msg;
break;
}
$GLOBALS['Message'] = $this->ParseTemplate($template,true);
}
$username = IEM::requestGetPOST('ss_username', false);
if ($username) {
$GLOBALS['ss_username'] = htmlspecialchars($username, ENT_QUOTES, SENDSTUDIO_CHARSET);
}
$GLOBALS['ss_takemeto'] = 'index.php';
$loginPreference = IEM::requestGetCookie('IEM_LoginPreference', array());
if (is_array($loginPreference) && isset($loginPreference['takemeto'])) {
$GLOBALS['ss_takemeto'] = $loginPreference['takemeto'];
}
$this->GlobalAreas['SubmitAction'] = 'Login';
$this->ParseTemplate('login');
$this->PrintFooter(true);
}
示例11: _save
/**
* _save
* Save record (edit/create)
*
* @param Array $parameters Any parameters that need to be parsed to this function (OPTIONAL)
* @return String Returns response string that can be outputted to the browser
*
* @uses SendStudio_Functions::_getPOSTRequest()
* @uses SendStudio_Functions::GetApi()
* @uses TriggerEmails_API::Save()
* @uses TriggerEmails::_getEditor()
* @uses FlashMessage()
*/
private function _save($parameters = array())
{
if (IEM::requestGetPOST('ProcessThis', 0, 'intval') != 1) {
return $this->_manage($parameters);
}
$api = $this->GetApi();
$record = IEM::requestGetPOST('record', array());
if (empty($record['triggeremailsid'])) {
if (!$parameters['user']->HasAccess('triggeremails', 'create')) {
$this->DenyAccess();
exit();
}
} else {
if (!$parameters['user']->HasAccess('triggeremails', 'edit')) {
$this->DenyAccess();
exit();
}
if (!$parameters['user']->Admin() && !$api->IsOwner($record['triggeremailsid'], $parameters['user']->userid)) {
$this->DenyAccess();
exit();
}
}
// If triggeremailsid is specified, load the record from database,
// if error is encountered, flash error message, and return to the editor page
if (!empty($record['triggeremailsid'])) {
$status = $api->Load(intval($record['triggeremailsid']));
if (!$status) {
FlashMessage(GetLang('TriggerEmails_Cannot_Load_Record'), SS_FLASH_MSG_ERROR);
return $this->_getEditor($parameters, $record);
}
}
// Check permission for parameters entered in
if (!$this->_checkUserResourcePermission($record, $parameters['user'])) {
$GLOBALS['Error'] = GetLang('TriggerEmails_Form_Save_Failed_Permission');
$parameters['message'] .= $this->ParseTemplate('errormsg', true);
unset($GLOBALS['Error']);
return $this->_getEditor($parameters, $record);
}
// Overwrite bounce email if user can't specify their own
if (!$parameters['user']->HasAccess('Lists', 'BounceSettings') && isset($record['triggeractions']) && isset($record['triggeractions']['send']) && isset($record['triggeractions']['send']['enabled']) && $record['triggeractions']['send']['enabled']) {
$record['triggeractions']['send']['bounceemail'] = SENDSTUDIO_BOUNCE_ADDRESS;
}
// Populate the API
foreach ($record as $property => $value) {
if ($property != 'triggeremailsid') {
$api->{$property} = $value;
}
}
// Set up owner ID
$api->ownerid = $parameters['user']->userid;
// Save
$triggerid = $api->Save();
if ($triggerid === false) {
$GLOBALS['Error'] = GetLang('TriggerEmails_Form_Save_Failed');
$parameters['message'] .= $this->ParseTemplate('errormsg', true);
unset($GLOBALS['Error']);
return $this->_getEditor($parameters, $record);
} else {
FlashMessage(GetLang('TriggerEmails_Form_Save_Success'), SS_FLASH_MSG_SUCCESS, 'index.php?Page=TriggerEmails');
return $this->_manage($parameters);
}
}
示例12: SendResponse
$function_params = false;
// -----
// SimpleXML extensions needs to be loaded
if (!extension_loaded('SimpleXML')) {
SendResponse(false, 'The XML-API requires the SimpleXML extension to be loaded.');
}
if (defined('IEM_SYSTEM_ACTIVE') && !IEM_SYSTEM_ACTIVE) {
SendResponse(false, 'Error: Please contact your system admin!');
}
// ----- Get XML object
$tempXMLString = IEM::requestGetPOST('xml', '', 'trim');
// They do not parse the XML string into the POST parameter, so getting it from php://input stream
if (empty($tempXMLString)) {
$tempXMLString = file_get_contents('php://input');
}
$tempXMLString = trim($tempXMLString);
// Make sure XML request is NOT empty
if (empty($tempXMLString)) {
SendResponse(false, 'No data has been given to the XML-API.');
}
/**
* we can't use a try/catch and a 'new SimpleXMLObject' here because php4 throws a parse error when it hits the 'try' line.