function GetServerStatus($xml)
{
    global $content;
    parseXMLFile($xml['serversite'][0]['serverdata'][0]['path'][0], "stats_startElement", "stats_endElement");
    if (time() > $content["STATISTICS"]["TIME"] + 60) {
        return false;
    } else {
        return true;
    }
}
function editTheme($cid)
{
    global $_DOCMAN;
    // disable the main menu to force user to use buttons
    $_REQUEST['hidemainmenu'] = 1;
    if (!$cid) {
        throw new Exception('Theme name not found');
    }
    $themes_path = $_DOCMAN->getPath('themes', $cid);
    $lists = array();
    $row = parseXMLFile(0, $themes_path . "themeDetails.xml");
    // published
    $published = $_DOCMAN->getCfg('icon_theme') == $cid ? 1 : 0;
    $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published);
    // get params definitions
    require $themes_path . 'themeConfig.php';
    $params = new dmParameters('', $themes_path . "themeDetails.xml", 'theme');
    $params->_params = new themeConfig();
    HTML_DMThemes::editTheme($row, $lists, $params);
}
Exemple #3
0
function editTheme($cid)
{
    global $_DOCMAN, $mosConfig_absolute_path;
    // disable the main menu to force user to use buttons
    $_REQUEST['hidemainmenu'] = 1;
    $themes_path = $_DOCMAN->getPath('themes', $cid);
    $lists = array();
    $row = parseXMLFile(0, $themes_path . "themeDetails.xml");
    // published
    $published = $_DOCMAN->getCfg('icon_theme') == $cid ? 1 : 0;
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $published);
    // get params definitions
    require $themes_path . "themeConfig.php";
    $params =& new dmParameters('', $themes_path . "themeDetails.xml", 'theme');
    $params->_params = new themeConfig();
    HTML_DMThemes::editTheme($row, $lists, $params);
}
Exemple #4
0
ProcessMonitor::start('some API import (this is only fake demo)');
$count = 0;
// this is how typical processing loop looks like
foreach ($filesList as $fileInfo) {
    // while debugging scripts which repeat some actions multiple times
    // reset process monitor timers in each loop
    pmr('some api call to import ' . $fileInfo['name']);
    // 1. step some api call
    runApiCallToGetXMLFile($fileInfo, $memoryLeakData);
    // pms is shortcut for ProcessMonitor::addSummary()
    // when processing can be split in several steps as in this case
    // it is very useful to track time and memory usage for each step separately
    // track api call time + download response time
    pms("get file {$fileInfo['name']} xml: " . ProcessMonitor::formatSize($fileInfo['size'] * 1000, ProcessMonitor::SIZE_AUTO) . " <a href='/examples/processMonitor.php?file={$fileInfo['name']}'>Run again &gt;&gt; </a>" . " <br/> see imported xml: <a href='/some_url/{$fileInfo['name']}' target='_blank'>" . $fileInfo['name'] . "</a>", null, 'time_api_call');
    // 2. step - parsing xml response
    parseXMLFile($fileInfo, $memoryLeakData);
    // track time to validate and parse xml
    pms('parsed ' . $fileInfo['name'], $fileInfo, 'time_parse');
    // 3. step - preparing and storing data to db, etc
    storeData($fileInfo, $memoryLeakData);
    // track time to process and store the data
    pms('processed ' . $fileInfo['name'], $fileInfo, 'time_processed');
    // intentionally condition for always true in this example
    if ($error = true) {
        // pme is shortcut to output error messages
        // you may include whatever data useful for debugging
        // for more variables to dump use array
        pme("Error description", ['some useful data']);
    }
    $count++;
}