Compare commits

..

No commits in common. "master" and "v1.3.2" have entirely different histories.

215 changed files with 6222 additions and 24256 deletions

View file

@ -1,32 +0,0 @@
# top-most EditorConfig file
root = true
# 'insert_final_newline = false' should not remove last empty line
[*]
charset = utf-8
end_of_line = lf
# tab_width here is only used to represent tabs if indent_size is not set
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true
[*.php]
indent_style = space
indent_size = 4
[*.js]
indent_style = space
tab_width = 4
[*.{css,yml,html,svg,xml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
insert_final_newline = false
[/src/includes/theme.php]
indent_style = space
indent_size = 2

10
.gitignore vendored
View file

@ -1,10 +0,0 @@
.DS_Store
src/db/todolist.db*
src/db/config.php
src/db/config-*
src/db/backup.xml*
src/config.php
src/includes/vendor/
src/content/theme/custom.css
tests/

5
.hgignore Normal file
View file

@ -0,0 +1,5 @@
syntax: glob
src/db/todolist.db
src/tmp/sessions/sess*
src/db/config.php

View file

@ -1,22 +0,0 @@
# myTinyTodo
Your tiny todo list
Original website - http://www.mytinytodo.net/
### System requirements
- PHP 7.2 or greater
- PHP extensions:
- mbstring
- pdo_sqlite, intl (SQLite version)
- pdo_mysql or mysqli (MySQL version)
- pdo_pgsql (PostgreSQL version)
- One of databases:
- MySQL 5.7 or greater / MariaDB 10.2 or greater
- PostgreSQL 10 or greater
- SQLite (system library)
Supported browsers: Chrome 49, Safari 10, Firefox 53.
Internet Explorer and Opera with Presto engine are not supported.

View file

@ -1,124 +0,0 @@
#!/usr/bin/env php
<?php
// PHP 5.4 is required
if ( !isset($argv) || !isset($argv[1]) ) {
die("Usage: buildtar.php <path_to_repo> [-o source.tar.gz] [-v VERSION]\n");
}
$repo = $argv[1];
$dir = sys_get_temp_dir(). DIRECTORY_SEPARATOR. "mytinytodo.build";
$curdir = getcwd();
$archive = $curdir. DIRECTORY_SEPARATOR. 'mytinytodo-v@VERSION-@REV.tar.gz';
$ver = 0;
while ($arg = next($argv))
{
if ($arg == '-o') {
$archive = next($argv);
}
elseif ($arg == '-v') {
$ver = next($argv);
}
}
deleteTreeIfDir($dir);
$out = `git clone $repo $dir 2>&1`;
if (!is_dir($dir)) {
die("Error while clone: $out\n");
}
print "> Repository was cloned to temp dir: $dir\n";
#get current version number if not specified
if (!$ver) {
require_once(__DIR__ . '/src/includes/version.php');
$ver = mytinytodo\Version::VERSION;
}
chdir($dir. DIRECTORY_SEPARATOR. 'src');
$rev = trim(`git show --format=format:%H --summary`);
$rev = substr($rev, 0, 8);
##$ver = str_replace('@REV', $rev, $ver);
print "> Version is $ver\n";
unlink('./docker-config.php');
unlink('./includes/lang/en-rtl.json');
unlink('./includes/lang/_percent.php');
unlink('./mtt-edit-settings.php');
unlink('./mtt-emergency.php');
unlink('./content/theme/images/svg2base64.php');
chdir('..'); # to the root of repo
assert( strpos(getcwd(), ':') === false ); # FIXME: if path contains a colon ':'
echo("> Run Composer\n");
$retval = 0;
if (false === system( "./composer.sh install --no-dev --no-interaction --optimize-autoloader", $retval) || $retval != 0) {
die("Failed to install composer libs via docker\n");
}
# ext
if (is_dir('src/ext')) {
mkdir('src/ext2');
chdir('src/ext');
deleteTreeIfDir('_examples');
$extCount = 0;
$exts = array_diff(scandir('.') ?? [], ['.', '..']);
foreach ($exts as $ext) {
if (is_dir($ext)) {
rename($ext, "../ext2/$ext");
$extCount++;
}
}
chdir('../ext2');
if ($extCount > 0) {
`tar --no-xattrs -czf ../ext/extensions.tar.gz *`; #OS dep.!!!
}
chdir('../..');
deleteTreeIfDir('src/ext2');
echo("> Extensions were packed\n");
}
rename('src', 'mytinytodo') or die("Cant rename 'src'\n");
`tar --no-xattrs -czf mytinytodo.tar.gz mytinytodo`; #OS dep.!!!
if (!file_exists('mytinytodo.tar.gz')) {
die("Failed to pack files (no output tar.gz file)\n");
}
$archive = str_replace('@VERSION', $ver, $archive);
$archive = str_replace('@REV', $rev, $archive);
chdir($curdir);
if ( ! rename("$dir/mytinytodo.tar.gz", $archive) ) {
die("Failed to move mytinytodo.tar.gz to $archive");
}
deleteTreeIfDir($dir);
echo("> Temp dir was cleaned\n");
echo("> Build is stored in $archive\n");
function deleteTreeIfDir($dir)
{
if ( !is_dir($dir) ) {
return;
}
switch (PHP_OS) {
case 'Darwin':
case 'Linux':
system("rm -rf ". escapeshellarg($dir));
break;
case 'Windows':
system("rmdir /s /q ". escapeshellarg($dir));
break;
default:
die("Unknown system ". PHP_OS. "\n");
}
}

View file

@ -1,24 +0,0 @@
{
"name": "maxpozdeev/mytinytodo",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://mytinytodo.net",
"authors": [
{
"name": "Max Pozdeev",
"role": "Developer"
}
],
"config": {
"vendor-dir": "src/includes/vendor"
},
"require": {
"php": ">=7.2",
"ext-mbstring": "*",
"erusev/parsedown": "1.7.x-dev#f7285e7",
"symfony/polyfill-intl-normalizer": "^1.31"
},
"require-dev": {
"league/commonmark": "^2.6"
}
}

765
composer.lock generated
View file

@ -1,765 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c27d4b183be86ec7d95203f1a84b86e2",
"packages": [
{
"name": "erusev/parsedown",
"version": "1.7.x-dev",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "f7285e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/f7285e7",
"reference": "f7285e7",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.7|^6.5|^7.5|^8.5|^9.6"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"support": {
"issues": "https://github.com/erusev/parsedown/issues",
"source": "https://github.com/erusev/parsedown/tree/1.7.x"
},
"time": "2024-07-12T14:59:16+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "3833d7255cc303546435cb650316bff708a1c75c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
"reference": "3833d7255cc303546435cb650316bff708a1c75c",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's Normalizer class and related functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"intl",
"normalizer",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
}
],
"packages-dev": [
{
"name": "dflydev/dot-access-data",
"version": "v3.0.3",
"source": {
"type": "git",
"url": "https://github.com/dflydev/dflydev-dot-access-data.git",
"reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f",
"reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.42",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.3",
"scrutinizer/ocular": "1.6.0",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Dflydev\\DotAccessData\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dragonfly Development Inc.",
"email": "info@dflydev.com",
"homepage": "http://dflydev.com"
},
{
"name": "Beau Simensen",
"email": "beau@dflydev.com",
"homepage": "http://beausimensen.com"
},
{
"name": "Carlos Frutos",
"email": "carlos@kiwing.it",
"homepage": "https://github.com/cfrutos"
},
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com"
}
],
"description": "Given a deep data structure, access data by dot notation.",
"homepage": "https://github.com/dflydev/dflydev-dot-access-data",
"keywords": [
"access",
"data",
"dot",
"notation"
],
"support": {
"issues": "https://github.com/dflydev/dflydev-dot-access-data/issues",
"source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3"
},
"time": "2024-07-08T12:26:09+00:00"
},
{
"name": "league/commonmark",
"version": "2.7.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6fbb36d44824ed4091adbcf4c7d4a3923cdb3405",
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"league/config": "^1.1.1",
"php": "^7.4 || ^8.0",
"psr/event-dispatcher": "^1.0",
"symfony/deprecation-contracts": "^2.1 || ^3.0",
"symfony/polyfill-php80": "^1.16"
},
"require-dev": {
"cebe/markdown": "^1.0",
"commonmark/cmark": "0.31.1",
"commonmark/commonmark.js": "0.31.1",
"composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4",
"erusev/parsedown": "^1.0",
"ext-json": "*",
"github/gfm": "0.29.0",
"michelf/php-markdown": "^1.4 || ^2.0",
"nyholm/psr7": "^1.5",
"phpstan/phpstan": "^1.8.2",
"phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
"scrutinizer/ocular": "^1.8.1",
"symfony/finder": "^5.3 | ^6.0 | ^7.0",
"symfony/process": "^5.4 | ^6.0 | ^7.0",
"symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0",
"unleashedtech/php-coding-standard": "^3.1.1",
"vimeo/psalm": "^4.24.0 || ^5.0.0"
},
"suggest": {
"symfony/yaml": "v2.3+ required if using the Front Matter extension"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"League\\CommonMark\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com",
"role": "Lead Developer"
}
],
"description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)",
"homepage": "https://commonmark.thephpleague.com",
"keywords": [
"commonmark",
"flavored",
"gfm",
"github",
"github-flavored",
"markdown",
"md",
"parser"
],
"support": {
"docs": "https://commonmark.thephpleague.com/",
"forum": "https://github.com/thephpleague/commonmark/discussions",
"issues": "https://github.com/thephpleague/commonmark/issues",
"rss": "https://github.com/thephpleague/commonmark/releases.atom",
"source": "https://github.com/thephpleague/commonmark"
},
"funding": [
{
"url": "https://www.colinodell.com/sponsor",
"type": "custom"
},
{
"url": "https://www.paypal.me/colinpodell/10.00",
"type": "custom"
},
{
"url": "https://github.com/colinodell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/league/commonmark",
"type": "tidelift"
}
],
"time": "2025-05-05T12:20:28+00:00"
},
{
"name": "league/config",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/config.git",
"reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3",
"reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3",
"shasum": ""
},
"require": {
"dflydev/dot-access-data": "^3.0.1",
"nette/schema": "^1.2",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.8.2",
"phpunit/phpunit": "^9.5.5",
"scrutinizer/ocular": "^1.8.1",
"unleashedtech/php-coding-standard": "^3.1",
"vimeo/psalm": "^4.7.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.2-dev"
}
},
"autoload": {
"psr-4": {
"League\\Config\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com",
"role": "Lead Developer"
}
],
"description": "Define configuration arrays with strict schemas and access values with dot notation",
"homepage": "https://config.thephpleague.com",
"keywords": [
"array",
"config",
"configuration",
"dot",
"dot-access",
"nested",
"schema"
],
"support": {
"docs": "https://config.thephpleague.com/",
"issues": "https://github.com/thephpleague/config/issues",
"rss": "https://github.com/thephpleague/config/releases.atom",
"source": "https://github.com/thephpleague/config"
},
"funding": [
{
"url": "https://www.colinodell.com/sponsor",
"type": "custom"
},
{
"url": "https://www.paypal.me/colinpodell/10.00",
"type": "custom"
},
{
"url": "https://github.com/colinodell",
"type": "github"
}
],
"time": "2022-12-11T20:36:23+00:00"
},
{
"name": "nette/schema",
"version": "v1.3.2",
"source": {
"type": "git",
"url": "https://github.com/nette/schema.git",
"reference": "da801d52f0354f70a638673c4a0f04e16529431d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d",
"reference": "da801d52f0354f70a638673c4a0f04e16529431d",
"shasum": ""
},
"require": {
"nette/utils": "^4.0",
"php": "8.1 - 8.4"
},
"require-dev": {
"nette/tester": "^2.5.2",
"phpstan/phpstan-nette": "^1.0",
"tracy/tracy": "^2.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0-only",
"GPL-3.0-only"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "📐 Nette Schema: validating data structures against a given Schema.",
"homepage": "https://nette.org",
"keywords": [
"config",
"nette"
],
"support": {
"issues": "https://github.com/nette/schema/issues",
"source": "https://github.com/nette/schema/tree/v1.3.2"
},
"time": "2024-10-06T23:10:23+00:00"
},
{
"name": "nette/utils",
"version": "v4.0.6",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "ce708655043c7050eb050df361c5e313cf708309"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/ce708655043c7050eb050df361c5e313cf708309",
"reference": "ce708655043c7050eb050df361c5e313cf708309",
"shasum": ""
},
"require": {
"php": "8.0 - 8.4"
},
"conflict": {
"nette/finder": "<3",
"nette/schema": "<1.2.2"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "dev-master",
"nette/tester": "^2.5",
"phpstan/phpstan": "^1.0",
"tracy/tracy": "^2.9"
},
"suggest": {
"ext-gd": "to use Image",
"ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()",
"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
"ext-json": "to use Nette\\Utils\\Json",
"ext-mbstring": "to use Strings::lower() etc...",
"ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0-only",
"GPL-3.0-only"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
"homepage": "https://nette.org",
"keywords": [
"array",
"core",
"datetime",
"images",
"json",
"nette",
"paginator",
"password",
"slugify",
"string",
"unicode",
"utf-8",
"utility",
"validation"
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.0.6"
},
"time": "2025-03-30T21:06:30+00:00"
},
{
"name": "psr/event-dispatcher",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/event-dispatcher.git",
"reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0",
"reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0",
"shasum": ""
},
"require": {
"php": ">=7.2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\EventDispatcher\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Standard interfaces for event handling.",
"keywords": [
"events",
"psr",
"psr-14"
],
"support": {
"issues": "https://github.com/php-fig/event-dispatcher/issues",
"source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0"
},
"time": "2019-01-08T18:20:26+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-01-02T08:10:11+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"erusev/parsedown": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.2",
"ext-mbstring": "*"
},
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View file

@ -1,11 +0,0 @@
#!/bin/sh
#dir="$( dirname -- "$( readlink -f -- "$0"; )"; )"
dir="$PWD"
app=$(which podman)
if [ -z $app ]; then
app="docker"
fi
$app run -it --rm -v "$dir:/app" composer $@

67
langs/be.php Normal file
View file

@ -0,0 +1,67 @@
<?php
/*
myTinyTodo Belarusian language pack
v1.2 beta2 compatible
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "нататка",
'actionEdit' => "зьмяніць",
'actionDelete' => "выдаліць",
'taskDate' => array("function(date) { return 'дадана '+date; }"),
'confirmDelete' => "Вы ўпэўнены?",
'actionNoteSave' => "захаваць",
'actionNoteCancel' => "скасаваць",
'error' => "Памылка",
'denied' => "Доступ забаронены",
'invalidpass' => "Няверны пароль",
'readonly' => "толькі чытаньне",
'tagfilter' => "Бірка:",
);
var $inc = array
(
'My Tiny Todolist' => "Мой сьпіс задач",
'tab_newtask' => "новая задача",
'tab_search' => "пошук",
'btn_add' => "Дадаць",
'btn_search' => "Шукаць",
'searching' => "Пошук",
'tasks' => "Задачы",
'show_completed' => "Адлюстраваць завершаныя задачы",
'hide_completed' => "Схаваць завершаныя задачы",
'edit_task' => "Рэдагаваць задачу",
'priority' => "Прыярытэт",
'task' => "Задача",
'note' => "Нататка",
'save' => "Захаваць",
'cancel' => "Скасаваць",
'password' => "Пароль",
'btn_login' => "Увайсьці",
'a_login' => "Уваход",
'a_logout' => "Выйсьці",
'tags' => "Біркі",
'tagfilter_cancel' => "скасаваць",
'sortByHand' => "Сартаваць уручную",
'sortByPriority' => "Сартаваць па прыярытэту",
'sortByDueDate' => "Сартаваць па тэрміну",
'due' => "Тэрмін",
'daysago' => "%d дзён таму",
'indays' => "праз %d дзён",
'months_short' => array("Сту","Лют","Сак","Кра","Тра","Чэр","Ліп","Жні","Вер","Кас","Ліс","Сне"),
'date_md' => "%2\$d %1\$s",
'date_ymd' => "%3\$d %2\$s %1\$d",
'today' => "сёньня",
'yesterday' => "учора",
'tomorrow' => "заўтра",
'f_past' => "Пратэрмінаваныя",
'f_today' => "Сёньня й заўтра",
'f_soon' => "Хутка",
);
}
?>

91
langs/cns.php Normal file
View file

@ -0,0 +1,91 @@
<?php
/*
myTinyTodo language pack
Language: Simple Chinese
Author: heraldboy@gmail.com
Url:
AppVersion: v1.3.1
Date: 2009-11-29
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "内容",
'actionEdit' => "编辑",
'actionDelete' => "删除",
'confirmDelete' => "你确定吗?",
'actionNoteSave' => "保存",
'actionNoteCancel' => "退出",
'error' => "发生了错误 (点击查看详细情况)",
'denied' => "数据被拒绝了",
'invalidpass' => "密码错误",
'readonly' => "只读",
'tagfilter' => "标签:",
'addList' => "请输入一个新的列表名称",
'renameList' => "重命名列表",
'deleteList' => "当前列表及其包括的所有任务将被删除。\\n你确定吗?",
'settingsSaved' => "设置已经被保存了,正在重新引导...",
);
var $inc = array
(
'My Tiny Todolist' => "我的迷你任务列表",
'htab_newtask' => "新任务",
'htab_search' => "查询",
'btn_add' => "增加",
'btn_search' => "查询",
'advanced_add' => "高级新增",
'searching' => "查找",
'tasks' => "所有任务",
'taskdate_inline' => "%s 新增的",
'edit_task' => "编辑任务",
'add_task' => "新增任务",
'priority' => "优先级",
'task' => "任务",
'note' => "内容",
'save' => "保存",
'cancel' => "退出",
'password' => "密码",
'btn_login' => "登录",
'a_login' => "登录",
'a_logout' => "退出",
'tags' => "标签",
'tagfilter_cancel' => "取消标签过滤",
'sortByHand' => "手动排序",
'sortByPriority' => "按优先级排序",
'sortByDueDate' => "按到期时间排序",
'due' => "到期",
'daysago' => "%d 天前",
'indays' => "%d 天后",
'months_short' => array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"),
'months_long' => array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"),
'days_min' => array("","","","","","",""),
'days_long' => array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"),
'today' => "今天",
'yesterday' => "昨天",
'tomorrow' => "明天",
'f_past' => "过期",
'f_today' => "今天和明天",
'f_soon' => "最近的",
'tasks_and_compl' => "所有任务(包括完成的)",
'notes' => "内容:",
'notes_show' => "显示",
'notes_hide' => "隐藏",
'list_new' => "新增列表",
'list_rename' => "重命名",
'list_delete' => "删除",
'list_publish' => "公开列表",
'alltags' => "所有标签:",
'alltags_show' => "显示所有",
'alltags_hide' => "隐藏所有",
'a_settings' => "系统设置",
'rss_feed' => "RSS Feed",
'feed_title' => "%s",
'feed_description' => "新任务 %s",
);
}
?>

69
langs/cz.php Normal file
View file

@ -0,0 +1,69 @@
<?php
/*
myTinyTodo language pack (Czech)
by Michal Brůha www.prdka.cz
v1.2.7
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "poznámka",
'actionEdit' => "upravit",
'actionDelete' => "smazat",
'taskDate' => array("function(date) { return 'added at '+date; }"),
'confirmDelete' => "Jste si jist?",
'actionNoteSave' => "uložit",
'actionNoteCancel' => "zrušit",
'error' => "Vyskytla se chyba (klikněte pro detaily)",
'denied' => "Přístup zamítnut",
'invalidpass' => "Chybné heslo",
'readonly' => "pouze pro čtení",
'tagfilter' => "Klíčové slovo:",
);
var $inc = array
(
'My Tiny Todolist' => "My Tiny Todolist",
'tab_newtask' => "nový úkol",
'tab_search' => "hledat",
'btn_add' => "Přidat",
'btn_search' => "Hledat",
'searching' => "Hledání",
'tasks' => "Aktuální úkoly",
'edit_task' => "Upravit Úkol",
'priority' => "Důležitost",
'task' => "Úkol",
'note' => "Poznámka",
'save' => "Uložit",
'cancel' => "Zrušit",
'password' => "Heslo",
'btn_login' => "Přihlásit",
'a_login' => "Přihlásit",
'a_logout' => "Odhlásit",
'tags' => "Klíčová slova",
'tagfilter_cancel' => "zrušit filtr",
'sortByHand' => "Seřadit manuálně",
'sortByPriority' => "Seřadit podle důležitosti",
'sortByDueDate' => "Seřadit podle datumu dokončení",
'due' => "Dokončení",
'daysago' => " před %d dny",
'indays' => "během %d dnů",
'months_short' => array("Led","Úno","Bře","Dub","Kvě","Črn","Črc","Srp","Zář","Říj","Lis","Pro"),
'months_long' => array("Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"),
'days_min' => array("Ne","Po","Út","St","Čt","","So"),
'date_md' => "%2\$d %1\$s",
'date_ymd' => "%3\$d %2\$s %1\$d",
'today' => "dnes",
'yesterday' => "včera",
'tomorrow' => "zítra",
'f_past' => "Zpožděné",
'f_today' => "Dnes a zítra",
'f_soon' => "Brzy",
'tasks_and_compl' => "Aktuální úkoly + dokončené",
);
}
?>

88
langs/de.php Normal file
View file

@ -0,0 +1,88 @@
<?php
/*
myTinyTodo language pack
Language: German
Author: Isabelle
E-Mail:
Url: http://aileesh.blogspot.com/
Version: v1.3b3
Date: 2009-11-04
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "Notiz",
'actionEdit' => "&auml;ndern",
'actionDelete' => "l&ouml;schen",
'taskDate' => array("function(date) { return 'added at '+date; }"),
'confirmDelete' => "Bist du sicher?",
'actionNoteSave' => "speichern",
'actionNoteCancel' => "abbrechen",
'error' => "Fehler aufgetreten (click für Details)",
'denied' => "Zugriff verweigert",
'invalidpass' => "Falsches Passwort",
'readonly' => "read-only",
'tagfilter' => "Tag:",
'addList' => "neue Liste anlegen",
'renameList' => "Liste umbenennen",
'deleteList' => "Löscht die aktuelle Liste mit allen darin enthaltenen Aufgaben.\\nBist du sicher?",
'settingsSaved' => "Einstellugnen gespeichert. Aktualisierung...",
);
var $inc = array
(
'My Tiny Todolist' => "My Tiny Todolist",
'htab_newtask' => "Neue Aufgabe",
'htab_search' => "suchen",
'btn_add' => "hinzuf&uuml;gen",
'btn_search' => "suchen",
'advanced_add' => "erweitert",
'searching' => "suchen nach",
'tasks' => "Aufgaben",
'edit_task' => "Aufgabe bearbeiten",
'add_task' => "Neue Aufgabe",
'priority' => "Priorit&auml;t",
'task' => "Aufgabe",
'note' => "Notiz",
'save' => "speichern",
'cancel' => "abbrechen",
'password' => "Passwort",
'btn_login' => "Login",
'a_login' => "Login",
'a_logout' => "Logout",
'tags' => "Tags",
'tagfilter_cancel' => "Filter aufheben",
'sortByHand' => "sortieren nach",
'sortByPriority' => "sortieren nach Priorit&auml;t",
'sortByDueDate' => "sortieren nach F&auml;llig-Datum",
'due' => "F&auml;llig",
'daysago' => "vor %d Tagen",
'indays' => "in %d Tagen",
'months_short' => array("Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"),
'months_long' => array("Januar","Februar","M&auml;rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"),
'days_min' => array("So","Mo","Di","Mi","Do","Fr","Sa"),
'today' => "heute",
'yesterday' => "gestern",
'tomorrow' => "morgen",
'f_past' => "&uuml;berf&auml;llig",
'f_today' => "heute und morgen",
'f_soon' => "bald",
'tasks_and_compl' => "Aufgaben + erledigt",
'notes' => "Notizen:",
'notes_show' => "Anzeigen",
'notes_hide' => "Verbergen",
'list_new' => "neue Liste",
'list_rename' => "umbenennen",
'list_delete' => "l&ouml;schen",
'alltags' => "Alle Tags:",
'alltags_show' => "alle anzeigen",
'alltags_hide' => "alle verbergen",
'a_settings' => "Einstellungen",
'rss_feed' => "RSS Feed",
);
}
?>

91
langs/es.php Normal file
View file

@ -0,0 +1,91 @@
<?php
/*
myTinyTodo language pack
Language: Español
Translated: Spanish
Author: Thanatermesis
AppVersion: v1.3.1
Date: 2009-12-24
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "nota",
'actionEdit' => "modificar",
'actionDelete' => "borrar",
'confirmDelete' => "Está seguro ?",
'actionNoteSave' => "guardar",
'actionNoteCancel' => "cancelar",
'error' => "Se ha producido un error (clicar para detalles)",
'denied' => "Access denied",
'invalidpass' => "Wrong password",
'readonly' => "read-only",
'tagfilter' => "Tag:",
'addList' => "Crear nueva lista",
'renameList' => "Renombrar lista",
'deleteList' => "Esto borrará su lista actual con todas sus tareas incluídas.\\nEstá seguro ?",
'settingsSaved' => "Settings saved. Reloading...",
);
var $inc = array
(
'My Tiny Todolist' => "Mi lista de tareas",
'htab_newtask' => "Nueva tarea",
'htab_search' => "Buscar",
'btn_add' => "Añadir",
'btn_search' => "Buscar",
'advanced_add' => "Avanzado",
'searching' => "Buscar por",
'tasks' => "Tareas",
'taskdate_inline' => "añadido en %s",
'edit_task' => "Editar Tarea",
'add_task' => "Nueva Tarea",
'priority' => "Prioridad",
'task' => "Tarea",
'note' => "Nota",
'save' => "Guardar",
'cancel' => "Cancelar",
'password' => "Password",
'btn_login' => "Login",
'a_login' => "Login",
'a_logout' => "Logout",
'tags' => "Tags",
'tagfilter_cancel' => "cancelar filtro",
'sortByHand' => "Ordenar por Mano",
'sortByPriority' => "Ordenar por Prioridad",
'sortByDueDate' => "Ordenar por fecha de vencimiento",
'due' => "Vencimiento",
'daysago' => "hace %d días",
'indays' => "in %d days",
'months_short' => array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"),
'months_long' => array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"),
'days_min' => array("Do","Lu","Ma","Mi","Ju","Vi","Sa"),
'days_long' => array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sabado"),
'today' => "hoy",
'yesterday' => "ayer",
'tomorrow' => "mañana",
'f_past' => "Atrasados",
'f_today' => "Hoy y Mañana",
'f_soon' => "Pronto",
'tasks_and_compl' => "Tareas + completados",
'notes' => "Notea:",
'notes_show' => "Mostrar",
'notes_hide' => "Esconder",
'list_new' => "Nueva Lista",
'list_rename' => "Renombrar",
'list_delete' => "Borrar",
'list_publish' => "Publicar la Lista",
'alltags' => "Todos los Tags:",
'alltags_show' => "Mostrar todo",
'alltags_hide' => "Esconder todo",
'a_settings' => "Configuración",
'rss_feed' => "RSS Feed",
'feed_title' => "%s",
'feed_description' => "New tasks in %s",
);
}
?>

87
langs/fr.php Normal file
View file

@ -0,0 +1,87 @@
<?php
/*
myTinyTodo language pack
Language: French
Author: v1.2 - Mickael Fradin (http://blog.kewix.fr)
Author: v1.2.7 - Didier Corbière
Author: v1.3b3 - Philippe ALEXANDRE
Version: v1.3b3
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "note",
'actionEdit' => "modifier",
'actionDelete' => "supprimer",
'taskDate' => array("function(date) { return 'ajouté le '+date; }"),
'confirmDelete' => "Êtes-vous sûr?",
'actionNoteSave' => "enregistrer",
'actionNoteCancel' => "annuler",
'error' => "Une erreur s'est produite",
'denied' => "Accès interdit",
'invalidpass' => "Mot de passe incorrect",
'readonly' => "lecture-seule",
'tagfilter' => "Tag:",
'addList' => "Créer une nouvelle liste",
'renameList' => "Renommer la liste",
'deleteList' => "Cela effacera la liste avec toutes les taches la composant.\\nEtes vous sûr?",
'settingsSaved' => "Options sauvegardées. Chargement...",
);
var $inc = array
(
'My Tiny Todolist' => "Liste des tâches",
'htab_newtask' => "Nouvelle tâche",
'htab_search' => "Rechercher",
'btn_add' => "Ajouter",
'btn_search' => "Rechercher",
'advanced_add' => "Avancée",
'searching' => "Recherche de",
'tasks' => "Tâches",
'edit_task' => "Modifier la tâche",
'add_task' => "Nouvelle tâche",
'priority' => "Priorité",
'task' => "Tâche",
'note' => "Note",
'save' => "Enregistrer",
'cancel' => "Annuler",
'password' => "Mot de passe",
'btn_login' => "Connexion",
'a_login' => "Connexion",
'a_logout' => "Déconnexion",
'tags' => "Tags",
'tagfilter_cancel' => "annuler le filtre",
'sortByHand' => "Trier à la main",
'sortByPriority' => "Trier par priorité",
'sortByDueDate' => "Trier par date d'échéance",
'due' => "Échéance",
'daysago' => "il y a %d jours",
'indays' => "dans %d jours",
'months_short' => array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sept","Oct","Nov","Dec"),
'months_long' => array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Decembre"),
'days_min' => array("Di","Lu","Ma","Me","Je","Ve","Sa"),
'today' => "aujourd'hui",
'yesterday' => "hier",
'tomorrow' => "demain",
'f_past' => "En retard",
'f_today' => "Aujourd'hui et demain",
'f_soon' => "Bientôt",
'tasks_and_compl' => "Tâches + Terminées",
'notes' => "Notes:",
'notes_show' => "Afficher",
'notes_hide' => "Cacher",
'list_new' => "Nouvelle liste",
'list_rename' => "Renommer",
'list_delete' => "Effacer",
'alltags' => "Tous les tags:",
'alltags_show' => "Tous les afficher",
'alltags_hide' => "Tous les cacher",
'a_settings' => "Options",
'rss_feed' => "Flux RSS",
);
}
?>

67
langs/it.php Normal file
View file

@ -0,0 +1,67 @@
<?php
/**
* Italian translation for My Tiny Todolist v1.2.5
* Author: Devis Lucato http://www.lucato.it
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "nota",
'actionEdit' => "modifica",
'actionDelete' => "elimina",
'taskDate' => array("function(date) { return 'aggiunto il '+date; }"),
'confirmDelete' => "Sicuro?",
'actionNoteSave' => "salva",
'actionNoteCancel' => "annulla",
'error' => "Si è verificato un errore (clicca per maggiori dettagli)",
'denied' => "Accesso negato",
'invalidpass' => "Password errata",
'readonly' => "sola lettura",
'tagfilter' => "Tag:",
);
var $inc = array
(
'My Tiny Todolist' => "I miei compiti",
'tab_newtask' => "nuovo compito",
'tab_search' => "cerca",
'btn_add' => "Aggiungi",
'btn_search' => "Cerca",
'searching' => "Cercando",
'tasks' => "Compiti",
'edit_task' => "Modifica Compito",
'priority' => "Priorità",
'task' => "Compito",
'note' => "Nota",
'save' => "Salva",
'cancel' => "Annula",
'password' => "Password",
'btn_login' => "Login",
'a_login' => "Login",
'a_logout' => "Esci",
'tags' => "Tags",
'tagfilter_cancel' => "annulla filtro",
'sortByHand' => "Ordine manuale",
'sortByPriority' => "Ordina per priorità",
'sortByDueDate' => "Ordina per scadenza",
'due' => "Scadenza",
'daysago' => "%d giorni fa",
'indays' => "in %d giorni",
'months_short' => array("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"),
'days_min' => array("Do","Lu","Ma","Me","Gi","Ve","Sa"),
'date_md' => "%1\$s %2\$d",
'date_ymd' => "%2\$s %3\$d, %1\$d",
'today' => "oggi",
'yesterday' => "ieri",
'tomorrow' => "domani",
'f_past' => "In ritardo",
'f_today' => "Oggi e domani",
'f_soon' => "Presto",
'tasks_and_compl' => "Compiti + completati",
);
}
?>

69
langs/mk.php Normal file
View file

@ -0,0 +1,69 @@
<?php
/*
myTinyTodo language pack: Macedonian
by nGen Solutions (http://www.ngen.mk)
v1.2 compatible
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "забелешка",
'actionEdit' => "измени",
'actionDelete' => "избриши",
'taskDate' => array("function(date) { return 'added at '+date; }"),
'confirmDelete' => "Дали си сигурен?",
'actionNoteSave' => "зачувај",
'actionNoteCancel' => "откажи",
'error' => "Се појави грешка... (подетално)",
'denied' => "Забранет пристап",
'invalidpass' => "Неточна лозинка",
'readonly' => "read-only",
'tagfilter' => "Ознака:",
);
var $inc = array
(
'My Tiny Todolist' => "Моја Листа на Задачи",
'tab_newtask' => "нова задача",
'tab_search' => "пребарај",
'btn_add' => "Додади",
'btn_search' => "Барај",
'searching' => "Пребарувам",
'tasks' => "Задачи",
'edit_task' => "Измени задача",
'priority' => "Приоритет",
'task' => "Задача",
'note' => "Забелешка",
'save' => "Сочувај",
'cancel' => "Откажи",
'password' => "Лозинка",
'btn_login' => "Најави се",
'a_login' => "Најава",
'a_logout' => "Одјави се",
'tags' => "Ознаки",
'tagfilter_cancel' => "откажи филтер",
'sortByHand' => "Подреди рачно",
'sortByPriority' => "Подреди по приоритет",
'sortByDueDate' => "Подреди по рок",
'due' => "Рок",
'daysago' => "пред %d денови",
'indays' => "за %d денови",
'months_short' => array("Јан","Фев","Мар","Апр","Мај","Јун","Јул","Авг","Сеп","Окт","Нов","Дек"),
'months_long' => array("Јануари","Февруари","Март","Април","Мај","Јуни","Јули","Август","Септември","Октомври","Ноември","Декември"),
'days_min' => array("Не","По","Вт","Ср","Че","Пе","Са"),
'date_md' => "%1\$s %2\$d",
'date_ymd' => "%2\$s %3\$d, %1\$d",
'today' => "денес",
'yesterday' => "вчера",
'tomorrow' => "Утре",
'f_past' => "Задоцнети",
'f_today' => "Денес и Утре",
'f_soon' => "Наскоро",
'tasks_and_compl' => "Задачи + завршени",
);
}
?>

68
langs/nl.php Normal file
View file

@ -0,0 +1,68 @@
<?php
/*
myTinyTodo language pack: Dutch
by André Groendijk
v1.2 compatible
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "notitie",
'actionEdit' => "wijzigen",
'actionDelete' => "verwijderen",
'taskDate' => array("function(date) { return 'toegevoegd op '+date; }"),
'confirmDelete' => "Zeker weten?",
'actionNoteSave' => "opslaan",
'actionNoteCancel' => "annuleren",
'error' => "Foutmelding... (klik voor details)",
'denied' => "Verboden toegang",
'invalidpass' => "Verkeerd wachtwoord",
'readonly' => "alleen-lezen",
'tagfilter' => "Tag:",
);
var $inc = array
(
'My Tiny Todolist' => "My Tiny Todolist",
'tab_newtask' => "nieuwe taak",
'tab_search' => "zoeken",
'btn_add' => "Toevoegen",
'btn_search' => "Zoeken",
'searching' => "Zoekt naar",
'tasks' => "Taak",
'edit_task' => "Wijzig taak",
'priority' => "Prioriteit",
'task' => "Taak",
'note' => "Notitie",
'save' => "Opslaan",
'cancel' => "Annuleren",
'password' => "Wachtwoord",
'btn_login' => "Login",
'a_login' => "Login",
'a_logout' => "Logout",
'tags' => "Tags",
'tagfilter_cancel' => "annuleer filter",
'sortByHand' => "Handmatig sorteren",
'sortByPriority' => "Sorteren op prioriteit",
'sortByDueDate' => "Sorteren op datum",
'due' => "Tot",
'daysago' => "%d dagen geleden",
'indays' => "in %d dagen",
'months_short' => array("Jan","Feb","Mar","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"),
'days_min' => array("Su","Mo","Tu","We","Th","Fr","Sa"),
'date_md' => "%1\$s %2\$d",
'date_ymd' => "%2\$s %3\$d, %1\$d",
'today' => "vandaag",
'yesterday' => "gister",
'tomorrow' => "morgen",
'f_past' => "Overdue",
'f_today' => "Vandaag en morgen",
'f_soon' => "Binnenkort",
'tasks_and_compl' => "Taken + voltooid",
);
}
?>

69
langs/pl.php Normal file
View file

@ -0,0 +1,69 @@
<?php
/*
myTinyTodo language pack (Polish)
by Pawel Frankowski, blog.elimu.pl
v1.2.7
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "dodaj opis",
'actionEdit' => "zmień",
'actionDelete' => "usuń",
'taskDate' => array("function(date) { return 'added at '+date; }"),
'confirmDelete' => "Jesteś pewien?",
'actionNoteSave' => "zapisz",
'actionNoteCancel' => "anuluj",
'error' => "Some error occurred (kliknij aby zobaczyć szczegóły)",
'denied' => "Dostęp zabroniony",
'invalidpass' => "Złe hasło",
'readonly' => "tylko do odczytu",
'tagfilter' => "Tag:",
);
var $inc = array
(
'My Tiny Todolist' => "Moja mała lista Todo (do zrobienia)",
'tab_newtask' => "nowe zadanie",
'tab_search' => "szukaj",
'btn_add' => "Dodaj",
'btn_search' => "Szukaj",
'searching' => "Szukając",
'tasks' => "Zadania",
'edit_task' => "Edytuj Zadanie",
'priority' => "Piorytet",
'task' => "Zadanie",
'note' => "Szczegółowy opis",
'save' => "Zapisz",
'cancel' => "Anuluj",
'password' => "Hasło",
'btn_login' => "Login",
'a_login' => "Login",
'a_logout' => "Wyloguj",
'tags' => "Tagi",
'tagfilter_cancel' => "Anuluj filtr",
'sortByHand' => "Sortuj ręcznie",
'sortByPriority' => "Sortuj piorytetem",
'sortByDueDate' => "Sortuj Terminem",
'due' => "Termin",
'daysago' => "%d dni temu",
'indays' => "w ciągu %d dni",
'months_short' => array("Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"),
'months_long' => array("Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"),
'days_min' => array("Ni","Pon","Wt","Śr","Cz","Pi","So"),
'date_md' => "%2\$d %1\$s",
'date_ymd' => "%3\$d %2\$s %1\$d",
'today' => "dziś",
'yesterday' => "wczoraj",
'tomorrow' => "do jutra",
'f_past' => "Opóźnione",
'f_today' => "Dziś i jutro",
'f_soon' => "Wkrótce",
'tasks_and_compl' => "Zadania + zakończone",
);
}
?>

90
langs/pt-br.php Normal file
View file

@ -0,0 +1,90 @@
<?php
/*
myTinyTodo language pack
Language: Brazilian Portuguese
Author: Raphael Guimarães
E-Mail:
Url:
AppVersion: v1.3.0
Date: 2009-11-09
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "nota",
'actionEdit' => "modificar",
'actionDelete' => "deletar",
'taskDate' => array("function(date) { return 'added at '+date; }"),
'confirmDelete' => "você tem certeza?",
'actionNoteSave' => "salvar",
'actionNoteCancel' => "cancelar",
'error' => "Ocorreu algum erro (clique para detalhes)",
'denied' => "Acesso negado",
'invalidpass' => "Password errado",
'readonly' => "Somente leitura",
'tagfilter' => "Título:",
'addList' => "Criar nova list",
'renameList' => "Renomear lista",
'deleteList' => "Isso deletará essa lista com todas as tarefas nela.\\nVocê tem certeza?",
'settingsSaved' => "Preferencias salvas. Recarregando...",
);
var $inc = array
(
'My Tiny Todolist' => "Minha lista de tarefas",
'htab_newtask' => "Nova tarefa",
'htab_search' => "Procurar",
'btn_add' => "Adicionar",
'btn_search' => "Procurar",
'advanced_add' => "Avaçado",
'searching' => "Procurar por",
'tasks' => "Tarefas",
'edit_task' => "Editar Tarefa",
'add_task' => "Nova Tarefa",
'priority' => "Prioridade",
'task' => "Tarefa",
'note' => "Nota",
'save' => "Salvar",
'cancel' => "Cancelar",
'password' => "Senha",
'btn_login' => "Login",
'a_login' => "Login",
'a_logout' => "Sair",
'tags' => "Títulos",
'tagfilter_cancel' => "cancelar filtro",
'sortByHand' => "Ordenar manualmente",
'sortByPriority' => "Ordenar por prioridade",
'sortByDueDate' => "Ordenar por data de vencimento",
'due' => "Prazo",
'daysago' => "%d dias atrás",
'indays' => "em %d dias",
'months_short' => array("Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"),
'months_long' => array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"),
'days_min' => array("Dom","Seg","Ter","Qua","Qui","Sex","Sab"),
'today' => "hoje",
'yesterday' => "ontem",
'tomorrow' => "amanhã",
'f_past' => "Vencido",
'f_today' => "Hoje e amanhã",
'f_soon' => "Breve",
'tasks_and_compl' => "Tarefas + completas",
'notes' => "Notas:",
'notes_show' => "Mostrar",
'notes_hide' => "Esconder",
'list_new' => "Nova lista",
'list_rename' => "Renomear",
'list_delete' => "Deletar",
'alltags' => "Todos os títulos:",
'alltags_show' => "Mostrar todos",
'alltags_hide' => "Esconder todos",
'a_settings' => "Preferências",
'rss_feed' => "RSS Feed",
'feed_title' => "%s",
'feed_description' => "Nova tarefa em %s",
);
}
?>

125
langs/ru.php Normal file
View file

@ -0,0 +1,125 @@
<?php
/*
myTinyTodo language pack
Language: Русский
Translated: Russian
Author: Max Pozdeev
Author Url: http://www.mytinytodo.net
AppVersion: v1.3.2
Date: 2009-12-26
*/
class Lang extends DefaultLang
{
var $js = array
(
'confirmDelete' => "Вы действительно хотите удалить задачу?",
'actionNoteSave' => "сохранить",
'actionNoteCancel' => "отмена",
'error' => "Ошибка",
'denied' => "Доступ запрещен",
'invalidpass' => "Неверный пароль",
'tagfilter' => "Тег:",
'addList' => "Новый список",
'renameList' => "Переименовать список",
'deleteList' => "Вы действительно хотите удалить этот список со всеми задачами?",
'settingsSaved' => "Настройки сохранены. Перезагрузка...",
);
var $inc = array
(
'My Tiny Todolist' => "Мои задачи",
'htab_newtask' => "Новая задача",
'htab_search' => "Поиск",
'btn_add' => "Добавить",
'btn_search' => "Искать",
'advanced_add' => "Расширенная форма",
'searching' => "Поиск",
'tasks' => "Задачи",
'taskdate_inline' => "добавленa %s",
'taskdate_created' => "Дата создания",
'taskdate_completed' => "Дата завершения",
'edit_task' => "Редактирование задачи",
'add_task' => "Новая задача",
'priority' => "Приоритет",
'task' => "Задача",
'note' => "Заметка",
'save' => "Сохранить",
'cancel' => "Отмена",
'password' => "Пароль",
'btn_login' => "Войти",
'a_login' => "Вход",
'a_logout' => "Выйти",
'public_tasks' => "Опубликованные задачи",
'tags' => "Теги",
'tagfilter_cancel' => "отменить фильтр по тегу",
'sortByHand' => "Сортировка вручную",
'sortByPriority' => "Сортировка по приоритету",
'sortByDueDate' => "Сортировка по сроку",
'due' => "Срок",
'daysago' => "%d дн. назад",
'indays' => "через %d дн.",
'months_short' => array("Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"),
'months_long' => array("Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"),
'days_min' => array("Вс","Пн","Вт","Ср","Чт","Пт","Сб"),
'days_long' => array("Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"),
'today' => "сегодня",
'yesterday' => "вчера",
'tomorrow' => "завтра",
'f_past' => "Просроченные",
'f_today' => "Сегодня и завтра",
'f_soon' => "Скоро",
'tasks_and_compl' => "Задачи + завершенные",
'action_edit' => "Редактировать",
'action_note' => "Заметка",
'action_delete' => "Удалить",
'action_priority' => "Приоритет",
'action_move' => "Переместить в",
'notes' => "Заметки:",
'notes_show' => "Показать",
'notes_hide' => "Скрыть",
'list_new' => "Новый список",
'list_rename' => "Переименовать",
'list_delete' => "Удалить",
'list_publish' => "Опубликовать",
'alltags' => "Все теги:",
'alltags_show' => "Показать все",
'alltags_hide' => "Скрыть все",
'a_settings' => "Настройки",
'rss_feed' => "RSS-лента",
'feed_title' => "%s",
'feed_description' => "%s - новые задачи",
/* Settings */
'set_header' => "Настройки",
'set_title' => "Заголовок страницы",
'set_title_descr' => "(если поле не заполнено, будет использован заголовок по-умолчанию)",
'set_language' => "Язык (Language)",
'set_protection' => "Парольная защита",
'set_enabled' => "Включено",
'set_disabled' => "Выключено",
'set_newpass' => "Новый пароль",
'set_newpass_descr' => "(не заполняйте поле если не хотите менять текущий пароль)",
'set_smartsyntax' => "Smart syntax",
'set_smartsyntax_descr' => "(возможность использовать синтаксис: /приоритет/ задача /теги/)",
'set_autotz' => "Автоопределение часового пояса",
'set_autotz_descr' => "(определение часового пояса пользователя с помощью javascript)",
'set_autotag' => "Autotagging",
'set_autotag_descr' => "(автодобавление текущего тега из фильтра в новую задачу)",
'set_sessions' => "Хранилище сессий",
'set_sessions_php' => "PHP",
'set_sessions_files' => "Файлы",
'set_firstdayofweek' => "Первый день недели",
'set_duedate' => "Формат даты для календаря",
'set_date' => "Формат даты",
'set_shortdate' => "Формат короткой даты",
'set_clock' => "Формат часов",
'set_12hour' => "12-часовой",
'set_24hour' => "24-часовой",
'set_submit' => "Сохранить изменения",
'set_cancel' => "Отмена",
);
}
?>

88
langs/sr.php Normal file
View file

@ -0,0 +1,88 @@
<?php
/*
myTinyTodo language pack
Language: Serbian
Author: Goran Trajkovic
AppVersion: v1.3.0
Date: 2009-11-17
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "промени текст задатка",
'actionEdit' => "промени цео задатак",
'actionDelete' => "обриши задатак",
'taskDate' => array("function(date) { return 'уписан '+date; }"),
'confirmDelete' => "Да ли сте сигурни?",
'actionNoteSave' => "сними",
'actionNoteCancel' => "одустани",
'error' => "Грешке у раду програма (кликните да бисте видели детаље)",
'denied' => "Немогућ приступ апликацији",
'invalidpass' => "Неисправна лозинка?",
'readonly' => "само-за-читање",
'tagfilter' => "Категорија: ",
'addList' => "Направи нову листу",
'renameList' => "Преименуј листу",
'deleteList' => "Ова акција ће обрисати текућу листу са свим припадајућим пословима.\\а ли сте сигурни?",
'settingsSaved' => "Промене у подешавањима су сачуване. Поновно учитавање у току...",
);
var $inc = array
(
'My Tiny Todolist' => "РОКОВНИК",
'htab_newtask' => "Нови задатак",
'htab_search' => "Претрага",
'btn_add' => "Упиши",
'btn_search' => "Тражи",
'advanced_add' => "Напредно додавање (*)",
'searching' => "Претраживање у току...",
'tasks' => "Текући",
'edit_task' => "Измена задатка",
'add_task' => "Нови задатак",
'priority' => "Приоритет",
'task' => "Наслов",
'note' => "Опис",
'save' => "Сними",
'cancel' => "Одустани",
'password' => "Лозинка",
'btn_login' => "Пријави се",
'a_login' => "Пријављивање",
'a_logout' => "Одјави се",
'tags' => "Категорија",
'tagfilter_cancel' => "искључивање филтра",
'sortByHand' => "Ручно уређивање задатака",
'sortByPriority' => "Уређивање по приоритету",
'sortByDueDate' => "Уређивање по датуму обављања",
'due' => "Датум обављања",
'daysago' => "пре %d дана",
'indays' => "за %d дана",
'months_short' => array("Jан","Феб","Maр","Aпр","Maј","Jун","Jул","г","Сеп","Oкт","Нов","Дец"),
'months_long' => array("Јануар","Фебруар","Март","Април","Maј","Jун","Jул","густ","Септембар","Oктобар","Новембар","Децембар"),
'days_min' => array("Не","По","Ут","Ср","Че","Пе","Су"),
'today' => "данас",
'yesterday' => "јуче",
'tomorrow' => "сутра",
'f_past' => "Пробивени",
'f_today' => "Данас и сутра",
'f_soon' => "Ускоро",
'tasks_and_compl' => "Сви",
'notes' => "Напомене:",
'notes_show' => "прикажи",
'notes_hide' => "сакриј",
'list_new' => "Нова листа",
'list_rename' => "Преименуј",
'list_delete' => "Обриши",
'alltags' => "Све категорије (тагови):",
'alltags_show' => "Прикажи све",
'alltags_hide' => "Сакриј све",
'a_settings' => "Подешавања",
'rss_feed' => "RSS Feed",
'feed_title' => "%s",
'feed_description' => "Нови задаци у групи %s",
);
}
?>

70
langs/sv.php Normal file
View file

@ -0,0 +1,70 @@
<?php
/*
myTinyTodo language pack: Swedish
by Anders Ytterström
v1.2 compatible
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "anteckning",
'actionEdit' => "ändra",
'actionDelete' => "ta bort",
'taskDate' => array("function(date) { return 'inlagd '+date; }"),
'confirmDelete' => "Är du säker?",
'actionNoteSave' => "spara",
'actionNoteCancel' => "ångra",
'error' => "Ett fel inträffade (klicka för detaljer)",
'denied' => "Åtkomst nekad",
'invalidpass' => "Fel lösenord",
'readonly' => "skrivskyddad",
'tagfilter' => "Etikett:",
);
var $inc = array
(
'My Tiny Todolist' => "Min enkla Att-Göra",
'tab_newtask' => "Ny uppgift",
'tab_search' => "Sök",
'btn_add' => "Lägg till",
'btn_search' => "Sök",
'searching' => "Söker efter",
'tasks' => "Uppgifter",
'edit_task' => "redigera Uppgift",
'priority' => "Prio",
'task' => "Uppgift",
'note' => "anteckning",
'save' => "Spara",
'cancel' => "Ångra",
'password' => "Lösenord",
'btn_login' => "Logga in",
'a_login' => "Logga in",
'a_logout' => "Logga ut",
'tags' => "Etiketter",
'tagfilter_cancel' => "ångra filter",
'sortByHand' => "Sortera för hand",
'sortByPriority' => "Sortera efter prio",
'sortByDueDate' => "Sortera efter förfallodag",
'due' => "tills",
'daysago' => "för %d dagar sedan",
'indays' => "om %d dagar",
'months_short' => array("jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"),
'months_long' => array("januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"),
'days_min' => array("","","Ti","On","To","Fr",""),
'date_md' => "%1\$s %2\$d",
'date_ymd' => "%2\$s %3\$d, %1\$d",
'today' => "idag",
'yesterday' => "igår",
'tomorrow' => "imorgon",
'f_past' => "Försenad",
'f_today' => "Idag och imorgon",
'f_soon' => "Snart",
'tasks_and_compl' => "Uppgifter + slutförda",
);
}
?>

91
langs/tr.php Normal file
View file

@ -0,0 +1,91 @@
<?php
/*
myTinyTodo language pack
Language: Turkish
Author: FeyyazEsat
Url: http://www.esttechnology.com
AppVersion: v1.3.1
Date: 2009-11-29
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "not",
'actionEdit' => "modifiye et",
'actionDelete' => "sil",
'confirmDelete' => "Eminmisiniz?",
'actionNoteSave' => "kaydet",
'actionNoteCancel' => "iptal",
'error' => "Bazı hatalar oluştu (detaylar için tıklayın)",
'denied' => "İzin verilmedi",
'invalidpass' => "Yanlış Şifre",
'readonly' => "sadece okunabilir",
'tagfilter' => "Etiket:",
'addList' => "Yeni Liste Oluştur",
'renameList' => "Listeyi Çıkar",
'deleteList' => "Mevcut liste ve içindeki tüm görevler silinecek.\\nEminmisiniz?",
'settingsSaved' => "Ayarlar kaydedildi. Tekrar Yükleniyor...",
);
var $inc = array
(
'My Tiny Todolist' => "My Tiny Todolist",
'htab_newtask' => "Yeni görev",
'htab_search' => "Ara",
'btn_add' => "Ekle",
'btn_search' => "Ara",
'advanced_add' => "İleri düzey",
'searching' => "Aranıyor ->",
'tasks' => "Görevler",
'taskdate_inline' => "%s a Eklendi",
'edit_task' => "Görev düzenle",
'add_task' => "Yeni görev",
'priority' => "Öncelik",
'task' => "Görev",
'note' => "Not",
'save' => "Kaydet",
'cancel' => "İptal",
'password' => "Şifre",
'btn_login' => "Giriş",
'a_login' => "Giriş",
'a_logout' => "Çıkış",
'tags' => "Etiketler",
'tagfilter_cancel' => "Filtre iptal",
'sortByHand' => "Elle sırala",
'sortByPriority' => "Önceliğe göre sırala",
'sortByDueDate' => "Vade tarihine göre düzenle",
'due' => "Vade",
'daysago' => "%d Gün önce",
'indays' => "%d Gün içinde",
'months_short' => array("Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"),
'months_long' => array("Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"),
'days_min' => array("Pa","Pz","Sa","Ça","Pe","Cu","Ct"),
'days_long' => array("Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"),
'today' => "bugün",
'yesterday' => "dün",
'tomorrow' => "yarın",
'f_past' => "Vade bitimi",
'f_today' => "Bugün ve Yarın",
'f_soon' => "Yakında",
'tasks_and_compl' => "Görevler + Tamamlanan",
'notes' => "Notlar:",
'notes_show' => "Göster",
'notes_hide' => "Gizle",
'list_new' => "Yeni Liste",
'list_rename' => "Yeniden adlandır",
'list_delete' => "Sil",
'list_publish' => "Listeyi yayımla",
'alltags' => "Tüm Etiketler:",
'alltags_show' => "Tümünü göster",
'alltags_hide' => "Tümünü gizle",
'a_settings' => "Ayarlar",
'rss_feed' => "RSS Beslemesi",
'feed_title' => "%s",
'feed_description' => "Yeni görevler %s nin içinde",
);
}
?>

68
langs/uk.php Normal file
View file

@ -0,0 +1,68 @@
<?php
/*
myTinyTodo Ukrainian language pack
v1.2 compatible
Author: budulay (http://budulay.org.ua)
*/
class Lang extends DefaultLang
{
var $js = array
(
'actionNote' => "замітка",
'actionEdit' => "редагувати",
'actionDelete' => "видалити",
'taskDate' => array("function(date) { return 'додана '+date; }"),
'confirmDelete' => "Ви впевнені?",
'actionNoteSave' => "зберегти",
'actionNoteCancel' => "скасувати",
'error' => "Помилка",
'denied' => "Доступ заборонено",
'invalidpass' => "Невірний пароль",
'readonly' => "тільки для перегляду",
'tagfilter' => "Мітка:",
);
var $inc = array
(
'My Tiny Todolist' => "Мій список завдань",
'tab_newtask' => "нове завдання",
'tab_search' => "пошук",
'btn_add' => "Додати",
'btn_search' => "Шукати",
'searching' => "Пошук",
'tasks' => "Завдання",
'edit_task' => "Редагувати завдання",
'priority' => "Пріорітет",
'task' => "Завдання",
'note' => "Замітка",
'save' => "Зберегти",
'cancel' => "Скасувати",
'password' => "Пароль",
'btn_login' => "Увійти",
'a_login' => "Вхід",
'a_logout' => "Вихід",
'tags' => "Мітки",
'tagfilter_cancel' => "скасувати фільтр по мітці",
'sortByHand' => "Сортувати вручну",
'sortByPriority' => "Сортувати за пріорітетом",
'sortByDueDate' => "Сортувати за терміном",
'due' => "Термін",
'daysago' => "%d днів тому",
'indays' => "через %d днів",
'months_short' => array("Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"),
'days_min' => array("Нд","Пн","Вт","Ср","Чт","Пт","Сб"),
'date_md' => "%2\$d %1\$s",
'date_ymd' => "%3\$d %2\$s %1\$d",
'today' => "сьогодні",
'yesterday' => "вчора",
'tomorrow' => "завтра",
'f_past' => "Прострочені",
'f_today' => "Сьогодні і завтра",
'f_soon' => "Незабаром",
'tasks_and_compl' => "Завдання + завершені",
);
}
?>

View file

@ -1,29 +0,0 @@
# For REST API in Apache
#<IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^api/(.*)$ api.php/$1 [L,QSA]
#</IfModule>
#<Limit GET POST PUT DELETE>
# Allow from all
#</Limit>
# In Nginx set something like this:
# Deny access to some files and folders
#location ~ ^/(db|includes)/ {
# deny all;
#}
#location ~ /\.ht {
# deny all;
#}
#location ~* ^/ext/.*\.(json|md)$ {
# deny all;
#}
# Optional
# location /api/ {
# rewrite ^/api/(.*) /api.php/$1 last;
# }

View file

@ -1,23 +1,22 @@
This program is free software; you can redistribute it and/or modify 
myTinyTodo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at the Free Software Foundation, either version 3 of the License, or
your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, but myTinyTodo is distributed in the hope that it will be useful,
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY but WITHOUT ANY WARRANTY; without even the implied warranty of
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License See file LICENSE or <http://www.gnu.org/licenses/gpl-3.0.txt>.
along with this program as the file LICENSE; if not, please see
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
myTinyTodo myTinyTodo
-------------- --------------
Url: https://www.mytinytodo.net/ Url: http://www.pozdeev.com/mytinytodo/
Copyright: 2009-2011,2019-2025 Max Pozdeev <maxpozdeev@gmail.com> Copyright: 2009 Max Pozdeev <maxpozdeev@gmail.com>
License: GPL version 2 or any later (see LICENSE file) License: GPL version 3 (see LICENSE file)
myTinyTodo uses other works: myTinyTodo uses other works:
@ -25,35 +24,25 @@ myTinyTodo uses other works:
jQuery jQuery
-------------- --------------
Url: http://jquery.com/ Url: http://jquery.com/
Copyright: (c) JS Foundation and other contributors | https://jquery.org/license/ Copyright: 2009 John Resig <jeresig@gmail.com>
License: MIT license. Compatible with GNU GPL (see https://blog.jquery.com/2012/09/10/jquery-licensing-changes/) License: Dual licensed under the MIT and GPL version 2 licenses (see http://docs.jquery.com/License)
jQuery UI jQuery UI
-------------- --------------
Url: http://jqueryui.com/ Url: http://jqueryui.com/
Copyright: Copyright jQuery Foundation and other contributors Copyright: 2009 jQuery UI Authors (see http://jqueryui.com/about)
License: MIT license. Compatible with GNU GPL. License: Dual licensed under the MIT and GPL version 2 licenses (see http://jqueryui.com/about)
jQuery UI Touch Punch (fork by RWAP Software) Autocomplete - jQuery plugin
--------------------------------------------- ------------------------------
Url: https://github.com/RWAP/jquery-ui-touch-punch Url: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
based on original touchpunch Copyright: 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
Original: https://github.com/furf/jquery-ui-touch-punch License: Dual licensed under the MIT and GPL licenses:
Copyright: Copyright 20112014, Dave Furfero * http://www.opensource.org/licenses/mit-license.php
License: Dual licensed under the MIT or GPL Version 2 licenses. * http://www.gnu.org/licenses/gpl.html
Parsedown Images based on Silk Icons set (see also images/COPYRIGHT file)
-------------- -----------------------------------
Url: https://parsedown.org/ Url: http://www.famfamfam.com/lab/icons/silk/
Copyright: (c) 2013-2018 Emanuil Rusev, erusev.com Copyright: Mark James
License: MIT license. Compatible with GNU GPL. License: Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/)
Other libraries (in includes/vendor)
----------------------------------------------
symfony/polyfill-intl-normalizer
league/commonmark
Images
--------------
This software contains images by 3d-parties.
See file content/theme/images/COPYRIGHT for details.

833
src/LICENSE Executable file → Normal file
View file

@ -1,281 +1,622 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 3, 29 June 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc., Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The licenses for most software are designed to take away your The GNU General Public License is a free, copyleft license for
freedom to share and change it. By contrast, the GNU General Public software and other kinds of works.
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This The licenses for most software and other practical works are designed
General Public License applies to most of the Free Software to take away your freedom to share and change the works. By contrast,
Foundation's software and to any other program whose authors commit to the GNU General Public License is intended to guarantee your freedom to
using it. (Some other Free Software Foundation software is covered by share and change all versions of a program--to make sure it remains free
the GNU Lesser General Public License instead.) You can apply it to software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too. your programs, too.
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it them if you wish), that you receive source code or can get it if you
if you want it, that you can change the software or use pieces of it want it, that you can change the software or use pieces of it in new
in new free programs; and that you know you can do these things. free programs, and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid To protect your rights, we need to prevent others from denying you
anyone to deny you these rights or to ask you to surrender the rights. these rights or asking you to surrender the rights. Therefore, you have
These restrictions translate to certain responsibilities for you if you certain responsibilities if you distribute copies of the software, or if
distribute copies of the software, or if you modify it. you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that gratis or for a fee, you must pass on to the recipients the same
you have. You must make sure that they, too, receive or can get the freedoms that you received. You must make sure that they, too, receive
source code. And you must show them these terms so they know their or can get the source code. And you must show them these terms so they
rights. know their rights.
We protect your rights with two steps: (1) copyright the software, and Developers that use the GNU GPL protect your rights with two steps:
(2) offer you this license which gives you legal permission to copy, (1) assert copyright on the software, and (2) offer you this License
distribute and/or modify the software. giving you legal permission to copy, distribute and/or modify it.
Also, for each author's protection and ours, we want to make certain For the developers' and authors' protection, the GPL clearly explains
that everyone understands that there is no warranty for this free that there is no warranty for this free software. For both users' and
software. If the software is modified by someone else and passed on, we authors' sake, the GPL requires that modified versions be marked as
want its recipients to know that what they have is not the original, so changed, so that their problems will not be attributed erroneously to
that any problems introduced by others will not reflect on the original authors of previous versions.
authors' reputations.
Finally, any free program is threatened constantly by software Some devices are designed to deny users access to install or run
patents. We wish to avoid the danger that redistributors of a free modified versions of the software inside them, although the manufacturer
program will individually obtain patent licenses, in effect making the can do so. This is fundamentally incompatible with the aim of
program proprietary. To prevent this, we have made it clear that any protecting users' freedom to change the software. The systematic
patent must be licensed for everyone's free use or not licensed at all. pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 0. Definitions.
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not "This License" refers to version 3 of the GNU General Public License.
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's "Copyright" also means copyright-like laws that apply to other kinds of
source code as you receive it, in any medium, provided that you works, such as semiconductor masks.
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and "The Program" refers to any copyrightable work licensed under this
you may at your option offer warranty protection in exchange for a fee. License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
2. You may modify your copy or copies of the Program or any portion To "modify" a work means to copy from or adapt all or part of the work
of it, thus forming a work based on the Program, and copy and in a fashion requiring copyright permission, other than the making of an
distribute such modifications or work under the terms of Section 1 exact copy. The resulting work is called a "modified version" of the
above, provided that you also meet all of these conditions: earlier work or a work "based on" the earlier work.
a) You must cause the modified files to carry prominent notices A "covered work" means either the unmodified Program or a work based
stating that you changed the files and the date of any change. on the Program.
b) You must cause any work that you distribute or publish, that in To "propagate" a work means to do anything with it that, without
whole or in part contains or is derived from the Program or any permission, would make you directly or secondarily liable for
part thereof, to be licensed as a whole at no charge to all third infringement under applicable copyright law, except executing it on a
parties under the terms of this License. computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
c) If the modified program normally reads commands interactively To "convey" a work means any kind of propagation that enables other
when run, you must cause it, when started running for such parties to make or receive copies. Mere interaction with a user through
interactive use in the most ordinary way, to print or display an a computer network, with no transfer of a copy, is not conveying.
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If An interactive user interface displays "Appropriate Legal Notices"
identifiable sections of that work are not derived from the Program, to the extent that it includes a convenient and prominently visible
and can be reasonably considered independent and separate works in feature that (1) displays an appropriate copyright notice, and (2)
themselves, then this License, and its terms, do not apply to those tells the user that there is no warranty for the work (except to the
sections when you distribute them as separate works. But when you extent that warranties are provided), that licensees may convey the
distribute the same sections as part of a whole which is a work based work under this License, and how to view a copy of this License. If
on the Program, the distribution of the whole must be on the terms of the interface presents a list of user commands or options, such as a
this License, whose permissions for other licensees extend to the menu, a prominent item in the list meets this criterion.
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest 1. Source Code.
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program The "source code" for a work means the preferred form of the work
with the Program (or with a work based on the Program) on a volume of for making modifications to it. "Object code" means any non-source
a storage or distribution medium does not bring the other work under form of a work.
the scope of this License.
3. You may copy and distribute the Program (or a work based on it, A "Standard Interface" means an interface that either is an official
under Section 2) in object code or executable form under the terms of standard defined by a recognized standards body, or, in the case of
Sections 1 and 2 above provided that you also do one of the following: interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
a) Accompany it with the complete corresponding machine-readable The "System Libraries" of an executable work include anything, other
source code, which must be distributed under the terms of Sections than the work as a whole, that (a) is included in the normal form of
1 and 2 above on a medium customarily used for software interchange; or, packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
b) Accompany it with a written offer, valid for at least three The "Corresponding Source" for a work in object code form means all
years, to give any third party, for a charge no more than your the source code needed to generate, install, and (for an executable
cost of physically performing source distribution, a complete work) run the object code and to modify the work, including scripts to
machine-readable copy of the corresponding source code, to be control those activities. However, it does not include the work's
distributed under the terms of Sections 1 and 2 above on a medium System Libraries, or general-purpose tools or generally available free
customarily used for software interchange; or, programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
c) Accompany it with the information you received as to the offer The Corresponding Source need not include anything that users
to distribute corresponding source code. (This alternative is can regenerate automatically from other parts of the Corresponding
allowed only for noncommercial distribution and only if you Source.
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for The Corresponding Source for a work in source code form is that
making modifications to it. For an executable work, complete source same work.
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering 2. Basic Permissions.
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program All rights granted under this License are granted for the term of
except as expressly provided under this License. Any attempt copyright on the Program, and are irrevocable provided the stated
otherwise to copy, modify, sublicense or distribute the Program is conditions are met. This License explicitly affirms your unlimited
void, and will automatically terminate your rights under this License. permission to run the unmodified Program. The output from running a
However, parties who have received copies, or rights, from you under covered work is covered by this License only if the output, given its
this License will not have their licenses terminated so long as such content, constitutes a covered work. This License acknowledges your
parties remain in full compliance. rights of fair use or other equivalent, as provided by copyright law.
5. You are not required to accept this License, since you have not You may make, run and propagate covered works that you do not
signed it. However, nothing else grants you permission to modify or convey, without conditions so long as your license otherwise remains
distribute the Program or its derivative works. These actions are in force. You may convey covered works to others for the sole purpose
prohibited by law if you do not accept this License. Therefore, by of having them make modifications exclusively for you, or provide you
modifying or distributing the Program (or any work based on the with facilities for running those works, provided that you comply with
Program), you indicate your acceptance of this License to do so, and the terms of this License in conveying all material for which you do
all its terms and conditions for copying, distributing or modifying not control copyright. Those thus making or running the covered works
the Program or works based on it. for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
6. Each time you redistribute the Program (or any work based on the Conveying under any other circumstances is permitted solely under
Program), the recipient automatically receives a license from the the conditions stated below. Sublicensing is not allowed; section 10
original licensor to copy, distribute or modify the Program subject to makes it unnecessary.
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
You are not responsible for enforcing compliance by third parties to
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License. this License.
7. If, as a consequence of a court judgment or allegation of patent Each contributor grants you a non-exclusive, worldwide, royalty-free
infringement or for any other reason (not limited to patent issues), patent license under the contributor's essential patent claims, to
conditions are imposed on you (whether by court order, agreement or make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot excuse you from the conditions of this License. If you cannot convey a
distribute so as to satisfy simultaneously your obligations under this covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you License and any other pertinent obligations, then as a consequence you may
may not distribute the Program at all. For example, if a patent not convey it at all. For example, if you agree to terms that obligate you
license would not permit royalty-free redistribution of the Program by to collect a royalty for further conveying from those to whom you convey
all those who receive copies directly or indirectly through you, then the Program, the only way you could satisfy both those terms and this
the only way you could satisfy both it and this License would be to License would be to refrain entirely from conveying the Program.
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under 13. Use with the GNU Affero General Public License.
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any Notwithstanding any other provision of this License, you have
patents or other property right claims or to contest validity of any permission to link or combine any covered work with a work licensed
such claims; this section has the sole purpose of protecting the under version 3 of the GNU Affero General Public License into a single
integrity of the free software distribution system, which is combined work, and to convey the resulting work. The terms of this
implemented by public license practices. Many people have made License will continue to apply to the part which is the covered work,
generous contributions to the wide range of software distributed but the special requirements of the GNU Affero General Public License,
through that system in reliance on consistent application of that section 13, concerning interaction through a network will apply to the
system; it is up to the author/donor to decide if he or she is willing combination as such.
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to 14. Revised Versions of this License.
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in The Free Software Foundation may publish revised and/or new versions of
certain countries either by patents or by copyrighted interfaces, the the GNU General Public License from time to time. Such new versions will
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to be similar in spirit to the present version, but may differ in detail to
address new problems or concerns. address new problems or concerns.
Each version is given a distinguishing version number. If the Program Each version is given a distinguishing version number. If the
specifies a version number of this License which applies to it and "any Program specifies that a certain numbered version of the GNU General
later version", you have the option of following the terms and conditions Public License "or any later version" applies to it, you have the
either of that version or of any later version published by the Free option of following the terms and conditions either of that numbered
Software Foundation. If the Program does not specify a version number of version or of any later version published by the Free Software
this License, you may choose any version ever published by the Free Software Foundation. If the Program does not specify a version number of the
Foundation. GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free If the Program specifies that a proxy can decide which future
programs whose distribution conditions are different, write to the author versions of the GNU General Public License can be used, that proxy's
to ask for permission. For software which is copyrighted by the Free public statement of acceptance of a version permanently authorizes you
Software Foundation, write to the Free Software Foundation; we sometimes to choose that version for the Program.
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 15. Disclaimer of Warranty.
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
POSSIBILITY OF SUCH DAMAGES.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> <one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author> Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program. If not, see <http://www.gnu.org/licenses/>.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this If the program does terminal interaction, make it output a short
when it starts in an interactive mode: notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author <program> Copyright (C) <year> <name of author>
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may parts of the General Public License. Of course, your program's commands
be called something other than `show w' and `show c'; they could even be might be different; for a GUI interface, you would use an "about box".
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your You should also get your employer (if you work as a programmer) or school,
school, if any, to sign a "copyright disclaimer" for the program, if if any, to sign a "copyright disclaimer" for the program, if necessary.
necessary. Here is a sample; alter the names: For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program The GNU General Public License does not permit incorporating your program
`Gnomovision' (which makes passes at compilers) written by James Hacker. into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
<signature of Ty Coon>, 1 April 1989 the library. If this is what you want to do, use the GNU Lesser General
Ty Coon, President of Vice Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

1324
src/ajax.js Normal file

File diff suppressed because it is too large Load diff

12
src/ajax.lang.php Normal file
View file

@ -0,0 +1,12 @@
<?php
require_once('./db/config.php');
require_once('./lang/class.default.php');
require_once('./lang/'. $config['lang']. '.php');
$l = new Lang();
header('Content-type: text/javascript');
echo $l->makeJS();
?>

726
src/ajax.php Normal file
View file

@ -0,0 +1,726 @@
<?php
/*
This file is part of myTinyTodo.
(C) Copyright 2009 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL v3 license. See file COPYRIGHT for details.
*/
set_error_handler('myErrorHandler');
set_exception_handler('myExceptionHandler');
require_once('./init.php');
require_once('./lang/class.default.php');
require_once('./lang/'.Config::get('lang').'.php');
$lang = new Lang();
if(isset($_GET['loadLists']))
{
if($needAuth && !is_logged()) $sqlWhere = 'WHERE published=1';
else $sqlWhere = '';
$t = array();
$t['total'] = 0;
$q = $db->dq("SELECT * FROM {$db->prefix}lists $sqlWhere ORDER BY id ASC");
while($r = $q->fetch_assoc($q))
{
$t['total']++;
$t['list'][] = array(
'id' => $r['id'],
'name' => htmlarray($r['name']),
'sort' => (int)$r['sorting'],
'published' => $r['published'] ? 1 :0,
);
}
echo json_encode($t);
exit;
}
elseif(isset($_GET['loadTasks']))
{
stop_gpc($_GET);
$listId = (int)_get('list');
check_read_access($listId);
$sqlWhere = ' AND list_id='. $listId;
if(_get('compl') == 0) $sqlWhere .= ' AND compl=0';
$inner = '';
$tag = trim(_get('t'));
if($tag != '') {
$tag_id = get_tag_id($tag, $listId);
$inner = "INNER JOIN {$db->prefix}tag2task ON id=task_id";
$sqlWhere .= " AND tag_id=$tag_id ";
}
$s = trim(_get('s'));
if($s != '') $sqlWhere .= " AND (title LIKE ". $db->quoteForLike("%%%s%%",$s). " OR note LIKE ". $db->quoteForLike("%%%s%%",$s). ")";
$sort = (int)_get('sort');
$sqlSort = "ORDER BY compl ASC, ";
if($sort == 1) $sqlSort .= "prio DESC, ddn ASC, duedate ASC, ow ASC";
elseif($sort == 2) $sqlSort .= "ddn ASC, duedate ASC, prio DESC, ow ASC";
else $sqlSort .= "ow ASC";
$tz = (int)_get('tz');
if(Config::get('autotz')==0 || $tz<-720 || $tz>720 || $tz%30!=0) $tz = round(date('Z')/60);
$t = array();
$t['total'] = 0;
$t['list'] = array();
$q = $db->dq("SELECT *, duedate IS NULL AS ddn FROM {$db->prefix}todolist $inner WHERE 1=1 $sqlWhere $sqlSort");
while($r = $q->fetch_assoc($q))
{
$t['total']++;
$t['list'][] = prepareTaskRow($r, $tz);
}
echo json_encode($t);
exit;
}
elseif(isset($_GET['newTask']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$listId = (int)_post('list');
$title = trim(_post('title'));
$prio = 0;
$tags = '';
if(Config::get('smartsyntax') != 0)
{
$a = parse_smartsyntax($title);
if($a === false) {
echo json_encode($t);
exit;
}
$title = $a['title'];
$prio = $a['prio'];
$tags = $a['tags'];
}
if($title == '') {
echo json_encode($t);
exit;
}
if(Config::get('autotag')) $tags .= ','._post('tag');
$tz = (int)_post('tz');
if(Config::get('autotz')==0 || $tz<-720 || $tz>720 || $tz%30!=0 ) $tz = round(date('Z')/60);
$ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE list_id=$listId AND compl=0");
$db->ex("BEGIN");
$db->dq("INSERT INTO {$db->prefix}todolist (list_id,title,d_created,ow,prio) VALUES ($listId,?,?,$ow,$prio)", array($title, time()));
$id = $db->last_insert_id();
if($tags)
{
$tag_ids = prepare_tags($tags, $listId);
if($tag_ids) {
update_task_tags($id, $tag_ids);
$db->ex("UPDATE {$db->prefix}todolist SET tags=? WHERE id=$id", $tags);
}
}
$db->ex("COMMIT");
$r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id=$id");
$t['list'][] = prepareTaskRow($r, $tz);
$t['total'] = 1;
echo json_encode($t);
exit;
}
elseif(isset($_GET['fullNewTask']))
{
check_write_access();
stop_gpc($_POST);
$listId = (int)_post('list');
$title = trim(_post('title'));
$note = str_replace("\r\n", "\n", trim(_post('note')));
$prio = (int)_post('prio');
if($prio < -1) $prio = -1;
elseif($prio > 2) $prio = 2;
$duedate = parse_duedate(trim(_post('duedate')));
$t = array();
$t['total'] = 0;
if($title == '') {
echo json_encode($t);
exit;
}
$tags = trim(_post('tags'));
if(Config::get('autotag')) $tags .= ','._post('tag');
$tz = (int)_post('tz');
if( Config::get('autotz')==0 || $tz<-720 || $tz>720 || $tz%30!=0 ) $tz = round(date('Z')/60);
$ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE list_id=$listId AND compl=0");
if(is_null($duedate)) $duedate = 'NULL'; else $duedate = $db->quote($duedate);
$db->ex("BEGIN");
$db->dq("INSERT INTO {$db->prefix}todolist (list_id,title,d_created,ow,prio,note,duedate) VALUES($listId,?,?,$ow,$prio,?,$duedate)", array($title,time(),$note));
$id = $db->last_insert_id();
if($tags)
{
$tag_ids = prepare_tags($tags, $listId);
if($tag_ids) {
update_task_tags($id, $tag_ids);
$db->ex("UPDATE {$db->prefix}todolist SET tags=? WHERE id=$id", $tags);
}
}
$db->ex("COMMIT");
$r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id=$id");
$t['list'][] = prepareTaskRow($r, $tz);
$t['total'] = 1;
echo json_encode($t);
exit;
}
elseif(isset($_GET['deleteTask']))
{
$id = (int)$_GET['deleteTask'];
$deleted = deleteTask($id);
$t = array();
$t['total'] = $deleted;
$t['list'][] = array('id'=>$id);
echo json_encode($t);
exit;
}
elseif(isset($_GET['completeTask']))
{
check_write_access();
$id = (int)$_GET['completeTask'];
$compl = _get('compl') ? 1 : 0;
if($compl) $ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE compl=1");
else $ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE compl=0");
$db->dq("UPDATE {$db->prefix}todolist SET compl=$compl,ow=$ow,d_completed=? WHERE id=$id", array($compl?time():0 ));
$t = array();
$t['total'] = 1;
$t['list'][] = array('id'=>$id, 'compl'=>$compl, 'ow'=>$ow);
echo json_encode($t);
exit;
}
elseif(isset($_GET['editNote']))
{
check_write_access();
$id = (int)$_GET['editNote'];
stop_gpc($_POST);
$note = str_replace("\r\n", "\n", trim(_post('note')));
$db->dq("UPDATE {$db->prefix}todolist SET note=? WHERE id=$id", $note);
$t = array();
$t['total'] = 1;
$t['list'][] = array('id'=>$id, 'note'=>nl2br(htmlarray($note)), 'noteText'=>(string)$note);
echo json_encode($t);
exit;
}
elseif(isset($_GET['editTask']))
{
check_write_access();
$id = (int)$_GET['editTask'];
stop_gpc($_POST);
$listId = (int)_post('list');
$title = trim(_post('title'));
$note = str_replace("\r\n", "\n", trim(_post('note')));
$prio = (int)_post('prio');
if($prio < -1) $prio = -1;
elseif($prio > 2) $prio = 2;
$duedate = parse_duedate(trim(_post('duedate')));
$t = array();
$t['total'] = 0;
if($title == '') {
echo json_encode($t);
exit;
}
$tags = trim(_post('tags'));
$tz = (int)_post('tz');
if( Config::get('autotz')==0 || $tz<-720 || $tz>720 || $tz%30!=0 ) $tz = round(date('Z')/60);
$db->ex("BEGIN");
$tag_ids = prepare_tags($tags, $listId);
$cur_ids = get_task_tags($id);
if($cur_ids) {
$ids = implode(',', $cur_ids);
$db->ex("DELETE FROM {$db->prefix}tag2task WHERE task_id=$id");
$db->dq("UPDATE {$db->prefix}tags SET tags_count=tags_count-1 WHERE id IN ($ids)");
}
if($tag_ids) {
update_task_tags($id, $tag_ids);
}
if(is_null($duedate)) $duedate = 'NULL'; else $duedate = $db->quote($duedate);
$db->dq("UPDATE {$db->prefix}todolist SET title=?,note=?,prio=?,tags=?,duedate=$duedate WHERE id=$id", array($title,$note,$prio,$tags));
$db->ex("COMMIT");
$r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id=$id");
if($r) {
$t['list'][] = prepareTaskRow($r, $tz);
$t['total'] = 1;
}
echo json_encode($t);
exit;
}
elseif(isset($_GET['changeOrder']))
{
check_write_access();
stop_gpc($_POST);
$s = _post('order');
parse_str($s, $order);
$t = array();
$t['total'] = 0;
if($order)
{
$ad = array();
foreach($order as $id=>$diff) {
$ad[(int)$diff][] = (int)$id;
}
$db->ex("BEGIN");
foreach($ad as $diff=>$ids) {
if($diff >=0) $set = "ow=ow+".$diff;
else $set = "ow=ow-".abs($diff);
$db->dq("UPDATE {$db->prefix}todolist SET $set WHERE id IN (".implode(',',$ids).")");
}
$db->ex("COMMIT");
$t['total'] = 1;
}
echo json_encode($t);
exit;
}
elseif(isset($_POST['login']))
{
$t = array('logged' => 0);
if(!$needAuth) {
$t['disabled'] = 1;
echo json_encode($t);
exit;
}
stop_gpc($_POST);
$password = _post('password');
if($password == Config::get('password')) {
$t['logged'] = 1;
session_regenerate_id(1);
$_SESSION['logged'] = 1;
}
echo json_encode($t);
exit;
}
elseif(isset($_POST['logout']))
{
$_SESSION = array();
$t = array('logged' => 0);
echo json_encode($t);
exit;
}
elseif(isset($_GET['suggestTags']))
{
$listId = (int)_get('list');
check_read_access($listId);
$begin = trim(_get('q'));
$limit = (int)_get('limit');
if($limit<1) $limit = 8;
$q = $db->dq("SELECT name,id FROM {$db->prefix}tags WHERE list_id=$listId AND name LIKE ". $db->quoteForLike('%s%%',$begin). " AND tags_count>0 ORDER BY name LIMIT $limit");
$s = '';
while($r = $q->fetch_row()) {
$s .= "$r[0]|$r[1]\n";
}
echo htmlarray($s);
exit;
}
elseif(isset($_GET['setPrio']))
{
check_write_access();
$id = (int)$_GET['setPrio'];
$prio = (int)_get('prio');
if($prio < -1) $prio = -1;
elseif($prio > 2) $prio = 2;
$db->ex("UPDATE {$db->prefix}todolist SET prio=$prio WHERE id=$id");
$t = array();
$t['total'] = 1;
$t['list'][] = array('id'=>$id, 'prio'=>$prio);
echo json_encode($t);
exit;
}
elseif(isset($_GET['tagCloud']))
{
$listId = (int)_get('list');
check_read_access($listId);
$a = array();
$q = $db->dq("SELECT name,tags_count FROM {$db->prefix}tags WHERE list_id=$listId AND tags_count>0 ORDER BY tags_count ASC");
while($r = $q->fetch_row()) {
$a[$r[0]] = $r[1];
}
$t = array();
$t['total'] = 0;
$count = sizeof($a);
if(!$count) {
echo json_encode($t);
exit;
}
$qmax = max(array_values($a));
$qmin = min(array_values($a));
if($count >= 10) $grades = 10;
else $grades = $count;
$step = ($qmax - $qmin)/$grades;
foreach($a as $tag=>$q) {
$t['cloud'][] = array('tag'=>htmlarray($tag), 'w'=> tag_size($qmin,$q,$step) );
}
$t['total'] = $count;
echo json_encode($t);
exit;
}
elseif(isset($_POST['addList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$name = str_replace(array('"',"'",'<','>','&'),array('','','','',''),trim(_post('name')));
$db->dq("INSERT INTO {$db->prefix}lists (name) VALUES (?)", array($name));
$id = $db->last_insert_id();
$t['total'] = 1;
$r = $db->sqa("SELECT * FROM {$db->prefix}lists WHERE id=$id");
$t['list'][] = array(
'id' => $r['id'],
'name' => htmlarray($r['name']),
'sort' => (int)$r['sorting'],
'published' => $r['published'] ? 1 :0,
);
echo json_encode($t);
exit;
}
elseif(isset($_POST['renameList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$id = (int)_post('id');
$name = str_replace(array('"',"'",'<','>','&'),array('','','','',''),trim(_post('name')));
$db->dq("UPDATE {$db->prefix}lists SET name=? WHERE id=$id", array($name));
$t['total'] = $db->affected();
$r = $db->sqa("SELECT * FROM {$db->prefix}lists WHERE id=$id");
$t['list'][] = array(
'id' => $r['id'],
'name' => htmlarray($r['name']),
'sort' => (int)$r['sorting'],
'published' => $r['published'] ? 1 :0,
);
echo json_encode($t);
exit;
}
elseif(isset($_POST['deleteList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$id = (int)_post('id');
$db->ex("BEGIN");
$db->ex("DELETE FROM {$db->prefix}lists WHERE id=$id");
$t['total'] = $db->affected();
if($t['total']) {
$db->ex("DELETE FROM {$db->prefix}tags WHERE list_id=$id");
# sqlite doesnt support DELETE FROM INNNER JOIN
$db->ex("DELETE FROM {$db->prefix}tag2task WHERE task_id IN (SELECT id FROM {$db->prefix}todolist WHERE list_id=$id)");
$db->ex("DELETE FROM {$db->prefix}todolist WHERE list_id=$id");
}
$db->ex("COMMIT");
echo json_encode($t);
exit;
}
elseif(isset($_GET['setSort']))
{
check_write_access();
$listId = (int)_post('list');
$sort = (int)_post('sort');
if($sort < 0 || $sort > 2) $sort = 0;
$db->ex("UPDATE {$db->prefix}lists SET sorting=$sort WHERE id=$listId");
echo json_encode(array('total'=>1));
exit;
}
elseif(isset($_GET['publishList']))
{
check_write_access();
$listId = (int)_post('list');
$publish = (int)_post('publish');
$db->ex("UPDATE {$db->prefix}lists SET published=? WHERE id=$listId", array($publish ? 1 : 0));
echo json_encode(array('total'=>1));
exit;
}
elseif(isset($_GET['moveTask']))
{
check_write_access();
$id = (int)_post('id');
// $fromId = (int)_post('from');
$toId = (int)_post('to');
$r = moveTask($id, $toId);
echo json_encode(array('total'=>$r?1:0));
exit;
}
###################################################################################################
function prepareTaskRow($r, $tz)
{
global $lang;
$dueA = prepare_duedate($r['duedate'], $tz);
$dCreated = timestampToDatetime($r['d_created'], $tz);
return array(
'id' => $r['id'],
'title' => htmlarray($r['title']),
'date' => htmlarray($dCreated),
'dateInline' => htmlarray(sprintf($lang->get('taskdate_inline'), $dCreated)),
'dateCompleted' => htmlarray(timestampToDatetime($r['d_completed'], $tz)),
'compl' => (int)$r['compl'],
'prio' => $r['prio'],
'note' => nl2br(htmlarray($r['note'])),
'noteText' => (string)$r['note'],
'ow' => (int)$r['ow'],
'tags' => htmlarray($r['tags']),
'duedate' => $dueA['formatted'],
'dueClass' => $dueA['class'],
'dueStr' => htmlarray($dueA['str']),
'dueInt' => date2int($r['duedate']),
);
}
function check_read_access($listId = null)
{
global $db;
if(Config::get('password') == '') return true;
if(is_logged()) return true;
if($listId)
{
$id = $db->sq("SELECT id FROM {$db->prefix}lists WHERE id=? AND published=1", array($listId));
if($id) return;
}
echo json_encode( array('total'=>0, 'list'=>array(), 'denied'=>1) );
exit;
}
function check_write_access()
{
if(Config::get('password') == '') return;
if(is_logged()) return;
echo json_encode( array('total'=>0, 'list'=>array(), 'denied'=>1) );
exit;
}
function prepare_tags(&$tags_str, $listId)
{
$tag_ids = array();
$tag_names = array();
$tags = explode(',', $tags_str);
foreach($tags as $v)
{
# remove duplicate tags?
$tag = str_replace(array('"',"'",'<','>','&'),array('','','','',''),trim($v));
if($tag == '') continue;
list($tag_id,$tag_name) = get_or_create_tag($tag, $listId);
if($tag_id && !in_array($tag_id, $tag_ids)) {
$tag_ids[] = $tag_id;
$tag_names[] = $tag_name;
}
}
$tags_str = implode(',', $tag_names);
return $tag_ids;
}
function get_or_create_tag($name, $listId)
{
global $db;
$tag = $db->sq("SELECT id,name FROM {$db->prefix}tags WHERE list_id=? AND name=?", array($listId, $name));
if($tag) return $tag;
# need to create tag
$db->ex("INSERT INTO {$db->prefix}tags (name,list_id) VALUES (?,?)", array($name,$listId));
return array($db->last_insert_id(), $name);
}
function get_tag_id($tag, $listId)
{
global $db;
$id = $db->sq("SELECT id FROM {$db->prefix}tags WHERE list_id=? AND name=?", array($listId, $tag));
return $id ? $id : 0;
}
function get_task_tags($id)
{
global $db;
$q = $db->dq("SELECT tag_id FROM {$db->prefix}tag2task WHERE task_id=?", $id);
$a = array();
while($r = $q->fetch_row()) {
$a[] = $r[0];
}
return $a;
}
function update_task_tags($id, $tag_ids)
{
global $db;
foreach($tag_ids as $v) {
$db->ex("INSERT INTO {$db->prefix}tag2task (task_id,tag_id) VALUES ($id,$v)");
}
$db->ex("UPDATE {$db->prefix}tags SET tags_count=tags_count+1 WHERE id IN (". implode(',', $tag_ids). ")");
}
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;
return $a;
}
function tag_size($qmin, $q, $step)
{
if($step == 0) return 1;
$v = ceil(($q - $qmin)/$step);
if($v == 0) return 0;
else return $v-1;
}
function parse_duedate($s)
{
$y = $m = $d = 0;
if(preg_match("|^(\d+)-(\d+)-(\d+)\b|", $s, $ma)) {
$y = (int)$ma[1]; $m = (int)$ma[2]; $d = (int)$ma[3];
}
elseif(preg_match("|^(\d+)\/(\d+)\/(\d+)\b|", $s, $ma))
{
if(Config::get('duedateformat') == 4) {
$d = (int)$ma[1]; $m = (int)$ma[2]; $y = (int)$ma[3];
} else {
$m = (int)$ma[1]; $d = (int)$ma[2]; $y = (int)$ma[3];
}
}
elseif(preg_match("|^(\d+)\.(\d+)\.(\d+)\b|", $s, $ma)) {
$d = (int)$ma[1]; $m = (int)$ma[2]; $y = (int)$ma[3];
}
elseif(preg_match("|^(\d+)\.(\d+)\b|", $s, $ma)) {
$d = (int)$ma[1]; $m = (int)$ma[2];
$a = explode(',', date('Y,m,d'));
if( $m<(int)$a[1] || ($m==(int)$a[1] && $d<(int)$a[2]) ) $y = (int)$a[0]+1;
else $y = (int)$a[0];
}
elseif(preg_match("|^(\d+)\/(\d+)\b|", $s, $ma))
{
if(Config::get('duedateformat') == 4) {
$d = (int)$ma[1]; $m = (int)$ma[2];
} else {
$m = (int)$ma[1]; $d = (int)$ma[2];
}
$a = explode(',', date('Y,m,d'));
if( $m<(int)$a[1] || ($m==(int)$a[1] && $d<(int)$a[2]) ) $y = (int)$a[0]+1;
else $y = (int)$a[0];
}
else return null;
if($y < 100) $y = 2000 + $y;
elseif($y < 1000 || $y > 2099) $y = 2000 + (int)substr((string)$y, -2);
if($m > 12) $m = 12;
$maxdays = daysInMonth($m,$y);
if($m < 10) $m = '0'.$m;
if($d > $maxdays) $d = $maxdays;
elseif($d < 10) $d = '0'.$d;
return "$y-$m-$d";
}
function prepare_duedate($duedate, $tz)
{
global $lang;
$a = array( 'class'=>'', 'str'=>'', 'formatted'=>'' );
if($duedate == '') {
return $a;
}
$ad = explode('-', $duedate);
$at = explode('-', gmdate('Y-m-d', time() + $tz*60));
$diff = mktime(0,0,0,$ad[1],$ad[2],$ad[0]) - mktime(0,0,0,$at[1],$at[2],$at[0]);
if($diff < -604800 && $ad[0] == $at[0]) { $a['class'] = 'past'; $a['str'] = formatDate3(Config::get('dateformatshort'), (int)$ad[0], (int)$ad[1], (int)$ad[2], $lang); }
elseif($diff < -604800) { $a['class'] = 'past'; $a['str'] = formatDate3(Config::get('dateformat'), (int)$ad[0], (int)$ad[1], (int)$ad[2], $lang); }
elseif($diff < -86400) { $a['class'] = 'past'; $a['str'] = sprintf($lang->get('daysago'),ceil(abs($diff)/86400)); }
elseif($diff < 0) { $a['class'] = 'past'; $a['str'] = $lang->get('yesterday'); }
elseif($diff < 86400) { $a['class'] = 'today'; $a['str'] = $lang->get('today'); }
elseif($diff < 172800) { $a['class'] = 'today'; $a['str'] = $lang->get('tomorrow'); }
elseif($diff < 691200) { $a['class'] = 'soon'; $a['str'] = sprintf($lang->get('indays'),ceil($diff/86400)); }
elseif($ad[0] == $at[0]) { $a['class'] = 'future'; $a['str'] = formatDate3(Config::get('dateformatshort'), (int)$ad[0], (int)$ad[1], (int)$ad[2], $lang); }
else { $a['class'] = 'future'; $a['str'] = formatDate3(Config::get('dateformat'), (int)$ad[0], (int)$ad[1], (int)$ad[2], $lang); }
if(Config::get('duedateformat') == 2) $a['formatted'] = (int)$ad[1].'/'.(int)$ad[2].'/'.$ad[0];
elseif(Config::get('duedateformat') == 3) $a['formatted'] = $ad[2].'.'.$ad[1].'.'.$ad[0];
elseif(Config::get('duedateformat') == 4) $a['formatted'] = $ad[2].'/'.$ad[1].'/'.$ad[0];
else $a['formatted'] = $duedate;
return $a;
}
function date2int($d)
{
if(!$d) return 33330000;
$ad = explode('-', $d);
$s = $ad[0];
if(strlen($ad[1]) < 2) $s .= "0$ad[1]"; else $s .= $ad[1];
if(strlen($ad[2]) < 2) $s .= "0$ad[2]"; else $s .= $ad[2];
return (int)$s;
}
function daysInMonth($m, $y=0)
{
if($y == 0) $y = (int)date('Y');
$a = array(1=>31,(($y-2000)%4?28:29),31,30,31,30,31,31,30,31,30,31);
if(isset($a[$m])) return $a[$m]; else return 0;
}
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
if($errno==E_ERROR || $errno==E_CORE_ERROR || $errno==E_COMPILE_ERROR || $errno==E_USER_ERROR || $errno==E_PARSE) $error = 'Error';
elseif($errno==E_WARNING || $errno==E_CORE_WARNING || $errno==E_COMPILE_WARNING || $errno==E_USER_WARNING || $errno==E_STRICT) {
if(error_reporting() & $errno) $error = 'Warning'; else return;
}
elseif($errno==E_NOTICE || $errno==E_USER_NOTICE) {
if(error_reporting() & $errno) $error = 'Notice'; else return;
}
elseif(defined('E_DEPRECATED') && ($errno==E_DEPRECATED || $errno==E_USER_DEPRECATED)) { # since 5.3.0
if(error_reporting() & $errno) $error = 'Notice'; else return;
}
else $error = "Error ($errno)"; # here may be E_RECOVERABLE_ERROR
throw new Exception("$error: '$errstr' in $errfile:$errline", -1);
}
function myExceptionHandler($e)
{
if(-1 == $e->getCode()) {
echo $e->getMessage(); exit;
}
echo 'Exception: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine();
exit;
}
function deleteTask($id)
{
check_write_access();
global $db;
$tags = get_task_tags($id);
$db->ex("BEGIN");
if($tags) {
$s = implode(',', $tags);
$db->ex("DELETE FROM {$db->prefix}tag2task WHERE task_id=$id");
$db->ex("UPDATE {$db->prefix}tags SET tags_count=tags_count-1 WHERE id IN ($s)");
$db->ex("DELETE FROM {$db->prefix}tags WHERE tags_count < 1"); # slow on large amount of tags
}
$db->dq("DELETE FROM {$db->prefix}todolist WHERE id=$id");
$affected = $db->affected();
$db->ex("COMMIT");
return $affected;
}
function moveTask($id, $listId)
{
check_write_access();
global $db;
$r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id=?", array($id));
if(!$r || $listId == $r['list_id']) return false;
if(!$db->sq("SELECT COUNT(*) FROM {$db->prefix}lists WHERE id=?", $listId))
return false;
$ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE list_id=? AND compl=?", array($listId, $r['compl']?1:0));
$tags = get_task_tags($id);
$db->ex("BEGIN");
if($tags)
{
$s = implode(',', $tags);
$db->ex("DELETE FROM {$db->prefix}tag2task WHERE task_id=?", $id);
$db->ex("UPDATE {$db->prefix}tags SET tags_count=tags_count-1 WHERE id IN ($s)");
$db->ex("DELETE FROM {$db->prefix}tags WHERE tags_count < 1"); #slow
update_task_tags($id, prepare_tags($r['tags'], $listId));
}
$db->dq("UPDATE {$db->prefix}todolist SET list_id=?, ow=? WHERE id=?", array($listId, $ow, $id));
$db->ex("COMMIT");
return true;
}
?>

View file

@ -1,228 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2022-2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
require_once('./init.php');
if (MTT_DEBUG) {
set_error_handler('myErrorHandler'); //catch Notices, Warnings
set_exception_handler('myExceptionHandler');
}
else {
ini_set('display_errors', '0');
}
require_once(MTTINC. 'api/ListsController.php');
require_once(MTTINC. 'api/TasksController.php');
require_once(MTTINC. 'api/TagsController.php');
require_once(MTTINC. 'api/AuthController.php');
require_once(MTTINC. 'api/ExtSettingsController.php');
$endpoints = array(
'/lists' => [
'GET' => [ ListsController::class , 'get' ],
'POST' => [ ListsController::class , 'post' ],
'PUT' => [ ListsController::class , 'put' ],
],
'/lists/(-?\d+)' => [
'GET' => [ ListsController::class , 'getId' ],
'PUT' => [ ListsController::class , 'putId' ],
'DELETE' => [ ListsController::class , 'deleteId' ],
'POST' => [ ListsController::class , 'putId' ], //compatibility
],
'/tasks' => [
'GET' => [ TasksController::class , 'get' ],
'POST' => [ TasksController::class , 'post' ],
'PUT' => [ TasksController::class , 'put' ],
],
'/tasks/(-?\d+)' => [
'PUT' => [ TasksController::class , 'putId' ],
'DELETE' => [ TasksController::class , 'deleteId' ],
'POST' => [ TasksController::class , 'putId' ], //compatibility
],
'/tasks/parseTitle' => [
'POST' => [ TasksController::class , 'postTitleParse' ],
],
'/tasks/newCounter' => [
'POST' => [ TasksController::class , 'postNewCounter' ],
],
'/tagCloud/(-?\d+)' => [
'GET' => [ TagsController::class , 'getCloud' ],
],
'/suggestTags' => [
'GET' => [ TagsController::class , 'getSuggestions' ],
],
'/(login|logout|session)' => [
'POST' => [ AuthController::class , 'postAction' ],
],
'/ext-settings/(.+)' => [
'GET' => [ ExtSettingsController::class , 'get' ],
'PUT' => [ ExtSettingsController::class , 'put' ],
'POST' => [ ExtSettingsController::class , 'put' ], //compatibility
]
);
// look for extensions
foreach (MTTExtensionLoader::loadedExtensions() as $instance) {
if ($instance instanceof MTTHttpApiExtender) {
$newRoutes = $instance->extendHttpApi();
foreach ($newRoutes as $endpoint => $methods) {
$endpoint = '/ext/'. $instance::bundleId. $endpoint;
foreach ($methods as $k => &$v) {
$v[3] = true; // Mark extension method
}
$endpoints[$endpoint] = $methods;
}
}
}
$req = new ApiRequest();
$response = new ApiResponse();
$executed = false;
$data = null;
foreach ($endpoints as $search => $methods) {
$m = array();
if (preg_match("#^$search$#", $req->path, $m)) {
$classDescr = $methods[$req->method] ?? null;
// check if http method is supported for path
if ( is_null($classDescr) ) {
$response->htmlContent("Unknown method for resource", 500)
->exit();
}
if ( !is_array($classDescr) || count($classDescr) < 2) {
$response->htmlContent("Incorrect method definition", 500)
->exit();
}
// check if class method exists
$class = $classDescr[0];
$classMethod = $classDescr[1];
$isExtMethod = $classDescr[3] ?? false;
if ($isExtMethod) {
if (false == ($classDescr[2] ?? false)) { //TODO: describe $classDescr[2]
// By default all extension methods require write access rights
checkWriteAccess();
}
}
$param = null;
if (count($m) >= 2) {
$param = $m[1];
}
if (method_exists($class, $classMethod)) { // test for static with ReflectionMethod?
if ($req->method != 'GET' && $req->contentType == 'application/json') {
if ($req->decodeJsonBody() === false) {
$response->htmlContent("Failed to parse JSON body", 500)
->exit();
}
}
$instance = new $class($req, $response);
$instance->$classMethod($param);
$executed = true;
break;
}
else {
if (MTT_DEBUG) {
$response->htmlContent("Class method $class:$classMethod() not found", 405)
->exit();
}
$response->htmlContent("Class method not found", 405)
->exit();
}
}
}
if (!$executed) {
if (MTT_DEBUG) {
$response->htmlContent("Unknown endpoint: {$req->method} {$req->path}", 404)
->exit();
}
$response->htmlContent("Unknown endpoint", 404);
}
$response->exit();
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
if ($errno==E_ERROR || $errno==E_CORE_ERROR || $errno==E_COMPILE_ERROR || $errno==E_USER_ERROR || $errno==E_PARSE) {
$error = 'Error';
}
elseif ($errno==E_WARNING || $errno==E_CORE_WARNING || $errno==E_COMPILE_WARNING || $errno==E_USER_WARNING) {
if (error_reporting() & $errno) $error = 'Warning'; else return;
}
elseif ($errno==E_NOTICE || $errno==E_USER_NOTICE || $errno==E_DEPRECATED || $errno==E_USER_DEPRECATED) {
if (error_reporting() & $errno) $error = 'Notice'; else return;
}
else $error = "Error ($errno)"; // here may be E_RECOVERABLE_ERROR
throw new Exception("$error: '$errstr' in $errfile:$errline", -1);
}
function myExceptionHandler(Throwable $e)
{
// to avoid Exception thrown without a stack frame
try
{
if (-1 == $e->getCode()) {
//thrown in myErrorHandler
http_response_code(500);
logAndDie( $e->getMessage() );
}
$c = get_class($e);
$errText = "Exception ($c): '". $e->getMessage(). "' in ". $e->getFile(). ":". $e->getLine() ;
if (MTT_DEBUG) {
if ( count($e->getTrace()) > 0 ) {
$errText .= "\n". $e->getTraceAsString() ;
}
}
http_response_code(500);
logAndDie($errText);
}
catch (Exception $e) {
http_response_code(500);
logAndDie('Exception in ExceptionHandler: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
}
exit;
}
function checkReadAccess(?int $listId = null)
{
check_token();
$db = DBConnection::instance();
if (is_logged()) return true;
if ($listId !== null)
{
$id = $db->sq("SELECT id FROM {$db->prefix}lists WHERE id=? AND published=1", array($listId));
if ($id) return;
}
http_response_code(403);
jsonExit( array('total'=>0, 'list'=>array(), 'denied'=>1) );
}
function checkWriteAccess(?int $listId = null)
{
check_token();
if (haveWriteAccess($listId)) return;
http_response_code(403);
jsonExit( array('total'=>0, 'list'=>array(), 'denied'=>1) );
}
function haveWriteAccess(?int $listId = null) : bool
{
if (is_readonly()) {
return false;
}
// check list exist
if ($listId !== null && $listId != -1)
{
$db = DBConnection::instance();
$count = $db->sq("SELECT COUNT(*) FROM {$db->prefix}lists WHERE id=?", array($listId));
if (!$count) return false;
}
return true;
}

168
src/class.db.mysql.php Normal file
View file

@ -0,0 +1,168 @@
<?php
# Copyright 2009 Max Pozdeev
class DatabaseResult_Mysql
{
var $parent;
var $q;
var $query;
var $rows = NULL;
var $affected = NULL;
var $prefix = '';
function __construct($query, &$h, $resultless = 0)
{
$this->parent = $h;
$this->query = $query;
$this->q = mysql_query($query, $this->parent->dbh);
if(!$this->q)
{
throw new Exception($this->parent->error());
}
}
function affected()
{
if(is_null($this->affected))
{
$this->affected = mysql_affected_rows($this->parent->dbh);
}
return $this->affected;
}
function fetch_row()
{
return mysql_fetch_row($this->q);
}
function fetch_assoc()
{
return mysql_fetch_assoc($this->q);
}
function rows()
{
if (!is_null($this -> rows)) return $this->rows;
$this->rows = mysql_num_rows($this->q);
return $this->rows;
}
}
class Database_Mysql
{
var $dbh;
var $error_str;
function __construct()
{
}
function connect($host, $user, $pass, $db)
{
if(!$this->dbh = @mysql_connect($host,$user,$pass))
{
throw new Exception(mysql_error());
}
if( @!mysql_select_db($db, $this->dbh) )
{
throw new Exception($this->error());
}
return true;
}
function last_insert_id()
{
return mysql_insert_id($this->dbh);
}
function error()
{
return mysql_error($this->dbh);
}
function sq($query, $p = NULL)
{
$q = $this->_dq($query, $p);
if($q->rows()) $res = $q->fetch_row();
else return NULL;
if(sizeof($res) > 1) return $res;
else return $res[0];
}
function sqa($query, $p = NULL)
{
$q = $this->_dq($query, $p);
if($q->rows()) $res = $q->fetch_assoc();
else return NULL;
if(sizeof($res) > 1) return $res;
else return $res[0];
}
function dq($query, $p = NULL)
{
return $this->_dq($query, $p);
}
function ex($query, $p = NULL)
{
return $this->_dq($query, $p, 1);
}
private function _dq($query, $p = NULL, $resultless = 0)
{
if(!isset($p)) $p = array();
elseif(!is_array($p)) $p = array($p);
$m = explode('?', $query);
if(sizeof($p)>0)
{
if(sizeof($m)< sizeof($p)+1) {
throw new Exception("params to set MORE than query params");
}
if(sizeof($m)> sizeof($p)+1) {
throw new Exception("params to set LESS than query params");
}
$query = "";
for($i=0; $i<sizeof($m)-1; $i++) {
$query .= $m[$i]. $this->quote($p[$i]);
}
$query .= $m[$i];
}
return new DatabaseResult_Mysql($query, $this, $resultless);
}
function affected()
{
return mysql_affected_rows($this->dbh);
}
function quote($s)
{
return '\''. addslashes($s). '\'';
}
function quoteForLike($format, $s)
{
$s = str_replace(array('%','_'), array('\%','\_'), addslashes($s));
return '\''. sprintf($format, $s). '\'';
}
function table_exists($table)
{
$table = addslashes($table);
$q = mysql_query("SELECT 1 FROM `$table` WHERE 1=0", $this->dbh);
if($q === false) return false;
else return true;
}
}
?>

159
src/class.db.sqlite3.php Normal file
View file

@ -0,0 +1,159 @@
<?php
# Copyright 2009 Max Pozdeev
class DatabaseResult_Sqlite3
{
private $parent;
private $q;
var $query;
var $prefix;
function __construct($query, &$h, $resultless = 0)
{
$this->parent = $h;
$this->parent->lastQuery = $this->query = $query;
if($resultless)
{
$r = $this->parent->dbh->exec($query);
if($r === false) {
$ei = $this->parent->dbh->errorInfo();
throw new Exception($ei[2]);
}
$this->parent->affected = $r;
}
else
{
$this->q = $this->parent->dbh->query($query);
if(!$this->q) {
$ei = $this->parent->dbh->errorInfo();
throw new Exception($ei[2]);
}
$this->parent->affected = $this->q->rowCount();
}
}
function fetch_row()
{
return $this->q->fetch(PDO::FETCH_NUM);
}
function fetch_assoc()
{
return $this->q->fetch(PDO::FETCH_ASSOC);
}
}
class Database_Sqlite3
{
var $dbh;
var $affected = null;
var $lastQuery;
function __construct()
{
}
function connect($filename)
{
try {
$this->dbh = new PDO("sqlite:$filename");
}
catch(PDOException $e) {
throw new Exception($e->getMessage());
}
return true;
}
function sq($query, $p = NULL)
{
$q = $this->_dq($query, $p);
$res = $q->fetch_row();
if($res === false) return NULL;
if(sizeof($res) > 1) return $res;
else return $res[0];
}
function sqa($query, $p = NULL)
{
$q = $this->_dq($query, $p);
$res = $q->fetch_assoc();
if($res === false) return NULL;
if(sizeof($res) > 1) return $res;
else return $res[0];
}
function dq($query, $p = NULL)
{
return $this->_dq($query, $p);
}
/*
for resultless queries like INSERT,UPDATE
*/
function ex($query, $p = NULL)
{
return $this->_dq($query, $p, 1);
}
private function _dq($query, $p = NULL, $resultless = 0)
{
if(!isset($p)) $p = array();
elseif(!is_array($p)) $p = array($p);
$m = explode('?', $query);
if(sizeof($p)>0)
{
if(sizeof($m)< sizeof($p)+1) {
throw new Exception("params to set MORE than query params");
}
if(sizeof($m)> sizeof($p)+1) {
throw new Exception("params to set LESS than query params");
}
$query = "";
for($i=0; $i<sizeof($m)-1; $i++) {
$query .= $m[$i]. $this->quote($p[$i]);
}
$query .= $m[$i];
}
return new DatabaseResult_Sqlite3($query, $this, $resultless);
}
function affected()
{
return $this->affected;
}
function quote($s)
{
return $this->dbh->quote($s);
}
function quoteForLike($format, $s)
{
$s = str_replace(array('\\','%','_'), array('\\\\','\%','\_'), $s);
return $this->dbh->quote(sprintf($format, $s)). " ESCAPE '\'";
}
function last_insert_id()
{
return $this->dbh->lastInsertId();
}
function table_exists($table)
{
$table = $this->dbh->quote($table);
$q = $this->dbh->query("SELECT 1 FROM $table WHERE 1=0");
if($q === false) return false;
else return true;
}
}
?>

142
src/common.php Normal file
View file

@ -0,0 +1,142 @@
<?php
function htmlarray($a, $exclude=null)
{
htmlarray_ref($a, $exclude);
return $a;
}
function htmlarray_ref(&$a, $exclude=null)
{
if(!$a) return;
if(!is_array($a)) {
$a = htmlspecialchars($a);
return;
}
reset($a);
if($exclude && !is_array($exclude)) $exclude = array($exclude);
foreach($a as $k=>$v)
{
if(is_array($v)) $a[$k] = htmlarray($v, $exclude);
elseif(!$exclude) $a[$k] = htmlspecialchars($v);
elseif(!in_array($k, $exclude)) $a[$k] = htmlspecialchars($v);
}
return;
}
function stop_gpc(&$arr)
{
if (!is_array($arr)) return 1;
if (!get_magic_quotes_gpc()) return 1;
reset($arr);
foreach($arr as $k=>$v)
{
if(is_array($arr[$k])) stop_gpc($arr[$k]);
elseif(is_string($arr[$k])) $arr[$k] = stripslashes($v);
}
return 1;
}
function _post($param,$defvalue = '')
{
if(!isset($_POST[$param])) {
return $defvalue;
}
else {
return $_POST[$param];
}
}
function _get($param,$defvalue = '')
{
if(!isset($_GET[$param])) {
return $defvalue;
}
else {
return $_GET[$param];
}
}
class Config
{
public static $params = array(
'db' => array('default'=>'sqlite', 'type'=>'s'),
'mysql.host' => array('default'=>'localhost', 'type'=>'s'),
'mysql.db' => array('default'=>'mytinytodo', 'type'=>'s'),
'mysql.user' => array('default'=>'user', 'type'=>'s'),
'mysql.password' => array('default'=>'', 'type'=>'s'),
'prefix' => array('default'=>'', 'type'=>'s'),
'title' => array('default'=>'', 'type'=>'s'),
'lang' => array('default'=>'en', 'type'=>'s'),
'password' => array('default'=>'', 'type'=>'s'),
'smartsyntax' => array('default'=>1, 'type'=>'i'),
'autotz' => array('default'=>1, 'type'=>'i'),
'autotag' => array('default'=>1, 'type'=>'i'),
'duedateformat' => array('default'=>1, 'type'=>'i'),
'firstdayofweek' => array('default'=>1, 'type'=>'i'),
'session' => array('default'=>'files', 'type'=>'s', 'options'=>array('files','default')),
'clock' => array('default'=>24, 'type'=>'i', 'options'=>array(12,24)),
'dateformat' => array('default'=>'j M Y', 'type'=>'s'),
'dateformatshort' => array('default'=>'j M', 'type'=>'s'),
);
public static $config;
public function loadConfig($config)
{
self::$config = $config;
}
public static function get($key)
{
if(isset(self::$config[$key])) return self::$config[$key];
elseif(isset(self::$params[$key])) return self::$params[$key]['default'];
else return null;
}
public static function set($key, $value)
{
self::$config[$key] = $value;
}
public static function save()
{
$s = '';
foreach(self::$params as $param=>$v)
{
if(!isset(self::$config[$param])) $val = $v['default'];
elseif(isset($v['options']) && !in_array(self::$config[$param], $v['options'])) $val = $v['default'];
else $val = self::$config[$param];
if($v['type']=='i') {
$s .= "\$config['$param'] = ".(int)$val.";\n";
}
else {
$s .= "\$config['$param'] = '".str_replace(array("\\","'"),array("\\\\","\\'"),$val)."';\n";
}
}
$f = fopen('./db/config.php', 'w');
if($f === false) throw new Exception("Error while saving config file");
fwrite($f, "<?php\n\$config = array();\n$s?>");
fclose($f);
}
}
function formatDate3($format, $ay, $am, $ad, $lang)
{
# F - month long, M - month short
# m - month 2-digit, n - month 1-digit
# d - day 2-digit, j - day 1-digit
$ml = $lang->get('months_long');
$ms = $lang->get('months_short');
$Y = $ay;
$n = $am;
$m = $n < 10 ? '0'.$n : $n;
$F = $ml[$am-1];
$M = $ms[$am-1];
$j = $ad;
$d = $j < 10 ? '0'.$j : $j;
return strtr($format, array('Y'=>$Y, 'F'=>$F, 'M'=>$M, 'n'=>$n, 'm'=>$m, 'd'=>$d, 'j'=>$j));
}
?>

View file

@ -1,24 +0,0 @@
<?php
/*
Uncomment the line with MTT_DB_TYPE if you make clean install only.
Leave it commented (with # at start) if you are upgrading from version before 1.7.
Select the database type: sqlite or mysql or postgres.
*/
#define("MTT_DB_TYPE", "sqlite");
define("MTT_DB_HOST", "localhost");
define("MTT_DB_NAME", "mytinytodo");
define("MTT_DB_USER", "mtt");
define("MTT_DB_PASSWORD", "mtt");
define("MTT_DB_PREFIX", "");
// set mysqli if needed
define("MTT_DB_DRIVER", "");
define("MTT_SALT", "Put random text here");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,310 +0,0 @@
/*!
* jQuery UI Touch Punch 1.1.5 as modified by RWAP Software
* based on original touchpunch v0.2.3 which has not been updated since 2014
*
* Updates by RWAP Software to take account of various suggested changes on the original code issues
*
* Original: https://github.com/furf/jquery-ui-touch-punch
* Copyright 20112014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Fork: https://github.com/RWAP/jquery-ui-touch-punch
*
* Modified by Max Pozdeev in 2022
* - Added delay before mousedown dispatch
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "jquery", "jquery-ui" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function ($) {
// Detect touch support - Windows Surface devices and other touch devices
$.mspointer = window.navigator.msPointerEnabled;
$.touch = ( 'ontouchstart' in document
|| 'ontouchstart' in window
|| window.TouchEvent
|| (window.DocumentTouch && document instanceof DocumentTouch)
|| navigator.maxTouchPoints > 0
|| navigator.msMaxTouchPoints > 0
);
// Ignore browsers without touch or mouse support
if ((!$.touch && !$.mspointer) || !$.ui.mouse) {
return;
}
let mouseProto = $.ui.mouse.prototype,
_mouseInit = mouseProto._mouseInit,
_mouseDestroy = mouseProto._mouseDestroy,
touchHandled, lastClickTime = 0;
let delay = 300,
delayTimer,
delayEvent,
delayStarted = false,
delayFinished = false,
lastClickCoord;
/**
* Get the x,y position of a touch event
* @param {Object} event A touch event
*/
function getTouchCoords (event) {
return {
x: event.originalEvent.changedTouches[0].pageX,
y: event.originalEvent.changedTouches[0].pageY
};
}
/**
* Simulate a mouse event based on a corresponding touch event
* @param {Object} event A touch event
* @param {String} simulatedType The corresponding mouse event
*/
function simulateMouseEvent (event, simulatedType) {
// Ignore multi-touch events
if (event.originalEvent.touches.length > 1) {
return;
}
//Ignore input or textarea elements so user can still enter text
if ($(event.target).is("input") || $(event.target).is("textarea")) {
return;
}
// Prevent "Ignored attempt to cancel a touchmove event with cancelable=false" errors
if (event.cancelable) {
event.preventDefault();
}
let touch = event.originalEvent.changedTouches[0],
simulatedEvent = new MouseEvent(simulatedType, {
bubbles: true,
cancelable: true,
view:window,
screenX:touch.screenX,
screenY:touch.screenY,
clientX:touch.clientX,
clientY:touch.clientY
});
// Dispatch the simulated event to the target element
event.target.dispatchEvent(simulatedEvent);
}
function startDelayTimer (event) {
clearTimeout(delayTimer);
delayEvent = event;
delayTimer = setTimeout(function() {
fireMouseDown.call(this);
}, delay);
delayStarted = true;
delayFinished = false;
}
function fireMouseDown () {
const self = this;
delayFinished = true;
// Set the flag to prevent other widgets from inheriting the touch event
touchHandled = true;
// Track movement to determine if interaction was a click
self._touchMoved = false;
// Simulate the mouseover event
simulateMouseEvent(delayEvent, 'mouseover');
// Simulate the mousemove event
simulateMouseEvent(delayEvent, 'mousemove');
// Simulate the mousedown event
simulateMouseEvent(delayEvent, 'mousedown');
}
/**
* Handle the jQuery UI widget's touchstart events
* @param {Object} event The widget element's touchstart event
*/
mouseProto._touchStart = function (event) {
let self = this;
// Interaction time
this._startedMove = event.timeStamp;
// Track movement to determine if interaction was a click
self._startPos = getTouchCoords(event);
// Ignore the event if another widget is already being handled
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
return;
}
if (!delayStarted) {
startDelayTimer.call(self, event);
}
};
/**
* Handle the jQuery UI widget's touchmove events
* @param {Object} event The document's touchmove event
*/
mouseProto._touchMove = function (event) {
//
if (!delayFinished) {
delayStarted = false;
clearTimeout(delayTimer);
return;
}
// Ignore event if not handled
if (!touchHandled) {
return;
}
// Interaction was moved
this._touchMoved = true;
// Simulate the mousemove event
simulateMouseEvent(event, 'mousemove');
};
/**
* Handle the jQuery UI widget's touchend events
* @param {Object} event The document's touchend event
*/
mouseProto._touchEnd = function (event) {
//
if (delayStarted) {
clearTimeout(delayTimer);
delayStarted = false;
if (!delayFinished) {
fireMouseDown();
}
}
// Ignore event if not handled
if (!touchHandled) {
return;
}
// Simulate the mouseup event
simulateMouseEvent(event, 'mouseup');
// Simulate the mouseout event
simulateMouseEvent(event, 'mouseout');
// If the touch interaction did not move, it should trigger a click
// Check for this in two ways - length of time of simulation and distance moved
// Allow for Apple Stylus to be used also
let timeMoving = event.timeStamp - this._startedMove;
if (!this._touchMoved || timeMoving < 500) {
// Simulate the dblclick event if last click was not far away from the previous one
if ( event.timeStamp - lastClickTime < 400 &&
Math.abs(lastClickCoord.x - this._startPos.x) < 10 && Math.abs(lastClickCoord.y - this._startPos.y) < 10) {
simulateMouseEvent(event, 'dblclick');
}
// Simulate the click event
else
simulateMouseEvent(event, 'click');
lastClickTime = event.timeStamp
lastClickCoord = this._startPos;
}
else {
let endPos = getTouchCoords(event);
if ((Math.abs(endPos.x - this._startPos.x) < 10) && (Math.abs(endPos.y - this._startPos.y) < 10)) {
// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved || event.originalEvent.changedTouches[0].touchType === 'stylus') {
// Simulate the click event
simulateMouseEvent(event, 'click');
}
}
}
// Unset the flag to determine the touch movement stopped
this._touchMoved = false;
// Unset the flag to allow other widgets to inherit the touch event
touchHandled = false;
};
let _touchStartBound;
let _touchMoveBound;
let _touchEndBound
/**
* A duck punch of the $.ui.mouse _mouseInit method to support touch events.
* This method extends the widget with bound touch event handlers that
* translate touch events to mouse events and pass them to the widget's
* original mouse event handling methods.
*/
mouseProto._mouseInit = function () {
let self = this;
// Microsoft Surface Support = remove original touch Action
if ($.mspointer) {
self.element[0].style.msTouchAction = 'none';
}
_touchStartBound = mouseProto._touchStart.bind(self);
_touchMoveBound = mouseProto._touchMove.bind(self);
_touchEndBound = mouseProto._touchEnd.bind(self);
// Delegate the touch handlers to the widget's element
self.element.on({
touchstart: _touchStartBound,
touchmove: _touchMoveBound,
touchend: _touchEndBound
});
// Call the original $.ui.mouse init method
_mouseInit.call(self);
};
/**
* Remove the touch event handlers
*/
mouseProto._mouseDestroy = function () {
let self = this;
// Delegate the touch handlers to the widget's element
self.element.off({
touchstart: _touchStartBound,
touchmove: _touchMoveBound,
touchend: _touchEndBound
});
// Call the original $.ui.mouse destroy method
_mouseDestroy.call(self);
//
clearTimeout(delayTimer);
delayEvent = null
};
}));

File diff suppressed because it is too large Load diff

View file

@ -1,423 +0,0 @@
/*
This file is a part of myTinyTodo.
(C) Copyright 2010,2020-2025 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
"use strict";
/**
* @class
*/
function MytinytodoAjaxApi(props)
{
if (typeof mytinytodo !== 'object') {
throw "mytinytodo global object is not found!";
}
this.useREST = true;
if (props.hasOwnProperty('useREST')) {
this.useREST = !!props.useREST;
}
}
MytinytodoAjaxApi.prototype = {
/**
* required method
* @param {string} action
* @param {Object.<string, any>} [params]
* @param {ApiDriverCallback} [callback]
*
* @callback ApiDriverCallback
* @param {object} json
*/
request(action, params, callback) {
if (typeof this[action] !== 'function') {
throw "Unknown ApiDriver action: " + action;
}
this[action](params, function(json){
if (json.denied) {
mytinytodo.errorDenied();
}
if (callback) {
callback.call(mytinytodo, json)
}
});
},
loadTasks(params, callback) {
let q = '';
if (params.search && params.search != '') q += '&s=' + encodeURIComponent(params.search);
if (params.tag && params.tag != '') q += '&t=' + encodeURIComponent(params.tag);
if (params.setCompl && params.setCompl != 0) q += '&setCompl=1';
if (params.saveSort && params.saveSort != 0) q += '&saveSort=1';
$.getJSON(mytinytodo.apiUrl + 'tasks' + (mytinytodo.apiUrl.indexOf('?') > -1 ? '&' : '?') +
'list='+params.list+'&compl='+params.compl+'&sort='+params.sort+q,
callback);
},
newTask(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'newSimple',
list: params.list,
title: params.title,
tag: params.tag,
}),
success: callback,
dataType: 'json'
});
},
fullNewTask(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'newFull',
list: params.list,
title: params.title,
note: params.note,
prio: params.prio,
tags: params.tags,
duedate: params.duedate,
/* tag: params.tag, // We do not send current tag filter, autotag should set it in the form and include in tags */
}),
success: callback,
dataType: 'json'
});
},
editTask(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'edit',
title: params.title,
note: params.note,
prio: params.prio,
tags: params.tags,
duedate: params.duedate,
}),
success: callback,
dataType: 'json'
});
},
editNote(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'note',
note: params.note
}),
success: callback,
dataType: 'json'
});
},
completeTask(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'complete',
compl: params.compl
}),
success: callback,
dataType: 'json'
});
},
deleteTask(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: this.useREST ? 'DELETE' : 'POST',
contentType : 'application/json', // contentType and data are required if method is POST
data: JSON.stringify({
action: 'delete',
}),
success: callback,
dataType: 'json'
});
},
setTaskPriority(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'priority',
prio: params.priority,
}),
success: callback,
dataType: 'json'
});
},
changeOrder(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks',
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'order',
order: params.order,
}),
success: callback,
dataType: 'json'
});
},
suggestTags(params, callback) {
$.getJSON(mytinytodo.apiUrl + 'suggestTags', {list:params.list, q:params.q}, callback);
},
tagCloud(params, callback) {
$.getJSON(mytinytodo.apiUrl + 'tagCloud/' + encodeURIComponent(params.list), callback);
},
moveTask(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'move',
from: params.from,
to: params.to
}),
success: callback,
dataType: 'json'
});
},
parseTaskStr(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'tasks/parseTitle',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
list: params.list,
title: params.title,
tag: params.tag ,
}),
success: callback,
dataType: 'json'
});
},
newTaskCounter(params, callback) {
fetch(mytinytodo.apiUrl + 'tasks/newCounter', {
method: 'POST',
credentials: 'same-origin', // old browsers
headers: {
'Content-Type': 'application/json',
'MTT-Token': mytinytodo.options.token,
},
body: JSON.stringify(params)
})
.then((response) => {
if (!response.ok) throw response;
return response.json();
})
.catch((e) => {
if (e instanceof Error) console.log("newTaskCounter fetch error: ", e);
else console.log("newTaskCounter fetch error, HTTP status code: " + e.status);
})
.then(json => {
callback(json)
});
},
// Lists
loadLists(params, callback) {
$.getJSON(mytinytodo.apiUrl + 'lists', callback);
},
addList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'new',
name: params.name,
}),
success: callback,
dataType: 'json'
});
},
deleteList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'DELETE' : 'POST',
contentType : 'application/json', // contentType and data are required if method is POST
data: JSON.stringify({
action: 'delete',
}),
success: callback,
dataType: 'json'
});
},
renameList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'rename',
name: params.name,
}),
success: callback,
dataType: 'json'
});
},
setSort(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'sort',
name: params.name,
sort: params.sort
}),
success: callback,
dataType: 'json'
});
},
publishList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'publish',
publish: params.publish,
}),
success: callback,
dataType: 'json'
});
},
enableFeedKey(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'enableFeedKey',
enable: params.enable,
}),
success: callback,
dataType: 'json'
});
},
setShowNotesInList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'showNotes',
shownotes: params.shownotes,
}),
success: callback,
dataType: 'json'
});
},
setHideList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'hide',
hide: params.hide,
}),
success: callback,
dataType: 'json'
});
},
changeListOrder(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists',
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'order',
order: params.order
}),
success: callback,
dataType: 'json'
});
},
clearCompletedInList(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: this.useREST ? 'PUT' : 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'clearCompleted',
}),
success: callback,
dataType: 'json'
});
},
/* Auth */
login(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'login',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
password: params.password,
}),
success: callback,
dataType: 'json'
});
},
logout(params, callback) {
$.ajax({
url: mytinytodo.apiUrl + 'logout',
method: 'POST',
success: callback,
dataType: 'json'
});
}
};

View file

@ -1,99 +0,0 @@
/*
This file is a part of myTinyTodo.
*/
/* Dark mode */
/* prefers-color-scheme media query is used in html link tag */
:root {
color-scheme: dark;
--color-bg: #151515;
--color-text-default: #eee;
--color-text-reduced: #e0e0e0;
--color-text-reduced2: #999;
--color-text-reduced3: #666;
--color-link: #6495ED; /* CornflowerBlue */
--color-btn-reduced: #999;
--color-btn-reduced-hover: #ddd;
--color-btn-default: #fff;
--color-btn-hover: #444;
--color-submit: #444;
--color-submit-hover: #555;
--color-row-underlinig: #303030;
--color-border-default: #555;
--color-border-focus: #5a8df0;
--color-error: #ff3333;
--color-error-bg: var(--color-bg);
--color-info: #EFC300;
--color-info-bg: var(--color-bg);
--color-input-bg: #1e1e1e;
--color-toolbar: #3b3b3b;
--color-btn-toolbar-hover: #555;
--color-content-delimiter: #676767;
--color-footer: var(--color-bg);
/* Tabs */
--color-tab: #1b1b1b;
--color-tab-selected: var(--color-toolbar);
--color-tab-hover: #262626;
--color-tab-border: #676767;
--color-tab-text: #ddd;
--color-btn-tab: #ccc;
--color-btn-tab-hover: #fff;
--color-btn-tab-hover-bg: #5a5a5a;
/* Menu */
--color-menu: #252525;
--color-menu-border: #555;
--color-menu-hover: #5a8df0;
--color-menu-text: #eaeaea;
--color-menu-text-hover: #ebf0f8;
--color-menu-text-disabled: #696969;
--color-popup-shadow: 1px 2px 6px 1px rgba(85,85,85,0.1);
/* Tasklist */
--color-tasklist-row: var(--color-bg);
--color-tasklist-row-border: var(--color-row-underlinig);
--color-tasklist-row-inter-border: var(--color-tasklist-row-border);
--color-tasklist-row-expanded-border: #555;
--color-tasklist-tag: var(--color-tab-text);
--color-tasklist-note-link: #999;
--color-tasklist-link-hover: var(--color-link);
--color-tasklisk-hover-shadow: rgba(255,255,255,0.4);
--color-taglist-tag: var(--color-text-reduced);
--color-taglist-tag-bg: #444;
--color-taglist-tag-hover: var(--color-taglist-tag);
--color-taglist-tag-hover-bg: var(--color-taglist-tag-bg);
--color-tasklist-listname: #bbb;
--color-tasklist-listname-bg: #333;
/* Priority */
--color-priority-none: #676767;
--color-priority-text: var(--color-text-default);
/* DueDates */
--color-duedate-default: var(--color-tab-text);
--color-duedate-soon: #008000;
--color-duedate-today: #FF0000;
--color-duedate-past: #B52D2D;
/* Markdown */
--color-md-border: #333;
--color-md-bg-highlighted: #222;
--color-md-text-blockquote: #777;
/* Settings */
--color-settings-row: #222;
/* */
--color-placeholder: #444;
--color-placeholder-border: #555;
--svg-select: var(--svg-select-dark);
}

View file

@ -1,6 +0,0 @@
rss.svg, rss-disabled.svg - are (or based on) icons by Icons8 from https://icons8.com/icon/13841/rss
calendar.svg - icon by Icons8 from https://icons8.com/icon/__LA9wZgJaqd/calendar
loading48.gif - generated at Preloaders.net
Other images in this directory were made by Max Pozdeev the author of myTinyTodo
and licensed under the terms of GNU GPL version 2 or any later.

View file

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<polyline points="15 4, 15 9, 2 9" stroke-width="1.5" stroke="#000" fill="none" />
<polyline points="6 5, 1 9, 6 13" stroke-width="1.5" stroke="#000" fill="none" />
</svg>

Before

Width:  |  Height:  |  Size: 237 B

View file

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<polygon points="10 3, 4 8, 10 13" fill="#000"/>
</svg>

Before

Width:  |  Height:  |  Size: 118 B

View file

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<polygon points="6 3, 12 8, 6 13" fill="#000"/>
</svg>

Before

Width:  |  Height:  |  Size: 117 B

View file

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<polygon points="0 2, 8 2, 4 6" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 115 B

View file

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
<!--<rect x="0" y="0" width="14" height="14" fill="lightpink"/>-->
<polyline points="9 2, 4 7, 9 12" stroke-width="1.5" stroke="#000" fill="none" />
</svg>

Before

Width:  |  Height:  |  Size: 217 B

View file

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path fill="#fff" d="M0.5 1.5H15.5V14.5H0.5z"/>
<path fill="#788b9c" d="M15,2v12H1V2H15 M16,1H0v14h16V1L16,1z"/>
<path fill="#f78f8f" d="M0.5 1.5H15.5V4.5H0.5z"/>
<path fill="#c74343" d="M15,2v2H1V2H15 M16,1H0v4h16V1L16,1z"/>
<path fill="#c5d4de" d="M5 7H6V8H5zM7 7H8V8H7zM9 7H10V8H9zM11 7H12V8H11zM3 9H4V10H3zM5 9H6V10H5zM7 9H8V10H7zM9 9H10V10H9zM11 9H12V10H11zM3 11H4V12H3zM5 11H6V12H5zM7 11H8V12H7zM9 11H10V12H9z"/>
</svg>

Before

Width:  |  Height:  |  Size: 491 B

View file

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<polyline points="4 8, 7 12, 13 5" fill="none" stroke-width="2" stroke="#000" />
</svg>

Before

Width:  |  Height:  |  Size: 149 B

View file

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g stroke-width="1.5" fill="none">
<path d="M12.0 12.0l-8-8" stroke="#000"/>
<path d="M4.0 12.0l+8-8" stroke="#000"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

View file

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" >
<g stroke="#000" fill="none" stroke-width="1.0">
<polyline points="10 0.5, 0.5 0.5, 0.5 15.5, 13.5 15.5, 13.5 7.5" stroke-linejoin="round"/>
<polyline points="7 7, 6 10, 9 9, 15 3, 13 1, 7 7, 6 10" />
<line x1="7" y1="7" x2="9" y2="9" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 318 B

View file

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
<!--<rect x="0" y="0" width="14" height="14" fill="lightpink"/>-->
<polyline points="5 2, 10 7, 5 12" stroke-width="1.5" stroke="#000" fill="none" />
</svg>

Before

Width:  |  Height:  |  Size: 217 B

View file

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<line x1="2" y1="8" x2="14" y2="8" stroke-width="1.5" stroke="#000" />
<line x1="8" y1="2" x2="8" y2="14" stroke-width="1.5" stroke="#000" />
</svg>

Before

Width:  |  Height:  |  Size: 211 B

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<title>RSS feed icon</title>
<style type="text/css">
.button {stroke: none; fill: #bbb;}
.symbol {stroke: none; fill: white;}
</style>
<rect class="button" width="8" height="8" rx="1.5" />
<circle class="symbol" cx="2" cy="6" r="1" />
<path class="symbol" d="m 1,4 a 3,3 0 0 1 3,3 h 1 a 4,4 0 0 0 -4,-4 z" />
<path class="symbol" d="m 1,2 a 5,5 0 0 1 5,5 h 1 a 6,6 0 0 0 -6,-6 z" />
</svg>

Before

Width:  |  Height:  |  Size: 517 B

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<title>RSS feed icon</title>
<style type="text/css">
.button {stroke: none; fill: orange;}
.symbol {stroke: none; fill: white;}
</style>
<rect class="button" width="8" height="8" rx="1.5" />
<circle class="symbol" cx="2" cy="6" r="1" />
<path class="symbol" d="m 1,4 a 3,3 0 0 1 3,3 h 1 a 4,4 0 0 0 -4,-4 z" />
<path class="symbol" d="m 1,2 a 5,5 0 0 1 5,5 h 1 a 6,6 0 0 0 -6,-6 z" />
</svg>

Before

Width:  |  Height:  |  Size: 519 B

View file

@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path d="m8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm-2.4688 3.4688 2.4688 2.4688 2.4688-2.4688 1.0625 1.0625-2.4688 2.4688 2.4688 2.4688-1.0625 1.0625-2.4688-2.4688-2.4688 2.4688-1.0625-1.0625 2.4688-2.4688-2.4688-2.4688 1.0625-1.0625z" fill="#000"/>
</svg>
<!-- source:
<g stroke-width="1.5" fill="none">
<circle cx="8" cy="8" r="7" fill="#000"/>
<path d="M11.0 11.0l-6-6" stroke="#ffffff"/>
<path d="M5.0 11.0l+6-6" stroke="#ffffff"/>
</g>
-->

Before

Width:  |  Height:  |  Size: 528 B

View file

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g stroke-width="1.5" stroke="#000" fill="none">
<path d="M14 14l-4-4"/>
<circle cx="7" cy="7" r="4.5"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 177 B

View file

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
<polyline points="2 6, 7 11, 12 6" stroke-width="2" stroke="#aaa" fill="none"/>
</svg>

Before

Width:  |  Height:  |  Size: 148 B

View file

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
<polyline points="2 6, 7 11, 12 6" stroke-width="2" stroke="#444" fill="none"/>
</svg>

Before

Width:  |  Height:  |  Size: 148 B

View file

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<circle cx="3" cy="8" r="1.5" fill="#333"/>
<circle cx="8" cy="8" r="1.5" fill="#333"/>
<circle cx="13" cy="8" r="1.5" fill="#333"/>
</svg>

Before

Width:  |  Height:  |  Size: 200 B

View file

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g fill="none" stroke-width="1.5" stroke="#000" stroke-linecap="round">
<line x1="2" y1="3" x2="14" y2="3"/>
<line x1="2" y1="8" x2="14" y2="8"/>
<line x1="4" y1="13" x2="14" y2="13"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 260 B

View file

@ -1,62 +0,0 @@
<?php
/*
This file is a part of myTinyTodo.
(C) Copyright 2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
// call like: php -f svg2base64.php > ../images.css
if (php_sapi_name() != 'cli') {
error_log("Supports cli only");
exit(-1);
}
if (isset($argv[1])) {
print base64file($argv[1]);
exit();
}
$files = [];
$h = opendir(__DIR__);
while ( false !== ($file = readdir($h)) )
{
if ( preg_match('/(.+)\.svg$/', $file, $m) ) {
$files[] = $m[1];
}
}
closedir($h);
if (!$files) {
exit;
}
sort($files);
print ":root {\n";
foreach ($files as $name) {
$b64 = base64file(__DIR__. "/$name.svg");
print " --svg-{$name}: url('data:image/svg+xml;base64,$b64');\n";
}
print "}\n";
function base64file(string $filename): string
{
$content = file_get_contents($filename);
//$content = str_replace(["\n","\r\n"], ['',''], $content);
$content = cleanXml($content);
return base64_encode($content);
}
function cleanXml(string $data): string
{
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->loadXML($data);
$xpath = new DOMXPath($dom);
foreach ($xpath->query('//comment()') as $comment) {
$comment->parentNode->removeChild($comment);
}
return $dom->saveXML();
}

View file

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
<!--<rect x="0" y="0" width="14" height="14" fill="lightpink"/>-->
<polyline points="2 6, 7 11, 12 6" stroke-width="2" stroke="#000" fill="none" />
</svg>

Before

Width:  |  Height:  |  Size: 216 B

View file

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
<!--<rect x="0" y="0" width="14" height="14" fill="lightpink"/>-->
<g fill="#000">
<circle cx="7" cy="2" r="1.5" />
<circle cx="7" cy="7" r="1.5" />
<circle cx="7" cy="12" r="1.5" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 259 B

View file

@ -1,123 +0,0 @@
/* Markdown notes */
.markdown-note {
line-height: 1.3;
}
.markdown-note > *:first-child { margin-top: 0 !important; }
.markdown-note > *:last-child { margin-bottom: 0 !important; }
.markdown-note h1 { font-size:2rem; }
.markdown-note h2 { font-size:1.5rem; }
.markdown-note h3 { font-size:1.2rem; }
.markdown-note h4 { font-size:1rem; }
.markdown-note h5 { font-size:1rem; }
.markdown-note h6 { font-size:1rem; }
.markdown-note hr {
height: 1px;
border: 0;
background-color: var(--color-border-default);
}
.markdown-note p,
.markdown-note blockquote,
.markdown-note ul,
.markdown-note ol,
.markdown-note dl,
.markdown-note table,
.markdown-note pre {
margin: 12px 0;
}
.markdown-note ul,
.markdown-note ol {
padding-left: 2.3rem;
}
.markdown-note ul.no-list,
.markdown-note ol.no-list {
list-style-type: none;
padding: 0;
}
.markdown-note blockquote {
margin:15px 0;
border-left: 4px solid var(--color-md-border);
padding: 0 15px;
color: var(--color-md-text-blockquote, #777);
}
.markdown-note blockquote > :first-child {
margin-top: 0px;
}
.markdown-note blockquote > :last-child {
margin-bottom: 0px;
}
.markdown-note table {
width: 100%;
overflow: auto;
display: block;
border-spacing: 0;
border-collapse: collapse;
}
.markdown-note table th {
font-weight: bold;
}
.markdown-note table th,
.markdown-note table td {
border: 1px solid var(--color-md-border);
padding: 6px 13px;
}
.markdown-note table tr {
border-top: 1px solid var(--color-border-default);
background-color: var(--color-tasklist-row);
}
.markdown-note table tr:nth-child(2n) {
background-color: var(--color-md-bg-highlighted);
}
.markdown-note code, /* inline code */
.markdown-note tt {
font-size: 13px; /* if main font is 14px */
font-family: ui-monospace,Consolas,"SF Mono",Menlo,"Noto Sans Mono","Liberation Mono",monospace;
padding: 0px 5px;
background-color: var(--color-md-bg-highlighted);
border-radius: 3px;
}
.markdown-note code {
white-space: break-spaces;
}
.markdown-note pre {
font-size: 13px;
font-family: ui-monospace,Consolas,"SF Mono",Menlo,"Noto Sans Mono","Liberation Mono",monospace;
line-height: 1.2rem;
padding: 10px;
background-color: var(--color-md-bg-highlighted);
overflow: auto;
border-radius: 3px;
}
.markdown-note pre code, /* block of code */
.markdown-note pre tt {
margin: 0;
padding: 0;
background-color: transparent;
border: none;
}
.markdown-note pre > code {
white-space: pre;
}
.markdown-note img {
max-width: 100%;
}
/* narrow screens */
@media only screen and (max-width: 600px) {
.markdown-note pre,
.markdown-note code,
.markdown-note tt {
font-size: 14px; /* if main font is 16px */
}
}

View file

@ -1,57 +0,0 @@
@media print {
html,body { height:auto; }
h2 { display: none; }
h3 { border-bottom:2px solid #777777; }
#toolbar { display: none; }
.topblock { display:none; }
.mtt-tab { display:none; }
.mtt-tab.mtt-tab-selected { display:block; border:none; background:none; margin:0; }
.mtt-tab.mtt-tab-selected a { padding:0; display:inline-block; height:auto; }
.mtt-tab.mtt-tab-selected .title-block { display:inline-block; }
.mtt-tab.mtt-tab-selected .list-action { display:none; }
.mtt-tab.mtt-tab-selected .title { text-align:left; padding:0; margin:0; max-width:none; font-size:1.3rem; color:#000; }
.mtt-tabs-new-button { display:none; }
#tabs_buttons { display:none; }
#taskview { padding-left:0; font-weight:normal; }
#taskview .arrdown { display:none; }
#tasklist { list-style-type: decimal; list-style-position: outside; }
#tasklist li.task-row {
border-bottom:none;
margin-left:2.5rem;
/*border-bottom:1px solid #f0f0f0;*/
border: none;
}
#tasklist li.task-row:hover { box-shadow: none; }
#tasklist li.task-row.task-has-note.task-expanded .task-block,
#tasklist li.task-row.task-has-note.clicked .task-block,
#tasklist li.task-row.task-expanded { border: none; }
div.task-note-block {
border-left:1px solid #777777;
padding-left:10px;
margin-left:3px;
padding-top:0px;
font-size:9pt;
color:#333333;
}
.task-middle { margin-left:0px; margin-right:3px; }
.task-left { display:none; }
.task-actions { display:none; }
.task-date { white-space:nowrap; margin-left:10px; }
#tasklist li.today, #tasklist li.past { background-color:#ffffff; border-color:#dedede; }
.task-prio { font-weight:bold; }
li.task-completed { opacity:1; }
#footer_content { border-top:1px solid #777777; background:none; }
#footer_content a { text-decoration:none; color:#000000; }
#tagcloudbtn { display:none; }
.mtt-notes-showhide { display:none; }
#taskview img { display:none; }
}

File diff suppressed because it is too large Load diff

View file

@ -1,47 +0,0 @@
body { direction:rtl; }
.topblock h2 {
background-position: right;
padding-left: 10px;
padding-right: 30px;
}
#loading { margin-left:6px; margin-right:0px; }
.bar-menu { text-align: left; }
.bar-menu > * {
margin-right: 10px;
margin-left: unset;
}
.mtt-tab { margin-left:3px; margin-right:0px; border-top-right-radius:0px; border-top-left-radius:8px; }
.mtt-tabs-new-button { border-top-right-radius:0px; border-top-left-radius:8px; }
.mtt-tabs-select-button>span { transform:rotateY(180deg); }
#task { padding-left:20px; padding-right:4px; }
.mtt-taskbox-icon { left:2px; right:auto; transform:rotateY(180deg); }
#newtask_adv { margin-left:0; margin-right:0.5rem; transform:rotateY(180deg); }
.mtt-searchbox-icon.mtt-icon-search { right:4px; left:auto; }
.mtt-searchbox-icon.mtt-icon-cancelsearch { left:4px; right:auto; }
#tagcloudbtn { margin-left:0; margin-right:auto; }
.task-toggle { margin-left:2px; margin-right:0; transform:rotate(180deg); }
.task-middle { margin-left:0; margin-right:5px; }
.task-actions { margin-left:0; margin-right:5px; }
.task-prio, .task-title, .task-date, .task-tags { display:inline-block; } /* TODO: fix this */
.task-prio { margin-left:5px; margin-right:0; }
.task-note-block { margin-left:0; margin-right:2px; padding-left:0; padding-right:19px; background-position:right 0px;}
.task-date { margin-left:0; margin-right:4px; }
.duedate { margin-left:0; margin-right:5px; }
.duedate-arrow { display:none; }
.duedate:before { content:'\20\2190\20'; }
#tagcloud { box-shadow:-1px 2px 5px rgba(0,0,0,0.5); }
h3.page-title a.mtt-back-button { transform:rotate(180deg); }
.form-row-short { margin-left:12px; margin-right:0; }
.alltags-cell { padding-left:0; padding-right:5px; }
.mtt-menu-container { box-shadow:-1px 2px 5px rgba(0,0,0,0.5); }
.mtt-menu-container .menu-icon { left:auto; right:6px; }
li.mtt-menu-indicator .submenu-icon { left:6px; right:auto; transform:rotate(180deg); }

48
src/db/config.php.default Normal file
View file

@ -0,0 +1,48 @@
<?php
# Configuration goes here
$config = array();
# Database type: sqlite or mysql
$config['db'] = 'sqlite';
# Specify these settings if you selected above to use Mysql
$config['mysql.host'] = "localhost";
$config['mysql.db'] = "mytinytodo";
$config['mysql.user'] = "user";
$config['mysql.password'] = "";
# Tables prefix
$config['prefix'] = "mtt_";
# Language pack
$config['lang'] = "en";
# Specify password here to protect your tasks from modification,
# or leave empty that everyone could read/write todolist
$config['password'] = "";
# To disable smart syntax uncomment the line below
#$config['smartsyntax'] = 0;
# To disable auto detecting user time zone uncomment the line below
#$config['autotz'] = 0;
# To disable auto adding selected tag comment out the line below or set value to 0
$config['autotag'] = 1;
# duedate calendar format: 1 => y-m-d (default), 2 => m/d/y, 3 => d.m.y
$config['duedateformat'] = 1;
# First day of week: 0-Sunday, 1-Monday, 2-Tuesday, .. 6-Saturday
$config['firstdayofweek'] = 1;
# select session handling mechanism: files or default (php default)
$config['session'] = 'files';
# Date/time formats
$config['clock'] = 24;
$config['dateformat'] = 'j M Y';
$config['dateformatshort'] = 'j M';
?>

View file

@ -1,23 +0,0 @@
<?php
// Rename it to config.php before using in docker.
if (getenv('MTT_DB_TYPE') == 'mysql' || getenv('MTT_DB_TYPE') == 'postgres') {
define("MTT_DB_TYPE", getenv('MTT_DB_TYPE'));
define("MTT_DB_HOST", getenv('MTT_DB_HOST') ?: "undefined_host");
define("MTT_DB_NAME", getenv('MTT_DB_NAME') ?: "undefined_db");
define("MTT_DB_USER", getenv('MTT_DB_USER') ?: "undefined_user");
define("MTT_DB_PASSWORD", getenv('MTT_DB_PASSWORD') ?: "");
define("MTT_DB_PREFIX", getenv('MTT_DB_PREFIX') ?: "mtt_");
define("MTT_DB_DRIVER", getenv('MTT_DB_DRIVER') ?: "");
}
else if (getenv('MTT_DB_TYPE') == 'sqlite') {
define("MTT_DB_TYPE", "sqlite");
define("MTT_DB_PREFIX", "");
}
define("MTT_SALT", "Put Random Text Here");
//define("MTT_DISABLE_EXT", 1);
if (getenv('MTT_API_USE_PATH_INFO')) {
define("MTT_API_USE_PATH_INFO", 1);
}

View file

@ -1,150 +0,0 @@
<?php
/*
This file is a part of myTinyTodo.
(C) Copyright 2010-2011,2019-2021 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
//$dontStartSession = 1;
require_once('./init.php');
$listId = (int)_get('list');
$db = DBConnection::instance();
$listData = $db->sqa("SELECT * FROM {$db->prefix}lists WHERE id=$listId");
if ( $listData && !is_logged() && !$listData['published'] ) {
$extra = json_decode($listData['extra'] ?? '', true, 10, JSON_INVALID_UTF8_SUBSTITUTE);
$feedKey = (string) ($extra['feedKey'] ?? '');
$inFeedKey = trim(_get('key'));
if ($feedKey == '' || $feedKey != $inFeedKey) {
die("Access denied.");
}
}
if (!$listData) {
die("No list found.");
}
$data = DBCore::default()->getTasksByListId($listId, '', (int)$listData['sorting']);
if (_get('format') == 'ical') {
printICal($listData, $data);
}
else {
printCSV($listData, $data);
}
function printCSV(array $listData, array $data)
{
$s = "\xEF\xBB\xBF". "Completed;Priority;Task;Notes;Tags;Due;DateCreated;DateCompleted\n";
foreach($data as $r)
{
$s .= ($r['compl']?'1':'0'). ';'.
$r['prio']. ';'. escape_csv($r['title'] ?? ''). ';'.
escape_csv($r['note'] ?? ''). ';'.
escape_csv($r['tags'] ?? ''). ';'.
$r['duedate']. ';'.
date('Y-m-d H:i:s O',$r['d_created']). ';'.
($r['d_completed'] ? date('Y-m-d H:i:s O',$r['d_completed']) :''). "\n";
}
header('Content-type: text/csv; charset=utf-8');
header('Content-disposition: attachment; filename=list_'.(int)$listData['id'].'.csv');
print $s;
}
function escape_csv(string $v)
{
//escape formulas
$nf = '';
$trimmed = ltrim($v);
if (strlen($trimmed) > 0 && in_array(substr($trimmed, 0, 1), array('=', '+', '-', '@'))) {
$nf = "'";
}
return '"'. $nf. str_replace('"', '""', $v). '"';
}
function printICal(array $listData, array $data)
{
$mttToIcalPrio = array("1" => 5, "2" => 1);
$s = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nMETHOD:PUBLISH\r\nCALSCALE:GREGORIAN\r\nPRODID:-//myTinyTodo//iCalendar Export v1.4//EN\r\n".
"X-WR-CALNAME:". $listData['name']. "\r\nX-MTT-TIMEZONE:".Config::get('timezone')."\r\n";
# to-do
foreach($data as $r)
{
$a = array();
$a[] = "BEGIN:VTODO";
$a[] = "UID:". $r['uuid'];
$a[] = "CREATED:". gmdate('Ymd\THis\Z', $r['d_created']);
$a[] = "DTSTAMP:". gmdate('Ymd\THis\Z', $r['d_edited']);
$a[] = "LAST-MODIFIED:". gmdate('Ymd\THis\Z', $r['d_edited']);
$a[] = utf8chunks("SUMMARY:". $r['title']);
if($r['duedate']) {
$dda = explode('-', $r['duedate']);
$a[] = "DUE;VALUE=DATE:".sprintf("%u%02u%02u", $dda[0], $dda[1], $dda[2]);
}
# Apple's iCal priorities: low-9, medium-5, high-1
if($r['prio'] > 0 && isset($mttToIcalPrio[$r['prio']])) $a[] = "PRIORITY:". $mttToIcalPrio[$r['prio']];
$a[] = "X-MTT-PRIORITY:". $r['prio'];
$descr = array();
if($r['tags'] != '') $descr[] = Lang::instance()->get('tags'). ": ". str_replace(',', ', ', $r['tags']);
if($r['note'] != '') $descr[] = Lang::instance()->get('note'). ": ". $r['note'];
if($descr) $a[] = utf8chunks("DESCRIPTION:". str_replace("\n", '\\n', implode("\n",$descr)));
if($r['compl']) {
$a[] = "STATUS:COMPLETED"; #used in Sunbird
$a[] = "COMPLETED:". gmdate('Ymd\THis\Z', $r['d_completed']);
#$a[] = "PERCENT-COMPLETE:100"; #used in Sunbird
}
if($r['tags'] != '') $a[] = utf8chunks("X-MTT-TAGS:". $r['tags']);
$a[] = "END:VTODO\r\n";
$s .= implode("\r\n", $a);
}
# events
foreach($data as $r)
{
if(!$r['duedate'] || $r['compl']) continue; # skip tasks completed and without duedate
$a = array();
$a[] = "BEGIN:VEVENT";
$a[] = "UID:_". $r['uuid']; # do not duplicate VTODO UID
$a[] = "CREATED:". gmdate('Ymd\THis\Z', $r['d_created']);
$a[] = "DTSTAMP:". gmdate('Ymd\THis\Z', $r['d_edited']);
$a[] = "LAST-MODIFIED:". gmdate('Ymd\THis\Z', $r['d_edited']);
$a[] = utf8chunks("SUMMARY:". $r['title']);
if($r['prio'] > 0 && isset($mttToIcalPrio[$r['prio']])) $a[] = "PRIORITY:". $mttToIcalPrio[$r['prio']];
$dda = explode('-', $r['duedate']);
$a[] = "DTSTART;VALUE=DATE:".sprintf("%u%02u%02u", $dda[0], $dda[1], $dda[2]);
$a[] = "DTEND;VALUE=DATE:".date('Ymd', mktime(1,1,1,$dda[1],$dda[2],$dda[0]) + 86400);
$descr = array();
if($r['tags'] != '') $descr[] = Lang::instance()->get('tags'). ": ". str_replace(',', ', ', $r['tags']);
if($r['note'] != '') $descr[] = Lang::instance()->get('note'). ": ". $r['note'];
if($descr) $a[] = utf8chunks("DESCRIPTION:". str_replace("\n", '\\n', implode("\n",$descr)));
$a[] = "END:VEVENT\r\n";
$s .= implode("\r\n", $a);
}
$s .= "END:VCALENDAR\r\n";
header('Content-type: text/calendar; charset=utf-8');
header('Content-disposition: attachment; filename=list_'.(int)$listData['id'].'.ics');
print $s;
}
function utf8chunks($text, $chunklen=75, $delimiter="\r\n\t")
{
if($text == '') return '';
preg_match_all('/./u', $text, $m);
$chars = $m[0];
$a = array();
$s = '';
$max = count($chars);
for($i=0; $i<$max; $i++)
{
$ch = $chars[$i];
if(strlen($s) + strlen($ch) > $chunklen) { # line should be not more than $chunklen bytes
$a[] = $s;
$s = $ch;
}
else $s .= $ch;
}
if($s != '') $a[] = $s;
return implode($delimiter, $a);
}

View file

@ -1,5 +0,0 @@
<FilesMatch "\.(json|md|MD)$">
Order deny,allow
Deny from all
</FilesMatch>

View file

@ -1 +0,0 @@
deny from all

View file

@ -1,6 +0,0 @@
{
"bundleId": "CustomCSS",
"name": "Custom CSS",
"version": "1.0.1",
"description": "Add you own css rules"
}

View file

@ -1,7 +0,0 @@
{
"ext.CustomCSS.name": "Custom CSS",
"customcss.h_css": "CSS",
"customcss.d_css": "Write you own CSS rules",
"customcss.not_writable": "CSS file is not writable, check permissions for custom.css",
"customcss.saved": "Saved"
}

View file

@ -1,7 +0,0 @@
{
"ext.CustomCSS.name": "Własny styl CSS",
"customcss.h_css": "CSS",
"customcss.d_css": "Dodaj własne reguły CSS",
"customcss.not_writable": "Plik stylu nie jest zapisywalny, sprawdź uprawnienia dla pliku custom.css",
"customcss.saved": "Zmiany zostały zapisane"
}

View file

@ -1,7 +0,0 @@
{
"ext.CustomCSS.name": "Дополнительные стили",
"customcss.h_css": "CSS",
"customcss.d_css": "Добавляйте собственные стили CSS",
"customcss.not_writable": "Ошибка записи в файл, проверьте права доступа к custom.css",
"customcss.saved": "Сохранено"
}

View file

@ -1,93 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2022 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
if (!defined('MTTPATH')) {
die("Unexpected usage.");
}
function mtt_ext_customcss_instance(): MTTExtension
{
return new CustomCssExtension();
}
class CustomCssExtension extends MTTExtension implements MTTExtensionSettingsInterface
{
//the same as dir name
const bundleId = 'CustomCSS';
// settings domain
const domain = "ext.customcss.json";
const cssFilename = 'custom.css';
function init()
{
$prefs = self::preferences();
if (isset($prefs['css'])) {
$href = htmlspecialchars( get_unsafe_mttinfo('theme_url'). self::cssFilename. '?v='. ($prefs['edited'] ?? 0) );
$cb = function() use ($href) {
print "<link rel='stylesheet' type='text/css' href='$href'>\n";
};
add_action('theme_head_end', $cb);
}
}
function settingsPage(): string
{
$e = function($s) { return __($s, true); };
$prefs = self::preferences();
$css = htmlspecialchars($prefs['css'] ?? '');
return
<<<EOD
<div class="tr">
<div class="th"> {$e('customcss.h_css')}
<div class="descr">{$e('customcss.d_css')}</div>
</div>
<div class="td"> <textarea name="css" class="inmax monospace">$css</textarea> </div>
</div>
EOD;
}
function settingsPageType(): int
{
return 0; //default page
}
function saveSettings(array $params, ?string &$outMessage): bool
{
if (defined('MTT_DEMO')) {
$outMessage = "Demo";
return true;
}
$css = $params['css'] ?? '';
$cssFilename = MTT_THEME_PATH. self::cssFilename;
if (!file_exists($cssFilename)) {
@touch($cssFilename);
}
if (!is_writable($cssFilename)) {
$outMessage = __('customcss.not_writable');
return false;
}
@file_put_contents($cssFilename, $css);
$outMessage = __('customcss.saved');
return true;
}
static function preferences(): array
{
$prefs['cssFilename'] = $cssFilename = MTT_THEME_PATH. self::cssFilename;
if (file_exists($prefs['cssFilename'])) {
$prefs['edited'] = filemtime($cssFilename) ?? 0;
$prefs['css'] = @file_get_contents($cssFilename) ?? '';
}
return $prefs;
}
}

View file

@ -1 +0,0 @@
deny from all

View file

@ -1,6 +0,0 @@
{
"bundleId": "CustomSmartSyntax",
"name": "Custom Smart Syntax",
"version": "1.0",
"description": "Prototype to write you own smart syntax parser"
}

View file

@ -1,41 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
if (!defined('MTTPATH')) {
die("Unexpected usage.");
}
function mtt_ext_customsmartsyntax_instance(): MTTExtension
{
return new CustomSmartSyntaxExtension();
}
class CustomSmartSyntaxExtension extends MTTExtension implements MTTFilterInterface
{
//the same as dir name
const bundleId = 'CustomSmartSyntax';
function init() {
\MTTFilterCenter::addFilterForAction('parseSmartSyntax', $this);
}
// parseSmartSyntax
function filter($title, &$out)
{
$a = [
'prio' => 0, // int: -1 .. 2
'title' => $title, // string
'tags' => '', // string: "tag1, tag2, tag3,..."
'duedate' => null, // string: "Y-m-d" format
];
// This filter just overwrites results of default parser
$out = $a;
}
}

View file

@ -1 +0,0 @@
deny from all

View file

@ -1,203 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023-2025 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace BackupExtension;
use Exception;
class Backup
{
public $lastErrorString = null;
public $filename;
private $fh;
private $level = 0;
private $tagClosed = true;
function __construct(?string $filename)
{
$this->filename = is_null($filename) ? MTTPATH. 'db/backup.xml' : $filename;
}
function isFileWritable()
{
if (!file_exists($this->filename)) {
@touch($this->filename);
}
if (!is_writable($this->filename)) {
return false;
}
return true;
}
function makeBackup()
{
if (!$this->isFileWritable()) {
$this->lastErrorString = __('backup.not_writable');
return false;
}
$this->fh = fopen($this->filename, 'w');
if ($this->fh === false) {
$ea = error_get_last();
$this->lastErrorString = $ea['message'] ?? "Failed to open file for writing";
return false;
}
$db = \DBConnection::instance();
fwrite($this->fh, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
$this->writeOpeningTag('mttdb', [
'version' => 1,
'appversion' => \mytinytodo\Version::VERSION,
'dbversion' => \mytinytodo\Version::DB_VERSION,
'dbtype' => $db::DBTYPE,
'created' => date(DATE_ATOM)
]);
$this->level = 0;
$this->writeTable($db->prefix.'lists', 'lists', 'list');
$this->writeTable($db->prefix.'todolist', 'tasks', 'task');
$this->writeTable($db->prefix.'tags', 'tags', 'tag');
$this->writeTable($db->prefix.'tag2task', 'tag2task', 'item');
$this->writeTable($db->prefix.'settings', 'settings', 'item');
$this->writeClosingTag('mttdb');
fwrite($this->fh, "\n");
if (!fclose($this->fh)) {
$ea = error_get_last();
$this->lastErrorString = $ea['message'] ?? "Failed to close file";
return false;
}
return true;
}
function writeTable(string $table, string $group, string $itemName)
{
if (!preg_match("/^[\\w:]+$/", $table)) {
throw new Exception("Malformed table name: $table");
}
$db = \DBConnection::instance();
$props = null;
$autoinc = $this->getTableAutoIncrement($table);
if ($autoinc != '') {
$props = ['auto_increment' => $autoinc];
}
$this->writeOpeningTag($group, $props);
$q = $db->dq("SELECT * FROM $table");
while ($r = $q->fetchAssoc()) {
$this->writeItem($itemName, $r);
}
$this->writeClosingTag($group);
}
function writeItem(string $entity, $r)
{
$tagAttrs = null;
if (isset($r['id'])) {
$tagAttrs = ['id' => $r['id']];
unset($r['id']);
}
$this->writeOpeningTag($entity, $tagAttrs);
foreach ($r as $field => $value) {
$props = null;
if (is_null($value)) {
$props['isnull'] = 'yes';
}
$this->writeOpeningTag($field, $props);
$this->writeTagContent((string)$value);
$this->writeClosingTag($field);
}
$this->writeClosingTag($entity);
}
function getTableAutoIncrement($table): string
{
$db = \DBConnection::instance();
if ($db::DBTYPE == \DBConnection::DBTYPE_MYSQL) {
$r = $db->sqa("SHOW TABLE STATUS WHERE Name=?", [$table]);
return (string)$r['Auto_increment'] ?? '';
}
else if ($db::DBTYPE == \DBConnection::DBTYPE_SQLITE) {
$seq = (int)$db->sq("SELECT seq FROM sqlite_sequence WHERE name=?", [$table]);
if ($seq > 0)
return (string)$seq;
}
else if ($db::DBTYPE == \DBConnection::DBTYPE_POSTGRES) {
if ($db->tableFieldExists($table, 'id')) {
$v = (int)$db->sq("SELECT last_value FROM ". $table. '_id_seq');
if ($v > 0)
return (string)$v;
}
}
return '';
}
function writeOpeningTag(string $tag, ?array $attrs = null)
{
if (!preg_match("/^[\\w:]+$/", $tag)) {
throw new Exception("Malformed tag: $tag");
}
$data = "<$tag";
if ($attrs !== null) {
$a = [];
foreach ($attrs as $k => $v) {
if (!preg_match("/^[\\w:-]+$/", $k)) {
throw new Exception("Malformed attribute name: $k");
}
$v = (string)$v;
if (preg_match("/[\\r\\n]+/", $v)) {
throw new Exception("Malformed attribute value: $v");
}
$a[] = "$k=\"". htmlspecialchars($v). "\"";
}
if (count($a) > 0) {
$data .= " ". implode(" ", $a);
}
}
$data .= ">";
$this->write( ($this->tagClosed ? "" : "\n"). str_repeat(' ', $this->level) . $data );
$this->level += 1;
$this->tagClosed = false;
}
function writeClosingTag(string $tag)
{
if (!preg_match("/^[\\w:]+$/", $tag)) {
throw new Exception("Malformed tag: $tag");
}
$this->level -= 1;
if ($this->level < 0) $this->level = 0;
$padding = '';
if ($this->tagClosed) {
$padding = str_repeat(' ', $this->level);
}
$this->write( $padding . "</$tag>\n" );
$this->tagClosed = true;
}
function writeTagContent(?string $content)
{
if ($content !== null) {
$this->write( htmlspecialchars($content, ENT_XML1, 'UTF-8') ); //TODO: make xml compliant?
}
}
function write(string $data)
{
if (false === @fwrite($this->fh, $data)) {
$ea = error_get_last();
throw new Exception("Failed to write to file: ". ($ea['message'] ?? "unknown reason"));
}
}
}

View file

@ -1,126 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace BackupExtension;
use DBConnection;
class Check
{
public $lastErrorString = null;
public $report = '';
function check(): bool
{
$db = DBConnection::instance();
$msg = [];
// Task without list
$count = $db->sq("SELECT COUNT(*) FROM {$db->prefix}todolist WHERE list_id NOT IN (SELECT id FROM {$db->prefix}lists)");
if ($count) {
$msg[] = "Tasks without list: $count";
}
// Tag without task (not a broblem)
$count = $db->sq("SELECT COUNT(*) FROM {$db->prefix}tags WHERE id NOT IN (SELECT tag_id FROM {$db->prefix}tag2task)");
if ($count) {
$msg[] = "Tags without task: $count";
}
// tag2task no list
$count = $db->sq("SELECT COUNT(*) FROM {$db->prefix}tag2task WHERE list_id NOT IN (SELECT id FROM {$db->prefix}lists)");
if ($count) {
$msg[] = "tag2task no list: $count";
}
// tag2task no tag
$count = $db->sq("SELECT COUNT(*) FROM {$db->prefix}tag2task WHERE tag_id NOT IN (SELECT id FROM {$db->prefix}tags)");
if ($count) {
$msg[] = "tag2task no tag: $count";
}
// tag2task no task
$count = $db->sq("SELECT COUNT(*) FROM {$db->prefix}tag2task WHERE task_id NOT IN (SELECT id FROM {$db->prefix}todolist)");
if ($count) {
$msg[] = "tag2task no task: $count";
}
$count = 0;
$uniqTag = []; // lowerTag => [id, tag]
$nonuniqTag = []; // id => [tag, lowerTag, uniqId, uniqTag, taskCount]
$q = $db->dq("SELECT id,name,COUNT(task_id) c FROM {$db->prefix}tags t LEFT JOIN {$db->prefix}tag2task tt ON t.id=tt.tag_id GROUP BY id ORDER BY id");
while ($r = $q->fetchAssoc()) {
$v = mb_strtolower((string)$r['name'], 'UTF-8');
if (!isset($uniqTag[$v])) {
$uniqTag[$v] = [$r['id'], $r['name']];
}
else {
$count++;
$nonuniqTag[$r['id']] = [$r['name'], $v, $uniqTag[$v][0], $uniqTag[$v][1], $r['c']];
}
}
if ($count > 0) {
$msg[] = "Non-unique tags: $count";
foreach ($nonuniqTag as $id => $a) {
$msg[] = " ID:{$id} Tag:{$a[0]} (tasks: {$a[4]}) same as ID:{$a[2]} Tag:{$a[3]}";
}
}
if (count($msg) == 0) {
$msg[] = "OK";
}
$this->report = implode("\n", $msg);
return true;
}
function repair(): bool
{
$db = DBConnection::instance();
$db->ex("BEGIN");
// Task without list
$count = (int)$db->sq("SELECT COUNT(*) FROM {$db->prefix}todolist WHERE list_id NOT IN (SELECT id FROM {$db->prefix}lists)");
if ($count > 0) {
// Move to new list
$listID = \DBCore::default()->createListWithName("Restored tasks");
$db->ex("UPDATE {$db->prefix}todolist SET list_id=? WHERE list_id NOT IN (SELECT id FROM {$db->prefix}lists)", [$listID]);
}
//Tags
$db->ex("DELETE FROM {$db->prefix}tags WHERE id NOT IN (SELECT tag_id FROM {$db->prefix}tag2task)");
$db->ex("DELETE FROM {$db->prefix}tag2task WHERE task_id NOT IN (SELECT id FROM {$db->prefix}todolist)");
$db->ex("DELETE FROM {$db->prefix}tag2task WHERE tag_id NOT IN (SELECT id FROM {$db->prefix}tags)");
//Non-unique tags replace with first unique
$uniqTag = [];
$replace = [];
$q = $db->dq("SELECT id,name FROM {$db->prefix}tags t LEFT JOIN {$db->prefix}tag2task tt ON t.id=tt.tag_id GROUP BY id ORDER BY id");
while ($r = $q->fetchAssoc()) {
$v = mb_strtolower((string)$r['name'], 'UTF-8');
if (!isset($uniqTag[$v])) {
$uniqTag[$v] = $r['id'];
}
else {
$replace[$r['id']] = $uniqTag[$v];
}
}
foreach ($replace as $id => $newId) {
$db->ex("UPDATE {$db->prefix}tag2task SET tag_id=? WHERE tag_id=?", [$newId, $id]);
}
$db->ex("DELETE FROM {$db->prefix}tags WHERE id NOT IN (SELECT tag_id FROM {$db->prefix}tag2task)");
// TODO: tag2task no list ?
$db->ex("COMMIT");
return true;
}
}

View file

@ -1,156 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace BackupExtension;
use BackupExtension;
use BackupExtension\Backup;
use BackupExtension\Download;
use BackupExtension\Check;
class Controller extends \ApiController
{
function postMakeBackup()
{
require_once('class.backup.php');
$filename = BackupExtension::backupFilePath();
$backup = new Backup($filename);
if (!$backup->makeBackup()) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $backup->lastErrorString ?? '',
];
}
$this->response->data = [
'total' => 1,
'ok' => true,
'msg' => __("backup.done"),
'alertTextOnLoad' => __("backup.done"),
];
}
function postDownload()
{
require_once('class.download.php');
$filename = BackupExtension::backupFilePath();
$download = new Download($filename);
if (!$download->checkFileAccess()) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $download->lastErrorString ?? '',
];
return;
}
$this->response->data = [
'total' => 1,
'redirect' => $download->downloadUrl()
];
}
function getDownload()
{
require_once('class.download.php');
$filename = BackupExtension::backupFilePath();
$download = new Download($filename);
$ott = (string)_get('t');
if (!$download->checkFileAccess($ott)) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $download->lastErrorString ?? '',
];
return;
}
$download->printFile();
exit();
}
function postRestore()
{
require_once('class.restore.php');
$restore = new Restore();
if (!$restore->isUploaded()) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $restore->lastErrorString ?? '',
];
return;
}
if (!$restore->restore()) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $restore->lastErrorString ?? '',
];
return;
}
$this->response->data = [
'total' => 1,
'msg' => __("backup.done"),
'redirect' => get_mttinfo('url'),
];
}
function postCheckInconsistency()
{
require_once('class.check.php');
$check = new Check();
if (!$check->check()) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $check->lastErrorString ?? '',
];
return;
}
$this->response->data = [
'total' => 1,
'ok' => true,
'msg' => __("backup.done"),
];
if ($check->report == 'OK') {
$this->response->data['alertText'] = "OK";
}
else {
$this->response->data['html'] = "<pre>". htmlspecialchars($check->report). "</pre>";
}
}
function postRepairInconsistency()
{
require_once('class.check.php');
$check = new Check();
if (!$check->repair()) {
$this->response->data = [
'total' => 0,
'msg' => __("error"),
'details' => $check->lastErrorString ?? '',
];
return;
}
$this->response->data = [
'total' => 1,
'ok' => true,
'msg' => __("backup.done"),
'alertText' => __("backup.done"),
];
}
}

View file

@ -1,74 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace BackupExtension;
use BackupExtension;
class Download
{
public $filename;
public $lastErrorString = null;
private $token = '';
function __construct(?string $filename)
{
$this->filename = is_null($filename) ? MTTPATH. 'db/backup.xml' : $filename;
}
function checkFileAccess(?string $tokenHash = null): bool
{
if (!file_exists($this->filename)) {
$this->lastErrorString = "Backup file not found";
return false;
}
$this->token = access_token();
if ($this->token == '') {
$this->lastErrorString = "No token provided";
return false;
}
if (!is_null($tokenHash)) {
$a = explode(':', $tokenHash, 2);
$rnd = $a[0] ?? '';
$hash = $a[1] ?? '';
if (!hash_equals(hash_hmac('sha256', $rnd, $this->token), $hash)) {
$this->lastErrorString = "No temp token provided";
return false;
}
}
return true;
}
function downloadUrl()
{
$rnd = randomString();
$hash = $rnd. ':'. hash_hmac('sha256', $rnd, $this->token);
$url = BackupExtension::extApiActionUrl("download", "t=$hash");
return $url;
}
function printFile()
{
header('Content-type: application/xml; charset=utf-8');
header('Content-disposition: attachment; filename=backup.xml');
$fh = fopen($this->filename, "r") or die("Couldn't open file");
if ($fh) {
while (!feof($fh)) {
$buffer = fgets($fh, 4096);
print($buffer);
}
fclose($fh);
}
exit();
}
}

View file

@ -1,255 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023-2025 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace BackupExtension;
use XMLReader;
use DBConnection;
use Exception;
class Restore
{
public $lastErrorString = null;
private $filename;
/** @var XMLReader */
private $reader;
private $tableItem;
function __construct()
{
// xml table => [ db table, xml item ]
$this->tableItem = [
'lists' => ['lists', 'list'],
'tasks' => ['todolist', 'task'],
'tags' => ['tags', 'tag'],
'tag2task' => ['tag2task', 'item'],
'settings' => ['settings', 'item'],
];
}
function isUploaded(): bool
{
if (!isset($_FILES['file']) || !isset($_FILES['file']['name']) || !isset($_FILES['file']['tmp_name'])) {
$this->lastErrorString = "Not uploaded";
return false;
}
$this->filename = $_FILES['file']['tmp_name'];
if (!file_exists($this->filename) || !is_readable($this->filename)) {
$this->lastErrorString = "Can't open file";
return false;
}
return true;
}
function restore(): bool
{
$this->reader = $reader = new XMLReader();
$reader->open($this->filename);
// root element
$reader->next('mttdb');
if ($reader->name != 'mttdb') {
$this->lastErrorString = "Incorrect format: missing 'mttdb'.";
return false;
}
if (!$this->moveNextElement()) {
$this->lastErrorString = "Incorrect format: tables not found.";
return false;
}
$this->beginRestore();
$tables = array_keys($this->tableItem);
// Enumerate tables
do {
if ($reader->nodeType != XMLReader::ELEMENT) {
error_log("Unexpected element '{$reader->name}' of type: {$reader->nodeType}");
break;
}
//error_log("Found table '{$reader->name}'");
$result = null;
if (in_array($reader->name, $tables)) {
$result = $this->readTable($this->tableItem[$reader->name][0], $this->tableItem[$reader->name][1]);
}
else {
continue; // Unexpected table, just skip
}
if (is_null($result)) {
return false; // Incorrect format, error is set, stop
}
} while ($this->moveNextElementSameLevel());
$this->endRestore();
$reader->close();
return true;
}
function moveNextElement(?string $el = null): ?bool
{
while ($this->reader->read()) {
if ($this->reader->nodeType == XMLReader::ELEMENT) {
if (!is_null($el) && $this->reader->name != $el) {
return false;
}
return true;
}
else if ($this->reader->nodeType == XMLReader::END_ELEMENT) {
return null;
}
}
return null;
}
function moveNextElementSameLevel(?string $el = null)
{
return $this->reader->next() && ($this->reader->nodeType == XMLReader::ELEMENT || $this->moveNextElement($el));
}
function readTable(string $table, string $itemName): ?int
{
$autoinc = $this->reader->getAttribute("auto_increment");
$maxId = 0;
$count = 0;
// find first item
$found = $this->moveNextElement($itemName);
if ($found === false) {
$this->lastErrorString = "Incorrect item name {$this->reader->name}, expected '{$itemName}'";
return null; // Error
}
else if (is_null($found)) {
return 0; // No items found
}
do {
$count++;
$id = $this->reader->getAttribute("id");
if (!is_null($id)) {
$maxId = max($maxId, (int)$id);
}
// error_log("# $count: found $itemName with id $id");
$itemXml = $this->reader->readOuterXml();
$xml = simplexml_load_string($itemXml); //SimpleXMLElement
if ($xml === false) {
error_log("Incorrect format of $itemName");
continue;
}
if (!$this->insertToTable($table, $xml)) {
return null; // Error
}
} while ($this->moveNextElementSameLevel($itemName));
// restore table last auto_increment (mysql)
if (!is_null($autoinc)) {
$autoinc = max((int)$autoinc, $maxId);
}
else {
$autoinc = $maxId + 1;
}
if ($autoinc > 1) {
$this->updateAutoinc($table, $autoinc);
}
return $count;
}
private function insertToTable(string $table, \SimpleXMLElement $xml): bool
{
if (!preg_match("/^[\\w]+$/", $table)) {
throw new Exception("Malformed table name: $table");
}
$fields = [];
$values = [];
$attrsXml = $xml->attributes();
if (isset($attrsXml['id']) && $attrsXml['id'] != '') {
$fields[] = 'id';
$values[] = (string)$attrsXml['id'];
}
foreach ($xml->children() as $item) {
$field = $item->getName();
$value = (string)$item;
if (!preg_match("/^[\\w]+$/", $field)) {
throw new Exception("Malformed field name: $field");
}
$attrsXml = $item->attributes();
if (isset($attrsXml['isnull']) && $attrsXml['isnull'] == 'yes') { //$attrsXml['isnull']->__toString()
$value = null;
}
$fields[] = $field;
$values[] = $value;
}
$fieldsStr = implode(',', $fields); // id,name,title ...
$subsStr = implode(',', array_fill(0, count($fields), '?')); // ?,?,? ...
$db = DBConnection::instance();
try {
$db->ex("INSERT INTO {$db->prefix}{$table} ($fieldsStr) VALUES ($subsStr)", $values);
}
catch (Exception $e) {
error_log("Failed query: {$db->lastQuery}");
$this->lastErrorString = "Failed to add data to table '{$db->prefix}$table'. Database error (see query in error log): ". $e->getMessage();
return false;
}
return true;
}
private function updateAutoinc(string $table, int $autoinc)
{
$db = DBConnection::instance();
switch ($db::DBTYPE) {
case DBConnection::DBTYPE_MYSQL:
$db->ex("ALTER TABLE {$db->prefix}$table AUTO_INCREMENT = ". (int)$autoinc);
break;
case DBConnection::DBTYPE_POSTGRES:
$db->ex("ALTER TABLE {$db->prefix}$table ALTER COLUMN id RESTART WITH ". (int)$autoinc);
break;
case DBConnection::DBTYPE_SQLITE:
$db->ex("UPDATE sqlite_sequence SET seq=? WHERE name=?", [$autoinc, $db->prefix. $table]);
break;
default:
break;
}
}
private function beginRestore()
{
$db = DBConnection::instance();
$db->ex("BEGIN");
foreach ($this->tableItem as $a) {
$table = $db->prefix. $a[0];
if ($db::DBTYPE == DBConnection::DBTYPE_POSTGRES) {
$db->ex("TRUNCATE TABLE $table RESTART IDENTITY");
}
else {
# - we do not use TRUNCATE on mysql due to autocommit
# - sqlite has truncate optimizer while delete all to make it faster
# - no need to reset auto_increment sequence before inserting lower ids
$db->ex("DELETE FROM $table");
}
}
$db->ex("DELETE FROM {$db->prefix}sessions");
}
private function endRestore()
{
$db = DBConnection::instance();
$db->ex("COMMIT");
// vacuum?
}
}

View file

@ -1,6 +0,0 @@
{
"bundleId": "backup",
"name": "Backup",
"version": "1.1",
"description": "Backup"
}

View file

@ -1,17 +0,0 @@
{
"ext.backup.name": "Backup",
"backup.h_make": "Make backup",
"backup.d_make": "Will create backup file in '%s' folder.",
"backup.make": "Make",
"backup.download": "Download",
"backup.done": "Done",
"backup.not_writable": "Backup file is not writable, check permissions for db/backup.xml",
"backup.last_backup": "Last backup: %s",
"backup.h_inconsistency": "Check for inconsistency",
"backup.d_inconsistency": "If you want to restore the backup to another database version or type, it's better to fix inconsistency before making backup.",
"backup.check": "Check",
"backup.repair": "Repair",
"backup.h_restore": "Restore from backup",
"backup.d_restore": "Will delete all records in existing database before restoring.",
"backup.restore": "Restore…"
}

View file

@ -1,17 +0,0 @@
{
"ext.backup.name": "Резервное копирование",
"backup.h_make": "Сделать копию",
"backup.d_make": "Сохранит файл в папке '%s'.",
"backup.make": "Создать",
"backup.download": "Скачать",
"backup.done": "Выполнено",
"backup.not_writable": "Ошибка записи в файл, проверьте права доступа к db/backup.xml",
"backup.last_backup": "Резервная копия: %s",
"backup.h_inconsistency": "Проверка базы данных",
"backup.d_inconsistency": "Если планируете восстановление из резервной копии в другую базу данных, то лучше исправить возможные ошибки перед резервным копированием.",
"backup.check": "Проверить",
"backup.repair": "Исправить",
"backup.h_restore": "Восстановить из резервной копии",
"backup.d_restore": "Удалит все существующие записи во время восстановления.",
"backup.restore": "Восстановить…"
}

View file

@ -1,140 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
if (!defined('MTTPATH')) {
die("Unexpected usage.");
}
require_once('class.controller.php');
function mtt_ext_backup_instance(): MTTExtension
{
return new BackupExtension();
}
use BackupExtension\Controller;
class BackupExtension extends MTTExtension implements MTTExtensionSettingsInterface, MTTHttpApiExtender
{
//the same as dir name
const bundleId = 'backup';
// settings domain
const domain = "ext.backup.json";
function init() {
}
// MTTHttpApiExtender
function extendHttpApi(): array
{
return array(
'/makeBackup' => [
'POST' => [ Controller::class , 'postMakeBackup' ],
],
'/download' => [
'POST' => [ Controller::class , 'postDownload' ],
'GET' => [ Controller::class , 'getDownload', true ], // doesn't check auth token
],
'/restore' => [
'POST' => [ Controller::class , 'postRestore' ],
],
'/checkInconsistency' => [
'POST' => [ Controller::class , 'postCheckInconsistency' ],
],
'/repairInconsistency' => [
'POST' => [ Controller::class , 'postRepairInconsistency' ],
],
);
}
function settingsPage(): string
{
$warning = '';
$e = function($s, $arg=null) { return __($s, true, $arg); };
$ext = htmlspecialchars(self::bundleId);
$downloadDisabled = '';
$lastBackup = '';
$filename = MTTPATH. 'db/backup.xml';
if (file_exists($filename)) {
$time = filemtime($filename);
$lastBackup = htmlspecialchars( sprintf($e('backup.last_backup'), formatTime(Config::get('dateformat'). " H:i:s", $time)) );
}
else {
$downloadDisabled = 'disabled';
}
return <<<EOD
$warning
<script>
function onBackupFileChange(el) {
const fd = new FormData();
fd.append('file', el.files[0]);
mytinytodo.extensionSettingsAction(el.dataset.extSettingsAction, el.dataset.ext, fd);
}
</script>
<div class="tr">
<div class="th"> {$e('backup.h_make')}
<div class="descr">{$e('backup.d_make', 'db')}</div>
</div>
<div class="td">
<button type=button data-ext-settings-action="post:makeBackup" data-ext="$ext"> {$e('backup.make')} </button> <br>
<br> $lastBackup &nbsp;
<button type=button data-ext-settings-action="post:download" data-ext="$ext" $downloadDisabled> {$e('backup.download')} </button>
</div>
</div>
<div class="tr">
<div class="th"> {$e('backup.h_inconsistency')}
<div class="descr">{$e('backup.d_inconsistency')}</div>
</div>
<div class="td">
<button type=button data-ext-settings-action="post:checkInconsistency" data-ext="$ext"> {$e('backup.check')} </button> &nbsp;
<button type=button data-ext-settings-action="post:repairInconsistency" data-ext="$ext"> {$e('backup.repair')} </button> <br>
</div>
</div>
<div class="tr">
<div class="th"> {$e('backup.h_restore')}
<div class="descr"> {$e('backup.d_restore')} </div>
</div>
<div class="td">
<label class="mtt-settings-upload-button">
<input type="file" name="file" onchange="return onBackupFileChange(this)" data-ext-settings-action="post:restore" data-ext="$ext">
{$e('backup.restore')}
</label>
</div>
</div>
EOD;
}
function settingsPageType(): int
{
return 1; //no form buttons
}
function saveSettings(array $params, ?string &$outMessage): bool
{
return false;
}
/*
static function preferences(): array
{
return [
'backupFilePath' => MTTPATH. 'db/backup.xml'
];
}
*/
static function backupFilePath()
{
//return self::preferences()['backupFilePath'];
return MTTPATH. 'db/backup.xml';
}
}

View file

View file

@ -1 +0,0 @@
deny from all

View file

@ -1,117 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2022-2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace Notify;
use NotificationsExtension;
use Config;
class Controller extends \ApiController
{
function postDeactivateAll()
{
$prefs = Config::requestDomain(NotificationsExtension::domain);
if (isset($prefs['chats'])) {
$prefs['chats'] = [];
Config::saveDomain(NotificationsExtension::domain, $prefs);
}
$this->response->data = [ 'total' => 1, 'msg' => __("notifications.all_chats_deactivated") ];
}
function postCheck()
{
$prefs = Config::requestDomain(NotificationsExtension::domain);
if (!($prefs['validToken'] ?? false)) {
$this->response->data = [ 'total' => 0, 'msg' => __("notifications.bot_not_configured") ];
return;
}
if (!isset($prefs['chats']) || !is_array($prefs['chats'])) {
$prefs['chats'] = [];
}
$code = $prefs['code'] ?? null;
$codeExpires = $prefs['codeExpires'] ?? 0;
$token = $prefs['token'] ?? '';
$this->response->data = [ 'total' => 0, 'msg' => __("notifications.no_new_chats") ];
// Read messages since last check
$maxId = $prefs['lastUpdateId'] ?? 0;
$api = new TelegramApi($token);
$api->logApiErrors = true;
$updates = $api->getUpdates([
'offset' => $maxId + 1,
'allowed_updates' => ['message']
]);
if (!is_array($updates) || count($updates) == 0) {
return;
}
// Select last message in every chat
$messages = array();
foreach ($updates as $update) {
$message = $update['message'] ?? [];
$chatId = (string)($message['chat']['id'] ?? 0);
$prefs['lastUpdateId'] = max($maxId, $update['update_id'] ?? 0);
$messages[$chatId] = $message;
}
$total = 0;
foreach ($messages as $chatId => $message) {
$chatId = (int) $chatId;
$text = $message['text'] ?? '';
$msgId = (int) ($message['message_id'] ?? 0);
if (in_array($chatId, $prefs['chats'])) {
$api->sendMessage([
'chat_id' => $chatId,
'text' => __("notifications.already_active")
]);
}
else if ($text === '/start') {
$api->sendMessage([
'chat_id' => $chatId,
'text' => __("notifications.please_send")
]);
}
else if ($code === null) {
$api->sendMessage([
'chat_id' => $chatId,
'text' => __("notifications.code_not_set")
]);
}
else if ($codeExpires < time()) {
$api->sendMessage([
'chat_id' => $chatId,
'text' => __("notifications.code_expired")
]);
}
else if ($text == $code) {
$prefs['chats'][] = $chatId;
$api->sendMessage([
'chat_id' => $chatId,
'reply_to_message_id' => $msgId,
'text' => __("notifications.activated")
]);
$total++;
$this->response->data = [
'total' => $total,
'msg' => __("notifications.activated")
];
}
else {
$api->sendMessage([
'chat_id' => $chatId,
'reply_to_message_id' => $msgId,
'text' => __("notifications.code_wrong")
]);
}
}
Config::saveDomain(NotificationsExtension::domain, $prefs);
}
}

View file

@ -1,65 +0,0 @@
<?php declare(strict_types=1);
/*
This file is a part of myTinyTodo.
(C) Copyright 2022 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
namespace Notify;
use NotificationsExtension;
use MTTNotification;
use MTTNotificationCenter;
use DBConnection;
class NotificationObserver implements \MTTNotificationObserverInterface
{
private $prefs = null;
private $delayedNotifications = [];
public function notification(string $notification, $object)
{
if (!$this->prefs) {
$this->init();
}
if (count($this->prefs['chats']) == 0 && count($this->prefs['emails']) == 0) {
return; // nobody to notify
}
$db = DBConnection::instance();
switch ($notification) {
case MTTNotification::didFinishRequest:
$this->processDelayed();
break;
case MTTNotification::didCreateTask:
case MTTNotification::didCreateList:
// Get list name
$list = $db->sqa( "SELECT name FROM {$db->prefix}lists WHERE id=?", array($object['listId'] ?? 0) );
$object['listName'] = htmlspecialchars($list['name'] ?? '');
$this->delayedNotifications[] = [
'notification' => $notification,
'object' => $object
];
MTTNotificationCenter::addObserverForNotification(MTTNotification::didFinishRequest, $this);
}
}
private function processDelayed()
{
//$db = DBConnection::instance();
$useCli = !function_exists('fastcgi_finish_request');
$sender = new Sender( $this->prefs, $useCli );
foreach ($this->delayedNotifications as $item) {
$sender->notify($item);
}
}
private function init()
{
$this->prefs = NotificationsExtension::preferences();
//$this->token = $this->prefs['token'] ?? '';
}
}

Some files were not shown because too many files have changed in this diff Show more