mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
replace tabs with spaces in php files
This commit is contained in:
parent
490b64c2b3
commit
6f60e75c45
9 changed files with 30 additions and 30 deletions
|
|
@ -68,7 +68,7 @@ closedir($dh);
|
|||
chdir('..'); # to the root of repo
|
||||
rename('src', 'mytinytodo') or die("Cant rename 'src'\n");
|
||||
|
||||
`zip -9 -r mytinytodo.zip mytinytodo`; #OS dep.!!!
|
||||
`zip -9 -r mytinytodo.zip mytinytodo`; #OS dep.!!!
|
||||
if (!file_exists('mytinytodo.zip')) {
|
||||
die("Failed to pack files (no output zip file)\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ function myErrorHandler($errno, $errstr, $errfile, $errline)
|
|||
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
|
||||
else $error = "Error ($errno)"; // here may be E_RECOVERABLE_ERROR
|
||||
throw new Exception("$error: '$errstr' in $errfile:$errline", -1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ function printICal($listData, $data)
|
|||
# events
|
||||
foreach($data as $r)
|
||||
{
|
||||
if(!$r['duedate'] || $r['compl']) continue; # skip tasks completed and without duedate
|
||||
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[] = "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']);
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ class TasksController extends ApiController {
|
|||
$db = DBConnection::instance();
|
||||
$compl = (int)($this->req->jsonBody['compl'] ?? 0);
|
||||
$listId = (int)$db->sq("SELECT list_id FROM {$db->prefix}todolist WHERE id=$id");
|
||||
if ($compl) $ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE list_id=$listId AND compl=1");
|
||||
if ($compl) $ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE list_id=$listId AND compl=1");
|
||||
else $ow = 1 + (int)$db->sq("SELECT MAX(ow) FROM {$db->prefix}todolist WHERE list_id=$listId AND compl=0");
|
||||
$dateCompleted = $compl ? time() : 0;
|
||||
$db->dq("UPDATE {$db->prefix}todolist SET compl=$compl,ow=$ow,d_completed=?,d_edited=? WHERE id=$id",
|
||||
|
|
@ -542,15 +542,15 @@ class TasksController extends ApiController {
|
|||
$a['timestamp'] = mktime(0,0,0, (int)$ad[1], (int)$ad[2], (int)$ad[0]);
|
||||
$diff = mktime(0,0,0, (int)$ad[1], (int)$ad[2], (int)$ad[0]) - mktime(0,0,0, (int)$at[1], (int)$at[2], (int)$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('dateformat2'), (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('dateformat2'), (int)$ad[0], (int)$ad[1], (int)$ad[2], $lang); }
|
||||
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('dateformat2'), (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('dateformat2'), (int)$ad[0], (int)$ad[1], (int)$ad[2], $lang); }
|
||||
|
||||
#avoid short year
|
||||
$fmt = str_replace('y', 'Y', Config::get('dateformat2'));
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Config
|
|||
$val = passwordHash($val); // in v1.7 password is hashed
|
||||
}
|
||||
// if (!isset(self::$dbparams[$key])) {
|
||||
// throw new Exception("Unknown key: $key");
|
||||
// throw new Exception("Unknown key: $key");
|
||||
// }
|
||||
self::$config[$key] = $val;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ class Lang
|
|||
$this->code = $code;
|
||||
$json = json_decode($jsonString, true);
|
||||
if ($json === null) {
|
||||
$json = array();
|
||||
}
|
||||
$json = array();
|
||||
}
|
||||
|
||||
//load default language
|
||||
if ( $code != $this->default ) {
|
||||
|
|
@ -82,8 +82,8 @@ class Lang
|
|||
$defStr = file_get_contents($this->langDir(). "{$this->default}.json");
|
||||
$this->strings = json_decode($defStr, true);
|
||||
if ($this->strings === null) {
|
||||
die("Invalid JSON in default language file (". htmlspecialchars($this->default). ".json)");
|
||||
}
|
||||
die("Invalid JSON in default language file (". htmlspecialchars($this->default). ".json)");
|
||||
}
|
||||
}
|
||||
|
||||
function get($key)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function htmlarray_ref(&$a, $exclude=null)
|
|||
|
||||
function _post($param,$defvalue = '')
|
||||
{
|
||||
if(!isset($_POST[$param])) {
|
||||
if(!isset($_POST[$param])) {
|
||||
return $defvalue;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ function selectOptionsA($a, $key, $default=null)
|
|||
if($default !== null && !isset($a[$key])) $key = $default;
|
||||
foreach($a as $k=>$v) {
|
||||
if (!is_array($v)) {
|
||||
$v = array('name' => $k);
|
||||
}
|
||||
$v = array('name' => $k);
|
||||
}
|
||||
$s .= '<option value="'.htmlspecialchars($k).'" '.($k===$key?'selected="selected"':'').
|
||||
(isset($v['title']) ? ' title="'.htmlspecialchars($v['title']).'"' : '').
|
||||
'>'.htmlspecialchars($v['name']).'</option>';
|
||||
|
|
|
|||
|
|
@ -219,9 +219,9 @@ function createMysqlTables($db)
|
|||
`compl` TINYINT UNSIGNED NOT NULL default 0,
|
||||
`title` VARCHAR(250) NOT NULL,
|
||||
`note` TEXT,
|
||||
`prio` TINYINT NOT NULL default 0, /* priority -,0,+ */
|
||||
`ow` INT NOT NULL default 0, /* order weight */
|
||||
`tags` VARCHAR(600) NOT NULL default '', /* for fast access to task tags */
|
||||
`prio` TINYINT NOT NULL default 0, /* priority -,0,+ */
|
||||
`ow` INT NOT NULL default 0, /* order weight */
|
||||
`tags` VARCHAR(600) NOT NULL default '', /* for fast access to task tags */
|
||||
`tags_ids` VARCHAR(250) NOT NULL default '', /* no more than 22 tags (x11 chars) */
|
||||
`duedate` DATE default NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
|
|
@ -246,7 +246,7 @@ function createMysqlTables($db)
|
|||
`list_id` INT UNSIGNED NOT NULL,
|
||||
KEY(`tag_id`),
|
||||
KEY(`task_id`),
|
||||
KEY(`list_id`) /* for tagcloud */
|
||||
KEY(`list_id`) /* for tagcloud */
|
||||
) CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci ");
|
||||
|
||||
|
||||
|
|
@ -260,10 +260,10 @@ function createMysqlTables($db)
|
|||
|
||||
$db->ex(
|
||||
"CREATE TABLE {$db->prefix}sessions (
|
||||
`id` VARCHAR(64) NOT NULL default '', /* upto 64 bytes for sha256 */
|
||||
`id` VARCHAR(64) NOT NULL default '', /* upto 64 bytes for sha256 */
|
||||
`data` TEXT,
|
||||
`last_access` INT UNSIGNED NOT NULL default 0, /* time() timestamp */
|
||||
`expires` INT UNSIGNED NOT NULL default 0, /* time() timestamp */
|
||||
`last_access` INT UNSIGNED NOT NULL default 0, /* time() timestamp */
|
||||
`expires` INT UNSIGNED NOT NULL default 0, /* time() timestamp */
|
||||
UNIQUE KEY `id` (`id`)
|
||||
) CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ");
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ function createSqliteTables($db)
|
|||
) ");
|
||||
$db->ex("CREATE INDEX tag2task_tag_id ON {$db->prefix}tag2task (tag_id)");
|
||||
$db->ex("CREATE INDEX tag2task_task_id ON {$db->prefix}tag2task (task_id)");
|
||||
$db->ex("CREATE INDEX tag2task_list_id ON {$db->prefix}tag2task (list_id)"); /* for tagcloud */
|
||||
$db->ex("CREATE INDEX tag2task_list_id ON {$db->prefix}tag2task (list_id)"); /* for tagcloud */
|
||||
|
||||
|
||||
$db->ex(
|
||||
|
|
|
|||
Loading…
Reference in a new issue