function hide_show_menu_item($id, $key, $default = '')
{
    if ($extend = Extend::field('page', $key, $id)) {
        return Extend::value($extend, $default);
    }
    return $default;
}
Beispiel #2
0
function page_custom_field($key, $default = '')
{
    $id = Registry::prop('page', 'id');
    if ($extend = Extend::field('page', $key, $id)) {
        return Extend::value($extend, $default);
    }
    return $default;
}
Beispiel #3
0
/**
 * Returns an array of ids for posts that have the specified tag
 *
 * @param string
 * @return array
 */
function get_posts_with_tag($tag)
{
    $tag_ext = Extend::where('key', '=', 'post_tags')->get();
    $tag_id = $tag_ext[0]->id;
    $prefix = Config::db('prefix', '');
    $posts = array();
    foreach (Query::table($prefix . 'post_meta')->where('extend', '=', $tag_id)->where('data', 'LIKE', '%' . $tag . '%')->get() as $meta) {
        $posts[] = $meta->post;
    }
    return array_unique($posts);
}
Beispiel #4
0
 /**
  * Load data from DB.
  */
 public static function _loadDB()
 {
     self::$actions = array();
     self::$enabled = array();
     $mdl = new Modele('mod_list');
     $mdl->find();
     while ($mdl->next()) {
         self::$actions[$mdl->mod_action] = $mdl->mod_dir;
         if (!in_array($mdl->mod_dir, self::$enabled)) {
             self::$enabled[] = $mdl->mod_dir;
         }
     }
 }
Beispiel #5
0
 public static function listing($category = null, $page = 1, $per_page = 10, $language = false)
 {
     // get total
     $query = static::left_join(Base::table('users'), Base::table('users.id'), '=', Base::table('posts.author'))->where(Base::table('posts.status'), '=', 'published');
     if ($category) {
         $query->where(Base::table('posts.category'), '=', $category->id);
     }
     $total = $query->count();
     // get posts
     $posts = $query->sort(Base::table('posts.created'), 'desc')->take($per_page)->skip(--$page * $per_page)->get(array(Base::table('posts.*'), Base::table('users.id as author_id'), Base::table('users.bio as author_bio'), Base::table('users.real_name as author_name')));
     $outputPosts = array();
     if ($language !== false) {
         for ($i = 0; $i < count($posts); $i++) {
             $post_lang = Extend::value(Extend::field('post', 'targetlanguage', $posts[$i]->data["id"]));
             if ($post_lang === $language) {
                 $outputPosts[] = $posts[$i];
             }
         }
     } else {
         $outputPosts = $posts;
     }
     return array($total, $outputPosts);
 }
/**
 * Returns an array of unique tags that exist on post given post,
 * empty array if no tags are found.
 *
 * @return array
 */
function get_tags_for_post($post_id)
{
    $tag_ext = Extend::where('key', '=', 'post_tags')->where('type', '=', 'post')->get();
    $tag_id = $tag_ext[0]->id;
    $prefix = Config::db('prefix', '');
    $tags = array();
    $index = 0;
    $meta = Query::table($prefix . 'post_meta')->left_join('posts', 'posts.id', '=', 'post_meta.post')->where('posts.status', '=', 'published')->where('extend', '=', $tag_id)->where('post', '=', $post_id)->get();
    $post_meta = json_decode($meta[0]->data);
    if (!trim($post_meta->text) == "") {
        foreach (explode(",", $post_meta->text) as $tag_text) {
            $tags[$index] = trim($tag_text);
            $index += 1;
        }
    }
    return array_unique($tags);
}
            return Page::where('slug', '=', $str)->count() == 0;
        });
        $validator->check('title')->is_max(3, __('pages.title_missing'));
        $validator->check('slug')->is_max(3, __('pages.slug_missing'))->is_duplicate(__('pages.slug_duplicate'))->not_regex('#^[0-9_-]+$#', __('pages.slug_invalid'));
        if ($input['redirect']) {
            $validator->check('redirect')->is_url(__('pages.redirect_missing'));
        }
        if ($errors = $validator->errors()) {
            Input::flash();
            Notify::error($errors);
            return Response::redirect('admin/pages/add');
        }
        if (empty($input['name'])) {
            $input['name'] = $input['title'];
        }
        $input['show_in_menu'] = is_null($input['show_in_menu']) ? 0 : 1;
        $page = Page::create($input);
        Extend::process('page', $page->id);
        Notify::success(__('pages.created'));
        return Response::redirect('admin/pages');
    });
    /*
    	Delete Page
    */
    Route::get('admin/pages/delete/(:num)', function ($id) {
        Page::find($id)->delete();
        Query::table(Base::table('page_meta'))->where('page', '=', $id)->delete();
        Notify::success(__('pages.deleted'));
        return Response::redirect('admin/pages');
    });
});
Beispiel #8
0
     }
     $action = null;
     if (isset($_GET['action'])) {
         $action = $_GET['action'];
     }
     $action = basename($action);
 }
 if (!isset($page)) {
     $page = 'index';
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     }
     $page = basename($page);
 }
 // Recherche du module ...
 if (Extend::getAction($action) == false && !file_exists($root . 'action' . DS . $action . '.php')) {
     $action = 'syscore';
     $page = 'nomod';
 }
 // Etape 3, vérification des droits d'accès
 if (!isset($_SESSION['user'])) {
     $_SESSION['user'] = false;
 }
 $tpl->assign('_user', $_SESSION['user']);
 if ($_SESSION['user']) {
     $sections = $pdo->prepare('SELECT * FROM user_sections LEFT JOIN sections ON us_section = section_id WHERE us_user = ?');
     $sections->bindValue(1, $_SESSION['user']['user_id']);
     $sections->execute();
     $_SESSION['user']['sections'] = array();
     while ($line = $sections->fetch()) {
         $_SESSION['user']['sections'][$line['section_id']] = $line;
Beispiel #9
0
 });
 Route::post('admin/departments/add', function () {
     $input = Input::get(array('title', 'slug', 'description'));
     $validator = new validator($input);
     $validator->check('title')->is_max(3, __('departments.title_missing'));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/departments/add');
     }
     if (empty($input['slug'])) {
         $input['slug'] = $input['title'];
     }
     $input['slug'] = slug($input['slug']);
     $department = department::create($input);
     Extend::process('department', $department->id);
     Notify::success(__('departments.created'));
     return Response::redirect('admin/departments');
 });
 Route::get('admin/departments/delete/(:num)', function ($id) {
     $total = department::count();
     if ($total == 1) {
         Notify::error(__('departments.delete_error'));
         return Response::redirect('admin/departments/edit/' . $id);
     }
     $department = department::where('id', '<>', $id)->fetch();
     department::find($id)->delete();
     Post::where('department', '=', $id)->update(array('department' => $department->id));
     Notify::success(__('departments.deleted'));
     return Response::redirect('admin/departments');
 });
Beispiel #10
0
}
?>
                <div id="extended-fields">
                    <?php 
foreach ($fields as $field) {
    ?>
                        <p>
                            <label for="extend_<?php 
    echo $field->key;
    ?>
"><?php 
    echo $field->label;
    ?>
:</label>
                            <?php 
    echo Extend::html($field);
    ?>
                        </p>
                    <?php 
}
?>
                </div>
            </div>
        </fieldset>
    </form>

    <script src="<?php 
echo asset('anchor/views/assets/js/redirect.js');
?>
"></script>
    <script src="<?php 
Beispiel #11
0
                <p>

                    <?php 
if ($publicofpublication) {
    echo "<label for='extend_" . $publicofpublication->key . "'>" . $publicofpublication->label . "</label>";
    echo Form::select("extend[" . $publicofpublication->key . "]", array('scientific' => 'Scientifique', 'public' => 'Grand public'), 'public');
}
?>

                </p>

                <p>
                    <?php 
if ($customdate) {
    echo "<p><label for='extend_" . $customdate->key . "'>" . $customdate->label . "</label>" . Extend::html($customdate, 'date') . "</p>";
}
?>
                </p>

                <p>
                    <?php 
if ($externallink) {
    echo Form::text("extend[" . $externallink->key . "]", null, array('label' => $externallink->label, 'autocomplete' => 'off', 'id' => 'extend_' . $externallink->key));
}
?>
                </p>
                <?php 
echo addTargetLanguageSelect($targetLanguage);
?>
                <p>
Beispiel #12
0
     return View::create('users/add', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
 });
 Route::post('admin/users/add', function () {
     $input = Input::get(array('username', 'email', 'real_name', 'password', 'bio', 'status', 'role'));
     $validator = new Validator($input);
     $validator->check('username')->is_max(3, __('users.username_missing', 2));
     $validator->check('email')->is_email(__('users.email_missing'));
     $validator->check('password')->is_max(6, __('users.password_too_short', 6));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/users/add');
     }
     $input['password'] = Hash::make($input['password']);
     $user = User::create($input);
     Extend::process('user', $user->id);
     Notify::success(__('users.created'));
     return Response::redirect('admin/users');
 });
 /*
 	Delete user
 */
 Route::get('admin/users/delete/(:num)', function ($id) {
     $self = Auth::user();
     if ($self->id == $id) {
         Notify::error(__('users.delete_error'));
         return Response::redirect('admin/users/edit/' . $id);
     }
     User::where('id', '=', $id)->delete();
     Query::table(Base::table('user_meta'))->where('user', '=', $id)->delete();
     Notify::success(__('users.deleted'));
Beispiel #13
0
    Registry::set('currentPageNumber', $pageNumber);
    return new Template('page');
});
/**
 * Blog Page
 */
Route::get(array('blog', 'blog/(:any)'), function ($pageNumber = 1) {
    $page = Page::slug('blog');
    $category = Category::slug('blog');
    $per_page = Config::meta('posts_per_page');
    list($total, $posts) = Post::listing($category, $pageNumber, $per_page);
    //     get the last page
    $max_page = $total > $per_page ? ceil($total / $per_page) : 1;
    for ($i = 0; $i < count($posts); $i++) {
        $postId = $posts[$i]->data["id"];
        $posts[$i]->data['lang'] = Extend::value(Extend::field('post', 'targetlanguage', $postId));
    }
    // stop users browsing to non existing ranges
    if ($pageNumber > $max_page or $pageNumber < 1) {
        return Response::create(new Template('404'), 404);
    }
    Registry::set('posts', $posts);
    Registry::set('page', $page);
    Registry::set('category', $category);
    Registry::set('total_posts', $total);
    Registry::set('maxPageNumber', $max_page);
    Registry::set('currentPageNumber', $pageNumber);
    return new Template('page');
});
Route::get('upload/numpy', function () {
    return new Template('upload/send');
Beispiel #14
0
         Notify::error($errors);
         return Response::redirect('admin/posts/add');
     }
     if (empty($input['created'])) {
         $input['created'] = Date::mysql('now');
     }
     $user = Auth::user();
     $input['author'] = $user->id;
     if (is_null($input['comments'])) {
         $input['comments'] = 0;
     }
     if (empty($input['html'])) {
         $input['status'] = 'draft';
     }
     $post = Post::create($input);
     Extend::process('post', $post->id);
     Notify::success(__('posts.created'));
     return Response::redirect('admin/posts');
 });
 /*
 	Preview post
 */
 Route::post('admin/posts/preview', function () {
     $html = Input::get('html');
     // apply markdown processing
     $md = new Markdown();
     $output = Json::encode(array('html' => $md->transform($html)));
     return Response::create($output, 200, array('content-type' => 'application/json'));
 });
 /*
 	Delete post
Beispiel #15
0
function mdle_need_desc($table)
{
    global $_mdle_cache, $root;
    if (isset($_mdle_cache[$table])) {
        return $_mdle_cache[$table];
    }
    $file = $root . 'modeles' . DS . $table . '.yml';
    if (is_file($file)) {
        $data = spyc_load_file($file);
        $data['file'] = $table . '.yml';
        if (isset($data['name']) && $data['name'] == $table) {
            //$_mdle_cache[$data['name']] = $data;
            return $data;
        }
    }
    #Recherche modules
    foreach (Extend::getInstalledMods() as $mod) {
        $tables = $mod->getModels();
        if (isset($tables[$table])) {
            return $tables[$table];
        }
    }
    dbg_warning(__FILE__, "Il n'y a pas de fichier portant le nom d'un modèle demandé : {$table}", 1);
    // Peut-être qu'en chargeant tous les fichiers on va trouver le bon...
    mdle_get_tables();
    if (!isset($_mdle_cache[$table])) {
        dbg_error(__FILE__, "Le modèle demandé ({$table}) n'existe pas", 1);
    }
    return $_mdle_cache[$table];
}
Beispiel #16
0
function mod_update()
{
    $mod = new Extend($_GET['mod']);
    redirect('mod', 'index', array('hsuccess' => $mod->update()));
}
Beispiel #17
0
 });
 Route::post('admin/companies/add', function () {
     $input = Input::get(array('title', 'slug', 'description'));
     $validator = new validator($input);
     $validator->check('title')->is_max(3, __('companies.title_missing'));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/companies/add');
     }
     if (empty($input['slug'])) {
         $input['slug'] = $input['title'];
     }
     $input['slug'] = slug($input['slug']);
     $company = Company::create($input);
     Extend::process('company', $company->id);
     Notify::success(__('companies.created'));
     return Response::redirect('admin/companies');
 });
 Route::get('admin/companies/delete/(:num)', function ($id) {
     $total = Company::count();
     if ($total == 1) {
         Notify::error(__('companies.delete_error'));
         return Response::redirect('admin/companies/edit/' . $id);
     }
     $company = Company::where('id', '<>', $id)->fetch();
     Company::find($id)->delete();
     Post::where('company', '=', $id)->update(array('company' => $company->id));
     Notify::success(__('companies.deleted'));
     return Response::redirect('admin/companies');
 });
Beispiel #18
0
/**
 * Get a custom field value
 *
 * @param  string
 * @param  string
 * @return string
 */
function article_custom_field($key, $default = '', $id = null)
{
    if ($id == null) {
        $id = Registry::prop('article', 'id');
    }
    if ($extend = Extend::field('post', $key, $id)) {
        return Extend::value($extend, $default);
    }
    return $default;
}
Beispiel #19
0
     if ($input['redirect']) {
         $validator->check('redirect')->is_url(__('pages.redirect_missing'));
     }
     if ($errors = $validator->errors()) {
         Input::flash();
         // Notify::error($errors);
         return Response::json(array('id' => $id, 'errors' => array_flatten($errors, array())));
     }
     if (empty($input['name'])) {
         $input['name'] = $input['title'];
     }
     $input['show_in_menu'] = is_null($input['show_in_menu']) || empty($input['show_in_menu']) ? 0 : 1;
     $input['html'] = parse($input['markdown']);
     $page = Page::create($input);
     $id = $page->id;
     Extend::process('page', $id);
     // Notify::success(__('pages.created'));
     return Response::json(array('id' => $id, 'notification' => __('pages.created'), 'redirect' => Uri::to('admin/pages/edit/' . $id)));
 });
 /*
     Delete Page
 */
 Route::get('admin/pages/delete/(:num)', function ($id) {
     if (Page::count() > 1) {
         Page::find($id)->delete();
         Query::table(Base::table('page_meta'))->where('page', '=', $id)->delete();
         Notify::success(__('pages.deleted'));
     } else {
         Notify::error('Unable to delete page, you must have at least 1 page.');
     }
     return Response::redirect('admin/pages');
Beispiel #20
0
?>
                    <em><?php 
/*echo __('posts.custom_js_explain'); */
?>
</em>
                </p>-->
                <?php 
foreach ($fields as $field) {
    ?>
                    <?php 
    switch ($field->key) {
        case 'typeofproblem':
            echo "<p><label for='extend_" . $field->key . "'>" . $field->label . "</label>" . Extend::html($field) . "</p>";
            break;
        default:
            echo "<p><label for='extend_" . $field->key . "'>" . $field->label . "</label>" . Extend::html($field) . "</p>";
            break;
    }
    ?>
                <?php 
}
?>

                <aside class="buttons">
                    <?php 
echo Form::button(__('global.save'), array('type' => 'submit', 'class' => 'btn'));
?>

                    <?php 
echo Html::link('admin/posts/delete/' . $article->id, __('global.delete'), array('class' => 'btn delete red'));
?>
Beispiel #21
0
 /*
     List all posts and paginate through them
 */
 Route::get(array('admin/dossiers', 'admin/dossiers/(:num)', 'admin/dossiers/(:num)/(:any)'), function ($page = 1, $lang = 'all') {
     $lang = $lang == 'fr' || $lang == 'en' || ($lang = 'all') ? $lang : 'all';
     $currentPageCategoryId = getCurrentPageCategoryId('dossier');
     $url = Uri::to('admin/dossiers');
     $perpage = Config::meta('posts_per_page');
     $allPosts = Post::where('category', '=', $currentPageCategoryId)->sort('created', 'asc')->get();
     $allPostsSelectedLanguage = [];
     $curPagePosts = [];
     $indexFirstOk = ($page - 1) * $perpage;
     $indexLastOk = $indexFirstOk + $perpage;
     for ($i = 0; $i < count($allPosts); $i++) {
         //Getting all posts for selected language
         $allPosts[$i]->targetlanguage = Extend::value(Extend::field('post', 'targetlanguage', $allPosts[$i]->id));
         if ($lang == 'all' || $allPosts[$i]->targetlanguage == $lang) {
             $allPostsSelectedLanguage[] = $allPosts[$i];
         }
     }
     $i = $indexFirstOk;
     while ($i < count($allPostsSelectedLanguage) && $i < $indexLastOk) {
         //Getting all posts for current page
         $curPagePosts[] = $allPostsSelectedLanguage[$i];
         $i++;
     }
     $pagination = new Paginator($curPagePosts, count($allPostsSelectedLanguage), $page, $perpage, $url, $lang);
     $vars['messages'] = Notify::read();
     $vars['posts'] = $pagination;
     $vars['categories'] = Category::sort('title')->get();
     $vars['choosenlanguage'] = $lang;
Beispiel #22
0
            return Extend::where('key', '=', $str)->where('type', '=', $input['type'])->where('id', '<>', $id)->count() == 0;
        });
        $validator->check('key')->is_max(1, __('extend.key_missing'))->is_valid_key(__('extend.key_exists'));
        $validator->check('label')->is_max(1, __('extend.label_missing'));
        if ($errors = $validator->errors()) {
            Input::flash();
            Notify::error($errors);
            return Response::redirect('admin/extend/fields/edit/' . $id);
        }
        if ($input['field'] == 'image') {
            $attributes = Json::encode($input['attributes']);
        } elseif ($input['field'] == 'file') {
            $attributes = Json::encode(array('attributes' => array('type' => $input['attributes']['type'])));
        } else {
            $attributes = '';
        }
        Extend::update($id, array('type' => $input['type'], 'pagetype' => $input['pagetype'], 'field' => $input['field'], 'key' => $input['key'], 'label' => $input['label'], 'attributes' => $attributes));
        Notify::success(__('extend.field_updated'));
        return Response::redirect('admin/extend/fields/edit/' . $id);
    });
    /*
        Delete Field
    */
    Route::get('admin/extend/fields/delete/(:num)', function ($id) {
        $field = Extend::find($id);
        Query::table(Base::table($field->type . '_meta'))->where('extend', '=', $field->id)->delete();
        $field->delete();
        Notify::success(__('extend.field_deleted'));
        return Response::redirect('admin/extend/fields');
    });
});
Beispiel #23
0
    $vars['version'] = $version;
    $vars['url'] = sprintf($url, $version);
    return View::create('upgrade', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
});
/*
	List extend
*/
Route::get('admin/extend', array('before' => 'auth', 'main' => function ($page = 1) {
    $vars['messages'] = Notify::read();
    $vars['token'] = Csrf::token();
    return View::create('extend/index', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
}));
Route::post('admin/get_fields', array('before' => 'auth', 'main' => function () {
    $input = Input::get(array('id', 'pagetype'));
    // get the extended fields
    $vars['fields'] = Extend::fields('page', -1, $input['pagetype']);
    $html = View::create('pages/fields', $vars)->render();
    $token = '<input name="token" type="hidden" value="' . Csrf::token() . '">';
    return Response::json(array('token' => $token, 'html' => $html));
}));
/*
	Upload an image
*/
Route::post('admin/upload', array('before' => 'auth', 'main' => function () {
    $uploader = new Uploader(PATH . 'content', array('png', 'jpg', 'bmp', 'gif', 'pdf'));
    $filepath = $uploader->upload($_FILES['file']);
    $uri = Config::app('url', '/') . 'content/' . basename($filepath);
    $output = array('uri' => $uri);
    return Response::json($output);
}));
/*
Beispiel #24
0
     foreach ($input as $key => &$value) {
         $value = eq($value);
     }
     $validator = new Validator($input);
     $validator->check('title')->is_max(3, __('categories.title_missing'));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/categories/add');
     }
     if (empty($input['slug'])) {
         $input['slug'] = $input['title'];
     }
     $input['slug'] = slug($input['slug']);
     $category = Category::create($input);
     Extend::process('category', $category->id);
     Notify::success(__('categories.created'));
     return Response::redirect('admin/categories');
 });
 /*
     Delete Category
 */
 Route::get('admin/categories/delete/(:num)', function ($id) {
     $total = Category::count();
     if ($total == 1) {
         Notify::error(__('categories.delete_error'));
         return Response::redirect('admin/categories/edit/' . $id);
     }
     // move posts
     $category = Category::where('id', '<>', $id)->fetch();
     // delete selected
Beispiel #25
0
     }
     if (empty($input['created'])) {
         $input['created'] = Date::mysql('now');
     }
     $user = Auth::user();
     $input['author'] = $user->id;
     if (empty($input['comments'])) {
         $input['comments'] = 0;
     }
     if (empty($input['markdown'])) {
         $input['status'] = 'draft';
     }
     $input['html'] = parse($input['markdown']);
     $post = Post::create($input);
     $id = $post->id;
     Extend::process('post', $id);
     // Notify::success(__('posts.created'));
     if (Input::get('autosave') === 'true') {
         return Response::json(array('id' => $id, 'notification' => __('posts.updated')));
     } else {
         return Response::json(array('id' => $id, 'notification' => __('posts.created'), 'redirect' => Uri::to('admin/posts/edit/' . $id)));
     }
 });
 /*
     Preview post
 */
 Route::post('admin/posts/preview', function () {
     $markdown = Input::get('markdown');
     // apply markdown processing
     $md = new Markdown();
     $output = Json::encode(array('markdown' => $md->transform($markdown)));
Beispiel #26
0
echo '<div class="upload_explain">Glissez une image ici pour remplacer l\'image de votre livre.</div>' . '<div id="upload-file-progress"><progress value="0"></progress></div>';
echo "<img class='file-image-preview' src='/content/" . $bookimage->value->text . "'>";
echo Form::text("extend[" . $bookimage->key . "]", $bookimage->value->text, array('placeholder' => $bookimage->label, 'autocomplete' => 'off', 'id' => 'extend_' . $bookimage->key, 'class' => 'upload_filename hide'));
echo Form::text("extend[" . $typeofpublication->key . "]", null, array('placeholder' => $typeofpublication->label, 'id' => "extend_" . $typeofpublication->key, 'value' => 'book', 'class' => 'hide'));
?>
                <p>
                    <?php 
echo Form::textarea('description', Input::previous('description', $book->description), array('label' => 'Description du livre', 'autofocus' => 'false'));
?>
                    <em><?php 
echo __('posts.description_explain');
?>
</em>
                </p>
                <?php 
echo "<p><label for='extend_" . $externallink->key . "'>" . $externallink->label . "</label>" . Extend::html($externallink) . "</p>";
?>
                <?php 
echo addTargetLanguageSelect($targetLanguage);
?>
                <p>
                    <label for="status"><?php 
echo __('posts.status');
?>
:</label>
                    <?php 
echo Form::select('status', $statuses, Input::previous('status', $book->status));
?>
                    <em><?php 
echo __('posts.status_explain');
?>
Beispiel #27
0
/**
 * Execute un controleur
 * @global type $root
 * @param type $action
 * @param type $page
 */
function modexec($action, $page = 'index')
{
    global $root, $exec_mod, $exec_action, $exec_extend;
    $exec_extend = false;
    if (file_exists($root . 'action' . DS . $action . '.php')) {
        include_once $root . 'action' . DS . $action . '.php';
    } else {
        $exec_extend = Extend::getAction($action);
        $exec_extend->init($action);
    }
    $exec = false;
    if (function_exists($action . '_autoload')) {
        call_user_func($action . '_autoload', $page);
        $exec = true;
    }
    if (function_exists($action . '_' . $page)) {
        $exec_mod = $action;
        $exec_action = $page;
        call_user_func($action . '_' . $page);
        $exec = true;
    }
    if ($exec == false) {
        modexec('syscore', 'nopage');
    }
}