cvs: embed /php-irssi php-core.c

[email protected] ("Wez Furlong") Mon, 31 Mar 2003 23:54:09 -0000
Newsgroups php.embed.cvs
Message-ID <cvswez1049154849@cvsserver>
wez		Mon Mar 31 18:54:09 2003 EDT

  Modified files:              
    /embed/php-irssi	php-core.c 
  Log:
  Really tidy the settings stuff.
  Also, turn on some error reporting stuff (which is needed if the php.ini file
  is missing).
  
  
  
Index: embed/php-irssi/php-core.c
diff -u embed/php-irssi/php-core.c:1.20 embed/php-irssi/php-core.c:1.21
--- embed/php-irssi/php-core.c:1.20	Mon Mar 31 18:47:31 2003
+++ embed/php-irssi/php-core.c	Mon Mar 31 18:54:09 2003
@@ -15,7 +15,7 @@
   | Authors: Wez Furlong <[email protected]>                                   |
   |          Tal Peer <[email protected]>                                      | 
   +----------------------------------------------------------------------+
-  $Id: php-core.c,v 1.20 2003/03/31 23:47:31 wez Exp $
+  $Id: php-core.c,v 1.21 2003/03/31 23:54:09 wez Exp $
 */
 #define MODULE_NAME "php/core"
 #include "common.h"
@@ -289,7 +289,7 @@
 /* Module init: called by irssi when the user types "/load php" */
 void php_core_init(void)
 {
-	char *include_path = NULL;
+	char *include_path, *tmp;
 	
 	init_php();
 
@@ -305,19 +305,16 @@
 	command_bind("php version", NULL, (SIGNAL_FUNC)cmd_php_version);
 	command_bind("php set", NULL, (SIGNAL_FUNC)cmd_php_set);
 	
-	include_path = settings_get_str("php_include_path");
+	spprintf(&tmp, -1, "%s/scripts:%s", get_irssi_dir(), SCRIPTDIR);
+	include_path = g_strdup(tmp);
+	efree(tmp);
 
-	if (include_path == NULL) {
-		char *tmp;
-		spprintf(&tmp, -1, "%s/scripts:%s", get_irssi_dir(), SCRIPTDIR);
-		include_path = g_strdup(tmp);
-		efree(tmp);
-
-		settings_add_str("php", "php_include_path", include_path);
-	}
+	settings_add_str("php", "php_include_path", include_path);
 	
 	php_set_ini_entry("include_path", (char*)settings_get_str("php_include_path"), PHP_INI_STAGE_ACTIVATE);
 	php_set_ini_entry("html_errors", "0", PHP_INI_STAGE_ACTIVATE);
+	php_set_ini_entry("display_errors", "1", PHP_INI_STAGE_ACTIVATE);
+	php_set_ini_entry("display_startup_errors", "1", PHP_INI_STAGE_ACTIVATE);
 	
 	if (irssi_init_finished) {
 		/* if the module is being loaded manually execute autorun directly */