本文整理汇总了PHP中Contacts::tokenExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::tokenExists方法的具体用法?PHP Contacts::tokenExists怎么用?PHP Contacts::tokenExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contacts
的用法示例。
在下文中一共展示了Contacts::tokenExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPassword
/**
* Set password value
*
* @param string $value
* @return boolean
*/
function setPassword($value)
{
do {
$salt = substr(sha1(uniqid(rand(), true)), rand(0, 25), 13);
$token = sha1($salt . $value);
} while (Contacts::tokenExists($token));
$this->setToken($token);
$this->setSalt($salt);
$this->setTwister(StringTwister::getTwister());
}
示例2: ical_export
function ical_export()
{
$this->setLayout('ical');
require_once ROOT . '/environment/classes/event/CalFormatUtilities.php';
if (!isset($_GET['t']) || !isset($_GET['cal'])) {
header('HTTP/1.0 404 Not Found');
die;
}
$token = $_GET['t'];
$cal = $_GET['cal'];
if (Contacts::tokenExists($token)) {
$user = Contacts::findOne(array('conditions' => "token='{$token}'"));
$conditions = " AND EXISTS (SELECT i.contact_id FROM " . TABLE_PREFIX . "event_invitations i WHERE i.event_id=e.object_id AND i.contact_id=" . $user->getId() . ")";
if (array_var($_GET, 'cal') != "") {
$mem_cond = "e.object_id IN (SELECT object_id FROM " . TABLE_PREFIX . "object_members WHERE member_id IN (" . array_var($_GET, 'cal') . "))";
} else {
$mem_cond = "true";
}
$user_pgs = $user->getPermissionGroupIds();
$perm_cond = " AND EXISTS (SELECT st.object_id FROM " . TABLE_PREFIX . "sharing_table st WHERE st.object_id=e.object_id AND st.group_id IN (" . implode(',', $user_pgs) . "))";
$events = ProjectEvents::findAll(array('conditions' => "{$mem_cond} {$perm_cond} {$conditions}"));
$calendar_name = isset($_GET['n']) ? $_GET['n'] : $user->getObjectName();
$calendar_name = str_replace(' ', '_', $calendar_name);
$content = CalFormatUtilities::generateICalInfo($events, $calendar_name, $user);
tpl_assign('content', $content);
} else {
header('HTTP/1.0 404 Not Found');
die;
}
}