示例#1
0
function action_login()
{
    global $DETDB;
    if (check_login() && action_check_login()) {
        replace_page('index');
    }
    if (isset($_POST['form_login'])) {
        $checker = actions_zone('login_check');
        if (!in_array(false, $checker, true)) {
            $login = $_POST['form_login'];
            if ($user = $DETDB->select('users', 'ID, login, password, salt', true, "WHERE login='******'")) {
                $password = md5($_POST['form_password']);
                if (crypt($password, $user->salt) == $user->password) {
                    setcookie('user_ID', $user->ID, time() + get_option('cookie_login_live'), '/');
                    $hash = random_hash(10);
                    setcookie('user_hash', $hash, time() + get_option('cookie_login_live'), '/');
                    if ($DETDB->update('users', array('hash' => $hash, 'last_ip' => $_SERVER['REMOTE_ADDR'], 'last_activity' => date('c'), 'last_agent' => $_SERVER['HTTP_USER_AGENT']), "WHERE ID='" . $user->ID . "'")) {
                        $_COOKIE['user_ID'] = $user->ID;
                        $_COOKIE['user_hash'] = $hash;
                        $url = isset($_COOKIE['from_page']) ? $_COOKIE['from_page'] : 'index';
                        destroy_cookie('from_page');
                        int_user();
                        if (make_action('check_login')) {
                            replace_page($url);
                        }
                    }
                }
            }
            if (!$user || !isset($hash)) {
                push_output_message(array('text' => 'Неверный логин или пароль', 'title' => 'Ошибка!', 'class' => 'alert alert-danger', 'type' => 'error'));
            }
        }
    }
}
 public function doit()
 {
     if (check_rule($this->rule) && ($this->function != null && (is_string($this->function) && function_exists($this->function) || is_callable($this->function)))) {
         actions_zone("before_page_{$this->code}");
         call_user_func($this->function);
         actions_zone("after_page_{$this->code}");
     }
 }
 public function doit($params = null)
 {
     global $PAGE;
     if (check_rule($this->rule) && (!$this->auto || check_auto($PAGE->code, $this->auto))) {
         actions_zone("before_{$this->code}");
         if ($this->function != null && (is_string($this->function) && function_exists($this->function) || is_callable($this->function))) {
             return call_user_func($this->function, $params);
         }
         actions_zone("after_{$this->code}");
     }
 }
示例#4
0
function action_settings_main($pre = null)
{
    $custom = array('site_name' => '', 'current_template' => '', 'default_group' => '', 'login_agent' => false, 'login_ip' => false, 'cookie_login_live' => null);
    if (!isset($_POST['site_name'])) {
        $custom['site_name'] = get_option('site_name');
        $custom['current_template'] = get_option('current_template');
        $custom['default_group'] = get_option('default_group');
        $login = get_option('admin_check_login');
        $custom['login_ip'] = $login['login_ip'];
        $custom['login_agent'] = $login['login_agent'];
        $custom['cookie_login_live'] = get_option('cookie_login_live') / 60;
        set_glob_content(array('body' => $custom));
    }
    if (isset($_POST['site_name'])) {
        $data = $pre ? $pre : $_POST;
        $custom_new = set_merge($custom, $data, false, true);
        set_glob_content(array('body' => $custom_new));
        if ($custom_new['site_name'] && $custom_new['current_template'] && $custom_new['default_group']) {
            $checker = array();
            if ($custom['site_name'] != $custom_new['site_name']) {
                $checker[] = update_option('site_name', $custom_new['site_name']);
            }
            if ($custom['current_template'] != $custom_new['current_template']) {
                $checker[] = update_option('current_template', $custom_new['current_template']);
            }
            if ($custom['default_group'] != $custom_new['default_group']) {
                $checker[] = update_option('default_group', $custom_new['default_group']);
            }
            if ($custom['login_agent'] !== $custom_new['login_agent'] || $custom['login_ip'] !== $custom_new['login_ip']) {
                $checker[] = update_option('admin_check_login', array('login_ip' => $custom_new['login_ip'] != false, 'login_agent' => $custom_new['login_agent'] != false));
            }
            if ($custom['cookie_login_live'] != $custom_new['cookie_login_live']) {
                $checker[] = update_option('cookie_login_live', $custom_new['cookie_login_live'] * 60);
            }
            $checker = array_merge($checker, actions_zone('settings_checking', $data));
            if (!in_array(false, $checker, true)) {
                push_output_message(array('title' => 'Обновлено!', 'text' => 'Поля успешно обновлены', 'class' => 'alert alert-success'));
            } else {
                push_output_message(array('title' => 'Ошибка!', 'text' => 'Поля заполнены некорректно', 'class' => 'alert alert-danger', 'type' => 'error'));
            }
        } else {
            push_output_message(array('text' => 'Поля не заполнены', 'title' => 'Ошибка!', 'class' => 'alert alert-warning', 'type' => 'warning'));
        }
    }
}
示例#5
0
?>
                </label>
            </div></div>
            <hr />
            <h3>Cookie</h3>
            <div class="row">
                <div class="field form-group col-lg-4">
                    <label><?php 
echo 'Время жизни Cookie профиля (в мин)';
?>
</label>
                    <input name="cookie_login_live" type="number" class="form-control data-control" value="<?php 
echo $params['cookie_login_live'];
?>
" required>
                </div>
            </div>
            <?php 
actions_zone('settings_secure');
?>
        </div>
        <?php 
actions_zone('settings_panels');
?>
    </div>
    <hr />
    <button name="submit" type="submit" class="btn btn-primary" data-action="settings_update"><span class="glyphicon glyphicon-ok"></span> <?php 
echo 'Сохранить';
?>
</button>
</form>
示例#6
0
    <div class="container">
        <form class="form-signin" method="POST" role="form">
            <h2 class="form-signin-heading">Вход</h2>
            <div class="field form-group">
                <label>Логин</label>
                <div class="input-group">
                    <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                    <input type="text" name="form_login" class="form-control" placeholder="Введите ваш логин" value="" required autofocus />
                </div>
            </div>
            <div class="field form-group">
                <label>Пароль</label>
                <div class="input-group">
                    <span class="input-group-addon"><i class="glyphicon glyphicon-warning-sign"></i></span>
                    <input type="password" name="form_password" class="form-control" placeholder="Введите ваш пароль" value="" required />
                </div>
            </div>
            <?php 
actions_zone('login_fields');
?>
            <button class="btn btn-lg btn-primary btn-block" type="submit">Войти</button>
        </form>
        <?php 
show_output_result_messages();
?>
    </div>
<?php 
page_footer();
?>
</body>
</html>
示例#7
0
actions_zone('before_form_page');
//Формирование страницы
if (is_ajax()) {
    $PAGE->code = 'ajax_call';
} elseif (is_remote()) {
    $PAGE->code = 'remote_call';
} elseif (!$PAGE->code) {
    $key = get_current_key();
    $PAGE->title = $APAGES[$key]->title;
    $PAGE->code = $key;
}
uasort($APAGES, 'collector_sort');
foreach ($APAGES as $item) {
    if (count($item->childs) > 1) {
        usort($item->childs, 'apage_sort_child');
    }
}
uasort($SCRIPTS, 'collector_sort');
uasort($ACTIONS, 'collector_sort');
//Загрузка шаблонов
if (!is_connect()) {
    actions_zone('before_template');
    if ($APAGES[$PAGE->code]->skelet) {
        get_template('header.php');
    }
    show_apage($PAGE->code);
    if ($APAGES[$PAGE->code]->skelet) {
        get_template('footer.php');
    }
    actions_zone('after_template');
}
示例#8
0
            echo $item['desc'] ? '<p class="help-block">' . $item['desc'] . '</p>' : '';
            ?>
                        </div>
                    <?php 
        }
    } else {
        echo 'Пусто!';
    }
    ?>
                </fieldset>
            <?php 
}
?>
        </div>
        <?php 
actions_zone('edit_user_tabs');
?>
    </div>
    <hr />
    <div class="form-group">
        <button class="btn btn-primary" name="save"><span class="glyphicon glyphicon-ok"></span> Сохранить</button>
        <?php 
if (isset($user->ID)) {
    ?>
            <button class="btn btn-danger" name="delete" onclick="return false;"><span class="glyphicon glyphicon-trash"></span> Удалить пользователя</button>
        <?php 
}
?>
    </div>
    <input type="hidden" name="action" value="save" />
</form>
示例#9
0
文件: add.php 项目: taqtaq11/detemiro
                        <label data-code="<?php 
            echo $item['code'];
            ?>
" for="<?php 
            echo 'param-' . $item['code'];
            ?>
"><?php 
            echo $item['code'];
            ?>
</label>
                        <?php 
            echo $item['desc'] ? '<p class="help-block">' . $item['desc'] . '</p>' : '';
            ?>
                    </div>
                <?php 
        }
    } else {
        echo 'Пусто!';
    }
    ?>
            </fieldset>
        <?php 
}
?>
    </fieldset>
    <?php 
actions_zone('remote_keys_edit_fieldset');
?>
    <hr />
    <button class="btn btn-primary" name="save"><span class="glyphicon glyphicon-ok"></span> Сохранить</button>
</form>
示例#10
0
        $CONNECT->type = 'remote';
    } elseif ($CONNECT->host == $_SERVER['HTTP_HOST']) {
        $CONNECT->type = 'ajax';
    }
    if ($CONNECT->type) {
        require_once ABSPATH . INCLUDES . '/basic-load.php';
        global $BLOCK;
        if (!$BLOCK) {
            if ($CONNECT->type == 'remote' && (!check_remote_key($CONNECT->key) || $_SERVER['HTTP_USER_AGENT'] != 'DETWorker')) {
                echo 'Wrong key';
            } else {
                $CONNECT->action = canone_code($CONNECT->action);
                if (!preg_match('/^(' . $CONNECT->type . '_)/i', $CONNECT->action)) {
                    $CONNECT->action = $CONNECT->type . '_' . $CONNECT->action;
                }
                if ($CONNECT->params && check_json($CONNECT->params)) {
                    $CONNECT->params = json_decode($CONNECT->params, true);
                }
                if ($CONNECT->category == 'admin') {
                    require_once ABSPATH . '/' . ADMIN . INCLUDES . '/admin-load.php';
                } else {
                    require_once ABSPATH . INCLUDES . '/public/public-load.php';
                }
                require_once ABSPATH . INCLUDES . '/basic-doit.php';
                actions_zone($CONNECT->type . '_before_action', $CONNECT->params);
                make_action($CONNECT->action, $CONNECT->params);
                actions_zone($CONNECT->type . '_after_action', $CONNECT->params);
            }
        }
    }
}