本文整理匯總了PHP中OCP\Share::checkPasswordProtectedShare方法的典型用法代碼示例。如果您正苦於以下問題:PHP Share::checkPasswordProtectedShare方法的具體用法?PHP Share::checkPasswordProtectedShare怎麽用?PHP Share::checkPasswordProtectedShare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCP\Share
的用法示例。
在下文中一共展示了Share::checkPasswordProtectedShare方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getShareByToken
/**
* Based on the given token the share information will be returned - password protected shares will be verified
* @param string $token
* @param bool $checkPasswordProtection
* @return array|boolean false will be returned in case the token is unknown or unauthorized
*/
public static function getShareByToken($token, $checkPasswordProtection = true)
{
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
$result = $query->execute(array($token));
if (\OC_DB::isError($result)) {
\OCP\Util::writeLog('OCP\\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
}
$row = $result->fetchRow();
if ($row === false) {
return false;
}
if (is_array($row) and self::expireItem($row)) {
return false;
}
// password protected shares need to be authenticated
if ($checkPasswordProtection && !\OCP\Share::checkPasswordProtectedShare($row)) {
return false;
}
return $row;
}
示例2: testCheckPasswordProtectedShare
/**
* @dataProvider checkPasswordProtectedShareDataProvider
* @param $expected
* @param $item
*/
public function testCheckPasswordProtectedShare($expected, $item)
{
\OC::$server->getSession()->set('public_link_authenticated', '100');
$result = \OCP\Share::checkPasswordProtectedShare($item);
$this->assertEquals($expected, $result);
}