当前位置: 首页>>代码示例>>PHP>>正文


PHP Contacts::tokenExists方法代码示例

本文整理汇总了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());
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:16,代码来源:Contact.class.php

示例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;
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:30,代码来源:FeedController.class.php


注:本文中的Contacts::tokenExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。