Esempio n. 1
0
            $Query = "INSERT INTO plugin_svntracker_data_master " . "(holder_id, svn_date, log_text, file, prev_version, " . "actual_version, author)" . " VALUES ('" . $HolderID . "','" . $Config['SvnDate'] . "','" . $Config['Log'] . "','" . $Config['FileName'] . "','" . $Config['PrevVersion'] . "','" . $Config['ActualVersion'] . "','" . $Config['UserName'] . "')";
            $DBRes = db_query($Query);
            if (!$DBRes) {
                db_rollback();
            } else {
                db_commit();
            }
        }
    }
    if ($Rows > 1) {
        $return['Error'] .= "Unknown problem adding Task:{$Num}.";
    }
    return $return;
}
foreach ($Configs as $Config) {
    $Result = parseConfig(&$Config);
    if ($Result['check'] == false) {
        exit_error('Check_error', $Result['error']);
    }
    if (!is_null($Config['ArtifactNumbers'])) {
        foreach ($Config['ArtifactNumbers'] as $Num) {
            $AddResult = addArtifactLog($Config, $Result['group_id'], $Num);
            if (isset($AddResult['Error'])) {
                exit_error('Adding ArtifactNumber', $AddResult['Error']);
            }
        }
    }
    if (!is_null($Config['TaskNumbers'])) {
        foreach ($Config['TaskNumbers'] as $Num) {
            $AddResult = addTaskLog($Config, $Result['group_id'], $Num);
            if (isset($AddResult['Error'])) {
Esempio n. 2
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
if (parseConfig() == NO_WRITE_PERMISION) {
    echo translate("Plugin WIRIS Installer hasn't write permisions on"), ' ./wrs_config.php<br /><br />';
    echo errorMessage('conf');
} else {
    echo '<form name="installerForm" action="./install.php" method="POST">';
    echo '<input type="hidden" name="step" value="5" />';
    echo '<input type="hidden" name="language" value="', addSlashesOnDoubleQuotes($shortLanguageName), '" />';
    echo translate('Plugin WIRIS installation has been completed.'), '<br /><br />';
    echo translate('Important! Now, you must manually activate WIRIS filter in your moodle setup'), ':<br /><br />';
    echo translate('For'), ' moodle 1.6.5, ', translate('go to'), '<b>Administration &gt; Configuration &gt; Filters</b>.<br />';
    echo translate('For'), ' moodle >= 1.7, ', translate('go to'), '<b>Administration &gt; Modules &gt; Filters</b>.<br /><br />';
    echo translate('Then, check WIRIS filter as like this'), ':<br />';
    echo '<img src="./install/img/filter.jpeg" /><br /><br />';
    echo '<input type="checkbox" id="activated" />', translate("I've just activated WIRIS"), '<br /><br />';
    echo '
	<script type="text/javascript">
		function submitForm() {
			if (document.getElementById("activated").checked) {
				document.installerForm.submit();
			}
			else {
				alert("', translate('Important! Now, you must manually activate WIRIS filter in your moodle setup'), '");
			}
		}
	</script>';
    echo '<input type="button" value="', addSlashesOnDoubleQuotes(translate('Continue')), '" onclick="submitForm();" />';
Esempio n. 3
0
            fclose($fp);
            // Close the buffer and send the remaining contents to the browser
            ob_end_flush();
        }
    }
}
// ------------------------------------------------- controler part of script
// Get the default config
$config = defaultConfig();
// Check first for genconfig before we try to parseConfig
if ($argv[1] == 'genconfig') {
    genConfig();
    exit;
}
// Parse the user's config
$config = parseConfig($config['configfile'], $config);
// Main Controler
if ($_REQUEST['rss'] !== NULL or $argv[1] == 'rss') {
    // Run rss()
    // Create instance of cache class.
    $cache = new cache('rss.xml', $config);
    // Start the caching engine
    $cache->start();
    // Do the actuall rss function
    rss();
    // End the rss engine
    $cache->end();
} else {
    if ($argv[1] == 'setstatus') {
        genStatusUpdate();
    } else {
Esempio n. 4
0
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
//require_once($config_dir . '/config.php');
require_once '/export/servers/' . $v_path . '/PhpCodeFactory/code/parseConfig.php';
$tDtl = array();
$tDtl['IP'] = $agentip;
$tDtl['PORT'] = $agentport;
$tDtl['TOKEN'] = $accesstoken;
parseConfig($cfg, $tDtl);
if ($php_dir != null) {
    TPL2CODE::buildDTCfg($tDtl, $php_dir, $v_path);
    TPL2CODE::buildDTCPHP($tDtl, $php_dir, $v_path);
    var_dump(TPL2CODE::$errMsg);
}
if ($java_dir != null) {
    TPL2CODE::buildDTCfg($tDtl, $java_dir, $v_path);
    TPL2CODE::buildDTCJAVA($tDtl, $java_dir, $v_path);
    var_dump(TPL2CODE::$errMsg);
}
if ($cplus_dir != null) {
    TPL2CODE::buildDTCfg($tDtl, $cplus_dir, $v_path);
    TPL2CODE::buildDTCCplus($tDtl, $cplus_dir, $v_path);
    var_dump(TPL2CODE::$errMsg);
}
Esempio n. 5
0
function loadConfig()
{
    $file = './conf.ini.php';
    $conf = parseConfig($file);
    $_SERVER['SOLAR_CONFIG'] = $conf;
}
Esempio n. 6
0
require_once SM_PATH . 'include/validate.php';
require_once SM_PATH . 'plugins/administrator/defines.php';
require_once SM_PATH . 'plugins/administrator/auth.php';
global $data_dir, $username;
if (!adm_check_user()) {
    header('Location: ' . SM_PATH . 'src/options.php');
    exit;
}
displayPageHeader($color, 'None');
$newcfg = array();
foreach ($defcfg as $key => $def) {
    $newcfg[$key] = '';
}
$cfgfile = SM_PATH . 'config/config.php';
parseConfig(SM_PATH . 'config/config_default.php');
parseConfig($cfgfile);
$colapse = array('Titles' => 'off', 'Group1' => getPref($data_dir, $username, 'adm_Group1', 'off'), 'Group2' => getPref($data_dir, $username, 'adm_Group2', 'on'), 'Group3' => getPref($data_dir, $username, 'adm_Group3', 'on'), 'Group4' => getPref($data_dir, $username, 'adm_Group4', 'on'), 'Group5' => getPref($data_dir, $username, 'adm_Group5', 'on'), 'Group6' => getPref($data_dir, $username, 'adm_Group6', 'on'), 'Group7' => getPref($data_dir, $username, 'adm_Group7', 'on'), 'Group8' => getPref($data_dir, $username, 'adm_Group8', 'on'), 'Group9' => getPref($data_dir, $username, 'adm_Group9', 'on'), 'Group10' => getPref($data_dir, $username, 'adm_Group10', 'on'));
/* look in $_GET array for 'switch' */
if (sqgetGlobalVar('switch', $switch, SQ_GET)) {
    if ($colapse[$switch] == 'on') {
        $colapse[$switch] = 'off';
    } else {
        $colapse[$switch] = 'on';
    }
    setPref($data_dir, $username, "adm_{$switch}", $colapse[$switch]);
}
echo '<form action="options.php" method="post" name="options">' . '<center><table width="95%" bgcolor="' . $color[5] . '"><tr><td>' . '<table width="100%" cellspacing="0" bgcolor="' . $color[4] . '">' . '<tr bgcolor="' . $color[5] . '"><th colspan="2">' . _("Configuration Administrator") . '</th></tr>' . '<tr bgcolor="' . $color[5] . '"><td colspan="2" align="center"><small>' . _("Note: it is recommended that you configure your system using conf.pl, and not this plugin. conf.pl contains additional information regarding the purpose of variables and appropriate values, as well as additional verification steps.") . '<br />' . _("Run or consult conf.pl should you run into difficulty with your configuration.") . '</small></td></tr>';
$act_grp = 'Titles';
/* Active group */
foreach ($newcfg as $k => $v) {
    $l = strtolower($v);
Esempio n. 7
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
if (parseConfig() == NO_WRITE_PERMISION) {
    echo utf8_htmlentities(translate('WIRIS Quizzes installer hasn\'t write permisions on')), ' ./wrsqz_config.php <br />';
    echo '<ul><li>', utf8_htmlentities(translate('Copy the following PHP file and paste to')), ' <b>wiris-quizzes/wrsqz_config.php</b>', '</li></ul>';
    echo '<div id="information">';
    echo str_replace("\n", "<br />", utf8_htmlentities(parseConfig(true)));
    echo '</div>';
    echo '<br />';
    echo '<form action="./install.php" method="POST">';
    echo '<input type="hidden" name="language" value="', utf8_htmlentities($shortLanguageName), '" />';
    echo '<input type="hidden" name="step" value="5">';
    echo '<input type="submit" value="Continue" />';
    echo '</form>';
    echo '<br /><br /><hr>';
    echo errorMessage('conf');
} else {
    echo '<div align="left"><br /><ul><li><i>wrsqz_config.php</i> ', utf8_htmlentities(translate('successfully created.')), '</li></ul></div>';
    include './install/pages/5.php';
}
Esempio n. 8
0
/**
 * Currently, this function does nothing more than return getContent().
 * It exists in case we run into a situation where we need to do some special
 * processing befor or after calling getContent().
 *
 * @param SimpleXMLElement $inputXML
 *
 * @return string
 * @author Andrew Darwin <*****@*****.**>
 */
function getInnerContent($inputXML)
{
    global $contentXML;
    $header = "getInnerContent(): ";
    logMessage("{$header} Attempting to get inner content");
    parseConfig();
    // Must parse config first to set global variables
    initializeContent($inputXML);
    $output = "<html>\n<head>\n";
    $output = $output . getAllScriptDeclarations();
    $output = $output . "</head>\n<body>\n";
    $output = $output . getContent($contentXML->content[0], "");
    $output = $output . "</body>\n</html>";
    //logMessage("$header $output");
    return $output;
}
Esempio n. 9
0
    foreach ($contentArray as $row) {
        fputcsv($fp, $row, $delimiter);
    }
    fclose($fp);
    return true;
}
function saveJSON($filename, $outputDirectory, $content)
{
    $fp = fopen($outputDirectory . '/' . $filename, 'w');
    fwrite($fp, $content);
    fclose($fp);
    return true;
}
$cliArgs = parseArgs($argc, $argv);
$configFile = $cliArgs['config'];
$config = parseConfig($configFile);
$analytics = getService($config['emailAddress'], $config['keyFileLocation']);
$profile = getFirstProfileId($analytics);
$events = getTotalEvents($analytics, $profile, $config);
$profileName = $events->getProfileInfo()->getProfileName();
$dateFetching = date('Y-m-d H:i:s');
echo info("VIEW: " . $profileName . "\n");
echo info("OUTPUT: " . $config['outputFormat'] . "\n");
$headers = array();
foreach ($events->getColumnHeaders() as $header) {
    $headers[] = $header['name'];
}
$rows = $events->getRows();
if (!count($rows)) {
    echo error("No data found\n");
    exit;
Esempio n. 10
0
/**
 * Parses the rsnapshot configuration file (and any `include_conf` files for specific rsnapshot
 * directives and hidden plugin configuration directives.
 *
 *
 * Possible *hidden* Nagios Plugin Configuration Directives
 *
 * Configuration directives for this plugin can be placed in comments on lines starting `#NAGIOS`.
 *
 * `$KEY` below is the token following a `backup` directive
 *
 * Here are what we look for now:
 *
 * Settings for minimum file count check.
 *
 *     #NAGIOS $KEY MINFILES x1 x2
 *     x1 minimum file count for warning state.
 *     x2 minimum file count for critical state.
 *
 * Settings for minimum backup size test.
 *
 *     #NAGIOS $KEY MINSIZE y1 y2
 *     y1 minimum backup size for warning state.
 *     y2 minimum backup size for critical state.
 *
 * Settings for time stamp check.
 *
 *     #NAGIOS $KEY TIMESTAMP $FILE z1 z2
 *     $FILE - specific file name which can be found in the snapshot_root/$retention_period.0/$bupname
 *          directory and containing a UNIX timestamp value.
 *     z1 minimum time interval from now for warning state (default: rentention period time as defined in $periods above).
 *     z2 minimum time interval from now for error state  (default: 2 x rentention period time as defined in $periods above).
 *
 * Setting an alias allows the plugin to print the alias in any messages rather than the unwieldy backup string
 *
 *     #NAGIOS $key ALIAS alias
 *
 * Overriding time period values as defined in `$periods` above
 *
 *     #NAGIOS TPERIOD period val
 *     period time period name to override.
 *     val new value
 *
 * If $key is `DEFAULT` then it will be stored as a default option and these default
 * options will be used for all backups unless whey have defined their own options.
 *
 * @param string $confFile The configuration file to parse
 * @return void
 */
function parseConfig($confFile, $primary = true)
{
    global $cmdargs, $periods;
    $fp = fopen($confFile, 'r');
    if (!$fp) {
        _log(sprintf("Configuration file [%s] does not exist or cannot be read.", $confFile), LOG__ERROR);
        exit(STATUS_UNKNOWN);
    }
    _log(sprintf("PARSING CONF: opened config file: %s", $confFile), LOG__DEBUG);
    while (($buffer = fgets($fp, 4096)) !== false) {
        $tokens = parseConfigurationLine($buffer);
        if (count($tokens) < 2) {
            continue;
        }
        switch ($tokens[0]) {
            case "include_conf":
                _log(sprintf("PARSING CONF: recursively parsing included config file: %s", $tokens[1]), LOG__DEBUG);
                parseConfig($tokens[1], false);
                break;
            case "config_version":
                if ($tokens[1] != $cmdargs['config_version']) {
                    _log("WARNING: Configuration version is different from that supported by script.", LOG__ERROR);
                }
                _log(sprintf("PARSING CONF: found configuration file version: %s", $tokens[1]), LOG__DEBUG);
                $cmdargs["version"] = $tokens[1];
                break;
            case "retain":
            case "interval":
                _log(sprintf("PARSING CONF: found retention period: %s => %s", $tokens[1], $tokens[2]), LOG__DEBUG);
                $cmdargs["retain"][$tokens[1]] = $tokens[2];
                break;
            case "snapshot_root":
                if (substr($tokens[1], -1) != '/') {
                    $tokens[1] .= '/';
                }
                _log(sprintf("PARSING CONF: found snapshot root %s", $tokens[1]), LOG__DEBUG);
                $cmdargs["snapshot_root"] = $tokens[1];
                break;
            case "logfile":
                _log(sprintf("PARSING CONF: found log file %s", $tokens[1]), LOG__DEBUG);
                $cmdargs["logfile"] = $tokens[1];
                break;
            case "backup":
                array_shift($tokens);
                _log(sprintf("PARSING CONF: found backup: %s", implode(' ', $tokens)), LOG__DEBUG);
                $cmdargs["backup"][] = $tokens;
                break;
            case "backup_script":
                array_shift($tokens);
                _log(sprintf("PARSING CONF: found backup_script: %s", implode(' ', $tokens)), LOG__DEBUG);
                $cmdargs["backup"][] = $tokens;
                break;
            case "#NAGIOS":
                if ($tokens[1] == "TPERIOD") {
                    _log(sprintf("PARSING CONF: found plugin config directive TPERIOD: %s => %s", $tokens[2], $tokens[3]), LOG__DEBUG);
                    $periods[$tokens[2]] = $tokens[3];
                } else {
                    if ($tokens[2] == "ALIAS") {
                        _log(sprintf("PARSING CONF: found plugin config directive ALIAS for %s: %s => %s", $tokens[1], $tokens[2], $tokens[3]), LOG__DEBUG);
                        $cmdargs["nagios"][$tokens[1]][$tokens[2]] = $tokens[3];
                    } else {
                        if ($tokens[1] == "FIRSTRUN") {
                            _log(sprintf("PARSING CONF: found plugin config directive FIRSTRUN: %s", date('Y-m-d H:i:s', $tokens[2])), LOG__DEBUG);
                            $cmdargs[$tokens[1]] = $tokens[2];
                        } else {
                            array_shift($tokens);
                            $a = array_shift($tokens);
                            $b = array_shift($tokens);
                            _log(sprintf("PARSING CONF: found plugin config directive %s: %s", $a, $b), LOG__DEBUG);
                            $cmdargs["nagios"][$a][$b] = $tokens;
                        }
                    }
                }
                break;
            default:
                // ignored directive
                break;
        }
    }
    fclose($fp);
    if ($primary && !isset($cmdargs['FIRSTRUN'])) {
        $fp = fopen($confFile, 'a');
        if ($fp) {
            $cmdargs['FIRSTRUN'] = mktime();
            fwrite($fp, "\n\n# Added by Nagios check_rsnapshot.php and is required for directory creation checks\n");
            fwrite($fp, "# plugin first run at " . date('Y-m-d H:i:s') . "\n");
            fwrite($fp, "#NAGIOS\tFIRSTRUN\t" . mktime() . "\n\n");
            fclose($fp);
        } else {
            $cmdarg['FIRSTRUN'] = false;
            _log("Need write access to configuration file to set FIRSTRUN paramater. Directory creation checks will not work without this.", LOG__ERROR);
        }
    }
}
Esempio n. 11
0
function getAutoLoginToken()
{
    $user = '';
    $passhash = '';
    $config = parseConfig();
    if (is_array($config)) {
        if (array_key_exists('username', $config)) {
            $user = $config['username'];
        }
        if (array_key_exists('password', $config)) {
            $passhash = getPasswordHash($config['password']);
        } else {
            if (array_key_exists('hashedpassword', $config)) {
                $passhash = $config['hashedpassword'];
            }
        }
    }
    date_default_timezone_set("UTC");
    $date = date("Y/m/d  H:i:s");
    $data = $user . "|" . $passhash . "|" . $date;
    return array("user" => $user, "session" => strtoupper(base64_encode(hash_hmac("sha1", $data, $passhash, true))), "date" => $date, "dname" => getDevicename());
}
include VOIPCONFIGELEMENTSDIR . "VOIPConfig.php";
include VOIPCONFIGELEMENTSDIR . "VOIPInboundRoute.php";
include VOIPCONFIGELEMENTSDIR . "VOIPOutboundRoute.php";
include VOIPCONFIGELEMENTSDIR . "VOIPQueue.php";
include VOIPCONFIGELEMENTSDIR . "VOIPRingGroup.php";
include VOIPCONFIGELEMENTSDIR . "VOIPTrunk.php";
include VOIPCONFIGELEMENTSDIR . "VOIPUser.php";
include VOIPCONFIGELEMENTSDIR . "VOIPChannelMap.php";
include VOIPCONFIGELEMENTSDIR . "VOIPSound.php";
include VOIPCONFIGELEMENTSDIR . "VOIPURA.php";
include VOIPCONFIGELEMENTSDIR . "VOIPRecording.php";
include VOIPCONFIGELEMENTSDIR . "VOIPAnnounce.php";
include VOIPCONFIGELEMENTSDIR . "VOIPMiscApp.php";
error_reporting(E_ALL);
$errors = array();
$config = parseConfig("myvoip", "127.0.0.1");
function parseConfig($basename, $server)
{
    $xmlfile = '/etc/voip/voipconfig.xml';
    $xlsfile = dirname(__FILE__) . DIRECTORY_SEPARATOR . $basename;
    if (!file_exists($xmlfile)) {
        VOIPXMLConfiguredElement::error("Can't find {$xmlfile}.");
    }
    $config = new VOIPConfig(new SimpleXMLElement(file_get_contents($xmlfile)));
    $config->findRefs();
    if (createExcel()) {
        $objPHPExcel = phpexcel_createPHPExcelObject();
        $objPHPExcel->getProperties()->setCreator("freePbxConfig - MEVOIP - {$basename}")->setLastModifiedBy("freePbxConfig - MEVOIP - {$basename}")->setTitle("freePbxConfig - MEVOIP - {$basename}")->setSubject("freePbxConfig - MEVOIP - {$basename}")->setDescription("freePbxConfig - MEVOIP - {$basename}")->setKeywords("freePbxConfig - MEVOIP - {$basename}")->setCategory("freePbxConfig - MEVOIP - {$basename}");
        $s = $objPHPExcel->setActiveSheetIndex(0);
        $objPHPExcel->getActiveSheet()->setTitle('VOIP PABX');
        $objPHPExcel->getDefaultStyle()->getFont()->setName('Tahoma');