-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protector updates - PHP8 compatibility, update and remove legacy code (…
…#1098) * Corrected class reference to the database class * Formatting to match icms code syntax, addressing todo items * Replacing dirname(__FILE__) with __DIR__ * Removing closing php tag at end of file * Removed closing php tag and extra blank lines at end of file * removing closing php tag a blank lines at end of file * Replacing dirname(__FILE__) with __DIR__ * Removed get_magic_quotes_gpc usage * Updating to use current class instead of deprecated IcmsPreloadItem * Replacing intval with (int) - speed * Removing tests for conditions that will never occur * correcting logic for HTMLPurifier filter class_exists config * Converting to icms_version files * Wrong file was being included * Replacing use of xoopsConfig with icmsConfig * Removing search - do not include * Didn't see the search config value at the bottom of the file * Removed conditional check in language loading that was unnecessary * Replacing the remaining $xoopsUser occurrences and global inclusions * Removed deprecated references and conditionals that will not occur * Updating version information for Protector
- Loading branch information
Showing
63 changed files
with
2,860 additions
and
3,208 deletions.
There are no files selected for viewing
13 changes: 5 additions & 8 deletions
13
htdocs/install/modules/protector/root/modules/protector/admin/admin_menu.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(dirname(__DIR__)); | ||
$mydirpath = dirname(__DIR__); | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; | ||
$mydirpath = dirname( dirname( __FILE__ ) ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/admin_menu.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/admin_menu.php'; |
15 changes: 6 additions & 9 deletions
15
htdocs/install/modules/protector/root/modules/protector/admin/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
<?php | ||
require '../../../mainfile.php'; | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH in mainfile.php'); | ||
|
||
require '../../../mainfile.php' ; | ||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH in mainfile.php' ) ; | ||
$mydirname = basename(dirname(__DIR__)); | ||
$mydirpath = dirname(__DIR__); | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; | ||
$mydirpath = dirname( dirname( __FILE__ ) ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/admin.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/admin.php'; |
13 changes: 5 additions & 8 deletions
13
htdocs/install/modules/protector/root/modules/protector/blocks/blocks.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(dirname(__DIR__)); | ||
$mydirpath = dirname(__DIR__); | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; | ||
$mydirpath = dirname( dirname( __FILE__ ) ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/blocks.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/blocks.php'; |
8 changes: 8 additions & 0 deletions
8
htdocs/install/modules/protector/root/modules/protector/icms_version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/icms_version.php'; |
19 changes: 8 additions & 11 deletions
19
htdocs/install/modules/protector/root/modules/protector/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
<?php | ||
require '../../mainfile.php'; | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH in mainfile.php'); | ||
|
||
require '../../mainfile.php' ; | ||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH in mainfile.php' ) ; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
if( @$_GET['mode'] == 'admin' ) { | ||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/admin.php' ; | ||
if (@$_GET['mode'] == 'admin') { | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/admin.php'; | ||
} else { | ||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/main.php' ; | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/main.php'; | ||
} | ||
|
||
?> |
17 changes: 7 additions & 10 deletions
17
htdocs/install/modules/protector/root/modules/protector/module_icon.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
<?php | ||
$xoopsOption['nocommon'] = true; | ||
require '../../mainfile.php'; | ||
|
||
$xoopsOption['nocommon'] = true ; | ||
require '../../mainfile.php' ; | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/module_icon.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/module_icon.php'; |
3 changes: 1 addition & 2 deletions
3
htdocs/install/modules/protector/root/modules/protector/mytrustdirname.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
<?php | ||
$mytrustdirname = 'protector' ; | ||
?> | ||
$mytrustdirname = 'protector'; |
13 changes: 5 additions & 8 deletions
13
htdocs/install/modules/protector/root/modules/protector/notification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/notification.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/notification.php'; |
17 changes: 8 additions & 9 deletions
17
htdocs/install/modules/protector/root/modules/protector/notification_update.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
<?php | ||
require '../../mainfile.php' ; | ||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH in mainfile.php' ) ; | ||
require '../../mainfile.php'; | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH in mainfile.php'); | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
$mydirurl = ICMS_URL.'/modules/'.$mydirname; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
$mydirurl = ICMS_URL . '/modules/' . $mydirname; | ||
|
||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$_GET['page'] = basename( __FILE__ , '.php'); | ||
$_GET['page'] = basename(__FILE__, '.php'); | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/main.php' ; | ||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/main.php'; |
13 changes: 5 additions & 8 deletions
13
htdocs/install/modules/protector/root/modules/protector/oninstall.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/oninstall.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/oninstall.php'; |
13 changes: 5 additions & 8 deletions
13
htdocs/install/modules/protector/root/modules/protector/onuninstall.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/onuninstall.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/onuninstall.php'; |
13 changes: 5 additions & 8 deletions
13
htdocs/install/modules/protector/root/modules/protector/onupdate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
if (!defined('ICMS_TRUST_PATH')) die('set ICMS_TRUST_PATH into mainfile.php'); | ||
|
||
if( ! defined( 'ICMS_TRUST_PATH' ) ) die( 'set ICMS_TRUST_PATH into mainfile.php' ) ; | ||
$mydirname = basename(__DIR__); | ||
$mydirpath = __DIR__; | ||
require $mydirpath . '/mytrustdirname.php'; // set $mytrustdirname | ||
|
||
$mydirname = basename( dirname( __FILE__ ) ) ; | ||
$mydirpath = dirname( __FILE__ ) ; | ||
require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname | ||
|
||
require ICMS_TRUST_PATH.'/modules/'.$mytrustdirname.'/onupdate.php' ; | ||
|
||
?> | ||
require ICMS_TRUST_PATH . '/modules/' . $mytrustdirname . '/onupdate.php'; |
11 changes: 0 additions & 11 deletions
11
htdocs/install/modules/protector/root/modules/protector/search.php
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
htdocs/install/modules/protector/root/modules/protector/xoops_version.php
This file was deleted.
Oops, something went wrong.
78 changes: 29 additions & 49 deletions
78
htdocs/install/modules/protector/trust_path/modules/protector/admin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,53 @@ | ||
<?php | ||
|
||
$mytrustdirname = basename( dirname( __FILE__ ) ) ; | ||
$mytrustdirpath = dirname( __FILE__ ) ; | ||
$mytrustdirname = basename(__DIR__); | ||
$mytrustdirpath = __DIR__; | ||
|
||
// environment | ||
require_once ICMS_ROOT_PATH.'/class/template.php' ; | ||
$module_handler = icms::handler('icms_module') ; | ||
$xoopsModule = $module_handler->getByDirname( $mydirname ) ; | ||
$config_handler = icms::handler('icms_config') ; | ||
$xoopsModuleConfig =& $config_handler->getConfigsByCat( 0 , $xoopsModule->getVar( 'mid' ) ) ; | ||
$module_handler = icms::handler('icms_module'); | ||
$xoopsModule = $module_handler->getByDirname($mydirname); | ||
$config_handler = icms::handler('icms_config'); | ||
$xoopsModuleConfig = &$config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid')); | ||
|
||
// check permission of 'module_admin' of this module | ||
$moduleperm_handler = icms::handler('icms_member_groupperm') ; | ||
if( ! is_object( @icms::$user ) || ! $moduleperm_handler->checkRight( 'module_admin' , $xoopsModule->getVar( 'mid' ) , icms::$user->getGroups() ) ) die( 'only admin can access this area' ) ; | ||
$moduleperm_handler = icms::handler('icms_member_groupperm'); | ||
if (!is_object(@icms::$user) || !$moduleperm_handler->checkRight('module_admin', $xoopsModule->getVar('mid'), icms::$user->getGroups())) die('only admin can access this area'); | ||
|
||
$xoopsOption['pagetype'] = 'admin' ; | ||
require ICMS_ROOT_PATH.'/include/cp_functions.php' ; | ||
$xoopsOption['pagetype'] = 'admin'; | ||
require ICMS_ROOT_PATH . '/include/cp_functions.php'; | ||
|
||
// language files (admin.php) | ||
$language = empty( $xoopsConfig['language'] ) ? 'english' : $xoopsConfig['language'] ; | ||
if( file_exists( "$mydirpath/language/$language/admin.php" ) ) { | ||
$language = empty($icmsConfig['language']) ? 'english' : $icmsConfig['language']; | ||
if (file_exists("$mydirpath/language/$language/admin.php")) { | ||
// user customized language file | ||
include_once "$mydirpath/language/$language/admin.php" ; | ||
} else if( file_exists( "$mytrustdirpath/language/$language/admin.php" ) ) { | ||
include_once "$mydirpath/language/$language/admin.php"; | ||
} else if (file_exists("$mytrustdirpath/language/$language/admin.php")) { | ||
// default language file | ||
include_once "$mytrustdirpath/language/$language/admin.php" ; | ||
include_once "$mytrustdirpath/language/$language/admin.php"; | ||
} else { | ||
// fallback english | ||
include_once "$mytrustdirpath/language/english/admin.php" ; | ||
include_once "$mytrustdirpath/language/english/admin.php"; | ||
} | ||
|
||
// language files (main.php) | ||
$language = empty( $xoopsConfig['language'] ) ? 'english' : $xoopsConfig['language'] ; | ||
if( file_exists( "$mydirpath/language/$language/main.php" ) ) { | ||
$language = empty($icmsConfig['language']) ? 'english' : $icmsConfig['language']; | ||
if (file_exists("$mydirpath/language/$language/main.php")) { | ||
// user customized language file | ||
include_once "$mydirpath/language/$language/main.php" ; | ||
} else if( file_exists( "$mytrustdirpath/language/$language/main.php" ) ) { | ||
include_once "$mydirpath/language/$language/main.php"; | ||
} else if (file_exists("$mytrustdirpath/language/$language/main.php")) { | ||
// default language file | ||
include_once "$mytrustdirpath/language/$language/main.php" ; | ||
include_once "$mytrustdirpath/language/$language/main.php"; | ||
} else { | ||
// fallback english | ||
include_once "$mytrustdirpath/language/english/main.php" ; | ||
include_once "$mytrustdirpath/language/english/main.php"; | ||
} | ||
|
||
// fork each pages of this module | ||
$page = preg_replace('/[^a-zA-Z0-9_-]/', '', @$_GET['page']); | ||
|
||
|
||
if( ! empty( $_GET['lib'] ) ) { | ||
// common libs (eg. altsys) | ||
$lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ; | ||
$page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ; | ||
|
||
if( file_exists( ICMS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) { | ||
include ICMS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ; | ||
} else if( file_exists( ICMS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) { | ||
include ICMS_TRUST_PATH.'/libs/'.$lib.'/index.php' ; | ||
} else { | ||
die( 'wrong request' ) ; | ||
} | ||
if (file_exists("$mytrustdirpath/admin/$page.php")) { | ||
include "$mytrustdirpath/admin/$page.php"; | ||
} else if (file_exists("$mytrustdirpath/admin/index.php")) { | ||
include "$mytrustdirpath/admin/index.php"; | ||
} else { | ||
// fork each pages of this module | ||
$page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ; | ||
|
||
if( file_exists( "$mytrustdirpath/admin/$page.php" ) ) { | ||
include "$mytrustdirpath/admin/$page.php" ; | ||
} else if( file_exists( "$mytrustdirpath/admin/index.php" ) ) { | ||
include "$mytrustdirpath/admin/index.php" ; | ||
} else { | ||
die( 'wrong request' ) ; | ||
} | ||
die('wrong request'); | ||
} | ||
|
||
?> |
Oops, something went wrong.