Revision 1837
Added by Dietmar almost 12 years ago
index.php | ||
---|---|---|
18 | 18 |
require('../../config.php'); |
19 | 19 |
require_once(WB_PATH.'/framework/class.admin.php'); |
20 | 20 |
$admin = new admin('Pages', 'pages'); |
21 |
|
|
22 | 21 |
$admin->clearIDKEY(); |
23 |
|
|
24 | 22 |
// Include the WB functions file |
25 | 23 |
require_once(WB_PATH.'/framework/functions.php'); |
26 | 24 |
// eggsurplus: add child pages for a specific page |
27 | 25 |
/**/ |
28 | 26 |
|
29 |
?> |
|
30 |
<script type="text/javascript" src="<?php print ADMIN_URL; ?>/pages/eggsurplus.js"></script> |
|
31 |
<?php |
|
27 |
echo '<script type="text/javascript" src="'.ADMIN_URL.'/pages/eggsurplus.js"></script>'.PHP_EOL; |
|
32 | 28 |
// fixes A URI contains impermissible characters or quotes around the URI are not closed. |
33 | 29 |
$MESSAGE['PAGES_DELETE_CONFIRM'] = url_encode( $MESSAGE['PAGES_DELETE_CONFIRM'] ); |
34 | 30 |
|
35 | 31 |
function set_node ($parent,& $par) |
36 | 32 |
{ |
37 | 33 |
$retval = ''; |
38 |
|
|
39 |
if($par['num_subs'] ) |
|
40 |
{ |
|
41 |
$retval .= "\n".'<ul id="p'.$parent.'"'; |
|
42 |
if ($parent != 0) |
|
43 |
{ |
|
44 |
$retval .= ' class="page_list"'; |
|
45 |
if (isset ($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1') |
|
46 |
{ |
|
47 |
$retval .= ' style="display:block"'; |
|
34 |
if ($par['num_subs']) { |
|
35 |
$retval .= "\n".'<ul id="p'.$parent.'"'; |
|
36 |
if ($parent != 0) { |
|
37 |
$retval .= ' class="page_list"'; |
|
38 |
if (isset ($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1') { |
|
39 |
$retval .= ' style="display:block"'; |
|
40 |
} |
|
48 | 41 |
} |
49 |
} |
|
50 |
$retval .= ">\n"; |
|
42 |
$retval .= ">\n"; |
|
51 | 43 |
} |
52 |
|
|
53 | 44 |
return $retval; |
54 | 45 |
} |
55 | 46 |
|
56 | 47 |
function make_list($parent = 0, $editable_pages = 0) { |
57 | 48 |
// Get objects and vars from outside this function |
58 |
global $admin, $template, $database, $TEXT, $MESSAGE, $HEADING, $par; |
|
59 |
static $row,$iLevel,$iOldLevel; |
|
60 |
static $aRowLevel = array(); |
|
61 |
print set_node ($parent,$par); |
|
62 |
|
|
49 |
global $admin, $template, $TEXT, $MESSAGE, $HEADING, $par; |
|
50 |
$database = WbDatabase::getInstance(); |
|
51 |
static $row = 0; |
|
52 |
// static $iLevel = 0; |
|
53 |
// static $iOldLevel = 0; |
|
54 |
// static $aRowLevel = array(); |
|
55 |
|
|
56 |
print set_node ($parent, $par); |
|
63 | 57 |
// Get page list from database |
64 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' ';
|
|
65 |
$sql .= (PAGE_TRASH != 'inline') ? 'AND `visibility` != \'deleted\' ' : ' ';
|
|
66 |
$sql .= 'ORDER BY `position` ASC';
|
|
67 |
$get_pages = $database->query($sql);
|
|
68 |
// Work out how many pages there are for this parent
|
|
69 |
$num_pages = $get_pages->numRows();
|
|
58 |
$sql = 'SELECT `module`, MAX(s.`publ_start` + s.`publ_end`) published, p.* '
|
|
59 |
. 'FROM `'.TABLE_PREFIX.'pages` p '
|
|
60 |
. 'INNER JOIN `'.TABLE_PREFIX.'sections` s ON p.`page_id` = s.`page_id` '
|
|
61 |
. 'WHERE `parent`='.$parent.((PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\' ' : ' ')
|
|
62 |
. 'GROUP BY p.`page_id` '
|
|
63 |
. 'ORDER BY p.`position` ASC';
|
|
70 | 64 |
|
71 |
// Insert values into main page list |
|
72 |
if($get_pages->numRows() > 0) |
|
73 |
{ |
|
74 |
while($page = $get_pages->fetchRow()) |
|
75 |
{ |
|
65 |
if($get_pages = $database->query($sql)) { |
|
66 |
// Work out how many pages there are for this parent |
|
67 |
$num_pages = $get_pages->numRows(); |
|
68 |
// Insert values into main page list |
|
69 |
if($num_pages > 0) |
|
70 |
{ |
|
71 |
while($page = $get_pages->fetchRow(MYSQL_ASSOC)) |
|
72 |
{ |
|
73 |
//echo implode('-',$page); |
|
74 |
$sLineOut = ''; |
|
75 |
$row = $row++ % 2; // toggle row colors between 0<->1 |
|
76 |
// Get user permissions |
|
77 |
$can_modify = false; |
|
78 |
if( $admin->ami_group_member($page['admin_users']) || |
|
79 |
$admin->is_group_match($admin->get_groups_id(), $page['admin_groups'])) |
|
80 |
{ |
|
81 |
if(($page['visibility'] == 'deleted' && PAGE_TRASH == 'inline') || |
|
82 |
($page['visibility'] != 'deleted')) |
|
83 |
{ |
|
84 |
$can_modify = true; |
|
85 |
$editable_pages++; |
|
86 |
} |
|
87 |
} else { |
|
88 |
if($page['visibility'] == 'private') { continue; } |
|
89 |
} |
|
90 |
// check if the page has children |
|
91 |
// $sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` '; |
|
92 |
// $sql .= 'WHERE `parent`='.$page['page_id']; |
|
93 |
// $sql .= (PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\'' : ''; |
|
94 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` ' |
|
95 |
. 'WHERE `parent`='.$page['page_id'].((PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\'' : ''); |
|
96 |
$par['num_subs'] = intval($database->get_one($sql)); |
|
97 |
$display_plus = (bool)$par['num_subs']; |
|
98 |
$sLineOut .= '<li class="p'.$page['parent'].'">'; |
|
99 |
// --------------------------------------------------------------------------------------- |
|
100 |
$sLineOut .= '<table class="pages_view">'; |
|
101 |
$sLineOut .= "\t".'<tbody>'; |
|
102 |
$sLineOut .= "\t\t".'<tr class="row_'.$row.'">'; |
|
103 |
// --- Tab 1 --- |
|
104 |
$sLineOut .= "\t\t\t".'<td valign="middle" width="20" style="padding-left: '. |
|
105 |
(($page['level'] == 0) ? 0 : ($page['level']*25)-pow($page['level'],2)).'px;">'; |
|
106 |
if($display_plus == true) { |
|
107 |
$sLineOut .= '<a href="javascript:toggle_visibility(\'p'.$page['page_id'].'\');" '. |
|
108 |
'title="'.$TEXT['EXPAND'].'/'.$TEXT['COLLAPSE'].'">'; |
|
109 |
$sLineOut .= '<span>'; |
|
110 |
$sLineOut .= '<img src="'.THEME_URL.'/images/'. |
|
111 |
( ((isset($_COOKIE['p'.$page['page_id']]) && $_COOKIE['p'.$page['page_id']] == '1') ? 'minus' : 'plus'). |
|
112 |
'_16.png" onclick="toggle_plus_minus(\''.$page['page_id'].'\');" '. |
|
113 |
'name="plus_minus_'.$page['page_id'] ).'" alt="+" />'; |
|
114 |
$sLineOut .= '</span>'; |
|
115 |
$sLineOut .= '</a>'; |
|
116 |
} |
|
117 |
$sLineOut .= '</td>'.PHP_EOL; |
|
118 |
// --- Tab 2 --- |
|
119 |
$sLineOut .= "\t\t\t".'<td class="list_menu_title">'; |
|
120 |
$sClassMenutitle = ''; |
|
121 |
if($admin->get_permission('pages_modify') && $can_modify) { |
|
122 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page['page_id'].'" title="'.$TEXT['MODIFY'].'">'; |
|
123 |
$sClassMenutitle = 'bold grey'; |
|
124 |
} |
|
125 |
$sLineOut .= '<span>'; |
|
126 |
switch($page['visibility']): |
|
127 |
case 'private': |
|
128 |
$sIcon = 'private_16.png'; |
|
129 |
$sText = $TEXT['PRIVATE']; |
|
130 |
break; |
|
131 |
case 'registered': |
|
132 |
$sIcon = 'keys_16.png'; |
|
133 |
$sText = $TEXT['REGISTERED']; |
|
134 |
break; |
|
135 |
case 'hidden': |
|
136 |
$sIcon = 'hidden_16.png'; |
|
137 |
$sText = $TEXT['HIDDEN']; |
|
138 |
break; |
|
139 |
case 'none': |
|
140 |
$sIcon = 'none_16.png'; |
|
141 |
$sText = $TEXT['NONE']; |
|
142 |
break; |
|
143 |
case 'deleted': |
|
144 |
$sIcon = 'deleted_16.png'; |
|
145 |
$sText = $TEXT['DELETED']; |
|
146 |
break; |
|
147 |
default: // public |
|
148 |
$sIcon = 'visible_16.png'; |
|
149 |
$sText = $TEXT['PUBLIC']; |
|
150 |
break; |
|
151 |
endswitch; |
|
152 |
$sLineOut .= '<img src="'.THEME_URL.'/images/'.$sIcon.'" '; |
|
153 |
$sLineOut .= 'alt="'.$TEXT['VISIBILITY'].': '.$sText.'" class="page_list_rights" />'; |
|
154 |
if($admin->get_permission('pages_modify') && $can_modify) { |
|
155 |
$sLineOut .= '<span class="modify_link">'.$page['menu_title'].'</span></a>'; |
|
156 |
}else { |
|
157 |
$sLineOut .= '<span class="bold grey">'.$page['menu_title'].'</span>'; |
|
158 |
} |
|
159 |
$sLineOut .= '</td>'.PHP_EOL; |
|
160 |
// --- Tab 3 --- |
|
161 |
$sLineOut .= "\t\t\t".'<td class="list_page_title">'.$page['page_title'].'</td>'.PHP_EOL; |
|
162 |
// --- Tab 4 --- |
|
163 |
$sLineOut .= "\t\t\t".'<td class="list_page_id right">'.$page['page_id'].'</td>'.PHP_EOL; |
|
164 |
// --- Tab 5 --- |
|
165 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
166 |
if($page['visibility'] != 'deleted' && $page['visibility'] != 'none') { |
|
167 |
$sLineOut .= '<a href="'.$admin->page_link($page['link']).'" target="_blank" '. |
|
168 |
'title="'.$TEXT['VIEW'].'">'; |
|
169 |
$sLineOut .= '<img src="'.THEME_URL.'/images/view_16.png" alt="'.$TEXT['VIEW'].'" />'; |
|
170 |
$sLineOut .= '</a>'; |
|
171 |
} |
|
172 |
$sLineOut .= '</td>'.PHP_EOL; |
|
173 |
// --- Tab 6 --- |
|
174 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
175 |
if($page['visibility'] != 'deleted') { |
|
176 |
if($admin->get_permission('pages_settings') && $can_modify) { |
|
177 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/settings.php?page_id='.$page['page_id'].'" '. |
|
178 |
'title="'.$TEXT['SETTINGS'].'">'; |
|
179 |
$sLineOut .= '<img src="'.THEME_URL.'/images/modify_16.png" alt="'.$TEXT['SETTINGS'].'" />'; |
|
180 |
$sLineOut .= '</a>'; |
|
181 |
} |
|
182 |
}else { |
|
183 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/restore.php?page_id='.$page['page_id'].'" '. |
|
184 |
'title="'.$TEXT['RESTORE'].'">'; |
|
185 |
$sLineOut .= '<img src="'.THEME_URL.'/images/restore_16.png" alt="'.$TEXT['RESTORE'].'" />'; |
|
186 |
$sLineOut .= '</a>'; |
|
187 |
} |
|
188 |
$sLineOut .= '</td>'.PHP_EOL; |
|
189 |
// --- Tab 7 --- MANAGE SECTIONS AND DATES BUTTONS --- |
|
190 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
191 |
// Work-out if we should show the "manage dates" link |
|
192 |
if( MANAGE_SECTIONS && $admin->get_permission('pages_add') && $can_modify ) { |
|
193 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/sections.php?page_id='.$page['page_id'].'"'. |
|
194 |
' title="'.$HEADING['MANAGE_SECTIONS'].'">'; |
|
195 |
$file = $admin->page_is_active($page) ? "clock_16.png" : "clock_red_16.png"; |
|
196 |
$file = ($page['published'] && $page['module'] != 'menu_link') ? $file : 'noclock_16.png'; |
|
197 |
$sLineOut .= '<img src="'.THEME_URL.'/images/'.$file.'" alt="'.$HEADING['MANAGE_SECTIONS'].'" />'; |
|
198 |
$sLineOut .= '</a>'; |
|
199 |
} |
|
200 |
$sLineOut .= '</td>'.PHP_EOL; |
|
201 |
// --- Tab 8 --- |
|
202 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
203 |
if($page['position'] != 1) { |
|
204 |
if($page['visibility'] != 'deleted') { |
|
205 |
if($admin->get_permission('pages_settings') && $can_modify) { |
|
206 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/move_up.php?page_id='.$page['page_id'].'" '. |
|
207 |
'title="'.$TEXT['MOVE_UP'].'"><img src="'.THEME_URL. |
|
208 |
'/images/up_16.png" alt="'.$TEXT['MOVE_UP'].'" /></a>'; |
|
209 |
} |
|
210 |
} |
|
211 |
} |
|
212 |
$sLineOut .= '</td>'.PHP_EOL; |
|
213 |
// --- Tab 9 --- |
|
214 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
215 |
if($page['position'] != $num_pages) { |
|
216 |
if($page['visibility'] != 'deleted') { |
|
217 |
if($admin->get_permission('pages_settings') && $can_modify) { |
|
218 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/move_down.php?page_id='.$page['page_id'].'" '. |
|
219 |
'title="'.$TEXT['MOVE_DOWN'].'"><img src="'.THEME_URL. |
|
220 |
'/images/down_16.png" alt="'.$TEXT['MOVE_DOWN'].'" /></a>'; |
|
221 |
} |
|
222 |
} |
|
223 |
}else { $sLineOut .= ' '; } |
|
224 |
$sLineOut .= '</td>'.PHP_EOL; |
|
225 |
// --- Tab 10 --- |
|
226 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
227 |
if($admin->get_permission('pages_delete') && $can_modify) { |
|
228 |
$sLineOut .= '<a href="javascript:confirm_link(\''.$MESSAGE['PAGES_DELETE_CONFIRM']. |
|
229 |
'?,'.ADMIN_URL.'/pages/delete.php?page_id='.$admin->getIDKEY($page['page_id']).'\');" '. |
|
230 |
'title="'.$TEXT['DELETE'].'">'; |
|
231 |
$sLineOut .= '<img src="'.THEME_URL.'/images/delete_16.png" alt="'.$TEXT['DELETE'].'" />'; |
|
232 |
$sLineOut .= '</a>'; |
|
233 |
}else { $sLineOut .= ' '; } |
|
234 |
$sLineOut .= '</td>'.PHP_EOL; |
|
235 |
// --- Tab 11 --- Add action to add a page as a child --- |
|
236 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
237 |
if($admin->get_permission('pages_add') && $can_modify && ($page['visibility'] != 'deleted')) { |
|
238 |
$sLineOut .= '<a href="javascript:add_child_page(\''.$page['page_id'].'\');" ' |
|
239 |
.'title="'.$HEADING['ADD_CHILD_PAGE'].'">'; |
|
240 |
$sLineOut .= '<img src="'.THEME_URL.'/images/siteadd.png" name="addpage_'.$page['page_id'].'" ' |
|
241 |
.'alt="Add Child Page" />'; |
|
242 |
$sLineOut .= '</a>'; |
|
243 |
}else { $sLineOut .= ' '; } |
|
244 |
$sLineOut .= '</td>'.PHP_EOL; |
|
245 |
// --- Tab 12 --- |
|
246 |
$sLineOut .= "\t\t\t".'<td class="list_page_id center">'.$page['language'].'</td>'.PHP_EOL; |
|
247 |
// --- End TR / TBODY / TABLE |
|
248 |
$sLineOut .= "\t\t".'</tr>'.PHP_EOL; |
|
249 |
$sLineOut .= "\t".'</tbody>'.PHP_EOL; |
|
250 |
$sLineOut .= '</table>'.PHP_EOL; |
|
251 |
// --------------------------------------------------------------------------------------- |
|
252 |
echo $sLineOut; |
|
253 |
if ( $page['parent'] == 0) { |
|
254 |
$page_tmp_id = $page['page_id']; |
|
255 |
} |
|
256 |
// Get subs |
|
257 |
$editable_pages = make_list($page['page_id'], $editable_pages); |
|
258 |
echo '</li>'.PHP_EOL; |
|
259 |
} // end of WHILE |
|
260 |
} // end of $num_pages > 0 |
|
261 |
} // end of $get_pages = $database->query($sql) |
|
76 | 262 |
|
77 |
$row = $row ? 0 : 1; |
|
78 |
// Get user perms |
|
79 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
|
80 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
|
81 |
$in_group = FALSE; |
|
82 |
foreach($admin->get_groups_id() as $cur_gid) |
|
83 |
{ |
|
84 |
if (in_array($cur_gid, $admin_groups)) |
|
85 |
{ |
|
86 |
$in_group = TRUE; |
|
87 |
} |
|
88 |
} |
|
89 |
if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users))) |
|
90 |
{ |
|
91 |
if($page['visibility'] == 'deleted') |
|
92 |
{ |
|
93 |
if(PAGE_TRASH == 'inline') |
|
94 |
{ |
|
95 |
$can_modify = true; |
|
96 |
$editable_pages = $editable_pages+1; |
|
97 |
} else { |
|
98 |
$can_modify = false; |
|
99 |
} |
|
100 |
} elseif($page['visibility'] != 'deleted') |
|
101 |
{ |
|
102 |
$can_modify = true; |
|
103 |
$editable_pages = $editable_pages+1; |
|
104 |
} |
|
105 |
} else { |
|
106 |
if($page['visibility'] == 'private') |
|
107 |
{ |
|
108 |
continue; |
|
109 |
} |
|
110 |
else { |
|
111 |
$can_modify = false; |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
// Work out if we should show a plus or not |
|
116 |
$sql = 'SELECT `page_id`,`admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$page['page_id'].' '; |
|
117 |
$sql .= (PAGE_TRASH != 'inline') ? 'AND `visibility` != \'deleted\' ' : ' '; |
|
118 |
// $sql .= ' ORDER BY `position` ASC'; |
|
119 |
$get_page_subs = $database->query($sql); |
|
120 |
$num_subs = $get_page_subs->numRows(); |
|
121 |
$par['num_subs'] = $num_subs; |
|
122 |
/* |
|
123 |
if(PAGE_TRASH != 'inline') |
|
124 |
{ |
|
125 |
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'"); |
|
126 |
} else { |
|
127 |
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'"); |
|
128 |
} |
|
129 |
*/ |
|
130 |
if($get_page_subs->numRows() > 0) |
|
131 |
{ |
|
132 |
$display_plus = true; |
|
133 |
} else { |
|
134 |
$display_plus = false; |
|
135 |
} |
|
136 |
|
|
137 |
?> |
|
138 |
<li class="p<?php echo $page['parent']; ?>"> |
|
139 |
<table class="pages_view"> |
|
140 |
<tbody> |
|
141 |
<tr class="row_<?php echo $row ?>"> |
|
142 |
<td valign="middle" width="20" style="padding-left: <?php echo $page['level']==0 ? 0 : ($page['level']*25)-pow($page['level'],2); ?>px;"> |
|
143 |
<?php |
|
144 |
if($display_plus == true) { |
|
145 |
?> |
|
146 |
<a href="javascript:toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>"> |
|
147 |
<span> |
|
148 |
<img src="<?php echo THEME_URL; ?>/images/<?php echo ( isset($_COOKIE['p'.$page['page_id']]) && $_COOKIE['p'.$page['page_id']] == '1') ?'minus' : 'plus'; ?>_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" alt="+" /> |
|
149 |
</span> |
|
150 |
|
|
151 |
</a> |
|
152 |
<?php |
|
153 |
} |
|
154 |
?> |
|
155 |
</td> |
|
156 |
<?php if($admin->get_permission('pages_modify') == true && $can_modify == true) { ?> |
|
157 |
<td class="list_menu_title"> |
|
158 |
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"> |
|
159 |
<span> |
|
160 |
<?php if($page['visibility'] == 'public') { ?> |
|
161 |
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" /> |
|
162 |
<?php } elseif($page['visibility'] == 'private') { ?> |
|
163 |
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" /> |
|
164 |
<?php } elseif($page['visibility'] == 'registered') { ?> |
|
165 |
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" /> |
|
166 |
<?php } elseif($page['visibility'] == 'hidden') { ?> |
|
167 |
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" /> |
|
168 |
<?php } elseif($page['visibility'] == 'none') { ?> |
|
169 |
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" /> |
|
170 |
<?php } elseif($page['visibility'] == 'deleted') { ?> |
|
171 |
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" /> |
|
172 |
<?php } |
|
173 |
echo '<span class="modify_link">'.($page['menu_title']).'</span>'; ?> |
|
174 |
</span> |
|
175 |
</a> |
|
176 |
</td> |
|
177 |
<?php } else { ?> |
|
178 |
<td class="list_menu_title"> |
|
179 |
<span> |
|
180 |
<?php if($page['visibility'] == 'public') { ?> |
|
181 |
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" /> |
|
182 |
<?php } elseif($page['visibility'] == 'private') { ?> |
|
183 |
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" /> |
|
184 |
<?php } elseif($page['visibility'] == 'registered') { ?> |
|
185 |
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" /> |
|
186 |
<?php } elseif($page['visibility'] == 'hidden') { ?> |
|
187 |
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" /> |
|
188 |
<?php } elseif($page['visibility'] == 'none') { ?> |
|
189 |
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" /> |
|
190 |
<?php } elseif($page['visibility'] == 'deleted') { ?> |
|
191 |
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" /> |
|
192 |
<?php } |
|
193 |
echo '<span class="bold grey">'.($page['menu_title']).'</span>'; ?> |
|
194 |
</span> |
|
195 |
</td> |
|
196 |
<?php } ?> |
|
197 |
<td class="list_page_title"> |
|
198 |
<?php echo ($page['page_title']); ?> |
|
199 |
</td> |
|
200 |
<td class="list_page_id right"> |
|
201 |
<?php echo $page['page_id']; ?> |
|
202 |
</td> |
|
203 |
|
|
204 |
<td class="list_actions"> |
|
205 |
<?php if($page['visibility'] != 'deleted' && $page['visibility'] != 'none') { ?> |
|
206 |
<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank" title="<?php echo $TEXT['VIEW']; ?>"> |
|
207 |
<img src="<?php echo THEME_URL; ?>/images/view_16.png" alt="<?php echo $TEXT['VIEW']; ?>" /> |
|
208 |
</a> |
|
209 |
<?php } ?> |
|
210 |
</td> |
|
211 |
<td class="list_actions"> |
|
212 |
<?php if($page['visibility'] != 'deleted') { ?> |
|
213 |
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?> |
|
214 |
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>"> |
|
215 |
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" alt="<?php echo $TEXT['SETTINGS']; ?>" /> |
|
216 |
</a> |
|
217 |
<?php } ?> |
|
218 |
<?php } else { ?> |
|
219 |
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>"> |
|
220 |
<img src="<?php echo THEME_URL; ?>/images/restore_16.png" alt="<?php echo $TEXT['RESTORE']; ?>" /> |
|
221 |
</a> |
|
222 |
<?php } ?> |
|
223 |
</td> |
|
224 |
<!-- MANAGE SECTIONS AND DATES BUTTONS --> |
|
225 |
<td class="list_actions"> |
|
226 |
<?php |
|
227 |
// Work-out if we should show the "manage dates" link |
|
228 |
if( (MANAGE_SECTIONS == true) && $admin->get_permission('pages_add')==true && $can_modify==true) |
|
229 |
{ |
|
230 |
$sql = 'SELECT `publ_start`, `publ_end` FROM `'.TABLE_PREFIX.'sections` '; |
|
231 |
$sql .= 'WHERE `page_id` = '.$page['page_id'].' AND `module` != \'menu_link\' '; |
|
232 |
// $query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'"); |
|
233 |
if( ($query_sections = $database->query($sql)) ) |
|
234 |
{ |
|
235 |
$mdate_display=false; |
|
236 |
while($mdate_res = $query_sections->fetchRow()) |
|
237 |
{ |
|
238 |
if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0') |
|
239 |
{ |
|
240 |
$mdate_display=true; |
|
241 |
break; |
|
242 |
} |
|
243 |
} |
|
244 |
if($mdate_display==1) |
|
245 |
{ |
|
246 |
$file=$admin->page_is_active($page)?"clock_16.png":"clock_red_16.png"; |
|
247 |
?> |
|
248 |
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>"> |
|
249 |
<img src="<?php echo THEME_URL."/images/$file"; ?>" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /> |
|
250 |
</a> |
|
251 |
<?php } else { ?> |
|
252 |
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>"> |
|
253 |
<img src="<?php echo THEME_URL; ?>/images/noclock_16.png" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a> |
|
254 |
<?php } ?> |
|
255 |
<?php } ?> |
|
256 |
<?php } ?> |
|
257 |
</td> |
|
258 |
<td class="list_actions"> |
|
259 |
<?php if($page['position'] != 1) { ?> |
|
260 |
<?php if($page['visibility'] != 'deleted') { ?> |
|
261 |
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?> |
|
262 |
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>"> |
|
263 |
<img src="<?php echo THEME_URL; ?>/images/up_16.png" alt="<?php echo $TEXT['MOVE_UP']; ?>" /> |
|
264 |
</a> |
|
265 |
<?php } ?> |
|
266 |
<?php } ?> |
|
267 |
<?php } ?> |
|
268 |
</td> |
|
269 |
<td class="list_actions"> |
|
270 |
<?php if($page['position'] != $num_pages) { ?> |
|
271 |
<?php if($page['visibility'] != 'deleted') { ?> |
|
272 |
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?> |
|
273 |
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>"> |
|
274 |
<img src="<?php echo THEME_URL; ?>/images/down_16.png" alt="<?php echo $TEXT['MOVE_DOWN']; ?>" /> |
|
275 |
</a> |
|
276 |
<?php } ?> |
|
277 |
<?php } ?> |
|
278 |
<?php } ?> |
|
279 |
</td> |
|
280 |
<td class="list_actions"> |
|
281 |
<?php if($admin->get_permission('pages_delete') == true && $can_modify == true) { // add IdKey ?> |
|
282 |
<a href="javascript:confirm_link('<?php echo $MESSAGE['PAGES_DELETE_CONFIRM']; ?>?','<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $admin->getIDKEY($page['page_id']); ?>');" title="<?php echo $TEXT['DELETE']; ?>"> |
|
283 |
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['DELETE']; ?>" /> |
|
284 |
</a> |
|
285 |
<?php } ?> |
|
286 |
</td> |
|
287 |
<?php |
|
288 |
// eggsurplus: Add action to add a page as a child |
|
289 |
?> |
|
290 |
<td class="list_actions"> |
|
291 |
<?php if(($admin->get_permission('pages_add')) == true && ($can_modify == true) && ($page['visibility'] != 'deleted')) { ?> |
|
292 |
<a href="javascript:add_child_page('<?php echo $page['page_id']; ?>');" title="<?php echo $HEADING['ADD_CHILD_PAGE']; ?>"> |
|
293 |
<img src="<?php echo THEME_URL; ?>/images/siteadd.png" name="addpage_<?php echo $page['page_id']; ?>" alt="Add Child Page" /> |
|
294 |
</a> |
|
295 |
<?php } ?> |
|
296 |
</td> |
|
297 |
<?php |
|
298 |
// end [IC] jeggers 2009/10/14: Add action to add a page as a child |
|
299 |
?> |
|
300 |
<td class="list_page_id center"> |
|
301 |
<?php echo $page['language']; ?> |
|
302 |
</td> |
|
303 |
</tr> |
|
304 |
</tbody> |
|
305 |
</table> |
|
306 |
<?php |
|
307 |
if ( $page['parent'] == 0) |
|
308 |
{ |
|
309 |
$page_tmp_id = $page['page_id']; |
|
310 |
} |
|
311 |
// Get subs |
|
312 |
$editable_pages=make_list($page['page_id'], $editable_pages); |
|
313 |
print '</li>'."\n"; |
|
314 |
} |
|
315 |
} |
|
316 |
$output = ($par['num_subs'] )? '</ul>'."\n" : ''; |
|
263 |
$output = ($par['num_subs'] )? '</ul>'.PHP_EOL : ''; |
|
317 | 264 |
$par['num_subs'] = (empty($output) ) ? 1 : $par['num_subs']; |
318 |
print $output;
|
|
265 |
echo $output;
|
|
319 | 266 |
return $editable_pages; |
320 | 267 |
} |
321 |
|
|
322 | 268 |
// Generate pages list |
323 |
if($admin->get_permission('pages_view') == true) { |
|
324 |
?> |
|
269 |
if($admin->get_permission('pages_view') == true) |
|
270 |
{ |
|
271 |
$sListHeader = <<<LHEAD |
|
325 | 272 |
<div class="jsadmin hide"></div> |
326 |
<table> |
|
327 |
<tbody> |
|
328 |
<tr> |
|
329 |
<td> |
|
330 |
<h2 class="left"><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2> |
|
331 |
</td> |
|
332 |
<td align="right"></td> |
|
333 |
</tr> |
|
334 |
</tbody> |
|
335 |
</table> |
|
336 |
<div class="pages_list"> |
|
337 |
<table> |
|
338 |
<tbody> |
|
339 |
<tr class="pages_list_header"> |
|
340 |
<td class="header_list_menu_title"> |
|
341 |
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE']; ?>: |
|
342 |
</td> |
|
343 |
<td class="header_list_page_title"> |
|
344 |
<?php echo $TEXT['PAGE_TITLE']; ?>: |
|
345 |
</td> |
|
346 |
<td class="header_list_page_id"> |
|
347 |
PID |
|
348 |
</td> |
|
349 |
<td class="header_list_actions"> |
|
350 |
<?php echo $TEXT['ACTIONS']; ?>: |
|
351 |
</td> |
|
352 |
<td class="list_page_id"> |
|
353 |
|
|
354 |
</td> |
|
355 |
</tr> |
|
356 |
</tbody> |
|
357 |
</table> |
|
358 |
<?php |
|
273 |
<table> |
|
274 |
<tbody> |
|
275 |
<tr> |
|
276 |
<td><h2 class="left">{$HEADING['MODIFY_DELETE_PAGE']}</h2></td> |
|
277 |
<td align="right"></td> |
|
278 |
</tr> |
|
279 |
</tbody> |
|
280 |
</table> |
|
281 |
<div class="pages_list"> |
|
282 |
<table> |
|
283 |
<tbody> |
|
284 |
<tr class="pages_list_header"> |
|
285 |
<td class="header_list_menu_title">{$TEXT['VISIBILITY']} / {$TEXT['MENU_TITLE']}:</td> |
|
286 |
<td class="header_list_page_title">{$TEXT['PAGE_TITLE']}:</td> |
|
287 |
<td class="header_list_page_id">PID</td> |
|
288 |
<td class="header_list_actions">{$TEXT['ACTIONS']}:</td> |
|
289 |
<td class="list_page_id"> </td> |
|
290 |
</tr> |
|
291 |
</tbody> |
|
292 |
</table> |
|
293 |
LHEAD; |
|
294 |
echo $sListHeader; |
|
359 | 295 |
// Work-out if we should check for existing page_code |
360 | 296 |
$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code'); |
361 |
|
|
362 | 297 |
$par = array(); |
363 | 298 |
$par['num_subs'] = 1; |
364 | 299 |
$editable_pages = make_list(0, 0); |
365 |
} else {
|
|
300 |
}else { |
|
366 | 301 |
$editable_pages = 0; |
367 | 302 |
} |
368 |
?></div><?php |
|
369 |
|
|
370 |
if(intval($editable_pages) == 0 ) { |
|
371 |
?> |
|
372 |
<div class="empty_list"> |
|
373 |
<?php echo $TEXT['NONE_FOUND']; ?> |
|
374 |
</div> |
|
375 |
<?php |
|
303 |
echo "\t\t".'</div>'.PHP_EOL; |
|
304 |
if(!intval($editable_pages)) { |
|
305 |
echo "\t\t".'<div class="empty_list">'.$TEXT['NONE_FOUND'].'</div>'.PHP_EOL; |
|
376 | 306 |
} |
377 | 307 |
// Setup template object, parse vars to it, then parse it |
378 | 308 |
// Create new template object |
... | ... | |
382 | 312 |
$template->set_block('page', 'main_block', 'main'); |
383 | 313 |
// Insert values into the add page form |
384 | 314 |
$template->set_var('FTAN', $admin->getFTAN()); |
385 |
|
|
386 | 315 |
// Group list 1 |
316 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
317 |
$get_groups = $database->query($query); |
|
387 | 318 |
|
388 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
389 |
$get_groups = $database->query($query); |
|
390 |
$template->set_block('main_block', 'group_list_block', 'group_list'); |
|
391 |
// Insert admin group and current group first |
|
392 |
$admin_group_name = $get_groups->fetchRow(); |
|
393 |
$template->set_var(array( |
|
394 |
'ID' => 1, |
|
395 |
'TOGGLE' => '1', |
|
396 |
'DISABLED' => ' disabled="disabled"', |
|
397 |
'LINK_COLOR' => '000000', |
|
398 |
'CURSOR' => 'default', |
|
399 |
'NAME' => $admin_group_name['name'], |
|
400 |
'CHECKED' => ' checked="checked"' |
|
401 |
) |
|
319 |
$template->set_block('main_block', 'group_list_block', 'group_list'); |
|
320 |
// Insert admin group and current group first |
|
321 |
$admin_group_name = $get_groups->fetchRow(MYSQL_ASSOC); |
|
322 |
$template->set_var(array( |
|
323 |
'ID' => 1, |
|
324 |
'TOGGLE' => '1', |
|
325 |
'DISABLED' => ' disabled="disabled"', |
|
326 |
'LINK_COLOR' => '000000', |
|
327 |
'CURSOR' => 'default', |
|
328 |
'NAME' => $admin_group_name['name'], |
|
329 |
'CHECKED' => ' checked="checked"' |
|
330 |
) |
|
331 |
); |
|
332 |
$template->parse('group_list', 'group_list_block', true); |
|
333 |
while($group = $get_groups->fetchRow(MYSQL_ASSOC)) { |
|
334 |
// check if the user is a member of this group |
|
335 |
$flag_disabled = ''; |
|
336 |
$flag_checked = ''; |
|
337 |
$flag_cursor = 'pointer'; |
|
338 |
$flag_color = ''; |
|
339 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
340 |
$flag_disabled = ''; //' disabled'; |
|
341 |
$flag_checked = ' checked="checked"'; |
|
342 |
$flag_cursor = 'default'; |
|
343 |
$flag_color = '000000'; |
|
344 |
} |
|
345 |
// Check if the group is allowed to edit pages |
|
346 |
$system_permissions = explode(',', $group['system_permissions']); |
|
347 |
if(is_numeric(array_search('pages_modify', $system_permissions))) { |
|
348 |
$template->set_var(array( |
|
349 |
'ID' => $group['group_id'], |
|
350 |
'TOGGLE' => $group['group_id'], |
|
351 |
'CHECKED' => $flag_checked, |
|
352 |
'DISABLED' => $flag_disabled, |
|
353 |
'LINK_COLOR' => $flag_color, |
|
354 |
'CURSOR' => $flag_checked, |
|
355 |
'NAME' => $group['name'], |
|
356 |
) |
|
402 | 357 |
); |
403 |
$template->parse('group_list', 'group_list_block', true); |
|
404 |
|
|
405 |
while($group = $get_groups->fetchRow()) { |
|
406 |
// check if the user is a member of this group |
|
407 |
$flag_disabled = ''; |
|
408 |
$flag_checked = ''; |
|
409 |
$flag_cursor = 'pointer'; |
|
410 |
$flag_color = ''; |
|
411 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
412 |
$flag_disabled = ''; //' disabled'; |
|
413 |
$flag_checked = ' checked="checked"'; |
|
414 |
$flag_cursor = 'default'; |
|
415 |
$flag_color = '000000'; |
|
416 |
} |
|
417 |
|
|
418 |
// Check if the group is allowed to edit pages |
|
419 |
$system_permissions = explode(',', $group['system_permissions']); |
|
420 |
if(is_numeric(array_search('pages_modify', $system_permissions))) { |
|
421 |
$template->set_var(array( |
|
422 |
'ID' => $group['group_id'], |
|
423 |
'TOGGLE' => $group['group_id'], |
|
424 |
'CHECKED' => $flag_checked, |
|
425 |
'DISABLED' => $flag_disabled, |
|
426 |
'LINK_COLOR' => $flag_color, |
|
427 |
'CURSOR' => $flag_checked, |
|
428 |
'NAME' => $group['name'], |
|
429 |
) |
|
430 |
); |
|
431 |
$template->parse('group_list', 'group_list_block', true); |
|
432 |
} |
|
358 |
$template->parse('group_list', 'group_list_block', true); |
|
433 | 359 |
} |
360 |
} |
|
434 | 361 |
// Group list 2 |
435 |
|
|
436 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
437 |
|
|
438 |
$get_groups = $database->query($query); |
|
439 |
$template->set_block('main_block', 'group_list_block2', 'group_list2'); |
|
440 |
// Insert admin group and current group first |
|
441 |
$admin_group_name = $get_groups->fetchRow(); |
|
362 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`'; |
|
363 |
$get_groups = $database->query($sql); |
|
364 |
$template->set_block('main_block', 'group_list_block2', 'group_list2'); |
|
365 |
// Insert admin group and current group first |
|
366 |
$admin_group_name = $get_groups->fetchRow(MYSQL_ASSOC); |
|
367 |
$template->set_var(array( |
|
368 |
'ID' => 1, |
|
369 |
'TOGGLE' => '1', |
|
370 |
'DISABLED' => ' disabled="disabled"', |
|
371 |
'LINK_COLOR' => '000000', |
|
372 |
'CURSOR' => 'default', |
|
373 |
'NAME' => $admin_group_name['name'], |
|
374 |
'CHECKED' => ' checked="checked"' |
|
375 |
) |
|
376 |
); |
|
377 |
$template->parse('group_list2', 'group_list_block2', true); |
|
378 |
while($group = $get_groups->fetchRow(MYSQL_ASSOC)) { |
|
379 |
// check if the user is a member of this group |
|
380 |
$flag_disabled = ''; |
|
381 |
$flag_checked = ''; |
|
382 |
$flag_cursor = 'pointer'; |
|
383 |
$flag_color = ''; |
|
384 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
385 |
$flag_disabled = ''; //' disabled'; |
|
386 |
$flag_checked = ' checked="checked"'; |
|
387 |
$flag_cursor = 'default'; |
|
388 |
$flag_color = '000000'; |
|
389 |
} |
|
442 | 390 |
$template->set_var(array( |
443 |
'ID' => 1,
|
|
444 |
'TOGGLE' => '1',
|
|
445 |
'DISABLED' => ' disabled="disabled"',
|
|
446 |
'LINK_COLOR' => '000000',
|
|
447 |
'CURSOR' => 'default',
|
|
448 |
'NAME' => $admin_group_name['name'],
|
|
449 |
'CHECKED' => ' checked="checked"'
|
|
450 |
)
|
|
451 |
);
|
|
391 |
'ID' => $group['group_id'],
|
|
392 |
'TOGGLE' => $group['group_id'],
|
|
393 |
'CHECKED' => $flag_checked,
|
|
394 |
'DISABLED' => $flag_disabled,
|
|
395 |
'LINK_COLOR' => $flag_color,
|
|
396 |
'CURSOR' => $flag_cursor,
|
|
397 |
'NAME' => $group['name'],
|
|
398 |
) |
|
399 |
); |
|
452 | 400 |
$template->parse('group_list2', 'group_list_block2', true); |
453 |
|
|
454 |
while($group = $get_groups->fetchRow()) { |
|
455 |
// check if the user is a member of this group |
|
456 |
$flag_disabled = ''; |
|
457 |
$flag_checked = ''; |
|
458 |
$flag_cursor = 'pointer'; |
|
459 |
$flag_color = ''; |
|
460 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
461 |
$flag_disabled = ''; //' disabled'; |
|
462 |
$flag_checked = ' checked="checked"'; |
|
463 |
$flag_cursor = 'default'; |
|
464 |
$flag_color = '000000'; |
|
465 |
} |
|
466 |
|
|
467 |
$template->set_var(array( |
|
468 |
'ID' => $group['group_id'], |
|
469 |
'TOGGLE' => $group['group_id'], |
|
470 |
'CHECKED' => $flag_checked, |
|
471 |
'DISABLED' => $flag_disabled, |
|
472 |
'LINK_COLOR' => $flag_color, |
|
473 |
'CURSOR' => $flag_cursor, |
|
474 |
'NAME' => $group['name'], |
|
475 |
) |
|
476 |
); |
|
477 |
$template->parse('group_list2', 'group_list_block2', true); |
|
478 |
} |
|
479 |
|
|
480 |
|
|
401 |
} |
|
481 | 402 |
// Parent page list |
482 | 403 |
// $database = new database(); |
483 | 404 |
function parent_list($parent) |
484 | 405 |
{ |
485 |
global $admin, $database, $template, $field_set; |
|
486 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC"; |
|
487 |
$get_pages = $database->query($query); |
|
488 |
while($page = $get_pages->fetchRow()) { |
|
489 |
if($admin->page_is_visible($page)==false) |
|
490 |
continue; |
|
406 |
global $admin, $template, $field_set; |
|
407 |
$database = WbDatabase::getInstance(); |
|
408 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '. |
|
409 |
'WHERE `parent`='.$parent.' AND `visibility`!=\'deleted\' '. |
|
410 |
'ORDER BY `position` ASC'; |
|
411 |
$get_pages = $database->query($sql); |
|
412 |
|
|
413 |
while($page = $get_pages->fetchRow(MYSQL_ASSOC)) { |
|
414 |
if(!$admin->page_is_visible($page)) { continue; } |
|
491 | 415 |
// if parent = 0 set flag_icon |
492 |
$template->set_var('FLAG_ROOT_ICON',' none '); |
|
416 |
$template->set_var('FLAG_ROOT_ICON', ' none ');
|
|
493 | 417 |
if( $page['parent'] == 0 && $field_set) { |
494 | 418 |
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)'); |
495 | 419 |
} |
496 | 420 |
// Stop users from adding pages with a level of more than the set page level limit |
497 | 421 |
if($page['level']+1 < PAGE_LEVEL_LIMIT) { |
498 |
// Get user perms |
|
499 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
|
500 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
|
501 |
|
|
502 |
$in_group = FALSE; |
|
503 |
foreach($admin->get_groups_id() as $cur_gid) { |
|
504 |
if (in_array($cur_gid, $admin_groups)) { |
|
505 |
$in_group = TRUE; |
|
506 |
} |
|
507 |
} |
|
508 |
if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users))) { |
|
509 |
$can_modify = true; |
|
510 |
} else { |
|
511 |
$can_modify = false; |
|
512 |
} |
|
422 |
// Get user permissions |
|
423 |
$can_modify = ($admin->ami_group_member($page['admin_groups']) || |
|
424 |
$admin->is_group_match($admin->get_groups_id(), $page['admin_users'])); |
|
513 | 425 |
// Title -'s prefix |
514 | 426 |
$title_prefix = ''; |
515 | 427 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; } |
... | ... | |
541 | 453 |
$template->parse('page_list2', 'page_list_block2', true); |
542 | 454 |
} |
543 | 455 |
parent_list(0); |
544 |
|
|
545 | 456 |
// Explode module permissions |
546 | 457 |
$module_permissions = $_SESSION['MODULE_PERMISSIONS']; |
547 | 458 |
// Modules list |
548 | 459 |
$template->set_block('main_block', 'module_list_block', 'module_list'); |
549 | 460 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name"); |
550 | 461 |
if($result->numRows() > 0) { |
551 |
while ($module = $result->fetchRow()) { |
|
462 |
while ($module = $result->fetchRow(MYSQL_ASSOC)) {
|
|
552 | 463 |
// Check if user is allowed to use this module |
553 | 464 |
if(!is_numeric(array_search($module['directory'], $module_permissions))) { |
554 | 465 |
$template->set_var('VALUE', $module['directory']); |
... | ... | |
562 | 473 |
} |
563 | 474 |
} |
564 | 475 |
} |
565 |
|
|
566 | 476 |
// Insert urls |
567 | 477 |
$template->set_var(array( |
568 | 478 |
'THEME_URL' => THEME_URL, |
... | ... | |
570 | 480 |
'ADMIN_URL' => ADMIN_URL, |
571 | 481 |
) |
572 | 482 |
); |
573 |
|
|
574 | 483 |
// Insert language headings |
575 | 484 |
$template->set_var(array( |
576 | 485 |
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'], |
... | ... | |
597 | 506 |
'INTRO_LINK' => $MESSAGE['PAGES_INTRO_LINK'], |
598 | 507 |
) |
599 | 508 |
); |
600 |
|
|
601 | 509 |
// Insert permissions values |
602 | 510 |
if($admin->get_permission('pages_add') != true) { |
603 | 511 |
$template->set_var('DISPLAY_ADD', 'hide'); |
... | ... | |
607 | 515 |
if($admin->get_permission('pages_intro') != true || INTRO_PAGE != 'enabled') { |
608 | 516 |
$template->set_var('DISPLAY_INTRO', 'hide'); |
609 | 517 |
} |
610 |
|
|
611 |
|
|
612 | 518 |
// Parse template object |
613 | 519 |
$template->parse('main', 'main_block', false); |
614 | 520 |
$template->pparse('output', 'page'); |
615 |
|
|
616 | 521 |
// include the required file for Javascript admin |
617 |
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php')) |
|
618 |
{ |
|
522 |
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php')) { |
|
619 | 523 |
include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'); |
620 | 524 |
} |
621 |
|
|
622 | 525 |
// Print admin |
623 | 526 |
$admin->print_footer(); |
Also available in: Unified diff
! runtime optimized in /admin/pages/index.php