function process_cli_params($params) { $success = 0; // 0 == success. if (isset($params['version'])) { print_version(); return [$params, 2]; } if (isset($params['help']) || !isset($params['g'])) { print_help(); return [$params, 1]; } if (@$params['logfile']) { mylogger()->set_log_file($params['logfile']); mylogger()->echo_log = false; } $loglevel = @$params['loglevel'] ?: 'info'; mylogger()->set_log_level_by_name($loglevel); $xpublist = get_xpub_list($params, $empty_ok = true); $params['derivation'] = @$params['derivation'] ?: 'relative'; $params['include-unused'] = isset($params['include-unused']) ? true : false; $params['multisig'] = count($xpublist) > 1; // legacy copay used multisig even for 1 of 1 wallets. if ($params['derivation'] == 'copaylegacy') { $params['multisig'] = true; // if numsig is missing for 1of1 then we set it to 1. $params['numsig'] = @$params['numsig'] ?: (count($xpublist) == 1 ? 1 : null); } $params['gen-only'] = is_numeric(@$params['gen-only']) ? $params['gen-only'] : null; $types = array('receive', 'change', 'both'); $params['type'] = in_array(@$params['type'], $types) ? $params['type'] : 'both'; if (count($xpublist) > 1 && !@$params['numsig']) { throw new Exception("multisig requires --numsig"); } $params['gap-limit'] = @$params['gap-limit'] ?: 20; $params['batch-size'] = @$params['batch-size'] ?: 'auto'; $params['cols'] = get_cols($params); $params['min-receive'] = is_numeric(@$params['min-receive']) ? $params['min-receive'] : 0; $params['min-change'] = is_numeric(@$params['min-change']) ? @$params['min-change'] : 0; $params['api'] = @$params['api'] ?: 'blockchaindotinfo'; $params['insight'] = @$params['insight'] ?: 'https://insight.bitpay.com/api'; $params['blockchaindotinfo'] = @@$params['blockchaindotinfo'] ?: 'https://blockchain.info'; $params['toshi'] = @$params['toshi'] ?: 'https://bitcoin.toshi.io'; $params['blockr'] = @$params['blockr'] ?: 'https://btc.blockr.io'; $params['format'] = @$params['format'] ?: 'txt'; $params['cols'] = @$params['cols'] ?: 'all'; $params['oracle-raw'] = @$params['oracle-raw'] ?: null; $params['oracle-json'] = @$params['oracle-json'] ?: null; return [$params, $success]; }
function stdfoot($normalpage = true, $update = true) { global $STYLEPATH; if ($normalpage) { include $STYLEPATH . '/footer.php'; } print_version(); print "</body>\n</html>\n"; if ($update) { register_shutdown_function("updatedata"); } }
#!/usr/bin/php5 <?php $PROGNAME = basename($_SERVER["SCRIPT_NAME"]); $VERSION = "0.1.0"; $shortopts = ""; #$shortopts .= "f:"; // Required value #$shortopts .= "v::"; // Optional value #$shortopts .= "abc"; // These options do not accept values $longopts = array("debug", "version", "help"); $options = getopt($shortopts, $longopts); if (array_key_exists("debug", $options)) { $DEBUG = 1; } if (array_key_exists("version", $options)) { print_version(); } if (array_key_exists("help", $options)) { print_usage(); } function print_version() { global $PROGNAME; global $VERSION; print "{$PROGNAME}: version {$VERSION}\n"; exit; } function print_usage($message = "", $retval = 0) { if ($message) { print "{$message}\n"; }
function stdfoot($normalpage = true, $update = true, $adminpage = false, $torrentspage = false, $forumpage = false) { global $STYLEPATH, $tpl, $no_columns, $PRINT_DEBUG, $STYLETYPE; $tpl->set('to_top', print_top()); $tpl->set('tracker_url', print_trackerurl()); $tpl->set('site_name', print_sitename()); $tpl->set('user_name', print_username()); $tpl->set('main_footer', bottom_menu() . "<br />\n"); $tpl->set('xbtit_version', print_version()); $tpl->set('style_copyright', print_designer()); $tpl->set('xbtit_debug', $PRINT_DEBUG ? print_debug() : ""); $tpl->set('news_text', print_disclaimer()); if ($STYLETYPE == 2) { // It's a style modified for atmoner's original system // Improvement of template by atmoner if ($normalpage && !$no_columns) { $tpl->set("RIGHT_COL", true, true); $tpl->set("LEFT_COL", true, true); $tpl->set("NO_HEADER", true, true); $tpl->set("NO_FOOTER", true, true); } elseif ($adminpage) { $tpl->set("RIGHT_COL", false, true); $tpl->set("LEFT_COL", true, true); $tpl->set("NO_HEADER", true, true); $tpl->set("NO_FOOTER", true, true); } elseif ($torrentspage || $forumpage || $no_columns == 1) { $tpl->set("RIGHT_COL", false, true); $tpl->set("LEFT_COL", false, true); $tpl->set("NO_HEADER", true, true); $tpl->set("NO_FOOTER", true, true); } else { $tpl->set("RIGHT_COL", false, true); $tpl->set("LEFT_COL", false, true); $tpl->set("NO_HEADER", false, true); $tpl->set("NO_FOOTER", false, true); } echo $tpl->fetch(load_template('main.tpl')); } elseif ($STYLETYPE == 3) { // It's a style modified for Petr1fied's enhanced version of atmoner's system. $tpl->set("TYPE1_EXCLUSIVE_1", false, true); $tpl->set("TYPE1_EXCLUSIVE_2", false, true); $tpl->set("TYPE1_EXCLUSIVE_3", false, true); $tpl->set("TYPE1_EXCLUSIVE_4", false, true); $tpl->set("TYPE1_EXCLUSIVE_5", false, true); $tpl->set("TYPE2_EXCLUSIVE_1", false, true); $tpl->set("TYPE2_EXCLUSIVE_2", false, true); $tpl->set("TYPE2_EXCLUSIVE_3", false, true); $tpl->set("TYPE2_EXCLUSIVE_4", false, true); $tpl->set("TYPE2_EXCLUSIVE_5", false, true); $tpl->set("TYPE3_EXCLUSIVE_1", false, true); $tpl->set("TYPE3_EXCLUSIVE_2", false, true); $tpl->set("TYPE3_EXCLUSIVE_3", false, true); $tpl->set("TYPE3_EXCLUSIVE_4", false, true); $tpl->set("TYPE3_EXCLUSIVE_5", false, true); $tpl->set("TYPE4_EXCLUSIVE_1", false, true); $tpl->set("TYPE4_EXCLUSIVE_2", false, true); $tpl->set("TYPE4_EXCLUSIVE_3", false, true); $tpl->set("TYPE4_EXCLUSIVE_4", false, true); $tpl->set("TYPE4_EXCLUSIVE_5", false, true); if ($normalpage && !$no_columns) { $tpl->set("HAS_LEFT_COL", true, true); $tpl->set("HAS_RIGHT_COL", true, true); $tpl->set("IS_DISPLAYED_1", true, true); $tpl->set("IS_DISPLAYED_2", true, true); $tpl->set("IS_DISPLAYED_3", true, true); $tpl->set("IS_DISPLAYED_4", true, true); $tpl->set("IS_DISPLAYED_5", true, true); $tpl->set("TYPE1_EXCLUSIVE_1", true, true); $tpl->set("TYPE1_EXCLUSIVE_2", true, true); $tpl->set("TYPE1_EXCLUSIVE_3", true, true); $tpl->set("TYPE1_EXCLUSIVE_4", true, true); $tpl->set("TYPE1_EXCLUSIVE_5", true, true); } elseif ($adminpage) { $tpl->set("HAS_LEFT_COL", true, true); $tpl->set("HAS_RIGHT_COL", false, true); $tpl->set("IS_DISPLAYED_1", true, true); $tpl->set("IS_DISPLAYED_2", true, true); $tpl->set("IS_DISPLAYED_3", true, true); $tpl->set("IS_DISPLAYED_4", true, true); $tpl->set("IS_DISPLAYED_5", true, true); $tpl->set("TYPE2_EXCLUSIVE_1", true, true); $tpl->set("TYPE2_EXCLUSIVE_2", true, true); $tpl->set("TYPE2_EXCLUSIVE_3", true, true); $tpl->set("TYPE2_EXCLUSIVE_4", true, true); $tpl->set("TYPE2_EXCLUSIVE_5", true, true); } elseif ($torrentspage || $forumpage || $no_columns == 1) { $tpl->set("HAS_LEFT_COL", false, true); $tpl->set("HAS_RIGHT_COL", false, true); $tpl->set("IS_DISPLAYED_1", true, true); $tpl->set("IS_DISPLAYED_2", true, true); $tpl->set("IS_DISPLAYED_3", true, true); $tpl->set("IS_DISPLAYED_4", true, true); $tpl->set("IS_DISPLAYED_5", true, true); $tpl->set("IS_DISPLAYED_5", true, true); $tpl->set("TYPE3_EXCLUSIVE_1", true, true); $tpl->set("TYPE3_EXCLUSIVE_2", true, true); $tpl->set("TYPE3_EXCLUSIVE_3", true, true); $tpl->set("TYPE3_EXCLUSIVE_4", true, true); $tpl->set("TYPE3_EXCLUSIVE_5", true, true); } else { $tpl->set("HAS_LEFT_COL", false, true); $tpl->set("HAS_RIGHT_COL", false, true); $tpl->set("IS_DISPLAYED_1", false, true); $tpl->set("IS_DISPLAYED_2", false, true); $tpl->set("IS_DISPLAYED_3", false, true); $tpl->set("IS_DISPLAYED_4", false, true); $tpl->set("IS_DISPLAYED_5", false, true); $tpl->set("IS_DISPLAYED_5", false, true); $tpl->set("TYPE4_EXCLUSIVE_1", true, true); $tpl->set("TYPE4_EXCLUSIVE_2", true, true); $tpl->set("TYPE4_EXCLUSIVE_3", true, true); $tpl->set("TYPE4_EXCLUSIVE_4", true, true); $tpl->set("TYPE4_EXCLUSIVE_5", true, true); } echo $tpl->fetch(load_template('main.tpl')); } else { // It's an original style type. Also default to this if there's an unknown value for the $STYLETYPE variable. if ($normalpage && !$no_columns) { echo $tpl->fetch(load_template('main.tpl')); } elseif ($adminpage) { if (file_exists(load_template('main.left_column.tpl'))) { echo $tpl->fetch(load_template('main.left_column.tpl')); } else { echo $tpl->fetch(load_template('main.tpl')); } } elseif ($torrentspage || $forumpage || $no_columns == 1) { if (file_exists(load_template('main.no_columns.tpl'))) { echo $tpl->fetch(load_template('main.no_columns.tpl')); } else { echo $tpl->fetch(load_template('main.tpl')); } } else { if (file_exists(load_template('main.no_header_1_column.tpl'))) { echo $tpl->fetch(load_template('main.no_header_1_column.tpl')); } else { echo $tpl->fetch(load_template('main.tpl')); } } } ob_end_flush(); if ($update) { register_shutdown_function('updatedata'); } }
function print_help() { print_version(); echo <<<END_HELP --version <num> Version the minified bundles with the given number --conf <file> Alternative configuration file --verbose Be verbose or quiet. Default mode set in the configuration file. --quiet --css-only Only minify and bundle CSS or JS rather than the default. --js-only --help This help message -h --license Print the software license. -l -v Print the version number END_HELP; }
/** * @param $amount_stat_columns * @param $print_flag * @param $show_zero_issues * @param $versions */ function print_tablebody($amount_stat_columns, $print_flag, $show_zero_issues, $versions) { $specmanagement_database_api = new specmanagement_database_api(); $specmanagement_print_api = new specmanagement_print_api(); echo '<tbody>'; for ($version_index = 0; $version_index < count($versions); $version_index++) { $version = $versions[$version_index]; $version_spec_bug_ids = $specmanagement_database_api->get_version_spec_bugs($version['version']); if (is_null($version_spec_bug_ids) && !$show_zero_issues) { continue; } $version_deadline = date_is_null($version['date_order']) ? '' : string_attribute(date(config_get('calendar_date_format'), $version['date_order'])); $timeleft = time() - $version['date_order']; $unsolved_bug_duration = null; $add_rel_duration = 0; $status_process = null; $uncertainty_bug_ids = array(); $add_rel_uncertainty_bug_ids = array(); $sum_duration = 0; $uncertainty_status_process = null; $unsolved_bug_finished_date = null; $null_issues_flag = true; if (!is_null($version_spec_bug_ids)) { $unsolveld_bug_ids = get_unsolved_issues($version_spec_bug_ids); $unsolved_bug_duration = $specmanagement_database_api->get_bug_array_duration($unsolveld_bug_ids); $rel_based_data = calculate_rel_based_data($unsolveld_bug_ids); $add_rel_duration = $rel_based_data[0]; $add_rel_uncertainty_bug_ids = $rel_based_data[1]; $sum_duration = $unsolved_bug_duration + $add_rel_duration; $status_process = 100 * round(1 - count($unsolveld_bug_ids) / count($version_spec_bug_ids), 2); $uncertainty_bug_ids = get_uncertainty_issues($unsolveld_bug_ids); $uncertainty_status_process = 100 * round(count($uncertainty_bug_ids) / count($version_spec_bug_ids), 2); $null_issues_flag = false; } $time_delay = calc_time_delay($timeleft, $sum_duration); $specmanagement_print_api->printRow(); print_version($version); print_date($version_deadline, $time_delay[0]); print_issue_amount($amount_stat_columns, $print_flag, $version, $version_spec_bug_ids, $null_issues_flag); print_process($status_process, $null_issues_flag); print_duration($sum_duration, $add_rel_duration, $null_issues_flag); print_uncertainty($uncertainty_bug_ids, $add_rel_uncertainty_bug_ids, $uncertainty_status_process, $null_issues_flag); //print_information( $version, $null_issues_flag, $time_delay[1] ); echo '</tr>'; } echo '</tbody>'; }
die; } elseif ($act == "recover_ok") { $id = intval(0 + $_GET["id"]); $random = intval($_GET["random"]); if (!$id || !$random || empty($random) || $random == 0) { stderr($language["ERROR"], $language["ERR_UPDATE_USER"]); } $res = do_sqlquery("SELECT username, email, random" . ($GLOBALS["FORUMLINK"] == "smf" ? ", smf_fid" : "") . " FROM {$TABLE_PREFIX}users WHERE id = {$id}", true); $arr = mysql_fetch_array($res); if ($random != $arr["random"]) { stderr($language["ERROR"], $language["ERR_UPDATE_USER"]); } $email = $arr["email"]; success_msg($language["SUCCESS"], $language["SUC_SEND_EMAIL"] . " <b>{$email}</b>.\n" . $language["SUC_SEND_EMAIL_2"]); $tpl->set("main_footer", bottom_menu() . "<br />\n"); $tpl->set("btit_version", print_version()); echo $tpl->fetch(load_template("main.tpl")); die; } elseif ($act == "recover") { } $recovertpl = new bTemplate(); global $language, $recovertpl; $recovertpl->set("language", $language); $recover = array(); $recover["action"] = "index.php?page=recover&act=takerecover"; $recovertpl->set("recover", $recover); if ($USE_IMAGECODE) { if (extension_loaded('gd')) { $arr = gd_info(); if ($arr['FreeType Support'] == 1) { $p = new ocr_captcha();
/** * Parses the cli arguments. * * @return Boolean that indicates whether the given arguments are * fine. */ function parse_arguments() { global $argv; if (!isset($argv)) { if (false === (bool) ini_get('register_argc_argv')) { error_log('[ERROR] Please enable register_argc_argv in your php.ini.'); } else { error_log('[ERROR] No $argv array available.'); } echo PHP_EOL; return false; } // Remove the script name (first argument) global $scriptname; $scriptname = array_shift($argv); if (count($argv) === 0) { error_log('[ERROR] Missing argument.'); return false; } // Set the path and remove from command line (last argument) global $path; $path = (string) array_pop($argv); // Parse options $longopts = ["help", "version", "format:", "nodes:", "relationships:"]; $options = getopt("hvf:n:r:", $longopts); if ($options === FALSE) { error_log('[ERROR] Could not parse command line arguments.'); return false; } // Help? if (isset($options['help']) || isset($options['h'])) { print_version(); echo PHP_EOL; print_usage(); echo PHP_EOL; print_help(); exit(0); } // Version? if (isset($options['version']) || isset($options['v'])) { print_version(); exit(0); } // Format? if (isset($options['format']) || isset($options['f'])) { global $format; switch ($options['format'] ?? $options['f']) { case "jexp": $format = CSVExporter::JEXP_FORMAT; break; case "neo4j": $format = CSVExporter::NEO4J_FORMAT; break; default: error_log("[WARNING] Unknown format '{$options['f']}', using neo4j format."); $format = CSVExporter::NEO4J_FORMAT; break; } } // Nodes file? if (isset($options['nodes']) || isset($options['n'])) { global $nodefile; $nodefile = $options['nodes'] ?? $options['n']; } // Relationships file? if (isset($options['relationships']) || isset($options['r'])) { global $relfile; $relfile = $options['relationships'] ?? $options['r']; } return true; }
function stdfoot($normalpage = true, $update = true, $adminpage = false, $torrentspage = false, $forumpage = false) { global $STYLEPATH, $tpl, $no_columns; $tpl->set('to_top', print_top()); $tpl->set('tracker_url', print_trackerurl()); $tpl->set('site_name', print_sitename()); $tpl->set('user_name', print_username()); $tpl->set('main_footer', bottom_menu() . "<br />\n"); $tpl->set('xbtit_version', print_version()); $tpl->set('style_copyright', print_designer()); $tpl->set('xbtit_debug', print_debug()); if ($normalpage && !$no_columns) { echo $tpl->fetch(load_template('main.tpl')); } elseif ($adminpage) { echo $tpl->fetch(load_template('main.left_column.tpl')); } elseif ($torrentspage || $forumpage || $no_columns == 1) { echo $tpl->fetch(load_template('main.no_columns.tpl')); } else { echo $tpl->fetch(load_template('main.no_header_1_column.tpl')); } ob_end_flush(); if ($update) { register_shutdown_function('updatedata'); } }