@@ -122,7 +122,7 @@ class Controller { | |||
// Protect data directory here, so we can test if the protection is working | |||
\OC_Setup::protectDataDirectory(); | |||
try { | |||
$htaccessWorking = \OC_Util::isHtAccessWorking(); | |||
$htaccessWorking = \OC_Util::isHtaccessWorking(); | |||
} catch (\OC\HintException $e) { | |||
$errors[] = array( | |||
'error' => $e->getMessage(), |
@@ -185,7 +185,6 @@ class OC { | |||
if (file_exists(self::$configDir . "/config.php") | |||
and !is_writable(self::$configDir . "/config.php") | |||
) { | |||
$defaults = new OC_Defaults(); | |||
if (self::$CLI) { | |||
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"; | |||
@@ -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) { | |||
if (self::needUpgrade()) { | |||
if ($showTemplate && !OC_Config::getValue('maintenance', false)) { | |||
@@ -799,6 +803,11 @@ class OC { | |||
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) { | |||
OC_App::loadApps(); | |||
$app = $param['app']; | |||
@@ -841,6 +850,10 @@ class OC { | |||
OC_Util::displayLoginPage(array_unique($error)); | |||
} | |||
/** | |||
* Remove outdated and therefore invalid tokens for a user | |||
* @param string $user | |||
*/ | |||
protected static function cleanupLoginTokens($user) { | |||
$cutoff = time() - OC_Config::getValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); | |||
$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() { | |||
$return = OC_User::handleApacheAuth(); | |||
@@ -866,6 +883,10 @@ class OC { | |||
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() { | |||
if (!isset($_COOKIE["oc_remember_login"]) | |||
|| !isset($_COOKIE["oc_token"]) | |||
@@ -907,6 +928,10 @@ class OC { | |||
return true; | |||
} | |||
/** | |||
* Tries to login a user using the formbased authentication | |||
* @return bool|void | |||
*/ | |||
protected static function tryFormLogin() { | |||
if (!isset($_POST["user"]) || !isset($_POST['password'])) { | |||
return false; | |||
@@ -941,6 +966,10 @@ class OC { | |||
return true; | |||
} | |||
/** | |||
* Try to login a user using HTTP authentication. | |||
* @return bool | |||
*/ | |||
protected static function tryBasicAuthLogin() { | |||
if (!isset($_SERVER["PHP_AUTH_USER"]) | |||
|| !isset($_SERVER["PHP_AUTH_PW"]) | |||
@@ -959,6 +988,10 @@ class OC { | |||
} | |||
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() { | |||
if ($temp = ini_get('upload_tmp_dir')) return $temp; | |||
if ($temp = getenv('TMP')) return $temp; |
@@ -46,7 +46,7 @@ class ActivityManager implements IManager { | |||
$type, | |||
$priority); | |||
} catch (\Exception $ex) { | |||
// TODO: log the excepetion | |||
// TODO: log the exception | |||
} | |||
} | |||
@@ -127,9 +127,9 @@ class OC_API { | |||
/** | |||
* merge the returned result objects into one response | |||
* @param array $responses | |||
* @return array|\OC_OCS_Result | |||
*/ | |||
public static function mergeResponses($responses) { | |||
$response = array(); | |||
// Sort into shipped and thirdparty | |||
$shipped = array( | |||
'succeeded' => array(), | |||
@@ -191,7 +191,7 @@ class OC_API { | |||
// Merge the successful responses | |||
$data = array(); | |||
foreach($responses as $app => $response) { | |||
foreach($responses as $response) { | |||
if($response['shipped']) { | |||
$data = array_merge_recursive($response['response']->getData(), $data); | |||
} else { |
@@ -568,7 +568,7 @@ class OC_App{ | |||
/** | |||
* @brief Returns the navigation | |||
* @return string | |||
* @return array | |||
* | |||
* This function returns an array containing all entries added. The | |||
* entries are sorted by the key 'order' ascending. Additional to the keys |
@@ -71,6 +71,7 @@ class AppConfig implements \OCP\IAppConfig { | |||
/** | |||
* @param string $app | |||
* @return \string[] | |||
*/ | |||
private function getAppValues($app) { | |||
$appCache = $this->getAppCache($app); |
@@ -10,7 +10,7 @@ abstract class OC_Archive{ | |||
/** | |||
* open any of the supported archive types | |||
* @param string $path | |||
* @return OC_Archive | |||
* @return OC_Archive|void | |||
*/ | |||
public static function open($path) { | |||
$ext=substr($path, strrpos($path, '.')); | |||
@@ -29,6 +29,9 @@ abstract class OC_Archive{ | |||
} | |||
} | |||
/** | |||
* @param $source | |||
*/ | |||
abstract function __construct($source); | |||
/** | |||
* add an empty folder to the archive | |||
@@ -39,7 +42,7 @@ abstract class OC_Archive{ | |||
/** | |||
* add a file to the archive | |||
* @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 | |||
*/ | |||
abstract function addFile($path, $source=''); |
@@ -32,6 +32,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return array|bool|int|null|string | |||
*/ | |||
function parsePHP($string) { | |||
$string = $this->stripPHPTags($string); | |||
@@ -41,6 +42,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return string | |||
*/ | |||
function stripPHPTags($string) { | |||
$string = trim($string); | |||
@@ -55,6 +57,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return string | |||
*/ | |||
function stripAssignAndReturn($string) { | |||
$string = trim($string); | |||
@@ -67,6 +70,10 @@ class ArrayParser { | |||
return $string; | |||
} | |||
/** | |||
* @param string $string | |||
* @return array|bool|int|null|string | |||
*/ | |||
function parse($string) { | |||
$string = trim($string); | |||
$string = trim($string, ';'); | |||
@@ -85,6 +92,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return int | |||
*/ | |||
function getType($string) { | |||
$string = strtolower($string); | |||
@@ -104,6 +112,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return string | |||
*/ | |||
function parseString($string) { | |||
return substr($string, 1, -1); | |||
@@ -111,6 +120,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return int | |||
*/ | |||
function parseNum($string) { | |||
return intval($string); | |||
@@ -118,6 +128,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return bool | |||
*/ | |||
function parseBool($string) { | |||
$string = strtolower($string); | |||
@@ -126,6 +137,7 @@ class ArrayParser { | |||
/** | |||
* @param string $string | |||
* @return array | |||
*/ | |||
function parseArray($string) { | |||
$body = substr($string, 5); | |||
@@ -157,6 +169,7 @@ class ArrayParser { | |||
/** | |||
* @param string $body | |||
* @return array | |||
*/ | |||
function splitArray($body) { | |||
$inSingleQuote = false;//keep track if we are inside quotes |
@@ -6,15 +6,11 @@ | |||
* See the COPYING-README file. | |||
*/ | |||
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 | |||
* @param integer $longitude | |||
* @brief returns the closest timezone to coordinates | |||
* @param $latitude | |||
* @param $longitude | |||
* @return mixed Closest timezone | |||
*/ | |||
public static function timezone($latitude, $longitude) { | |||
$alltimezones = DateTimeZone::listIdentifiers(); |
@@ -200,6 +200,9 @@ class OC_Group { | |||
/** | |||
* @brief get a list of all groups | |||
* @param string $search | |||
* @param int|null $limit | |||
* @param int|null $offset | |||
* @returns array with group names | |||
* | |||
* Returns a list with all groups | |||
@@ -225,6 +228,10 @@ class OC_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 | |||
*/ | |||
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 | |||
* @param string $gid | |||
* @param string $search | |||
* @param int $limit | |||
* @param int $offset | |||
* @returns array with display names (value) and user ids(key) | |||
*/ | |||
public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { |
@@ -36,7 +36,7 @@ class OC_Helper { | |||
* @param array $parameters | |||
* @return | |||
* @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. | |||
*/ |
@@ -43,8 +43,7 @@ class OC_JSON{ | |||
} | |||
/** | |||
* @brief Check an ajax get/post call if the request token is valid. | |||
* @return json Error msg if not valid. | |||
* Check an ajax get/post call if the request token is valid, send json error msg if not. | |||
*/ | |||
public static function callCheck() { | |||
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() { | |||
if( !OC_User::isAdminUser(OC_User::getUser())) { |
@@ -267,43 +267,18 @@ class OC_L10N implements \OCP\IL10N { | |||
$identifier = "_${text_singular}_::_${text_plural}_"; | |||
if( array_key_exists($identifier, $this->translations)) { | |||
return new OC_L10N_String( $this, $identifier, $parameters, $count ); | |||
} | |||
else{ | |||
}else{ | |||
if($count === 1) { | |||
return new OC_L10N_String($this, $text_singular, $parameters, $count); | |||
} | |||
else{ | |||
}else{ | |||
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 | |||
* @returns Fetch all translations | |||
* @returns array Fetch all translations | |||
* | |||
* Returns an associative array with all translations | |||
*/ | |||
@@ -339,7 +314,7 @@ class OC_L10N implements \OCP\IL10N { | |||
/** | |||
* @brief get localizations | |||
* @returns Fetch all localizations | |||
* @returns array Fetch all localizations | |||
* | |||
* Returns an associative array with all localizations | |||
*/ |
@@ -69,9 +69,9 @@ class OC_Migrate{ | |||
/** | |||
* @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 ootional $type string type of export, defualts to user | |||
* @param otional $path string path to zip output folder | |||
* @param string $uid user id of user to export if export type is user, defaults to current | |||
* @param string $type type of export, defualts to user | |||
* @param string $path path to zip output folder | |||
* @return string on error, path to zip on success | |||
*/ | |||
public static function export( $uid=null, $type='user', $path=null ) { | |||
@@ -192,11 +192,12 @@ class OC_Migrate{ | |||
} | |||
/** | |||
* @brief imports a user, or owncloud instance | |||
* @param $path string path to zip | |||
* @param optional $type type of import (user or instance) | |||
* @param optional $uid userid of new user | |||
*/ | |||
* @brief imports a user, or owncloud instance | |||
* @param string $path path to zip | |||
* @param string $type type of import (user or instance) | |||
* @param string|null|int $uid userid of new user | |||
* @return string | |||
*/ | |||
public static function import( $path, $type='user', $uid=null ) { | |||
$datadir = OC_Config::getValue( 'datadirectory' ); | |||
@@ -307,8 +308,8 @@ class OC_Migrate{ | |||
/** | |||
* @brief recursively deletes a directory | |||
* @param string $dir string path of dir to delete | |||
* $param optional $deleteRootToo bool delete the root directory | |||
* @param string $dir path of dir to delete | |||
* @param bool $deleteRootToo delete the root directory | |||
* @return bool | |||
*/ | |||
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 | |||
* @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 | |||
*/ | |||
static private function getExportInfo( $array=array() ) { | |||
@@ -430,8 +431,7 @@ class OC_Migrate{ | |||
/** | |||
* @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 | |||
* @param string $path to migration.db, defaults to user data dir | |||
* @return bool whether the operation was successful | |||
*/ | |||
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 | |||
* @param string $appid string id of the app | |||
* @param string $appid id of the app | |||
* @return bool whether the operation was successful | |||
*/ | |||
static private function createAppTables( $appid ) { | |||
@@ -499,7 +499,6 @@ class OC_Migrate{ | |||
/** | |||
* @brief tries to create the zip | |||
* @param $path string path to zip destination | |||
* @return bool | |||
*/ | |||
static private function createZip() { | |||
@@ -538,7 +537,7 @@ class OC_Migrate{ | |||
* @brief imports a new user | |||
* @param string $db string path to migration.db | |||
* @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. | |||
*/ | |||
public static function importAppData( $db, $info, $uid=null ) { | |||
@@ -601,10 +600,10 @@ class OC_Migrate{ | |||
} | |||
/* | |||
* @brief creates a new user in the database | |||
* @param $uid string user_id of the user to be created | |||
* @param $hash string hash of the user to be created | |||
/** | |||
* creates a new user in the database | |||
* @param string $uid user_id of the user to be created | |||
* @param string $hash hash of the user to be created | |||
* @return bool result of user creation | |||
*/ | |||
public static function createUser( $uid, $hash ) { |
@@ -36,7 +36,7 @@ class OC_Migration_Content{ | |||
* @brief sets up the | |||
* @param ZipArchive $zip ZipArchive object | |||
* @param $db a database object (required for exporttype user) | |||
* @return boolean|null | |||
* @return bool|null | |||
*/ | |||
public function __construct( $zip, $db=null ) { | |||
@@ -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 | |||
*/ | |||
public static function readData($method, $key, $type = 'raw', $default = null) { | |||
$data = false; | |||
if ($method == 'get') { | |||
if (isset($_GET[$key])) { | |||
$data = $_GET[$key]; | |||
@@ -107,19 +108,19 @@ class OC_OCS { | |||
/** | |||
* generates the xml or json response for the API call from an multidimenional data array. | |||
* @param string $format | |||
* @param string $status | |||
* @param string $statuscode | |||
* @param string $message | |||
* @param array $data | |||
* @param string $tag | |||
* @param string $tagattribute | |||
* @param int $dimension | |||
* @param int $itemscount | |||
* @param int $itemsperpage | |||
* @return string xml/json | |||
*/ | |||
* generates the xml or json response for the API call from an multidimenional data array. | |||
* @param string $format | |||
* @param string $status | |||
* @param string $statuscode | |||
* @param string $message | |||
* @param array $data | |||
* @param string $tag | |||
* @param string $tagattribute | |||
* @param int $dimension | |||
* @param int|string $itemscount | |||
* @param int|string $itemsperpage | |||
* @return string xml/json | |||
*/ | |||
private static function generateXml($format, $status, $statuscode, | |||
$message, $data=array(), $tag='', $tagattribute='', $dimension=-1, $itemscount='', $itemsperpage='') { | |||
if($format=='json') { | |||
@@ -212,6 +213,8 @@ class OC_OCS { | |||
} | |||
/** | |||
* @param $writer | |||
* @param $data | |||
* @param string $node | |||
*/ | |||
public static function toXml($writer, $data, $node) { |
@@ -95,7 +95,8 @@ class OC_OCSClient{ | |||
* @returns array with application data | |||
* | |||
* This function returns a list of all the applications on the OCS server | |||
* @param integer $page | |||
* @param $categories | |||
* @param int $page | |||
* @param string $filter | |||
*/ | |||
public static function getApplications($categories, $page, $filter) { | |||
@@ -148,6 +149,7 @@ class OC_OCSClient{ | |||
/** | |||
* @brief Get an the applications from the OCS server | |||
* @param string $id | |||
* @returns array with application data | |||
* | |||
* This function returns an applications from the OCS server | |||
@@ -189,12 +191,13 @@ class OC_OCSClient{ | |||
} | |||
/** | |||
* @brief Get the download url for an application from the OCS server | |||
* @returns array with application data | |||
* | |||
* This function returns an download url for an applications from the OCS server | |||
* @param integer $item | |||
*/ | |||
* @brief Get the download url for an application from the OCS server | |||
* @returns array with application data | |||
* | |||
* This function returns an download url for an applications from the OCS server | |||
* @param string $id | |||
* @param integer $item | |||
*/ | |||
public static function getApplicationDownload($id, $item) { | |||
if(OC_Config::getValue('appstoreenabled', true)==false) { | |||
return null; |
@@ -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 $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 | |||
* @throws \Exception | |||
* @return mixed (bool / string) | |||
* false if thumbnail does not exist | |||
* path to thumbnail if thumbnail exists | |||
@@ -172,6 +173,9 @@ class Preview { | |||
return $this->configMaxY; | |||
} | |||
/** | |||
* @return false|Files\FileInfo|\OCP\Files\FileInfo | |||
*/ | |||
protected function getFileInfo() { | |||
$absPath = $this->fileView->getAbsolutePath($this->file); | |||
$absPath = Files\Filesystem::normalizePath($absPath); | |||
@@ -211,6 +215,7 @@ class Preview { | |||
/** | |||
* @brief set the the max width of the preview | |||
* @param int $maxX | |||
* @throws \Exception | |||
* @return $this | |||
*/ | |||
public function setMaxX($maxX = 1) { | |||
@@ -231,6 +236,7 @@ class Preview { | |||
/** | |||
* @brief set the the max height of the preview | |||
* @param int $maxY | |||
* @throws \Exception | |||
* @return $this | |||
*/ | |||
public function setMaxY($maxY = 1) { | |||
@@ -401,6 +407,10 @@ class Preview { | |||
return $possibleThumbnails; | |||
} | |||
/** | |||
* @param string $name | |||
* @return array | |||
*/ | |||
private function getDimensionsFromFilename($name) { | |||
$size = explode('-', $name); | |||
$x = (int) $size[0]; | |||
@@ -409,6 +419,11 @@ class Preview { | |||
return array($x, $y, $aspectRatio); | |||
} | |||
/** | |||
* @param int $x | |||
* @param int $y | |||
* @return bool | |||
*/ | |||
private function unscalable($x, $y) { | |||
$maxX = $this->getMaxX(); | |||
@@ -707,6 +722,7 @@ class Preview { | |||
/** | |||
* @param string $mimeType | |||
* @return bool | |||
*/ | |||
public static function isMimeSupported($mimeType) { | |||
if (!\OC_Config::getValue('enable_previews', true)) { |
@@ -201,6 +201,7 @@ class OC_Request { | |||
/** | |||
* @brief get Path info from request, not urldecoded | |||
* @throws Exception | |||
* @return string Path info or false when not found | |||
*/ | |||
public static function getRawPathInfo() { |
@@ -50,7 +50,7 @@ class OC_Response { | |||
/** | |||
* @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) { | |||
$protocol = $_SERVER['SERVER_PROTOCOL']; |
@@ -45,7 +45,7 @@ class OC_Search{ | |||
/** | |||
* search all provider for $query | |||
* @param string query | |||
* @param string $query | |||
* @return array An array of OC_Search_Result's | |||
*/ | |||
public static function search($query) { |
@@ -136,6 +136,7 @@ class OC_Template extends \OC\Template\Base { | |||
* @param string $theme | |||
* @param string $app | |||
* @param string $fext | |||
* @return array | |||
*/ | |||
protected function findTemplate($theme, $app, $name, $fext) { | |||
// 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 | |||
* @param string $application The application we render the template for | |||
* @param string $name Name of the template | |||
* @param string $parameters Parameters for the template | |||
* @param array|string $parameters Parameters for the template | |||
* @return bool | |||
*/ | |||
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 | |||
* @param Exception $exception | |||
*/ | |||
public static function printExceptionErrorPage(Exception $exception) { | |||
$error_msg = $exception->getMessage(); | |||
if ($exception->getCode()) { |
@@ -1,8 +1,6 @@ | |||
<?php | |||
use Assetic\Asset\AssetCollection; | |||
use Assetic\Asset\FileAsset; | |||
use Assetic\Asset\GlobAsset; | |||
use Assetic\AssetManager; | |||
use Assetic\AssetWriter; | |||
use Assetic\Filter\CssRewriteFilter; | |||
@@ -99,6 +97,10 @@ class OC_TemplateLayout extends OC_Template { | |||
} | |||
} | |||
/** | |||
* @param $styles | |||
* @return array | |||
*/ | |||
static public function findStylesheetFiles($styles) { | |||
// Read the selected theme from the config file | |||
$theme = OC_Util::getTheme(); | |||
@@ -113,6 +115,10 @@ class OC_TemplateLayout extends OC_Template { | |||
return $locator->getResources(); | |||
} | |||
/** | |||
* @param $scripts | |||
* @return array | |||
*/ | |||
static public function findJavascriptFiles($scripts) { | |||
// Read the selected theme from the config file | |||
$theme = OC_Util::getTheme(); | |||
@@ -168,6 +174,10 @@ class OC_TemplateLayout extends OC_Template { | |||
$this->append('cssfiles', OC_Helper::linkTo('assets', "$cssHash.css")); | |||
} | |||
/** | |||
* @param $files | |||
* @return string | |||
*/ | |||
private static function hashScriptNames($files) | |||
{ | |||
$files = array_map(function ($item) { |
@@ -95,6 +95,7 @@ class URLGenerator implements IURLGenerator { | |||
* @brief Creates path to an image | |||
* @param string $app app | |||
* @param string $image image name | |||
* @throws \RuntimeException If the image does not exist | |||
* @return string the url | |||
* | |||
* Returns the path to the image. |
@@ -37,6 +37,10 @@ | |||
* logout() | |||
*/ | |||
class OC_User { | |||
/** | |||
* @return \OC\User\Session | |||
*/ | |||
public static function getUserSession() { | |||
return OC::$server->getUserSession(); | |||
} | |||
@@ -220,8 +224,8 @@ class OC_User { | |||
/** | |||
* @brief Try to login a user | |||
* @param $uid The username of the user to log in | |||
* @param $password The password of the user | |||
* @param string $uid The username of the user to log in | |||
* @param string $password The password of the user | |||
* @return boolean|null | |||
* | |||
* 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 | |||
* @param string $uid | |||
* @param null $displayName | |||
* @return bool Whether the display name could get set | |||
*/ | |||
public static function setDisplayName($uid, $displayName = null) { | |||
if (is_null($displayName)) { | |||
@@ -514,6 +520,7 @@ class OC_User { | |||
* @returns array with all uids | |||
* | |||
* Get a list of all users. | |||
* @param string $search | |||
* @param integer $limit | |||
* @param integer $offset | |||
*/ |
@@ -87,7 +87,9 @@ class OC_Util { | |||
} | |||
/** | |||
* Get the quota of a user | |||
* @param string $user | |||
* @return int Quota bytes | |||
*/ | |||
public static function getUserQuota($user){ | |||
$config = \OC::$server->getConfig(); | |||
@@ -301,8 +303,6 @@ class OC_Util { | |||
return $errors; | |||
} | |||
$defaults = new \OC_Defaults(); | |||
$webServerRestart = false; | |||
//check for database drivers | |||
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()) { | |||
$parameters = array(); | |||
foreach( $errors as $key => $value ) { | |||
foreach( $errors as $value ) { | |||
$parameters[$value] = true; | |||
} | |||
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 | |||
* @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 | |||
*/ | |||
public static function isHtAccessWorking() { | |||
public static function isHtaccessWorking() { | |||
if (!\OC_Config::getValue("check_for_working_htaccess", true)) { | |||
return true; | |||
} |
@@ -36,8 +36,8 @@ class OC_VObject{ | |||
/** | |||
* @brief Parses the VObject | |||
* @param string VObject as string | |||
* @returns Sabre_VObject or null | |||
* @param string $data VObject as string | |||
* @returns Sabre\VObject\Reader|null | |||
*/ | |||
public static function parse($data) { | |||
try { | |||
@@ -55,7 +55,7 @@ class OC_VObject{ | |||
/** | |||
* @brief Escapes semicolons | |||
* @param string $value | |||
* @param array $value | |||
* @return string | |||
*/ | |||
public static function escapeSemicolons($value) { | |||
@@ -88,7 +88,7 @@ class OC_VObject{ | |||
} | |||
/** | |||
* Constuctor | |||
* Constructor | |||
* @param Sabre\VObject\Component or string | |||
*/ | |||
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) { | |||
if ($item instanceof OC_VObject) { | |||
$item = $item->getVObject(); | |||
@@ -110,8 +115,8 @@ class OC_VObject{ | |||
* @brief Add property to vobject | |||
* @param object $name of property | |||
* @param object $value of property | |||
* @param object $parameters of property | |||
* @returns Sabre_VObject_Property newly created | |||
* @param array|object $parameters of property | |||
* @returns Sabre\VObject\Property newly created | |||
*/ | |||
public function addProperty($name, $value, $parameters=array()) { | |||
if(is_array($value)) { | |||
@@ -131,6 +136,11 @@ class OC_VObject{ | |||
$this->vobject->add('UID', $uid); | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param mixed $name | |||
* @param string $string | |||
*/ | |||
public function setString($name, $string) { | |||
if ($string != '') { | |||
$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 null, unset the property | |||
* | |||
* @param string property name | |||
* @param string $name | |||
* @param DateTime $datetime | |||
* @param int $dateType | |||
* @return void | |||
@@ -163,12 +173,22 @@ class OC_VObject{ | |||
} | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param $name | |||
* @return string | |||
*/ | |||
public function getAsString($name) { | |||
return $this->vobject->__isset($name) ? | |||
$this->vobject->__get($name)->value : | |||
''; | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param $name | |||
* @return array | |||
*/ | |||
public function getAsArray($name) { | |||
$values = array(); | |||
if ($this->vobject->__isset($name)) { | |||
@@ -178,6 +198,11 @@ class OC_VObject{ | |||
return $values; | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param $name | |||
* @return array|OC_VObject|\Sabre\VObject\Property | |||
*/ | |||
public function &__get($name) { | |||
if ($name == 'children') { | |||
return $this->vobject->children; | |||
@@ -189,18 +214,38 @@ class OC_VObject{ | |||
return $return; | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param string $name | |||
* @param string $value | |||
*/ | |||
public function __set($name, $value) { | |||
return $this->vobject->__set($name, $value); | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param string $name | |||
*/ | |||
public function __unset($name) { | |||
return $this->vobject->__unset($name); | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param string $name | |||
* @return bool | |||
*/ | |||
public function __isset($name) { | |||
return $this->vobject->__isset($name); | |||
} | |||
/** | |||
* @todo Write documentation | |||
* @param $function | |||
* @param $arguments | |||
* @return mixed | |||
*/ | |||
public function __call($function, $arguments) { | |||
return call_user_func_array(array($this->vobject, $function), $arguments); | |||
} |
@@ -57,7 +57,7 @@ class Util { | |||
* @param string $mailtext | |||
* @param string $fromaddress | |||
* @param string $fromname | |||
* @param bool $html | |||
* @param int $html | |||
* @param string $altbody | |||
* @param string $ccaddress | |||
* @param string $ccname | |||
@@ -85,7 +85,7 @@ class Util { | |||
* write exception into the log. Include the stack trace | |||
* if DEBUG mode is enabled | |||
* @param string $app app name | |||
* @param Exception $ex exception to log | |||
* @param \Exception $ex exception to log | |||
*/ | |||
public static function logException( $app, \Exception $ex ) { | |||
$class = get_class($ex); | |||
@@ -156,6 +156,7 @@ class Util { | |||
* formats a timestamp in the "right" way | |||
* @param int $timestamp $timestamp | |||
* @param bool $dateOnly option to omit time from the result | |||
* @return string timestamp | |||
*/ | |||
public static function formatDate( $timestamp, $dateOnly=false) { | |||
return(\OC_Util::formatDate( $timestamp, $dateOnly )); | |||
@@ -203,9 +204,8 @@ class Util { | |||
* Creates an url using a defined route | |||
* @param $route | |||
* @param array $parameters | |||
* @return | |||
* @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() ) { | |||
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 | |||
* | |||
* @return the request uri | |||
* @return string the request uri | |||
*/ | |||
public static function getRequestUri() { | |||
return(\OC_Request::requestUri()); | |||
@@ -293,8 +292,7 @@ class Util { | |||
/** | |||
* Returns the script name, even if the website uses one or more reverse proxies | |||
* | |||
* @return the script name | |||
* @returns string the script name | |||
*/ | |||
public static function getScriptName() { | |||
return(\OC_Request::scriptName()); | |||
@@ -350,7 +348,7 @@ class Util { | |||
* Emits a signal. To get data from the slot use references! | |||
* @param string $signalclass class name of emitter | |||
* @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 | |||
* | |||
* TODO: write example | |||
@@ -467,9 +465,8 @@ class Util { | |||
/** | |||
* Calculate free space left within user quota | |||
* | |||
* @param $dir the current folder where the user currently operates | |||
* @return number of bytes representing | |||
* @param string $dir the current folder where the user currently operates | |||
* @return int number of bytes representing | |||
*/ | |||
public static function freeSpace($dir) { | |||
return \OC_Helper::freeSpace($dir); |
@@ -14,7 +14,7 @@ OC_App::setActiveNavigationEntry( "admin" ); | |||
$tmpl = new OC_Template( 'settings', 'admin', 'user'); | |||
$forms=OC_App::getForms('admin'); | |||
$htaccessworking=OC_Util::isHtAccessWorking(); | |||
$htaccessworking=OC_Util::isHtaccessWorking(); | |||
$entries=OC_Log_Owncloud::getEntries(3); | |||
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3; |
@@ -34,7 +34,7 @@ try { | |||
if (OC::$CLI) { | |||
print_r($values); | |||
} else { | |||
echo(json_encode($values)); | |||
print_unescaped(json_encode($values)); | |||
} | |||
} catch (Exception $ex) { |
@@ -1,6 +1,8 @@ | |||
<?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); | |||
// The human readable string |