diff --git a/admin/js/users.js b/admin/js/users.js index 48f3b15e3b..994ce6f6cb 100644 --- a/admin/js/users.js +++ b/admin/js/users.js @@ -112,7 +112,7 @@ $(document).ready(function(){ //######################################################################### // Password (clicking on user name) - $("div[x-use='usernamediv']").live( "click", function(){ + $("span[x-use='usernamediv']").live( "click", function(){ if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){ togglepassword = $(this).parent().parent().attr("x-uid"); // Set the username! @@ -167,6 +167,7 @@ $(document).ready(function(){ } }); $("#changegroupuid").val(togglegroup); + $(this).empty(); $(this).parent().append( $('#changegroups') ); $('#changegroups').show(); } @@ -205,13 +206,6 @@ $(document).ready(function(){ // Clicking on buttons //######################################################################### - // Show the create user form - $( "#createuseroptionbutton" ) - .click(function(){ - $("#createuserform").show(); - $("#createuseroption").hide(); - return false; - }); // Create a new user $( "#createuserbutton" ) diff --git a/admin/templates/users.php b/admin/templates/users.php index 133028c4e2..147db7c7aa 100644 --- a/admin/templates/users.php +++ b/admin/templates/users.php @@ -1,101 +1,102 @@ -

t( 'Users' ); ?>

- - - - - - - - - - - - - - - - - - - - - - - - - - "> - - - - - - -
t( 'Name' ); ?>t( 'Groups' ); ?>
  
t( 'remove' ); ?>
- -

t( 'Groups' ); ?>

- - - - - - - - - +
+ t( 'Users' ); ?> +
t( 'Name' ); ?>
+ - - + + + - - - - - "> - - + + + + + + + + - - -
t( 'Name' ); ?>t( 'Groups' ); ?>
- - t( 'remove' ); ?> - -   - -
+ ' /> + ' /> + + + " type="checkbox" name="groups[]" value="" /> + "> + + + +
+ + + + "> + +
+ + + t( 'remove' ); ?> + + + + + + + + +
+ t( 'Groups' ); ?> + + + + + + + + + + + + + + + + + + "> + + + + + +
t( 'Name' ); ?>
+ + t( 'remove' ); ?> + +   + +
+
- - + - +
diff --git a/admin/users.php b/admin/users.php index 0848d57162..8237d06da0 100644 --- a/admin/users.php +++ b/admin/users.php @@ -30,6 +30,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )) // We have some javascript foo! OC_UTIL::addScript( "admin", "users" ); +OC_UTIL::addStyle( "admin", "users" ); OC_APP::setActiveNavigationEntry( "core_users" ); $users = array(); diff --git a/apps/files_publiclink/lib_public.php b/apps/files_publiclink/lib_public.php index 93ccc52d0e..b4bc86505a 100644 --- a/apps/files_publiclink/lib_public.php +++ b/apps/files_publiclink/lib_public.php @@ -26,8 +26,8 @@ class OC_PublicLink{ */ public static function getPath($token){ //remove expired links - $query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < NOW() AND expire_time!=0"); - $query->execute(); + $query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < ? AND expire_time!=0"); + $query->execute(array(time())); //get the path and the user $query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?"); diff --git a/apps/files_publiclink/templates/admin.php b/apps/files_publiclink/templates/admin.php index 95b99109f2..da4586cb3d 100644 --- a/apps/files_publiclink/templates/admin.php +++ b/apps/files_publiclink/templates/admin.php @@ -11,7 +11,7 @@ '> - l('datetime', $link['expire_time']);?> + l('date', $link['expire_time']);?> '>?token= diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index b197aaa250..a2fd48cdf0 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -97,7 +97,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND { return $entries[0]["dn"]; } public function checkPassword( $uid, $password ) { - if(!self::$configured){ + if(!$this->configured){ return false; } $dn = $this->getDn( $uid ); @@ -108,7 +108,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND { } public function userExists( $uid ) { - if(!self::$configured){ + if(!$this->configured){ return false; } $dn = $this->getDn($uid); diff --git a/apps/user_openid/phpmyid.php b/apps/user_openid/phpmyid.php index 7991b87c6d..146eb380f7 100644 --- a/apps/user_openid/phpmyid.php +++ b/apps/user_openid/phpmyid.php @@ -209,7 +209,6 @@ function authorize_mode () { $profile['idp_url']=$IDENTITY; if (isset($_SERVER['PHP_AUTH_USER']) && $profile['authorized'] === false && $_SERVER['PHP_AUTH_USER']==$USERNAME) { if (OC_USER::checkPassword($USERNAME, $_SERVER['PHP_AUTH_PW'])) {// successful login! - error_log('success'); // return to the refresh url if they get in $_SESSION['openid_auth']=true; $_SESSION['openid_user']=$USERNAME; @@ -339,7 +338,7 @@ function checkid ( $wait ) { : error_get($return_to, 'Missing identity'); $assoc_handle = @strlen($_REQUEST['openid_assoc_handle']) - ? $_REQUEST['openid_assoc.handle'] + ? $_REQUEST['openid_assoc_handle'] : null; $trust_root = @strlen($_REQUEST['openid_trust_root']) @@ -1626,7 +1625,6 @@ $GLOBALS['port'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' && $_ : ':' . $_SERVER['SERVER_PORT']; -error_log($_SERVER['HTTP_HOST']); /** * Determine the HTTP request protocol * @name $proto @@ -1651,15 +1649,15 @@ $profile['req_url'] = sprintf("%s://%s%s", // $port,//host already includes the path $_SERVER["REQUEST_URI"]); -$fullId=urlencode('.php/'.$USERNAME); -$incompleteId=urlencode('.php/'); +$fullId='user.php/'.$USERNAME.'/'; +$incompleteId='user.php/'; if(!strpos($profile['req_url'],$fullId)){ $profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']); } -error_log('inc id: '.$fullId); -error_log('req url: '.$profile['req_url']); +// error_log('inc id: '.$fullId); +// error_log('req url: '.$profile['req_url']); // Set the default allowance for testing if (! array_key_exists('allow_test', $profile)) diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php index 52af9ba3a5..4b5d13e339 100644 --- a/apps/user_openid/user.php +++ b/apps/user_openid/user.php @@ -25,6 +25,9 @@ $USERNAME=substr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],'.php/') if(strpos($USERNAME,'?')!==false){ $USERNAME=substr($USERNAME,0,strpos($USERNAME,'?')); } +if(substr($USERNAME,-1,1)=='/'){//openid sometimes add slashes to the username + $USERNAME=substr($USERNAME,0,-1); +} if($USERNAME=='' and isset($_SERVER['PHP_AUTH_USER'])){ @@ -36,7 +39,8 @@ $RUNTIME_NOAPPS=false; require_once '../../lib/base.php'; if(!OC_USER::userExists($USERNAME)){ - $USERNAME=''; + error_log($USERNAME.' doesn\'t exist'); + $USERNAME=''; } global $WEBROOT; $IDENTITY=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$WEBROOT.'/apps/user_openid/user.php/'.$USERNAME; diff --git a/core/css/styles.css b/core/css/styles.css index f0dfd1e9b1..f9b536a2b0 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -7,8 +7,6 @@ h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercas p.center { text-align:center; } a { color:#000; text-decoration:none; } -form { margin:2em 2em 2em 3em; } -form#quota { max-width:600px; } form#user_settings { max-width:600px; } form#user_settings p label { display:block; float:left; width:35%; padding:0.4em 0.5em 0 0; text-align:right; } form p { padding:0.5em 4em 0.5em 0.5em; text-align:left; } @@ -19,8 +17,8 @@ form input[type="submit"] { padding:0.1em 1em; border:1px solid #999; font-weigh form input[type="submit"]:hover, form input[type="submit"]:focus { border:1px solid #999; background-color:#999; outline:0; } form input[type="submit"]:active { outline:0; } form input[type="button"], form input[type="text"] { font-size: 0.9em; } -fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; } -legend { padding:0 0.5em; font-size:1.2em; } +fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; max-width:600px; margin:2em 2em 2em 3em; } +legend { padding: 0.5em; font-size:1.2em; } div.controls { width:91%; margin:1em 1em 1em 2em; padding:0.5em 0; background-color:#f7f7f7; border:1px solid #eee; } @@ -107,7 +105,10 @@ div.controls { width:91%; margin:1em 1em 1em 2em; padding:0.5em 0; background-co background-color: #666; color: #FFF; } - +#login_form input[type="checkbox"] +{ + width:15px; +} #setup_form { margin: 3em auto; diff --git a/core/templates/login.php b/core/templates/login.php index 0ed4178a98..19830a2499 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -5,8 +5,15 @@ t( 'Login failed!' ); ?> + + t('Remember login'); ?> + + + + t('Remember login'); ?> +
diff --git a/files/ajax/upload.php b/files/ajax/upload.php index effee0c03c..f47f9b3d28 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -14,20 +14,26 @@ if( !OC_USER::isLoggedIn()){ exit(); } -$fileName=$_FILES['file']['name']; -$source=$_FILES['file']['tmp_name']; +$files=$_FILES['files']; + $dir = $_POST['dir']; if(!empty($dir)) $dir .= '/'; -$target='/' . stripslashes($dir) . $fileName; +$error=''; +$result=array(); if(strpos($dir,'..') === false){ - if(OC_FILESYSTEM::fromUploadedFile($source,$target)){ - echo json_encode(array( "status" => "success", 'mime'=>OC_FILESYSTEM::getMimeType($target),'size'=>OC_FILESYSTEM::filesize($target))); - exit(); + $fileCount=count($files['name']); + for($i=0;$i<$fileCount;$i++){ + $target='/' . stripslashes($dir) . $files['name'][$i]; + if(OC_FILESYSTEM::fromUploadedFile($files['tmp_name'][$i],$target)){ + $result[]=array( "status" => "success", 'mime'=>OC_FILESYSTEM::getMimeType($target),'size'=>OC_FILESYSTEM::filesize($target),'name'=>$files['name'][$i]); + } } + echo json_encode($result); + exit(); +}else{ + $error='invalid dir'; } -$error = $_FILES['file']['error']; - echo json_encode(array( 'status' => 'error', 'data' => array('error' => $error, "file" => $fileName))); ?> diff --git a/files/css/files.css b/files/css/files.css index ed67755ab4..f4da6fae98 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -20,31 +20,32 @@ text-decoration: none; } -#file_upload_form, #file_newfolder_form { +.file_upload_form, #file_newfolder_form { display: inline; + margin-left:3em; } #fileSelector, #file_upload_submit, #file_newfolder_submit { display: none; } -#file_upload_filename, #file_newfolder_name { +.file_upload_filename, #file_newfolder_name { background-repeat: no-repeat; background-position: 0.5em 0; padding-left: 2em; } -#file_upload_filename { +.file_upload_filename { background-image:url(../img/file.png); font-weight:bold; } -#file_upload_start {opacity:0;filter: alpha(opacity = 0);} +.file_upload_start {opacity:0;filter: alpha(opacity = 0);} #file_newfolder_name { background-image:url(../img/folder.png); font-weight:bold; width: 14em; } -#file_upload_start, #file_upload_filename{ +.file_upload_start, .file_upload_filename{ position:absolute; top:0px; left:0px; @@ -52,7 +53,7 @@ font-size: 0.9em; } -#file_upload_wrapper{ +.file_upload_wrapper{ position:relative; top:-1.2em; left:-2em; @@ -65,7 +66,7 @@ width: 3em; } -#file_upload_target { +.file_upload_target { display: none; } diff --git a/files/img/loading.gif b/files/img/loading.gif new file mode 100644 index 0000000000..5b33f7e54f Binary files /dev/null and b/files/img/loading.gif differ diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 1bdbc4ac0b..b683dc0cd3 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -86,7 +86,7 @@ FileActions.register('all','Download',function(filename){ FileActions.register('all','Delete',function(filename){ $.ajax({ url: 'ajax/delete.php', - data: "dir="+$('#dir').val()+"&file="+filename, + data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename), complete: function(data){ boolOperationFinished(data, function(){ FileList.remove(filename); diff --git a/files/js/filelist.js b/files/js/filelist.js index 290f062dae..2c662087ab 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -2,16 +2,21 @@ FileList={ update:function(fileListHtml) { $('#fileList').empty().html(fileListHtml); }, - addFile:function(name,size,lastModified){ + addFile:function(name,size,lastModified,loading){ + var img=(loading)?'img/loading.gif':'img/file.png'; var html=''; html+=''; - html+=''+name+''; + html+=''+name+''; html+=''+size+''; html+=''+lastModified+''; html+=''; html+=''; FileList.insertElement(name,'file',$(html)); - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + if(loading){ + $('tr[data-file="'+name+'"]').data('loading',true); + }else{ + $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + } }, addDir:function(name,size,lastModified){ var html=''; @@ -58,5 +63,13 @@ FileList={ }else{ $('#fileList').append(element); } + }, + loadingDone:function(name){ + $('tr[data-file="'+name+'"]').data('loading',false); + $('tr[data-file="'+name+'"] td.filename a').attr('style','background-image:url(img/file.png'); + $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + }, + isLoading:function(name){ + return $('tr[data-file="'+name+'"]').data('loading'); } } diff --git a/files/js/files.js b/files/js/files.js index 3c02110fe2..d419121597 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -40,11 +40,13 @@ $(document).ready(function() { $('td.filename a').live('click',function(event) { event.preventDefault(); var filename=$(this).parent().parent().attr('data-file'); - var mime=$(this).parent().parent().attr('data-mime'); - var type=$(this).parent().parent().attr('data-type'); - var action=FileActions.getDefault(mime,type); - if(action){ - action(filename); + if(!FileList.isLoading(filename)){ + var mime=$(this).parent().parent().attr('data-mime'); + var type=$(this).parent().parent().attr('data-type'); + var action=FileActions.getDefault(mime,type); + if(action){ + action(filename); + } } }); @@ -115,7 +117,7 @@ $(document).ready(function() { //send the browser to the download location var dir=$('#dir').val()||'/'; // alert(files); - window.location='ajax/download.php?files='+files+'&dir='+dir; + window.location='ajax/download.php?files='+encodeURIComponent(files)+'&dir='+encodeURIComponent(dir); return false; }); @@ -128,7 +130,7 @@ $(document).ready(function() { $.ajax({ url: 'ajax/delete.php', - data: "dir="+$('#dir').val()+"&files="+files, + data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files), complete: function(data){ boolOperationFinished(data, function(){ $('td.selection input:checkbox:checked').parent().parent().each(function(i,element){ @@ -141,36 +143,51 @@ $(document).ready(function() { return false; }); - $('#file_upload_start').change(function(){ - var filename=$(this).val(); - filename=filename.replace(/^.*[\/\\]/g, ''); - $('#file_upload_filename').val(filename); - $('#file_upload_submit').show(); - }) - - $('#file_upload_submit').click(function(){ - var name=$('#file_upload_filename').val(); - if($('#file_upload_start')[0].files[0] && $('#file_upload_start')[0].files[0].size>0){ - var size=simpleFileSize($('#file_upload_start')[0].files[0].size); - }else{ - var size='Pending'; - } - $('#file_upload_target').load(function(){ - var response=jQuery.parseJSON($('#file_upload_target').contents().find('body').text()); + $('.file_upload_start').live('change',function(){ + var form=$(this).parent().parent(); + var uploadId=form.attr('data-upload-id'); + var files=this.files; + var target=form.children('iframe'); + target.load(function(){ + var response=jQuery.parseJSON(target.contents().find('body').text()); //set mimetype and if needed filesize - $('tr[data-file="'+name+'"]').attr('data-mime',response.mime); - if(size=='Pending'){ - $('tr[data-file='+name+'] td.filesize').text(response.size); + if(response){ + for(var i=0;i0){ + var size=simpleFileSize(files[i].size); + }else{ + var size='Pending'; + } + FileList.addFile(files[i].name,size,uploadTime,true); + } + + //clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading + var clone=form.clone(); + uploadId++; + clone.attr('data-upload-id',uploadId); + clone.attr('target','file_upload_target_'+uploadId); + clone.children('iframe').attr('name','file_upload_target_'+uploadId) + clone.insertBefore(form); + form.hide(); }); - //save the original upload button text - $('#file_upload_filename').data('upload_text',$('#file_upload_filename').val()); + + //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) + if(navigator.userAgent.search(/konqueror/i)==-1){ + $('.file_upload_start').attr('multiple','multiple') + } }); var adjustNewFolderSize = function() { diff --git a/files/templates/index.php b/files/templates/index.php index a1254eeb42..efc9290063 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -1,15 +1,14 @@
-
+ " id="max_upload"> )"> " id="dir"> -
- )"/> - +
+ )"/> +
  - - +
  diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 14a359fe66..d717f28885 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,6 +1,6 @@ + $simple_size_color = 200-intval(pow(($file['size']/(1024*1024)),2)); ?> diff --git a/help/templates/index.php b/help/templates/index.php index ac7e12b757..7105507f5e 100644 --- a/help/templates/index.php +++ b/help/templates/index.php @@ -1,23 +1,27 @@

t( 'Questions and Answers' ); ?>

- - - - - - - - - -
"") { echo(''); } ?>
'.$kb['description'].''); ?>
- '') echo('
Answer:
'.$kb['answer'].'');?> -
-printPage(); -?> -t( 'ASK A QUESTION' ); ?> + + Can't connect to Q&A database + + + + + + + + + + +
"") { echo(''); } ?>
'.$kb['description'].''); ?>
+ '') echo('
Answer:
'.$kb['answer'].'');?> +
+ printPage(); + ?> + t( 'ASK A QUESTION' ); ?> + diff --git a/index.php b/index.php index d1726676c6..2e2d495fda 100644 --- a/index.php +++ b/index.php @@ -31,7 +31,6 @@ OC_UTIL::addScript('setup'); $not_installed = !OC_CONFIG::getValue('installed', false); $install_called = (isset($_POST['install']) AND $_POST['install']=='true'); - // First step : check if the server is correctly configured for ownCloud : $errors = OC_UTIL::checkServer(); if(count($errors) > 0) { @@ -61,17 +60,23 @@ elseif(isset($_POST["user"])) { OC_APP::loadApps(); if(OC_USER::login($_POST["user"], $_POST["password"])) { header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php")); + if(!empty($_POST["remember_login"])){ + OC_USER::setUsernameInCookie($_POST["user"]); + } + else { + OC_USER::unsetUsernameInCookie(); + } exit(); } else { - OC_TEMPLATE::printGuestPage("", "login", array("error" => true)); + OC_TEMPLATE::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["username"])); } } // For all others cases, we display the guest page : else { OC_APP::loadApps(); - OC_TEMPLATE::printGuestPage("", "login", array("error" => false)); + OC_TEMPLATE::printGuestPage("", "login", array("error" => false, "username" => $_COOKIE["username"])); } ?> \ No newline at end of file diff --git a/lib/filestorage.php b/lib/filestorage.php index 819ad2e60b..c2614dc5dc 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -65,6 +65,7 @@ OC_FILESYSTEM::registerStorageType('local','OC_FILESTORAGE_LOCAL',array('datadir */ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ private $datadir; + private static $mimetypes=null; public function __construct($arguments){ $this->datadir=$arguments['datadir']; if(substr($this->datadir,-1)!=='/'){ @@ -209,71 +210,14 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ $mime_type=substr($reply,0,strrpos($reply,' ')); } if (empty($mime_type)) { - // Fallback solution: try to guess the type by the file extension - // TODO: add more ... - switch (strtolower(strrchr(basename($fspath), "."))) { - case '.css': - $mime_type = 'text/css'; - break; - case '.flac': - $mime_type = 'audio/flac'; - break; - case '.gif': - $mime_type = 'image/gif'; - break; - case '.gzip': - case '.gz': - $mime_type = 'application/x-gzip'; - break; - case '.htm': - case '.html': - $mime_type = 'text/html'; - break; - case '.jpeg': - case '.jpg': - $mime_type = 'image/jpeg'; - break; - case '.js': - $mime_type = 'application/x-javascript'; - break; - case '.oga': - case '.ogg': - $mime_type = 'audio/ogg'; - break; - case '.ogv': - $mime_type = 'video/ogg'; - break; - case '.pdf': - $mime_type = 'application/pdf'; - break; - case '.png': - $mime_type = 'image/png'; - break; - case '.svg': - $mime_type = 'image/svg+xml'; - break; - case '.tar': - $mime_type = 'application/x-tar'; - break; - case '.tgz': - $mime_type = 'application/x-compressed'; - break; - case '.tif': - case '.tiff': - $mime_type = 'image/tiff'; - break; - case '.txt': - $mime_type = 'text/plain'; - break; - case '.zip': - $mime_type = 'application/zip'; - break; - default: - $mime_type = 'application/octet-stream'; - break; + // Fallback solution: (try to guess the type by the file extension + if(!self::$mimetypes){ + self::$mimetypes=include('mimetypes.list.php'); } + $extention=strtolower(strrchr(basename($fspath), ".")); + $extention=substr($extention,1);//remove leading . + $mime_type=(isset(self::$mimetypes[$extention]))?self::$mimetypes[$extention]:'application/octet-stream'; } - return $mime_type; } } diff --git a/lib/mimetypes.list.php b/lib/mimetypes.list.php new file mode 100644 index 0000000000..6d8b3b9abc --- /dev/null +++ b/lib/mimetypes.list.php @@ -0,0 +1,81 @@ +. +* +*/ + +/** + * list of mimetypes by extention + */ + +return array( + 'css'=>'text/css', + 'flac'=>'audio/flac', + 'gif'=>'image/gif', + 'gzip'=>'application/x-gzip', + 'gz'=>'application/x-gzip', + 'html'=>'text/html', + 'htm'=>'text/html', + 'jpeg'=>'image/jpeg', + 'jpg'=>'image/jpeg', + 'js'=>'application/javascript', + 'oga'=>'audio/ogg', + 'ogg'=>'audio/ogg', + 'ogv'=>'video/ogg', + 'pdf'=>'application/pdf', + 'png'=>'image/png', + 'svg'=>'image/svg+xml', + 'tar'=>'application/x-tar', + 'tgz'=>'application/x-compressed', + 'tar.gz'=>'application/x-compressed', + 'tif'=>'image/tiff', + 'tiff'=>'image/tiff', + 'txt'=>'text/plain', + 'zip'=>'application/zip', + 'wav'=>'audio/wav', + 'odt'=>'application/vnd.oasis.opendocument.text', + 'ods'=>'application/vnd.oasis.opendocument.spreadsheet', + 'odg'=>'application/vnd.oasis.opendocument.graphics', + 'odp'=>'application/vnd.oasis.opendocument.presentation', + 'kra'=>'application/x-krita', + 'mp3'=>'audio/mpeg', + 'doc'=>'application/msword', + 'docx'=>'application/msword', + 'xls'=>'application/msexcel', + 'xlsx'=>'application/msexcel', + 'php'=>'application/x-php', + 'exe'=>'application/x-ms-dos-executable', + 'pl'=>'application/x-pearl', + 'py'=>'application/x-python', + 'blend'=>'application/x-blender', + 'xcf'=>'application/x-gimp', + 'psd'=>'application/x-photoshop', + 'xml'=>'application/xml', + 'avi'=>'video/x-msvideo', + 'dv'=>'video/dv', + 'm2t'=>'video/mp2t', + 'mp4'=>'video/mp4', + 'm4v'=>'video/mp4', + 'mpg'=>'video/mpeg', + 'mpeg'=>'video/mpeg', + 'mov'=>'video/quicktime', + 'webm'=>'video/webm', + 'wmv'=>'video/x-ms-asf' +); +?> \ No newline at end of file diff --git a/lib/setup.php b/lib/setup.php index 1be4dea286..1a33209ec5 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -102,12 +102,12 @@ class OC_SETUP { //add prefix to the mysql user name to prevent collissions $dbusername='oc_mysql_'.$username; //hash the password so we don't need to store the admin config in the config file - $dbpassowrd=md5(time().$password); + $dbpassword=md5(time().$password); - self::createDBUser($dbusername, $dbpassowrd, $connection); + self::createDBUser($dbusername, $dbpassword, $connection); OC_CONFIG::setValue('dbuser', $dbusername); - OC_CONFIG::setValue('dbpassword', $dbpassowrd); + OC_CONFIG::setValue('dbpassword', $dbpassword); //create the database self::createDatabase($dbname, $dbusername, $connection); diff --git a/lib/user.php b/lib/user.php index 25f555b47b..a64ce05f2c 100644 --- a/lib/user.php +++ b/lib/user.php @@ -337,4 +337,20 @@ class OC_USER { } return false; } + + /** + * @brief Set cookie value to use in next page load + * @param string $username username to be set + */ + public static function setUsernameInCookie($username){ + setcookie("username", $username, mktime().time()+60*60*24*15); + } + + /** + * @brief Remove cookie for "remember username" + */ + public static function unsetUsernameInCookie(){ + unset($_COOKIE["username"]); + setcookie("username", NULL, -1); + } }