class OC_Core_LostPassword_Controller {
protected static function displayLostPasswordPage($error, $requested) {
- OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => $error, 'requested' => $requested));
+ OC_Template::printGuestPage('core/lostpassword', 'lostpassword',
+ array('error' => $error, 'requested' => $requested));
}
protected static function displayResetPasswordPage($success, $args) {
$route_args = array();
$route_args['token'] = $args['token'];
$route_args['user'] = $args['user'];
- OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => $success, 'args' => $route_args));
+ OC_Template::printGuestPage('core/lostpassword', 'resetpassword',
+ array('success' => $success, 'args' => $route_args));
}
protected static function checkToken($user, $token) {
public static function sendEmail($args) {
if (OC_User::userExists($_POST['user'])) {
$token = hash('sha256', OC_Util::generate_random_bytes(30).OC_Config::getValue('passwordsalt', ''));
- OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token)); // Hash the token again to prevent timing attacks
+ OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword',
+ hash('sha256', $token)); // Hash the token again to prevent timing attacks
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
- $link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
+ $link = OC_Helper::linkToRoute('core_lostpassword_reset',
+ array('user' => $_POST['user'], 'token' => $token));
$link = OC_Helper::makeURLAbsolute($link);
$tmpl = new OC_Template('core/lostpassword', 'email');
$format = $parameters['format'];
$login = OC_OCS::readData('post', 'login', 'text');
$passwd = OC_OCS::readData('post', 'password', 'text');
- OC_OCS::personCheck($format,$login,$passwd);
- })
+ OC_OCS::personCheck($format, $login, $passwd);
+ })
->requirements(array('format'=>'xml|json'));
// ACTIVITY
$pagesize = OC_OCS::readData('get', 'pagesize', 'int', 10);
if($pagesize<1 or $pagesize>100) $pagesize=10;
OC_OCS::activityGet($format, $page, $pagesize);
- })
+ })
->requirements(array('format'=>'xml|json'));
// activityput - POST ACTIVITY
$router->create('activity_put', '/activity.{format}')
->action(function ($parameters) {
$format = $parameters['format'];
$message = OC_OCS::readData('post', 'message', 'text');
- OC_OCS::activityPut($format,$message);
- })
+ OC_OCS::activityPut($format, $message);
+ })
->requirements(array('format'=>'xml|json'));
// PRIVATEDATA
$app = addslashes(strip_tags($parameters['app']));
$key = addslashes(strip_tags($parameters['key']));
OC_OCS::privateDataGet($format, $app, $key);
- })
+ })
->requirements(array('format'=>'xml|json'));
// set - POST DATA
$router->create('privatedata_set',
$key = addslashes(strip_tags($parameters['key']));
$value=OC_OCS::readData('post', 'value', 'text');
OC_OCS::privateDataSet($format, $app, $key, $value);
- })
+ })
->requirements(array('format'=>'xml|json'));
// delete - POST DATA
$router->create('privatedata_delete',
$app = addslashes(strip_tags($parameters['app']));
$key = addslashes(strip_tags($parameters['key']));
OC_OCS::privateDataDelete($format, $app, $key);
- })
+ })
->requirements(array('format'=>'xml|json'));
// CLOUD
->action(function ($parameters) {
$format = $parameters['format'];
OC_OCS::systemwebapps($format);
- })
+ })
->requirements(array('format'=>'xml|json'));
// quotaget
$format = $parameters['format'];
$user = $parameters['user'];
OC_OCS::quotaGet($format, $user);
- })
+ })
->requirements(array('format'=>'xml|json'));
// quotaset
$router->create('quota_set',
$user = $parameters['user'];
$quota = self::readData('post', 'quota', 'int');
OC_OCS::quotaSet($format, $user, $quota);
- })
+ })
->requirements(array('format'=>'xml|json'));
// keygetpublic
->action(function ($parameters) {
$format = $parameters['format'];
$user = $parameters['user'];
- OC_OCS::publicKeyGet($format,$user);
- })
+ OC_OCS::publicKeyGet($format, $user);
+ })
->requirements(array('format'=>'xml|json'));
// keygetprivate
->action(function ($parameters) {
$format = $parameters['format'];
$user = $parameters['user'];
- OC_OCS::privateKeyGet($format,$user);
- })
+ OC_OCS::privateKeyGet($format, $user);
+ })
->requirements(array('format'=>'xml|json'));
try {
$router->match($_SERVER['PATH_INFO']);
} catch (ResourceNotFoundException $e) {
- $txt='Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n";
+ $txt='Invalid query, please check the syntax. '
+ .'API specifications are here: '
+ .'http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'
+ .'DEBUG OUTPUT:'."\n";
$txt.=OC_OCS::getdebugoutput();
echo(OC_OCS::generatexml($format, 'failed', 999, $txt));
} catch (MethodNotAllowedException $e) {
* @param int $itemsperpage
* @return string xml/json
*/
- private static function generateXml($format,$status,$statuscode,$message,$data=array(),$tag='',$tagattribute='',$dimension=-1,$itemscount='',$itemsperpage='') {
+ private static function generateXml($format, $status, $statuscode, $message, $data=array(), $tag='', $tagattribute='', $dimension=-1, $itemscount='', $itemsperpage='') {
if($format=='json') {
$json=array();
$json['status']=$status;
xmlwriter_write_element($writer, 'status', $status);
xmlwriter_write_element($writer, 'statuscode', $statuscode);
xmlwriter_write_element($writer, 'message', $message);
- if($itemscount<>'') xmlwriter_write_element($writer,'totalitems',$itemscount);
+ if($itemscount<>'') xmlwriter_write_element($writer, 'totalitems', $itemscount);
if(!empty($itemsperpage)) xmlwriter_write_element($writer, 'itemsperpage', $itemsperpage);
xmlwriter_end_element($writer);
if($dimension=='0') {
xmlwriter_end_element($writer);
}elseif($dimension=='2') {
- xmlwriter_start_element($writer,'data');
+ xmlwriter_start_element($writer, 'data');
foreach($data as $entry) {
xmlwriter_start_element($writer, $tag);
if(!empty($tagattribute)) {
}
}
- public static function toXml($writer,$data,$node) {
+ public static function toXml($writer, $data, $node) {
foreach($data as $key => $value) {
if (is_numeric($key)) {
$key = $node;
}
if (is_array($value)) {
xmlwriter_start_element($writer, $key);
- OC_OCS::toxml($writer,$value, $node);
+ OC_OCS::toxml($writer, $value, $node);
xmlwriter_end_element($writer);
}else{
xmlwriter_write_element($writer, $key, $value);
* @param string $passwd
* @return string xml/json
*/
- private static function personCheck($format,$login,$passwd) {
+ private static function personCheck($format, $login, $passwd) {
if($login<>'') {
if(OC_User::login($login, $passwd)) {
$xml['person']['personid']=$login;
//TODO
- $txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'activity', 'full', 2, $totalcount,$pagesize);
+ $txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'activity', 'full', 2, $totalcount, $pagesize);
echo($txt);
}
* @param string $message
* @return string xml/json
*/
- private static function activityPut($format,$message) {
+ private static function activityPut($format, $message) {
// not implemented in ownCloud
$user=OC_OCS::checkpassword();
echo(OC_OCS::generatexml($format, 'ok', 100, ''));
foreach($apps as $app) {
$info=OC_App::getAppInfo($app);
if(isset($info['standalone'])) {
- $newvalue=array('name'=>$info['name'],'url'=>OC_Helper::linkToAbsolute($app,''),'icon'=>'');
+ $newvalue=array('name'=>$info['name'], 'url'=>OC_Helper::linkToAbsolute($app, ''), 'icon'=>'');
$values[]=$newvalue;
}
* @param string $user
* @return string xml/json
*/
- private static function quotaGet($format,$user) {
+ private static function quotaGet($format, $user) {
$login=OC_OCS::checkpassword();
if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {
* @param string $quota
* @return string xml/json
*/
- private static function quotaSet($format,$user,$quota) {
+ private static function quotaSet($format, $user, $quota) {
$login=OC_OCS::checkpassword();
if(OC_Group::inGroup($login, 'admin')) {
* @param string $user
* @return string xml/json
*/
- private static function publicKeyGet($format,$user) {
+ private static function publicKeyGet($format, $user) {
$login=OC_OCS::checkpassword();
if(OC_User::userExists($user)) {
* @param string $user
* @return string xml/json
*/
- private static function privateKeyGet($format,$user) {
+ private static function privateKeyGet($format, $user) {
$login=OC_OCS::checkpassword();
if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {