コード例 #1
0
ファイル: explorer.php プロジェクト: AroundPBT/PHPBoost
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ###################################################*/
require_once '../kernel/begin.php';
include_once '../wiki/wiki_functions.php';
load_module_lang('wiki');
define('TITLE', $LANG['wiki_explorer']);
$bread_crumb_key = 'wiki_explorer';
require_once '../wiki/wiki_bread_crumb.php';
$cat = retrieve(GET, 'cat', 0);
require_once '../kernel/header.php';
$template = new FileTemplate('wiki/explorer.tpl');
$module_data_path = $template->get_pictures_data_path();
//Contenu de la racine:
$root = '';
foreach (WikiCategoriesCache::load()->get_categories() as $key => $cat) {
    if ($cat['id_parent'] == 0) {
        $root .= '<li><a href="javascript:open_cat(' . $key . '); show_wiki_cat_contents(' . $cat['id_parent'] . ', 0);"><i class="fa fa-folder"></i>' . stripslashes($cat['title']) . '</a></li>';
    }
}
$result = PersistenceContext::get_querier()->select("SELECT title, id, encoded_title\n\tFROM " . PREFIX . "wiki_articles a\n\tWHERE id_cat = 0\n\tAND a.redirect = 0\n\tORDER BY is_cat DESC, title ASC");
while ($row = $result->fetch()) {
    $root .= '<li><a href="' . url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title']) . '"><i class="fa fa-file"></i>' . stripslashes($row['title']) . '</a></li>';
}
$result->dispose();
$template->put_all(array('TITLE' => $LANG['wiki_explorer'], 'L_ROOT' => $LANG['wiki_root'], 'SELECTED_CAT' => $cat > 0 ? $cat : 0, 'ROOT_CONTENTS' => $root, 'L_CATS' => $LANG['wiki_cats_tree']));
$contents = '';
$result = PersistenceContext::get_querier()->select("SELECT c.id, a.title, a.encoded_title\nFROM " . PREFIX . "wiki_cats c\nLEFT JOIN " . PREFIX . "wiki_articles a ON a.id = c.article_id\nWHERE c.id_parent = 0\nORDER BY title ASC");
コード例 #2
0
ファイル: gallery.php プロジェクト: AroundPBT/PHPBoost
     $error_controller = PHPBoostErrors::user_not_authorized();
     DispatchManager::redirect($error_controller);
 }
 $cat_links = '';
 foreach ($categories as $category) {
     if ($category->get_id() != Category::ROOT_CATEGORY && $category->get_id_parent() == $categories[$id_category]->get_id_parent()) {
         $cat_links .= ' <a href="' . GalleryUrlBuilder::get_link_cat($category->get_id()) . '">' . $category->get_name() . '</a> &raquo;';
     }
 }
 //Gestion erreur.
 $get_error = retrieve(GET, 'error', '');
 $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_max_dimension', 'e_upload_error', 'e_upload_php_code', 'e_upload_failed_unwritable', 'e_upload_already_exist', 'e_unlink_disabled', 'e_unsupported_format', 'e_unabled_create_pics', 'e_error_resize', 'e_no_graphic_support', 'e_unabled_incrust_logo', 'delete_thumbnails', 'upload_limit');
 if (in_array($get_error, $array_error)) {
     $tpl->put('message_helper', MessageHelper::display(LangLoader::get_message($get_error, 'errors'), MessageHelper::WARNING));
 }
 $module_data_path = $tpl->get_pictures_data_path();
 //Aficchage de la photo uploadée.
 if (!empty($g_idpics)) {
     try {
         $imageup = PersistenceContext::get_querier()->select_single_row(GallerySetup::$gallery_table, array('idcat', 'name', 'path'), 'WHERE id = :id', array('id' => $g_idpics));
     } catch (RowNotFoundException $e) {
         $error_controller = PHPBoostErrors::unexisting_element();
         DispatchManager::redirect($error_controller);
     }
     $tpl->assign_block_vars('image_up', array('NAME' => stripslashes($imageup['name']), 'IMG' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '&amp;id=' . $g_idpics . '#pics_max"><img src="pics/' . $imageup['path'] . '" alt="' . $imageup['name'] . '" /></a>', 'L_SUCCESS_UPLOAD' => $LANG['success_upload_img'], 'U_CAT' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '">' . $categories[$imageup['idcat']]->get_name() . '</a>'));
 }
 //Affichage du quota d'image uploadée.
 $category_authorizations = GalleryService::get_categories_manager()->get_heritated_authorizations($id_category, Category::WRITE_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY);
 $quota = isset($category_authorizations['r-1']) ? $category_authorizations['r-1'] != '3' : true;
 if ($quota) {
     switch (AppContext::get_current_user()->get_level()) {