File: _menutop.php

package info (click to toggle)
b2evolution 0.9.2-3%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 12,972 kB
  • ctags: 5,460
  • sloc: php: 58,989; sh: 298; makefile: 36
file content (282 lines) | stat: -rw-r--r-- 9,556 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?php
/**
 * Displays first part of the page menu (before the page title) 
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
 * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * @package admin
 */
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="<?php locale_lang() ?>" lang="<?php locale_lang() ?>">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php locale_charset() ?>" />
	<title>b2evo :: <?php echo preg_replace( '/:$/', '', $admin_pagetitle ); ?></title>
	<link href="variation.css" rel="stylesheet" type="text/css" title="Variation" />
	<link href="desert.css" rel="alternate stylesheet" type="text/css" title="Desert" />
	<link href="legacy.css" rel="alternate stylesheet" type="text/css" title="Legacy" />
	<?php if( is_file( dirname(__FILE__).'/custom.css' ) ) { ?>
	<link href="custom.css" rel="alternate stylesheet" type="text/css" title="Custom" />
	<?php } ?>
	<script type="text/javascript" src="styleswitcher.js"></script>
	<?php
	if( $mode == 'sidebar' )
	{ // Include CSS overrides for sidebar: ?>
		<link href="sidebar.css" rel="stylesheet" type="text/css" />
	<?php
	}

	if( $admin_tab == 'files'	|| ($admin_tab == 'blogs' && $tab == 'perm') )
	{ // -- Inject javascript ----------------
		// gets initialized in _footer.php
		?>
		<script type="text/javascript">
		<!--
		<?php
		
		switch( $admin_tab )
		{
			case 'blogs':
			?>
			function toggleall( the_form, id, i )
			{
				if( allchecked[i] )
					allchecked[i] = false;
				else
					allchecked[i] = true;
				
				the_form.elements['blog_ismember_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_published_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_protected_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_private_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_draft_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_deprecated_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_delpost_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_comments_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_cats_'+String(id)].checked = allchecked[i];
				the_form.elements['blog_perm_properties_'+String(id)].checked = allchecked[i];
				
				setcheckallspan( i );
			}
			<?php
			break;
				
			case 'files':
			/**
			 * Toggles status of a bunch of checkboxes in a form
			 *
			 * @param string the form name
			 * @param string the checkbox(es) element(s) name
			 */	?>
			function toggleCheckboxes(the_form, the_elements)
			{
				if( allchecked[0] ) allchecked[0] = false;
				else allchecked[0] = true;
				
				var elems = document.forms[the_form].elements[the_elements];
				var elems_cnt = (typeof(elems.length) != 'undefined') ? elems.length : 0;
				if (elems_cnt)
				{
					for (var i = 0; i < elems_cnt; i++)
					{
						elems[i].checked = allchecked[0];
					} // end for
				}
				else
				{
					elems.checked = allchecked[0];
				}
				setcheckallspan(0);
			}
			<?php
			break;
		}
		
		// --- general functions ----------------
		/**
		 * replaces the text of the [nr]th checkall-html-ID
		 *
		 * @param integer number of the checkall "set"
		 * @param boolean force setting to true/false
		 */	?>
		function setcheckallspan( nr, set )
		{
			if( typeof allchecked[nr] == 'undefined' || typeof set != 'undefined' )
			{ // init
				allchecked[ nr ] = set;
			}

			if( allchecked[nr] )
				var replace = document.createTextNode('<?php echo /* TRANS: Warning this is a javascript string */ T_('uncheck all') ?>');
			else
				var replace = document.createTextNode('<?php echo /* TRANS: Warning this is a javascript string */ T_('check all') ?>');
						
			if( document.getElementById( idprefix+'_'+String(nr) ) )
				document.getElementById( idprefix+'_'+String(nr) ).replaceChild(replace, document.getElementById( idprefix+'_'+String(nr) ).firstChild);
			//else alert('no element with id '+idprefix+'_'+String(nr));
		}
		
		<?php
		/**
		 * inits the checkall functionality.
		 *
		 * @param string the prefix of the IDs where the '(un)check all' text should be set
		 * @param boolean initial state of the text (if there is no checkbox with ID htmlid + '_state_' + nr)
		 */ ?>
		function initcheckall( htmlid, init )
		{
			// initialize array
			allchecked = Array();
			if( typeof htmlid == 'undefined' ) idprefix = 'checkallspan';
			else idprefix = htmlid;
			
			var i = 0;
			//alert(document.getElementById("checkallspan"+String(i)));
			while( id = document.getElementById( idprefix+'_'+String(i)) )
			{
				//alert( document.getElementById(idprefix+'_state_'+String(i)) );
				if( document.getElementById( idprefix+'_state_'+String(i)) )
					setcheckallspan( i, document.getElementById( idprefix+'_state_'+String(i)).checked );
				else setcheckallspan( i, init );
			
				i++;
			}
			//if( i == 0 ) alert('no elements with ID prefix '+idprefix+' found!');
		}
		//-->
		</script>
		<?php
	}
	?>
</head>
<body>

<?php

param( 'blog', 'integer', 0, true );	// We need this for the urls

if( empty($mode) )
{	// We're not running in an special mode (bookmarklet, sidebar...)
?>

<div id="header">
	<a href="http://b2evolution.net/" title="<?php echo T_("visit b2evolution's website") ?>"><img id="evologo" src="../img/b2evolution_minilogo2.png" alt="b2evolution"  title="<?php echo T_("visit b2evolution's website") ?>" width="185" height="40" /></a>

	<div id="headfunctions">
		<?php echo T_('Style:') ?>
		<a href="#" onclick="setActiveStyleSheet('Variation'); return false;" title="Variation (Default)">V</a>&middot;<a href="#" onclick="setActiveStyleSheet('Desert'); return false;" title="Desert">D</a>&middot;<a href="#" onclick="setActiveStyleSheet('Legacy'); return false;" title="Legacy">L</a><?php if( is_file( dirname(__FILE__).'/custom.css' ) ) { ?>&middot;<a href="#" onclick="setActiveStyleSheet('Custom'); return false;" title="Custom">C</a><?php } ?>
		&bull;
		<a href="<?php echo $htsrv_url ?>/login.php?action=logout"><?php echo T_('Logout') ?></a>
		&bull;
		<a href="<?php echo $baseurl ?>"><?php echo T_('Exit to blogs') ?> <img src="img/close.gif" width="14" height="14" class="top" alt="" title="<?php echo T_('Exit to blogs') ?>" /></a><br />
	</div>

	<?php	
	if( !$obhandler_debug )
	{ // don't display changing time when we want to test obhandler
	?>
	<div id="headinfo">
		b2evo v <strong><?php echo $b2_version ?></strong>
		&middot; <?php echo T_('Blog time:') ?> <strong><?php echo date_i18n( locale_timefmt(), $localtimenow ) ?></strong>
		&middot; <?php echo T_('GMT:') ?> <strong><?php echo gmdate( locale_timefmt(), $servertimenow); ?></strong>
		&middot; <?php echo T_('Logged in as:'), ' <strong>', $user_login; ?></strong>
	</div>
	<?php } ?>
	
	<ul class="tabs">
	<?php
		if( $admin_tab == 'new' )
			echo '<li class="current">';
		else
			echo '<li>';
		echo '<a href="b2edit.php?blog=', $blog, '" style="font-weight: bold;">', T_('Write'), '</a></li>';

		if( $admin_tab == 'edit'  )
			echo '<li class="current">';
		else
			echo '<li>';
		echo '<a href="b2browse.php?blog=', $blog, '" style="font-weight: bold;">', T_('Edit'), '</a></li>';

		if( $admin_tab == 'cats' )
			echo '<li class="current">';
		else
			echo '<li>';
		echo '<a href="b2categories.php?blog=', $blog, '" >', T_('Categories'), '</a></li>';

		if( $admin_tab == 'blogs' )
			echo '<li class="current">';
		else
			echo '<li>';
		echo '<a href="b2blogs.php" >', T_('Blogs'), '</a></li>';

		if( $current_User->check_perm( 'stats', 'view' ) )
		{
			if( $admin_tab == 'stats' )
				echo '<li class="current">';
			else
				echo '<li>';
			echo '<a href="b2stats.php" >', T_('Stats'), '</a></li>';
		}

		if( $current_User->check_perm( 'spamblacklist', 'view' ) )
		{
			if( $admin_tab == 'antispam' )
				echo '<li class="current">';
			else
				echo '<li>';
			echo '<a href="b2antispam.php" >', T_('Antispam'), '</a></li>';
		}

		if( $current_User->check_perm( 'templates', 'any' ) )
		{
			if( $admin_tab == 'templates' )
				echo '<li class="current">';
			else
				echo '<li>';
			echo '<a href="b2template.php">', T_('Templates'), '</a></li>';
		}

		if( $admin_tab == 'users' )
			echo '<li class="current">';
		else
			echo '<li>';
		
		if( $current_User->check_perm( 'users', 'view' ) )
		{
			echo '<a href="b2users.php" >', T_('Users'), '</a></li>';
		}
		else
		{
			echo '<a href="b2users.php" >', T_('User Profile'), '</a></li>';
		}


		if( $current_User->check_perm( 'options', 'view' ) )
		{
			if( $admin_tab == 'options' )
				echo '<li class="current">';
			else
				echo '<li>';
			echo '<a href="b2options.php" >', T_('Settings'), '</a></li>';
		}

		if( $admin_tab == 'tools' )
			echo '<li class="current">';
		else
			echo '<li>';
		echo '<a href="tools.php" >', T_('Tools'), '</a></li>';

	?>

	</ul>
</div>

<?php
}	// not in special mode
?>

<div id="TitleArea">
<h1><strong>:: <?php echo $admin_pagetitle; ?></strong>