layout.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <?php
  2. /* $Id: layout.php,v 1.64 2006/10/02 05:36:52 andrei Exp $ */
  3. # spacer()
  4. # print a IMG tag for a sized spacer GIF
  5. #
  6. function spacer($width = 1, $height = 1, $align = false, $extras = false) {
  7. printf('<img src="/gifs/spacer.gif" style="width:%d; height:%d;" border="0" alt="" %s%s />',
  8. $width,
  9. $height,
  10. ($align ? 'align="'.$align.'" ' : ''),
  11. ($extras ? $extras : '')
  12. );
  13. }
  14. # resize_image()
  15. # tag the output of make_image() and resize it manually
  16. #
  17. function resize_image($img, $width = 1, $height = 1) {
  18. $str = preg_replace('/width=\"([0-9]+?)\"/i', '', $img);
  19. $str = preg_replace('/height=\"([0-9]+?)\"/i', '', $str);
  20. $str = substr($str, 0, -1) . sprintf(' style="height:%d; width:%d;">', $height, $width);
  21. return $str;
  22. }
  23. # make_image()
  24. # return an IMG tag for a given file (relative to the images dir)
  25. #
  26. function make_image($file, $alt = false, $align = false, $extras = false, $dir = false, $border = 0) {
  27. if (!$dir) {
  28. $dir = "/gifs";
  29. }
  30. if ($size = @getimagesize($_SERVER['DOCUMENT_ROOT'].$dir.'/'.$file)) {
  31. $image = sprintf('<img src="%s/%s" border="%d" %s alt="%s" %s%s />',
  32. $dir,
  33. $file,
  34. $border,
  35. $size[3],
  36. ($alt ? $alt : ''),
  37. ($align ? ' align="'.$align.'"' : ''),
  38. ($extras ? ' '.$extras : '')
  39. );
  40. } else {
  41. $image = sprintf('<img src="%s/%s" border="%d" alt="%s" %s%s />',
  42. $dir,
  43. $file,
  44. $border,
  45. ($alt ? $alt : ''),
  46. ($align ? ' align="'.$align.'"' : ''),
  47. ($extras ? ' '.$extras : '')
  48. );
  49. }
  50. return $image;
  51. }
  52. # print_image()
  53. # print an IMG tag for a given file
  54. #
  55. function print_image($file, $alt = false, $align = false, $extras = false, $dir = false, $border = 0) {
  56. print make_image($file, $alt, $align, $extras, $dir);
  57. }
  58. # make_submit()
  59. # - make a submit button image
  60. #
  61. function make_submit($file, $alt = false, $align = false, $extras = false, $dir = false, $border = 0) {
  62. if (!$dir) {
  63. $dir = "/gifs";
  64. }
  65. $return = make_image($file, $alt, $align, $extras, $dir, $border);
  66. $return = str_replace(' border="' . $border . '"', '', '<input type="image"' . substr($return, 4));
  67. return $return;
  68. }
  69. # delim()
  70. # print a pipe delimiter
  71. #
  72. function delim($color = false) {
  73. if (!$color) {
  74. return '&nbsp;|&nbsp;';
  75. }
  76. return sprintf('<span style="color: %s">&nbsp;|&nbsp;</span>', $color);
  77. }
  78. # hdelim()
  79. # print a horizontal delimiter (just a wide line);
  80. #
  81. function hdelim($color = '#000000') {
  82. echo '<hr />';
  83. }
  84. # make_link()
  85. # return a hyperlink to something, within the site
  86. #
  87. function make_link($url, $linktext=false, $target=false, $extras=false) {
  88. return sprintf("<a href=\"%s\"%s%s>%s</a>",
  89. $url,
  90. ($target ? ' target="'.$target.'"' : ''),
  91. ($extras ? ' '.$extras : ''),
  92. ($linktext ? $linktext : $url)
  93. );
  94. }
  95. # print_link()
  96. # echo a hyperlink to something, within the site
  97. #
  98. function print_link($url, $linktext = false, $target = false, $extras = false) {
  99. echo make_link($url, $linktext, $target, $extras);
  100. }
  101. # make_email()
  102. # make an e-mail hyperlink
  103. #
  104. function make_email($email, $linktext = false) {
  105. return sprintf("<a href=\"mailto:%s\">%s</a>",
  106. $email,
  107. ($linktext ? $linktext : $email)
  108. );
  109. }
  110. # print_email()
  111. # echo an e-mail hyperlink
  112. #
  113. function print_email($email, $linktext = false) {
  114. echo make_email($email, $linktext);
  115. }
  116. # commonheader()
  117. #
  118. #
  119. function commonHeader($title = false, $padding = true) {
  120. global $SIDEBAR_DATA;
  121. ob_start();
  122. ?>
  123. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  124. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  125. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  126. <head>
  127. <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  128. <title>PHP-GTK<?php if ($title) { echo ' : '.$title; } ?></title>
  129. <link rel="stylesheet" type="text/css" href="/style.css" />
  130. <link rel="stylesheet" type="text/css" href="/style-highlight.css" />
  131. <link rel="shortcut icon" href="/gifs/favicon.ico" />
  132. </head>
  133. <body bgcolor="#FFFFFF" text="#000000" link="#000099" alink="#0000FF" vlink="#000099">
  134. <a name="TOP"></a>
  135. <table border="0" cellspacing="0" cellpadding="0" width="100%" style="height:48px;">
  136. <tr bgcolor="#0099CC">
  137. <td align="left" rowspan="2">
  138. <?php print_link('/', make_image('php-gtk.gif', 'PHP-GTK', false, 'vspace="2" hspace="2"')); ?><br />
  139. </td>
  140. <td align="right" valign="top" style="white-space: nowrap">
  141. <font color="#FFFFFF">
  142. <b><?php echo strftime("%A, %B %d, %Y"); ?></b>&nbsp;<br />
  143. </font>
  144. </td>
  145. </tr>
  146. <tr bgcolor="#0099CC">
  147. <td align="right" valign="bottom" style="white-space: nowrap">
  148. <?php
  149. print_link('/download.php', 'download', false, 'class="menuBlack"');
  150. echo delim();
  151. print_link('/docs.php', 'documentation', false, 'class="menuBlack"');
  152. echo delim();
  153. /*
  154. print_link('/wiki/Main/HomePage', 'wiki', false, 'class="menuBlack"');
  155. echo delim();
  156. */
  157. print_link('/apps/', 'applications', false, 'class="menuBlack"');
  158. echo delim();
  159. print_link('/faq.php', 'faq', false, 'class="menuBlack"');
  160. echo delim();
  161. print_link('/changelog.php', 'changelog', false, 'class="menuBlack"');
  162. echo delim();
  163. print_link('/resources.php', 'resources', false, 'class="menuBlack"');
  164. if (isset($_COOKIE['PHP-GTK'])) {
  165. echo delim();
  166. print_link('/admin-logout.php', 'logout', false, 'class="menuBlack"');
  167. }
  168. ?>&nbsp;<br />
  169. <?php spacer(2, 2); ?><br />
  170. </td>
  171. </tr>
  172. <tr bgcolor="#000033"><td colspan="2"><?php spacer(1, 1); ?><br /></td></tr>
  173. <tr bgcolor="#006699">
  174. <td align="right" valign="top" colspan="2" style="white-space: nowrap">
  175. <form method="post" action="/search.php" style="display:inline">
  176. <font color="#FFFFFF">
  177. <small>search for</small>
  178. <input class="small" type="text" name="pattern" value="<?php if (isset($_GET['prevsearch'])) echo htmlentities($_GET['prevsearch']); ?>" size="30" />
  179. <small>in the</small>
  180. <select name="show" class="small">
  181. <?php
  182. $options = array(
  183. 'manual' => 'PHP-GTK 2 manual',
  184. 'manual1' => 'PHP-GTK 1 manual',
  185. 'whole-site' => 'whole site',
  186. 'php-gtk-general-list' => 'general mailing list',
  187. 'php-gtk-dev-list' => 'development mailing list',
  188. 'php-gtk-doc-list' => 'documentation mailing list'
  189. );
  190. $uris = explode('/', $_SERVER['REQUEST_URI']);
  191. $dir = $uris[1];
  192. foreach ($options as $value => $title) {
  193. $sel = ($value == substr($dir, 0, strlen($value))) ? ' selected="selected"' : '';
  194. echo '<option value="' . $value . '"' . $sel . '>' . $title . '</option>' . "\n";
  195. }
  196. ?>
  197. </select>
  198. <?php echo make_submit('small_submit_white.gif', 'search', 'bottom'); ?>&nbsp;<br />
  199. </font>
  200. </form>
  201. </td>
  202. </tr>
  203. <tr bgcolor="#000033"><td colspan="2"><?php spacer(1, 1) ;?><br /></td></tr>
  204. </table>
  205. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  206. <tr valign="top">
  207. <?php if (isset($SIDEBAR_DATA)): ?>
  208. <td width="200" bgcolor="#F0F0F0">
  209. <table width="100%" cellpadding="4" cellspacing="0">
  210. <tr valign="top">
  211. <td class="sidebar">
  212. <?php echo $SIDEBAR_DATA; ?>
  213. </td>
  214. </tr>
  215. </table>
  216. </td>
  217. <td bgcolor="#CCCCCC" style="background-image:url(/gifs/checkerboard.gif)"><?php spacer(1, 1); ?><br /></td>
  218. <?php endif; ?>
  219. <td>
  220. <table width="100%" cellpadding="<?php if ($padding) { print("10"); } else { print("0"); } ?>" cellspacing="0">
  221. <tr>
  222. <td valign="top">
  223. <?php
  224. }
  225. # commonfooter()
  226. #
  227. #
  228. function commonFooter($padding = true) {
  229. global $RIGHT_SIDEBAR_DATA;
  230. if ($padding) {
  231. print("<br />");
  232. }
  233. ?>
  234. </td>
  235. </tr>
  236. </table>
  237. </td>
  238. <?php if (isset($RIGHT_SIDEBAR_DATA)): ?>
  239. <td bgcolor="#CCCCCC" style="background-image: url(/gifs/checkerboard.gif)"><?php spacer(1, 1); ?><br /></td>
  240. <td width="170" bgcolor="#F0F0F0">
  241. <table width="100%" cellpadding="4" cellspacing="0">
  242. <tr valign="top">
  243. <td class="sidebar">
  244. <?php echo $RIGHT_SIDEBAR_DATA; ?>
  245. </td>
  246. </tr>
  247. </table>
  248. </td>
  249. <?php endif; ?>
  250. </tr>
  251. </table>
  252. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  253. <tr bgcolor="#000033"><td><?php spacer(1,1);?><br /></td></tr>
  254. <tr bgcolor="#006699">
  255. <td align="right" valign="bottom">
  256. <?php
  257. //print_link('/source.php?url='.$_SERVER['SCRIPT_NAME'], 'show source', false, 'class="menuWhite"');
  258. //echo delim();
  259. print_link('/credits.php', 'credits', false, 'class="menuWhite"');
  260. ?>&nbsp;<br />
  261. </td>
  262. </tr>
  263. <tr bgcolor="#000033"><td><?php spacer(1,1); ?><br /></td></tr>
  264. </table>
  265. <table border="0" cellspacing="0" cellpadding="6" width="100%">
  266. <tr valign="top" bgcolor="#CCCCCC">
  267. <td>
  268. <small>
  269. <?php print_link('http://www.php.net/', make_image('php-logo.gif', 'PHP', 'left')); ?>
  270. &nbsp;<?php print_link('/copyright.php', 'Copyright &copy; 2001-' . date('Y') . ' The PHP Group'); ?><br />
  271. &nbsp;All rights reserved.<br />
  272. </small>
  273. </td>
  274. <td align="right">
  275. <small>
  276. Last updated: <?php echo strftime("%c %Z", getlastmod()); ?><br />
  277. </small>
  278. <br />
  279. </td>
  280. </tr>
  281. </table>
  282. </body>
  283. </html>
  284. <?php
  285. }
  286. # stretchPage()
  287. #
  288. #
  289. function stretchPage($pixels) {
  290. $div = "<div style = 'margin: ".$pixels."%'>";
  291. return $div;
  292. }
  293. /*
  294. * Local variables:
  295. * tab-width: 4
  296. * c-basic-offset: 4
  297. * End:
  298. * vim: expandtab sw=4 ts=4 fdm=marker softtabstop=4
  299. */
  300. ?>