some more porting

This commit is contained in:
Frank Karlitschek 2012-05-01 21:07:08 +02:00
parent ab58471904
commit e2fb094693
12 changed files with 86 additions and 18 deletions

2
apps/files/ajax/list.php Normal file → Executable file
View File

@ -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;
}

2
apps/files/ajax/rawlist.php Normal file → Executable file
View File

@ -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;
}

View File

@ -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'];

2
apps/files_sharing/get.php Normal file → Executable file
View File

@ -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'];

View File

@ -16,7 +16,7 @@ if( OCA_Versions\Storage::isversioned( $source ) ) {
foreach ( $versions AS $version ) {
$versionsFormatted[] = OC_Util::formatDate( $version );
$versionsFormatted[] = OCP\Util::formatDate( $version );
}

4
apps/files_versions/history.php Normal file → Executable file
View File

@ -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'] ) );
}

2
apps/files_versions/templates/history.php Normal file → Executable file
View File

@ -22,7 +22,7 @@ if( isset( $_['message'] ) ) {
foreach ( $_['versions'] as $v ) {
echo ' ';
echo OC_Util::formatDate( $v );
echo OCP\Util::formatDate( $v );
echo ' <a href="history.php?path='.urlencode( $_['path'] ).'&revert='. $v .'" class="button">Revert</a><br /><br />';
}

View File

@ -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');

View File

@ -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);
}
}
?>

View File

@ -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));
}
}
?>

View File

@ -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

View File

@ -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 )){