1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
blacklist.php
См. документацию.
1<?php
2
4
8
28{
29 const CategoryAuto = 0;
30 const CategoryManual = 1;
31
37 public static function getTableName()
38 {
39 return 'b_main_mail_blacklist';
40 }
41
47 public static function getMap()
48 {
49 return array(
50 'ID' => array(
51 'data_type' => 'integer',
52 'primary' => true,
53 'autocomplete' => true,
54 ),
55 'CATEGORY_ID' => array(
56 'data_type' => 'integer',
57 'required' => true,
58 'default_value' => self::CategoryAuto,
59 ),
60 'CODE' => array(
61 'data_type' => 'string',
62 'required' => true,
63 ),
64 'DATE_INSERT' => array(
65 'data_type' => 'datetime',
66 'required' => new DateTime(),
67 ),
68 );
69 }
70
76 public static function hasBlacklistedEmails()
77 {
78 static $hasEmails = null;
79 if ($hasEmails === null)
80 {
81 $row = static::getRow([
82 'select' => ['ID'],
83 'limit' => 1,
84 'order' => ['ID' => 'ASC'],
85 'cache' => ['ttl' => 36000]
86 ]);
87
88 $hasEmails = $row !== null;
89 }
90
91 return $hasEmails;
92 }
93
100 public static function insertBatch(array $list)
101 {
103 $helper = $connection->getSqlHelper();
104 $tableName = static::getTableName();
105 $dateNow = $helper->convertToDbDateTime(new DateTime());
106
107 foreach (self::divideList($list) as $batchList)
108 {
109 $values = [];
110 foreach ($batchList as $code)
111 {
112 $code = trim($code);
113 if (!$code)
114 {
115 continue;
116 }
117
118 $code = $helper->forSql($code);
119 $values[] = "$dateNow, \"$code\"";
120 }
121
122 if (empty($values))
123 {
124 return;
125 }
126
127 $values = '(' . implode('), (', $values) . ')';
128
129 $sql = $helper->getInsertIgnore($tableName, '(DATE_INSERT, CODE)', 'VALUES ' . $values);
130 $connection->query($sql);
131
132 static::getEntity()->cleanCache();
133 }
134 }
135
136 protected static function divideList(array $list, $limit = 300)
137 {
138 $length = count($list);
139 if ($length < $limit)
140 {
141 return array($list);
142 }
143
144 $result = array();
145 $partsCount = ceil($length / $limit);
146 for ($index = 0; $index < $partsCount; $index++)
147 {
148 $result[$index] = array_slice($list, $limit * $index, $limit);
149 }
150
151 return $result;
152 }
153}
$connection
Определения actionsdefinitions.php:38
static getConnection($name="")
Определения application.php:638
static divideList(array $list, $limit=300)
Определения blacklist.php:136
static insertBatch(array $list)
Определения blacklist.php:100
static hasBlacklistedEmails()
Определения blacklist.php:76
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936