Example #1
0
 public function initAccount($certrow, $isFroxlorVhost = false)
 {
     // Let's see if we have the private accountkey
     $this->accountKey = $certrow['leprivatekey'];
     if (!$this->accountKey || $this->accountKey == 'unset' || Settings::Get('system.letsencryptca') != 'production') {
         // generate and save new private key for account
         // ---------------------------------------------
         $this->log('Starting new account registration');
         $keys = $this->generateKey();
         // Only store the accountkey in production, in staging always generate a new key
         if (Settings::Get('system.letsencryptca') == 'production') {
             if ($isFroxlorVhost) {
                 Settings::Set('system.lepublickey', $keys['public']);
                 Settings::Set('system.leprivatekey', $keys['private']);
             } else {
                 $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `lepublickey` = :public, `leprivatekey` = :private " . "WHERE `customerid` = :customerid;");
                 Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid']));
             }
         }
         $this->accountKey = $keys['private'];
         $response = $this->postNewReg();
         if ($this->client->getLastCode() != 201) {
             throw new \RuntimeException("Account not initialized, probably due to rate limiting. Whole response: " . json_encode($response));
         }
         $this->license = $this->client->getAgreementURL();
         // Terms of Servce are optional according to ACME specs; if no ToS are presented, no need to update registration
         if (!empty($this->license)) {
             $this->postRegAgreement(parse_url($this->client->getLastLocation(), PHP_URL_PATH));
         }
         $this->log('New account certificate registered');
     } else {
         $this->log('Account already registered. Continuing.');
     }
 }
/**
 * Function updateToVersion
 *
 * updates the panel.version field
 * to the given value (no checks here!)
 *
 * @param string $new_version new-version
 *
 * @return bool true on success, else false
 */
function updateToVersion($new_version = null)
{
    if ($new_version !== null && $new_version != '') {
        $upd_stmt = Database::prepare("\n\t\t\t\tUPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :newversion\n\t\t\t\tWHERE `settinggroup` = 'panel' AND `varname` = 'version'");
        Database::pexecute($upd_stmt, array('newversion' => $new_version));
        Settings::Set('panel.version', $new_version);
        return true;
    }
    return false;
}
function storeSettingFieldInsertBindTask($fieldname, $fielddata, $newfieldvalue)
{
    if (is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] != '' && isset($fielddata['varname']) && $fielddata['varname'] != '') {
        if (Settings::Set($fielddata['settinggroup'] . '.' . $fielddata['varname'], $newfieldvalue) !== false) {
            return array($fielddata['settinggroup'] . '.' . $fielddata['varname'] => $newfieldvalue);
        } else {
            return false;
        }
    } else {
        return false;
    }
}
/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**> (2003-2009)
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function storeSettingIpAddress($fieldname, $fielddata, $newfieldvalue)
{
    $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
    if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'ipaddress') {
        $mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host')));
        $mysql_access_host_array[] = $newfieldvalue;
        $mysql_access_host_array = array_unique(array_trim($mysql_access_host_array));
        $mysql_access_host = implode(',', $mysql_access_host_array);
        correctMysqlUsers($mysql_access_host_array);
        Settings::Set('system.mysql_access_host', $mysql_access_host);
    }
    return $returnvalue;
}
Example #5
0
 /**
  * Retrieve a list of valid enabled plugins
  * @return array Returns a list of enabled plugins, any orphaned plugins are disabled
  */
 static function GetEnabledPlugins()
 {
     $enabled = Settings::Get('enabled_plugins');
     $enabled = unserialize($enabled);
     foreach ($enabled as $key => $plugin) {
         $plugin_file = DOC_ROOT . "/cc-content/plugins/{$plugin}/{$plugin}.php";
         if (!file_exists($plugin_file)) {
             unset($enabled[$key]);
         }
     }
     reset($enabled);
     Settings::Set('enabled_plugins', serialize($enabled));
     return $enabled;
 }
/**
 * Function checkLastGuid
 *
 * Checks if the system's last guid is not higher than the one saved
 * in froxlor's database. If it's higher, froxlor needs to
 * set its last guid to this one to avoid conflicts with libnss-users
 *
 * @param int guid (from froxlor database)
 *
 * @return null
 */
function checkLastGuid()
{
    global $log, $cronlog;
    $mylog = null;
    if (isset($cronlog) && $cronlog instanceof FroxlorLogger) {
        $mylog = $cronlog;
    } else {
        $mylog = $log;
    }
    $group_lines = array();
    $group_guids = array();
    $update_to_guid = 0;
    $froxlor_guid = 0;
    $result_stmt = Database::query("SELECT MAX(`guid`) as `fguid` FROM `" . TABLE_PANEL_CUSTOMERS . "`");
    $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
    $froxlor_guid = $result['fguid'];
    // possibly no customers yet or f*cked up lastguid settings
    if ($froxlor_guid < Settings::Get('system.lastguid')) {
        $froxlor_guid = Settings::Get('system.lastguid');
    }
    $g_file = '/etc/group';
    if (file_exists($g_file)) {
        if (is_readable($g_file)) {
            if (true == ($groups = file_get_contents($g_file))) {
                $group_lines = explode("\n", $groups);
                foreach ($group_lines as $group) {
                    $group_guids[] = explode(":", $group);
                }
                foreach ($group_guids as $idx => $group) {
                    /**
                     * nogroup | nobody have very high guids
                     * ignore them
                     */
                    if ($group[0] == 'nogroup' || $group[0] == 'nobody') {
                        continue;
                    }
                    $guid = isset($group[2]) ? (int) $group[2] : 0;
                    if ($guid > $update_to_guid) {
                        $update_to_guid = $guid;
                    }
                }
                // if it's lower, then froxlor's highest guid is the last
                if ($update_to_guid < $froxlor_guid) {
                    $update_to_guid = $froxlor_guid;
                } elseif ($update_to_guid == $froxlor_guid) {
                    // if it's equal, that means we already have a collision
                    // to ensure it won't happen again, increase the guid by one
                    $update_to_guid = (int) $update_to_guid++;
                }
                // now check if it differs from our settings
                if ($update_to_guid != Settings::Get('system.lastguid')) {
                    $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to ' . $update_to_guid);
                    Settings::Set('system.lastguid', $update_to_guid);
                }
            } else {
                $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
            }
        } else {
            $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
        }
    } else {
        $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group does not exist; cannot check for latest guid');
    }
}
Example #7
0
<?php

// Include required files
include_once dirname(dirname(__FILE__)) . '/cc-core/config/admin.bootstrap.php';
App::LoadClass('User');
// Establish page variables, objects, arrays, etc
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$admin = new User($logged_in);
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/');
$page_title = 'CumulusClips Admin Panel - Dashboard';
$first_run = null;
// Execute post install / first run operations
if (isset($_GET['first_run']) && file_exists(DOC_ROOT . '/cc-install')) {
    Settings::Set('version', CURRENT_VERSION);
    Filesystem::Open();
    Filesystem::Delete(DOC_ROOT . '/cc-install');
    Filesystem::Close();
    $first_run = true;
}
// Retrieve news from mothership
if (isset($_POST['news'])) {
    $curl_handle = curl_init();
    curl_setopt($curl_handle, CURLOPT_URL, MOTHERSHIP_URL . '/news/');
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
    $news = curl_exec($curl_handle);
    curl_close($curl_handle);
    $news = !empty($news) ? $news : '<strong>Nothing to report.</strong>';
    exit($news);
}
// Retrieve Video totals
Example #8
0
            }
            // Enable plugin
            $enabled_plugins[] = $_GET['enable'];
            Settings::Set('enabled_plugins', serialize($enabled_plugins));
            // Output message
            $plugin_info = Plugin::GetPluginInfo($_GET['enable']);
            $message = $plugin_info->name . ' has been enabled.';
            $message_type = 'success';
        }
    } else {
        if (!empty($_GET['disable']) && !ctype_space($_GET['disable'])) {
            // Uninstall plugin if applicable
            $key = array_search($_GET['disable'], $enabled_plugins);
            if ($key !== false && Plugin::ValidPlugin($_GET['disable'])) {
                unset($enabled_plugins[$key]);
                Settings::Set('enabled_plugins', serialize($enabled_plugins));
                // Output message
                $plugin_info = Plugin::GetPluginInfo($_GET['disable']);
                $message = $plugin_info->name . ' has been disabled.';
                $message_type = 'success';
            }
        }
    }
}
// Retrieve plugins
foreach (glob(DOC_ROOT . '/cc-content/plugins/*') as $plugin_path) {
    // Load plugin and retrieve it's info
    $plugin_name = basename($plugin_path);
    include_once "{$plugin_path}/{$plugin_name}.php";
    // Store info for output
    $plugin = new stdClass();
Example #9
0
    Database::query("ALTER TABLE `panel_traffic`\n    \tDROP KEY `customerid`,\n    \tADD FOREIGN KEY `fk_customer` (customerid)\n        \tREFERENCES panel_customers(customerid)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `panel_traffic_admins`\n    \tDROP KEY `adminid`,\n    \t\tADD FOREIGN KEY `fk_admin` (adminid)\n        \tREFERENCES panel_admins(adminid)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    // it seems there are occasions where diskspace info
    // for deleted customers is still in the database.
    // remove that, just in case
    Database::query("DELETE FROM `panel_diskspace` WHERE customerid NOT IN (SELECT customerid FROM `panel_customers`)");
    Database::query("ALTER TABLE `panel_diskspace`\n    \tDROP KEY `customerid`,\n    \tADD FOREIGN KEY `fk_customer` (customerid)\n        \tREFERENCES panel_customers(customerid)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `panel_diskspace_admins`\n    \tDROP KEY `adminid`,\n    \tADD FOREIGN KEY `fk_admin` (adminid)\n        \tREFERENCES panel_admins(adminid)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `panel_tickets`\n    \tMODIFY COLUMN `adminid` INT(11) UNSIGNED NOT NULL,\n    \tMODIFY COLUMN `customerid` INT(11) UNSIGNED DEFAULT NULL");
    Database::query("UPDATE `panel_tickets` set customerid=NULL where customerid='0'");
    Database::query("ALTER TABLE `panel_tickets`\n\t\tDROP KEY `customerid`,\n    \t  ADD FOREIGN KEY `fk_admin` (adminid)\n\t        REFERENCES panel_admins(adminid)\n    \t    ON UPDATE CASCADE ON DELETE CASCADE,\n    \tADD FOREIGN KEY `fk_customer` (customerid)\n        \tREFERENCES panel_customers(customerid)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `panel_ticket_categories`\n    \tMODIFY COLUMN `adminid` INT(11) UNSIGNED DEFAULT NULL,\n    \tADD FOREIGN KEY `fk_admin` (adminid)\n        \tREFERENCES panel_admins(adminid)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    // it seems there can be redirect codes for deleted
    // domains. Delete those, too
    Database::query("DELETE from `domain_redirect_codes` where did not in (select id from `panel_domains`)");
    Database::query("ALTER TABLE `domain_redirect_codes`\n    \tADD PRIMARY KEY `pk` (`rid`,`did`),\n    \tADD FOREIGN KEY `fk_redirect` (`rid`)\n\t        REFERENCES redirect_codes(id)\n    \t    ON UPDATE CASCADE ON DELETE CASCADE,\n    \tADD FOREIGN KEY `fk_domain` (did)\n        \tREFERENCES panel_domains(id)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `domain_ssl_settings`\n    \tMODIFY COLUMN `domainid` INT(11) UNSIGNED NOT NULL,\n    \tADD FOREIGN KEY `fk_domain` (domainid)\n        \tREFERENCES panel_domains(id)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `panel_domaintoip`\n    \tADD FOREIGN KEY `fk_domain` (id_domain)\n        \tREFERENCES panel_domains(id)\n        \tON UPDATE CASCADE ON DELETE CASCADE,\n    \tADD FOREIGN KEY `fk_ipandport` (id_ipandports)\n        \tREFERENCES panel_ipsandports(id)\n        \tON UPDATE CASCADE ON DELETE CASCADE;");
    Database::query("ALTER TABLE `ftp_quotalimits`\n\t\tADD PRIMARY KEY `pk` (`name`, `quota_type`);");
    Database::query("ALTER TABLE `ftp_quotatallies`\n\t\tADD PRIMARY KEY `pk` (`name`, `quota_type`);");
    // add setting for webserver group
    Settings::AddNew('system.customerdir_group_webserver', '0');
    // add multinode version
    Settings::AddNew('multinode.version', '0.0.1.0');
}
if (MN_getVersion() == array(0, 0, 1, 0)) {
    showUpdateStep("Updating to multinode 0.0.2.0", false);
    Database::query("CREATE TABLE `panel_nodes` (\n  \t\t`id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n  \t\t`name` varchar(64) NOT NULL,\n  \t\t`image_name` varchar(128) NOT NULL,\n  \t\t`image_tag` varchar(128) DEFAULT 'latest' NOT NULL,\n  \t\t`is_default` tinyint(1) DEFAULT '0',\n  \t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;");
    Database::query("CREATE TABLE `panel_nodetodomain` (\n  \t\t`id_node` int(11) unsigned NOT NULL,\n  \t\t`id_domain` int(11) unsigned NOT NULL,\n  \t\tPRIMARY KEY (`id_node`,`id_domain`),\n  \t\tFOREIGN KEY `fk_node` (id_node)\n  \t\t\tREFERENCES panel_nodes(id)\n    \t\tON UPDATE CASCADE ON DELETE CASCADE,\n  \t\tFOREIGN KEY `fk_domain` (id_domain)\n  \t\t\tREFERENCES panel_domains(id)\n    \t\tON UPDATE CASCADE ON DELETE CASCADE\n\t\t) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;");
    Settings::Set('multinode.version', '0.0.2.0');
}
Example #10
0
     if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') {
         Settings::Set('panel.version', '1.4.2.1');
     }
     if (Settings::Get('system.dbversion') == null || Settings::Get('system.dbversion') == '') {
         /**
          * for syscp-stable (1.4.2.1) this value has to be 0
          * so the required table-fields are added correctly
          * and the svn-version has its value in the database
          * -> bug #54
          */
         $result_stmt = Database::query("\n\t\t\t\tSELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
         $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
         if (isset($result['value'])) {
             Settings::Set('system.dbversion', (int) $result['value'], false);
         } else {
             Settings::Set('system.dbversion', 0, false);
         }
     }
 }
 if (hasUpdates($version)) {
     $successful_update = false;
     $message = '';
     if (isset($_POST['send']) && $_POST['send'] == 'send') {
         if (isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0 || !isset($_POST['update_preconfig'])) {
             eval("echo \"" . getTemplate('update/update_start') . "\";");
             include_once './install/updatesql.php';
             $redirect_url = 'admin_index.php?s=' . $s;
             eval("echo \"" . getTemplate('update/update_end') . "\";");
             updateCounters();
             inserttask('1');
             @chmod('./lib/userdata.inc.php', 0440);
Example #11
0
<?php

/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Install
 *
 */
if (!defined('AREA') || defined('AREA') && AREA != 'admin' || !isset($userinfo['loginname']) || isset($userinfo['loginname']) && $userinfo['loginname'] == '') {
    header('Location: ../../../index.php');
    exit;
}
$updateto = '0.9-r0';
$frontend = 'froxlor';
showUpdateStep("Upgrading SysCP " . Settings::Get('panel.version') . " to Froxlor " . $updateto, false);
updateToVersion($updateto);
// add field frontend
Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET\n\t`settinggroup` = 'panel',\n\t`varname` = 'frontend',\n\t`value` = 'froxlor'");
Settings::Set('panel.frontend', $frontend);
    Settings::Set('opf_email_filter', $data["email_filter"], false);
} else {
    Settings::Set('opf_email_filter', 1, false);
}
if (isset($data["mailto_filter"])) {
    Settings::Set('opf_mailto_filter', $data["mailto_filter"], false);
} else {
    Settings::Set('opf_mailto_filter', 1, false);
}
Settings::Set('opf_js_mailto', 1, false);
Settings::Set('opf_short_url', 0, false);
Settings::Set('opf_css_to_head', 1, false);
if (isset($data["at_replacement"])) {
    Settings::Set('opf_at_replacement', $data["at_replacement"], false);
} else {
    Settings::Set('opf_at_replacement', "(at)", false);
}
if (isset($data["dot_replacement"])) {
    Settings::Set('opf_dot_replacement', $data["dot_replacement"], false);
} else {
    Settings::Set('opf_dot_replacement', "(dot)", false);
}
//finally delete the old table as its no longer needed
$table = TABLE_PREFIX . 'mod_output_filter';
$database->query("DROP TABLE IF EXISTS `{$table}`");
//Setting Version
include "info.php";
Settings::Set("opf_version", $module_version);
Settings::Set('opf_insert_be', 1);
Settings::Set('opf_css_to_head_be', 1);
Example #13
0
            // Validate theme
            $language_file = DOC_ROOT . '/cc-content/languages/' . $_GET['deactivate'] . '.xml';
            if (array_key_exists($_GET['deactivate'], $active_languages)) {
                $xml = simplexml_load_file($language_file);
                unset($active_languages[$_GET['deactivate']]);
                Settings::Set('active_languages', serialize($active_languages));
                $message = $xml->information->lang_name . ' has been deactivated.';
                $message_type = 'success';
            }
        } else {
            if (!empty($_GET['default']) && !ctype_space($_GET['default'])) {
                // Validate language
                $language_file = DOC_ROOT . '/cc-content/languages/' . $_GET['default'] . '.xml';
                if (array_key_exists($_GET['default'], $active_languages) && file_exists($language_file)) {
                    $xml = simplexml_load_file($language_file);
                    Settings::Set('default_language', $_GET['default']);
                    $message = $xml->information->lang_name . ' is now the default language.';
                    $message_type = 'success';
                }
            }
        }
    }
}
// Retrieve languages
foreach (glob(DOC_ROOT . '/cc-content/languages/*') as $language) {
    $lang = new stdClass();
    $lang->filename = basename($language, '.xml');
    $lang->active = array_key_exists($lang->filename, $active_languages) ? true : false;
    $lang->default = $lang->filename == Settings::Get('default_language') ? true : false;
    $lang->xml = simplexml_load_file($language);
    $lang_list[] = $lang;
Example #14
0
if (isDatabaseVersion('201604270')) {
    showUpdateStep("Adding new dns related tables and settings");
    $enable_dns = isset($_POST['enable_dns']) ? (int) $_POST['enable_dns'] : "0";
    Settings::AddNew("system.dnsenabled", $enable_dns);
    Database::query("DROP TABLE IF EXISTS `domain_dns_entries`;");
    $sql = "CREATE TABLE `domain_dns_entries` (\n\t\t`id` int(20) NOT NULL auto_increment,\n\t\t`domain_id` int(15) NOT NULL,\n\t\t`record` varchar(255) NOT NULL,\n\t\t`type` varchar(10) NOT NULL DEFAULT 'A',\n\t\t`content` text NOT NULL,\n\t\t`ttl` int(11) NOT NULL DEFAULT '18000',\n\t\t`prio` int(11) DEFAULT NULL,\n\t\tPRIMARY KEY (`id`)\n\t\t) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
    Database::query($sql);
    lastStepStatus(0);
    updateToDbVersion('201605090');
}
if (isDatabaseVersion('201605090')) {
    showUpdateStep("Adjusting SPF record setting");
    $current_spf = Settings::Get('spf.spf_entry');
    // @	IN	TXT	"v=spf1 a mx -all"
    $new_spf = substr($current_spf, strpos($current_spf, '"'));
    Settings::Set('spf.spf_entry', $new_spf, true);
    lastStepStatus(0);
    updateToDbVersion('201605120');
}
if (isDatabaseVersion('201605120')) {
    showUpdateStep("Adding new dns-server setting");
    $new_dns_daemon = isset($_POST['new_dns_daemon']) ? $_POST['new_dns_daemon'] : "bind";
    Settings::AddNew("system.dns_server", $new_dns_daemon);
    lastStepStatus(0);
    updateToDbVersion('201605170');
}
if (isDatabaseVersion('201605170')) {
    showUpdateStep("Adding new dns-editor setting for customers");
    Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `dnsenabled` tinyint(1) NOT NULL default '0' AFTER `perlenabled`;");
    lastStepStatus(0);
    updateToDbVersion('201605180');
    // get configuration settings
    $enabled_captcha = $_POST['enabled_captcha'] == '1' ? 'true' : 'false';
    $enabled_asp = $_POST['enabled_asp'] == '1' ? 'true' : 'false';
    $captcha_type = $admin->add_slashes($_POST['captcha_type']);
    // update settings
    Settings::Set("enabled_captcha", $enabled_captcha);
    Settings::Set("enabled_asp", $enabled_asp);
    Settings::Set("captcha_type", $captcha_type);
    // save text-captchas if they are set , so we dont forget em
    if (isset($_POST['text_qa'])) {
        // text question/answer
        $text_qa = $admin->add_slashes($_POST['text_qa']);
        //check for valid phrases
        if (!preg_match('/### .*? ###/', $text_qa)) {
            //set value
            Settings::Set("ct_text", $text_qa);
        }
    }
    // check if there is a database error, otherwise say successful
    if ($database->is_error()) {
        $admin->print_error($database->get_error(), $returnUrl, false);
    } else {
        $admin->print_success($MESSAGE['PAGES_SAVED'], $returnUrl);
    }
} else {
    // include captcha-file from here we get the "$useable_captchas" var
    require_once WB_PATH . '/include/captcha/captcha.php';
    // load text-captchas
    $text_qa = CT_TEXT;
    if ($text_qa == '') {
        $text_qa = $MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'];
        }
    }
    closedir($handle);
}
echo '<br />Languages reloaded<br />';
/**********************************************************
 *  - Set Version to new Version
 */
echo '<br />Update database version number to ' . NEW_WBCE_VERSION . ' (Tag: ' . NEW_WBCE_TAG . ')';
Settings::Set('wbce_version', NEW_WBCE_VERSION);
Settings::Set('wbce_tag', NEW_WBCE_TAG);
Settings::Set('wb_version', VERSION);
// Legacy: WB-classic
Settings::Set('wb_revision', REVISION);
// Legacy: WB-classic
Settings::Set('wb_sp', SP);
// Legacy: WB-classic
/**********************************************************
 *  - End of upgrade script only some output stuff down here
 */
if (!defined('DEFAULT_THEME')) {
    define('DEFAULT_THEME', $DEFAULT_THEME);
}
if (!defined('THEME_PATH')) {
    define('THEME_PATH', WB_PATH . '/templates/' . DEFAULT_THEME);
}
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
status_msg('<br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
// show buttons to go to the backend or frontend
echo '<br />';
if (defined('WB_URL')) {
        $errmsg .= (string) Settings::Set("opf_droplets", $data['droplets']);
        $errmsg .= (string) Settings::Set("opf_droplets_be", $data['droplets_be']);
        $errmsg .= (string) Settings::Set("opf_wblink", $data['wblink']);
        $errmsg .= (string) Settings::Set("opf_auto_placeholder", $data['auto_placeholder']);
        $errmsg .= (string) Settings::Set("opf_insert", $data['insert']);
        $errmsg .= (string) Settings::Set("opf_sys_rel", $data['sys_rel']);
        $errmsg .= (string) Settings::Set("opf_email_filter", $data['email_filter']);
        $errmsg .= (string) Settings::Set("opf_mailto_filter", $data['mailto_filter']);
        $errmsg .= (string) Settings::Set("opf_js_mailto", $data['js_mailto']);
        $errmsg .= (string) Settings::Set("opf_short_url", $data['short_url']);
        $errmsg .= (string) Settings::Set("opf_css_to_head", $data['css_to_head']);
        $errmsg .= (string) Settings::Set("opf_at_replacement", $data['at_replacement']);
        $errmsg .= (string) Settings::Set("opf_dot_replacement", $data['dot_replacement']);
        //backend
        $errmsg .= (string) Settings::Set("opf_insert_be", $data['insert_be']);
        $errmsg .= (string) Settings::Set("opf_css_to_head_be", $data['css_to_head_be']);
        if ($errmsg == "") {
            //anything ok
            $msgTxt = "<b>" . $MESSAGE['RECORD_MODIFIED_SAVED'] . "</b>";
            $msgCls = 'msg-box';
        } else {
            // error
            $msgTxt = "<b>" . $MESSAGE['RECORD_MODIFIED_FAILED'] . "</b><p>" . $errmsg . "</p>";
            $msgCls = 'error-box';
        }
    } else {
        // FTAN error
        $msgTxt = "<b>" . $MESSAGE['GENERIC_SECURITY_ACCESS'] . "</b>";
        $msgCls = 'error-box';
    }
} else {
 */
//no direct file access
if (count(get_included_files()) == 1) {
    die(header("Location: ../index.php", TRUE, 301));
}
// get CAPTCHA and ASP settings from old table
$sql = 'SELECT * FROM `' . TABLE_PREFIX . 'mod_captcha_control`';
if (($get_settings = $database->query($sql)) && ($setting = $get_settings->fetchRow(MYSQLI_ASSOC))) {
    // fetching settings from old table
    Settings::Set("enabled_captcha", $setting['enabled_captcha'] == '1' ? true : false);
    Settings::Set("enabled_asp", $setting['enabled_asp'] == '1' ? true : false);
    Settings::Set("captcha_type", $setting['captcha_type']);
    Settings::Set("asp_session_min_age", $setting['asp_session_min_age']);
    Settings::Set("asp_view_min_age", $setting['asp_view_min_age']);
    Settings::Set("asp_input_min_age", $setting['asp_input_min_age']);
    Settings::Set("ct_text", $setting['ct_text']);
    // Delete old tabe construct
    $table = TABLE_PREFIX . 'mod_captcha_control';
    if (!$database->query("DROP TABLE `{$table}`")) {
        $msg = $database->get_error();
    }
} else {
    //Set defaults but dont overwrite settings
    Settings::Set("enabled_captcha", true, false);
    Settings::Set("enabled_asp", true, false);
    Settings::Set("captcha_type", "calc_text", false);
    Settings::Set("asp_session_min_age", "20", false);
    Settings::Set("asp_view_min_age", "10", false);
    Settings::Set("asp_input_min_age", "5", false);
    Settings::Set("ct_text", "", false);
}
Example #19
0
    // check if this is is no attack
    if (!$admin->checkFTAN()) {
        if (!$admin_header) {
            $admin->print_header();
        }
        $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $_SERVER['REQUEST_URI']);
        //ends page here
    }
    // Include functions file
    // not sure we need this?? We test this later.
    require_once WB_PATH . '/framework/functions.php';
    // here the actual action is going on, we set the setting
    if ($admin->get_post("mmode")) {
        Settings::Set("wb_maintainance_mode", true);
    } else {
        Settings::Set("wb_maintainance_mode", false);
    }
    // check if there is a database error, otherwise say successful
    // this should be refined , as the functions are capable of reporting errors.
    if (!$admin_header) {
        $admin->print_header();
    }
    if ($database->is_error()) {
        $admin->print_error($database->get_error(), $js_back);
        // ends page here
    } else {
        $admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL . '/admintools/tool.php?tool=maintainance_mode');
        // ends page here
    }
}
// Display form
<?php

/**
 *
 * @category        modules
 * @package         captcha_control
 * @author          WBCE Project
 * @copyright       Thorn, Luise Hahne, Norbert Heimsath
 * @license         GPLv2 or any later
 */
//no direct file access
if (count(get_included_files()) == 1) {
    header("Location: ../index.php", TRUE, 301);
}
// Default settings
Settings::Set("enabled_captcha", true);
Settings::Set("enabled_asp", true);
Settings::Set("captcha_type", "calc_text");
Settings::Set("asp_session_min_age", "20");
Settings::Set("asp_view_min_age", "10");
Settings::Set("asp_input_min_age", "5");
Settings::Set("ct_text", "");
Example #21
0
    Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/temp', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/avatars', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/logs', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/bin', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/bin/qtfaststart', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/exceptions.py', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/__init__.py', 0777);
    Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/processor.py', 0777);
    ### Delete temp. dir.
    Filesystem::Delete($tmp);
    ### Activate themes
    ### Activate plugins
    Filesystem::Close();
    unset($_SESSION['updates_available']);
    Settings::Set('version', $update->version);
} catch (Exception $e) {
    $error = $e->getMessage();
    $page_title = 'Error During Update';
}
// Output Header
$dont_show_update_prompt = true;
include 'header.php';
?>

<div id="updates-complete">

    <?php 
if (!$error) {
    ?>
/**
 * set the multinode version (after upgrade)
 *
 * @param $new_version array
 */
function MN_setVersion($new_version)
{
    $version = implode('.', $new_version);
    Settings::Set('multinode.version', $version);
}
 /**
  * fastcgi-fakedirectory directory
  *
  * @param boolean $createifnotexists create the directory if it does not exist
  *
  * @return string the directory
  */
 public function getAliasConfigDir($createifnotexists = true)
 {
     // ensure default...
     if (Settings::Get('phpfpm.aliasconfigdir') == null) {
         Settings::Set('phpfpm.aliasconfigdir', '/var/www/php-fpm');
     }
     $configdir = makeCorrectDir(Settings::Get('phpfpm.aliasconfigdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
     if (!is_dir($configdir) && $createifnotexists) {
         safe_exec('mkdir -p ' . escapeshellarg($configdir));
         safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
     }
     return $configdir;
 }
 * @requirements    PHP 5.3.6 and higher
 * @version         $Id: install.php 1538 2011-12-10 15:06:15Z Luisehahne $
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb_svn/wb280/tags/2.8.3/wb/modules/output_filter/install.php $
 * @lastmodified    $Date: 2011-12-10 16:06:15 +0100 (Sa, 10. Dez 2011) $
 *
 */
//no direct file access
if (count(get_included_files()) == 1) {
    die(header("Location: ../index.php", TRUE, 301));
}
Settings::Set('wb_suppress_old_opf', 0, false);
Settings::Set('opf_droplets', 1, false);
Settings::Set('opf_droplets_be', 1, false);
Settings::Set('opf_wblink', 1, false);
Settings::Set('opf_auto_placeholder', 1, false);
Settings::Set('opf_insert', 1, false);
Settings::Set('opf_sys_rel', 1, false);
Settings::Set('opf_email_filter', 1, false);
Settings::Set('opf_mailto_filter', 1, false);
Settings::Set('opf_js_mailto', 1, false);
Settings::Set('opf_short_url', 0, false);
Settings::Set('opf_css_to_head', 1, false);
Settings::Set('opf_at_replacement', "(at)", false);
Settings::Set('opf_dot_replacement', "(dot)", false);
//backend
Settings::Set('opf_insert_be', 1);
Settings::Set('opf_css_to_head_be', 1);
//Setting version
include "info.php";
Settings::Set("opf_version", $module_version);
Example #25
0
    // Validate auto_approve_users
    if (isset($_POST['auto_approve_users']) && in_array($_POST['auto_approve_users'], array('1', '0'))) {
        $data['auto_approve_users'] = $_POST['auto_approve_users'];
    } else {
        $errors['auto_approve_users'] = 'Invalid member approval option';
    }
    // Validate auto_approve_comments
    if (isset($_POST['auto_approve_comments']) && in_array($_POST['auto_approve_comments'], array('1', '0'))) {
        $data['auto_approve_comments'] = $_POST['auto_approve_comments'];
    } else {
        $errors['auto_approve_comments'] = 'Invalid comment approval option';
    }
    // Update video if no errors were made
    if (empty($errors)) {
        foreach ($data as $key => $value) {
            Settings::Set($key, $value);
        }
        $message = 'Settings have been updated.';
        $message_type = 'success';
    } else {
        $message = 'The following errors were found. Please correct them and try again.';
        $message .= '<br /><br /> - ' . implode('<br /> - ', $errors);
        $message_type = 'error';
    }
}
// Output Header
include 'header.php';
?>

<div id="settings">
Example #26
0
 /**
  * Set whether to log cron-runs
  *
  * @param bool $_cronlog
  *
  * @return boolean
  */
 public function setCronLog($_cronlog = 0)
 {
     $_cronlog = (int) $_cronlog;
     if ($_cronlog != 0 && $_cronlog != 1) {
         $_cronlog = 0;
     }
     Settings::Set('logger.log_cron', $_cronlog);
     return true;
 }
Example #27
0
    Database::pexecute($ins_stmt, array('varname' => 'mdalog', 'value' => isset($_POST['mdalog']) ? $_POST['mdalog'] : '/var/log/mail.log'));
    Database::pexecute($ins_stmt, array('varname' => 'mtalog', 'value' => isset($_POST['mtalog']) ? $_POST['mtalog'] : '/var/log/mail.log'));
    Database::pexecute($ins_stmt, array('varname' => 'mdaserver', 'value' => isset($_POST['mdaserver']) ? $_POST['mdaserver'] : 'dovecot'));
    Database::pexecute($ins_stmt, array('varname' => 'mtaserver', 'value' => isset($_POST['mtaserver']) ? $_POST['mtaserver'] : 'postfix'));
    lastStepStatus(0);
    updateToVersion('0.9.32-dev2');
}
if (isFroxlorVersion('0.9.32-dev2')) {
    showUpdateStep("Updating from 0.9.32-dev2 to 0.9.32-dev3");
    lastStepStatus(0);
    showUpdateStep("Updating froxlor - theme");
    Database::query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';");
    Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';");
    Database::query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';");
    if (Settings::Get('panel.default_theme') == 'Froxlor') {
        Settings::Set('panel.default_theme', 'Sparkle_froxlor');
    }
    lastStepStatus(0);
    updateToVersion('0.9.32-dev3');
}
if (isFroxlorVersion('0.9.32-dev3')) {
    showUpdateStep("Updating from 0.9.32-dev3 to 0.9.32-dev4");
    lastStepStatus(0);
    showUpdateStep("Adding new FTP-description field");
    Database::query("ALTER TABLE `" . TABLE_FTP_USERS . "` ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `customerid`;");
    lastStepStatus(0);
    updateToVersion('0.9.32-dev4');
}
if (isFroxlorVersion('0.9.32-dev4')) {
    showUpdateStep("Updating from 0.9.32-dev4 to 0.9.32-dev5");
    lastStepStatus(0);
        $setError .= Settings::Set("frontend_login", false);
        $setError .= Settings::Set("wb_frontend_login", false);
        $setError .= Settings::Set("redirect_timer", "1500");
        $setError .= Settings::Set("wb_redirect_timer", "1500");
        $setError .= Settings::Set("frontend_signup", false);
        $setError .= Settings::Set("wb_frontend_signup", false);
        $setError .= Settings::Set("er_level", '');
        $setError .= Settings::Set("wb_er_level", '');
        $setError .= Settings::Set("wysiwyg_style", "font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;");
        $setError .= Settings::Set("wb_wysiwyg_style", "font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;");
        $value = "ckeditor";
        if (!gs_EditorPossible($value)) {
            $value = "none";
        }
        $setError .= Settings::Set("wysiwyg_editor", $value);
        $setError .= Settings::Set("wb_wysiwyg_editor", $value);
        // report success or failure
        Tool::Msg($setError, $returnUrl);
    } else {
        // Display form
        // get setting from DB , as constant may not be set yet.
        $maintMode = (string) Settings::Get("wb_maintainance_mode");
        if ($maintMode == "true") {
            $maintMode = ' checked="checked" ';
        } else {
            $maintMode = '';
        }
        // we need to preload no values , as they all stored in constants
        include $this->GetTemplatePath("general.tpl.php");
    }
}
    } else {
        $setError .= $SFS['SECRETTIME_ERR'];
    }
    // END ACTION!!
    // report success or failure
    toolMsg($setError, $returnUrl);
} else {
    if ($saveDefault) {
        // setting defaults
        $setError = Settings::Set("wb_maintainance_mode", false);
        $setError = Settings::Set("wb_secform_secret", "5609bnefg93jmgi99igjefg");
        $setError = Settings::Set("wb_secform_secrettime", '86400');
        $setError = Settings::Set("wb_secform_timeout", '7200');
        $setError = Settings::Set("wb_secform_tokenname", 'formtoken');
        $setError = Settings::Set("wb_secform_usefp", false);
        $setError = Settings::Set("fingerprint_with_ip_octets", "2");
        // report success or failure
        toolMsg($setError, $returnUrl);
    } else {
        // Get form vars
        $selected = ' selected="selected" ';
        $checked = ' checked="checked" ';
        // get settings from DB , as constant may not be set yet.
        $useFP = (string) Settings::Get("wb_secform_usefp");
        if ($useFP == "true") {
            $useFP = $checked;
        } else {
            $useFP = '';
        }
        $ipOctets = (string) Settings::Get("fingerprint_with_ip_octets");
        $tokenName = Settings::Get("wb_secform_tokenname");
    if ($saveDefault) {
        $setError = "";
        $setError .= Settings::Set("WBMAILER_DEFAULT_SENDERNAME", 'WBCE Mailer');
        $setError .= Settings::Set("WB_MAILER_DEFAULT_SENDERNAME", 'WBCE Mailer');
        $setError .= Settings::Set("WBMAILER_SMTP_AUTH", 1);
        $setError .= Settings::Set("WB_MAILER_SMTP_AUTH", 1);
        $setError .= Settings::Set("WBMAILER_SMTP_HOST", "");
        $setError .= Settings::Set("WB_MAILER_SMTP_HOST", "");
        $setError .= Settings::Set("WBMAILER_SMTP_USERNAME", "");
        $setError .= Settings::Set("WB_MAILER_SMTP_USERNAME", "");
        $setError .= Settings::Set("WBMAILER_SMTP_PASSWORD", "");
        $setError .= Settings::Set("WB_MAILER_SMTP_PASSWORD", "");
        $setError .= Settings::Set("WBMAILER_ROUTINE", "phpmail");
        $setError .= Settings::Set("WB_MAILER_ROUTINE", "phpmail");
        $setError .= Settings::Set("WBMAILER_DEFAULT_SENDER_MAIL", SERVER_EMAIL);
        $setError .= Settings::Set("WB_MAILER_DEFAULT_SENDER_MAIL", SERVER_EMAIL);
        // report success or failure
        Tool::Msg($setError, $returnUrl);
    } else {
        //This hapens if form is not send in any way
        // We simply go for display the form
        //Fetch form  content from DB
        include $modulePath . "/includes/fetch_form_content.php";
        // we need to preload no values , as they all stored in constants
        include $this->GetTemplatePath("tool.tpl.php");
    }
}
//////////////////////////////
// Helper functions down here
function se_GetTemplatesArray()
{