Skip to content

Commit

Permalink
1. Added configuration options which allow control on who should be n…
Browse files Browse the repository at this point in the history
…otified on different actions/events.

2. Added checking for obsolete variables (before of enhancement 1), if found, an error is reported directing the admin to the new configuration variables.
3. Added a database API that allows checking whether a field name exists or not.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1162 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Jul 2, 2002
1 parent dfc1f16 commit 3ff24e4
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 118 deletions.
18 changes: 18 additions & 0 deletions core_API.php
Expand Up @@ -22,6 +22,24 @@
}
# Load file globals # @@@ ugly hack for ugly problem. Find better solution soon
require( './default/config_inc2.php' );

# Should be eventually moved to the admin scripts, but keep it here for a while
# to make sure people don't miss it.
function obsolete_config_variable($var, $replace) {
global $$var;
if (isset($$var)) {
PRINT '$' . $var . ' is now obsolete';
if ($replace != '') {
PRINT ', please use $' . $replace;
}
exit;
}
}

# Check for obsolete variables
obsolete_config_variable('g_notify_developers_on_new', 'g_notify_flags');
obsolete_config_variable('g_notify_on_new_threshold', 'g_notify_flags');
obsolete_config_variable('g_notify_admin_on_new', 'g_notify_flags');

ini_set('magic_quotes_runtime', 0);
if ( OFF == $g_register_globals ) {
Expand Down
24 changes: 21 additions & 3 deletions core_database_API.php
Expand Up @@ -5,11 +5,11 @@
# See the files README and LICENSE for details

# --------------------------------------------------------
# $Revision: 1.13 $
# $Revision: 1.14 $
# $Author: vboctor $
# $Date: 2002-06-25 10:19:58 $
# $Date: 2002-07-02 12:48:52 $
#
# $Id: core_database_API.php,v 1.13 2002-06-25 10:19:58 vboctor Exp $
# $Id: core_database_API.php,v 1.14 2002-07-02 12:48:52 vboctor Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -109,6 +109,24 @@ function db_insert_id() {
return db_result( $t_result, 0, 0 );
}
# --------------------
function db_field_exists( $p_field_name, $p_table_name, $p_db_name = '') {
global $g_database_name;

if ($p_db_name == '') {
$p_db_name = $g_database_name;
}

$fields = mysql_list_fields($p_db_name, $p_table_name);
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
if ( mysql_field_name( $fields, $i ) == $p_field_name ) {
return true;
}
}

return false;
}
# --------------------
function db_error_num() {
return mysql_errno();
}
Expand Down

0 comments on commit 3ff24e4

Please sign in to comment.