From: Frank Karlitschek Date: Tue, 1 May 2012 19:07:08 +0000 (+0200) Subject: some more porting X-Git-Tag: v4.0.0beta~116 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e2fb094693e94d425fa9f59278806ef636fc127b;p=nextcloud-server.git some more porting --- diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php old mode 100644 new mode 100755 index 83914332a7d..0bff5742ef4 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -33,7 +33,7 @@ if($doBreadcrumb){ // make filelist $files = array(); foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ - $i["date"] = OC_Util::formatDate($i["mtime"] ); + $i["date"] = OCP\Util::formatDate($i["mtime"] ); $files[] = $i; } diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php old mode 100644 new mode 100755 index 0b37b93674f..86119de2d1b --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -16,7 +16,7 @@ $mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : ''; // make filelist $files = array(); foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){ - $i["date"] = OC_Util::formatDate($i["mtime"] ); + $i["date"] = OCP\Util::formatDate($i["mtime"] ); $i['mimetype_icon'] = $i['type'] == 'dir' ? mimetype_icon('dir'): mimetype_icon($i['mimetype']); $files[] = $i; } diff --git a/apps/files/index.php b/apps/files/index.php index c1b99cfaf5a..180452593ab 100755 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -44,7 +44,7 @@ if(!OC_Filesystem::is_dir($dir.'/')) { $files = array(); foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ - $i["date"] = OC_Util::formatDate($i["mtime"] ); + $i["date"] = OCP\Util::formatDate($i["mtime"] ); if($i['type']=='file'){ $fileinfo=pathinfo($i['name']); $i['basename']=$fileinfo['filename']; diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php old mode 100644 new mode 100755 index fbcb265fc03..f6ae4bf075f --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -27,7 +27,7 @@ if ($source !== false) { $files = array(); $rootLength = strlen($root); foreach (OC_Files::getdirectorycontent($source) as $i) { - $i['date'] = OC_Util::formatDate($i['mtime'] ); + $i['date'] = OCP\Util::formatDate($i['mtime'] ); if ($i['type'] == 'file') { $fileinfo = pathinfo($i['name']); $i['basename'] = $fileinfo['filename']; diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php index 9f5b5908797..d12cf368f18 100755 --- a/apps/files_versions/ajax/getVersions.php +++ b/apps/files_versions/ajax/getVersions.php @@ -16,7 +16,7 @@ if( OCA_Versions\Storage::isversioned( $source ) ) { foreach ( $versions AS $version ) { - $versionsFormatted[] = OC_Util::formatDate( $version ); + $versionsFormatted[] = OCP\Util::formatDate( $version ); } diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php old mode 100644 new mode 100755 index 16ad92b90da..d806638e011 --- a/apps/files_versions/history.php +++ b/apps/files_versions/history.php @@ -39,13 +39,13 @@ if ( isset( $_GET['path'] ) ) { $tmpl->assign( 'outcome_stat', 'success' ); - $tmpl->assign( 'outcome_msg', "File {$_GET['path']} was reverted to version ".OC_Util::formatDate( $_GET['revert'] ) ); + $tmpl->assign( 'outcome_msg', "File {$_GET['path']} was reverted to version ".OCP\Util::formatDate( $_GET['revert'] ) ); } else { $tmpl->assign( 'outcome_stat', 'failure' ); - $tmpl->assign( 'outcome_msg', "File {$_GET['path']} could not be reverted to version ".OC_Util::formatDate( $_GET['revert'] ) ); + $tmpl->assign( 'outcome_msg', "File {$_GET['path']} could not be reverted to version ".OCP\Util::formatDate( $_GET['revert'] ) ); } diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php old mode 100644 new mode 100755 index 2ef0c89e229..3b29625b3b0 --- a/apps/files_versions/templates/history.php +++ b/apps/files_versions/templates/history.php @@ -22,7 +22,7 @@ if( isset( $_['message'] ) ) { foreach ( $_['versions'] as $v ) { echo ' '; - echo OC_Util::formatDate( $v ); + echo OCP\Util::formatDate( $v ); echo ' Revert

'; } diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php index 867a0a3ed33..3e26d922689 100755 --- a/apps/user_openid/appinfo/app.php +++ b/apps/user_openid/appinfo/app.php @@ -14,8 +14,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'=')) } } -OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName)); -OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName)); +OCP\Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName)); +OCP\Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName)); OC_APP::registerPersonal('user_openid','settings'); diff --git a/lib/public/user.php b/lib/public/user.php index f59fbe0b25a..febac06730f 100644 --- a/lib/public/user.php +++ b/lib/public/user.php @@ -53,10 +53,39 @@ class User { return \OC_USER::isLoggedIn(); } + /** + * @brief check if a user exists + * @param string $uid the username + * @return boolean + */ + public static function userExists($uid){ + return \OC_USER::userExists($uid); + } -} + /** + * @brief Loggs the user out including all the session data + * @returns true + * + * Logout, destroys session + */ + public static function logout(){ + return \OC_USER::logout(); + } + + /** + * @brief Check if the password is correct + * @param $uid The username + * @param $password The password + * @returns true/false + * + * Check if the password is correct without logging in the user + */ + public static function checkPassword( $uid, $password ){ + return \OC_USER::checkPassword($uid, $password); + } +} ?> diff --git a/lib/public/util.php b/lib/public/util.php index 3e647fc6605..c4a73a5a7fc 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -39,6 +39,15 @@ class Util { const ERROR=3; const FATAL=4; + /** + * get the current installed version of ownCloud + * @return array + */ + public static function getVersion(){ + return(\OC_Util::getVersion()); + } + + /** * send an email * @@ -81,10 +90,38 @@ class Util { \OC_Util::addStyle($application, $file); } + /** + * add a javascript file + * + * @param appid $application + * @param filename $file + */ + public static function addScript( $application, $file = null ){ + \OC_Util::addScript($application, $file); + } -} + /** + * @brief Add a custom element to the header + * @param string tag tag name of the element + * @param array $attributes array of attributes for the element + * @param string $text the text content for the element + */ + public static function addHeader( $tag, $attributes, $text=''){ + \OC_Util::addHeader($tag, $attribute, $text); + } + /** + * formats a timestamp in the "right" way + * + * @param int timestamp $timestamp + * @param bool dateOnly option to ommit time from the result + */ + public static function formatDate( $timestamp,$dateOnly=false){ + return(\OC_Util::formatDate($timestamp,$dateOnly)); + } +} + ?> diff --git a/lib/user.php b/lib/user.php index 57ddb9e511b..8b887559df3 100644 --- a/lib/user.php +++ b/lib/user.php @@ -215,7 +215,7 @@ class OC_User { } /** - * @brief Kick the user + * @brief Logs the current user out and kills all the session data * @returns true * * Logout, destroys session diff --git a/lib/util.php b/lib/util.php index 5de5b8df384..d22d8710867 100644 --- a/lib/util.php +++ b/lib/util.php @@ -96,7 +96,8 @@ class OC_Util { /** * add a javascript file * - * @param url $url + * @param appid $application + * @param filename $file */ public static function addScript( $application, $file = null ){ if( is_null( $file )){ @@ -113,7 +114,8 @@ class OC_Util { /** * add a css file * - * @param url $url + * @param appid $application + * @param filename $file */ public static function addStyle( $application, $file = null ){ if( is_null( $file )){