本文整理匯總了PHP中ContentController::join_links方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentController::join_links方法的具體用法?PHP ContentController::join_links怎麽用?PHP ContentController::join_links使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ContentController
的用法示例。
在下文中一共展示了ContentController::join_links方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: submit
/**
* Save the changes to the form
*/
function submit($data, $form)
{
$bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
$member = Member::currentUser();
$newMember = false;
Session::set("FormInfo.Form_Form.data", $data);
$emailField = new EmailField("Email");
$emailField->setValue($data["Email"]);
if ($emailField) {
if (!$emailField->validate($form->validator)) {
$form->addErrorMessage("Blurb", $this->ErrorBadEmail, "bad");
$this->redirectBack();
return;
}
}
if (!$member) {
$newMember = true;
$member = Object::create('Member');
$form->sessionMessage($this->WelcomeTitle, 'good');
$id = 0;
} else {
$form->sessionMessage($this->ThankYouTitle, 'good');
$id = $member->ID;
}
//validation
if ($existingMember = Member::get()->filter(array("Email" => Convert::raw2sql($data['Email'])))->exclude(array("ID" => $id))->first()) {
$form->addErrorMessage("Blurb", $this->ErrorEmailAddressAlreadyExists, "bad");
return $this->redirectBack();
}
// check password fields are the same before saving
if ($data["Password"]["_Password"] != $data["Password"]["_ConfirmPassword"]) {
$form->addErrorMessage("Password", $this->ErrorPasswordDoNotMatch, "bad");
return $this->redirectBack();
}
if (!$id && !$data["Password"]["_Password"]) {
$form->addErrorMessage("Password", $this->ErrorMustSupplyPassword, "bad");
return $this->redirectBack();
}
$password = $member->Password;
if (isset($data["Password"]["Password"]) && strlen($data["Password"]["Password"]) > 3) {
$password = $data["Password"]["Password"];
}
$form->saveInto($member);
$member->changePassword($password);
$member->write();
if ($newMember) {
$form->saveInto($member);
$member->write();
}
//adding to group
$group = Group::get()->filter(array("Code" => self::$register_group_code))->first();
if ($group) {
$member->Groups()->add($group);
}
if ($newMember) {
$member->logIn();
$link = ContentController::join_links($this->Link(), 'welcome');
} else {
$link = ContentController::join_links($this->Link(), 'thanks');
}
if (!isset($_REQUEST["BackURL"]) && Session::get('BackURL')) {
$_REQUEST["BackURL"] = Session::get('BackURL');
}
if (isset($_REQUEST["BackURL"])) {
$link = urldecode($_REQUEST["BackURL"]);
Session::set('BackURL', '');
}
if ($link) {
return $this->redirect($link);
}
return array();
}