Merge branch 'master' into sharing
This commit is contained in:
commit
abf6ba621a
|
@ -112,7 +112,7 @@ $(document).ready(function(){
|
||||||
//#########################################################################
|
//#########################################################################
|
||||||
|
|
||||||
// Password (clicking on user name)
|
// 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 ){
|
if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){
|
||||||
togglepassword = $(this).parent().parent().attr("x-uid");
|
togglepassword = $(this).parent().parent().attr("x-uid");
|
||||||
// Set the username!
|
// Set the username!
|
||||||
|
@ -167,6 +167,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#changegroupuid").val(togglegroup);
|
$("#changegroupuid").val(togglegroup);
|
||||||
|
$(this).empty();
|
||||||
$(this).parent().append( $('#changegroups') );
|
$(this).parent().append( $('#changegroups') );
|
||||||
$('#changegroups').show();
|
$('#changegroups').show();
|
||||||
}
|
}
|
||||||
|
@ -205,13 +206,6 @@ $(document).ready(function(){
|
||||||
// Clicking on buttons
|
// Clicking on buttons
|
||||||
//#########################################################################
|
//#########################################################################
|
||||||
|
|
||||||
// Show the create user form
|
|
||||||
$( "#createuseroptionbutton" )
|
|
||||||
.click(function(){
|
|
||||||
$("#createuserform").show();
|
|
||||||
$("#createuseroption").hide();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a new user
|
// Create a new user
|
||||||
$( "#createuserbutton" )
|
$( "#createuserbutton" )
|
||||||
|
|
|
@ -1,101 +1,102 @@
|
||||||
<h2><?php echo $l->t( 'Users' ); ?></h2>
|
<fieldset>
|
||||||
|
<legend><?php echo $l->t( 'Users' ); ?></legend>
|
||||||
<table id="usertable">
|
<table id="usertable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
|
||||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
|
||||||
<th><?php echo $l->t( 'Groups' ); ?></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr id="createuseroption">
|
|
||||||
<td><button id="createuseroptionbutton"><?php echo $l->t( 'Add user' ); ?></button></td>
|
|
||||||
<td> </td>
|
|
||||||
<td> </td>
|
|
||||||
</tr>
|
|
||||||
<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" />
|
|
||||||
</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>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<button id="createuserbutton"><?php echo $l->t( 'Create user' ); ?></button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</form>
|
|
||||||
</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="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>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><?php echo $l->t( 'Groups' ); ?></h2>
|
|
||||||
<table id="grouptable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $l->t( 'Name' ); ?></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<form id="creategroupdata">
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><input x-use="creategroupfield" type="text" name="groupname" /></td>
|
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||||
<td><button id="creategroupbutton"><?php echo $l->t( 'Create group' ); ?></button></td>
|
<th><?php echo $l->t( 'Groups' ); ?></th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
</thead>
|
||||||
</tfoot>
|
<tfoot>
|
||||||
<tbody>
|
<tr id="createuserform">
|
||||||
<?php foreach($_["groups"] as $group): ?>
|
<form id="createuserdata">
|
||||||
<tr x-gid="<?php echo $group["name"]; ?>">
|
<td>
|
||||||
<td><?php echo $group["name"] ?></td>
|
<input x-use="createuserfield" type="text" name="username" placeholder='<?php echo $l->t( 'Name' ); ?>' />
|
||||||
<td>
|
<input x-use="createuserfield" type="password" name="password" placeholder='<?php echo $l->t( 'Password' ); ?>' />
|
||||||
<?php if( $group["name"] != "admin" ): ?>
|
</td>
|
||||||
<a class="removegroupbutton" href=""><?php echo $l->t( 'remove' ); ?></a>
|
<td id="createusergroups">
|
||||||
<?php else: ?>
|
<?php foreach($_["groups"] as $i): ?>
|
||||||
|
<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"]; ?>" />
|
||||||
<?php endif; ?>
|
<span x-gid="<?php echo $i["name"]; ?>"><label for='newuser_group_<?php echo $i["name"]; ?>'><?php echo $i["name"]; ?></label></span>
|
||||||
</td>
|
<?php endforeach; ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button id="createuserbutton"><?php echo $l->t( 'Create' ); ?></button>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</tfoot>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
<?php foreach($_["users"] as $user): ?>
|
||||||
|
<tr x-uid="<?php echo $user["name"] ?>">
|
||||||
|
<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>
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend><?php echo $l->t( 'Groups' ); ?></legend>
|
||||||
|
<table id="grouptable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $l->t( 'Name' ); ?></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<form id="creategroupdata">
|
||||||
|
<tr>
|
||||||
|
<td><input x-use="creategroupfield" type="text" name="groupname" /></td>
|
||||||
|
<td><button id="creategroupbutton"><?php echo $l->t( 'Create group' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</tfoot>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($_["groups"] as $group): ?>
|
||||||
|
<tr x-gid="<?php echo $group["name"]; ?>">
|
||||||
|
<td><?php echo $group["name"] ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if( $group["name"] != "admin" ): ?>
|
||||||
|
<a class="removegroupbutton" href=""><?php echo $l->t( 'remove' ); ?></a>
|
||||||
|
<?php else: ?>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
<span id="changegroups" style="display:none">
|
||||||
<div id="changegroups" style="display:none">
|
|
||||||
<form id="changegroupsform">
|
<form id="changegroupsform">
|
||||||
<input id="changegroupuid" type="hidden" name="username" value="" />
|
<input id="changegroupuid" type="hidden" name="username" value="" />
|
||||||
<input id="changegroupgid" type="hidden" name="group" value="" />
|
<input id="changegroupgid" type="hidden" name="group" value="" />
|
||||||
<?php foreach($_["groups"] as $i): ?>
|
<?php foreach($_["groups"] as $i): ?>
|
||||||
<input x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" />
|
<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; ?>
|
<?php endforeach; ?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</span>
|
||||||
|
|
||||||
<div id="changepassword" style="display:none">
|
<span id="changepassword" style="display:none">
|
||||||
<form id="changepasswordform">
|
<form id="changepasswordform">
|
||||||
<input id="changepassworduid" type="hidden" name="username" value="" />
|
<input id="changepassworduid" type="hidden" name="username" value="" />
|
||||||
<?php echo $l->t( 'Force new password:' ); ?>
|
<?php echo $l->t( 'Force new password:' ); ?>
|
||||||
<input id="changepasswordpwd" type="password" name="password" value="" />
|
<input id="changepasswordpwd" type="password" name="password" value="" />
|
||||||
<button id="changepasswordbutton"><?php echo $l->t( 'Set' ); ?></button>
|
<button id="changepasswordbutton"><?php echo $l->t( 'Set' ); ?></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</span>
|
||||||
|
|
||||||
<div id="removeuserform" title="Remove user">
|
<div id="removeuserform" title="Remove user">
|
||||||
<form id="removeuserdata">
|
<form id="removeuserdata">
|
||||||
|
|
|
@ -30,6 +30,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' ))
|
||||||
|
|
||||||
// We have some javascript foo!
|
// We have some javascript foo!
|
||||||
OC_UTIL::addScript( "admin", "users" );
|
OC_UTIL::addScript( "admin", "users" );
|
||||||
|
OC_UTIL::addStyle( "admin", "users" );
|
||||||
OC_APP::setActiveNavigationEntry( "core_users" );
|
OC_APP::setActiveNavigationEntry( "core_users" );
|
||||||
|
|
||||||
$users = array();
|
$users = array();
|
||||||
|
|
|
@ -26,8 +26,8 @@ class OC_PublicLink{
|
||||||
*/
|
*/
|
||||||
public static function getPath($token){
|
public static function getPath($token){
|
||||||
//remove expired links
|
//remove expired links
|
||||||
$query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < NOW() AND expire_time!=0");
|
$query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < ? AND expire_time!=0");
|
||||||
$query->execute();
|
$query->execute(array(time()));
|
||||||
|
|
||||||
//get the path and the user
|
//get the path and the user
|
||||||
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
|
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<?php foreach($_['links'] as $link):?>
|
<?php foreach($_['links'] as $link):?>
|
||||||
<tr class='link' id='<?php echo $link['token'];?>'>
|
<tr class='link' id='<?php echo $link['token'];?>'>
|
||||||
<td class='path'><?php echo $link['path'];?></td>
|
<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 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>
|
<td><button class='delete fancybutton' data-token='<?php echo $link['token'];?>'><?php echo $l->t( 'Delete' ); ?></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -97,7 +97,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND {
|
||||||
return $entries[0]["dn"];
|
return $entries[0]["dn"];
|
||||||
}
|
}
|
||||||
public function checkPassword( $uid, $password ) {
|
public function checkPassword( $uid, $password ) {
|
||||||
if(!self::$configured){
|
if(!$this->configured){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$dn = $this->getDn( $uid );
|
$dn = $this->getDn( $uid );
|
||||||
|
@ -108,7 +108,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function userExists( $uid ) {
|
public function userExists( $uid ) {
|
||||||
if(!self::$configured){
|
if(!$this->configured){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$dn = $this->getDn($uid);
|
$dn = $this->getDn($uid);
|
||||||
|
|
|
@ -209,7 +209,6 @@ function authorize_mode () {
|
||||||
$profile['idp_url']=$IDENTITY;
|
$profile['idp_url']=$IDENTITY;
|
||||||
if (isset($_SERVER['PHP_AUTH_USER']) && $profile['authorized'] === false && $_SERVER['PHP_AUTH_USER']==$USERNAME) {
|
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!
|
if (OC_USER::checkPassword($USERNAME, $_SERVER['PHP_AUTH_PW'])) {// successful login!
|
||||||
error_log('success');
|
|
||||||
// return to the refresh url if they get in
|
// return to the refresh url if they get in
|
||||||
$_SESSION['openid_auth']=true;
|
$_SESSION['openid_auth']=true;
|
||||||
$_SESSION['openid_user']=$USERNAME;
|
$_SESSION['openid_user']=$USERNAME;
|
||||||
|
@ -339,7 +338,7 @@ function checkid ( $wait ) {
|
||||||
: error_get($return_to, 'Missing identity');
|
: error_get($return_to, 'Missing identity');
|
||||||
|
|
||||||
$assoc_handle = @strlen($_REQUEST['openid_assoc_handle'])
|
$assoc_handle = @strlen($_REQUEST['openid_assoc_handle'])
|
||||||
? $_REQUEST['openid_assoc.handle']
|
? $_REQUEST['openid_assoc_handle']
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
$trust_root = @strlen($_REQUEST['openid_trust_root'])
|
$trust_root = @strlen($_REQUEST['openid_trust_root'])
|
||||||
|
@ -1626,7 +1625,6 @@ $GLOBALS['port'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' && $_
|
||||||
: ':' . $_SERVER['SERVER_PORT'];
|
: ':' . $_SERVER['SERVER_PORT'];
|
||||||
|
|
||||||
|
|
||||||
error_log($_SERVER['HTTP_HOST']);
|
|
||||||
/**
|
/**
|
||||||
* Determine the HTTP request protocol
|
* Determine the HTTP request protocol
|
||||||
* @name $proto
|
* @name $proto
|
||||||
|
@ -1651,15 +1649,15 @@ $profile['req_url'] = sprintf("%s://%s%s",
|
||||||
// $port,//host already includes the path
|
// $port,//host already includes the path
|
||||||
$_SERVER["REQUEST_URI"]);
|
$_SERVER["REQUEST_URI"]);
|
||||||
|
|
||||||
$fullId=urlencode('.php/'.$USERNAME);
|
$fullId='user.php/'.$USERNAME.'/';
|
||||||
$incompleteId=urlencode('.php/');
|
$incompleteId='user.php/';
|
||||||
|
|
||||||
if(!strpos($profile['req_url'],$fullId)){
|
if(!strpos($profile['req_url'],$fullId)){
|
||||||
$profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']);
|
$profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
error_log('inc id: '.$fullId);
|
// error_log('inc id: '.$fullId);
|
||||||
error_log('req url: '.$profile['req_url']);
|
// error_log('req url: '.$profile['req_url']);
|
||||||
|
|
||||||
// Set the default allowance for testing
|
// Set the default allowance for testing
|
||||||
if (! array_key_exists('allow_test', $profile))
|
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){
|
if(strpos($USERNAME,'?')!==false){
|
||||||
$USERNAME=substr($USERNAME,0,strpos($USERNAME,'?'));
|
$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'])){
|
if($USERNAME=='' and isset($_SERVER['PHP_AUTH_USER'])){
|
||||||
|
@ -36,7 +39,8 @@ $RUNTIME_NOAPPS=false;
|
||||||
require_once '../../lib/base.php';
|
require_once '../../lib/base.php';
|
||||||
|
|
||||||
if(!OC_USER::userExists($USERNAME)){
|
if(!OC_USER::userExists($USERNAME)){
|
||||||
$USERNAME='';
|
error_log($USERNAME.' doesn\'t exist');
|
||||||
|
$USERNAME='';
|
||||||
}
|
}
|
||||||
global $WEBROOT;
|
global $WEBROOT;
|
||||||
$IDENTITY=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$WEBROOT.'/apps/user_openid/user.php/'.$USERNAME;
|
$IDENTITY=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$WEBROOT.'/apps/user_openid/user.php/'.$USERNAME;
|
||||||
|
|
|
@ -7,8 +7,6 @@ h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercas
|
||||||
p.center { text-align:center; }
|
p.center { text-align:center; }
|
||||||
a { color:#000; text-decoration:none; }
|
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 { 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#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; }
|
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"]: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="submit"]:active { outline:0; }
|
||||||
form input[type="button"], form input[type="text"] { font-size: 0.9em; }
|
form input[type="button"], form input[type="text"] { font-size: 0.9em; }
|
||||||
fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; }
|
fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; max-width:600px; margin:2em 2em 2em 3em; }
|
||||||
legend { padding:0 0.5em; font-size:1.2em; }
|
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; }
|
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;
|
background-color: #666;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
#login_form input[type="checkbox"]
|
||||||
|
{
|
||||||
|
width:15px;
|
||||||
|
}
|
||||||
|
|
||||||
#setup_form {
|
#setup_form {
|
||||||
margin: 3em auto;
|
margin: 3em auto;
|
||||||
|
|
|
@ -5,8 +5,15 @@
|
||||||
<?php if($_['error']): ?>
|
<?php if($_['error']): ?>
|
||||||
<?php echo $l->t( 'Login failed!' ); ?>
|
<?php echo $l->t( 'Login failed!' ); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if(empty($_["username"])){?>
|
||||||
<input type="text" name="user" id="user" value="" autofocus />
|
<input type="text" name="user" id="user" value="" autofocus />
|
||||||
<input type="password" name="password" id="password" value="" />
|
<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" />
|
<input type="submit" value="Log in" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -14,20 +14,26 @@ if( !OC_USER::isLoggedIn()){
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName=$_FILES['file']['name'];
|
$files=$_FILES['files'];
|
||||||
$source=$_FILES['file']['tmp_name'];
|
|
||||||
$dir = $_POST['dir'];
|
$dir = $_POST['dir'];
|
||||||
if(!empty($dir)) $dir .= '/';
|
if(!empty($dir)) $dir .= '/';
|
||||||
$target='/' . stripslashes($dir) . $fileName;
|
$error='';
|
||||||
|
$result=array();
|
||||||
if(strpos($dir,'..') === false){
|
if(strpos($dir,'..') === false){
|
||||||
if(OC_FILESYSTEM::fromUploadedFile($source,$target)){
|
$fileCount=count($files['name']);
|
||||||
echo json_encode(array( "status" => "success", 'mime'=>OC_FILESYSTEM::getMimeType($target),'size'=>OC_FILESYSTEM::filesize($target)));
|
for($i=0;$i<$fileCount;$i++){
|
||||||
exit();
|
$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)));
|
echo json_encode(array( 'status' => 'error', 'data' => array('error' => $error, "file" => $fileName)));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -20,31 +20,32 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file_upload_form, #file_newfolder_form {
|
.file_upload_form, #file_newfolder_form {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
margin-left:3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fileSelector, #file_upload_submit, #file_newfolder_submit {
|
#fileSelector, #file_upload_submit, #file_newfolder_submit {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file_upload_filename, #file_newfolder_name {
|
.file_upload_filename, #file_newfolder_name {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: 0.5em 0;
|
background-position: 0.5em 0;
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file_upload_filename {
|
.file_upload_filename {
|
||||||
background-image:url(../img/file.png); font-weight:bold;
|
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 {
|
#file_newfolder_name {
|
||||||
background-image:url(../img/folder.png); font-weight:bold;
|
background-image:url(../img/folder.png); font-weight:bold;
|
||||||
width: 14em;
|
width: 14em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file_upload_start, #file_upload_filename{
|
.file_upload_start, .file_upload_filename{
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:0px;
|
top:0px;
|
||||||
left:0px;
|
left:0px;
|
||||||
|
@ -52,7 +53,7 @@
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file_upload_wrapper{
|
.file_upload_wrapper{
|
||||||
position:relative;
|
position:relative;
|
||||||
top:-1.2em;
|
top:-1.2em;
|
||||||
left:-2em;
|
left:-2em;
|
||||||
|
@ -65,7 +66,7 @@
|
||||||
width: 3em;
|
width: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file_upload_target {
|
.file_upload_target {
|
||||||
display: none;
|
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){
|
FileActions.register('all','Delete',function(filename){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/delete.php',
|
url: 'ajax/delete.php',
|
||||||
data: "dir="+$('#dir').val()+"&file="+filename,
|
data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename),
|
||||||
complete: function(data){
|
complete: function(data){
|
||||||
boolOperationFinished(data, function(){
|
boolOperationFinished(data, function(){
|
||||||
FileList.remove(filename);
|
FileList.remove(filename);
|
||||||
|
|
|
@ -2,16 +2,21 @@ FileList={
|
||||||
update:function(fileListHtml) {
|
update:function(fileListHtml) {
|
||||||
$('#fileList').empty().html(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">';
|
var html='<tr data-file="'+name+'" data-type="file">';
|
||||||
html+='<td class="selection"><input type="checkbox" /></td>';
|
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="filesize">'+size+'</td>';
|
||||||
html+='<td class="date">'+lastModified+'</td>';
|
html+='<td class="date">'+lastModified+'</td>';
|
||||||
html+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
|
html+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
|
||||||
html+='</tr>';
|
html+='</tr>';
|
||||||
FileList.insertElement(name,'file',$(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){
|
addDir:function(name,size,lastModified){
|
||||||
var html='<tr data-file="'+name+'" data-type="dir">';
|
var html='<tr data-file="'+name+'" data-type="dir">';
|
||||||
|
@ -58,5 +63,13 @@ FileList={
|
||||||
}else{
|
}else{
|
||||||
$('#fileList').append(element);
|
$('#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,11 +40,13 @@ $(document).ready(function() {
|
||||||
$('td.filename a').live('click',function(event) {
|
$('td.filename a').live('click',function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var filename=$(this).parent().parent().attr('data-file');
|
var filename=$(this).parent().parent().attr('data-file');
|
||||||
var mime=$(this).parent().parent().attr('data-mime');
|
if(!FileList.isLoading(filename)){
|
||||||
var type=$(this).parent().parent().attr('data-type');
|
var mime=$(this).parent().parent().attr('data-mime');
|
||||||
var action=FileActions.getDefault(mime,type);
|
var type=$(this).parent().parent().attr('data-type');
|
||||||
if(action){
|
var action=FileActions.getDefault(mime,type);
|
||||||
action(filename);
|
if(action){
|
||||||
|
action(filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,7 +117,7 @@ $(document).ready(function() {
|
||||||
//send the browser to the download location
|
//send the browser to the download location
|
||||||
var dir=$('#dir').val()||'/';
|
var dir=$('#dir').val()||'/';
|
||||||
// alert(files);
|
// alert(files);
|
||||||
window.location='ajax/download.php?files='+files+'&dir='+dir;
|
window.location='ajax/download.php?files='+encodeURIComponent(files)+'&dir='+encodeURIComponent(dir);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/delete.php',
|
url: 'ajax/delete.php',
|
||||||
data: "dir="+$('#dir').val()+"&files="+files,
|
data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files),
|
||||||
complete: function(data){
|
complete: function(data){
|
||||||
boolOperationFinished(data, function(){
|
boolOperationFinished(data, function(){
|
||||||
$('td.selection input:checkbox:checked').parent().parent().each(function(i,element){
|
$('td.selection input:checkbox:checked').parent().parent().each(function(i,element){
|
||||||
|
@ -141,36 +143,51 @@ $(document).ready(function() {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#file_upload_start').change(function(){
|
$('.file_upload_start').live('change',function(){
|
||||||
var filename=$(this).val();
|
var form=$(this).parent().parent();
|
||||||
filename=filename.replace(/^.*[\/\\]/g, '');
|
var uploadId=form.attr('data-upload-id');
|
||||||
$('#file_upload_filename').val(filename);
|
var files=this.files;
|
||||||
$('#file_upload_submit').show();
|
var target=form.children('iframe');
|
||||||
})
|
target.load(function(){
|
||||||
|
var response=jQuery.parseJSON(target.contents().find('body').text());
|
||||||
$('#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());
|
|
||||||
//set mimetype and if needed filesize
|
//set mimetype and if needed filesize
|
||||||
$('tr[data-file="'+name+'"]').attr('data-mime',response.mime);
|
if(response){
|
||||||
if(size=='Pending'){
|
for(var i=0;i<response.length;i++){
|
||||||
$('tr[data-file='+name+'] td.filesize').text(response.size);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#file_upload_form').submit();
|
form.submit();
|
||||||
var date=new Date();
|
var date=new Date();
|
||||||
var uploadTime=formatDate(date);
|
var uploadTime=formatDate(date);
|
||||||
FileList.addFile(name,size,uploadTime);
|
for(var i=0;i<files.length;i++){
|
||||||
$('#file_upload_filename').val($('#file_upload_filename').data('upload_text'));
|
if(files[i].size>0){
|
||||||
|
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() {
|
var adjustNewFolderSize = function() {
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="actions">
|
<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" 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" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)">
|
||||||
<input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir">
|
<input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir">
|
||||||
<div id='file_upload_wrapper'>
|
<div class='file_upload_wrapper'>
|
||||||
<input class="prettybutton" id='file_upload_filename' value="Upload (max. <?php echo $_["uploadMaxHumanFilesize"];?>)"/>
|
<input class="prettybutton file_upload_filename" value="Upload (max. <?php echo $_["uploadMaxHumanFilesize"];?>)"/>
|
||||||
<input class="prettybutton" type="file" id="file_upload_start" name='file'/>
|
<input class="prettybutton file_upload_start" type="file" name='files[]'/>
|
||||||
</div>
|
</div>
|
||||||
<input class="prettybutton" type="button" id="file_upload_submit" name="file_upload_submit" value="OK" />
|
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
|
||||||
<iframe id="file_upload_target" name="file_upload_target" src=""></iframe>
|
|
||||||
</form>
|
</form>
|
||||||
<form id="file_newfolder_form">
|
<form id="file_newfolder_form">
|
||||||
<input type="text" class="prettybutton" name="file_newfolder_name" id="file_newfolder_name" value="New Folder" />
|
<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):
|
<?php foreach($_['files'] as $file):
|
||||||
$simple_file_size = simple_file_size($file['size']);
|
$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']?>">
|
<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="selection"><input type="checkbox" /></td>
|
||||||
<td class="filename">
|
<td class="filename">
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
|
|
||||||
<h1><?php echo $l->t( 'Questions and Answers' ); ?></h1>
|
<h1><?php echo $l->t( 'Questions and Answers' ); ?></h1>
|
||||||
|
|
||||||
<table cellspacing="0" width="100%">
|
<?php if(is_null($_["kbe"])):?>
|
||||||
<tbody>
|
Can't connect to Q&A database
|
||||||
<?php foreach($_["kbe"] as $kb): ?>
|
<?php else:?>
|
||||||
<tr>
|
<table cellspacing="0" width="100%">
|
||||||
<td width="1"><?php if($kb["preview1"] <> "") { echo('<img class="preview" border="0" src="'.$kb["preview1"].'" />'); } ?> </a></td>
|
<tbody>
|
||||||
<td class="name"><?php echo $kb["name"]; ?><br /><?php echo('<span class="type">'.$kb['description'].'</span>'); ?><br />
|
<?php foreach($_["kbe"] as $kb): ?>
|
||||||
<?php if($kb['answer']<>'') echo('<br /><span class="type"><b>Answer:</b></span><br /><span class="type">'.$kb['answer'].'</span>');?>
|
<tr>
|
||||||
</td>
|
<td width="1"><?php if($kb["preview1"] <> "") { echo('<img class="preview" border="0" src="'.$kb["preview1"].'" />'); } ?> </a></td>
|
||||||
</tr>
|
<td class="name"><?php echo $kb["name"]; ?><br /><?php echo('<span class="type">'.$kb['description'].'</span>'); ?><br />
|
||||||
<?php endforeach; ?>
|
<?php if($kb['answer']<>'') echo('<br /><span class="type"><b>Answer:</b></span><br /><span class="type">'.$kb['answer'].'</span>');?>
|
||||||
</tbody>
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
<?php
|
<?php endforeach; ?>
|
||||||
$url=OC_HELPER::linkTo( "help", "index.php" ).'?page=';
|
</tbody>
|
||||||
$pageNavi=OC_UTIL::getPageNavi($_['pagecount'],$_['page'],$url);
|
</table>
|
||||||
$pageNavi->printPage();
|
<?php
|
||||||
?>
|
$url=OC_HELPER::linkTo( "help", "index.php" ).'?page=';
|
||||||
<a target="_blank" class="prettybutton" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new"><?php echo $l->t( 'ASK A QUESTION' ); ?></a>
|
$pageNavi=OC_UTIL::getPageNavi($_['pagecount'],$_['page'],$url);
|
||||||
|
$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);
|
$not_installed = !OC_CONFIG::getValue('installed', false);
|
||||||
$install_called = (isset($_POST['install']) AND $_POST['install']=='true');
|
$install_called = (isset($_POST['install']) AND $_POST['install']=='true');
|
||||||
|
|
||||||
// First step : check if the server is correctly configured for ownCloud :
|
// First step : check if the server is correctly configured for ownCloud :
|
||||||
$errors = OC_UTIL::checkServer();
|
$errors = OC_UTIL::checkServer();
|
||||||
if(count($errors) > 0) {
|
if(count($errors) > 0) {
|
||||||
|
@ -61,17 +60,23 @@ elseif(isset($_POST["user"])) {
|
||||||
OC_APP::loadApps();
|
OC_APP::loadApps();
|
||||||
if(OC_USER::login($_POST["user"], $_POST["password"])) {
|
if(OC_USER::login($_POST["user"], $_POST["password"])) {
|
||||||
header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php"));
|
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();
|
exit();
|
||||||
}
|
}
|
||||||
else {
|
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 :
|
// For all others cases, we display the guest page :
|
||||||
else {
|
else {
|
||||||
OC_APP::loadApps();
|
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{
|
class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
|
||||||
private $datadir;
|
private $datadir;
|
||||||
|
private static $mimetypes=null;
|
||||||
public function __construct($arguments){
|
public function __construct($arguments){
|
||||||
$this->datadir=$arguments['datadir'];
|
$this->datadir=$arguments['datadir'];
|
||||||
if(substr($this->datadir,-1)!=='/'){
|
if(substr($this->datadir,-1)!=='/'){
|
||||||
|
@ -209,71 +210,14 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
|
||||||
$mime_type=substr($reply,0,strrpos($reply,' '));
|
$mime_type=substr($reply,0,strrpos($reply,' '));
|
||||||
}
|
}
|
||||||
if (empty($mime_type)) {
|
if (empty($mime_type)) {
|
||||||
// Fallback solution: try to guess the type by the file extension
|
// Fallback solution: (try to guess the type by the file extension
|
||||||
// TODO: add more ...
|
if(!self::$mimetypes){
|
||||||
switch (strtolower(strrchr(basename($fspath), "."))) {
|
self::$mimetypes=include('mimetypes.list.php');
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
$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;
|
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
|
//add prefix to the mysql user name to prevent collissions
|
||||||
$dbusername='oc_mysql_'.$username;
|
$dbusername='oc_mysql_'.$username;
|
||||||
//hash the password so we don't need to store the admin config in the config file
|
//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('dbuser', $dbusername);
|
||||||
OC_CONFIG::setValue('dbpassword', $dbpassowrd);
|
OC_CONFIG::setValue('dbpassword', $dbpassword);
|
||||||
|
|
||||||
//create the database
|
//create the database
|
||||||
self::createDatabase($dbname, $dbusername, $connection);
|
self::createDatabase($dbname, $dbusername, $connection);
|
||||||
|
|
16
lib/user.php
16
lib/user.php
|
@ -337,4 +337,20 @@ class OC_USER {
|
||||||
}
|
}
|
||||||
return false;
|
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