Browse Source

fix some more phpdoc

tags/v4.5.0RC1
Robin Appelman 11 years ago
parent
commit
4131b205d4
13 changed files with 351 additions and 307 deletions
  1. 41
    24
      lib/app.php
  2. 17
    17
      lib/appconfig.php
  3. 11
    11
      lib/config.php
  4. 30
    22
      lib/group.php
  5. 17
    10
      lib/group/backend.php
  6. 27
    20
      lib/group/database.php
  7. 17
    10
      lib/group/interface.php
  8. 72
    73
      lib/helper.php
  9. 12
    12
      lib/hook.php
  10. 1
    1
      lib/l10n.php
  11. 33
    33
      lib/preferences.php
  12. 28
    28
      lib/public/config.php
  13. 45
    46
      lib/template.php

+ 41
- 24
lib/app.php View File

@@ -40,7 +40,7 @@ class OC_App{
/**
* @brief loads all apps
* @param array $types
* @returns true/false
* @return bool
*
* This function walks through the owncloud directory and loads all apps
* it can find. A directory contains an app if the file /appinfo/app.php
@@ -77,7 +77,7 @@ class OC_App{

/**
* load a single app
* @param string app
* @param string $app
*/
public static function loadApp($app) {
if(is_file(self::getAppPath($app).'/appinfo/app.php')) {
@@ -90,6 +90,7 @@ class OC_App{
* check if an app is of a specific type
* @param string $app
* @param string/array $types
* @return bool
*/
public static function isType($app,$types) {
if(is_string($types)) {
@@ -156,8 +157,8 @@ class OC_App{

/**
* @brief checks whether or not an app is enabled
* @param $app app
* @returns true/false
* @param string $app app
* @return bool
*
* This function checks whether or not an app is enabled.
*/
@@ -171,8 +172,8 @@ class OC_App{

/**
* @brief enables an app
* @param $app app
* @returns true/false
* @param mixed $app app
* @return bool
*
* This function set an app as enabled in appconfig.
*/
@@ -202,13 +203,12 @@ class OC_App{
}else{
return false;
}
return $app;
}

/**
* @brief disables an app
* @param $app app
* @returns true/false
* @param string $app app
* @return bool
*
* This function set an app as disabled in appconfig.
*/
@@ -219,8 +219,8 @@ class OC_App{

/**
* @brief adds an entry to the navigation
* @param $data array containing the data
* @returns true/false
* @param string $data array containing the data
* @return bool
*
* This function adds a new entry to the navigation visible to users. $data
* is an associative array.
@@ -245,8 +245,8 @@ class OC_App{

/**
* @brief marks a navigation entry as active
* @param $id id of the entry
* @returns true/false
* @param string $id id of the entry
* @return bool
*
* This function sets a navigation entry as active and removes the 'active'
* property from all other entries. The templates can use this for
@@ -259,7 +259,7 @@ class OC_App{

/**
* @brief gets the active Menu entry
* @returns id or empty string
* @return string id or empty string
*
* This function returns the id of the active navigation entry (set by
* setActiveNavigationEntry
@@ -270,7 +270,7 @@ class OC_App{

/**
* @brief Returns the Settings Navigation
* @returns associative array
* @return array
*
* This function returns an array containing all settings pages added. The
* entries are sorted by the key 'order' ascending.
@@ -291,7 +291,7 @@ class OC_App{
// personal menu
$settings[] = array( "id" => "personal", "order" => 1, "href" => OC_Helper::linkTo( "settings", "personal.php" ), "name" => $l->t("Personal"), "icon" => OC_Helper::imagePath( "settings", "personal.svg" ));

// if there're some settings forms
// if there are some settings forms
if(!empty(self::$settingsForms))
// settings menu
$settings[]=array( "id" => "settings", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "settings.php" ), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath( "settings", "settings.svg" ));
@@ -361,6 +361,7 @@ class OC_App{
return $app_dir[$appid]=$dir;
}
}
return false;
}
/**
* Get the directory for the given app.
@@ -370,6 +371,7 @@ class OC_App{
if( ($dir = self::findAppInDirectories($appid)) != false) {
return $dir['path'].'/'.$appid;
}
return false;
}

/**
@@ -380,6 +382,7 @@ class OC_App{
if( ($dir = self::findAppInDirectories($appid)) != false) {
return OC::$WEBROOT.$dir['url'].'/'.$appid;
}
return false;
}

/**
@@ -399,8 +402,8 @@ class OC_App{
/**
* @brief Read all app metadata from the info.xml file
* @param string $appid id of the app or the path of the info.xml file
* @param boolean path (optional)
* @returns array
* @param boolean $path (optional)
* @return array
* @note all data is read from info.xml, not just pre-defined fields
*/
public static function getAppInfo($appid,$path=false) {
@@ -415,24 +418,36 @@ class OC_App{
$data=array();
$content=@file_get_contents($file);
if(!$content) {
return;
return null;
}
$xml = new SimpleXMLElement($content);
$data['info']=array();
$data['remote']=array();
$data['public']=array();
foreach($xml->children() as $child) {
/**
* @var $child SimpleXMLElement
*/
if($child->getName()=='remote') {
foreach($child->children() as $remote) {
/**
* @var $remote SimpleXMLElement
*/
$data['remote'][$remote->getName()]=(string)$remote;
}
}elseif($child->getName()=='public') {
foreach($child->children() as $public) {
/**
* @var $public SimpleXMLElement
*/
$data['public'][$public->getName()]=(string)$public;
}
}elseif($child->getName()=='types') {
$data['types']=array();
foreach($child->children() as $type) {
/**
* @var $type SimpleXMLElement
*/
$data['types'][]=$type->getName();
}
}elseif($child->getName()=='description') {
@@ -449,7 +464,7 @@ class OC_App{

/**
* @brief Returns the navigation
* @returns associative array
* @return array
*
* This function returns an array containing all entries added. The
* entries are sorted by the key 'order' ascending. Additional to the keys
@@ -494,6 +509,8 @@ class OC_App{
case 'personal':
$source=self::$personalForms;
break;
default:
return array();
}
foreach($source as $form) {
$forms[]=include $form;
@@ -558,7 +575,7 @@ class OC_App{
/**
* @brief: get a list of all apps on apps.owncloud.com
* @return multi-dimensional array of apps. Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description
* @return array, multi-dimensional array of apps. Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description
*/
public static function getAppstoreApps( $filter = 'approved' ) {
@@ -674,7 +691,7 @@ class OC_App{

/**
* update the database for the app and call the update script
* @param string appid
* @param string $appid
*/
public static function updateApp($appid) {
if(file_exists(self::getAppPath($appid).'/appinfo/database.xml')) {
@@ -688,7 +705,7 @@ class OC_App{
include self::getAppPath($appid).'/appinfo/update.php';
}

//set remote/public handelers
//set remote/public handlers
$appData=self::getAppInfo($appid);
foreach($appData['remote'] as $name=>$path) {
OCP\CONFIG::setAppValue('core', 'remote_'.$name, $appid.'/'.$path);
@@ -701,7 +718,7 @@ class OC_App{
}

/**
* @param string appid
* @param string $appid
* @return OC_FilesystemView
*/
public static function getStorage($appid) {

+ 17
- 17
lib/appconfig.php View File

@@ -40,7 +40,7 @@
class OC_Appconfig{
/**
* @brief Get all apps using the config
* @returns array with app ids
* @return array with app ids
*
* This function returns a list of all apps that have at least one
* entry in the appconfig table.
@@ -60,8 +60,8 @@ class OC_Appconfig{

/**
* @brief Get the available keys for an app
* @param $app the app we are looking for
* @returns array with key names
* @param string $app the app we are looking for
* @return array with key names
*
* This function gets all keys of an app. Please note that the values are
* not returned.
@@ -81,13 +81,13 @@ class OC_Appconfig{

/**
* @brief Gets the config value
* @param $app app
* @param $key key
* @param $default = null, default value if the key does not exist
* @returns the value or $default
* @param string $app app
* @param string $key key
* @param string $default = null, default value if the key does not exist
* @return string the value or $default
*
* This function gets a value from the appconfig table. If the key does
* not exist the default value will be returnes
* not exist the default value will be returned
*/
public static function getValue( $app, $key, $default = null ) {
// At least some magic in here :-)
@@ -114,10 +114,10 @@ class OC_Appconfig{

/**
* @brief sets a value in the appconfig
* @param $app app
* @param $key key
* @param $value value
* @returns true/false
* @param string $app app
* @param string $key key
* @param string $value value
* @return bool
*
* Sets a value. If the key did not exist before it will be created.
*/
@@ -135,9 +135,9 @@ class OC_Appconfig{

/**
* @brief Deletes a key
* @param $app app
* @param $key key
* @returns true/false
* @param string $app app
* @param string $key key
* @return bool
*
* Deletes a key.
*/
@@ -151,8 +151,8 @@ class OC_Appconfig{

/**
* @brief Remove app from appconfig
* @param $app app
* @returns true/false
* @param string $app app
* @return bool
*
* Removes all keys in appconfig belonging to the app.
*/

+ 11
- 11
lib/config.php View File

@@ -47,7 +47,7 @@ class OC_Config{

/**
* @brief Lists all available config keys
* @returns array with key names
* @return array with key names
*
* This function returns all keys saved in config.php. Please note that it
* does not return the values.
@@ -60,9 +60,9 @@ class OC_Config{

/**
* @brief Gets a value from config.php
* @param $key key
* @param $default = null default value
* @returns the value or $default
* @param string $key key
* @param string $default = null default value
* @return string the value or $default
*
* This function gets the value from config.php. If it does not exist,
* $default will be returned.
@@ -79,9 +79,9 @@ class OC_Config{

/**
* @brief Sets a value
* @param $key key
* @param $value value
* @returns true/false
* @param string $key key
* @param string $value value
* @return bool
*
* This function sets the value and writes the config.php. If the file can
* not be written, false will be returned.
@@ -99,8 +99,8 @@ class OC_Config{

/**
* @brief Removes a key from the config
* @param $key key
* @returns true/false
* @param string $key key
* @return bool
*
* This function removes a key from the config.php. If owncloud has no
* write access to config.php, the function will return false.
@@ -121,7 +121,7 @@ class OC_Config{

/**
* @brief Loads the config file
* @returns true/false
* @return bool
*
* Reads the config file and saves it to the cache
*/
@@ -148,7 +148,7 @@ class OC_Config{

/**
* @brief Writes the config file
* @returns true/false
* @return bool
*
* Saves the config to the config file.
*

+ 30
- 22
lib/group.php View File

@@ -35,12 +35,15 @@
*/
class OC_Group {
// The backend used for group management
/**
* @var OC_Group_Interface[]
*/
private static $_usedBackends = array();

/**
* @brief set the group backend
* @param string $backend The backend to use for user managment
* @returns true/false
* @return bool
*/
public static function useBackend( $backend ) {
if($backend instanceof OC_Group_Interface) {
@@ -57,10 +60,10 @@ class OC_Group {

/**
* @brief Try to create a new group
* @param $gid The name of the group to create
* @returns true/false
* @param string $gid The name of the group to create
* @return bool
*
* Trys to create a new group. If the group name already exists, false will
* Tries to create a new group. If the group name already exists, false will
* be returned. Basic checking of Group name
*
* Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-"
@@ -94,6 +97,7 @@ class OC_Group {

return true;
}
return false;
}else{
return false;
}
@@ -101,8 +105,8 @@ class OC_Group {

/**
* @brief delete a group
* @param $gid gid of the group to delete
* @returns true/false
* @param string $gid gid of the group to delete
* @return bool
*
* Deletes a group and removes it from the group_user-table
*/
@@ -126,6 +130,7 @@ class OC_Group {

return true;
}
return false;
}else{
return false;
}
@@ -133,9 +138,9 @@ class OC_Group {

/**
* @brief is user in group?
* @param $uid uid of the user
* @param $gid gid of the group
* @returns true/false
* @param string $uid uid of the user
* @param string $gid gid of the group
* @return bool
*
* Checks whether the user is member of a group or not.
*/
@@ -150,9 +155,9 @@ class OC_Group {

/**
* @brief Add a user to a group
* @param $uid Name of the user to add to group
* @param $gid Name of the group in which add the user
* @returns true/false
* @param string $uid Name of the user to add to group
* @param string $gid Name of the group in which add the user
* @return bool
*
* Adds a user to a group.
*/
@@ -167,7 +172,7 @@ class OC_Group {
OC_Hook::emit( "OC_Group", "pre_addToGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid ));

if($run) {
$succes=false;
$success=false;

//add the user to the all backends that have the group
foreach(self::$_usedBackends as $backend) {
@@ -175,13 +180,13 @@ class OC_Group {
continue;

if($backend->groupExists($gid)) {
$succes|=$backend->addToGroup($uid, $gid);
$success|=$backend->addToGroup($uid, $gid);
}
}
if($succes) {
if($success) {
OC_Hook::emit( "OC_User", "post_addToGroup", array( "uid" => $uid, "gid" => $gid ));
}
return $succes;
return $success;
}else{
return false;
}
@@ -189,9 +194,9 @@ class OC_Group {

/**
* @brief Removes a user from a group
* @param $uid Name of the user to remove from group
* @param $gid Name of the group from which remove the user
* @returns true/false
* @param string $uid Name of the user to remove from group
* @param string $gid Name of the group from which remove the user
* @return bool
*
* removes the user from a group.
*/
@@ -216,8 +221,8 @@ class OC_Group {

/**
* @brief Get all groups a user belongs to
* @param $uid Name of the user
* @returns array with group names
* @param string $uid Name of the user
* @return array with group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
@@ -275,7 +280,10 @@ class OC_Group {
/**
* @brief get a list of all users in several groups
* @param array $gids
* @returns array with user ids
* @param string $search
* @param int $limit
* @param int $offset
* @return array with user ids
*/
public static function usersInGroups($gids, $search = '', $limit = -1, $offset = 0) {
$users = array();

+ 17
- 10
lib/group/backend.php View File

@@ -47,7 +47,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {

/**
* @brief Get all supported actions
* @returns bitwise-or'ed actions
* @return int bitwise-or'ed actions
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
@@ -65,8 +65,8 @@ abstract class OC_Group_Backend implements OC_Group_Interface {

/**
* @brief Check if backend implements actions
* @param $actions bitwise-or'ed actions
* @returns boolean
* @param int $actions bitwise-or'ed actions
* @return boolean
*
* Returns the supported actions as int to be
* compared with OC_GROUP_BACKEND_CREATE_GROUP etc.
@@ -77,9 +77,9 @@ abstract class OC_Group_Backend implements OC_Group_Interface {

/**
* @brief is user in group?
* @param $uid uid of the user
* @param $gid gid of the group
* @returns true/false
* @param string $uid uid of the user
* @param string $gid gid of the group
* @return bool
*
* Checks whether the user is member of a group or not.
*/
@@ -89,8 +89,8 @@ abstract class OC_Group_Backend implements OC_Group_Interface {

/**
* @brief Get all groups a user belongs to
* @param $uid Name of the user
* @returns array with group names
* @param string $uid Name of the user
* @return array with group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
@@ -101,7 +101,10 @@ abstract class OC_Group_Backend implements OC_Group_Interface {

/**
* @brief get a list of all groups
* @returns array with group names
* @param string $search
* @param int $limit
* @param int $offset
* @return array with group names
*
* Returns a list with all groups
*/
@@ -121,7 +124,11 @@ abstract class OC_Group_Backend implements OC_Group_Interface {

/**
* @brief get a list of all users in a group
* @returns array with user ids
* @param string $gid
* @param string $search
* @param int $limit
* @param int $offset
* @return array with user ids
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
return array();

+ 27
- 20
lib/group/database.php View File

@@ -44,10 +44,10 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief Try to create a new group
* @param $gid The name of the group to create
* @returns true/false
* @param string $gid The name of the group to create
* @return bool
*
* Trys to create a new group. If the group name already exists, false will
* Tries to create a new group. If the group name already exists, false will
* be returned.
*/
public function createGroup( $gid ) {
@@ -70,28 +70,28 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief delete a group
* @param $gid gid of the group to delete
* @returns true/false
* @param string $gid gid of the group to delete
* @return bool
*
* Deletes a group and removes it from the group_user-table
*/
public function deleteGroup( $gid ) {
// Delete the group
$stmt = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE `gid` = ?" );
$result = $stmt->execute( array( $gid ));
$stmt->execute( array( $gid ));

// Delete the group-user relation
$stmt = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `gid` = ?" );
$result = $stmt->execute( array( $gid ));
$stmt->execute( array( $gid ));

return true;
}

/**
* @brief is user in group?
* @param $uid uid of the user
* @param $gid gid of the group
* @returns true/false
* @param string $uid uid of the user
* @param string $gid gid of the group
* @return bool
*
* Checks whether the user is member of a group or not.
*/
@@ -105,9 +105,9 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief Add a user to a group
* @param $uid Name of the user to add to group
* @param $gid Name of the group in which add the user
* @returns true/false
* @param string $uid Name of the user to add to group
* @param string $gid Name of the group in which add the user
* @return bool
*
* Adds a user to a group.
*/
@@ -124,9 +124,9 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief Removes a user from a group
* @param $uid Name of the user to remove from group
* @param $gid Name of the group from which remove the user
* @returns true/false
* @param string $uid Name of the user to remove from group
* @param string $gid Name of the group from which remove the user
* @return bool
*
* removes the user from a group.
*/
@@ -139,8 +139,8 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief Get all groups a user belongs to
* @param $uid Name of the user
* @returns array with group names
* @param string $uid Name of the user
* @return array with group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
@@ -160,7 +160,10 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief get a list of all groups
* @returns array with group names
* @param string $search
* @param int $limit
* @param int $offset
* @return array with group names
*
* Returns a list with all groups
*/
@@ -190,7 +193,11 @@ class OC_Group_Database extends OC_Group_Backend {

/**
* @brief get a list of all users in a group
* @returns array with user ids
* @param string $gid
* @param string $search
* @param int $limit
* @param int $offset
* @return array with user ids
*/
public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
$stmt = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?', $limit, $offset);

+ 17
- 10
lib/group/interface.php View File

@@ -24,8 +24,8 @@
interface OC_Group_Interface {
/**
* @brief Check if backend implements actions
* @param $actions bitwise-or'ed actions
* @returns boolean
* @param int $actions bitwise-or'ed actions
* @return boolean
*
* Returns the supported actions as int to be
* compared with OC_GROUP_BACKEND_CREATE_GROUP etc.
@@ -34,9 +34,9 @@ interface OC_Group_Interface {

/**
* @brief is user in group?
* @param $uid uid of the user
* @param $gid gid of the group
* @returns true/false
* @param string $uid uid of the user
* @param string $gid gid of the group
* @return bool
*
* Checks whether the user is member of a group or not.
*/
@@ -44,8 +44,8 @@ interface OC_Group_Interface {

/**
* @brief Get all groups a user belongs to
* @param $uid Name of the user
* @returns array with group names
* @param string $uid Name of the user
* @return array with group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
@@ -54,7 +54,10 @@ interface OC_Group_Interface {

/**
* @brief get a list of all groups
* @returns array with group names
* @param string $search
* @param int $limit
* @param int $offset
* @return array with group names
*
* Returns a list with all groups
*/
@@ -69,8 +72,12 @@ interface OC_Group_Interface {

/**
* @brief get a list of all users in a group
* @returns array with user ids
* @param string $gid
* @param string $search
* @param int $limit
* @param int $offset
* @return array with user ids
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);

}
}

+ 72
- 73
lib/helper.php View File

@@ -30,10 +30,10 @@ class OC_Helper {

/**
* @brief Creates an url
* @param $app app
* @param $file file
* @param $args array with param=>value, will be appended to the returned url
* @returns the url
* @param string $app app
* @param string $file file
* @param array $args array with param=>value, will be appended to the returned url
* @return string the url
*
* Returns a url to the given app and file.
*/
@@ -74,10 +74,10 @@ class OC_Helper {

/**
* @brief Creates an absolute url
* @param $app app
* @param $file file
* @param $args array with param=>value, will be appended to the returned url
* @returns the url
* @param string $app app
* @param string $file file
* @param array $args array with param=>value, will be appended to the returned url
* @return string the url
*
* Returns a absolute url to the given app and file.
*/
@@ -88,8 +88,8 @@ class OC_Helper {

/**
* @brief Makes an $url absolute
* @param $url the url
* @returns the absolute url
* @param string $url the url
* @return string the absolute url
*
* Returns a absolute url to the given app and file.
*/
@@ -100,8 +100,8 @@ class OC_Helper {

/**
* @brief Creates an absolute url for remote use
* @param $service id
* @returns the url
* @param string $service id
* @return string the url
*
* Returns a absolute url to the given service.
*/
@@ -111,8 +111,8 @@ class OC_Helper {

/**
* @brief Creates an absolute url for public use
* @param $service id
* @returns the url
* @param string $service id
* @return string the url
*
* Returns a absolute url to the given service.
*/
@@ -122,9 +122,9 @@ class OC_Helper {

/**
* @brief Creates path to an image
* @param $app app
* @param $image image name
* @returns the url
* @param string $app app
* @param string $image image name
* @return string the url
*
* Returns the path to the image.
*/
@@ -153,8 +153,8 @@ class OC_Helper {

/**
* @brief get path to icon of file type
* @param $mimetype mimetype
* @returns the url
* @param string $mimetype mimetype
* @return string the url
*
* Returns the path to the image of this file type.
*/
@@ -187,8 +187,8 @@ class OC_Helper {

/**
* @brief Make a human file size
* @param $bytes file size in bytes
* @returns a human readable file size
* @param int $bytes file size in bytes
* @return string a human readable file size
*
* Makes 2048 to 2 kB.
*/
@@ -212,15 +212,14 @@ class OC_Helper {

/**
* @brief Make a computer file size
* @param $str file size in a fancy format
* @returns a file size in bytes
* @param string $str file size in a fancy format
* @return int a file size in bytes
*
* Makes 2kB to 2048.
*
* Inspired by: http://www.php.net/manual/en/function.filesize.php#92418
*/
public static function computerFileSize( $str ) {
$bytes = 0;
$str=strtolower($str);

$bytes_array = array(
@@ -249,10 +248,10 @@ class OC_Helper {
}

/**
* @brief Recusive editing of file permissions
* @param $path path to file or folder
* @param $filemode unix style file permissions as integer
*
* @brief Recursive editing of file permissions
* @param string $path path to file or folder
* @param int $filemode unix style file permissions
* @return bool
*/
static function chmodr($path, $filemode) {
if (!is_dir($path))
@@ -277,7 +276,7 @@ class OC_Helper {
}

/**
* @brief Recusive copying of folders
* @brief Recursive copying of folders
* @param string $src source folder
* @param string $dest target folder
*
@@ -299,9 +298,9 @@ class OC_Helper {
}

/**
* @brief Recusive deletion of folders
* @brief Recursive deletion of folders
* @param string $dir path to the folder
*
* @return bool
*/
static function rmdirr($dir) {
if(is_dir($dir)) {
@@ -317,12 +316,14 @@ class OC_Helper {
}
if(file_exists($dir)) {
return false;
}else{
return true;
}
}

/**
* get the mimetype form a local file
* @param string path
* @param string $path
* @return string
* does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
*/
@@ -379,7 +380,7 @@ class OC_Helper {

/**
* get the mimetype form a data string
* @param string data
* @param string $data
* @return string
*/
static function getStringMimeType($data) {
@@ -399,9 +400,9 @@ class OC_Helper {

/**
* @brief Checks $_REQUEST contains a var for the $s key. If so, returns the html-escaped value of this var; otherwise returns the default value provided by $d.
* @param $s name of the var to escape, if set.
* @param $d default value.
* @returns the print-safe value.
* @param string $s name of the var to escape, if set.
* @param string $d default value.
* @return string the print-safe value.
*
*/

@@ -415,7 +416,7 @@ class OC_Helper {
}

/**
* returns "checked"-attribut if request contains selected radio element OR if radio element is the default one -- maybe?
* returns "checked"-attribute if request contains selected radio element OR if radio element is the default one -- maybe?
* @param string $s Name of radio-button element name
* @param string $v Value of current radio-button element
* @param string $d Value of default radio-button element
@@ -428,8 +429,8 @@ class OC_Helper {
/**
* detect if a given program is found in the search PATH
*
* @param string program name
* @param string optional search path, defaults to $PATH
* @param string $program name
* @param string $optional search path, defaults to $PATH
* @return bool true if executable program found in path
*/
public static function canExecute($name, $path = false) {
@@ -451,18 +452,16 @@ class OC_Helper {
$dirs = explode(PATH_SEPARATOR, $path);
// WARNING : We have to check if open_basedir is enabled :
$obd = ini_get('open_basedir');
if($obd != "none")
if($obd != "none"){
$obd_values = explode(PATH_SEPARATOR, $obd);
if(count($obd_values) > 0 and $obd_values[0])
{
// open_basedir is in effect !
// We need to check if the program is in one of these dirs :
$dirs = $obd_values;
}
foreach($dirs as $dir)
{
foreach($exts as $ext)
{
if(count($obd_values) > 0 and $obd_values[0]){
// open_basedir is in effect !
// We need to check if the program is in one of these dirs :
$dirs = $obd_values;
}
}
foreach($dirs as $dir){
foreach($exts as $ext){
if($check_fn("$dir/$name".$ext))
return true;
}
@@ -472,8 +471,8 @@ class OC_Helper {

/**
* copy the contents of one stream to another
* @param resource source
* @param resource target
* @param resource $source
* @param resource $target
* @return int the number of bytes copied
*/
public static function streamCopy($source,$target) {
@@ -489,7 +488,7 @@ class OC_Helper {

/**
* create a temporary file with an unique filename
* @param string postfix
* @param string $postfix
* @return string
*
* temporary files are automatically cleaned up after the script is finished
@@ -553,10 +552,10 @@ class OC_Helper {
$ext = substr($filename, $pos);
} else {
$name = $filename;
$ext = '';
}

$newpath = $path . '/' . $filename;
$newname = $filename;
$counter = 2;
while (OC_Filesystem::file_exists($newpath)) {
$newname = $name . ' (' . $counter . ')' . $ext;
@@ -570,8 +569,8 @@ class OC_Helper {
/*
* checks if $sub is a subdirectory of $parent
*
* @param $sub
* @param $parent
* @param string $sub
* @param string $parent
* @return bool
*/
public static function issubdirectory($sub, $parent) {
@@ -604,9 +603,9 @@ class OC_Helper {
/**
* @brief Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
*
* @param $input The array to work on
* @param $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
* @param $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param array $input The array to work on
* @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return array
*
* Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
@@ -625,11 +624,11 @@ class OC_Helper {
/**
* @brief replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.
*
* @param $input The input string. .Opposite to the PHP build-in function does not accept an array.
* @param $replacement The replacement string.
* @param $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
* @param $length Length of the part to be replaced
* @param $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param string $input The input string. .Opposite to the PHP build-in function does not accept an array.
* @param string $replacement The replacement string.
* @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
* @param int $length Length of the part to be replaced
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return string
*
*/
@@ -646,11 +645,11 @@ class OC_Helper {
/**
* @brief Replace all occurrences of the search string with the replacement string
*
* @param $search The value being searched for, otherwise known as the needle. String.
* @param $replace The replacement string.
* @param $subject The string or array being searched and replaced on, otherwise known as the haystack.
* @param $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param $count If passed, this will be set to the number of replacements performed.
* @param string $search The value being searched for, otherwise known as the needle.
* @param string $replace The replacement
* @param string $subject The string or array being searched and replaced on, otherwise known as the haystack.
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param int $count If passed, this will be set to the number of replacements performed.
* @return string
*
*/
@@ -667,10 +666,10 @@ class OC_Helper {

/**
* @brief performs a search in a nested array
* @param haystack the array to be searched
* @param needle the search string
* @param $index optional, only search this key name
* @return the key of the matching field, otherwise false
* @param array $haystack the array to be searched
* @param string $needle the search string
* @param string $index optional, only search this key name
* @return mixed the key of the matching field, otherwise false
*
* performs a search in a nested array
*

+ 12
- 12
lib/hook.php View File

@@ -9,11 +9,11 @@ class OC_Hook{

/**
* @brief connects a function to a hook
* @param $signalclass class name of emitter
* @param $signalname name of signal
* @param $slotclass class name of slot
* @param $slotname name of slot
* @returns true/false
* @param string $signalclass class name of emitter
* @param string $signalname name of signal
* @param string $slotclass class name of slot
* @param string $slotname name of slot
* @return bool
*
* This function makes it very easy to connect to use hooks.
*
@@ -38,11 +38,11 @@ class OC_Hook{
}

/**
* @brief emitts a signal
* @param $signalclass class name of emitter
* @param $signalname name of signal
* @param $params defautl: array() array with additional data
* @returns true if slots exists or false if not
* @brief emits a signal
* @param string $signalclass class name of emitter
* @param string $signalname name of signal
* @param array $params defautl: array() array with additional data
* @return bool, true if slots exists or false if not
*
* Emits a signal. To get data from the slot use references!
*
@@ -68,8 +68,8 @@ class OC_Hook{

/**
* clear hooks
* @param string signalclass
* @param string signalname
* @param string $signalclass
* @param string $signalname
*/
static public function clear($signalclass='', $signalname='') {
if($signalclass) {

+ 1
- 1
lib/l10n.php View File

@@ -140,7 +140,7 @@ class OC_L10N{
/**
* @brief Translating
* @param $text String The text we need a translation for
* @param array|\default $parameters default:array() Parameters for sprintf
* @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text
*
* Returns the translation. If no translation is found, $text will be

+ 33
- 33
lib/preferences.php View File

@@ -40,7 +40,7 @@
class OC_Preferences{
/**
* @brief Get all users using the preferences
* @returns array with user ids
* @return array with user ids
*
* This function returns a list of all users that have at least one entry
* in the preferences table.
@@ -60,8 +60,8 @@ class OC_Preferences{

/**
* @brief Get all apps of a user
* @param $user user
* @returns array with app ids
* @param string $user user
* @return array with app ids
*
* This function returns a list of all apps of the user that have at least
* one entry in the preferences table.
@@ -81,9 +81,9 @@ class OC_Preferences{

/**
* @brief Get the available keys for an app
* @param $user user
* @param $app the app we are looking for
* @returns array with key names
* @param string $user user
* @param string $app the app we are looking for
* @return array with key names
*
* This function gets all keys of an app of an user. Please note that the
* values are not returned.
@@ -103,14 +103,14 @@ class OC_Preferences{

/**
* @brief Gets the preference
* @param $user user
* @param $app app
* @param $key key
* @param $default = null, default value if the key does not exist
* @returns the value or $default
* @param string $user user
* @param string $app app
* @param string $key key
* @param string $default = null, default value if the key does not exist
* @return string the value or $default
*
* This function gets a value from the prefernces table. If the key does
* not exist the default value will be returnes
* This function gets a value from the preferences table. If the key does
* not exist the default value will be returned
*/
public static function getValue( $user, $app, $key, $default = null ) {
// Try to fetch the value, return default if not exists.
@@ -127,11 +127,11 @@ class OC_Preferences{

/**
* @brief sets a value in the preferences
* @param $user user
* @param $app app
* @param $key key
* @param $value value
* @returns true/false
* @param string $user user
* @param string $app app
* @param string $key key
* @param string $value value
* @return bool
*
* Adds a value to the preferences. If the key did not exist before, it
* will be added automagically.
@@ -155,63 +155,63 @@ class OC_Preferences{

/**
* @brief Deletes a key
* @param $user user
* @param $app app
* @param $key key
* @returns true/false
* @param string $user user
* @param string $app app
* @param string $key key
* @return bool
*
* Deletes a key.
*/
public static function deleteKey( $user, $app, $key ) {
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
$result = $query->execute( array( $user, $app, $key ));
$query->execute( array( $user, $app, $key ));

return true;
}

/**
* @brief Remove app of user from preferences
* @param $user user
* @param $app app
* @returns true/false
* @param string $user user
* @param string $app app
* @return bool
*
* Removes all keys in appconfig belonging to the app and the user.
*/
public static function deleteApp( $user, $app ) {
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
$result = $query->execute( array( $user, $app ));
$query->execute( array( $user, $app ));

return true;
}

/**
* @brief Remove user from preferences
* @param $user user
* @returns true/false
* @param string $user user
* @return bool
*
* Removes all keys in appconfig belonging to the user.
*/
public static function deleteUser( $user ) {
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?' );
$result = $query->execute( array( $user ));
$query->execute( array( $user ));

return true;
}

/**
* @brief Remove app from all users
* @param $app app
* @returns true/false
* @param string $app app
* @return bool
*
* Removes all keys in preferences belonging to the app.
*/
public static function deleteAppFromAllUsers( $app ) {
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?' );
$result = $query->execute( array( $app ));
$query->execute( array( $app ));

return true;
}

+ 28
- 28
lib/public/config.php View File

@@ -40,9 +40,9 @@ namespace OCP;
class Config {
/**
* @brief Gets a value from config.php
* @param $key key
* @param $default = null default value
* @returns the value or $default
* @param string $key key
* @param string $default = null default value
* @return string the value or $default
*
* This function gets the value from config.php. If it does not exist,
* $default will be returned.
@@ -53,9 +53,9 @@ class Config {

/**
* @brief Sets a value
* @param $key key
* @param $value value
* @returns true/false
* @param string $key key
* @param string $value value
* @return bool
*
* This function sets the value and writes the config.php. If the file can
* not be written, false will be returned.
@@ -66,13 +66,13 @@ class Config {

/**
* @brief Gets the config value
* @param $app app
* @param $key key
* @param $default = null, default value if the key does not exist
* @returns the value or $default
* @param string $app app
* @param string $key key
* @param string $default = null, default value if the key does not exist
* @return string the value or $default
*
* This function gets a value from the appconfig table. If the key does
* not exist the default value will be returnes
* not exist the default value will be returned
*/
public static function getAppValue( $app, $key, $default = null ) {
return(\OC_Appconfig::getValue( $app, $key, $default ));
@@ -80,10 +80,10 @@ class Config {

/**
* @brief sets a value in the appconfig
* @param $app app
* @param $key key
* @param $value value
* @returns true/false
* @param string $app app
* @param string $key key
* @param string $value value
* @return string true/false
*
* Sets a value. If the key did not exist before it will be created.
*/
@@ -93,14 +93,14 @@ class Config {

/**
* @brief Gets the preference
* @param $user user
* @param $app app
* @param $key key
* @param $default = null, default value if the key does not exist
* @returns the value or $default
* @param string $user user
* @param string $app app
* @param string $key key
* @param string $default = null, default value if the key does not exist
* @return string the value or $default
*
* This function gets a value from the prefernces table. If the key does
* not exist the default value will be returnes
* This function gets a value from the preferences table. If the key does
* not exist the default value will be returned
*/
public static function getUserValue( $user, $app, $key, $default = null ) {
return(\OC_Preferences::getValue( $user, $app, $key, $default ));
@@ -108,16 +108,16 @@ class Config {

/**
* @brief sets a value in the preferences
* @param $user user
* @param $app app
* @param $key key
* @param $value value
* @returns true/false
* @param string $user user
* @param string $app app
* @param string $key key
* @param string $value value
* @returns bool
*
* Adds a value to the preferences. If the key did not exist before, it
* will be added automagically.
*/
public static function setUserValue( $user, $app, $key, $value ) {
return(\OC_Preferences::setValue( $user, $app, $key, $value ));
return(\OC_Preferences::setValue( $user, $app, $key, $value ));
}
}

+ 45
- 46
lib/template.php View File

@@ -23,10 +23,10 @@

/**
* @brief make OC_Helper::linkTo available as a simple function
* @param $app app
* @param $file file
* @param $args array with param=>value, will be appended to the returned url
* @returns link to the file
* @param string $app app
* @param string $file file
* @param array $args array with param=>value, will be appended to the returned url
* @return string link to the file
*
* For further information have a look at OC_Helper::linkTo
*/
@@ -36,9 +36,9 @@ function link_to( $app, $file, $args = array() ) {

/**
* @brief make OC_Helper::imagePath available as a simple function
* @param $app app
* @param $image image
* @returns link to the image
* @param string $app app
* @param string $image image
* @return string link to the image
*
* For further information have a look at OC_Helper::imagePath
*/
@@ -48,8 +48,8 @@ function image_path( $app, $image ) {

/**
* @brief make OC_Helper::mimetypeIcon available as a simple function
* @param $mimetype mimetype
* @returns link to the image
* @param string $mimetype mimetype
* @return string link to the image
*
* For further information have a look at OC_Helper::mimetypeIcon
*/
@@ -59,8 +59,8 @@ function mimetype_icon( $mimetype ) {

/**
* @brief make OC_Helper::humanFileSize available as a simple function
* @param $bytes size in bytes
* @returns size as string
* @param int $bytes size in bytes
* @return string size as string
*
* For further information have a look at OC_Helper::humanFileSize
*/
@@ -139,10 +139,10 @@ class OC_Template{

/**
* @brief Constructor
* @param $app app providing the template
* @param $file name of the template file (without suffix)
* @param $renderas = ""; produce a full page
* @returns OC_Template object
* @param string $app app providing the template
* @param string $file name of the template file (without suffix)
* @param string $renderas = ""; produce a full page
* @return OC_Template object
*
* This function creates an OC_Template object.
*
@@ -168,7 +168,7 @@ class OC_Template{
}

/**
* autodetects the formfactor of the used device
* autodetect the formfactor of the used device
* default -> the normal desktop browser interface
* mobile -> interface for smartphones
* tablet -> interface for tablets
@@ -226,7 +226,7 @@ class OC_Template{

/**
* @brief find the template with the given name
* @param $name of the template file (without suffix)
* @param string $name of the template file (without suffix)
*
* Will select the template file for the selected theme and formfactor.
* Checking all the possible locations.
@@ -271,13 +271,13 @@ class OC_Template{

/**
* @brief check Path For Template with and without $fext
* @param $path to check
* @param $name of the template file (without suffix)
* @param $fext formfactor extension
* @param string $path to check
* @param string $name of the template file (without suffix)
* @param string $fext formfactor extension
* @return bool true when found
*
* Will set $this->template and $this->path if there is a template at
* the specifief $path
* the specific $path
*/
protected function checkPathForTemplate($path, $name, $fext)
{
@@ -298,10 +298,10 @@ class OC_Template{

/**
* @brief Assign variables
* @param $key key
* @param $value value
* @param $sanitizeHTML false, if data shouldn't get passed through htmlentities
* @returns true
* @param string $key key
* @param string $value value
* @param bool $sanitizeHTML false, if data shouldn't get passed through htmlentities
* @return bool
*
* This function assigns a variable. It can be accessed via $_[$key] in
* the template.
@@ -316,9 +316,9 @@ class OC_Template{

/**
* @brief Appends a variable
* @param $key key
* @param $value value
* @returns true
* @param string $key key
* @param string $value value
* @return bool
*
* This function assigns a variable in an array context. If the key already
* exists, the value will be appended. It can be accessed via
@@ -335,7 +335,7 @@ class OC_Template{

/**
* @brief Add a custom element to the header
* @param string tag tag name of the element
* @param string $tag tag name of the element
* @param array $attributes array of attrobutes for the element
* @param string $text the text content for the element
*/
@@ -345,7 +345,7 @@ class OC_Template{

/**
* @brief Prints the proceeded template
* @returns true/false
* @return bool
*
* This function proceeds the template and prints its output.
*/
@@ -362,7 +362,7 @@ class OC_Template{

/**
* @brief Proceeds the template
* @returns content
* @return bool
*
* This function proceeds the template. If $this->renderas is set, it
* will produce a full page.
@@ -392,7 +392,7 @@ class OC_Template{

/**
* @brief doing the actual work
* @returns content
* @return string content
*
* Includes the template file, fetches its output
*/
@@ -413,13 +413,12 @@ class OC_Template{

/**
* @brief Include template
* @returns returns content of included template
* @return string returns content of included template
*
* Includes another template. use <?php echo $this->inc('template'); ?> to
* do this.
*/
public function inc( $file, $additionalparams = null ) {
// $_ erstellen
$_ = $this->vars;
$l = $this->l10n;

@@ -439,10 +438,10 @@ class OC_Template{

/**
* @brief Shortcut to print a simple page for users
* @param $application The application we render the template for
* @param $name Name of the template
* @param $parameters Parameters for the template
* @returns true/false
* @param string $application The application we render the template for
* @param string $name Name of the template
* @param array $parameters Parameters for the template
* @return bool
*/
public static function printUserPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "user" );
@@ -454,10 +453,10 @@ class OC_Template{

/**
* @brief Shortcut to print a simple page for admins
* @param $application The application we render the template for
* @param $name Name of the template
* @param $parameters Parameters for the template
* @returns true/false
* @param string $application The application we render the template for
* @param string $name Name of the template
* @param array $parameters Parameters for the template
* @return bool
*/
public static function printAdminPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "admin" );
@@ -469,10 +468,10 @@ class OC_Template{

/**
* @brief Shortcut to print a simple page for guests
* @param $application The application we render the template for
* @param $name Name of the template
* @param $parameters Parameters for the template
* @returns true/false
* @param string $application The application we render the template for
* @param string $name Name of the template
* @param string $parameters Parameters for the template
* @return bool
*/
public static function printGuestPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "guest" );

Loading…
Cancel
Save