$action2 = "update"; } else { $action2 = "insert"; } $title = "<a href=\"" . htmlentities($sess->self_url() . $sess->add_query(array("action" => $action2, "id" => $db_appid))) . "\"><img src=\"images/recycled.png\" border=0 alt=\"" . $t->translate("Update") . "\"></a>\n"; $bx->box_title($title); break; case "update": $db3 = new DB_SourceWell(); $db3->query("UPDATE software SET modification='{$db2_creation_his}' WHERE appid='{$db_appid}'"); $timestamp = mktimestamp($db2_creation_his); $title = "Modification date is updated to " . timestr($timestamp) . "\n"; $bx->box_title($title); break; case "insert": $db3 = new DB_SourceWell(); $db_user = $db->f("user"); $db_version = $db->f("version"); $db3->query("INSERT history SET appid='{$db_appid}', user_his='{$db_user}', creation_his='{$db_modification}', version_his='{$db_version}'"); // echo "<p>INSERT history SET appid='$db_appid', user_his='$db_user', creation_his='$db_modification', version_his='$db_version'\n"; $timestamp = mktimestamp($db_modification); $title = "History date is updated to " . timestr($timestamp) . "\n"; $bx->box_title($title); break; default: $be->box_full($t->translate("Error"), $t->translate("Invalid action")); break; } $bx->box_end(); $i++; }
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>http:" . $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>http:" . $sys_logo_small_image . "</url>\n"; echo " <link>http:" . $sys_url . "</link>\n"; echo " <description>" . $sys_name . " - " . $sys_title . "</description>\n"; echo " <width>124</width>\n"; echo " <height>32</height>\n"; echo " </image>\n"; $db = new DB_SourceWell(); $db->query("SELECT * FROM software,counter,auth_user WHERE software.appid=counter.appid AND software.user=auth_user.username AND software.status='A' ORDER BY software.modification DESC limit 10"); $i = 0; while ($db->next_record()) { echo " <item>\n"; echo " <title>" . htmlspecialchars($db->f("name")) . " " . $db->f("version") . "</title>\n"; echo " <link>http:" . $sys_url . "appbyid.php?id=" . $db->f("appid") . "</link>\n"; // echo " <description>".wrap($db->f("description"))."</description>\n"; echo " <guid>http:" . $sys_url . "appbyid.php?id=" . $db->f("appid") . "</guid>\n"; echo " </item>\n"; $i++; } echo " </channel>\n"; echo "</rss>\n";
<h3><?php echo $sys_name; ?> Database Connection</h3> <ul> <li>I am now going to try to create a DB_<?php echo $sys_name; ?> database connection.<br>If an error occures, 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 tables and set the defaults? (you've got them in the <i>sql</i> subdirectory) <li>Is your database running? ;-) </ul> <?php $db = new DB_SourceWell(); if ($db->query("SELECT * FROM auth_user")) { ?> <li><b><font color="green">Created a DB_<?php echo $sys_name; ?> database connection successfully.</font></b></li> <?php } ?> </ul> <p>[ <a href="install.php">Go back</a> ] [ <a href="install.php?action=check_session">Next</a> ]
$db->next_record(); $numiter = $db->f("COUNT(*)") / 10; $limit = "{$iter},10"; $db->query("SELECT DISTINCT developer,email FROM software WHERE developer LIKE '{$by}' ORDER BY developer ASC LIMIT {$limit}"); $bx->box_begin(); $bx->box_title($t->translate("Authors")); $bx->box_body_begin(); ?> <table border=0 align=center cellspacing=1 cellpadding=1 width=100%> <?php echo "<tr><td><b>" . $t->translate("No") . ".</b></td><td><b># " . $t->translate("Apps") . "</b></td><td><b>" . $t->translate("Names") . "</b></td><td><b>" . $t->translate("E-Mail") . "</b></td></tr>\n"; $i = 1; while ($db->next_record()) { $developer = addslashes($db->f("developer")); $email = $db->f("email"); $db2 = new DB_SourceWell(); $db2->query("SELECT COUNT(*) FROM software WHERE developer='{$developer}' AND email='{$email}' AND status='A'"); $db2->next_record(); if ($db2->f("COUNT(*)")) { $num = "[" . sprintf("%03d", $db2->f("COUNT(*)")) . "]"; echo "<tr><td>" . sprintf("%d", $i) . "</td>\n"; if (empty($developer)) { echo "<td><a href=\"" . htmlentities($sess->url("appbydev.php") . $sess->add_query(array("developer" => "", "email" => "{$email}"))) . "\">{$num}</a></td>\n"; echo "<td>" . $t->translate("Unknown") . "</td>\n"; } else { echo "<td><a href=\"" . htmlentities($sess->url("appbydev.php") . $sess->add_query(array("developer" => $db->f("developer"), "email" => "{$email}"))) . "\">{$num}</a></td>\n"; echo "<td>" . $db->f("developer") . "</td>\n"; } if (!empty($email)) { echo "<td><<a href=\"mailto:" . mailtoencode($email) . "\">" . ereg_replace("\\.", " dot ", ereg_replace("@", " at ", htmlentities($email))) . "</a>></td>\n"; } else {
require "lib.inc"; 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>" . $config_sys_name . "</title>\n"; echo " <link>" . $config_sys_url . "</link>\n"; echo " <description>" . $config_sys_name . " - " . $config_sys_title . "</description>\n"; echo " <language>en-us</language>\n"; echo " <image>\n"; echo " <title>" . $config_sys_name . "</title>\n"; echo " <url>" . $config_sys_url . $config_sys_logo_image . "</url>\n"; echo " <link>" . $config_sys_url . "</link>\n"; echo " <description>" . $config_sys_name . " - " . $config_sys_title . "</description>\n"; echo " <width>66</width>\n"; echo " <height>73</height>\n"; echo " </image>\n"; $db = new DB_SourceWell(); $db->query("SELECT * FROM software,counter,auth_user WHERE software.appid=counter.appid AND software.user=auth_user.username AND software.status='A' ORDER BY software.modification DESC limit 10"); $i = 0; while ($db->next_record()) { echo " <item>\n"; echo " <title>" . $db->f("name") . " " . $db->f("version") . "</title>\n"; echo " <link>" . $config_sys_url . "app.php?id=" . $db->f("id") . "</link>\n"; echo " <description>" . $db->f("description") . "</description>\n"; echo " </item>\n"; $i++; } echo " </channel>\n"; echo "</rss>\n";
require "./include/header.inc"; $bx = new box("95%", $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); $be = new box("", $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_error_font_color, $th_box_body_align); ?> <!-- content --> <?php echo "<table border=0 align=center cellspacing=0 cellpadding=0 width=\"100%\">\n"; echo "<tr><td width=\"40%\" valign=top>\n"; $bx->box_begin(); $bx->box_title($t->translate("Sections")); $bx->box_body_begin(); $db->query("SELECT DISTINCT section FROM categories"); while ($db->next_record()) { $current_section = $db->f("section"); $db2 = new DB_SourceWell(); $db2->query("SELECT COUNT(*) FROM software WHERE section='{$current_section}' AND status='A'"); $db2->next_record(); $num = "[" . sprintf("%03d", $db2->f("COUNT(*)")) . "]"; echo "{$num} <a href=\"" . htmlentities($sess->url("categories.php") . $sess->add_query(array("section" => $db->f("section")))) . "\">" . $db->f("section") . "<br></a>\n"; } $bx->box_body_end(); $bx->box_end(); ?> </td> <td width="60%" valign=top> <?php if (isset($section)) { $db->query("SELECT category FROM categories WHERE section='{$section}' ORDER BY category ASC");
echo "</td></tr>\n"; echo "<tr><td> </td>\n"; echo "<input type=\"hidden\" name=\"sec_and_cat\" value=\"{$sec_and_cat}\">\n"; echo "<input type=\"hidden\" name=\"del_category\" value=\"too_late\">\n"; echo "<td><input type=\"submit\" value=\"" . $t->translate("Delete") . "\">"; echo "</td></tr>\n"; echo "</form>\n"; echo "</table>\n"; $bx->box_body_end(); $bx->box_end(); } } else { $db->query("SELECT appid,modification FROM software WHERE category = '{$category}' and section='{$section}'"); $affected_apps = $db->num_rows(); // All the affected apps are treated as modified $db2 = new DB_SourceWell(); while ($db->next_record()) { $modification = $db->f("modification"); $appid = $db->f("appid"); $db2->query("UPDATE software SET status='M',modification='{$modification}' WHERE appid='{$appid}'"); } $db->query("DELETE from categories WHERE section='{$section}' AND category='{$category}'"); if ($db->affected_rows() == 1) { $bx->box_full($t->translate("Administration"), $t->translate("Deletion succesfully completed affecting") . " {$affected_apps} " . $t->translate("applications")); } } } if (!isset($del_category) && !isset($new_category)) { // It's already in our database // but no rename and no deletion... ->error $be->box_full($t->translate("Error"), $t->translate("Category") . " {$section}/{$category} " . $t->translate("already exists!"));
} 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 appid,modification FROM software WHERE license = '{$license}'"); // All the affected apps are treated as modified // BUT they are assigned to the new license!!!! $affected_apps = $db->num_rows(); while ($db->next_record()) { $modification = $db->f("modification"); $appid = $db->f("appid"); $db_rename = new DB_SourceWell(); $db_rename->query("UPDATE software SET status='M',license='{$new_license}',modification='{$modification}' WHERE appid='{$appid}'"); } $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_apps} " . $t->translate("applications")); } } 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}'");
if (isset($auth) && !empty($auth->auth["perm"])) { page_close(); page_open(array("sess" => "SourceWell_Session", "auth" => "SourceWell_Auth", "perm" => "SourceWell_Perm")); } require "./include/header.inc"; $bx = new box("", $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); $be = new box("", $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_error_font_color, $th_box_body_align); ?> <!-- content --> <?php ### ### Submit Handler ### ## Get a database connection $db = new DB_SourceWell(); // Check if there was a submission $reg = 0; while (is_array($HTTP_POST_VARS) && (list($key, $val) = each($HTTP_POST_VARS))) { switch ($key) { case "register": // Register a new user $username = trim($username); $password = trim($password); $cpassword = trim($cpassword); $realname = trim($realname); list($email_usr, $rest) = split("\n", $email_usr, 2); $email_usr = trim($email_usr); if (empty($username) || empty($password) || empty($cpassword) || empty($email_usr)) { // Do we have all necessary data? $be->box_full($t->translate("Error"), $t->translate("Please enter") . " <b>" . $t->translate("Username") . "</b>, <b>" . $t->translate("Password") . "</b> " . $t->translate("and") . " <b>" . $t->translate("E-Mail") . "</b>!");
# the Free Software Foundation; either version 2 or later of the GPL. ###################################################################### require "./include/prepend.php3"; page_open(array("sess" => "SourceWell_Session")); // Disabling cache header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 require "./include/config.inc"; require "./include/lib.inc"; require "./include/translation.inc"; require "./include/lang.inc"; require "./include/box.inc"; $t = new translation($la); $db = new DB_SourceWell(); $bx = new box("95%", $th_box_frame_color, 0, $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); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="expires" content="0"> <meta http-equiv="Refresh" content="1200; URL=<?php echo $sys_url . "sitebar.php"; ?> "> <title><?php echo $sys_name; ?> - <?php
// We need to know the total number of users $query = "SELECT {$columns} FROM {$tables} WHERE {$where}"; $db->query($query); $db->next_record(); $numiter = $db->f("COUNT(*)") / 10; $limit = "{$iter},10"; $db->query("SELECT DISTINCT * FROM licenses WHERE license LIKE '{$by}' ORDER BY license ASC LIMIT {$limit}"); $bx->box_begin(); $bx->box_title($t->translate("Licenses")); $bx->box_body_begin(); $i = 1; echo "<table border=0 align=center cellspacing=1 cellpadding=1 width=\"100%\">\n"; echo "<tr><td><b>" . $t->translate("No") . ".</b></td><td><b># " . $t->translate("Apps") . "</b></td><td><b>" . $t->translate("License") . "</b></td></tr>\n"; while ($db->next_record()) { $license = $db->f("license"); $db2 = new DB_SourceWell(); $db2->query("SELECT COUNT(*) FROM software WHERE license='{$license}' AND status='A'"); $db2->next_record(); $num = "[" . sprintf("%03d", $db2->f("COUNT(*)")) . "]"; echo "<tr><td>{$i}</td><td><a href=\"" . htmlentities($sess->url("appbylic.php") . $sess->add_query(array("license" => $license))) . "\">{$num}</a></td><td><a href=\"" . $db->f("url") . "\" target=\"_blank\">" . $license . "</a></td></tr>\n"; $i++; } echo "</table>\n"; $bx->box_body_end(); $bx->box_end(); if ($numiter > 1) { $url = "licenses.php"; $urlquery = array("by" => "{$by}", "find" => "{$find}"); show_more($iter, $numiter, $url, $urlquery); } ?>
echo "<tr><td> </td>\n"; echo "<input type=\"hidden\" name=\"section\" value=\"{$section}\">\n"; echo "<input type=\"hidden\" name=\"del_section\" value=\"too_late\">\n"; echo "<td><input type=\"submit\" value=\"" . $t->translate("Delete") . "\">"; echo "</td></tr>\n"; echo "</form>\n"; echo "</table>\n"; $bx->box_body_end(); $bx->box_end(); } else { // Ok, let's go for it and delete! $db->query("SELECT name,modification FROM software WHERE section='{$section}'"); // All the affected apps are treated as deleted while ($db->next_record()) { $modification = $db->f("modification"); $db2 = new DB_SourceWell(); $db2->query("UPDATE software SET status='M',modification='{$modification}' WHERE section='{$section}'"); } $db->query("DELETE from categories WHERE section='{$section}'"); if ($db->affected_rows() > 0) { $bx->box_full($t->translate("Administration"), $t->translate("Deletion succesfully completed.")); } } } if (!isset($del_section) && !isset($new_section)) { // It's already in our database, but the user wants to admin // it. We don't mind ;-) It's like inserting only a category inssec("no"); } } else { // If section is not in table, insert it
# This is the text backend of the system # # 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" => "SourceWell_Session")); if (isset($auth) && !empty($auth->auth["perm"])) { page_close(); page_open(array("sess" => "SourceWell_Session", "auth" => "SourceWell_Auth", "perm" => "SourceWell_Perm")); } header("Content-Type: text/plain"); // Disabling cache header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 require "./include/config.inc"; require "./include/lib.inc"; $db = new DB_SourceWell(); $db->query("SELECT * FROM software,counter,auth_user WHERE software.appid=counter.appid AND software.user=auth_user.username AND software.status='A' ORDER BY software.modification DESC limit 10"); $i = 0; while ($db->next_record()) { echo $db->f("name") . " " . $db->f("version") . "\n"; $timestamp = mktimestamp($db->f("modification")); echo timestr($timestamp) . "\n"; echo $sys_url . "appbyid.php?id=" . $db->f("appid") . "\n"; $i++; } @page_close();
} } stats_end(); break; // Licenses by Email from Developer // Licenses by Email from Developer case "email_license": stats_title($t->translate("Applications listed by Licenses and Developer's Email Domain")); $url = "0"; // No URL in function stats_display $urlquery = "0"; // No URL query in function stats_display $db->query("SELECT license FROM licenses"); while ($db->next_record()) { // We need a second database connection $db2 = new DB_SourceWell(); // Total number of apps with that License $license = $db->f("license"); $db2->query("SELECT COUNT(*) FROM software WHERE license='{$license}'"); $db2->next_record(); $total = $db2->f("COUNT(*)"); if ($total > $Minimum_apps_in_license) { stats_subtitle($db->f("license")); for ($i = 1; $i < sizeof($domain_country); $i++) { $like = "%." . $domain_country[$i][0]; $db2->query("SELECT COUNT(*) FROM software WHERE license='{$license}' AND email LIKE '{$like}'"); $db2->next_record(); $num = $db2->f("COUNT(*)"); if (100 * $num / $total > $MinimumLicByEmail) { stats_display($domain_country[$i][1], $num, $url, $urlquery, $total); }