Exemple #1
0
 /**
  * updateModuleSettings
  *
  * Called by modulesettings to read settings back in after changes...
  *
  */
 public static function updateModuleSettings()
 {
     LoadModules::setSettings('general', parse_ini_file(APP_PATH . '/config/' . self::$settings_ini, true));
     //generate list of all modules
     LoadUtility::generateExtensionList('plugins', self::$_plugins);
     //load all charting modules that are enabled
     LoadUtility::loadExtensions('plugins', self::$_settings, self::$_classes, self::$_plugins);
 }
Exemple #2
0
function loadElectionModules($httpRawPostData, $electionIdPlace)
{
    // getpermission: $reqdecoded['electionId']
    global $dbInfos, $numVerifyBallots, $numSignBallots, $pServerKeys, $serverkey, $numAllBallots, $numPSigsRequiered;
    $dbElections = new DbElections($dbInfos);
    $reqdecoded = json_decode($httpRawPostData, true);
    if ($reqdecoded == null) {
        WrongRequestException::throwException(7040, 'Data in JSON format expected', 'got: ' . $HTTP_RAW_POST_DATA);
    }
    //	if (! isset($electionIdPlace($reqdecoded))) 	WrongRequestException::throwException(7010, 'Election id missing in client request'	, $httpRawPostData);
    if (!is_string($electionIdPlace($reqdecoded))) {
        WrongRequestException::throwException(7050, 'Election id must be a string', 'got: ' . print_r($reqdecoded['electionId'], true));
    }
    // load election config from database by election id
    $completeElectionId = $electionIdPlace($reqdecoded);
    $splittedElectionId = json_decode($completeElectionId);
    if ($splittedElectionId == null) {
        $mainElectionId = $completeElectionId;
    } else {
        $mainElectionId = $splittedElectionId->mainElectionId;
    }
    $elconfig = $dbElections->loadElectionConfigFromElectionId($mainElectionId);
    if (count($elconfig) < 1) {
        WrongRequestException::throwException(7000, 'Election id not found in server database', "ElectionId you sent: " . $reqdecoded['electionId']);
    }
    if (!isset($elconfig['auth'])) {
        WrongRequestException::throwException(7020, 'element auth not found in election config', "ElectionId you sent: " . $reqdecoded['electionId']);
    }
    $auth = LoadModules::laodAuthModule($elconfig['auth']);
    if (isset($elconfig['authConfig'])) {
        $auth->setup($elconfig["electionId"], $elconfig['authConfig']);
    }
    // TODO think about: should Election be any Election or just the blinding module?
    $blinder = LoadModules::loadBlinder($elconfig['blinding'], $elconfig, $auth);
    $blinder->tally = LoadModules::loadTally($elconfig['tally'], $blinder);
    // TODO use a different private key for tallying server
    $blinder->tally->setup($elconfig);
    return $blinder;
}
Exemple #3
0
* Hardware/CPU links
* 
* @version SVN: $Id$
* @link https://github.com/loadavg/loadavg
* @author Karsten Becker
* @copyright 2014 Sputnik7
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
?>


<?php 
//get date range links for header here
$links = LoadModules::getRangeLinks();
//get settings for this module
$modSettings = LoadModules::$_settings->{$module};
//get the display_limiting setting from the settings subsection for this module
$thedata = $modSettings['settings']['display_limiting'];
//if we are changing mode
if (isset($_GET['diskmode']) || !empty($_GET['diskmode'])) {
    $newmode = $_GET['diskmode'];
    switch ($newmode) {
        case "true":
            $mydata['settings']['display_limiting'] = "true";
            $mergedsettings = LoadUtility::ini_merge($modSettings, $mydata);
            LoadUtility::write_module_ini($mergedsettings, $module);
            header("Location: " . $links);
            break;
        case "false":
Exemple #4
0
    //set url for callback - see end of chartcore.php in lib.charts
    //get plugin url for callbacks - needs cleaning up
    $host_url = LoadUtility::get_module_url();
    //if we have a log file selected override callback
    if ($gotLogDate) {
        $callback = $host_url . 'page=Process&logdate=' . $logDate . '&timestamp=';
    } else {
        $callback = $host_url . 'page=Process&timestamp=';
    }
    //render chart
    //get plugin settings for chart to display
    $chartToShow = $pluginSettings['settings']['display_chart'];
    //contains args[] array from modules .ini file
    //echo 'showing ' . $showChart;
    //LoadModules::renderChart("Cpu", false, false, false, $callback, 770 );
    LoadModules::renderChart($chartToShow, false, false, false, $callback, 770);
    ?>
		</div>

		<?php 
    // get and parse process data here
    // to view on your system in console:
    // ps -Ao %cpu,%mem,pid,user,comm,args | sort -r -k1 | less
    //grab process data from log file for timeStamp
    $data = false;
    $gotLog = false;
    if ($timeStamp) {
        //echo '<pre>'; 'got timestamp checking for data';
        $data = $process->fetchProcessLogData($timeStamp, $logDate);
        //var_dump ($data);
        //echo '</pre>';
Exemple #5
0
     $newconfig["electionTitle"] = $electionconfig['electionTitle'];
 } else {
     $newconfig["electionTitle"] = $electionId;
 }
 //		$authm = LoadModules::laodAuthModule($electionconfig['auth']);
 global $dbInfos;
 $authm = new SharedAuth($dbInfos);
 $authTmp = $authm->handleNewElectionReq($electionId, $electionconfig);
 $newconfig['authConfig'] = $authTmp['authConfig'];
 $newconfig["auth"] = $authTmp['auth'];
 // blinder
 $newconfig['blinding'] = 'blindedVoter';
 global $numVerifyBallots, $numSignBallots, $pServerKeys, $serverkey, $numAllBallots, $numPSigsRequiered;
 $blinder = new BlindedVoter($electionId, $numVerifyBallots, $numSignBallots, $pServerKeys, $serverkey, $numAllBallots, $numPSigsRequiered, $dbInfos, $authm);
 // tally
 $tallym = LoadModules::loadTally($electionconfig['tally'], $blinder);
 $newconfig['tally'] = constant(get_class($tallym) . '::name');
 //		$newconfig['tallyData'] = $tallym->handleNewElectionReq($electionId, $authm, $blinder, $electionconfig['tallyData']);
 // $this->subTally->handleNewElectionReq($req['subTallyData']);
 if (!isset($electionconfig["questions"]) || !is_array($electionconfig["questions"])) {
     WrongRequestException::throwException(2146, 'Request must contain an array of questions', print_r($electionconfig, true));
 }
 foreach ($electionconfig['questions'] as $i => $question) {
     $completeElectionId = json_encode(array('mainElectionId' => $electionId, 'subElectionId' => $question['questionID']));
     //			$subAuthConf = $authm->newSubElection($completeElectionId);
     $subBlinderConf = $blinder->handleNewElectionReq($completeElectionId);
     $subTallyConf = $tallym->handleNewElectionReq($completeElectionId, $authm, $blinder, $question);
     $ret[$i] = array('questionID' => $question['questionID'], 'questionWording' => $question['questionWording'], 'blinderData' => $subBlinderConf, 'tallyData' => $subTallyConf);
     if (isset($question['options'])) {
         $ret[$i]['options'] = $question['options'];
     }
Exemple #6
0
 function newElection($electionId, $subAuth, $subAuthData)
 {
     // $this->db->newElection($electionId, $subAuthModule);
     $this->subAuth = $subAuth;
     $this->subAuthData = $subAuthData;
     $this->subAuthModule = LoadModules::laodAuthModule($subAuth);
     $subAuthRet = $this->subAuthModule->handleNewElectionReq($electionId, $subAuthData);
     return array('auth' => $subAuth, 'authConfig' => $subAuthRet);
 }