From efc7352404783da7b70f447f2d8e5ff431e33700 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 24 Apr 2022 17:43:44 +0200 Subject: [PATCH] Code cleaning --- includes/cli.php | 619 +++++++++++++------------ includes/config.inc.php | 14 +- includes/core.php | 14 +- includes/db.php | 207 +++++---- includes/functions.php | 209 +++++---- includes/hooks.php | 144 +++--- includes/logging.php | 141 +++--- includes/mail.php | 7 +- includes/session.php | 31 +- includes/smarty.php | 11 +- includes/translation-cli.php | 8 + includes/translation.php | 2 +- includes/url-helpers.php | 22 +- includes/url-public.php | 32 +- includes/url.php | 169 ++++--- lang/fr_FR.UTF8/LC_MESSAGES/DEFAULT.po | 214 ++++----- lang/headers.pot | 4 +- lang/messages.pot | 216 ++++----- lang/php-messages.pot | 212 ++++----- 19 files changed, 1222 insertions(+), 1054 deletions(-) diff --git a/includes/cli.php b/includes/cli.php index 1419810..95eb6e1 100644 --- a/includes/cli.php +++ b/includes/cli.php @@ -1,34 +1,35 @@ $handler, - 'short_desc' => $short_desc, - 'usage_args' => $usage_args, - 'long_desc' => $long_desc, - ); - return True; + $cli_commands[$command] = array ( + 'handler' => $handler, + 'short_desc' => $short_desc, + 'usage_args' => $usage_args, + 'long_desc' => $long_desc, + ); + return True; } /* - ************************************************************************************************************** + ************************************************************************************************* * /!\ Code after this message will only be execute on CLI context /!\ - ************************************************************************************************************** + ************************************************************************************************* */ if (php_sapi_name() != "cli") - return true; + return true; // Store current CLI command $cli_command = null; @@ -38,105 +39,124 @@ $cli_command = null; **/ function usage($error=false) { - global $cli_commands, $cli_command, $argv; + global $cli_commands, $cli_command, $argv; - if ($error) - echo "$error\n\n"; - printf(_("Usage: %s [-h] [-qd] command\n"), basename($argv[0])); - echo _(" -h Show this message\n"); - echo _(" -q / -d Quiet/Debug mode\n"); - echo _(" --trace Trace mode (the most verbose)\n"); - echo _(" command Command to run\n"); - echo "\n"; - echo _("Available commands:\n"); + if ($error) + echo "$error\n\n"; + printf(_("Usage: %s [-h] [-qd] command\n"), basename($argv[0])); + echo _(" -h Show this message\n"); + echo _(" -q / -d Quiet/Debug mode\n"); + echo _(" --trace Trace mode (the most verbose)\n"); + echo _(" command Command to run\n"); + echo "\n"; + echo _("Available commands:\n"); - foreach ($cli_commands as $command => $info) { - if ($cli_command && $command != $cli_command) - continue; - echo " ".str_replace("\n", "\n ", wordwrap("$command : "._($info['short_desc'])))."\n\n"; - echo " ".basename($argv[0])." $command ".($info['usage_args']?_($info['usage_args']):'')."\n"; - if ($info['long_desc']) { - if (is_array($info['long_desc'])) { - $lines = array(); - foreach ($info['long_desc'] as $line) - $lines[] = _($line); - $info['long_desc'] = implode("\n", $lines); - } - else - $info['long_desc'] = _($info['long_desc']); + foreach ($cli_commands as $command => $info) { + if ($cli_command && $command != $cli_command) + continue; + echo ( + " ".str_replace( + "\n", "\n ", + wordwrap("$command : "._($info['short_desc']))) + ."\n\n"); + echo ( + " ".basename($argv[0])." $command ". + ($info['usage_args']?_($info['usage_args']):''). + "\n"); + if ($info['long_desc']) { + if (is_array($info['long_desc'])) { + $lines = array(); + foreach ($info['long_desc'] as $line) + $lines[] = _($line); + $info['long_desc'] = implode("\n", $lines); + } + else + $info['long_desc'] = _($info['long_desc']); - echo "\n ".str_replace("\n", "\n ", wordwrap($info['long_desc']))."\n"; - } - echo "\n"; - } + echo "\n ".str_replace("\n", "\n ", wordwrap($info['long_desc']))."\n"; + } + echo "\n"; + } - exit(($error?1:0)); + exit(($error?1:0)); } function handle_cli_args() { - global $log_level, $cli_commands, $cli_command, $argv; - $log_level = 'INFO'; - $cli_command = false; - $command_args = array(); - for ($i=1; $i < count($argv); $i++) { - if (array_key_exists($argv[$i], $cli_commands)) { - if (!$cli_command) - $cli_command = $argv[$i]; - else - usage(_("Only one command could be executed !")); - } - else { - switch($argv[$i]) { - case '-h': - case '--help': - usage(); - break; - case '-d': - case '--debug': - $log_level = 'DEBUG'; - break; - case '-q': - case '--quiet': - $log_level = 'WARNING'; - break; - case '--trace': - $log_level = 'TRACE'; - break; - default: - if ($cli_command) - $command_args[] = $argv[$i]; - else - usage( - sprintf(_("Invalid parameter \"%s\".\nNote: Command's parameter/argument must be place after the command."), $argv[$i]) - ); - } - } - } + global $log_level, $cli_commands, $cli_command, $argv; + $log_level = 'INFO'; + $cli_command = false; + $command_args = array(); + for ($i=1; $i < count($argv); $i++) { + if (array_key_exists($argv[$i], $cli_commands)) { + if (!$cli_command) + $cli_command = $argv[$i]; + else + usage(_("Only one command could be executed !")); + } + else { + switch($argv[$i]) { + case '-h': + case '--help': + usage(); + break; + case '-d': + case '--debug': + $log_level = 'DEBUG'; + break; + case '-q': + case '--quiet': + $log_level = 'WARNING'; + break; + case '--trace': + $log_level = 'TRACE'; + break; + default: + if ($cli_command) + $command_args[] = $argv[$i]; + else + usage( + sprintf( + _("Invalid parameter \"%s\".\nNote: Command's parameter/argument must be place ". + "after the command."), $argv[$i] + ) + ); + } + } + } - if (!$cli_command) - usage(); + if (!$cli_command) + usage(); - logging('DEBUG', 'Run '.basename($argv[0])." command $cli_command with argument(s) '".implode("', '", $command_args)."'"); + logging( + 'DEBUG', sprintf( + "Run %s command %s with argument(s) '%s'.", + basename($argv[0]), $cli_command, + implode("', '", $command_args) + ) + ); - try { - $result = call_user_func($cli_commands[$cli_command]['handler'], $command_args); + try { + $result = call_user_func($cli_commands[$cli_command]['handler'], $command_args); - exit($result?0:1); - } - catch(Exception $e) { - log_exception(sprintf(_("An exception occured running command %s"), $cli_command)); - exit(1); - } + exit($result?0:1); + } + catch(Exception $e) { + log_exception(sprintf(_("An exception occured running command %s"), $cli_command)); + exit(1); + } } function print_item_info($item) { - printf(_("Item #%s:\n"), $item['id']); - printf("\t"._("ID: %s")."\n", $item['id']); - printf("\t"._("Name: '%s'")."\n", $item['name']); - printf("\t"._("Date: %s")."\n", format_time($item['date'])); - printf("\t"._("Description: %s")."\n", ($item['description']?"'".$item['description']."'":_("Not set"))); - printf("\t"._("Status: %s")."\n", $item['status']); - return true; + printf(_("Item #%s:\n"), $item['id']); + printf("\t"._("ID: %s")."\n", $item['id']); + printf("\t"._("Name: '%s'")."\n", $item['name']); + printf("\t"._("Date: %s")."\n", format_time($item['date'])); + printf( + "\t"._("Description: %s")."\n", + ($item['description']?"'".$item['description']."'":_("Not set")) + ); + printf("\t"._("Status: %s")."\n", $item['status']); + return true; } @@ -146,235 +166,252 @@ function print_item_info($item) { $orderbys = array('id', 'name', 'date', 'status', 'description'); function cli_list($command_args) { - global $orderbys; - $params = array( - 'order' => $orderbys[0], - 'order_direction' => 'ASC', - 'all' => true, - ); - $patterns = array(); - for($i=0; $i < count($command_args); $i++) { - switch($command_args[$i]) { - case '-o': - case '--orderby': - $i++; - if(!in_array($command_args[$i], $orderbys)) - usage('Invalid --orderby clause'); - $params['order'] = $command_args[$i]; - break; - case '-r': - case '--reverse': - $params['order_direction'] = 'DESC'; - break; - case '-s': - case '--status': - $i++; - if(!check_status($command_args[$i])) - usage('Invalid -s/--status clause'); - $params['status'] = $command_args[$i]; - break; - default: - $patterns[] = $command_args[$i]; - } - } + global $orderbys; + $params = array( + 'order' => $orderbys[0], + 'order_direction' => 'ASC', + 'all' => true, + ); + $patterns = array(); + for($i=0; $i < count($command_args); $i++) { + switch($command_args[$i]) { + case '-o': + case '--orderby': + $i++; + if(!in_array($command_args[$i], $orderbys)) + usage('Invalid --orderby clause'); + $params['order'] = $command_args[$i]; + break; + case '-r': + case '--reverse': + $params['order_direction'] = 'DESC'; + break; + case '-s': + case '--status': + $i++; + if(!check_status($command_args[$i])) + usage('Invalid -s/--status clause'); + $params['status'] = $command_args[$i]; + break; + default: + $patterns[] = $command_args[$i]; + } + } - if (!empty($patterns)) - $params['pattern'] = implode(' ', $patterns); + if (!empty($patterns)) + $params['pattern'] = implode(' ', $patterns); - $items = search_items($params); - if (!is_array($items)) { - logging("ERROR", "Invalid DB info return.\n"); - return False; - } + $items = search_items($params); + if (!is_array($items)) { + logging("ERROR", "Invalid DB info return.\n"); + return False; + } - if ($items['count'] == 0){ - echo _("No item.\n"); - return True; - } + if ($items['count'] == 0){ + echo _("No item.\n"); + return True; + } - $tbl = new Console_Table(); - $tbl->setHeaders( - array( - 'ID', - 'Name', - 'Date', - 'Status', - 'Description', - ) - ); - foreach($items['items'] as $info) { - $tbl->addRow( - array( - $info['id'], - $info['name'], - format_time($info['date']), - $info['status'], - ($info['description']?$info['description']:''), - ) - ); - } - echo $tbl->getTable(); - echo "\n".sprintf(_("%d item(s)"), $items['count'])."\n"; - return True; + $tbl = new Console_Table(); + $tbl->setHeaders( + array( + 'ID', + 'Name', + 'Date', + 'Status', + 'Description', + ) + ); + foreach($items['items'] as $info) { + $tbl->addRow( + array( + $info['id'], + $info['name'], + format_time($info['date']), + $info['status'], + ($info['description']?$info['description']:''), + ) + ); + } + echo $tbl->getTable(); + echo "\n".sprintf(_("%d item(s)"), $items['count'])."\n"; + return True; } add_cli_command( - 'list', - 'cli_list', - ___("List/search items"), - ___("[patterns]"), - array( - ___("-o|--orderby Ordering list criterion. Possible values:"), - " - ".implode("\n - ", $orderbys), - ___("-r|--reverse Reverse order"), - ___("-s|--status Filter on status. Possible values:"), - " - ".implode("\n - ", array_keys($status_list)), - ) + 'list', + 'cli_list', + ___("List/search items"), + ___("[patterns]"), + array( + ___("-o|--orderby Ordering list criterion. Possible values:"), + " - ".implode("\n - ", $orderbys), + ___("-r|--reverse Reverse order"), + ___("-s|--status Filter on status. Possible values:"), + " - ".implode("\n - ", array_keys($status_list)), + ) ); function cli_show($command_args) { - if (count($command_args) != 1 || !check_id($command_args[0])) - usage(_('You must provide a valid ID.')); + if (count($command_args) != 1 || !check_id($command_args[0])) + usage(_('You must provide a valid ID.')); $item_id = $command_args[0]; - $item = get_item($item_id); + $item = get_item($item_id); - if (!$item) - logging('FATAL', sprintf(_("Item #%s not found."), $item_id)); + if (!$item) + logging('FATAL', sprintf(_("Item #%s not found."), $item_id)); - print_item_info($item); - return True; + print_item_info($item); + return True; } add_cli_command( - 'show', - 'cli_show', - ___("Show item"), - ___("[ID]") + 'show', + 'cli_show', + ___("Show item"), + ___("[ID]") ); function cli_delete($command_args) { - if (count($command_args) != 1) - usage(_('You must provide item ID.')); + if (count($command_args) != 1) + usage(_('You must provide item ID.')); - // Check URI - if (!check_id($command_args[0])) - logging('FATAL', _("Invalid item ID")); + // Check URI + if (!check_id($command_args[0])) + logging('FATAL', _("Invalid item ID")); - // Check exist - $item_id = $command_args[0]; - $item = get_item($item_id); - if (!$item) - logging('FATAL', sprintf(_("Item #%s not found."), $item_id)); + // Check exist + $item_id = $command_args[0]; + $item = get_item($item_id); + if (!$item) + logging('FATAL', sprintf(_("Item #%s not found."), $item_id)); - print_item_info($item); + print_item_info($item); - // Sure ? - echo _("Are you sure you want to delete this item? Type 'yes' to continue: "); - $handle = fopen ("php://stdin","r"); - $line = fgets($handle); - if(trim($line) != 'yes'){ - logging('WARNING', _("User cancel")); - exit; - } - echo "\n"; + // Sure ? + echo _("Are you sure you want to delete this item? Type 'yes' to continue: "); + $handle = fopen ("php://stdin","r"); + $line = fgets($handle); + if(trim($line) != 'yes'){ + logging('WARNING', _("User cancel")); + exit; + } + echo "\n"; - if (!delete_item($item['id'])) - logging('FATAL', sprintf(_("An error occured deleting item #%d."), $item_id)); + if (!delete_item($item['id'])) + logging('FATAL', sprintf(_("An error occured deleting item #%d."), $item_id)); - return True; + return True; } add_cli_command( - 'delete', - 'cli_delete', - ___("Delete item"), - ___("[item ID]") + 'delete', + 'cli_delete', + ___("Delete item"), + ___("[item ID]") ); function cli_export($command_args) { - $fd = fopen((count($command_args) >= 1?$command_args[0]:'php://output'), 'w'); - export_items($fd); - fclose($fd); - logging('INFO', "Items export to '".(count($command_args) >= 1?$command_args[0]:'STDOUT')."'."); + $fd = fopen((count($command_args) >= 1?$command_args[0]:'php://output'), 'w'); + export_items($fd); + fclose($fd); + logging('INFO', "Items export to '".(count($command_args) >= 1?$command_args[0]:'STDOUT')."'."); } add_cli_command( - 'export', - 'cli_export', - ___("Export items (as CSV)"), - ___("[output file path]") + 'export', + 'cli_export', + ___("Export items (as CSV)"), + ___("[output file path]") ); function cli_restore($command_args) { - $fd = fopen((count($command_args) >= 1?$command_args[0]:'php://stdin'), 'r'); - restore_items($fd); - fclose($fd); - logging('INFO', "Items restored from '".(count($command_args) >= 1?$command_args[0]:'STDIN')."'."); + $fd = fopen((count($command_args) >= 1?$command_args[0]:'php://stdin'), 'r'); + restore_items($fd); + fclose($fd); + logging('INFO', sprint( + "Items restored from '%s'", + (count($command_args) >= 1?$command_args[0]:'STDIN') + )); } add_cli_command( - 'restore', - 'cli_restore', - ___("Restore items (from CSV)"), - ___("[input file path]") + 'restore', + 'cli_restore', + ___("Restore items (from CSV)"), + ___("[input file path]") ); function cli_cron($command_args) { - global $item_max_age; - if (!isset($item_max_age)) - $item_max_age = 30; + global $item_max_age; + if (!isset($item_max_age)) + $item_max_age = 30; - $just_try = false; - for($i=0; $i < count($command_args); $i++) { - switch($command_args[$i]) { - case '-m': - case '--max-age': - $i++; - if(!check_id($command_args[$i])) - usage('Invalid -m|--max-age clause'); - $item_max_age = $command_args[$i]; - break; - case '-j': - case '--just-try': - $just_try = true; - break; - default: - usage('Invalid parameter '.$command_args[$i]); - } - } + $just_try = false; + for($i=0; $i < count($command_args); $i++) { + switch($command_args[$i]) { + case '-m': + case '--max-age': + $i++; + if(!check_id($command_args[$i])) + usage('Invalid -m|--max-age clause'); + $item_max_age = $command_args[$i]; + break; + case '-j': + case '--just-try': + $just_try = true; + break; + default: + usage('Invalid parameter '.$command_args[$i]); + } + } - if (!is_int($item_max_age) || $item_max_age <= 0) - logging('FATAL', 'Invalid $item_max_age value set in configuration: it\'s must be a positive integer.'); - logging('DEBUG', "cli_cron(): item max age = $item_max_age day(s)"); + if (!is_int($item_max_age) || $item_max_age <= 0) + logging( + 'FATAL', + 'Invalid $item_max_age value set in configuration: it\'s must be a positive integer.'); + logging('DEBUG', "cli_cron(): item max age = $item_max_age day(s)"); - $limit = time() - ($item_max_age * 86400); - logging('DEBUG', "Handle items expiration with creation date limit ".format_time($limit)."."); + $limit = time() - ($item_max_age * 86400); + logging('DEBUG', "Handle items expiration with creation date limit ".format_time($limit)."."); - $items = search_items(array('all' => true)); - $error = false; - foreach($items['items'] as $item) { - if ($item['date'] < $limit) { - if ($just_try) { - logging('DEBUG', 'Just-try mode: do not really delete item #'.$item['id'].' ('.$item['name'].', creation date: '.format_time($item['date']).')'); - } - else if (delete_item($item['id'])) { - logging('INFO', 'item #'.$item['id'].' ('.$item['name'].') deleted (creation date: '.format_time($item['date']).')'); - remove_item_attachments($item['id']); - } - else { - logging('ERROR', 'Fail to delete item "'.$item['id'].'" ('.$item['name'].', creation date: '.format_time($item['date']).')'); - $error = true; - } - } - else { - logging('DEBUG', 'item "'.$item['id'].'" ('.$item['name'].') still valid (creation date: '.format_time($item['date']).')'); - } - } - exit($error?1:0); + $items = search_items(array('all' => true)); + $error = false; + foreach($items['items'] as $item) { + if ($item['date'] < $limit) { + if ($just_try) { + logging('DEBUG', sprintf( + 'Just-try mode: do not really delete item #%s (%s, creation date: %s)', + $item['id'], $item['name'], format_time($item['date']) + )); + } + else if (delete_item($item['id'])) { + logging('INFO', sprintf( + 'Item #%s (%s) deleted (creation date: %s)', + + )); + remove_item_attachments($item['id']); + } + else { + logging('ERROR', sprintf( + 'Fail to delete item "%s" (%s, creation date: %s)', + $item['id'], $item['name'], format_time($item['date']) + )); + $error = true; + } + } + else { + logging('DEBUG', sprintf( + 'Item "%s" (%s) still valid (creation date: %s)', + $item['id'], $item['name'], format_time($item['date']) + )); + } + } + exit($error?1:0); } add_cli_command( - 'cron', - 'cli_cron', - ___("Cron to handle item expiration"), - false, - array ( - ___("-j/--just-try Just-try mode : do not really removed expired item(s)"), - ___("-m/--max-age Item expiration limit (in days, optional)"), - ) + 'cron', + 'cli_cron', + ___("Cron to handle item expiration"), + false, + array ( + ___("-j/--just-try Just-try mode : do not really removed expired item(s)"), + ___("-m/--max-age Item expiration limit (in days, optional)"), + ) ); diff --git a/includes/config.inc.php b/includes/config.inc.php index 9c817e1..96ef4ce 100644 --- a/includes/config.inc.php +++ b/includes/config.inc.php @@ -44,8 +44,8 @@ $smarty_templates_c_dir = "$tmp_root_dir/templates_c"; $default_locale = 'en_US.UTF8'; // Session -$session_timeout = 1800; // Session timeout dur to inactivity (in seconds) -$session_max_duration = 43200; // Session max duration (in seconds, default : 12h) +$session_timeout = 1800; // Session timeout dur to inactivity (in seconds) +$session_max_duration = 43200; // Session max duration (in seconds, default : 12h) /** * Database configuration @@ -69,8 +69,8 @@ $db_pwd="items"; $db_options=array(); // Date/Datetime format in database (strptime format) -$db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12 -$db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59 +$db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12 +$db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59 */ /* @@ -81,8 +81,8 @@ $db_pwd="items"; $db_options=array(); // Date/Datetime format in database (strptime format) -$db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12 -$db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59 +$db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12 +$db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59 */ /* @@ -118,5 +118,5 @@ $mail_catch_all = false; // Load local configuration file is present if (is_file("$root_dir_path/includes/config.local.php")) { - require "$root_dir_path/includes/config.local.php"; + require "$root_dir_path/includes/config.local.php"; } diff --git a/includes/core.php b/includes/core.php index 3165c2f..2b8008b 100644 --- a/includes/core.php +++ b/includes/core.php @@ -4,13 +4,13 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); // Root directory path if (__FILE__ != "") { - $script = __FILE__; + $script = __FILE__; } else { - // Fallback method : detect path from core.php path - foreach(get_included_files() as $script) - if (basename($script) == 'core.php') - break; + // Fallback method : detect path from core.php path + foreach(get_included_files() as $script) + if (basename($script) == 'core.php') + break; } $root_dir_path=realpath(dirname($script).'/../'); @@ -29,7 +29,7 @@ require_once('config.inc.php'); // Check $public_root_url end if (substr($public_root_url, -1)=='/') { - $public_root_url=substr($public_root_url, 0, -1); + $public_root_url=substr($public_root_url, 0, -1); } // Define upload_tmp_dir @@ -59,4 +59,4 @@ require_once('mail.php'); // Initialize translation init_translation(); foreach($status_list as $key => $value) - $status_list[$key] = _($value); + $status_list[$key] = _($value); diff --git a/includes/db.php b/includes/db.php index f777f87..2c3ff8d 100644 --- a/includes/db.php +++ b/includes/db.php @@ -182,15 +182,15 @@ function update_item($id, $changes) { } function change_item_status($id, $status) { - if (update_item($id, array('status' => $status))) { - logging('INFO', "Status of item #$id changed to $status."); - return true; - } - return false; + if (update_item($id, array('status' => $status))) { + logging('INFO', "Status of item #$id changed to $status."); + return true; + } + return false; } function archive_item($id) { - return change_item_status($id, 'archived'); + return change_item_status($id, 'archived'); } function delete_item($id) { @@ -285,7 +285,13 @@ function search_items($params) { if (!empty($where)) $query -> where($where); foreach ($patterns_where as $patterns_word) - call_user_func_array(array($query, 'where'), array_merge(array('('.implode(' OR ', array_keys($patterns_word)).')'), array_values($patterns_word))); + call_user_func_array( + array($query, 'where'), + array_merge( + array('('.implode(' OR ', array_keys($patterns_word)).')'), + array_values($patterns_word) + ) + ); $result = $query -> orderBy($orderby) -> limit($limit) -> offset($offset) @@ -315,7 +321,13 @@ function search_items($params) { if (!empty($where)) $query_count -> where($where); foreach ($patterns_where as $patterns_word) - call_user_func_array(array($query_count, 'where'), array_merge(array('('.implode(' OR ', array_keys($patterns_word)).')'), array_values($patterns_word))); + call_user_func_array( + array($query_count, 'where'), + array_merge( + array('('.implode(' OR ', array_keys($patterns_word)).')'), + array_values($patterns_word) + ) + ); $result_count = $query_count -> execute(); @@ -327,7 +339,9 @@ function search_items($params) { return array( 'count' => $count['count'], 'first' => $offset+1, - 'last' => ($offset+$nb_by_page<$count['count']?$offset+$nb_by_page:$count['count']), + 'last' => ( + $offset+$nb_by_page<$count['count']? + $offset+$nb_by_page:$count['count']), 'nb_pages' => ceil($count['count']/$nb_by_page), 'page' => $page, 'items' => $items, @@ -345,97 +359,102 @@ function search_items($params) { } function export_items($fd=null) { - if (!$fd) $fd = fopen('php://output', 'w'); - fputcsv( - $fd, - array ( - 'id', - 'name', - 'date', - 'status', - 'description', - ) - ); - $items = get_items(); - foreach($items as $item) { - fputcsv( - $fd, - array( - $item['id'], - $item['name'], - $item['date'], - $item['status'], - $item['description'], - ) - ); - } - return True; + if (!$fd) $fd = fopen('php://output', 'w'); + fputcsv( + $fd, + array ( + 'id', + 'name', + 'date', + 'status', + 'description', + ) + ); + $items = get_items(); + foreach($items as $item) { + fputcsv( + $fd, + array( + $item['id'], + $item['name'], + $item['date'], + $item['status'], + $item['description'], + ) + ); + } + return True; } function restore_items($fd=null) { - global $fpdo; - if (!$fd) $fd = fopen('php://stdin', 'r'); - try { - $result = $fpdo -> deleteFrom('item') - -> execute(); - if ($result === false) { - logging('ERROR', "An unknown error occured truncating item table in database."); - return false; - } - } - catch (Exception $e) { - logging('ERROR', "Error truncating item table in database : ".$e->getMessage()); - return false; - } + global $fpdo; + if (!$fd) $fd = fopen('php://stdin', 'r'); + try { + $result = $fpdo -> deleteFrom('item') + -> execute(); + if ($result === false) { + logging('ERROR', "An unknown error occured truncating item table in database."); + return false; + } + } + catch (Exception $e) { + logging('ERROR', "Error truncating item table in database : ".$e->getMessage()); + return false; + } - $first_row = false; - $line = 0; - $restored = 0; - $error = false; - $datetime_fields = array ( - 'date', - ); - // Map fields to support hold CSV files format - $mapping = array ( - 'creation_date' => 'date', - 'desc' => 'description', - ); + $first_row = false; + $line = 0; + $restored = 0; + $error = false; + $datetime_fields = array ( + 'date', + ); + // Map fields to support hold CSV files format + $mapping = array ( + 'creation_date' => 'date', + 'desc' => 'description', + ); - while (($row = fgetcsv($fd)) !== FALSE) { - $line++; - if ($first_row === false) { - $first_row = $row; - continue; - } - try { - $values = array(); - for ($i=0; $i < count($first_row); $i++) { - if (!$row[$i]) continue; - $field = (array_key_exists($first_row[$i], $mapping)?$mapping[$first_row[$i]]:$first_row[$i]); - $value = (in_array($field, $datetime_fields)?db_time2datetime($row[$i]):$row[$i]); - $values[$field] = $value; - } - $result = $fpdo -> insertInto('item') - -> values($values) - -> execute(); + while (($row = fgetcsv($fd)) !== FALSE) { + $line++; + if ($first_row === false) { + $first_row = $row; + continue; + } + try { + $values = array(); + for ($i=0; $i < count($first_row); $i++) { + if (!$row[$i]) continue; + $field = ( + array_key_exists($first_row[$i], $mapping)? + $mapping[$first_row[$i]]: + $first_row[$i]); + $value = (in_array($field, $datetime_fields)?db_time2datetime($row[$i]):$row[$i]); + $values[$field] = $value; + } + $result = $fpdo -> insertInto('item') + -> values($values) + -> execute(); - if ($result !== false) { - $restored++; - } - else { - logging('ERROR', "Unkwown error occured restoring item from line #$line :\n".print_r($values, true)); - $error = true; - } - } - catch (Exception $e) { - logging('ERROR', "Error restoring item from line #$line : ".$e->getMessage()."\n".print_r($values, true)); - $error = true; - } - } - logging('INFO', "$restored items restored"); + if ($result !== false) { + $restored++; + } + else { + logging('ERROR', "Unkwown error occured restoring item from line #$line :\n".print_r($values, true)); + $error = true; + } + } + catch (Exception $e) { + logging( + 'ERROR', + "Error restoring item from line #$line : ".$e->getMessage()."\n".print_r($values, true)); + $error = true; + } + } + logging('INFO', "$restored items restored"); - // Trigger hooks - trigger_hook('items_restored'); + // Trigger hooks + trigger_hook('items_restored'); - return !$error; + return !$error; } diff --git a/includes/functions.php b/includes/functions.php index 75ae196..6796eae 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -83,7 +83,8 @@ function check_email($value, $domain=NULL, $checkDns=true) { /* * Handling item POST data */ -function handle_item_post_data(&$info, $enabled_fields=null, $required_fields=null, &$item=null, &$changes=null) { +function handle_item_post_data(&$info, $enabled_fields=null, $required_fields=null, &$item=null, + &$changes=null) { $field_errors=array(); if (isset($_POST['submit'])) { logging('DEBUG', 'POST data : '.vardump($_POST)); @@ -113,7 +114,10 @@ function handle_item_post_data(&$info, $enabled_fields=null, $required_fields=nu } // description - if (isset($_POST['description']) && (!$enabled_fields || in_array('description', $enabled_fields))) { + if ( + isset($_POST['description']) && + (!$enabled_fields || in_array('description', $enabled_fields)) + ) { if (check_is_empty(trim($_POST['description']))) { $info['description'] = null; } @@ -221,132 +225,143 @@ function can_do($item, $status=array()) { * Generic Data/value helpers */ function vardump($data) { - ob_start(); - var_dump($data); - $data = ob_get_contents(); - ob_end_clean(); - return $data; + ob_start(); + var_dump($data); + $data = ob_get_contents(); + ob_end_clean(); + return $data; } function check_is_empty($val) { - switch(gettype($val)) { - case "boolean": - case "integer": - case "double": - case "object": - case "resource": + switch(gettype($val)) { + case "boolean": + case "integer": + case "double": + case "object": + case "resource": return False; - case "array": - case "string": + case "array": + case "string": if ($val == "0") return false; return empty($val); - case "NULL": + case "NULL": return True; - } + } } /* * Generic file/directory helpers */ function dump_file($file_path, $max_age=3600) { - if (is_file($file_path)) { - header('Content-Type: '.mime_content_type($file_path)); - $last_modified_time = filemtime($file_path); - $etag = md5_file($file_path); - header("Cache-Control: max-age=$max_age, must-revalidate"); - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT"); - header("Etag: $etag"); + if (is_file($file_path)) { + header('Content-Type: '.mime_content_type($file_path)); + $last_modified_time = filemtime($file_path); + $etag = md5_file($file_path); + header("Cache-Control: max-age=$max_age, must-revalidate"); + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT"); + header("Etag: $etag"); - if ((isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time) || (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) { - header("HTTP/1.1 304 Not Modified"); - exit(); - } + if ( + ( + isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && + @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time + ) || ( + isset($_SERVER['HTTP_IF_NONE_MATCH']) && + trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag + ) + ) { + header("HTTP/1.1 304 Not Modified"); + exit(); + } - header('Pragma: public'); - header('Content-Length: ' . filesize($file_path)); - readfile($file_path); - exit(); - } - header("HTTP/1.1 404 Not found"); - exit(); + header('Pragma: public'); + header('Content-Length: ' . filesize($file_path)); + readfile($file_path); + exit(); + } + header("HTTP/1.1 404 Not found"); + exit(); } function delete_directory($dir, $recursive=true) { - $files = array_diff(scandir($dir), array('.','..')); - if ($recursive) { + $files = array_diff(scandir($dir), array('.','..')); + if ($recursive) { foreach ($files as $file) { if (is_dir("$dir/$file")) { - if (!delete_directory("$dir/$file", true)) { - logging('ERROR', "delete_directory($dir) : Fail to delete sub-directory '$dir/$file'."); - return false; - } - } - else if (!unlink("$dir/$file")) { - logging('ERROR', "delete_directory($dir) : Fail to delete '$dir/$file'."); - return false; - } + if (!delete_directory("$dir/$file", true)) { + logging('ERROR', "delete_directory($dir) : Fail to delete sub-directory '$dir/$file'."); + return false; + } + } + else if (!unlink("$dir/$file")) { + logging('ERROR', "delete_directory($dir) : Fail to delete '$dir/$file'."); + return false; + } } - } - else if (!empty($files)) { - logging('ERROR', "delete_directory($dir) : Directory is not empty."); - return false; - } + } + else if (!empty($files)) { + logging('ERROR', "delete_directory($dir) : Directory is not empty."); + return false; + } return rmdir($dir); } /* * Run external command helper */ - /** - * Run external command - * - * @param[in] $command string|array The command. It's could be an array of the command with its arguments. - * @param[in] $data_stdin string|null The command arguments (optional, default: null) - * @param[in] $escape_command_args boolean If true, the command will be escaped (optional, default: true) - * - * @retval false|array An array of return code, stdout and stderr result or False in case of fatal error - **/ - function run_external_command($command, $data_stdin=null, $escape_command_args=true) { - if (array($command)) - $command = implode(' ', $command); - if ($escape_command_args) - $command = escapeshellcmd($command); - logging('DEBUG', "Run external command: '$command'"); - $descriptorspec = array( - 0 => array("pipe", "r"), // stdin - 1 => array("pipe", "w"), // stdout - 2 => array("pipe", "w"), // stderr - ); - $process = proc_open($command, $descriptorspec, $pipes); +/** + * Run external command + * + * @param $command string|array The command. It's could be an array of the command with its + * arguments. + * @param $data_stdin string|null The command arguments (optional, default: null) + * @param $escape_command_args boolean If true, the command will be escaped + * (optional, default: true) + * + * @return false|array An array of return code, stdout and stderr result or False in case of fatal + * error + **/ +function run_external_command($command, $data_stdin=null, $escape_command_args=true) { + if (array($command)) + $command = implode(' ', $command); + if ($escape_command_args) + $command = escapeshellcmd($command); + logging('DEBUG', "Run external command: '$command'"); + $descriptorspec = array( + 0 => array("pipe", "r"), // stdin + 1 => array("pipe", "w"), // stdout + 2 => array("pipe", "w"), // stderr + ); + $process = proc_open($command, $descriptorspec, $pipes); - if (!is_resource($process)) { - logging('ERROR', "Fail to run external command: '$command'"); - return false; - } + if (!is_resource($process)) { + logging('ERROR', "Fail to run external command: '$command'"); + return false; + } - if (!is_null($data_stdin)) { - fwrite($pipes[0], $data_stdin); - } - fclose($pipes[0]); + if (!is_null($data_stdin)) { + fwrite($pipes[0], $data_stdin); + } + fclose($pipes[0]); - $stdout = stream_get_contents($pipes[1]); - fclose($pipes[1]); + $stdout = stream_get_contents($pipes[1]); + fclose($pipes[1]); - $stderr = stream_get_contents($pipes[2]); - fclose($pipes[2]); + $stderr = stream_get_contents($pipes[2]); + fclose($pipes[2]); - $return_value = proc_close($process); + $return_value = proc_close($process); - $error = (!empty($stderr) || $return_value != 0); - logging( - ($error?'ERROR':'DEBUG'), - "External command ".($error?"error":"result").":\n". - "\tCommand : $command\n". - "\tReturn code: $return_value\n". - "\tOutput:\n". - "\t\t- Stdout :\n$stdout\n\n". - "\t\t- Stderr :\n$stderr" - ); + $error = (!empty($stderr) || $return_value != 0); + logging( + ($error?'ERROR':'DEBUG'), + "External command ".($error?"error":"result").":\n". + "\tCommand : $command\n". + "\tReturn code: $return_value\n". + "\tOutput:\n". + "\t\t- Stdout :\n$stdout\n\n". + "\t\t- Stderr :\n$stderr" + ); - return array($return_value, $stdout, $stderr); - } + return array($return_value, $stdout, $stderr); +} diff --git a/includes/hooks.php b/includes/hooks.php index 298609f..6d202ff 100644 --- a/includes/hooks.php +++ b/includes/hooks.php @@ -5,95 +5,99 @@ $hooks = array(); /** * Registered a hook on a specific event * - * @param[in] $event string The event name - * @param[in] $callable callable The callable to run on event - * @param[in] $param mixed Paremeter that will be pass to the callable + * @param $event string The event name + * @param $callable callable The callable to run on event + * @param $param mixed Paremeter that will be pass to the callable * Use an array if you have multiple parameters to pass * - * @retval void + * @return void */ function register_hook($event, $callable, $param=NULL) { - global $hooks; - if (!array_key_exists($event, $hooks)) - $hooks[$event] = array(); - $hooks[$event][] = array ( - 'callable' => $callable, - 'param' => $param, - ); + global $hooks; + if (!array_key_exists($event, $hooks)) + $hooks[$event] = array(); + $hooks[$event][] = array ( + 'callable' => $callable, + 'param' => $param, + ); } /** * Run triggered actions on specific event * - * @param[in] $event string Event name + * @param $event string Event name * - * @retval boolean True if all triggered actions succefully runned, false otherwise + * @return boolean True if all triggered actions succefully runned, false otherwise */ function trigger_hook($event_name, $event_data=null) { - global $hooks; - $return = true; + global $hooks; + $return = true; - if (isset($hooks[$event_name]) && is_array($hooks[$event_name])) { - if ($event_name == 'all') - $event = new Event($event_data['event_name'], $event_data['event_data']); - else - $event = new Event($event_name, $event_data); - foreach ($hooks[$event_name] as $e) { - if (is_callable($e['callable'])) { - try { - call_user_func_array($e['callable'],array($event, &$e['param'])); - } - catch(Exception $e) { - logException($e, "An exception occured running hook ".format_callable($e['callable'])." on event $event_name"); - $return = false; - } - } - else { - logging('ERROR', "The hook ".format_callable($e['callable'])." on event $event_name is not callable."); - $return = false; - } - } - } - else - logging('DEBUG', "No hook registered for event $event_name."); + if (isset($hooks[$event_name]) && is_array($hooks[$event_name])) { + if ($event_name == 'all') + $event = new Event($event_data['event_name'], $event_data['event_data']); + else + $event = new Event($event_name, $event_data); + foreach ($hooks[$event_name] as $e) { + if (is_callable($e['callable'])) { + try { + call_user_func_array($e['callable'],array($event, &$e['param'])); + } + catch(Exception $e) { + logException( + $e, "An exception occured running hook ".format_callable($e['callable']). + " on event $event_name"); + $return = false; + } + } + else { + logging( + 'ERROR', + "The hook ".format_callable($e['callable'])." on event $event_name is not callable."); + $return = false; + } + } + } + else + logging('DEBUG', "No hook registered for event $event_name."); - // Handle 'all' event - if ($event_name != 'all') { - trigger_hook ( - 'all', - array ( - 'event_name' => $event_name, - 'event_data' => $event_data, - ) - ); - } + // Handle 'all' event + if ($event_name != 'all') { + trigger_hook ( + 'all', + array ( + 'event_name' => $event_name, + 'event_data' => $event_data, + ) + ); + } - return $return; + return $return; } class Event implements JsonSerializable { - private $name; - private $data; + private $name; + private $data; - function __construct($name, $data) { - $this -> name = $name; - $this -> data = $data; - } + function __construct($name, $data) { + $this -> name = $name; + $this -> data = $data; + } - function __get($key) { - if ($key == 'name') - return $this -> name; - elseif ($key == 'data') - return $this -> data; - elseif (is_array($this -> data) && array_key_exists($key, $this -> data)) - return $this -> data[$key]; - return null; - } + function __get($key) { + if ($key == 'name') + return $this -> name; + elseif ($key == 'data') + return $this -> data; + elseif (is_array($this -> data) && array_key_exists($key, $this -> data)) + return $this -> data[$key]; + return null; + } - public function jsonSerialize() { - return array ( - 'name' => $this -> name, - 'data' => $this -> data, - ); - } + public function jsonSerialize() { + return array ( + 'name' => $this -> name, + 'data' => $this -> data, + ); + } } diff --git a/includes/logging.php b/includes/logging.php index 72daeb8..731e928 100644 --- a/includes/logging.php +++ b/includes/logging.php @@ -15,90 +15,107 @@ $_log_file_fd=null; // Log Levels $_log_levels=array( - 'TRACE' => 0, - 'DEBUG' => 1, - 'INFO' => 2, - 'WARNING' => 3, - 'ERROR' => 4, - 'FATAL' => 5, + 'TRACE' => 0, + 'DEBUG' => 1, + 'INFO' => 2, + 'WARNING' => 3, + 'ERROR' => 4, + 'FATAL' => 5, ); function logging($level, $message) { - global $log_file, $_log_file_fd, $_log_levels, $log_level, $argv; + global $log_file, $_log_file_fd, $_log_levels, $log_level, $argv, $auth_user; - if (!array_key_exists($level, $_log_levels)) $level = 'INFO'; - $level_id = $_log_levels[$level]; + if (!array_key_exists($level, $_log_levels)) $level = 'INFO'; + $level_id = $_log_levels[$level]; - if (!array_key_exists($log_level, $_log_levels)) $log_level = 'INFO'; - $log_level_id = $_log_levels[$log_level]; + if (!array_key_exists($log_level, $_log_levels)) $log_level = 'INFO'; + $log_level_id = $_log_levels[$log_level]; - if ($level_id < $log_level_id) return true; - if(is_null($_log_file_fd)) { - $_log_file_fd = fopen($log_file, 'a'); - } + if ($level_id < $log_level_id) return true; + if(is_null($_log_file_fd)) { + $_log_file_fd = fopen($log_file, 'a'); + } - if (php_sapi_name() == "cli") { - $msg=date('Y/m/d H:i:s').' - '.basename($argv[0])." - $level - $message\n"; - } - else { - // With auth enabled - // global $auth_user; - // $msg=date('Y/m/d H:i:s').' - '.$_SERVER['REQUEST_URI'].' - '.$_SERVER['REMOTE_ADDR']." - $auth_user - $level - $message\n"; - $msg=date('Y/m/d H:i:s').' - '.$_SERVER['REQUEST_URI'].' - '.$_SERVER['REMOTE_ADDR']." - $level - $message\n"; - } + if (php_sapi_name() == "cli") { + $msg = implode(' - ', array( + date('Y/m/d H:i:s'), + basename($argv[0]), + $level, + $message + ))."\n"; + } + else { + $msg = array( + date('Y/m/d H:i:s'), + $_SERVER['REQUEST_URI'], + $_SERVER['REMOTE_ADDR'], + ); + if (isset($auth_user)) + $msg[] = ($auth_user?$auth_user:'anonymous'); + $msg[] = $level; + $msg[] = $message; + $msg = implode(' - ', $msg)."\n"; + } - fwrite($_log_file_fd , $msg); + fwrite($_log_file_fd , $msg); - if ($level == 'FATAL') - if (function_exists('fatal_error')) - fatal_error($message); - else - die("\n$message\n\n"); - elseif (php_sapi_name() == "cli") - echo $msg; + if ($level == 'FATAL') + if (function_exists('fatal_error')) + fatal_error($message); + else + die("\n$message\n\n"); + elseif (php_sapi_name() == "cli") + echo $msg; - return true; + return true; } function change_log_file($file) { - global $log_file, $_log_file_fd; - if ($file == $log_file) return True; - if ($_log_file_fd) { - fclose($_log_file_fd); - $_log_file_fd = false; - } - $log_file = $file; - return True; + global $log_file, $_log_file_fd; + if ($file == $log_file) return True; + if ($_log_file_fd) { + fclose($_log_file_fd); + $_log_file_fd = false; + } + $log_file = $file; + return True; } // Handle exception logging function get_debug_backtrace_context($ignore_last=0) { - $traces = debug_backtrace(); + $traces = debug_backtrace(); - // Also ignore this function it self - $ignore_last++; + // Also ignore this function it self + $ignore_last++; - if (!is_array($traces) || count($traces) <= $ignore_last) - return ""; + if (!is_array($traces) || count($traces) <= $ignore_last) + return ""; - $msg = array(); - for ($i=$ignore_last; $i < count($traces); $i++) { - $trace = array("#$i"); - if (isset($traces[$i]['file'])) - $trace[] = $traces[$i]['file'].(isset($traces[$i]['line'])?":".$traces[$i]['line']:""); - if (isset($traces[$i]['class']) && isset($traces[$i]['function'])) - $trace[] = $traces[$i]['class'] . " " . $traces[$i]['type'] . " " . $traces[$i]['function']. "()"; - elseif (isset($traces[$i]['function'])) - $trace[] = $traces[$i]['function']. "()"; - $msg[] = implode(" - ", $trace); - } + $msg = array(); + for ($i=$ignore_last; $i < count($traces); $i++) { + $trace = array("#$i"); + if (isset($traces[$i]['file'])) + $trace[] = $traces[$i]['file'].(isset($traces[$i]['line'])?":".$traces[$i]['line']:""); + if (isset($traces[$i]['class']) && isset($traces[$i]['function'])) + $trace[] = implode(" ", array( + $traces[$i]['class'], + $traces[$i]['type'], + $traces[$i]['function']. "()")); + elseif (isset($traces[$i]['function'])) + $trace[] = $traces[$i]['function']. "()"; + $msg[] = implode(" - ", $trace); + } - return implode("\n", $msg); + return implode("\n", $msg); } function log_exception($exception, $prefix='') { - logging("ERROR", ($prefix?"$prefix :\n":"An exception occured :\n"). get_debug_backtrace_context(1). "\n" . - "## ".$exception->getFile().":".$exception->getLine(). " : ". $exception->getMessage()); + logging( + "ERROR", + ($prefix?"$prefix :\n":"An exception occured :\n"). + get_debug_backtrace_context(1). "\n" . + "## ".$exception->getFile().":".$exception->getLine(). " : ". $exception->getMessage()); } set_exception_handler('log_exception'); @@ -108,6 +125,6 @@ function log_php_eror($errno, $errstr, $errfile, $errline) { return False; } if ($log_level == 'DEBUG') - set_error_handler('log_php_eror', E_ALL & ~E_STRICT); + set_error_handler('log_php_eror', E_ALL & ~E_STRICT); else - set_error_handler('log_php_eror', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); + set_error_handler('log_php_eror', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); diff --git a/includes/mail.php b/includes/mail.php index 29afe63..a180246 100644 --- a/includes/mail.php +++ b/includes/mail.php @@ -4,12 +4,15 @@ require_once($php_mail_path); require_once($php_mail_mime_path); -function send_mail($from, $to, $subject, $msg, $headers=array(), $attachments=array(), $crlf="\r\n") { +function send_mail($from, $to, $subject, $msg, $headers=array(), $attachments=array(), + $crlf="\r\n") { global $mail_send_method, $mail_headers, $mail_send_params, $mail_catch_all, $mail_sender; $mail_obj = Mail::factory($mail_send_method, $mail_send_params); if ($mail_catch_all) { - $msg .= sprintf(_("\n\n\nMail initialy intended for %s."), (is_array($to)?implode(',', $to):$to)); + $msg .= sprintf( + _("\n\n\nMail initialy intended for %s."), + (is_array($to)?implode(',', $to):$to)); $to = $mail_catch_all; } diff --git a/includes/session.php b/includes/session.php index 7297185..51a592a 100644 --- a/includes/session.php +++ b/includes/session.php @@ -4,7 +4,7 @@ if (php_sapi_name() == "cli") // Define session max duration if (!isset($session_max_duration)) - $session_max_duration = (12*60*60); // Default to 12h + $session_max_duration = (12*60*60); // Default to 12h ini_set('session.gc_maxlifetime', $session_max_duration); ini_set('session.cookie_lifetime', $session_max_duration); @@ -13,23 +13,26 @@ session_start(); // Init session key if (!isset($_SESSION['session_key'])) { - $_SESSION['session_key']=uniqid(); + $_SESSION['session_key']=uniqid(); } // Handle session timeout if ($session_timeout) { - if (!isset($_SESSION['session_last_access'])) { - logging('DEBUG', 'Set initial session last access'); - $_SESSION['session_last_access'] = time(); - } - elseif ($_SESSION['session_last_access'] > (time() - $session_timeout)) { - logging('DEBUG', 'Session timeout not expired, update session last access (Previous value : '.$_SESSION['session_last_access'].')'); - $_SESSION['session_last_access'] = time(); - } - else { - logging('INFO', 'Session destroyed due to inactivity'); - session_destroy(); - } + if (!isset($_SESSION['session_last_access'])) { + logging('DEBUG', 'Set initial session last access'); + $_SESSION['session_last_access'] = time(); + } + elseif ($_SESSION['session_last_access'] > (time() - $session_timeout)) { + logging( + 'DEBUG', + 'Session timeout not expired, update session last access '. + '(Previous value : '.$_SESSION['session_last_access'].')'); + $_SESSION['session_last_access'] = time(); + } + else { + logging('INFO', 'Session destroyed due to inactivity'); + session_destroy(); + } } function check_session_key($value=null) { diff --git a/includes/smarty.php b/includes/smarty.php index 17ce792..4190ad5 100644 --- a/includes/smarty.php +++ b/includes/smarty.php @@ -202,7 +202,11 @@ function smarty_item_status($params) { else $class='danger'; echo ""; - echo array_key_exists($params['item']['status'], $status_list)?$status_list[$params['item']['status']]:"Inconnu (".$params['item']['status'].")"; + echo ( + array_key_exists($params['item']['status'], $status_list)? + $status_list[$params['item']['status']]: + "Inconnu (".$params['item']['status'].")" + ); echo ""; } smarty_register_function('item_status','smarty_item_status'); @@ -223,7 +227,10 @@ function smarty_table_ordered_th($params, $smarty) { echo "".$params['text'].""; } if ($params['order']==$params['search']['order']) { - echo ' '; + echo ( + ' '); } } smarty_register_function('table_ordered_th','smarty_table_ordered_th'); diff --git a/includes/translation-cli.php b/includes/translation-cli.php index 268c4e1..364197b 100644 --- a/includes/translation-cli.php +++ b/includes/translation-cli.php @@ -9,6 +9,14 @@ if (php_sapi_name() != "cli") return true; +/** + * Convert PO file to JSON file + * + * @param string $locale The locale of the input PO file + * @param string $path The path of the input PO file + * + * @return string JSON encoded file content + */ function po2json($locale, $path) { $fileHandler = new \Sepia\PoParser\SourceHandler\FileSystem($path); $poparser = new \Sepia\PoParser\Parser($fileHandler); diff --git a/includes/translation.php b/includes/translation.php index 07c6982..54c5e5f 100644 --- a/includes/translation.php +++ b/includes/translation.php @@ -61,7 +61,7 @@ function lang2locale($lang, $default=null) { * * @param string $msg The message to translate * - * @return string The message without transformation + * @return string The message without transformation */ function ___($msg) { return $msg; diff --git a/includes/url-helpers.php b/includes/url-helpers.php index 9c5f4a0..ed0307c 100644 --- a/includes/url-helpers.php +++ b/includes/url-helpers.php @@ -1,16 +1,16 @@ false, 'status' => 'all', @@ -81,7 +85,10 @@ function handle_search($request) { logging('DEBUG', 'Search params : '.vardump($_SESSION['search'])); $result = search_items($_SESSION['search']); if (!is_array($result)) - fatal_error(_("An error occurred while listing the items. If the problem persists, please contact support.")); + fatal_error( + _("An error occurred while listing the items. ". + "If the problem persists, please contact support.") + ); $smarty -> assign('result', $result); $smarty -> assign('search', $_SESSION['search']); @@ -117,7 +124,10 @@ function handle_show($request) { 'js/myconfirm.js', )); - display_template("show.tpl", sprintf(_("Element %s"), (is_array($item)?$item['name']:"#".$request -> id))); + display_template( + "show.tpl", + sprintf(_("Element %s"), (is_array($item)?$item['name']:"#".$request -> id)) + ); } add_url_handler('|^item/(?P[0-9]+)$|', 'handle_show'); @@ -139,7 +149,9 @@ function handle_create($request) { logging('DEBUG', 'Validated data : '.vardump($info)); logging('DEBUG', 'Fields errors : '.vardump($field_errors)); if (isset($_POST['submit']) && !empty($field_errors)) - add_error(_("There are errors preventing this item from being saved. Please correct them before attempting to add this item.")); + add_error( + _("There are errors preventing this item from being saved. ". + "Please correct them before attempting to add this item.")); $smarty->assign('submited', isset($_POST['submit'])); $smarty->assign('info', $info); $smarty->assign('field_errors', $field_errors); @@ -183,7 +195,9 @@ function handle_modify($request) { logging('DEBUG', 'Fields errors : '.vardump($field_errors)); $smarty->assign('submited', isset($_POST['submit'])); if (isset($_POST['submit']) && !empty($field_errors)) - add_error(_("There are errors preventing this item from being saved. Please correct them before attempting to save your changes.")); + add_error( + _("There are errors preventing this item from being saved. ". + "Please correct them before attempting to save your changes.")); $smarty->assign('info', (!empty($info)?$info:$item)); $smarty->assign('item_id', $item['id']); $smarty->assign('field_errors', $field_errors); @@ -212,7 +226,9 @@ function handle_archive($request) { add_error(_('You cannot archive this item.')); } else if (archive_item($item['id']) === true) { - add_message(sprintf(_("The element '% s' has been archived successfully."), $item['name'])); + add_message(sprintf( + _("The element '% s' has been archived successfully."), + $item['name'])); } else { add_error(_('An error occurred while archiving this item.')); @@ -232,7 +248,9 @@ function handle_delete($request) { add_error(_('You cannot delete this item.')); } else if (delete_item($item['id']) === true) { - add_message(sprintf(_("The element '% s' has been deleted successfully."), $item['name'])); + add_message(sprintf( + _("The element '% s' has been deleted successfully."), + $item['name'])); } else { add_error(_('An error occurred while deleting this item.')); diff --git a/includes/url.php b/includes/url.php index cfd4df5..1ff8c57 100644 --- a/includes/url.php +++ b/includes/url.php @@ -26,14 +26,17 @@ $url_patterns =array(); /** * Add an URL pattern * - * @param[in] $pattern string The URL pattern (required) - * @param[in] $handler callable The URL pattern handler (must be callable, required) - * @param[in] $authenticated boolean Permit to define if this URL is accessible only for authenticated users (optional, default: true) - * @param[in] $override boolean Allow override if a command already exists with the same name (optional, default: false) - * @param[in] $api_mode boolean Enable API mode (optional, default: false) - * @param[in] $methods array|null HTTP method (optional, default: array('GET', 'POST')) + * @param $pattern string The URL pattern (required) + * @param $handler callable The URL pattern handler (must be callable, required) + * @param $authenticated boolean Permit to define if this URL is accessible only for + * authenticated users (optional, default: true) + * @param $override boolean Allow override if a command already exists with the + * same name (optional, default: false) + * @param $api_mode boolean Enable API mode (optional, default: false) + * @param $methods array|null HTTP method (optional, default: array('GET', 'POST')) **/ -function add_url_handler($pattern, $handler=null, $authenticated=false, $override=true, $api_mode=false, $methods=null) { +function add_url_handler($pattern, $handler=null, $authenticated=false, $override=true, + $api_mode=false, $methods=null) { if (is_null($methods)) $methods = array('GET', 'POST'); elseif (!is_array($methods)) @@ -57,7 +60,10 @@ function add_url_handler($pattern, $handler=null, $authenticated=false, $overrid ); } elseif ($override) { - logging('DEBUG', "URL : override pattern '$pattern' with handler '$handler' (old handler = '".$url_patterns[$pattern]."')"); + logging( + 'DEBUG', + "URL : override pattern '$pattern' with handler '$handler' ". + "(old handler = '".$url_patterns[$pattern]."')"); $url_patterns[$pattern] = array( 'handler' => $handler, 'authenticated' => $authenticated, @@ -75,13 +81,13 @@ function add_url_handler($pattern, $handler=null, $authenticated=false, $overrid * Error 404 page */ - /** - * Error 404 handler - * - * @param[in] $request UrlRequest|null The request (optional, default: null) - * - * @retval void - **/ +/** + * Error 404 handler + * + * @param $request UrlRequest|null The request (optional, default: null) + * + * @return void + **/ function error_404($request=null) { display_template('error_404.tpl', _("Whoops ! Page not found")); exit(); @@ -94,19 +100,23 @@ function set_404_url_handler($handler=null) { } -/* +/** * Interprets the requested URL and return the corresponding UrlRequest object * - * @param[in] $default_url string|null The default URL if current one does not - * match with any configured pattern. + * @param $default_url string|null The default URL if current one does not + * match with any configured pattern. * - * @retval UrlRequest The UrlRequest object corresponding to the the requested URL. + * @return UrlRequest The UrlRequest object corresponding to the the requested URL. */ function get_request($default_url=null) { global $url_patterns, $_404_url_handler; $current_url = get_current_url(); if ($current_url === false) { - logging('FATAL', _('Unable to determine the requested page. If the problem persists, please contact support.')); + logging( + 'FATAL', + _('Unable to determine the requested page. '. + 'If the problem persists, please contact support.') + ); exit(); } if (!is_array($url_patterns)) { @@ -115,7 +125,11 @@ function get_request($default_url=null) { } logging('DEBUG', "URL : current url = '$current_url'"); - logging('DEBUG', "URL : check current url with the following URL patterns :\n - ".implode("\n - ", array_keys($url_patterns))); + logging( + 'DEBUG', + "URL : check current url with the following URL patterns :\n - ". + implode("\n - ", array_keys($url_patterns)) + ); foreach ($url_patterns as $pattern => $handler_infos) { $m = url_match($pattern, $current_url, $handler_infos['methods']); if (is_array($m)) { @@ -134,7 +148,9 @@ function get_request($default_url=null) { } // Error 404 $api_mode = (strpos($current_url, 'api/') === 0); - logging('DEBUG', "Current URL match with no pattern. Use error 404 handler (API mode=$api_mode)."); + logging( + 'DEBUG', + "Current URL match with no pattern. Use error 404 handler (API mode=$api_mode)."); return new UrlRequest( $current_url, array( @@ -148,11 +164,11 @@ function get_request($default_url=null) { /** * Check if the current requested URL match with a specific pattern * - * @param[in] $pattern string The URL pattern - * @param[in] $current_url string|false The current URL (optional) - * @param[in] $methods array|null HTTP method (optional, default: no check) + * @param $pattern string The URL pattern + * @param $current_url string|false The current URL (optional) + * @param $methods array|null HTTP method (optional, default: no check) * - * @retval array|false The URL info if pattern matched, false otherwise. + * @return array|false The URL info if pattern matched, false otherwise. **/ function url_match($pattern, $current_url=false, $methods=null) { if ($methods && !in_array($_SERVER['REQUEST_METHOD'], $methods)) @@ -162,16 +178,19 @@ function url_match($pattern, $current_url=false, $methods=null) { if (!$current_url) return False; } if (preg_match($pattern, $current_url, $m)) { - logging('DEBUG', "URL : Match found with pattern '$pattern' :\n\t".str_replace("\n", "\n\t", print_r($m, 1))); + logging( + 'DEBUG', + "URL : Match found with pattern '$pattern' :\n\t". + str_replace("\n", "\n\t", print_r($m, 1))); return $m; } return False; } -/* +/** * Retreive current requested URL and return it * - * @retval string|false The current request URL or false if fail + * @return string|false The current request URL or false if fail **/ function get_current_url() { logging('DEBUG', "URL : request URI = '".$_SERVER['REQUEST_URI']."'"); @@ -183,7 +202,9 @@ function get_current_url() { return ''; if (substr($_SERVER['REQUEST_URI'], 0, strlen($base)) != $base) { - logging('ERROR', "URL : request URI (".$_SERVER['REQUEST_URI'].") does not start with rewrite base ($base)"); + logging( + 'ERROR', + "URL : request URI (".$_SERVER['REQUEST_URI'].") does not start with rewrite base ($base)"); return False; } @@ -206,7 +227,7 @@ function get_current_url() { /** * Try to detect rewrite base from public root URL * - * @retval string The detected rewrite base + * @return string The detected rewrite base **/ function get_rewrite_base() { global $public_root_url; @@ -220,9 +241,9 @@ function get_rewrite_base() { /** * Trigger redirect to specified URL (or homepage if omited) * - * @param[in] $go string|false The destination URL + * @param $go string|false The destination URL * - * @retval void + * @return void **/ function redirect($go=false) { global $public_root_url; @@ -244,7 +265,10 @@ function redirect($go=false) { // Prevent loop if (isset($_SESSION['last_redirect']) && $_SESSION['last_redirect'] == $url) - logging('FATAL', _('Unable to determine the requested page (loop detected). If the problem persists, please contact support.')); + logging( + 'FATAL', + _('Unable to determine the requested page (loop detected). '. + 'If the problem persists, please contact support.')); else $_SESSION['last_redirect'] = $url; @@ -256,10 +280,10 @@ function redirect($go=false) { /** * Handle the current requested URL * - * @param[in] $default_url string|null The default URL if current one does not - * match with any configured pattern. + * @param $default_url string|null The default URL if current one does not + * match with any configured pattern. * - * @retval void + * @return void **/ function handle_request($default_url=null) { global $smarty, $api_mode; @@ -284,7 +308,8 @@ function handle_request($default_url=null) { return call_user_func($request -> handler, $request); } catch (Exception $e) { - log_exception($e, "An exception occured running URL handler function ".$request -> handler."()"); + log_exception( + $e, "An exception occured running URL handler function ".$request -> handler."()"); logging('FATAL', _("This request could not be processed correctly.")); } } @@ -292,9 +317,9 @@ function handle_request($default_url=null) { /** * Remove trailing slash in specified URL * - * @param[in] $url string The URL + * @param $url string The URL * - * @retval string The specified URL without trailing slash + * @return string The specified URL without trailing slash **/ function remove_trailing_slash($url) { if ($url == '/') @@ -310,9 +335,9 @@ function remove_trailing_slash($url) { * Check if session key is present and valid and set AJAX * mode. * - * @param[in] $session_key string The current session key (optional) + * @param $session_key string The current session key (optional) * - * @retval void + * @return void **/ function check_ajax_request($session_key=null) { global $ajax, $debug_ajax; @@ -328,18 +353,25 @@ function check_ajax_request($session_key=null) { /** * Get the public absolute URL * - * @param[in] $relative_url string|null Relative URL to convert (Default: current URL) + * @param $relative_url string|null Relative URL to convert (Default: current URL) * - * @retval string The public absolute URL + * @return string The public absolute URL **/ function get_absolute_url($relative_url=null) { global $public_root_url; if (!is_string($relative_url)) $relative_url = get_current_url(); if ($public_root_url[0] == '/') { - logging('DEBUG', "URL :: get_absolute_url($relative_url): configured public root URL is relative ($public_root_url) => try to detect it from current request infos."); - $public_root_url = 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'?'s':'').'://'.$_SERVER['HTTP_HOST'].$public_root_url; - logging('DEBUG', "URL :: get_absolute_url($relative_url): detected public_root_url: $public_root_url"); + logging( + 'DEBUG', + "URL :: get_absolute_url($relative_url): configured public root URL is relative ". + "($public_root_url) => try to detect it from current request infos."); + $public_root_url = ( + 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'?'s':'').'://'. + $_SERVER['HTTP_HOST'].$public_root_url); + logging( + 'DEBUG', + "URL :: get_absolute_url($relative_url): detected public_root_url: $public_root_url"); } if (substr($relative_url, 0, 1) == '/') @@ -352,23 +384,23 @@ function get_absolute_url($relative_url=null) { /** * Check if specified URL is absolute * - * @param[in] $url string The URL to check + * @param $url string The URL to check * - * @retval boolean True if specified URL is absolute, False otherwise + * @return boolean True if specified URL is absolute, False otherwise **/ function is_absolute_url($url) { return boolval(preg_match('#^https?://#', $url)); } -/* +/** * Add parameter in specified URL * - * @param[in] &$url string The reference of the URL - * @param[in] $param string The parameter name - * @param[in] $value string The parameter value - * @param[in] $encode boolean Set if parameter value must be URL encoded (optional, default: true) + * @param &$url string The reference of the URL + * @param $param string The parameter name + * @param $value string The parameter value + * @param $encode boolean Set if parameter value must be URL encoded (optional, default: true) * - * @retval string|null The completed URL + * @return string|null The completed URL */ function add_url_parameter(&$url, $param, $value, $encode=true) { if (strpos($url, '?') === false) @@ -404,17 +436,21 @@ class UrlRequest { public function __construct($current_url, $handler_infos, $url_params=array()) { $this -> current_url = $current_url; $this -> handler = $handler_infos['handler']; - $this -> authenticated = (isset($handler_infos['authenticated'])?boolval($handler_infos['authenticated']):true); - $this -> api_mode = (isset($handler_infos['api_mode'])?boolval($handler_infos['api_mode']):false); + $this -> authenticated = ( + isset($handler_infos['authenticated'])? + boolval($handler_infos['authenticated']):true); + $this -> api_mode = ( + isset($handler_infos['api_mode'])? + boolval($handler_infos['api_mode']):false); $this -> url_params = $url_params; } /** * Get request info * - * @param[in] $key string The name of the info + * @param $key string The name of the info * - * @retval mixed The value + * @return mixed The value **/ public function __get($key) { if ($key == 'current_url') @@ -439,9 +475,9 @@ class UrlRequest { /** * Check is request info is set * - * @param[in] $key string The name of the info + * @param $key string The name of the info * - * @retval boolval True is info is set, False otherwise + * @return boolval True is info is set, False otherwise **/ public function __isset($key) { if (in_array($key, array('current_url', 'handler', 'authenticated'))) @@ -452,10 +488,11 @@ class UrlRequest { /** * Get request parameter * - * @param[in] $parameter string The name of the parameter - * @param[in] $decode string If true, the parameter value will be urldecoded (optional, default: true) + * @param $parameter string The name of the parameter + * @param $decode string If true, the parameter value will be urldecoded + * (optional, default: true) * - * @retval mixed The value or false if parameter does not exists + * @return mixed The value or false if parameter does not exists **/ public function get_param($parameter, $decode=true) { if (array_key_exists($parameter, $this->url_params)) { @@ -466,10 +503,10 @@ class UrlRequest { return false; } - /* + /** * Get request referer (if known) * - * @retval string|null The request referer URL if known, null otherwise + * @return string|null The request referer URL if known, null otherwise */ public function get_referer() { if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) diff --git a/lang/fr_FR.UTF8/LC_MESSAGES/DEFAULT.po b/lang/fr_FR.UTF8/LC_MESSAGES/DEFAULT.po index a7ec58a..be9eb01 100644 --- a/lang/fr_FR.UTF8/LC_MESSAGES/DEFAULT.po +++ b/lang/fr_FR.UTF8/LC_MESSAGES/DEFAULT.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2022-04-24 16:47+0200\n" +"POT-Creation-Date: 2022-04-24 17:42+0200\n" "PO-Revision-Date: \n" "Last-Translator: Benjamin Renard \n" "Language-Team: \n" @@ -17,8 +17,8 @@ msgid "Invalid element identifier." msgstr "Identifiant d'élément invalide." #: /home/brenard/dev/eesyphp/includes/url-helpers.php:9 -#: /home/brenard/dev/eesyphp/includes/url-public.php:205 -#: /home/brenard/dev/eesyphp/includes/url-public.php:229 +#: /home/brenard/dev/eesyphp/includes/url-public.php:219 +#: /home/brenard/dev/eesyphp/includes/url-public.php:245 #, php-format msgid "Item #% s not found." msgstr "L'élément #%s est introuvable." @@ -40,11 +40,11 @@ msgstr "Une erreur est survenue en affichant cette page." msgid "Hello world !" msgstr "Bonjour tout le monde !" -#: /home/brenard/dev/eesyphp/includes/url-public.php:27 +#: /home/brenard/dev/eesyphp/includes/url-public.php:31 msgid "Any" msgstr "Peu importe" -#: /home/brenard/dev/eesyphp/includes/url-public.php:84 +#: /home/brenard/dev/eesyphp/includes/url-public.php:89 msgid "" "An error occurred while listing the items. If the problem persists, please " "contact support." @@ -52,25 +52,25 @@ msgstr "" "Une erreur est survenue en listant les éléments. Si le problème persiste, " "merci de prendre contact avec le support." -#: /home/brenard/dev/eesyphp/includes/url-public.php:97 +#: /home/brenard/dev/eesyphp/includes/url-public.php:104 msgid "Search" msgstr "Rechercher" -#: /home/brenard/dev/eesyphp/includes/url-public.php:120 +#: /home/brenard/dev/eesyphp/includes/url-public.php:129 #, php-format msgid "Element %s" msgstr "Élément %s" -#: /home/brenard/dev/eesyphp/includes/url-public.php:132 +#: /home/brenard/dev/eesyphp/includes/url-public.php:142 #, php-format msgid "The element '% s' has been created." msgstr "L'élément '%s' a bien été créé." -#: /home/brenard/dev/eesyphp/includes/url-public.php:136 +#: /home/brenard/dev/eesyphp/includes/url-public.php:146 msgid "An error occurred while saving this item." msgstr "Une erreur est survenue en enregistrant cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:142 +#: /home/brenard/dev/eesyphp/includes/url-public.php:153 msgid "" "There are errors preventing this item from being saved. Please correct them " "before attempting to add this item." @@ -78,29 +78,29 @@ msgstr "" "Des erreurs empêchent l'enregistrement de cet élément. Merci de les corriger " "avant de tenter d'ajouter cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:148 +#: /home/brenard/dev/eesyphp/includes/url-public.php:160 msgid "New" msgstr "Nouveau" -#: /home/brenard/dev/eesyphp/includes/url-public.php:158 +#: /home/brenard/dev/eesyphp/includes/url-public.php:170 msgid "You cannot edit this item." msgstr "Vous ne pouvez pas modifier cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:171 +#: /home/brenard/dev/eesyphp/includes/url-public.php:183 #, php-format msgid "You have not made any changes to element '% s'." msgstr "Vous n'avez apporté aucune modification à l'élément '%s'." -#: /home/brenard/dev/eesyphp/includes/url-public.php:175 +#: /home/brenard/dev/eesyphp/includes/url-public.php:187 #, php-format msgid "The element '% s' has been updated successfully." msgstr "L'élément '%s' a bien été mise à jour." -#: /home/brenard/dev/eesyphp/includes/url-public.php:179 +#: /home/brenard/dev/eesyphp/includes/url-public.php:191 msgid "An error occurred while updating this item." msgstr "Une erreur est survenue en mettant à jour cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:186 +#: /home/brenard/dev/eesyphp/includes/url-public.php:199 msgid "" "There are errors preventing this item from being saved. Please correct them " "before attempting to save your changes." @@ -108,38 +108,38 @@ msgstr "" "Des erreurs empêchent l'enregistrement de cet élément. Merci de les corriger " "avant de tenter d'enregistrer vos modifications." -#: /home/brenard/dev/eesyphp/includes/url-public.php:196 +#: /home/brenard/dev/eesyphp/includes/url-public.php:210 #, php-format msgid "Element %s: Modification" msgstr "Élément %s : Modification" -#: /home/brenard/dev/eesyphp/includes/url-public.php:209 +#: /home/brenard/dev/eesyphp/includes/url-public.php:223 msgid "This item is already archived." msgstr "Cet élément est déjà archivé." -#: /home/brenard/dev/eesyphp/includes/url-public.php:212 +#: /home/brenard/dev/eesyphp/includes/url-public.php:226 msgid "You cannot archive this item." msgstr "Vous ne pouvez pas archiver cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:215 +#: /home/brenard/dev/eesyphp/includes/url-public.php:230 #, php-format msgid "The element '% s' has been archived successfully." msgstr "L'élément '%s' a bien été archivé." -#: /home/brenard/dev/eesyphp/includes/url-public.php:218 +#: /home/brenard/dev/eesyphp/includes/url-public.php:234 msgid "An error occurred while archiving this item." msgstr "Une erreur est survenue en archivant cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:232 +#: /home/brenard/dev/eesyphp/includes/url-public.php:248 msgid "You cannot delete this item." msgstr "Vous ne pouvez pas supprimer cet élément." -#: /home/brenard/dev/eesyphp/includes/url-public.php:235 +#: /home/brenard/dev/eesyphp/includes/url-public.php:252 #, php-format msgid "The element '% s' has been deleted successfully." msgstr "L'élément '%s' a bien été supprimé." -#: /home/brenard/dev/eesyphp/includes/url-public.php:238 +#: /home/brenard/dev/eesyphp/includes/url-public.php:256 msgid "An error occurred while deleting this item." msgstr "Une erreur est survenue en supprimant cet élément." @@ -163,106 +163,106 @@ msgstr "Refusé" msgid "Archived" msgstr "Archivé" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:51 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:59 msgid "Fail to list PHP files." msgstr "Impossible de lister les fichiers PHP." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:68 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:76 msgid "Fail to extract messages from PHP files using xgettext." msgstr "" "Impossible d'extraire les messages depuis les fichiers PHP en utilisant " "xgettext." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:78 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:86 msgid "Fail to list JS files." msgstr "Impossible de lister les fichiers JS." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:95 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:103 msgid "Fail to extract messages from JS files using xgettext." msgstr "" "Impossible d'extraire les messages depuis les fichiers JS en utilisant " "xgettext." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:108 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:116 msgid "" "Fail to extract messages from template files using tsmarty2c.php script." msgstr "" "Impossible d'extraire les messages depuis les fichiers template en utilisant " "le script tsmarty2c.php." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:134 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:142 msgid "Fail to merge messages using msgcat." msgstr "Impossible de fusionner les messages en utilisant msgcat." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:139 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:147 msgid "Extract messages that need to be translated" msgstr "Extraire les messages devant être traduit" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:141 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:149 msgid "This command could be used to generate/update lang/messages.pot file." msgstr "" "Cette commande peut-être utilisée pour générer/mettre à jour le fichier lang/" "messages.pot." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:159 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:167 #, php-format msgid "Compendium file %s not found." msgstr "Fichier compendium %s introuvable." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:171 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:179 #, php-format msgid "POT file not found (%s). Please run extract_messages first." msgstr "" "Fichier POT introuvable (%s). Merci de lancer la commande extract_messages " "pour commencer." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:186 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:325 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:194 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:333 #, php-format msgid "Lang directory '%s' found" msgstr "Dossier de langue '%s' trouvé" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:193 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:332 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:201 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:340 #, php-format msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it." msgstr "" "Le dossier LC_MESSAGES est introuvable dans le dossier de langue '%s', on " "l'ignore." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:210 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:218 #, php-format msgid "Fail to init messages in %s PO file using msginit (%s)." msgstr "" "Impossible d'initialiser les messages dans le fichier PO %s en utilisant " "msginit (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:230 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:238 #, php-format msgid "Fail to update messages in %s PO file using msgmerge (%s)." msgstr "" "Impossible de mettre à jour les messages dans les fichiers PO %s en " "utilisant msgmerge (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:238 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:342 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:246 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:350 #, php-format msgid "PO file not found in lang '%s' directory, ignore it." msgstr "" "Le fichier PO est introuvable dans le dossier de langue '%s', on l'ignore." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:247 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:390 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:255 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:398 #, php-format msgid "Fail to open root lang directory (%s)." msgstr "Impossible d'ouvrir le dossier racine des langues (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:252 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:260 msgid "Update messages in translation PO lang files" msgstr "" "Mettre à jour les messages dans les fichiers de traduction PO existants" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:254 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:262 msgid "" "This command could be used to init/update PO files in lang/*/LC_MESSAGES " "directories." @@ -270,28 +270,28 @@ msgstr "" "Cette commande peut-être utilisée pour initialiser/mettre à jour les " "fichiers PO les dossiers lang/*/LC_MESSAGES." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:281 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:289 #, php-format msgid "Lang alias symlink found: %s -> %s" msgstr "Lien symbolique d'alias de langue trouvé : %s -> %s" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:291 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:299 #, php-format msgid "JSON catalog symlink for %s -> %s created (%s)" msgstr "Lien symbolique de catalogue JSON pour %s -> %s créé (%s)" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:299 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:307 #, php-format msgid "Fail to create JSON catalog symlink for %s -> %s (%s)" msgstr "" "Impossible de créer le lien symbolique de catalogue JSON pour %s -> %s (%s)" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:309 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:317 #, php-format msgid "JSON catalog symlink for %s -> %s already exist (%s)" msgstr "Le lien symbolique du catalogue JSON pour %s -> %s existe déjà (%s)" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:317 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:325 #, php-format msgid "" "JSON catalog file for %s already exist, but it's not a symlink to %s (%s)" @@ -299,29 +299,29 @@ msgstr "" "Le catalogue JSON pour %s existe, mais il ne s'agit par d'un lien symbolique " "vers %s (%s)" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:356 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:364 #, php-format msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)." msgstr "" "Impossible de compiler les messages depuis le fichier PO %s en tant que " "fichier MO en utilisant msgfmt (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:367 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:375 #, php-format msgid "Fail to open %s JSON catalog file in write mode (%s)." msgstr "Impossible d'ouvrir le catalogue JSON %s en mode écriture (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:374 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:382 #, php-format msgid "Fail to write %s JSON catalog in file (%s)." msgstr "Impossible d'écrire le fichier du catalogue JSON %s (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:381 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:389 #, php-format msgid "%s JSON catalog writed (%s)." msgstr "Catalogue JSON %s créé (%s)." -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:396 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:404 msgid "" "Compile messages from existing translation PO lang files to corresponding MO " "files and JSON catalogs" @@ -329,7 +329,7 @@ msgstr "" "Compiler les messages depuis les fichiers PO de traduction existants vers " "les fichiers MO et les catalogues JSON correspondant" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:401 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:409 msgid "" "This command could be used to compile PO files in lang/*/LC_MESSAGES " "directories to MO files and as JSON catalogs in public_html/translations." @@ -338,7 +338,7 @@ msgstr "" "dossiers lang/*/LC_MESSAGES en fichiers MO and en tant que catalogues JSON " "dans public_html/translations." -#: /home/brenard/dev/eesyphp/includes/mail.php:12 +#: /home/brenard/dev/eesyphp/includes/mail.php:14 #, php-format msgid "" "\n" @@ -351,11 +351,11 @@ msgstr "" "\n" "Mail originalement destiné à %s." -#: /home/brenard/dev/eesyphp/includes/url.php:86 +#: /home/brenard/dev/eesyphp/includes/url.php:92 msgid "Whoops ! Page not found" msgstr "Oups ! Page introuvable" -#: /home/brenard/dev/eesyphp/includes/url.php:109 +#: /home/brenard/dev/eesyphp/includes/url.php:117 msgid "" "Unable to determine the requested page. If the problem persists, please " "contact support." @@ -363,7 +363,7 @@ msgstr "" "Impossible de déterminer la page demandée. Si le problème persiste, merci de " "prendre contact avec le support." -#: /home/brenard/dev/eesyphp/includes/url.php:247 +#: /home/brenard/dev/eesyphp/includes/url.php:270 msgid "" "Unable to determine the requested page (loop detected). If the problem " "persists, please contact support." @@ -371,54 +371,54 @@ msgstr "" "Impossible de déterminer la page demandée (boucle détectée). Si le problème " "persiste, merci de prendre contact avec le support." -#: /home/brenard/dev/eesyphp/includes/url.php:271 +#: /home/brenard/dev/eesyphp/includes/url.php:295 msgid "This request cannot be processed." msgstr "Cette requête ne peut être traitée." -#: /home/brenard/dev/eesyphp/includes/url.php:288 +#: /home/brenard/dev/eesyphp/includes/url.php:313 msgid "This request could not be processed correctly." msgstr "Cette requête n'a put être traitée correctement." -#: /home/brenard/dev/eesyphp/includes/cli.php:7 +#: /home/brenard/dev/eesyphp/includes/cli.php:8 #, php-format msgid "The CLI command '%s' already exists." msgstr "La commande CLI '%s' n'existe pas." -#: /home/brenard/dev/eesyphp/includes/cli.php:12 +#: /home/brenard/dev/eesyphp/includes/cli.php:13 #, php-format msgid "The CLI command '%s' handler is not callable !" msgstr "La fonction implémentant la commande CLI '%s' n'est pas exécutable !" -#: /home/brenard/dev/eesyphp/includes/cli.php:45 +#: /home/brenard/dev/eesyphp/includes/cli.php:46 #, php-format msgid "Usage: %s [-h] [-qd] command\n" msgstr "Utilisation: %s [-h] [-qd] commande\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:46 +#: /home/brenard/dev/eesyphp/includes/cli.php:47 msgid " -h Show this message\n" msgstr " -h Affiche ce message\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:47 +#: /home/brenard/dev/eesyphp/includes/cli.php:48 msgid " -q / -d Quiet/Debug mode\n" msgstr " -q / -d Mode silencieux/debug\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:48 +#: /home/brenard/dev/eesyphp/includes/cli.php:49 msgid " --trace Trace mode (the most verbose)\n" msgstr " --trace Mode trace (le plus verbeux)\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:49 +#: /home/brenard/dev/eesyphp/includes/cli.php:50 msgid " command Command to run\n" msgstr " command La commande à exécuter\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:51 +#: /home/brenard/dev/eesyphp/includes/cli.php:52 msgid "Available commands:\n" msgstr "Commandes disponibles:\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:86 +#: /home/brenard/dev/eesyphp/includes/cli.php:94 msgid "Only one command could be executed !" msgstr "Une seul commande peut-être exécutée !" -#: /home/brenard/dev/eesyphp/includes/cli.php:110 +#: /home/brenard/dev/eesyphp/includes/cli.php:119 #, php-format msgid "" "Invalid parameter \"%s\".\n" @@ -428,150 +428,150 @@ msgstr "" "Note : Les paramètres/arguments de la requête doivent être placés après " "celle-ci." -#: /home/brenard/dev/eesyphp/includes/cli.php:127 +#: /home/brenard/dev/eesyphp/includes/cli.php:144 #, php-format msgid "An exception occured running command %s" msgstr "Une exception est survenue en exécutant la commande %s" -#: /home/brenard/dev/eesyphp/includes/cli.php:133 +#: /home/brenard/dev/eesyphp/includes/cli.php:150 #, php-format msgid "Item #%s:\n" msgstr "Élément #%s :\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:134 +#: /home/brenard/dev/eesyphp/includes/cli.php:151 #, php-format msgid "ID: %s" msgstr "ID : %s" -#: /home/brenard/dev/eesyphp/includes/cli.php:135 +#: /home/brenard/dev/eesyphp/includes/cli.php:152 #, php-format msgid "Name: '%s'" msgstr "Nom : %s" -#: /home/brenard/dev/eesyphp/includes/cli.php:136 +#: /home/brenard/dev/eesyphp/includes/cli.php:153 #, php-format msgid "Date: %s" msgstr "Date : %s" -#: /home/brenard/dev/eesyphp/includes/cli.php:137 +#: /home/brenard/dev/eesyphp/includes/cli.php:155 #, php-format msgid "Description: %s" msgstr "Description : %s" -#: /home/brenard/dev/eesyphp/includes/cli.php:137 +#: /home/brenard/dev/eesyphp/includes/cli.php:156 msgid "Not set" msgstr "Non-défini" -#: /home/brenard/dev/eesyphp/includes/cli.php:138 +#: /home/brenard/dev/eesyphp/includes/cli.php:158 #, php-format msgid "Status: %s" msgstr "Statut : %s" -#: /home/brenard/dev/eesyphp/includes/cli.php:191 +#: /home/brenard/dev/eesyphp/includes/cli.php:211 msgid "No item.\n" msgstr "Aucun élément.\n" -#: /home/brenard/dev/eesyphp/includes/cli.php:217 +#: /home/brenard/dev/eesyphp/includes/cli.php:237 #, php-format msgid "%d item(s)" msgstr "%d élément(s)" -#: /home/brenard/dev/eesyphp/includes/cli.php:223 +#: /home/brenard/dev/eesyphp/includes/cli.php:243 msgid "List/search items" msgstr "Lister/rechercher les éléments" -#: /home/brenard/dev/eesyphp/includes/cli.php:224 +#: /home/brenard/dev/eesyphp/includes/cli.php:244 msgid "[patterns]" msgstr "[mots clés]" -#: /home/brenard/dev/eesyphp/includes/cli.php:226 +#: /home/brenard/dev/eesyphp/includes/cli.php:246 msgid "-o|--orderby Ordering list criterion. Possible values:" msgstr "-o|--orderby Critère de tri de la liste. Valeurs possibles :" -#: /home/brenard/dev/eesyphp/includes/cli.php:228 +#: /home/brenard/dev/eesyphp/includes/cli.php:248 msgid "-r|--reverse Reverse order" msgstr "-r|--reverse Ordre inverse" -#: /home/brenard/dev/eesyphp/includes/cli.php:229 +#: /home/brenard/dev/eesyphp/includes/cli.php:249 msgid "-s|--status Filter on status. Possible values:" msgstr "-s|--status Filtrer sur le statut. Valeurs possibles :" -#: /home/brenard/dev/eesyphp/includes/cli.php:236 +#: /home/brenard/dev/eesyphp/includes/cli.php:256 msgid "You must provide a valid ID." msgstr "Vous devez fournir un ID valide." -#: /home/brenard/dev/eesyphp/includes/cli.php:242 -#: /home/brenard/dev/eesyphp/includes/cli.php:266 +#: /home/brenard/dev/eesyphp/includes/cli.php:262 +#: /home/brenard/dev/eesyphp/includes/cli.php:286 #, php-format msgid "Item #%s not found." msgstr "Élément #%s introuvable." -#: /home/brenard/dev/eesyphp/includes/cli.php:250 +#: /home/brenard/dev/eesyphp/includes/cli.php:270 msgid "Show item" msgstr "Voir un élément" -#: /home/brenard/dev/eesyphp/includes/cli.php:251 +#: /home/brenard/dev/eesyphp/includes/cli.php:271 msgid "[ID]" msgstr "[ID]" -#: /home/brenard/dev/eesyphp/includes/cli.php:256 +#: /home/brenard/dev/eesyphp/includes/cli.php:276 msgid "You must provide item ID." msgstr "Vous devez fournir un ID valide." -#: /home/brenard/dev/eesyphp/includes/cli.php:260 +#: /home/brenard/dev/eesyphp/includes/cli.php:280 msgid "Invalid item ID" msgstr "ID d'élément invalide" -#: /home/brenard/dev/eesyphp/includes/cli.php:271 +#: /home/brenard/dev/eesyphp/includes/cli.php:291 msgid "Are you sure you want to delete this item? Type 'yes' to continue: " msgstr "" "Êtes-vous sûre de vouloir supprimer cet élément ? Taper 'yes' pour " "continuer : " -#: /home/brenard/dev/eesyphp/includes/cli.php:275 +#: /home/brenard/dev/eesyphp/includes/cli.php:295 msgid "User cancel" msgstr "L'utilisateur a annulé" -#: /home/brenard/dev/eesyphp/includes/cli.php:281 +#: /home/brenard/dev/eesyphp/includes/cli.php:301 #, php-format msgid "An error occured deleting item #%d." msgstr "Une erreur est survenue en supprimant l'élément #%d." -#: /home/brenard/dev/eesyphp/includes/cli.php:288 +#: /home/brenard/dev/eesyphp/includes/cli.php:308 msgid "Delete item" msgstr "Supprimer un élément" -#: /home/brenard/dev/eesyphp/includes/cli.php:289 +#: /home/brenard/dev/eesyphp/includes/cli.php:309 msgid "[item ID]" msgstr "[ID de l'élément]" -#: /home/brenard/dev/eesyphp/includes/cli.php:301 +#: /home/brenard/dev/eesyphp/includes/cli.php:321 msgid "Export items (as CSV)" msgstr "Exporter les éléments (au format CSV)" -#: /home/brenard/dev/eesyphp/includes/cli.php:302 +#: /home/brenard/dev/eesyphp/includes/cli.php:322 msgid "[output file path]" msgstr "[chemin du fichier de sortie]" -#: /home/brenard/dev/eesyphp/includes/cli.php:314 +#: /home/brenard/dev/eesyphp/includes/cli.php:337 msgid "Restore items (from CSV)" msgstr "Restaurer les éléments (depuis un fichier CSV)" -#: /home/brenard/dev/eesyphp/includes/cli.php:315 +#: /home/brenard/dev/eesyphp/includes/cli.php:338 msgid "[input file path]" msgstr "[chemin du fichier d'entrée]" -#: /home/brenard/dev/eesyphp/includes/cli.php:374 +#: /home/brenard/dev/eesyphp/includes/cli.php:411 msgid "Cron to handle item expiration" msgstr "Cron gérant l'expiration des éléments" -#: /home/brenard/dev/eesyphp/includes/cli.php:377 +#: /home/brenard/dev/eesyphp/includes/cli.php:414 msgid "-j/--just-try Just-try mode : do not really removed expired item(s)" msgstr "" "-j/--just-try Mode just-try : Ne supprime pas réellement les éléments " "expirés" -#: /home/brenard/dev/eesyphp/includes/cli.php:378 +#: /home/brenard/dev/eesyphp/includes/cli.php:415 msgid "-m/--max-age Item expiration limit (in days, optional)" msgstr "" "-m/--max-age Limite d'expiration des éléments (en secondes, optionnel)" diff --git a/lang/headers.pot b/lang/headers.pot index 594e590..9751f75 100644 --- a/lang/headers.pot +++ b/lang/headers.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" -"POT-Creation-Date: 2022-04-24 16:47+0200\n" -"PO-Revision-Date: 2022-04-24 16:47+0200\n" +"POT-Creation-Date: 2022-04-24 17:42+0200\n" +"PO-Revision-Date: 2022-04-24 17:42+0200\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" \ No newline at end of file diff --git a/lang/messages.pot b/lang/messages.pot index 70d6606..8af168d 100644 --- a/lang/messages.pot +++ b/lang/messages.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" -"POT-Creation-Date: 2022-04-24 16:47+0200\n" -"PO-Revision-Date: 2022-04-24 16:47+0200\n" +"POT-Creation-Date: 2022-04-24 17:42+0200\n" +"PO-Revision-Date: 2022-04-24 17:42+0200\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -11,8 +11,8 @@ msgid "Invalid element identifier." msgstr "" #: /home/brenard/dev/eesyphp/includes/url-helpers.php:9 -#: /home/brenard/dev/eesyphp/includes/url-public.php:205 -#: /home/brenard/dev/eesyphp/includes/url-public.php:229 +#: /home/brenard/dev/eesyphp/includes/url-public.php:219 +#: /home/brenard/dev/eesyphp/includes/url-public.php:245 #, php-format msgid "Item #% s not found." msgstr "" @@ -34,100 +34,100 @@ msgstr "" msgid "Hello world !" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:27 +#: /home/brenard/dev/eesyphp/includes/url-public.php:31 msgid "Any" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:84 +#: /home/brenard/dev/eesyphp/includes/url-public.php:89 msgid "" "An error occurred while listing the items. If the problem persists, please " "contact support." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:97 +#: /home/brenard/dev/eesyphp/includes/url-public.php:104 msgid "Search" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:120 +#: /home/brenard/dev/eesyphp/includes/url-public.php:129 #, php-format msgid "Element %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:132 +#: /home/brenard/dev/eesyphp/includes/url-public.php:142 #, php-format msgid "The element '% s' has been created." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:136 +#: /home/brenard/dev/eesyphp/includes/url-public.php:146 msgid "An error occurred while saving this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:142 +#: /home/brenard/dev/eesyphp/includes/url-public.php:153 msgid "" "There are errors preventing this item from being saved. Please correct them " "before attempting to add this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:148 +#: /home/brenard/dev/eesyphp/includes/url-public.php:160 msgid "New" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:158 +#: /home/brenard/dev/eesyphp/includes/url-public.php:170 msgid "You cannot edit this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:171 +#: /home/brenard/dev/eesyphp/includes/url-public.php:183 #, php-format msgid "You have not made any changes to element '% s'." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:175 +#: /home/brenard/dev/eesyphp/includes/url-public.php:187 #, php-format msgid "The element '% s' has been updated successfully." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:179 +#: /home/brenard/dev/eesyphp/includes/url-public.php:191 msgid "An error occurred while updating this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:186 +#: /home/brenard/dev/eesyphp/includes/url-public.php:199 msgid "" "There are errors preventing this item from being saved. Please correct them " "before attempting to save your changes." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:196 +#: /home/brenard/dev/eesyphp/includes/url-public.php:210 #, php-format msgid "Element %s: Modification" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:209 +#: /home/brenard/dev/eesyphp/includes/url-public.php:223 msgid "This item is already archived." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:212 +#: /home/brenard/dev/eesyphp/includes/url-public.php:226 msgid "You cannot archive this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:215 +#: /home/brenard/dev/eesyphp/includes/url-public.php:230 #, php-format msgid "The element '% s' has been archived successfully." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:218 +#: /home/brenard/dev/eesyphp/includes/url-public.php:234 msgid "An error occurred while archiving this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:232 +#: /home/brenard/dev/eesyphp/includes/url-public.php:248 msgid "You cannot delete this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:235 +#: /home/brenard/dev/eesyphp/includes/url-public.php:252 #, php-format msgid "The element '% s' has been deleted successfully." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:238 +#: /home/brenard/dev/eesyphp/includes/url-public.php:256 msgid "An error occurred while deleting this item." msgstr "" @@ -151,152 +151,152 @@ msgstr "" msgid "Archived" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:51 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:59 msgid "Fail to list PHP files." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:68 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:76 msgid "Fail to extract messages from PHP files using xgettext." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:78 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:86 msgid "Fail to list JS files." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:95 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:103 msgid "Fail to extract messages from JS files using xgettext." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:108 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:116 msgid "" "Fail to extract messages from template files using tsmarty2c.php script." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:134 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:142 msgid "Fail to merge messages using msgcat." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:139 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:147 msgid "Extract messages that need to be translated" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:141 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:149 msgid "This command could be used to generate/update lang/messages.pot file." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:159 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:167 #, php-format msgid "Compendium file %s not found." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:171 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:179 #, php-format msgid "POT file not found (%s). Please run extract_messages first." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:186 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:325 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:194 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:333 #, php-format msgid "Lang directory '%s' found" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:193 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:332 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:201 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:340 #, php-format msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:210 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:218 #, php-format msgid "Fail to init messages in %s PO file using msginit (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:230 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:238 #, php-format msgid "Fail to update messages in %s PO file using msgmerge (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:238 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:342 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:246 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:350 #, php-format msgid "PO file not found in lang '%s' directory, ignore it." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:247 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:390 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:255 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:398 #, php-format msgid "Fail to open root lang directory (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:252 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:260 msgid "Update messages in translation PO lang files" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:254 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:262 msgid "" "This command could be used to init/update PO files in lang/*/LC_MESSAGES " "directories." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:281 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:289 #, php-format msgid "Lang alias symlink found: %s -> %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:291 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:299 #, php-format msgid "JSON catalog symlink for %s -> %s created (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:299 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:307 #, php-format msgid "Fail to create JSON catalog symlink for %s -> %s (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:309 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:317 #, php-format msgid "JSON catalog symlink for %s -> %s already exist (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:317 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:325 #, php-format msgid "" "JSON catalog file for %s already exist, but it's not a symlink to %s (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:356 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:364 #, php-format msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:367 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:375 #, php-format msgid "Fail to open %s JSON catalog file in write mode (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:374 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:382 #, php-format msgid "Fail to write %s JSON catalog in file (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:381 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:389 #, php-format msgid "%s JSON catalog writed (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:396 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:404 msgid "" "Compile messages from existing translation PO lang files to corresponding MO " "files and JSON catalogs" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:401 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:409 msgid "" "This command could be used to compile PO files in lang/*/LC_MESSAGES " "directories to MO files and as JSON catalogs in public_html/translations." msgstr "" -#: /home/brenard/dev/eesyphp/includes/mail.php:12 +#: /home/brenard/dev/eesyphp/includes/mail.php:14 #, php-format msgid "" "\n" @@ -305,216 +305,216 @@ msgid "" "Mail initialy intended for %s." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:86 +#: /home/brenard/dev/eesyphp/includes/url.php:92 msgid "Whoops ! Page not found" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:109 +#: /home/brenard/dev/eesyphp/includes/url.php:117 msgid "" "Unable to determine the requested page. If the problem persists, please " "contact support." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:247 +#: /home/brenard/dev/eesyphp/includes/url.php:270 msgid "" "Unable to determine the requested page (loop detected). If the problem " "persists, please contact support." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:271 +#: /home/brenard/dev/eesyphp/includes/url.php:295 msgid "This request cannot be processed." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:288 +#: /home/brenard/dev/eesyphp/includes/url.php:313 msgid "This request could not be processed correctly." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:7 +#: /home/brenard/dev/eesyphp/includes/cli.php:8 #, php-format msgid "The CLI command '%s' already exists." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:12 +#: /home/brenard/dev/eesyphp/includes/cli.php:13 #, php-format msgid "The CLI command '%s' handler is not callable !" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:45 +#: /home/brenard/dev/eesyphp/includes/cli.php:46 #, php-format msgid "Usage: %s [-h] [-qd] command\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:46 +#: /home/brenard/dev/eesyphp/includes/cli.php:47 msgid " -h Show this message\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:47 +#: /home/brenard/dev/eesyphp/includes/cli.php:48 msgid " -q / -d Quiet/Debug mode\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:48 +#: /home/brenard/dev/eesyphp/includes/cli.php:49 msgid " --trace Trace mode (the most verbose)\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:49 +#: /home/brenard/dev/eesyphp/includes/cli.php:50 msgid " command Command to run\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:51 +#: /home/brenard/dev/eesyphp/includes/cli.php:52 msgid "Available commands:\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:86 +#: /home/brenard/dev/eesyphp/includes/cli.php:94 msgid "Only one command could be executed !" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:110 +#: /home/brenard/dev/eesyphp/includes/cli.php:119 #, php-format msgid "" "Invalid parameter \"%s\".\n" "Note: Command's parameter/argument must be place after the command." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:127 +#: /home/brenard/dev/eesyphp/includes/cli.php:144 #, php-format msgid "An exception occured running command %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:133 +#: /home/brenard/dev/eesyphp/includes/cli.php:150 #, php-format msgid "Item #%s:\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:134 +#: /home/brenard/dev/eesyphp/includes/cli.php:151 #, php-format msgid "ID: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:135 +#: /home/brenard/dev/eesyphp/includes/cli.php:152 #, php-format msgid "Name: '%s'" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:136 +#: /home/brenard/dev/eesyphp/includes/cli.php:153 #, php-format msgid "Date: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:137 +#: /home/brenard/dev/eesyphp/includes/cli.php:155 #, php-format msgid "Description: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:137 +#: /home/brenard/dev/eesyphp/includes/cli.php:156 msgid "Not set" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:138 +#: /home/brenard/dev/eesyphp/includes/cli.php:158 #, php-format msgid "Status: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:191 +#: /home/brenard/dev/eesyphp/includes/cli.php:211 msgid "No item.\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:217 +#: /home/brenard/dev/eesyphp/includes/cli.php:237 #, php-format msgid "%d item(s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:223 +#: /home/brenard/dev/eesyphp/includes/cli.php:243 msgid "List/search items" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:224 +#: /home/brenard/dev/eesyphp/includes/cli.php:244 msgid "[patterns]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:226 +#: /home/brenard/dev/eesyphp/includes/cli.php:246 msgid "-o|--orderby Ordering list criterion. Possible values:" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:228 +#: /home/brenard/dev/eesyphp/includes/cli.php:248 msgid "-r|--reverse Reverse order" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:229 +#: /home/brenard/dev/eesyphp/includes/cli.php:249 msgid "-s|--status Filter on status. Possible values:" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:236 +#: /home/brenard/dev/eesyphp/includes/cli.php:256 msgid "You must provide a valid ID." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:242 -#: /home/brenard/dev/eesyphp/includes/cli.php:266 +#: /home/brenard/dev/eesyphp/includes/cli.php:262 +#: /home/brenard/dev/eesyphp/includes/cli.php:286 #, php-format msgid "Item #%s not found." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:250 +#: /home/brenard/dev/eesyphp/includes/cli.php:270 msgid "Show item" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:251 +#: /home/brenard/dev/eesyphp/includes/cli.php:271 msgid "[ID]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:256 +#: /home/brenard/dev/eesyphp/includes/cli.php:276 msgid "You must provide item ID." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:260 +#: /home/brenard/dev/eesyphp/includes/cli.php:280 msgid "Invalid item ID" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:271 +#: /home/brenard/dev/eesyphp/includes/cli.php:291 msgid "Are you sure you want to delete this item? Type 'yes' to continue: " msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:275 +#: /home/brenard/dev/eesyphp/includes/cli.php:295 msgid "User cancel" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:281 +#: /home/brenard/dev/eesyphp/includes/cli.php:301 #, php-format msgid "An error occured deleting item #%d." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:288 +#: /home/brenard/dev/eesyphp/includes/cli.php:308 msgid "Delete item" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:289 +#: /home/brenard/dev/eesyphp/includes/cli.php:309 msgid "[item ID]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:301 +#: /home/brenard/dev/eesyphp/includes/cli.php:321 msgid "Export items (as CSV)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:302 +#: /home/brenard/dev/eesyphp/includes/cli.php:322 msgid "[output file path]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:314 +#: /home/brenard/dev/eesyphp/includes/cli.php:337 msgid "Restore items (from CSV)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:315 +#: /home/brenard/dev/eesyphp/includes/cli.php:338 msgid "[input file path]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:374 +#: /home/brenard/dev/eesyphp/includes/cli.php:411 msgid "Cron to handle item expiration" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:377 +#: /home/brenard/dev/eesyphp/includes/cli.php:414 msgid "-j/--just-try Just-try mode : do not really removed expired item(s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:378 +#: /home/brenard/dev/eesyphp/includes/cli.php:415 msgid "-m/--max-age Item expiration limit (in days, optional)" msgstr "" diff --git a/lang/php-messages.pot b/lang/php-messages.pot index c99a6b7..d46e253 100644 --- a/lang/php-messages.pot +++ b/lang/php-messages.pot @@ -3,8 +3,8 @@ msgid "Invalid element identifier." msgstr "" #: /home/brenard/dev/eesyphp/includes/url-helpers.php:9 -#: /home/brenard/dev/eesyphp/includes/url-public.php:205 -#: /home/brenard/dev/eesyphp/includes/url-public.php:229 +#: /home/brenard/dev/eesyphp/includes/url-public.php:219 +#: /home/brenard/dev/eesyphp/includes/url-public.php:245 #, php-format msgid "Item #% s not found." msgstr "" @@ -26,100 +26,100 @@ msgstr "" msgid "Hello world !" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:27 +#: /home/brenard/dev/eesyphp/includes/url-public.php:31 msgid "Any" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:84 +#: /home/brenard/dev/eesyphp/includes/url-public.php:89 msgid "" "An error occurred while listing the items. If the problem persists, please " "contact support." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:97 +#: /home/brenard/dev/eesyphp/includes/url-public.php:104 msgid "Search" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:120 +#: /home/brenard/dev/eesyphp/includes/url-public.php:129 #, php-format msgid "Element %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:132 +#: /home/brenard/dev/eesyphp/includes/url-public.php:142 #, php-format msgid "The element '% s' has been created." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:136 +#: /home/brenard/dev/eesyphp/includes/url-public.php:146 msgid "An error occurred while saving this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:142 +#: /home/brenard/dev/eesyphp/includes/url-public.php:153 msgid "" "There are errors preventing this item from being saved. Please correct them " "before attempting to add this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:148 +#: /home/brenard/dev/eesyphp/includes/url-public.php:160 msgid "New" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:158 +#: /home/brenard/dev/eesyphp/includes/url-public.php:170 msgid "You cannot edit this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:171 +#: /home/brenard/dev/eesyphp/includes/url-public.php:183 #, php-format msgid "You have not made any changes to element '% s'." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:175 +#: /home/brenard/dev/eesyphp/includes/url-public.php:187 #, php-format msgid "The element '% s' has been updated successfully." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:179 +#: /home/brenard/dev/eesyphp/includes/url-public.php:191 msgid "An error occurred while updating this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:186 +#: /home/brenard/dev/eesyphp/includes/url-public.php:199 msgid "" "There are errors preventing this item from being saved. Please correct them " "before attempting to save your changes." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:196 +#: /home/brenard/dev/eesyphp/includes/url-public.php:210 #, php-format msgid "Element %s: Modification" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:209 +#: /home/brenard/dev/eesyphp/includes/url-public.php:223 msgid "This item is already archived." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:212 +#: /home/brenard/dev/eesyphp/includes/url-public.php:226 msgid "You cannot archive this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:215 +#: /home/brenard/dev/eesyphp/includes/url-public.php:230 #, php-format msgid "The element '% s' has been archived successfully." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:218 +#: /home/brenard/dev/eesyphp/includes/url-public.php:234 msgid "An error occurred while archiving this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:232 +#: /home/brenard/dev/eesyphp/includes/url-public.php:248 msgid "You cannot delete this item." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:235 +#: /home/brenard/dev/eesyphp/includes/url-public.php:252 #, php-format msgid "The element '% s' has been deleted successfully." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url-public.php:238 +#: /home/brenard/dev/eesyphp/includes/url-public.php:256 msgid "An error occurred while deleting this item." msgstr "" @@ -143,152 +143,152 @@ msgstr "" msgid "Archived" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:51 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:59 msgid "Fail to list PHP files." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:68 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:76 msgid "Fail to extract messages from PHP files using xgettext." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:78 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:86 msgid "Fail to list JS files." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:95 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:103 msgid "Fail to extract messages from JS files using xgettext." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:108 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:116 msgid "" "Fail to extract messages from template files using tsmarty2c.php script." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:134 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:142 msgid "Fail to merge messages using msgcat." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:139 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:147 msgid "Extract messages that need to be translated" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:141 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:149 msgid "This command could be used to generate/update lang/messages.pot file." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:159 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:167 #, php-format msgid "Compendium file %s not found." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:171 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:179 #, php-format msgid "POT file not found (%s). Please run extract_messages first." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:186 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:325 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:194 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:333 #, php-format msgid "Lang directory '%s' found" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:193 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:332 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:201 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:340 #, php-format msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:210 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:218 #, php-format msgid "Fail to init messages in %s PO file using msginit (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:230 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:238 #, php-format msgid "Fail to update messages in %s PO file using msgmerge (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:238 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:342 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:246 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:350 #, php-format msgid "PO file not found in lang '%s' directory, ignore it." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:247 -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:390 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:255 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:398 #, php-format msgid "Fail to open root lang directory (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:252 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:260 msgid "Update messages in translation PO lang files" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:254 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:262 msgid "" "This command could be used to init/update PO files in lang/*/LC_MESSAGES " "directories." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:281 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:289 #, php-format msgid "Lang alias symlink found: %s -> %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:291 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:299 #, php-format msgid "JSON catalog symlink for %s -> %s created (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:299 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:307 #, php-format msgid "Fail to create JSON catalog symlink for %s -> %s (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:309 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:317 #, php-format msgid "JSON catalog symlink for %s -> %s already exist (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:317 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:325 #, php-format msgid "" "JSON catalog file for %s already exist, but it's not a symlink to %s (%s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:356 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:364 #, php-format msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:367 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:375 #, php-format msgid "Fail to open %s JSON catalog file in write mode (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:374 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:382 #, php-format msgid "Fail to write %s JSON catalog in file (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:381 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:389 #, php-format msgid "%s JSON catalog writed (%s)." msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:396 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:404 msgid "" "Compile messages from existing translation PO lang files to corresponding MO " "files and JSON catalogs" msgstr "" -#: /home/brenard/dev/eesyphp/includes/translation-cli.php:401 +#: /home/brenard/dev/eesyphp/includes/translation-cli.php:409 msgid "" "This command could be used to compile PO files in lang/*/LC_MESSAGES " "directories to MO files and as JSON catalogs in public_html/translations." msgstr "" -#: /home/brenard/dev/eesyphp/includes/mail.php:12 +#: /home/brenard/dev/eesyphp/includes/mail.php:14 #, php-format msgid "" "\n" @@ -297,215 +297,215 @@ msgid "" "Mail initialy intended for %s." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:86 +#: /home/brenard/dev/eesyphp/includes/url.php:92 msgid "Whoops ! Page not found" msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:109 +#: /home/brenard/dev/eesyphp/includes/url.php:117 msgid "" "Unable to determine the requested page. If the problem persists, please " "contact support." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:247 +#: /home/brenard/dev/eesyphp/includes/url.php:270 msgid "" "Unable to determine the requested page (loop detected). If the problem " "persists, please contact support." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:271 +#: /home/brenard/dev/eesyphp/includes/url.php:295 msgid "This request cannot be processed." msgstr "" -#: /home/brenard/dev/eesyphp/includes/url.php:288 +#: /home/brenard/dev/eesyphp/includes/url.php:313 msgid "This request could not be processed correctly." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:7 +#: /home/brenard/dev/eesyphp/includes/cli.php:8 #, php-format msgid "The CLI command '%s' already exists." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:12 +#: /home/brenard/dev/eesyphp/includes/cli.php:13 #, php-format msgid "The CLI command '%s' handler is not callable !" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:45 +#: /home/brenard/dev/eesyphp/includes/cli.php:46 #, php-format msgid "Usage: %s [-h] [-qd] command\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:46 +#: /home/brenard/dev/eesyphp/includes/cli.php:47 msgid " -h Show this message\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:47 +#: /home/brenard/dev/eesyphp/includes/cli.php:48 msgid " -q / -d Quiet/Debug mode\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:48 +#: /home/brenard/dev/eesyphp/includes/cli.php:49 msgid " --trace Trace mode (the most verbose)\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:49 +#: /home/brenard/dev/eesyphp/includes/cli.php:50 msgid " command Command to run\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:51 +#: /home/brenard/dev/eesyphp/includes/cli.php:52 msgid "Available commands:\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:86 +#: /home/brenard/dev/eesyphp/includes/cli.php:94 msgid "Only one command could be executed !" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:110 +#: /home/brenard/dev/eesyphp/includes/cli.php:119 #, php-format msgid "" "Invalid parameter \"%s\".\n" "Note: Command's parameter/argument must be place after the command." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:127 +#: /home/brenard/dev/eesyphp/includes/cli.php:144 #, php-format msgid "An exception occured running command %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:133 +#: /home/brenard/dev/eesyphp/includes/cli.php:150 #, php-format msgid "Item #%s:\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:134 +#: /home/brenard/dev/eesyphp/includes/cli.php:151 #, php-format msgid "ID: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:135 +#: /home/brenard/dev/eesyphp/includes/cli.php:152 #, php-format msgid "Name: '%s'" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:136 +#: /home/brenard/dev/eesyphp/includes/cli.php:153 #, php-format msgid "Date: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:137 +#: /home/brenard/dev/eesyphp/includes/cli.php:155 #, php-format msgid "Description: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:137 +#: /home/brenard/dev/eesyphp/includes/cli.php:156 msgid "Not set" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:138 +#: /home/brenard/dev/eesyphp/includes/cli.php:158 #, php-format msgid "Status: %s" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:191 +#: /home/brenard/dev/eesyphp/includes/cli.php:211 msgid "No item.\n" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:217 +#: /home/brenard/dev/eesyphp/includes/cli.php:237 #, php-format msgid "%d item(s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:223 +#: /home/brenard/dev/eesyphp/includes/cli.php:243 msgid "List/search items" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:224 +#: /home/brenard/dev/eesyphp/includes/cli.php:244 msgid "[patterns]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:226 +#: /home/brenard/dev/eesyphp/includes/cli.php:246 msgid "-o|--orderby Ordering list criterion. Possible values:" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:228 +#: /home/brenard/dev/eesyphp/includes/cli.php:248 msgid "-r|--reverse Reverse order" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:229 +#: /home/brenard/dev/eesyphp/includes/cli.php:249 msgid "-s|--status Filter on status. Possible values:" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:236 +#: /home/brenard/dev/eesyphp/includes/cli.php:256 msgid "You must provide a valid ID." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:242 -#: /home/brenard/dev/eesyphp/includes/cli.php:266 +#: /home/brenard/dev/eesyphp/includes/cli.php:262 +#: /home/brenard/dev/eesyphp/includes/cli.php:286 #, php-format msgid "Item #%s not found." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:250 +#: /home/brenard/dev/eesyphp/includes/cli.php:270 msgid "Show item" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:251 +#: /home/brenard/dev/eesyphp/includes/cli.php:271 msgid "[ID]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:256 +#: /home/brenard/dev/eesyphp/includes/cli.php:276 msgid "You must provide item ID." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:260 +#: /home/brenard/dev/eesyphp/includes/cli.php:280 msgid "Invalid item ID" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:271 +#: /home/brenard/dev/eesyphp/includes/cli.php:291 msgid "Are you sure you want to delete this item? Type 'yes' to continue: " msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:275 +#: /home/brenard/dev/eesyphp/includes/cli.php:295 msgid "User cancel" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:281 +#: /home/brenard/dev/eesyphp/includes/cli.php:301 #, php-format msgid "An error occured deleting item #%d." msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:288 +#: /home/brenard/dev/eesyphp/includes/cli.php:308 msgid "Delete item" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:289 +#: /home/brenard/dev/eesyphp/includes/cli.php:309 msgid "[item ID]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:301 +#: /home/brenard/dev/eesyphp/includes/cli.php:321 msgid "Export items (as CSV)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:302 +#: /home/brenard/dev/eesyphp/includes/cli.php:322 msgid "[output file path]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:314 +#: /home/brenard/dev/eesyphp/includes/cli.php:337 msgid "Restore items (from CSV)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:315 +#: /home/brenard/dev/eesyphp/includes/cli.php:338 msgid "[input file path]" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:374 +#: /home/brenard/dev/eesyphp/includes/cli.php:411 msgid "Cron to handle item expiration" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:377 +#: /home/brenard/dev/eesyphp/includes/cli.php:414 msgid "-j/--just-try Just-try mode : do not really removed expired item(s)" msgstr "" -#: /home/brenard/dev/eesyphp/includes/cli.php:378 +#: /home/brenard/dev/eesyphp/includes/cli.php:415 msgid "-m/--max-age Item expiration limit (in days, optional)" msgstr ""