From ee21903e009320d8bb3c482fffc75a2c065aa4b6 Mon Sep 17 00:00:00 2001 From: Abdulrahman Date: Sat, 18 May 2019 16:58:43 +0300 Subject: [PATCH] fix serve.php (overwritten on update!) --- includes/functions.php | 48 +++++++++++++++++++++--------------------- serve.php | 13 +++++++----- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 2732941..43085a7 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -1642,7 +1642,17 @@ function p($name, $type = 'str', $default = '') */ function add_to_serve_rules($rules, $unique_id = '') { - $current_serve_content = file_get_contents(PATH . 'serve.php'); + if(! file_exists(PATH . 'plugins_rules.php')) + { + if(! is_writable(PATH)) + { + chmod(PATH, K_DIR_CHMOD); + } + + file_put_contents(PATH . 'plugins_rules.php', ' ['file' => 'ucp.php', 'args' => 'go=fileuser&id=$1&page=$2'], // #for future plugins '^go-(.*).html$' => ['file' => 'go.php', 'args' => 'go=$1'], - - //---------> - //don't remove the next line ever. - //end_kleeja_rewrites_rules# - //<--------- ]; + +if (file_exists('plugins_rules.php')) +{ + $plugins_rules = include_once 'plugins_rules.php'; + $rules = array_merge($rules, $plugins_rules); +} + + $request_uri = trim(strtok($_SERVER['REQUEST_URI'], '?'), '/');