The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Autotomatically resolve base/root path for Formtools - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: Feature Suggestions (https://forums.formtools.org/forumdisplay.php?fid=7)
+--- Thread: Autotomatically resolve base/root path for Formtools (/showthread.php?tid=1260)



Autotomatically resolve base/root path for Formtools - crunchers - May 5th, 2011

Just a suggestion:

In the Formtools main config.php file, use the following(?) to define $g_root_url and $g_root_dir:

PHP Code:
$g_root_url  = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" "http");
$g_root_url .= "://".$_SERVER['HTTP_HOST'];
$g_root_url .= str_replace("/global/".basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

$g_root_dir  $_SERVER['DOCUMENT_ROOT'];
$g_root_dir .= str_replace("/global/".basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']); 

I can't remember how these are defined by default but the above snippet will automatically calculate both the base and root paths for FormTools (you could even go as far as excluding it from the config file altogether and place it in the core).

I've used something similar before on Codeigniter and thought it may prove useful for future releases, Ben.


RE: Autotomatically resolve base/root path for Formtools - Ben - May 5th, 2011

Hi Crunchers,

Yeah, I had the same thought! In fact, I did something like that on another script of mine for a while. But I got burned by it: the SCRIPT_NAME and some other commonly available $_SERVER contents weren't being doled up on a particular the server. According to the PHP specs, technically they may not be available. Chances are it was just an anomaly, but it's made me nervous about relying on it.

Eventually, what I'll do is examine the way other popular PHP scripts (like Wordpress, Drupal etc) are doing it these days. If I *can* do away with having those variables set, that would be terrific.

- Ben


RE: Autotomatically resolve base/root path for Formtools - crunchers - May 5th, 2011

PITA problem you ran into there. One way round it, I suppose, is to check for this anomaly during installation and fall back on prompting the user to adjust it manually if the condition fails. I guess the flip-side is you'd be creating more work re:logic. Time better spent elsewhere etc.

Just thinking out loud really...

Thanks, Ben.


RE: Autotomatically resolve base/root path for Formtools - Ben - May 5th, 2011

But very welcome! I appreciate the ideas - it's good to get reminders of these things. There's always things that can be improved.

- Ben