Cosmetic updates
This commit is contained in:
parent
6b8163748d
commit
51274920e1
1 changed files with 16 additions and 33 deletions
|
@ -316,11 +316,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
$observed_csrf_token = $token;
|
$observed_csrf_token = $token;
|
||||||
$expected_csrf_token = $current_namespace->authtoken;
|
$expected_csrf_token = $current_namespace->authtoken;
|
||||||
|
|
||||||
if($observed_csrf_token == $expected_csrf_token){
|
return ($observed_csrf_token === $expected_csrf_token);
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function verifyAuth($checkApiKey, $checkSession)
|
private function verifyAuth($checkApiKey, $checkSession)
|
||||||
|
@ -331,7 +327,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
if(!$this->verifyCSRFToken($this->_getParam('csrf_token'))){
|
if(!$this->verifyCSRFToken($this->_getParam('csrf_token'))){
|
||||||
$resp = $this->getResponse();
|
$resp = $this->getResponse();
|
||||||
$resp->setHttpResponseCode(401);
|
$resp->setHttpResponseCode(401);
|
||||||
$resp->appendBody("ERROR: Token Missmatch.");
|
$resp->appendBody("ERROR: Token Mismatch.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -361,24 +357,13 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
$encodedRequestApiKey = substr($authHeader, strlen("Basic "));
|
$encodedRequestApiKey = substr($authHeader, strlen("Basic "));
|
||||||
$encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":");
|
$encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":");
|
||||||
|
|
||||||
if ($encodedRequestApiKey === $encodedStoredApiKey)
|
return ($encodedRequestApiKey === $encodedStoredApiKey);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function verifySession()
|
private function verifySession()
|
||||||
{
|
{
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = Zend_Auth::getInstance();
|
||||||
if ($auth->hasIdentity())
|
return ($auth->hasIdentity());
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//Token checking stub code. We'd need to change LoginController.php to generate a token too, but
|
//Token checking stub code. We'd need to change LoginController.php to generate a token too, but
|
||||||
//but luckily all the token code already exists and works.
|
//but luckily all the token code already exists and works.
|
||||||
|
@ -488,7 +473,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
return $service_user->getCurrentUser()->getDbId();
|
return $service_user->getCurrentUser()->getDbId();
|
||||||
} else {
|
} else {
|
||||||
$defaultOwner = CcSubjsQuery::create()
|
$defaultOwner = CcSubjsQuery::create()
|
||||||
->filterByDbType('A')
|
->filterByDbType(array('A', 'S'), Criteria::IN)
|
||||||
->orderByDbId()
|
->orderByDbId()
|
||||||
->findOne();
|
->findOne();
|
||||||
if (!$defaultOwner) {
|
if (!$defaultOwner) {
|
||||||
|
@ -507,10 +492,10 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
*
|
*
|
||||||
* Strips out fields from incoming request data that should never be modified
|
* Strips out fields from incoming request data that should never be modified
|
||||||
* from outside of Airtime
|
* from outside of Airtime
|
||||||
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
private static function removeBlacklistedFieldsFromRequestData($data)
|
private static function removeBlacklistedFieldsFromRequestData($data) {
|
||||||
{
|
|
||||||
foreach (self::$blackList as $key) {
|
foreach (self::$blackList as $key) {
|
||||||
unset($data[$key]);
|
unset($data[$key]);
|
||||||
}
|
}
|
||||||
|
@ -518,9 +503,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function removeEmptySubFolders($path) {
|
||||||
private function removeEmptySubFolders($path)
|
|
||||||
{
|
|
||||||
exec("find $path -empty -type d -delete");
|
exec("find $path -empty -type d -delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue