Some more PHPDoc fixes

This commit is contained in:
Lukas Reschke 2014-04-21 15:44:54 +02:00
parent 4fe5ca1908
commit e88731a477
31 changed files with 243 additions and 127 deletions

View File

@ -122,7 +122,7 @@ class Controller {
// Protect data directory here, so we can test if the protection is working // Protect data directory here, so we can test if the protection is working
\OC_Setup::protectDataDirectory(); \OC_Setup::protectDataDirectory();
try { try {
$htaccessWorking = \OC_Util::isHtAccessWorking(); $htaccessWorking = \OC_Util::isHtaccessWorking();
} catch (\OC\HintException $e) { } catch (\OC\HintException $e) {
$errors[] = array( $errors[] = array(
'error' => $e->getMessage(), 'error' => $e->getMessage(),

View File

@ -185,7 +185,6 @@ class OC {
if (file_exists(self::$configDir . "/config.php") if (file_exists(self::$configDir . "/config.php")
and !is_writable(self::$configDir . "/config.php") and !is_writable(self::$configDir . "/config.php")
) { ) {
$defaults = new OC_Defaults();
if (self::$CLI) { if (self::$CLI) {
echo "Can't write into config directory!\n"; echo "Can't write into config directory!\n";
echo "This can usually be fixed by giving the webserver write access to the config directory\n"; echo "This can usually be fixed by giving the webserver write access to the config directory\n";
@ -305,6 +304,11 @@ class OC {
} }
} }
/**
* Checks if the version requires an update and shows
* @param bool $showTemplate Whether an update screen should get shown
* @return bool|void
*/
public static function checkUpgrade($showTemplate = true) { public static function checkUpgrade($showTemplate = true) {
if (self::needUpgrade()) { if (self::needUpgrade()) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) { if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
@ -799,6 +803,11 @@ class OC {
self::handleLogin(); self::handleLogin();
} }
/**
* Load a PHP file belonging to the specified application
* @param array $param The application and file to load
* @return bool Whether the file has been found (will return 404 and false if not)
*/
public static function loadAppScriptFile($param) { public static function loadAppScriptFile($param) {
OC_App::loadApps(); OC_App::loadApps();
$app = $param['app']; $app = $param['app'];
@ -841,6 +850,10 @@ class OC {
OC_Util::displayLoginPage(array_unique($error)); OC_Util::displayLoginPage(array_unique($error));
} }
/**
* Remove outdated and therefore invalid tokens for a user
* @param string $user
*/
protected static function cleanupLoginTokens($user) { protected static function cleanupLoginTokens($user) {
$cutoff = time() - OC_Config::getValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); $cutoff = time() - OC_Config::getValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
$tokens = OC_Preferences::getKeys($user, 'login_token'); $tokens = OC_Preferences::getKeys($user, 'login_token');
@ -852,6 +865,10 @@ class OC {
} }
} }
/**
* Try to login a user via HTTP authentication
* @return bool|void
*/
protected static function tryApacheAuth() { protected static function tryApacheAuth() {
$return = OC_User::handleApacheAuth(); $return = OC_User::handleApacheAuth();
@ -866,6 +883,10 @@ class OC {
return is_null($return) ? false : true; return is_null($return) ? false : true;
} }
/**
* Try to login a user using the remember me cookie.
* @return bool Whether the provided cookie was valid
*/
protected static function tryRememberLogin() { protected static function tryRememberLogin() {
if (!isset($_COOKIE["oc_remember_login"]) if (!isset($_COOKIE["oc_remember_login"])
|| !isset($_COOKIE["oc_token"]) || !isset($_COOKIE["oc_token"])
@ -907,6 +928,10 @@ class OC {
return true; return true;
} }
/**
* Tries to login a user using the formbased authentication
* @return bool|void
*/
protected static function tryFormLogin() { protected static function tryFormLogin() {
if (!isset($_POST["user"]) || !isset($_POST['password'])) { if (!isset($_POST["user"]) || !isset($_POST['password'])) {
return false; return false;
@ -941,6 +966,10 @@ class OC {
return true; return true;
} }
/**
* Try to login a user using HTTP authentication.
* @return bool
*/
protected static function tryBasicAuthLogin() { protected static function tryBasicAuthLogin() {
if (!isset($_SERVER["PHP_AUTH_USER"]) if (!isset($_SERVER["PHP_AUTH_USER"])
|| !isset($_SERVER["PHP_AUTH_PW"]) || !isset($_SERVER["PHP_AUTH_PW"])
@ -959,6 +988,10 @@ class OC {
} }
if (!function_exists('get_temp_dir')) { if (!function_exists('get_temp_dir')) {
/**
* Get the temporary dir to store uploaded data
* @return null|string Path to the temporary directory or null
*/
function get_temp_dir() { function get_temp_dir() {
if ($temp = ini_get('upload_tmp_dir')) return $temp; if ($temp = ini_get('upload_tmp_dir')) return $temp;
if ($temp = getenv('TMP')) return $temp; if ($temp = getenv('TMP')) return $temp;

View File

@ -46,7 +46,7 @@ class ActivityManager implements IManager {
$type, $type,
$priority); $priority);
} catch (\Exception $ex) { } catch (\Exception $ex) {
// TODO: log the excepetion // TODO: log the exception
} }
} }

View File

@ -127,9 +127,9 @@ class OC_API {
/** /**
* merge the returned result objects into one response * merge the returned result objects into one response
* @param array $responses * @param array $responses
* @return array|\OC_OCS_Result
*/ */
public static function mergeResponses($responses) { public static function mergeResponses($responses) {
$response = array();
// Sort into shipped and thirdparty // Sort into shipped and thirdparty
$shipped = array( $shipped = array(
'succeeded' => array(), 'succeeded' => array(),
@ -191,7 +191,7 @@ class OC_API {
// Merge the successful responses // Merge the successful responses
$data = array(); $data = array();
foreach($responses as $app => $response) { foreach($responses as $response) {
if($response['shipped']) { if($response['shipped']) {
$data = array_merge_recursive($response['response']->getData(), $data); $data = array_merge_recursive($response['response']->getData(), $data);
} else { } else {

View File

@ -568,7 +568,7 @@ class OC_App{
/** /**
* @brief Returns the navigation * @brief Returns the navigation
* @return string * @return array
* *
* This function returns an array containing all entries added. The * This function returns an array containing all entries added. The
* entries are sorted by the key 'order' ascending. Additional to the keys * entries are sorted by the key 'order' ascending. Additional to the keys

View File

@ -71,6 +71,7 @@ class AppConfig implements \OCP\IAppConfig {
/** /**
* @param string $app * @param string $app
* @return \string[]
*/ */
private function getAppValues($app) { private function getAppValues($app) {
$appCache = $this->getAppCache($app); $appCache = $this->getAppCache($app);

View File

@ -10,7 +10,7 @@ abstract class OC_Archive{
/** /**
* open any of the supported archive types * open any of the supported archive types
* @param string $path * @param string $path
* @return OC_Archive * @return OC_Archive|void
*/ */
public static function open($path) { public static function open($path) {
$ext=substr($path, strrpos($path, '.')); $ext=substr($path, strrpos($path, '.'));
@ -29,6 +29,9 @@ abstract class OC_Archive{
} }
} }
/**
* @param $source
*/
abstract function __construct($source); abstract function __construct($source);
/** /**
* add an empty folder to the archive * add an empty folder to the archive
@ -39,7 +42,7 @@ abstract class OC_Archive{
/** /**
* add a file to the archive * add a file to the archive
* @param string $path * @param string $path
* @param string source either a local file or string data * @param string $source either a local file or string data
* @return bool * @return bool
*/ */
abstract function addFile($path, $source=''); abstract function addFile($path, $source='');

View File

@ -32,6 +32,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return array|bool|int|null|string
*/ */
function parsePHP($string) { function parsePHP($string) {
$string = $this->stripPHPTags($string); $string = $this->stripPHPTags($string);
@ -41,6 +42,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return string
*/ */
function stripPHPTags($string) { function stripPHPTags($string) {
$string = trim($string); $string = trim($string);
@ -55,6 +57,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return string
*/ */
function stripAssignAndReturn($string) { function stripAssignAndReturn($string) {
$string = trim($string); $string = trim($string);
@ -67,6 +70,10 @@ class ArrayParser {
return $string; return $string;
} }
/**
* @param string $string
* @return array|bool|int|null|string
*/
function parse($string) { function parse($string) {
$string = trim($string); $string = trim($string);
$string = trim($string, ';'); $string = trim($string, ';');
@ -85,6 +92,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return int
*/ */
function getType($string) { function getType($string) {
$string = strtolower($string); $string = strtolower($string);
@ -104,6 +112,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return string
*/ */
function parseString($string) { function parseString($string) {
return substr($string, 1, -1); return substr($string, 1, -1);
@ -111,6 +120,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return int
*/ */
function parseNum($string) { function parseNum($string) {
return intval($string); return intval($string);
@ -118,6 +128,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return bool
*/ */
function parseBool($string) { function parseBool($string) {
$string = strtolower($string); $string = strtolower($string);
@ -126,6 +137,7 @@ class ArrayParser {
/** /**
* @param string $string * @param string $string
* @return array
*/ */
function parseArray($string) { function parseArray($string) {
$body = substr($string, 5); $body = substr($string, 5);
@ -157,6 +169,7 @@ class ArrayParser {
/** /**
* @param string $body * @param string $body
* @return array
*/ */
function splitArray($body) { function splitArray($body) {
$inSingleQuote = false;//keep track if we are inside quotes $inSingleQuote = false;//keep track if we are inside quotes

View File

@ -6,15 +6,11 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
class OC_Geo{ class OC_Geo{
/*
* @brief returns the closest timezone to coordinates
* @param (string) $latitude - Latitude
* @param (string) $longitude - Longitude
* @return (string) $timezone - closest timezone
*/
/** /**
* @param integer $latitude * @brief returns the closest timezone to coordinates
* @param integer $longitude * @param $latitude
* @param $longitude
* @return mixed Closest timezone
*/ */
public static function timezone($latitude, $longitude) { public static function timezone($latitude, $longitude) {
$alltimezones = DateTimeZone::listIdentifiers(); $alltimezones = DateTimeZone::listIdentifiers();

View File

@ -200,6 +200,9 @@ class OC_Group {
/** /**
* @brief get a list of all groups * @brief get a list of all groups
* @param string $search
* @param int|null $limit
* @param int|null $offset
* @returns array with group names * @returns array with group names
* *
* Returns a list with all groups * Returns a list with all groups
@ -225,6 +228,10 @@ class OC_Group {
/** /**
* @brief get a list of all users in a group * @brief get a list of all users in a group
* @param string $gid
* @param string $search
* @param int $limit
* @param int $offset
* @returns array with user ids * @returns array with user ids
*/ */
public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
@ -260,6 +267,10 @@ class OC_Group {
/** /**
* @brief get a list of all display names in a group * @brief get a list of all display names in a group
* @param string $gid
* @param string $search
* @param int $limit
* @param int $offset
* @returns array with display names (value) and user ids(key) * @returns array with display names (value) and user ids(key)
*/ */
public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {

View File

@ -36,7 +36,7 @@ class OC_Helper {
* @param array $parameters * @param array $parameters
* @return * @return
* @internal param array $args with param=>value, will be appended to the returned url * @internal param array $args with param=>value, will be appended to the returned url
* @returns the url * @returns string the url
* *
* Returns a url to the given app and file. * Returns a url to the given app and file.
*/ */

View File

@ -43,8 +43,7 @@ class OC_JSON{
} }
/** /**
* @brief Check an ajax get/post call if the request token is valid. * Check an ajax get/post call if the request token is valid, send json error msg if not.
* @return json Error msg if not valid.
*/ */
public static function callCheck() { public static function callCheck() {
if( !OC_Util::isCallRegistered()) { if( !OC_Util::isCallRegistered()) {
@ -55,7 +54,7 @@ class OC_JSON{
} }
/** /**
* Check if the user is a admin, send json error msg if not * Check if the user is a admin, send json error msg if not.
*/ */
public static function checkAdminUser() { public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) { if( !OC_User::isAdminUser(OC_User::getUser())) {

View File

@ -267,43 +267,18 @@ class OC_L10N implements \OCP\IL10N {
$identifier = "_${text_singular}_::_${text_plural}_"; $identifier = "_${text_singular}_::_${text_plural}_";
if( array_key_exists($identifier, $this->translations)) { if( array_key_exists($identifier, $this->translations)) {
return new OC_L10N_String( $this, $identifier, $parameters, $count ); return new OC_L10N_String( $this, $identifier, $parameters, $count );
} }else{
else{
if($count === 1) { if($count === 1) {
return new OC_L10N_String($this, $text_singular, $parameters, $count); return new OC_L10N_String($this, $text_singular, $parameters, $count);
} }else{
else{
return new OC_L10N_String($this, $text_plural, $parameters, $count); return new OC_L10N_String($this, $text_plural, $parameters, $count);
} }
} }
} }
/**
* @brief Translating
* @param $textArray The text array we need a translation for
* @returns Translation or the same text
*
* Returns the translation. If no translation is found, $textArray will be
* returned.
*
*
* @deprecated deprecated since ownCloud version 5.0
* This method will probably be removed with ownCloud 6.0
*
*
*/
public function tA($textArray) {
OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.', OC_Log::WARN);
$result = array();
foreach($textArray as $key => $text) {
$result[$key] = (string)$this->t($text);
}
return $result;
}
/** /**
* @brief getTranslations * @brief getTranslations
* @returns Fetch all translations * @returns array Fetch all translations
* *
* Returns an associative array with all translations * Returns an associative array with all translations
*/ */
@ -339,7 +314,7 @@ class OC_L10N implements \OCP\IL10N {
/** /**
* @brief get localizations * @brief get localizations
* @returns Fetch all localizations * @returns array Fetch all localizations
* *
* Returns an associative array with all localizations * Returns an associative array with all localizations
*/ */

View File

@ -69,9 +69,9 @@ class OC_Migrate{
/** /**
* @brief exports a user, or owncloud instance * @brief exports a user, or owncloud instance
* @param optional $uid string user id of user to export if export type is user, defaults to current * @param string $uid user id of user to export if export type is user, defaults to current
* @param ootional $type string type of export, defualts to user * @param string $type type of export, defualts to user
* @param otional $path string path to zip output folder * @param string $path path to zip output folder
* @return string on error, path to zip on success * @return string on error, path to zip on success
*/ */
public static function export( $uid=null, $type='user', $path=null ) { public static function export( $uid=null, $type='user', $path=null ) {
@ -193,9 +193,10 @@ class OC_Migrate{
/** /**
* @brief imports a user, or owncloud instance * @brief imports a user, or owncloud instance
* @param $path string path to zip * @param string $path path to zip
* @param optional $type type of import (user or instance) * @param string $type type of import (user or instance)
* @param optional $uid userid of new user * @param string|null|int $uid userid of new user
* @return string
*/ */
public static function import( $path, $type='user', $uid=null ) { public static function import( $path, $type='user', $uid=null ) {
@ -307,8 +308,8 @@ class OC_Migrate{
/** /**
* @brief recursively deletes a directory * @brief recursively deletes a directory
* @param string $dir string path of dir to delete * @param string $dir path of dir to delete
* $param optional $deleteRootToo bool delete the root directory * @param bool $deleteRootToo delete the root directory
* @return bool * @return bool
*/ */
private static function unlink_r( $dir, $deleteRootToo=true ) { private static function unlink_r( $dir, $deleteRootToo=true ) {
@ -406,7 +407,7 @@ class OC_Migrate{
/** /**
* @brief generates json containing export info, and merges any data supplied * @brief generates json containing export info, and merges any data supplied
* @param optional $array array of data to include in the returned json * @param array $array of data to include in the returned json
* @return string * @return string
*/ */
static private function getExportInfo( $array=array() ) { static private function getExportInfo( $array=array() ) {
@ -430,8 +431,7 @@ class OC_Migrate{
/** /**
* @brief connects to migration.db, or creates if not found * @brief connects to migration.db, or creates if not found
* @param $db optional path to migration.db, defaults to user data dir * @param string $path to migration.db, defaults to user data dir
* @param string $path
* @return bool whether the operation was successful * @return bool whether the operation was successful
*/ */
static private function connectDB( $path=null ) { static private function connectDB( $path=null ) {
@ -461,7 +461,7 @@ class OC_Migrate{
/** /**
* @brief creates the tables in migration.db from an apps database.xml * @brief creates the tables in migration.db from an apps database.xml
* @param string $appid string id of the app * @param string $appid id of the app
* @return bool whether the operation was successful * @return bool whether the operation was successful
*/ */
static private function createAppTables( $appid ) { static private function createAppTables( $appid ) {
@ -499,7 +499,6 @@ class OC_Migrate{
/** /**
* @brief tries to create the zip * @brief tries to create the zip
* @param $path string path to zip destination
* @return bool * @return bool
*/ */
static private function createZip() { static private function createZip() {
@ -538,7 +537,7 @@ class OC_Migrate{
* @brief imports a new user * @brief imports a new user
* @param string $db string path to migration.db * @param string $db string path to migration.db
* @param $info object of migration info * @param $info object of migration info
* @param $uid optional uid to use * @param string|null|int $uid uid to use
* @return array of apps with import statuses, or false on failure. * @return array of apps with import statuses, or false on failure.
*/ */
public static function importAppData( $db, $info, $uid=null ) { public static function importAppData( $db, $info, $uid=null ) {
@ -601,10 +600,10 @@ class OC_Migrate{
} }
/* /**
* @brief creates a new user in the database * creates a new user in the database
* @param $uid string user_id of the user to be created * @param string $uid user_id of the user to be created
* @param $hash string hash of the user to be created * @param string $hash hash of the user to be created
* @return bool result of user creation * @return bool result of user creation
*/ */
public static function createUser( $uid, $hash ) { public static function createUser( $uid, $hash ) {

View File

@ -36,7 +36,7 @@ class OC_Migration_Content{
* @brief sets up the * @brief sets up the
* @param ZipArchive $zip ZipArchive object * @param ZipArchive $zip ZipArchive object
* @param $db a database object (required for exporttype user) * @param $db a database object (required for exporttype user)
* @return boolean|null * @return bool|null
*/ */
public function __construct( $zip, $db=null ) { public function __construct( $zip, $db=null ) {

View File

@ -39,6 +39,7 @@ class OC_OCS {
* @return string Data or if the key is not found and no default is set it will exit with a 400 Bad request * @return string Data or if the key is not found and no default is set it will exit with a 400 Bad request
*/ */
public static function readData($method, $key, $type = 'raw', $default = null) { public static function readData($method, $key, $type = 'raw', $default = null) {
$data = false;
if ($method == 'get') { if ($method == 'get') {
if (isset($_GET[$key])) { if (isset($_GET[$key])) {
$data = $_GET[$key]; $data = $_GET[$key];
@ -116,8 +117,8 @@ class OC_OCS {
* @param string $tag * @param string $tag
* @param string $tagattribute * @param string $tagattribute
* @param int $dimension * @param int $dimension
* @param int $itemscount * @param int|string $itemscount
* @param int $itemsperpage * @param int|string $itemsperpage
* @return string xml/json * @return string xml/json
*/ */
private static function generateXml($format, $status, $statuscode, private static function generateXml($format, $status, $statuscode,
@ -212,6 +213,8 @@ class OC_OCS {
} }
/** /**
* @param $writer
* @param $data
* @param string $node * @param string $node
*/ */
public static function toXml($writer, $data, $node) { public static function toXml($writer, $data, $node) {

View File

@ -95,7 +95,8 @@ class OC_OCSClient{
* @returns array with application data * @returns array with application data
* *
* This function returns a list of all the applications on the OCS server * This function returns a list of all the applications on the OCS server
* @param integer $page * @param $categories
* @param int $page
* @param string $filter * @param string $filter
*/ */
public static function getApplications($categories, $page, $filter) { public static function getApplications($categories, $page, $filter) {
@ -148,6 +149,7 @@ class OC_OCSClient{
/** /**
* @brief Get an the applications from the OCS server * @brief Get an the applications from the OCS server
* @param string $id
* @returns array with application data * @returns array with application data
* *
* This function returns an applications from the OCS server * This function returns an applications from the OCS server
@ -193,6 +195,7 @@ class OC_OCSClient{
* @returns array with application data * @returns array with application data
* *
* This function returns an download url for an applications from the OCS server * This function returns an download url for an applications from the OCS server
* @param string $id
* @param integer $item * @param integer $item
*/ */
public static function getApplicationDownload($id, $item) { public static function getApplicationDownload($id, $item) {

View File

@ -72,6 +72,7 @@ class Preview {
* @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
* @param bool $scalingUp Disable/Enable upscaling of previews * @param bool $scalingUp Disable/Enable upscaling of previews
* @throws \Exception
* @return mixed (bool / string) * @return mixed (bool / string)
* false if thumbnail does not exist * false if thumbnail does not exist
* path to thumbnail if thumbnail exists * path to thumbnail if thumbnail exists
@ -172,6 +173,9 @@ class Preview {
return $this->configMaxY; return $this->configMaxY;
} }
/**
* @return false|Files\FileInfo|\OCP\Files\FileInfo
*/
protected function getFileInfo() { protected function getFileInfo() {
$absPath = $this->fileView->getAbsolutePath($this->file); $absPath = $this->fileView->getAbsolutePath($this->file);
$absPath = Files\Filesystem::normalizePath($absPath); $absPath = Files\Filesystem::normalizePath($absPath);
@ -211,6 +215,7 @@ class Preview {
/** /**
* @brief set the the max width of the preview * @brief set the the max width of the preview
* @param int $maxX * @param int $maxX
* @throws \Exception
* @return $this * @return $this
*/ */
public function setMaxX($maxX = 1) { public function setMaxX($maxX = 1) {
@ -231,6 +236,7 @@ class Preview {
/** /**
* @brief set the the max height of the preview * @brief set the the max height of the preview
* @param int $maxY * @param int $maxY
* @throws \Exception
* @return $this * @return $this
*/ */
public function setMaxY($maxY = 1) { public function setMaxY($maxY = 1) {
@ -401,6 +407,10 @@ class Preview {
return $possibleThumbnails; return $possibleThumbnails;
} }
/**
* @param string $name
* @return array
*/
private function getDimensionsFromFilename($name) { private function getDimensionsFromFilename($name) {
$size = explode('-', $name); $size = explode('-', $name);
$x = (int) $size[0]; $x = (int) $size[0];
@ -409,6 +419,11 @@ class Preview {
return array($x, $y, $aspectRatio); return array($x, $y, $aspectRatio);
} }
/**
* @param int $x
* @param int $y
* @return bool
*/
private function unscalable($x, $y) { private function unscalable($x, $y) {
$maxX = $this->getMaxX(); $maxX = $this->getMaxX();
@ -707,6 +722,7 @@ class Preview {
/** /**
* @param string $mimeType * @param string $mimeType
* @return bool
*/ */
public static function isMimeSupported($mimeType) { public static function isMimeSupported($mimeType) {
if (!\OC_Config::getValue('enable_previews', true)) { if (!\OC_Config::getValue('enable_previews', true)) {

View File

@ -201,6 +201,7 @@ class OC_Request {
/** /**
* @brief get Path info from request, not urldecoded * @brief get Path info from request, not urldecoded
* @throws Exception
* @return string Path info or false when not found * @return string Path info or false when not found
*/ */
public static function getRawPathInfo() { public static function getRawPathInfo() {

View File

@ -50,7 +50,7 @@ class OC_Response {
/** /**
* @brief Set response status * @brief Set response status
* @param $status a HTTP status code, see also the STATUS constants * @param int $status a HTTP status code, see also the STATUS constants
*/ */
static public function setStatus($status) { static public function setStatus($status) {
$protocol = $_SERVER['SERVER_PROTOCOL']; $protocol = $_SERVER['SERVER_PROTOCOL'];

View File

@ -45,7 +45,7 @@ class OC_Search{
/** /**
* search all provider for $query * search all provider for $query
* @param string query * @param string $query
* @return array An array of OC_Search_Result's * @return array An array of OC_Search_Result's
*/ */
public static function search($query) { public static function search($query) {

View File

@ -136,6 +136,7 @@ class OC_Template extends \OC\Template\Base {
* @param string $theme * @param string $theme
* @param string $app * @param string $app
* @param string $fext * @param string $fext
* @return array
*/ */
protected function findTemplate($theme, $app, $name, $fext) { protected function findTemplate($theme, $app, $name, $fext) {
// Check if it is a app template or not. // Check if it is a app template or not.
@ -232,7 +233,7 @@ class OC_Template extends \OC\Template\Base {
* @brief Shortcut to print a simple page for guests * @brief Shortcut to print a simple page for guests
* @param string $application The application we render the template for * @param string $application The application we render the template for
* @param string $name Name of the template * @param string $name Name of the template
* @param string $parameters Parameters for the template * @param array|string $parameters Parameters for the template
* @return bool * @return bool
*/ */
public static function printGuestPage( $application, $name, $parameters = array() ) { public static function printGuestPage( $application, $name, $parameters = array() ) {
@ -261,7 +262,6 @@ class OC_Template extends \OC\Template\Base {
* print error page using Exception details * print error page using Exception details
* @param Exception $exception * @param Exception $exception
*/ */
public static function printExceptionErrorPage(Exception $exception) { public static function printExceptionErrorPage(Exception $exception) {
$error_msg = $exception->getMessage(); $error_msg = $exception->getMessage();
if ($exception->getCode()) { if ($exception->getCode()) {

View File

@ -1,8 +1,6 @@
<?php <?php
use Assetic\Asset\AssetCollection; use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset; use Assetic\Asset\FileAsset;
use Assetic\Asset\GlobAsset;
use Assetic\AssetManager;
use Assetic\AssetWriter; use Assetic\AssetWriter;
use Assetic\Filter\CssRewriteFilter; use Assetic\Filter\CssRewriteFilter;
@ -99,6 +97,10 @@ class OC_TemplateLayout extends OC_Template {
} }
} }
/**
* @param $styles
* @return array
*/
static public function findStylesheetFiles($styles) { static public function findStylesheetFiles($styles) {
// Read the selected theme from the config file // Read the selected theme from the config file
$theme = OC_Util::getTheme(); $theme = OC_Util::getTheme();
@ -113,6 +115,10 @@ class OC_TemplateLayout extends OC_Template {
return $locator->getResources(); return $locator->getResources();
} }
/**
* @param $scripts
* @return array
*/
static public function findJavascriptFiles($scripts) { static public function findJavascriptFiles($scripts) {
// Read the selected theme from the config file // Read the selected theme from the config file
$theme = OC_Util::getTheme(); $theme = OC_Util::getTheme();
@ -168,6 +174,10 @@ class OC_TemplateLayout extends OC_Template {
$this->append('cssfiles', OC_Helper::linkTo('assets', "$cssHash.css")); $this->append('cssfiles', OC_Helper::linkTo('assets', "$cssHash.css"));
} }
/**
* @param $files
* @return string
*/
private static function hashScriptNames($files) private static function hashScriptNames($files)
{ {
$files = array_map(function ($item) { $files = array_map(function ($item) {

View File

@ -95,6 +95,7 @@ class URLGenerator implements IURLGenerator {
* @brief Creates path to an image * @brief Creates path to an image
* @param string $app app * @param string $app app
* @param string $image image name * @param string $image image name
* @throws \RuntimeException If the image does not exist
* @return string the url * @return string the url
* *
* Returns the path to the image. * Returns the path to the image.

View File

@ -37,6 +37,10 @@
* logout() * logout()
*/ */
class OC_User { class OC_User {
/**
* @return \OC\User\Session
*/
public static function getUserSession() { public static function getUserSession() {
return OC::$server->getUserSession(); return OC::$server->getUserSession();
} }
@ -220,8 +224,8 @@ class OC_User {
/** /**
* @brief Try to login a user * @brief Try to login a user
* @param $uid The username of the user to log in * @param string $uid The username of the user to log in
* @param $password The password of the user * @param string $password The password of the user
* @return boolean|null * @return boolean|null
* *
* Log in a user and regenerate a new session - if the password is ok * Log in a user and regenerate a new session - if the password is ok
@ -291,6 +295,8 @@ class OC_User {
/** /**
* @brief Sets user display name for session * @brief Sets user display name for session
* @param string $uid * @param string $uid
* @param null $displayName
* @return bool Whether the display name could get set
*/ */
public static function setDisplayName($uid, $displayName = null) { public static function setDisplayName($uid, $displayName = null) {
if (is_null($displayName)) { if (is_null($displayName)) {
@ -514,6 +520,7 @@ class OC_User {
* @returns array with all uids * @returns array with all uids
* *
* Get a list of all users. * Get a list of all users.
* @param string $search
* @param integer $limit * @param integer $limit
* @param integer $offset * @param integer $offset
*/ */

View File

@ -87,7 +87,9 @@ class OC_Util {
} }
/** /**
* Get the quota of a user
* @param string $user * @param string $user
* @return int Quota bytes
*/ */
public static function getUserQuota($user){ public static function getUserQuota($user){
$config = \OC::$server->getConfig(); $config = \OC::$server->getConfig();
@ -301,8 +303,6 @@ class OC_Util {
return $errors; return $errors;
} }
$defaults = new \OC_Defaults();
$webServerRestart = false; $webServerRestart = false;
//check for database drivers //check for database drivers
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
@ -598,11 +598,11 @@ class OC_Util {
} }
/** /**
* @return void * @param array $errors
*/ */
public static function displayLoginPage($errors = array()) { public static function displayLoginPage($errors = array()) {
$parameters = array(); $parameters = array();
foreach( $errors as $key => $value ) { foreach( $errors as $value ) {
$parameters[$value] = true; $parameters[$value] = true;
} }
if (!empty($_POST['user'])) { if (!empty($_POST['user'])) {
@ -827,12 +827,13 @@ class OC_Util {
} }
/** /**
* @brief Check if the htaccess file is working * @brief Check if the .htaccess file is working
* @throws OC\HintException If the testfile can't get written.
* @return bool * @return bool
* @description Check if the htaccess file is working by creating a test * @description Check if the .htaccess file is working by creating a test
* file in the data directory and trying to access via http * file in the data directory and trying to access via http
*/ */
public static function isHtAccessWorking() { public static function isHtaccessWorking() {
if (!\OC_Config::getValue("check_for_working_htaccess", true)) { if (!\OC_Config::getValue("check_for_working_htaccess", true)) {
return true; return true;
} }

View File

@ -36,8 +36,8 @@ class OC_VObject{
/** /**
* @brief Parses the VObject * @brief Parses the VObject
* @param string VObject as string * @param string $data VObject as string
* @returns Sabre_VObject or null * @returns Sabre\VObject\Reader|null
*/ */
public static function parse($data) { public static function parse($data) {
try { try {
@ -55,7 +55,7 @@ class OC_VObject{
/** /**
* @brief Escapes semicolons * @brief Escapes semicolons
* @param string $value * @param array $value
* @return string * @return string
*/ */
public static function escapeSemicolons($value) { public static function escapeSemicolons($value) {
@ -88,7 +88,7 @@ class OC_VObject{
} }
/** /**
* Constuctor * Constructor
* @param Sabre\VObject\Component or string * @param Sabre\VObject\Component or string
*/ */
public function __construct($vobject_or_name) { public function __construct($vobject_or_name) {
@ -99,6 +99,11 @@ class OC_VObject{
} }
} }
/**
* @todo Write documentation
* @param $item
* @param null $itemValue
*/
public function add($item, $itemValue = null) { public function add($item, $itemValue = null) {
if ($item instanceof OC_VObject) { if ($item instanceof OC_VObject) {
$item = $item->getVObject(); $item = $item->getVObject();
@ -110,8 +115,8 @@ class OC_VObject{
* @brief Add property to vobject * @brief Add property to vobject
* @param object $name of property * @param object $name of property
* @param object $value of property * @param object $value of property
* @param object $parameters of property * @param array|object $parameters of property
* @returns Sabre_VObject_Property newly created * @returns Sabre\VObject\Property newly created
*/ */
public function addProperty($name, $value, $parameters=array()) { public function addProperty($name, $value, $parameters=array()) {
if(is_array($value)) { if(is_array($value)) {
@ -131,6 +136,11 @@ class OC_VObject{
$this->vobject->add('UID', $uid); $this->vobject->add('UID', $uid);
} }
/**
* @todo Write documentation
* @param mixed $name
* @param string $string
*/
public function setString($name, $string) { public function setString($name, $string) {
if ($string != '') { if ($string != '') {
$string = strtr($string, array("\r\n"=>"\n")); $string = strtr($string, array("\r\n"=>"\n"));
@ -145,7 +155,7 @@ class OC_VObject{
* When $datetime is set to 'now', use the current time * When $datetime is set to 'now', use the current time
* When $datetime is null, unset the property * When $datetime is null, unset the property
* *
* @param string property name * @param string $name
* @param DateTime $datetime * @param DateTime $datetime
* @param int $dateType * @param int $dateType
* @return void * @return void
@ -163,12 +173,22 @@ class OC_VObject{
} }
} }
/**
* @todo Write documentation
* @param $name
* @return string
*/
public function getAsString($name) { public function getAsString($name) {
return $this->vobject->__isset($name) ? return $this->vobject->__isset($name) ?
$this->vobject->__get($name)->value : $this->vobject->__get($name)->value :
''; '';
} }
/**
* @todo Write documentation
* @param $name
* @return array
*/
public function getAsArray($name) { public function getAsArray($name) {
$values = array(); $values = array();
if ($this->vobject->__isset($name)) { if ($this->vobject->__isset($name)) {
@ -178,6 +198,11 @@ class OC_VObject{
return $values; return $values;
} }
/**
* @todo Write documentation
* @param $name
* @return array|OC_VObject|\Sabre\VObject\Property
*/
public function &__get($name) { public function &__get($name) {
if ($name == 'children') { if ($name == 'children') {
return $this->vobject->children; return $this->vobject->children;
@ -189,18 +214,38 @@ class OC_VObject{
return $return; return $return;
} }
/**
* @todo Write documentation
* @param string $name
* @param string $value
*/
public function __set($name, $value) { public function __set($name, $value) {
return $this->vobject->__set($name, $value); return $this->vobject->__set($name, $value);
} }
/**
* @todo Write documentation
* @param string $name
*/
public function __unset($name) { public function __unset($name) {
return $this->vobject->__unset($name); return $this->vobject->__unset($name);
} }
/**
* @todo Write documentation
* @param string $name
* @return bool
*/
public function __isset($name) { public function __isset($name) {
return $this->vobject->__isset($name); return $this->vobject->__isset($name);
} }
/**
* @todo Write documentation
* @param $function
* @param $arguments
* @return mixed
*/
public function __call($function, $arguments) { public function __call($function, $arguments) {
return call_user_func_array(array($this->vobject, $function), $arguments); return call_user_func_array(array($this->vobject, $function), $arguments);
} }

View File

@ -57,7 +57,7 @@ class Util {
* @param string $mailtext * @param string $mailtext
* @param string $fromaddress * @param string $fromaddress
* @param string $fromname * @param string $fromname
* @param bool $html * @param int $html
* @param string $altbody * @param string $altbody
* @param string $ccaddress * @param string $ccaddress
* @param string $ccname * @param string $ccname
@ -85,7 +85,7 @@ class Util {
* write exception into the log. Include the stack trace * write exception into the log. Include the stack trace
* if DEBUG mode is enabled * if DEBUG mode is enabled
* @param string $app app name * @param string $app app name
* @param Exception $ex exception to log * @param \Exception $ex exception to log
*/ */
public static function logException( $app, \Exception $ex ) { public static function logException( $app, \Exception $ex ) {
$class = get_class($ex); $class = get_class($ex);
@ -156,6 +156,7 @@ class Util {
* formats a timestamp in the "right" way * formats a timestamp in the "right" way
* @param int $timestamp $timestamp * @param int $timestamp $timestamp
* @param bool $dateOnly option to omit time from the result * @param bool $dateOnly option to omit time from the result
* @return string timestamp
*/ */
public static function formatDate( $timestamp, $dateOnly=false) { public static function formatDate( $timestamp, $dateOnly=false) {
return(\OC_Util::formatDate( $timestamp, $dateOnly )); return(\OC_Util::formatDate( $timestamp, $dateOnly ));
@ -203,9 +204,8 @@ class Util {
* Creates an url using a defined route * Creates an url using a defined route
* @param $route * @param $route
* @param array $parameters * @param array $parameters
* @return
* @internal param array $args with param=>value, will be appended to the returned url * @internal param array $args with param=>value, will be appended to the returned url
* @return the url * @return string the url
*/ */
public static function linkToRoute( $route, $parameters = array() ) { public static function linkToRoute( $route, $parameters = array() ) {
return \OC_Helper::linkToRoute($route, $parameters); return \OC_Helper::linkToRoute($route, $parameters);
@ -284,8 +284,7 @@ class Util {
/** /**
* Returns the request uri, even if the website uses one or more reverse proxies * Returns the request uri, even if the website uses one or more reverse proxies
* * @return string the request uri
* @return the request uri
*/ */
public static function getRequestUri() { public static function getRequestUri() {
return(\OC_Request::requestUri()); return(\OC_Request::requestUri());
@ -293,8 +292,7 @@ class Util {
/** /**
* Returns the script name, even if the website uses one or more reverse proxies * Returns the script name, even if the website uses one or more reverse proxies
* * @returns string the script name
* @return the script name
*/ */
public static function getScriptName() { public static function getScriptName() {
return(\OC_Request::scriptName()); return(\OC_Request::scriptName());
@ -350,7 +348,7 @@ class Util {
* Emits a signal. To get data from the slot use references! * Emits a signal. To get data from the slot use references!
* @param string $signalclass class name of emitter * @param string $signalclass class name of emitter
* @param string $signalname name of signal * @param string $signalname name of signal
* @param string $params defautl: array() array with additional data * @param array $params default: array() array with additional data
* @return bool true if slots exists or false if not * @return bool true if slots exists or false if not
* *
* TODO: write example * TODO: write example
@ -467,9 +465,8 @@ class Util {
/** /**
* Calculate free space left within user quota * Calculate free space left within user quota
* * @param string $dir the current folder where the user currently operates
* @param $dir the current folder where the user currently operates * @return int number of bytes representing
* @return number of bytes representing
*/ */
public static function freeSpace($dir) { public static function freeSpace($dir) {
return \OC_Helper::freeSpace($dir); return \OC_Helper::freeSpace($dir);

View File

@ -14,7 +14,7 @@ OC_App::setActiveNavigationEntry( "admin" );
$tmpl = new OC_Template( 'settings', 'admin', 'user'); $tmpl = new OC_Template( 'settings', 'admin', 'user');
$forms=OC_App::getForms('admin'); $forms=OC_App::getForms('admin');
$htaccessworking=OC_Util::isHtAccessWorking(); $htaccessworking=OC_Util::isHtaccessWorking();
$entries=OC_Log_Owncloud::getEntries(3); $entries=OC_Log_Owncloud::getEntries(3);
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3; $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;

View File

@ -34,7 +34,7 @@ try {
if (OC::$CLI) { if (OC::$CLI) {
print_r($values); print_r($values);
} else { } else {
echo(json_encode($values)); print_unescaped(json_encode($values));
} }
} catch (Exception $ex) { } catch (Exception $ex) {

View File

@ -1,6 +1,8 @@
<?php <?php
// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel when updating major/minor version number. // We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
// when updating major/minor version number.
$OC_Version=array(6, 90, 0, 2); $OC_Version=array(6, 90, 0, 2);
// The human readable string // The human readable string