예제 #1
0
파일: session.php 프로젝트: rasuldev/torino
 /**
  * @return string
  */
 public static function CleanUpAgent()
 {
     global $DB;
     $maxlifetime = intval(ini_get("session.gc_maxlifetime"));
     if ($maxlifetime && !CSecuritySessionMC::isStorageEnabled()) {
         $strSql = "\n\t\t\t\tdelete from b_sec_session\n\t\t\t\twhere TIMESTAMP_X < " . CSecurityDB::SecondsAgo($maxlifetime) . "\n\t\t\t";
         if (CSecurityDB::Init()) {
             CSecurityDB::Query($strSql, "Module: security; Class: CSecuritySession; Function: CleanUpAgent; File: " . __FILE__ . "; Line: " . __LINE__);
         } else {
             $DB->Query($strSql, false, "Module: security; Class: CSecuritySession; Function: CleanUpAgent; File: " . __FILE__ . "; Line: " . __LINE__);
         }
     }
     return self::GC_AGENT_NAME;
 }
예제 #2
0
 function CleanUpAgent()
 {
     global $DB;
     $maxlifetime = intval(ini_get("session.gc_maxlifetime"));
     if ($maxlifetime && !defined("BX_SECURITY_SESSION_MEMCACHE_HOST")) {
         $strSql = "\n\t\t\t\tdelete from b_sec_session\n\t\t\t\twhere TIMESTAMP_X < " . CSecurityDB::SecondsAgo($maxlifetime) . "\n\t\t\t";
         if (CSecurityDB::Init()) {
             CSecurityDB::Query($strSql, "Module: security; Class: CSecuritySession; Function: CleanUpAgent; File: " . __FILE__ . "; Line: " . __LINE__);
         } else {
             $DB->Query($strSql, false, "Module: security; Class: CSecuritySession; Function: CleanUpAgent; File: " . __FILE__ . "; Line: " . __LINE__);
         }
     }
     return "CSecuritySession::CleanUpAgent();";
 }
예제 #3
0
 function dolog()
 {
     if (defined("ANTIVIRUS_CREATE_TRACE")) {
         $this->CreateTrace();
     }
     $uniq_id = md5($this->data);
     $rsLog = CSecurityDB::Query("SELECT * FROM b_sec_virus WHERE ID = '" . $uniq_id . "'", "Module: security; Class: CSecurityAntiVirus; Function: AddEventLog; File: " . __FILE__ . "; Line: " . __LINE__);
     $arLog = CSecurityDB::Fetch($rsLog);
     if ($arLog && $arLog["SENT"] == "Y") {
         CSecurityDB::Query("DELETE FROM b_sec_virus WHERE SENT = 'Y' AND TIMESTAMP_X < " . CSecurityDB::SecondsAgo($BX_SECURITY_AV_TIMEOUT * 60) . "", "Module: security; Class: CSecurityAntiVirus; Function: AddEventLog; File: " . __FILE__ . "; Line: " . __LINE__);
         $rsLog = CSecurityDB::Query("SELECT * FROM b_sec_virus WHERE ID = '" . $uniq_id . "'", "Module: security; Class: CSecurityAntiVirus; Function: AddEventLog; File: " . __FILE__ . "; Line: " . __LINE__);
         $arLog = CSecurityDB::Fetch($rsLog);
     }
     if (!$arLog) {
         $ss = $this->data;
         if (defined("ANTIVIRUS_CREATE_TRACE")) {
             foreach ($this->resultrules as $k => $v) {
                 $ss .= "\n" . $k . "=" . $v;
             }
         }
         if (defined("SITE_ID") && !defined("ADMIN_SECTION")) {
             $SITE_ID = SITE_ID;
         } else {
             $rsDefSite = CSecurityDB::Query("SELECT LID FROM b_lang WHERE ACTIVE='Y' ORDER BY DEF desc, SORT", "Module: security; Class: CSecurityAntiVirus; Function: AddEventLog; File: " . __FILE__ . "; Line: " . __LINE__);
             $arDefSite = CSecurityDB::Fetch($rsDefSite);
             if ($arDefSite) {
                 $SITE_ID = $arDefSite["LID"];
             } else {
                 $SITE_ID = false;
             }
         }
         $s = serialize(array("SEVERITY" => "SECURITY", "AUDIT_TYPE_ID" => "SECURITY_VIRUS", "MODULE_ID" => "security", "ITEM_ID" => "UNKNOWN", "REMOTE_ADDR" => $_SERVER["REMOTE_ADDR"], "USER_AGENT" => $_SERVER["HTTP_USER_AGENT"], "REQUEST_URI" => $_SERVER["REQUEST_URI"], "SITE_ID" => defined("SITE_ID") ? SITE_ID : false, "USER_ID" => false, "GUEST_ID" => array_key_exists("SESS_GUEST_ID", $_SESSION) && $_SESSION["SESS_GUEST_ID"] > 0 ? $_SESSION["SESS_GUEST_ID"] : false, "DESCRIPTION" => "==" . base64_encode($ss)));
         CSecurityDB::QueryBind("insert into b_sec_virus (ID, TIMESTAMP_X, SITE_ID, INFO) values ('" . $uniq_id . "', " . CSecurityDB::CurrentTimeFunction() . ", " . ($SITE_ID ? "'" . $SITE_ID . "'" : "null") . ", :INFO)", array("INFO" => base64_encode($s)), "Module: security; Class: CSecurityAntiVirus; Function: AddEventLog; File: " . __FILE__ . "; Line: " . __LINE__);
         @fclose(@fopen($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/managed_cache/b_sec_virus", "w"));
     }
 }
예제 #4
0
 /**
  * @param int $maxLifeTime
  * @return bool
  */
 public static function gc($maxLifeTime)
 {
     CSecurityDB::Query("\n\t\t\tdelete from b_sec_session\n\t\t\twhere TIMESTAMP_X < " . CSecurityDB::SecondsAgo($maxLifeTime) . "\n\t\t\t", "Module: security; Class: CSecuritySession; Function: gc; File: " . __FILE__ . "; Line: " . __LINE__);
     return true;
 }
예제 #5
0
 public static function UnlockTable($table_lock)
 {
     if (is_array($table_lock)) {
         CSecurityDB::Query("SELECT RELEASE_LOCK('" . $table_lock["lock_id"] . "')", "Module: security; Class: CSecurityDB; Function: UnlockTable; File: " . __FILE__ . "; Line: " . __LINE__);
     }
 }