Revision 883
Added by thorn almost 16 years ago
trunk/CHANGELOG | ||
---|---|---|
10 | 10 |
# = Bugfix |
11 | 11 |
! = Update/Change |
12 | 12 |
|
13 |
------------------------------------- 2.7.1 ------------------------------------- |
|
13 |
------------------------------------- 2.7.1 ------------------------------------- |
|
14 |
27-Nov-2008 Thomas Hornik |
|
15 |
! added redirect-type (301/302) to menu_link |
|
14 | 16 |
24-Nov-2008 Matthias Gallas |
15 | 17 |
! updated upgrade-script.php to add sec_anchor field to settings table |
16 | 18 |
22-Nov-2008 Thomas Hornik |
trunk/wb/upgrade-script.php | ||
---|---|---|
102 | 102 |
$OK = '<span class="ok">OK</span>'; |
103 | 103 |
$FAIL = '<span class="error">FAILED</span>'; |
104 | 104 |
|
105 |
/********************************************************** |
|
106 |
* - Adding field sec_anchor to settings table |
|
107 |
*/ |
|
105 |
// function to add a var/value-pair into settings-table |
|
108 | 106 |
function db_add_key_value($key, $value) { |
109 | 107 |
global $database; global $OK; global $FAIL; |
110 | 108 |
$table = TABLE_PREFIX.'settings'; |
... | ... | |
126 | 124 |
} |
127 | 125 |
} |
128 | 126 |
|
129 |
echo "<br />Adding field sec_anchor to settings table<br />"; |
|
127 |
// function to add a new field into a table |
|
128 |
function db_add_field($field, $table, $desc) { |
|
129 |
global $database; global $OK; global $FAIL; |
|
130 |
echo "<u>Adding field '$field' to table '$table'</u><br />"; |
|
131 |
$table = TABLE_PREFIX.$table; |
|
132 |
$query = $database->query("DESCRIBE $table '$field'"); |
|
133 |
if($query->numRows() == 0) { // add field |
|
134 |
$query = $database->query("ALTER TABLE $table ADD $field $desc"); |
|
135 |
echo (mysql_error()?mysql_error().'<br />':''); |
|
136 |
$query = $database->query("DESCRIBE $table '$field'"); |
|
137 |
echo (mysql_error()?mysql_error().'<br />':''); |
|
138 |
if($query->numRows() > 0) { |
|
139 |
echo "'$field' added. $OK.<br />"; |
|
140 |
} else { |
|
141 |
echo "adding '$field' $FAIL!<br />"; |
|
142 |
} |
|
143 |
} else { |
|
144 |
echo "'$field' allready there. $OK.<br />"; |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
|
|
149 |
/********************************************************** |
|
150 |
* - Adding field sec_anchor to settings table |
|
151 |
*/ |
|
152 |
echo "<br />Adding key sec_anchor to settings table<br />"; |
|
130 | 153 |
$cfg = array( |
131 | 154 |
'sec_anchor' => 'wb_' |
132 |
|
|
133 | 155 |
); |
134 | 156 |
foreach($cfg as $key=>$value) { |
135 | 157 |
db_add_key_value($key, $value); |
136 | 158 |
} |
137 | 159 |
|
160 |
|
|
138 | 161 |
/********************************************************** |
162 |
* - Add field "redirect_type" to table "mod_menu_link" |
|
163 |
*/ |
|
164 |
echo "<br />Adding field redirect_type to mod_menu_link table<br />"; |
|
165 |
db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`"); |
|
166 |
|
|
167 |
|
|
168 |
/********************************************************** |
|
139 | 169 |
* - End of upgrade script |
140 | 170 |
*/ |
141 | 171 |
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>'; |
trunk/wb/index.php | ||
---|---|---|
55 | 55 |
|
56 | 56 |
// redirect menu-link |
57 | 57 |
$this_page_id = PAGE_ID; |
58 |
if(version_compare(phpversion(), '4.3', '>=')) $php43 = TRUE; else $php43 = FALSE; |
|
58 | 59 |
$query_this_module = $database->query("SELECT module, block FROM ".TABLE_PREFIX."sections WHERE page_id = '$this_page_id' AND module = 'menu_link'"); |
59 | 60 |
if($query_this_module->numRows() == 1) { // This is a menu_link. Get link of target-page and redirect |
60 | 61 |
// get target_page_id |
61 | 62 |
$table = TABLE_PREFIX.'mod_menu_link'; |
62 |
$query_tpid = $database->query("SELECT target_page_id, anchor, extern FROM $table WHERE page_id = '$this_page_id'");
|
|
63 |
$query_tpid = $database->query("SELECT * FROM $table WHERE page_id = '$this_page_id'");
|
|
63 | 64 |
if($query_tpid->numRows() == 1) { |
64 | 65 |
$res=$query_tpid->fetchRow(); |
65 | 66 |
$target_page_id = $res['target_page_id']; |
67 |
$r_type = $res['redirect_type']; |
|
66 | 68 |
$anchor = $res['anchor']; |
67 | 69 |
$extern = $res['extern']; |
68 | 70 |
if($anchor != '0') $anchor = ''.$anchor; |
69 | 71 |
else $anchor = FALSE; |
72 |
// set redirect-type |
|
73 |
if($r_type=='301') { |
|
74 |
if($php43) @header('HTTP/1.1 301 Moved Permanently', TRUE, 301); |
|
75 |
else @header('HTTP/1.1 301 Moved Permanently'); |
|
76 |
} |
|
70 | 77 |
if($target_page_id == -1) { |
71 | 78 |
if($extern!='') { |
72 | 79 |
header("Location: $extern".($anchor?'#'.$anchor:'')); |
... | ... | |
78 | 85 |
if($query_link->numRows() == 1) { |
79 | 86 |
$res=$query_link->fetchRow(); |
80 | 87 |
$target_page_link = $res['link']; |
81 |
// redirect |
|
82 | 88 |
header('Location: '.WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.($anchor?'#'.$anchor:'')); |
83 | 89 |
exit; |
84 | 90 |
} |
trunk/wb/modules/menu_link/save.php | ||
---|---|---|
34 | 34 |
$foreign_page_id = $admin->add_slashes($_POST['page_link']); |
35 | 35 |
$page_target = $admin->add_slashes($_POST['page_target']); |
36 | 36 |
$url_target = $admin->add_slashes($_POST['target']); |
37 |
$r_type = $admin->add_slashes($_POST['r_type']); |
|
37 | 38 |
if(isset($_POST['extern'])) |
38 | 39 |
$extern = $admin->add_slashes($_POST['extern']); |
39 | 40 |
else |
... | ... | |
41 | 42 |
|
42 | 43 |
$table_pages = TABLE_PREFIX.'pages'; |
43 | 44 |
$table_mod = TABLE_PREFIX.'mod_menu_link'; |
44 |
$database->query("UPDATE $table_pages SET target = '$url_target' WHERE page_id = '$page_id'");
|
|
45 |
$database->query("UPDATE $table_mod SET target_page_id = '$foreign_page_id', anchor = '$page_target', extern = '$extern' WHERE page_id = '$page_id'");
|
|
45 |
$database->query("UPDATE `$table_pages` SET `target` = '$url_target' WHERE `page_id` = '$page_id'");
|
|
46 |
$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
|
|
46 | 47 |
} |
47 | 48 |
|
48 | 49 |
// Check if there is a database error, otherwise say successful |
trunk/wb/modules/menu_link/languages/NL.php | ||
---|---|---|
29 | 29 |
// Headings and text outputs |
30 | 30 |
$MOD_MENU_LINK['TEXT'] = 'Klik HIER om naar de hoofdpagina te gaan'; |
31 | 31 |
$MOD_MENU_LINK['EXTERNAL_LINK'] = 'Externe Link'; |
32 |
$MOD_MENU_LINK['R_TYPE'] = 'Redirect-Type'; |
|
32 | 33 |
|
33 | 34 |
?> |
trunk/wb/modules/menu_link/languages/NO.php | ||
---|---|---|
29 | 29 |
// Headings and text outputs |
30 | 30 |
$MOD_MENU_LINK['TEXT'] = 'Klikk HER for å komme til hovedsiden'; |
31 | 31 |
$MOD_MENU_LINK['EXTERNAL_LINK'] = 'Ekstern lenke'; |
32 |
$MOD_MENU_LINK['R_TYPE'] = 'Redirect-Type'; |
|
32 | 33 |
|
33 | 34 |
?> |
trunk/wb/modules/menu_link/languages/EN.php | ||
---|---|---|
29 | 29 |
// Headings and text outputs |
30 | 30 |
$MOD_MENU_LINK['TEXT'] = 'Click HERE to go to the main page'; |
31 | 31 |
$MOD_MENU_LINK['EXTERNAL_LINK'] = 'External Link'; |
32 |
$MOD_MENU_LINK['R_TYPE'] = 'Redirect-Type'; |
|
32 | 33 |
|
33 | 34 |
?> |
trunk/wb/modules/menu_link/languages/RU.php | ||
---|---|---|
29 | 29 |
// Headings and text outputs |
30 | 30 |
$MOD_MENU_LINK['TEXT'] = 'Нажмите здесь для перехода на главную'; |
31 | 31 |
$MOD_MENU_LINK['EXTERNAL_LINK'] = 'Внешняя ссылка'; |
32 |
$MOD_MENU_LINK['R_TYPE'] = 'Redirect-Type'; |
|
32 | 33 |
|
33 | 34 |
?> |
trunk/wb/modules/menu_link/languages/DE.php | ||
---|---|---|
32 | 32 |
// Ueberschriften und Textausgaben |
33 | 33 |
$MOD_MENU_LINK['TEXT'] = 'Klicken Sie HIER um zur Startseite zu gelangen'; |
34 | 34 |
$MOD_MENU_LINK['EXTERNAL_LINK'] = 'Entfernte Adresse'; |
35 |
$MOD_MENU_LINK['R_TYPE'] = 'Redirect-Typ'; |
|
35 | 36 |
|
36 | 37 |
?> |
trunk/wb/modules/menu_link/install.php | ||
---|---|---|
36 | 36 |
`section_id` INT(11) NOT NULL DEFAULT '0', |
37 | 37 |
`page_id` INT(11) NOT NULL DEFAULT '0', |
38 | 38 |
`target_page_id` INT(11) NOT NULL DEFAULT '0', |
39 |
`redirect_type` INT NOT NULL DEFAULT '302', |
|
39 | 40 |
`anchor` VARCHAR(255) NOT NULL DEFAULT '0' , |
40 | 41 |
`extern` VARCHAR(255) NOT NULL DEFAULT '' , |
41 | 42 |
PRIMARY KEY (`section_id`) |
trunk/wb/modules/menu_link/modify.php | ||
---|---|---|
40 | 40 |
$sql_result = $database->query("SELECT * FROM $table WHERE section_id = '$section_id'"); |
41 | 41 |
$sql_row = $sql_result->fetchRow(); |
42 | 42 |
$target_page_id = $sql_row['target_page_id']; |
43 |
$r_type = $sql_row['redirect_type']; |
|
43 | 44 |
$extern = $sql_row['extern']; |
44 | 45 |
$anchor = $sql_row['anchor']; |
45 | 46 |
$sel = ' selected'; |
... | ... | |
178 | 179 |
</td> |
179 | 180 |
<td> |
180 | 181 |
<select name="target" style="width:250px;" /> |
181 |
<option value="_blank"<?php if($target=='_blank') echo ' selected'; ?>><?php echo $TEXT['NEW_WINDOW'] ?></option> |
|
182 |
<option value="_self"<?php if($target=='_self') echo ' selected'; ?>><?php echo $TEXT['SAME_WINDOW'] ?></option> |
|
183 |
<option value="_top"<?php if($target=='_top') echo ' selected'; ?>><?php echo $TEXT['TOP_FRAME'] ?></option> |
|
182 |
<option value="_blank"<?php if($target=='_blank') echo ' selected="selected"'; ?>><?php echo $TEXT['NEW_WINDOW'] ?></option>
|
|
183 |
<option value="_self"<?php if($target=='_self') echo ' selected="selected"'; ?>><?php echo $TEXT['SAME_WINDOW'] ?></option>
|
|
184 |
<option value="_top"<?php if($target=='_top') echo ' selected="selected"'; ?>><?php echo $TEXT['TOP_FRAME'] ?></option>
|
|
184 | 185 |
</select> |
185 | 186 |
</td> |
186 | 187 |
</tr> |
188 |
<tr> |
|
189 |
<td> |
|
190 |
<?php echo $MOD_MENU_LINK['R_TYPE'].':' ?> |
|
191 |
</td> |
|
192 |
<td> |
|
193 |
<select name="r_type" style="width:250px;" /> |
|
194 |
<option value="301"<?php if($r_type=='301') echo ' selected="selected"'; ?>>301</option> |
|
195 |
<option value="302"<?php if($r_type=='302') echo ' selected="selected"'; ?>>302</option> |
|
196 |
</select> |
|
197 |
</td> |
|
198 |
</tr> |
|
187 | 199 |
</table> |
188 | 200 |
|
189 | 201 |
<br /> |
Also available in: Unified diff
added redirect-type (301/302) to menu_link