本文整理汇总了PHP中Typeframe::Redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Typeframe::Redirect方法的具体用法?PHP Typeframe::Redirect怎么用?PHP Typeframe::Redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Typeframe
的用法示例。
在下文中一共展示了Typeframe::Redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FailureOrRedirect
public static function FailureOrRedirect($message, $redirect = null, $data = null)
{
if (requestIsAjax()) {
die(self::Failure($message, self::_addRedirectToData($data, $redirect)));
}
Typeframe::Redirect($message, $redirect);
}
示例2:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$page->delete();
Typeframe::Redirect('Page deleted.', Typeframe::CurrentPage()->applicationUri());
}
} else {
Typeframe::Redirect('Invalid page specified.', Typeframe::CurrentPage()->applicationUri());
}
return;
/**
* Typeframe Pages application
*
* admin delete controller
*/
// save typing below
$typef_app_dir = TYPEF_WEB_DIR . '/admin/pages';
// can only process posts
if ('POST' != $_SERVER['REQUEST_METHOD']) {
//Typeframe::Redirect('Nothing to do.', $typef_app_dir);
return;
}
// validate the page id
$pageid = @$_POST['pageid'];
$page = Model_Page::Get($pageid);
if (!$page->exists()) {
Typeframe::Redirect('Invalid page.', $typef_app_dir);
return;
}
Model_Page::Delete($pageid);
Typeframe::Registry()->purgeRegistryCache();
Typeframe::Redirect('Page deleted.', $typef_app_dir);
示例3:
<?php
$site = Model_Site::Get($_REQUEST['id']);
if ($site->exists()) {
require_once 'options.inc.php';
$pm->setVariable('site', $site);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
include 'update.inc.php';
Typeframe::Redirect('Site updated.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
}
} else {
Typeframe::Redirect('Invalid site specified.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
}
示例4: array
<?php
$mailform['mailformname'] = $_POST['mailformname'];
$mailform['message'] = $_POST['message'];
$mailform['response'] = $_POST['response'];
$mailform['subject'] = $_POST['subject'];
$mailform['replyto'] = $_POST['replyto'];
$mailform['redirect'] = $_POST['redirect'];
$mailform['template'] = $_POST['template'];
$recipients = array();
for ($i = 0; $i < count($_POST['recipients']['email']); $i++) {
if (!empty($_POST['recipients']['email'][$i])) {
$recipients[] = array('email' => $_POST['recipients']['email'][$i], 'name' => $_POST['recipients']['name'][$i], 'when' => $_POST['recipients']['when'][$i], 'fieldname' => $_POST['recipients']['fieldname'][$i], 'fieldvalue' => $_POST['recipients']['fieldvalue'][$i]);
}
}
$mailform['recipients'] = $recipients;
$formfields = array();
for ($i = 0; $i < count($_POST['fields']['name']); $i++) {
if (!empty($_POST['fields']['name'][$i])) {
$formfields[] = array('name' => $_POST['fields']['name'][$i], 'class' => $_POST['fields']['class'][$i], 'type' => $_POST['fields']['type'][$i], 'values' => $_POST['fields']['values'][$i], 'required' => $_POST['fields']['required'][$i]);
}
}
$mailform['captcha'] = !empty($_POST['captcha']) ? 1 : 0;
$mailform['formfields'] = $formfields;
$mailform->save();
Typeframe::Redirect('Mailform saved.', Typeframe::CurrentPage()->applicationUri());
示例5: trim
<?php
$userid = trim(@$_REQUEST['userid']);
$confirmkey = trim(@$_REQUEST['confirmkey']);
$user = Model_User::Get($userid);
$confirms = new Model_UserConfirm();
$confirms->where('userid = ?', $userid);
$confirms->where('confirmkey = ?', $confirmkey);
$confirm = $confirms->getFirst();
if ($confirm->exists()) {
$user['confirmed'] = 1;
$user->save();
$confirm->delete();
Typeframe::Redirect('Your account confirmation is complete. Welcome!', TYPEF_WEB_DIR . '/', 1);
} else {
Typeframe::Redirect('Confirmation failed.', TYPEF_WEB_DIR . '/', 1);
}
示例6: array
<?php
$usergroup = Model_Usergroup::Get($_REQUEST['usergroupid']);
if ($usergroup->exists()) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
include 'update.inc.php';
Typeframe::Redirect('User group updated.', Typeframe::CurrentPage()->applicationUri() . '/groups');
} else {
$pm->setVariable('usergroup', $usergroup);
$admin = new BaseModel_UsergroupAdmin();
$admin->where('usergroupid = ?', $usergroup['usergroupid']);
$apps = array();
foreach ($admin->select() as $a) {
$apps[] = $a['application'];
}
$pm->setVariable('admin_applications', $apps);
include 'form.inc.php';
}
} else {
}
示例7: mkdir
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$base = TYPEF_DIR . '/files/public/userfiles/' . Typeframe::User()->get('userid');
if (!file_exists($base)) {
mkdir($base);
}
$folder = isset($_REQUEST['folder']) ? $_REQUEST['folder'] : '';
$currentFolder = "{$base}/{$folder}";
$moved = FileManager::MoveUpload($_FILES['upload']['tmp_name'], "{$currentFolder}/{$_FILES['upload']['name']}");
$message = '';
if ($moved) {
$moved = basename($moved);
} else {
$moved = '';
$message = 'Upload failed.';
}
if (!empty($_REQUEST['command']) && $_REQUEST['command'] == 'BrowserUpload') {
Typeframe::Redirect('File uploaded.', TYPEF_WEB_DIR . '/ckeditor/browse?type=' . $_REQUEST['type'] . '&folder=' . $_REQUEST['folder'] . '&CKEditorFuncNum=' . $_REQUEST['CKEditorFuncNum']);
} else {
if ($moved) {
$pm->setVariable('file', TYPEF_WEB_DIR . '/files/public/userfiles/' . Typeframe::User()->get('userid') . ($folder ? '/' . $folder : '') . '/' . $moved);
}
$pm->setVariable('funcnum', $_REQUEST['CKEditorFuncNum']);
$pm->setVariable('message', $message);
}
}
示例8: Model_User
if ('POST' == $_SERVER['REQUEST_METHOD']) {
// save typing below
$typef_app_dir = TYPEF_WEB_DIR . '/admin/users/groups';
// get and validate user group id
$usergroupid = @$_REQUEST['usergroupid'];
$usergroup = Model_Usergroup::Get($usergroupid);
if (!$usergroup->exists()) {
Typeframe::Redirect('No user group provided.', $typef_app_dir, 1);
return;
}
if (in_array($usergroupid, array(TYPEF_DEFAULT_USERGROUPID, TYPEF_ADMIN_USERGROUPID))) {
Typeframe::Redirect('Unable to delete primary user groups.', $typef_app_dir, -1);
return;
}
$users = new Model_User();
$users->where('usergroupid = ?', $usergroupid);
if ($users->count() > 0) {
Typeframe::Redirect('Unable to delete a group containing users. Delete the users or move them to a different group first.', $typef_app_dir, -1);
return;
}
// delete application associations
/*$ugadmin = UserGroupAdmin::DAOFactory();
$ugadmin->select()->where('usergroupid = ?', $usergroupid);
foreach ($ugadmin->getAll() as $uga)
$uga->delete();*/
// delete the user group
$usergroup->delete();
// done
Typeframe::Redirect('User group deleted.', $typef_app_dir);
return;
}
示例9: array
if (isset($_POST['action']) && 'Cancel' != $_POST['action']) {
$content = array();
foreach ($group['members'] as $member) {
$key = $member['name'];
if ('image' == $member['type']) {
$value = basename(FileManager::GetPostedOrUploadedFile($key, TYPEF_DIR . '/files/public/content'));
} elseif (isset($_POST[$key])) {
$value = $_POST[$key];
} else {
$value = null;
}
$content[$key] = $value;
}
$pm->setVariable('row', $content);
$pm->setVariable('group', $group);
}
Typeframe::SetPageTemplate('/admin/content/groups/form-post.html');
}
$pm->setVariable('action', $_SERVER['REQUEST_URI']);
$pm->setVariable('group', $group);
$pm->setVariable('template', $_REQUEST['template']);
$pm->setVariable('base', $_REQUEST['base']);
if (!empty($_REQUEST['pageid'])) {
$pm->setVariable('group_url', TYPEF_WEB_DIR . '/admin/content/groups/form?pageid=' . $_REQUEST['pageid']);
} else {
$pm->setVariable('group_url', TYPEF_WEB_DIR . '/admin/content/groups/form?plugid=' . $_REQUEST['plugid']);
}
} else {
Typeframe::Redirect('Invalid base.', $typef_app_dir, -1);
return;
}
示例10: array
}
// if no errors...
if (!$error) {
// set values in mailform object; save
$values = array();
foreach (array('mailformname', 'message', 'response', 'redirect', 'replyto', 'template') as $field) {
$mailform->set($field, trim(@$_POST[$field]));
}
$mailform->set('multiple', $multiple);
$mailform->set('recipient', $recipient);
$mailform->set('subject', $subject);
$mailform->set('mapping', $mapping);
$mailform->set('formfields', trim(@$_POST['fields']));
$mailform->save();
// done; go back to the listing
Typeframe::Redirect(Mailform::MODE_ADD == $mode ? 'Mailform added.' : 'Mailform updated.', $typef_app_dir);
return;
}
// otherwise, readd values to template
$pm->setVariable('mailform', $_POST);
$pm->setVariable('fields', $fields);
} else {
// add mailform and fields to template
$pm->setVariable('mailform', $mailform);
$pm->setVariable('fields', $mailform->get('formfields'));
// add multiple_data to template, if any
if ($mailform->get('multiple')) {
$subjects = json_decode($mailform->get('subject'));
$recipients = json_decode($mailform->get('recipient'));
$mappings = json_decode($mailform->get('mapping'));
$multiple_data = array();
示例11: tmpfile
Typeframe::Redirect('Unable to connect to FTP server.', Typeframe::CurrentPage()->applicationUri(), -1);
return;
}
if (!$ftp->login($_SESSION['typef_ftp_user'], $_SESSION['typef_ftp_pass'])) {
Typeframe::Redirect('Unable to log into FTP server.', Typeframe::CurrentPage()->applicationUri(), -1);
return;
}
$h = tmpfile();
fwrite($h, $_REQUEST['source']);
if (!fflush($h)) {
die("Failed to flush");
}
rewind($h);
// Make sure that all required directories exist
$dirs = dirname("{$_REQUEST['skin']}{$_REQUEST['stylesheet']}");
$dirnames = split("/", $dirs);
$localpath = TYPEF_DIR . '/skins';
$curdir = '';
for ($i = 0; $i < count($dirnames); $i++) {
$curdir .= '/' . $dirnames[$i];
if (!file_exists("{$localpath}{$curdir}")) {
echo "Making /skins{$curdir}<br/>";
$ftp->mkdir(TYPEF_FTP_ROOT . "/skins{$curdir}");
}
}
$ftp->fput(TYPEF_FTP_ROOT . "/skins/{$_REQUEST['skin']}{$_REQUEST['stylesheet']}", $h, FTP_ASCII);
$ftp->close();
fclose($h);
Typeframe::Redirect("Stylesheet updated.", Typeframe::CurrentPage()->applicationUri(), 1);
return;
}
示例12: foreach
<?php
/**
* Change the order of plugins in a socket.
*/
$typef_app_dir = Typeframe::CurrentPage()->applicationUri();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!isset($_POST['locid']) || !is_array($_POST['locid'])) {
Typeframe::Redirect('Invalid socket plugin ids.', $typef_app_dir);
} else {
$sortnum = 1;
foreach ($_POST['locid'] as $locid) {
$plugloc = Model_PlugLoc::Get($locid);
$plugloc->set('sortnum', $sortnum);
$plugloc->save();
++$sortnum;
}
Typeframe::Redirect('Plugins sorted.', $typef_app_dir);
}
} else {
Typeframe::Redirect('Nothing to do.', $typef_app_dir);
}
示例13: isset
<?php
/**
* Create a new plugin.
*/
Plugin_Breadcrumbs::Add('Add');
// save typing below
$typef_app_dir = Typeframe::CurrentPage()->applicationUri();
// process form
if ('POST' == $_SERVER['REQUEST_METHOD']) {
$plug = Model_Plug::Create();
$plug->set('plug', $_POST['plug']);
//$plug->set('settings', json_encode((isset($_POST['settings']) && is_array($_POST['settings'])) ? $_POST['settings'] : array()));
$plug->set('settings', isset($_POST['settings']) && is_array($_POST['settings']) ? $_POST['settings'] : array());
$plug['siteid'] = Typeframe::CurrentPage()->siteid();
$plug->save();
// done
$skin = isset($_REQUEST['skin']) ? "&skin={$_REQUEST['skin']}" : '';
Typeframe::Redirect('Plugin created.', "{$typef_app_dir}/edit?plugid=" . $plug->get('plugid') . $skin);
return;
}
// load plugins; add to template; sort by name
foreach (Typeframe::Registry()->plugins() as $plugin) {
$pm->addLoop('plugins', array('name' => $plugin->name()));
}
$pm->sortLoop('plugins', 'name');
示例14:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$master = Model_Site_Master::Create();
$master->setArray($_POST, false);
$master->save();
Typeframe::Redirect('Master created.', Typeframe::CurrentPage()->applicationUri() . '/masters/pages?masterid=' . $master['id']);
}
示例15: Form_Handler_User
<?php
$form = new Form_Handler_User(!$user->exists() || !empty($_POST['password']) ? true : false);
$form->validate();
$errors = $form->errors();
if ($errors) {
$pm->setVariable('errors', $errors);
$pm->setVariable('user', $form->input());
} else {
$user->setArray($_POST, false);
$user['password'] = $_POST['password'];
$user->save();
if (defined('TYPEF_HOST')) {
$sites = Model_User_Site::ForUserId($user['userid']);
$sites->deleteQuery();
if (!empty($_POST['admin_siteid'])) {
foreach ($_POST['admin_siteid'] as $siteid) {
$site = Model_User_Site::Create();
$site['userid'] = $user['userid'];
$site['siteid'] = $siteid;
$site->save();
}
}
}
Typeframe::Redirect('User saved.', Typeframe::CurrentPage()->applicationUri());
}