Changeset 9261
- Timestamp:
- Feb 17, 2011, 4:27:09 PM (13 years ago)
- Location:
- extensions/AdditionalPages
- Files:
-
- 8 added
- 2 deleted
- 16 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdditionalPages/additional_page.php
r8132 r9261 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 global $template, $conf, $user; 5 global $template, $user; 6 7 $page['section'] = 'additional_page'; 8 $identifier = $page['is_homepage'] ? $conf['additional_pages']['homepage'] : $tokens[1]; 6 9 7 10 load_language('plugin.lang.php', AP_PATH); 8 11 9 $ap_id = explode('additional_page/' , $_SERVER['REQUEST_URI']); 10 $ap_id = explode('&' , $ap_id[1]); 11 $ap_conf = explode ("," , $conf['additional_pages']); 12 if (function_exists('get_extended_desc')) 13 add_event_handler('AP_render_content', 'get_extended_desc'); 12 14 13 15 // Récupération des données de la page 14 $q = 'SELECT title , pos , text16 $query = 'SELECT id, title , content, users, groups, permalink 15 17 FROM ' . ADD_PAGES_TABLE . ' 16 WHERE id = ' . $ap_id[0] . ';'; 17 $result = mysql_fetch_assoc(pwg_query($q)); 18 '; 19 $query .= is_numeric($identifier) ? 20 'WHERE id = '.$identifier.';' : 21 'WHERE permalink = "'.$identifier.'";'; 18 22 19 if (empty($result)) 23 $row = mysql_fetch_assoc(pwg_query($query)); 24 25 if (empty($row)) 20 26 { 21 page_not_found('This page does not exist', 'index.php?'); 27 if ($page['is_homepage']) return; 28 page_not_found('Requested page does not exist'); 22 29 } 23 30 31 if (is_numeric($identifier) and !empty($row['permalink']) and !$page['is_homepage']) 32 { 33 redirect(make_index_url().'/page/' . $row['permalink']); 34 } 35 36 $page['additional_page'] = array( 37 'id' => $row['id'], 38 'permalink' => @$row['permalink'], 39 'title' => trigger_event('AP_render_content', $row['title']), 40 'content' => trigger_event('AP_render_content', $row['content']), 41 ); 42 24 43 // Utilisateurs autorisés 25 if ( strpos($result['title'] , 'user_id='))44 if (!empty($row['users'])) 26 45 { 27 $array = explode('/user_id=' , $result['title']); 28 $result['title'] = $array[0]; 29 $authorized_users = explode(',', $array[1]); 30 if (!is_admin() and $ap_conf[7] == 'on' and !in_array($user['status'], $authorized_users)) 46 $authorized_users = explode(',', $row['users']); 47 if (!is_admin() and $conf['additional_pages']['user_perm'] and !in_array($user['status'], $authorized_users)) 31 48 { 32 page_not_found('User not allowed', 'index.php?'); 49 if ($page['is_homepage']) return; 50 page_forbidden(l10n('You are not authorized to access the requested page')); 33 51 } 34 52 } 35 53 36 54 // Groupe autorisé 37 if ( strpos($result['title'] , 'group_id='))55 if (!empty($row['groups'])) 38 56 { 39 $array = explode('/group_id=' , $result['title']);40 $result['title'] = $array[0];41 $authorized_groups = $array[1];42 43 57 $q = 'SELECT * 44 58 FROM ' . USER_GROUP_TABLE . ' 45 WHERE user_id = ' . $user['id'] . ' AND group_id IN (' . $ authorized_groups. ');';59 WHERE user_id = ' . $user['id'] . ' AND group_id IN (' . $row['groups'] . ');'; 46 60 $array = mysql_fetch_array(pwg_query($q)); 47 if (!is_admin() and $ ap_conf[6] == 'on'and empty($array))61 if (!is_admin() and $conf['additional_pages']['group_perm'] and empty($array)) 48 62 { 49 page_not_found('User not allowed', 'index.php?'); 63 if ($page['is_homepage']) return; 64 page_forbidden(l10n('You are not authorized to access the requested page')); 50 65 } 51 66 } 52 67 53 // Envoi de la page 54 // Extended description 55 if (function_exists('get_extended_desc')) 56 add_event_handler('AP_render_content', 'get_extended_desc'); 68 add_event_handler('loc_end_index', 'ap_set_index'); 57 69 58 $template->assign(array( 59 'TITLE' => trigger_event('AP_render_content', $result['title']), 60 'PLUGIN_INDEX_CONTENT_BEGIN' => trigger_event('AP_render_content', $result['text']))); 61 if (isset($ap_conf[2]) and $ap_conf[2] == 'on') 70 function ap_set_index() 62 71 { 63 $template->assign('PLUGIN_INDEX_ACTIONS' , ' 64 <li><a href="' . make_index_url() . '" title="' . l10n('return to homepage') . '"> 65 <img src="' . $template->get_themeconf('icon_dir') . '/home.png" class="button" alt="' . l10n('home') . '"/></a> 66 </li>'); 67 } 68 if (is_admin()) 69 { 70 $template->assign('U_EDIT', PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . AP_DIR . '%2Fadmin%2Fadd_page.php&edit=' . $ap_id[0]); 72 global $template, $page, $conf; 73 74 $template->assign(array( 75 'TITLE' => $page['additional_page']['title'], 76 'PLUGIN_INDEX_CONTENT_BEGIN' => $page['additional_page']['content'], 77 ) 78 ); 79 80 if ($conf['additional_pages']['show_home']) 81 { 82 $template->assign('PLUGIN_INDEX_ACTIONS' , ' 83 <li><a href="'.make_index_url().'" title="' . l10n('return to homepage') . '"> 84 <img src="' . $template->get_themeconf('icon_dir') . '/home.png" class="button" alt="' . l10n('home') . '"/></a> 85 </li>'); 86 } 87 if (is_admin()) 88 { 89 $template->assign('U_EDIT', PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.AP_DIR.'%2Fadmin%2Fadmin.php&tab=edit_page&edit='.$page['additional_page']['id'].'&redirect=true'); 90 } 91 $template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED')); 71 92 } 72 93 73 $template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED'));74 75 94 ?> -
extensions/AdditionalPages/admin/add_page.inc.php
r8131 r9261 2 2 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 load_language('plugin.lang', AP_PATH); 5 $ap_conf = explode(',' , $conf['additional_pages']); 4 6 5 $edited_page = array(); 6 $edited_page['id'] = 0; 7 $edited_page['homepage'] = false; 7 8 $page_title = l10n('ap_create'); 8 9 9 if (isset($_GET['saved']) and isset($_GET['edit'])) 10 { 11 array_push($page['infos'], sprintf(l10n('ap_saved_page') , $_GET['edit'])); 12 } 13 14 // Suppression 15 if (isset($_POST['delete']) and isset($_GET['edit'])) 16 { 17 pwg_query('DELETE FROM ' . ADD_PAGES_TABLE . ' WHERE id = ' . $_GET['edit'] . ';'); 18 array_push($page['infos'], l10n('ap_deleted_page')); 19 @unlink(AP_PATH . 'backup/' . $_GET['edit'] . '.txt'); 20 return; 21 } 22 23 // Enregistrement 24 if (isset($_POST['save'])) 25 { 26 $group_access = (!empty($_POST['groups']) ? implode(',', $_POST['groups']) : ''); 27 $user_access = (!empty($_POST['users']) ? implode(',', $_POST['users']) : ''); 28 if (empty($_POST['name'])) 29 { 30 array_push($page['errors'], l10n('ap_no_name')); 31 $edited_page['title'] = ''; 32 $edited_page['pos'] = $_POST['pos']; 33 $edited_page['text'] = stripslashes($_POST['ap_content']); 34 $edited_page['group'] = (!empty($_POST['groups']) ? $_POST['groups'] : array()); 35 $edited_page['user'] = (!empty($_POST['users']) ? $_POST['users'] : array()); 36 } 37 else 38 { 39 $PageTitle = $_POST['name']; 40 if (!empty($group_access)) 41 { 42 $PageTitle .= '/group_id=' . $group_access ; 43 } 44 if ($ap_conf[7] == 'on') 45 { 46 $PageTitle .= '/user_id=' . $user_access ; 47 } 48 if (isset($_GET['edit'])) 49 { 50 $next_element_id = $_GET['edit']; 51 pwg_query('DELETE FROM ' . ADD_PAGES_TABLE . ' WHERE id = ' . $_GET['edit'] . ';'); 52 } 53 else 54 { 55 $q = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id FROM ' . ADD_PAGES_TABLE . ' ;'; 56 list($next_element_id) = mysql_fetch_array(pwg_query($q)); 57 } 58 if ($_POST['pos'] == '') $_POST['pos'] = 'NULL'; 59 $q = 'INSERT INTO ' . ADD_PAGES_TABLE . ' ( id , pos , lang , title , text ) 60 VALUES (' . $next_element_id . ' , ' . $_POST['pos'] . ' , "' . $_POST['lang'] . '" , "' . $PageTitle . '" , "' . $_POST['ap_content'] . '");'; 61 pwg_query($q); 62 63 // Enregistrement du fichier de sauvegarde 64 $sav_file = @fopen(AP_PATH . 'backup/' . $next_element_id . '.txt', "w"); 65 @fwrite($sav_file, "Title: " . $_POST['name'] . " 66 Position: " . $_POST['pos'] . " 67 Language: " . $_POST['lang'] . " 68 69 " . $_POST['ap_content']); 70 @fclose($sav_file); 71 72 if (isset($ap_conf[4]) and $ap_conf[4] == 'on') 73 { 74 redirect(get_root_url() . 'index.php?/additional_page/' . $next_element_id); 75 } 76 else 77 { 78 redirect(get_root_url() . 'admin.php?page=plugin§ion=' . AP_DIR . '%2Fadmin%2Fadd_page.php&saved=1&edit=' . $next_element_id); 79 } 80 } 81 } 82 83 // Chargement des données 84 if (isset($_GET['edit'])) 85 { 86 $q = 'SELECT id , pos , lang , title , text 87 FROM ' . ADD_PAGES_TABLE . ' 88 WHERE id = ' . $_GET['edit'] . ';'; 89 $edited_page = mysql_fetch_assoc(pwg_query($q)); 90 $page_title = l10n('ap_modify'); 91 // Utilisateurs autorisés 92 if (strpos($edited_page['title'] , '/user_id=')) 93 { 94 $array = explode('/user_id=' , $edited_page['title']); 95 $edited_page['title'] = $array[0]; 96 $edited_page['user'] = explode(',', $array[1]); 97 } 98 // Groupes autorisés 99 if (strpos($edited_page['title'] , '/group_id=')) 100 { 101 $array = explode('/group_id=' , $edited_page['title']); 102 $edited_page['title'] = $array[0]; 103 $edited_page['group'] = explode(',', $array[1]); 104 } 105 // Lien de suppression 106 $template->assign('delete', true); 107 } 108 109 // Selection des langues 110 $options['ALL'] = l10n('ap_all_lang'); 111 $selected = 'ALL'; 112 foreach (get_languages() as $language_code => $language_name) 113 { 114 $options[$language_code] = $language_name; 115 if (isset($edited_page['lang']) and $edited_page['lang'] == $language_code) 116 { 117 $selected = $language_code; 118 } 119 } 120 $template->assign('lang', array( 121 'OPTIONS' => $options, 122 'SELECTED' => $selected)); 123 124 // Selection des groupes 125 if (isset($ap_conf[6]) and $ap_conf[6] == 'on') 126 { 127 include_once(AP_PATH . 'admin/functions_groups.php'); 128 $template->assign('GROUPSELECTION', get_html_groups_selection(get_all_groups(), 'groups', (!empty($edited_page['group']) ? $edited_page['group'] : array()))); 129 } 130 131 // Selection des utilisateurs 132 if (isset($ap_conf[7]) and $ap_conf[7] == 'on') 133 { 134 $selected_users = (isset($edited_page['user']) ? $edited_page['user'] : array('guest', 'generic', 'normal')); 135 $template->assign('user_perm', array( 136 'GUEST' => (in_array('guest', $selected_users) ? 'checked="checked"' : ''), 137 'GENERIC' => (in_array('generic', $selected_users) ? 'checked="checked"' : ''), 138 'NORMAL' => (in_array('normal', $selected_users) ? 'checked="checked"' : ''))); 139 } 140 141 // Chargement des données pour l'édition 142 if (!empty($edited_page)) 143 { 144 $template->assign(array( 145 'NAME' => $edited_page['title'], 146 'POS' => $edited_page['pos'], 147 'CONTENT' => $edited_page['text'])); 148 } 149 150 // Parametrage du template 151 $template->assign('AP_TITLE', $page_title); 152 153 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/add_page.tpl'); 154 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 10 include(AP_PATH.'admin/page_form.inc.php'); 155 11 156 12 ?> -
extensions/AdditionalPages/admin/admin.php
r3609 r9261 4 4 load_language('plugin.lang', AP_PATH); 5 5 6 global $conf, $template , $lang;6 global $conf, $template; 7 7 8 $ap_conf = explode ("," , $conf['additional_pages']); 8 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 9 $my_base_url = get_admin_plugin_menu_link(__FILE__); 9 10 10 // Enregistrement de la configuration 11 if (isset($_POST['submit'])) 11 if (!isset($_GET['tab'])) 12 $page['tab'] = 'manage'; 13 else 14 $page['tab'] = $_GET['tab']; 15 16 include(AP_PATH.'admin/'.$page['tab'].'.inc.php'); 17 18 $tabsheet = new tabsheet(); 19 $tabsheet->add('manage', l10n('Manage'), $my_base_url.'&tab=manage'); 20 $tabsheet->add('add_page', l10n('ap_add_page'), $my_base_url.'&tab=add_page'); 21 $tabsheet->add('config', l10n('Configuration'), $my_base_url.'&tab=config'); 22 if ($page['tab'] == 'edit_page') 12 23 { 13 foreach($_POST['menu_lang'] as $language_code => $name) 14 { 15 if ($language_code == 'default') $save_languages[] = $name; 16 elseif (!empty($name)) $save_languages[] = $language_code . ':' . $name; 17 } 18 $languages = implode('/', $save_languages); 19 if (!isset($_POST['show_menu'])) 20 $_POST['show_menu'] = 'off'; 21 if (!isset($_POST['show_home'])) 22 $_POST['show_home'] = 'off'; 23 if (!isset($_POST['show_edit'])) 24 $_POST['show_edit'] = 'off'; 25 if (!isset($_POST['redirect'])) 26 $_POST['redirect'] = 'off'; 27 if (!isset($_POST['group_perm'])) 28 $_POST['group_perm'] = 'off'; 29 if (!isset($_POST['user_perm'])) 30 $_POST['user_perm'] = 'off'; 31 $ap_conf = array($languages, 32 $_POST['show_menu'], 33 $_POST['show_home'], 34 $_POST['show_edit'], 35 $_POST['redirect'], 36 $ap_conf[5], //Ancien emplacement du bbcode 37 $_POST['group_perm'], 38 $_POST['user_perm']); 39 $query = ' 40 UPDATE ' . CONFIG_TABLE . ' 41 SET value="' . implode ("," , $ap_conf) . '" 42 WHERE param="additional_pages" 43 LIMIT 1'; 44 pwg_query($query); 45 array_push($page['infos'], l10n('ap_conf_saved')); 24 $tabsheet->add('edit_page', l10n('ap_edit_page'), $my_base_url.'&tab=edit_page'); 46 25 } 47 48 // Gestion des langues pour le bloc menu 49 $languages = explode('/', $ap_conf[0]); 50 foreach($languages as $language) 51 { 52 $array = explode(':', $language); 53 if (!isset($array[1])) $menu_langs['default'] = $array[0]; 54 else $menu_langs[$array[0]] = $array[1]; 55 } 56 57 $template->assign('LANG_DEFAULT_VALUE', $menu_langs['default']); 58 foreach (get_languages() as $language_code => $language_name) 59 { 60 $template->append('language', array( 61 'LANGUAGE_NAME' => $language_name, 62 'LANGUAGE_CODE' => $language_code, 63 'VALUE' => (isset($menu_langs[$language_code]) ? $menu_langs[$language_code] : ''))); 64 } 65 66 // Parametrage du template 67 $template->assign(array( 68 'MENU_NAME' => $ap_conf[0], 69 'SHOW_MENU' => (isset($ap_conf[1]) and $ap_conf[1] == 'on') ? 'checked="checked"' : '', 70 'SHOW_HOME' => (isset($ap_conf[2]) and $ap_conf[2] == 'on') ? 'checked="checked"' : '', 71 'SHOW_EDIT' => (isset($ap_conf[3]) and $ap_conf[3] == 'on') ? 'checked="checked"' : '', 72 'REDIRECT' => (isset($ap_conf[4]) and $ap_conf[4] == 'on') ? 'checked="checked"' : '', 73 'GROUP_PERM' => (isset($ap_conf[6]) and $ap_conf[6] == 'on') ? 'checked="checked"' : '', 74 'USER_PERM' => (isset($ap_conf[7]) and $ap_conf[7] == 'on') ? 'checked="checked"' : '')); 75 76 // Lien de conversion bbcode 77 if (isset($ap_conf[5]) and $ap_conf[5] == 'on') 78 { 79 $template->assign('convert_bbcode', array('PATH' => get_admin_plugin_menu_link(AP_PATH . 'admin/parse_bbcode.php'))); 80 } 81 82 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 83 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 26 $tabsheet->select($page['tab']); 27 $tabsheet->assign(); 84 28 85 29 ?> -
extensions/AdditionalPages/index_menu.php
r6227 r9261 11 11 if ($menu->get_id() != 'menubar') 12 12 return; 13 $menu->register_block( new RegisteredBlock( 'mbAdditionalPages', 'Additional Pages', ' AP'));13 $menu->register_block( new RegisteredBlock( 'mbAdditionalPages', 'Additional Pages', 'P@t')); 14 14 } 15 15 … … 17 17 { 18 18 global $template, $conf, $user, $lang; 19 20 $ap_conf = explode ("," , $conf['additional_pages']);21 19 22 20 $menu = & $menu_ref_arr[0]; … … 27 25 28 26 load_language('plugin.lang', AP_PATH); 29 30 // Gestion des langues pour le nom du menu31 $languages = explode('/', $ap_conf[0]);32 foreach($languages as $language)33 {34 $array = explode(':', $language);35 if (!isset($array[1])) $menu_langs['default'] = $array[0];36 else $menu_langs[$array[0]] = $array[1];37 }38 27 39 28 $data = array(); 40 29 41 if (is_admin())42 {43 array_push($data, array(44 'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . AP_DIR . '%2Fadmin%2Fadd_page.php',45 'LABEL' => l10n('ap_add_page')));46 $clauses = '';47 }48 else49 {50 $clauses = 'WHERE (lang = "' . $user['language'] . '" OR lang = "ALL")';51 }52 53 30 // Recupération des groupes de l'utilisateur 54 31 $q = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = ' . $user['id'] . ';'; … … 61 38 62 39 // Récupération des pages 63 $q = 'SELECT id , pos , title40 $q = 'SELECT id, pos, title, users, groups, permalink 64 41 FROM ' . ADD_PAGES_TABLE . ' 65 ' . $clauses . ' 66 ORDER BY pos ASC;'; 42 WHERE (lang = "' . $user['language'] . '" OR lang IS NULL) 43 AND pos > 0 44 ORDER BY pos ASC, id ASC 45 ;'; 67 46 $result = pwg_query($q); 68 47 … … 71 50 if ($row['pos'] != '0' or is_admin()) 72 51 { 73 if (strpos($row['title'] , '/user_id=')) 52 $authorized_users = array(); 53 $authorized_groups = array(); 54 if (!empty($row['users'])) 74 55 { 75 $array = explode('/user_id=' , $row['title']); 76 $row['title'] = $array[0]; 77 $authorized_users = explode(',', $array[1]); 56 $authorized_users = explode(',', $row['users']); 78 57 } 79 if ( strpos($row['title'] , '/group_id='))58 if (!empty($row['groups'])) 80 59 { 81 $array = explode('/group_id=' , $row['title']); 82 $row['title'] = $array[0]; 83 $auth = explode(',', $array[1]); 60 $auth = explode(',', $row['groups']); 84 61 $authorized_groups = array_intersect($groups, $auth); 85 62 } 86 if (is_admin() and isset($ap_conf[3]) and $ap_conf[3] == 'on')87 {88 $row['title'] .= '</a> --- <a href=' . PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . AP_DIR . '%2Fadmin%2Fadd_page.php&edit=' . $row['id'] . '>[edit]';89 }90 63 if (is_admin() or ( 91 ( isset($ap_conf[6]) and $ap_conf[6] == 'off' or !isset($authorized_groups) or !empty($authorized_groups)) and92 ( isset($ap_conf[7]) and $ap_conf[7] == 'off' or !isset($authorized_users) or in_array($user['status'], $authorized_users))))64 (!$conf['additional_pages']['group_perm'] or empty($row['groups']) or !empty($authorized_groups)) and 65 (!$conf['additional_pages']['user_perm'] or empty($row['users']) or in_array($user['status'], $authorized_users)))) 93 66 { 94 67 array_push($data, array( 95 'URL' => PHPWG_ROOT_PATH . 'index.php?/additional_page/' . $row['id'],68 'URL' => make_index_url().'/page/'.(isset($row['permalink']) ? $row['permalink'] : $row['id']), 96 69 'LABEL' => $row['title'])); 97 70 } … … 103 76 if (!empty($data)) 104 77 { 105 $block->set_title(isset($menu_langs[$user['language']]) ? $menu_langs[$user['language']] : $menu_langs['default']); 78 $block->set_title( 79 isset($conf['additional_pages']['languages'][$user['language']]) ? 80 $conf['additional_pages']['languages'][$user['language']] : 81 @$conf['additional_pages']['languages']['default'] 82 ); 106 83 $block->template = 'AdditionalPages_menu.tpl'; 107 84 $block->data = $data; -
extensions/AdditionalPages/language/cs_CZ/plugin.lang.php
r7127 r9261 4 4 5 5 $lang['ap_create'] = 'Přidat novou stránku'; 6 $lang['ap_deleted_page'] = 'Stránka byla smazána. (<a href="' .PHPWG_ROOT_PATH . '">zpět domů</a>)';6 $lang['ap_deleted_page'] = 'Stránka byla smazána.'; 7 7 $lang['ap_no_name'] = 'Je nutné vyplnit jméno.'; 8 $lang['ap_saved_page'] = 'Stránka byla uložena (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">zobrazit stránku</a>)';8 $lang['ap_saved_page'] = 'Stránka byla uložena'; 9 9 $lang['ap_modify'] = 'Upravit stránku'; 10 10 $lang['ap_all_lang'] = 'Všechny'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Převod proběhl v pořádku.'; 40 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/de_DE/plugin.lang.php
r3691 r9261 4 4 5 5 $lang['ap_create'] = 'Neue Seite hinzufügen'; 6 $lang['ap_deleted_page'] = 'Seite gelöscht (<a href="' .PHPWG_ROOT_PATH . '">zurück zur Startseite</a>)';6 $lang['ap_deleted_page'] = 'Seite gelöscht'; 7 7 $lang['ap_no_name'] = 'Es wurde kein Name vergeben.'; 8 $lang['ap_saved_page'] = 'Seite gespeichert (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">Seite anzeigen</a>)';8 $lang['ap_saved_page'] = 'Seite gespeichert'; 9 9 $lang['ap_modify'] = 'Neue Seite bearbeiten'; 10 10 $lang['ap_all_lang'] = 'Alle'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Konvertierung abgeschlossen.'; 40 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/en_UK/plugin.lang.php
r3609 r9261 4 4 5 5 $lang['ap_create'] = 'Create new additional page'; 6 $lang['ap_deleted_page'] = 'Page deleted (<a href="' .PHPWG_ROOT_PATH . '">back to home</a>)';6 $lang['ap_deleted_page'] = 'Page deleted'; 7 7 $lang['ap_no_name'] = 'You do not fill name field.'; 8 $lang['ap_saved_page'] = 'Page saved (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">see the page</a>)';8 $lang['ap_saved_page'] = 'Page saved'; 9 9 $lang['ap_modify'] = 'Modify the additional page'; 10 10 $lang['ap_all_lang'] = 'All'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Conversion effectuée.'; 40 40 41 $lang['ap_edit_page'] = 'Edit a page'; 42 $lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/es_ES/plugin.lang.php
r5772 r9261 4 4 5 5 $lang['ap_create'] = 'Crear una nueva página adiciónal'; 6 $lang['ap_deleted_page'] = 'Página eliminada (<a href="' .PHPWG_ROOT_PATH . '">volver al inicio</a>)';6 $lang['ap_deleted_page'] = 'Página eliminada'; 7 7 $lang['ap_no_name'] = 'Usted no indicó el nombre.'; 8 $lang['ap_saved_page'] = 'Página registrada (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">Ver la página</a>)';8 $lang['ap_saved_page'] = 'Página registrada'; 9 9 $lang['ap_modify'] = 'Modificar la página adiciónal'; 10 10 $lang['ap_all_lang'] = 'Todas'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Conversión efectuada.'; 40 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/fr_FR/plugin.lang.php
r3609 r9261 4 4 5 5 $lang['ap_create'] = 'Créer une nouvelle page additionelle'; 6 $lang['ap_deleted_page'] = 'Page supprimée (<a href="' .PHPWG_ROOT_PATH . '">retour à l\'accueil</a>)';6 $lang['ap_deleted_page'] = 'Page supprimée'; 7 7 $lang['ap_no_name'] = 'Vous n\'avez pas indiqué le nom.'; 8 $lang['ap_saved_page'] = 'Page enregistrée (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">voir la page</a>)';8 $lang['ap_saved_page'] = 'Page enregistrée'; 9 9 $lang['ap_modify'] = 'Modifier la page additionelle'; 10 10 $lang['ap_all_lang'] = 'Toutes'; … … 38 38 $lang['ap_parse_bbcode'] = 'Convertir les pages déjà écrites avec le BBCode'; 39 39 $lang['ap_convert_bbcode_ok'] = 'Conversion effectuée.'; 40 41 $lang['ap_edit_page'] = 'Editer une page'; 42 $lang['ap_set_as_homepage'] = 'Définir comme page d\'accueil'; 43 40 44 ?> -
extensions/AdditionalPages/language/hu_HU/plugin.lang.php
r4248 r9261 4 4 5 5 $lang['ap_create'] = 'További új oldal létrehozása'; 6 $lang['ap_deleted_page'] = 'Oldal törlése (<a href="' .PHPWG_ROOT_PATH . '">vissza a főoldalra</a>)';6 $lang['ap_deleted_page'] = 'Oldal törlése'; 7 7 $lang['ap_no_name'] = 'Nem létező mező.'; 8 $lang['ap_saved_page'] = 'Oldal mentve (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">oldal megtekintése</a>)';8 $lang['ap_saved_page'] = 'Oldal mentve'; 9 9 $lang['ap_modify'] = 'Új oldal módosítása'; 10 10 $lang['ap_all_lang'] = 'Összes nyelv'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Konvertálás kész.'; 40 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/it_IT/plugin.lang.php
r5276 r9261 4 4 5 5 $lang['ap_create'] = 'Creare una nuova pagina addizionale'; 6 $lang['ap_deleted_page'] = 'Pagina soppressa (<a href="' .PHPWG_ROOT_PATH . '">ritorno alla home page</a>)';6 $lang['ap_deleted_page'] = 'Pagina soppressa'; 7 7 $lang['ap_no_name'] = 'Dovete indicare un nome.'; 8 $lang['ap_saved_page'] = 'Pagina registrata (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">visualizzare pagina</a>)';8 $lang['ap_saved_page'] = 'Pagina registrata'; 9 9 $lang['ap_modify'] = 'Modificare la pagina addizionale'; 10 10 $lang['ap_all_lang'] = 'Tutte'; … … 38 38 $lang['ap_parse_bbcode'] = 'Convertire le pagini già scritte con BBCode'; 39 39 $lang['ap_convert_bbcode_ok'] = 'Conversione effettuata.'; 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 40 44 ?> -
extensions/AdditionalPages/language/lv_LV/plugin.lang.php
r7320 r9261 4 4 5 5 $lang['ap_create'] = 'Izveidot jaunu papildus lapu'; 6 $lang['ap_deleted_page'] = 'Lapa dzēsta (<a href="' .PHPWG_ROOT_PATH . '">atpakaļ uz sākumu</a>)';6 $lang['ap_deleted_page'] = 'Lapa dzēsta'; 7 7 $lang['ap_no_name'] = 'Jūs neesat aizpildījis nosaukuma lauku.'; 8 $lang['ap_saved_page'] = 'Lapa saglabāta (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">skatīt lapu</a>)';8 $lang['ap_saved_page'] = 'Lapa saglabāta'; 9 9 $lang['ap_modify'] = 'Veikt izmaiņas papildus lapā'; 10 10 $lang['ap_all_lang'] = 'Visas'; … … 38 38 $lang['ap_parse_bbcode'] = 'Konvertēt BBCode kodā rakstītās lapas'; 39 39 $lang['ap_convert_bbcode_ok'] = 'Konvertācija veiksmīga.'; 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 40 44 ?> -
extensions/AdditionalPages/language/pl_PL/plugin.lang.php
r3825 r9261 4 4 5 5 $lang['ap_create'] = 'Stwórz nową dodatkową stronę'; 6 $lang['ap_deleted_page'] = 'Strona usunięta (<a href="' .PHPWG_ROOT_PATH . '">powrót do głównej</a>)';6 $lang['ap_deleted_page'] = 'Strona usunięta'; 7 7 $lang['ap_no_name'] = 'Nie wypełniłeś pola nazwy.'; 8 $lang['ap_saved_page'] = 'Strona zapisana (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">zobacz stronę</a>)';8 $lang['ap_saved_page'] = 'Strona zapisana'; 9 9 $lang['ap_modify'] = 'Modyfikuj dodatkową stronę'; 10 10 $lang['ap_all_lang'] = 'Wszystkie'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Konwersja aktywna.'; 40 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/ru_RU/plugin.lang.php
r7331 r9261 4 4 5 5 $lang['ap_create'] = 'Создать новую дополнительную сраницу'; 6 $lang['ap_deleted_page'] = 'Страница удалена (<a href="' .PHPWG_ROOT_PATH . '">на главную</a>)';6 $lang['ap_deleted_page'] = 'Страница удалена'; 7 7 $lang['ap_no_name'] = 'Введите название страницы'; 8 $lang['ap_saved_page'] = 'Cтраница сохранена (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">просмотреть страницу</a>)';8 $lang['ap_saved_page'] = 'Cтраница сохранена'; 9 9 $lang['ap_modify'] = 'Изменить дополнительную страницу'; 10 10 $lang['ap_all_lang'] = 'Все'; … … 39 39 $lang['ap_convert_bbcode_ok'] = 'Конвертирование выполнено'; 40 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 41 44 ?> -
extensions/AdditionalPages/language/sk_SK/plugin.lang.php
r7063 r9261 4 4 5 5 $lang['ap_create'] = 'Vytvoriť novú prídavnú stránku'; 6 $lang['ap_deleted_page'] = 'Stránka vymazaná (<a href="' .PHPWG_ROOT_PATH . '">späť na úvodnú stránku</a>)';6 $lang['ap_deleted_page'] = 'Stránka vymazaná'; 7 7 $lang['ap_no_name'] = 'Nevyplnili ste názov.'; 8 $lang['ap_saved_page'] = 'Stránka uložená (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">pozrieť stránku</a>)';8 $lang['ap_saved_page'] = 'Stránka uložená'; 9 9 $lang['ap_modify'] = 'Upraviť prídavnú stránku'; 10 10 $lang['ap_all_lang'] = 'Všetky'; … … 38 38 $lang['ap_parse_bbcode'] = 'Konvertovať stránky napísané v BBCode'; 39 39 $lang['ap_convert_bbcode_ok'] = 'Konverzia úspešná.'; 40 41 /*TODO*/$lang['ap_edit_page'] = 'Edit a page'; 42 /*TODO*/$lang['ap_set_as_homepage'] = 'Set as Homepage'; 43 40 44 ?> -
extensions/AdditionalPages/main.inc.php
r3825 r9261 4 4 Version: auto 5 5 Description: Add additional pages in menubar. 6 Plugin URI: http://p hpwebgallery.net/ext/extension_view.php?eid=1536 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=153 7 7 Author: P@t 8 8 Author URI: http://www.gauchon.com … … 17 17 define('ADD_PAGES_TABLE' , $prefixeTable . 'additionalpages'); 18 18 19 $conf['additional_pages'] = unserialize($conf['additional_pages']); 20 19 21 function additional_pages_admin_menu($menu) 20 22 { … … 27 29 function section_init_additional_page() 28 30 { 29 global $tokens, $page; 30 if ($tokens[0] == 'additional_page') 31 $page['section'] = 'additional_page'; 31 global $tokens, $conf, $page; 32 33 $page['is_homepage'] = (count($tokens) == 1 and empty($tokens[0])); 34 35 if (($tokens[0] == 'page' and !empty($tokens[1])) or ($page['is_homepage'] and !is_null($conf['additional_pages']['homepage']))) 36 include(AP_PATH . 'additional_page.php'); 37 38 if ($tokens[0] == 'additional_page' and !empty($tokens[1])) 39 redirect(make_index_url().'/page/'.$tokens[1]); 32 40 } 33 41 34 function index_additional_page() 35 { 36 global $page; 37 if (isset($page['section']) and $page['section'] == 'additional_page') 38 include(AP_PATH . 'additional_page.php'); 39 } 40 41 $ap_conf = explode ("," , $conf['additional_pages']); 42 if (isset($ap_conf[1]) and $ap_conf[1] == 'on' or is_admin()) 43 { 44 include(AP_PATH . 'index_menu.php'); 45 } 42 include(AP_PATH . 'index_menu.php'); 46 43 47 44 add_event_handler('get_admin_plugin_menu_links', 'additional_pages_admin_menu'); 48 45 add_event_handler('loc_end_section_init', 'section_init_additional_page'); 49 add_event_handler('loc_end_index', 'index_additional_page');50 46 51 47 ?> -
extensions/AdditionalPages/maintain.inc.php
r3609 r9261 11 11 $query = 'CREATE TABLE ' . $prefixeTable . 'additionalpages ( 12 12 id SMALLINT( 5 ) UNSIGNED NOT NULL , 13 pos SMALLINT( 5 ) UNSIGNEDdefault NULL ,14 lang VARCHAR( 255 ) N OTNULL ,13 pos SMALLINT( 5 ) NULL default NULL , 14 lang VARCHAR( 255 ) NULL default NULL , 15 15 title VARCHAR( 255 ) NOT NULL , 16 text LONGTEXT NOT NULL , 16 content LONGTEXT NOT NULL , 17 permalink VARCHAR( 64 ) NULL DEFAULT NULL , 17 18 PRIMARY KEY (id) , 18 19 INDEX (pos) , … … 24 25 if (!isset($conf['additional_pages'])) 25 26 { 27 $config = array( 28 'languages' => array('default' => 'Additional Pages'), 29 'show_menu' => true, 30 'show_home' => true, 31 'redirect' => false, 32 'group_perm' => false, 33 'user_perm' => false, 34 'homepage' => null, 35 ); 26 36 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 27 VALUES ("additional_pages" , " Additional Pages,on,on,off,off,,off,off" , "Parametres du plugin Additional Pages");';37 VALUES ("additional_pages" , "'.addslashes(serialize($config)).'" , "Additional Pages config configuration");'; 28 38 pwg_query($query); 29 39 } … … 51 61 { 52 62 upgrade_ap_from_17(); 63 } 64 $result = array_from_query($query, 'Field'); 65 if (!in_array('permalink', $result)) 66 { 67 upgrade_ap_from_21(); 53 68 } 54 69 } … … 78 93 } 79 94 95 function upgrade_ap_from_21() 96 { 97 global $prefixeTable, $conf; 98 99 $query = 'ALTER TABLE ' . $prefixeTable . 'additionalpages 100 CHANGE `id` `id` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT , 101 CHANGE `pos` `pos` SMALLINT( 5 ) NULL DEFAULT NULL , 102 CHANGE `lang` `lang` VARCHAR( 255 ) NULL DEFAULT NULL , 103 CHANGE `text` `content` LONGTEXT NOT NULL , 104 ADD `users` VARCHAR( 255 ) NULL DEFAULT NULL , 105 ADD `groups` VARCHAR( 255 ) NULL DEFAULT NULL , 106 ADD `permalink` VARCHAR( 64 ) NULL DEFAULT NULL;'; 107 pwg_query($query); 108 109 $query = ' 110 SELECT id, pos, title, lang 111 FROM '.$prefixeTable.'additionalpages 112 ORDER BY pos ASC, id ASC 113 ;'; 114 $result = pwg_query($query); 115 while ($row = mysql_fetch_assoc($result)) 116 { 117 $title = $row['title']; 118 $authorized_users = 'NULL'; 119 $authorized_groups = 'NULL'; 120 121 if (strpos($title , '/user_id=')) 122 { 123 $array = explode('/user_id=' , $title); 124 $title = $array[0]; 125 $authorized_users = '"'.$array[1].'"'; 126 } 127 if (strpos($title , '/group_id=')) 128 { 129 $array = explode('/group_id=' , $title); 130 $title = $array[0]; 131 $authorized_groups = '"'.$array[1].'"'; 132 } 133 134 $position = $row['pos']; 135 if ($row['pos'] === '0') 136 $position = '-1'; 137 elseif (empty($row['pos'])) 138 $position = '0'; 139 140 $language = $row['lang'] != 'ALL' ? '"'.$row['lang'].'"' : 'NULL'; 141 142 $query = ' 143 UPDATE '.$prefixeTable.'additionalpages 144 SET title = "'.addslashes($title).'", 145 pos = '.$position.', 146 lang = '.$language.', 147 users = '.$authorized_users.', 148 groups = '.$authorized_groups.' 149 WHERE id = '.$row['id'].' 150 ;'; 151 pwg_query($query); 152 } 153 154 $old_conf = explode ("," , $conf['additional_pages']); 155 156 $new_conf = array( 157 'show_menu' => @($old_conf[1] == 'on'), 158 'show_home' => @($old_conf[2] == 'on'), 159 'redirect' => @($old_conf[4] == 'on'), 160 'group_perm' => @($old_conf[6] == 'on'), 161 'user_perm' => @($old_conf[7] == 'on'), 162 'homepage' => null, 163 ); 164 165 $languages = explode('/', $old_conf[0]); 166 $new_conf['languages'] = array(); 167 foreach($languages as $language) 168 { 169 $array = explode(':', $language); 170 if (!isset($array[1])) $new_conf['languages']['default'] = $array[0]; 171 else $new_conf['languages'][$array[0]] = $array[1]; 172 } 173 174 $query = ' 175 UPDATE '.CONFIG_TABLE.' 176 SET value = "'.addslashes(serialize($new_conf)).'" 177 WHERE param = "additional_pages" 178 ;'; 179 pwg_query($query); 180 } 181 80 182 ?>
Note: See TracChangeset
for help on using the changeset viewer.