Merge branch 'master' into calendar_repeat

This commit is contained in:
Georg Ehrke 2012-06-11 15:38:02 +02:00
commit 24a1ab8c15
4 changed files with 33 additions and 4 deletions

View File

@ -82,6 +82,7 @@ if(is_array($value)) {
$value = strip_tags($value); $value = strip_tags($value);
} }
/* preprocessing value */
switch($name) { switch($name) {
case 'BDAY': case 'BDAY':
$date = New DateTime($value); $date = New DateTime($value);
@ -94,6 +95,8 @@ switch($name) {
case 'N': case 'N':
case 'ORG': case 'ORG':
case 'NOTE': case 'NOTE':
$value = str_replace('\n', ' \\n', $value);
break;
case 'NICKNAME': case 'NICKNAME':
// TODO: Escape commas and semicolons. // TODO: Escape commas and semicolons.
break; break;
@ -105,8 +108,14 @@ switch($name) {
break; break;
} }
switch($name) {
$property = $vcard->addProperty($name, $value); //, $parameters); case 'NOTE':
$vcard->setString('NOTE', $value);
break;
default:
$property = $vcard->addProperty($name, $value); //, $parameters);
break;
}
$line = count($vcard->children) - 1; $line = count($vcard->children) - 1;

View File

@ -186,7 +186,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
if(!$this->configured) { if(!$this->configured) {
return array(); return array();
} }
if(is_null($this->_groups)) { if(empty($this->_groups)) {
$ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn')); $ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
$this->_groups = OC_LDAP::ownCloudGroupNames($ldap_groups); $this->_groups = OC_LDAP::ownCloudGroupNames($ldap_groups);
} }

View File

@ -112,6 +112,7 @@ elseif(OC_User::isLoggedIn()) {
if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) { if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
//OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG); //OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG);
OC_User::unsetMagicInCookie(); OC_User::unsetMagicInCookie();
$_REQUEST['redirect_url'] = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'');
OC_Util::redirectToDefaultPage(); OC_Util::redirectToDefaultPage();
}else{ }else{
$error = true; $error = true;

21
lib/util.php Normal file → Executable file
View File

@ -332,7 +332,8 @@ class OC_Util {
* Redirect to the user default page * Redirect to the user default page
*/ */
public static function redirectToDefaultPage(){ public static function redirectToDefaultPage(){
if(isset($_REQUEST['redirect_url']) && substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT) { OC_Log::write('core','redirectToDefaultPage',OC_Log::DEBUG);
if(isset($_REQUEST['redirect_url']) && (substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT || $_REQUEST['redirect_url'][0] == '/')) {
header( 'Location: '.$_REQUEST['redirect_url']); header( 'Location: '.$_REQUEST['redirect_url']);
} else { } else {
header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files')); header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files'));
@ -358,12 +359,30 @@ class OC_Util {
* Todo: Write howto * Todo: Write howto
*/ */
public static function callRegister(){ public static function callRegister(){
//mamimum time before token exires
$maxtime=(60*60); // 1 hour
// generate a random token. // generate a random token.
$token=mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000); $token=mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000);
// store the token together with a timestamp in the session. // store the token together with a timestamp in the session.
$_SESSION['requesttoken-'.$token]=time(); $_SESSION['requesttoken-'.$token]=time();
// cleanup old tokens garbage collector
// only run every 20th time so we don´t waste cpu cycles
if(rand(0,20)==0) {
foreach($_SESSION as $key=>$value) {
// search all tokens in the session
if(substr($key,0,12)=='requesttoken') {
if($value+$maxtime<time()){
// remove outdated tokens
unset($_SESSION[$key]);
}
}
}
}
// return the token // return the token
return($token); return($token);
} }