* Module loader script for detecting and displaying the correct module using the Dryden framework, this handles the autolaoding of classes. * @package zpanelx * @subpackage dryden -> core * @author Bobby Allen (ballen@bobbyallen.me) * @copyright ZPanel Project (http://www.zpanelcp.com/) * @link http://www.zpanelcp.com/ * @license GPL (http://www.gnu.org/licenses/gpl.html) */ global $starttime; $mtime = explode(' ', microtime()); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; $class_name = null; function __autoload($class_name) { $path = 'dryden/' . str_replace('_', '/', $class_name) . '.class.php'; if (file_exists($path)) { require_once $path; } } if (isset($_GET['module'])) { $CleanModuleName = fs_protector::SanitiseFolderName($_GET['module']); $ControlerPath = 'modules/' . $CleanModuleName . '/code/controller.ext.php'; if (file_exists($ControlerPath)) { require_once $ControlerPath; } $ModulePath = 'modules/' . $CleanModuleName . '/code/' . $class_name . '.class.php'; if (file_exists($ModulePath)) { require_once $ModulePath; } }
* @subpackage core -> api * @author Bobby Allen (ballen@bobbyallen.me) * @copyright ZPanel Project (http://www.zpanelcp.com/) * @link http://www.zpanelcp.com/ * @license GPL (http://www.gnu.org/licenses/gpl.html) */ $rawPath = str_replace("\\", "/", dirname(__FILE__)); $rootPath = str_replace("/bin", "/", $rawPath); chdir($rootPath); require_once 'dryden/loader.inc.php'; require_once 'cnf/db.php'; require_once 'inc/dbc.inc.php'; debug_phperrors::SetMode('dev'); if (file_exists('modules/' . fs_protector::SanitiseFolderName($_GET['m']) . '/code/webservice.ext.php')) { include 'modules/' . fs_protector::SanitiseFolderName($_GET['m']) . '/code/controller.ext.php'; include 'modules/' . fs_protector::SanitiseFolderName($_GET['m']) . '/code/webservice.ext.php'; $api = new webservice(); if ($api->wsdataarray['request'] == '') { $response_nomethod = new runtime_dataobject(); $response_nomethod->addItemValue('response', '1106'); $response_nomethod->addItemValue('content', 'No \'request\' method was recieved'); $api->SendResponse($response_nomethod->getDataObject()); die; } if ($api->CheckServerAPIKey()) { if (method_exists($api, $api->wsdataarray['request'])) { $api->SendResponse(call_user_func(array($api, '' . $api->wsdataarray['request'] . ''))); } else { $response_nomethod = new runtime_dataobject(); $response_nomethod = new runtime_dataobject(); $response_nomethod->addItemValue('response', '1102');
/** * Check the cache file for presents and valid/upto date Data * @author Sam Mottley (smottley@sentora.org) */ static function CheckFileCache($phpCode) { $currentCode = $phpCode; //Get the users current theme $userDetails = ctrl_users::GetUserDetail(); $userTheme = $userDetails['usertheme']; //The location of the cached php if (isset($_GET['module'])) { $location = ui_templateparser::$storageLocation . $userTheme . '/' . md5(fs_protector::SanitiseFolderName($_GET['module'])) . '.cache'; } else { $location = ui_templateparser::$storageLocation . $userTheme . '/' . md5('index') . '.cache'; } //check folder exists (First load of 10.1.0 and on new theme) $dirname = dirname($location); if (!is_dir($dirname)) { mkdir($dirname, 0755, true); } //check file exsists if not make, insert code else just get current code if (file_exists($location)) { $content = file_get_contents($location); } else { $handle = fopen($location, 'w'); file_put_contents($location, $phpCode, LOCK_EX); $content = $phpCode; } //check the file content is the same as the generated content then return file location if ($currentCode == $content) { return $location; } else { file_put_contents($location, $phpCode, LOCK_EX); return $location; } }