本文整理汇总了PHP中kString::verifyExpiryHash方法的典型用法代码示例。如果您正苦于以下问题:PHP kString::verifyExpiryHash方法的具体用法?PHP kString::verifyExpiryHash怎么用?PHP kString::verifyExpiryHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kString
的用法示例。
在下文中一共展示了kString::verifyExpiryHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: blockEmail
public static function blockEmail($email_str, $should_update_db = true)
{
$params = explode(self::SEPARATOR, $email_str);
$email = @$params[0];
$email_hash = @$params[1];
$valid = kString::verifyExpiryHash($email, self::$key, $email_hash, self::EXPIRY_INTERVAL);
if ($valid) {
if ($should_update_db) {
try {
$blocked_email = new blockedEmail();
$blocked_email->setEmail($email);
$blocked_email->save();
} catch (PropelException $pe) {
// already exists - think it's better than to query the DB every time to see if the object exists or not
// before updating it
}
}
} else {
// hashing is wrong !
}
return $valid;
}
示例2: array
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$page_size = $pageSize > self::MAX_PAGE_SIZE ? self::MAX_PAGE_SIZE : $pageSize;
$status = "ok";
$message = '';
// this is a silly hack until we change the interface to work with an input container rather than the request
// TODO - replace !
$_REQUEST["keywords"] = $searchText;
// TODO - remove -see the comment above the __construct() funciton
$clzz = self::$s_clazz;
//get_class ();
$service = new $clzz();
$entry_filter = $service->getEntryFilter($extraData);
$map = array("page" => $page, "keywords" => $searchText);
// this container will
$generic_container = new myGenericContainer($map);
$entry_pager = new mySmartPager($generic_container, "entry", $page_size);
// this bellow will bypass the partner filter - at the end of the code the filter will return to be as was before
// don't filter by partner
$criteria = entryPeer::getCriteriaFilter()->getFilter();
$original_partner_to_filter = $criteria->get(entryPeer::PARTNER_ID);
$criteria->remove(entryPeer::PARTNER_ID);
// filter: allow only entries of status READY !
$criteria->addAnd(entryPeer::STATUS, entryStatus::READY);
$act = new AJAX_getEntriesAction();
$act->setIdList(NULL);
$act->setSortAlias("ids");
$act->skip_count = true;
// $kaltura_media_type = self::getKalturaMediaType ( $media_type );
$act->setMediaType($media_type);
$fetch = true;
if ($authData != null) {
list($kuser_id, $hash) = explode("I", $authData);
$fetch = false;
$hash_res = kString::verifyExpiryHash($kuser_id, self::AUTH_SALT, $hash, self::AUTH_INTERVAL);
if (0 < $hash_res) {
$fetch = true;
$act->setOnlyForKuser($kuser_id);
}
if (!$fetch) {
$status = "error";
$message = "invalid authentication data";
}
} else {
$act->setPublicOnly(true);
}
if ($fetch) {
$entry_results = $act->fetchPage($generic_container, $entry_filter, $entry_pager);
} else {
$entry_results = array();
}
// after the query - return the filter to what it was before
$criteria->addAnd(entryPeer::PARTNER_ID, $original_partner_to_filter);
$number_of_results = $entry_pager->getNumberOfResults();
$number_of_pages = $entry_pager->getNumberOfPages();
$objects = array();
// add thumbs when not image or video
$should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
foreach ($entry_results as $entry) {
/* @var $entry entry */
// use the id as the url - it will help using this entry id in addentry
$object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription(), "flash_playback_type" => $entry->getMediaTypeName());
if ($should_add_thumbs) {
$object["thumb"] = $entry->getThumbnailUrl();
}
$objects[] = $object;
}
return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}