/**
  * Generate a new API key and add it to the database. 
  */
 static function doGenerate()
 {
     $new_random_key = sha1(rand() . ctrl_options::GetOption('server_ip'));
     ctrl_options::SetSystemOption('apikey', $new_random_key);
     self::$updated = true;
     return true;
 }
Пример #2
0
function CheckZPanelLatestVersion()
{
    // Grab the latest version of ZPanel from the ZPanel API servers and cache it into the database.
    $live_version = ws_generic::ReadURLRequestResult(ctrl_options::GetSystemOption('update_url'));
    if (!$live_version) {
        return false;
    }
    $versionnumber = ws_generic::JSONToArray($live_version);
    ctrl_options::SetSystemOption('latestzpversion', $versionnumber[0]['version']);
    return true;
}
Пример #3
0
function CheckMADminLatestVersion()
{
    // Grab the latest version of MADmin from the MADmin API servers and cache it into the database.
    $live_version = ws_generic::ReadURLRequestResult(ctrl_options::GetSystemOption('update_url'));
    if (!$live_version) {
        return false;
    }
    $versionnumber = ws_generic::JSONToArray($live_version);
    # MADmin API returns simple object not in an array like it was for zpanel.
    #    if(count($versionnumber) > 1) {
    #        $currentVersionSetting = current($versionnumber);
    #        $currentVersion = $currentVersionSetting['version'];
    #    } else {
    $currentVersion = $versionnumber['version'];
    #    }
    ctrl_options::SetSystemOption('latestzpversion', $currentVersion);
    return true;
}
Пример #4
0
    ctrl_options::SetSystemOption('daemon_hourrun', time());
    runtime_hook::Execute("OnStartDaemonHour");
    runtime_hook::Execute("OnDaemonHour");
    runtime_hook::Execute("OnEndDaemonHour");
}
if (time() >= ctrl_options::GetSystemOption('daemon_dayrun') + 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_dayrun', time());
    runtime_hook::Execute("OnStartDaemonDay");
    runtime_hook::Execute("OnDaemonDay");
    runtime_hook::Execute("OnEndDaemonDay");
}
if (time() >= ctrl_options::GetSystemOption('daemon_weekrun') + 7 * 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_weekrun', time());
    runtime_hook::Execute("OnStartDaemonWeek");
    runtime_hook::Execute("OnDaemonWeek");
    runtime_hook::Execute("OnEndDaemonWeek");
}
if (time() >= ctrl_options::GetSystemOption('daemon_monthrun') + 30 * 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_monthrun', time());
    runtime_hook::Execute("OnStartDaemonMonth");
    runtime_hook::Execute("OnDaemonMonth");
    runtime_hook::Execute("OnEndDaemonMonth");
}
echo "\nDaemon run complete! (" . date($dateformat) . ")\n";
ctrl_options::SetSystemOption('daemon_lastrun', time());
$daemonLog->detail = "Daemon execution completed!";
$daemonLog->writeLog();
if (!runtime_controller::IsCLI()) {
    echo "</pre>";
}
exit;
Пример #5
0
 function checkVersion($whmcs_version = null)
 {
     $version = module_controller::getVersion();
     if (empty($whmcs_version)) {
         $request_data = $this->XMLDataToArray($this->wsdata);
         $ctags = $request_data['xmws']['content'];
         $whmcs_version = $ctags['whmcs_version'];
     }
     $dataobject = new runtime_dataobject();
     $dataobject->addItemValue('response', '');
     if ((int) $version != (int) $whmcs_version) {
         $dataobject->addItemValue('content', ws_xmws::NewXMLTag('pass', 'false'));
         //check database if this is first time
         $alreadyReported = ctrl_options::GetSystemOption('whmcs_reported');
         if ($alreadyReported == 'false') {
             //if so then update database
             ctrl_options::SetSystemOption('whmcs_reported', $ctags['whmcs_version']);
             //then send email to admins if possible
             $sendemail = ctrl_options::GetSystemOption('whmcs_sendemail_bo');
             if ($sendemail == 'true') {
                 module_controller::sendBadVersionMail($ctags['whmcs_version']);
             }
         }
     } else {
         $alreadyReported = ctrl_options::GetSystemOption('whmcs_reported');
         if ($alreadyReported != 'false') {
             ctrl_options::SetSystemOption('whmcs_reported', 'false');
         }
         $dataobject->addItemValue('content', ws_xmws::NewXMLTag('pass', 'true'));
     }
     return $dataobject->getDataObject();
 }
Пример #6
0
 /**
  * Accepts Admin settings form
  * @return null
  */
 static function doUpdateSettings()
 {
     global $controller;
     runtime_csfr::Protect();
     $form = $controller->GetAllControllerRequests('FORM');
     if (!isset($form['inAdminSettings'])) {
         return false;
     }
     ctrl_options::SetSystemOption('whmcs_sendemail_bo', $form['SendEmail']);
     ctrl_options::SetSystemOption('whmcs_link', $form['Link']);
     self::$Results[] = ui_sysmessage::shout('Settings updated!', 'alert-success');
 }
Пример #7
0
 static function doUpdateSettings()
 {
     global $controller;
     runtime_csfr::Protect();
     $form = $controller->GetAllControllerRequests('FORM');
     if (!isset($form['inAdminSettings'])) {
         return false;
     }
     if (!self::getIsAdmin()) {
         return false;
     }
     ctrl_options::SetSystemOption('whmcs_sendemail_bo', $form['SendEmail']);
     ctrl_options::SetSystemOption('whmcs_reseller_view_api', $form['ResellerViewAPI']);
     ctrl_options::SetSystemOption('whmcs_link', $form['Link']);
     self::$Results[] = ui_sysmessage::shout(ui_language::translate("Changes to your settings have been saved successfully!"));
 }