本文整理汇总了PHP中MVCUtils::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP MVCUtils::redirect方法的具体用法?PHP MVCUtils::redirect怎么用?PHP MVCUtils::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MVCUtils
的用法示例。
在下文中一共展示了MVCUtils::redirect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processInvalid
protected function processInvalid()
{
//No invalid processing required
if ($this->errors['form']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpsuserdirmove.tpl'), array("rootdir" => $this->fieldData['dirID'], "error" => "form"));
} else {
MVCUtils::redirect(MVCUtils::getTemplateID('dpsuserdirmove.tpl'), array("rootdir" => $this->fieldData['dirID'], "error" => "perm"));
}
}
示例2: processInvalid
protected function processInvalid()
{
//No invalid processing required
if ($this->errors['text']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpssteditawitem.tpl'), array("awitemID" => $this->fieldData['awitemID'], "error" => "text"));
} elseif ($this->errors['style']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpssteditawitem.tpl'), array("awitemID" => $this->fieldData['awitemID'], "error" => "style"));
} elseif ($this->errors['audioID']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpssteditawitem.tpl'), array("awitemID" => $this->fieldData['awitemID'], "error" => "audioID"));
}
}
示例3: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$where = "id = " . pg_escape_string($this->fieldData['scriptID']);
$item['name'] = $this->fieldData['name'];
$item['contents'] = $this->fieldData['content'];
$item['length'] = 60 * $this->fieldData['mins'] + $this->fieldData['secs'];
$db->update('scripts', $item, $where, true);
if (isset($this->fieldData['Submit'])) {
MVCUtils::redirect(44);
}
}
示例4: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$sql = "SELECT COUNT(*) FROM showitems \n\t\t\tWHERE showplanid = " . $this->fieldData['showID'];
$pos = $db->getOne($sql);
$pos++;
$showitem['showplanid'] = $this->fieldData['showID'];
$showitem['position'] = $pos;
$showitem['title'] = 'New Item';
$showitem['length'] = 0;
$showitem['id'] = '#id#';
$itemID = $db->insert('showitems', $showitem, true);
MVCUtils::redirect("58", array("itemID" => $itemID));
}
示例5: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$userName = $auth->getUser();
$sql = "SELECT id FROM dir\n\t\t\t\tWHERE parent = " . $cfg['DPS']['userDirectoryID'] . "\n\t\t\t\tAND name = '" . $userName . "'";
$dirID = $db->getOne($sql);
if ($dirID == '') {
$newdir['name'] = $userName;
$newdir['parent'] = $cfg['DPS']['userDirectoryID'];
$newdir['id'] = '#id#';
$newdir['notes'] = $userName . "'s home directory";
$newdir['inherit'] = 'f';
$dirID = $db->insert('dir', $newdir, true);
$newperm['dirid'] = $dirID;
$newperm['userid'] = $userID;
$newperm['permissions'] = 'B' . $cfg['DPS']['fileRW'] . 'B';
$db->insert('dirusers', $newperm, false);
//for binary insert
$sql_gperm['dirid'] = $dirID;
$sql_gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$sql_gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$db->insert('dirgroups', $sql_gperm, false);
}
$newscript['name'] = "New Script";
$newscript['userid'] = $userID;
$newscript['creationdate'] = time();
$newscript['id'] = '#id#';
$newscript['length'] = 0;
$scriptID = $db->insert('scripts', $newscript, true);
$newsperm['scriptid'] = $scriptID;
$newsperm['userid'] = $userID;
$newsperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
//own
$db->insert('scriptsusers', $newsperm, false);
//for binary insert
$gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$gperm['scriptid'] = $scriptID;
$gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$db->insert('scriptsgroups', $gperm, false);
$scriptdir['scriptid'] = $scriptID;
$scriptdir['dirid'] = $dirID;
$scriptdir['linktype'] = 0;
$db->insert('scriptsdir', $scriptdir, true);
MVCUtils::redirect(45, array("scriptID" => $scriptID));
}
示例6: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$userName = $auth->getUser();
$sql = "SELECT id FROM dir \n\t\t\t\tWHERE parent = " . $cfg['DPS']['userDirectoryID'] . "\n\t\t\t\tAND name = '" . $userName . "'";
$dirID = $db->getOne($sql);
if ($dirID == '') {
$newdir['name'] = $userName;
$newdir['parent'] = $cfg['DPS']['userDirectoryID'];
$newdir['id'] = '#id#';
$newdir['notes'] = $userName . "'s home directory";
$newdir['inherit'] = 'f';
$dirID = $db->insert('dir', $newdir, true);
$newperm['dirid'] = $dirID;
$newperm['userid'] = $userID;
$newperm['permissions'] = 'B' . $cfg['DPS']['fileRW'] . 'B';
$db->insert('dirusers', $newperm, false);
//for binary
$sql_gperm['dirid'] = $dirID;
$sql_gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$sql_gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$db->insert('dirgroups', $sql_gperm, false);
}
$newshow['name'] = "New Show";
$newshow['userid'] = $userID;
$newshow['creationdate'] = time();
$newshow['showdate'] = mktime(date('H', time()), 0, 0) + 604800;
$newshow['completed'] = 'f';
$newshow['id'] = '#id#';
$showID = $db->insert('showplans', $newshow, true);
$newsperm['showplanid'] = $showID;
$newsperm['userid'] = $userID;
$newsperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$db->insert('showplansusers', $newsperm, false);
//for binary
$gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$gperm['showplanid'] = $showID;
$gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$db->insert('showplansgroups', $gperm, false);
$showdir['showplanid'] = $showID;
$showdir['dirid'] = $dirID;
$showdir['linktype'] = 0;
$db->insert('showplansdir', $showdir, true);
MVCUtils::redirect("55", array("showID" => $showID));
}
示例7: processValid
protected function processValid()
{
global $cfg;
$auth = Auth::getInstance();
//If the fwtid (forward template id) variable is set, then set the
//templateID to that requested as long as the user has permission
BasicLogger::logMessage("Checking access to requested template", 'debug');
if (isset($this->fieldData['fwdtid']) && $this->fieldData['fwdtid'] != '' && AuthUtil::templateAccessAllowed($this->fieldData['fwdtid'], $auth->getUserID())) {
BasicLogger::logMessage("Access granted, forwarding user to {$this->fieldData['fwdtid']}", 'debug');
MVCUtils::redirect($this->fieldData['fwdtid']);
//If the fwtid (forward template id) variable is not set, then set the
//templateID to that default as long as the user has permission
} elseif (!(isset($this->fieldData['fwdtid']) && $this->fieldData['fwdtid'] == '') && AuthUtil::templateAccessAllowed(MVCUtils::getTemplateID($cfg['smarty']['defaultTemplate']), $auth->getUserID())) {
BasicLogger::logMessage("Access granted, forwarding user to {$cfg['smarty']['defaultTemplate']}", 'debug');
MVCUtils::redirect(MVCUtils::getTemplateID($cfg['smarty']['defaultTemplate']));
//If all the above fails, show the user permission denied
} else {
BasicLogger::logMessage("Access denied", 'debug');
MVCUtils::redirect(MVCUtils::getTemplateID($cfg['Auth']['permissionErrorTemplate']));
}
/*//If the fwtid (forward template id) variable is set, then set the
//templateID to that requested as long as the user is allowed access.
if(isset($this->fieldData['fwdtid']) &&
$this->fieldData['fwdtid'] != '' &&
AuthUtil::templateAccessAllowed($this->fieldData['fwdtid'], $auth->getUserID())){
$this->templateID = $this->fieldData['fwdtid'];
//If now fwtid has not been set, then forward to the default template
//as long as the user is allowed access
}elseif((!isset($this->fieldData['fwdtid']) ||
$this->fieldData['fwdtid'] == '') &&
AuthUtil::templateAccessAllowed(MVCUtils::getTemplateID($cfg['smarty']['defaultTemplate']), $auth->getUserID())){
$this->templateID = MVCUtils::getTemplateID($cfg['smarty']['defaultTemplate']);
}*/
}
示例8: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['Auth']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$userName = $auth->getUser();
$sql = "SELECT usersconfigs.val, usersconfigs.id \n\t\t\tFROM configs, usersconfigs \n\t\t\tWHERE configs.id = usersconfigs.configid \n\t\t\tAND configs.name = 'user_curlogin' \n\t\t\tAND usersconfigs.userid = " . $userID;
$usercurlogin = $db->getRow($sql);
$sql = "SELECT usersconfigs.val, usersconfigs.id\n\t\t\tFROM configs, usersconfigs \n\t\t\tWHERE configs.id = usersconfigs.configid\n\t\t\tAND configs.name = 'user_lastlogin'\n\t\t\tAND usersconfigs.userid = " . $userID;
$userlastlogin = $db->getRow($sql);
$sql = "SELECT id FROM dir \n\t\t\tWHERE parent = " . $cfg['DPS']['userDirectoryID'] . " \n\t\t\tAND name = '" . $userName . "'";
$dirID = $db->getOne($sql);
if ($dirID == '') {
$newdir['name'] = $userName;
$newdir['parent'] = $cfg['DPS']['userDirectoryID'];
$newdir['id'] = '#id#';
$newdir['notes'] = $userName . "'s home directory";
$newdir['inherit'] = 'f';
$dirID = $db->insert('dir', $newdir, true);
$newperm['dirid'] = $dirID;
$newperm['userid'] = $userID;
$newperm['permissions'] = 'B' . $cfg['DPS']['fileRW'] . 'B';
$db->insert('dirusers', $newperm, false);
//false for binary insert
$sql_gperm['dirid'] = $dirID;
$sql_gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$sql_gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$db->insert('dirgroups', $sql_gperm, false);
}
if (is_null($userlastlogin) && !is_null($usercurlogin)) {
$awset = array();
$sql = "SELECT id FROM configs WHERE configs.name = 'user_lastlogin'";
$awset['configid'] = $db->getOne($sql);
$awset['val'] = $usercurlogin['val'];
$awset['userid'] = $userID;
$db->insert('usersconfigs', $awset, true);
} elseif (is_null($userlastlogin) && is_null($usercurlogin)) {
$awset = array();
$sql = "SELECT id FROM configs WHERE configs.name = 'user_lastlogin'";
$awset['configid'] = $db->getOne($sql);
$awset['val'] = time();
$awset['userid'] = $userID;
$db->insert('usersconfigs', $awset, true);
} elseif (!is_null($userlastlogin) && is_null($usercurlogin)) {
$logint = array();
$logint['val'] = time();
$atWhere = "id = " . $userlastlogin['id'];
$db->update('usersconfigs', $logint, $atWhere, true);
} else {
$logint = array();
$logint['val'] = $usercurlogin['val'];
$atWhere = "id = " . $userlastlogin['id'];
$db->update('usersconfigs', $logint, $atWhere, true);
}
if (is_null($usercurlogin)) {
$awset = array();
$sql = "SELECT id FROM configs WHERE configs.name = 'user_curlogin'";
$awset['configid'] = $db->getOne($sql);
$awset['val'] = time();
$awset['userid'] = $userID;
$db->insert('usersconfigs', $awset, true);
} else {
$logint = array();
$logint['val'] = time();
$atWhere = "id = " . $usercurlogin['id'];
$db->update('usersconfigs', $logint, $atWhere, true);
}
BasicLogger::logMessage("Checking access to requested template", 'debug');
if (isset($this->fieldData['fwdtid']) && $this->fieldData['fwdtid'] != '' && AuthUtil::templateAccessAllowed($this->fieldData['fwdtid'], $auth->getUserID())) {
BasicLogger::logMessage("Access granted, forwarding user to {$this->fieldData['fwdtid']}", 'debug');
MVCUtils::redirect($this->fieldData['fwdtid']);
//If the fwtid (forward template id) variable is not set, then set the
//templateID to that default as long as the user has permission
} elseif (!(isset($this->fieldData['fwdtid']) && $this->fieldData['fwdtid'] == '') && AuthUtil::templateAccessAllowed(MVCUtils::getTemplateID($cfg['smarty']['defaultTemplate']), $auth->getUserID())) {
BasicLogger::logMessage("Access granted, forwarding user to {$cfg['smarty']['defaultTemplate']}", 'debug');
MVCUtils::redirect(MVCUtils::getTemplateID($cfg['smarty']['defaultTemplate']));
//If all the above fails, show the user permission denied
} else {
BasicLogger::logMessage("Access denied", 'debug');
MVCUtils::redirect(MVCUtils::getTemplateID($cfg['Auth']['permissionErrorTemplate']));
}
}
示例9: processInvalid
protected function processInvalid()
{
//No invalid processing required
MVCUtils::redirect(MVCUtils::getTemplateID('dpsuseraudiomove.tpl'), array("audioID" => $this->fieldData['audioID'], "error" => "perm"));
}
示例10: requireRealm
/**
* Require access to a realm
*
* This method will ensure that the current user has access to the
* specified realm before continuing. If the user does not have
* permission, then the permission error template will be initialised
* and exit() called immediatly afterwards.
*
* @param int $realmID The ID of the realm for which access is required
* @return boolean True if access is allowed. Program flow does not contine otherwise
*
*/
public static function requireRealm($realmID)
{
global $cfg;
$auth = Auth::getInstance();
$uid = $auth->getUserID();
$realmPath = AuthUtil::getRealmPath($realmID);
if (AuthUtil::getDetailedUserrealmAccess($realmPath, $uid)) {
return true;
} else {
$permissionErrorTemplateID = MVCUtils::getPermErrorTemplateID();
//$error = array('permission' => 'You do not have permission to perform this action');
//MVCUtils::initializeViewer(array($permissionErrorTemplateID), null, $cfg['Auth']['permissionErrorTemplateModule'], null, $error);
MVCUtils::redirect($permissionErrorTemplateID);
}
exit(1);
}