Archived
1
0
Disbranĉigi 0
Ĉi tiu deponejo arĥiviĝis je 2024-01-28. Vi povas vidi kaj elŝuti dosierojn, sed ne povas puŝi nek raporti problemojn nek tirpeti.
blagoblag/res/lib/load.php

73 lines
2.1 KiB
PHP
Raw Normal View History

2019-02-11 00:20:33 -06:00
<?php
2019-02-13 20:43:32 -06:00
/* This file is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU Affero General
License as published by the Free Software Foundation.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. */
2019-02-11 00:20:33 -06:00
2019-02-11 10:41:39 -06:00
// PATH --> PATH
// Take a path from root and turn it into a relative path.
function root($path) {
return $GLOBALS['depth'] . $path;
}
2019-02-15 08:32:58 -06:00
2019-02-11 10:41:39 -06:00
// -------------------------------------
2019-02-13 20:43:32 -06:00
include(root("config.php"));
2019-02-11 10:41:39 -06:00
require_once root("vendor/autoload.php");
2019-02-13 20:43:32 -06:00
include(root("res/lib/string.php"));
include(root("res/lib/array.php"));
include(root("res/lib/user.php"));
2019-02-15 08:32:58 -06:00
include(root("res/lib/error.php"));
include(root("res/lib/sterilize.php"));
2019-02-13 20:43:32 -06:00
include(root("res/lib/db.php"));
2019-02-15 08:32:58 -06:00
include(root("res/lib/url.php"));
2019-02-18 23:24:07 -06:00
include(root("res/lib/post.php"));
2019-02-15 08:32:58 -06:00
include(root("res/lib/blagoblag.php"));
2019-02-13 20:43:32 -06:00
2019-02-11 10:41:39 -06:00
$loader= new Twig_Loader_Filesystem(root("res/themes/default/html"));
$twig = new Twig_Environment($loader, ['cache' =>
2019-02-18 23:24:07 -06:00
root('cache/'), 'autoescape' => false]);
2019-02-11 10:41:39 -06:00
2019-02-15 08:32:58 -06:00
// -------------------------------------
// global variable declaration
global $users; $users = user_ids();
global $user; $user = array();
2019-02-20 08:04:55 -06:00
global $posts; $posts = post_ids_recent();
global $post; $post = array();
2019-02-15 08:32:58 -06:00
$push_user_data = function($user_id) {
$user_name = user_name($user_id);
$GLOBALS['user'][$user_id] = user_data($user_id);
$GLOBALS['user'][$user_name] = user_data($user_id);
};
2019-02-20 08:04:55 -06:00
$push_post_data = function($post_id) {
$post_title = post_title($post_id);
$GLOBALS['post'][$post_id] = post_data($post_id);
$GLOBALS['post'][$post_title] = post_data($post_id);
};
2019-02-15 08:32:58 -06:00
2019-02-20 08:04:55 -06:00
array_map($push_user_data, $users);
array_map($push_post_data, $posts);
2019-02-15 08:32:58 -06:00
// -----------------
global $twig_exports;
$twig_exports = array('theme' => $GLOBALS['theme'],
'users' => $GLOBALS['users'],
2019-02-18 23:24:07 -06:00
'user' => $GLOBALS['user'],
'posts' => $GLOBALS['posts'],
2019-02-20 08:04:55 -06:00
'post' => $GLOBALS['post'],
'instance_title' => $GLOBALS['instance_title']);
2019-02-15 08:32:58 -06:00
2019-02-11 00:20:33 -06:00
?>