本文整理汇总了PHP中IEM::redirectTo方法的典型用法代码示例。如果您正苦于以下问题:PHP IEM::redirectTo方法的具体用法?PHP IEM::redirectTo怎么用?PHP IEM::redirectTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEM
的用法示例。
在下文中一共展示了IEM::redirectTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DeleteNewsletters
/**
* DeleteNewsletters
* Deletes a list of newsletter id's passed in.
*
* @param Array $newsletterids An array of newsletters you want to delete. If it's a single id, it's turned into an array for easy processing.
*
* @see GetApi
* @see Newsletters_API::Delete
* @see ManageNewsletters
*
* @return Void Doesn't return anything. Prints out a message based on what happened and prints out the list of newsletters again.
*/
function DeleteNewsletters($newsletterids=array()) {
if (!is_array($newsletterids)) {
$newsletterids = array($newsletterids);
}
$api = $this->GetApi();
$jobapi = $this->GetApi('Jobs');
$newsletterids = $api->CheckIntVars($newsletterids);
if (empty($newsletterids)) {
$GLOBALS['Error'] = GetLang('NoNewslettersToDelete');
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->ManageNewletters();
return;
}
$user = GetUser();
$sends_in_progress = array();
$delete_ok = $delete_fail = 0;
foreach ($newsletterids as $p => $newsletterid) {
$job = $jobapi->FindJob('send', 'newsletter', $newsletterid);
if ($job) {
if ($job['jobstatus'] == 'i') {
$api->Load($newsletterid);
$newsletter_name = $api->Get('name');
$sends_in_progress[] = $newsletter_name;
continue;
}
$jobapi->Delete($job['jobid']);
while ($job = $jobapi->FindJob('send', 'newsletter', $newsletterid)) {
if ($job['jobstatus'] == 'i') {
$api->Load($newsletterid);
$newsletter_name = $api->Get('name');
$sends_in_progress[] = $newsletter_name;
break;
}
$jobapi->Delete($job['jobid']);
}
}
$status = $api->Delete($newsletterid, $user->Get('userid'));
if ($status) {
$delete_ok++;
} else {
$delete_fail++;
}
}
$msg = '';
if (!empty($sends_in_progress)) {
if (sizeof($sends_in_progress) == 1) {
$GLOBALS['Error'] = sprintf(GetLang('Newsletter_NotDeleted_SendInProgress'), current($sends_in_progress));
} else {
$GLOBALS['Error'] = sprintf(GetLang('Newsletters_NotDeleted_SendInProgress'), implode('\',\'', $sends_in_progress));
}
$msg .= $this->ParseTemplate('ErrorMsg', true, false);
}
if ($delete_ok > 0) {
if ($delete_ok == 1) {
$msg .= $this->PrintSuccess('Newsletter_Deleted');
} else {
$msg .= $this->PrintSuccess('Newsletters_Deleted', $this->FormatNumber($delete_ok));
}
}
$GLOBALS['Message'] = $msg;
IEM::sessionSet('Newsletters_deletion['.$user->Get('userid').']',$GLOBALS['Message']);
IEM::redirectTo("Newsletters",array("Action" => "Manage"));
}
示例3: DeleteUsers
/**
* DeleteUsers
* Deletes a list of users from the database via the api. Each user is checked to make sure you're not going to accidentally delete your own account and that you're not going to delete the 'last' something (whether it's the last active user, admin user or other).
* If you aren't an admin user, you can't do anything at all.
*
* @param integer[] $users An array of userid's to delete
* @param boolean $deleteData Whether or not to delete data owned by user along
*
* @see GetUser
* @see User_API::UserAdmin
* @see DenyAccess
* @see CheckUserSystem
* @see PrintManageUsers
*
* @return Void Doesn't return anything. Works out the relevant message about who was/wasn't deleted and prints that out. Returns control to PrintManageUsers.
*/
function DeleteUsers($users = array(), $deleteData = false)
{
$thisuser = GetUser();
if (!$thisuser->UserAdmin()) {
$this->DenyAccess();
return;
}
if (!is_array($users)) {
$users = array($users);
}
$not_deleted_list = array();
$not_deleted = $deleted = 0;
foreach ($users as $p => $userid) {
if ($userid == $thisuser->Get('userid')) {
$not_deleted++;
$not_deleted_list[$userid] = array('username' => $thisuser->Get('username'), 'reason' => GetLang('User_CantDeleteOwn'));
continue;
}
$error = $this->CheckUserSystem($userid);
if (!$error) {
$result = API_USERS::deleteRecordByID($userid, $deleteData);
if ($result) {
$deleted++;
} else {
$not_deleted++;
$user = GetUser($userid);
if ($user instanceof User_API) {
$not_deleted_list[$userid] = array('username' => $user->Get('username'), 'reason' => '');
} else {
$not_deleted_list[$userid] = array('username' => $userid, 'reason' => '');
}
}
} else {
$not_deleted++;
$user = GetUser($userid);
if ($user instanceof User_API) {
$not_deleted_list[$userid] = array('username' => $user->Get('username'), 'reason' => $error);
} else {
$not_deleted_list[$userid] = array('username' => $userid, 'reason' => $error);
}
}
}
if ($not_deleted > 0) {
foreach ($not_deleted_list as $uid => $details) {
FlashMessage(sprintf(GetLang('UserDeleteFail'), htmlspecialchars($details['username'], ENT_QUOTES, SENDSTUDIO_CHARSET), htmlspecialchars($details['reason'], ENT_QUOTES, SENDSTUDIO_CHARSET)), SS_FLASH_MSG_ERROR);
}
}
if ($deleted > 0) {
if ($deleted == 1) {
FlashMessage(GetLang('UserDeleteSuccess_One'), SS_FLASH_MSG_SUCCESS, IEM::urlFor('Users'));
} else {
FlashMessage(sprintf(GetLang('UserDeleteSuccess_Many'), $this->FormatNumber($deleted)), SS_FLASH_MSG_SUCCESS, IEM::urlFor('Users'));
}
}
IEM::redirectTo('Users');
}
示例4: ChangeList
/**
* ChangeList
* Performs the following actions:
* - Deletes lists,
* - Deletes all subscribers within lists,
* - Changes the format of all subscribers within lists,
* - Changes the confirmed status of all subscribers within lists, or
* - Merges lists.
*
* @param Array $param Any parameters that needed to be passed into this function
*
* @return Void Redirects to the Manage Lists page or Edit List page depending on action or error.
*/
private function ChangeList($param)
{
$user =& $param['user'];
// The User should be able to view the lists they want to merge, but there is no 'View' permission for lists.
// For now we will just require that they have 'edit' permissions.
foreach ($_POST['Lists'] as $lid) {
if (!$user->HasAccess('lists', 'edit', $lid)) {
$this->DenyAccess();
}
}
$subaction = strtolower($_POST['ChangeType']);
$listApi = $this->GetApi();
$success_format = 0; $failure_format = 0;
$success_status = 0; $failure_status = 0;
$success_confirmed = 0; $failure_confirmed = 0;
if ($subaction == 'mergelists') {
if ($user->CanCreateList() !== true) {
FlashMessage(GetLang('TooManyLists'), SS_FLASH_MSG_ERROR, IEM::urlFor('Lists'));
}
if (sizeof($_POST['Lists']) < 2) {
FlashMessage(GetLang('UnableToMergeLists'), SS_FLASH_MSG_ERROR, IEM::urlFor('Lists'));
}
$message = '';
$userdetails = array();
$userdetails['userid'] = $user->userid;
$userdetails['name'] = $user->fullname;
$userdetails['emailaddress'] = $user->emailaddress;
list($newid, $msg, $results) = $listApi->MergeLists($_POST['Lists'], $userdetails);
$success_merged = $results['Success'];
$failure_merged = $results['Failure'];
$duplicates_success_removed = $results['DuplicatesSuccess'];
$duplicates_failure_removed = $results['DuplicatesFailure'];
if ($success_merged > 0) {
$message .= sprintf(GetLang('MergeSuccessful'), $this->FormatNumber($success_merged));
FlashMessage($message, SS_FLASH_MSG_SUCCESS);
}
if ($failure_merged > 0) {
$message = sprintf(GetLang('MergeUnsuccessful'), $this->FormatNumber($success_merged));
FlashMessage($message, SS_FLASH_MSG_ERROR);
}
if ($duplicates_success_removed > 0) {
$message = sprintf(GetLang('MergeDuplicatesRemoved_Success'), $this->FormatNumber($duplicates_success_removed));
FlashMessage($message, SS_FLASH_MSG_SUCCESS);
}
if ($duplicates_failure_removed > 0) {
$message = sprintf(GetLang('MergeDuplicatesRemoved_Fail'), $this->FormatNumber($duplicates_failure_removed));
FlashMessage($message, SS_FLASH_MSG_ERROR);
}
if (!$newid) {
IEM::redirectTo('Lists');
}
$user->LoadPermissions($user->userid);
$user->GrantListAccess($newid);
$user->SavePermissions();
IEM::redirectTo('Lists', array('Action' => 'Edit', 'id' => $newid));
}
$lists_deleted_success = $lists_deleted_failure = 0;
$subscribers_deleted_success = $subscribers_deleted_failure = 0;
foreach ($_POST['Lists'] as $pos => $list) {
$listApi->Load((int)$list);
switch ($subaction) {
case 'delete':
// ----- get jobs running for this user
$db = IEM::getDatabase();
$jobs_to_check = array();
$query = "SELECT jobid FROM [|PREFIX|]jobs_lists WHERE listid = {$list}";
$result = $db->Query($query);
if(!$result){
trigger_error(mysql_error()."<br />".$query);
FlashMessage("Unable to load list jobs. <br /> ". mysql_error(), SS_FLASH_MSG_ERROR, IEM::urlFor('Lists'));
//.........这里部分代码省略.........
示例5: RemoveBans
/**
* RemoveBans
* Removes an array of bans from the list passed in. It calls the API to do the actual removal, then prints out a report of actions taken.
*
* @param Array $banlist An array of bans to remove (their id's anyway). If it's not an array (it's a single ban to remove), it gets converted to an array for easy use.
* @param Mixed $list List to remove the bans from. This can either be a numeric value (listid), or if it's 'global' it will cover the 'global' bans.
*
* @see GetApi
* @see Subscriber_API::RemoveBannedSubscriber
*
* @return Void Prints out the report, doesn't return anything.
*/
function RemoveBans($banlist=array(), $list=null)
{
if (!is_array($banlist)) {
$banlist = array($banlist);
}
$subscriber_api = $this->GetApi('Subscribers');
$banned_search_info = IEM::sessionGet('Banned_Search_Subscribers');
if (is_numeric($list)) {
$ListApi = $this->GetApi('Lists');
$ListApi->Load($banned_search_info['List']);
$listname = $ListApi->name;
} else {
$listname = GetLang('Subscribers_GlobalBan');
}
$subscriber_api->Db->StartTransaction();
$removed = 0; $notremoved = 0;
foreach ($banlist as $pos => $banid) {
list($status, $statusmsg) = $subscriber_api->RemoveBannedSubscriber($banid, $list);
if ($status) {
$removed++;
} else {
$notremoved++;
}
}
$subscriber_api->Db->CommitTransaction();
$msg = '';
if ($notremoved > 0) {
if ($notremoved == 1) {
$GLOBALS['Error'] = sprintf(GetLang('Subscriber_Ban_NotDeleted_One'), htmlspecialchars($listname, ENT_QUOTES, SENDSTUDIO_CHARSET));
} else {
$GLOBALS['Error'] = sprintf(GetLang('Subscriber_Ban_NotDeleted_Many'), $this->FormatNumber($notremoved), htmlspecialchars($listname, ENT_QUOTES, SENDSTUDIO_CHARSET));
}
$msg .= $this->ParseTemplate('ErrorMsg', true, false);
}
if ($removed > 0) {
if ($removed == 1) {
$msg .= $this->PrintSuccess('Subscriber_Ban_Deleted_One', htmlspecialchars($listname, ENT_QUOTES, SENDSTUDIO_CHARSET));
} else {
$msg .= $this->PrintSuccess('Subscriber_Ban_Deleted_Many', $this->FormatNumber($removed), htmlspecialchars($listname, ENT_QUOTES, SENDSTUDIO_CHARSET));
}
}
$GLOBALS['Message'] = $msg;
$GLOBALS['List'] = $list;
IEM::sessionSet('DeleteBannedSubscriberMessage', $msg);
$banscount = IEM::sessionGet('ListBansCount');
$newcount = $banscount - $removed;
if ($newcount < 1) {
IEM::redirectTo('Subscribers', array('Action' => 'Banned'));
exit();
}
$this->ShowBannedList($list);
}
示例6: page_index
/**
* page_index
* The "controller" assume that this function always exists.
* If the method is not overwritten, user will be re-directed to index page.
*
* TODO: becareful with index page... This can create infinite loop when the page_Index class
* does not overwrite this method.
*/
public function page_index()
{
IEM::redirectTo('index');
return false;
}