add_apage(array('title' => 'Календарь событий', 'code' => 'calendar_event', 'parent' => '', 'rule' => 'calendar_event_admin', 'priority' => 30, 'category' => 'admin', 'function' => function () { get_module_template('panel.php'); })); add_apage(array('title' => 'Календарь событий', 'code' => 'calendar_event', 'rule' => 'public', 'priority' => 30, 'category' => 'public', 'function' => function () { get_module_template('public.php'); })); add_action(array('title' => 'Календарь событий', 'code' => 'remote_calendar_event', 'rule' => 'public', 'category' => 'public', 'function' => function ($params) { $_GET['month'] = isset($params['month']) ? $params['month'] : $_GET['month']; $_GET['year'] = isset($params['year']) ? $params['year'] : $_GET['year']; show_apage('calendar_event'); })); add_apage(array('title' => 'Календарь событий для обмена', 'code' => 'calendar_event_json', 'rule' => 'public', 'priority' => 30, 'category' => 'public', 'skelet' => false, 'function' => function () { show_calendar_events(array('links' => false, 'show' => 'json')); })); add_apage(array('title' => 'Добавить событие', 'category' => 'admin', 'code' => 'calendar_event_add', 'parent' => 'calendar_event', 'rule' => 'calendar_event_admin', 'priority' => -1, 'function' => function () { get_module_template('add.php'); })); add_script(array('type' => 'script', 'link' => get_module_file('js/jquery.datetimepicker.min.js'), 'priority' => '40', 'auto' => 'calendar_event_add', 'category' => 'admin', 'zone' => 'footer', 'code' => 'datetimepicker_js')); add_script(array('type' => 'style', 'link' => get_module_file('js/jquery.datetimepicker.min.css'), 'priority' => '35', 'auto' => 'calendar_event_add', 'category' => 'admin', 'zone' => 'footer', 'code' => 'datetimepicker_css')); add_script(array('type' => 'script', 'priority' => '49', 'auto' => 'calendar_event_add', 'category' => 'admin', 'zone' => 'footer', 'link' => 'http://momentjs.com/downloads/moment.min.js', 'code' => 'moment_js')); add_script(array('type' => 'script', 'priority' => '50', 'auto' => 'calendar_event_add', 'category' => 'admin', 'zone' => 'footer', 'code' => 'datetimepicker_doit', 'function' => function () { $option = get_option('calendar_events_range'); ?> <script> $(function(){ var time_start, time_end, min = null, max = null; var ID = ($('[name="event_ID"]:first-of-type').length) ? $('[name="event_ID"]:first-of-type').val() : ''; function check_calendar_events_near() { $('.datepicker-error').remove(); if($('.table_show table').length) {
<?php add_apage(array('code' => 'console', 'parent' => 'settings', 'title' => 'Консоль', 'rule' => 'admin_settings', 'category' => 'admin', 'priority' => 20, 'function' => function () { get_module_template('console.php'); })); add_action(array('code' => 'console_doit', 'function' => 'action_console_doit', 'rule' => 'admin, admin_settings', 'zone' => 'before_template', 'category' => 'admin', 'auto' => 'console')); function action_console_doit() { global $DETDB, $ACTIONS, $SCRIPTS, $BLOCK, $PAGE, $APAGES; set_glob_content(array('body' => array('', ''))); if (isset($_POST['input'])) { $input = $_POST['input']; $output = $input; ob_start(); $time_start = microtime(true); eval($output); $time_end = microtime(true); $output = ob_get_clean(); $time = number_format($time_end - $time_start, 7); set_glob_content(array('body' => array($input, $output))); push_output_message(array('title' => 'Выполнено!', 'text' => "Время выполнения вашего запроса: <b>{$time} сек</b>.", 'type' => 'success', 'class' => 'alert alert-success')); } }
<?php add_action(array('code' => 'include_admin_recaptcha', 'rule' => 'public', 'category' => 'admin', 'auto' => 'login', 'zone' => 'before_template', 'priority' => '-5', 'function' => function () { get_module_template('recaptchalib.php'); })); add_action(array('code' => 'show_admin_recaptcha', 'rule' => 'public', 'category' => 'admin', 'auto' => 'login', 'zone' => 'login_fields', 'priority' => '30', 'function' => function () { ?> <div class="field form-group"> <label>Проверочный код</label> <?php show_recaptcha(); ?> <p class="help-block">Введите код, представленный на изображении.</p> </div> <?php })); add_action(array('code' => 'check_admin_recaptcha', 'rule' => 'public', 'category' => 'admin', 'auto' => 'login', 'zone' => 'login_check', 'priority' => '30', 'function' => function () { $t = true; $private_key = get_option('admin_recaptcha_keys')[1]; if (isset($_POST['recaptcha_challenge_field'])) { $resp = recaptcha_check_answer($private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $t = false; push_output_message(array('text' => 'Ошибка заполнения проверочного кода', 'title' => 'Ошибка!', 'class' => 'alert alert-danger', 'type' => 'error')); } } return $t; })); function show_recaptcha($skin = 'white') { $public_key = get_option('admin_recaptcha_keys')[0];