1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
2/* @var CMain $APPLICATION */
3/* @var CUser $USER */
4$module_id = 'subscribe';
5$POST_RIGHT = CMain::GetUserRight($module_id);
6if ($POST_RIGHT >= 'R') :
7IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/main/options.php');
9
11 ['allow_anonymous', GetMessage('opt_anonym'), ['checkbox', 'Y']],
12 ['show_auth_links', GetMessage('opt_links'), ['checkbox', 'Y']],
13 ['subscribe_section', GetMessage('opt_sect'), ['text', 35]],
14 ['posting_interval', GetMessage('opt_interval'), ['text', 5]],
15 ['max_bcc_count', GetMessage('opt_max_bcc_count'), ['text', 5]],
16 ['default_from', GetMessage('opt_def_from'), ['text', 35]],
17 ['default_to', GetMessage('opt_def_to'), ['text', 35]],
18 ['posting_charset', GetMessage('opt_encoding'), ['text-list', 3, 20]],
19 ['allow_8bit_chars', GetMessage('opt_allow_8bit'), ['checkbox', 'Y']],
20 ['mail_additional_parameters', GetMessage('opt_mail_additional_parameters'), ['text', 35]],
21 ['attach_images', GetMessage('opt_attach'), ['checkbox', 'Y']],
22 ['subscribe_confirm_period', GetMessage('opt_delete'), ['text', 5]],
23 ['subscribe_auto_method', GetMessage('opt_method'), ['selectbox', ['agent' => GetMessage('opt_method_agent'), 'cron' => GetMessage('opt_method_cron')]]],
24 ['subscribe_max_emails_per_hit', GetMessage('opt_max_per_hit'), ['text', 5]],
25 ['subscribe_template_method', GetMessage('opt_template_method'), ['selectbox', ['agent' => GetMessage('opt_method_agent'), 'cron' => GetMessage('opt_method_cron')]]],
26 ['subscribe_template_interval', GetMessage('opt_template_interval'), ['text', 10]],
27 ['max_files_size', GetMessage('opt_max_files_size'), ['text', 5]],
28];
30 ['DIV' => 'edit1', 'TAB' => GetMessage('MAIN_TAB_SET'), 'ICON' => 'subscribe_settings', 'TITLE' => GetMessage('MAIN_TAB_TITLE_SET')],
31 ['DIV' => 'edit2', 'TAB' => GetMessage('MAIN_TAB_RIGHTS'), 'ICON' => 'subscribe_settings', 'TITLE' => GetMessage('MAIN_TAB_TITLE_RIGHTS')],
32];
33$tabControl = new CAdminTabControl('tabControl', $aTabs);
34
35/* @var $request \Bitrix\Main\HttpRequest */
36$request = \Bitrix\Main\Context::getCurrent()->getRequest();
37
38if (
39 $request->isPost()
40 && (
41 (string)$request['Update'] !== ''
42 || (string)$request['Apply'] !== ''
43 || (string)$request['RestoreDefaults'] !== ''
44 )
45 && $POST_RIGHT === 'W'
47)
48{
49 if ((string)$request['RestoreDefaults'] !== '')
50 {
51 COption::RemoveOption('subscribe');
52 $z = CGroup::GetList('id', 'asc', ['ACTIVE' => 'Y', 'ADMIN' => 'N']);
53 while ($zr = $z->Fetch())
54 {
55 CMain::DelGroupRight($module_id, [$zr['ID']]);
56 }
57 }
58 else
59 {
60 foreach ($arAllOptions as $arOption)
61 {
62 $name = $arOption[0];
63 if ($arOption[2][0] == 'text-list')
64 {
65 $val = '';
66 foreach ($_POST[$name] as $postValue)
67 {
68 $postValue = trim($postValue);
69 if ($postValue !== '')
70 {
71 $val .= ($val !== '' ? ',' : '') . $postValue;
72 }
73 }
74 }
75 else
76 {
77 $val = $_POST[$name];
78 }
79
80 if ($arOption[2][0] == 'checkbox' && $val !== 'Y')
81 {
82 $val = 'N';
83 }
84
85 if ($name != 'mail_additional_parameters' || $USER->IsAdmin())
86 {
87 COption::SetOptionString($module_id, $name, $val);
88 }
89 }
90 }
91 CAgent::RemoveAgent('CPostingTemplate::Execute();', 'subscribe');
92 if (COption::GetOptionString('subscribe', 'subscribe_template_method') !== 'cron')
93 {
94 CAgent::AddAgent('CPostingTemplate::Execute();', 'subscribe', 'N', COption::GetOptionString('subscribe', 'subscribe_template_interval'));
95 }
96
97 $Update = (string)$request['Update'] . (string)$request['Apply'];
98 ob_start();
99 require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/admin/group_rights.php';
100 ob_end_clean();
101
102 if ($request['back_url_settings'] !== '')
103 {
104 if (((string)$request['Apply'] !== '') || ((string)$request['RestoreDefaults'] !== ''))
105 {
106 LocalRedirect($APPLICATION->GetCurPage() . '?mid=' . urlencode($module_id) . '&lang=' . urlencode(LANGUAGE_ID) . '&back_url_settings=' . urlencode($_REQUEST['back_url_settings']) . '&' . $tabControl->ActiveTabParam());
107 }
108 else
109 {
110 LocalRedirect($request['back_url_settings']);
111 }
112 }
113 else
114 {
115 LocalRedirect($APPLICATION->GetCurPage() . '?mid=' . urlencode($module_id) . '&lang=' . urlencode(LANGUAGE_ID) . '&' . $tabControl->ActiveTabParam());
116 }
117}
118
119?>
120<form method="post" action="<?php echo $APPLICATION->GetCurPage()?>?mid=<?=urlencode($module_id)?>&amp;lang=<?=LANGUAGE_ID?>">
121<?php
122$tabControl->Begin();
123$tabControl->BeginNextTab();
124
125 foreach ($arAllOptions as $Option)
126 {
127 $type = $Option[2];
129 ?>
130 <tr>
131 <td width="40%" <?php echo ($type[0] == 'textarea' || $type[0] == 'text-list') ? 'class="adm-detail-valign-top"' : '';?>>
132 <label for="<?php echo htmlspecialcharsbx($Option[0])?>"><?php echo $Option[1]?></label>
133 <td width="60%">
134 <?php
135 if ($type[0] == 'checkbox')
136 {
137 ?><input type="checkbox" name="<?php echo htmlspecialcharsbx($Option[0])?>" id="<?php echo htmlspecialcharsbx($Option[0])?>" value="Y" <?php echo ($val == 'Y') ? 'checked' : '';?>><?php
138 }
139 elseif ($type[0] == 'text')
140 {
141 ?><input type="text" size="<?php echo $type[1]?>" maxlength="255" value="<?php echo htmlspecialcharsbx($val)?>" name="<?php echo htmlspecialcharsbx($Option[0])?>"><?php
142 }
143 elseif ($type[0] == 'textarea')
144 {
145 ?><textarea rows="<?php echo $type[1]?>" cols="<?php echo $type[2]?>" name="<?php echo htmlspecialcharsbx($Option[0])?>"><?php echo htmlspecialcharsbx($val)?></textarea><?php
146 }
147 elseif ($type[0] == 'text-list')
148 {
149 $aVal = explode(',', $val);
150 foreach ($aVal as $val)
151 {
152 ?><input type="text" size="<?php echo $type[2]?>" value="<?php echo htmlspecialcharsbx($val)?>" name="<?php echo htmlspecialcharsbx($Option[0]) . '[]'?>"><br><?php
153 }
154 for ($j = 0; $j < $type[1]; $j++)
155 {
156 ?><input type="text" size="<?php echo $type[2]?>" value="" name="<?php echo htmlspecialcharsbx($Option[0]) . '[]'?>"><br><?php
157 }
158 }
159 elseif ($type[0] == 'selectbox')
160 {
161 ?><select name="<?php echo htmlspecialcharsbx($Option[0])?>"><?php
162 foreach ($type[1] as $optionValue => $optionDisplay)
163 {
164 ?><option value="<?php echo $optionValue?>" <?php echo ($val == $optionValue) ? 'selected' : '';?>><?php echo htmlspecialcharsbx($optionDisplay)?></option><?php
165 }
166 ?></select><?php
167 }
168 ?></td>
169 </tr>
170 <?php
171 }
172 ?>
173<?php $tabControl->BeginNextTab();?>
174<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/admin/group_rights.php';?>
175<?php $tabControl->Buttons();?>
176 <input <?php echo ($POST_RIGHT < 'W') ? 'disabled' : '';?> type="submit" name="Update" value="<?=GetMessage('MAIN_SAVE')?>" title="<?=GetMessage('MAIN_OPT_SAVE_TITLE')?>" class="adm-btn-save">
177 <input <?php echo ($POST_RIGHT < 'W') ? 'disabled' : '';?> type="submit" name="Apply" value="<?=GetMessage('MAIN_OPT_APPLY')?>" title="<?=GetMessage('MAIN_OPT_APPLY_TITLE')?>">
178 <?php if ($_REQUEST['back_url_settings'] <> ''):?>
179 <input <?php echo ($POST_RIGHT < 'W') ? 'disabled' : '';?> type="button" name="Cancel" value="<?=GetMessage('MAIN_OPT_CANCEL')?>" title="<?=GetMessage('MAIN_OPT_CANCEL_TITLE')?>" onclick="window.location='<?php echo htmlspecialcharsbx(CUtil::addslashes($_REQUEST['back_url_settings']))?>'">
180 <input type="hidden" name="back_url_settings" value="<?=htmlspecialcharsbx($_REQUEST['back_url_settings'])?>">
181 <?php endif?>
182 <input <?php echo ($POST_RIGHT < 'W') ? 'disabled' : '';?> type="submit" name="RestoreDefaults" title="<?php echo GetMessage('MAIN_HINT_RESTORE_DEFAULTS')?>" OnClick="return confirm('<?php echo addslashes(GetMessage('MAIN_HINT_RESTORE_DEFAULTS_WARNING'))?>')" value="<?php echo GetMessage('MAIN_RESTORE_DEFAULTS')?>">
183 <?=bitrix_sessid_post();?>
184<?php $tabControl->End();?>
185</form>
186<?php endif;
return select
Определения access_edit.php:440
$type
Определения options.php:106
const BX_ROOT
Определения bx_root.php:3
global $APPLICATION
Определения include.php:80
$module_id
Определения options.php:6
if($_SERVER $arAllOptions['REQUEST_METHOD']=='GET' &&!empty($_REQUEST['RestoreDefaults']) &&! $bReadOnly &&check_bitrix_sessid())
Определения options.php:63
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static GetList($by='c_sort', $order='asc', $arFilter=[], $SHOW_USERS_AMOUNT="N")
Определения group.php:136
static GetOptionString($module_id, $name, $def="", $site=false, $bExactSite=false)
Определения option.php:8
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
$zr
Определения options.php:5
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$Update
Определения options.php:212
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$tabControl
Определения csv_new_setup.php:244
$aTabs
Определения csv_new_setup.php:238
endif
Определения csv_new_setup.php:990
$z
Определения options.php:31
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
$name
Определения menu_edit.php:35
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76
font size
Определения invoice.php:442
$val
Определения options.php:1793
$optionValue
Определения options.php:3512
$POST_RIGHT
Определения options.php:3
else $Option[0]
Определения options.php:387