$Template->assign_block_vars('folder', array('NAME' => $name)); $Template->assign_vars(array('SELECTED_CAT' => $id_cat, 'ID_FILE' => $move_folder, 'TARGET' => url('admin_files.php?movefd=' . $move_folder . '&f=0&token=' . $Session->get_token()))); $cat_explorer = display_cat_explorer($id_cat, $cats, 1, $folder_member); } else { $info_move = $Sql->query_array(PREFIX . "upload", "path", "name", "type", "size", "idcat", "WHERE id = '" . $move_file . "'", __LINE__, __FILE__); $get_img_mimetype = $Uploads->get_img_mimetype($info_move['type']); $size_img = ''; switch ($info_move['type']) { case 'jpg': case 'png': case 'gif': case 'bmp': list($width_source, $height_source) = @getimagesize('../upload/' . $info_move['path']); $size_img = ' (' . $width_source . 'x' . $height_source . ')'; } $cat_explorer = display_cat_explorer($info_move['idcat'], $cats, 1, $folder_member); $Template->assign_block_vars('file', array('NAME' => $info_move['name'], 'FILETYPE' => $get_img_mimetype['filetype'] . $size_img, 'SIZE' => $info_move['size'] > 1024 ? number_round($info_move['size'] / 1024, 2) . ' ' . $LANG['unit_megabytes'] : number_round($info_move['size'], 0) . ' ' . $LANG['unit_kilobytes'], 'U_IMG_MOVE' => PATH_TO_ROOT . '/upload/' . $info_move['path'])); $Template->assign_vars(array('SELECTED_CAT' => $info_move['idcat'], 'TARGET' => url('admin_files.php?movefi=' . $move_file . '&f=0&token=' . $Session->get_token()))); } $Template->assign_vars(array('FOLDERS' => $cat_explorer, 'ID_FILE' => $move_file)); $Template->pparse('admin_files_move'); } else { $Template->set_filenames(array('admin_files_management' => 'admin/admin_files_management.tpl')); $sql_request = !empty($folder_member) ? "SELECT uc.user_id, m.login\n\t\tFROM " . DB_TABLE_UPLOAD_CAT . " uc\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = uc.user_id\n\t\tWHERE uc.user_id = '" . $folder_member . "'\n\t\tUNION\n\t\tSELECT u.user_id, m.login\n\t\tFROM " . DB_TABLE_UPLOAD . " u\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = u.user_id\n\t\tWHERE u.user_id = '" . $folder_member . "'" : "SELECT uc.user_id, m.login\n\t\tFROM " . DB_TABLE_UPLOAD_CAT . " uc\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = uc.user_id\n\t\tWHERE uc.id = '" . $folder . "'"; $result = $Sql->query_while($sql_request, __LINE__, __FILE__); $folder_info = $Sql->fetch_assoc($result); $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_error', 'e_upload_failed_unwritable', 'e_unlink_disabled'); if (in_array($get_error, $array_error)) { $Errorh->handler($LANG[$get_error], E_USER_WARNING); } if ($get_error == 'incomplete') {
$errstr = ''; } if (!empty($errstr)) { $Errorh->handler($errstr, E_USER_WARNING); } } elseif (isset($_GET['com']) && $idcom > 0) { $Template->assign_vars(array('C_COMMENTS' => true, 'COMMENTS' => display_comments('wiki_articles', $idcom, url('property.php?idcom=' . $idcom . '&com=%s'), 'wiki'))); } elseif ($del_article > 0) { if (empty($article_infos['title'])) { redirect(HOST . DIR . '/wiki/' . url('wiki.php')); } if ($article_infos['is_cat'] == 0) { redirect(HOST . DIR . '/wiki/' . url('wiki.php?title=' . $article_infos['encoded_title'], $article_infos['encoded_title'])); } else { $cats = array(); $cat_list = display_cat_explorer($article_infos['id_cat'], $cats); $cats = array_reverse($cats); if (array_key_exists(0, $cats)) { unset($cats[0]); } $current_cat = ''; $nbr_cats = count($cats); $i = 1; foreach ($cats as $key => $value) { $current_cat .= $_WIKI_CATS[$value]['name'] . ($i < $nbr_cats ? ' / ' : ''); $i++; } if ($article_infos['id_cat'] > 0) { $current_cat .= ($nbr_cats > 0 ? ' / ' : '') . $_WIKI_CATS[$article_infos['id_cat']]['name']; } else { $current_cat = $LANG['wiki_no_selected_cat'];
} $l_action_submit = $LANG['update']; $Template->assign_vars(array('SELECTED_CAT' => $id_edit)); } else { if ($is_cat && !$User->check_auth($_WIKI_CONFIG['auth'], WIKI_CREATE_CAT)) { $Errorh->handler('e_auth', E_USER_REDIRECT); } elseif (!$is_cat && !$User->check_auth($_WIKI_CONFIG['auth'], WIKI_CREATE_ARTICLE)) { $Errorh->handler('e_auth', E_USER_REDIRECT); } if (!empty($encoded_title)) { $Errorh->handler($LANG['wiki_article_does_not_exist'], E_USER_WARNING); } if ($id_cat > 0 && array_key_exists($id_cat, $_WIKI_CATS)) { $Template->assign_block_vars('create', array()); $cats = array(); $cat_list = display_cat_explorer($id_cat, $cats, 1); $cats = array_reverse($cats); if (array_key_exists(0, $cats)) { unset($cats[0]); } $nbr_cats = count($cats); $current_cat = ''; $i = 1; foreach ($cats as $key => $value) { $current_cat .= $_WIKI_CATS[$value]['name'] . ($i < $nbr_cats ? ' / ' : ''); $i++; } $current_cat .= ($nbr_cats > 0 ? ' / ' : '') . $_WIKI_CATS[$id_cat]['name']; $Template->assign_vars(array('SELECTED_CAT' => $id_cat, 'CAT_0' => '', 'CAT_LIST' => $cat_list, 'CURRENT_CAT' => $current_cat)); } else { $Template->assign_block_vars('create', array());
} $Bread_crumb->reverse(); } else { $Bread_crumb->add($LANG['pages'], url('pages.php'), $LANG['pages_redirections'], url('action.php')); } require_once '../kernel/header.php'; $Template->set_filenames(array('pages_action' => 'pages/action.tpl')); if ($del_cat > 0) { $page_infos = $Sql->query_array(PREFIX . 'pages', 'id', 'title', 'encoded_title', 'auth', 'id_cat', 'redirect', "WHERE id = '" . $del_cat . "'", __LINE__, __FILE__); $special_auth = !empty($page_infos['auth']); $array_auth = unserialize($page_infos['auth']); if ($special_auth && !$User->check_auth($array_auth, EDIT_PAGE) || !$special_auth && !$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) { redirect(HOST . DIR . '/pages/pages.php?error=e_auth'); } $cats = array(); $cat_list = display_cat_explorer($page_infos['id_cat'], $cats); $cats = array_reverse($cats); if (array_key_exists(0, $cats)) { unset($cats[0]); } $current_cat = ''; $nbr_cats = count($cats); $i = 1; foreach ($cats as $key => $value) { $current_cat .= $_PAGES_CATS[$value]['name'] . ($i < $nbr_cats ? ' / ' : ''); $i++; } if ($page_infos['id_cat'] > 0) { $current_cat .= ($nbr_cats > 0 ? ' / ' : '') . $_PAGES_CATS[$page_infos['id_cat']]['name']; } else { $current_cat = $LANG['pages_no_selected_cat'];
$cats = array(); $id_cat_display = $page_infos['is_cat'] == 1 ? $_PAGES_CATS[$page_infos['id_cat']]['id_parent'] : $page_infos['id_cat']; $cat_list = display_cat_explorer($id_cat_display, $cats, 1); $Template->assign_vars(array('CONTENTS' => !empty($error) ? htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1') : pages_unparse($page_infos['contents']), 'COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($page_infos['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($page_infos['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => !empty($page_infos['auth']) ? 'checked="checked"' : '', 'CAT_0' => $id_cat_display == 0 ? 'pages_selected_cat' : '', 'ID_CAT' => $id_cat_display, 'SELECTED_CAT' => $id_cat_display, 'CHECK_IS_CAT' => 'disabled="disabled"' . ($page_infos['is_cat'] == 1 ? ' checked="checked"' : ''))); } else { if (!$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) { redirect(HOST . DIR . '/pages/pages.php?error=e_auth'); } if ($error == 'page_already_exists') { $Errorh->handler($LANG['pages_already_exists'], E_USER_WARNING); } elseif ($error == 'preview') { $Errorh->handler($LANG['pages_notice_previewing'], E_USER_NOTICE); $Template->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title))); } if (!empty($error)) { $Template->assign_vars(array('CONTENTS' => htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1'), 'PAGE_TITLE' => stripslashes($title))); } $Template->assign_block_vars('create', array()); $cats = array(); $cat_list = display_cat_explorer(0, $cats, 1); $current_cat = $LANG['pages_root']; $Template->assign_vars(array('COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($_PAGES_CONFIG['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($_PAGES_CONFIG['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => '', 'CAT_0' => 'pages_selected_cat', 'ID_CAT' => '0', 'SELECTED_CAT' => '0')); } if (!empty($page_infos['auth'])) { $array_auth = unserialize($page_infos['auth']); } else { $array_auth = !empty($_PAGES_CONFIG['auth']) ? $_PAGES_CONFIG['auth'] : array(); } $Template->assign_vars(array('ID_EDIT' => $id_edit, 'SELECT_READ_PAGE' => Authorizations::generate_select(READ_PAGE, $array_auth), 'SELECT_EDIT_PAGE' => Authorizations::generate_select(EDIT_PAGE, $array_auth), 'SELECT_READ_COM' => Authorizations::generate_select(READ_COM, $array_auth), 'OWN_AUTH_DISABLED' => !empty($page_infos['auth']) ? 'false' : 'true', 'DISPLAY' => empty($page_infos['auth']) ? 'display:none;' : '', 'PAGES_PATH' => $Template->get_module_data_path('pages'), 'CAT_LIST' => $cat_list, 'KERNEL_EDITOR' => display_editor(), 'L_AUTH' => $LANG['pages_auth'], 'L_ACTIV_COM' => $LANG['pages_activ_com'], 'L_COUNT_HITS' => $LANG['pages_count_hits'], 'L_ALERT_CONTENTS' => $LANG['page_alert_contents'], 'L_ALERT_TITLE' => $LANG['page_alert_title'], 'L_READ_PAGE' => $LANG['pages_auth_read'], 'L_EDIT_PAGE' => $LANG['pages_auth_edit'], 'L_READ_COM' => $LANG['pages_auth_read_com'], 'L_OWN_AUTH' => $LANG['pages_own_auth'], 'L_IS_CAT' => $LANG['pages_is_cat'], 'L_CAT' => $LANG['pages_parent_cat'], 'L_AUTH' => $LANG['pages_auth'], 'L_PATH' => $LANG['pages_page_path'], 'L_PROPERTIES' => $LANG['pages_properties'], 'L_TITLE_POST' => $id_edit > 0 ? sprintf($LANG['pages_edit_page'], $page_infos['title']) : $LANG['pages_creation'], 'L_TITLE_FIELD' => $LANG['page_title'], 'L_CONTENTS' => $LANG['page_contents'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_SUMBIT' => $LANG['submit'], 'L_ROOT' => $LANG['pages_root'], 'L_PREVIEWING' => $LANG['pages_previewing'], 'L_CONTENTS_PART' => $LANG['pages_contents_part'], 'L_SUBMIT' => $id_edit > 0 ? $LANG['update'] : $LANG['submit'], 'TARGET' => url('post.php?token=' . $Session->get_token()))); $Template->pparse('post'); require_once '../kernel/footer.php';
$size_img = ''; $display_real_img = false; switch ($info_move['type']) { //Images case 'jpg': case 'png': case 'gif': case 'bmp': list($width_source, $height_source) = @getimagesize('../upload/' . $info_move['path']); $size_img = ' (' . $width_source . 'x' . $height_source . ')'; //On affiche l'image réelle si elle n'est pas trop grande. if ($width_source < 350 && $height_source < 350) { $display_real_img = true; } } $cat_explorer = display_cat_explorer($info_move['idcat'], $cats, 1, AppContext::get_current_user()->get_id()); $tpl->assign_block_vars('file', array('C_DISPLAY_REAL_IMG' => $display_real_img, 'NAME' => $info_move['name'], 'FILETYPE' => $get_img_mimetype['filetype'] . $size_img, 'SIZE' => $info_move['size'] > 1024 ? NumberHelper::round($info_move['size'] / 1024, 2) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : NumberHelper::round($info_move['size'], 0) . ' ' . LangLoader::get_message('unit.kilobytes', 'common'), 'FILE_ICON' => $display_real_img ? $info_move['path'] : $get_img_mimetype['img'])); $tpl->put_all(array('SELECTED_CAT' => $info_move['idcat'], 'TARGET' => url('upload.php?movefi=' . $move_file . '&f=0&token=' . AppContext::get_session()->get_token() . $popup))); } $tpl->put_all(array('FOLDERS' => $cat_explorer, 'ID_FILE' => $move_file)); $tpl->display(); } else { $is_admin = AppContext::get_current_user()->check_level(User::ADMIN_LEVEL); $tpl = new FileTemplate('user/upload.tpl'); //Gestion des erreurs. $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_error', 'e_upload_php_code', 'e_upload_failed_unwritable', 'e_unlink_disabled', 'e_max_data_reach'); if (in_array($get_error, $array_error)) { $tpl->put('message_helper', MessageHelper::display($LANG[$get_error], MessageHelper::WARNING)); } if ($get_error == 'incomplete') { $tpl->put('message_helper', MessageHelper::display($LANG['e_incomplete'], MessageHelper::NOTICE));
$Template->assign_block_vars('folder', array('NAME' => $name)); $Template->assign_vars(array('SELECTED_CAT' => $id_cat, 'ID_FILE' => $move_folder, 'TARGET' => url('upload.php?movefd=' . $move_folder . '&f=0&token=' . $Session->get_token() . $popup))); $cat_explorer = display_cat_explorer($id_cat, $cats, 1, $User->get_attribute('user_id')); } else { $info_move = $Sql->query_array(PREFIX . "upload", "path", "name", "type", "size", "idcat", "WHERE id = '" . $move_file . "'", __LINE__, __FILE__); $get_img_mimetype = $Uploads->get_img_mimetype($info_move['type']); $size_img = ''; switch ($info_move['type']) { case 'jpg': case 'png': case 'gif': case 'bmp': list($width_source, $height_source) = @getimagesize('../upload/' . $info_move['path']); $size_img = ' (' . $width_source . 'x' . $height_source . ')'; } $cat_explorer = display_cat_explorer($info_move['idcat'], $cats, 1, $User->get_attribute('user_id')); $Template->assign_block_vars('file', array('NAME' => $info_move['name'], 'FILETYPE' => $get_img_mimetype['filetype'] . $size_img, 'SIZE' => $info_move['size'] > 1024 ? number_round($info_move['size'] / 1024, 2) . ' ' . $LANG['unit_megabytes'] : number_round($info_move['size'], 0) . ' ' . $LANG['unit_kilobytes'], 'U_IMG_MOVE' => PATH_TO_ROOT . '/upload/' . $info_move['path'])); $Template->assign_vars(array('SELECTED_CAT' => $info_move['idcat'], 'TARGET' => url('upload.php?movefi=' . $move_file . '&f=0&token=' . $Session->get_token() . $popup))); } $Template->assign_vars(array('FOLDERS' => $cat_explorer, 'ID_FILE' => $move_file)); $Template->pparse('upload_move'); } else { $is_admin = $User->check_level(ADMIN_LEVEL); $Template->set_filenames(array('upload' => 'member/upload.tpl')); $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_error', 'e_upload_failed_unwritable', 'e_unlink_disabled', 'e_max_data_reach'); if (in_array($get_error, $array_error)) { $Errorh->handler($LANG[$get_error], E_USER_WARNING); } if ($get_error == 'incomplete') { $Errorh->handler($LANG['e_incomplete'], E_USER_NOTICE); }