Пример #1
0
 function run()
 {
     $q = $this->get_param('query');
     if (empty($q)) {
         $q = functions::request_var('keyword');
     }
     if (loader::in_ajax()) {
         $keyword = trim($q);
     } else {
         $keyword = trim(urldecode($q));
     }
     $this->renderer->set_return('keyword', $keyword);
     $this->renderer->set_main_title('search');
     if (empty($q)) {
         return;
     }
     if (strings::strlen($keyword) < 3) {
         $this->renderer->set_message('sat.search_too_short', array('result' => false));
         $this->renderer->set_ajax_message('sat.search_too_short');
         return false;
     }
     // make search and redirect to it
     $id = $this->make_search($keyword);
     // redirect to search results
     $url = $this->_controller->get_context()->get_router()->make_url('/search/' . $id . '/');
     if (loader::in_ajax()) {
         $this->_controller->set_null_template();
         $this->renderer->set_ajax_message($this->_found ? sprintf('По вашему запросу найдено %d записей', $this->_found) : 'Подходящих записей не найдено')->set_ajax_result($this->_found)->set_ajax_redirect($url);
     } else {
         functions::redirect($url);
         core::get_instance()->halt();
     }
 }
Пример #2
0
/**
 * Entry point for editor interface
 *
 * @package    TwoFace
 * @author     Golovkin Vladimir <*****@*****.**> http://www.skillz.ru
 * @copyright  SurSoft (C) 2008
 * @version    $Id: index.php,v 1.2.6.1 2008/10/24 13:19:05 j4ck Exp $
 */
define('IN_MAIN', 'I think so');
define('IN_EDITOR', 'Hell year');
require '../modules/core/loader.php';
// disable cache
functions::headers_no_cache();
if (!core::lib('auth')->logged_in() || 'admin' != core::lib('auth')->get_user()->get_level()) {
    // disable auth
    functions::redirect('/');
    exit;
}
$module = core::get_params()->module;
if (!empty($module) && 'core' != $module) {
    try {
        if ($mod = core::module($module)) {
            $mod->on_editor();
        }
    } catch (modules_exception $e) {
        // module not found
        core::get_instance()->error404('Module not found');
    }
} else {
    // core handler
    core::get_instance()->on_editor();
Пример #3
0
// @fixme multifileuploader ua check fix
if (!empty($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'Shockwave Flash' && isset($_POST['_ua'])) {
    $_SERVER['HTTP_USER_AGENT'] = $_POST['_ua'];
    $_COOKIE['vidz0xoid'] = $_POST['_sid'];
    $_REQUEST['with_ajax'] = 1;
}
require '../modules/core/loader.php';
loader::bootstrap(array(loader::OPTION_CORE_PARAMS => array('editor' => true)));
// disable cache
functions::headers_no_cache();
/** @var tf_editor $editor */
$editor = core::lib('editor');
if (!core::lib('auth')->logged_in()) {
    core::dprint('Please login!');
    $editor->on_exception('Not logged in');
    functions::redirect('/editor/in/');
    return;
}
$core = core::selfie();
/** @var user_item */
$user = core::lib('auth')->get_user();
$path = @$_GET['req'];
// allow ng-redirect
if (strpos($core->request->uri(), '/editor/redirect') === 0) {
    // die('ng-redirect');
    $path = '/editor/core/redirect/';
}
try {
    core::module('users')->check_forged();
} catch (controller_exception $e) {
    $editor->on_exception($e->getMessage(), $e);
Пример #4
0
    //throw new controller_exception('Action not found');
} else {
    /**
     * Create post
     * supplied type_name and title
     */
    // @todo check rate
    if (!empty($post)) {
        if (empty($post['title'])) {
            $this->get_context()->get_core()->set_message('error_empty_title');
            $this->get_context()->get_core()->set_message_data($post, true);
        }
        try {
            $id = $post_handle->create_empty($post, $user);
        } catch (validator_exception $e) {
            $this->set_null_template();
            core::get_instance()->set_raw_message($e->getMessage());
            return;
        }
        if ($id) {
            // well done, move user to post edit
            $url = $this->get_context()->get_cp_links('post');
            $url = $url['url'] . $id . '/';
            functions::redirect($url);
            core::halt();
        } else {
            core::get_instance()->set_message(array('users', 'error_post_too_often'));
        }
        // redirect to this post
    }
}
Пример #5
0
<?php

/**
 * Login gate
 */
require '../../modules/core/loader.php';
loader::bootstrap();
core::get_instance(true);
if (core::lib('auth')->logged_in()) {
    return functions::redirect('../');
}
$token = '<input type="hidden" name="x_token" value="' . core::lib('auth')->token() . '" />';
?>
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Панель управления сайтом</title>
<link href="/vendor/bootstrap/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/vendor/toastr/toastr.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />


<style>

html,body {
    height:100%;
    background: url("/editor/templates/img/bg.png") repeat scroll 0 0 gray;
    margin:0;
    padding:0;