diff --git a/.editorconfig b/.editorconfig index 6ce6fc3..63f7b7b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,7 @@ root = true charset = utf-8 end_of_line = lf indent_style = tab +tab_width = 4 trim_trailing_whitespace = true insert_final_newline = true @@ -17,5 +18,9 @@ insert_final_newline = false trim_trailing_whitespace = false insert_final_newline = false +[*.css] +indent_style = space +indent_size = 2 + [/version.txt] insert_final_newline = false diff --git a/buildzip.php b/buildzip.php index 298332d..62d05b7 100755 --- a/buildzip.php +++ b/buildzip.php @@ -51,10 +51,6 @@ rename('db/config.php.default', 'db/config.php'); $fh = fopen("./content/themes/default/index.php", 'a') or die("cant write index.php\n"); fwrite($fh, "\n"); fclose($fh); - -$fh = fopen("./content/themes/ie8/index.php", 'a') or die("cant write ie8/index.php\n"); -fwrite($fh, "\n"); -fclose($fh); */ #replace @VERSION @@ -76,13 +72,6 @@ closedir($dh); */ -# pack ie8 theme -chdir('content/themes'); -`zip -9 -r ie8.zip ie8`; #OS dep.!!! -deleteTreeIfDir('ie8'); -chdir('../..'); - - chdir('..'); # to the root of repo rename('src', 'mytinytodo') or die("Cant rename 'src'\n"); diff --git a/src/ajax.php b/src/ajax.php index 665996e..5359f59 100644 --- a/src/ajax.php +++ b/src/ajax.php @@ -18,7 +18,8 @@ if(isset($_GET['loadLists'])) if (!is_logged()) $sqlWhere = 'WHERE published=1'; else $sqlWhere = ''; $t = array(); - $t['total'] = 0; + $t['list'][] = prepareAllTasksList(); + $t['total'] = 1; $q = $db->dq("SELECT * FROM {$db->prefix}lists $sqlWhere ORDER BY ow ASC, id ASC"); while($r = $q->fetch_assoc($q)) { @@ -226,7 +227,7 @@ elseif(isset($_GET['editNote'])) $db->dq("UPDATE {$db->prefix}todolist SET note=?,d_edited=? WHERE id=$id", array($note, time()) ); $t = array(); $t['total'] = 1; - $t['list'][] = array('id'=>$id, 'note'=>nl2br(escapeTags($note)), 'noteText'=>(string)$note); + $t['list'][] = array('id'=>$id, 'note'=>mttMarkup_v1($note), 'noteText'=>(string)$note); jsonExit($t); } elseif(isset($_GET['editTask'])) @@ -530,7 +531,7 @@ function prepareTaskRow($r) return array( 'id' => $r['id'], - 'title' => escapeTags($r['title']), + 'title' => htmlspecialchars( $r['title'] ), 'listId' => $r['list_id'], 'date' => htmlarray($dCreated), 'dateInt' => (int)$r['d_created'], @@ -542,7 +543,7 @@ function prepareTaskRow($r) 'dateCompletedInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_completed'), $dCompleted)), 'compl' => (int)$r['compl'], 'prio' => $r['prio'], - 'note' => nl2br(escapeTags($r['note'])), + 'note' => mttMarkup_v1($r['note']), 'noteText' => (string)$r['note'], 'ow' => (int)$r['ow'], 'tags' => htmlarray($r['tags']), @@ -664,16 +665,33 @@ function addTaskTags($taskId, $tagIds, $listId) function parse_smartsyntax($title) { - $a = array(); - if(!preg_match("|^(/([+-]{0,1}\d+)?/)?(.*?)(\s+/([^/]*)/$)?$|", $title, $m)) return false; - $a['prio'] = isset($m[2]) ? (int)$m[2] : 0; - $a['title'] = isset($m[3]) ? trim($m[3]) : ''; - $a['tags'] = isset($m[5]) ? trim($m[5]) : ''; - if($a['prio'] < -1) $a['prio'] = -1; - elseif($a['prio'] > 2) $a['prio'] = 2; + $a = [ + 'prio' => 0, + 'title' => $title, + 'tags' => '' + ]; + if ( preg_match("|^([-+]{1}\d+)(.+)|", $a['title'], $m) ) { + $a['prio'] = (int) $m[1]; + if ( $a['prio'] < -1 ) $a['prio'] = -1; + elseif ( $a['prio'] > 2 ) $a['prio'] = 2; + $a['title'] = trim($m[2]); + } + $tags = []; + $a['title'] = trim( preg_replace_callback( + "/(?:^|\s+)#([^#\s]+)/", + function ($matches) use (&$tags) { + $tags[] = $matches[1]; + return ''; + }, + $a['title'] + ) ); + if (count($tags) > 0) { + $a['tags'] = implode( ',' , $tags ); + } return $a; } + function tag_size($qmin, $q, $step) { if($step == 0) return 1; @@ -862,6 +880,19 @@ function prepareList($row) ); } +function prepareAllTasksList() +{ + return array( + 'id' => -1, + 'name' => htmlarray(__('alltasks')), + 'sort' => 3, + 'published' => 0, + 'showCompl' => 1, + 'showNotes' => 0, + 'hidden' => 1, + ); +} + function getUserListsSimple() { $db = DBConnection::instance(); diff --git a/src/content/lang/en.json b/src/content/lang/en.json index c5f0763..4c68cae 100644 --- a/src/content/lang/en.json +++ b/src/content/lang/en.json @@ -8,8 +8,6 @@ "author_url": "http://www.mytinytodo.net" }, "My Tiny Todolist": "My Tiny Todolist", - "desktop_version": "Desktop version", - "mobile_version": "Mobile version", "powered_by": "Powered by", "htab_newtask": "New task", "htab_search": "Search", @@ -127,7 +125,11 @@ "feed_title": "%s", "feed_completed_tasks": "Completed tasks", "feed_modified_tasks": "Modified tasks", - "feed_new_tasks": "New tasks", + "feed_new_tasks": "New tasks", + "feed_tasks": "Tasks", + "feed_status_new": "New", + "feed_status_updated": "Updated", + "feed_status_completed": "Completed", "alltasks": "All tasks", "set_header": "Settings", "set_title": "Title", diff --git a/src/content/lang/ru.json b/src/content/lang/ru.json index fd4b2d0..a05331b 100644 --- a/src/content/lang/ru.json +++ b/src/content/lang/ru.json @@ -8,8 +8,6 @@ "author_url": "http://www.mytinytodo.net" }, "My Tiny Todolist": "My Tiny Todolist", - "desktop_version": "Версия для компьютера", - "mobile_version": "Мобильная версия", "powered_by": "Работает на", "htab_newtask": "Новая задача", "htab_search": "Поиск", @@ -127,7 +125,11 @@ "feed_title": "%s", "feed_completed_tasks": "Завершенные задачи", "feed_modified_tasks": "Изменившиеся задачи", - "feed_new_tasks": "Новые задачи", + "feed_new_tasks": "Новые задачи", + "feed_status_new": "Задача создана", + "feed_status_updated": "Задача обновлена", + "feed_status_completed": "Задача завершена", + "feed_tasks": "Задачи", "alltasks": "Все задачи", "set_header": "Настройки", "set_title": "Заголовок страницы", diff --git a/src/content/themes/default/index.php b/src/content/themes/default/index.php index c79ec50..a600337 100644 --- a/src/content/themes/default/index.php +++ b/src/content/themes/default/index.php @@ -1,29 +1,25 @@ - - + +
- -| t |