From 1e8cab123d8b49fcc0694be604b068c5e47b631c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 6 Feb 2020 06:40:13 +0000 Subject: [PATCH] fixed source code for php74 compatibility --- codepot/README | 11 ++++++++++- codepot/src/codepot/models/coderepomodel.php | 15 ++++++++++----- codepot/src/codepot/models/subversionmodel.php | 4 ++-- codepot/src/system/libraries/Input.php | 4 ++-- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/codepot/README b/codepot/README index 268caec9..54a5fb72 100644 --- a/codepot/README +++ b/codepot/README @@ -83,7 +83,7 @@ INSTALLATION ON CENTOS database_username = "root" database_password = "" database_name = "codepot" - database_driver = "mysql" + database_driver = "mysqli" database_prefix = "" 5. Add a local user using the 'codepot-user' command. This command is used @@ -135,6 +135,15 @@ INSTALLATION ON CENTOS $ ls -lZd /var/cache/codepot drwxr-xr-x apache apache system_u:object_r:httpd_sys_content_t /var/cache/codepot + The following commands may help. + $ chcon -R -t httpd_sys_content_t /var/lib/codepot + $ chcon -R -t httpd_sys_content_t /var/cache/codepot + + + If it doesn't work with 'httpd_sys_content_t', you may require 'httpd_sys_content_rw_t'. + $ chcon -R -t httpd_sys_content_rw_t /var/lib/codepot + $ chcon -R -t httpd_sys_content_rw_t /var/cache/codepot + 10. If you have SELinux on in the enforcing mode, ensure to allow httpd to execute an external command. diff --git a/codepot/src/codepot/models/coderepomodel.php b/codepot/src/codepot/models/coderepomodel.php index ce6e25d8..b20c73af 100644 --- a/codepot/src/codepot/models/coderepomodel.php +++ b/codepot/src/codepot/models/coderepomodel.php @@ -19,7 +19,7 @@ class CodeRepoModel extends Model return $this->errmsg; } - function _scandir ($dir) + static function _scandir ($dir) { $files = array (); @@ -33,22 +33,27 @@ class CodeRepoModel extends Model return $files; } - function deleteDirectory($dir) + static function _deleteDirectory($dir) { if (is_link($dir)) return @unlink($dir); if (!file_exists($dir)) return TRUE; if (!is_dir($dir)) return @unlink($dir); - foreach ($this->_scandir($dir) as $item) + foreach (self::_scandir($dir) as $item) { if ($item == '.' || $item == '..') continue; - if ($this->deleteDirectory($dir . "/" . $item) === FALSE) + if (self::_deleteDirectory($dir . "/" . $item) === FALSE) { chmod($dir . "/" . $item, 0777); - if ($this->deleteDirectory($dir . "/" . $item) === FALSE) return FALSE; + if (self::deleteDirectory($dir . "/" . $item) === FALSE) return FALSE; }; } return rmdir($dir); } + + function deleteDirectory($dir) + { + return self::_deleteDirectory($dir); + } } diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 09c5dffe..b87453ea 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -867,7 +867,7 @@ class SubversionModel extends CodeRepoModel $listing[$index]["rev1lineno"] = 0; $listing[$index]["rev2lineno"] = 0; - $mod = $line{0}; + $mod = $line[0]; $line = rtrim(substr($line, 1), "\r\n"); if ($ent) $line = replaceEntities($line, $rep); @@ -2247,7 +2247,7 @@ class SubversionModel extends CodeRepoModel static function deleteRepo ($projectid, $repodir) { - return $this->deleteDirectory("{$repodir}/{$projectid}"); + return self::_deleteDirectory("{$repodir}/{$projectid}"); } } diff --git a/codepot/src/system/libraries/Input.php b/codepot/src/system/libraries/Input.php index b3bf7eaa..e41cc5ac 100644 --- a/codepot/src/system/libraries/Input.php +++ b/codepot/src/system/libraries/Input.php @@ -179,7 +179,7 @@ class CI_Input { } // We strip slashes if magic quotes is on to keep things consistent - if (get_magic_quotes_gpc()) + if ((!defined('PHP_MAJOR_VERSION') || (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION < 7)) && get_magic_quotes_gpc()) { $str = stripslashes($str); } @@ -1064,4 +1064,4 @@ class CI_Input { // END Input class /* End of file Input.php */ -/* Location: ./system/libraries/Input.php */ \ No newline at end of file +/* Location: ./system/libraries/Input.php */