From 6f60e75c45587ab734b3cf23bb06e899224b63b1 Mon Sep 17 00:00:00 2001 From: maxpozdeev Date: Sun, 10 Jul 2022 15:35:19 +0300 Subject: [PATCH] replace tabs with spaces in php files --- buildzip.php | 2 +- src/api.php | 2 +- src/export.php | 4 ++-- src/includes/api/TasksController.php | 20 ++++++++++---------- src/includes/class.config.php | 2 +- src/includes/class.lang.php | 8 ++++---- src/includes/common.php | 2 +- src/settings.php | 4 ++-- src/setup.php | 16 ++++++++-------- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/buildzip.php b/buildzip.php index bdf1ce6..c88bc86 100755 --- a/buildzip.php +++ b/buildzip.php @@ -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"); } diff --git a/src/api.php b/src/api.php index ce5d2ee..dda691b 100644 --- a/src/api.php +++ b/src/api.php @@ -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); } diff --git a/src/export.php b/src/export.php index 69163a3..3c8b947 100644 --- a/src/export.php +++ b/src/export.php @@ -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']); diff --git a/src/includes/api/TasksController.php b/src/includes/api/TasksController.php index 7915b4b..890dffa 100644 --- a/src/includes/api/TasksController.php +++ b/src/includes/api/TasksController.php @@ -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')); diff --git a/src/includes/class.config.php b/src/includes/class.config.php index 0ff3a2e..ea3a7c4 100644 --- a/src/includes/class.config.php +++ b/src/includes/class.config.php @@ -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; } diff --git a/src/includes/class.lang.php b/src/includes/class.lang.php index 04fc370..0927f65 100644 --- a/src/includes/class.lang.php +++ b/src/includes/class.lang.php @@ -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) diff --git a/src/includes/common.php b/src/includes/common.php index 87b7d12..6d005fb 100644 --- a/src/includes/common.php +++ b/src/includes/common.php @@ -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 { diff --git a/src/settings.php b/src/settings.php index 6214270..4eb7f73 100644 --- a/src/settings.php +++ b/src/settings.php @@ -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 .= ''; diff --git a/src/setup.php b/src/setup.php index ad8c2cb..489ec7a 100644 --- a/src/setup.php +++ b/src/setup.php @@ -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(