Projects
Kolab:3.4
kolab-webadmin
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 54
View file
kolab-webadmin.spec
Changed
@@ -34,7 +34,7 @@ %global kolabr_group_id 414 Name: kolab-webadmin -Version: 3.2.5 +Version: 3.2.6 Release: 1%{?dist} Summary: Kolab Groupware Server Web Administration Interface License: AGPLv3+ @@ -167,6 +167,9 @@ %attr(0770,%{httpd_user},%{httpd_group}) %{_var}/log/%{name} %changelog +* Fri Jan 23 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.2.6-1 +- Upstream release of version 3.2.6 + * Fri Nov 28 2014 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.2.5-1 - New upstream release - Resolve #3613, #3821, #3987, #4000, #4002
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +kolab-webadmin (3.2.6-0~kolab1) unstable; urgency=low + + * New upstream release 3.2.6 + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Fri, 23 Jan 2015 22:08:00 +0100 + kolab-webadmin (3.2.5-0~kolab2) unstable; urgency=low * add prerm script to cleanly remove the package (disable the site for apache)
View file
kolab-webadmin-3.2.5.tar.gz/doc/kolab_wap.sql -> kolab-webadmin-3.2.6.tar.gz/doc/kolab_wap.sql
Changed
@@ -25,13 +25,13 @@ CREATE TABLE `group_types` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` text NOT NULL, - `name` varchar(256) NOT NULL, + `name` varchar(255) NOT NULL, `description` text NOT NULL, `attributes` longtext NOT NULL, `is_default` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -54,7 +54,7 @@ CREATE TABLE `options` ( `attribute` varchar(128) NOT NULL, `option_values` text NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77,13 +77,13 @@ CREATE TABLE `ou_types` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` text NOT NULL, - `name` varchar(256) NOT NULL, + `name` varchar(255) NOT NULL, `description` text NOT NULL, `attributes` longtext NOT NULL, `is_default` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -106,13 +106,13 @@ CREATE TABLE `resource_types` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` text NOT NULL, - `name` varchar(256) NOT NULL, + `name` varchar(255) NOT NULL, `description` text NOT NULL, `attributes` longtext NOT NULL, `is_default` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -135,13 +135,13 @@ CREATE TABLE `role_types` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` text NOT NULL, - `name` varchar(256) NOT NULL, + `name` varchar(255) NOT NULL, `description` text NOT NULL, `attributes` longtext NOT NULL, `is_default` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,13 +164,13 @@ CREATE TABLE `sharedfolder_types` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` text NOT NULL, - `name` varchar(256) NOT NULL, + `name` varchar(255) NOT NULL, `description` text NOT NULL, `attributes` longtext NOT NULL, `is_default` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -193,14 +193,14 @@ CREATE TABLE `user_types` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` text NOT NULL, - `name` varchar(256) NOT NULL, + `name` varchar(255) NOT NULL, `description` text NOT NULL, `attributes` longtext NOT NULL, `used_for` varchar(16) DEFAULT NULL, `is_default` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; --
View file
kolab-webadmin-3.2.5.tar.gz/lib/Auth/LDAP.php -> kolab-webadmin-3.2.6.tar.gz/lib/Auth/LDAP.php
Changed
@@ -552,13 +552,7 @@ public function group_add($attrs, $typeid = null) { - if (!empty($attrs['ou'])) { - $base_dn = $attrs['ou']; - unset($attrs['ou']); - } - else { - $base_dn = $this->entry_base_dn('group', $typeid); - } + $base_dn = $this->entry_base_dn('group', $typeid, $attrs); // TODO: The rdn is configurable as well. // Use [$type_str . "_"]user_rdn_attr @@ -656,7 +650,7 @@ { $this->_log(LOG_DEBUG, "Auth::LDAP::list_organizationalunits(" . var_export($attributes, true) . ", " . var_export($search, true) . ", " . var_export($params, true)); - $base_dn = $this->_subject_base_dn('ou'); + $base_dn = $this->_subject_base_dn($params['type'] ? $params['type'] . '_ou' : 'ou'); $filter = $this->conf->get('ou_filter'); if (!$filter) { @@ -724,13 +718,7 @@ public function organizationalunit_add($attrs, $typeid = null) { - if (!empty($attrs['base_dn'])) { - $base_dn = $attrs['base_dn']; - unset($attrs['base_dn']); - } - else { - $base_dn = $this->entry_base_dn('ou', $typeid); - } + $base_dn = $this->entry_base_dn('ou', $typeid, $attrs); // TODO: The rdn is configurable as well. // Use [$type_str . "_"]ou_rdn_attr @@ -782,13 +770,7 @@ public function resource_add($attrs, $typeid = null) { - if (!empty($attrs['ou'])) { - $base_dn = $attrs['ou']; - unset($attrs['ou']); - } - else { - $base_dn = $this->entry_base_dn('resource', $typeid); - } + $base_dn = $this->entry_base_dn('resource', $typeid, $attrs); // TODO: The rdn is configurable as well. // Use [$type_str . "_"]resource_rdn_attr @@ -839,7 +821,7 @@ public function role_add($attrs, $typeid = null) { - $base_dn = $this->entry_base_dn('role', $typeid); + $base_dn = $this->entry_base_dn('role', $typeid, $attrs); // TODO: The rdn is configurable as well. // Use [$type_str . "_"]role_rdn_attr @@ -891,7 +873,7 @@ public function sharedfolder_add($attrs, $typeid = null) { - $base_dn = $this->entry_base_dn('sharedfolder', $typeid); + $base_dn = $this->entry_base_dn('sharedfolder', $typeid, $attrs); // TODO: The rdn is configurable as well. // Use [$type_str . "_"]user_rdn_attr @@ -940,15 +922,13 @@ return $this->_read($sharedfolder_dn, $attributes); } - - public function search($base_dn, $filter = '(objectclass=*)', $scope = 'sub', $sort = NULL, $search = array()) + public function search($base_dn, $filter = '(objectclass=*)', $scope = 'sub', $attributes = null, $props = array(), $count_only = false) { if (isset($_SESSION['user']->user_bind_dn) && !empty($_SESSION['user']->user_bind_dn)) { $this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw); } - $this->_log(LOG_DEBUG, "Relaying search to parent:" . var_export(func_get_args(), true)); - return parent::search($base_dn, $filter, $scope, $sort, $search); + return parent::search($base_dn, $filter, $scope, $attributes ?: array('*'), $props, $count_only); } public function subject_base_dn($subject, $strict = false) @@ -958,12 +938,7 @@ public function user_add($attrs, $typeid = null) { - $base_dn = $this->entry_base_dn('user', $typeid); - - if (!empty($attrs['ou'])) { - $base_dn = $attrs['ou']; - unset($attrs['ou']); - } + $base_dn = $this->entry_base_dn('user', $typeid, $attrs); // TODO: The rdn is configurable as well. // Use [$type_str . "_"]user_rdn_attr @@ -1086,7 +1061,13 @@ $attributes = array('*'); } - $result = $this->search_entries($base_dn, $filter, $scope, $attributes, array('search' => $search)); + // LDAP3 search parameters + $opts = array( + 'search' => $search, + 'sort' => $params['sort_by'], // for VLV + ); + + $result = $this->search_entries($base_dn, $filter, $scope, $attributes, $opts); $entries = $this->sort_and_slice($result, $params); return array( @@ -1147,9 +1128,21 @@ /** * Return base DN for specified object type */ - protected function entry_base_dn($type, $typeid = null) + protected function entry_base_dn($type, $typeid = null, &$attrs = array()) { - if ($typeid) { + // check if base_dn already exists in object attributes + if (!empty($attrs)) { + if (!empty($attrs['base_dn'])) { + $base_dn = $attrs['base_dn']; + unset($attrs['base_dn']); + } + else if ($type != 'ou' && !empty($attrs['ou'])) { + $base_dn = $attrs['ou']; + unset($attrs['ou']); + } + } + + if (empty($base_dn) && $typeid) { $db = SQL::get_instance(); $query = $db->query("SELECT `key` FROM `{$type}_types` WHERE `id` = ?", array($typeid)); $sql = $db->fetch_assoc($query); @@ -1233,6 +1226,16 @@ $subject_base_dn = $this->conf->get_raw("ldap", $subject . "_base_dn"); } + // This could be "<object_type>_<object_name>", if so we'll try the name only now + if (empty($subject_base_dn) && ($pos = strrpos($subject, '_'))) { + $subject = substr($subject, $pos + 1); + $subject_base_dn = $this->conf->get_raw($domain, $subject . "_base_dn"); + + if (empty($subject_base_dn)) { + $subject_base_dn = $this->conf->get_raw("ldap", $subject . "_base_dn"); + } + } + if (empty($subject_base_dn) && $strict) { $this->_log(LOG_DEBUG, "subject_base_dn for subject $subject not found"); return null;
View file
kolab-webadmin-3.2.5.tar.gz/lib/api/kolab_api_service_form_value.php -> kolab-webadmin-3.2.6.tar.gz/lib/api/kolab_api_service_form_value.php
Changed
@@ -407,7 +407,7 @@ } // TODO: Generate using policy from configuration - $cn = trim($postdata['givenname'] . " " . $postdata['sn']); + $cn = trim(trim($postdata['givenname']) . " " . trim($postdata['sn'])); return $cn; } @@ -424,7 +424,7 @@ } $auth = Auth::get_instance($_SESSION['user']->get_domain()); - $cn = $postdata['cn']; + $cn = trim($postdata['cn']); $x = 2; while (($resource_found = $auth->resource_find_by_attribute(array('cn' => $cn)))) { @@ -438,7 +438,7 @@ } } - $cn = $postdata['cn'] . ' #' . $x; + $cn = trim($postdata['cn']) . ' #' . $x; $x++; } @@ -457,9 +457,11 @@ } // TODO: Generate using policy from configuration - $displayname = $postdata['givenname']; - if ($postdata['sn']) { - $displayname = $postdata['sn'] . ", " . $displayname; + $displayname = trim($postdata['givenname']); + $sn = trim($postdata['sn']); + + if ($sn) { + $displayname = $sn . ", " . $displayname; } // TODO: Figure out what may be sent as an additional comment; @@ -606,7 +608,7 @@ //console("normalized resource data", $resourcedata); // TODO: Normalize $postdata - $mail_local = 'resource-' . $postdata['type_key'] . '-' . strtolower($resourcedata['cn']); + $mail_local = 'resource-' . $postdata['type_key'] . '-' . strtolower(trim($resourcedata['cn'])); $mail_domain = $_SESSION['user']->get_domain(); $mail = $mail_local . '@' . $mail_domain; $auth = Auth::get_instance($_SESSION['user']->get_domain()); @@ -805,7 +807,7 @@ if (empty($postdata['uid'])) { - $postdata['uid'] = $postdata['sn']; + $postdata['uid'] = trim($postdata['sn']); } $userdata = kolab_recipient_policy::normalize_userdata($postdata); @@ -973,7 +975,7 @@ // convert to key=>value array foreach ($list as $idx => $value) { - $list[$idx] = $value['entrydn']; + $list[$idx] = kolab_utils::dn2ufn($idx); } return $list; @@ -1059,12 +1061,11 @@ $base_dn = $auth->subject_base_dn($object_key, $object_type); if (!empty($postdata['id'])) { - $subjects = $auth->search($base_dn, '(' . $unique_attr . '=' . $postdata['id'] . ')'); + $subjects = $auth->search($base_dn, '(' . $unique_attr . '=' . $postdata['id'] . ')', 'sub', array('dn')); if ($subjects) { - $subjects = $subjects->entries(true); - $subject = array_shift($subjects); - $subject_dn = key($subject); + $subjects = $subjects->entries(true); + $subject_dn = key($subjects); $subject_dn_components = kolab_utils::explode_dn($subject_dn); if ($subject_dn_components) { @@ -1078,18 +1079,24 @@ $default = $base_dn; } - $_ous = array(); + $result = array(); + $params = array( + 'type' => $object_key, + 'page_size' => 99999, + ); + + $ous = $auth->list_organizationalunits(null, array(''), null, $params); - if ($ous = $auth->search($base_dn, '(objectclass=organizationalunit)')) { - foreach ($ous->entries(true) as $ou_dn => $ou_attrs) { - $_ous[] = strtolower($ou_dn); + if ($ous['count']) { + foreach ($ous['list'] as $ou_dn => $ou_attrs) { + $result[] = strtolower($ou_dn); } - sort($_ous); + sort($result); } return array( - 'list' => $_ous, + 'list' => $result, 'default' => strtolower($default), ); }
View file
kolab-webadmin-3.2.5.tar.gz/lib/client/kolab_client_task_settings.php -> kolab-webadmin-3.2.6.tar.gz/lib/client/kolab_client_task_settings.php
Changed
@@ -32,8 +32,10 @@ ); protected $form_element_types = array( - 'text', 'text-separated', 'select', 'multiselect', 'list', 'list-autocomplete', 'checkbox', 'password', 'ldap_url', - 'text-quota', 'aci', 'imap_acl', + 'text', 'text-separated', 'text-quota', 'text-autocomplete', + 'select', 'multiselect', + 'list', 'list-autocomplete', 'checkbox', 'password', 'ldap_url', + 'aci', 'imap_acl', ); protected $special_attributes = array('ou'); @@ -624,7 +626,7 @@ // defined attributes foreach ($attributes as $attr) { $row = $cells; - $type = $data['attributes']['form_fields'][$attr]['type']; + $type = $data['attributes']['form_fields'][$attr]['type'] ?: 'text'; $optional = $data['attributes']['form_fields'][$attr]['optional']; $autocomplete = $data['attributes']['form_fields'][$attr]['autocomplete']; $validate = $data['attributes']['form_fields'][$attr]['validate']; @@ -634,6 +636,9 @@ if ($type == 'list' && $autocomplete) { $type = 'list-autocomplete'; } + else if ($type == 'text' && $autocomplete) { + $type = 'text-autocomplete'; + } if ($data['attributes']['fields'][$attr]) { $valtype = 'static'; @@ -669,7 +674,7 @@ // set cell content $row['name']['body'] = !empty($available[$attr]) ? $available[$attr] : $attr; - $row['type']['body'] = !empty($type) ? $type : 'text'; + $row['type']['body'] = $type; $row['readonly']['body'] = $valtype == 'auto-readonly' ? $yes : $no; $row['optional']['body'] = $optional ? $yes : $no; $row['validate']['body'] = $this->translate('attribute.validate.' . $n_validate);
View file
kolab-webadmin-3.2.5.tar.gz/lib/client/kolab_client_task_signup.php -> kolab-webadmin-3.2.6.tar.gz/lib/client/kolab_client_task_signup.php
Changed
@@ -251,7 +251,7 @@ $fields['domain']['label'] = 'signup.domain'; // Create form object and populate with fields - $form = $this->form_create('user', $attribs, array('other'), $fields, $fields_map, $data, true + $form = $this->form_create('user', $attribs, array('other'), $fields, $fields_map, $data, true, $this->translate('signup.formtitle')); $this->output->add_translation('user.password.mismatch', 'signup.wronguid', 'signup.userexists', 'internalerror', 'servererror');
View file
kolab-webadmin-3.2.5.tar.gz/lib/kolab_api_service.php -> kolab-webadmin-3.2.6.tar.gz/lib/kolab_api_service.php
Changed
@@ -311,6 +311,12 @@ foreach ($type_attrs['form_fields'] as $key => $value) { Log::trace("Running parse input attributes for key $key"); + $type = $value['type'] ?: ($type_attrs['auto_form_fields'][$key] ? $type_attrs['auto_form_fields'][$key]['type'] : ''); + + if (($type == 'text' || empty($type)) && is_array($attribs[$key])) { + $attribs[$key] = array_shift($attribs[$key]); + } + if (empty($attribs[$key]) && empty($value['optional'])) { Log::error("\$attribs['" . $key . "'] is empty, and the field is not optional"); throw new Exception("Missing input value for $key", 345);
View file
kolab-webadmin-3.2.5.tar.gz/lib/kolab_client_task.php -> kolab-webadmin-3.2.6.tar.gz/lib/kolab_client_task.php
Changed
@@ -921,10 +921,14 @@ break; default: - $result['type'] = kolab_form::INPUT_TEXT; - - if (isset($field['maxlength'])) { - $result['maxlength'] = $field['maxlength']; + if (!empty($field['autocomplete'])) { + $result['type'] = kolab_form::INPUT_TEXTAREA; + $result['data-type'] = 'list'; + $result['data-maxcount'] = 1; + $result['data-autocomplete'] = true; + } + else { + $result['type'] = kolab_form::INPUT_TEXT; } if ($field['type'] && $field['type'] != 'text') { @@ -940,6 +944,10 @@ else { $result['default'] = $field['default']; } + + if (isset($field['maxlength'])) { + $result['maxlength'] = $field['maxlength']; + } } $result['required'] = empty($field['optional']); @@ -1357,7 +1365,7 @@ $field['description'] = "$name.$idx.desc"; $field['section'] = $section_idx; - if (empty($field['value']) && !empty($data[$idx])) { + if (empty($field['value']) && $data[$idx] !== null && $data[$idx] !== '') { $value = $data[$idx]; // Convert data for the list field with autocompletion
View file
kolab-webadmin-3.2.5.tar.gz/lib/kolab_utils.php -> kolab-webadmin-3.2.6.tar.gz/lib/kolab_utils.php
Changed
@@ -171,16 +171,16 @@ * * @param string $dn LDAP DN string * - * @return array Exploded DN (uses unicode encoding) + * @return array|bool Exploded DN (uses unicode encoding), False on failure */ public static function explode_dn($dn) { - $result = ldap_explode_dn($dn, 0); + if ($result = ldap_explode_dn($dn, 0)) { + // get rid of count + unset($result['count']); - // get rid of count - unset($result['count']); - - $result = array_map(array('kolab_utils', 'decode_dn'), $result); + $result = array_map(array('kolab_utils', 'decode_dn'), $result); + } return $result; }
View file
kolab-webadmin-3.2.5.tar.gz/lib/recaptchalib.php -> kolab-webadmin-3.2.6.tar.gz/lib/recaptchalib.php
Changed
@@ -1,17 +1,15 @@ <?php -/* +/** * This is a PHP library that handles calling reCAPTCHA. * - Documentation and latest version - * http://recaptcha.net/plugins/php/ + * https://developers.google.com/recaptcha/docs/php * - Get a reCAPTCHA API Key * https://www.google.com/recaptcha/admin/create * - Discussion group * http://groups.google.com/group/recaptcha * - * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net - * AUTHORS: - * Mike Crawford - * Ben Maurer + * @copyright Copyright (c) 2014, Google Inc. + * @link http://www.google.com/recaptcha * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,245 +31,110 @@ */ /** - * The reCAPTCHA server URL's - */ -define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api"); -define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api"); -define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); - -/** - * Encodes the given data into a query string format - * @param $data - array of string elements to be encoded - * @return string - encoded request - */ -function _recaptcha_qsencode ($data) { - $req = ""; - foreach ( $data as $key => $value ) - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; - - // Cut the last '&' - $req=substr($req,0,strlen($req)-1); - return $req; -} - - - -/** - * Submits an HTTP POST to a reCAPTCHA server - * @param string $host - * @param string $path - * @param array $data - * @param int port - * @return array response + * A ReCaptchaResponse is returned from checkAnswer(). */ -function _recaptcha_http_post($host, $path, $data, $port = 80) { - - $req = _recaptcha_qsencode ($data); - - $http_request = "POST $path HTTP/1.0\r\n"; - $http_request .= "Host: $host\r\n"; - $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; - $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; - $http_request .= "\r\n"; - $http_request .= $req; - - $response = ''; - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { - die ('Could not open socket'); - } - - fwrite($fs, $http_request); - - while ( !feof($fs) ) - $response .= fgets($fs, 1160); // One TCP-IP packet - fclose($fs); - $response = explode("\r\n\r\n", $response, 2); - - return $response; +class ReCaptchaResponse +{ + public $success; + public $errorCodes; } - - -/** - * Gets the challenge HTML (javascript and non-javascript version). - * This is called from the browser, and the resulting reCAPTCHA HTML widget - * is embedded within the HTML form it was called from. - * @param string $pubkey A public key for reCAPTCHA - * @param string $error The error given by reCAPTCHA (optional, default is null) - * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) - - * @return string - The HTML to be embedded in the user's form. - */ -function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) +class ReCaptcha { - if ($pubkey == null || $pubkey == '') { - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); - } - - if ($use_ssl) { - $server = RECAPTCHA_API_SECURE_SERVER; - } else { - $server = RECAPTCHA_API_SERVER; + private static $_signupUrl = "https://www.google.com/recaptcha/admin"; + private static $_siteVerifyUrl = + "https://www.google.com/recaptcha/api/siteverify?"; + private $_secret; + private static $_version = "php_1.0"; + + /** + * Constructor. + * + * @param string $secret shared secret between site and ReCAPTCHA server. + */ + function ReCaptcha($secret) + { + if ($secret == null || $secret == "") { + die("To use reCAPTCHA you must get an API key from <a href='" + . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>"); } - - $errorpart = ""; - if ($error) { - $errorpart = "&error=" . $error; + $this->_secret=$secret; + } + + /** + * Encodes the given data into a query string format. + * + * @param array $data array of string elements to be encoded. + * + * @return string - encoded request. + */ + private function _encodeQS($data) + { + $req = ""; + foreach ($data as $key => $value) { + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; } - return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> - - <noscript> - <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> - <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> - <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> - </noscript>'; -} - - - - -/** - * A ReCaptchaResponse is returned from recaptcha_check_answer() - */ -class ReCaptchaResponse { - var $is_valid; - var $error; -} - -/** - * Calls an HTTP POST function to verify if the user's guess was correct - * @param string $privkey - * @param string $remoteip - * @param string $challenge - * @param string $response - * @param array $extra_params an array of extra variables to post to the server - * @return ReCaptchaResponse - */ -function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) -{ - if ($privkey == null || $privkey == '') { - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); - } - - if ($remoteip == null || $remoteip == '') { - die ("For security reasons, you must pass the remote ip to reCAPTCHA"); - } - - - - //discard spam submissions - if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { - $recaptcha_response = new ReCaptchaResponse(); - $recaptcha_response->is_valid = false; - $recaptcha_response->error = 'incorrect-captcha-sol'; - return $recaptcha_response; + // Cut the last '&' + $req=substr($req, 0, strlen($req)-1); + return $req; + } + + /** + * Submits an HTTP GET to a reCAPTCHA server. + * + * @param string $path url path to recaptcha server. + * @param array $data array of parameters to be sent. + * + * @return array response + */ + private function _submitHTTPGet($path, $data) + { + $req = $this->_encodeQS($data); + $response = file_get_contents($path . $req); + return $response; + } + + /** + * Calls the reCAPTCHA siteverify API to verify whether the user passes + * CAPTCHA test. + * + * @param string $remoteIp IP address of end user. + * @param string $response response string from recaptcha verification. + * + * @return ReCaptchaResponse + */ + public function verifyResponse($remoteIp, $response) + { + // Discard empty solution submissions + if ($response == null || strlen($response) == 0) { + $recaptchaResponse = new ReCaptchaResponse(); + $recaptchaResponse->success = false; + $recaptchaResponse->errorCodes = 'missing-input'; + return $recaptchaResponse; } - $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", - array ( - 'privatekey' => $privkey, - 'remoteip' => $remoteip, - 'challenge' => $challenge, - 'response' => $response - ) + $extra_params - ); - - $answers = explode ("\n", $response [1]); - $recaptcha_response = new ReCaptchaResponse(); - - if (trim ($answers [0]) == 'true') { - $recaptcha_response->is_valid = true; - } - else { - $recaptcha_response->is_valid = false; - $recaptcha_response->error = $answers [1]; + $getResponse = $this->_submitHttpGet( + self::$_siteVerifyUrl, + array ( + 'secret' => $this->_secret, + 'remoteip' => $remoteIp, + 'v' => self::$_version, + 'response' => $response + ) + ); + $answers = json_decode($getResponse, true); + $recaptchaResponse = new ReCaptchaResponse(); + + if (trim($answers ['success']) == true) { + $recaptchaResponse->success = true; + } else { + $recaptchaResponse->success = false; + $recaptchaResponse->errorCodes = $answers [error-codes]; } - return $recaptcha_response; - -} - -/** - * gets a URL where the user can sign up for reCAPTCHA. If your application - * has a configuration page where you enter a key, you should provide a link - * using this function. - * @param string $domain The domain where the page is hosted - * @param string $appname The name of your application - */ -function recaptcha_get_signup_url ($domain = null, $appname = null) { - return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); -} -function _recaptcha_aes_pad($val) { - $block_size = 16; - $numpad = $block_size - (strlen ($val) % $block_size); - return str_pad($val, strlen ($val) + $numpad, chr($numpad)); + return $recaptchaResponse; + } } -/* Mailhide related code */ - -function _recaptcha_aes_encrypt($val,$ky) { - if (! function_exists ("mcrypt_encrypt")) { - die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); - } - $mode=MCRYPT_MODE_CBC; - $enc=MCRYPT_RIJNDAEL_128; - $val=_recaptcha_aes_pad($val); - return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); -} - - -function _recaptcha_mailhide_urlbase64 ($x) { - return strtr(base64_encode ($x), '+/', '-_'); -} - -/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ -function recaptcha_mailhide_url($pubkey, $privkey, $email) { - if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { - die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . - "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>"); - } - - - $ky = pack('H*', $privkey); - $cryptmail = _recaptcha_aes_encrypt ($email, $ky); - - return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); -} - -/** - * gets the parts of the email to expose to the user. - * eg, given johndoe@example,com return ["john", "example.com"]. - * the email is then displayed as john...@example.com - */ -function _recaptcha_mailhide_email_parts ($email) { - $arr = preg_split("/@/", $email ); - - if (strlen ($arr[0]) <= 4) { - $arr[0] = substr ($arr[0], 0, 1); - } else if (strlen ($arr[0]) <= 6) { - $arr[0] = substr ($arr[0], 0, 3); - } else { - $arr[0] = substr ($arr[0], 0, 4); - } - return $arr; -} - -/** - * Gets html to display an email address given a public an private key. - * to get a key, go to: - * - * http://www.google.com/recaptcha/mailhide/apikey - */ -function recaptcha_mailhide_html($pubkey, $privkey, $email) { - $emailparts = _recaptcha_mailhide_email_parts ($email); - $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); - - return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) . - "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]); - -} - - ?>
View file
kolab-webadmin-3.2.5.tar.gz/public_html/js/kolab_admin.js -> kolab-webadmin-3.2.6.tar.gz/public_html/js/kolab_admin.js
Changed
@@ -104,6 +104,9 @@ $('li', $('#navigation')).removeClass('active'); $('li.'+task, ('#navigation')).addClass('active'); + if (ret === false) + this.set_busy(false); + return ret === false ? false : obj ? false : true; }; @@ -852,6 +855,7 @@ readonly = e.attr('readonly'), autocomplete = e.attr('data-autocomplete'), maxlength = e.attr('data-maxlength'), + maxcount = e.attr('data-maxcount'), area = $('<span class="listarea"></span>'); e.hide(); @@ -902,6 +906,16 @@ oninsert: this.form_element_oninsert }); + // when max=1 we use only one input + if (maxcount == 1) { + $.each(list, function(i, v) { + $('input', elem).val(v); + return false; + }); + + list = []; + } + elem.appendTo(area); area.addClass('autocomplete'); } @@ -1009,6 +1023,13 @@ af = kadm.env.assoc_fields, maxcount = $('textarea[name="'+name+'"]').attr('data-maxcount'); + if (maxcount == 1) { + $(input).val(val); + af[name] = {}; + af[name][key] = val; + return; + } + // reset autocomplete input input.value = ''; @@ -1595,7 +1616,7 @@ target = $('<input id="aci-targets-target" type="text" size="40" />'), filter = $('<input id="aci-targets-filter" type="text" size="40" />'), button = $('<input type="button" id="aci-targets-targetbtn" />').val(this.t('aci.thisentry')) - .on('click', function() { target.val(self.env.entrydn) }), + .on('click', function() { target.val('ldap:///' + self.env.entrydn); }), select = $('<select id="aci-targets-attr" multiple="multiple" size="8"></select>'), radio = [ $('<label>').text(this.t('aci.selected')).prepend($('<input type="radio" name="attr-operator" value="=" />')), @@ -2294,12 +2315,12 @@ this.domain_delete = function(id) { this.env.delete_domain_id = id; - this.delete_handler(id, 'domain'); + return this.delete_handler(id, 'domain'); }; this.domain_save = function(reload, section) { - this.save_handler('domain', reload, section); + return this.save_handler('domain', reload, section); }; this.domain_delete_response = function(response) @@ -2348,12 +2369,12 @@ this.user_list = function(props) { - this.list_handler('user', props); + return this.list_handler('user', props); }; this.user_delete = function(id) { - this.delete_handler(id, 'user'); + return this.delete_handler(id, 'user'); }; this.user_save = function(reload, section) @@ -2370,7 +2391,7 @@ return data; }; - this.save_handler('user', reload, section, validate); + return this.save_handler('user', reload, section, validate); }; this.user_delete_response = function(response) @@ -2395,17 +2416,17 @@ this.group_list = function(props) { - this.list_handler('group', props); + return this.list_handler('group', props); }; this.group_delete = function(id) { - this.delete_handler(id, 'group'); + return this.delete_handler(id, 'group'); }; this.group_save = function(reload, section) { - this.save_handler('group', reload, section); + return this.save_handler('group', reload, section); }; this.group_delete_response = function(response) @@ -2430,17 +2451,17 @@ this.ou_list = function(props) { - this.list_handler('ou', props); + return this.list_handler('ou', props); }; this.ou_delete = function(id) { - this.delete_handler(id, 'ou'); + return this.delete_handler(id, 'ou'); }; this.ou_save = function(reload, section) { - this.save_handler('ou', reload, section); + return this.save_handler('ou', reload, section); }; this.ou_delete_response = function(response) @@ -2465,17 +2486,17 @@ this.resource_list = function(props) { - this.list_handler('resource', props); + return this.list_handler('resource', props); }; this.resource_delete = function(id) { - this.delete_handler(id, 'resource'); + return this.delete_handler(id, 'resource'); }; this.resource_save = function(reload, section) { - this.save_handler('resource', reload, section); + return this.save_handler('resource', reload, section); }; this.resource_delete_response = function(response) @@ -2500,17 +2521,17 @@ this.role_list = function(props) { - this.list_handler('role', props); + return this.list_handler('role', props); }; this.role_delete = function(id) { - this.delete_handler(id, 'role'); + return this.delete_handler(id, 'role'); }; this.role_save = function(reload, section) { - this.save_handler('role', reload, section); + return this.save_handler('role', reload, section); }; this.role_delete_response = function(response) @@ -2535,17 +2556,17 @@ this.sharedfolder_list = function(props) { - this.list_handler('sharedfolder', props); + return this.list_handler('sharedfolder', props); }; this.sharedfolder_delete = function(id) { - this.delete_handler(id, 'sharedfolder'); + return this.delete_handler(id, 'sharedfolder'); }; this.sharedfolder_save = function(reload, section) { - this.save_handler('sharedfolder', reload, section); + return this.save_handler('sharedfolder', reload, section); }; this.sharedfolder_delete_response = function(response) @@ -2588,11 +2609,7 @@ this.type_delete = function(id) { - if (!confirm(this.t('type.delete.confirm'))) - return; - - this.set_busy(true, 'deleting'); - this.api_post('type.delete', this.type_id_parse(id), 'type_delete_response'); + return this.delete_handler(this.type_id_parse(id), 'type'); }; this.type_save = function(reload, section) @@ -2612,12 +2629,12 @@ if (!this.check_required_fields(data)) { this.display_message('form.required.empty', 'error'); - return; + return false; } if (data.key.match(/[^a-z_-]/)) { this.display_message('attribute.key.invalid', 'error'); - return; + return false; } request.id = data.id; @@ -2653,6 +2670,9 @@ data.type = 'list'; data.autocomplete = true; } + else if (attr.type == 'text-autocomplete') { + data.autocomplete = true; + } else if (attr.type != 'text') data.type = attr.type; @@ -2680,7 +2700,7 @@ if (required.length) { this.display_message(this.t('attribute.required.error').replace(/\$1/, required.join(',')), 'error'); - return; + return false; } this.set_busy(true, 'saving'); @@ -2745,13 +2765,16 @@ }; // universal object delete handler - this.delete_handler = function(id, type) + this.delete_handler = function(request, type) { if (!confirm(this.t(type + '.delete.confirm'))) - return; + return false; + + if (typeof request != 'object') + request = {'id': request}; this.set_busy(true, 'deleting'); - this.api_post(type + '.delete', {'id': id}, type + '_delete_response'); + this.api_post(type + '.delete', request, type + '_delete_response'); }; // universal form save handler
View file
kolab-webadmin-3.2.5.tar.gz/public_html/js/kolab_hosted.js -> kolab-webadmin-3.2.6.tar.gz/public_html/js/kolab_hosted.js
Changed
@@ -24,9 +24,6 @@ // overwrite user_save() function kadm.user_save = function(reload, section) { - if (this.busy) - return; - var data = this.serialize_form('#'+this.env.form_id); if (!this.check_required_fields(data)) {
View file
kolab-webadmin-3.2.5.tar.gz/public_html/skins/default/style.css -> kolab-webadmin-3.2.6.tar.gz/public_html/skins/default/style.css
Changed
@@ -723,7 +723,8 @@ } .autocomplete > span.listelement input { - width: 346px; + width: 348px; + border-radius: 0; } .autocomplete > span.listelement span.actions {
View file
kolab-webadmin-3.2.5.tar.gz/public_html/skins/default/templates/signup.html -> kolab-webadmin-3.2.6.tar.gz/public_html/skins/default/templates/signup.html
Changed
@@ -8,7 +8,7 @@ <link rel="shortcut icon" type="image/png" href="{$skin_path}images/favicon.png" /> <script src="js/jquery.min.js"></script> <script src="js/kolab_admin.js"></script> - <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script> + <script src='https://www.google.com/recaptcha/api.js'></script> <script src="js/kolab_hosted.js"></script> <script src="{$skin_path}ui.js"></script> </head> @@ -20,7 +20,10 @@ <h1>{$engine->translate('signup.headline')}</h1> <p>{$engine->translate('signup.intro1')}</p> <p>{$engine->translate('signup.intro2')}</p> - <div id="taskcontent" class="signup">{$form}</div> + <div id="taskcontent" class="signup">{$form} + <br /> + <div align="center" class="g-recaptcha" data-sitekey="6LdfwgATAAAAAB9vPmBXhRwXKtXaHgaxCrWjT98p"></div> + </div> </div> </div> <div id="footer">
View file
kolab-webadmin-3.2.5.tar.gz/public_html/skins/kolabsys/templates/signup.html -> kolab-webadmin-3.2.6.tar.gz/public_html/skins/kolabsys/templates/signup.html
Changed
@@ -8,12 +8,16 @@ <link rel="shortcut icon" type="image/png" href="{$skin_path}images/favicon.png" /> <script src="js/jquery.min.js"></script> <script src="js/kolab_admin.js"></script> - <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script> + <script src='https://www.google.com/recaptcha/api.js'></script> <script src="js/kolab_hosted.js"></script> <script src="{$skin_path}ui.js"></script> </head> <body> - <div id="taskcontent" class="signup">{$form}</div> + <div id="taskcontent" class="signup"> + {$form} + <br /> + <div align="center" class="g-recaptcha" data-sitekey="6LdfwgATAAAAAB9vPmBXhRwXKtXaHgaxCrWjT98p"></div> + </div> {$script} </body>
View file
kolab-webadmin-3.2.5.tar.gz/public_html/skins/minimal/templates/signup.html -> kolab-webadmin-3.2.6.tar.gz/public_html/skins/minimal/templates/signup.html
Changed
@@ -8,13 +8,16 @@ <link rel="shortcut icon" type="image/png" href="{$skin_path}images/favicon.png" /> <script src="js/jquery.min.js"></script> <script src="js/kolab_admin.js"></script> - <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script> + <script src='https://www.google.com/recaptcha/api.js'></script> <script src="js/kolab_hosted.js"></script> <script src="{$skin_path}ui.js"></script> </head> <body> - <div id="taskcontent" class="signup">{$form}</div> - + <div id="taskcontent" class="signup"> + {$form} + <br /> + <div align="center" class="g-recaptcha" data-sitekey="6LdfwgATAAAAAB9vPmBXhRwXKtXaHgaxCrWjT98p"></div> + </div> <div id="footer"> {include file="signup_footer.html"} </div>
View file
kolab-webadmin.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-webadmin Binary: kolab-webadmin Architecture: all -Version: 3.2.5-0~kolab2 +Version: 3.2.6-0~kolab1 Maintainer: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl> Homepage: http://www.kolab.org/ @@ -13,5 +13,5 @@ Package-List: kolab-webadmin deb admin extra Files: - 00000000000000000000000000000000 0 kolab-webadmin-3.2.5.tar.gz + 00000000000000000000000000000000 0 kolab-webadmin-3.2.6.tar.gz 00000000000000000000000000000000 0 debian.tar.gz
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.