Skip to content

Commit

Permalink
Fix for unvisible settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Offerel committed Jul 17, 2020
1 parent aad95d8 commit 96f6f66
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"role": "Developer"
}
],
"version": "2.2.1",
"version": "2.2.2",
"repositories": [
{
"type": "composer",
Expand Down
4 changes: 3 additions & 1 deletion syncmarks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Roundcube Bookmarks Plugin
*
* @version 2.2.1
* @version 2.2.2
* @author Offerel
* @copyright Copyright (c) 2020, Offerel
* @license GNU General Public License, version 3
Expand All @@ -27,6 +27,7 @@ function bookmarks_cmd() {

function add_url(format) {
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
console.log(format);
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=" + format)
}

Expand All @@ -42,6 +43,7 @@ function get_bookmarks(response) {
}

function en_noti() {
console.log("test");
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
Expand Down
4 changes: 2 additions & 2 deletions syncmarks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions syncmarks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
/**
* Roundcube Bookmarks Plugin
*
* @version 2.2.1
* @version 2.2.2
* @author Offerel
* @copyright Copyright (c) 2020, Offerel
* @license GNU General Public License, version 3
*/
class syncmarks extends rcube_plugin
{
public $task = '?(?!login|logout).*';
{
public $task = '?(?!login).*';

public function init() {
$rcmail = rcmail::get_instance();
$this->load_config();
$this->add_texts('localization/', true);
$this->register_task('syncmarks');
$this->include_stylesheet($this->local_skin_path().'/plugin.css');
Expand Down Expand Up @@ -54,13 +55,17 @@ function bms_preferences_list($p) {
if ($p['section'] != 'syncmarks') {
return $p;
}

$rcmail = rcmail::get_instance();
$p['blocks']['main']['name']=$this->gettext('mainoptions');
$field_id='bms_notifications';
$input = new html_checkbox(array( 'name' => 'bms_notifications',
'onchange' => 'en_noti()',
'id' => 'bms_notifications',
'value' => 1));

$p['blocks']['main']['options']['bms_noti'] = array('title' => html::label($field_id, $this->gettext('bookmarks_not')),
'content' => $input->show(intval($rcmail->config->get('bms_notifications'))));
return $p;
}

Expand All @@ -80,8 +85,8 @@ function unset_cookie() {

function get_notifications() {
$rcmail = rcmail::get_instance();
$this->load_config();
if($_COOKIE['sycmarks_n'] != '1' && $rcmail->config->get('bms_notifications') == "1") {
//$this->load_config();
$path = $rcmail->config->get('bookmarks_path', false);
$filename = $rcmail->config->get('bookmarks_filename', false);

Expand Down Expand Up @@ -288,6 +293,7 @@ function get_title($url) {

function add_url() {
$rcmail = rcmail::get_instance();
$this->load_config();
$new_url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
$format = rcube_utils::get_input_value('_format', rcube_utils::INPUT_POST);
$path = $rcmail->config->get('bookmarks_path', false);
Expand Down Expand Up @@ -387,11 +393,11 @@ function add_url() {

function add_bookmarks() {
$rcmail = rcmail::get_instance();
$this->include_script('syncmarks.js');
$exctasks = array("login","logout");

if(!in_array($rcmail->task,$exctasks)) {
$this->load_config();
$this->include_script('syncmarks.js');
$filename = $rcmail->config->get('bookmarks_filename', false);
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$rcmail->output->add_footer("<div id=\"bookmarkpane\"></div>");
Expand Down Expand Up @@ -450,7 +456,6 @@ function makeHTMLTree($arr) {
}

function parseHTMLMarks($bookmarks, $bdate, $button, $format='html') {
$rcmail = rcmail::get_instance();
$bookmarks = preg_replace("/<DD>[^>]*?</i", "<", $bookmarks);
$bookmarks = preg_replace("/<DT><H3 [^>]*? PERSONAL_TOOLBAR_FOLDER=\"true\">(.+?)<\/H3>/is", "</ol><H1>$1</H1>", $bookmarks);
$bookmarks = preg_replace("/<DT><H3 [^>]*? UNFILED_BOOKMARKS_FOLDER=\"true\">(.+?)<\/H3>/is", "<H1>$1</H1>", $bookmarks);
Expand Down

0 comments on commit 96f6f66

Please sign in to comment.