diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-02-20 13:18:22 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-02-20 13:18:22 +0100 |
commit | 8ed42623930b16f7cf5d1e02d5f0d0621e50c93d (patch) | |
tree | 3a338dfa81a9e898c1ebb708431fa1fb2a7a707e /apps | |
parent | 430ccef09cb303e1b2136cd0599f3baddf4acbcd (diff) | |
parent | 30d524b4260fe3e920b6be1f3818a0fbcbb5adfc (diff) | |
download | nextcloud-server-8ed42623930b16f7cf5d1e02d5f0d0621e50c93d.tar.gz nextcloud-server-8ed42623930b16f7cf5d1e02d5f0d0621e50c93d.zip |
Merge gitorious.org:owncloud/owncloud into vcategories
Diffstat (limited to 'apps')
-rw-r--r-- | apps/bookmarks/addBm.php | 3 | ||||
-rw-r--r-- | apps/bookmarks/css/bookmarks.css | 15 | ||||
-rw-r--r-- | apps/bookmarks/templates/list.php | 6 | ||||
-rw-r--r-- | apps/calendar/lib/object.php | 1 | ||||
-rw-r--r-- | apps/user_ldap/appinfo/app.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/templates/settings.php | 3 | ||||
-rw-r--r-- | apps/user_ldap/user_ldap.php | 78 |
7 files changed, 89 insertions, 23 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php index 62ad5821dbf..f56022c42c2 100644 --- a/apps/bookmarks/addBm.php +++ b/apps/bookmarks/addBm.php @@ -40,6 +40,7 @@ $url = isset($_GET['url']) ? urldecode($_GET['url']) : ''; $metadata = getURLMetadata($url); $tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8')); -$tmpl->assign('TITLE', htmlentities($metadata['title'],ENT_COMPAT,'utf-8')); +$title = isset($metadata['title']) ? $metadata['title'] : (isset($_GET['title']) ? $_GET['title'] : ''); +$tmpl->assign('TITLE', htmlentities($title,ENT_COMPAT,'utf-8')); $tmpl->printPage(); diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css index 48f0bede110..8dfdc8a07b9 100644 --- a/apps/bookmarks/css/bookmarks.css +++ b/apps/bookmarks/css/bookmarks.css @@ -83,4 +83,17 @@ .loading_meta { display: none; margin-left: 5px; -}
\ No newline at end of file +} + +#footer { + color: #999; + font-size: medium; + text-align: center; + position: absolute; + bottom: 10px; + left: 0px; + width: 100%; + height: 20px; + visibility: visible; + display: block +} diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php index ccfe74f008f..d44a0ecbcdb 100644 --- a/apps/bookmarks/templates/list.php +++ b/apps/bookmarks/templates/list.php @@ -22,4 +22,8 @@ </div> <div class="bookmarks_list"> <?php echo $l->t('You have no bookmarks'); ?> -</div>
\ No newline at end of file +</div> +<div id="footer"> +Bookmark pages more easily. Drag this bookmarklet to the Bookmarks bar of your browser: +<a style='background-color:#dddddd;border:1px groove #999; padding:5px;padding-top:0px;padding-bottom:2px; text-decoration:none; margin-top:5px' href='javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("<?php echo OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') ?>?output=popup&url="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();'>ownCloud bookmark</a> +</div> diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index cbb1badf802..230c610d35a 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -194,6 +194,7 @@ class OC_Calendar_Object{ public static function deleteFromDAVData($cid,$uri){ $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri=?' ); $stmt->execute(array($cid,$uri)); + OC_Calendar_Calendar::touchCalendar($cid); return true; } diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 3261708f590..5c56ca8191e 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -32,13 +32,13 @@ define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389); define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid'); // register user backend -OC_User::useBackend( "LDAP" ); +OC_User::useBackend( 'LDAP' ); // add settings page to navigation $entry = array( - 'id' => "user_ldap_settings", + 'id' => 'user_ldap_settings', 'order'=>1, - 'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ), + 'href' => OC_Helper::linkTo( 'user_ldap', 'settings.php' ), 'name' => 'LDAP' ); // OC_App::addNavigationSubEntry( "core_users", $entry); diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 2abb0b47291..5bbd5d4008d 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -12,6 +12,9 @@ <small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p> <p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p> <p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if ($_['ldap_nocase']) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Case insensitve LDAP server (Windows)');?></label></p> + <p><label for="ldap_quota">Quota Attribute</label><input type="text" id="ldap_quota" name="ldap_quota" value="<?php echo $_['ldap_quota']; ?>" /> + <label for="ldap_quota_def">Quota Default</label><input type="text" id="ldap_quota_def" name="ldap_quota_def" value="<?php echo $_['ldap_quota_def']; ?>" />bytes</p> + <p><label for="ldap_email">Email Attribute</label><input type="text" id="ldap_email" name="ldap_email" value="<?php echo $_['ldap_email']; ?>" /></p> <input type="submit" value="Save" /> </fieldset> </form> diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 106240e74b8..670d938ea95 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -36,6 +36,12 @@ class OC_USER_LDAP extends OC_User_Backend { protected $ldap_tls; protected $ldap_nocase; protected $ldap_display_name; + protected $ldap_quota; + protected $ldap_quota_def; + protected $ldap_email; + + // will be retrieved from LDAP server + protected $ldap_dc = false; function __construct() { $this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host',''); @@ -47,6 +53,9 @@ class OC_USER_LDAP extends OC_User_Backend { $this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0); $this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0); $this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME); + $this->ldap_quota_attr = OC_Appconfig::getValue('user_ldap', 'ldap_quota_attr',''); + $this->ldap_quota_def = OC_Appconfig::getValue('user_ldap', 'ldap_quota_def',''); + $this->ldap_email_attr = OC_Appconfig::getValue('user_ldap', 'ldap_email_attr',''); if( !empty($this->ldap_host) && !empty($this->ldap_port) @@ -66,6 +75,28 @@ class OC_USER_LDAP extends OC_User_Backend { ldap_unbind($this->ds); } + private function setQuota( $uid ) { + if( !$this->ldap_dc ) + return false; + + $quota = $this->ldap_dc[$this->ldap_quota_attr][0]; + $quota = $quota != -1 ? $quota : $this->ldap_quota_def; + OC_Preferences::setValue($uid, 'files', 'quota', $quota); + } + + private function setEmail( $uid ) { + if( !$this->ldap_dc ) + return false; + + $email = OC_Preferences::getValue($uid, 'settings', 'email', ''); + if ( !empty( $email ) ) + return false; + + $email = $this->ldap_dc[$this->ldap_email_attr][0]; + OC_Preferences::setValue($uid, 'settings', 'email', $email); + } + + //Connect to LDAP and store the resource private function getDs() { if(!$this->ds) { $this->ds = ldap_connect( $this->ldap_host, $this->ldap_port ); @@ -74,18 +105,19 @@ class OC_USER_LDAP extends OC_User_Backend { if($this->ldap_tls) ldap_start_tls($this->ds); } - + //TODO: Not necessary to perform a bind each time, is it? // login if(!empty($this->ldap_dn)) { $ldap_login = @ldap_bind( $this->ds, $this->ldap_dn, $this->ldap_password ); - if(!$ldap_login) + if(!$ldap_login) { return false; + } } return $this->ds; } - private function getDn( $uid ) { + private function getDc( $uid ) { if(!$this->configured) return false; @@ -99,31 +131,43 @@ class OC_USER_LDAP extends OC_User_Backend { $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); $entries = ldap_get_entries( $this->getDs(), $sr ); - if( $entries['count'] == 0 ) + if( $entries['count'] == 0 ) { return false; + } + + $this->ldap_dc = $entries[0]; - return $entries[0]['dn']; + return $this->ldap_dc; } public function checkPassword( $uid, $password ) { if(!$this->configured){ return false; } - $dn = $this->getDn( $uid ); - if( !$dn ) + $dc = $this->getDc( $uid ); + if( !$dc ) return false; - if (!@ldap_bind( $this->getDs(), $dn, $password )) + if (!@ldap_bind( $this->getDs(), $dc['dn'], $password )) { return false; - + } + + if(!empty($this->ldap_quota) && !empty($this->ldap_quota_def)) { + $this->setQuota($uid); + } + + if(!empty($this->ldap_email_attr)) { + $this->setEmail($uid); + } + if($this->ldap_nocase) { $filter = str_replace('%uid', $uid, $this->ldap_filter); $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); $entries = ldap_get_entries( $this->getDs(), $sr ); if( $entries['count'] == 1 ) { foreach($entries as $row) { - $ldap_display_name = strtolower($this->ldap_display_name); - if(isset($row[$ldap_display_name])) { + $ldap_display_name = strtolower($this->ldap_display_name); + if(isset($row[$ldap_display_name])) { return $row[$ldap_display_name][0]; } } @@ -131,12 +175,12 @@ class OC_USER_LDAP extends OC_User_Backend { else { return $uid; } - + } else { return $uid; } - + } public function userExists( $uid ) { @@ -146,17 +190,17 @@ class OC_USER_LDAP extends OC_User_Backend { $dn = $this->getDn($uid); return !empty($dn); } - + public function getUsers() { if(!$this->configured) return false; - + // connect to server $ds = $this->getDs(); if( !$ds ) return false; - + // get users $filter = 'objectClass=person'; $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); @@ -169,7 +213,7 @@ class OC_USER_LDAP extends OC_User_Backend { // TODO ldap_get_entries() seems to lower all keys => needs review $ldap_display_name = strtolower($this->ldap_display_name); if(isset($row[$ldap_display_name])) { - $users[] = $row[$ldap_display_name][0]; + $users[] = $row[$ldap_display_name][0]; } } // TODO language specific sorting of user names |