Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-10-07 02:15:54 +0400
committerRobin Appelman <icewind1991@gmail.com>2011-10-07 02:15:54 +0400
commit20554be9f4b311af0f239c5d9ad2fcf7c5156bbd (patch)
treedb35daca3e64a24e040982cd0278e3e9a5acafc0 /apps
parenta8621265e27daefc4bd76fdf446e65648db4387d (diff)
parente345fbd386f3e2c63b6682ae245beb7b24af08fb (diff)
Merge branch 'master' of gitorious.org:owncloud/owncloud
Diffstat (limited to 'apps')
-rw-r--r--apps/calendar/ajax/getcal.php699
-rw-r--r--apps/calendar/css/style.css5
-rw-r--r--apps/calendar/templates/settings.php73
-rw-r--r--apps/files_sharing/get.php7
-rw-r--r--apps/gallery/ajax/cover.php9
-rw-r--r--apps/gallery/ajax/createAlbum.php9
-rw-r--r--apps/gallery/ajax/getAlbums.php13
-rw-r--r--apps/gallery/ajax/getCovers.php9
-rw-r--r--apps/gallery/ajax/scanForAlbums.php11
-rw-r--r--apps/gallery/ajax/thumbnail.php7
-rw-r--r--apps/gallery/appinfo/info.xml3
-rw-r--r--apps/gallery/index.php1
-rw-r--r--apps/gallery/lib_scanner.php10
-rw-r--r--apps/media/css/music.css4
-rw-r--r--apps/remoteStorage/lib_remoteStorage.php2
15 files changed, 727 insertions, 135 deletions
diff --git a/apps/calendar/ajax/getcal.php b/apps/calendar/ajax/getcal.php
index a65c6cf2602..3d43677075f 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 5e19b88f55a..14b7d45523e 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;}
@@ -60,4 +59,4 @@ 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.active{background-image:url("../../../core/img/actions/selected.svg");background-position:2px 2px;}
diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php
index 3bfda702e9b..4f509283939 100644
--- a/apps/calendar/templates/settings.php
+++ b/apps/calendar/templates/settings.php
@@ -11,57 +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>
- <tr><td><label for="firstdayofweek" class="bold"><?php echo $l->t('First day of the week');?></label></td><td>
- <select style="display: none;" id="firstdayofweek" name="firstdayofweek">
- <?php
- $weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
- for($i = 0;$i <= 6;$i++){
- echo '<option value="'.$i.'" id="select_'.$i.'">' . $l->t($weekdays[$i]) . '</option>';
- }
- ?>
- </select>
- </td></tr>
+ </table>
- <tr><td><label for="weekend" class="bold"><?php echo $l->t('Days of weekend');?></label></td><td>
- <select id="weekend" name="weekend[]" style="width: 30em;" multiple="multiple" title="<?php echo $l->t("Weekend"); ?>">
- <?php
- $weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
- for($i = 0;$i <= 6;$i++){
- echo '<option value="'.$weekdays[$i].'" id="selectweekend_' . $weekdays[$i] . '">' . $l->t($weekdays[$i]) . '</option>';
- }
- ?>
- </select>
- </td></tr>
-
- <tr><td><label for="duration" class="bold"><?php echo $l->t('Event duration');?></label></td><td><input type="text" maxlength="3" size="3" style="width: 2em;" id="duration" name="duration" /> <?php echo $l->t("Minutes");?></td></tr>
- </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 083f48e1127..ca95a68c6ce 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 375905ec520..d83f4daaa52 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,16 +38,11 @@ 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'];
-$stmt = OC_DB::prepare('SELECT file_path FROM *PREFIX*gallery_photos,*PREFIX*gallery_albums WHERE *PREFIX*gallery_albums.uid_owner = ? AND album_name = ? AND *PREFIX*gallery_photos.album_id == *PREFIX*gallery_albums.album_id');
+$stmt = OC_DB::prepare('SELECT `file_path` FROM *PREFIX*gallery_photos,*PREFIX*gallery_albums WHERE *PREFIX*gallery_albums.`uid_owner` = ? AND `album_name` = ? AND *PREFIX*gallery_photos.`album_id` == *PREFIX*gallery_albums.`album_id`');
$result = $stmt->execute(array(OC_User::getUser(), $album_name));
$x = min((int)($x/($box_size/$result->numRows())), $result->numRows()-1); // get image to display
$result->seek($x); // never throws
diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php
index 3a490bdc3bd..610f761b72a 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 6b551ac49d5..38bea74636f 100644
--- a/apps/gallery/ajax/getAlbums.php
+++ b/apps/gallery/ajax/getAlbums.php
@@ -1,22 +1,19 @@
<?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 = ?');
+$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?');
$result = $stmt->execute(array(OC_User::getUser()));
while ($r = $result->fetchRow()) {
$album_name = $r['album_name'];
- $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE album_id = ?');
+ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ?');
$tmp_res = $stmt->execute(array($r['album_id']));
$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 ebda8d3e47f..d84bf2a7903 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,15 +40,10 @@ 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'];
-$stmt = OC_DB::prepare('SELECT file_path FROM *PREFIX*gallery_photos,*PREFIX*gallery_albums WHERE *PREFIX*gallery_albums.uid_owner = ? AND album_name = ? AND *PREFIX*gallery_photos.album_id == *PREFIX*gallery_albums.album_id');
+$stmt = OC_DB::prepare('SELECT `file_path` FROM *PREFIX*gallery_photos,*PREFIX*gallery_albums WHERE *PREFIX*gallery_albums.`uid_owner` = ? AND `album_name` = ? AND *PREFIX*gallery_photos.`album_id` = *PREFIX*gallery_albums.`album_id`');
$result = $stmt->execute(array(OC_User::getUser(), $album_name));
$numOfItems = min($result->numRows(),10);
diff --git a/apps/gallery/ajax/scanForAlbums.php b/apps/gallery/ajax/scanForAlbums.php
index a04ad62b1bf..de0b141a367 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 db428eeff34..f24782390f6 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/info.xml b/apps/gallery/appinfo/info.xml
index 154b5fcf7ae..054ddb6f139 100644
--- a/apps/gallery/appinfo/info.xml
+++ b/apps/gallery/appinfo/info.xml
@@ -7,5 +7,4 @@
<author>Bartosz Przybylski</author>
<require>2</require>
<description></description>
- <default_enable/>
-</info>
+</info> \ No newline at end of file
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index c8d5892e555..87fdafcf13c 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 fe14b68add1..5490c4a55ad 100644
--- a/apps/gallery/lib_scanner.php
+++ b/apps/gallery/lib_scanner.php
@@ -28,21 +28,21 @@ class OC_GALLERY_SCANNER {
}
$current_album['imagesCount'] = count($current_album['images']);
$albums[] = $current_album;
- $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE "uid_owner" = ? AND "album_name" = ?');
+ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?');
$result = $stmt->execute(array(OC_User::getUser(), $current_album['name']));
if ($result->numRows() == 0 && count($current_album['images'])) {
- $stmt = OC_DB::prepare('INSERT OR REPLACE INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES (?, ?)');
+ $stmt = OC_DB::prepare('REPLACE INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)');
$stmt->execute(array(OC_User::getUser(), $current_album['name']));
}
- $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE "uid_owner" = ? AND "album_name" = ?');
+ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?');
$result = $stmt->execute(array(OC_User::getUser(), $current_album['name']));
$albumId = $result->fetchRow();
$albumId = $albumId['album_id'];
foreach ($current_album['images'] as $img) {
- $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE "album_id" = ? AND "file_path" = ?');
+ $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/css/music.css b/apps/media/css/music.css
index 8575e6334a5..67d56075194 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/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php
index 259efb0da69..5677ab3c6e0 100644
--- a/apps/remoteStorage/lib_remoteStorage.php
+++ b/apps/remoteStorage/lib_remoteStorage.php
@@ -3,7 +3,7 @@
class OC_remoteStorage {
public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) {
$query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100");
- $result=$query->execute(array($user,$userAddress,$dataScope));
+ $result=$query->execute(array($ownCloudUser,$userAddress,$dataScope));
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';