Merge branch 'master' into sharing
This commit is contained in:
commit
abf6ba621a
|
@ -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" )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<h2><?php echo $l->t( 'Users' ); ?></h2>
|
||||
|
||||
<fieldset>
|
||||
<legend><?php echo $l->t( 'Users' ); ?></legend>
|
||||
<table id="usertable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -9,41 +9,42 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr id="createuseroption">
|
||||
<td><button id="createuseroptionbutton"><?php echo $l->t( 'Add user' ); ?></button></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr id="createuserform">
|
||||
<form id="createuserdata">
|
||||
<tr id="createuserform" style="display:none;">
|
||||
<td>
|
||||
<?php echo $l->t( 'Name' ); ?> <input x-use="createuserfield" type="text" name="username" /><br>
|
||||
<?php echo $l->t( 'Password' ); ?> <input x-use="createuserfield" type="password" name="password" />
|
||||
<input x-use="createuserfield" type="text" name="username" placeholder='<?php echo $l->t( 'Name' ); ?>' />
|
||||
<input x-use="createuserfield" type="password" name="password" placeholder='<?php echo $l->t( 'Password' ); ?>' />
|
||||
</td>
|
||||
<td id="createusergroups">
|
||||
<?php foreach($_["groups"] as $i): ?>
|
||||
<input x-use="createusercheckbox" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" />
|
||||
<span x-gid="<?php echo $i["name"]; ?>"><?php echo $i["name"]; ?><br></span>
|
||||
<input id='newuser_group_<?php echo $i["name"]; ?>' x-use="createusercheckbox" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" />
|
||||
<span x-gid="<?php echo $i["name"]; ?>"><label for='newuser_group_<?php echo $i["name"]; ?>'><?php echo $i["name"]; ?></label></span>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
<td>
|
||||
<button id="createuserbutton"><?php echo $l->t( 'Create user' ); ?></button>
|
||||
<button id="createuserbutton"><?php echo $l->t( 'Create' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach($_["users"] as $user): ?>
|
||||
<tr x-uid="<?php echo $user["name"] ?>">
|
||||
<td x-use="username"><div x-use="usernamediv"><?php echo $user["name"]; ?></div></td>
|
||||
<td x-use="username"><span x-use="usernamediv"><?php echo $user["name"]; ?></span></td>
|
||||
<td x-use="usergroups"><div x-use="usergroupsdiv"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo " ";} ?></div></td>
|
||||
<td><a class="removeuserbutton" href=""><?php echo $l->t( 'remove' ); ?></a></td>
|
||||
<td>
|
||||
<?php if($user['name']!=OC_USER::getUser()):?>
|
||||
<a class="removeuserbutton" href=""><?php echo $l->t( 'remove' ); ?></a>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<h2><?php echo $l->t( 'Groups' ); ?></h2>
|
||||
<fieldset>
|
||||
<legend><?php echo $l->t( 'Groups' ); ?></legend>
|
||||
<table id="grouptable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -74,28 +75,28 @@
|
|||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<div id="changegroups" style="display:none">
|
||||
<span id="changegroups" style="display:none">
|
||||
<form id="changegroupsform">
|
||||
<input id="changegroupuid" type="hidden" name="username" value="" />
|
||||
<input id="changegroupgid" type="hidden" name="group" value="" />
|
||||
<?php foreach($_["groups"] as $i): ?>
|
||||
<input x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" />
|
||||
<span x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>"><?php echo $i["name"]; ?><br></span>
|
||||
<span x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>"><?php echo $i["name"]; ?></span>
|
||||
<?php endforeach; ?>
|
||||
</form>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<div id="changepassword" style="display:none">
|
||||
<span id="changepassword" style="display:none">
|
||||
<form id="changepasswordform">
|
||||
<input id="changepassworduid" type="hidden" name="username" value="" />
|
||||
<?php echo $l->t( 'Force new password:' ); ?>
|
||||
<input id="changepasswordpwd" type="password" name="password" value="" />
|
||||
<button id="changepasswordbutton"><?php echo $l->t( 'Set' ); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<div id="removeuserform" title="Remove user">
|
||||
<form id="removeuserdata">
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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=?");
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<?php foreach($_['links'] as $link):?>
|
||||
<tr class='link' id='<?php echo $link['token'];?>'>
|
||||
<td class='path'><?php echo $link['path'];?></td>
|
||||
<td class='expire'><?php echo ($link['expire_time']==0)?'Never':$l->l('datetime', $link['expire_time']);?></td>
|
||||
<td class='expire'><?php echo ($link['expire_time']==0)?'Never':$l->l('date', $link['expire_time']);?></td>
|
||||
<td class='link'><a href='get.php?token=<?php echo $link['token'];?>'><?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?></a></td>
|
||||
<td><button class='delete fancybutton' data-token='<?php echo $link['token'];?>'><?php echo $l->t( 'Delete' ); ?></button></td>
|
||||
</tr>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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,6 +39,7 @@ $RUNTIME_NOAPPS=false;
|
|||
require_once '../../lib/base.php';
|
||||
|
||||
if(!OC_USER::userExists($USERNAME)){
|
||||
error_log($USERNAME.' doesn\'t exist');
|
||||
$USERNAME='';
|
||||
}
|
||||
global $WEBROOT;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -5,8 +5,15 @@
|
|||
<?php if($_['error']): ?>
|
||||
<?php echo $l->t( 'Login failed!' ); ?>
|
||||
<?php endif; ?>
|
||||
<?php if(empty($_["username"])){?>
|
||||
<input type="text" name="user" id="user" value="" autofocus />
|
||||
<input type="password" name="password" id="password" value="" />
|
||||
<input type="checkbox" name="remember_login"/> <?php echo $l->t('Remember login'); ?>
|
||||
<?php }else{ ?>
|
||||
<input type="text" name="user" id="user" value="<?php echo $_['username']; ?>">
|
||||
<input type="password" name="password" id="password" value="" autofocus />
|
||||
<input type="checkbox" name="remember_login" checked /> <?php echo $l->t('Remember login'); ?>
|
||||
<?php } ?>
|
||||
<input type="submit" value="Log in" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -14,19 +14,25 @@ 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)));
|
||||
$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)));
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -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);
|
||||
|
|
|
@ -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='<tr data-file="'+name+'" data-type="file">';
|
||||
html+='<td class="selection"><input type="checkbox" /></td>';
|
||||
html+='<td class="filename"><a style="background-image:url(img/file.png)" href="download.php?file='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
|
||||
html+='<td class="filename"><a style="background-image:url('+img+')" href="download.php?file='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
|
||||
html+='<td class="filesize">'+size+'</td>';
|
||||
html+='<td class="date">'+lastModified+'</td>';
|
||||
html+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
|
||||
html+='</tr>';
|
||||
FileList.insertElement(name,'file',$(html));
|
||||
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='<tr data-file="'+name+'" data-type="dir">';
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,14 @@ $(document).ready(function() {
|
|||
$('td.filename a').live('click',function(event) {
|
||||
event.preventDefault();
|
||||
var filename=$(this).parent().parent().attr('data-file');
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Sets the select_all checkbox behaviour :
|
||||
|
@ -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);
|
||||
$('.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
|
||||
if(response){
|
||||
for(var i=0;i<response.length;i++){
|
||||
var file=response[i];
|
||||
$('tr[data-file="'+file.name+'"]').attr('data-mime',file.mime);
|
||||
if(size=='Pending'){
|
||||
$('tr[data-file='+file.name+'] td.filesize').text(file.size);
|
||||
}
|
||||
FileList.loadingDone(file.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
form.submit();
|
||||
var date=new Date();
|
||||
var uploadTime=formatDate(date);
|
||||
for(var i=0;i<files.length;i++){
|
||||
if(files[i].size>0){
|
||||
var size=simpleFileSize(files[i].size);
|
||||
}else{
|
||||
var size='Pending';
|
||||
}
|
||||
$('#file_upload_target').load(function(){
|
||||
var response=jQuery.parseJSON($('#file_upload_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);
|
||||
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();
|
||||
});
|
||||
$('#file_upload_form').submit();
|
||||
var date=new Date();
|
||||
var uploadTime=formatDate(date);
|
||||
FileList.addFile(name,size,uploadTime);
|
||||
$('#file_upload_filename').val($('#file_upload_filename').data('upload_text'));
|
||||
});
|
||||
//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() {
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
<div class="controls">
|
||||
<div class="actions">
|
||||
<form id="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target">
|
||||
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_["uploadMaxFilesize"] ?>" id="max_upload">
|
||||
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)">
|
||||
<input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir">
|
||||
<div id='file_upload_wrapper'>
|
||||
<input class="prettybutton" id='file_upload_filename' value="Upload (max. <?php echo $_["uploadMaxHumanFilesize"];?>)"/>
|
||||
<input class="prettybutton" type="file" id="file_upload_start" name='file'/>
|
||||
<div class='file_upload_wrapper'>
|
||||
<input class="prettybutton file_upload_filename" value="Upload (max. <?php echo $_["uploadMaxHumanFilesize"];?>)"/>
|
||||
<input class="prettybutton file_upload_start" type="file" name='files[]'/>
|
||||
</div>
|
||||
<input class="prettybutton" type="button" id="file_upload_submit" name="file_upload_submit" value="OK" />
|
||||
<iframe id="file_upload_target" name="file_upload_target" src=""></iframe>
|
||||
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
|
||||
</form>
|
||||
<form id="file_newfolder_form">
|
||||
<input type="text" class="prettybutton" name="file_newfolder_name" id="file_newfolder_name" value="New Folder" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php foreach($_['files'] as $file):
|
||||
$simple_file_size = simple_file_size($file['size']);
|
||||
$simple_size_color = 200-intval(pow($simple_file_size,3)); ?>
|
||||
$simple_size_color = 200-intval(pow(($file['size']/(1024*1024)),2)); ?>
|
||||
<tr data-file="<?php echo $file['name'];?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>">
|
||||
<td class="selection"><input type="checkbox" /></td>
|
||||
<td class="filename">
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
<h1><?php echo $l->t( 'Questions and Answers' ); ?></h1>
|
||||
|
||||
<?php if(is_null($_["kbe"])):?>
|
||||
Can't connect to Q&A database
|
||||
<?php else:?>
|
||||
<table cellspacing="0" width="100%">
|
||||
<tbody>
|
||||
<?php foreach($_["kbe"] as $kb): ?>
|
||||
|
@ -19,5 +22,6 @@
|
|||
$pageNavi->printPage();
|
||||
?>
|
||||
<a target="_blank" class="prettybutton" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new"><?php echo $l->t( 'ASK A QUESTION' ); ?></a>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
|
|
11
index.php
11
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"]));
|
||||
}
|
||||
|
||||
?>
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Robin Appelman
|
||||
* @copyright 2011 Robin Appelman icewind1991@gmail.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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'
|
||||
);
|
||||
?>
|
|
@ -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);
|
||||
|
|
16
lib/user.php
16
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue