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); }
$be->box_full($t->translate('Error'), $t->translate('Access denied')); } 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)) {
function testShow_proposals() { global $db, $qs; $fname = 'show_proposals'; $qs = array(0 => $this->queries[$fname . '_1'], 1 => $this->queries[$fname . '_2'], 2 => $this->queries[$fname . '_3']); $db_config = new mock_db_configure(20); $args = $this->_generate_records(array('proid', 'content_id'), 10); $d1 = $this->_generate_records(array('content_id'), 10); $d2 = $this->_generate_records(array('creation', 'username', 'cost', 'license', 'status', 'cooperation', 'devid', 'valid', 'start', 'duration'), 10); $inst_nr = 0; // test one, no records $db_config->add_record($d1[0], 0); $db_config->add_query(sprintf($qs[0], $args[0]['proid'], $d1[0]['content_id']), 1); $db_config->add_record(false, 1); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 0, $args[0]); $inst_nr = 2; // test two: one record, cooperation == No, COUNT(*) == 0 $d2[0]['cooperation'] = 'No'; $inst_nr = $this->_config_db_show_proposals($db_config, $inst_nr, $args[1], $d1[1], $d2[0], -1, 0); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 1108, $args[1]); $this->_checkFor_show_proposals($args[1]['proid'], $d2[0], -1, 0); // test three: one record, cooperation == Yes, both COUNT(*) == 0 $d2[1]['cooperation'] = 'Yes'; $inst_nr = $this->_config_db_show_proposals($db_config, $inst_nr, $args[2], $d1[2], $d2[1], 0, 0); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 1274, $args[2]); $this->_checkFor_show_proposals($args[2]['proid'], $d2[1], 0, 0); // test four: one record, cooperation == No, COUNT(*) == 1 $d2[2]['cooperation'] = 'No'; $inst_nr = $this->_config_db_show_proposals($db_config, $inst_nr, $args[3], $d1[3], $d2[2], -1, 1); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 1224, $args[3]); $this->_checkFor_show_proposals($args[3]['proid'], $d2[2], -1, 1); // test five: one record, cooperation == Yes, both COUNT(*) == 1 $d2[3]['cooperation'] = 'Yes'; $inst_nr = $this->_config_db_show_proposals($db_config, $inst_nr, $args[4], $d1[4], $d2[3], 1, 1); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 1424, $args[4]); $this->_checkFor_show_proposals($args[4]['proid'], $d2[3], 1, 1); // test six: one record, cooperation == Yes ... $d2[4]['cooperation'] = 'Yes'; $inst_nr = $this->_config_db_show_proposals($db_config, $inst_nr, $args[5], $d1[5], $d2[4], 0, 1); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 1356, $args[5]); $this->_checkFor_show_proposals($args[5]['proid'], $d2[4], 0, 1); // test seven: one record, cooperation == Yes ... $d2[5]['cooperation'] = 'Yes'; $inst_nr = $this->_config_db_show_proposals($db_config, $inst_nr, $args[6], $d1[6], $d2[5], 1, 0); $db = new DB_SourceAgency(); $db->next_record(); $this->capture_call($fname, 1342, $args[6]); $this->_checkFor_show_proposals($args[6]['proid'], $d2[5], 1, 0); $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();
<li>PostgreSQL Support: <?php status($pgsql); ?> </li> </ul> <h3>SourceAgency Database Connection</h3> <ul> <li>I am now going to try to create a DB_SourceAgency database connection. If this line is the last thing that you see then you should look at these points and fix them before proceeding: <UL> <LI>Have you introduced the correct database parameters (<I>Host</I>, <I>Database</I> name, <I>User</I> name and <I>Password</I>) in the include/local.inc file? <LI>Have you created the database structures in the database? (you have got them in the <I>sql</I> subdirectory) <LI>Is your database running? ;-) <?php $db = new DB_SourceAgency(); ?> <li>Database configuration: <ul> <li> Host <b><?php echo $db->Host; ?> </b> <li> Database <b><?php echo $db->Database; ?> </b> <li> User <b><?php echo $db->User; ?> </b>
$db->query("SELECT * FROM auth_user WHERE {$where} ORDER BY username ASC"); $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();
# This is the index file, i.e. the front page of the SourceAgency portal. # # This program is free software. You can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 or later of the GPL. ###################################################################### require "include/prepend.php3"; page_open(array('sess' => 'SourceAgency_Session')); if (isset($auth) && !empty($auth->auth['perm'])) { page_close(); page_open(array('sess' => 'SourceAgency_Session', 'auth' => 'SourceAgency_Auth', 'perm' => 'SourceAgency_Perm')); } require 'include/header.inc'; $bx = new box('100%', $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align); start_content(); $db_summary = new DB_SourceAgency(); $bx->box_begin(); $bx->box_body_begin(); $bx->box_columns_begin(2, 'top'); $bx->box_column_start('left', '65%', ''); $bx->box_begin(); $bx->box_title($t->translate('SourceAgency')); $bx->box_body_begin(); $db->query("SELECT * FROM doco WHERE page='index' AND language='{$la}'"); if ($db->num_rows() == 0) { /* grab the english doco */ $db->query("SELECT * FROM doco WHERE page='index' AND language='English'"); } $db->next_record(); echo $db->f('doco'); $bx->box_body_end();