diff --git a/.gitignore b/.gitignore
index ea8e5bd42facacb612876ac2d8588d3ac91a3d38..312dc0433aa21ca80a6d838e57ec8de77eb1df38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,4 +32,7 @@ RCS/*
 # netbeans 
 nbproject
 
-.DS_Store
\ No newline at end of file
+# geany
+*.geany
+
+.DS_Store
diff --git a/COPYING-README b/COPYING-README
index b0caca2ad21681d6c43283fef2a8ea2ff3b3d0c9..49e035186ed0b3ff295f752150262ea424ebc736 100644
--- a/COPYING-README
+++ b/COPYING-README
@@ -2,13 +2,14 @@ Files in ownCloud are licensed under the Affero General Public License version 3
 the text of which can be found in COPYING-AGPL, or any later version of the AGPL,
 unless otherwise noted.
 
-Components of ownCloud:
-* jQuery is dual licensed under MIT and GPL
-* HTTP is three clause BSD license
-* MDB2 uses a custom license in the BSD style
-* User is AGPL
-* XML/RPC is both MIT and PHP license
+Licensing of components:
+* jQuery: MIT / GPL
+* HTTP: 3 clause BSD
+* MDB2: BSD style custom
+* User: AGPL
+* XML/RPC: MIT / PHP
+* Silk icons: Creative Commons Attribution 
 All unmodified files from these and other sources retain their original copyright
 and license notices: see the relevant individual files.
 
-Attribution information for ownCloud is contained in the AUTHORS file.
+Attribution information for ownCloud is contained in the AUTHORS file.
\ No newline at end of file
diff --git a/apps/calendar/ajax/getcal.php b/apps/calendar/ajax/getcal.php
index a65c6cf2602192808f0b0109e1cfb2400178a047..3d43677075f7da0871ab635d9a266f3aa26f1d0d 100644
--- a/apps/calendar/ajax/getcal.php
+++ b/apps/calendar/ajax/getcal.php
@@ -28,43 +28,674 @@ $select_year = $_GET["year"];
 $user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
 foreach($events as $event)
 {
-	if ($select_year != substr($event['startdate'], 0, 4))
+	if($select_year != substr($event['startdate'], 0, 4) && $event["repeating"] == false)
 		continue;
-	$object = Sabre_VObject_Reader::read($event['calendardata']);
-	$vevent = $object->VEVENT;
-	$dtstart = $vevent->DTSTART;
-	$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
-	$start_dt = $dtstart->getDateTime();
-	$start_dt->setTimezone(new DateTimeZone($user_timezone));
-	$end_dt = $dtend->getDateTime();
-	$end_dt->setTimezone(new DateTimeZone($user_timezone));
-	$year  = $start_dt->format('Y');
-	$month = $start_dt->format('n') - 1; // return is 0 based
-	$day   = $start_dt->format('j');
-	$hour  = $start_dt->format('G');
-	if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
-		$hour = 'allday';
-	}
+	if($select_year == substr($event['startdate'], 0, 4) && $event["repeating"] == false){
+		$object = Sabre_VObject_Reader::read($event['calendardata']);
+		$vevent = $object->VEVENT;
+		$dtstart = $vevent->DTSTART;
+		$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
+		$start_dt = $dtstart->getDateTime();
+		$start_dt->setTimezone(new DateTimeZone($user_timezone));
+		$end_dt = $dtend->getDateTime();
+		$end_dt->setTimezone(new DateTimeZone($user_timezone));
+		$year  = $start_dt->format('Y');
+		$month = $start_dt->format('n') - 1; // return is 0 based
+		$day   = $start_dt->format('j');
+		$hour  = $start_dt->format('G');
+		if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+			$hour = 'allday';
+		}
 
-	$return_event = array();
-	foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop)
-	{
-		$return_event[$prop] = $event[$prop];
-	}
-	$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
-	$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
-	$return_event['description'] = $event['summary'];
-	if ($hour == 'allday')
-	{
-		$return_event['allday'] = true;
-	}
-	if (isset($return[$year][$month][$day][$hour]))
-	{
-		$return[$year][$month][$day][$hour][] = $return_event;
+		$return_event = array();
+		foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop)
+		{
+			$return_event[$prop] = $event[$prop];
+		}
+		$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+		$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+		$return_event['description'] = $event['summary'];
+		if ($hour == 'allday')
+		{
+			$return_event['allday'] = true;
+		}
+		if (isset($return[$year][$month][$day][$hour]))
+		{
+			$return[$year][$month][$day][$hour][] = $return_event;
+		}
+		else
+		{
+			$return[$year][$month][$day][$hour] = array(1 => $return_event);
+		}
 	}
-	else
-	{
-		$return[$year][$month][$day][$hour] = array(1 => $return_event);
+	if($event["repeating"] == 1){
+		$object = Sabre_VObject_Reader::read($event['calendardata']);
+		$vevent = $object->VEVENT;
+		//echo substr_count($event["calendardata"], "EXDATE");
+		$numofelements = substr_count($vevent->RRULE, ";");
+		$properties = array("FREQ"=>"false", "UNTIL"=>"false", "COUNT"=>"false", "INTERVAL"=>"false", "BYDAY"=>"false", "BYMONTHDAY"=>"false", "BYWEEKNO"=>"false", "BYMONTH"=>"false", "BYYEARDAY"=>"false", "BYSETPOS"=>"false");
+		$exruleproperties = array("FREQ"=>"false", "UNTIL"=>"false", "COUNT"=>"false", "INTERVAL"=>"false", "BYDAY"=>"false", "BYMONTHDAY"=>"false", "BYWEEKNO"=>"false", "BYMONTH"=>"false", "BYYEARDAY"=>"false", "BYSETPOS"=>"false");
+		$byday = array("MO"=>"false", "TU"=>"false", "WE"=>"false", "TH"=>"false", "FR"=>"false", "SA"=>"false", "SU"=>"false");
+		if($numofelements !=  0){
+			$rrule = explode(";", $vevent->RRULE);
+			for($i = 0;$i <= $numofelements;$i++){
+				$rule = explode("=", $rrule[$i]);
+				$property = $rule[0];
+				$value = $rule[1];
+				$properties[$property] = $value;
+			}
+			if($properties["BYDAY"] != "false"){
+				$numofdays = substr_count($properties["BYDAY"], ",");
+				if($numofdays == 0){
+					if(strlen($properties["BYDAY"]) != 2){
+						$lenght = strlen($properties["BYDAY"]);
+						switch($lenght){
+							case "3":
+								$properties["BYSETPOS"] = substr($properties["BYDAY"],0,1);
+								$properties["BYDAY"] = substr($properties["BYDAY"],1,2);
+								break;
+							case "4":
+								$properties["BYSETPOS"] = substr($properties["BYDAY"],0,2);
+								$properties["BYDAY"] = substr($properties["BYDAY"],2,2);
+								break;
+							case "5":
+								$properties["BYSETPOS"] = substr($properties["BYDAY"],0,3);
+								$properties["BYDAY"] = substr($properties["BYDAY"],3,2);
+								break;
+							case "6":
+								$properties["BYSETPOS"] = substr($properties["BYDAY"],0,4);
+								$properties["BYDAY"] = substr($properties["BYDAY"],4,2);
+								break;
+						}
+					}
+					$byday[$properties["BYDAY"]] = true;
+					
+				}else{
+					$days = explode(",", $properties["BYDAY"]);
+					for($i = 0;$i <= $numofdays;$i++){
+						$day = $days[$i];
+						$byday[$day] = true;
+					}
+				}
+			}
+		}else{
+			$rule = explode("=", $vevent->RRULE);
+			$properties[$rule[0]] = $rule[1];
+		}
+		if($properties["INTERVAL"] == "false"){
+				$properties["INTERVAL"] = 1;
+		}
+		$count = 0; //counts all loops
+		$countedoutputs = 0; //counts only the outputs
+		$countchecker = true;
+		$dtstart = $vevent->DTSTART;
+		$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
+		$start_dt = $dtstart->getDateTime();
+		$start_dt->setTimezone(new DateTimeZone($user_timezone));
+		$end_dt = $dtend->getDateTime();
+		$end_dt->setTimezone(new DateTimeZone($user_timezone));
+		$firststart_year  = $start_dt->format('Y');
+		$firststart_month = $start_dt->format('n');
+		$firststart_day   = $start_dt->format('j');
+		$hour  = $start_dt->format('G');
+		$interval = 0;
+		if($properties["UNTIL"] != "false"){
+			$until = $properties["UNTIL"];
+			$until_year = substr($until, 0, 4);
+			$until_month = substr($until, 4, 2);
+			$until_day = substr($until, 6, 2);
+		}
+		//print_r($properties);
+		//print_r($byday);
+		if($properties["FREQ"] == "DAILY"){
+			if($properties["BYDAY"] == "false"){
+				$byday = array("MO"=>"1", "TU"=>"1", "WE"=>"1", "TH"=>"1", "FR"=>"1", "SA"=>"1", "SU"=>"1");
+			}
+			while(date("Y", mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year) + ($count * 1 * 86400 * $interval)) <= $select_year && $countchecker == true){
+				if($byday[strtoupper(substr(date("D", mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year) + ($count * 1 * 86400 * $interval)), 0, 2))] == "1"){
+					$newunixtime = mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year) + ($count * 1 * 86400 * $interval);
+					$year  = date("Y", $newunixtime);
+					$month = date("n", $newunixtime) - 1; // return is 0 based
+					$day   = date("j", $newunixtime);
+					if($properties["UNTIL"] != "false"){
+						if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+							break;
+						}
+					}
+					if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+						$hour = 'allday';
+					}
+					$return_event = array();
+					foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+						$return_event[$prop] = $event[$prop];
+					}
+					$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+					$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+					$return_event['description'] = $event['summary'];
+					$interval = $properties["INTERVAL"];
+					$countedoutputs++;
+					if($properties["COUNT"] != "false"){
+						if($countedoutputs == $properties["COUNT"]){
+							$countchecker = false;
+						}
+					}
+					if ($hour == 'allday'){
+						$return_event['allday'] = true;
+					}
+					if (isset($return[$year][$month][$day][$hour])){
+						$return[$year][$month][$day][$hour][] = $return_event;
+					}else{
+						$return[$year][$month][$day][$hour] = array(1 => $return_event);
+					}
+				}
+				$count++;
+			}
+		}
+		if($properties["FREQ"] == "WEEKLY"){
+			if($properties["BYDAY"] == "false"){
+				$byday[strtoupper(substr(date("D", mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year)), 0, 2))] = "1";
+			}
+			while(date("Y", mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year) + ($count * 1 * 86400 * $interval)) <= $select_year && $countchecker == true){
+				if($byday[strtoupper(substr(date("D", mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year) + ($count * 1 * 86400 * $interval)), 0, 2))] == "1"){
+					$newunixtime = mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year) + ($count * 1 * 86400 * $interval);
+					$year  = date("Y", $newunixtime);
+					$month = date("n", $newunixtime) - 1; // return is 0 based
+					$day   = date("j", $newunixtime);
+					if($properties["UNTIL"] != "false"){
+						if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+							break;
+						}
+					}
+					if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+						$hour = 'allday';
+					}
+					$return_event = array();
+					foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+						$return_event[$prop] = $event[$prop];
+					}
+					$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+					$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+					$return_event['description'] = $event['summary'];
+					$interval = $properties["INTERVAL"];
+					$countedoutputs++;
+					if($properties["COUNT"] != "false"){
+						if($countedoutputs == $properties["COUNT"]){
+							$countchecker = false;
+						}
+					}
+					if ($hour == 'allday'){
+						$return_event['allday'] = true;
+					}
+					if (isset($return[$year][$month][$day][$hour])){
+						$return[$year][$month][$day][$hour][] = $return_event;
+					}else{
+						$return[$year][$month][$day][$hour] = array(1 => $return_event);
+					}
+				}
+				$count++;
+			}
+		}
+		if($properties["FREQ"] == "MONTHLY"){
+			if(substr_count($properties["BYMONTHDAY"], ",") != 0){
+				$numofBYMONTHDAY = substr_count($properties["BYMONTHDAY"], ",");
+				if($numofBYMONTHDAY == 0){
+					$BYMONTHDAY = array();
+					$BYMONTHDAY[0] = $properties["BYMONTHDAY"];
+				}else{
+					$BYMONTHDAY = explode(",", $properties["BYMONTHDAY"]);
+				}
+				while(date("Y", mktime(0,0,0, $firststart_month + ($count * $interval), $properties["BYMONTHDAY"], $firststart_year)) <= $select_year && $countchecker == true){
+					for($i = 0;$i <= $numofBYMONTHDAY;$i++){
+						$newunixtime = mktime(0,0,0, $firststart_month + ($count * $interval), $BYMONTHDAY[$i], $firststart_year);
+						$year  = date("Y", $newunixtime);
+						$month = date("n", $newunixtime) - 1; // return is 0 based
+						$day   = date("j", $newunixtime);
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+					}
+					$count++;
+				}
+			}
+			//if($properties["BYMONTHDAY"] != "false"){
+				if($properties["BYSETPOS"] == "false"){
+					while(date("Y", mktime(0,0,0, $firststart_month + ($count * $interval), $properties["BYMONTHDAY"], $firststart_year)) <= $select_year && $countchecker == true){
+						$newunixtime = mktime(0,0,0, $firststart_month + ($count * $interval), $properties["BYMONTHDAY"], $firststart_year);
+						$year  = date("Y", $newunixtime);
+						$month = date("n", $newunixtime) - 1; // return is 0 based
+						$day   = date("j", $newunixtime);
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+						$count++;
+					}
+				}else{
+					if(!is_nan($properties["BYSETPOS"]) && $properties["BYSETPOS"] >= 1){
+						while(date("Y", mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year)) <= $select_year && $countchecker == true){
+							$lastdayofmonth = date("t", mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year));
+							$matches = 0;
+							$matchedday = "";
+							for($i = 1;$i <= $lastdayofmonth;$i++){
+								$thisday = date("j", mktime(0,0,0, $firststart_month + ($count * $interval), $i, $firststart_year));
+								$thisdayname = strtoupper(substr(date("D", mktime(0,0,0, $firststart_month + ($count * $interval), $i, $firststart_year)),0,2));
+								//echo $thisdayname . " " . $thisday . "\n"; 
+								if($byday[$thisdayname] == 1){
+									$matches++;
+								}
+								if($matches == $properties["BYSETPOS"]){
+									$matchedday = $thisday;
+									$i = 32;
+								}
+							}
+							$newunixtime = mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year);
+							$year  = date("Y", $newunixtime);
+							$month = date("n", $newunixtime) - 1; // return is 0 based
+							$day   = $matchedday;
+							if($properties["UNTIL"] != "false"){
+								if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+									break;
+								}
+							}
+							if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+								$hour = 'allday';
+							}
+							$return_event = array();
+							foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+								$return_event[$prop] = $event[$prop];
+							}
+							$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+							$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+							$return_event['description'] = $event['summary'];
+							$interval = $properties["INTERVAL"];
+							$countedoutputs++;
+							if($properties["COUNT"] != "false"){
+								if($countedoutputs == $properties["COUNT"]){
+									$countchecker = false;
+								}
+							}
+							if ($hour == 'allday'){
+								$return_event['allday'] = true;
+							}
+							if (isset($return[$year][$month][$day][$hour])){
+								$return[$year][$month][$day][$hour][] = $return_event;
+							}else{
+								$return[$year][$month][$day][$hour] = array(1 => $return_event);
+							}
+							$count++;
+						}
+					}elseif(!is_nan($properties["BYSETPOS"]) && $properties["BYSETPOS"] <= -1){
+						while(date("Y", mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year)) <= $select_year && $countchecker == true){
+							$lastdayofmonth = date("t", mktime(0,0,0, $firststart_month + ($count * $interval), 1, $firststart_year));
+							$matches = 0;
+							$matchedday = "";
+							for($i = $lastdayofmonth;$i >= 1;$i--){
+								$thisday = date("j", mktime(0,0,0, $firststart_month + ($count * $interval), $i, $firststart_year));
+								$thisdayname = strtoupper(substr(date("D", mktime(0,0,0, $firststart_month + ($count * $interval), $i, $firststart_year)),0,2));
+								//echo $thisdayname . " " . $thisday . "\n"; 
+								if($byday[$thisdayname] == 1){
+									$matches++;
+								}
+								if($matches == $properties["BYSETPOS"]){
+									$matchedday = $thisday;
+									$i = 0;
+								}
+							}
+							$newunixtime = mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year);
+							$year  = date("Y", $newunixtime);
+							$month = date("n", $newunixtime) - 1; // return is 0 based
+							$day   = $matchedday;
+							if($properties["UNTIL"] != "false"){
+								if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+									break;
+								}
+							}
+							if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+								$hour = 'allday';
+							}
+							$return_event = array();
+							foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+								$return_event[$prop] = $event[$prop];
+							}
+							$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+							$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+							$return_event['description'] = $event['summary'];
+							$interval = $properties["INTERVAL"];
+							$countedoutputs++;
+							if($properties["COUNT"] != "false"){
+								if($countedoutputs == $properties["COUNT"]){
+									$countchecker = false;
+								}
+							}
+							if ($hour == 'allday'){
+								$return_event['allday'] = true;
+							}
+							if (isset($return[$year][$month][$day][$hour])){
+								$return[$year][$month][$day][$hour][] = $return_event;
+							}else{
+								$return[$year][$month][$day][$hour] = array(1 => $return_event);
+							}
+							$count++;
+						}
+					//}
+				}
+			}
+			if(strlen($properties["BYDAY"]) == 2){
+				while(date("Y", mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year)) <= $select_year && $countchecker == true){
+					if($byday[strtoupper(substr(date("D", mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year)), 0, 2))] == "1"){
+						$newunixtime = mktime(0,0,0, $firststart_month + ($count * $interval), $firststart_day, $firststart_year);
+						$year  = date("Y", $newunixtime);
+						$month = date("n", $newunixtime) - 1; // return is 0 based
+						$day   = date("j", $newunixtime);
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+					}
+					$count++;
+				}
+			}else{
+				while(date("Y", mktime(0,0,0, 0, 0, $firststart_year + ($count * $interval))) <= $select_year && $countchecker == true){
+					$newunixtime = mktime(0,0,0, $properties["BYMONTH"], $properties["BYMONTHDAY"], $firststart_year + ($count * $interval));
+					$year  = date("Y", $newunixtime);
+					$month = $month - 1; // return is 0 based
+					$day   = $dateofweekone;
+					if($properties["UNTIL"] != "false"){
+						if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+							break;
+						}
+					}
+					if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+						$hour = 'allday';
+					}
+					$return_event = array();
+					foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+						$return_event[$prop] = $event[$prop];
+					}
+					$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+					$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+					$return_event['description'] = $event['summary'];
+					$interval = $properties["INTERVAL"];
+					$countedoutputs++;
+					if($properties["COUNT"] != "false"){
+						if($countedoutputs == $properties["COUNT"]){
+							$countchecker = false;
+						}
+					}
+					if ($hour == 'allday'){
+						$return_event['allday'] = true;
+					}
+					if (isset($return[$year][$month][$day][$hour])){
+						$return[$year][$month][$day][$hour][] = $return_event;
+					}else{
+						$return[$year][$month][$day][$hour] = array(1 => $return_event);
+					}
+					$count++;
+				}
+			}
+		}
+		if($properties["FREQ"] == "YEARLY"){
+			if($properties["BYMONTH"] != "false"){
+				if($properties["BYMONTHDAY"] == false){
+					$properties["BYMONTHDAY"] = date("j", mktime(0,0,0, $firststart_month, $firststart_day, $firststart_year));
+				}
+				if($properties["BYDAY"] == "false"){
+					while(date("Y", mktime(0,0,0, $properties["BYMONTH"], $properties["BYMONTHDAY"], $firststart_year + ($count * $interval))) <= $select_year && $countchecker == true){
+						$newunixtime = mktime(0,0,0, $properties["BYMONTH"], $properties["BYMONTHDAY"], $firststart_year + ($count * $interval));
+						$year  = date("Y", $newunixtime);
+						$month = date("n", $newunixtime) - 1; // return is 0 based
+						$day   = date("j", $newunixtime);
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+						$count++;
+					}
+				}
+				if(strlen($properties["BYDAY"]) == 2){
+					while(date("Y", mktime(0,0,0, $properties["BYMONTH"], $properties["BYMONTHDAY"], $firststart_year + ($count * $interval))) <= $select_year && $countchecker == true){
+						$newunixtime = mktime(0,0,0, $properties["BYMONTH"], $properties["BYMONTHDAY"], $firststart_year + ($count * $interval));
+						$year  = date("Y", $newunixtime);
+						$month = date("n", $newunixtime) - 1; // return is 0 based
+						$day   = date("j", $newunixtime);
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+						$count++;
+					}
+				}else{
+					$number = substr($properties["BYDAY"],0,1);
+					$weekday = substr($properties["BYDAY"],1,2);
+					$month = $properties["BYMONTH"];
+					$dateofweekone = "";
+					for($i = 0; $i <= 7;$i++){
+						if(strtoupper(substr(date("D", mktime(0,0,0, $properties["BYMONTH"], $i, $select_year)), 0, 2)) == $weekday){
+							$dateofweekone = date("j", mktime(0,0,0, $properties["BYMONTH"], $i, $select_year));
+							$i = 8;
+						}
+					}
+					if($number != 1){
+						$dateofweekone = $dateofweekone + (7 * ($number - 1));
+					}
+					while(date("Y", mktime(0,0,0, 0, 0, $firststart_year + ($count * $interval))) <= $select_year && $countchecker == true){
+						$newunixtime = mktime(0,0,0, $properties["BYMONTH"], $properties["BYMONTHDAY"], $firststart_year + ($count * $interval));
+						$year  = date("Y", $newunixtime);
+						$month = $month - 1; // return is 0 based
+						$day   = $dateofweekone;
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+						$count++;
+					}
+				}
+			}elseif($properties["BYYEARDAY"] != false){
+				$numofyeardays = substr_count($properties["BYYEARDAY"], ",");
+				if($numofyeardays == 0){
+					$yeardays = array();
+					$yeardays[0] = $properties["BYYEARDAY"];
+				}else{
+					$yeardays = explode(",", $properties["BYYEARDAY"]);
+				}
+				while(date("Y", mktime(0,0,0, 0, 0, $firststart_year + ($count * $interval)) + ($yeardays[$numofyeardays]-1) * 86400) <= $select_year && $countchecker == true){
+					for($i = 0;$i <= $numofyeardays;$i++){
+						$newunixtime = mktime(0,0,0, 1, 1, $firststart_year + ($count * $interval)) + ($yeardays[$i] -1) * 86400;
+						$year  = date("Y", $newunixtime);
+						$month = date("n", $newunixtime) - 1; // return is 0 based
+						$day   = date("j", $newunixtime);
+						if($properties["UNTIL"] != "false"){
+							if($year >= $until_year && $month + 1 >= $until_month && $day > $until_day){
+								break;
+							}
+						}
+						if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+							$hour = 'allday';
+						}
+						$return_event = array();
+						foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop){
+							$return_event[$prop] = $event[$prop];
+						}
+						$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
+						$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
+						$return_event['description'] = $event['summary'];
+						$interval = $properties["INTERVAL"];
+						$countedoutputs++;
+						if($properties["COUNT"] != "false"){
+							if($countedoutputs == $properties["COUNT"]){
+								$countchecker = false;
+							}
+						}
+						if ($hour == 'allday'){
+							$return_event['allday'] = true;
+						}
+						if (isset($return[$year][$month][$day][$hour])){
+							$return[$year][$month][$day][$hour][] = $return_event;
+						}else{
+							$return[$year][$month][$day][$hour] = array(1 => $return_event);
+						}
+					}
+					$count++;
+				}
+			}
+		}
 	}
 }
 OC_JSON::encodedPrint($return);
diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css
index 5e19b88f55ad66e10bbcc8fcaf6dbc6acbea0d11..80d29ca8974b7bf77105ecccffa1c8a781fa6cce 100644
--- a/apps/calendar/css/style.css
+++ b/apps/calendar/css/style.css
@@ -5,7 +5,7 @@
  * See the COPYING-README file.
  */
 
-#view {margin-left: 10px; float: left; font-size: 12px;}
+#view { float: left; font-size: 12px; height: 100%;}
 #datecontrol {text-align: center;}
 #datecontrol_left{font-size: 12px;}
 #datecontrol_right{font-size: 12px;}
@@ -17,7 +17,6 @@
 #editentry_dialog {display: none;}
 #parsingfail_dialog{display: none;}
 
-#view {margin-left: 10px; float: left; font-size: 12px; height: 100%;}
 #calendar_holder {height: 100%; width: 100%;}
 #onedayview, #oneweekview, #fourweeksview, #onemonthview, #listview {display: none; position: absolute;bottom: 0; right: 0; left: 160px; top: 80px;}
 #onedayview table {margin: 0; padding: 0; width: 100%; height: 100%; border-spacing:1px; background: #EEEEEE;}
@@ -59,5 +58,5 @@ color:#A9A9A9;
 select#category{width:140px;}
 button.category{margin:0 3px;}
 
-.calendar-colorpicker-color{display:inline-block;width:20px;height:20px;margin-right:2px;cursor:pointer;}
-.calendar-colorpicker-color.active{background-image:url("../../../core/img/jquery-ui/ui-icons_222222_256x240.png");background-position:-62px -143px;}
+.calendar-colorpicker-color{display:inline-block;width:20px;height:20px;margin-right:2px;cursor:pointer;border:2px solid transparent;}
+.calendar-colorpicker-color.active{border:2px solid black;}
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index 131325007a02aab21a2d730fa5df3789961ccb14..87954b7aac69ca18b3a774b8ec7cc5a38d5d65c6 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -491,8 +491,6 @@ Calendar={
 				// based on jquery-colorpicker at jquery.webspirited.com
 				var obj = $('.colorpicker', container);
 				var picker = $('<div class="calendar-colorpicker"></div>');
-				var size = 20;
-
 				//build an array of colors
 				var colors = {};
 				$(obj).children('option').each(function(i, elm) {
@@ -501,7 +499,7 @@ Calendar={
 					colors[i].label = $(elm).text();
 				});
 				for (var i in colors) {
-					picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: #' + colors[i].color + '; width: ' + size + 'px; height: ' + size + 'px;"></span>');
+					picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: #' + colors[i].color + ';"></span>');
 				}
 				picker.delegate(".calendar-colorpicker-color", "click", function() {
 					$(obj).val($(this).attr('rel'));
diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php
index 19a1a543b4613e10f51492bcea357f08447ec9fe..4f5092839392af8da45b6d740c094adca2fb5887 100644
--- a/apps/calendar/templates/settings.php
+++ b/apps/calendar/templates/settings.php
@@ -11,34 +11,36 @@ OC_UTIL::addStyle('', 'jquery.multiselect');
 ?>
 <form id="calendar">
         <fieldset class="personalblock">
-		<table class="nostyle">
-			<tr><td><label for="timezone" class="bold"><?php echo $l->t('Timezone');?></label></td><td><select style="display: none;" id="timezone" name="timezone">
+        <table class="nostyle">
+            <tr><td><label for="timezone" class="bold"><?php echo $l->t('Timezone');?></label></td><td><select style="display: none;" id="timezone" name="timezone">
                 <?php
-		$continent = '';
-		foreach($_['timezones'] as $timezone):
-			if ( preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $timezone ) ):
-				$ex=explode('/', $timezone, 2);//obtain continent,city
-				if ($continent!=$ex[0]):
-					if ($continent!="") echo '</optgroup>';
-					echo '<optgroup label="'.$ex[0].'">';
-				endif;
-				$city=$ex[1];
-				$continent=$ex[0];
-				echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';
-			endif;
+                $continent = '';
+                foreach($_['timezones'] as $timezone):
+                    $ex=explode('/', $timezone, 2);//obtain continent,city
+                    if (!isset($ex[1])) {
+                            $ex[1] = $ex[0];
+                            $ex[0] = "Other";
+                    }
+                    if ($continent!=$ex[0]):
+                        if ($continent!="") echo '</optgroup>';
+                        echo '<optgroup label="'.$ex[0].'">';
+                    endif;
+					$city=strtr($ex[1], '_', ' ');
+                    $continent=$ex[0];
+                    echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';
                 endforeach;?>
-                </select></td></tr>
+            </select></td></tr>
 
-			<tr><td><label for="timeformat" class="bold"><?php echo $l->t('Timeformat');?></label></td><td>
-				<select style="display: none;" id="timeformat" title="<?php echo "timeformat"; ?>" name="timeformat">
-					<option value="24" id="24h"><?php echo $l->t("24h"); ?></option>
-					<option value="ampm" id="ampm"><?php echo $l->t("12h"); ?></option>
-				</select>
-			</td></tr>
+            <tr><td><label for="timeformat" class="bold"><?php echo $l->t('Timeformat');?></label></td><td>
+                <select style="display: none;" id="timeformat" title="<?php echo "timeformat"; ?>" name="timeformat">
+                    <option value="24" id="24h"><?php echo $l->t("24h"); ?></option>
+                    <option value="ampm" id="ampm"><?php echo $l->t("12h"); ?></option>
+                </select>
+            </td></tr>
 
-		</table>
+        </table>
 
-		<?php echo $l->t('Calendar CalDAV syncing address:');?> 
-  		<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
+        <?php echo $l->t('Calendar CalDAV syncing address:');?>
+        <?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
         </fieldset>
 </form>
diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php
index 083f48e1127c458e93456a63048d245a6e2a8c92..ca95a68c6ce940f0277c383cabd99eeafe20c477 100644
--- a/apps/files_sharing/get.php
+++ b/apps/files_sharing/get.php
@@ -30,8 +30,9 @@ if ($source !== false) {
 		foreach (OC_Files::getdirectorycontent($source) as $i) {
 			$i['date'] = OC_Util::formatDate($i['mtime'] );
 			if ($i['type'] == 'file') {
-				$i['extention'] = substr($i['name'], strrpos($i['name'], "."));
-				$i['basename'] = substr($i['name'], 0, strrpos($i['name'], "."));
+				$fileinfo = pathinfo($i['name']);
+				$i['basename'] = $fileinfo['filename'];
+				$i['extention'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : '';
 			}
 			$i['directory'] = substr($i['directory'], $rootLength);
 			if ($i['directory'] == "/") {
@@ -70,7 +71,7 @@ if ($source !== false) {
 		header("Expires: 0");
 		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 		header("Pragma: public");
-		header("Content-Disposition: filename=".basename($source));
+		header('Content-Disposition: filename="'.basename($source).'"');
 		header("Content-Type: " . $mimetype);
 		header("Content-Length: " . OC_Filesystem::filesize($source));
 		//download the file
diff --git a/apps/gallery/ajax/cover.php b/apps/gallery/ajax/cover.php
index 44d73028510010e92c83868e997aa65417c7dcbc..d83f4daaa52ef0f0fac5f6b58b4aef2e9f33ec0e 100644
--- a/apps/gallery/ajax/cover.php
+++ b/apps/gallery/ajax/cover.php
@@ -1,5 +1,7 @@
 <?php
 require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
 
 function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
     //getting the image dimensions  
@@ -36,11 +38,6 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr
     return $thumb;
 }
 
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
-	echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
-	exit();
-}
 $box_size = 200;
 $album_name = $_GET['album'];
 $x = $_GET['x'];
diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php
index 3a490bdc3bd35d83db91fd8c260202e978271f4f..610f761b72ac0d8f967fcf19ba1f6f4f353be1b3 100644
--- a/apps/gallery/ajax/createAlbum.php
+++ b/apps/gallery/ajax/createAlbum.php
@@ -1,14 +1,11 @@
 <?php
 require_once('../../../lib/base.php');
-
-if( !OC_User::isLoggedIn()){
-	echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
-	exit();
-}
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
 
 $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES ("'.OC_User::getUser().'", "'.$_GET['album_name'].'")');
 $stmt->execute(array());
 
-echo json_encode(array( 'status' => 'success', 'name' => $_GET['album_name']));
+OC_JSON::success(array('name' => $_GET['album_name']));
 
 ?>
diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php
index 2829dae81f3f0ad0bac54e4e83c1570e770a628e..38bea74636fb0e0604e2ac624fbf61324d579ffa 100644
--- a/apps/gallery/ajax/getAlbums.php
+++ b/apps/gallery/ajax/getAlbums.php
@@ -1,10 +1,7 @@
 <?php
 require_once('../../../lib/base.php');
-
-if (!OC_User::IsLoggedIn()) {
-  echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
-  exit();
-}
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
 
 $a = array();
 $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?');
@@ -17,6 +14,6 @@ while ($r = $result->fetchRow()) {
   $a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10));
 }
 
-echo json_encode(array('status'=>'success', 'albums'=>$a));
+OC_JSON::success(array('albums'=>$a));
 
 ?>
diff --git a/apps/gallery/ajax/getCovers.php b/apps/gallery/ajax/getCovers.php
index 57737f2fdd65963577068b6ab1e9ce0766df4049..d84bf2a7903dc77ddc7f413b472ceaf27d788814 100644
--- a/apps/gallery/ajax/getCovers.php
+++ b/apps/gallery/ajax/getCovers.php
@@ -1,5 +1,7 @@
 <?php
 require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
 
 function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $shift) { 
     //getting the image dimensions
@@ -38,11 +40,6 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $
     imagedestroy($myImage);
 }
 
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
-	echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
-	exit();
-}
 $box_size = 200;
 $album_name= $_GET['album_name'];
 
@@ -61,6 +58,12 @@ while (($i = $result->fetchRow()) && $counter < $numOfItems) {
 
 header('Content-Type: image/png');
 
+$offset = 3600 * 24;
+// calc the string in GMT not localtime and add the offset
+header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
+header('Cache-Control: max-age=3600, must-revalidate');
+header('Pragma: public');
+
 imagepng($targetImg);
 imagedestroy($targetImg);
 ?>
diff --git a/apps/gallery/ajax/scanForAlbums.php b/apps/gallery/ajax/scanForAlbums.php
index a04ad62b1bff2e7be927b50ff9aea6337416f3f7..de0b141a36709c32acc27c9f04e95dcc023c6f96 100644
--- a/apps/gallery/ajax/scanForAlbums.php
+++ b/apps/gallery/ajax/scanForAlbums.php
@@ -1,14 +1,11 @@
 <?php
 
 require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
 require_once('../lib_scanner.php');
 
-if (!OC_User::IsLoggedIn()) {
-  echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
-  exit();
-}
-
-echo json_encode(array( 'status' => 'success', 'albums' => OC_GALLERY_SCANNER::scan('')));
-//echo json_encode(array('status' => 'success', 'albums' => array(array('name' => 'test', 'imagesCount' => 1, 'images' => array('dupa')))));
+OC_JSON::success(array('albums' => OC_GALLERY_SCANNER::scan('')));
+//OC_JSON::success(array('albums' => array(array('name' => 'test', 'imagesCount' => 1, 'images' => array('dupa')))));
 
 ?>
diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php
index db428eeff34983f6b6f3ad45bcfd668429712ef1..f24782390f68fd42de8e8d91e56e9429ab676f9a 100644
--- a/apps/gallery/ajax/thumbnail.php
+++ b/apps/gallery/ajax/thumbnail.php
@@ -1,5 +1,7 @@
 <?php
 require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
 
 function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
     //getting the image dimensions  
@@ -40,11 +42,6 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr
     return $thumb;
 }
 
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
-	echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
-	exit();
-}
 $box_size = 200;
 $img = $_GET['img'];
 
diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index 5760bb149d819fafa0831130f050232bdc975ba2..8f855c470e579a9a763c3e0053e3fa1e3c6b115f 100644
--- a/apps/gallery/appinfo/app.php
+++ b/apps/gallery/appinfo/app.php
@@ -8,7 +8,7 @@ OC_App::addNavigationEntry( array(
  'id' => 'gallery_index',
  'order' => 20,
  'href' => OC_Helper::linkTo('gallery', 'index.php'),
- 'icon' => OC_Helper::linkTo('', 'core/img/filetypes/image.png'),
+ 'icon' => OC_Helper::imagePath('core', 'places/picture.svg'),
  'name' => 'Gallery'));
 
  class OC_GallerySearchProvider extends OC_Search_Provider{
@@ -17,7 +17,7 @@ OC_App::addNavigationEntry( array(
 		$result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
 		$results=array();
 		while($row=$result->fetchRow()){
-			$results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo( 'apps/gallery', 'index.php?view='.$row['album_name']),'Galleries');
+			$results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('apps/gallery', 'index.php?view='.$row['album_name']),'Galleries');
 		}
 		return $results;
 	}
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index c8d5892e5552f0c20995b806a6f656a9af99acbc..87fdafcf13c0a2f0341e3d2f11679e6186b2bfce 100644
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -2,6 +2,7 @@
 require_once('../../lib/base.php');
 
 OC_Util::checkLoggedIn();
+OC_Util::checkAppEnabled('gallery');
 OC_App::setActiveNavigationEntry( 'gallery_index' );
 
 
diff --git a/apps/gallery/lib_scanner.php b/apps/gallery/lib_scanner.php
index fcd9b0acb65b7809ea4a51cd61fa45657558592b..5490c4a55adda1a77fc7996e250cce3dc1b6e8c8 100644
--- a/apps/gallery/lib_scanner.php
+++ b/apps/gallery/lib_scanner.php
@@ -42,7 +42,7 @@ class OC_GALLERY_SCANNER {
       $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ? AND `file_path` = ?');
       $result = $stmt->execute(array($albumId, $img));
       if ($result->numRows() == 0) {
-        $stmt = OC_DB::prepare('INSERT OR REPLACE INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)');
+        $stmt = OC_DB::prepare('REPLACE INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)');
         $stmt->execute(array($albumId, $img));
       }
     }
diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php
index dd1a830a94b70e5f249ecaf50f440f1d8c81a598..475a33500f4bdf4b15745de34bb0164b034183f7 100644
--- a/apps/media/appinfo/app.php
+++ b/apps/media/appinfo/app.php
@@ -29,5 +29,5 @@ OC_APP::registerPersonal('media','settings');
 
 OC_App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
 
-OC_App::addNavigationEntry( array( 'id' => 'media_index', 'order' => 2, 'href' => OC_Helper::linkTo( 'media', 'index.php' ), 'icon' => OC_Helper::imagePath( 'core', 'filetypes/audio.svg' ), 'name' => $l->t('Music') ));
+OC_App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OC_Helper::linkTo('media', 'index.php'), 'icon' => OC_Helper::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music')));
 ?>
diff --git a/apps/media/css/music.css b/apps/media/css/music.css
index 8575e6334a5d0fcfbc910ec07966e08987597c96..67d56075194acdd3508870c930118896cc748dfa 100644
--- a/apps/media/css/music.css
+++ b/apps/media/css/music.css
@@ -1,6 +1,6 @@
 #controls ul.jp-controls { padding:0; }
 #controls ul.jp-controls li { display:inline; }
-#controls ul.jp-controls li a { position:absolute; padding:.8em 1em; }
+#controls ul.jp-controls li a { position:absolute; padding:.8em 1em .8em 0; }
 a.jp-play, a.jp-pause { left:2.5em; }
 a.jp-pause { display:none; }
 a.jp-next { left:5em; }
@@ -39,7 +39,7 @@ tr.album td.artist { padding-left:1em; }
 tr.song td.artist { padding-left:2em; }
 .add {margin: 0 0.5em 0 0; }
 
-#scan { position:absolute; right:13em; top:0em; }
+#scan { position:absolute; right:13.5em; top:0em; }
 #scan .start { position:relative; display:inline; float:right; }
 #scan .stop { position:relative; display:inline; float:right; }
 #scan #scanprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; }
diff --git a/apps/user_openid/appinfo/info.xml b/apps/user_openid/appinfo/info.xml
index 332d2199dd3c305e850785e481bbdaf5f485e98c..37be15abfda39283fa678a1388622a16bbf0b03f 100644
--- a/apps/user_openid/appinfo/info.xml
+++ b/apps/user_openid/appinfo/info.xml
@@ -7,5 +7,4 @@
 	<licence>AGPL</licence>
 	<author>Robin Appelman</author>
 	<require>2</require>
-	<default_enable/>
 </info>
diff --git a/core/css/styles.css b/core/css/styles.css
index 84a024f95b91f5375d0786251588424c7915db29..5d4df586a8e7419f5e8fb95976ce2f55ad172701 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -50,7 +50,7 @@ input[type="submit"].enabled { background:#66f866; border:1px solid #5e5; -moz-b
 input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-shadow:#ffeedd 0 1px 0; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; }
 
 /* CONTENT ------------------------------------------------------------------ */
-#controls { width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:50; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; }
+#controls { padding: 0 0.5em; width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:50; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; }
 #controls .button { display:inline-block; }
 #content { margin:3.5em 0 0 12.5em; }
 #leftcontent, .leftcontent { position:fixed; overflow: auto; top:6.4em; width:20em; background:#f8f8f8; border-right:1px solid #ddd; }
@@ -117,7 +117,7 @@ tbody tr:hover, tr:active { background-color:#f8f8f8; }
 #quotatext {padding: .6em 1em;}
 div.jp-play-bar, div.jp-seek-bar { padding:0; }
 
-.pager { list-style:none; float:right; display:inline; margin:.7em 12.7em 0 0; }
+.pager { list-style:none; float:right; display:inline; margin:.7em 13em 0 0; }
 .pager li { display:inline-block; }
 
 li.error { width:640px; margin:4em auto; padding:1em 1em 1em 4em; background:#ffe .8em .8em no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
diff --git a/core/img/filetypes/audio.png b/core/img/filetypes/audio.png
index 4c844425d644f2c6e83e2962ec6c4dd201e3100e..a8b3ede3df956f8d505543b190bc8d1b5b4dce75 100644
Binary files a/core/img/filetypes/audio.png and b/core/img/filetypes/audio.png differ
diff --git a/core/img/filetypes/c.png b/core/img/filetypes/c.png
new file mode 100644
index 0000000000000000000000000000000000000000..34a05cccf064b35701b61ba1d395048873d7b48e
Binary files /dev/null and b/core/img/filetypes/c.png differ
diff --git a/core/img/filetypes/code.png b/core/img/filetypes/code.png
new file mode 100644
index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615
Binary files /dev/null and b/core/img/filetypes/code.png differ
diff --git a/core/img/filetypes/cplusplus.png b/core/img/filetypes/cplusplus.png
new file mode 100644
index 0000000000000000000000000000000000000000..a87cf847cb768acb8c600759ce433ce1bad3cdc0
Binary files /dev/null and b/core/img/filetypes/cplusplus.png differ
diff --git a/core/img/filetypes/csharp.png b/core/img/filetypes/csharp.png
new file mode 100644
index 0000000000000000000000000000000000000000..ffb8fc932f321d19049a51e0134459e7d6549226
Binary files /dev/null and b/core/img/filetypes/csharp.png differ
diff --git a/core/img/filetypes/css.png b/core/img/filetypes/css.png
new file mode 100644
index 0000000000000000000000000000000000000000..23f3101811f2e402b8c581ba2e39977a675e0295
Binary files /dev/null and b/core/img/filetypes/css.png differ
diff --git a/core/img/filetypes/database.png b/core/img/filetypes/database.png
new file mode 100644
index 0000000000000000000000000000000000000000..3d09261a26eb97c6dedc1d3504cbc2cf915eb642
Binary files /dev/null and b/core/img/filetypes/database.png differ
diff --git a/core/img/filetypes/file.png b/core/img/filetypes/file.png
index 4979044889708bf736aefaee7ade0b1f4462600e..8b8b1ca0000bc8fa8d0379926736029f8fabe364 100644
Binary files a/core/img/filetypes/file.png and b/core/img/filetypes/file.png differ
diff --git a/core/img/filetypes/flash.png b/core/img/filetypes/flash.png
new file mode 100644
index 0000000000000000000000000000000000000000..5769120b1b6d38019b505c9167498ea199212cc1
Binary files /dev/null and b/core/img/filetypes/flash.png differ
diff --git a/core/img/filetypes/folder.png b/core/img/filetypes/folder.png
new file mode 100644
index 0000000000000000000000000000000000000000..784e8fa48234f4f64b6922a6758f254ee0ca08ec
Binary files /dev/null and b/core/img/filetypes/folder.png differ
diff --git a/core/img/filetypes/font.png b/core/img/filetypes/font.png
new file mode 100644
index 0000000000000000000000000000000000000000..81e41de7d3a9bcc50267b34d0005487d5c7cc7c0
Binary files /dev/null and b/core/img/filetypes/font.png differ
diff --git a/core/img/filetypes/h.png b/core/img/filetypes/h.png
new file mode 100644
index 0000000000000000000000000000000000000000..e902abb07671254da98cd4eb0f7d21fab89d2332
Binary files /dev/null and b/core/img/filetypes/h.png differ
diff --git a/core/img/filetypes/html.png b/core/img/filetypes/html.png
new file mode 100644
index 0000000000000000000000000000000000000000..55d1072eafda48abb0a5fcecb98b114d866077b9
Binary files /dev/null and b/core/img/filetypes/html.png differ
diff --git a/core/img/filetypes/ical.png b/core/img/filetypes/ical.png
new file mode 100644
index 0000000000000000000000000000000000000000..658913852d60fc6ca8557568d26b8e93e7d56525
Binary files /dev/null and b/core/img/filetypes/ical.png differ
diff --git a/core/img/filetypes/image.png b/core/img/filetypes/image.png
index 980a7c6981311787a5c33102fb23d0157103b65f..4a158fef7e0da8fd19525f574f2c4966443866cf 100644
Binary files a/core/img/filetypes/image.png and b/core/img/filetypes/image.png differ
diff --git a/core/img/filetypes/link.png b/core/img/filetypes/link.png
new file mode 100644
index 0000000000000000000000000000000000000000..68f21d30116710e48a8bf462cb32441e51fad5f6
Binary files /dev/null and b/core/img/filetypes/link.png differ
diff --git a/core/img/filetypes/model.png b/core/img/filetypes/model.png
new file mode 100644
index 0000000000000000000000000000000000000000..7851cf34c946e5667221e3478668503eb1cd733f
Binary files /dev/null and b/core/img/filetypes/model.png differ
diff --git a/core/img/filetypes/ms-excel.png b/core/img/filetypes/ms-excel.png
new file mode 100644
index 0000000000000000000000000000000000000000..abcd93689a08ec9bdbf0984927e8da06c043c7cd
Binary files /dev/null and b/core/img/filetypes/ms-excel.png differ
diff --git a/core/img/filetypes/ms-powerpoint.png b/core/img/filetypes/ms-powerpoint.png
new file mode 100644
index 0000000000000000000000000000000000000000..b4aaad9a45c9abbee2d47611a6963101b64a8023
Binary files /dev/null and b/core/img/filetypes/ms-powerpoint.png differ
diff --git a/core/img/filetypes/msword.png b/core/img/filetypes/msword.png
new file mode 100644
index 0000000000000000000000000000000000000000..813f712f726c935f9adf8d2f2dd0d7683791ef11
Binary files /dev/null and b/core/img/filetypes/msword.png differ
diff --git a/core/img/filetypes/pdf.png b/core/img/filetypes/pdf.png
new file mode 100644
index 0000000000000000000000000000000000000000..8f8095e46fa4965700afe1f9d065d8a37b101676
Binary files /dev/null and b/core/img/filetypes/pdf.png differ
diff --git a/core/img/filetypes/php.png b/core/img/filetypes/php.png
new file mode 100644
index 0000000000000000000000000000000000000000..7868a25945cd5e5cb7daaca9591927511ca65c0f
Binary files /dev/null and b/core/img/filetypes/php.png differ
diff --git a/core/img/filetypes/presentation.png b/core/img/filetypes/presentation.png
new file mode 100644
index 0000000000000000000000000000000000000000..b4aaad9a45c9abbee2d47611a6963101b64a8023
Binary files /dev/null and b/core/img/filetypes/presentation.png differ
diff --git a/core/img/filetypes/readme.txt b/core/img/filetypes/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..400a64d7857425f6aa49877a91a9bf8a5737400a
--- /dev/null
+++ b/core/img/filetypes/readme.txt
@@ -0,0 +1,22 @@
+Silk icon set 1.3
+
+_________________________________________
+Mark James
+http://www.famfamfam.com/lab/icons/silk/
+_________________________________________
+
+This work is licensed under a
+Creative Commons Attribution 2.5 License.
+[ http://creativecommons.org/licenses/by/2.5/ ]
+
+This means you may use it for any purpose,
+and make any changes you like.
+All I ask is that you include a link back
+to this page in your credits.
+
+Are you using this icon set? Send me an email
+(including a link or picture if available) to
+mjames@gmail.com
+
+Any other questions about this icon set please
+contact mjames@gmail.com
\ No newline at end of file
diff --git a/core/img/filetypes/rss.png b/core/img/filetypes/rss.png
new file mode 100644
index 0000000000000000000000000000000000000000..315c4f4fa62cb720326ba3f54259666ba3999e42
Binary files /dev/null and b/core/img/filetypes/rss.png differ
diff --git a/core/img/filetypes/ruby.png b/core/img/filetypes/ruby.png
new file mode 100644
index 0000000000000000000000000000000000000000..f59b7c4365fa1720af1aa04eb47167ddaa6eeed4
Binary files /dev/null and b/core/img/filetypes/ruby.png differ
diff --git a/core/img/filetypes/script.png b/core/img/filetypes/script.png
new file mode 100644
index 0000000000000000000000000000000000000000..63fe6ceff5bfcedb9670279d4bb8d25807f6ecee
Binary files /dev/null and b/core/img/filetypes/script.png differ
diff --git a/core/img/filetypes/spreadsheet.png b/core/img/filetypes/spreadsheet.png
new file mode 100644
index 0000000000000000000000000000000000000000..abcd93689a08ec9bdbf0984927e8da06c043c7cd
Binary files /dev/null and b/core/img/filetypes/spreadsheet.png differ
diff --git a/core/img/filetypes/svg.png b/core/img/filetypes/svg.png
new file mode 100644
index 0000000000000000000000000000000000000000..a1291c2dfad75b289f88ab762a3a32ccb436c1ed
Binary files /dev/null and b/core/img/filetypes/svg.png differ
diff --git a/core/img/filetypes/text.png b/core/img/filetypes/text.png
new file mode 100644
index 0000000000000000000000000000000000000000..813f712f726c935f9adf8d2f2dd0d7683791ef11
Binary files /dev/null and b/core/img/filetypes/text.png differ
diff --git a/core/img/filetypes/vcf.png b/core/img/filetypes/vcf.png
new file mode 100644
index 0000000000000000000000000000000000000000..c02f315d20749098a50e79bd9525eed3cda7be6b
Binary files /dev/null and b/core/img/filetypes/vcf.png differ
diff --git a/core/img/filetypes/video.png b/core/img/filetypes/video.png
new file mode 100644
index 0000000000000000000000000000000000000000..b0ce7bb198a3b268bd634d2b26e9b710f3797d37
Binary files /dev/null and b/core/img/filetypes/video.png differ
diff --git a/core/img/filetypes/x-.png b/core/img/filetypes/x-.png
new file mode 100644
index 0000000000000000000000000000000000000000..8443c23eb944cf8ef49c9d13cd496502f46f1885
Binary files /dev/null and b/core/img/filetypes/x-.png differ
diff --git a/core/img/places/file.png b/core/img/places/file.png
new file mode 100644
index 0000000000000000000000000000000000000000..4979044889708bf736aefaee7ade0b1f4462600e
Binary files /dev/null and b/core/img/places/file.png differ
diff --git a/core/img/filetypes/file.svg b/core/img/places/file.svg
similarity index 100%
rename from core/img/filetypes/file.svg
rename to core/img/places/file.svg
diff --git a/core/img/places/music.png b/core/img/places/music.png
new file mode 100644
index 0000000000000000000000000000000000000000..4c844425d644f2c6e83e2962ec6c4dd201e3100e
Binary files /dev/null and b/core/img/places/music.png differ
diff --git a/core/img/filetypes/audio.svg b/core/img/places/music.svg
similarity index 100%
rename from core/img/filetypes/audio.svg
rename to core/img/places/music.svg
diff --git a/core/img/places/picture.png b/core/img/places/picture.png
new file mode 100644
index 0000000000000000000000000000000000000000..980a7c6981311787a5c33102fb23d0157103b65f
Binary files /dev/null and b/core/img/places/picture.png differ
diff --git a/core/img/filetypes/image.svg b/core/img/places/picture.svg
similarity index 100%
rename from core/img/filetypes/image.svg
rename to core/img/places/picture.svg
diff --git a/files/css/files.css b/files/css/files.css
index 1766d03d967d2a35a9380298dbb095b0c2a4bcea..a8419e972ef2794463084afa5a8eaf95b6a0c73e 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -10,7 +10,7 @@
 .file_upload_form, #file_newfolder_form { display:inline; float: left;}
 #fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
 .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; }
-.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:.1em 1em;}
+.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:.1em 1em .1em 0em;}
 .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; }
 
 #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; }
diff --git a/lib/app.php b/lib/app.php
index cd4a7293e49019805624c05e488556d37102cc9b..b9eea483a557cd6b52421e4c6367a2860fe09843 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -200,23 +200,36 @@ class OC_App{
 	 */
 	public static function getSettingsNavigation(){
 		$l=new OC_L10N('core');
-		$admin=array(
-			array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" )),
-			array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" )),
-		);
-		$settings=array(
-			array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "help.php" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" )),
-			array( "id" => "personal", "order" => 1, "href" => OC_Helper::linkTo( "settings", "personal.php" ), "name" => $l->t("Personal"), "icon" => OC_Helper::imagePath( "settings", "personal.svg" ))
-		);
-		if(count(self::$settingsForms)>0){
-			$settings[]=array( "id" => "settings", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "settings.php" ), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath( "settings", "settings.svg" ));
-		}
-		if(count(self::$adminForms)>0){
-			$admin[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" ));
-		}
-		if( OC_Group::inGroup( $_SESSION["user_id"], "admin" )){
-			$settings=array_merge($admin,$settings);
-		}
+
+		// by default, settings only contain the help menu
+		$settings = array(
+			array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "help.php" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
+ 		);
+
+		// if the user is logged-in
+		if (OC_User::isLoggedIn()) {
+			// personal menu
+			$settings[] = array( "id" => "personal", "order" => 1, "href" => OC_Helper::linkTo( "settings", "personal.php" ), "name" => $l->t("Personal"), "icon" => OC_Helper::imagePath( "settings", "personal.svg" ));
+
+			// if there're some settings forms
+			if(!empty(self::$settingsForms))
+				// settings menu
+				$settings[]=array( "id" => "settings", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "settings.php" ), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath( "settings", "settings.svg" ));
+
+			// if the user is an admin
+			if(OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
+				// admin users menu
+				$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
+				// admin apps menu
+				$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
+
+				// if there're some admin forms
+				if(!empty(self::$adminForms))
+					// admins menu
+					$settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" ));
+			}
+ 		}
+
 		$navigation = self::proceedNavigation($settings);
 		return $navigation;
 	}
@@ -237,7 +250,7 @@ class OC_App{
 
 		return $list;
 	}
-	
+
 	/**
 	 * @brief Read app metadata from the info.xml file
 	 * @param string $appid id of the app or the path of the info.xml file
@@ -261,7 +274,7 @@ class OC_App{
 		}
 		return $data;
 	}
-	
+
 	/**
 	 * @brief Returns the navigation
 	 * @returns associative array
@@ -277,7 +290,7 @@ class OC_App{
 		$navigation = self::proceedNavigation( self::$navigation );
 		return $navigation;
 	}
-	
+
 	/**
 	 * get the id of loaded app
 	 * @return string
@@ -292,8 +305,8 @@ class OC_App{
 			return $topFolder;
 		}
 	}
-	
-	
+
+
 	/**
 	 * get the forms for either settings, admin or personal
 	 */
@@ -315,28 +328,28 @@ class OC_App{
 		}
 		return $forms;
 	}
-	
+
 	/**
 	 * register a settings form to be shown
 	 */
 	public static function registerSettings($app,$page){
 		self::$settingsForms[]='apps/'.$app.'/'.$page.'.php';
 	}
-	
+
 	/**
 	 * register an admin form to be shown
 	 */
 	public static function registerAdmin($app,$page){
 		self::$adminForms[]='apps/'.$app.'/'.$page.'.php';
 	}
-	
+
 	/**
 	 * register a personal form to be shown
 	 */
 	public static function registerPersonal($app,$page){
 		self::$personalForms[]='apps/'.$app.'/'.$page.'.php';
 	}
-	
+
 	/**
 	 * get a list of all apps in the apps folder
 	 */