本文整理汇总了PHP中CEventLog::Log方法的典型用法代码示例。如果您正苦于以下问题:PHP CEventLog::Log方法的具体用法?PHP CEventLog::Log怎么用?PHP CEventLog::Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEventLog
的用法示例。
在下文中一共展示了CEventLog::Log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: custom_mail
/**
* @see CEvent::HandleEvent()
* @see bxmail()
*
* @param string $to
* @param string $subject
* @param string $message
* @param string $additionalHeaders Additional headers setted by Bitrix.
*
* @return bool
*/
function custom_mail($to, $subject, $message, $additionalHeaders = '')
{
// Cache to send many mails in one script run.
static $transport, $sender;
try {
if (!$sender) {
if (!$transport) {
$host = COption::GetOptionString('sh.mailtransport', 'host');
if (COption::GetOptionInt('sh.mailtransport', 'ssl')) {
$host = 'ssl://' . $host;
}
$port = COption::GetOptionInt('sh.mailtransport', 'port');
$user = COption::GetOptionString('sh.mailtransport', 'username');
$password = COption::GetOptionString('sh.mailtransport', 'password');
$transport = new Net_SMTP($host, $port);
if (PEAR::isError($connectionResult = $transport->connect())) {
throw new Capall_MailTransportException($connectionResult);
}
// TODO Server without authentication?..
if (PEAR::isError($authenticationResult = $transport->auth($user, $password))) {
throw new Capall_MailTransportException($authenticationResult);
}
}
$sender = new Capall_MailTransport_Sender($transport);
}
$sender->send($to, $subject, $message, $additionalHeaders);
return true;
} catch (Capall_MailTransportException $error) {
CEventLog::Log('WARNING', 'MAILTRANSPORT_ERROR', 'sh.mailtransport', null, $error->__toString());
return false;
} catch (Exception $error) {
// Unknown error...
return false;
}
}
示例2: BXCreateSection
function BXCreateSection(&$fileContent, &$sectionFileContent, &$absoluteFilePath, &$sectionPath)
{
//Check quota
$quota = new CDiskQuota();
if (!$quota->CheckDiskQuota(array("FILE_SIZE" => strlen($fileContent) + strlen($sectionFileContent)))) {
$GLOBALS["APPLICATION"]->ThrowException($quota->LAST_ERROR, "BAD_QUOTA");
return false;
}
$io = CBXVirtualIo::GetInstance();
//Create dir
if (!$io->CreateDirectory($absoluteFilePath)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("PAGE_NEW_FOLDER_CREATE_ERROR") . "<br /> (" . htmlspecialcharsbx($absoluteFilePath) . ")", "DIR_NOT_CREATE");
return false;
}
//Create .section.php
$f = $io->GetFile($absoluteFilePath . "/.section.php");
if (!$GLOBALS["APPLICATION"]->SaveFileContent($absoluteFilePath . "/.section.php", $sectionFileContent)) {
return false;
}
//Create index.php
if (!$GLOBALS["APPLICATION"]->SaveFileContent($absoluteFilePath . "/index.php", $fileContent)) {
return false;
} else {
if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
$res_log['path'] = $sectionPath . "/index.php";
CEventLog::Log("content", "PAGE_ADD", "main", "", serialize($res_log));
}
}
return true;
}
示例3: put
public function put()
{
if ($this->_stateSaved) {
throw new \Exception("Log instance saved before");
}
$this->_stateSaved = true;
return \CEventLog::Log($this->_severity, $this->_type, $this->_moduleId, $this->_itemId, $this->_description);
}
示例4: Log
static function Log($object, $action, $id, $description)
{
if (!COption::GetOptionString("webdav", "webdav_log", "N") == "Y") {
return;
}
$type = CWebDavEventLog::_name($object, $action);
CEventLog::Log("NOTICE", $type, "webdav", $id, $description);
}
示例5: Log
function Log($object, $action, $id, $description = "", $title = "")
{
if (COption::GetOptionString("forum", "LOGS", "Q") <= "A") {
return false;
}
$arTypesTitle = array("FORUM_MESSAGE_APPROVE" => GetMessage("FORUM_MESSAGE_APPROVE"), "FORUM_MESSAGE_UNAPPROVE" => GetMessage("FORUM_MESSAGE_UNAPPROVE"), "FORUM_MESSAGE_MOVE" => GetMessage("FORUM_MESSAGE_MOVE"), "FORUM_MESSAGE_EDIT" => GetMessage("FORUM_MESSAGE_EDIT"), "FORUM_MESSAGE_DELETE" => GetMessage("FORUM_MESSAGE_DELETE"), "FORUM_MESSAGE_SPAM" => GetMessage("FORUM_MESSAGE_SPAM"), "FORUM_TOPIC_APPROVE" => GetMessage("FORUM_TOPIC_APPROVE"), "FORUM_TOPIC_UNAPPROVE" => GetMessage("FORUM_TOPIC_UNAPPROVE"), "FORUM_TOPIC_STICK" => GetMessage("FORUM_TOPIC_STICK"), "FORUM_TOPIC_UNSTICK" => GetMessage("FORUM_TOPIC_UNSTICK"), "FORUM_TOPIC_OPEN" => GetMessage("FORUM_TOPIC_OPEN"), "FORUM_TOPIC_CLOSE" => GetMessage("FORUM_TOPIC_CLOSE"), "FORUM_TOPIC_MOVE" => GetMessage("FORUM_TOPIC_MOVE"), "FORUM_TOPIC_EDIT" => GetMessage("FORUM_TOPIC_EDIT"), "FORUM_TOPIC_DELETE" => GetMessage("FORUM_TOPIC_DELETE"), "FORUM_TOPIC_SPAM" => GetMessage("FORUM_TOPIC_SPAM"), "FORUM_FORUM_EDIT" => GetMessage("FORUM_FORUM_EDIT"), "FORUM_FORUM_DELETE" => GetMessage("FORUM_FORUM_DELETE"));
$object = strToUpper($object);
$action = strToUpper($action);
$type = "FORUM_" . $object . "_" . $action;
$title = trim($title);
if (empty($title)) {
$title = $arTypesTitle[$type];
}
$description = trim($description);
CEventLog::Log("NOTICE", $type, "forum", $id, $description);
}
示例6: Init
//.........这里部分代码省略.........
},
fileNew: {
alt_name: "<?php
echo CUtil::JSEscape($altName);
?>
",
name: "<?php
echo CUtil::JSEscape($name_i);
?>
",
path: "<?php
echo CUtil::JSEscape($filePath);
?>
",
site: "<?php
echo CUtil::JSEscape($site);
?>
",
bDir: <?php
echo $bDir_i ? "true" : "false";
?>
,
size: "<?php
echo $bDir_i ? '-' : CFile::FormatSize($fTmp1->GetFileSize());
?>
",
date: "<?php
echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPath_i) + CTimeZone::GetOffset());
?>
"
}
};
</script><?php
return;
} elseif ($caseOption == 'replace') {
// We don't need to replace, couse it's one file
if (CFileMan::NormalizePath($pathTo . "/" . $name_i) == $filePath) {
continue;
}
$strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy'], true);
if ($strWarn != "") {
$arWarnings[] = $strWarn;
$log = false;
} elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) {
CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath);
}
} elseif ($caseOption == 'auto_rename') {
$strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $altName)), !$Params['bCopy']);
if ($strWarn != "") {
$arWarnings[] = $strWarn;
$log = false;
} elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) {
CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath);
}
} elseif ($caseOption == 'skip') {
continue;
}
} else {
$strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy']);
if ($strWarn != "") {
$arWarnings[] = $strWarn;
$log = false;
} elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) {
CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath);
}
}
$module_id = "fileman";
if (COption::GetOptionString($module_id, "log_page", "Y") == "Y" && $log) {
$res_log['copy_to'] = substr($pathTo, 1);
$res_log['path'] = substr($filePath, 1);
if ($Params['bCopy'] == "copy") {
if (!$bDir_i) {
CEventLog::Log("content", "FILE_COPY", "fileman", "", serialize($res_log));
} else {
CEventLog::Log("content", "SECTION_COPY", "fileman", "", serialize($res_log));
}
} else {
if (!$bDir_i) {
CEventLog::Log("content", "FILE_MOVE", "fileman", "", serialize($res_log));
} else {
CEventLog::Log("content", "SECTION_MOVE", "fileman", "", serialize($res_log));
}
}
}
}
}
$arWarnings;
?>
<script>
window.BXFM_result = {
status: "<?php
echo count($arWarnings) > 0 ? 'errors' : 'ok';
?>
",
errors: <?php
echo count($arWarnings) > 0 ? CUtil::PhpToJSObject($arWarnings) : '{}';
?>
};
</script><?php
}
示例7: _logError
protected static function _logError($event_name, $description)
{
\CEventLog::Log(self::SEVERITY_LEVEL, GetMessage('UMT_EVENT_LOG_AUDIT_TYPE'), \UMT_MODULE_NAME, $event_name, $description, defined('\\SITE_ID') ? \SITE_ID : false);
}
示例8: Update
//.........这里部分代码省略.........
while ($arProp = $props->Fetch()) {
if (!array_key_exists($arProp["VALUE"], $arDup)) {
$arFields["PROPERTY_VALUES"][$arProp["ID"]][$arProp['PROPERTY_VALUE_ID']] = array("VALUE" => $arProp["VALUE"], "DESCRIPTION" => $arProp["DESCRIPTION"]);
$arDup[$arProp["VALUE"]] = true;
//This is cure for files duplication bug
}
}
}
}
} else {
if (array_key_exists("PREVIEW_PICTURE", $arFields)) {
CFile::SaveForDB($arFields, "PREVIEW_PICTURE", "iblock");
}
if (array_key_exists("DETAIL_PICTURE", $arFields)) {
CFile::SaveForDB($arFields, "DETAIL_PICTURE", "iblock");
}
}
unset($arFields["IBLOCK_ID"]);
unset($arFields["WF_NEW"]);
unset($arFields["IBLOCK_SECTION_ID"]);
$bTimeStampNA = false;
if (is_set($arFields, "TIMESTAMP_X") && ($arFields["TIMESTAMP_X"] === NULL || $arFields["TIMESTAMP_X"] === false)) {
$bTimeStampNA = true;
unset($arFields["TIMESTAMP_X"]);
}
$strUpdate = $DB->PrepareUpdate("b_iblock_element", $arFields, "iblock");
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strSql = "UPDATE b_iblock_element SET " . $strUpdate . ($bTimeStampNA ? "TIMESTAMP_X=TIMESTAMP_X" : "TIMESTAMP_X=now()") . " WHERE ID=" . $ID;
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
if (array_key_exists("PROPERTY_VALUES", $arFields) && is_array($arFields["PROPERTY_VALUES"]) && count($arFields["PROPERTY_VALUES"]) > 0) {
CIBlockElement::SetPropertyValues($ID, $ar_element["IBLOCK_ID"], $arFields["PROPERTY_VALUES"]);
}
if (is_set($arFields, "IBLOCK_SECTION")) {
CIBlockElement::SetElementSection($ID, $arFields["IBLOCK_SECTION"], false, $arIBlock["RIGHTS_MODE"] === "E" ? $arIBlock["ID"] : 0);
}
if ($arIBlock["RIGHTS_MODE"] === "E") {
$obElementRights = new CIBlockElementRights($arIBlock["ID"], $ID);
if (array_key_exists("RIGHTS", $arFields) && is_array($arFields["RIGHTS"])) {
$obElementRights->SetRights($arFields["RIGHTS"]);
}
}
if (array_key_exists("IPROPERTY_TEMPLATES", $arFields)) {
$ipropTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($arIBlock["ID"], $ID);
$ipropTemplates->set($arFields["IPROPERTY_TEMPLATES"]);
}
if ($bUpdateSearch) {
CIBlockElement::UpdateSearch($ID, true);
}
if ($bWorkFlow) {
CIBlockElement::WF_CleanUpHistoryCopies($ID);
}
//Restore saved values
if ($SAVED_PREVIEW_PICTURE !== false) {
$arFields["PREVIEW_PICTURE_ID"] = $arFields["PREVIEW_PICTURE"];
$arFields["PREVIEW_PICTURE"] = $SAVED_PREVIEW_PICTURE;
} else {
unset($arFields["PREVIEW_PICTURE"]);
}
if ($SAVED_DETAIL_PICTURE !== false) {
$arFields["DETAIL_PICTURE_ID"] = $arFields["DETAIL_PICTURE"];
$arFields["DETAIL_PICTURE"] = $SAVED_DETAIL_PICTURE;
} else {
unset($arFields["DETAIL_PICTURE"]);
}
if ($arIBlock["FIELDS"]["LOG_ELEMENT_EDIT"]["IS_REQUIRED"] == "Y") {
$USER_ID = is_object($USER) ? intval($USER->GetID()) : 0;
$arEvents = GetModuleEvents("main", "OnBeforeEventLog", true);
if (empty($arEvents) || ExecuteModuleEventEx($arEvents[0], array($USER_ID)) === false) {
$rsElement = CIBlockElement::GetList(array(), array("=ID" => $ID, "CHECK_PERMISSIONS" => "N", "SHOW_NEW" => "Y"), false, false, array("ID", "NAME", "LIST_PAGE_URL", "CODE"));
$arElement = $rsElement->GetNext();
$res = array("ID" => $ID, "CODE" => $arElement["CODE"], "NAME" => $arElement["NAME"], "ELEMENT_NAME" => $arIBlock["ELEMENT_NAME"], "USER_ID" => $USER_ID, "IBLOCK_PAGE_URL" => $arElement["LIST_PAGE_URL"]);
CEventLog::Log("IBLOCK", "IBLOCK_ELEMENT_EDIT", "iblock", $arIBlock["ID"], serialize($res));
}
}
$Result = true;
/************* QUOTA *************/
$_SESSION["SESS_RECOUNT_DB"] = "Y";
/************* QUOTA *************/
}
$arFields["ID"] = $ID;
$arFields["IBLOCK_ID"] = $ar_element["IBLOCK_ID"];
$arFields["RESULT"] =& $Result;
if (isset($arFields["PREVIEW_PICTURE"]) && $arFields["PREVIEW_PICTURE"]["COPY_FILE"] == "Y" && $arFields["PREVIEW_PICTURE"]["copy"]) {
@unlink($arFields["PREVIEW_PICTURE"]["tmp_name"]);
@rmdir(dirname($arFields["PREVIEW_PICTURE"]["tmp_name"]));
}
if (isset($arFields["DETAIL_PICTURE"]) && $arFields["DETAIL_PICTURE"]["COPY_FILE"] == "Y" && $arFields["DETAIL_PICTURE"]["copy"]) {
@unlink($arFields["DETAIL_PICTURE"]["tmp_name"]);
@rmdir(dirname($arFields["DETAIL_PICTURE"]["tmp_name"]));
}
foreach (GetModuleEvents("iblock", "OnAfterIBlockElementUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("iblock_id_" . $arIBlock["ID"]);
}
return $Result;
}
示例9: unserialize
$abs_path = $DOC_ROOT . $path;
}
if (strlen($strWarning) <= 0) {
if ($REQUEST_METHOD == "POST" && strlen($save) > 0 && is_array($ids) && check_bitrix_sessid()) {
CFileMan::SaveMenu(array($site, $menufilename), $aMenuLinksTmp, $sMenuTemplateTmp);
$bEdit = true;
$module_id = "fileman";
if (COption::GetOptionString($module_id, "log_menu", "Y") == "Y") {
$mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
$mt = unserialize(str_replace("\\", "", $mt));
$res_log['menu_name'] = $mt[$name];
$res_log['path'] = substr($path, 1);
if (strlen($new) <= 0) {
CEventLog::Log("content", "MENU_EDIT", "fileman", "", serialize($res_log));
} else {
CEventLog::Log("content", "MENU_ADD", "fileman", "", serialize($res_log));
}
}
if (strlen($apply) <= 0) {
if (strlen($back_url) > 0) {
LocalRedirect("/" . ltrim($back_url, "/"));
} else {
LocalRedirect("/bitrix/admin/fileman_admin.php?" . $addUrl . "&site=" . $site . "&path=" . UrlEncode($path));
}
} else {
LocalRedirect("/bitrix/admin/fileman_menu_edit.php?" . $addUrl . "&site=" . $site . "&path=" . UrlEncode($path) . "&name=" . $name);
}
}
}
}
if ($bEdit) {
示例10: Delete
public static function Delete($ID)
{
global $DB, $APPLICATION, $USER;
$USER_ID = is_object($USER) ? intval($USER->GetID()) : 0;
$ID = IntVal($ID);
$APPLICATION->ResetException();
foreach (GetModuleEvents("iblock", "OnBeforeIBlockElementDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
$err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
$err_id = false;
if ($ex = $APPLICATION->GetException()) {
$err .= ': ' . $ex->GetString();
$err_id = $ex->GetID();
}
$APPLICATION->throwException($err, $err_id);
return false;
}
}
$arSql = array("ID='" . $ID . "'", "WF_PARENT_ELEMENT_ID='" . $ID . "'");
foreach ($arSql as $strWhere) {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tID\n\t\t\t\t\t,IBLOCK_ID\n\t\t\t\t\t,WF_PARENT_ELEMENT_ID\n\t\t\t\t\t,WF_STATUS_ID\n\t\t\t\t\t,PREVIEW_PICTURE\n\t\t\t\t\t,DETAIL_PICTURE\n\t\t\t\t\t,XML_ID as EXTERNAL_ID\n\t\t\t\t\t,CODE\n\t\t\t\t\t,NAME\n\t\t\t\tFROM b_iblock_element\n\t\t\t\tWHERE " . $strWhere . "\n\t\t\t\tORDER BY ID DESC\n\t\t\t";
$z = $DB->Query($strSql);
while ($zr = $z->Fetch()) {
$elementId = (int) $zr["ID"];
$VERSION = CIBlockElement::GetIBVersion($zr["IBLOCK_ID"]);
$db_res = CIBlockElement::GetProperty($zr["IBLOCK_ID"], $zr["ID"], "sort", "asc", array("PROPERTY_TYPE" => "F"));
$arIBlockFields = CIBLock::GetArrayByID($zr["IBLOCK_ID"], "FIELDS");
if (IntVal($zr["WF_PARENT_ELEMENT_ID"]) <= 0 && $arIBlockFields["LOG_ELEMENT_DELETE"]["IS_REQUIRED"] == "Y") {
$arEvents = GetModuleEvents("main", "OnBeforeEventLog", true);
if (empty($arEvents) || ExecuteModuleEventEx($arEvents[0], array($USER_ID)) === false) {
$rsElement = CIBlockElement::GetList(array(), array("=ID" => $ID), false, false, array("LIST_PAGE_URL", "NAME", "CODE"));
$arElement = $rsElement->GetNext();
$arIblock = CIBlock::GetArrayByID($zr['IBLOCK_ID']);
$res_log = array("ID" => $ID, "CODE" => $arElement["CODE"], "NAME" => $arElement["NAME"], "ELEMENT_NAME" => $arIblock["ELEMENT_NAME"], "USER_ID" => $USER_ID, "IBLOCK_PAGE_URL" => $arElement["LIST_PAGE_URL"]);
CEventLog::Log("IBLOCK", "IBLOCK_ELEMENT_DELETE", "iblock", $zr["IBLOCK_ID"], serialize($res_log));
}
}
$piId = \Bitrix\Iblock\PropertyIndex\Manager::resolveElement($zr["IBLOCK_ID"], $zr["ID"]);
foreach (GetModuleEvents("iblock", "OnIBlockElementDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($elementId, $zr));
}
while ($res = $db_res->Fetch()) {
CIBlockElement::DeleteFile($res["VALUE"], $zr["ID"], "PROPERTY", $zr["WF_PARENT_ELEMENT_ID"], $zr["IBLOCK_ID"]);
}
if ($VERSION == 2) {
if (!$DB->Query("DELETE FROM b_iblock_element_prop_m" . $zr["IBLOCK_ID"] . " WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
return false;
}
if (!$DB->Query("DELETE FROM b_iblock_element_prop_s" . $zr["IBLOCK_ID"] . " WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
return false;
}
} else {
if (!$DB->Query("DELETE FROM b_iblock_element_property WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
return false;
}
}
static $arDelCache = array();
if (!is_set($arDelCache, $zr["IBLOCK_ID"])) {
$arDelCache[$zr["IBLOCK_ID"]] = false;
$db_ps = $DB->Query("SELECT ID,IBLOCK_ID,VERSION,MULTIPLE FROM b_iblock_property WHERE PROPERTY_TYPE='E' AND (LINK_IBLOCK_ID=" . $zr["IBLOCK_ID"] . " OR LINK_IBLOCK_ID=0 OR LINK_IBLOCK_ID IS NULL)");
while ($ar_ps = $db_ps->Fetch()) {
if ($ar_ps["VERSION"] == 2) {
if ($ar_ps["MULTIPLE"] == "Y") {
$strTable = "b_iblock_element_prop_m" . $ar_ps["IBLOCK_ID"];
} else {
$strTable = "b_iblock_element_prop_s" . $ar_ps["IBLOCK_ID"];
}
} else {
$strTable = "b_iblock_element_property";
}
$arDelCache[$zr["IBLOCK_ID"]][$strTable][] = $ar_ps["ID"];
}
}
if ($arDelCache[$zr["IBLOCK_ID"]]) {
foreach ($arDelCache[$zr["IBLOCK_ID"]] as $strTable => $arProps) {
if (strncmp("b_iblock_element_prop_s", $strTable, 23) == 0) {
$tableFields = $DB->GetTableFields($strTable);
foreach ($arProps as $prop_id) {
$strSql = "UPDATE " . $strTable . " SET PROPERTY_" . $prop_id . "=null";
if (isset($tableFields["DESCRIPTION_" . $prop_id])) {
$strSql .= ",DESCRIPTION_" . $prop_id . "=null";
}
$strSql .= " WHERE PROPERTY_" . $prop_id . "=" . $zr["ID"];
if (!$DB->Query($strSql)) {
return false;
}
}
} elseif (strncmp("b_iblock_element_prop_m", $strTable, 23) == 0) {
$tableFields = $DB->GetTableFields(str_replace("prop_m", "prop_s", $strTable));
$strSql = "SELECT IBLOCK_PROPERTY_ID, IBLOCK_ELEMENT_ID FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
$rs = $DB->Query($strSql);
while ($ar = $rs->Fetch()) {
$strSql = "\n\t\t\t\t\t\t\t\t\tUPDATE " . str_replace("prop_m", "prop_s", $strTable) . "\n\t\t\t\t\t\t\t\t\tSET PROPERTY_" . $ar["IBLOCK_PROPERTY_ID"] . "=null\n\t\t\t\t\t\t\t\t\t" . (isset($tableFields["DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"]]) ? ",DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"] . "=null" : "") . "\n\t\t\t\t\t\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ar["IBLOCK_ELEMENT_ID"] . "\n\t\t\t\t\t\t\t\t";
if (!$DB->Query($strSql)) {
return false;
}
}
$strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
if (!$DB->Query($strSql)) {
return false;
//.........这里部分代码省略.........
示例11: OnModuleInstalledEvent
OnModuleInstalledEvent($id, 'Y', $Module);
if (COption::GetOptionString("main", "event_log_marketplace", "Y") === "Y") {
CEventLog::Log("INFO", "MP_MODULE_INSTALLED", "main", $id);
}
if ($Module->DoInstall() !== false) {
LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&mod=" . $id . "&result=OK");
} else {
$errorMessage = GetMessage("MOD_INSTALL_ERROR", array("#CODE#" => $id));
if ($e = $APPLICATION->GetException()) {
$errorMessageFull = $e->GetString();
}
}
} elseif (!$Module->IsInstalled() && strlen($_REQUEST["clear"]) > 0) {
if (strlen($Module->MODULE_ID) > 0 && ($mdir = getLocalPath("modules/" . $Module->MODULE_ID)) !== false) {
if (COption::GetOptionString("main", "event_log_marketplace", "Y") === "Y") {
CEventLog::Log("INFO", "MP_MODULE_DELETED", "main", $id);
}
DeleteDirFilesEx($mdir . "/");
LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&mod=" . $id . "&result=CLEAROK");
}
}
}
}
$sTableID = "upd_partner_modules_all";
$lAdmin = new CAdminList($sTableID);
$sTableID1 = "upd_partner_modules_new";
$lAdmin1 = new CAdminList($sTableID1);
$lAdmin->BeginPrologContent();
echo "<h2>" . GetMessage("MOD_SMP_AV_MOD") . "</h2><p>" . GetMessage("MOD_SMP_AV_MOD_TEXT1") . "<br />" . GetMessage("MOD_SMP_AV_MOD_TEXT2") . "</p>";
$lAdmin->EndPrologContent();
$arHeaders = array(array("id" => "NAME", "content" => GetMessage("MOD_NAME"), "default" => true), array("id" => "PARTNER", "content" => GetMessage("MOD_PARTNER"), "default" => true), array("id" => "VERSION", "content" => GetMessage("MOD_VERSION"), "default" => true), array("id" => "DATE_UPDATE", "content" => GetMessage("MOD_DATE_UPDATE"), "default" => true), array("id" => "DATE_TO", "content" => GetMessage("MOD_DATE_TO"), "default" => true), array("id" => "STATUS", "content" => GetMessage("MOD_SETUP"), "default" => true));
示例12: authenticate
/**
* For Bitrix calls.
*
* @param array &$params
*
* @return int
*/
public static function authenticate(&$params)
{
try {
// Import PEAR library gracefully...
if (!@(include_once 'Net/LDAP2.php')) {
throw new Capall_Ldaper_UnavailableDependencyException('PEAR::Net_LDAP2');
}
$ldapConnection = Net_LDAP2::connect(array('host' => COption::GetOptionString('sh.ldaper', 'host'), 'port' => COption::GetOptionInt('sh.ldaper', 'port'), 'binddn' => COption::GetOptionString('sh.ldaper', 'binddn'), 'bindpw' => COption::GetOptionString('sh.ldaper', 'bindpw')));
if (PEAR::isError($ldapConnection)) {
throw new Capall_Ldaper_LdapException($ldapConnection);
}
$ldaper = new self($ldapConnection, new Capall_Ldaper_BitrixUserManager(new CUser(), array_filter(explode(',', COption::GetOptionString('sh.ldaper', 'default_groups', '')), 'trim')), COption::GetOptionString('sh.ldaper', 'basedn'), COption::GetOptionString('sh.ldaper', 'login_attribute'), COption::GetOptionString('sh.ldaper', 'mail_attribute'), COption::GetOptionString('sh.ldaper', 'mail_attribute_index'));
$ldapUser = $ldaper->getLdapUser($params['LOGIN']);
if ($ldapUser) {
if ($ldaper->authenticateUser($ldapUser, $params['PASSWORD'])) {
$bitrixUserIdentifier = $ldaper->getBitrixUser($ldapUser);
} else {
// Authentication failed. May be user not from LDAP?
return false;
}
} else {
// User not found. It's normal use case.
return;
}
// Return identifier to Bitrix for authorization.
return $bitrixUserIdentifier;
} catch (Exception $error) {
CEventLog::Log('WARNING', 'USER_LOGIN', 'sh.ldaper', $params['LOGIN'], (string) $error);
}
}
示例13: count
CUpdateClientPartner::AddMessage2Log("Error: " . $errorMessage, "UPD_ERROR");
echo "ERR" . $errorMessage;
} else {
echo "STP";
echo count($arItemsUpdated) . "|";
$bFirst = True;
foreach ($arItemsUpdated as $key => $value) {
$strModuleDescr = "";
if (strlen($arItemsUpdatedDescr[$key]) > 0) {
$strModuleDescr = "<br>" . htmlspecialcharsback($arItemsUpdatedDescr[$key]);
$strModuleDescr = preg_replace("#</?pre>#i", " ", $strModuleDescr);
$strModuleDescr = preg_replace("/[\\s\n\r]+/", " ", $strModuleDescr);
$strModuleDescr = addslashes($strModuleDescr);
}
CUpdateClientPartner::AddMessage2Log("Updated: " . $key . (StrLen($value) > 0 ? " (" . $value . ")" : "") . $strModuleDescr, "UPD_SUCCESS");
if (COption::GetOptionString("main", "event_log_marketplace", "Y") === "Y") {
CEventLog::Log("INFO", "MP_MODULE_DOWNLOADED", "main", $key, $value);
}
echo ($bFirst ? "" : ", ") . $key . (StrLen($value) > 0 ? " (" . $value . ")" : "");
$bFirst = False;
}
}
}
} else {
CUpdateClientPartner::AddMessage2Log("Error: " . $errorMessage, "UPD_ERROR");
echo "ERR" . $errorMessage;
}
/************************************/
if (!defined("UPD_INTERNAL_CALL") || UPD_INTERNAL_CALL != "Y") {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_after.php";
}
示例14: OnBeforeProlog
function OnBeforeProlog()
{
if(defined("BX_CHECK_SHORT_URI") && BX_CHECK_SHORT_URI)
{
$upload_dir = "/".trim(COption::GetOptionString("main", "upload_dir", "upload"), "/")."/";
$request_uri = urldecode($_SERVER["REQUEST_URI"]);
$request_uri = CCloudUtil::URLEncode($request_uri, LANG_CHARSET);
foreach(CCloudStorageBucket::GetAllBuckets() as $arBucket)
{
if($arBucket["ACTIVE"] == "Y")
{
$obBucket = new CCloudStorageBucket($arBucket["ID"]);
if($obBucket->Init())
{
$match = array();
if(
COption::GetOptionString("clouds", "delayed_resize") === "Y"
&& preg_match("#^(/".$obBucket->PREFIX."|)(/resize_cache/.*\$)#", $request_uri, $match)
)
{
session_write_close();
$to_file = $obBucket->GetFileSRC(urldecode($match[2]));
if (CCloudStorage::ResizeImageFileCheck($obBucket, $to_file))
{
$cache_time = 3600*24*30; // 30 days
header("Cache-Control: max-age=".$cache_time);
header("Expires: ".gmdate("D, d M Y H:i:s", time()+$cache_time)." GMT");
header_remove("Pragma");
LocalRedirect($to_file, true, "301 Moved Permanently");
}
}
elseif($obBucket->FileExists($request_uri))
{
if(COption::GetOptionString("clouds", "log_404_errors") === "Y")
CEventLog::Log("WARNING", "CLOUDS_404", "clouds", $_SERVER["REQUEST_URI"], $_SERVER["HTTP_REFERER"]);
LocalRedirect($obBucket->GetFileSRC($request_uri), true);
}
elseif(strpos($request_uri, $upload_dir) === 0)
{
$check_url = substr($request_uri, strlen($upload_dir)-1);
if($obBucket->FileExists($check_url))
{
if(COption::GetOptionString("clouds", "log_404_errors") === "Y")
CEventLog::Log("WARNING", "CLOUDS_404", "clouds", $_SERVER["REQUEST_URI"], $_SERVER["HTTP_REFERER"]);
LocalRedirect($obBucket->GetFileSRC($check_url), true);
}
}
}
}
}
}
}
示例15: PreGenerateXML
public static function PreGenerateXML($xml_type = 'yandex')
{
if ($xml_type == 'yandex') {
$strYandexAgent = (string) Main\Config\Option::get('catalog', 'yandex_agent_file');
if ($strYandexAgent != '') {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $strYandexAgent) && is_file($_SERVER['DOCUMENT_ROOT'] . $strYandexAgent)) {
include_once $_SERVER['DOCUMENT_ROOT'] . $strYandexAgent;
} else {
CEventLog::Log('WARNING', 'CAT_YAND_FILE', 'catalog', 'YandexAgent', $strYandexAgent);
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/load/yandex.php";
}
} else {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/load/yandex.php";
}
}
global $pPERIOD;
$pPERIOD = (int) Main\Config\Option::get('catalog', 'yandex_xml_period') * 3600;
return 'CCatalog::PreGenerateXML("' . $xml_type . '");';
}