#2320 - Composr 10b4: Missing require_code statements
| Identifier | #2320 |
|---|---|
| Issue type | Minor issue (breaks specific functionality) |
| Title | Composr 10b4: Missing require_code statements |
| Status | Completed |
| Handling member | Chris Graham |
| Addon | core |
| Description | Composr 10b4 has a few missing require_code statements. In regular website functionality, these are usually not necessary. However for scripts that use minimal Composr interface (such as bots as well as custom scripts that load just the core of Composr), without these require code statements, many errors are triggered and functionality is abnormal.
*sources/globals3.php needs a "require_code('config')" inside the get_ip_address function. *sources/config.php needs a "require_code('database')" within the function around line 34. *sources/config.php needs a "require_code('caches')" within the function near line 162. |
| Steps to reproduce | |
| Additional information | Related to #2316 |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
Any third party code must initialise Composr in the normal way, rather than jumping into it. E.g. data/ajax_tree.php, loads a big blob of standard code before the final 2 lines of that file which are custom code now that Composr has bootstrapped.
<?php /*
Composr
Copyright (c) ocProducts, 2004-2016
See text/EN/licence.txt for full licencing information.
NOTE TO PROGRAMMERS:
Do not edit this file. If you need to make changes, save your changed file to the appropriate *_custom folder
**** If you ignore this advice, then your website upgrades (e.g. for bug fixes) will likely kill your changes ****
*/
/**
* @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
* @copyright ocProducts Ltd
* @package core
*/
// Find Composr base directory, and chdir into it
global $FILE_BASE, $RELATIVE_PATH;
$FILE_BASE = ...;
$RELATIVE_PATH = '';
@chdir($FILE_BASE);
global $FORCE_INVISIBLE_GUEST;
$FORCE_INVISIBLE_GUEST = false;
global $EXTERNAL_CALL;
$EXTERNAL_CALL = true;
if (!is_file($FILE_BASE . '/sources/global.php')) {
exit('<!DOCTYPE html>' . "\n" . '<html lang="EN"><head><title>Critical startup error</title></head><body><h1>Composr startup error</h1>
The second most basic Composr startup file, sources/global.php, could not be located. This is almost always due to an incomplete upload of the Composr system, so please check all files are uploaded correctly.
Once all Composr files are in place, Composr must actually be installed by running the installer. You must be seeing this message either because your system has become corrupt since installation, or because you have uploaded some but not all files from our manual installer package: the quick installer is easier, so you might consider using that instead.
ocProducts maintains full documentation for all procedures and tools, especially those for installation. These may be found on the <a href="http://compo.sr">Composr website</a>. If you are unable to easily solve this problem, we may be contacted from our website and can help resolve it for you.
<hr /><p style="font-size: 0.8em">Composr is a website engine created by ocProducts.</body></html>');}
require($FILE_BASE . '/sources/global.php');
Is the error reproducable? I don't have FTP access to the site anymore, if you can email me ([email protected]) I can likely take a look tomorrow.
Static caching is enabled *and*
A backdoor IP is set *and*
No cookies are set
It would try and call get_ip_address() too early in the startup.