replace tabs with spaces in php files

This commit is contained in:
maxpozdeev 2022-07-10 15:35:19 +03:00
parent 490b64c2b3
commit 6f60e75c45
9 changed files with 30 additions and 30 deletions

View file

@ -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");
}

View file

@ -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);
}

View file

@ -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']);

View file

@ -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'));

View file

@ -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;
}

View file

@ -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)

View file

@ -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 {

View file

@ -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>';

View file

@ -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(