function mn_status() { echo '<div class="wrap"><h2>MoIP Status</h2>'; if (isset($_POST['mn_submit'])) { update_option('mn_moip_login', $_POST['mn_moip_login']); update_option('mn_moip_pass', $_POST['mn_moip_pass']); show_status(); } ?> <p>O MoIPStatus é uma ferramenta que permite a consulta de saldo e a lista das dez últimas transações sem a necessidade de efetuar login no MoIP</p> <?php if (!get_option('mn_moip_login') or !get_option('mn_moip_pass')) { ?> <p>Você precisa configurar a sua conta no MoIP antes de usar este plugin:</p> <form action="" method="post"> <?php credentials_table(); ?> <div class="submit"> <input type="submit" name="mn_submit" id="mn_submit" value="<?php _e('Verificar Status »'); ?> " /> </div> </form> <?php } else { ?> <a href="#" onclick="jQuery('#tbl_credentials').show(); jQuery(this).hide(); return false;" />Alterar login/senha</a> <form action="" method="post"> <div id="tbl_credentials" style="display:none"> <?php credentials_table(); ?> </div> <div class="submit"> <input type="submit" name="mn_submit" id="mn_submit" value="<?php _e('Verificar Status »'); ?> " /> </div> </form> <?php } echo '</div>'; }
function testShow_consultants() { global $db, $t, $bx; $db_config = new mock_db_configure(2); $db_q = array(0 => "SELECT * FROM consultants,auth_user WHERE " . "proid='%s' AND username=consultant ORDER " . "BY creation"); $dat = $this->_generate_records(array("proid"), 2); $rows = $this->_generate_records(array("username", "status", "creation"), 3); $db_config->add_query(sprintf($db_q[0], $dat[0]["proid"]), 0); $db_config->add_query(sprintf($db_q[0], $dat[1]["proid"]), 1); $db_config->add_num_row(0, 0); $db_config->add_num_row(3, 1); $db_config->add_record($rows[0], 1); $db_config->add_record($rows[1], 1); $db_config->add_record($rows[2], 1); // first test: no data to list, print error message $db = new DB_SourceAgency(); $bx = new box(); $this->set_msg("test 1"); $this->capture_call('show_consultants', 64, &$dat[0]); $this->_testFor_pattern("No developers have offered " . "themselves as consultants yet"); // second test: three pieces of data $db = new DB_SourceAgency(); $bx = $this->_create_default_box(); $this->set_msg('test 2'); $this->capture_call('show_consultants', 3573, &$dat[1]); $this->_checkFor_a_box('Consultants'); $this->_checkFor_columns(4); $this->_checkFor_column_titles(array("Number", "Username", "Status", "Creation"), '', '', ''); $colors = array(1 => 'gold', 0 => '#FFFFFF'); for ($idx = 1; $idx < 4; $idx++) { $row = $rows[$idx - 1]; $this->set_msg("Test {$idx}"); $this->_testFor_box_next_row_of_columns(); $this->_checkFor_column_values(array('<b>' . $idx . '</b>', '<b>' . lib_nick($row['username']), '<b>' . show_status($row["status"]) . '</b>', '<b>' . timestr(mktimestamp($row["creation"])) . '</b>'), '', '', $colors[$idx % 2]); } $this->_check_db($db_config); }
<?php $status = isset($_GET["status"]); page_header($status ? lang('Status') : lang('Variables')); $variables = $status ? show_status() : show_variables(); if (!$variables) { echo "<p class='message'>" . lang('No rows.') . "\n"; } else { echo "<table cellspacing='0'>\n"; foreach ($variables as $key => $val) { echo "<tr>"; echo "<th><code class='jush-" . $jush . ($status ? "status" : "set") . "'>" . h($key) . "</code>"; echo "<td>" . nbsp($val); } echo "</table>\n"; }
case "BUILDING": show_status($ci_status, "images/build.png", "green"); break; case "DEPLOYING": show_status($ci_status, "images/deploy.png", "orange"); break; case "FUNCTEST_PREP": show_status($ci_status, "images/test.png", "red"); break; case "FUNCTEST_TEMPEST": show_status($ci_status, "images/test.png", "red"); break; case "FUNCTEST_RALLY": show_status($ci_status, "images/test.png", "red"); break; case "FUNCTEST_ODL": show_status($ci_status, "images/test.png", "red"); break; case "FUNCTEST_VPING": show_status($ci_status, "images/test.png", "red"); break; case "CLEANING": show_status($ci_status, "images/clean.png", "blue"); break; } echo "</pre>"; ?> </p> </body> </html>
$gid = $_REQUEST['gid']; $uid = $_REQUEST['uid']; mysql_query("INSERT INTO usergroup (uid, gid) VALUES " . "('" . mysql_real_escape_string($uid) . "', '" . mysql_real_escape_string($gid) . "')") or die('Error adding user to group: ' . mysql_error()); show_status('Added user ' . $uid . " to group " . $gid); break; case 'delfromgrp': $gid = $_REQUEST['gid']; $uid = $_REQUEST['uid']; mysql_query("DELETE FROM usergroup WHERE gid='" . mysql_real_escape_string($gid) . "' AND " . "uid='" . mysql_real_escape_string($uid) . "'") or die('Error deleting group associations: ' . mysql_error()); show_status('Removed user ' . $uid . " from group " . $gid); break; case 'login': # Used to require login break; default: show_status('Invalid Command'); break; } } echo "<div id='users'>"; echo "<h2>Change Password:</h2>"; echo "<table>"; echo "<form action='{$_SERVER['PHP_SELF']}' METHOD='post'>\n"; echo "<tr><th>User:</th><td>"; if ($admin) { get_name_options(); } else { echo $user; echo "<input type='hidden' value='" . $user . "'/>"; } echo "</td></tr>";
echo format_date($_obj['publish_time']); ?> </td> <td><div admin_type="text" admin_para="m=update&table=item&column=status&id=<?php echo $_obj['item_id']; ?> " admin_select_value="<?php echo $_obj['status']; ?> " admin_select_source_id="status_select" admin_trigger="click" ><?php echo show_status($_obj['status']); ?> </div></td> <td> <a href="admin.php?p=item&action=edit_item&item_id=<?php echo $_obj['item_id']; ?> "> 编辑</a> <a href="javascript:;" onclick="if (confirm(' 确定要删除吗?')) delete_item(<?php echo $_obj['item_id']; ?> ,this);"> 删除</a> <?php if ($_obj['status'] == "0") { ?> <?php
function _checkFor_show_proposals($proid, &$row, $count_star_1, $count_star_2) { global $t, $sess; $strings = array('><b>' . $t->translate('Developing Proposal') . '</b><', '<b>' . lib_nick($row['username']) . ' - ' . timestr(mktimestamp($row['creation'])) . "</b>\n"); foreach ($strings as $str) { $this->_testFor_pattern($this->_to_regexp($str)); } $tv = array('Cost' => $row['cost'] . " euros", 'License' => $row['license'], 'Status' => show_status($row['status']), 'Valid' => timestr_middle(mktimestamp($row['valid'])), 'Start' => timestr_middle(mktimestamp($row['start'])), 'Duration' => $row['duration'] . " weeks"); while (list($key, $val) = each($tv)) { $str = sprintf("<b>%s:</b> %s\n", $t->translate($key), $val); $this->_testFor_pattern("[<]..?[>]" . $this->_to_regexp($str)); } /** check for a cooperation link or not .... **/ $str1 = html_link('cooperation.php3', array('proid' => $proid, 'devid' => $row['devid']), 'Cooperation') . ' [' . $count_star_1 . ']'; $str2 = 'Cooperation [' . $count_star_1 . ']'; if ($row['cooperation'] != 'No') { if ($count_star_1) { $this->_testFor_pattern($this->_to_regexp($str1)); $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($str2)); } else { $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($str1)); $this->_testFor_pattern($this->_to_regexp($str2)); } } else { $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($str1)); $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($str2)); } /** check for a comments link **/ $str1 = html_link('comments.php3', array('proid' => $proid, 'type' => 'proposals', 'number' => $row['devid']), 'Comments') . ' [' . $count_star_2 . "]\n"; $str2 = 'Comments [0]'; if ($count_star_2 > 0) { $this->_testFor_pattern($this->_to_regexp($str1)); $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($str2)); } else { $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($str1)); $this->_testFor_pattern($this->_to_regexp($str2)); } $str = "<FONT SIZE=-1>[ <a href=\"" . $sess->url("comments_edit.php3") . $sess->add_query(array("proid" => $proid, "type" => "proposal", "number" => $row["devid"])) . "\">Comment This Proposal</a> ]</FONT><p>\n"; $this->_testFor_pattern($this->_to_regexp($str)); }
if (defined('SAE_ACCESSKEY')) { header('Location: sae.php'); exit; } elseif (getenv('OPENSHIFT_APP_NAME')) { $extra_script = '<script type="text/javascript">if(confirm("要使用 OpenShift 一键安装向导吗?")) location.href="openshift.php";</script>'; } $content = '<p>欢迎使用 贴吧签到助手 安装向导!</p><p>本程序将会指引你在服务器上配置好“贴吧签到助手”</p><p>点击右侧的“下一步”按钮开始</p><p class="btns"><button onclick="location.href=\'./?step=check\';">下一步 »</button>'; show_install_page('Welcome', $content); break; case 'check': $content = '<p>安装前,程序需要检查当前的服务器环境是否允许运行“贴吧签到助手”</p><p>请确保表格中每一行均为绿色,以避免可能带来的问题</p><table><thead><tr><td>项目</td><td>要求</td><td>当前状态</td></tr></thead><tbody>'; $content .= '<tr><td>PHP 版本</td><td><span class="status on">5.2</span></td><td><span class="status ' . (version_compare('5.2.0', PHP_VERSION, '<') ? 'on' : 'off') . '">' . PHP_VERSION . '</span></td></tr>'; $content .= '<tr><td>PHP: allow_url_fopen</td><td>' . show_status(true) . '</td><td>' . show_status(ini_get('allow_url_fopen')) . '</td></tr>'; $content .= '<tr><td>CURL</td><td>' . show_status(true) . '</td><td>' . show_status(function_exists('curl_init')) . '</td></tr>'; $content .= '<tr><td>Socket 连接</td><td>' . show_status(true) . '</td><td>' . show_status(function_exists('fsockopen') || function_exists('pfsockopen')) . '</td></tr>'; $content .= '<tr><td>system/config.inc.php</td><td>' . show_status(true, '可写') . '</td><td>' . show_status(is_writable($config_file), '可写', '不可写') . '</td></tr>'; $content .= '</tbody></table>'; if (function_exists('curl_init') && (function_exists('fsockopen') || function_exists('pfsockopen')) && is_writable($config_file)) { $content .= '<br><p class="btns"><button onclick="location.href=\'./?step=database\';">下一步 »</button></p>'; } show_install_page('服务器兼容性检查', $content); break; case 'database': $content = '<div class="config"><p>请填写数据库连接信息</p><br>'; $content .= '<form action="./?step=install" method="post" onsubmit="show_waiting();">'; $content .= '<p><span>数据库服务器:</span><input type="text" name="db_server" value="localhost" /></p>'; $content .= '<p><span>数据库端口:</span><input type="text" name="db_port" value="3306" /></p>'; $content .= '<p><span>数据库用户名:</span><input type="text" name="db_username" value="root" /></p>'; $content .= '<p><span>数据库密码:</span><input type="password" name="db_password" /></p>'; $content .= '<p><span>数据库名:</span><input type="text" name="db_name" value="kk_sign" /></p>'; if (function_exists('mysql_pconnect')) {
function CheckHash($Dictionary = array(), $HashAlgo, $Hash, $LogFile = false) { if ($LogFile) { LogToFile(Log_Start($Hash), $LogFile); } foreach ($Dictionary as $Value) { if ($LogFile) { LogToFile(Log_Dictionary($Value), $LogFile); } $Count = 0; $NrPasswords = 0; print_r("\n-----------------------------------------------------------------------------\n\t\tUsing {$Value} as dictionary\n-----------------------------------------------------------------------------\r\n"); $NrPasswords = CountLines($Value); $Count = 1; $Dict = fopen($Value, "rb"); while (!feof($Dict)) { $Password = fgets($Dict); $Password = str_replace(array("\r", "\n"), '', $Password); if (($Result = hash($HashAlgo, $Password)) === $Hash) { show_status($NrPasswords, $NrPasswords); // Finish the progressbar if ($LogFile) { LogToFile(Log_End("[+] MATCH FOUND! for " . $Hash . " -> " . $Password), $LogFile); } return array($Result, $Password); } show_status($Count, $NrPasswords); // Show a progress bar for each password -> dictionary is empty. $Count++; } fclose($Dict); } return false; }
if ($mem['char_role'] == '9223372036854775807' && $mem['char_id'] != $G_site_admin) { if ($mem['sec_site_admin']) { $siterole = ' <a href="./?module=data&part=users&a=remove&id=' . $mem['char_id'] . '">Remove Access</a>'; } else { $siterole = ' <a href="./?module=data&part=users&a=give&id=' . $mem['char_id'] . '">Give Access</a>'; } } elseif ($mem['char_role'] == '9223372036854775807' && $mem['char_id'] == $G_site_admin) { $siterole = ' Main'; } else { $siterole = ' No Access'; } $wrt .= '<tr class="hilite">'; $wrt .= '<td>' . $mem['char_name'] . '</td>'; $wrt .= '<td>' . show_status('yn', $verified) . '</td>'; $wrt .= '<td>' . show_status('yn', $gpwd) . '</td>'; $wrt .= '<td>' . show_status('yn', $adm) . '' . $siterole . '</td>'; $wrt .= ''; $wrt .= ''; $wrt .= ''; $wrt .= '</td>'; } $wrt .= ''; $wrt .= ''; $wrt .= ''; $wrt .= '</table>'; $wrt .= ' <script type="text/javascript"> $(document).ready(function(){ $(\'.hilite\').hover(function(){ $(this).children().addClass(\'datahighlight\'); },function(){
$putsk .= "\t\tInterval: " . intval($skunit['Interval'][$key]) . "\n"; } if (isset($skunit['Target'][$key]) && $skunit['Target'][$key] != "noone") { $putsk .= "\t\tTarget: \"" . trim(ucfirst($skunit['Target'][$key])) . "\"\n"; } if (isset($skunit['Flag'][$key]) && $skunit['Flag'][$key] != "") { $putsk .= "\t\tFlag: " . getunitflag($skunit['Flag'][$key], $id) . "\n"; } $putsk .= "\t}\n"; } // close skill $putsk .= "},\n"; // Display progress bar show_status($i++, $linecount); } show_status($linecount, $linecount); /** * Print final messages and exit the script, conversion has completed. */ print "\n"; print "The skill database has been [1;32msuccessfully[0m converted to Hercules' libconfig\n"; print "format and has been saved as '" . DIRPATH . "skill_db.conf'.\n"; print "The following files are now deprecated and can be deleted -\n"; print DIRPATH . "skill_db.txt\n"; print DIRPATH . "skill_cast_db.txt\n"; print DIRPATH . "skill_castnodex_db.txt\n"; print DIRPATH . "skill_require_db.txt\n"; print DIRPATH . "skill_unit_db.txt\n"; $putsk .= ")"; $skconf = "skill_db.conf"; file_put_contents(DIRPATH . $skconf, $putsk);
<!doctype html> <html> <head> <title>wpa_cli_php demo</title> </head> <body> <?php include "wpa_cli.php"; $wpa_cli = new wpa_cli(); while (true) { if ($wpa_cli->scan() === true) { show_status($wpa_cli); show_results($wpa_cli); break; } else { sleep(0.5); } } function show_status($wpa_cli) { $status = $wpa_cli->status(); echo <<<EOF <h2>status()</h2> <table> <thead> <tr> <th>key</th> <th>value</th> </tr> </thead> <tbody>
function testShow_sponsorings() { global $db, $auth, $bx, $t; $func_name = 'show_sponsorings'; $auth->set_uname("this is the username"); $auth->set_perm("this is the permission"); $db_config = new mock_db_configure(9); $db_q = array(0 => "SELECT * FROM sponsoring,auth_user WHERE " . "proid='%s' AND sponsor=username ORDER " . "BY sponsoring.creation ASC", 1 => "SELECT * FROM sponsoring WHERE proid='%s' " . "AND status='A' AND sponsor='%s'"); $db_d = $this->_generate_records(array("proid"), 4); $rows = $this->_generate_records(array("creation", "username", "budget", "status", "valid", "begin", "finish", "spoid", "sponsoring_text"), 3); // first call initialisations $db_config->add_query(sprintf($db_q[0], $db_d[0]["proid"]), 0); $db_config->add_record(false, 0); $db_config->add_num_row(0, 0); // second call configurations $db_config->add_query(sprintf($db_q[0], $db_d[1]["proid"]), 1); $rows[0]["status"] = "D"; // status is deleted $db_config->add_record($rows[0], 1); $db_config->add_record(false, 1); $db_config->add_num_row(1, 1); // instance two of the database is the one used for doing // the lib_show_comments_on_it on the second call which is already // tested so there is no need to test it here, therefore configure // its database to ignore all errors. $db_config->ignore_all_errors(2); // third call configuration, here is_accepted_sponsor is called and // returns true $db_config->add_query(sprintf($db_q[0], $db_d[2]["proid"]), 3); $rows[1]["status"] = "P"; $db_config->add_record($rows[1], 3); $db_config->add_record(false, 3); $db_config->add_num_row(1, 3); $db_config->add_query(sprintf($db_q[1], $db_d[2]["proid"], $auth->auth["uname"]), 4); $db_config->add_num_row(1, 4); // is_accepted_sponsor returns true // instance for the lib_show_comments_on_it call $db_config->ignore_all_errors(5); // fourth call configuration, is_accepted_sponsor returns false $db_config->add_query(sprintf($db_q[0], $db_d[3]["proid"]), 6); $rows[2]["status"] = "P"; $db_config->add_record($rows[2], 6); $db_config->add_record(false, 6); $db_config->add_num_row(1, 6); $db_config->add_query(sprintf($db_q[1], $db_d[3]["proid"], $auth->auth["uname"]), 7); $db_config->add_num_row(0, 7); // is_accepted_sponsor returns true // instance for the lib_show_comments_on_it call $db_config->ignore_all_errors(8); // first call, no records $bx = $this->_create_default_box(); $db = new DB_SourceAgency(); $this->capture_call($func_name, 84, $db_d[0]); $this->set_msg('test 1'); $this->_testFor_pattern("<p>There have not been posted any" . " sponsoring involvement wishes " . "to this project.<p>"); // second call, one record but don't do is_accepted_sponsor call // i.e. status is not 'P' $bx = $this->_create_default_box(); $db = new DB_SourceAgency(); $this->capture_call($func_name, 1090, $db_d[1]); $this->set_msg('test 2'); $this->_checkFor_a_box('Sponsor Involvement'); $this->_testFor_lib_nick($rows[0]['username']); $v = array('Status' => show_status($rows[0]['status']), 'Validity' => timestr_middle(mktimestamp($rows[0]['valid'])), 'Finish before' => timestr_middle(mktimestamp($rows[0]['finish'])), 'Begin wished' => timestr_middle(mktimestamp($rows[0]['begin'])), 'Max. sum of money' => $rows[0]['budget'] . " euros", 'Comments to the involvement' => $rows[0]['sponsoring_text']); while (list($key, $val) = each($v)) { $this->_testFor_pattern($this->_to_regexp('<b>' . $t->translate($key) . ':</b> ' . $val)); } $this->_testFor_lib_comment_it($db_d[1]["proid"], 'Sponsoring', $rows[0]['spoid'], '0', 'Comment on Sponsor Involvement #' . $rows[0]['spoid'], $t->translate('Comment it!')); // third call, is_accepted_sponsor returns true after being called $bx = $this->_create_default_box(); $db = new DB_SourceAgency(); $this->capture_call($func_name, 1426, $db_d[2]); $this->set_msg('test 3'); $this->_checkFor_a_box('Sponsor Involvement'); $this->_testFor_lib_nick($rows[1]['username']); $v = array('Status' => show_status($rows[1]['status']), 'Validity' => timestr_middle(mktimestamp($rows[1]['valid'])), 'Finish before' => timestr_middle(mktimestamp($rows[1]['finish'])), 'Begin wished' => timestr_middle(mktimestamp($rows[1]['begin'])), 'Max. sum of money' => $rows[1]['budget'] . " euros", 'Comments to the involvement' => $rows[1]['sponsoring_text']); while (list($key, $val) = each($v)) { $this->_testFor_pattern($this->_to_regexp('<b>' . $t->translate($key) . ':</b> ' . $val)); } $ps = array(0 => "<b><a href=\"sponsoring_accepted.php3[?]proid=" . "proid_2&sponsor=username_1\" class=\"\">" . $t->translate("Accept this sponsor involvement") . "<\\/a>"); $this->_testFor_patterns($ps, 1); $this->_testFor_lib_comment_it($db_d[2]["proid"], 'Sponsoring', $rows[1]['spoid'], '0', 'Comment on Sponsor Involvement #' . $rows[1]['spoid'], $t->translate('Comment it!')); // fourth call, is_accepted_sponsor is called and returns false $bx = $this->_create_default_box(); $db = new DB_SourceAgency(); $this->capture_call($func_name, 1125, $db_d[3]); $this->set_msg('test 4'); $this->_checkFor_a_box('Sponsor Involvement'); $this->_testFor_lib_nick($rows[2]['username']); $v = array('Status' => show_status($rows[2]['status']), 'Validity' => timestr_middle(mktimestamp($rows[2]['valid'])), 'Finish before' => timestr_middle(mktimestamp($rows[2]['finish'])), 'Begin wished' => timestr_middle(mktimestamp($rows[2]['begin'])), 'Max. sum of money' => $rows[2]['budget'] . " euros", 'Comments to the involvement' => $rows[2]['sponsoring_text']); while (list($key, $val) = each($v)) { $this->_testFor_pattern($this->_to_regexp('<b>' . $t->translate($key) . ':</b> ' . $val)); } $this->_testFor_lib_comment_it($db_d[3]["proid"], 'Sponsoring', $rows[2]['spoid'], '0', 'Comment on Sponsor Involvement #' . $rows[2]['spoid'], $t->translate('Comment it!')); // finally check that everything went smoothly with the DB $this->_check_db($db_config); }
while ($row = mysqli_fetch_assoc($result)) { ?> <tr> <td><strong><?php echo $row['name']; ?> </strong><br /> <small><?php echo $row['url']; ?> </small></td> <td><?php echo show_fetch_type($row['fetch_type']); ?> </td> <td><?php echo show_status($row['status']); ?> </td> <td><?php echo $row['last_fetch_date'] != NULL ? relative_time(strtotime($row['last_fetch_date'])) : 'Mai'; ?> </td> <td><strong><?php echo show_last_result($row['last_fetch_result'], $row['last_fetch_increment']); ?> </strong></td> </tr> <?php } mysqli_free_result($result); ?>
} load_txt_strings(); // Setup the information // The keys on these entries need to match // what is in the $txt keys/brackets above // Makes for easy adding of extra info, or deleting $context['smfinfo'] = array('db_last_error' => !empty($db_last_error) ? date(DATE_RFC822, $db_last_error) : $txt['none'], 'auto_fix_db' => get_smf_setting('autoFixDatabase', 'on'), 'db_persist' => get_smf_setting('db_persist', 'off'), 'db_debug' => get_smf_setting('db_show_debug', 'off'), 'enable_error' => get_smf_setting('enableErrorLogging', 'on'), 'database_sessions' => get_smf_setting('databaseSession_enable'), 'database_loose' => get_smf_setting('databaseSession_loose'), 'session_timeout' => !empty($modSettings['databaseSession_lifetime']) ? $modSettings['databaseSession_lifetime'] . ' ' . $txt['seconds'] : '<i>' . $txt['empty'] . '</i> <strong>(' . $txt['recommended'] . ': >300)</strong>', 'maintenance_mode' => get_smf_setting('maintenance'), 'time_load' => get_smf_setting('timeLoadPageEnable'), 'hostname_lookup' => get_smf_setting('disableHostnameLookup'), 'cache' => (!empty($modSettings['cache_enable']) ? $txt['cache_level'] . ' ' . $modSettings['cache_enable'] : $txt['off']) . ($modSettings['cache_enable'] != '1' ? ' <strong>(' . $txt['recommended'] . ': ' . $txt['cache_level'] . ' 1)</strong>' : ''), 'memcached_settings' => isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '' ? trim($modSettings['cache_memcached']) : '<i>' . $txt['empty'] . '</i>', 'cookie_name' => !empty($cookiename) ? $cookiename : '<i>' . $txt['empty'] . '</i> <strong>(' . $txt['recommended'] . ': SMFCookie' . rand(100, 999) . ')</strong>', 'local_cookies' => get_smf_setting('localCookies', 'off'), 'global_cookies' => get_smf_setting('globalCookies'), 'log_pruning' => get_smf_setting('pruningOptions', 'on'), 'sef_urls' => get_smf_setting('queryless_urls'), 'compressed_output' => get_smf_setting('enableCompressedOutput')); $context['phpinfo'] = array('safe_mode' => get_php_setting('safe_mode', 'off'), 'open_base' => ($ob = ini_get('open_basedir')) ? $ob : $txt['none'], 'display_errors' => get_php_setting('display_errors', 'off'), 'file_uploads' => get_php_setting('file_uploads', 'on'), 'magic_quotes' => get_php_setting('magic_quotes_gpc', 'off'), 'register_globals' => get_php_setting('register_globals', 'off'), 'output_buffering' => get_php_setting('output_handler'), 'session_save' => ($path = ini_get('session.save_path')) ? $path : $txt['none'], 'session_auto' => (int) ini_get('session.auto_start'), 'xml_enabled' => extension_loaded('xml') ? $txt['on'] : $txt['off'], 'zlib_enabled' => extension_loaded('zlib') ? $txt['on'] : $txt['off']); show_header(); show_system_info(); show_php_info(); show_detailed_file(); show_detailed_db(); show_mods(); show_error_log(); show_status(); show_footer(); function show_header() { global $txt, $smfInfo, $context, $smfinfo_version; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" /> <title>', $txt['title'], '</title> <style type="text/css"> body { background-color: #E5E5E8; margin: 0px;
function testShow_status() { $this->assertEquals("Proposed", show_status('P')); $this->assertEquals("Negotiating", show_status('N')); $this->assertEquals("Accepted", show_status('A')); $this->assertEquals("Rejected", show_status('R')); $this->assertEquals("Deleted", show_status('D')); $this->assertEquals("Modified", show_status('M')); $this->assertEquals("Proposed", show_status('')); $this->assertEquals("Proposed", show_status('asdasd')); $this->assertEquals("Proposed", show_status('m')); }
$wrt .= '<td class="tcell' . $odder . '">' . show_status('yn', 'yes') . '</td>'; $i++; } else { $wrt .= '<td class="tcell' . $odder . '">' . show_status('yn', 'no') . '</td>'; } if (file_exists($root . '/' . $module . '/handler/index.php')) { $wrt .= '<td class="tcell' . $odder . '">' . show_status('yn', 'yes') . '</td>'; $i++; } else { $wrt .= '<td class="tcell' . $odder . '">' . show_status('yn', 'no') . '</td>'; } if (file_exists($root . '/' . $module . '/public/index.php')) { $wrt .= '<td class="tcell' . $odder . '">' . show_status('yn', 'yes') . '</td>'; $i++; } else { $wrt .= '<td class="tcell' . $odder . '">' . show_status('yn', 'no') . '</td>'; } global $mnm, $mdescr, $mreq, $mid; if ($i == $mreq) { $mod_row = good_query_assoc("SELECT * FROM modules WHERE module_id = {$mid}"); if ($mod_row) { $wrt .= '<td class="tcell' . $odder . ' font_s">installed</td>'; } else { $wrt .= '<td class="tcell' . $odder . ' font_s">Install</td>'; } } else { $wrt .= '<td class="tcell' . $odder . ' font_s">Broken</td>'; } $wrt .= '<tr><td class="tcell' . $odder . ' border_bottom font_s"> </td><td class="tcell' . $odder . ' border_bottom font_s">' . $mnm . '</td><td colspan="4" class="tcell' . $odder . ' border_bottom font_s">' . $mdescr . '</td></tr>'; } }
function testShow_selected_developing() { global $t, $bx, $db; $db_config = new mock_db_configure(101); $args = $this->_generate_records(array('proid'), 101); $q = "SELECT * FROM developing,auth_user WHERE proid='%s' AND " . "developer=username AND developing.status='A'"; // tests 1-100: not exactly one record ... for ($idx = 0; $idx < 100; $idx++) { if ($idx == 51) { $db = new DB_SourceAgency(); continue; } $db_config->add_query(sprintf($q, $args[$idx]['proid']), $idx); $db_config->add_num_row($idx - 50, $idx); $db = new DB_SourceAgency(); $this->capture_call('show_selected_developing', 121, $args[$idx]); $this->assertEquals("<b><font color=red>The number of accepted " . "developing proposals is not correct. SEe " . "show_selected_developing()</font></b>\n", $this->get_text()); } // test 101: exactly one record $d = $this->_generate_records(array('creation', 'username', 'cost', 'license', 'cooperation', 'status', 'valid', 'start', 'duration'), 10); $db_config->add_query(sprintf($q, $args[100]['proid']), 100); $db_config->add_num_row(1, 100); $db_config->add_record($d[0], 100); $db = new DB_SourceAgency(); $bx = $this->_create_default_box(); $this->capture_call('show_selected_developing', 922 + strlen(timestr(mktimestamp($d[0]['creation']))), $args[100]); $this->_checkFor_a_box('Developing Proposal'); $this->_testFor_lib_nick($d[0]['username']); $str = ' - ' . timestr(mktimestamp($d[0]['creation'])) . "</b>"; $this->_testFor_pattern($this->_to_regexp($str)); $v = array('Cost' => $d[0]['cost'] . " euros", 'License' => $d[0]['license'], 'Cooperation' => $d[0]['cooperation'], 'Status' => show_status($d[0]["status"]), 'Validity' => timestr_middle(mktimestamp($d[0]["valid"])), 'Start possible' => timestr_middle(mktimestamp($d[0]["start"])), 'Duration' => $d[0]["duration"] . " weeks"); while (list($key, $val) = each($v)) { $str = sprintf('<b>%s:</b> %s\\n', $t->translate($key), $val); $this->_testFor_pattern('[<]..?[>]' . $this->_to_regexp($str)); } $this->_check_db($db_config); }
function testPersonal_cooperation() { global $bx; $user1 = "fubar"; $status1 = "D"; $user2 = "snafu"; $status2 = "A"; $user3 = "fritz"; $status3 = "R"; $db_config = new mock_db_configure(3); $db_q = "SELECT * FROM cooperation,description,developing " . "WHERE cooperation.developer='%s' AND " . "cooperation.status='%s' AND " . "cooperation.devid = developing.devid AND " . "developing.proid=description.proid"; $db_config->add_query(sprintf($db_q, $user1, $status1), 0); $db_config->add_query(sprintf($db_q, $user2, $status2), 1); $db_config->add_query(sprintf($db_q, $user3, $status3), 2); $db_config->add_num_row(0, 0); $db_config->add_num_row(1, 1); $db_config->add_num_row(2, 2); $cols = array('devid', 'proid', 'project_title'); // this is for the snafu query $row1 = $this->_generate_array($cols, 1); $db_config->add_record($row1, 1); $db_config->add_record(false, 1); // this is for teh fritz query $row2 = $this->_generate_array($cols, 2); $db_config->add_record($row2, 2); $row3 = $this->_generate_array($cols, 3); $db_config->add_record($row3, 2); $db_config->add_record(false, 2); // test one $bx = $this->_create_default_box(); capture_reset_and_start(); // here next_record will not be called personal_cooperation($user1, $status1); $this->set_text(capture_stop_and_get()); $this->set_msg('test 1'); $this->_testFor_string_length(740); // check title string $this->_testFor_pattern("Developing Cooperation [(]" . show_status($status1) . "[)]"); $this->_testFor_pattern("No developing cooperation proposal " . "with this status\n"); // test two $bx = $this->_create_default_box(); capture_reset_and_start(); personal_cooperation($user2, $status2); $this->set_text(capture_stop_and_get()); $this->set_msg('test 2'); $this->_testFor_string_length(879); // check the title string $this->_testFor_pattern("Developing Cooperation [(]" . show_status($status2) . "[)]"); $this->_testFor_cooperation_project_link($row1['proid'], $row1['project_title'], $row1['devid']); // fritz query $bx = $this->_create_default_box(); capture_reset_and_start(); personal_cooperation($user3, $status3); $this->set_text(capture_stop_and_get()); $this->set_msg('test 3'); $this->_testFor_string_length(1069); // check the title string $this->_testFor_pattern("Developing Cooperation [(]" . show_status($status3) . "[)]"); $this->_testFor_cooperation_project_link($row2['proid'], $row2['project_title'], $row2['devid']); $this->_testFor_cooperation_project_link($row3['proid'], $row3['project_title'], $row3['devid']); // if using a database, then ensure that it didn't fail $this->_check_db($db_config); }
function show_daemon_status($host, $pidname, $progname, $disabled) { $running = daemon_status($host, $pidname, $progname, $disabled); show_status($host, $progname, $running); }
function start_mission() { global $id; global $uid; global $PHP_SELF; global $imperium; global $pid; $sth = mysql_query("select sum(population) from planets where uid={$uid}"); if (!$sth) { show_error("Database error!"); return 0; } $pop = mysql_fetch_row($sth); $spies = floor($pop[0] / 1000); $sth = mysql_query("select sum(count) from covertops where uid={$uid}"); if (!$sth) { show_error("Database failure!"); return 0; } $count = mysql_fetch_row($sth); if ($count[0] == NULL) { $count[0] = 0; } if ($count[0] == 0 and $spies == 0) { show_message("You don't have enough population to do any covertops!"); return 0; } $sth = mysql_query("select * from covertopsmissions as c , research as r where c.techdepend=r.t_id and r.uid={$uid} and c.id={$id}"); if (!$sth) { show_error("Database error!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("bbbblllllllllllll"); return 0; } $covertops = mysql_fetch_array($sth); if ($spies - $count[0] < $covertops["count"]) { show_message("You don't have enough free spies!"); return 0; } $sth = mysql_query("select c.id from covertopsmissions as c,ressources as r where c.metal<=r.metal and c.energy<=r.energy and c.mopgas<=r.mopgas and c.erkunum<=r.erkunum and c.gortium<=r.gortium and c.susebloom<=r.susebloom and r.uid={$uid} and c.id={$id}"); if (!$sth) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth) == 0) { show_error("You don't have enough ressources to start this mission!"); show_status(); return 0; } if ($imperium != "") { //$sth=mysql_query("select id from users where imperium='".addslashes($imperium)."' and id!=$uid"); $sth = mysql_query("select id from users where imperium='" . $imperium . "' and id!={$uid}"); if (!$sth) { show_error("Database error!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("Hund! 1"); return 0; } if ($covertops["targettype"] == "P" && $pid == "") { $sth = mysql_query("select id from users where imperium='{$imperium}'"); if (!$sth) { show_error("Database failure13!"); return 0; } $uid_target = mysql_fetch_array($sth); $sth = mysql_query("select id,name from planets where uid=" . $uid_target["id"] . " order by name"); if (!$sth) { show_error("Database failure!12"); return 0; } while ($planets = mysql_fetch_array($sth)) { if ($planets["name"] == "Unnamed") { $planets["name"] = get_planetname($planets["id"]); } $select[$planets["name"]] = $planets["id"]; } echo "<form action=\"" . $PHP_SELF . "\" method=post>"; table_start("center", "500"); table_head_text(array("Mission: " . $covertops["descr"]), "2"); table_text(array(" "), "", "", "2", "center", "head"); table_text_open("text", "center"); table_text_design("<img src='arts/idnummer.jpg' width='75' height='50' alt='" . $covertops["descr"] . "'>", "75"); table_text_design($covertops["descr"], "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Target empire", "75"); table_text_design($imperium, "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Time", "75"); table_text_design($covertops["time"], "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Special Info", "75"); table_text_design("dummy", "425"); table_text_close(); table_form_select("Select the targetplanet", "pid", $select, "2", "text", "text"); table_form_submit("Start", "start_mission", "2", "text"); table_end(); form_hidden("imperium", $imperium); form_hidden("id", $id); echo "</form>"; table_end(); } elseif ($covertops["targettype"] == "P") { $sth = mysql_query("select id from planets where id={$pid} and uid!={$uid} and uid!=0"); if (!$sth) { show_error("Database failure!1"); return 0; } if (mysql_num_rows($sth) == 0) { show_error("Hund! 2"); return 0; } proc_start_mission($covertops["id"], $uid, $pid); show_status(); } else { $sth = mysql_query("select id from users where id!={$uid} and imperium='{$imperium}'"); if (!$sth) { show_error("Database failure1!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("Du Klobrillenvergewaltiger!"); return 0; } $target_uid = mysql_fetch_array($sth); proc_start_mission($covertops["id"], $uid, $target_uid["id"]); show_status(); } } else { $sth = mysql_query("select imperium from users where id!={$uid} order by imperium"); if (!$sth) { show_error("Database failure!"); return 0; } while ($imperiums = mysql_fetch_array($sth)) { $select[$imperiums["imperium"]] = $imperiums["imperium"]; } echo "<form action=\"" . $PHP_SELF . "\" method=post>"; table_start("center", "500"); table_head_text(array("Mission: " . $covertops["descr"]), "2"); table_text(array(" "), "", "", "2", "head"); table_text_open("text", "center"); table_text_design("<img src='arts/o" . $covertops["id"] . ".jpg' width='75' height='50' alt='" . $covertops["descr"] . "'>", "75"); table_text_design($covertops["descr"], "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Time", "75"); table_text_design($covertops["time"], "425", "head"); table_text_close(); table_text_open("text", "center"); table_text_design("Special Info", "75"); table_text_design("dummy", "425", "head"); table_text_close(); table_form_select("Select the target empire", "imperium", $select, "", "text", "text"); table_form_submit("Start", "start_mission", "2", "text"); table_end(); form_hidden("id", $id); echo "</form>"; } }
function testShow_referees() { global $t, $bx, $db; $db_config = new mock_db_configure(2); $pid1 = "this sit he proid"; $pid2 = "this sit he proid two"; $q = $this->queries['show_referees']; $db_config->add_query(sprintf($q, $pid1), 0); $db_config->add_num_row(0, 0); $db_config->add_num_row(0, 0); $db_config->add_query(sprintf($q, $pid2), 1); $dat = $this->_generate_records(array('username', 'status', 'creation'), 5); $db_config->add_num_row(count($dat), 1); $db_config->add_num_row(count($dat), 1); for ($idx = 0; $idx < count($dat); $idx++) { $db_config->add_record($dat[$idx], 1); } // test one, no record/data $bx = $this->_create_default_box(); $db = new DB_SourceAgency(); capture_reset_and_start(); show_referees($pid1); $this->set_text(capture_stop_and_get()); $this->push_msg("Test One"); $this->_testFor_string_length(72); $msg = $t->translate("There are no developers that have " . "offered themselves as referees"); $this->_testFor_pattern($this->_to_regexp($msg)); $this->pop_msg(); // test two, data is defined $bx = $this->_create_default_box(); $db = new DB_SourceAgency(); capture_reset_and_start(); show_referees($pid2); $this->set_text(capture_stop_and_get()); $this->push_msg("Test Two"); $this->_testFor_string_length(4940); $msg = $t->translate("There are no developers that have " . "offered themselves as referees"); $this->reverse_next_test(); $this->_testFor_pattern($this->_to_regexp($msg)); $this->_checkFor_a_box('Referees'); $this->_checkFor_columns(4); $this->_checkFor_column_titles(array('Number', 'Username', 'Status', 'Creation'), '', '', ''); $colors = array(0 => '#FFFFFF', 1 => 'gold'); for ($idx = 0; $idx < count($dat); $idx++) { $v = array("<b>" . ($idx + 1) . "</b>", '<b>' . lib_nick($dat[$idx]['username']) . '</b>', '<b>' . show_status($dat[$idx]['status']) . '</b>', '<b>' . timestr(mktimestamp($dat[$idx]['creation'])) . '</b>'); $this->push_msg("Test {$idx}"); $this->_checkFor_column_values($v, '', '', $colors[$idx % 2]); $this->pop_msg(); } $this->pop_msg(); $this->_check_db($db_config); }
function testCooperation_show() { global $t, $bx, $db, $sess; $qs = array(0 => "SELECT * FROM cooperation,auth_user WHERE devid='%s'" . " AND developer=username ORDER BY creation DESC", 1 => "SELECT * FROM comments,auth_user WHERE proid='%s' " . "AND type='%s' AND number='%s' AND ref='%s' AND " . "user_cmt=username ORDER BY creation_cmt ASC"); $db_config = new mock_db_configure(3); $args = $this->_generate_records(array('proid', 'devid'), 10); $dat = $this->_generate_records(array('creation', 'cost', 'status', 'developer'), 20); // test one $db_config->add_query(sprintf($qs[0], $args[0]['devid']), 0); $db_config->add_num_row(0, 0); // test two $db_config->add_query(sprintf($qs[0], $args[1]['devid']), 1); $db_config->add_num_row(1, 1); $db_config->add_record($dat[0], 1); $db_config->add_record(false, 1); $db_config->add_query(sprintf($qs[1], $args[1]['proid'], 'Cooperation', $dat[0]['creation'], '0'), 2); $db_config->add_num_row(0, 2); // test one: no records $db = new DB_SourceAgency(); $bx = $this->_create_default_box(); $this->capture_call('cooperation_show', 77, $args[0]); $this->assertEquals("<p>There have not been posted any cooperation " . "proposals by any developer.<p>\n", $this->get_text()); // test two: one row of data $db = new DB_SourceAgency(); $bx = $this->_create_default_box(); $this->capture_call('cooperation_show', 916, $args[1]); $this->_checkFor_a_box('Cooperation'); $this->_testFor_lib_nick($dat[0]['developer']); $str = ' - ' . timestr(mktimestamp($dat[0]['creation'])) . "</b>"; $this->_testFor_pattern($this->_to_regexp($str)); $str = '<p><b>Cost</b>: ' . $dat[0]['cost'] . " euro\n"; $this->_testFor_pattern($this->_to_regexp($str)); $str = '<br><b>Status</b>: ' . show_status($dat[0]['status']) . "\n"; $this->_testFor_pattern($this->_to_regexp($str)); $this->_testFor_lib_comment_it($args[1]['proid'], 'Cooperation', $dat[0]['creation'], 0, '', $t->translate('Comment This Cooperation!')); $this->_check_db($db_config); }
// Moved on XL screen to panel side include $config['html_dir'] . "/includes/status-donuts.inc.php"; echo '</div>' . PHP_EOL; break; case "cable-map": include $config['html_dir'] . "/includes/cable-map.inc.php"; break; case "map": //include($config['html_dir']."/includes/map.inc.php"); show_map($config); break; case "device_status_boxes": show_status_boxes($config); break; case "device_status": show_status($config); break; case "alert_status": include "includes/alert-status.inc.php"; break; case "overall_traffic": show_traffic($config); break; case "custom_traffic": show_customtraffic($config); break; case "alert_table": print_alert_table(array('status' => 'failed', 'pagination' => FALSE, 'short' => TRUE, 'header' => array('title' => 'Current Alerts', 'url' => '/alerts/'))); break; case "splitlog": show_splitlog($config);
//array of arrays foreach ($aValue as $a2Value) { $aTmpLength = strlen($a2Value); $arrayLength[$index] = $aTmpLength > $arrayLength[$index] ? $aTmpLength : $arrayLength[$index]; } } else { $aTmpLength = strlen($aValue); $arrayLength[$index] = $aTmpLength > $arrayLength[$index] ? $aTmpLength : $arrayLength[$index]; } } } } } //show progress bar if ($showProgress) { show_status($rowCount, $countLines); //comment this out to remove status } //option to truncate for testing $rowCount++; if ($maxRows === $rowCount) { break; } } //output $arrayLabel = ""; if ($headerCols) { $labelHeader = "\tLabel"; } if ($hasArrays) { $arrayHeader = "\tArray";