コード例 #1
0
 static function UpdateConfiguration($id = 0)
 {
     if (OperatorRequest::IsValidated() && Is::Defined("VALIDATED_FULL_LOGIN") && OperatorRequest::IsAdministrator(true)) {
         Logging::SecurityLog("ServerManager::UpdateConfiguration", "", CALLER_SYSTEM_ID);
         if (Is::Defined("STATS_ACTIVE") && !empty($_POST["p_reset_stats"])) {
             Server::$Statistic->ResetAll();
         }
         $int = 0;
         if (DB_CONNECTION) {
             DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` SET `delete`='1';");
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_LOCALIZATIONS . "`;");
             while (!empty($_POST["p_cfg_cct_id_" . $int])) {
                 $cct = new CommercialChatBillingType($_POST["p_cfg_cct_id_" . $int], $_POST["p_cfg_cct_mnoc_" . $int], $_POST["p_cfg_cct_mtloc_" . $int], $_POST["p_cfg_cct_tae_" . $int], $_POST["p_cfg_cct_tvbo_" . $int], $_POST["p_cfg_cct_svbo_" . $int], $_POST["p_cfg_cct_evbo_" . $int], $_POST["p_cfg_cct_citl_" . $int], $_POST["p_cfg_cct_p_" . $int]);
                 $cct->Save();
                 $iint = 0;
                 while (!empty($_POST["p_cfg_cctli_id_" . $int . "_" . $iint])) {
                     $cctl = new CommercialChatVoucherLocalization($_POST["p_cfg_cctli_id_" . $int . "_" . $iint], $_POST["p_cfg_cctli_itl_" . $int . "_" . $iint], $_POST["p_cfg_cctli_t_" . $int . "_" . $iint], $_POST["p_cfg_cctli_d_" . $int . "_" . $iint], $_POST["p_cfg_cctli_terms_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvc_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvp_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvu_" . $int . "_" . $iint], $_POST["p_cfg_cctli_exr_" . $int . "_" . $iint]);
                     $cctl->Save($_POST["p_cfg_cct_id_" . $int]);
                     $iint++;
                 }
                 $int++;
             }
             $int = 0;
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_PROVIDERS . "`;");
             while (!empty($_POST["p_cfg_ccpp_id_" . $int])) {
                 $ccpp = new CommercialChatPaymentProvider($_POST["p_cfg_ccpp_id_" . $int], $_POST["p_cfg_ccpp_n_" . $int], $_POST["p_cfg_ccpp_a_" . $int], $_POST["p_cfg_ccpp_u_" . $int], $_POST["p_cfg_ccpp_l_" . $int]);
                 $ccpp->Save();
                 $int++;
             }
             $int = 0;
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_MAILBOXES . "`;");
             while (!empty($_POST["p_cfg_es_i_" . $int])) {
                 $acc = new Mailbox($int, true);
                 $acc->Save();
                 $int++;
             }
             $int = 0;
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_FEEDBACK_CRITERIA_CONFIG . "`;");
             while (isset($_POST["p_cfg_fc_i_" . $int])) {
                 $fc = new FeedbackCriteria($int, true);
                 $fc->Save();
                 $int++;
             }
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` WHERE `delete`='1';");
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CONFIG . "`;");
             foreach ($_POST as $key => $value) {
                 if (strpos($key, "p_cfg_g_") === 0) {
                     $skey = str_replace("p_cfg_g_", "", $key);
                     $value = base64_decode($value);
                     DBManager::Execute(true, "REPLACE INTO `" . DB_PREFIX . DATABASE_CONFIG . "` (`key`,`value`) VALUES ('" . DBManager::RealEscape($skey) . "','" . DBManager::RealEscape($value) . "');");
                 }
             }
             CacheManager::Flush();
         }
         if (isset($_POST["p_available"])) {
             ServerManager::UpdateAvailability(!empty($_POST["p_available"]));
         }
         //$id = IOStruct::CreateFile($file,base64_decode($_POST["p_upload_value"]),true);
     }
     GeoTracking::SpanRemove(true);
     CacheManager::Flush();
     Server::$Response->SetStandardResponse($id, "");
 }
コード例 #2
0
function setConfig($id = 0)
{
    global $INTERNAL, $RESPONSE, $STATS, $CONFIG;
    administrationLog("setConfig", "", CALLER_SYSTEM_ID);
    if (isValidated() && ($INTERNAL[CALLER_SYSTEM_ID]->Level == USER_LEVEL_ADMIN || in_array($CONFIG["gl_host"], $INTERNAL[CALLER_SYSTEM_ID]->WebsitesConfig))) {
        if (is("STATS_ACTIVE") && !empty($_POST["p_reset_stats"])) {
            $STATS->ResetAll();
        }
        $int = 0;
        $file = ISSUBSITE || $INTERNAL[CALLER_SYSTEM_ID]->Level != USER_LEVEL_ADMIN ? str_replace("config.inc", "config." . SUBSITEHOST . ".inc", FILE_CONFIG) : FILE_CONFIG;
        if (DB_CONNECTION && (!ISSUBSITE || file_exists($file))) {
            queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` SET `delete`='1';");
            queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_LOCALIZATIONS . "`;");
            while (!empty($_POST["p_cfg_cct_id_" . $int])) {
                $cct = new CommercialChatBillingType($_POST["p_cfg_cct_id_" . $int], $_POST["p_cfg_cct_mnoc_" . $int], $_POST["p_cfg_cct_mtloc_" . $int], $_POST["p_cfg_cct_tae_" . $int], $_POST["p_cfg_cct_tvbo_" . $int], $_POST["p_cfg_cct_svbo_" . $int], $_POST["p_cfg_cct_evbo_" . $int], $_POST["p_cfg_cct_citl_" . $int], $_POST["p_cfg_cct_p_" . $int]);
                $cct->Save();
                $iint = 0;
                while (!empty($_POST["p_cfg_cctli_id_" . $int . "_" . $iint])) {
                    $cctl = new CommercialChatVoucherLocalization($_POST["p_cfg_cctli_id_" . $int . "_" . $iint], $_POST["p_cfg_cctli_itl_" . $int . "_" . $iint], $_POST["p_cfg_cctli_t_" . $int . "_" . $iint], $_POST["p_cfg_cctli_d_" . $int . "_" . $iint], $_POST["p_cfg_cctli_terms_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvc_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvp_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvu_" . $int . "_" . $iint], $_POST["p_cfg_cctli_exr_" . $int . "_" . $iint]);
                    $cctl->Save($_POST["p_cfg_cct_id_" . $int]);
                    $iint++;
                }
                $int++;
            }
            $int = 0;
            queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_PROVIDERS . "`;");
            while (!empty($_POST["p_cfg_ccpp_id_" . $int])) {
                $ccpp = new CommercialChatPaymentProvider($_POST["p_cfg_ccpp_id_" . $int], $_POST["p_cfg_ccpp_n_" . $int], $_POST["p_cfg_ccpp_a_" . $int], $_POST["p_cfg_ccpp_u_" . $int], $_POST["p_cfg_ccpp_l_" . $int]);
                $ccpp->Save();
                $int++;
            }
            $int = 0;
            queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_MAILBOXES . "`;");
            while (!empty($_POST["p_cfg_es_i_" . $int])) {
                $acc = new Mailbox($int, true);
                $acc->Save();
                $int++;
            }
            queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` WHERE `delete`='1';");
            queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CONFIG . "`;");
            foreach ($_POST as $key => $value) {
                if (strpos($key, "p_cfg_g_") === 0) {
                    $skey = str_replace("p_cfg_g_", "", $key);
                    $value = base64_decode($value);
                    queryDB(true, "REPLACE INTO `" . DB_PREFIX . DATABASE_CONFIG . "` (`key`,`value`) VALUES ('" . DBManager::RealEscape($skey) . "','" . DBManager::RealEscape($value) . "');");
                }
            }
        }
        if (isset($_POST["p_available"])) {
            setAvailability(!empty($_POST["p_available"]));
        }
        $id = createFile($file, base64_decode($_POST["p_upload_value"]), true);
        $int = 1;
        $delete = false;
        while (isset($_POST["p_int_trans_iso_" . $int]) && strpos($_POST["p_int_trans_iso_" . $int], "..") === false) {
            $file = getLocalizationFileString($_POST["p_int_trans_iso_" . $int], false);
            if (!isset($_POST["p_int_trans_delete_" . $int])) {
                createFile($file, $_POST["p_int_trans_content_" . $int], true);
            } else {
                $delete = true;
                if (file_exists($file)) {
                    @unlink($file);
                }
                if (empty($CONFIG["gl_root"])) {
                    createFile($file, "", true);
                }
            }
            $int++;
        }
        if (!$delete && (!@file_exists($file) || @file_exists($file) && @filemtime($file) !== false && @filemtime($file) < time() - 10)) {
            header("HTTP/1.1 502 Bad Gateway");
            exit("HTTP/1.1 502 Bad Gateway");
        }
    }
    removeSSpanFile(true);
    setIdle(0);
    $RESPONSE->SetStandardResponse($id, "");
}