diff --git a/3rdparty/MDB2/Schema/Parser.php b/3rdparty/MDB2/Schema/Parser.php index cfd0c37d8a..3c4345661b 100644 --- a/3rdparty/MDB2/Schema/Parser.php +++ b/3rdparty/MDB2/Schema/Parser.php @@ -146,33 +146,6 @@ class MDB2_Schema_Parser extends XML_Parser ); } - /** - * PHP 4 compatible constructor - * - * @param array $variables mixed array with user defined schema - * variables - * @param bool $fail_on_invalid_names array with reserved words per RDBMS - * @param array $structure multi dimensional array with - * database schema and data - * @param array $valid_types information of all valid fields - * types - * @param bool $force_defaults if true sets a default value to - * field when not explicit - * @param int $max_identifiers_length maximum allowed size for entities - * name - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Parser($variables, $fail_on_invalid_names = true, - $structure = false, $valid_types = array(), $force_defaults = true, - $max_identifiers_length = null - ) { - $this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults); - } - /** * Triggered when reading a XML open tag * diff --git a/3rdparty/MDB2/Schema/Parser2.php b/3rdparty/MDB2/Schema/Parser2.php index b415b4a336..f27dffbabf 100644 --- a/3rdparty/MDB2/Schema/Parser2.php +++ b/3rdparty/MDB2/Schema/Parser2.php @@ -143,33 +143,6 @@ class MDB2_Schema_Parser2 extends XML_Unserializer parent::XML_Unserializer($this->options); } - /** - * PHP 4 compatible constructor - * - * @param array $variables mixed array with user defined schema - * variables - * @param bool $fail_on_invalid_names array with reserved words per RDBMS - * @param array $structure multi dimensional array with - * database schema and data - * @param array $valid_types information of all valid fields - * types - * @param bool $force_defaults if true sets a default value to - * field when not explicit - * @param int $max_identifiers_length maximum allowed size for entities - * name - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Parser2($variables, $fail_on_invalid_names = true, - $structure = false, $valid_types = array(), $force_defaults = true, - $max_identifiers_length = null - ) { - $this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults); - } - /** * Main method. Parses XML Schema File. * diff --git a/3rdparty/MDB2/Schema/Validate.php b/3rdparty/MDB2/Schema/Validate.php index 4cff175576..4a8e0d27ba 100644 --- a/3rdparty/MDB2/Schema/Validate.php +++ b/3rdparty/MDB2/Schema/Validate.php @@ -108,28 +108,6 @@ class MDB2_Schema_Validate $this->max_identifiers_length = $max_identifiers_length; } - /** - * PHP 4 compatible constructor - * - * @param bool $fail_on_invalid_names array with reserved words per RDBMS - * @param array $valid_types information of all valid fields - * types - * @param bool $force_defaults if true sets a default value to - * field when not explicit - * @param int $max_identifiers_length maximum allowed size for entities - * name - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Validate($fail_on_invalid_names = true, $valid_types = array(), - $force_defaults = true, $max_identifiers_length = null - ) { - $this->__construct($fail_on_invalid_names, $valid_types, $force_defaults); - } - // }}} // {{{ raiseError() diff --git a/3rdparty/MDB2/Schema/Writer.php b/3rdparty/MDB2/Schema/Writer.php index 70a03168de..3eaa39a207 100644 --- a/3rdparty/MDB2/Schema/Writer.php +++ b/3rdparty/MDB2/Schema/Writer.php @@ -82,22 +82,6 @@ class MDB2_Schema_Writer $this->valid_types = $valid_types; } - /** - * PHP 4 compatible constructor - * - * @param array $valid_types information of all valid fields - * types - * - * @return void - * - * @access public - * @static - */ - function MDB2_Schema_Writer($valid_types = array()) - { - $this->__construct($valid_types); - } - // }}} // {{{ raiseError() diff --git a/3rdparty/fullcalendar/js/fullcalendar.js b/3rdparty/fullcalendar/js/fullcalendar.js index 779a313c76..314f8c8a1a 100644 --- a/3rdparty/fullcalendar/js/fullcalendar.js +++ b/3rdparty/fullcalendar/js/fullcalendar.js @@ -4662,7 +4662,7 @@ function DayEventRenderer() { ""; } html += - "" + htmlEscape(event.title) + "" + + "" + event.title + "" + ""; if (seg.isEnd && isEventResizable(event)) { html += diff --git a/3rdparty/smb4php/smb.php b/3rdparty/smb4php/smb.php index 69fb2487bc..12c5890723 100644 --- a/3rdparty/smb4php/smb.php +++ b/3rdparty/smb4php/smb.php @@ -326,8 +326,11 @@ class smb_stream_wrapper extends smb { $this->dir = array_keys($o['info']); $this->dir_index = 0; $this->adddircache ($url, $this->dir); + if(substr($url,-1,1)=='/'){ + $url=substr($url,0,-1); + } foreach ($o['info'] as $name => $info) { - smb::addstatcache($url . '/' . urlencode($name), $info); + smb::addstatcache($url . '/' . $name, $info); } } else { trigger_error ("dir_opendir(): dir failed for path '".$pu['path']."'", E_USER_WARNING); diff --git a/3rdparty/when/MIT-LICENSE.txt b/3rdparty/when/MIT-LICENSE.txt deleted file mode 100644 index b4429c89ac..0000000000 --- a/3rdparty/when/MIT-LICENSE.txt +++ /dev/null @@ -1,9 +0,0 @@ -License - -Copyright (c) 2010 Thomas Planer - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/3rdparty/when/When.php b/3rdparty/when/When.php deleted file mode 100644 index 185836bf0c..0000000000 --- a/3rdparty/when/When.php +++ /dev/null @@ -1,731 +0,0 @@ - - * Location: http://github.com/tplaner/When - * Created: September 2010 - * Description: Determines the next date of recursion given an iCalendar "rrule" like pattern. - * Requirements: PHP 5.3+ - makes extensive use of the Date and Time library (http://us2.php.net/manual/en/book.datetime.php) - */ -class When -{ - protected $frequency; - - protected $start_date; - protected $try_date; - - protected $end_date; - - protected $gobymonth; - protected $bymonth; - - protected $gobyweekno; - protected $byweekno; - - protected $gobyyearday; - protected $byyearday; - - protected $gobymonthday; - protected $bymonthday; - - protected $gobyday; - protected $byday; - - protected $gobysetpos; - protected $bysetpos; - - protected $suggestions; - - protected $count; - protected $counter; - - protected $goenddate; - - protected $interval; - - protected $wkst; - - protected $valid_week_days; - protected $valid_frequency; - - /** - * __construct - */ - public function __construct() - { - $this->frequency = null; - - $this->gobymonth = false; - $this->bymonth = range(1,12); - - $this->gobymonthday = false; - $this->bymonthday = range(1,31); - - $this->gobyday = false; - // setup the valid week days (0 = sunday) - $this->byday = range(0,6); - - $this->gobyyearday = false; - $this->byyearday = range(0,366); - - $this->gobysetpos = false; - $this->bysetpos = range(1,366); - - $this->gobyweekno = false; - // setup the range for valid weeks - $this->byweekno = range(0,54); - - $this->suggestions = array(); - - // this will be set if a count() is specified - $this->count = 0; - // how many *valid* results we returned - $this->counter = 0; - - // max date we'll return - $this->end_date = new DateTime('9999-12-31'); - - // the interval to increase the pattern by - $this->interval = 1; - - // what day does the week start on? (0 = sunday) - $this->wkst = 0; - - $this->valid_week_days = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'); - - $this->valid_frequency = array('SECONDLY', 'MINUTELY', 'HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY'); - } - - /** - * @param DateTime|string $start_date of the recursion - also is the first return value. - * @param string $frequency of the recrusion, valid frequencies: secondly, minutely, hourly, daily, weekly, monthly, yearly - */ - public function recur($start_date, $frequency = "daily") - { - try - { - if(is_object($start_date)) - { - $this->start_date = clone $start_date; - } - else - { - // timestamps within the RFC have a 'Z' at the end of them, remove this. - $start_date = trim($start_date, 'Z'); - $this->start_date = new DateTime($start_date); - } - - $this->try_date = clone $this->start_date; - } - catch(Exception $e) - { - throw new InvalidArgumentException('Invalid start date DateTime: ' . $e); - } - - $this->freq($frequency); - - return $this; - } - - public function freq($frequency) - { - if(in_array(strtoupper($frequency), $this->valid_frequency)) - { - $this->frequency = strtoupper($frequency); - } - else - { - throw new InvalidArgumentException('Invalid frequency type.'); - } - - return $this; - } - - // accepts an rrule directly - public function rrule($rrule) - { - // strip off a trailing semi-colon - $rrule = trim($rrule, ";"); - - $parts = explode(";", $rrule); - - foreach($parts as $part) - { - list($rule, $param) = explode("=", $part); - - $rule = strtoupper($rule); - $param = strtoupper($param); - - switch($rule) - { - case "FREQ": - $this->frequency = $param; - break; - case "UNTIL": - $this->until($param); - break; - case "COUNT": - $this->count($param); - break; - case "INTERVAL": - $this->interval($param); - break; - case "BYDAY": - $params = explode(",", $param); - $this->byday($params); - break; - case "BYMONTHDAY": - $params = explode(",", $param); - $this->bymonthday($params); - break; - case "BYYEARDAY": - $params = explode(",", $param); - $this->byyearday($params); - break; - case "BYWEEKNO": - $params = explode(",", $param); - $this->byweekno($params); - break; - case "BYMONTH": - $params = explode(",", $param); - $this->bymonth($params); - break; - case "BYSETPOS": - $params = explode(",", $param); - $this->bysetpos($params); - break; - case "WKST": - $this->wkst($param); - break; - } - } - - return $this; - } - - //max number of items to return based on the pattern - public function count($count) - { - $this->count = (int)$count; - - return $this; - } - - // how often the recurrence rule repeats - public function interval($interval) - { - $this->interval = (int)$interval; - - return $this; - } - - // starting day of the week - public function wkst($day) - { - switch($day) - { - case 'SU': - $this->wkst = 0; - break; - case 'MO': - $this->wkst = 1; - break; - case 'TU': - $this->wkst = 2; - break; - case 'WE': - $this->wkst = 3; - break; - case 'TH': - $this->wkst = 4; - break; - case 'FR': - $this->wkst = 5; - break; - case 'SA': - $this->wkst = 6; - break; - } - - return $this; - } - - // max date - public function until($end_date) - { - try - { - if(is_object($end_date)) - { - $this->end_date = clone $end_date; - } - else - { - // timestamps within the RFC have a 'Z' at the end of them, remove this. - $end_date = trim($end_date, 'Z'); - $this->end_date = new DateTime($end_date); - } - } - catch(Exception $e) - { - throw new InvalidArgumentException('Invalid end date DateTime: ' . $e); - } - - return $this; - } - - public function bymonth($months) - { - if(is_array($months)) - { - $this->gobymonth = true; - $this->bymonth = $months; - } - - return $this; - } - - public function bymonthday($days) - { - if(is_array($days)) - { - $this->gobymonthday = true; - $this->bymonthday = $days; - } - - return $this; - } - - public function byweekno($weeks) - { - $this->gobyweekno = true; - - if(is_array($weeks)) - { - $this->byweekno = $weeks; - } - - return $this; - } - - public function bysetpos($days) - { - $this->gobysetpos = true; - - if(is_array($days)) - { - $this->bysetpos = $days; - } - - return $this; - } - - public function byday($days) - { - $this->gobyday = true; - - if(is_array($days)) - { - $this->byday = array(); - foreach($days as $day) - { - $len = strlen($day); - - $as = '+'; - - // 0 mean no occurence is set - $occ = 0; - - if($len == 3) - { - $occ = substr($day, 0, 1); - } - if($len == 4) - { - $as = substr($day, 0, 1); - $occ = substr($day, 1, 1); - } - - if($as == '-') - { - $occ = '-' . $occ; - } - else - { - $occ = '+' . $occ; - } - - $day = substr($day, -2, 2); - switch($day) - { - case 'SU': - $this->byday[] = $occ . 'SU'; - break; - case 'MO': - $this->byday[] = $occ . 'MO'; - break; - case 'TU': - $this->byday[] = $occ . 'TU'; - break; - case 'WE': - $this->byday[] = $occ . 'WE'; - break; - case 'TH': - $this->byday[] = $occ . 'TH'; - break; - case 'FR': - $this->byday[] = $occ . 'FR'; - break; - case 'SA': - $this->byday[] = $occ . 'SA'; - break; - } - } - } - - return $this; - } - - public function byyearday($days) - { - $this->gobyyearday = true; - - if(is_array($days)) - { - $this->byyearday = $days; - } - - return $this; - } - - // this creates a basic list of dates to "try" - protected function create_suggestions() - { - switch($this->frequency) - { - case "YEARLY": - $interval = 'year'; - break; - case "MONTHLY": - $interval = 'month'; - break; - case "WEEKLY": - $interval = 'week'; - break; - case "DAILY": - $interval = 'day'; - break; - case "HOURLY": - $interval = 'hour'; - break; - case "MINUTELY": - $interval = 'minute'; - break; - case "SECONDLY": - $interval = 'second'; - break; - } - - $month_day = $this->try_date->format('j'); - $month = $this->try_date->format('n'); - $year = $this->try_date->format('Y'); - - $timestamp = $this->try_date->format('H:i:s'); - - if($this->gobysetpos) - { - if($this->try_date == $this->start_date) - { - $this->suggestions[] = clone $this->try_date; - } - else - { - if($this->gobyday) - { - foreach($this->bysetpos as $_pos) - { - $tmp_array = array(); - $_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year))); - foreach($_mdays as $_mday) - { - $date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp); - - $occur = ceil($_mday / 7); - - $day_of_week = $date_time->format('l'); - $dow_abr = strtoupper(substr($day_of_week, 0, 2)); - - // set the day of the month + (positive) - $occur = '+' . $occur . $dow_abr; - $occur_zero = '+0' . $dow_abr; - - // set the day of the month - (negative) - $total_days = $date_time->format('t') - $date_time->format('j'); - $occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr; - - $day_from_end_of_month = $date_time->format('t') + 1 - $_mday; - - if(in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday)) - { - $tmp_array[] = clone $date_time; - } - } - - if($_pos > 0) - { - $this->suggestions[] = clone $tmp_array[$_pos - 1]; - } - else - { - $this->suggestions[] = clone $tmp_array[count($tmp_array) + $_pos]; - } - - } - } - } - } - elseif($this->gobyyearday) - { - foreach($this->byyearday as $_day) - { - if($_day >= 0) - { - $_day--; - - $_time = strtotime('+' . $_day . ' days', mktime(0, 0, 0, 1, 1, $year)); - $this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp); - } - else - { - $year_day_neg = 365 + $_day; - $leap_year = $this->try_date->format('L'); - if($leap_year == 1) - { - $year_day_neg = 366 + $_day; - } - - $_time = strtotime('+' . $year_day_neg . ' days', mktime(0, 0, 0, 1, 1, $year)); - $this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp); - } - } - } - // special case because for years you need to loop through the months too - elseif($this->gobyday && $interval == "year") - { - foreach($this->bymonth as $_month) - { - // this creates an array of days of the month - $_mdays = range(1, date('t',mktime(0,0,0,$_month,1,$year))); - foreach($_mdays as $_mday) - { - $date_time = new DateTime($year . '-' . $_month . '-' . $_mday . ' ' . $timestamp); - - // get the week of the month (1, 2, 3, 4, 5, etc) - $week = $date_time->format('W'); - - if($date_time >= $this->start_date && in_array($week, $this->byweekno)) - { - $this->suggestions[] = clone $date_time; - } - } - } - } - elseif($interval == "day") - { - $this->suggestions[] = clone $this->try_date; - } - elseif($interval == "week") - { - $this->suggestions[] = clone $this->try_date; - - if($this->gobyday) - { - $week_day = $this->try_date->format('w'); - - $days_in_month = $this->try_date->format('t'); - - $overflow_count = 1; - $_day = $month_day; - - $run = true; - while($run) - { - $_day++; - if($_day <= $days_in_month) - { - $tmp_date = new DateTime($year . '-' . $month . '-' . $_day . ' ' . $timestamp); - } - else - { - //$tmp_month = $month+1; - $tmp_date = new DateTime($year . '-' . $month . '-' . $overflow_count . ' ' . $timestamp); - $tmp_date->modify('+1 month'); - $overflow_count++; - } - - $week_day = $tmp_date->format('w'); - - if($this->try_date == $this->start_date) - { - if($week_day == $this->wkst) - { - $this->try_date = clone $tmp_date; - $this->try_date->modify('-7 days'); - $run = false; - } - } - - if($week_day != $this->wkst) - { - $this->suggestions[] = clone $tmp_date; - } - else - { - $run = false; - } - } - } - } - elseif($this->gobyday && $interval == "month") - { - $_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year))); - foreach($_mdays as $_mday) - { - $date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp); - - // get the week of the month (1, 2, 3, 4, 5, etc) - $week = $date_time->format('W'); - - if($date_time >= $this->start_date && in_array($week, $this->byweekno)) - { - $this->suggestions[] = clone $date_time; - } - } - } - elseif($this->gobymonth) - { - foreach($this->bymonth as $_month) - { - $date_time = new DateTime($year . '-' . $_month . '-' . $month_day . ' ' . $timestamp); - - if($date_time >= $this->start_date) - { - $this->suggestions[] = clone $date_time; - } - } - } - else - { - $this->suggestions[] = clone $this->try_date; - } - - if($interval == "month") - { - - $this->try_date->modify('first day of next month'); - if((int) date('t', $this->try_date->format('U')) > (int) $this->start_date->format('j')){ - $this->try_date->modify('+' . (int) $this->start_date->format('j') - 1 . ' day'); - }else{ - $this->try_date->modify('+' . (int) date('t', $this->try_date->format('U')) - 1 . ' day'); - } - } - else - { - $this->try_date->modify($this->interval . ' ' . $interval); - } - } - - protected function valid_date($date) - { - $year = $date->format('Y'); - $month = $date->format('n'); - $day = $date->format('j'); - - $year_day = $date->format('z') + 1; - - $year_day_neg = -366 + $year_day; - $leap_year = $date->format('L'); - if($leap_year == 1) - { - $year_day_neg = -367 + $year_day; - } - - // this is the nth occurence of the date - $occur = ceil($day / 7); - - $week = $date->format('W'); - - $day_of_week = $date->format('l'); - $dow_abr = strtoupper(substr($day_of_week, 0, 2)); - - // set the day of the month + (positive) - $occur = '+' . $occur . $dow_abr; - $occur_zero = '+0' . $dow_abr; - - // set the day of the month - (negative) - $total_days = $date->format('t') - $date->format('j'); - $occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr; - - $day_from_end_of_month = $date->format('t') + 1 - $day; - - if(in_array($month, $this->bymonth) && - (in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday)) && - in_array($week, $this->byweekno) && - (in_array($day, $this->bymonthday) || in_array(-$day_from_end_of_month, $this->bymonthday)) && - (in_array($year_day, $this->byyearday) || in_array($year_day_neg, $this->byyearday))) - { - return true; - } - else - { - return false; - } - } - - // return the next valid DateTime object which matches the pattern and follows the rules - public function next() - { - // check the counter is set - if($this->count !== 0) - { - if($this->counter >= $this->count) - { - return false; - } - } - - // create initial set of suggested dates - if(count($this->suggestions) === 0) - { - $this->create_suggestions(); - } - - // loop through the suggested dates - while(count($this->suggestions) > 0) - { - // get the first one on the array - $try_date = array_shift($this->suggestions); - - // make sure the date doesn't exceed the max date - if($try_date > $this->end_date) - { - return false; - } - - // make sure it falls within the allowed days - if($this->valid_date($try_date) === true) - { - $this->counter++; - return $try_date; - } - else - { - // we might be out of suggested days, so load some more - if(count($this->suggestions) === 0) - { - $this->create_suggestions(); - } - } - } - } -} \ No newline at end of file diff --git a/apps/admin_audit/appinfo/app.php b/apps/admin_audit/appinfo/app.php new file mode 100644 index 0000000000..e52f633cf1 --- /dev/null +++ b/apps/admin_audit/appinfo/app.php @@ -0,0 +1,18 @@ + + + admin_audit + Log audit info + 0.1 + AGPL + Bart Visscher + 2 + Audit user actions in Owncloud + diff --git a/apps/admin_audit/lib/hooks_handlers.php b/apps/admin_audit/lib/hooks_handlers.php new file mode 100644 index 0000000000..c5aec97d93 --- /dev/null +++ b/apps/admin_audit/lib/hooks_handlers.php @@ -0,0 +1,72 @@ +. -* +* */ @@ -28,6 +28,6 @@ OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('bookmarks'); require_once('bookmarksHelper.php'); -addBookmark($_POST['url'], '', 'Read-Later'); +addBookmark($_GET['url'], '', 'Read-Later'); include 'templates/addBm.php'; diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php index fcec2e1ced..439b680dc2 100644 --- a/apps/bookmarks/ajax/editBookmark.php +++ b/apps/bookmarks/ajax/editBookmark.php @@ -40,18 +40,26 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ } $bookmark_id = (int)$_POST["id"]; +$user_id = OCP\USER::getUser(); $query = OCP\DB::prepare(" UPDATE *PREFIX*bookmarks SET url = ?, title =?, lastmodified = $_ut - WHERE id = $bookmark_id + WHERE id = ? + AND user_id = ? "); $params=array( htmlspecialchars_decode($_POST["url"]), htmlspecialchars_decode($_POST["title"]), + $bookmark_id, + $user_id, ); -$query->execute($params); + +$result = $query->execute($params); + +# Abort the operation if bookmark couldn't be set (probably because the user is not allowed to edit this bookmark) +if ($result->numRows() == 0) exit(); # Remove old tags and insert new ones. $query = OCP\DB::prepare(" @@ -66,7 +74,7 @@ $query = OCP\DB::prepare(" (bookmark_id, tag) VALUES (?, ?) "); - + $tags = explode(' ', urldecode($_POST["tags"])); foreach ($tags as $tag) { if(empty($tag)) { diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css index 3a3e0fbf6b..a67afcd44f 100644 --- a/apps/bookmarks/css/bookmarks.css +++ b/apps/bookmarks/css/bookmarks.css @@ -1,5 +1,5 @@ #content { overflow: auto; height: 100%; } -#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;} +#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777; position: relative;} #firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; } #firstrun .button { font-size: 0.7em; } #firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; } diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php index 84436ae740..4b84b43890 100644 --- a/apps/bookmarks/templates/list.php +++ b/apps/bookmarks/templates/list.php @@ -7,7 +7,7 @@ * See the COPYING-README file. */ ?> - +
diff --git a/apps/calendar/ajax/cache/rescan.php b/apps/calendar/ajax/cache/rescan.php new file mode 100644 index 0000000000..3417f1ae4b --- /dev/null +++ b/apps/calendar/ajax/cache/rescan.php @@ -0,0 +1,15 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('calendar'); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); +foreach($calendars as $calendar){ + OC_Calendar_Repeat::cleancalendar($calendar['id']); + OC_Calendar_Repeat::generatecalendar($calendar['id']); +} +OCP\JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/cache/status.php b/apps/calendar/ajax/cache/status.php new file mode 100644 index 0000000000..d2806d4789 --- /dev/null +++ b/apps/calendar/ajax/cache/status.php @@ -0,0 +1,22 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('calendar'); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); +$allcached = true; +foreach($calendars as $calendar){ + if(!OC_Calendar_Repeat::is_calendar_cached($calendar['id'])){ + $allcached = false; + } +} +$l = new OC_L10N('calendar'); +if(!$allcached){ + OCP\JSON::error(array('message'=>'Not all calendars are completely cached', 'l10n'=>$l->t('Not all calendars are completely cached'))); +}else{ + OCP\JSON::success(array('message'=>'Everything seems to be completely cached', 'l10n'=>$l->t('Everything seems to be completely cached'))); +} \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/activation.php b/apps/calendar/ajax/calendar/activation.php index 380db6a943..e31908beb1 100644 --- a/apps/calendar/ajax/calendar/activation.php +++ b/apps/calendar/ajax/calendar/activation.php @@ -20,4 +20,4 @@ $calendar = OC_Calendar_App::getCalendar($calendarid); OCP\JSON::success(array( 'active' => $calendar['active'], 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar), -)); +)); \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/delete.php b/apps/calendar/ajax/calendar/delete.php index 9e092f2df1..4d6706f600 100644 --- a/apps/calendar/ajax/calendar/delete.php +++ b/apps/calendar/ajax/calendar/delete.php @@ -21,5 +21,4 @@ if($del == true){ OCP\JSON::success(); }else{ OCP\JSON::error(array('error'=>'dberror')); -} -?> +} \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/edit.form.php b/apps/calendar/ajax/calendar/edit.form.php index 036ed12bb7..3916c52763 100644 --- a/apps/calendar/ajax/calendar/edit.form.php +++ b/apps/calendar/ajax/calendar/edit.form.php @@ -16,5 +16,4 @@ $tmpl = new OCP\Template("calendar", "part.editcalendar"); $tmpl->assign('new', false); $tmpl->assign('calendarcolor_options', $calendarcolor_options); $tmpl->assign('calendar', $calendar); -$tmpl->printPage(); -?> +$tmpl->printPage(); \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/edit.php b/apps/calendar/ajax/calendar/edit.php index 516c9f6c76..82f18fe7f4 100644 --- a/apps/calendar/ajax/calendar/edit.php +++ b/apps/calendar/ajax/calendar/edit.php @@ -20,5 +20,4 @@ $tmpl = new OCP\Template("calendar", "part.editcalendar"); $tmpl->assign('new', false); $tmpl->assign('calendarcolor_options', $calendarcolor_options); $tmpl->assign('calendar', $calendar); -$tmpl->printPage(); -?> +$tmpl->printPage(); \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/new.form.php b/apps/calendar/ajax/calendar/new.form.php index ee46757f56..0783b6168f 100644 --- a/apps/calendar/ajax/calendar/new.form.php +++ b/apps/calendar/ajax/calendar/new.form.php @@ -19,5 +19,4 @@ $tmpl = new OCP\Template('calendar', 'part.editcalendar'); $tmpl->assign('new', true); $tmpl->assign('calendarcolor_options', $calendarcolor_options); $tmpl->assign('calendar', $calendar); -$tmpl->printPage(); -?> +$tmpl->printPage(); \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php index 76dbef6b9d..278c8e5520 100644 --- a/apps/calendar/ajax/calendar/new.php +++ b/apps/calendar/ajax/calendar/new.php @@ -34,4 +34,4 @@ $tmpl->assign('calendar', $calendar); OCP\JSON::success(array( 'page' => $tmpl->fetchPage(), 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar), -)); +)); \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/overview.php b/apps/calendar/ajax/calendar/overview.php index 9631253750..9d43364ffb 100644 --- a/apps/calendar/ajax/calendar/overview.php +++ b/apps/calendar/ajax/calendar/overview.php @@ -11,5 +11,4 @@ $l10n = OC_L10N::get('calendar'); OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('calendar'); $output = new OCP\Template("calendar", "part.choosecalendar"); -$output -> printpage(); -?> +$output -> printpage(); \ No newline at end of file diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php index dce0027304..5cf63d396f 100644 --- a/apps/calendar/ajax/calendar/update.php +++ b/apps/calendar/ajax/calendar/update.php @@ -39,4 +39,4 @@ $tmpl->assign('calendar', $calendar); OCP\JSON::success(array( 'page' => $tmpl->fetchPage(), 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar), -)); +)); \ No newline at end of file diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php index 93e8c50954..f0060cb23b 100644 --- a/apps/calendar/ajax/categories/rescan.php +++ b/apps/calendar/ajax/categories/rescan.php @@ -39,4 +39,4 @@ if(count($events) == 0) { OC_Calendar_App::scanCategories($events); $categories = OC_Calendar_App::getCategoryOptions(); -OCP\JSON::success(array('data' => array('categories'=>$categories))); +OCP\JSON::success(array('data' => array('categories'=>$categories))); \ No newline at end of file diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php index 0099fd5ec2..47e690f329 100644 --- a/apps/calendar/ajax/changeview.php +++ b/apps/calendar/ajax/changeview.php @@ -18,5 +18,4 @@ switch($view){ exit; } OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view); -OCP\JSON::success(); -?> +OCP\JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/event/delete.php b/apps/calendar/ajax/event/delete.php index cb30621af4..f183d431af 100644 --- a/apps/calendar/ajax/event/delete.php +++ b/apps/calendar/ajax/event/delete.php @@ -17,4 +17,4 @@ if($access != 'owner' && $access != 'rw'){ exit; } $result = OC_Calendar_Object::delete($id); -OCP\JSON::success(); +OCP\JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php index dbb78edb79..26a0cc2a60 100644 --- a/apps/calendar/ajax/event/edit.form.php +++ b/apps/calendar/ajax/event/edit.form.php @@ -27,6 +27,14 @@ $vevent = $object->VEVENT; $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); switch($dtstart->getDateType()) { + case Sabre_VObject_Property_DateTime::UTC: + $timeOffset = OC_Calendar_App::$tz*60; + $newDT = $dtstart->getDateTime(); + $newDT->add(new DateInterval("PT" . $timeOffset . "M")); + $dtstart->setDateTime($newDT); + $newDT = $dtend->getDateTime(); + $newDT->add(new DateInterval("PT" . $timeOffset . "M")); + $dtend->setDateTime($newDT); case Sabre_VObject_Property_DateTime::LOCALTZ: case Sabre_VObject_Property_DateTime::LOCAL: $startdate = $dtstart->getDateTime()->format('d-m-Y'); @@ -261,4 +269,4 @@ if($repeat['repeat'] != 'doesnotrepeat'){ $tmpl->assign('repeat_date', ''); $tmpl->assign('repeat_year', 'bydate'); } -$tmpl->printpage(); +$tmpl->printpage(); \ No newline at end of file diff --git a/apps/calendar/ajax/event/edit.php b/apps/calendar/ajax/event/edit.php index e615fb093d..1c3babc3d9 100644 --- a/apps/calendar/ajax/event/edit.php +++ b/apps/calendar/ajax/event/edit.php @@ -42,5 +42,4 @@ if($errarr){ OC_Calendar_Object::moveToCalendar($id, $cal); } OCP\JSON::success(); -} -?> +} \ No newline at end of file diff --git a/apps/calendar/ajax/event/move.php b/apps/calendar/ajax/event/move.php index 8added6914..04cf2fb051 100644 --- a/apps/calendar/ajax/event/move.php +++ b/apps/calendar/ajax/event/move.php @@ -43,4 +43,4 @@ $vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC); $result = OC_Calendar_Object::edit($id, $vcalendar->serialize()); $lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime(); -OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); +OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); \ No newline at end of file diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php index 91b85fff07..0b19e7e92f 100644 --- a/apps/calendar/ajax/event/new.form.php +++ b/apps/calendar/ajax/event/new.form.php @@ -72,4 +72,4 @@ $tmpl->assign('repeat_count', '10'); $tmpl->assign('repeat_weekofmonth', 'auto'); $tmpl->assign('repeat_date', ''); $tmpl->assign('repeat_year', 'bydate'); -$tmpl->printpage(); +$tmpl->printpage(); \ No newline at end of file diff --git a/apps/calendar/ajax/event/new.php b/apps/calendar/ajax/event/new.php index 72d57be03b..30e2b0cae3 100644 --- a/apps/calendar/ajax/event/new.php +++ b/apps/calendar/ajax/event/new.php @@ -21,5 +21,4 @@ if($errarr){ $vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST); $result = OC_Calendar_Object::add($cal, $vcalendar->serialize()); OCP\JSON::success(); -} -?> +} \ No newline at end of file diff --git a/apps/calendar/ajax/event/resize.php b/apps/calendar/ajax/event/resize.php index 0dc0a5fca7..56b83205e8 100644 --- a/apps/calendar/ajax/event/resize.php +++ b/apps/calendar/ajax/event/resize.php @@ -35,4 +35,4 @@ $vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC); OC_Calendar_Object::edit($id, $vcalendar->serialize()); $lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime(); -OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); +OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); \ No newline at end of file diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index b0c5587633..ae55cbc02d 100644 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -5,30 +5,26 @@ * later. * See the COPYING-README file. */ - - -require_once('when/When.php'); - OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('calendar'); +session_write_close(); // Look for the calendar id -$calendar_id = OC_Calendar_App::getCalendar($_GET['calendar_id'], false, false); -if($calendar_id !== false){ - if(! is_numeric($calendar_id['userid']) && $calendar_id['userid'] != OCP\User::getUser()){ - OCP\JSON::error(); - exit; +$calendar_id = null; +if (strval(intval($_GET['calendar_id'])) == strval($_GET['calendar_id'])) { // integer for sure. + $id = intval($_GET['calendar_id']); + $calendarrow = OC_Calendar_App::getCalendar($id, true, false); // Let's at least security check otherwise we might as well use OC_Calendar_Calendar::find() + if($calendarrow !== false && is_int($calendar_id['userid']) && $id == $calendar_id['userid']) { + $calendar_id = $id; } } -else { - $calendar_id = $_GET['calendar_id']; -} +$calendar_id = (is_null($calendar_id)?strip_tags($_GET['calendar_id']):$calendar_id); $start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']); $end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']); -$events = OC_Calendar_App::getrequestedEvents($calendar_id, $start, $end); +$events = OC_Calendar_App::getrequestedEvents($_GET['calendar_id'], $start, $end); $output = array(); foreach($events as $event){ $output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end)); } -OCP\JSON::encodedPrint($output); +OCP\JSON::encodedPrint(OCP\Util::sanitizeHTML($output)); diff --git a/apps/calendar/ajax/import/dialog.php b/apps/calendar/ajax/import/dialog.php index 3be02d2a6d..b99c32278c 100644 --- a/apps/calendar/ajax/import/dialog.php +++ b/apps/calendar/ajax/import/dialog.php @@ -12,5 +12,4 @@ OCP\App::checkAppEnabled('calendar'); $tmpl = new OCP\Template('calendar', 'part.import'); $tmpl->assign('path', $_POST['path']); $tmpl->assign('filename', $_POST['filename']); -$tmpl->printpage(); -?> +$tmpl->printpage(); \ No newline at end of file diff --git a/apps/calendar/ajax/import/dropimport.php b/apps/calendar/ajax/import/dropimport.php index e98c282ef4..87667d4de6 100644 --- a/apps/calendar/ajax/import/dropimport.php +++ b/apps/calendar/ajax/import/dropimport.php @@ -45,7 +45,7 @@ foreach($lines as $line) { } $i++; } -$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true); $id = $calendars[0]['id']; foreach($uids as $uid) { $prefix=$suffix=$content=array(); @@ -70,5 +70,4 @@ foreach($uids as $uid) { OC_Calendar_Object::add($id, $import); } } -OCP\JSON::success(); -?> \ No newline at end of file +OCP\JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php index 6fdad12c08..1facedfe0d 100644 --- a/apps/calendar/ajax/import/import.php +++ b/apps/calendar/ajax/import/import.php @@ -119,4 +119,4 @@ foreach($uids as $uid) { writeProgress('100'); sleep(3); OC_Cache::remove($progresskey); -OCP\JSON::success(); +OCP\JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/settings/getfirstday.php b/apps/calendar/ajax/settings/getfirstday.php index 23b71bba04..bc995f7d6e 100644 --- a/apps/calendar/ajax/settings/getfirstday.php +++ b/apps/calendar/ajax/settings/getfirstday.php @@ -8,5 +8,4 @@ OCP\JSON::checkLoggedIn(); $firstday = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo'); -OCP\JSON::encodedPrint(array('firstday' => $firstday)); -?> +OCP\JSON::encodedPrint(array('firstday' => $firstday)); \ No newline at end of file diff --git a/apps/calendar/ajax/settings/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php index f36f3bf061..6b6b8bef9c 100644 --- a/apps/calendar/ajax/settings/guesstimezone.php +++ b/apps/calendar/ajax/settings/guesstimezone.php @@ -23,5 +23,4 @@ if($timezone == OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timez } OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone); $message = array('message'=> $l->t('New Timezone:') . $timezone); -OCP\JSON::success($message); -?> \ No newline at end of file +OCP\JSON::success($message); \ No newline at end of file diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php index 373eeee796..056a603752 100644 --- a/apps/calendar/ajax/settings/setfirstday.php +++ b/apps/calendar/ajax/settings/setfirstday.php @@ -12,6 +12,4 @@ if(isset($_POST["firstday"])){ OCP\JSON::success(); }else{ OCP\JSON::error(); -} -?> - +} \ No newline at end of file diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php index eae7be54e8..8e95f6f3bf 100644 --- a/apps/calendar/ajax/settings/settimeformat.php +++ b/apps/calendar/ajax/settings/settimeformat.php @@ -12,6 +12,4 @@ if(isset($_POST["timeformat"])){ OCP\JSON::success(); }else{ OCP\JSON::error(); -} -?> - +} \ No newline at end of file diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php index d2797a08aa..6d029a6643 100644 --- a/apps/calendar/ajax/settings/settimezone.php +++ b/apps/calendar/ajax/settings/settimezone.php @@ -22,6 +22,4 @@ if( isset( $_POST['timezone'] ) ){ OCP\JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') ))); }else{ OCP\JSON::error(array('data' => array( 'message' => $l->t('Invalid request') ))); -} - -?> +} \ No newline at end of file diff --git a/apps/calendar/ajax/settings/timeformat.php b/apps/calendar/ajax/settings/timeformat.php index 809164e870..eebb687dfa 100644 --- a/apps/calendar/ajax/settings/timeformat.php +++ b/apps/calendar/ajax/settings/timeformat.php @@ -8,5 +8,4 @@ OCP\JSON::checkLoggedIn(); $timeformat = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24"); -OCP\JSON::encodedPrint(array("timeformat" => $timeformat)); -?> +OCP\JSON::encodedPrint(array("timeformat" => $timeformat)); \ No newline at end of file diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 886c218f7c..f1f2a26d87 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -5,9 +5,15 @@ OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php'; OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php'; OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php'; +OC::$CLASSPATH['OC_Calendar_Repeat'] = 'apps/calendar/lib/repeat.php'; OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php'; OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php'; OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); +OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate'); +OCP\Util::connectHook('OC_Calendar', 'editEvent', 'OC_Calendar_Repeat', 'update'); +OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Repeat', 'clean'); +OCP\Util::connectHook('OC_Calendar', 'moveEvent', 'OC_Calendar_Repeat', 'update'); +OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Repeat', 'cleanCalendar'); OCP\Util::addscript('calendar','loader'); OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min"); OCP\Util::addStyle("3rdparty", "chosen/chosen"); diff --git a/apps/calendar/appinfo/database.xml b/apps/calendar/appinfo/database.xml index 5a3ad32dc2..73457e6c6c 100644 --- a/apps/calendar/appinfo/database.xml +++ b/apps/calendar/appinfo/database.xml @@ -290,4 +290,56 @@ + + + *dbprefix*calendar_repeat + + + + + id + integer + 0 + true + 1 + true + 4 + + + + eventid + integer + 0 + true + true + 4 + + + + calid + integer + 0 + true + true + 4 + + + + startdate + timestamp + 0000-00-00 00:00:00 + false + + + + enddate + timestamp + 0000-00-00 00:00:00 + false + + + + +
+ diff --git a/apps/calendar/appinfo/update.php b/apps/calendar/appinfo/update.php index ce7f304a49..98159c3383 100644 --- a/apps/calendar/appinfo/update.php +++ b/apps/calendar/appinfo/update.php @@ -14,4 +14,11 @@ if (version_compare($installedVersion, '0.2.1', '<')) { $stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET calendarcolor=? WHERE id=?' ); $r = $stmt->execute(array($color,$id)); } +} +if (version_compare($installedVersion, '0.5', '<')) { + $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); + foreach($calendars as $calendar){ + OC_Calendar_Repeat::cleanCalendar($calendar['id']); + OC_Calendar_Repeat::generateCalendar($calendar['id']); + } } \ No newline at end of file diff --git a/apps/calendar/appinfo/version b/apps/calendar/appinfo/version index 267577d47e..2eb3c4fe4e 100644 --- a/apps/calendar/appinfo/version +++ b/apps/calendar/appinfo/version @@ -1 +1 @@ -0.4.1 +0.5 diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 05a808a5ae..4b87119592 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -11,15 +11,17 @@ OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('calendar'); // Create default calendar ... -$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), false); if( count($calendars) == 0){ OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar'); - $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1); + $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true); } $eventSources = array(); foreach($calendars as $calendar){ - $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar); + if($calendar['active'] == 1) { + $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar); + } } $eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true'); diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 1cbe5c6764..3b1be59381 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -430,6 +430,7 @@ Calendar={ $('#calendar_holder').fullCalendar('removeEventSource', url); $('#choosecalendar_dialog').dialog('destroy').remove(); Calendar.UI.Calendar.overview(); + $('#calendar_holder').fullCalendar('refetchEvents'); } }); } @@ -868,7 +869,7 @@ $(document).ready(function(){ eventDrop: Calendar.UI.moveEvent, eventResize: Calendar.UI.resizeEvent, eventRender: function(event, element) { - element.find('.fc-event-title').html(element.find('.fc-event-title').text()); + element.find('.fc-event-title').html(element.find('.fc-event-title').html()); element.tipsy({ className: 'tipsy-event', opacity: 0.9, diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js index c768a47a79..03e4217573 100644 --- a/apps/calendar/js/settings.js +++ b/apps/calendar/js/settings.js @@ -44,4 +44,24 @@ $(document).ready(function(){ $('#' + jsondata.firstday).attr('selected',true); $('#firstday').chosen(); }); + $('#cleancalendarcache').click(function(){ + $.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php'), function(){ + calendarcachecheck(); + }); + }); + calendarcachecheck(); }); +function calendarcachecheck(){ + $.getJSON(OC.filePath('calendar', 'ajax/cache', 'status.php'), function(jsondata, status) { + $('#cleancalendarcache').attr('title', jsondata.l10n.text); + if(jsondata.status == 'success'){ + $('#cleancalendarcache').css('background', '#90EE90'); + $('#cleancalendarcache').css('color', '#333'); + $('#cleancalendarcache').css('text-shadow', '#fff 0 1px 0'); + }else{ + $('#cleancalendarcache').css('background', '#DC143C'); + $('#cleancalendarcache').css('color', '#FFFFFF'); + $('#cleancalendarcache').css('text-shadow', '0px 0px 0px #fff, 0px 0px #fff'); + } + }); +} \ No newline at end of file diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index e04f2ed0cd..8e13b13b8a 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -50,10 +50,7 @@ class OC_Calendar_App{ return false; } } - if($calendar === false){ - return false; - } - return OC_Calendar_Calendar::find($id); + return $calendar; } /* @@ -119,8 +116,7 @@ class OC_Calendar_App{ * @brief returns the default categories of ownCloud * @return (array) $categories */ - protected static function getDefaultCategories() - { + protected static function getDefaultCategories(){ return array( self::$l10n->t('Birthday'), self::$l10n->t('Business'), @@ -155,8 +151,7 @@ class OC_Calendar_App{ * @brief returns the categories of the vcategories object * @return (array) $categories */ - public static function getCategoryOptions() - { + public static function getCategoryOptions(){ $categories = self::getVCategories()->categories(); return $categories; } @@ -343,6 +338,9 @@ class OC_Calendar_App{ $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); foreach($singleevents as $singleevent){ $event = OC_Calendar_Object::find($singleevent['eventid']); + if(!array_key_exists('summary', $event)){ + $event['summary'] = self::$l10n->t('unnamed'); + } $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')'; $events[] = $event; } @@ -362,94 +360,57 @@ class OC_Calendar_App{ /* * @brief generates the output for an event which will be readable for our js * @param (mixed) $event - event object / array - * @param (int) $start - unixtimestamp of start - * @param (int) $end - unixtimestamp of end + * @param (int) $start - DateTime object of start + * @param (int) $end - DateTime object of end * @return (array) $output - readable output */ public static function generateEventOutput($event, $start, $end){ - $output = array(); - if(isset($event['calendardata'])){ $object = OC_VObject::parse($event['calendardata']); $vevent = $object->VEVENT; }else{ $vevent = $event['vevent']; } - + $return = array(); + $id = $event['id']; + $allday = ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false; $last_modified = @$vevent->__get('LAST-MODIFIED'); $lastmodified = ($last_modified)?$last_modified->getDateTime()->format('U'):0; - - $output = array('id'=>(int)$event['id'], - 'title' => ($event['summary']!=NULL || $event['summary'] != '')?$event['summary']: self::$l10n->t('unnamed'), - 'description' => isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:'', - 'lastmodified'=>$lastmodified); - - $dtstart = $vevent->DTSTART; - $start_dt = $dtstart->getDateTime(); - $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); - $end_dt = $dtend->getDateTime(); - - if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ - $output['allDay'] = true; - }else{ - $output['allDay'] = false; - $start_dt->setTimezone(new DateTimeZone(self::$tz)); - $end_dt->setTimezone(new DateTimeZone(self::$tz)); - } - - // Handle exceptions to recurring events - $exceptionDateObjects = $vevent->select('EXDATE'); - $exceptionDateMap = Array(); - foreach ($exceptionDateObjects as $exceptionObject) { - foreach($exceptionObject->getDateTimes() as $datetime) { - $ts = $datetime->getTimestamp(); - $exceptionDateMap[idate('Y',$ts)][idate('m', $ts)][idate('d', $ts)] = true; - } - } - - $return = array(); - if($event['repeating'] == 1){ - $duration = (double) $end_dt->format('U') - (double) $start_dt->format('U'); - $r = new When(); - $r->recur($start_dt)->rrule((string) $vevent->RRULE); - /*$r = new iCal_Repeat_Generator(array('RECUR' => $start_dt, - * 'RRULE' => (string)$vevent->RRULE - * 'RDATE' => (string)$vevent->RDATE - * 'EXRULE' => (string)$vevent->EXRULE - * 'EXDATE' => (string)$vevent->EXDATE));*/ - while($result = $r->next()){ - if($result < $start){ - continue; - } - if($result > $end){ - break; - } - // Check for exceptions to recurring events - $ts = $result->getTimestamp(); - if (isset($exceptionDateMap[idate('Y',$ts)][idate('m', $ts)][idate('d', $ts)])) { - continue; - } - unset($ts); - - if($output['allDay'] == true){ - $output['start'] = $result->format('Y-m-d'); - $output['end'] = date('Y-m-d', $result->format('U') + --$duration); + $staticoutput = array('id'=>(int)$event['id'], + 'title' => htmlspecialchars(($event['summary']!=NULL || $event['summary'] != '')?$event['summary']: self::$l10n->t('unnamed')), + 'description' => isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'', + 'lastmodified'=>$lastmodified, + 'allDay'=>$allday); + if(OC_Calendar_Object::isrepeating($id) && OC_Calendar_Repeat::is_cached_inperiod($event['id'], $start, $end)){ + $cachedinperiod = OC_Calendar_Repeat::get_inperiod($id, $start, $end); + foreach($cachedinperiod as $cachedevent){ + $dynamicoutput = array(); + if($allday){ + $start_dt = new DateTime($cachedevent['startdate'], new DateTimeZone('UTC')); + $end_dt = new DateTime($cachedevent['enddate'], new DateTimeZone('UTC')); + $dynamicoutput['start'] = $start_dt->format('Y-m-d'); + $dynamicoutput['end'] = $end_dt->format('Y-m-d'); }else{ - $output['start'] = $result->format('Y-m-d H:i:s'); - $output['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration); + $start_dt = new DateTime($cachedevent['startdate'], new DateTimeZone('UTC')); + $end_dt = new DateTime($cachedevent['enddate'], new DateTimeZone('UTC')); + $start_dt->setTimezone(new DateTimeZone(self::$tz)); + $end_dt->setTimezone(new DateTimeZone(self::$tz)); + $dynamicoutput['start'] = $start_dt->format('Y-m-d H:i:s'); + $dynamicoutput['end'] = $end_dt->format('Y-m-d H:i:s'); } - $return[] = $output; + $return[] = array_merge($staticoutput, $dynamicoutput); } }else{ - if($output['allDay'] == true){ - $output['start'] = $start_dt->format('Y-m-d'); - $end_dt->modify('-1 sec'); - $output['end'] = $end_dt->format('Y-m-d'); - }else{ - $output['start'] = $start_dt->format('Y-m-d H:i:s'); - $output['end'] = $end_dt->format('Y-m-d H:i:s'); + if(OC_Calendar_Object::isrepeating($id)){ + $object->expand($start, $end); + } + foreach($object->getComponents() as $singleevent){ + if(!($singleevent instanceof Sabre_VObject_Component_VEvent)){ + continue; + } + $dynamicoutput = OC_Calendar_Object::generateStartEndDate($singleevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($singleevent), $allday, self::$tz); + $return[] = array_merge($staticoutput, $dynamicoutput); } - $return[] = $output; } return $return; } diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index 869b35e2e1..b725898858 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -44,13 +44,13 @@ class OC_Calendar_Calendar{ /** * @brief Returns the list of calendars for a specific user. * @param string $uid User ID - * @param boolean $active Only return calendars with this $active state, default(=null) is don't care + * @param boolean $active Only return calendars with this $active state, default(=false) is don't care * @return array */ - public static function allCalendars($uid, $active=null){ + public static function allCalendars($uid, $active=false){ $values = array($uid); $active_where = ''; - if (!is_null($active) && $active){ + if ($active){ $active_where = ' AND active = ?'; $values[] = $active; } @@ -109,7 +109,10 @@ class OC_Calendar_Calendar{ $stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components)); - return OCP\DB::insertid('*PREFIX*calendar_calendars'); + $insertid = OCP\DB::insertid('*PREFIX*calendar_calendars'); + OCP\Util::emitHook('OC_Calendar', 'addCalendar', $insertid); + + return $insertid; } /** @@ -129,7 +132,10 @@ class OC_Calendar_Calendar{ $stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components)); - return OCP\DB::insertid('*PREFIX*calendar_calendars'); + $insertid = OCP\DB::insertid('*PREFIX*calendar_calendars'); + OCP\Util::emitHook('OC_Calendar', 'addCalendar', $insertid); + + return $insertid; } /** @@ -158,6 +164,7 @@ class OC_Calendar_Calendar{ $stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET displayname=?,calendarorder=?,calendarcolor=?,timezone=?,components=?,ctag=ctag+1 WHERE id=?' ); $result = $stmt->execute(array($name,$order,$color,$timezone,$components,$id)); + OCP\Util::emitHook('OC_Calendar', 'editCalendar', $id); return true; } @@ -198,6 +205,11 @@ class OC_Calendar_Calendar{ $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ?' ); $stmt->execute(array($id)); + OCP\Util::emitHook('OC_Calendar', 'deleteCalendar', $id); + if(count(self::allCalendars()) == 0) { + self::addCalendar(OCP\USER::getUser(),'Default calendar'); + } + return true; } diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 9e4806227b..7f3322b1ab 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -108,7 +108,7 @@ class OC_Calendar_Object{ $object_id = OCP\DB::insertid('*PREFIX*calendar_objects'); OC_Calendar_Calendar::touchCalendar($id); - + OCP\Util::emitHook('OC_Calendar', 'addEvent', $object_id); return $object_id; } @@ -128,7 +128,7 @@ class OC_Calendar_Object{ $object_id = OCP\DB::insertid('*PREFIX*calendar_objects'); OC_Calendar_Calendar::touchCalendar($id); - + OCP\Util::emitHook('OC_Calendar', 'addEvent', $object_id); return $object_id; } @@ -149,6 +149,7 @@ class OC_Calendar_Object{ $stmt->execute(array($type,$startdate,$enddate,$repeating,$summary,$data,time(),$id)); OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']); + OCP\Util::emitHook('OC_Calendar', 'editEvent', $id); return true; } @@ -170,6 +171,7 @@ class OC_Calendar_Object{ $stmt->execute(array($type,$startdate,$enddate,$repeating,$summary,$data,time(),$oldobject['id'])); OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']); + OCP\Util::emitHook('OC_Calendar', 'editEvent', $oldobject['id']); return true; } @@ -184,6 +186,7 @@ class OC_Calendar_Object{ $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE id = ?' ); $stmt->execute(array($id)); OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']); + OCP\Util::emitHook('OC_Calendar', 'deleteEvent', $id); return true; } @@ -195,9 +198,11 @@ class OC_Calendar_Object{ * @return boolean */ public static function deleteFromDAVData($cid,$uri){ + $oldobject = self::findWhereDAVDataIs($cid, $uri); $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri=?' ); $stmt->execute(array($cid,$uri)); OC_Calendar_Calendar::touchCalendar($cid); + OCP\Util::emitHook('OC_Calendar', 'deleteEvent', $oldobject['id']); return true; } @@ -207,6 +212,7 @@ class OC_Calendar_Object{ $stmt->execute(array($calendarid,$id)); OC_Calendar_Calendar::touchCalendar($id); + OCP\Util::emitHook('OC_Calendar', 'moveEvent', $id); return true; } @@ -294,12 +300,11 @@ class OC_Calendar_Object{ * This function creates a date string that can be used by MDB2. * Furthermore it converts the time to UTC. */ - protected static function getUTCforMDB($datetime){ + public static function getUTCforMDB($datetime){ return date('Y-m-d H:i', $datetime->format('U') - $datetime->getOffset()); } - public static function getDTEndFromVEvent($vevent) - { + public static function getDTEndFromVEvent($vevent){ if ($vevent->DTEND) { $dtend = $vevent->DTEND; }else{ @@ -600,8 +605,8 @@ class OC_Calendar_Object{ public static function updateVCalendarFromRequest($request, $vcalendar) { - $title = strip_tags($request["title"]); - $location = strip_tags($request["location"]); + $title = $request["title"]; + $location = $request["location"]; $categories = $request["categories"]; $allday = isset($request["allday"]); $from = $request["from"]; @@ -611,7 +616,7 @@ class OC_Calendar_Object{ $totime = $request['totime']; } $vevent = $vcalendar->VEVENT; - $description = strip_tags($request["description"]); + $description = $request["description"]; $repeat = $request["repeat"]; if($repeat != 'doesnotrepeat'){ $rrule = ''; @@ -796,4 +801,29 @@ class OC_Calendar_Object{ $event = self::find($id); return $event['calendarid']; } + + public static function isrepeating($id){ + $event = self::find($id); + return ($event['repeating'] == 1)?true:false; + } + + public static function generateStartEndDate($dtstart, $dtend, $allday, $tz){ + $start_dt = $dtstart->getDateTime(); + $end_dt = $dtend->getDateTime(); + $return = array(); + if($allday){ + $return['start'] = $start_dt->format('Y-m-d'); + $end_dt->modify('-1 minute'); + while($start_dt >= $end_dt){ + $end_dt->modify('+1 day'); + } + $return['end'] = $end_dt->format('Y-m-d'); + }else{ + $start_dt->setTimezone(new DateTimeZone($tz)); + $end_dt->setTimezone(new DateTimeZone($tz)); + $return['start'] = $start_dt->format('Y-m-d H:i:s'); + $return['end'] = $end_dt->format('Y-m-d H:i:s'); + } + return $return; + } } diff --git a/apps/calendar/lib/repeat.php b/apps/calendar/lib/repeat.php new file mode 100644 index 0000000000..204f96a5a2 --- /dev/null +++ b/apps/calendar/lib/repeat.php @@ -0,0 +1,204 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +/* + * This class manages the caching of repeating events + * Events will be cached for the current year Âą 5 years + */ +class OC_Calendar_Repeat{ + /* + * @brief returns the cache of an event + * @param (int) $id - id of the event + * @return (array) + */ + public static function get($id){ + $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?'); + $result = $stmt->execute(array($id)); + $return = array(); + while($row = $result->fetchRow()){ + $return[] = $row; + } + return $return; + } + /* + * @brief returns the cache of an event in a specific peroid + * @param (int) $id - id of the event + * @param (DateTime) $from - start for period in UTC + * @param (DateTime) $until - end for period in UTC + * @return (array) + */ + public static function get_inperiod($id, $from, $until){ + $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?' + .' AND ((startdate >= ? AND startdate <= ?)' + .' OR (enddate >= ? AND enddate <= ?))'); + $result = $stmt->execute(array($id, + OC_Calendar_Object::getUTCforMDB($from), OC_Calendar_Object::getUTCforMDB($until), + OC_Calendar_Object::getUTCforMDB($from), OC_Calendar_Object::getUTCforMDB($until))); + $return = array(); + while($row = $result->fetchRow()){ + $return[] = $row; + } + return $return; + } + /* + * @brief returns the cache of all repeating events of a calendar + * @param (int) $id - id of the calendar + * @return (array) + */ + public static function getCalendar($id){ + $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?'); + $result = $stmt->execute(array($id)); + $return = array(); + while($row = $result->fetchRow()){ + $return[] = $row; + } + return $return; + } + /* + * @brief returns the cache of all repeating events of a calendar in a specific period + * @param (int) $id - id of the event + * @param (string) $from - start for period in UTC + * @param (string) $until - end for period in UTC + * @return (array) + */ + public static function getCalendar_inperiod($id, $from, $until){ + $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?' + .' AND ((startdate >= ? AND startdate <= ?)' + .' OR (enddate >= ? AND enddate <= ?))'); + $result = $stmt->execute(array($id, + $from, $until, + $from, $until)); + $return = array(); + while($row = $result->fetchRow()){ + $return[] = $row; + } + return $return; + } + /* + * @brief generates the cache the first time + * @param (int) id - id of the event + * @return (bool) + */ + public static function generate($id){ + $event = OC_Calendar_Object::find($id); + if($event['repeating'] == 0){ + return false; + } + $object = OC_VObject::parse($event['calendardata']); + $start = new DateTime('01-01-' . date('Y') . ' 00:00:00', new DateTimeZone('UTC')); + $start->modify('-5 years'); + $end = new DateTime('31-12-' . date('Y') . ' 23:59:59', new DateTimeZone('UTC')); + $end->modify('+5 years'); + $object->expand($start, $end); + foreach($object->getComponents() as $vevent){ + if(!($vevent instanceof Sabre_VObject_Component_VEvent)){ + continue; + } + $startenddate = OC_Calendar_Object::generateStartEndDate($vevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($vevent), ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false, 'UTC'); + $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*calendar_repeat (eventid,calid,startdate,enddate) VALUES(?,?,?,?)'); + $stmt->execute(array($id,OC_Calendar_Object::getCalendarid($id),$startenddate['start'],$startenddate['end'])); + } + return true; + } + /* + * @brief generates the cache the first time for all repeating event of an calendar + * @param (int) id - id of the calendar + * @return (bool) + */ + public static function generateCalendar($id){ + $allobjects = OC_Calendar_Object::all($id); + foreach($allobjects as $event){ + self::generate($event['id']); + } + return true; + } + /* + * @brief updates an event that is already cached + * @param (int) id - id of the event + * @return (bool) + */ + public static function update($id){ + self::clean($id); + self::generate($id); + return true; + } + /* + * @brief updates all repating events of a calendar that are already cached + * @param (int) id - id of the calendar + * @return (bool) + */ + public static function updateCalendar($id){ + self::cleanCalendar($id); + self::generateCalendar($id); + return true; + } + /* + * @brief checks if an event is already cached + * @param (int) id - id of the event + * @return (bool) + */ + public static function is_cached($id){ + if(count(self::get($id)) != 0){ + return true; + }else{ + return false; + } + } + /* + * @brief checks if an event is already cached in a specific period + * @param (int) id - id of the event + * @param (DateTime) $from - start for period in UTC + * @param (DateTime) $until - end for period in UTC + * @return (bool) + */ + public static function is_cached_inperiod($id, $start, $end){ + if(count(self::get_inperiod($id, $start, $end)) != 0){ + return true; + }else{ + return false; + } + + } + /* + * @brief checks if a whole calendar is already cached + * @param (int) id - id of the calendar + * @return (bool) + */ + public static function is_calendar_cached($id){ + $cachedevents = count(self::getCalendar($id)); + $repeatingevents = 0; + $allevents = OC_Calendar_Object::all($id); + foreach($allevents as $event){ + if($event['repeating'] === 1){ + $repeatingevents++; + } + } + if($cachedevents < $repeatingevents){ + return false; + }else{ + return true; + } + } + /* + * @brief removes the cache of an event + * @param (int) id - id of the event + * @return (bool) + */ + public static function clean($id){ + $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE eventid = ?'); + $stmt->execute(array($id)); + } + /* + * @brief removes the cache of all events of a calendar + * @param (int) id - id of the calendar + * @return (bool) + */ + public static function cleanCalendar($id){ + $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE calid = ?'); + $stmt->execute(array($id)); + } +} \ No newline at end of file diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php index 03516b3b70..6526b4223a 100644 --- a/apps/calendar/lib/search.php +++ b/apps/calendar/lib/search.php @@ -1,7 +1,7 @@ - * Copyright (c) 2011 Georg Ehrke + * Copyright (c) 2012 Georg Ehrke * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -44,7 +44,11 @@ - + + + + + t('Calendar CalDAV syncing addresses'); ?> (t('more info'); ?>)
diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php index e45072c954..12f7bb9db9 100644 --- a/apps/contacts/ajax/addcontact.php +++ b/apps/contacts/ajax/addcontact.php @@ -47,4 +47,4 @@ if(!$id) { exit(); } -OCP\JSON::success(array('data' => array( 'id' => $id ))); +OCP\JSON::success(array('data' => array( 'id' => $id, 'aid' => $aid ))); diff --git a/apps/contacts/ajax/contacts.php b/apps/contacts/ajax/contacts.php index 37d396cd83..16730ec947 100644 --- a/apps/contacts/ajax/contacts.php +++ b/apps/contacts/ajax/contacts.php @@ -6,15 +6,54 @@ * See the COPYING-README file. */ +function cmp($a, $b) +{ + if ($a['displayname'] == $b['displayname']) { + return 0; + } + return ($a['displayname'] < $b['displayname']) ? -1 : 1; +} OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); -$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser()); -$contacts = OC_Contacts_VCard::all($ids); +$active_addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser()); +error_log('active_addressbooks: '.print_r($active_addressbooks, true)); + +$contacts_addressbook = array(); +$ids = array(); +foreach($active_addressbooks as $addressbook) { + $ids[] = $addressbook['id']; + if(!isset($contacts_addressbook[$addressbook['id']])) { + $contacts_addressbook[$addressbook['id']] = array('contacts' => array()); + $contacts_addressbook[$addressbook['id']]['displayname'] = $addressbook['displayname']; + } +} +error_log('ids: '.print_r($ids, true)); +$contacts_alphabet = OC_Contacts_VCard::all($ids); +error_log('contacts_alphabet: '.print_r($contacts_alphabet, true)); + +// Our new array for the contacts sorted by addressbook +foreach($contacts_alphabet as $contact) { + if(!isset($contacts_addressbook[$contact['addressbookid']])) { // It should never execute. + $contacts_addressbook[$contact['addressbookid']] = array('contacts' => array()); + } + $display = trim($contact['fullname']); + if(!$display) { + $vcard = OC_Contacts_App::getContactVCard($contact['id']); + if(!is_null($vcard)) { + $struct = OC_Contacts_VCard::structureContact($vcard); + $display = isset($struct['EMAIL'][0])?$struct['EMAIL'][0]['value']:'[UNKNOWN]'; + } + } + $contacts_addressbook[$contact['addressbookid']]['contacts'][] = array('id' => $contact['id'], 'addressbookid' => $contact['addressbookid'], 'displayname' => htmlspecialchars($display)); +} + +uasort($contacts_addressbook, 'cmp'); + $tmpl = new OCP\Template("contacts", "part.contacts"); -$tmpl->assign('contacts', $contacts); +$tmpl->assign('books', $contacts_addressbook, false); $page = $tmpl->fetchPage(); OCP\JSON::success(array('data' => array( 'page' => $page ))); -?> + diff --git a/apps/contacts/ajax/editaddress.php b/apps/contacts/ajax/editaddress.php index 969aeeba8f..2d7aba11b0 100644 --- a/apps/contacts/ajax/editaddress.php +++ b/apps/contacts/ajax/editaddress.php @@ -20,7 +20,18 @@ if($checksum) { $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum); $element = $vcard->children[$line]; $adr = OC_Contacts_VCard::structureProperty($element); - $tmpl->assign('adr',$adr); + $types = array(); + if(isset($adr['parameters']['TYPE'])) { + if(is_array($adr['parameters']['TYPE'])) { + $types = array_map('htmlspecialchars', $adr['parameters']['TYPE']); + $types = array_map('strtoupper', $types); + } else { + $types = array(strtoupper(htmlspecialchars($adr['parameters']['TYPE']))); + } + } + $tmpl->assign('types', $types, false); + $adr = array_map('htmlspecialchars', $adr['value']); + $tmpl->assign('adr', $adr, false); } $tmpl->assign('id',$id); diff --git a/apps/contacts/ajax/editname.php b/apps/contacts/ajax/editname.php index d06d416b7e..62cae894b6 100644 --- a/apps/contacts/ajax/editname.php +++ b/apps/contacts/ajax/editname.php @@ -28,8 +28,9 @@ if($id) { $name = OC_Contacts_VCard::structureProperty($property); } } - $tmpl->assign('name',$name); - $tmpl->assign('id',$id); + $name = array_map('htmlspecialchars', $name['value']); + $tmpl->assign('name',$name, false); + $tmpl->assign('id',$id, false); } else { bailOut(OC_Contacts_App::$l10n->t('Contact ID is missing.')); } diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css index 8de68fbf05..6c65db2b77 100644 --- a/apps/contacts/css/contacts.css +++ b/apps/contacts/css/contacts.css @@ -2,9 +2,12 @@ font-weight: bold; }*/ #leftcontent { top: 3.5em !important; padding: 0; margin: 0; } +#leftcontent a { padding: 0 0 0 25px; } #rightcontent { top: 3.5em !important; padding-top: 5px; } -#contacts { background: #fff; width: 20em; left: 12.5em; top: 3.7em; bottom:3em; position: fixed; overflow: auto; padding: 0; margin: 0; } -#contacts a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; } +#leftcontent h3 { cursor: pointer; -moz-transition: background 300ms ease 0s; background: none no-repeat scroll 1em center #eee; border-bottom: 1px solid #ddd; border-top: 1px solid #fff; display: block; max-width: 100%; padding: 0.5em 0.8em; color: #666; text-shadow: 0 1px 0 #f8f8f8; font-size: 1.2em; } +#leftcontent h3:hover { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; } +#contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; } +.contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; } #bottomcontrols { padding: 0; bottom:0px; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;} #contacts_newcontact { float: left; margin: 0.2em 0 0 1em; } #chooseaddressbook { float: right; margin: 0.2em 1em 0 0; } @@ -22,10 +25,10 @@ #firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; } #firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; } -#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 14em; float: left; font-weight: bold; } +#card input[type="text"].contacts_property,input[type="email"].contacts_property,input[type="url"].contacts_property { width: 14em; float: left; font-weight: bold; } .categories { float: left; width: 16em; } -#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select, textarea { background-color: #fefefe; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; } -#card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="tel"]:active, select:hover, select:focus, select:active, textarea:focus, textarea:hover { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #ddd, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #ddd, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #ddd, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; } +#card input[type="text"],input[type="email"],input[type="url"],input[type="tel"],input[type="date"], select, textarea { background-color: #fefefe; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; } +#card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="url"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="url"]:active,input[type="tel"]:active, select:hover, select:focus, select:active, textarea:focus, textarea:hover { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #ddd, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #ddd, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #ddd, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; } textarea { width: 80%; min-height: 5em; min-width: 30em; margin: 0 !important; padding: 0 !important; outline: 0 !important;} dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; } .form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom; color: #bbb;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ } diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 74b7c43c55..bdb52c123c 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -66,7 +66,7 @@ $tmpl->assign('phone_types', $phone_types); $tmpl->assign('email_types', $email_types); $tmpl->assign('categories', $categories); $tmpl->assign('addressbooks', $addressbooks); -$tmpl->assign('contacts', $contacts); +$tmpl->assign('contacts', $contacts, false); $tmpl->assign('details', $details ); $tmpl->assign('id',$id); $tmpl->printPage(); diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index a1b9976006..8ab2a3fbb8 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -171,13 +171,14 @@ Contacts={ });*/ // Name has changed. Update it and reorder. + // TODO: Take addressbook into account $('#fn').change(function(){ var name = $('#fn').val().strip_tags(); - var item = $('#contacts [data-id="'+Contacts.UI.Card.id+'"]'); + var item = $('.contacts li[data-id="'+Contacts.UI.Card.id+'"]'); $(item).find('a').html(name); Contacts.UI.Card.fn = name; var added = false; - $('#contacts li').each(function(){ + $('.contacts li[data-bookid="'+Contacts.UI.Card.bookid+'"]').each(function(){ if ($(this).text().toLowerCase() > name.toLowerCase()) { $(this).before(item).fadeIn('fast'); added = true; @@ -185,7 +186,7 @@ Contacts={ } }); if(!added) { - $('#leftcontent ul').append(item); + $('#contacts ul[data-id="'+Contacts.UI.Card.bookid+'"]').append(item); } Contacts.UI.Contacts.scrollTo(Contacts.UI.Card.id); }); @@ -245,19 +246,23 @@ Contacts={ honpre:'', honsuf:'', data:undefined, - update:function(id) { - var newid; + update:function(id, bookid) { + var newid, firstitem; if(!id) { - newid = $('#contacts li:first-child').data('id'); + firstitem = $('#contacts:first-child li:first-child'); + if(firstitem.length > 0) { + newid = firstitem.data('id'); + bookid = firstitem.data('bookid'); + } } else { newid = id; } - var localLoadContact = function(id) { - if($('#contacts li').length > 0) { - $('#leftcontent li[data-id="'+newid+'"]').addClass('active'); + var localLoadContact = function(newid, bookid) { + if($('.contacts li').length > 0) { + firstitem.addClass('active'); $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){ if(jsondata.status == 'success'){ - Contacts.UI.Card.loadContact(jsondata.data); + Contacts.UI.Card.loadContact(jsondata.data, bookid); } else { OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); } @@ -266,19 +271,19 @@ Contacts={ } // Make sure proper DOM is loaded. - if(!$('#card')[0]) { + if(!$('#card')[0] && newid) { $.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){ if(jsondata.status == 'success'){ $('#rightcontent').html(jsondata.data.page).ready(function() { Contacts.UI.loadHandlers(); - localLoadContact(newid); + localLoadContact(newid, bookid); }); } else { OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); } }); } - else if($('#contacts li').length == 0) { + else if(!newid) { // load intro page $.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){ if(jsondata.status == 'success'){ @@ -291,7 +296,7 @@ Contacts={ }); } else { - localLoadContact(); + localLoadContact(newid, bookid); } }, doExport:function() { @@ -313,13 +318,14 @@ Contacts={ if (jsondata.status == 'success'){ $('#rightcontent').data('id',jsondata.data.id); var id = jsondata.data.id; + var aid = jsondata.data.aid; $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){ if(jsondata.status == 'success'){ - Contacts.UI.Card.loadContact(jsondata.data); - $('#leftcontent .active').removeClass('active'); + Contacts.UI.Card.loadContact(jsondata.data, aid); + $('#contacts .active').removeClass('active'); var item = $('
  • '+Contacts.UI.Card.fn+'
  • '); var added = false; - $('#leftcontent ul li').each(function(){ + $('#contacts ul[data-id="'+aid+'"] li').each(function(){ if ($(this).text().toLowerCase() > Contacts.UI.Card.fn.toLowerCase()) { $(this).before(item).fadeIn('fast'); added = true; @@ -327,7 +333,7 @@ Contacts={ } }); if(!added) { - $('#leftcontent ul').append(item); + $('#contacts ul[data-id="'+aid+'"]').append(item); } if(isnew) { // add some default properties Contacts.UI.Card.addProperty('EMAIL'); @@ -370,8 +376,8 @@ Contacts={ if(answer == true) { $.post(OC.filePath('contacts', 'ajax', 'deletecard.php'),{'id':Contacts.UI.Card.id},function(jsondata){ if(jsondata.status == 'success'){ - var newid = ''; - var curlistitem = $('#leftcontent [data-id="'+jsondata.data.id+'"]'); + var newid = '', bookid; + var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]'); var newlistitem = curlistitem.prev(); if(newlistitem == undefined) { newlistitem = curlistitem.next(); @@ -379,13 +385,14 @@ Contacts={ curlistitem.remove(); if(newlistitem != undefined) { newid = newlistitem.data('id'); + bookid = newlistitem.data('id'); } $('#rightcontent').data('id',newid); this.id = this.fn = this.fullname = this.shortname = this.famname = this.givname = this.addname = this.honpre = this.honsuf = ''; this.data = undefined; - if($('#contacts li').length > 0) { // Load first in list. - Contacts.UI.Card.update(newid); + if($('.contacts li').length > 0) { // Load first in list. + Contacts.UI.Card.update(newid, bookid); } else { // load intro page $.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){ @@ -408,9 +415,10 @@ Contacts={ }); return false; }, - loadContact:function(jsondata){ + loadContact:function(jsondata, bookid){ this.data = jsondata; this.id = this.data.id; + this.bookid = bookid; $('#rightcontent').data('id',this.id); this.populateNameFields(); this.loadPhoto(); @@ -1498,40 +1506,54 @@ Contacts={ update:function(){ $.getJSON(OC.filePath('contacts', 'ajax', 'contacts.php'),{},function(jsondata){ if(jsondata.status == 'success'){ - $('#contacts').html(jsondata.data.page); + $('#contacts').html(jsondata.data.page).ready(function() { + /*setTimeout(function() { + $('.contacts li').unbind('inview'); + $('.contacts li:visible').bind('inview', function(event, isInView, visiblePartX, visiblePartY) { + if (isInView) { + if (!$(this).find('a').attr('style')) { + $(this).find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+$(this).data('id')+') no-repeat'); + } + } + })}, 100); + setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/ + }); Contacts.UI.Card.update(); } else{ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); } }); - setTimeout(function() { - $('#contacts li').unbind('inview'); - $('#contacts li').bind('inview', function(event, isInView, visiblePartX, visiblePartY) { + /*setTimeout(function() { + $('.contacts li').unbind('inview'); + $('.contacts li:visible').bind('inview', function(event, isInView, visiblePartX, visiblePartY) { if (isInView) { if (!$(this).find('a').attr('style')) { $(this).find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+$(this).data('id')+') no-repeat'); } } })}, 500); - setTimeout(Contacts.UI.Contacts.lazyupdate, 500); + setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/ }, // Add thumbnails to the contact list as they become visible in the viewport. lazyupdate:function(){ - $('#contacts li').live('inview', function(){ + $('.contacts li').live('inview', function(){ if (!$(this).find('a').attr('style')) { $(this).find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+$(this).data('id')+') no-repeat'); } }); }, refreshThumbnail:function(id){ - var item = $('#contacts [data-id="'+id+'"]').find('a'); + var item = $('.contacts li[data-id="'+id+'"]').find('a'); item.html(Contacts.UI.Card.fn); item.css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+id+'&refresh=1'+Math.random()+') no-repeat'); }, scrollTo:function(id){ - $('#contacts').animate({ - scrollTop: $('#leftcontent li[data-id="'+id+'"]').offset().top-20}, 'slow','swing'); + var item = $('#contacts li[data-id="'+id+'"]'); + if(item) { + $('.contacts').animate({ + scrollTop: $('#contacts li[data-id="'+id+'"]').offset().top-20}, 'slow','swing'); + } } } } @@ -1552,24 +1574,25 @@ $(document).ready(function(){ $('#contacts_newcontact').keydown(Contacts.UI.Card.editNew); // Load a contact. - $('#contacts').keydown(function(event) { + $('.contacts').keydown(function(event) { if(event.which == 13) { - $('#contacts').click(); + $('.contacts').click(); } }); - $('#contacts').click(function(event){ + $(document).on('click', '.contacts', function(event){ var $tgt = $(event.target); if ($tgt.is('li') || $tgt.is('a')) { var item = $tgt.is('li')?$($tgt):($tgt).parent(); var id = item.data('id'); + var bookid = item.data('bookid'); item.addClass('active'); var oldid = $('#rightcontent').data('id'); if(oldid != 0){ - $('#contacts li[data-id="'+oldid+'"]').removeClass('active'); + $('.contacts li[data-id="'+oldid+'"]').removeClass('active'); } $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){ if(jsondata.status == 'success'){ - Contacts.UI.Card.loadContact(jsondata.data); + Contacts.UI.Card.loadContact(jsondata.data, bookid); } else{ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); @@ -1579,7 +1602,12 @@ $(document).ready(function(){ return false; }); - $('#contacts li').bind('inview', function(event, isInView, visiblePartX, visiblePartY) { + $(document).on('click', '.addressbook', function(event){ + $(this).next().slideToggle(300); + return false; + }); + + /*$('.contacts li').bind('inview', function(event, isInView, visiblePartX, visiblePartY) { if (isInView) { //NOTE: I've kept all conditions for future reference ;-) // element is now visible in the viewport if (visiblePartY == 'top') { @@ -1591,14 +1619,14 @@ $(document).ready(function(){ if (!$(this).find('a').attr('style')) { //alert($(this).data('id') + ' has background: ' + $(this).attr('style')); $(this).find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+$(this).data('id')+') no-repeat'); - }/* else { - alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url')); - }*/ + }// else { + // alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url')); + //} } } else { // element has gone out of viewport } - }); + });*/ $('.contacts_property').live('change', function(){ Contacts.UI.Card.saveProperty(this); @@ -1677,4 +1705,7 @@ $(document).ready(function(){ } $('#contacts_propertymenu_dropdown a').click(propertyMenuItem); $('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem); + + Contacts.UI.loadHandlers(); + Contacts.UI.Contacts.update(); }); diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index 79445ceeee..878d8835f9 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -172,12 +172,11 @@ class OC_Contacts_Addressbook{ if(!$prefbooks){ $addressbooks = OC_Contacts_Addressbook::all($uid); if(count($addressbooks) == 0){ - OC_Contacts_Addressbook::add($uid,'default','Default Address Book'); - $addressbooks = OC_Contacts_Addressbook::all($uid); + $id = OC_Contacts_Addressbook::add($uid,'default','Default Address Book'); + self::setActive($id, true); } - $prefbooks = $addressbooks[0]['id']; - OCP\Config::setUserValue($uid,'contacts','openaddressbooks',$prefbooks); } + $prefbooks = OCP\Config::getUserValue($uid,'contacts','openaddressbooks',null); return explode(';',$prefbooks); } @@ -195,7 +194,7 @@ class OC_Contacts_Addressbook{ $stmt = OCP\DB::prepare( $prep ); $result = $stmt->execute($active); } catch(Exception $e) { - OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OCP\Util::DEBUG); + OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OCP\Util::ERROR); OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active, ids: '.join(',', $active),OCP\Util::DEBUG); OCP\Util::writeLog('contacts','OC_Contacts_Addressbook::active, SQL:'.$prep,OCP\Util::DEBUG); } @@ -210,7 +209,7 @@ class OC_Contacts_Addressbook{ /** * @brief Activates an addressbook * @param integer $id - * @param integer $name + * @param boolean $active * @return boolean */ public static function setActive($id,$active){ @@ -256,11 +255,15 @@ class OC_Contacts_Addressbook{ * @return boolean */ public static function delete($id){ - // FIXME: There's no error checking at all. self::setActive($id, false); - $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' ); - $stmt->execute(array($id)); - + try { + $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' ); + $stmt->execute(array($id)); + } catch(Exception $e) { + OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:delete:, exception for '.$id.': '.$e->getMessage(),OCP\Util::ERROR); + return false; + } + $cards = OC_Contacts_VCard::all($id); foreach($cards as $card){ OC_Contacts_VCard::delete($card['id']); diff --git a/apps/contacts/lib/hooks.php b/apps/contacts/lib/hooks.php index e3d5df3d51..e74b465a47 100644 --- a/apps/contacts/lib/hooks.php +++ b/apps/contacts/lib/hooks.php @@ -56,7 +56,7 @@ class OC_Contacts_Hooks{ static public function getBirthdayEvents($parameters) { $name = $parameters['calendar_id']; - if (strpos('birthday_', $name) != 0) { + if (strpos($name, 'birthday_') != 0) { return; } $info = explode('_', $name); diff --git a/apps/contacts/lib/search.php b/apps/contacts/lib/search.php index 144138a7c2..19330fa9be 100644 --- a/apps/contacts/lib/search.php +++ b/apps/contacts/lib/search.php @@ -2,17 +2,10 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{ function search($query){ $addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1); -// if(count($calendars)==0 || !OCP\App::isEnabled('contacts')){ -// //return false; -// } - // NOTE: Does the following do anything - $results=array(); - $searchquery=array(); - if(substr_count($query, ' ') > 0){ - $searchquery = explode(' ', $query); - }else{ - $searchquery[] = $query; + if(count($addressbooks)==0 || !OCP\App::isEnabled('contacts')){ + return array(); } + $results=array(); $l = new OC_l10n('contacts'); foreach($addressbooks as $addressbook){ $vcards = OC_Contacts_VCard::all($addressbook['id']); diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 71a874d783..110d721ace 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -56,7 +56,7 @@ class OC_Contacts_VCard{ $stmt = OCP\DB::prepare( $prep ); $result = $stmt->execute($id); } catch(Exception $e) { - OCP\Util::writeLog('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OCP\Util::DEBUG); + OCP\Util::writeLog('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OCP\Util::ERROR); OCP\Util::writeLog('contacts','OC_Contacts_VCard:all, ids: '.join(',', $id),OCP\Util::DEBUG); OCP\Util::writeLog('contacts','SQL:'.$prep,OCP\Util::DEBUG); } diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 7d212e71ba..d16356d4a5 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -3,16 +3,15 @@ var categories = ; var lang = ''; -
    -
      - inc("part.contacts"); ?> -
    -
    -
    -
    - - -
    +
    +
    +
    +
    +
    + + +
    +
    - + - + - + -
    @@ -121,19 +121,3 @@ $id = isset($_['id']) ? $_['id'] : '';
    - diff --git a/apps/contacts/templates/part.contacts.php b/apps/contacts/templates/part.contacts.php index 00a61f72fd..f0b14c8e5f 100644 --- a/apps/contacts/templates/part.contacts.php +++ b/apps/contacts/templates/part.contacts.php @@ -1,12 +1,10 @@ - $addressbook) { + echo '

    '.$addressbook['displayname'].'

    '; + echo ''; +} ?> -
  • - diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php index 1079afc808..6d7b1e4477 100644 --- a/apps/contacts/templates/part.cropphoto.php +++ b/apps/contacts/templates/part.cropphoto.php @@ -4,7 +4,7 @@ $tmpkey = $_['tmpkey']; $requesttoken = $_['requesttoken']; OCP\Util::writeLog('contacts','templates/part.cropphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG); ?> -

    +?>
    addTile(new \OC\Pictures\TileSingle($root.$images[$i])); - continue; - } - if (strcmp($prev_dir_arr[0], $dir_arr[0])!=0) { - $tl->addTile(new \OC\Pictures\TileStack($arr, $prev_dir_arr[0])); - $arr = array(); - } - $arr[] = $root.$images[$i]; - $previous_element = $images[$i]; -} - -$dir_arr = explode('/', $previous_element); - -if (count($images)>1 && count($dir_arr) > 1) { - if (count($dir_arr) && $ts->getCount() == 0){ - $ts = new \OC\Pictures\TileStack(array($root.$previous_element), $dir_arr[0]); - } else { - $arr[] = $previous_element; - $ts->addTile($arr); - } -} - -if ($ts->getCount() != 0) { - $tl->addTile($ts); -} - -echo $tl->get(); +echo $_['tl']->get(); ?>
    diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index a229c17e80..23abc57927 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -46,6 +46,9 @@ if(!isset($arguments['album'])){ if(!isset($arguments['search'])){ $arguments['search']=''; } + +session_write_close(); + OC_MEDIA_COLLECTION::$uid=OCP\USER::getUser(); if($arguments['action']){ switch($arguments['action']){ diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js index 03d577c7c9..161fc0c681 100644 --- a/apps/media/js/collection.js +++ b/apps/media/js/collection.js @@ -97,13 +97,13 @@ Collection={ if(artist.name && artist.songs.length>0){ var tr=template.clone().removeClass('template'); if(artist.songs.length>1){ - tr.find('td.title a').text(artist.songs.length+' '+t('media','songs')); - tr.find('td.album a').text(artist.albums.length+' '+t('media','albums')); + tr.find('td.title a').html(artist.songs.length+' '+t('media','songs')); + tr.find('td.album a').html(artist.albums.length+' '+t('media','albums')); }else{ - tr.find('td.title a').text(artist.songs[0].name); - tr.find('td.album a').text(artist.albums[0].name); + tr.find('td.title a').html(artist.songs[0].name); + tr.find('td.album a').html(artist.albums[0].name); } - tr.find('td.artist a').text(artist.name); + tr.find('td.artist a').html(artist.name); tr.data('artistData',artist); tr.find('td.artist a').click(function(event){ event.preventDefault(); diff --git a/apps/media/js/player.js b/apps/media/js/player.js index ad40683083..867ea80236 100644 --- a/apps/media/js/player.js +++ b/apps/media/js/player.js @@ -40,7 +40,7 @@ var PlayList={ PlayList.init(items[index].type,null); // init calls load that calls play }else{ PlayList.player.jPlayer("setMedia", items[PlayList.current]); - $(".jp-current-song").text(items[PlayList.current].name); + $(".jp-current-song").html(items[PlayList.current].name); items[index].playcount++; PlayList.player.jPlayer("play",time); if(index>0){ diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php index 82170e5ca8..a8218c3a4d 100644 --- a/apps/media/lib_scanner.php +++ b/apps/media/lib_scanner.php @@ -79,19 +79,19 @@ class OC_MEDIA_SCANNER{ OCP\Util::writeLog('media',"error reading artist tag in '$file'",OCP\Util::WARN); $artist='unknown'; }else{ - $artist=strip_tags(stripslashes($data['comments']['artist'][0])); + $artist=OCP\Util::sanitizeHTML(stripslashes($data['comments']['artist'][0])); } if(!isset($data['comments']['album'])){ OCP\Util::writeLog('media',"error reading album tag in '$file'",OCP\Util::WARN); $album='unknown'; }else{ - $album=strip_tags(stripslashes($data['comments']['album'][0])); + $album=OCP\Util::sanitizeHTML(stripslashes($data['comments']['album'][0])); } if(!isset($data['comments']['title'])){ OCP\Util::writeLog('media',"error reading title tag in '$file'",OCP\Util::WARN); $title='unknown'; }else{ - $title=strip_tags(stripslashes($data['comments']['title'][0])); + $title=OCP\Util::sanitizeHTML(stripslashes($data['comments']['title'][0])); } $size=$data['filesize']; if (isset($data['comments']['track'])) diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index 78bc5b4656..a3117b5a41 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -166,7 +166,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend { $result[] = OC_LDAP::dn2username($ldap_users[0]); continue; } else { - $result[] = OC_LDAP::dn2username($member); + if($ocname = OC_LDAP::dn2username($member)){ + $result[] = $ocname; + } } } if(!$isMemberUid) { diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php index befdf267bc..aa104eb512 100644 --- a/apps/user_ldap/lib_ldap.php +++ b/apps/user_ldap/lib_ldap.php @@ -166,11 +166,14 @@ class OC_LDAP { * @brief returns the internal ownCloud name for the given LDAP DN of the group * @param $dn the dn of the group object * @param $ldapname optional, the display name of the object - * @returns string with with the name to use in ownCloud + * @returns string with with the name to use in ownCloud, false on DN outside of search DN * * returns the internal ownCloud name for the given LDAP DN of the group */ static public function dn2groupname($dn, $ldapname = null) { + if(strrpos($dn, self::$ldapBaseGroups) !== (strlen($dn)-strlen(self::$ldapBaseGroups))) { + return false; + } return self::dn2ocname($dn, $ldapname, false); } @@ -180,9 +183,12 @@ class OC_LDAP { * @param $ldapname optional, the display name of the object * @returns string with with the name to use in ownCloud * - * returns the internal ownCloud name for the given LDAP DN of the user + * returns the internal ownCloud name for the given LDAP DN of the user, false on DN outside of search DN */ static public function dn2username($dn, $ldapname = null) { + if(strrpos($dn, self::$ldapBaseUsers) !== (strlen($dn)-strlen(self::$ldapBaseUsers))) { + return false; + } return self::dn2ocname($dn, $ldapname, true); } diff --git a/apps/user_migrate/admin.php b/apps/user_migrate/admin.php deleted file mode 100644 index df8bff01c8..0000000000 --- a/apps/user_migrate/admin.php +++ /dev/null @@ -1,87 +0,0 @@ -. - * - */ -OCP\User::checkAdminUser(); -OCP\App::checkAppEnabled('user_migrate'); - -// Import? -if (isset($_POST['user_import'])) { - - $root = OC::$SERVERROOT . "/"; - $importname = "owncloud_import_" . date("y-m-d_H-i-s"); - - // Save data dir for later - $datadir = OCP\Config::getSystemValue( 'datadirectory' ); - - // Copy the uploaded file - $from = $_FILES['owncloud_import']['tmp_name']; - $to = get_temp_dir().'/'.$importname.'.zip'; - if( !move_uploaded_file( $from, $to ) ){ - $error = array('error'=>'Failed to move the uploaded file','hint'=>'Try checking the permissions of the '.get_temp_dir().' dir.'); - OCP\Util::writeLog( 'user_migrate', "Failed to copy the uploaded file", OCP\Util::ERROR ); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } - $response = json_decode( OC_Migrate::import( $to, 'user' ) ); - if( !$response->success ){ - $error = array('error'=>'There was an error while importing the user!','hint'=>'Please check the logs for a more detailed explaination'); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } else { - // Check import status - foreach( $response->data as $app => $status ){ - if( $status != 'true' ){ - // It failed for some reason - if( $status == 'notsupported' ){ - $notsupported[] = $app; - } else if( !$status ){ - $failed[] = $app; - } - } - } - // Any problems? - if( isset( $notsupported ) || isset( $failed ) ){ - if( count( $failed ) > 0 ){ - $error = array('error'=>'Some app data failed to import','hint'=>'App data for: '.implode(', ', $failed).' failed to import.'); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } else if( count( $notsupported ) > 0 ){ - $error = array('error'=>'Some app data could not be imported, as the apps are not installed on this instance','hint'=>'App data for: '.implode(', ', $notsupported).' failed to import as they were not found. Please install the apps and try again'); - $tmpl = new OCP\Template('user_migrate', 'admin'); - $tmpl->assign('error',$error); - return $tmpl->fetchPage(); - } - } else { - // Went swimmingly! - $tmpl = new OCP\Template('user_migrate', 'admin'); - return $tmpl->fetchPage(); - } - } - -} else { -// fill template - $tmpl = new OCP\Template('user_migrate', 'admin'); - return $tmpl->fetchPage(); -} diff --git a/apps/user_migrate/appinfo/app.php b/apps/user_migrate/appinfo/app.php index e57bfc2a9d..9d314b59ce 100644 --- a/apps/user_migrate/appinfo/app.php +++ b/apps/user_migrate/appinfo/app.php @@ -22,7 +22,6 @@ */ OCP\App::registerPersonal( 'user_migrate', 'settings' ); -OCP\App::registerAdmin( 'user_migrate', 'admin' ); OCP\Util::addscript( 'user_migrate', 'export'); // add settings page to navigation @@ -32,4 +31,4 @@ $entry = array( 'href' => OCP\Util::linkTo( "user_migrate", "admin.php" ), 'name' => 'Import' ); -?> \ No newline at end of file +?> diff --git a/apps/user_migrate/settings.php b/apps/user_migrate/settings.php index 8edd035338..098927fa17 100644 --- a/apps/user_migrate/settings.php +++ b/apps/user_migrate/settings.php @@ -23,7 +23,67 @@ * */ OCP\App::checkAppEnabled('user_migrate'); +if (isset($_POST['user_import'])) { + $root = OC::$SERVERROOT . "/"; + $importname = "owncloud_import_" . date("y-m-d_H-i-s"); + + // Save data dir for later + $datadir = OCP\Config::getSystemValue( 'datadirectory' ); + + // Copy the uploaded file + $from = $_FILES['owncloud_import']['tmp_name']; + $to = get_temp_dir().'/'.$importname.'.zip'; + if( !move_uploaded_file( $from, $to ) ){ -// fill template -$tmpl = new OCP\Template('user_migrate', 'settings'); -return $tmpl->fetchPage(); \ No newline at end of file + $error = array('error'=>'Failed to move the uploaded file','hint'=>'Try checking the permissions of the '.get_temp_dir().' dir.'); + OCP\Util::writeLog( 'user_migrate', "Failed to copy the uploaded file", OCP\Util::ERROR ); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } + + + $response = json_decode( OC_Migrate::import( $to, 'user' ) ); + if( !$response->success ){ + $error = array('error'=>'There was an error while importing the user!','hint'=>'Please check the logs for a more detailed explaination'); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } else { + // Check import status + foreach( $response->data as $app => $status ){ + if( $status != 'true' ){ + // It failed for some reason + if( $status == 'notsupported' ){ + $notsupported[] = $app; + } else if( !$status ){ + $failed[] = $app; + } + } + } + // Any problems? + if( isset( $notsupported ) || isset( $failed ) ){ + if( count( $failed ) > 0 ){ + $error = array('error'=>'Some app data failed to import','hint'=>'App data for: '.implode(', ', $failed).' failed to import.'); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } else if( count( $notsupported ) > 0 ){ + $error = array('error'=>'Some app data could not be imported, as the apps are not installed on this instance','hint'=>'App data for: '.implode(', ', $notsupported).' failed to import as they were not found. Please install the apps and try again'); + $tmpl = new OCP\Template('user_migrate', 'settings'); + $tmpl->assign('error',$error); + //return $tmpl->fetchPage(); + } + } else { + // Went swimmingly! + $tmpl = new OCP\Template('user_migrate', 'settings'); + //return $tmpl->fetchPage(); + } + + } + +} else { + // fill template + $tmpl = new OCP\Template('user_migrate', 'settings'); + return $tmpl->fetchPage(); +} \ No newline at end of file diff --git a/apps/user_migrate/templates/admin.php b/apps/user_migrate/templates/admin.php deleted file mode 100644 index ff51f43ffd..0000000000 --- a/apps/user_migrate/templates/admin.php +++ /dev/null @@ -1,13 +0,0 @@ -
    -
    - -

    -

    - - t('Import user account');?> -

    -

    -

    - -
    -
    diff --git a/apps/user_migrate/templates/settings.php b/apps/user_migrate/templates/settings.php index 8f1fe41df0..1718abe9e0 100644 --- a/apps/user_migrate/templates/settings.php +++ b/apps/user_migrate/templates/settings.php @@ -4,3 +4,16 @@

    +
    +
    + +

    +

    + + t('Import user account');?> +

    +

    +

    + +
    +
    diff --git a/apps/user_openid/appinfo/info.xml b/apps/user_openid/appinfo/info.xml index 268af23973..7aae4271fa 100644 --- a/apps/user_openid/appinfo/info.xml +++ b/apps/user_openid/appinfo/info.xml @@ -8,6 +8,7 @@ 4 true + diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index 67cbba54a4..6b64a7e286 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -17,13 +17,6 @@ header("Content-Type: application/xrd+json"); * '* but can also use complex database queries to generate the webfinger result **/ -// calculate the documentroot -// modified version of the one in lib/base.php that takes the .well-known symlink into account -/*$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); -$SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__))))); -$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); -$WEBROOT=substr($SUBURI,0,-34); -*/ $userName = ''; $hostName = ''; diff --git a/core/css/styles.css b/core/css/styles.css index b6b5918d65..44fd1e084f 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -16,7 +16,7 @@ body { background:#fefefe; font:normal .8em/1.6em "Lucida Grande", Arial, Verdan /* HEADERS */ -#body-user #header, #body-settings #header { position:fixed; top:0; z-index:100; width:100%; height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; } +#body-user #header, #body-settings #header { position:fixed; top:0; left:0; right:0; z-index:100; height:2.5em; line-height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; } #body-login #header { margin: -2em auto 0; text-align:center; height:10em; padding:1em 0 .5em; -moz-box-shadow:0 0 1em rgba(0, 0, 0, .5); -webkit-box-shadow:0 0 1em rgba(0, 0, 0, .5); box-shadow:0 0 1em rgba(0, 0, 0, .5); background: #1d2d44; /* Old browsers */ @@ -28,8 +28,9 @@ background: -ms-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* IE10+ */ background: linear-gradient(top, #35537a 0%,#1d2d42 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', endColorstr='#1d2d42',GradientType=0 ); /* IE6-9 */ } -#owncloud { float:left; } - +#owncloud { float:left; vertical-align:middle; } +.header-right { float:right; vertical-align:middle; padding:0 0.5em; } +.header-right > * { vertical-align:middle; } /* INPUTS */ input[type="text"], input[type="password"] { cursor:text; } @@ -49,7 +50,7 @@ input[type="checkbox"] { width:auto; } #body-login input[type="text"], #body-login input[type="password"] { width: 13em; } #body-login input.login { width: auto; float: right; } #remember_login { margin:.8em .2em 0 1em; } -.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:3em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70);opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; } +.searchbox input[type="search"] { font-size:1.2em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70);opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; } input[type="submit"].enabled { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; } 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; } #select_all{ margin-top: .4em !important;} @@ -101,8 +102,6 @@ label.infield { cursor: text !important; } #expand { position:relative; z-index:100; margin-bottom:-.5em; padding:.5em 10.1em .7em 1.2em; cursor:pointer; } #expand+span { position:absolute; z-index:99; margin:-1.7em 0 0 2.5em; font-size:1.2em; color:#666; text-shadow:#f8f8f8 0 1px 0; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; } #expand:hover+span, #expand+span:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; cursor:pointer; } -#logout { position:absolute; right:0; top:0; padding:1.2em 2em .55em 1.2em; } - /* VARIOUS REUSABLE SELECTORS */ .hidden { display:none; } @@ -112,8 +111,8 @@ label.infield { cursor: text !important; } .action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter:alpha(opacity=50); opacity:.5; -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; } .action { width: 16px; height: 16px; } -#logout { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; } -.action:hover, .selectedActions a:hover, #logout:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } +.header-action { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; } +.action:hover, .selectedActions a:hover, .header-action:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } table:not(.nostyle) tr { -webkit-transition:background-color 200ms; -moz-transition:background-color 200ms; -o-transition:background-color 200ms; transition:background-color 200ms; } tbody tr:hover, tr:active { background-color:#f8f8f8; } diff --git a/core/minimizer.php b/core/minimizer.php index 6828acc87d..0abbca7502 100644 --- a/core/minimizer.php +++ b/core/minimizer.php @@ -1,14 +1,15 @@ findFiles(OC_Util::$core_styles); - $minimizer->output($files); + $files = OC_TemplateLayout::findStylesheetFiles(OC_Util::$core_styles); + $minimizer->output($files, $service); } else if ($service == 'core.js'){ $minimizer = new OC_Minimizer_JS(); - $files = $minimizer->findFiles(OC_Util::$core_scripts); - $minimizer->output($files); + $files = OC_TemplateLayout::findJavascriptFiles(OC_Util::$core_scripts); + $minimizer->output($files, $service); } diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index fabc28f663..d6911fd1e1 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -45,10 +45,10 @@