private function GetFeedbacksByGroup($counter = 0, $hrows = "")
 {
     $trow = IOStruct::GetFile(TEMPLATE_HTML_STATS_TOP_ROW);
     $rows = array();
     $graphData = array();
     $statTitles = FeedbackCriteria::GetStatArray(true);
     if (count($statTitles) == 0) {
         return "";
     }
     $result = DBManager::Execute(true, "SELECT `group_id`,SUM(`amount`) AS `totalgroup`,SUM(`ca`) AS `tc0`,SUM(`cb`) AS `tc1`,SUM(`cc`) AS `tc2`,SUM(`cd`) AS `tc3`,(SELECT SUM(`amount`) FROM `" . DB_PREFIX . DATABASE_STATS_AGGS_FEEDBACKS . "` WHERE" . $this->GetNoneAggregatedDateMatch() . " AND `group_id`!= '') AS `totalall` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS_FEEDBACKS . "` WHERE" . $this->GetNoneAggregatedDateMatch() . " AND `group_id`!= '' GROUP BY `group_id`;");
     while ($row = DBManager::FetchArray($result)) {
         if (isset(Server::$Groups[$row["group_id"]])) {
             $graphData[$row["group_id"]] = array();
             foreach ($statTitles as $title) {
                 if (isset($graphData[$row["group_id"]]) && !empty($row["totalgroup"])) {
                     $graphData[$row["group_id"]][] = $row["tc" . count($graphData[$row["group_id"]])] / $row["totalgroup"];
                 }
             }
             $avg = round(array_sum($graphData[$row["group_id"]]) / count($graphData[$row["group_id"]]), 2);
             $rows[$row["group_id"]] = str_replace("<!--title-->", isset(Server::$Groups[$row["group_id"]]) ? Server::$Groups[$row["group_id"]]->Id : "<!--lang_stats_unknown-->", $trow);
             $rows[$row["group_id"]] = str_replace("<!--rel_amount-->", @round(100 * $row["totalgroup"] / $row["totalall"], StatisticProvider::$RoundPrecision), $rows[$row["group_id"]]);
             $rows[$row["group_id"]] = str_replace("<!--abs_amount-->", $row["totalgroup"] . " (" . $avg . ")", $rows[$row["group_id"]]);
             $rows[$row["group_id"]] = str_replace("<!--count-->", ++$counter, $rows[$row["group_id"]]);
         }
     }
     foreach (Server::$Groups as $id => $group) {
         if (!isset($rows[$id]) && !$group->IsDynamic) {
             $rows[$id] = str_replace("<!--title-->", $group->Id, $trow);
             $rows[$id] = str_replace("<!--rel_amount-->", 0, $rows[$id]);
             $rows[$id] = str_replace("<!--abs_amount-->", "-", $rows[$id]);
             $rows[$id] = str_replace("<!--count-->", ++$counter, $rows[$id]);
             $graphData[$id] = array();
             foreach ($statTitles as $title) {
                 $graphData[$id][] = 0;
             }
         }
     }
     foreach ($rows as $hrow) {
         $hrows .= $hrow;
     }
     $html = str_replace("<!--rows-->", $hrows, IOStruct::GetFile(TEMPLATE_HTML_STATS_TOP_TABLE));
     $html = str_replace("<!--column_count_width-->", "12", $html);
     $html = str_replace("<!--expand_all-->", "none", $html);
     $html = str_replace("<!--expand_all_block-->", "", $html);
     $tlist = array(LocalizationManager::$TranslationStrings["stats_stars"]);
     foreach ($statTitles as $title) {
         $tlist[] = LocalizationManager::$TranslationStrings[$title];
     }
     $html = str_replace("<!--graph-->", $this->GetGraphImageTag($graphData, $tlist, true), $html);
     $html = str_replace("<!--width-->", $this->GetGraphWidth(), $html);
     $html = str_replace("<!--column_value_title-->", "<!--lang_stats_group-->", $html);
     $html = str_replace("<!--description-->", "<!--lang_stats_absolute-->: <!--lang_stats_feedbacks--> (" . LocalizationManager::$TranslationStrings["stats_stars"] . ")", $html);
     return str_replace("<!--title-->", "<!--lang_stats_feedbacks-->", $html);
 }
 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, "");
 }