本文整理汇总了PHP中IEM::sessionGet方法的典型用法代码示例。如果您正苦于以下问题:PHP IEM::sessionGet方法的具体用法?PHP IEM::sessionGet怎么用?PHP IEM::sessionGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEM
的用法示例。
在下文中一共展示了IEM::sessionGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RunUpgrade
/**
* RunUpgrde
* Run current upgrade
* @return Boolean Returns TRUE if successful, FALSE otherwise
*/
function RunUpgrade()
{
$new_version = '20081215';
$errors = IEM::sessionGet('DatabaseUpgradesFailed');
if (empty($errors)) {
$query = 'UPDATE ' . SENDSTUDIO_TABLEPREFIX . 'settings SET database_version=' . $new_version;
$result = $this->Db->Query($query);
return $result;
}
return false;
}
示例2: Process
/**
* Process
* All the action happens here.
* If you are not logged in, it will print the login form.
* Submitting that form will then try to authenticate you.
* If you are successfully authenticated, you get redirected back to the main index page (quickstats etc).
* Otherwise, will show an error message and the login form again.
*
* @see ShowLoginForm
* @uses AuthenticationSystem::Authenticate()
*
* @return Void Doesn't return anything. Checks the action and passes it off to the appropriate area.
*/
function Process()
{
$action = IEM::requestGetGET('Action', '', 'strtolower');
switch ($action) {
case 'forgotpass':
$this->ShowForgotForm();
break;
case 'changepassword':
if (!IEM::sessionGet('ForgotUser')) {
$this->ShowForgotForm('login_error', GetLang('BadLogin_Link'));
break;
}
$userapi = GetUser(-1);
$loaded = $userapi->Load(IEM::sessionGet('ForgotUser'));
if (!$loaded) {
$this->ShowForgotForm('login_error', GetLang('BadLogin_Link'));
break;
}
$password = IEM::requestGetPOST('ss_password', false);
$confirm = IEM::requestGetPOST('ss_password_confirm', false);
if ($password == false || ($password != $confirm)) {
$this->ShowForgotForm_Step2($userapi->Get('username'), 'login_error', GetLang('PasswordsDontMatch'));
break;
}
$userapi->password = $password;
$userapi->Save();
$code = md5(uniqid(rand(), true));
$userapi->ResetForgotCode($code);
$this->ShowLoginForm('login_success', GetLang('PasswordUpdated'));
break;
case 'sendpass':
$user = GetUser(-1);
$username = IEM::requestGetPOST('ss_username', '');
/**
* Fix vulnerabilities with MySQL
* Documented here: http://www.suspekt.org/2008/08/18/mysql-and-sql-column-truncation-vulnerabilities/
*
* Basically MySQL is truncating values in a column
*/
$username = preg_replace('/\s+/', ' ', $username);
$username = trim($username);
/**
* -----
*/
$founduser = $user->Find($username);
if (!$founduser) {
$this->ShowForgotForm('login_error', GetLang('BadLogin_Forgot'));
break;
}
$user->Load($founduser, false);
$code = md5(uniqid(rand(), true));
$user->ResetForgotCode($code);
$link = SENDSTUDIO_APPLICATION_URL . '/admin/index.php?Page=Login&Action=ConfirmCode&user=' . $founduser . '&code=' . $code;
$message = sprintf(GetLang('ChangePasswordEmail'), $link);
$email_api = $this->GetApi('Email');
$email_api->Set('CharSet', SENDSTUDIO_CHARSET);
$email_api->Set('Multipart', false);
$email_api->AddBody('text', $message);
$email_api->Set('Subject', GetLang('ChangePasswordSubject'));
$email_api->Set('FromAddress', SENDSTUDIO_EMAIL_ADDRESS);
$email_api->Set('ReplyTo', SENDSTUDIO_EMAIL_ADDRESS);
$email_api->Set('BounceAddress', SENDSTUDIO_EMAIL_ADDRESS);
$email_api->SetSmtp(SENDSTUDIO_SMTP_SERVER, SENDSTUDIO_SMTP_USERNAME, @base64_decode(SENDSTUDIO_SMTP_PASSWORD), SENDSTUDIO_SMTP_PORT);
$user_fullname = $user->Get('fullname');
$email_api->AddRecipient($user->emailaddress, $user_fullname, 't');
//.........这里部分代码省略.........
示例3: ViewSubscriber
/**
* ViewSubscriber
* Prints the 'view subscriber' page and all appropriate options including custom fields.
*
* @param Int $listid The list the subscriber is on. This is checked to make sure the user has 'manage' access to the list before anything else.
* @param Int $subscriberid The subscriberid to view.
* @param Int $segmentid The ID of the segment that the subscriber is going to be fetched from
* @param String $msgtype The heading to show when viewing a subscriber. This can be either error or success. Used with $msg to display something.
* @param String $msg The message to display in the heading. If this is not present, no message is displayed.
*
* @see GetApi
* @see Subscribers_API::GetCustomFieldSettings
* @see Lists_API::GetCustomFields
* @see Lists_API::Load
* @see Lists_API::GetListFormat
*
* @return Void Doesn't return anything. Prints out the view form and that's it.
*/
function ViewSubscriber($listid = 0, $subscriberid = 0, $segmentid = 0, $msgtype = 'Error', $msg = false)
{
$user = GetUser();
$access = $user->HasAccess('Subscribers', 'Manage');
if (!$access) {
$this->DenyAccess();
return;
}
$this->SetupGoogleCalendar();
$search_info = IEM::sessionGet('Search_Subscribers');
$GLOBALS['list'] = $listid;
if ($msg && $msgtype) {
switch (strtolower($msgtype)) {
case 'success':
$GLOBALS['Success'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('SuccessMsg', true, false);
break;
default:
$GLOBALS['Error'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
}
}
$SubscriberApi = $this->GetApi('Subscribers');
$subscriberinfo = false;
/**
* Get Subscriber record from the database
*/
$adminAccess = false;
// If this user is an admin/list admin/list admintype == a then give permission
if ($user->Admin() || $user->ListAdminType() == 'a' || $user->ListAdmin()) {
$adminAccess = true;
}
// Get subscribers from list
if ($segmentid == 0) {
if (!$adminAccess && !$SubscriberApi->CheckPermission($user->userid, $subscriberid)) {
$this->DenyAccess();
return;
}
$subscriberinfo = $SubscriberApi->LoadSubscriberList($subscriberid, $listid);
// Get subscribers from segment
} else {
if (!$adminAccess) {
$segmentapi = $this->GetApi('Segment', true);
$segmentapi->Load($segmentid);
if ($segmentapi->ownerid != $user->userid && !$user->HasAccess('Segments', 'View', $segmentid)) {
$this->DenyAccess();
return;
}
}
$subscriberinfo = $SubscriberApi->LoadSubscriberSegment($subscriberid, $segmentid);
}
/**
* -----
*/
// hmm, the subscriber doesn't exist or can't be loaded? show an error.
if (empty($subscriberinfo)) {
$GLOBALS['ErrorMessage'] = GetLang('SubscriberDoesntExist_View');
$this->DenyAccess();
return;
}
// Log this to "User Activity Log"
$logURL = SENDSTUDIO_APPLICATION_URL . '/admin/index.php?Page=Subscribers&Action=Edit&List=' . $_GET['List'] . '&id=' . $_GET['id'];
IEM::logUserActivity($logURL, 'images/contacts_view.gif', $subscriberinfo['emailaddress']);
$list_api = $this->GetApi('Lists');
$list_api->Load($listid);
//.........这里部分代码省略.........
示例4: EditAutoresponderStep4
/**
* EditAutoresponderStep4
* Loads up step 4 of editing an autoresponder which is editing the actual content.
* If you pass in an autoresponderid, it will load it up and set the appropriate language variables.
*
* @param Int $autoresponderid AutoresponderID to edit.
*
* @return Void Prints out step 4, doesn't return anything.
*/
function EditAutoresponderStep4($autoresponderid=0)
{
$autoapi = $this->GetApi();
$autorespondercontents = array('text' => '', 'html' => '');
$this->DisplayCronWarning();
$user = GetUser();
$GLOBALS['FromPreviewEmail'] = $user->Get('emailaddress');
//$GLOBALS['DisplayAttachmentsHeading'] = 'none';
$tpl = GetTemplateSystem();
if ($autoresponderid > 0) {
$GLOBALS['SaveAction'] = 'Edit&SubAction=Save&id=' . $autoresponderid;
$GLOBALS['Heading'] = GetLang('EditAutoresponder');
$GLOBALS['Intro'] = GetLang('EditAutoresponderIntro_Step4');
$GLOBALS['Action'] = 'Edit&SubAction=Complete&id=' . $autoresponderid;
$GLOBALS['CancelButton'] = GetLang('EditAutoresponderCancelButton');
$autoapi->Load($autoresponderid);
$autorespondercontents['text'] = $autoapi->GetBody('text');
$autorespondercontents['html'] = $autoapi->GetBody('html');
$GLOBALS['Subject'] = htmlspecialchars($autoapi->subject, ENT_QUOTES, SENDSTUDIO_CHARSET);
} else {
$GLOBALS['SaveAction'] = 'Create&SubAction=Save&id=' . $autoresponderid;
$GLOBALS['Heading'] = GetLang('CreateAutoresponder');
$GLOBALS['Intro'] = GetLang('CreateAutoresponderIntro_Step4');
$GLOBALS['Action'] = 'Create&SubAction=Complete';
$GLOBALS['CancelButton'] = GetLang('CreateAutoresponderCancelButton');
}
if (SENDSTUDIO_ALLOW_ATTACHMENTS) {
$attachmentsarea = strtolower(get_class($this));
$attachments_list = $this->GetAttachments($attachmentsarea, $autoresponderid);
$GLOBALS['AttachmentsList'] = $attachments_list;
$tpl->Assign('ShowAttach', true);
} else {
$GLOBALS['DisplayAttachments'] = 'none';
$user = IEM::getCurrentUser();
if($user) {
if ($user->isAdmin()) {
$GLOBALS['AttachmentsMsg'] = GetLang('NoAttachment_Admin');
} else {
$GLOBALS['AttachmentsMsg'] = GetLang('NoAttachment_User');
}
}
$tpl->Assign('ShowAttach', false);
}
$GLOBALS['PreviewID'] = $autoresponderid;
// we don't really need to get/set the stuff here.. we could use references.
// if we do though, it segfaults! so we get and then set the contents.
$session_autoresponder = IEM::sessionGet('Autoresponders');
$GLOBALS['List'] = $session_autoresponder['list'];
if (isset($session_autoresponder['TemplateID'])) {
$templateApi = $this->GetApi('Templates');
if (is_numeric($session_autoresponder['TemplateID'])) {
$templateApi->Load($session_autoresponder['TemplateID']);
$autorespondercontents['text'] = $templateApi->textbody;
$autorespondercontents['html'] = $templateApi->htmlbody;
} else {
$autorespondercontents['html'] = $templateApi->ReadServerTemplate($session_autoresponder['TemplateID']);
}
unset($session_autoresponder['TemplateID']);
}
$session_autoresponder['id'] = (int)$autoresponderid;
$session_autoresponder['contents'] = $autorespondercontents;
// we use the lowercase variable when we save, but the editor expects the uppercased version.
$session_autoresponder['Format'] = $session_autoresponder['format'];
IEM::sessionSet('Autoresponders', $session_autoresponder);
$editor = $this->FetchEditor();
$GLOBALS['Editor'] = $editor;
unset($session_autoresponder['Format']);
$GLOBALS['MaxFileSize'] = SENDSTUDIO_ATTACHMENT_SIZE*1024;
$user = GetUser();
if ($user->Get('forcespamcheck')) {
$GLOBALS['ForceSpamCheck'] = 1;
}
//.........这里部分代码省略.........
示例5: PrintStatusReport
/**
* PrintStatusReport
* Prints out the status report of what we're importing. So we can quickly see how many successful imports, updated subscribers, duplicate subscribers found, failures etc.
*
* @param Boolean $return Specify whether or not to return the report instead of printing it (Optional, default FALSE - print to screen)
*
* @return Void|String Depending on the parameter, it will either print out the report and return nothing or return the report as a string
*/
function PrintStatusReport($return = false)
{
$importresults = IEM::sessionGet('ImportResults');
$importinfo = IEM::sessionGet('ImportInfo');
$GLOBALS['ImportResults_Message'] = sprintf(GetLang('ImportResults_InProgress_Message'), $this->FormatNumber($importinfo['TotalSubscribers']));
$report = '';
foreach (array('success', 'updates', 'duplicates', 'failures', 'bans', 'unsubscribes', 'bads') as $pos => $key) {
$amount = $importresults[$key];
if ($amount == 1) {
$report .= GetLang('ImportSubscribers_InProgress_' . $key . '_One');
} else {
$report .= sprintf(GetLang('ImportSubscribers_InProgress_' . $key . '_Many'), $this->FormatNumber($importresults[$key]));
}
$report .= '<br/>';
}
$GLOBALS['Report'] = $report;
$temp = $this->ParseTemplate('Subscribers_Import_ReportProgress', $return);
return $temp;
}
示例6: Admin_Action_PreConfig
/**
* Admin_Action_PreConfig
*
* is use to preconfigured any request before hitting any of of the Action..
* Perhaps this can be used to setup any prerequeisite like seting error messages or warning
* and other related used that can be used accross action..
*
*
* @return void
*/
public function Admin_Action_PreConfig()
{
$messageText = IEM::sessionGet('MessageText');
$messageType = IEM::sessionGet('MessageType');
if ($messageText) {
$message['type'] = $messageType;
$message['message'] = $messageText;
$messageArr[] = $message;
IEM::sessionSet('FlashMessages', $messageArr);
// removing the session for next usage
IEM::sessionRemove('MessageText');
IEM::sessionRemove('MessageType');
}
}
示例7: Process
/**
* Process
* Executes functions for the page that was requested
*
* @return Void Returns nothing
*/
function Process()
{
$user = GetUser();
$action = $this->_getGETRequest('Action', '');
$statstype = $this->_getGETRequest('statstype', null);
$subaction = $this->_getGETRequest('subaction', '');
if (isset($_GET['PerPageDisplay'])) {
$perpage = $this->SetPerPage($_GET['PerPageDisplay']);
} else {
$perpage = $this->GetPerPage();
}
$statsapi = $this->GetApi('Stats');
switch ($action) {
case 'get_linkstats':
$linksjson = array();
$token_id = IEM::requestGetGET('token', false);
$request_link = IEM::requestGetGET('link', false);
if (!$token_id || !$request_link) {
die();
}
$token_data = IEM::sessionGet($token_id);
$statid = $token_data['statid'];
$calendar_restrictions = $token_data['calendar_restrictions'];
$chosen_link = (is_numeric($request_link) ? $request_link : 'a');
// Total Clicks
$linkclicks = $statsapi->GetClicks($statid, 0, 0, $chosen_link, $calendar_restrictions, true);
$linkclicks = intval($linkclicks);
$linksjson['linkclicks'] = $linkclicks;
// Average Clicks
$averageclicks = 0;
$open_count = $statsapi->GetOpens($statid, 0, 0, true, $calendar_restrictions, true);
$open_count = intval($open_count);
if ($open_count != 0) {
$averageclicks = $linkclicks / $open_count;
}
$linksjson['averageclicks'] = $this->FormatNumber($averageclicks, 3);
// Click-through rate
if (isset($token_data['summary']['emails_sent'])) {
$sent_to = $token_data['summary']['emails_sent'];
} else {
$summary = $statsapi->GetNewsletterSummary($statid, true, 0);
if (!isset($summary['htmlrecipients'])) {
$sent_to = $request_link == 'a' ?
$statsapi->GetRecipients($statid, 'autoresponder', 0, 1, $calendar_restrictions, true) :
0;
} else {
$sent_to = $summary['htmlrecipients'] + $summary['textrecipients'] + $summary['multipartrecipients'];
}
}
$clicks = $statsapi->GetUniqueClickRecipients($statid,$calendar_restrictions,$chosen_link);
if ($sent_to == 0) {
$linksjson['clickthrough'] = '0%';
} else {
$linksjson['clickthrough'] = $this->FormatNumber($clicks / $sent_to * 100,2) . '%';
}
// Unique Clicks
$uniqueclicks = $clicks;
$linksjson['uniqueclicks'] = $uniqueclicks;
echo "var linksjson = " . GetJSON($linksjson) . ";";
break;
case 'print':
if ($statstype != 'a' && $statstype != 'n' && $statstype != 'l' && $statstype != 't') {
exit;
}
switch ($statstype) {
case 'a':
$this->area = 'autoresponder';
break;
case 'n':
$this->area = 'newsletter';
break;
case 'l':
$this->area = 'list';
//.........这里部分代码省略.........
示例8: Process
//.........这里部分代码省略.........
if (is_array($newval)) {
$checkvals = array();
foreach ($newval as $k => $v) {
if ($v != '') {
$checkvals[] = $v;
}
}
$newval = $checkvals;
}
$fieldapi->Settings[$name] = $newval;
}
$fieldapi->Save();
$this->ManageCustomField_Lists($fieldid);
break;
default:
$this->EditCustomField($fieldid);
}
break;
case 'delete':
$deletelist = (isset($_POST['customfields'])) ? $_POST['customfields'] : array();
if (isset($_GET['id'])) {
$deletelist = array((int)$_GET['id']);
}
$this->RemoveCustomFields($deletelist);
break;
case 'create':
// see what step we're up to.
$subaction = (isset($_GET['SubAction'])) ? strtolower($_GET['SubAction']) : '';
switch ($subaction) {
case 'step2':
$newfield = array();
$newfield['FieldName'] = $_POST['FieldName'];
$newfield['FieldType'] = $_POST['FieldType'];
$newfield['FieldRequired'] = '';
if(isset($_POST['FieldRequired'])){ $newfield['FieldRequired'] = 'on'; $GLOBALS['ApplyDefault'] = ' CHECKED';} else { $GLOBALS['ApplyDefault'] = ''; }
IEM::sessionSet('CustomFields', $newfield);
$this->CreateCustomField_Step2($newfield);
break;
case 'step3':
$customfield_settings = IEM::sessionGet('CustomFields');
$fieldapi = $this->GetApi('CustomFields_' . $customfield_settings['FieldType']);
if (!$fieldapi) {
return false;
}
$alloptions = $fieldapi->GetOptions();
$newoptions = array();
if(isset($_POST['ApplyDefault'])){$newoptions['ApplyDefault'] = 'on';}
foreach ($alloptions as $fieldname => $option) {
if(isset($newoptions[$fieldname])){continue;}
$value = (isset($customfield_settings[$fieldname])) ? $customfield_settings[$fieldname] : $_POST[$fieldname];
$newoptions[$fieldname] = $value;
}
$AllOptions = array_merge($fieldapi->SharedOptions, $fieldapi->Options);
foreach ($AllOptions as $name => $val) {
$newval = $newoptions[$name];
if (is_array($newval)) {
$checkvals = array();
foreach ($newval as $k => $v) {
if ($v != '') {
$checkvals[] = $v;
}
}
$newval = $checkvals;
}
$fieldapi->Settings[$name] = $newval;
}
$fieldapi->ownerid = $user->userid;
$create = $fieldapi->Create();
if (!$create) {
$GLOBALS['Error'] = GetLang('UnableToCreateCustomField');
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
break;
}
$this->ManageCustomField_Lists($create, true);
break;
default:
$this->CreateCustomField_Step1();
}
break;
default:
$this->ManageCustomFields();
}
$this->PrintFooter();
}
示例9: GetImagesList
/**
* GetImagesList
* A function to generate a list of the available images for the editor displays
*
* @param String $type The type of the folder.
* @param Interger $typeId The Id of the folder type.
*
* @return Void Doesn't return anything. Display the javascript content.
*/
function GetImagesList($type, $typeId)
{
$d_path = TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $type. DIRECTORY_SEPARATOR . $typeId;
if(!is_dir($d_path)){CreateDirectory($d_path,TEMP_DIRECTORY, 0777);}
$remove_temp_dir = IEM::sessionGet($type.'_creation['.$this->user->Get('userid').']');
if(empty($remove_temp_dir)){IEM::sessionSet($type.'_creation['.$this->user->Get('userid').']',true);}
$api = $this->GetApi();
$api->Init('asc', 'name', $type, $typeId);
$output = '';
$output .= 'var tinyMCEImageList = new Array(';
$outputArray = array();
$imgDir = $api->GetImageDirFiles();
foreach ($imgDir as $k=>$image){
$outputArray[] = '["' . $image['name'] . '", "' . $image['url'] . '"]';
}
$output .= implode(",\n", $outputArray) . ');';
header('Content-type: text/javascript');
die($output);
}
示例10: 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'));
}
示例11: ManageSubscribers_Step3
/**
* ManageSubscribers_Step3
* Prints out the subscribers for the list chosen and criteria selected in steps 1 & 2. This handles sorting, paging and searching. If you are coming in for the first time, it remembers your search criteria in the session. If you change number per page, sorting criteria, it fetches the search criteria from the session again before continuing.
*
* @see ManageSubscribers_Step2
* @see GetApi
* @see GetPerPage
* @see GetCurrentPage
* @see GetSortDetails
* @see Subscribers_API::FetchSubscribers
* @see SetupPaging
* @see Lists_API::Load
*
* @return Void Doesn't return anything. Prints out the results and that's it.
*/
function ManageSubscribers_Step3($change=false)
{
$subscriber_api = $this->GetApi('Subscribers');
$user = IEM::getCurrentUser();
$search_info = IEM::sessionGet('Search_Subscribers');
$this->SetupGoogleCalendar();
$user_lists = $user->GetLists();
if (!isset($GLOBALS['Message'])) {
$GLOBALS['Message'] = '';
}
// if we are posting a form, we are most likely resetting the search criteria.
// we are also resetting the search criteria once we detect "Lists" variable in the GET Request
$resetsearch = ((isset($_POST) && !empty($_POST)) || isset($_GET['Lists']) || isset($_GET['Segment'])) ? true : false;
// except if we're changing paging!
if (isset($_GET['SubAction'])) {
$subaction = strtolower($_GET['SubAction']);
if ($subaction == 'processpaging' || $subaction == 'change') {
$resetsearch = false;
}
}
if (!$search_info || $resetsearch) {
$this->SetCurrentPage(1); // forget current page
$search_details = array();
if (isset($_POST['emailaddress']) && $_POST['emailaddress'] != '') {
$search_details['Email'] = trim($_POST['emailaddress']);
}
if (isset($_POST['format']) && $_POST['format'] != '-1') {
$search_details['Format'] = $_POST['format'];
}
if (isset($_POST['confirmed']) && $_POST['confirmed'] != '-1') {
$search_details['Confirmed'] = $_POST['confirmed'];
}
if (isset($_POST['status']) && $_POST['status'] != '-1') {
$search_details['Status'] = $_POST['status'];
}
if (isset($_POST['datesearch']) && isset($_POST['datesearch']['filter'])) {
$search_details['DateSearch'] = $_POST['datesearch'];
$search_details['DateSearch']['StartDate'] = AdjustTime(array(0, 0, 1, $_POST['datesearch']['mm_start'], $_POST['datesearch']['dd_start'], $_POST['datesearch']['yy_start']));
$search_details['DateSearch']['EndDate'] = AdjustTime(array(0, 0, 1, $_POST['datesearch']['mm_end'], $_POST['datesearch']['dd_end'], $_POST['datesearch']['yy_end']));
}
$customfields = array();
if (isset($_POST['CustomFields']) && !empty($_POST['CustomFields'])) {
$customfields = $_POST['CustomFields'];
}
$search_details['CustomFields'] = $customfields;
if (isset($_GET['Lists']) || isset($_GET['List'])) {
$search_details['List'] = isset($_GET['Lists'])? $_GET['Lists'] : $_GET['List'];
} else {
$search_details['List'] = 'any';
}
// Get segment, and make sure user have access permission to it
if ($user->HasAccess('Segments')) {
$search_details['Segment'] = null;
if (isset($_GET['Segment'])) {
$tempSegmentList = array_keys($user->GetSegmentList());
$tempSegment = $_GET['Segment'];
// Make sure that selected segment is allowed for user
if (!is_array($tempSegment)) {
if (!in_array($tempSegment, $tempSegmentList)) {
$tempSegment = null;
}
} else {
$tempSegment = array_intersect($tempSegment, $tempSegmentList);
}
if (!is_null($tempSegment)) {
$search_details['Segment'] = $tempSegment;
}
//.........这里部分代码省略.........
示例12: RunUpgrade
/**
* RunUpgrade
* Runs the query for the upgrade process
* and returns the result from the query.
* The calling function looks for a true or false result
*
* @return Mixed Returns true if the condition is already met (eg the column already exists).
* Returns false if the database query can't be run.
* Returns the resource from the query (which is then checked to be true).
*/
function RunUpgrade()
{
$tablePrefix = SENDSTUDIO_TABLEPREFIX;
// ----- Splitting process into chunks
$dbUpgradeStatus = IEM::sessionGet('DatabaseUpgradeStatusList');
$thisQuery = null;
if (isset($dbUpgradeStatus[get_class($this)])) {
$thisQuery = $dbUpgradeStatus[get_class($this)];
}
if (is_null($thisQuery)) {
$result = $this->Db->Query(" SELECT COUNT(autoresponderid) AS listcount
FROM {$tablePrefix}autoresponders");
$row = $this->Db->Fetch($result);
$this->Db->FreeResult($result);
$thisQuery = array(
'Total' => $row['listcount'],
'Processed' => 0,
'Offset' => 0,
'Limit' => 10
);
}
// -----
$query = " SELECT autoresponderid, listid
FROM {$tablePrefix}autoresponders
LIMIT {$thisQuery['Limit']}
OFFSET {$thisQuery['Offset']}";
$result = $this->Db->Query($query);
while ($row = $this->Db->Fetch($result)) {
$statid = $this->Db->NextId(SENDSTUDIO_TABLEPREFIX . 'stats_sequence');
$query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "stats_linkclicks(clicktime, clickip, subscriberid, statid, linkid) SELECT lc.timestamp, lc.ipaddress, lc.memberid, " . $statid . ", ln.linkid FROM " . SENDSTUDIO_TABLEPREFIX . "link_clicks lc, " . SENDSTUDIO_TABLEPREFIX . "links l, " . SENDSTUDIO_TABLEPREFIX . "links_new ln WHERE lc.linkid=l.linkid AND l.url=ln.url AND lc.ComposedID=l.ComposedID AND UPPER(lc.LinkType)='AUTO' AND lc.ListID='" . $row['listid'] . "'";
$this->Db->Query($query);
$query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "stats_emailopens(subscriberid, statid, opentime, openip) SELECT MemberID, " . $statid . ", TimeStamp, NULL FROM " . SENDSTUDIO_TABLEPREFIX . "email_opens WHERE SendID='" . $row['autoresponderid'] . "' AND UPPER(EmailType)='AUTO'";
$this->Db->Query($query);
$link_clicks_query = "SELECT COUNT(linkid) AS linkcount FROM " . SENDSTUDIO_TABLEPREFIX . "stats_links WHERE statid='" . $statid . "'";
$clicks_result = $this->Db->Query($link_clicks_query);
$link_clicks = $this->Db->FetchOne($clicks_result, 'linkcount');
$link_clicks_query = "SELECT COUNT(openid) AS opencount FROM " . SENDSTUDIO_TABLEPREFIX . "stats_emailopens WHERE statid='" . $statid . "'";
$opens_result = $this->Db->Query($link_clicks_query);
$email_opens = $this->Db->FetchOne($opens_result, 'opencount');
$insert_query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "stats_autoresponders(statid, htmlrecipients, textrecipients, multipartrecipients, bouncecount_soft, bouncecount_hard, bouncecount_unknown, unsubscribecount, autoresponderid, linkclicks, emailopens, emailforwards, emailopens_unique, hiddenby) VALUES ('" . $statid . "', '0', '0', '0', 0, 0, 0, 0, '" . $row['autoresponderid'] . "', '" . $link_clicks . "', '" . $email_opens . "', 0, '" . $email_opens . "', 0)";
$insert_result = $this->Db->Query($insert_query);
}
// ----- Make sure the process run for the next chunk
$thisQuery['Processed'] += $thisQuery['Limit'];
if ($thisQuery['Processed'] > $thisQuery['Total']) {
$thisQuery['Processed'] = $thisQuery['Total'];
}
$thisQuery['Offset'] = $thisQuery['Processed'] - 1;
$dbUpgradeStatus[get_class($this)] = $thisQuery;
IEM::sessionSet('DatabaseUpgradeStatusList', $dbUpgradeStatus);
// -----
// -----
// Will return 1 if need to process the same table, TRUE if processing complete, FALSE if process failed
// Will also process subsequent commands after finishing the main process
// -----
if ($thisQuery['Processed'] >= $thisQuery['Total']) {
// save all of the stat -> link associations here.
$query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "stats_links SELECT statid, linkid FROM " . SENDSTUDIO_TABLEPREFIX . "stats_linkclicks GROUP BY statid, linkid";
$this->Db->Query($query);
return true;
} else {
return 1;
}
// -----
}
示例13: DisplayEditTemplate
/**
* DisplayEditTemplate
* Prints out stage 2 of editing a template based on whether this is a text, html or multipart template. This information is stored in the session, so we need to retrieve those settings.
* This function is used both when creating and editing a template.
*
* @param Int $templateid If there is a template id, we are updating an existing template. If there is no template id, we are creating a new template. This changes form actions depending on what we're doing.
*
* @see GetApi
* @see GetUser
* @see Templates_API::Load
* @see Templates_API::GetBody
* @see FetchEditor
*
* @return Void Prints out the form, doesn't return anything.
*/
function DisplayEditTemplate($templateid=0, $server_template=false)
{
$template = $this->GetApi();
$templatecontents = array('text' => '', 'html' => '');
$user = IEM::getCurrentUser();
if ($templateid > 0) {
$GLOBALS['SaveAction'] = 'Edit&SubAction=Save&id=' . $templateid;
$GLOBALS['Heading'] = GetLang('EditTemplate');
$GLOBALS['Intro'] = GetLang('EditTemplateIntro_Step2');
$GLOBALS['Action'] = 'Edit&SubAction=Complete&id=' . $templateid;
$GLOBALS['CancelButton'] = GetLang('EditTemplateCancelButton');
$template->Load($templateid);
$show_misc_options = false;
if ($user->HasAccess('Templates', 'Approve')) {
$show_misc_options = true;
$GLOBALS['IsActive'] = ($template->Active()) ? ' CHECKED' : '';
} else {
$GLOBALS['ShowActive'] = 'none';
}
if ($user->HasAccess('Templates', 'Global')) {
$show_misc_options = true;
$GLOBALS['IsGlobal'] = ($template->IsGlobal() && $template->Active()) ? ' CHECKED' : '';
} else {
$GLOBALS['ShowGlobal'] = 'none';
}
if (!$show_misc_options) {
$GLOBALS['ShowMiscOptions'] = 'none';
}
$templatecontents['text'] = $template->GetBody('text');
$templatecontents['html'] = $template->GetBody('html');
} else {
$GLOBALS['SaveAction'] = 'Create&SubAction=Save&id=' . $templateid;
$GLOBALS['Heading'] = GetLang('CreateTemplate');
$GLOBALS['Intro'] = GetLang('CreateTemplateIntro_Step2');
$GLOBALS['Action'] = 'Create&SubAction=Complete';
$GLOBALS['CancelButton'] = GetLang('CreateTemplateCancelButton');
if (!$user->HasAccess('Templates', 'Global')) {
$GLOBALS['ShowGlobal'] = 'none';
}
$show_misc_options = false;
if ($user->HasAccess('Templates', 'Approve')) {
$GLOBALS['IsActive'] = ' CHECKED';
$show_misc_options = true;
} else {
$GLOBALS['ShowActive'] = 'none';
}
if (!$show_misc_options) {
$GLOBALS['ShowMiscOptions'] = 'none';
}
}
if ($server_template) {
$templatecontents['html'] = $template->ReadServerTemplate($server_template);
}
// we don't really need to get/set the stuff here.. we could use references.
// if we do though, it segfaults! so we get and then set the contents.
$session_template = IEM::sessionGet('Templates'.$templateid);
$session_template['id'] = (int)$templateid;
$session_template['contents'] = $templatecontents;
IEM::sessionSet('Templates'.$templateid, $session_template);
$editor = $this->FetchEditor('Templates'.$templateid);
$GLOBALS['Editor'] = $editor;
$this->ParseTemplate('Template_Form_Step2');
}
示例14: Process
/**
* Process
* This handles working out what stage you are up to and so on with workflow.
* Handles editing of schedules, pausing, resuming and deleting of schedules.
* Deleting a scheduled event (especially) needs to update statistics if there are any emails left over in the queue.
*
* @see GetUser
* @see User_API::HasAccess
* @see SENDSTUDIO_CRON_ENABLED
* @see GetApi
* @see Jobs_API::PauseJob
* @see Jobs_API::ResumeJob
* @see Jobs_API::LoadJob
* @see ManageSchedules
* @see CheckJob
* @see AdjustTime
*/
function Process()
{
$action = (isset($_GET['Action'])) ? strtolower($_GET['Action']) : null;
if (!SENDSTUDIO_CRON_SEND) {
$popup = (in_array($action, $this->PopupWindows)) ? true : false;
$this->PrintHeader($popup);
$GLOBALS['Error'] = GetLang('CronNotEnabled');
$this->ParseTemplate('ErrorMsg');
$this->PrintFooter();
return;
}
$user = GetUser();
$access = $user->HasAccess('Newsletters', 'Send');
$popup = (in_array($action, $this->PopupWindows)) ? true : false;
$this->PrintHeader($popup);
if (!$access) {
$this->DenyAccess();
return;
}
if ($action == 'processpaging') {
$this->SetPerPage($_GET['PerPageDisplay']);
$action = '';
}
$jobapi = $this->GetApi('Jobs');
$approve_job = IEM::sessionGet('ApproveJob');
if ($approve_job) {
if (isset($_GET['A'])) {
$jobapi->ApproveJob($approve_job, $user->Get('userid'));
$GLOBALS['Message'] = $this->PrintSuccess('JobScheduledOK');
IEM::sessionRemove('ApproveJob');
}
}
$jobid = 0;
if (isset($_GET['job'])) {
$jobid = (int)$_GET['job'];
}
switch ($action) {
/**
* These methods are all called the same thing:
* 'ActionJob'
* The 'action' has an upper-case first letter
* then 'Job' has the same.
* They also all just take the jobid as the argument.
*/
case 'approve':
case 'edit':
case 'pause':
case 'resend':
case 'resume':
case 'update':
if (!$this->CanAccessJobs($jobid)) {
$this->DenyAccess();
return false;
}
$method = ucwords($action) . 'Job';
call_user_func(array($this, $method), $jobid);
break;
case 'delete':
$jobids = array();
if (isset($_POST['jobs'])) {
$jobids = $_POST['jobs'];
} else {
$jobids[] = $jobid;
}
if (!$this->CanAccessJobs($jobids)) {
$this->DenyAccess();
return false;
}
$this->DeleteJobs($jobids);
//.........这里部分代码省略.........
示例15: Process
/**
* Process
* This processes the ajax requests.
* There are only two types of request - importfile and importurl.
*
* If it's importfile, it will display the 'fileupload' iframe again, and also process the file if there was one uploaded. It base 64 encodes the data to pass to javascript, this saves having to worry about newlines, quotes and so on. The javascript decodes it itself, then calls the DoImport function in the includes/js/javascript.js file.
*
* If it's importurl, it simply calls GetPageContents and returns that.
*
* @see GetPageContents
*
* @return Void Doesn't return anything, simply prints out the results.
*/
function Process()
{
// make sure they are logged in appropriately.
if (!IEM::getCurrentUser()) {
return;
}
$GLOBALS['ImportType'] = 'HTML';
if (isset($_GET['ImportType']) && strtolower($_GET['ImportType']) == 'text') {
$GLOBALS['ImportType'] = 'Text';
}
if (isset($_GET['DisplayFileUpload'])) {
$this->ParseTemplate('Editor_FileUpload');
return;
}
$user = GetUser();
if (isset($_POST['what'])) {
$what = $_POST['what'];
switch (strtolower($what)) {
case 'check_existing':
// this is used when editing an autoresponder and you check the "send to existing" box.
// it will alert you if you have sent this autoresponder to any recipients before
// so you're aware that they will receive it again.
$autoresponder_id = (isset($_POST['auto'])) ? (int)$_POST['auto'] : 0;
if ($autoresponder_id <= 0) {
exit;
}
$this->LoadLanguageFile('autoresponders');
require_once(SENDSTUDIO_API_DIRECTORY . '/autoresponders.php');
$auto_api = new Autoresponders_API();
$userid = $user->userid;
// If user is an admin, omit the userid so that it won't get checked
if ($user->Admin()) {
$userid = 0;
}
$already_sent_to = $auto_api->GetRecipientCount($autoresponder_id, $userid);
if (!$already_sent_to) {
exit;
}
if ($already_sent_to > 0) {
$msg = sprintf(GetLang('AutoresponderAlreadySentTo'), $this->FormatNumber($already_sent_to));
echo $msg;
}
exit;
break;
case 'importlinks':
$listid = false;
$processing_list = IEM::sessionGet('LinksForList');
if ($processing_list) {
$listid = (int)$processing_list;
}
$links = $user->GetAvailableLinks($listid);
$link_list = 'mylinks[-1]=\'' . GetLang('FilterAnyLink') . '\';' . "\n";
foreach ($links as $linkid => $url) {
$link_list .= 'mylinks[' . $linkid . ']=\'' . addslashes($url) . '\';' . "\n";
}
echo $link_list;
break;
case 'importnewsletters':
$listid = false;
$processing_list = IEM::sessionGet('NewsForList');
if ($processing_list) {
$listid = (int)$processing_list;
}
$news = $user->GetAvailableNewsletters($listid);
$news_list = 'mynews[-1]=\'' . GetLang('FilterAnyNewsletter') . '\';' . "\n";
foreach ($news as $newsid => $name) {
$news_list .= 'mynews[' . $newsid . ']=\'' . addslashes($name) . '\';' . "\n";
}
//.........这里部分代码省略.........