Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites
View Statistics - Next Notice - Previous NoticeDirectory filter : [ all ] / postnuke_modules / PostContact / admin_functions [ view in CVS ]
Date | Directory [filter] | File(s) [view] | Author [filter] |
06 Aug 2002 19:54:16 | postnuke_modules/PostContact/admin_functions | add_city.php,1.2,1.3 add_country.php,1.2,1.3 add_department.php,1.2,1.3 add_locationtype.php,1.2,1.3 add_title.php,1.2,1.3 companyinfo.php,1.2,1.3 newcontact.php,1.2,1.3 | Richard Cave |
ADODB conversion. |
Update of /home/cvsroot/postnuke_modules/PostContact/admin_functions In directory ns7.hostnuke.net:/tmp/cvs-serv17540/PostContact/admin_functions Modified Files: add_city.php add_country.php add_department.php add_locationtype.php add_title.php companyinfo.php newcontact.php Log Message: ADODB conversion. Index: add_city.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/PostContact/admin_functions/add_city.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** add_city.php 23 Jul 2002 11:55:15 -0000 1.2 --- add_city.php 6 Aug 2002 19:54:13 -0000 1.3 *************** *** 1,89 **** <? // $Id$ $Name$ if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['city_table']; ! $column = &$pntable['city']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._CICITYS."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['addcity'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['cid'].",".$column['name'].") VALUES ('','0','".$GLOBALS['addcity']."')"; ! mysql_query($query); ! echo mysql_error(); ! } ! $deleteThisCity = $GLOBALS['DeleteCity']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThisCityID = $deleteThisCity[$i]; ! $result = mysql_query("DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThisCityID'"); ! echo mysql_error(); ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $cityID = mysql_result($result, $i, $column['id']); ! $cityName = mysql_result($result, $i, $column['id']); ! if($GLOBALS['Editcity_'.$cityID] != $cityName){ ! if(strlen($GLOBALS['Editcity_'.$cityID]) > 0){ ! mysql_query("UPDATE ".$table." SET ".$column['name']."='".$GLOBALS['Editcity_'.$cityID]."' WHERE ".$column['id']."='$cityID'"); ! echo mysql_error(); ! } ! } ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! echo mysql_error(); ! if($num > 0){ ! echo "<table> ! <tr> ! <td>"._CICITY."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! for ($i = 0 ;$i < $num; $i++){ ! $cityName = mysql_result($result, $i, $column['name']); ! $cityID = mysql_result($result, $i, $column['id']); ! echo"<tr> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$cityName."\" name=\"Editcity_".$cityID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteCity[]\" value=\"".$cityID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } ! echo "</td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDNEWCITY.": </font></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addcity\"></td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittcity\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); ! ?> \ No newline at end of file --- 1,130 ---- <? // $Id$ $Name$ + // ---------------------------------------------------------------------- + // POST-NUKE Content Management System + // Copyright (C) 2002 by the PostNuke Development Team. + // http://www.postnuke.com/ + // ---------------------------------------------------------------------- + // LICENSE + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License (GPL) + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WIthOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // To read the license please visit http://www.gnu.org/copyleft/gpl.html + // ---------------------------------------------------------------------- + // Original Author of file: Bjarne Var�ystrand and Bjarne Var�ystrand + // Modifications by: Richard Cave + // Purpose of file: Administration - add a city to the database + // ---------------------------------------------------------------------- + if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['city_table']; ! $column = &$pntable['city']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._CICITYS."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['addcity'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['cid'].",".$column['name'].") VALUES ('','".$GLOBALS['companyCountry']."','".$GLOBALS['addcity']."')"; ! $resultIns = $dbconn->Execute( $query ); ! if ( $resultIns == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $deleteThisCity = $GLOBALS['DeleteCity']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThisCityID = $deleteThisCity[$i]; ! $query = "DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThisCityID'"; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! for (; !$result->EOF; $result->MoveNext() ) { ! $cityID = $result->fields[0]; ! $cityName = $result->fields[1]; ! if($GLOBALS['Editcity_'.$cityID] != $cityName){ ! if(strlen($GLOBALS['Editcity_'.$cityID]) > 0){ ! $query = "UPDATE ".$table." SET ".$column['name']."='".$GLOBALS['Editcity_'.$cityID]."' WHERE ".$column['id']."='$cityID'"; ! $resultUpd = $dbconn->Execute( $query ); ! if ( $resultUpd == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! } ! } // for (; !$result->EOF; $result->MoveNext() ) ! ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! if ( !$result->EOF ) { ! echo "<table> ! <tr> ! <td>"._CICITY."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! ! for (; !$result->EOF; $result->MoveNext() ) { ! $cityID = $result->fields[0]; ! $cityName = $result->fields[1]; ! echo"<tr> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$cityName."\" name=\"Editcity_".$cityID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteCity[]\" value=\"".$cityID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } // if ( !$result->EOF ) ! ! echo "</td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDNEWCITY.": </font></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addcity\"></td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittcity\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); ! ?> Index: add_country.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/PostContact/admin_functions/add_country.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** add_country.php 23 Jul 2002 11:55:19 -0000 1.2 --- add_country.php 6 Aug 2002 19:54:13 -0000 1.3 *************** *** 1,88 **** <? // $Id$ $Name$ if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['country_table']; ! $column = &$pntable['country']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"3\">"; ! if($GLOBALS['addCountry'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['lang'].",".$column['name'].") VALUES ('','".$GLOBALS['addcountryLang']."','".$GLOBALS['addCountry']."')"; ! mysql_query($query); ! echo mysql_error(); ! } ! $deleteThisCity = $GLOBALS['DeleteCountry']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThiscountryID = $deleteThisCity[$i]; ! $result = mysql_query("DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThiscountryID'"); ! echo mysql_error(); ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $countryID = mysql_result($result, $i, $column['id']); ! $countryName = mysql_result($result, $i, $column['name']); ! if($GLOBALS['EditCountry_'.$countryID] != $countryName){ ! if(strlen($GLOBALS['EditCountry_'.$countryID]) > 0){ ! mysql_query("UPDATE ".$table." SET ".$column['lang']."='".$GLOBALS['EditCountryLang_'.$countryID]."',".$column['name']."='".$GLOBALS['EditCountry_'.$countryID]."' WHERE ".$column['id']."='$countryID'"); ! echo mysql_error(); ! } ! } ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! echo mysql_error(); ! if($num > 0){ ! echo "<table> ! <tr> ! <td>"._CICOUNTRY."</td> ! <td>"._CICOUNTRYLANG."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! for ($i = 0 ;$i < $num; $i++){ ! $countryName = mysql_result($result, $i, $column['name']); ! $countryID = mysql_result($result, $i, $column['id']); ! $countryLang = mysql_result($result, $i, $column['lang']); ! echo"<tr> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$countryName."\" name=\"EditCountry_".$countryID."\"></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$countryLang."\" name=\"EditCountryLang_".$countryID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteCountry[]\" value=\"".$countryID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } ! echo "</td> ! </tr><tr> ! <td colspan=\"3\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDNEWCOUNTRY.": </font></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addCountry\"></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addcountryLang\"></td> ! </tr><tr> ! <td colspan=\"3\"><hr></td> ! </tr><tr> ! <td colspan=\"3\" align=\"right\"><input type=\"submit\" name=\"comittcountry\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); --- 1,130 ---- <? // $Id$ $Name$ + // ---------------------------------------------------------------------- + // POST-NUKE Content Management System + // Copyright (C) 2002 by the PostNuke Development Team. + // http://www.postnuke.com/ + // ---------------------------------------------------------------------- + // LICENSE + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License (GPL) + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WIthOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // To read the license please visit http://www.gnu.org/copyleft/gpl.html + // ---------------------------------------------------------------------- + // Original Author of file: Bjarne Var�ystrand and Bjarne Var�ystrand + // Modifications by: Richard Cave + // Purpose of file: Administration - add a country to the database + // ---------------------------------------------------------------------- + if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['country_table']; ! $column = &$pntable['country']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"3\">"; ! if($GLOBALS['addCountry'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['lang'].",".$column['name'].") VALUES ('','".$GLOBALS['addcountryLang']."','".$GLOBALS['addCountry']."')"; ! $resultIns = $dbconn->Execute( $query ); ! if ( $resultIns == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $deleteThisCity = $GLOBALS['DeleteCountry']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThiscountryID = $deleteThisCity[$i]; ! $query = "DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThiscountryID'"; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! for (; !$result->EOF; $result->MoveNext() ) { ! $countryID = $result->fields[0]; ! $countryName = $result->fields[1]; ! if($GLOBALS['EditCountry_'.$countryID] != $countryName){ ! if(strlen($GLOBALS['EditCountry_'.$countryID]) > 0){ ! $query = "UPDATE ".$table." SET ".$column['lang']."='".$GLOBALS['EditCountryLang_'.$countryID]."',".$column['name']."='".$GLOBALS['EditCountry_'.$countryID]."' WHERE ".$column['id']."='$countryID'"; ! $resultUpd = $dbconn->Execute( $query ); ! if ( $resultUpd == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! } ! } // for (; !$result->EOF; $result->MoveNext() ) { ! $query = "SELECT ".$column['id'].", ".$column['name'].", ".$column['lang']. ! " FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! if ( !$result->EOF ) { ! echo "<table> ! <tr> ! <td>"._CICOUNTRY."</td> ! <td>"._CICOUNTRYLANG."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! ! for (; !$result->EOF; $result->MoveNext() ) { ! $countryID = $result->fields[0]; ! $countryName = $result->fields[1]; ! $countryLang = $result->fields[2]; ! ! echo"<tr> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$countryName."\" name=\"EditCountry_".$countryID."\"></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$countryLang."\" name=\"EditCountryLang_".$countryID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteCountry[]\" value=\"".$countryID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } // if ( !$result->EOF ) ! ! echo "</td> ! </tr><tr> ! <td colspan=\"3\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDNEWCOUNTRY.": </font></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addCountry\"></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addcountryLang\"></td> ! </tr><tr> ! <td colspan=\"3\"><hr></td> ! </tr><tr> ! <td colspan=\"3\" align=\"right\"><input type=\"submit\" name=\"comittcountry\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); Index: add_department.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/PostContact/admin_functions/add_department.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** add_department.php 23 Jul 2002 11:55:23 -0000 1.2 --- add_department.php 6 Aug 2002 19:54:13 -0000 1.3 *************** *** 1,129 **** <? // $Id$ $Name$ if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['departments_table']; ! $column = &$pntable['departments']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._CIDEPARTMENTS."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['AddName'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['email'].",".$column['name'].",".$column['phone'].",".$column['fax'].",".$column['cid'].",".$column['hide'].") VALUES ('','".$GLOBALS['AddEmail']."','".$GLOBALS['AddName']."','".$GLOBALS['AddPhone']."','".$GLOBALS['AddFax']."','".$GLOBALS['AddCountry']."','".$GLOBALS['AddHiddenDepartment']."')"; ! mysql_query($query); ! echo mysql_error(); ! } ! $deleteThisCity = $GLOBALS['DeleteDepartment']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThistypeID = $deleteThisCity[$i]; ! $result = mysql_query("DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThistypeID'"); ! echo mysql_error(); ! } ! $result = mysql_query("SELECT * FROM ".$table." order by departmentName"); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $departmentID = mysql_result($result, $i, $column['id']); ! $eName = $GLOBALS['EditName_'.$departmentID]; ! $eEmail = $GLOBALS['EditEmail_'.$departmentID]; ! $ePhone = $GLOBALS['EditPhone_'.$departmentID]; ! $eFax = $GLOBALS['EditFax_'.$departmentID]; ! $eCountry = $GLOBALS['EditCountry_'.$departmentID]; ! $eHiddenDepartment = $GLOBALS['HiddenDepartment_'.$departmentID]; ! if(strlen($eName) > 0){ ! mysql_query("UPDATE ".$table." SET ".$column['name']."='$eName',".$column['email']."='$eEmail',".$column['phone']."='$ePhone',".$column['fax']."='$eFax',".$column['cid']."='$eCountry',".$column['hide']."='$eHiddenDepartment' WHERE ".$column['id']."='$departmentID'"); ! } ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! echo mysql_error(); ! if($num > 0){ ! echo "<table> ! <tr> ! <td nowrap>"._CINAME."</td> ! <td nowrap>"._CIEMAIL."</td> ! <td nowrap>"._CIPHONE."</td> ! <td nowrap>"._CIFAX."</td> ! <td nowrap>"._CILANGUAGE."</td> ! <td nowrap>"._CIHIDDEN."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! for ($i = 0 ;$i < $num; $i++){ ! $departmentID = mysql_result($result, $i, $column['id']); ! $departmentName = mysql_result($result, $i, $column['name']); ! $departmentEmail = mysql_result($result, $i, $column['email']); ! $departmentPhone = mysql_result($result, $i, $column['phone']); ! $departmentFax = mysql_result($result, $i, $column['fax']); ! $countryID = mysql_result($result, $i, $column['cid']); ! echo"<tr> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" value=\"".$departmentName."\" name=\"EditName_".$departmentID."\"></td> ! <td><input type=\"text\" size=\"10\" maxlength=\"60\" value=\"".$departmentEmail."\" name=\"EditEmail_".$departmentID."\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"".$departmentPhone."\" name=\"EditPhone_".$departmentID."\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"".$departmentFax."\" name=\"EditFax_".$departmentID."\"></td> ! <td><select name=\"EditCountry_".$departmentID."\" size=\"1\">"; ! lang_list($countryID,0,0); ! echo "</select></td> ! <td><input type=\"checkbox\" name=\"HiddenDepartment_".$departmentID."\" value=\"1\""; ! if($departmentHide == 1){ ! echo " checked"; ! } ! echo "></td> ! <td><input type=\"checkbox\" name=\"DeleteDepartment[]\" value=\"".$departmentID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } ! echo "</td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDDEPARTMENT.": </font></td> ! </tr><tr> ! <td colspan=\"2\"><table> ! <tr> ! <td nowrap>"._CINAME."</td> ! <td nowrap>"._CIMAIL."</td> ! <td nowrap>"._CIPHONE."</td> ! <td nowrap>"._CIFAX."</td> ! <td nowrap>"._CILANGUAGE."</td> ! <td nowrap>"._CIHIDDEN."</td> ! </tr><tr> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" value=\"\" name=\"AddName\"></td> ! <td><input type=\"text\" size=\"10\" maxlength=\"60\" value=\"\" name=\"AddEmail\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"\" name=\"AddPhone\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"\" name=\"AddFax\"></td> ! <td><select name=\"AddCountry\" size=\"1\">"; ! lang_list("",0,0); ! echo "</select></td> ! <td><input type=\"checkbox\" name=\"AddHiddenDepartment\" value=\"1\"></td> ! </tr> ! </table> ! </td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittcity\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); --- 1,182 ---- <? // $Id$ $Name$ + // ---------------------------------------------------------------------- + // POST-NUKE Content Management System + // Copyright (C) 2002 by the PostNuke Development Team. + // http://www.postnuke.com/ + // ---------------------------------------------------------------------- + // LICENSE + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License (GPL) + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WIthOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // To read the license please visit http://www.gnu.org/copyleft/gpl.html + // ---------------------------------------------------------------------- + // Original Author of file: Bjarne Var�ystrand and Bjarne Var�ystrand + // Modifications by: Richard Cave + // Purpose of file: Administration - add a department to the database + // ---------------------------------------------------------------------- + if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['departments_table']; ! $column = &$pntable['departments']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._CIDEPARTMENTS."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['AddName'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['email'].",".$column['name'].",".$column['phone'].",".$column['fax'].",".$column['cid'].",".$column['hide'].") VALUES ('','".$GLOBALS['AddEmail']."','".$GLOBALS['AddName']."','".$GLOBALS['AddPhone']."','".$GLOBALS['AddFax']."','".$GLOBALS['AddCountry']."','".$GLOBALS['AddHiddenDepartment']."')"; ! $resultIns = $dbconn->Execute( $query ); ! if ( $resultIns == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $deleteThisCity = $GLOBALS['DeleteDepartment']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThistypeID = $deleteThisCity[$i]; ! $query = "DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThistypeID'"; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $query = "SELECT ".$column['id']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! for (; !$result->EOF; $result->MoveNext() ) { ! $departmentID = $result->fields[0]; ! $eName = $GLOBALS['EditName_'.$departmentID]; ! $eEmail = $GLOBALS['EditEmail_'.$departmentID]; ! $ePhone = $GLOBALS['EditPhone_'.$departmentID]; ! $eFax = $GLOBALS['EditFax_'.$departmentID]; ! $eCountry = $GLOBALS['EditCountry_'.$departmentID]; ! $eHiddenDepartment = $GLOBALS['HiddenDepartment_'.$departmentID]; ! if(strlen($eName) > 0){ ! $query = "UPDATE ".$table." SET ".$column['name']."='$eName',".$column['email']."='$eEmail',".$column['phone']."='$ePhone',".$column['fax']."='$eFax',".$column['cid']."='$eCountry',".$column['hide']."='$eHiddenDepartment' WHERE ".$column['id']."='$departmentID'"; ! $resultUpd = $dbconn->Execute( $query ); ! if ( $resultUpd == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! } // for (; !$result->EOF; $result->MoveNext() ) ! ! $query = "SELECT ".$column['id'].", ".$column['email']. ! ", ".$column['name'].", ".$column['phone']. ! ", ".$column['fax'].", ".$column['country']. ! ", ".$column['cid'].", ".$column['hide']. ! " FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! if ( !$result->EOF ) { ! echo "<table> ! <tr> ! <td nowrap>"._CINAME."</td> ! <td nowrap>"._CIEMAIL."</td> ! <td nowrap>"._CIPHONE."</td> ! <td nowrap>"._CIFAX."</td> ! <td nowrap>"._CILANGUAGE."</td> ! <td nowrap>"._CIHIDDEN."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! ! for (; !$result->EOF; $result->MoveNext() ) { ! $departmentID = $result->fields[0]; ! $departmentEmail = $result->fields[1]; ! $departmentName = $result->fields[2]; ! $departmentPhone = $result->fields[3]; ! $departmentFax = $result->fields[4]; ! $departmentCountry = $result->fields[5]; ! $countryID = $result->fields[6]; ! $departmentHide = $result->fields[7]; ! ! echo"<tr> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" value=\"".$departmentName."\" name=\"EditName_".$departmentID."\"></td> ! <td><input type=\"text\" size=\"10\" maxlength=\"60\" value=\"".$departmentEmail."\" name=\"EditEmail_".$departmentID."\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"".$departmentPhone."\" name=\"EditPhone_".$departmentID."\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"".$departmentFax."\" name=\"EditFax_".$departmentID."\"></td> ! <td><select name=\"EditCountry_".$departmentID."\" size=\"1\">"; ! ! lang_list($countryID,0,0); ! ! echo "</select></td> ! <td><input type=\"checkbox\" name=\"HiddenDepartment_".$departmentID."\" value=\"1\""; ! if($departmentHide == 1){ ! echo " checked"; ! } ! echo "></td> ! <td><input type=\"checkbox\" name=\"DeleteDepartment[]\" value=\"".$departmentID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } // if ( !$result->EOF ) ! ! echo "</td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDDEPARTMENT.": </font></td> ! </tr><tr> ! <td colspan=\"2\"><table> ! <tr> ! <td nowrap>"._CINAME."</td> ! <td nowrap>"._CIEMAIL."</td> ! <td nowrap>"._CIPHONE."</td> ! <td nowrap>"._CIFAX."</td> ! <td nowrap>"._CILANGUAGE."</td> ! <td nowrap>"._CIHIDDEN."</td> ! </tr><tr> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" value=\"\" name=\"AddName\"></td> ! <td><input type=\"text\" size=\"10\" maxlength=\"60\" value=\"\" name=\"AddEmail\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"\" name=\"AddPhone\"></td> ! <td><input type=\"text\" size=\"8\" maxlength=\"60\" value=\"\" name=\"AddFax\"></td> ! <td><select name=\"AddCountry\" size=\"1\">"; ! ! lang_list("",0,0); ! ! echo "</select></td> ! <td><input type=\"checkbox\" name=\"AddHiddenDepartment\" value=\"1\"></td> ! </tr> ! </table> ! </td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittcity\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); Index: add_locationtype.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/PostContact/admin_functions/add_locationtype.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** add_locationtype.php 23 Jul 2002 11:55:26 -0000 1.2 --- add_locationtype.php 6 Aug 2002 19:54:13 -0000 1.3 *************** *** 1,92 **** <? // $Id$ $Name$ if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['infotype_table']; ! $column = &$pntable['infotype']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._CILOCATIONS."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['addcity'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['cid'].",".$column['name'].") VALUES ('','0','".$GLOBALS['addcity']."')"; ! mysql_query($query); ! echo mysql_error(); ! } ! $deleteThisCity = $GLOBALS['DeleteType']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThistypeID = $deleteThisCity[$i]; ! $result = mysql_query("DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThistypeID'"); ! echo mysql_error(); ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $typeID = mysql_result($result, $i, $column['id']); ! $typeName = mysql_result($result, $i, $column['name']); ! if($GLOBALS['EditType_'.$typeID] != $typeName){ ! if(strlen($GLOBALS['EditType_'.$typeID]) > 0){ ! mysql_query("UPDATE ".$table." SET ".$column['name']."='".$GLOBALS['EditType_'.$typeID]."' WHERE ".$column['id']."='$typeID'"); ! echo mysql_error(); ! } ! } ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! echo mysql_error(); ! if($num > 0){ ! echo "<table> ! <tr> ! <td nowrap>"._CILOCATIONTYPE."</td> ! <td>Delete</td> ! </tr> ! "; ! for ($i = 0 ;$i < $num; $i++){ ! $typeName = mysql_result($result, $i, $column['name']); ! $typeID = mysql_result($result, $i, $column['id']); ! echo"<tr> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" value=\"".$typeName."\" name=\"EditType_".$typeID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteType[]\" value=\"".$typeID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } ! echo "</td> ! </tr> ! <tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDLOCATIONTYPE.": </font></td> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" name=\"addcity\"></td> ! </tr> ! <tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittcity\" value=\""._CICOMITT."\"></td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr> ! </table> ! </form>"; } theindex(); --- 1,133 ---- <? // $Id$ $Name$ + // ---------------------------------------------------------------------- + // POST-NUKE Content Management System + // Copyright (C) 2002 by the PostNuke Development Team. + // http://www.postnuke.com/ + // ---------------------------------------------------------------------- + // LICENSE + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License (GPL) + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WIthOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // To read the license please visit http://www.gnu.org/copyleft/gpl.html + // ---------------------------------------------------------------------- + // Original Author of file: Bjarne Var�ystrand and Bjarne Var�ystrand + // Modifications by: Richard Cave + // Purpose of file: Administration - add a location type to the database + // ---------------------------------------------------------------------- + if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['infotype_table']; ! $column = &$pntable['infotype']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._CILOCATIONS."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['addcity'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['cid'].",".$column['name'].") VALUES ('','0','".$GLOBALS['addcity']."')"; ! $resultIns = $dbconn->Execute( $query ); ! if ( $resultIns == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $deleteThisCity = $GLOBALS['DeleteType']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThistypeID = $deleteThisCity[$i]; ! $query = "DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThistypeID'"; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! for (; !$result->EOF; $result->MoveNext() ) { ! $typeID = $result->fields[0]; ! $typeName = $result->fields[1]; ! if($GLOBALS['EditType_'.$typeID] != $typeName){ ! if(strlen($GLOBALS['EditType_'.$typeID]) > 0){ ! $query = "UPDATE ".$table." SET ".$column['name']."='".$GLOBALS['EditType_'.$typeID]."' WHERE ".$column['id']."='$typeID'"; ! $resultUpd = $dbconn->Execute( $query ); ! if ( $resultUpd == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! } ! } // for (; !$result->EOF; $result->MoveNext() ) ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! if ( !$result->EOF ) { ! echo "<table> ! <tr> ! <td nowrap>"._CILOCATIONTYPE."</td> ! <td>Delete</td> ! </tr> ! "; ! ! for (; !$result->EOF; $result->MoveNext() ) { ! $typeID = $result->fields[0]; ! $typeName = $result->fields[1]; ! ! echo"<tr> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" value=\"".$typeName."\" name=\"EditType_".$typeID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteType[]\" value=\"".$typeID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } // if ( !$result->EOF ) { ! ! echo "</td> ! </tr> ! <tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDLOCATIONTYPE.": </font></td> ! <td><input type=\"text\" size=\"20\" maxlength=\"60\" name=\"addcity\"></td> ! </tr> ! <tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittcity\" value=\""._CICOMITT."\"></td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr> ! </table> ! </form>"; } theindex(); Index: add_title.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/PostContact/admin_functions/add_title.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** add_title.php 23 Jul 2002 11:55:30 -0000 1.2 --- add_title.php 6 Aug 2002 19:54:13 -0000 1.3 *************** *** 1,88 **** <? // $Id$ $Name$ if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['titles_table']; ! $column = &$pntable['titles']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._TITLES."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['addTitle'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['name'].") VALUES ('','".$GLOBALS['addTitle']."')"; ! mysql_query($query); ! echo mysql_error(); ! } ! $deleteThisCity = $GLOBALS['DeleteTitle']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThistitleID = $deleteThisCity[$i]; ! $result = mysql_query("DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThistitleID'"); ! echo mysql_error(); ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $titleID = mysql_result($result, $i, $column['id']); ! $titleName = mysql_result($result, $i, $column['name']); ! if($GLOBALS['EditTitle_'.$titleID] != $titleName){ ! if(strlen($GLOBALS['EditTitle_'.$titleID]) > 0){ ! mysql_query("UPDATE ".$table." SET ".$column['name']."='".$GLOBALS['EditTitle_'.$titleID]."' WHERE ".$column['id']."='$titleID'"); ! echo mysql_error(); ! } ! } ! } ! $result = mysql_query("SELECT * FROM ".$table." order by ".$column['name']); ! $num = mysql_numrows($result); ! echo mysql_error(); ! if($num > 0){ ! echo "<table> ! <tr> ! <td>"._CITITLE."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! for ($i = 0 ;$i < $num; $i++){ ! $titleName = mysql_result($result, $i, $column['name']); ! $titleID = mysql_result($result, $i, $column['id']); ! echo"<tr> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$titleName."\" name=\"EditTitle_".$titleID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteTitle[]\" value=\"".$titleID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } ! echo "</td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDNEWTITLE.": </font></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addTitle\"></td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittitle\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); --- 1,129 ---- <? // $Id$ $Name$ + // ---------------------------------------------------------------------- + // POST-NUKE Content Management System + // Copyright (C) 2002 by the PostNuke Development Team. + // http://www.postnuke.com/ + // ---------------------------------------------------------------------- + // LICENSE + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License (GPL) + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WIthOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // To read the license please visit http://www.gnu.org/copyleft/gpl.html + // ---------------------------------------------------------------------- + // Original Author of file: Bjarne Var�ystrand and Bjarne Var�ystrand + // Modifications by: Richard Cave + // Purpose of file: Administration - add a title to the database + // ---------------------------------------------------------------------- + if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = basename( dirname( __FILE__ ) ); function theindex(){ ! global $ModName,$prefix; ! getForm(__FILE__); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['titles_table']; ! $column = &$pntable['titles']; ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ! <tr> ! <td colspan=\"2\"><font class=\"pn-title\">"._TITLES."</font></td> ! </tr><tr> ! <td colspan=\"2\"><br><br></td> ! </tr><tr> ! <td colspan=\"2\">"; ! if($GLOBALS['addTitle'] != ""){ ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['name'].") VALUES ('','".$GLOBALS['addTitle']."')"; ! $resultIns = $dbconn->Execute( $query ); ! if ( $resultIns == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $deleteThisCity = $GLOBALS['DeleteTitle']; ! for($i = 0;$i < count($deleteThisCity);$i++){ ! $deleteThistitleID = $deleteThisCity[$i]; ! $query = "DELETE FROM ".$table." WHERE ".$column['id']."='$deleteThistitleID'"; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! for (; !$result->EOF; $result->MoveNext() ) { ! $titleID = $result->fields[0]; ! $titleName = $result->fields[1]; ! if($GLOBALS['EditTitle_'.$titleID] != $titleName){ ! if(strlen($GLOBALS['EditTitle_'.$titleID]) > 0){ ! $query = "UPDATE ".$table." SET ".$column['name']."='".$GLOBALS['EditTitle_'.$titleID]."' WHERE ".$column['id']."='$titleID'"; ! $resultUpd = $dbconn->Execute( $query ); ! if ( $resultUpd == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! } ! } ! } ! $query = "SELECT ".$column['id'].", ".$column['name']." FROM ".$table." order by ".$column['name']; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! if ( !$result->EOF ) { ! echo "<table> ! <tr> ! <td>"._CITITLE."</td> ! <td>"._CIDELETE."</td> ! </tr> ! "; ! ! for (; !$result->EOF; $result->MoveNext() ) { ! $titleID = $result->fields[0]; ! $titleName = $result->fields[1]; ! ! echo"<tr> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" value=\"".$titleName."\" name=\"EditTitle_".$titleID."\"></td> ! <td><input type=\"checkbox\" name=\"DeleteTitle[]\" value=\"".$titleID."\"></td> ! </tr>"; ! } ! echo " ! </table>"; ! } // if ( !$result->EOF ) ! ! echo "</td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font class=\"pn-normal\">"._CIADDNEWTITLE.": </font></td> ! <td><input type=\"text\" size=\"40\" maxlength=\"60\" name=\"addTitle\"></td> ! </tr><tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"comittitle\" value=\""._CICOMITT."\"></td> ! </tr> ! </table> ! </form>"; } theindex(); Index: companyinfo.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/PostContact/admin_functions/companyinfo.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** companyinfo.php 23 Jul 2002 11:55:34 -0000 1.2 --- companyinfo.php 6 Aug 2002 19:54:13 -0000 1.3 *************** *** 1,7 **** <? // $Id$ $Name$ if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = $GLOBALS['name']; --- 1,31 ---- <? // $Id$ $Name$ + // ---------------------------------------------------------------------- + // POST-NUKE Content Management System + // Copyright (C) 2002 by the PostNuke Development Team. + // http://www.postnuke.com/ + // ---------------------------------------------------------------------- + // LICENSE + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License (GPL) + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WIthOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // To read the license please visit http://www.gnu.org/copyleft/gpl.html + // ---------------------------------------------------------------------- + // Original Author of file: Bjarne Var�ystrand and Bjarne Var�ystrand + // Modifications by: Richard Cave + // Purpose of file: Administration - add company information to the database + // ---------------------------------------------------------------------- + if (!eregi("admin.php", $PHP_SELF)) { ! die ("Access Denied"); } $ModName = $GLOBALS['name']; *************** *** 10,223 **** modules_get_language(); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! ! $table = $pntable['company_table']; ! $column = &$pntable['company']; ! $result = mysql_query("SELECT ".$column['id']." FROM ".$table.""); ! if(mysql_error()){ ! echo "<p>Fel i ".__FILE__." Rad: ".__LINE__." MYSQL: ".mysql_error()."</p>"; } ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $company_id = mysql_result($result, $i, $column['id']); } function addCityCompany($personID,$cityName,$country=''){ ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['city_table']; ! $column = &$pntable['city']; ! $query = "SELECT * FROM ".$table." WHERE ".$column['name']."='".$cityName."'"; ! $result = mysql_query($query); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $cityID = mysql_result($result, $i, $column['id']); ! } ! if(!$cityID){ ! if($cityName){ ! $query = "INSERT INTO ".$table." (".$column['name'].",".$column['cid'].") VALUES ('".$cityName."','".$country."')"; ! mysql_query($query); ! $cityID = mysql_insert_id(); // $results ! } ! } ! $table = $pntable['company_table']; ! $column = &$pntable['company']; ! $query = "UPDATE ".$table." SET ".$column['city']."='".$cityID."' WHERE ".$column['id']."='$company_id'"; ! mysql_query($query); ! return $cityID; } function theindex($company_id){ global $ModName,$prefix,$HTTP_POST_FILES; ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['company_table']; ! $column = &$pntable['company']; ! if(is_uploaded_file($GLOBALS['company_logo_upload'])){ ! $filename = $GLOBALS['company_logo_upload_name']; ! $companyLogo = "modules/".$ModName."/images/logo".substr($filename,-4,4); ! copy($GLOBALS['company_logo_upload'], "modules/".$ModName."/images/logo".substr($filename,-4,4)); }else{ ! $companyLogo = $GLOBALS['lastLogo']; ! } ! if($company_id > 0){ ! if($GLOBALS['UpdateCompanyInfo'] != ""){ ! $CompCity = $GLOBALS['companyCity']; ! $newCityName = $GLOBALS['AddNewCity']; ! if($newCityName){ ! $CompCity = addCityCompany($company_id,$newCityName,$GLOBALS['companyCountry']); ! } ! $query = "UPDATE ".$table." SET ".$column['defaultcountry']."='".$GLOBALS['companyDefaultCountry']."', ! ".$column['logo']."='$companyLogo', ! ".$column['name']."='".$GLOBALS['companyName']."', ! ".$column['phone']."='".$GLOBALS['companyPhone']."', ! ".$column['fax']."='".$GLOBALS['companyFax']."', ! ".$column['mail']."='".$GLOBALS['companyMail']."', ! ".$column['address']."='".$GLOBALS['companyAddress']."', ! ".$column['zip']."='".$GLOBALS['companyZip']."', ! ".$column['address2']."='".$GLOBALS['companyAddress2']."', ! ".$column['country']."='".$GLOBALS['companyCountry']."', ! ".$column['state']."='".$GLOBALS['companyState']."', ! ".$column['hide']."='".$GLOBALS['companyHide']."', ! ".$column['city']."='".$CompCity."' where ".$column['id']."='$company_id'"; ! $result = mysql_query($query); ! if(mysql_error()){ ! echo "<p>Fel i ".__FILE__." Rad: ".__LINE__." MYSQL: ".mysql_error()."</p>"; ! } ! } ! }else{ ! $falten = $column['state'].",".$column['id'].",".$column['defaultcountry'].",".$column['logo'].",".$column['name'].",".$column['address2'].",".$column['phone'].",".$column['fax'].",".$column['mail'].",".$column['address'].",".$column['zip'].",".$column['country'].",".$column['hide'].",".$column['city']; ! $varden = "'','','$companyDefaultCountry','$companyLogo','$companyName','$companyAddress2','$companyPhone','$companyFax','$companyMail','$companyAddress','$companyZip','$companyCountry','$companyHide','$companyCity'"; ! $result = mysql_query("INSERT INTO ".$table." ($falten) VALUES ($varden)"); ! $company_id = mysql_insert_id(); ! if(mysql_error()){ ! echo "<p>Fel i ".__FILE__." Rad: ".__LINE__." MYSQL: ".mysql_error()."</p>"; ! } ! } ! $result = mysql_query("SELECT * FROM ".$table." where ".$column['id']."='$company_id'"); ! if(mysql_error()){ ! echo "<p>Fel i ".__FILE__." Rad: ".__LINE__." MYSQL: ".mysql_error()."</p>"; ! } ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $companyName = mysql_result($result, $i, $column['name']); ! $companyAddress = mysql_result($result, $i, $column['address']); ! $companyCity = mysql_result($result, $i, $column['city']); ! $companyZip = mysql_result($result, $i, $column['zip']); ! $companyCountry = mysql_result($result, $i, $column['country']); ! $companyPhone = mysql_result($result, $i, $column['phone']); ! $companyFax = mysql_result($result, $i, $column['fax']); ! $companyMail = mysql_result($result, $i, $column['mail']); ! $companyAddress2 = mysql_result($result, $i, $column['address2']); ! $companyLogo = mysql_result($result, $i, $column['logo']); ! $companyDefaultCountry = mysql_result($result, $i, $column['defaultcountry']); ! $companyState = mysql_result($result, $i, $column['state']); ! } ! getForm(__FILE__); ! echo "<link rel=\"StyleSheet\" href=\"modules/$ModName/css/style.css\" type=\"text/css\"> ! <table border=\"0\" cellspacing=\"2\" cellpadding=\"1\"> ! <tr> ! <td> ! <table border=\"0\" cellspacing=\"2\" cellpadding=\"1\"> ! <tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYNAME.": </font></td> ! <td><input type=\"text\" name=\"companyName\" value=\"$companyName\"></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYADDRESS.": </font></td> ! <td><input type=\"text\" name=\"companyAddress\" value=\"$companyAddress\"></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYADDRESS2.": </font></td> ! <td><input type=\"text\" name=\"companyAddress2\" value=\"$companyAddress2\"></td> ! </tr> ! <tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYSTATE.": </font></td> ! <td><input type=\"text\" name=\"companyState\" value=\"$companyState\"></td> ! </tr> ! <tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYZIP.": </font></td> ! <td><input type=\"text\" name=\"companyZip\" value=\"$companyZip\"></td> ! </tr> ! <tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYCITY.": </font></td> ! <td><select name=\"companyCity\"> ! <option>"._CICITYS."</option>"; ! $TableCity = &$pntable['city_table']; ! $columnCity = &$pntable['city']; ! $result = mysql_query("SELECT * FROM ".$TableCity); ! $num = mysql_numrows($result); ! for ($i = 0 ;$i < $num; $i++){ ! $cityID = mysql_result($result, $i, $columnCity['id']); ! $countryID = mysql_result($result, $i, $columnCity['cid']); ! $cityName = mysql_result($result, $i, $columnCity['name']); ! echo "<option value=\"$cityID\""; ! if($companyCity == "$cityID"){ ! echo "SELECTED"; ! } ! echo ">$cityName</option>\n"; ! } ! echo "</select></td> ! </tr> ! ! <tr> ! <td nowrap=\"nowrap\" align=\"right\"><font class=\"pn-title\"> "._CIADD_CITY_ON_THE_FLY_.": </font></td> ! <td><input type=\"text\" name=\"AddNewCity\" maxlength=\"90\"></td> ! </tr> ! ! <tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYCOUNTRY.": </font></td> ! <td><select name=\"companyCountry\">"; ! lang_list($companyCountry,1,1); ! echo "</select></td> ! </tr>"; ! if($use_default_list){ ! echo "<tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYDEFAULTCOUNTRY.": </font></td> ! <td><select name=\"companyDefaultCountry\">"; ! lang_list($companyCountry,1,1); ! echo "</select></td> ! </tr> ! "; ! } ! echo "<tr> ! <td colspan=\"2\"><hr></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYPHONE.": </font></td> ! <td><input type=\"text\" name=\"companyPhone\" value=\"$companyPhone\"></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYFAX.": </font></td> ! <td><input type=\"text\" name=\"companyFax\" value=\"$companyFax\"></td> ! </tr><tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYMAIL.": </font></td> ! <td><input type=\"text\" name=\"companyMail\" value=\"$companyMail\"></td> ! </tr> ! <tr> ! <td align=\"right\" nowrap=\"nowrap\"><font size=\"1\" class=\"pn-normal\">"._CICOMPANYLOGO.": </font></td> ! <td><input type=\"file\" name=\"company_logo_upload\" size=\"20\"></td> ! </tr> ! </table> ! <input type=\"submit\" name=\"UpdateCompanyInfo\" value=\""._CISAVE."\"> ! <input type=\"hidden\" name=\"lastLogo\" value=\"".$companyLogo."\"> ! </form>"; ! echo "</td><td valign=\"top\">"; ! if(is_file($companyLogo)){ ! echo "<img src=\"".$companyLogo."\">"; ! } ! echo "</td></tr></table>"; } theindex($company_id); ! ?> \ No newline at end of file --- 34,294 ---- modules_get_language(); ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); + $table = $pntable['company_table']; + $column = &$pntable['company']; ! $query = "SELECT ".$column['id']." FROM ".$table.""; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); } ! ! for (; !$result->EOF; $result->MoveNext() ) { ! $company_id = $result->fields[0]; } function addCityCompany($personID,$cityName,$country=''){ ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! ! $table = $pntable['city_table']; ! $column = &$pntable['city']; ! ! $query = "SELECT ".$column['id']." FROM ".$table." WHERE ".$column['name']."='".$cityName."'"; ! $result = $dbconn->Execute( $query ); ! if ( $result == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! for (; !$result->EOF; $result->MoveNext() ) { ! $cityID = $result->fields[0]; ! } ! if(!$cityID){ ! if($cityName){ ! // R.Cave - ADODB 1.99 necessary to support GenId() ! $cityID = $dbconn->GenId($column['id']); ! ! $query = "INSERT INTO ".$table." (".$column['id'].",".$column['name'].",".$column['cid'].") VALUES ('".$cityID."','".$cityName."','".$country."')"; ! $resultIns = $dbconn->Execute( $query ); ! if ( $resultIns == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! // Get the newly generated $depID ! $cityID = $dbconn->PO_Insert_ID( $table, $column['id'] ); ! } ! } ! ! $table = $pntable['company_table']; ! $column = &$pntable['company']; ! ! $query = "UPDATE ".$table." SET ".$column['city']."='".$cityID."' WHERE ".$column['id']."='$company_id'"; ! $resultUpd = $dbconn->Execute( $query ); ! if ( $resultUpd == false ) { ! PN_DBMsgError( $dbconn, __FILE__, __LINE__, "Error accessing the database" ); ! } ! ! return $cityID; } + function theindex($company_id){ global $ModName,$prefix,$HTTP_POST_FILES; ! list($dbconn) = pnDBGetConn(); ! $pntable = PostContact_pntables(); ! $table = $pntable['company_table']; ! $column = &$pntable['company']; ! if(is_uploaded_file($GLOBALS['company_logo_upload'])){ ! $filename = $GLOBALS['company_logo_upload_name']; ! $companyLogo = "modules/".$ModName."/images/logo".substr($filename,-4,4); ! copy($GLOBALS['company_logo_upload'], "modules/".$ModName."/images/logo".substr($filename,-4,4)); }else{ ! $companyLogo = $GLOBALS['lastLogo']; ! } ! if($company_id > 0){ ! if($GLOBALS['UpdateCompanyInfo'] != ""){ ! $CompCity = $GLOBALS['companyCity']; ! $newCityName = $GLOBALS['AddNewCity']; ! if($newCityName){ ! $CompCity = addCityCompany($company_id,$newCityName,$GLOBALS['companyCountry']); ! } ! $query = "UPDATE ".$table." SET ".$column['def
View Statistics - Next Notice - Previous Notice
Visit Developer Site - Browse CVS Repository |
Syndicate via backend.rss (max. once per hour please) | Powered by CVSNotice 0.1.3 |