Advertisement
jargon

gallery php

Dec 17th, 2016
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.08 KB | None | 0 0
  1. <?php
  2.  
  3.     /*
  4.         Snipfree 0-048 "gallery" module by Nick of Neinstar Filmz @ url('http://neinstarfilmz.com/');
  5.     */
  6.  
  7.     include_once($_SERVER['DOCUMENT_ROOT'].'/snipfree/0-048/php/inc.php');
  8.    
  9. $album='Death\'s Embrace No.1';
  10. $model='Alisha';
  11. $photoset='*.png';
  12.  
  13. $album=$_GET['album'];
  14. $model=$_GET['model'];
  15.  
  16. if(!is_dir($_SERVER['DOCUMENT_ROOT'].'/i/'.$album))
  17. {
  18.     $album=false;
  19.     $model=false;
  20. }
  21. else
  22. {
  23.     if(!is_dir($_SERVER['DOCUMENT_ROOT'].'/i/'.$album.'/'.$model))
  24.         $model=false;
  25. }
  26.  
  27. echo render_page($photoset,$album,$model);
  28.  
  29. function gallery_attributes($photoset='*.png',$album=false,$model=false)
  30. {  
  31.     return array(
  32.         'path' => '/i/'.(($album!==false)?$album.'/'.(($model!==false)?$model.'/':''):''),
  33.         'prefix' => 'gallery-captions -- ',
  34.         'id' => (($album!==false)?$album.(($model!==false)?' (Featuring '.$model.')':''):''),
  35.         'ext' => '.php',
  36.     );
  37. }
  38.  
  39. function count_images($photoset='*.png',$album=false,$model=false)
  40. {
  41.     $attr=gallery_attributes(false,false,false);
  42.     switch(is_dir($attr['path']))
  43.     {
  44.         case true:
  45.             $attr=gallery_attributes(false,$album,false);
  46.             switch(is_dir($attr['path']))
  47.             {
  48.                 case true:
  49.                     $attr=gallery_attributes(false,$album,$model);
  50.                     switch(is_dir($attr['path']))
  51.                     {
  52.                         case true:
  53.                             switch(is_file($attr['path'].$attr['prefix'].$attr['id'].$attr['ext']))
  54.                             {
  55.                                 case true:
  56.                                     $talent=array(
  57.                                         'attr' => $attr,
  58.                                         'files' => glob($attr['path'].'/*.*')
  59.                                     );
  60.                                     ksort($talent['files']);
  61.                                     foreach($talent['files'] as $file)
  62.                                     {
  63.                                         $info=pathinfo($file);
  64.                                         if(!in_array($info['extension'],array('gif','png','jpg','jpeg')))
  65.                                             unset($talent['files'][$file]);
  66.                                     }  
  67.                                     $collection=array(
  68.                                         'ct' => 0
  69.                                     );
  70.                                     foreach($talent['files'] => $fn)
  71.                                     {
  72.                                         $collection[$collection['ct']++]['attr']=thumburl($fn);
  73.                                         $collection[$collection['ct']]['data']=base64_encode(get_file_contents($collection[$collection['ct']]['attr']['dest']))
  74.                                         $collection[$collection['ct']]['mime']='image/'.
  75.                                     }
  76.                                     break;
  77.                                 case false:
  78.                                     break;
  79.                                 default:
  80.                             }
  81.                             break;
  82.                         case false:
  83.                             break;
  84.                         default:
  85.                     }
  86.                     break;
  87.                 case false:
  88.                     break;
  89.                 default:
  90.             }
  91.             break;
  92.         case false:
  93.             break;
  94.         default:
  95.     }
  96. }
  97.  
  98. function render_page($photoset='*.png',$album=false,$model=false)
  99. {
  100.     $ret='';
  101.     snipecho($ret,'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');
  102.     snipecho($ret,'<html>');
  103.     snipecho($ret,'<head>');
  104.     snipecho($ret,'<title>');
  105.     snipecho($ret,$album);
  106.     snipecho($ret,'</title>');
  107.     snipecho($ret,'</head>');
  108.     snipecho($ret,'<style media="screen" type="text/css">');
  109.     snipecho($ret,'@import "http://neinstarfilmz.com/i/style.css";');
  110.     snipecho($ret,'</style>');
  111.     snipecho($ret,'<script language="JavaScript" src="index.js"></script>');
  112.     snipecho($ret,'<script src="/Glow JS 0-01/Glow JS 0-00 Parallax.js" language="JavaScript"></script>');
  113.     snipecho($ret,'<body link="grey" alink="grey" vlink="grey" onload="JsParallax_ini();">');
  114.     snipecho($ret,'<table border="0px" cellpadding="8px" cellspacing="4px" width="100%">');
  115.     snipecho($ret,page_header());
  116.     snipecho($ret,'<tr>');
  117.     snipecho($ret,'<td>');
  118.     snipecho($ret,gallery());
  119.     snipecho($ret,'</td>');
  120.     snipecho($ret,page_sidetray());
  121.     snipecho($ret,'</tr>');
  122.     snipecho($ret,page_footer());
  123.     snipecho($ret,'</table>');
  124.     snipecho($ret,'</body>');
  125.     snipecho($ret,'</html>');
  126.     return $ret;
  127. }
  128.    
  129. function page_sidetray()
  130. {
  131.  
  132. // page sidetray
  133.  
  134.     return '<td id="player"></td>';
  135. }
  136.  
  137. function page_header()
  138. {
  139.     $ret='';
  140.  
  141. // page header
  142.  
  143.     snipecho($ret,'<tr>');
  144.     snipecho($ret,'<td colspan="2">');
  145.     snipecho($ret,'<p><font color="red" face="Courier New" size="22pt"><b>neinstar filmz</b></font></p>');
  146.     snipecho($ret,'</td>');
  147.     snipecho($ret,'</tr>');
  148.  
  149.     return $ret;
  150. }
  151.  
  152. function page_footer()
  153. {
  154.     $ret='';
  155.  
  156. // page footer
  157.  
  158.     snipecho($ret,'<tr>');
  159.     snipecho($ret,'<td colspan="2"><font size="+3">(<a href="../">Back</a>)</font></td>');
  160.     snipecho($ret,'</tr>');
  161.  
  162.     return $ret;
  163. }
  164.  
  165. function gallery($photoset='*.png',$album=false,$model=false)
  166. {
  167.     global $domain;
  168.  
  169.     $ret='';
  170.    
  171.     snipecho($ret,'<table border="0px" cellspacing="8px" cellspacing="4px">');
  172.  
  173.     $dat=glob($_SERVER['DOCUMENT_ROOT'].'/i/'.$album.((strlen($model)>0)?'/'.$model:'').$photoset);
  174.     ksort($dat);
  175.     $panelct=4;
  176.     $rowct=0;
  177.  
  178. // Render section caption.
  179.  
  180.     $ret.=gallery_caption($panelct,-1);
  181.        
  182. // Cycle through images one row of the given gallery at a time.
  183.  
  184.     $ct=0;
  185.     $temp='';
  186.     foreach($dat as $fn)
  187.     {
  188.    
  189. // Render set captions.
  190.        
  191.         if(($ct===0)&&($rowct===0))
  192.             $ret.=gallery_caption($panelct,0);
  193.         $ct++;
  194.         $ct=($ct % $panelct);
  195.         snipecho($temp,'<td bgcolor="black" align="center" valign="middle" class="picframe">');
  196.         snipecho($temp,'<a href="'.thumburl($fn).'"><img src="'.thumburl($fn).'" style="max-width: 240px;"></a><br>');
  197.         snipecho($temp,'</td>');
  198.  
  199. // Render frame captions.
  200.  
  201.         if($ct===0)
  202.         {
  203.             $rowct++;
  204.             if(strlen($temp)>0)
  205.                 $temp='<tr>'.$temp.'</tr>';
  206.             $ret.=gallery_caption($panelct,$rowct).$temp;
  207.             $temp='';
  208.         }
  209.     }
  210.  
  211. // Ensure completopm of final row.
  212.  
  213.     if(strlen($temp)>0)
  214.     {
  215.         $rowct++;
  216.         snipecho($temp,'<td colspan="'.($panelct-1-$ct).'" class="emptyframe"></td>');
  217.         if(strlen($temp)>0)
  218.             $temp='<tr>'.$temp.'</tr>';
  219.         $ret.=gallery_caption($panelct,$rowct).$temp;
  220.         $temp='';
  221.     }
  222.    
  223.     snipecho($ret,'</table>');
  224.  
  225.     return $ret;
  226. }
  227.  
  228. function pattern_timmestamp()
  229. {
  230.     return array(
  231.         'timestamp' => '('./*?<timestamp>*/
  232.         '(('./*?<year>*/'[0-9]{4})'.
  233.         '(('./*?<month>*/'[0]{1}{1-9]{1}|[1]{1}[0-2]{1})'.
  234.         '(('./*?<day>*/'[0-2]{1}[0-9]{1}|[3]{1}[0-1]{1})'.
  235.         '(('./*?<hour>*/'[0-1]{1}[0-9]{1}|[2]{1}[0-2]{1})'.
  236.         '(('./*?<minute>*/'[0-5]{1}[0-9]{1})'.
  237.         '(('./*?<second>*/'[0-5]{1}[0-9]{1})'.
  238.         '|)|)|)|)|)|)'.
  239.         '('./*?<timezone>*/
  240.         '('./*?<hemisphere>*/'+|-)'.
  241.         '('./*?<hours>*/'[0]{1}[0-9]{1}|[1]{1}[0-1]{1})'.
  242.         '('./*?<minutes>*/'[0-5]{1}[0-9]{1})'.
  243.         '|)'.
  244.         ')'
  245.     );
  246. }
  247.  
  248. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement