Changeset 9262 for extensions/AdditionalPages
- Timestamp:
- Feb 17, 2011, 5:24:12 PM (14 years ago)
- Location:
- extensions/AdditionalPages
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdditionalPages/admin/admin.php
r9261 r9262 9 9 $my_base_url = get_admin_plugin_menu_link(__FILE__); 10 10 11 $query = 'SELECT id 12 FROM ' . ADD_PAGES_TABLE . ' 13 LIMIT 1 14 ;'; 15 $page_exist = array_from_query($query, 'id'); 16 11 17 if (!isset($_GET['tab'])) 12 $page['tab'] = 'manage'; 18 { 19 $page['tab'] = $page_exist ? 'manage' : 'add_page'; 20 } 13 21 else 22 { 14 23 $page['tab'] = $_GET['tab']; 24 } 15 25 16 26 include(AP_PATH.'admin/'.$page['tab'].'.inc.php'); 17 27 18 28 $tabsheet = new tabsheet(); 19 $tabsheet->add('manage', l10n('Manage'), $my_base_url.'&tab=manage'); 29 if ($page_exist) 30 { 31 $tabsheet->add('manage', l10n('Manage'), $my_base_url.'&tab=manage'); 32 } 20 33 $tabsheet->add('add_page', l10n('ap_add_page'), $my_base_url.'&tab=add_page'); 21 34 $tabsheet->add('config', l10n('Configuration'), $my_base_url.'&tab=config'); -
extensions/AdditionalPages/admin/config.inc.php
r9261 r9262 6 6 if (isset($_POST['submit'])) 7 7 { 8 $params = array('show_ menu', 'show_home', 'redirect', 'group_perm', 'user_perm');8 $params = array('show_home', 'group_perm', 'user_perm'); 9 9 10 10 $new_conf = array(); -
extensions/AdditionalPages/admin/template/config.tpl
r9261 r9262 8 8 <table> 9 9 <tr> 10 <td><br>{'ap_menu_name'|@translate} : </td>11 <td><br>{'Default'|@translate} </td>12 <td><br><input type="text" size="50" maxlength="255" value="{$LANG_DEFAULT_VALUE}" name="menu_lang[default]"/></td>13 </tr>14 {foreach from=$language item=lang}15 <tr>16 <td></td>17 <td>{$lang.LANGUAGE_NAME} </td>18 <td><input type="text" size="50" maxlength="255" value="{$lang.VALUE}" name="menu_lang[{$lang.LANGUAGE_CODE}]"/></td>19 </tr>20 {/foreach}21 <tr>22 <td colspan="3"><br><hr><br></td>23 </tr>24 <tr>25 <td colspan="3"><input type="checkbox" name="show_menu" value="on" {if $ap_conf.show_menu}checked="checked"{/if}/> {'ap_show_menu'|@translate}</td>26 </tr>27 <tr>28 10 <td colspan="3"><input type="checkbox" name="show_home" value="on" {if $ap_conf.show_home}checked="checked"{/if}/> {'ap_show_home'|@translate}</td> 29 </tr>30 <tr>31 <td colspan="3"><input type="checkbox" name="redirect" value="on" {if $ap_conf.redirect}checked="checked"{/if}/> {'ap_redirect'|@translate}</td>32 11 </tr> 33 12 <tr> … … 43 22 <td colspan="2"> <input type="checkbox" name="group_perm" value="on" {if $ap_conf.group_perm}checked="checked"{/if}/> <i>{'ap_group_perm'|@translate}</i></td> 44 23 </tr> 45 24 <tr> 25 <td colspan="3"><br><hr><br></td> 26 </tr> 27 <tr> 28 <td><br>{'ap_menu_name'|@translate} : </td> 29 <td><br>{'Default'|@translate} </td> 30 <td><br><input type="text" size="50" maxlength="255" value="{$LANG_DEFAULT_VALUE}" name="menu_lang[default]"/></td> 31 </tr> 32 {foreach from=$language item=lang} 33 <tr> 34 <td></td> 35 <td>{$lang.LANGUAGE_NAME} </td> 36 <td><input type="text" size="50" maxlength="255" value="{$lang.VALUE}" name="menu_lang[{$lang.LANGUAGE_CODE}]"/></td> 37 </tr> 38 {/foreach} 46 39 </table> 47 40 -
extensions/AdditionalPages/index_menu.php
r9261 r9262 41 41 FROM ' . ADD_PAGES_TABLE . ' 42 42 WHERE (lang = "' . $user['language'] . '" OR lang IS NULL) 43 AND pos > 043 AND pos >= 0 44 44 ORDER BY pos ASC, id ASC 45 45 ;'; -
extensions/AdditionalPages/main.inc.php
r9261 r9262 17 17 define('ADD_PAGES_TABLE' , $prefixeTable . 'additionalpages'); 18 18 19 $conf['additional_pages'] = unserialize($conf['additional_pages']); 19 $conf['additional_pages'] = @unserialize($conf['additional_pages']); 20 21 if ($conf['additional_pages'] === false) 22 include(AP_PATH.'admin/upgrade_from_21.php'); 20 23 21 24 function additional_pages_admin_menu($menu) -
extensions/AdditionalPages/maintain.inc.php
r9261 r9262 27 27 $config = array( 28 28 'languages' => array('default' => 'Additional Pages'), 29 'show_menu' => true,30 29 'show_home' => true, 31 'redirect' => false,32 30 'group_perm' => false, 33 31 'user_perm' => false, … … 62 60 upgrade_ap_from_17(); 63 61 } 64 $result = array_from_query($query, 'Field');65 if (!in_array('permalink', $result))66 {67 upgrade_ap_from_21();68 }69 62 } 70 63 … … 93 86 } 94 87 95 function upgrade_ap_from_21()96 {97 global $prefixeTable, $conf;98 99 $query = 'ALTER TABLE ' . $prefixeTable . 'additionalpages100 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, lang111 FROM '.$prefixeTable.'additionalpages112 ORDER BY pos ASC, id ASC113 ;';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.'additionalpages144 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 182 88 ?>
Note: See TracChangeset
for help on using the changeset viewer.