本文整理汇总了PHP中CDatabase::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CDatabase::Add方法的具体用法?PHP CDatabase::Add怎么用?PHP CDatabase::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDatabase
的用法示例。
在下文中一共展示了CDatabase::Add方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
function Add($arFields)
{
global $DB;
unset($arFields["ID"]);
if (!$this->CheckFields($arFields)) {
return false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
$arLID = array();
$str_LID = "''";
if (is_set($arFields, "LID")) {
if (is_array($arFields["LID"])) {
$arLID = $arFields["LID"];
} else {
$arLID[] = $arFields["LID"];
}
$arFields["LID"] = false;
foreach ($arLID as $v) {
$arFields["LID"] = $v;
$str_LID .= ", '" . $DB->ForSql($v) . "'";
}
}
$ID = CDatabase::Add("b_event_message", $arFields, array("MESSAGE"));
if (count($arLID) > 0) {
$strSql = "DELETE FROM b_event_message_site WHERE EVENT_MESSAGE_ID=" . $ID;
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$strSql = "INSERT INTO b_event_message_site(EVENT_MESSAGE_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_LID . ") ";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
return $ID;
}
示例2: Edit
public static function Edit($Params = array())
{
global $DB, $CACHE_MANAGER;
$arFields = $Params['arFields'];
// Get current user id
$userId = isset($Params['userId']) && intVal($Params['userId']) > 0 ? intVal($Params['userId']) : CCalendar::GetCurUserId();
if (!$userId && isset($arFields['CREATED_BY'])) {
$userId = intVal($arFields['CREATED_BY']);
}
$path = !empty($Params['path']) ? $Params['path'] : CCalendar::GetPath($arFields['CAL_TYPE'], $arFields['OWNER_ID'], true);
if ($userId < 0) {
return false;
}
if (!self::CheckFields($arFields)) {
return false;
}
if ($arFields['CAL_TYPE'] == 'user') {
$CACHE_MANAGER->ClearByTag('calendar_user_' . $arFields['OWNER_ID']);
}
$bNew = !isset($arFields['ID']) || $arFields['ID'] <= 0;
$arFields['TIMESTAMP_X'] = CCalendar::Date(mktime(), true, false);
if ($bNew) {
if (!isset($arFields['CREATED_BY'])) {
$arFields['CREATED_BY'] = $userId;
}
if (!isset($arFields['DATE_CREATE'])) {
$arFields['DATE_CREATE'] = $arFields['TIMESTAMP_X'];
}
}
$attendees = is_array($arFields['ATTENDEES']) ? $arFields['ATTENDEES'] : array();
if (!isset($arFields['OWNER_ID']) || !$arFields['OWNER_ID']) {
$arFields['OWNER_ID'] = 0;
}
if (!isset($arFields['LOCATION']['OLD']) && !$bNew) {
// Select meeting info about event
if (isset($Params['currentEvent'])) {
$oldEvent = $Params['currentEvent'];
} else {
$oldEvent = CCalendarEvent::GetById($arFields['ID']);
}
if ($oldEvent) {
$arFields['LOCATION']['OLD'] = $oldEvent['LOCATION'];
}
}
$offset = CCalendar::GetOffset();
$arFields['LOCATION'] = CCalendar::SetLocation($arFields['LOCATION']['OLD'], $arFields['LOCATION']['NEW'], array('dateFrom' => CCalendar::Date($arFields['DT_FROM_TS'] + $offset), 'dateTo' => CCalendar::Date($arFields['DT_TO_TS'] + $offset), 'name' => $arFields['NAME'], 'persons' => count($attendees), 'attendees' => $attendees, 'bRecreateReserveMeetings' => $arFields['LOCATION']['RE_RESERVE'] !== 'N'));
$bSendInvitations = false;
if (!isset($arFields['IS_MEETING']) && isset($arFields['ATTENDEES']) && is_array($arFields['ATTENDEES']) && empty($arFields['ATTENDEES'])) {
$arFields['IS_MEETING'] = false;
}
$attendeesCodes = array();
if ($arFields['IS_MEETING'] && is_array($arFields['MEETING'])) {
if (!empty($arFields['ATTENDEES_CODES'])) {
$attendeesCodes = $arFields['ATTENDEES_CODES'];
$arFields['ATTENDEES_CODES'] = implode(',', $arFields['ATTENDEES_CODES']);
}
// Organizer
$bSendInvitations = $Params['bSendInvitations'] !== false;
$arFields['~MEETING'] = array('HOST_NAME' => $arFields['MEETING']['HOST_NAME'], 'TEXT' => $arFields['MEETING']['TEXT'], 'OPEN' => $arFields['MEETING']['OPEN'], 'NOTIFY' => $arFields['MEETING']['NOTIFY'], 'REINVITE' => $arFields['MEETING']['REINVITE']);
$arFields['MEETING'] = serialize($arFields['~MEETING']);
}
$arReminders = array();
if ($arFields['REMIND'] && is_array($arFields['REMIND'])) {
foreach ($arFields['REMIND'] as $remind) {
if (in_array($remind['type'], array('min', 'hour', 'day'))) {
$arReminders[] = array('type' => $remind['type'], 'count' => floatVal($remind['count']));
}
}
}
$arFields['REMIND'] = count($arReminders) > 0 ? serialize($arReminders) : '';
$AllFields = self::GetFields();
$dbFields = array();
foreach ($arFields as $field => $val) {
if (isset($AllFields[$field]) && $field != "ID") {
$dbFields[$field] = $arFields[$field];
}
}
CTimeZone::Disable();
if ($bNew) {
$ID = CDatabase::Add("b_calendar_event", $dbFields, array('DESCRIPTION', 'MEETING', 'RDATE', 'EXDATE'));
} else {
$ID = $arFields['ID'];
$strUpdate = $DB->PrepareUpdate("b_calendar_event", $dbFields);
$strSql = "UPDATE b_calendar_event SET " . $strUpdate . " WHERE ID=" . IntVal($arFields['ID']);
$DB->QueryBind($strSql, array('DESCRIPTION' => $arFields['DESCRIPTION'], 'MEETING' => $arFields['MEETING'], 'RDATE' => $arFields['RDATE'], 'EXDATE' => $arFields['EXDATE']));
}
CTimeZone::Enable();
if ($bNew && !isset($dbFields['DAV_XML_ID'])) {
$strSql = "UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array('DAV_XML_ID' => $ID)) . " WHERE ID=" . IntVal($ID);
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
// Clean links
// Del link from table
if (!$bNew) {
$arAffectedSections = CCalendarEvent::GetCurrentSectionIds($ID);
$DB->Query("DELETE FROM b_calendar_event_sect WHERE EVENT_ID=" . IntVal($ID), false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
} else {
$arAffectedSections = array();
}
$strSections = "0";
//.........这里部分代码省略.........
示例3: Add
public static function Add($arFields)
{
global $DB, $APPLICATION;
$APPLICATION->ResetException();
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "SYNC") && $arFields["SYNC"] != "Y") {
$arFields["SYNC"] = "N";
}
if (is_set($arFields, "CONVERT_UTF8") && $arFields["CONVERT_UTF8"] != "Y") {
$arFields["CONVERT_UTF8"] = "N";
}
if (is_set($arFields, "USER_GROUP_ACCESSORY") && $arFields["USER_GROUP_ACCESSORY"] != "Y") {
$arFields["USER_GROUP_ACCESSORY"] = "N";
}
if (!CLdapServer::CheckFields($arFields)) {
return false;
}
if (is_set($arFields, "ADMIN_PASSWORD")) {
$arFields["ADMIN_PASSWORD"] = CLdapUtil::Crypt($arFields["ADMIN_PASSWORD"]);
}
if (is_set($arFields, "FIELD_MAP") && is_array($arFields["FIELD_MAP"])) {
$arFields["USER_NAME_ATTR"] = "" . $arFields["FIELD_MAP"]["NAME"];
$arFields["USER_LAST_NAME_ATTR"] = "" . $arFields["FIELD_MAP"]["LAST_NAME"];
$arFields["USER_EMAIL_ATTR"] = "" . $arFields["FIELD_MAP"]["EMAIL"];
$arFields["FIELD_MAP"] = serialize($arFields["FIELD_MAP"]);
}
$ID = CDatabase::Add("b_ldap_server", $arFields);
if (is_set($arFields, 'GROUPS')) {
CLdapServer::SetGroupMap($ID, $arFields['GROUPS']);
}
if ($arFields["SYNC"] == "Y") {
CLdapServer::__UpdateAgentPeriod($ID, $arFields["SYNC_PERIOD"]);
}
return $ID;
}
示例4: Edit
public static function Edit($Params)
{
global $DB;
$source_id = false;
$arFields = $Params['arFields'];
$bNew = !isset($arFields['ID']) || $arFields['ID'] <= 0;
$bFile_FD = $Params['path'] && strlen($Params['path']) > 0;
$bFile_PC = $Params['file'] && strlen($Params['file']['name']) > 0 && $Params['file']['size'] > 0;
$io = CBXVirtualIo::GetInstance();
if ($bFile_FD || $bFile_PC) {
if ($bFile_FD) {
$DocRoot = CSite::GetSiteDocRoot(false);
$tmp_name = $DocRoot . $Params['path'];
if ($io->FileExists($tmp_name)) {
$flTmp = $io->GetFile($tmp_name);
$file_name = substr($Params['path'], strrpos($Params['path'], '/') + 1);
$arFile = array("name" => $file_name, "size" => $flTmp->GetFileSize(), "tmp_name" => $tmp_name, "type" => CFile::IsImage($file_name) ? 'image' : 'file');
}
} else {
if ($bFile_PC) {
$arFile = $Params['file'];
}
}
if (!CMedialib::CheckFileExtention($arFile["name"])) {
return false;
}
if (!$bNew) {
$arFile["old_file"] = CMedialibItem::GetSourceId($arFields['ID']);
$arFile["del"] = "Y";
}
// Resizing Image
if (CFile::IsImage($arFile["name"])) {
$arSize = array('width' => COption::GetOptionInt('fileman', "ml_max_width", 1024), 'height' => COption::GetOptionInt('fileman', "ml_max_height", 1024));
$res = CFile::ResizeImage($arFile, $arSize);
}
$arFile["MODULE_ID"] = "fileman";
$source_id = CFile::SaveFile($arFile, "medialibrary");
if ($source_id) {
$r = CFile::GetByID($source_id);
if ($arFile = $r->Fetch()) {
if (CFile::IsImage($arFile['FILE_NAME'])) {
CMedialibItem::GenerateThumbnail($arFile, array('width' => COption::GetOptionInt('fileman', "ml_thumb_width", 140), 'height' => COption::GetOptionInt('fileman', "ml_thumb_height", 105)));
}
$arFile['PATH'] = CMedialibItem::GetFullPath($arFile);
}
}
}
// TODO: Add error handling
if ($bNew && !$source_id) {
return false;
}
// 2. Add to b_medialib_item
if (!isset($arFields['~DATE_UPDATE'])) {
$arFields['~DATE_UPDATE'] = $DB->CurrentTimeFunction();
}
if (!CMedialibItem::CheckFields($arFields)) {
return false;
}
if (CModule::IncludeModule("search")) {
$arStem = stemming($arFields['NAME'] . ' ' . $arFields['DESCRIPTION'] . ' ' . $arFields['KEYWORDS'], LANGUAGE_ID);
if (count($arStem) > 0) {
$arFields['SEARCHABLE_CONTENT'] = '{' . implode('}{', array_keys($arStem)) . '}';
} else {
$arFields['SEARCHABLE_CONTENT'] = '';
}
}
if ($bNew) {
unset($arFields['ID']);
$arFields['SOURCE_ID'] = $source_id;
$arFields['~DATE_CREATE'] = $arFields['~DATE_UPDATE'];
$arFields['ITEM_TYPE'] = '';
$ID = CDatabase::Add("b_medialib_item", $arFields, array("DESCRIPTION", "SEARCHABLE_CONTENT"));
} else {
if ($source_id) {
$arFields['SOURCE_ID'] = $source_id;
}
$ID = $arFields['ID'];
unset($arFields['ID']);
$strUpdate = $DB->PrepareUpdate("b_medialib_item", $arFields);
$strSql = "UPDATE b_medialib_item SET " . $strUpdate . " WHERE ID=" . IntVal($ID);
$DB->QueryBind($strSql, array("DESCRIPTION" => $arFields["DESCRIPTION"], "SEARCHABLE_CONTENT" => $arFields["SEARCHABLE_CONTENT"]), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
// 3. Set fields to b_medialib_collection_item
if (!$bNew) {
$strSql = "DELETE FROM b_medialib_collection_item WHERE ITEM_ID=" . IntVal($ID);
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
$strCollections = "0";
for ($i = 0, $l = count($Params['arCollections']); $i < $l; $i++) {
$strCollections .= "," . IntVal($Params['arCollections'][$i]);
}
$strSql = "INSERT INTO b_medialib_collection_item(ITEM_ID, COLLECTION_ID) " . "SELECT " . intVal($ID) . ", ID " . "FROM b_medialib_collection " . "WHERE ID in (" . $strCollections . ")";
$res = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
if (!$arFields['ID']) {
$arFields['ID'] = $ID;
}
if ($source_id) {
$arFields = array_merge($arFile, $arFields);
}
return $arFields;
//.........这里部分代码省略.........
示例5: Add
function Add($arFields)
{
if (!CTask::CheckFields($arFields)) {
return false;
}
if (CACHED_b_task !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_task");
}
$ID = CDatabase::Add("b_task", $arFields);
return $ID;
}
示例6: Set
public function Set($data)
{
global $USER, $DB;
if ($this->Reset() !== false)
{
if (is_array($data) && count($data) > 0)
{
$arFields = array(
'ID' => $this->GetID(),
'MODULE_ID' => 'main',
'UNDO_TYPE' => 'autosave',
'UNDO_HANDLER' => 'CAutoSave::_Restore',
'CONTENT' => serialize($data),
'USER_ID' => $USER->GetID(),
'TIMESTAMP_X' => time()
);
CDatabase::Add("b_undo", $arFields, Array("CONTENT"));
}
return true;
}
return false;
}
示例7: Edit
public static function Edit($Params)
{
global $DB, $USER;
$arFields = $Params['arFields'];
if (!self::CheckFields($arFields)) {
return false;
}
$userId = intVal(isset($Params['userId']) ? $Params['userId'] : $USER->GetID());
//if (!CCalendarSect::CanDo('calendar_edit_section', $ID))
// return CCalendar::ThrowError('EC_ACCESS_DENIED');
$bNew = !isset($arFields['ID']) || $arFields['ID'] <= 0;
if (isset($arFields['COLOR']) || $bNew) {
$arFields['COLOR'] = CCalendar::Color($arFields['COLOR']);
}
$arFields['TIMESTAMP_X'] = CCalendar::Date(mktime());
if (is_array($arFields['EXPORT'])) {
$arFields['EXPORT'] = array('ALLOW' => !!$arFields['EXPORT']['ALLOW'], 'SET' => in_array($arFields['EXPORT']['set'], array('all', '3_9', '6_12')) ? $arFields['EXPORT']['set'] : 'all');
}
if (!is_array($arFields['EXPORT'])) {
$arFields['EXPORT'] = array('ALLOW' => false, 'SET' => 'all');
}
$arFields['EXPORT'] = serialize($arFields['EXPORT']);
if ($bNew) {
if (!isset($arFields['DATE_CREATE'])) {
$arFields['DATE_CREATE'] = CCalendar::Date(mktime());
}
if ((!isset($arFields['CREATED_BY']) || !$arFields['CREATED_BY']) && $USER) {
$arFields['CREATED_BY'] = $USER->IsAuthorized() ? $USER->GetID() : '';
}
unset($arFields['ID']);
$ID = CDatabase::Add("b_calendar_section", $arFields, array('DESCRIPTION'));
} else {
$ID = $arFields['ID'];
unset($arFields['ID']);
$strUpdate = $DB->PrepareUpdate("b_calendar_section", $arFields);
$strSql = "UPDATE b_calendar_section SET " . $strUpdate . " WHERE ID=" . IntVal($ID);
$DB->QueryBind($strSql, array('DESCRIPTION' => $arFields['DESCRIPTION']));
}
//SaveAccess
if ($ID > 0 && is_array($arFields['ACCESS'])) {
if ($arFields['CAL_TYPE'] == 'user' && $arFields['OWNER_ID'] == $userId || self::CanDo('calendar_edit_access', $ID)) {
self::SavePermissions($ID, $arFields['ACCESS']);
} elseif ($bNew) {
self::SavePermissions($ID, CCalendarSect::GetDefaultAccess($arFields['CAL_TYPE'], $arFields['OWNER_ID']));
}
}
if ($bNew && $ID > 0 && !isset($arFields['ACCESS'])) {
self::SavePermissions($ID, CCalendarSect::GetDefaultAccess($arFields['CAL_TYPE'], $arFields['OWNER_ID']));
}
CCalendar::ClearCache('section_list');
if ($ID > 0 && isset(self::$Permissions[$ID])) {
unset(self::$Permissions[$ID]);
self::$arOp = array();
}
return $ID;
}
示例8: SetSearchResult
public static function SetSearchResult($searchRes, $searchSess, $bClean = true)
{
global $DB;
$DB->Query("DELETE FROM b_file_search WHERE SESS_ID='" . $DB->ForSql($searchSess) . "'", false);
for ($i = 0, $l = count($searchRes); $i < $l; $i++) {
$arFields = array('SESS_ID' => $searchSess, 'F_PATH' => $searchRes[$i]['path'], 'B_DIR' => $searchRes[$i]['b_dir'], 'F_TIME' => $searchRes[$i]['time'], 'F_SIZE' => $searchRes[$i]['size']);
unset($arFields['NEW']);
CDatabase::Add("b_file_search", $arFields);
}
return $searchRes;
}
示例9: Add
public static function Add($arFields)
{
global $CACHE_MANAGER;
if (!CTask::CheckFields($arFields)) {
return false;
}
if (CACHED_b_task !== false) {
$CACHE_MANAGER->CleanDir("b_task");
}
$ID = CDatabase::Add("b_task", $arFields);
return $ID;
}
示例10: Edit
public static function Edit($Params)
{
global $DB;
$arFields = $Params['arFields'];
$XML_ID = preg_replace("/[^a-zA-Z0-9_]/i", "", $arFields['XML_ID']);
$arFields['XML_ID'] = $XML_ID;
if (!isset($arFields['XML_ID']) || $XML_ID == "") {
return false;
}
//return $APPLICATION->ThrowException(GetMessage("EC_ACCESS_DENIED"));
$access = $arFields['ACCESS'];
unset($arFields['ACCESS']);
if (count($arFields) > 1) {
if ($Params['NEW']) {
$strSql = "SELECT * FROM b_calendar_type WHERE XML_ID='" . $DB->ForSql($XML_ID) . "'";
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
if (!($arRes = $res->Fetch())) {
CDatabase::Add("b_calendar_type", $arFields, array('DESCRIPTION'));
} else {
false;
}
} else {
unset($arFields['XML_ID']);
if (count($arFields) > 0) {
$strUpdate = $DB->PrepareUpdate("b_calendar_type", $arFields);
$strSql = "UPDATE b_calendar_type SET " . $strUpdate . " WHERE XML_ID='" . $DB->ForSql($XML_ID) . "'";
$DB->QueryBind($strSql, array('DESCRIPTION' => $arFields['DESCRIPTION']));
}
}
}
//SaveAccess
if (self::CanDo('calendar_type_access', $XML_ID) && is_array($access)) {
self::SavePermissions($XML_ID, $access);
}
CCalendar::ClearCache('type_list');
return $XML_ID;
}
示例11: SetMeetingStatus
public static function SetMeetingStatus($userId, $eventId, $status = 'Q', $comment = '', $parentEventId)
{
CTimeZone::Disable();
global $DB, $CACHE_MANAGER;
$eventId = intVal($eventId);
$userId = intVal($userId);
if (!in_array($status, array("Q", "Y", "N", "H", "M"))) {
$status = "Q";
}
$event = CCalendarEvent::GetById($eventId, false);
if ($event && $event['IS_MEETING'] && intVal($event['PARENT_ID']) > 0) {
$strSql = "UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array("MEETING_STATUS" => $status)) . " WHERE PARENT_ID=" . intVal($event['PARENT_ID']) . " AND OWNER_ID=" . $userId;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
CCalendarSect::UpdateModificationLabel($event['SECT_ID']);
// If it's open meeting and our attendee is not on the list
if ($event['MEETING'] && $event['MEETING']['OPEN'] && ($status == 'Y' || $status == 'M')) {
$arAttendees = self::GetAttendees(array($event['PARENT_ID']));
$arAttendees = $arAttendees[$event['PARENT_ID']];
$attendeeExist = false;
foreach ($arAttendees as $attendee) {
if ($attendee['USER_ID'] == $userId) {
$attendeeExist = true;
break;
}
}
if (!$attendeeExist) {
// 1. Create another childEvent for new attendee
$AllFields = self::GetFields();
$dbFields = array();
foreach ($event as $field => $val) {
if (isset($AllFields[$field]) && $field != "ID" && $field != "ATTENDEES_CODES") {
$dbFields[$field] = $event[$field];
}
}
$dbFields['MEETING_STATUS'] = $status;
$dbFields['CAL_TYPE'] = 'user';
$dbFields['OWNER_ID'] = $userId;
$dbFields['PARENT_ID'] = $event['PARENT_ID'];
$dbFields['MEETING'] = serialize($event['MEETING']);
$dbFields['REMIND'] = serialize($event['REMIND']);
$eventId = CDatabase::Add("b_calendar_event", $dbFields, array('DESCRIPTION', 'MEETING', 'RDATE', 'EXDATE'));
$DB->Query("UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array('DAV_XML_ID' => $eventId)) . " WHERE ID=" . IntVal($eventId), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$sectionId = CCalendarSect::GetLastUsedSection('user', $userId, $userId);
if (!$sectionId || !CCalendarSect::GetById($sectionId, false)) {
$sectRes = CCalendarSect::GetSectionForOwner('user', $userId);
$sectionId = $sectRes['sectionId'];
}
if ($eventId && $sectionId) {
self::ConnectEventToSection($eventId, $sectionId);
}
// 2. Update ATTENDEES_CODES
$attendeesCodes = $event['ATTENDEES_CODES'];
$attendeesCodes[] = 'U' . intVal($userId);
$attendeesCodes = array_unique($attendeesCodes);
$DB->Query("UPDATE b_calendar_event SET " . "ATTENDEES_CODES='" . implode(',', $attendeesCodes) . "'" . " WHERE PARENT_ID=" . intVal($event['PARENT_ID']), false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
CCalendarSect::UpdateModificationLabel(array($sectionId));
}
}
// Notify author of event
if ($event['MEETING']['NOTIFY'] && $userId != $event['MEETING_HOST']) {
// Send message to the author
$fromTo = CCalendarEvent::GetEventFromToForUser($event, $event['MEETING_HOST']);
CCalendar::SendMessage(array('mode' => $status == "Y" ? 'accept' : 'decline', 'name' => $event['NAME'], "from" => $fromTo["DATE_FROM"], "to" => $fromTo["DATE_TO"], "location" => CCalendar::GetTextLocation($event["LOCATION"]), "comment" => $comment, "guestId" => $userId, "eventId" => $event['PARENT_ID'], "userId" => $event['MEETING_HOST']));
}
CCalendarSect::UpdateModificationLabel(array($event['SECTIONS'][0]));
$CACHE_MANAGER->ClearByTag('calendar_user_' . $userId);
$CACHE_MANAGER->ClearByTag('calendar_user_' . $event['CREATED_BY']);
}
CTimeZone::Enable();
CCalendar::ClearCache(array('attendees_list', 'event_list'));
}
示例12: Add
function Add($arFields)
{
global $DB;
CMailError::ResetErrors();
if ($arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if ($arFields["DELETE_MESSAGES"] != "Y") {
$arFields["DELETE_MESSAGES"] = "N";
}
if ($arFields["USE_MD5"] != "Y") {
$arFields["USE_MD5"] = "N";
}
if ($arFields["USE_TLS"] != "Y") {
$arFields["USE_TLS"] = "N";
}
if ($arFields["SERVER_TYPE"] != "smtp") {
$arFields["SERVER_TYPE"] = "pop3";
}
if (!CMailBox::CheckFields($arFields)) {
return false;
}
if (is_set($arFields, "PASSWORD")) {
$arFields["PASSWORD"] = CMailUtil::Crypt($arFields["PASSWORD"]);
}
$ID = CDatabase::Add("b_mail_mailbox", $arFields);
if (intval($arFields["PERIOD_CHECK"]) > 0 && $arFields["SERVER_TYPE"] == "pop3") {
CAgent::AddAgent("CMailbox::CheckMailAgent(" . $ID . ");", "mail", "N", intval($arFields["PERIOD_CHECK"]) * 60);
}
CMailbox::SMTPReload();
return $ID;
}
示例13: Add
public static function Add($arFields)
{
global $DB;
CMailError::ResetErrors();
if($arFields["ACTIVE"]!="Y")
$arFields["ACTIVE"]="N";
if($arFields["DELETE_MESSAGES"]!="Y")
$arFields["DELETE_MESSAGES"]="N";
if($arFields["USE_MD5"]!="Y")
$arFields["USE_MD5"]="N";
if($arFields["USE_TLS"]!="Y")
$arFields["USE_TLS"]="N";
if (!in_array($arFields["SERVER_TYPE"], array("pop3", "smtp", "imap")))
$arFields["SERVER_TYPE"] = "pop3";
if(!CMailBox::CheckFields($arFields))
return false;
if(is_set($arFields, "PASSWORD"))
$arFields["PASSWORD"]=CMailUtil::Crypt($arFields["PASSWORD"]);
if ($arFields['ACTIVE'] == 'Y' && $arFields['USER_ID'] != 0)
CUserCounter::Clear($arFields['USER_ID'], 'mail_unseen', $arFields['LID']);
$ID = CDatabase::Add("b_mail_mailbox", $arFields);
if(intval($arFields["PERIOD_CHECK"])>0 && $arFields["SERVER_TYPE"]=="pop3")
CAgent::AddAgent("CMailbox::CheckMailAgent(".$ID.");", "mail", "N", intval($arFields["PERIOD_CHECK"])*60);
CMailbox::SMTPReload();
return $ID;
}