function UnRegister($member_id)
 {
     if (($ar_member = CControllerMember::GetMember($member_id)) === false) {
         return false;
     }
     $arParameters = array();
     $oRequest = new CControllerServerRequestTo($ar_member, "unregister", $arParameters);
     $oResponse = $oRequest->Send();
     $arControllerLog = array('NAME' => 'UNREGISTRATION', 'CONTROLLER_MEMBER_ID' => $ar_member['ID'], 'STATUS' => 'Y', 'DESCRIPTION' => GetMessage("CTRLR_MEM_LOG_DISCON"));
     if ($oResponse == false) {
         $e = $GLOBALS['APPLICATION']->GetException();
         $arControllerLog['DESCRIPTION'] = $e->GetString();
         $result = false;
     } else {
         $result = $oResponse->OK();
         $arControllerLog['DESCRIPTION'] = $oResponse->text;
         if ($result === false) {
             $e = new CApplicationException(GetMessage("CTRLR_MEM_LOG_DISCON_ERR") . " " . $oResponse->text);
             $GLOBALS["APPLICATION"]->ThrowException($e);
         } else {
             CControllerMember::Update($ar_member['ID'], array('DISCONNECTED' => 'Y'));
         }
     }
     if ($result === false) {
         $arControllerLog['DESCRIPTION'] = $e->GetString() . "\r\n" . $arControllerLog['DESCRIPTION'];
         $arControllerLog['STATUS'] = 'N';
     }
     CControllerLog::Add($arControllerLog);
     return $result;
 }
예제 #2
0
 public static function GetByID($ID)
 {
     return CControllerLog::GetList(array(), array("ID" => IntVal($ID)));
 }
예제 #3
0
             $oResponse->status = "404 Command not found";
             $oResponse->text = GetMessage("CTRLR_WS_ERR_BAD_COMMAND");
         }
     } else {
         $oResponse->status = "404 Command not found";
         $oResponse->text = GetMessage("CTRLR_WS_ERR_BAD_COMMAND");
     }
     break;
 case 'log':
     $dbr = CControllerMember::GetByGuid($oRequest->member_id);
     if (!($ar = $dbr->Fetch())) {
         $oResponse->status = "484";
         $oResponse->text = GetMessage("CTRLR_WS_ERR_MEMB_NFOUND");
         break;
     }
     if (CControllerLog::Add(array("CONTROLLER_MEMBER_ID" => $ar["ID"], "NAME" => $oRequest->arParameters['NAME'], "DESCRIPTION" => $oRequest->arParameters['DESCRIPTION'])) > 0) {
         $oResponse->status = "200 OK";
     } else {
         $oResponse->status = "500 Execution error";
         $e = $APPLICATION->GetException();
         $oResponse->text = $e->GetString();
     }
     break;
 case 'update_counters':
     $dbr = CControllerMember::GetByGuid($oRequest->member_id);
     if (!($ar = $dbr->Fetch())) {
         $oResponse->status = "484";
         $oResponse->text = GetMessage("CTRLR_WS_ERR_MEMB_NFOUND");
         break;
     }
     if (is_array(CControllerMember::UpdateCounters($ar["ID"]))) {
예제 #4
0
 function ProcessTask($ID)
 {
     global $DB, $APPLICATION;
     $ID = IntVal($ID);
     $uniq = $APPLICATION->GetServerUniqID();
     $uniq = "X" . $uniq . "_ctask";
     $STATUS = "0";
     // locking the task
     if (!CControllerAgent::_Lock($uniq)) {
         AddMessage2Log('ERROR_GET_LOCK');
         return $STATUS;
     }
     // selecting task
     $strSql = "SELECT T.*, M.SHARED_KERNEL " . "FROM b_controller_task T LEFT JOIN b_controller_member M ON T.CONTROLLER_MEMBER_ID=M.ID " . "WHERE T.ID='" . $ID . "' AND T.STATUS<>'Y'";
     $db_task = $DB->Query($strSql);
     if ($ar_task = $db_task->Fetch()) {
         $arControllerLog = array('CONTROLLER_MEMBER_ID' => $ar_task["CONTROLLER_MEMBER_ID"], 'TASK_ID' => $ar_task['ID'], 'STATUS' => 'Y');
         $RESULT = '';
         $STATUS = 'Y';
         unset($INIT_EXECUTE_PARAMS);
         switch ($ar_task['TASK_ID']) {
             case 'SET_SETTINGS':
                 $arControllerLog['NAME'] = 'SET_SETTINGS';
                 $APPLICATION->ResetException();
                 $res = CControllerMember::SetGroupSettings($ar_task["CONTROLLER_MEMBER_ID"], $ar_task['ID']);
                 if ($res !== false) {
                     $RESULT = $res;
                 } else {
                     $e = $APPLICATION->GetException();
                     $STATUS = "F";
                     $RESULT = $e->GetString();
                     $arControllerLog['STATUS'] = 'N';
                 }
                 break;
             case 'CLOSE_MEMBER':
                 $arControllerLog['NAME'] = 'SITE_CLOSING';
                 $APPLICATION->ResetException();
                 $res = CControllerMember::CloseMember($ar_task["CONTROLLER_MEMBER_ID"], $ar_task['INIT_EXECUTE_PARAMS']);
                 if ($res !== false) {
                     $RESULT = $res;
                 } else {
                     $e = $APPLICATION->GetException();
                     $STATUS = "F";
                     $RESULT = $e->GetString();
                     $arControllerLog['STATUS'] = 'N';
                 }
                 break;
             case 'UPDATE':
                 $arControllerLog['NAME'] = 'SITE_UPDATE';
                 $APPLICATION->ResetException();
                 if ($ar_task["SHARED_KERNEL"] == "Y") {
                     $STATUS = "F";
                     $RESULT = GetMessage("CTRLR_TASK_ERR_KERNEL");
                     $arControllerLog['STATUS'] = 'N';
                 } else {
                     $command = 'require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/update_client.php");';
                     if ($ar_task["STATUS"] == "P" && strlen($ar_task["INIT_EXECUTE_PARAMS"]) > 0) {
                         $command .= 'echo trim(CUpdateControllerSupport::Update("' . EscapePHPString($ar_task["INIT_EXECUTE_PARAMS"]) . '"));';
                     } else {
                         $command .= 'echo trim(CUpdateControllerSupport::Update(""));';
                     }
                     $res = CControllerMember::RunCommand($ar_task["CONTROLLER_MEMBER_ID"], $command, array(), $ar_task['ID']);
                     if ($res !== false) {
                         if (($p = strpos($res, "|")) > 0) {
                             $result_code = substr($res, 0, $p);
                             $RESULT = substr($res, $p + 1);
                         } else {
                             $result_code = $res;
                             $RESULT = $res;
                         }
                         if ($result_code == 'ERR') {
                             $STATUS = "F";
                             $arControllerLog['STATUS'] = 'N';
                         } elseif ($result_code == 'STP0') {
                             $STATUS = "P";
                         } elseif ($result_code != 'FIN') {
                             $STATUS = "P";
                             $INIT_EXECUTE_PARAMS = $result_code;
                         } else {
                             $RESULT = GetMessage("CTRLR_TASK_UPD_COMPL");
                         }
                     } else {
                         $STATUS = "F";
                         $e = $APPLICATION->GetException();
                         $RESULT = $e->GetString();
                         $arControllerLog['STATUS'] = 'N';
                     }
                 }
                 break;
             case 'COUNTERS_UPDATE':
                 $arControllerLog['NAME'] = 'UPDATE_COUNTERS';
                 $APPLICATION->ResetException();
                 $res = CControllerMember::UpdateCounters($ar_task["CONTROLLER_MEMBER_ID"], $ar_task['ID']);
                 $RESULT = '';
                 if ($res !== false) {
                     foreach ($res as $k => $v) {
                         $RESULT .= "{$k}={$v};\r\n";
                     }
                 } else {
                     $e = $APPLICATION->GetException();
                     $STATUS = "F";
                     $RESULT = $e->GetString();
                     $arControllerLog['STATUS'] = 'N';
                 }
                 break;
             case 'REMOTE_COMMAND':
                 $APPLICATION->ResetException();
                 $arControllerLog['NAME'] = 'REMOTE_COMMAND';
                 if (strlen($ar_task['INIT_EXECUTE_PARAMS']) > 0) {
                     $ar_task['INIT_EXECUTE_PARAMS'] = unserialize($ar_task['INIT_EXECUTE_PARAMS']);
                 } else {
                     $ar_task['INIT_EXECUTE_PARAMS'] = array();
                 }
                 $res = CControllerMember::RunCommand($ar_task["CONTROLLER_MEMBER_ID"], $ar_task['INIT_EXECUTE'], $ar_task['INIT_EXECUTE_PARAMS'], $ar_task['ID']);
                 if ($res !== false) {
                     $RESULT = $res;
                 } else {
                     $STATUS = "F";
                     $e = $APPLICATION->GetException();
                     $RESULT = $e->GetString();
                     $arControllerLog['STATUS'] = 'N';
                 }
                 break;
             case 'SEND_FILE':
                 $APPLICATION->ResetException();
                 $arControllerLog['NAME'] = 'SEND_FILE';
                 break;
         }
         if (!isset($arControllerLog['DESCRIPTION'])) {
             $arControllerLog['DESCRIPTION'] = $RESULT;
         }
         CControllerLog::Add($arControllerLog);
         // updating status
         $arUpdateFields = array("STATUS" => $STATUS, "~DATE_EXECUTE" => $DB->CurrentTimeFunction(), "RESULT_EXECUTE" => $RESULT, "INDEX_SALT" => rand());
         if (isset($INIT_EXECUTE_PARAMS)) {
             $arUpdateFields["INIT_EXECUTE_PARAMS"] = $INIT_EXECUTE_PARAMS;
         }
         $arUpdateBinds = array();
         $strUpdate = $DB->PrepareUpdateBind("b_controller_task", $arUpdateFields, "", false, $arUpdateBinds);
         $strSql = "UPDATE b_controller_task SET " . $strUpdate . " WHERE ID=" . $ID;
         $arBinds = array();
         foreach ($arUpdateBinds as $field_id) {
             $arBinds[$field_id] = $arUpdateFields[$field_id];
         }
         $DB->QueryBind($strSql, $arBinds);
     }
     // unlocking
     CControllerAgent::_UnLock($uniq);
     return $STATUS;
 }
예제 #5
0
        }
        $ID = IntVal($ID);
        switch ($_REQUEST['action']) {
            case "delete":
                @set_time_limit(0);
                $DB->StartTransaction();
                if (!CControllerLog::Delete($ID)) {
                    $DB->Rollback();
                    $lAdmin->AddGroupError(GetMessage("CTRL_LOG_ADMIN_ERR_DELETE"), $ID);
                }
                $DB->Commit();
                break;
        }
    }
}
$rsData = CControllerLog::GetList(array($by => $order), $arFilter, array("nPageSize" => CAdminResult::GetNavSize($sTableID)));
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("CTRL_LOG_ADMIN_PAGETITLE")));
$arHeaders = array();
$arHeaders[] = array("id" => "TIMESTAMP_X", "content" => GetMessage("CTRL_LOG_ADMIN_COLUMN_CREATED"), "default" => true, "sort" => "timestamp_x");
$arHeaders[] = array("id" => "NAME", "content" => GetMessage("CTRL_LOG_ADMIN_COLUMN_NAME"), "default" => true, "sort" => "name");
$arHeaders[] = array("id" => "CONTROLLER_MEMBER_NAME", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_CLIENT"), "default" => true, "sort" => "controller_member_name");
$arHeaders[] = array("id" => "STATUS", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_STATUS"), "default" => true, "sort" => "status");
$arHeaders[] = array("id" => "TASK_NAME", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_TASK"), "default" => true, "sort" => "task_name");
$arHeaders[] = array("id" => "USER", "content" => GetMessage("CTRL_LOG_ADMIN_COLUMN_USER"), "default" => true);
$arHeaders[] = array("id" => "DESCRIPTION", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_DESC"));
$arHeaders[] = array("id" => "ID", "content" => "ID", "default" => true, "sort" => "id");
$lAdmin->AddHeaders($arHeaders);
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
예제 #6
0
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$ID = intval($ID);
$rsLog = CControllerLog::GetList(array(), array("=ID" => $ID));
$arLog = $rsLog->GetNext();
$APPLICATION->SetTitle(GetMessage("CTRL_LOG_DETAIL_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_popup_admin.php";
?>

<table class="edit-table" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td>
<table cellspacing="0" cellpadding="0" border="0" class="internal">
<?php 
if ($arLog) {
    ?>
	<?php 
    $arLogNames = CControllerLog::GetNameArray();
    $arTaskNames = CControllerTask::GetTaskArray();
    ?>
	<tr valign="top">
		<td nowrap align="right"><?php 
    echo GetMessage("CTRL_LOG_DETAIL_ID");
    ?>
:</td>
		<td nowrap width="100%"><?php 
    echo $arLog["ID"];
    ?>
</td>
	</tr>
	<tr valign="top">
		<td nowrap align="right"><?php 
    echo GetMessage("CTRL_LOG_DETAIL_TIMESTAMP_X");
예제 #7
0
        }
        $ID = IntVal($ID);
        switch ($_REQUEST['action']) {
            case "delete":
                @set_time_limit(0);
                $DB->StartTransaction();
                if (!CControllerLog::Delete($ID)) {
                    $DB->Rollback();
                    $lAdmin->AddGroupError(GetMessage("CTRL_LOG_ADMIN_ERR_DELETE"), $ID);
                }
                $DB->Commit();
                break;
        }
    }
}
$rsData = CControllerLog::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("CTRL_LOG_ADMIN_PAGETITLE")));
$arHeaders = array();
$arHeaders[] = array("id" => "TIMESTAMP_X", "content" => GetMessage("CTRL_LOG_ADMIN_COLUMN_CREATED"), "default" => true, "sort" => "timestamp_x");
$arHeaders[] = array("id" => "NAME", "content" => GetMessage("CTRL_LOG_ADMIN_COLUMN_NAME"), "default" => true, "sort" => "name");
$arHeaders[] = array("id" => "CONTROLLER_MEMBER_NAME", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_CLIENT"), "default" => true, "sort" => "controller_member_name");
$arHeaders[] = array("id" => "STATUS", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_STATUS"), "default" => true, "sort" => "status");
$arHeaders[] = array("id" => "TASK_NAME", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_TASK"), "default" => true, "sort" => "task_name");
$arHeaders[] = array("id" => "USER", "content" => GetMessage("CTRL_LOG_ADMIN_COLUMN_USER"), "default" => true);
$arHeaders[] = array("id" => "DESCRIPTION", "content" => GetMessage("CTRL_LOG_ADMIN_FILTER_DESC"));
$arHeaders[] = array("id" => "ID", "content" => "ID", "default" => true, "sort" => "id");
$lAdmin->AddHeaders($arHeaders);
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
예제 #8
0
    $arControllerLog = array('NAME' => 'AUTH', 'CONTROLLER_MEMBER_ID' => $ar["ID"], 'DESCRIPTION' => GetMessage("CTRLR_LOG_GOUSER") . ' (' . $USER->GetParam("LOGIN") . ')', 'STATUS' => 'Y');
} else {
    //Authorize as admin
    $param = 'Array(
		"LOGIN"=>"' . EscapePHPString($USER->GetParam("LOGIN")) . '",
		"NAME"=>"' . EscapePHPString($USER->GetParam("FIRST_NAME")) . '",
		"LAST_NAME"=>"' . EscapePHPString($USER->GetParam("LAST_NAME")) . '",
		"EMAIL"=>"' . EscapePHPString($USER->GetParam("EMAIL")) . '",
	)';
    $query = '
	CControllerClient::AuthorizeAdmin(' . $param . ');
	LocalRedirect("/");
	';
    $arControllerLog = array('NAME' => 'AUTH', 'CONTROLLER_MEMBER_ID' => $ar["ID"], 'DESCRIPTION' => GetMessage("CTRLR_LOG_GOADMIN") . ' (' . $USER->GetParam("LOGIN") . ')', 'STATUS' => 'Y');
}
CControllerLog::Add($arControllerLog);
$result = CControllerMember::RunCommandRedirect($ar["ID"], $query, array(), false);
if ($result !== false) {
    LocalRedirect($ar["URL"] . "/bitrix/main_controller.php?lang=" . LANGUAGE_ID, true);
} else {
    $e = $APPLICATION->GetException();
    require_once dirname(__FILE__) . "/../../main/include/prolog_admin_after.php";
    ShowError("Error: " . $e->GetString());
    ?>
	<a href="/bitrix/admin/controller_member_admin.php?lang=<?php 
    echo LANGUAGE_ID;
    ?>
"><?php 
    echo GetMessage("CTRLR_GOTO_BACK");
    ?>
</a>
            if (strlen($errorMessage) <= 0) {
                if (!CUpdateClient::UpdateStepHelps($temporaryUpdatesDir, $errorMessage)) {
                    $errorMessage .= "[CL04] " . GetMessage("SUPC_HE_UPD") . ". ";
                    CUpdateClient::AddMessage2Log(GetMessage("SUPC_HE_UPD"), "CL04");
                }
            }
            if (StrLen($errorMessage) > 0) {
                CUpdateClient::AddMessage2Log("Error: " . $errorMessage, "UPD_ERROR");
                echo "ERR" . $errorMessage;
                CControllerLog::Add(array("CONTROLLER_MEMBER_ID" => 0, "NAME" => "SITE_UPDATE_KERNEL", "STATUS" => "N", "DESCRIPTION" => $errorMessage));
            } else {
                echo "STP";
                echo count($arItemsUpdated) . "|";
                $bFirst = True;
                foreach ($arItemsUpdated as $key => $value) {
                    CUpdateClient::AddMessage2Log("Updated: " . $key . (StrLen($value) > 0 ? "(" . $value . ")" : ""), "UPD_SUCCESS");
                    echo ($bFirst ? "" : ", ") . $key . (StrLen($value) > 0 ? "(" . $value . ")" : "");
                    $bFirst = False;
                }
            }
        }
    } else {
        CUpdateClient::AddMessage2Log("Error: " . $errorMessage, "UPD_ERROR");
        echo "ERR" . $errorMessage;
        CControllerLog::Add(array("CONTROLLER_MEMBER_ID" => 0, "NAME" => "SITE_UPDATE_KERNEL", "STATUS" => "N", "DESCRIPTION" => $errorMessage));
    }
}
/************************************/
if (!defined("UPD_INTERNAL_CALL") || UPD_INTERNAL_CALL != "Y") {
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_after.php";
}