diff options
Diffstat (limited to 'p')
| -rw-r--r-- | p/api/greader.php | 62 | ||||
| -rw-r--r-- | p/api/index.php | 3 | ||||
| -rw-r--r-- | p/api/pshb.php | 2 | ||||
| -rw-r--r-- | p/scripts/category.js | 2 | ||||
| -rw-r--r-- | p/scripts/global_view.js | 3 | ||||
| -rw-r--r-- | p/scripts/main.js | 39 | ||||
| -rw-r--r-- | p/themes/base-theme/README.md | 2 | ||||
| -rw-r--r-- | p/themes/base-theme/template.css | 16 |
8 files changed, 88 insertions, 41 deletions
diff --git a/p/api/greader.php b/p/api/greader.php index e1f4202a7..b87fcc225 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -2,10 +2,10 @@ /** == Description == Server-side API compatible with Google Reader API layer 2 - for the FreshRSS project http://freshrss.org + for the FreshRSS project https://freshrss.org == Credits == -* 2014-03: Released by Alexandre Alapetite http://alexandre.alapetite.fr +* 2014-03: Released by Alexandre Alapetite https://alexandre.alapetite.fr under GNU AGPL 3 license http://www.gnu.org/licenses/agpl-3.0.html == Documentation == @@ -23,7 +23,7 @@ Server-side API compatible with Google Reader API layer 2 require('../../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader -$ORIGINAL_INPUT = file_get_contents('php://input', false, null, -1, 1048576); +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576); if (PHP_INT_SIZE < 8) { //32-bit function dec2hex($dec) { @@ -86,7 +86,7 @@ function debugInfo() { if (function_exists('getallheaders')) { $ALL_HEADERS = getallheaders(); } else { //nginx http://php.net/getallheaders#84262 - $ALL_HEADERS = ''; + $ALL_HEADERS = array(); foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) === 'HTTP_') { $ALL_HEADERS[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; @@ -94,7 +94,16 @@ function debugInfo() { } } global $ORIGINAL_INPUT; - return print_r(array('date' => date('c'), 'headers' => $ALL_HEADERS, '_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE, 'INPUT' => $ORIGINAL_INPUT), true); + return print_r( + array( + 'date' => date('c'), + 'headers' => $ALL_HEADERS, + '_SERVER' => $_SERVER, + '_GET' => $_GET, + '_POST' => $_POST, + '_COOKIE' => $_COOKIE, + 'INPUT' => $ORIGINAL_INPUT + ), true); } function badRequest() { @@ -503,7 +512,7 @@ function streamContents($path, $include_target, $start_time, $count, $order, $ex $item = array( 'id' => /*'tag:google.com,2005:reader/item/' .*/ dec2hex($entry->id()), //64-bit hexa http://code.google.com/p/google-reader-api/wiki/ItemId 'crawlTimeMsec' => substr($entry->id(), 0, -3), - 'timestampUsec' => $entry->id(), //EasyRSS + 'timestampUsec' => '' . $entry->id(), //EasyRSS 'published' => $entry->date(true), 'title' => $entry->title(), 'summary' => array('content' => $entry->content()), @@ -694,8 +703,8 @@ $pathInfo = empty($_SERVER['PATH_INFO']) ? '/Error' : urldecode($_SERVER['PATH_I $pathInfos = explode('/', $pathInfo); Minz_Configuration::register('system', - DATA_PATH . '/config.php', - FRESHRSS_PATH . '/config.default.php'); + DATA_PATH . '/config.php', + FRESHRSS_PATH . '/config.default.php'); FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); if (!FreshRSS_Context::$system_conf->api_enabled) { serviceUnavailable(); @@ -715,24 +724,34 @@ Minz_Session::_param('currentUser', $user); if (count($pathInfos) < 3) { badRequest(); -} -elseif ($pathInfos[1] === 'accounts') { +} elseif ($pathInfos[1] === 'accounts') { if (($pathInfos[2] === 'ClientLogin') && isset($_REQUEST['Email']) && isset($_REQUEST['Passwd'])) { clientLogin($_REQUEST['Email'], $_REQUEST['Passwd']); } -} -elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) { +} elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) { if ($user == '') { unauthorized(); } $timestamp = isset($_GET['ck']) ? intval($_GET['ck']) : 0; //ck=[unix timestamp] : Use the current Unix time here, helps Google with caching. switch ($pathInfos[4]) { case 'stream': - $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; //xt=[exclude target] : Used to exclude certain items from the feed. For example, using xt=user/-/state/com.google/read will exclude items that the current user has marked as read, or xt=feed/[feedurl] will exclude items from a particular feed (obviously not useful in this request, but xt appears in other listing requests). + /* xt=[exclude target] : Used to exclude certain items from the feed. + * For example, using xt=user/-/state/com.google/read will exclude items + * that the current user has marked as read, or xt=feed/[feedurl] will + * exclude items from a particular feed (obviously not useful in this + * request, but xt appears in other listing requests). */ + $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; $count = isset($_GET['n']) ? intval($_GET['n']) : 20; //n=[integer] : The maximum number of results to return. $order = isset($_GET['r']) ? $_GET['r'] : 'd'; //r=[d|n|o] : Sort order of item results. d or n gives items in descending date order, o in ascending order. - $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; //ot=[unix timestamp] : The time from which you want to retrieve items. Only items that have been crawled by Google Reader after this time will be returned. - $continuation = isset($_GET['c']) ? $_GET['c'] : ''; //Continuation token. If a StreamContents response does not represent all items in a timestamp range, it will have a continuation attribute. The same request can be re-issued with the value of that attribute put in this parameter to get more items + /* ot=[unix timestamp] : The time from which you want to retrieve + * items. Only items that have been crawled by Google Reader after + * this time will be returned. */ + $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; + /* Continuation token. If a StreamContents response does not represent + * all items in a timestamp range, it will have a continuation attribute. + * The same request can be re-issued with the value of that attribute put + * in this parameter to get more items */ + $continuation = isset($_GET['c']) ? $_GET['c'] : ''; if (isset($pathInfos[5]) && $pathInfos[5] === 'contents' && isset($pathInfos[6])) { if (isset($pathInfos[7])) { if ($pathInfos[6] === 'feed') { @@ -757,7 +776,10 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo } } elseif ($pathInfos[5] === 'items') { if ($pathInfos[6] === 'ids' && isset($_GET['s'])) { - $streamId = $_GET['s']; //StreamId for which to fetch the item IDs. The parameter may be repeated to fetch the item IDs from multiple streams at once (more efficient from a backend perspective than multiple requests). + /* StreamId for which to fetch the item IDs. The parameter may + * be repeated to fetch the item IDs from multiple streams at once + * (more efficient from a backend perspective than multiple requests). */ + $streamId = $_GET['s']; streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target); } } @@ -779,8 +801,12 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo break; case 'edit': if (isset($_POST['s']) && isset($_POST['ac'])) { - $streamNames = multiplePosts('s'); //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once - $titles = multiplePosts('t'); //Title to use for the subscription. For the `subscribe` action, if not specified then the feed's current title will be used. Can be used with the `edit` action to rename a subscription + //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once + $streamNames = multiplePosts('s'); + /* Title to use for the subscription. For the `subscribe` action, + * if not specified then the feed's current title will be used. Can + * be used with the `edit` action to rename a subscription */ + $titles = multiplePosts('t'); $action = $_POST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit` $add = isset($_POST['a']) ? $_POST['a'] : ''; //StreamId to add the subscription to (generally a user label) $remove = isset($_POST['r']) ? $_POST['r'] : ''; //StreamId to remove the subscription from (generally a user label) diff --git a/p/api/index.php b/p/api/index.php index 580c90255..08f7b6b7b 100644 --- a/p/api/index.php +++ b/p/api/index.php @@ -22,7 +22,8 @@ echo Minz_Url::display('/api/greader.php', 'html', true); </dl> <ul> <li><a href="greader.php/check%2Fcompatibility" rel="nofollow">Check full server configuration</a></li> -<li><a href="greader.php/check/compatibility" rel="nofollow">Check partial server configuration (without <code>%2F</code> support)</a></li> +<li><a href="greader.php/check/compatibility" rel="nofollow">Check partial server +configuration (without <code>%2F</code> support)</a></li> </ul> </body> diff --git a/p/api/pshb.php b/p/api/pshb.php index 4b546908a..ed8326cf5 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -11,7 +11,7 @@ function logMe($text) { file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); } -$ORIGINAL_INPUT = file_get_contents('php://input', false, null, -1, MAX_PAYLOAD); +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, MAX_PAYLOAD); //logMe(print_r(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true)); diff --git a/p/scripts/category.js b/p/scripts/category.js index fbcd83a01..caa4fa22f 100644 --- a/p/scripts/category.js +++ b/p/scripts/category.js @@ -92,7 +92,7 @@ function init_draggable() { $.ajax({ type: 'POST', url: './?c=feed&a=move', - data : { + data: { f_id: dragFeedId, c_id: e.target.parentNode.getAttribute('data-cat-id'), _csrf: context.csrf, diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index de0b9cb9f..c5aaa48b1 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -33,6 +33,9 @@ function load_panel(link) { $.ajax({ type: "POST", url: $(this).attr("formaction"), + data: { + _csrf: context.csrf, + }, async: false }); window.location.reload(false); diff --git a/p/scripts/main.js b/p/scripts/main.js index 5be7bc36b..278ecfee9 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1,6 +1,6 @@ "use strict"; -/* globals context, i18n, shortcut, shortcuts, url */ -/* jshint globalstrict: true */ +/* globals $, jQuery, context, i18n, shortcut, shortcuts, url */ +/* jshint strict:global */ var $stream = null, isCollapsed = true, @@ -133,7 +133,7 @@ function mark_read(active, only_not_read) { $.ajax({ type: 'POST', url: url, - data : { + data: { ajax: true, _csrf: context.csrf, }, @@ -182,7 +182,7 @@ function mark_favorite(active) { $.ajax({ type: 'POST', url: url, - data : { + data: { ajax: true, _csrf: context.csrf, }, @@ -227,6 +227,7 @@ function toggleContent(new_active, old_active) { if (context.does_lazyload) { new_active.find('img[data-original], iframe[data-original]').each(function () { + this.onload = function () { $(document.body).trigger("sticky_kit:recalc"); }; this.setAttribute('src', this.getAttribute('data-original')); this.removeAttribute('data-original'); }); @@ -265,11 +266,9 @@ function toggleContent(new_active, old_active) { new_pos += old_scroll; } - if (old_active[0] !== new_active[0]) { - new_active.children(".flux_content").first().each(function () { - box_to_move.scrollTop(new_pos).scrollTop(); - }); - } + new_active.children(".flux_content").first().each(function () { + box_to_move.scrollTop(new_pos).scrollTop(); + }); } else { if (relative_move) { new_pos += old_scroll; @@ -385,13 +384,8 @@ function last_category() { } function collapse_entry() { - isCollapsed = !isCollapsed; - var flux_current = $(".flux.current"); - flux_current.toggleClass("active"); - if (isCollapsed && context.auto_mark_article) { - mark_read(flux_current, true); - } + toggleContent(flux_current, flux_current); } function user_filter(key) { @@ -541,9 +535,18 @@ function init_column_categories() { feed_web = $(this).data('fweb'), template = $('#feed_config_template').html().replace(/------/g, feed_id).replace('http://example.net/', feed_web); $(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template); + $('.tree-folder-items .dropdown-close a').click(function(){ + $('.tree').removeClass('treepadding'); + $(document.body).trigger("sticky_kit:recalc"); + }); } }); + $('.tree-folder-items .dropdown-toggle').click(function(){ + $('.tree').addClass('treepadding'); + $(document.body).trigger("sticky_kit:recalc"); + }); + init_sticky_column(); } @@ -813,7 +816,7 @@ function updateFeed(feeds, feeds_count) { $.ajax({ type: 'POST', url: feed.url, - data : { + data: { _csrf: context.csrf, noCommit: feeds.length > 0 ? 1 : 0, }, @@ -850,7 +853,7 @@ function init_actualize() { $.ajax({ //Empty request to force refresh server database cache type: 'POST', url: './?c=feed&a=actualize&id=-1', - data : { + data: { _csrf: context.csrf, noCommit: 0, }, @@ -1289,7 +1292,7 @@ function init_slider_observers() { $.ajax({ type: 'GET', url: url_slide, - data : { ajax: true } + data: { ajax: true } }).done(function (data) { slider.html(data); closer.addClass('active'); diff --git a/p/themes/base-theme/README.md b/p/themes/base-theme/README.md index 9f7d635ca..632d11d05 100644 --- a/p/themes/base-theme/README.md +++ b/p/themes/base-theme/README.md @@ -1,7 +1,7 @@ FreshRSS-base-theme =================== -A base theme for [FreshRSS](http://freshrss.org) +A base theme for [FreshRSS](https://freshrss.org) 1. Custom ```base.css``` file with colors, backgrounds and borders 2. Change information in ```metadata.json``` file (at least, give a name!) diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 277bb61b2..320ad2d9b 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -346,10 +346,15 @@ a.btn { /*=== Tree */ .tree { margin: 0; - padding: 0 0 15em 0; + padding: 0 0 2em 0; list-style: none; text-align: left; } + +.treepadding { + padding: 0 0 15em 0; +} + .tree-folder-items { padding: 0; list-style: none; @@ -830,6 +835,15 @@ input:checked + .slide-container .properties { .no-mobile { display: none; } + .dropdown .dropdown-menu { + border-radius: 0; + bottom: 0; + position: fixed; + width: 100%; + } + .dropdown-menu::after { + display: none; + } .aside .toggle_aside, .nav-login { display: block; |
