function testFaqshow() { global $t, $bx; $db_config = new mock_db_configure(1); $d = $this->_generate_records(array('question', 'answer'), 1); $db_config->add_query('fubar', 0); $db_config->add_record($d[0], 0); $db = new DB_SourceAgency(); $db->query('fubar'); $db->next_record(); $bx = $this->_create_default_box(); $this->capture_call('faqshow', 778, array(&$db)); $this->_checkFor_box_full($t->translate('Question') . '</B>: ' . $d[0]['question'], '<b>' . $t->translate('Answer') . '</b>: ' . $d[0]['answer']); $this->_check_db($db_config); }
function testDoco_show() { global $bx; $d = $this->_generate_records(array('page', 'header', 'doco'), 1); $db_config = new mock_db_configure(1); $db_config->add_query('fubar', 0); $db_config->add_record($d[0], 0); $db = new DB_SourceAgency(); $db->query('fubar'); $db->next_record(); $bx = $this->_create_default_box(); $this->capture_call('doco_show', 753, array(&$db)); $this->_checkFor_box_full($d[0]['page'] . ': ' . $d[0]['header'], $d[0]['doco']); $this->_check_db($db_config); }
} else { if (isset($license) && !empty($license)) { // Look if License is already in table $db->query("SELECT * FROM licenses WHERE license='{$license}'"); if ($db->num_rows() > 0) { if (isset($new_license)) { // If license in database and a new name is given, then rename if (!empty($new_license)) { $db->query("SELECT proid,creation FROM developing WHERE " . "license = '{$license}'"); // All the affected projects are treated as modified // BUT they are assigned to the new license!!!! while ($db->next_record()) { $creation = $db->f('creation'); $proid = $db->f('proid'); $db_rename = new DB_SourceAgency(); $db_rename->query("UPDATE developing SET license='{$new_license}'," . "creation='{$creation}' WHERE proid='{$proid}'"); } $affected_projects = $db->num_rows(); $db->query("UPDATE licenses SET license='{$new_license}' WHERE " . "license='{$license}'"); if ($db->affected_rows() == 1) { $bx->box_full($t->translate('Administration'), $t->translate('License') . ' ' . $license . ' ' . $t->translate('has been renamed to') . ' ' . $new_license . ' ' . $t->translate('affecting') . ' $affected_projects ' . $t->translate('projects')); } } else { // License is a blank line $be->box_full($t->translate('Error'), $t->translate('License name not specified')); } } if (isset($new_url)) { // If license in database and a new url is given, then go for it if (!empty($new_url)) { $db->query("UPDATE licenses SET url='{$new_url}' WHERE " . "license='{$license}'");
function testContent_box_footer() { global $bx, $db, $sess; $args = $this->_generate_records(array('proid', 'content_id', 'which_proposals'), 4); $dat = $this->_generate_records(array('content_id'), 4); $dat2 = $this->_generate_records(array('COUNT(*)'), 8); $db_config = new mock_db_configure(8); $q = array(0 => $this->queries['content_box_footer_1'], 1 => $this->queries['content_box_footer_2']); // test one, ensure that both if statements are false $dat[0]['content_id'] = $args[0]['which_proposals']; $dat2[1]['COUNT(*)'] = -1; // test two: ensure that both if statements are true $dat[1]['content_id'] = $args[1]['which_proposals'] . "DONT MATCH"; $dat2[3]['COUNT(*)'] = 10; // test three: first if true, second if false $dat[2]['content_id'] = $args[2]['which_proposals'] . "DONT MATCH"; $dat2[5]['COUNT(*)'] = -1; // test four: first if false, second if true $dat[3]['content_id'] = $args[3]['which_proposals']; $dat2[7]['COUNT(*)'] = 10; // test one $db_config->add_record($dat[0], 0); $db_config->add_query(sprintf($q[0], $args[0]['proid'], $args[0]['content_id']), 1); $db_config->add_query(sprintf($q[1], $args[0]['proid'], $args[0]['content_id']), 1); $db_config->add_record($dat2[0], 1); $db_config->add_record($dat2[1], 1); $db_config->add_query('fubar', 0); // test two $db_config->add_record($dat[1], 2); $db_config->add_query(sprintf($q[0], $args[1]['proid'], $args[1]['content_id']), 3); $db_config->add_query(sprintf($q[1], $args[1]['proid'], $args[1]['content_id']), 3); $db_config->add_record($dat2[2], 3); $db_config->add_record($dat2[3], 3); $db_config->add_query('fubar', 2); // test three $db_config->add_record($dat[2], 4); $db_config->add_query(sprintf($q[0], $args[2]['proid'], $args[2]['content_id']), 5); $db_config->add_query(sprintf($q[1], $args[2]['proid'], $args[2]['content_id']), 5); $db_config->add_record($dat2[4], 5); $db_config->add_record($dat2[5], 5); $db_config->add_query('fubar', 4); // test four $db_config->add_record($dat[3], 6); $db_config->add_query(sprintf($q[0], $args[3]['proid'], $args[3]['content_id']), 7); $db_config->add_query(sprintf($q[1], $args[3]['proid'], $args[3]['content_id']), 7); $db_config->add_record($dat2[6], 7); $db_config->add_record($dat2[7], 7); $db_config->add_query('fubar', 6); // a global db object is required which has 'content_id' as // row value. (content_box_footer is called by show_content which // uses the global database). // test one: both if statements are false $db = new DB_SourceAgency(); $db->query('fubar'); $db->next_record(); $bx = $this->_create_default_box(); $this->capture_call('content_box_footer', 852, $args[0]); $this->_checkFor_content_box_footer($args[0], $dat2[0], $dat2[1], $dat[0]); // test two: both if statements are true $db = new DB_SourceAgency(); $db->query('fubar'); $db->next_record(); $bx = $this->_create_default_box(); $this->capture_call('content_box_footer', 1018, $args[1]); $this->_checkFor_content_box_footer($args[1], $dat2[2], $dat2[3], $dat[1]); // test three: first if true, second if false $db = new DB_SourceAgency(); $db->query('fubar'); $db->next_record(); $bx = $this->_create_default_box(); $this->capture_call('content_box_footer', 925, $args[2]); $this->_checkFor_content_box_footer($args[2], $dat2[4], $dat2[5], $dat[2]); // test four: first if false, second if true $db = new DB_SourceAgency(); $db->query('fubar'); $db->next_record(); $bx = $this->_create_default_box(); $this->capture_call('content_box_footer', 945, $args[3]); $this->_checkFor_content_box_footer($args[3], $dat2[6], $dat2[7], $dat[3]); $this->_check_db($db_config); }
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n"; echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n"; echo "<rss version=\"0.91\">\n"; echo " <channel>\n"; echo " <title>" . $sys_name . "</title>\n"; echo " <link>" . $sys_url . "</link>\n"; echo " <description>" . $sys_name . " - " . $sys_title . "</description>\n"; echo " <language>en-us</language>\n"; echo " <image>\n"; echo " <title>" . $sys_name . "</title>\n"; echo " <url>" . $sys_url . $sys_logo_image . "</url>\n"; echo " <link>" . $sys_url . "</link>\n"; echo " <description>" . $sys_name . " - " . $sys_title . "</description>\n"; echo " <width>66</width>\n"; echo " <height>73</height>\n"; echo " </image>\n"; $db = new DB_SourceAgency(); $db->query("SELECT * FROM description,auth_user WHERE " . "description_user=username AND description.status>'1' " . "ORDER BY description_creation DESC limit 10"); $i = 0; while ($db->next_record()) { echo " <item>\n"; echo " <title>" . $db->f("project_title") . " " . $db->f("type") . "</title>\n"; echo " <link>" . $sys_url . "probyid.php?id=" . $db->f("proid") . "</link>\n"; echo " <description>" . wrap($db->f("description")) . "</description>\n"; echo " </item>\n"; $i++; } echo " </channel>\n"; echo "</rss>\n"; @page_close();
echo $db->Host; ?> </b> <li> Database <b><?php echo $db->Database; ?> </b> <li> User <b><?php echo $db->User; ?> </b> <li> Password <b>??????</b> </ul> </UL> <?php if ($db->query("SELECT * FROM auth_user")) { ?> <li><font color="green">Created a DB_SourceAgency database connection successfully.</font></li> <?php } ?> </ul> <h3>PHPLIB Configuration</h3> <ul> <li>track_vars: <?php echo status($track_vars); ?> </li>
$bx->box_begin(); $bx->box_title($t->translate('Users') . ': ' . $t->translate($type)); $bx->box_body_begin(); $bx->box_columns_begin(5); $bx->box_column('right', '5%', '', '<b>' . $t->translate('No.') . '</b>'); $bx->box_column('center', '25%', '', '<b># ' . $t->translate('Projects') . '</b>'); $bx->box_column('center', '25%', '', '<b>' . $t->translate('Username') . '</b>'); $bx->box_column('center', '25%', '', '<b>' . $t->translate('Realname') . '</b>'); $bx->box_column('center', '25%', '', '<b>' . $t->translate('E-Mail') . '</b>'); $bx->box_next_row_of_columns(); $i = 1; $colors = array(0 => '#FFFFFF', 1 => '#DFDFDF'); while ($db->next_record()) { $bgcolor = $colors[$i % 2]; $db2 = new DB_SourceAgency(); $db2->query("SELECT COUNT(*) FROM description " . "WHERE description_user='******' AND status>'0'"); $db2->next_record(); $num = '[' . sprintf('%03d', $db2->f("COUNT(*)")) . ']'; $bx->box_column('right', '', $bgcolor, $i); $bx->box_column('center', '', $bgcolor, $num); $user = $db->f('username'); $bx->box_column('center', '', $bgcolor, sprintf("<a target=\"_blank\" href=\"" . $g_dev_counter_url . "\">%s</a>", $user, $user)); $bx->box_column('center', '', $bgcolor, $db->f('realname')); $bx->box_column('center', '', $bgcolor, html_link('mailto:' . $db->f('email_usr'), '', ereg_replace('@', ' at ', htmlentities($db->f('email_usr'))))); $bx->box_next_row_of_columns(); $i++; } $bx->box_columns_end(); $bx->box_body_end(); $bx->box_end(); }
// echo (' - ' // .timestr(mktimestamp($db_summary->f('description_creation'))) // ."</b>\n"); // echo '<p>'.$db_summary->f('description'); // echo '<p>type <b>'.$db_summary->f('type').'</b> volume <b>' // .$db_summary->f('volume')."</b>\n<br>"; // echo '<hr>'; // } // $bx->box_body_end(); // $bx->box_end(); $bx->box_column_finish(); $bx->box_column_start('right', '35%', ''); $bx->box_begin(); $bx->box_title($t->translate('Recent Projects')); $bx->box_body_begin(); $db_summary->query("SELECT * FROM description WHERE status > '0' ORDER " . "BY description_creation DESC LIMIT 10"); if ($db_summary->num_rows() > 0) { while ($db_summary->next_record()) { echo '<div class=newsind>• ' . html_link('summary.php', array('proid' => $db_summary->f('proid')), $db_summary->f('project_title')) . '<br>[' . timestr(mktimestamp($db_summary->f('description_creation'))) . ']</div>'; } } $bx->box_body_end(); $bx->box_end(); print "<br>\n"; $bx->box_begin(); $bx->box_title($t->translate('Developing Proposals Wanted')); $bx->box_body_begin(); $db_summary->query("SELECT * FROM description,configure WHERE status = '2'" . " AND description.proid=configure.proid AND " . "other_developing_proposals='Yes' ORDER BY " . "description_creation DESC LIMIT 5"); if ($db_summary->num_rows() > 0) { while ($db_summary->next_record()) { echo '<div class=newsind>• ' . html_link('step2.php', array('proid' => $db_summary->f('proid')), $db_summary->f('project_title')) . '<br>[' . timestr(mktimestamp($db_summary->f('description_creation'))) . ']</div>';