return false;
}
+ /**
+ * @brief reads the image from LDAP that shall be used as Avatar
+ * @param $uid string, the ownCloud user name
+ * @param $dn string, the user DN
+ * @return image data (provided by LDAP) | false
+ */
+ private function getAvatarImage($uid, $dn) {
+ $attributes = array('jpegPhoto', 'thumbnailPhoto');
+ foreach($attributes as $attribute) {
+ $result = $this->access->readAttribute($dn, $attribute);
+ \OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup',
+ time());
+ if($result !== false && is_array($result) && isset($result[0])) {
+ return $result[0];
+ }
+ }
+
+ return false;
+ }
+
/**
* @brief Check if the password is correct
- * @param $uid The username
- * @param $password The password
- * @returns true/false
+ * @param string $uid The username
+ * @param string $password The password
+ * @return boolean
*
* Check if the password is correct without logging in the user
*/
* @param string $app app
* @param string $key key
* @return bool
- *
- * Deletes a key.
*/
- public static function deleteKey($app, $key) {
- // Boring!
- $query = OC_DB::prepare('DELETE FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `configkey` = ?');
- $query->execute(array($app, $key));
- if (isset(self::$cache[$app]) and isset(self::$cache[$app][$key])) {
- unset(self::$cache[$app][$key]);
+ public function deleteKey($app, $key) {
+ $where = array(
+ 'appid' => $app,
+ 'configkey' => $key,
+ );
+ $this->conn->delete('*PREFIX*appconfig', $where);
+ if (isset($this->cache[$app]) and isset($this->cache[$app][$key])) {
+ unset($this->cache[$app][$key]);
}
-
- return true;
}
/**
/**
* get multiply values, either the app or key can be used as wildcard by setting it to false
*
- * @param app
- * @param key
+ * @param boolean $app
+ * @param string $key
* @return array
*/
- public static function getValues($app, $key) {
- if ($app !== false and $key !== false) {
+ public function getValues($app, $key) {
+ if (($app !== false) == ($key !== false)) {
return false;
}
+
$fields = '`configvalue`';
$where = 'WHERE';
$params = array();