diff --git a/README.markdown b/README.markdown index 9947c17..60e2472 100644 --- a/README.markdown +++ b/README.markdown @@ -20,6 +20,7 @@ Features - Keyboard shortcuts (pressing '?' displays a pop-up listing the shortcuts; pressing 'q' closes it) - Basic bookmarks - Translated in English, French, German, Italian, Czech, Spanish, Portuguese and Simplified Chinese +- RTL language support - Themes support - Alternative login with a Google Account or Mozilla Persona - **Full article download for feeds that display only a summary** (website scraper based on Xpath rules) @@ -98,7 +99,6 @@ Libraries used - [PicoFeed](https://github.com/fguillot/picoFeed) - [PicoFarad](https://github.com/fguillot/picoFarad) -- [PicoTools](https://github.com/fguillot/picoTools) - [PicoDb](https://github.com/fguillot/picoDb) - [SimpleValidator](https://github.com/fguillot/simpleValidator) - [PHP 5.5 password backport](https://github.com/ircmaxell/password_compat) diff --git a/assets/js/all.min.js b/assets/js/all.min.js index 71d57c2..601f3fe 100644 --- a/assets/js/all.min.js +++ b/assets/js/all.min.js @@ -6,7 +6,7 @@ a);b&&(b.innerHTML="");if(b=document.getElementById("last-checked-feed-"+a))b.in function(b){b=e.indexOf(b.feed_id);0<=b&&e.splice(b,1);0==a.length&&0==e.length&&(clearInterval(d),clearInterval(f),window.location.href="?action=unread")})}},100)}}}(); Miniflux.Item=function(){function d(b){var a=document.getElementById("item-"+b);a||(a=document.getElementById("current-item"),a.getAttribute("data-item-id")!=b&&(a=!1));return a}function c(b){if((b=document.getElementById("bookmark-"+b))&&b.getAttribute("data-reverse-label")){var a=b.innerHTML;b.innerHTML=b.getAttribute("data-reverse-label");b.setAttribute("data-reverse-label",a)}}function a(b){if(b=document.getElementById("status-"+b)){var a=b.innerHTML;b.innerHTML=b.getAttribute("data-reverse-label"); b.setAttribute("data-reverse-label",a)}}function e(b){"mouse"!=Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();b.parentNode.removeChild(b);if(b=document.getElementById("page-counter"))counter=parseInt(b.textContent.trim(),10)-1,0==counter?window.location="?action=unread":(b.textContent=counter+" ",document.title="miniflux ("+counter+")",document.getElementById("nav-counter").textContent="("+counter+")")}function f(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c= -d(b);if(c)if(c.getAttribute("data-hide"))e(c);else{c.setAttribute("data-item-status","read");a(b);if(c=document.getElementById("show-"+b)){c.className="read";var g=document.createElement("span");g.id="read-icon-"+b;g.appendChild(document.createTextNode("\u2611 "));c.parentNode.insertBefore(g,c)}(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-unread")}}};c.open("POST","?action=mark-item-read&id="+b,!0);c.send()}function h(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c= +d(b);if(c)if(c.getAttribute("data-hide"))e(c);else{c.setAttribute("data-item-status","read");a(b);if(c=document.getElementById("show-"+b)){c.className="read";var g=document.createElement("span");g.id="read-icon-"+b;g.appendChild(document.createTextNode("\u2714 "));c.parentNode.insertBefore(g,c)}(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-unread")}}};c.open("POST","?action=mark-item-read&id="+b,!0);c.send()}function h(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c= d(b);if(c)if(c.getAttribute("data-hide"))e(c);else{c.setAttribute("data-item-status","unread");a(b);if(c=document.getElementById("show-"+b))c.className="";(c=document.getElementById("read-icon-"+b))&&c.parentNode.removeChild(c);(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-read")}}};c.open("POST","?action=mark-item-unread&id="+b,!0);c.send()}function l(b,a){var e=b.getAttribute("data-item-id"),d=new XMLHttpRequest;d.onload=function(){b.setAttribute("data-item-bookmark", a);if(a)if(Miniflux.Nav.IsListing()){if(f=document.getElementById("show-"+e)){var d=document.createElement("span");d.id="bookmark-icon-"+e;d.appendChild(document.createTextNode("\u2605 "));f.parentNode.insertBefore(d,f)}c(e)}else{var f=document.getElementById("bookmark-"+e);f&&(f.innerHTML="\u2605")}else if(Miniflux.Nav.IsListing())(d=document.getElementById("bookmark-icon-"+e))&&d.parentNode.removeChild(d),c(e);else if(d=document.getElementById("bookmark-"+e))d.innerHTML="\u2606"};d.open("POST", "?action=bookmark&id="+e+"&value="+a,!0);d.send()}return{Get:d,MarkAsRead:f,MarkAsUnread:h,SwitchBookmark:function(b){"1"==b.getAttribute("data-item-bookmark")?l(b,0):l(b,1)},SwitchStatus:function(b){var a=b.getAttribute("data-item-id");b=b.getAttribute("data-item-status");"read"==b?h(a):"unread"==b&&f(a)},ChangeStatus:function(b,a){switch(a){case "read":f(b);break;case "unread":h(b)}},Show:function(b){(b=document.getElementById("show-"+b))&&b.click()},OpenOriginal:function(b){var a=document.getElementById("original-"+ diff --git a/assets/js/item.js b/assets/js/item.js index cf69c2a..899eb45 100644 --- a/assets/js/item.js +++ b/assets/js/item.js @@ -93,7 +93,7 @@ Miniflux.Item = (function() { var icon = document.createElement("span"); icon.id = "read-icon-" + item_id; - icon.appendChild(document.createTextNode("☑ ")); + icon.appendChild(document.createTextNode("✔ ")); link.parentNode.insertBefore(icon, link); } diff --git a/common.php b/common.php index a89adca..5a893d3 100644 --- a/common.php +++ b/common.php @@ -1,7 +1,7 @@ - $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false)) ?> + $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false)) ?> - $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction)) ?> + $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction)) ?> \ No newline at end of file diff --git a/templates/config.php b/templates/config.php index c85b0a2..8bb810f 100644 --- a/templates/config.php +++ b/templates/config.php @@ -87,7 +87,7 @@
  • - +

    diff --git a/templates/show_help.php b/templates/show_help.php index d247fa0..4a82a2e 100644 --- a/templates/show_help.php +++ b/templates/show_help.php @@ -12,7 +12,7 @@

    - +
    diff --git a/templates/unread_items.php b/templates/unread_items.php index 007a38f..2224fd9 100644 --- a/templates/unread_items.php +++ b/templates/unread_items.php @@ -16,14 +16,14 @@
    - $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true)) ?> + $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true)) ?>
    - $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction)) ?> + $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction)) ?>
    diff --git a/vendor/PicoFarad/Response.php b/vendor/PicoFarad/Response.php index cb01296..9114fde 100644 --- a/vendor/PicoFarad/Response.php +++ b/vendor/PicoFarad/Response.php @@ -17,7 +17,9 @@ function content_type($mimetype) function status($status_code) { - if (strpos(php_sapi_name(), 'apache') !== false) { + $sapi_name = php_sapi_name(); + + if (strpos($sapi_name, 'apache') !== false || $sapi_name === 'cli-server') { header('HTTP/1.0 '.$status_code); } else { diff --git a/vendor/PicoFarad/Router.php b/vendor/PicoFarad/Router.php index 4794c9a..b62b8e2 100644 --- a/vendor/PicoFarad/Router.php +++ b/vendor/PicoFarad/Router.php @@ -104,12 +104,10 @@ function find_route($method, $route, \Closure $callback) { if ($_SERVER['REQUEST_METHOD'] === $method) { - if ($_SERVER['QUERY_STRING']) { - + if (! empty($_SERVER['QUERY_STRING'])) { $url = substr($_SERVER['REQUEST_URI'], 0, -(strlen($_SERVER['QUERY_STRING']) + 1)); } else { - $url = $_SERVER['REQUEST_URI']; } @@ -117,7 +115,7 @@ function find_route($method, $route, \Closure $callback) if (url_match($route, $url, $params)) { - before($handler); + before($route); \call_user_func_array($callback, $params); exit; } diff --git a/vendor/PicoTools/Template.php b/vendor/PicoFarad/Template.php similarity index 75% rename from vendor/PicoTools/Template.php rename to vendor/PicoFarad/Template.php index e4ec23d..c32be30 100644 --- a/vendor/PicoTools/Template.php +++ b/vendor/PicoFarad/Template.php @@ -1,36 +1,23 @@ 'value']); function load() { if (func_num_args() < 1 || func_num_args() > 2) { - die('Invalid template arguments'); } if (! file_exists(PATH.func_get_arg(0).'.php')) { - die('Unable to load the template: "'.func_get_arg(0).'"'); } if (func_num_args() === 2) { if (! is_array(func_get_arg(1))) { - die('Template variables must be an array'); } @@ -38,9 +25,7 @@ function load() } ob_start(); - include PATH.func_get_arg(0).'.php'; - return ob_get_clean(); } @@ -48,4 +33,4 @@ function load() function layout($template_name, array $template_args = array(), $layout_name = 'layout') { return load($layout_name, $template_args + array('content_for_layout' => load($template_name, $template_args))); -} \ No newline at end of file +} diff --git a/vendor/PicoTools/Command.php b/vendor/PicoTools/Command.php deleted file mode 100644 index 9f8597c..0000000 --- a/vendor/PicoTools/Command.php +++ /dev/null @@ -1,175 +0,0 @@ -cmd_line = $command; - } - - - /** - * Execute the command - * - * @access public - */ - public function execute() - { - $process = proc_open( - $this->cmd_line, - array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), - $pipes, - $this->cmd_dir, - $this->cmd_env - ); - - if (is_resource($process)) { - - $this->cmd_stdout = stream_get_contents($pipes[1]); - $this->cmd_stderr = stream_get_contents($pipes[2]); - $this->cmd_return = proc_close($process); - } - } - - - /** - * Set working directory - * - * @access public - * @param string $dir Working directory - */ - public function setDir($dir) - { - $this->cmd_dir = $dir; - } - - - /** - * Set command env variables - * - * @access public - * @param array $env Environnement variables - */ - public function setEnv(array $env) - { - $this->cmd_env = $env; - } - - - - /** - * Get the return value - * - * @access public - * @return integer Return value - */ - public function getReturnValue() - { - return $this->cmd_return; - } - - - /** - * Get stdout - * - * @access public - * @return string stdout - */ - public function getStdout() - { - return $this->cmd_stdout; - } - - - /** - * Get stderr - * - * @access public - * @return string stderr - */ - public function getStderr() - { - return $this->cmd_stderr; - } -} \ No newline at end of file diff --git a/vendor/PicoTools/Config.php b/vendor/PicoTools/Config.php deleted file mode 100644 index 0750829..0000000 --- a/vendor/PicoTools/Config.php +++ /dev/null @@ -1,97 +0,0 @@ - $max_length) { - return substr($value, 0, strpos($value, ' ', $max_length)).' '.$end; - } - else if ($length < $min_length) { - return ''; - } - - return $value; -} - -function in_list($id, array $listing) -{ - if (isset($listing[$id])) { - return escape($listing[$id]); - } - - return '?'; -} - -function relative_time($timestamp, $fallback_date_format = '%e %B %Y %k:%M') -{ - $diff = time() - $timestamp; - - if ($diff < 60) return \t('%d second'.($diff > 1 ? 's' : '').' ago', $diff); - - $diff = floor($diff / 60); - if ($diff < 60) return \t('%d minute'.($diff > 1 ? 's' : '').' ago', $diff); - - $diff = floor($diff / 60); - if ($diff < 24) return \t('%d hour'.($diff > 1 ? 's' : '').' ago', $diff); - - $diff = floor($diff / 24); - if ($diff < 7) return \t('%d day'.($diff > 1 ? 's' : '').' ago', $diff); - - $diff = floor($diff / 7); - if ($diff < 4) return \t('%d week'.($diff > 1 ? 's' : '').' ago', $diff); - - $diff = floor($diff / 4); - if ($diff < 12) return \t('%d month'.($diff > 1 ? 's' : '').' ago', $diff); - - return \dt($fallback_date_format, $timestamp); -} - -function error_class(array $errors, $name) -{ - return ! isset($errors[$name]) ? '' : ' form-error'; -} - -function error_list(array $errors, $name) -{ - $html = ''; - - if (isset($errors[$name])) { - - $html .= ''; - } - - return $html; -} - -function form_value($values, $name) -{ - if (isset($values->$name)) { - return 'value="'.escape($values->$name).'"'; - } - - return isset($values[$name]) ? 'value="'.escape($values[$name]).'"' : ''; -} - -function form_hidden($name, $values = array()) -{ - return ''; -} - -function form_default_select($name, array $options, $values = array(), array $errors = array(), $class = '') -{ - $options = array('' => '?') + $options; - return form_select($name, $options, $values, $errors, $class); -} - -function form_select($name, array $options, $values = array(), array $errors = array(), $class = '') -{ - $html = ''; - $html .= error_list($errors, $name); - - return $html; -} - -function form_radios($name, array $options, array $values = array()) -{ - $html = ''; - - foreach ($options as $value => $label) { - $html .= form_radio($name, $label, $value, isset($values[$name]) && $values[$name] == $value); - } - - return $html; -} - -function form_radio($name, $label, $value, $selected = false, $class = '') -{ - return ''; -} - -function form_checkbox($name, $label, $value, $checked = false, $class = '') -{ - return ''; -} - -function form_label($label, $name, $class = '') -{ - return ''; -} - -function form_textarea($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - $class .= error_class($errors, $name); - - $html = ''; - $html .= error_list($errors, $name); - - return $html; -} - -function form_input($type, $name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - $class .= error_class($errors, $name); - - $html = ''; - $html .= error_list($errors, $name); - - return $html; -} - -function form_text($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('text', $name, $values, $errors, $attributes, $class); -} - -function form_password($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('password', $name, $values, $errors, $attributes, $class); -} - -function form_email($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('email', $name, $values, $errors, $attributes, $class); -} - -function form_date($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('date', $name, $values, $errors, $attributes, $class); -} - -function form_number($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('number', $name, $values, $errors, $attributes, $class); -}