<?php require_once 'pm/Loader.php'; pm_Loader::registerAutoload(); pm_Bootstrap::init(); pm_Context::init('panel-stats'); if (pm_Settings::get('useAuth') && @$_GET['authToken'] != pm_Settings::get('authToken')) { die('Invalid auth token supplied.'); } $reporter = new Modules_PanelStats_Reporter(); $format = isset($_GET['format']) ? $_GET['format'] : 'xml'; if ('plain' == $format) { echo $reporter->getResultsPlain(); } else { if ('json' == $format) { header("Content-Type: application/json"); echo $reporter->getResultsJson(); } else { header("Content-Type: text/xml"); echo $reporter->getResultsXml(); } }
<?php pm_Context::init('example'); if (false !== ($upgrade = array_search('upgrade', $argv))) { $upgradeVersion = $argv[$upgrade + 1]; echo "upgrading from version {$upgradeVersion}\n"; if (version_compare($upgradeVersion, '1.2') < 0) { pm_Bootstrap::init(); $id = pm_Bootstrap::getDbAdapter()->fetchOne("select val from misc where param = 'moduleExampleCustomButton'"); pm_Bootstrap::getDbAdapter()->delete('misc', array("param = 'moduleExampleCustomButton'")); pm_Settings::set('customButtonId', $id); } echo "done\n"; exit(0); } $iconPath = rtrim(pm_Context::getHtdocsDir(), '/') . '/images/icon_16.gif'; $baseUrl = pm_Context::getBaseUrl(); $request = <<<APICALL <ui> <create-custombutton> <owner> <admin/> </owner> <properties> <file>{$iconPath}</file> <internal>true</internal> <noframe>true</noframe> <place>navigation</place> <url>{$baseUrl}</url> <text>Example Module</text> </properties>