[ Index ] |
PHP Cross Reference of Textpattern 4.0.8 |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 $HeadURL: https://textpattern.googlecode.com/svn/releases/4.0.8/source/textpattern/lib/txplib_head.php $ 5 $LastChangedRevision: 3004 $ 6 */ 7 8 // ------------------------------------------------------------- 9 function pagetop($pagetitle,$message="") 10 { 11 global $css_mode,$siteurl,$sitename,$txp_user,$event; 12 $area = gps('area'); 13 $event = (!$event) ? 'article' : $event; 14 $bm = gps('bm'); 15 16 $privs = safe_field("privs", "txp_users", "name = '".doSlash($txp_user)."'"); 17 18 $GLOBALS['privs'] = $privs; 19 20 $areas = areas(); 21 $area = false; 22 23 foreach ($areas as $k => $v) 24 { 25 if (in_array($event, $v)) 26 { 27 $area = $k; 28 break; 29 } 30 } 31 32 if (gps('logout')) 33 { 34 $body_id = 'page-logout'; 35 } 36 37 elseif (!$txp_user) 38 { 39 $body_id = 'page-login'; 40 } 41 42 else 43 { 44 $body_id = 'page-'.$event; 45 } 46 47 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 48 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo LANG; ?>" lang="<?php echo LANG; ?>" dir="<?php echo gTxt('lang_dir'); ?>"> 49 <head> 50 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 51 <meta name="robots" content="noindex, nofollow" /> 52 <title>Txp › <?php echo htmlspecialchars($sitename) ?> › <?php echo escape_title($pagetitle) ?></title> 53 <link href="textpattern.css" rel="stylesheet" type="text/css" /> 54 <script type="text/javascript" src="textpattern.js"></script> 55 <script type="text/javascript"> 56 <!-- 57 58 var cookieEnabled = checkCookies(); 59 60 if (!cookieEnabled) 61 { 62 confirm('<?php echo trim(gTxt('cookies_must_be_enabled')); ?>'); 63 } 64 65 <?php 66 $edit = array(); 67 68 if ($event == 'list') 69 { 70 $rs = safe_column('name', 'txp_section', "name != 'default'"); 71 72 $edit['section'] = $rs ? selectInput('Section', $rs, '', true) : ''; 73 74 $rs = getTree('root', 'article'); 75 76 $edit['category1'] = $rs ? treeSelectInput('Category1', $rs, '') : ''; 77 $edit['category2'] = $rs ? treeSelectInput('Category2', $rs, '') : ''; 78 79 $edit['comments'] = onoffRadio('Annotate', safe_field('val', 'txp_prefs', "name = 'comments_on_default'")); 80 81 $edit['status'] = selectInput('Status', array( 82 1 => gTxt('draft'), 83 2 => gTxt('hidden'), 84 3 => gTxt('pending'), 85 4 => gTxt('live'), 86 5 => gTxt('sticky'), 87 ), '', true); 88 89 $rs = safe_column('name', 'txp_users', "privs not in(0,6)"); 90 91 $edit['author'] = $rs ? selectInput('AuthorID', $rs, '', true) : ''; 92 } 93 94 if (in_array($event, array('image', 'file', 'link'))) 95 { 96 $rs = getTree('root', $event); 97 98 $edit['category'] = $rs ? treeSelectInput('category', $rs, '') : ''; 99 } 100 101 if ($event == 'plugin') 102 { 103 $edit['order'] = selectInput('order', array(1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9), 5, false); 104 } 105 106 if ($event == 'admin') 107 { 108 $edit['privilege'] = privs(); 109 } 110 111 // output JavaScript 112 ?> 113 function poweredit(elm) 114 { 115 var something = elm.options[elm.selectedIndex].value; 116 117 // Add another chunk of HTML 118 var pjs = document.getElementById('js'); 119 120 if (pjs == null) 121 { 122 var br = document.createElement('br'); 123 elm.parentNode.appendChild(br); 124 125 pjs = document.createElement('P'); 126 pjs.setAttribute('id','js'); 127 elm.parentNode.appendChild(pjs); 128 } 129 130 if (pjs.style.display == 'none' || pjs.style.display == '') 131 { 132 pjs.style.display = 'block'; 133 } 134 135 if (something != '') 136 { 137 switch (something) 138 { 139 <?php 140 foreach($edit as $key => $val) 141 { 142 echo "case 'change".$key."':".n. 143 t."pjs.innerHTML = '<span>".str_replace(array("\n", '-'), array('', '-'), addslashes($val))."</span>';".n. 144 t.'break;'.n.n; 145 } 146 ?> 147 default: 148 pjs.style.display = 'none'; 149 break; 150 } 151 } 152 153 return false; 154 } 155 156 addEvent(window, 'load', cleanSelects); 157 --> 158 </script> 159 <script type="text/javascript" src="jquery.js"></script> 160 <?php callback_event('admin_side', 'head_end'); ?> 161 </head> 162 <body id="<?php echo $body_id; ?>"> 163 <?php callback_event('admin_side', 'pagetop'); ?> 164 <table id="pagetop" cellpadding="0" cellspacing="0"> 165 <tr id="branding"><td><h1 id="textpattern">Textpattern</h1></td><td id="navpop"><?php echo navPop(1); ?></td></tr> 166 <tr id="nav-primary"><td align="center" class="tabs" colspan="2"> 167 <?php 168 if (!$bm) { 169 echo '<table cellpadding="0" cellspacing="0" align="center"><tr> 170 <td valign="middle" style="width:368px"> '.$message.'</td>', 171 172 has_privs('tab.content') 173 ? areatab(gTxt('tab_content'), 'content', 'article', $area) 174 : '', 175 has_privs('tab.presentation') 176 ? areatab(gTxt('tab_presentation'), 'presentation', 'page', $area) 177 : '', 178 has_privs('tab.admin') 179 ? areatab(gTxt('tab_admin'), 'admin', 'admin', $area) 180 : '', 181 (has_privs('tab.extensions') and !empty($areas['extensions'])) 182 ? areatab(gTxt('tab_extensions'), 'extensions', array_shift($areas['extensions']), $area) 183 : '', 184 185 '<td class="tabdown"><a href="'.hu.'" class="plain" target="_blank">'.gTxt('tab_view_site').'</a></td>', 186 '</tr></table>'; 187 188 $secondary = tabsort($area,$event); 189 190 if ($secondary) 191 { 192 echo '</td></tr><tr id="nav-secondary"><td align="center" class="tabs" colspan="2"> 193 <table cellpadding="0" cellspacing="0" align="center"><tr>', 194 $secondary, 195 '</tr></table>'; 196 } 197 } 198 echo '</td></tr></table>'; 199 callback_event('admin_side', 'pagetop_end'); 200 } 201 202 // ------------------------------------------------------------- 203 function areatab($label,$event,$tarea,$area) 204 { 205 $tc = ($area == $event) ? 'tabup' : 'tabdown'; 206 $atts=' class="'.$tc.'"'; 207 $hatts=' href="?event='.$tarea.'" class="plain"'; 208 return tda(tag($label,'a',$hatts),$atts); 209 } 210 211 // ------------------------------------------------------------- 212 function tabber($label,$tabevent,$event) 213 { 214 $tc = ($event==$tabevent) ? 'tabup' : 'tabdown2'; 215 $out = '<td class="'.$tc.'"><a href="?event='.$tabevent.'" class="plain">'.$label.'</a></td>'; 216 return $out; 217 } 218 219 // ------------------------------------------------------------- 220 221 function tabsort($area, $event) 222 { 223 if ($area) 224 { 225 $areas = areas(); 226 227 $out = array(); 228 229 foreach ($areas[$area] as $a => $b) 230 { 231 if (has_privs($b)) 232 { 233 $out[] = tabber($a, $b, $event, 2); 234 } 235 } 236 237 return ($out) ? join('', $out) : ''; 238 } 239 240 return ''; 241 } 242 243 // ------------------------------------------------------------- 244 function areas() 245 { 246 global $privs, $plugin_areas; 247 248 $areas['content'] = array( 249 gTxt('tab_organise') => 'category', 250 gTxt('tab_write') => 'article', 251 gTxt('tab_list') => 'list', 252 gTxt('tab_image') => 'image', 253 gTxt('tab_file') => 'file', 254 gTxt('tab_link') => 'link', 255 gTxt('tab_comments') => 'discuss' 256 ); 257 258 $areas['presentation'] = array( 259 gTxt('tab_sections') => 'section', 260 gTxt('tab_pages') => 'page', 261 gTxt('tab_forms') => 'form', 262 gTxt('tab_style') => 'css' 263 ); 264 265 $areas['admin'] = array( 266 gTxt('tab_diagnostics') => 'diag', 267 gTxt('tab_preferences') => 'prefs', 268 gTxt('tab_site_admin') => 'admin', 269 gTxt('tab_logs') => 'log', 270 gTxt('tab_plugins') => 'plugin', 271 gTxt('tab_import') => 'import' 272 ); 273 274 $areas['extensions'] = array( 275 ); 276 277 if (is_array($plugin_areas)) 278 $areas = array_merge_recursive($areas, $plugin_areas); 279 280 return $areas; 281 } 282 283 // ------------------------------------------------------------- 284 285 function navPop($inline = '') 286 { 287 $areas = areas(); 288 289 $out = array(); 290 291 foreach ($areas as $a => $b) 292 { 293 if (!has_privs( 'tab.'.$a)) 294 { 295 continue; 296 } 297 298 if (count($b) > 0) 299 { 300 $out[] = n.t.'<optgroup label="'.gTxt('tab_'.$a).'">'; 301 302 foreach ($b as $c => $d) 303 { 304 if (has_privs($d)) 305 { 306 $out[] = n.t.t.'<option value="'.$d.'">'.$c.'</option>'; 307 } 308 } 309 310 $out[] = n.t.'</optgroup>'; 311 } 312 } 313 314 if ($out) 315 { 316 $style = ($inline) ? ' style="display: inline;"': ''; 317 318 return '<form method="get" action="index.php" class="navpop"'.$style.'>'. 319 n.'<select name="event" onchange="submit(this.form);">'. 320 n.t.'<option>'.gTxt('go').'…</option>'. 321 join('', $out). 322 n.'</select>'. 323 n.'</form>'; 324 } 325 } 326 327 // ------------------------------------------------------------- 328 function button($label,$link) 329 { 330 return '<span style="margin-right:2em"><a href="?event='.$link.'" class="plain">'.$label.'</a></span>'; 331 } 332 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu May 21 23:03:01 2009 | Cross-referenced by PHPXref 0.7 |