本文整理汇总了PHP中Sanitize::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::sql方法的具体用法?PHP Sanitize::sql怎么用?PHP Sanitize::sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sanitize
的用法示例。
在下文中一共展示了Sanitize::sql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
function edit()
{
if (!isset($_SESSION['User'])) {
$this->redirect('/users/login');
}
$this->set('error', false);
$this->pageTitle = 'Edit My Account';
if (empty($this->data)) {
$this->User->id = $_SESSION['User']['id'];
$this->data = $this->User->read();
$this->data['User']['password'] = "";
$this->set('utz', $this->data['User']['tz']);
$this->data['User']['name'] = preg_replace("/&#(\\d{2,5});/e", '$this->Unicode->unicode2utf(${1})', html_entity_decode($this->data['User']['name']));
$this->data['User']['website'] = preg_replace("/&#(\\d{2,5});/e", '$this->Unicode->unicode2utf(${1})', html_entity_decode($this->data['User']['website']));
$this->data['User']['location'] = preg_replace("/&#(\\d{2,5});/e", '$this->Unicode->unicode2utf(${1})', html_entity_decode($this->data['User']['location']));
if (GMAP_API_KEY != null) {
if ($this->data['User']['lat']) {
$this->set('map', 'mapInit(' . $this->data['User']['lat'] . ',' . $this->data['User']['long'] . ',' . $this->data['User']['zoom'] . ')');
} else {
$this->set('map', 'mapInit()');
}
}
} else {
$user = $this->User->findById($_SESSION['User']['id']);
$this->User->id = $user['User']['id'];
$this->set('utz', $user['User']['tz']);
$clean = new Sanitize();
$temp = array('password' => $this->data['User']['password'], 'confpassword' => $this->data['User']['confpassword'], 'lat' => $clean->sql($this->data['User']['lat']), 'long' => $clean->sql($this->data['User']['long']), 'tz' => $clean->sql($this->data['User']['tz']));
//Nuke everything else
$clean->cleanArray($this->data);
$this->data['User']['email'] = $user['User']['email'];
$this->data['User']['password'] = $temp['password'];
$this->data['User']['confpassword'] = $temp['confpassword'];
$this->data['User']['lat'] = floatval($temp['lat']);
$this->data['User']['long'] = floatval($temp['long']);
$this->data['User']['tz'] = intval($temp['tz']);
$this->data['User']['role'] = $user['User']['role'];
if (!preg_match("/^(http|https)\\:\\/\\//i", $this->data['User']['website']) && !empty($this->data['User']['website'])) {
$this->User->invalidate('website');
}
if ($this->data['User']['password'] === $this->data['User']['confpassword'] && !empty($this->data['User']['password'])) {
$pass = $this->Hash->password($this->data['User']['password'], $user['User']['email']);
$this->data['User']['password'] = $pass['pass'];
$this->data['User']['salt'] = $pass['salt'];
} else {
if (empty($this->data['User']['password']) && empty($this->data['User']['confpassword'])) {
$this->data['User']['password'] = $user['User']['password'];
$this->data['User']['salt'] = $user['User']['salt'];
} else {
$this->set('error', true);
$this->User->invalidate('password');
$this->User->invalidate('confpassword');
}
}
if ($this->User->validates($this->data)) {
if ($this->User->save($this->data)) {
$sess = $this->User->findById($user['User']['id']);
$this->redirect('/users/');
}
} else {
$this->validateErrors($this->User);
$this->data['User']['password'] = null;
$this->data['User']['confpassword'] = null;
$this->render();
}
}
}
示例2: invited
function invited($icode = null, $conf = null)
{
$this->pageTitle = "Confirm Invite";
if ($icode == 'cancel') {
$this->Session->delete('invite');
$this->Session->delete('invitestep');
$this->redirect('/');
} else {
$clean = new Sanitize();
$icode = $clean->sql($icode);
$party = $this->Party->findByInvitecode($icode);
if (empty($party['Party']['id'])) {
$this->Session->setFlash('Could not find a party matching that invite code, please check it and try again.', 'errorFlash');
} else {
if (!empty($_SESSION['User']['id']) && !empty($_SESSION['invitestep']) && $conf == 'confirm') {
$this->Party->addGuest($_SESSION['User']['id'], $_SESSION['invite']);
$this->Session->setFlash('You have been successfully added to this party.', 'infoFlash');
$this->redirect('/parties/view/' . $party['Party']['id']);
} else {
if (!empty($_SESSION['User']['id'])) {
$this->set('confirm_only', true);
$this->set('party', $party);
$this->set('icode', $icode);
$this->Session->write('invitestep', 'true');
$this->Session->write('invite', $icode);
} else {
$this->Session->write('invite', $icode);
$this->set('party', $party);
$this->set('icode', $icode);
}
}
}
}
}