Update of /cvsroot/mxbb/mx_smartor/album_mod In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9232/album_mod Modified Files: album_common.php album_constants.php album_functions.php album_hierarchy_auth.php album_hierarchy_debug.php album_hierarchy_functions.php album_hierarchy_sql.php clown_album_functions.php index.html rank.gif Added Files: album_acp_functions.php album_bbcode.php album_exif_info.php album_image_class.php album_integration.php album_nuffimage_box.php archive.php fap_alpha.png fap_blur.png fap_bw.png fap_flip.png fap_infrared.png fap_interlace.png fap_loader.js fap_mirror.png fap_normal.png fap_pixelate.png fap_recompress.png fap_resize.png fap_rotate.png fap_scatter.png fap_screen.png fap_sepia.png fap_stereogram.png fap_tint.png fap_watermark.png mark_fap.png moo.ajax.js moo.fx.js moo.fx.pack.js mooshow.1.04.js nothumbnail.jpg prototype.lite.js rating_star.png rating_star_red.png spacer.gif Log Message: --- NEW FILE: album_bbcode.php --- <?php // CTracker_Ignore: File Checked By Human // Tell the Security Scanner that reachable code in this file is not a security issue define('BBCODE_UID_LEN', 10); define('BBCODE_NOSMILIES_START', '<!-- no smilies start -->'); define('BBCODE_NOSMILIES_END', '<!-- no smilies end -->'); global $board_config, $mx_root_path, $phpEx, $lang; $urls_local = array( 'http://www.' . $board_config['server_name'] . $board_config['script_path'], 'http://' . $board_config['server_name'] . $board_config['script_path'] ); define('AUTOURL', time()); class BBCode { [...3702 lines suppressed...] $binstring = strrev(implode('', $data_array)); $bit_integer = bindec($binstring); return $bit_integer; } /** * Will convert a stored integer into an array of binary values * * @param integer $data_integer Encoded integer * @return integer Array of binary values */ function binary_int_to_array($data_integer) { if (($data_integer > 2147483647) OR ($data_integer < 0)) return FALSE; $binstring = strrev(str_pad(decbin ($data_integer),31,"0",STR_PAD_LEFT)); $bitarray = explode(":",chunk_split($binstring, 1, ":")); return $bitarray; } ?> --- NEW FILE: fap_flip.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fap_infrared.png --- (This appears to be a binary file; contents omitted.) Index: rank.gif =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/rank.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsfooVDW and /tmp/cvsyr2aaz differ Index: album_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_functions.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** album_functions.php 30 Jun 2006 21:10:55 -0000 1.6 --- album_functions.php 7 Jun 2007 20:13:11 -0000 1.7 *************** *** 4,16 **** * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2002-2006 [Smartor, Volodymyr (CLowN) Skoryk, IdleVoid, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ - // +------------------------------------------------------+ - // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | - // +------------------------------------------------------+ [...1310 lines suppressed...] + } + return $r; + } + + function mx_album_uploadfiletype($UploadFile) + { + $UploadFileTypeTmp = explode(".", $UploadFile); + + $y = count($UploadFileTypeTmp) - 1; + $r = $UploadFileTypeTmp[$y];; + return $r; + } + + // +------------------------------------------------------+ + // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | + // +------------------------------------------------------+ + + ?> \ No newline at end of file --- NEW FILE: fap_rotate.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: prototype.lite.js --- /* Prototype JavaScript framework * (c) 2005 Sam Stephenson <sa...@co...> * Prototype is freely distributable under the terms of an MIT-style license. * For details, see the Prototype web site: http://prototype.conio.net/ /*--------------------------------------------------------------------------*/ //note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net). var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } Object.extend = function(destination, source) { for (property in source) destination[property] = source[property]; return destination; } Function.prototype.bind = function(object) { var __method = this; return function() { return __method.apply(object, arguments); } } Function.prototype.bindAsEventListener = function(object) { var __method = this; return function(event) { __method.call(object, event || window.event); } } function $() { if (arguments.length == 1) { return get$(arguments[0]); } var elements = []; $c(arguments).each(function(el) { elements.push(get$(el)); }); return elements; function get$(el) { if (typeof el == 'string') { el = document.getElementById(el); } return el; } } if (!window.Element) var Element = new Object(); Object.extend(Element, { remove: function(element) { element = $(element); element.parentNode.removeChild(element); }, hasClassName: function(element, className) { element = $(element); if (!element) { return; } var hasClass = false; element.className.split(' ').each(function(cn) { if (cn == className) { hasClass = true; } }); return hasClass; }, addClassName: function(element, className) { element = $(element); Element.removeClassName(element, className); element.className += ' ' + className; }, removeClassName: function(element, className) { element = $(element); if (!element) { return; } var newClassName = ''; element.className.split(' ').each(function(cn, i) { if (cn != className) { if (i > 0) { newClassName += ' '; } newClassName += cn; } }); element.className = newClassName; }, cleanWhitespace: function(element) { element = $(element); $c(element.childNodes).each(function(node) { if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) { Element.remove(node); } }); }, find: function(element, what) { element = $(element)[what]; while (element.nodeType != 1) element = element[what]; return element; } }); var Position = { cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); return [valueL, valueT]; } }; document.getElementsByClassName = function(className) { var children = document.getElementsByTagName('*') || document.all; var elements = []; $c(children).each(function(child) { if (Element.hasClassName(child, className)) { elements.push(child); } }); return elements; } //useful array functions Array.prototype.each = function(func) { for(var i = 0; ob = this[i]; i++) { func(ob, i); } } function $c(array) { var nArray = []; for (i = 0; el = array[i]; i++) { nArray.push(el); } return nArray; } // other functions added from prototype function times(iterator) { $R(0, this, true).each(iterator); return this; } --- NEW FILE: fap_tint.png --- (This appears to be a binary file; contents omitted.) Index: clown_album_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/clown_album_functions.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** clown_album_functions.php 30 Jun 2006 21:10:55 -0000 1.7 --- clown_album_functions.php 7 Jun 2007 20:13:16 -0000 1.8 *************** *** 4,111 **** * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2002-2006 [Smartor, Volodymyr (CLowN) Skoryk, IdleVoid, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! if ( !defined( 'IN_PORTAL' ) ) { ! die( "Hacking attempt" ); } ! function ImageRating( $rating, $css_style = 'border-style: none' ) { ! // Pre: returns what type of rating style to display ! global $db, $album_sp_config, $lang, $module_root_path; ! // deside how user wants to show their rating ! if ( $album_sp_config['rate_type'] == 0 ) // display only images { ! if ( !$rating ) ! { ! return $lang['Not_rated']; ! } else { $r = ""; ! for ( $temp = 1; $temp <= $rating; $temp++ ) { ! $r .= "<img src='" . $module_root_path . "album_mod/rank.gif' style='$css_style'/> "; } ! return ( $r ); } ! } ! else if ( $album_sp_config['rate_type'] == 1 ) // display just text { ! if ( !$rating ) ! { ! return $lang['Not_rated']; ! } else ! { ! return ( round( $rating, 2 ) ); ! } } ! else // display both images and text { ! if ( !$rating ) ! { ! return $lang['Not_rated']; ! } else { $r = ""; ! for ( $temp = 1; $temp <= $rating; $temp++ ) { ! $r .= "<img src='" . $module_root_path . "album_mod/rank.gif' style='$css_style'/> "; } } ! ! return ( round( $rating, 2 ) . ' ' . $r ); } } ! ! // to have smilies window popup ! function smartor_generate_smilies( $mode, $page_id ) { global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path; global $user_ip, $session_length, $starttime; global $userdata; global $is_block; ! $inline_columns = $board_config['smilie_columns']; $inline_rows = $board_config['smilie_rows']; $window_columns = $board_config['smilie_window_columns']; ! ! if ( $mode == 'window' ) { ! $userdata = session_pagestart( $user_ip, $page_id ); ! init_userprefs( $userdata ); ! $gen_simple_header = true; $page_title = "Smilies"; ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! } ! $template->set_filenames( array( 'smiliesbody' => 'album_posting_smilies.tpl' ) ); } ! $sql = "SELECT emoticon, code, smile_url ! FROM " . SMILIES_TABLE . " ORDER BY smilies_id"; ! ! if ( $result = $db->sql_query( $sql ) ) { $num_smilies = 0; $rowset = array(); ! while ( $row = $db->sql_fetchrow( $result ) ) { ! if ( empty( $rowset[$row['smile_url']] ) ) { ! $rowset[$row['smile_url']]['code'] = str_replace( "'", "\\'", str_replace( '\\', '\\\\', $row['code'] ) ); $rowset[$row['smile_url']]['emoticon'] = $row['emoticon']; $num_smilies++; --- 4,108 ---- * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2003 [bla...@ya..., Volodymyr (CLowN) Skoryk] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * + * some of the code was taken from phpbb forum (generate_smilies function) */ ! if ( !defined('IN_PORTAL') ) { ! die("Hacking attempt"); } ! function ImageRating($rating) { ! //Pre: returns what type of rating style to display ! global $db, $album_sp_config, $module_root_path; ! ! //deside how user wants to show their rating ! // ! if ($album_sp_config['rate_type'] == 0)//display only images { ! if (!$rating) ! return("<i>Not Rated</i>"); else { $r = ""; ! for ($temp = 1; $temp <= $rating; $temp++) { ! $r .= "<img src='".$module_root_path."album_mod/rank.gif' /> "; } ! ! return ($r); } ! } ! else if ($album_sp_config['rate_type'] == 1) //display just text { ! if (!$rating) ! return("<i>Not Rated</i>"); else ! return (round($rating, 2)); } ! else //display both images and text { ! if (!$rating) ! return("<i>Not Rated</i>"); else { $r = ""; ! for ($temp = 1; $temp <= $rating; $temp++) { ! $r .= "<img src='".$module_root_path."album_mod/rank.gif' /> "; } } ! ! return (round($rating, 2) . ' ' . $r); } } ! //to have smilies window popup ! function smartor_generate_smilies($mode, $page_id) { global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path; global $user_ip, $session_length, $starttime; global $userdata; + // MX global $is_block; ! $inline_columns = $board_config['smilie_columns']; $inline_rows = $board_config['smilie_rows']; $window_columns = $board_config['smilie_window_columns']; ! ! if ($mode == 'window') { ! $mx_user->init($user_ip, PAGE_INDEX); ! $gen_simple_header = TRUE; $page_title = "Smilies"; ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_header.'.$phpEx); ! } ! ! $template->set_filenames(array( ! 'smiliesbody' => 'album_posting_smilies.tpl') ! ); } ! $sql = "SELECT emoticon, code, smile_url ! FROM " . SMILIES_TABLE . " ORDER BY smilies_id"; ! if ($result = $db->sql_query($sql)) { $num_smilies = 0; $rowset = array(); ! while ($row = $db->sql_fetchrow($result)) { ! if (empty($rowset[$row['smile_url']])) { ! $rowset[$row['smile_url']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code'])); $rowset[$row['smile_url']]['emoticon'] = $row['emoticon']; $num_smilies++; *************** *** 113,120 **** } ! if ( $num_smilies ) { ! $smilies_count = ( $mode == 'inline' ) ? min( ( ( $inline_columns * $inline_rows ) - 1 ), $num_smilies ) : $num_smilies; ! $smilies_split_row = ( $mode == 'inline' ) ? $inline_columns - 1 : $window_columns - 1; $s_colspan = 0; --- 110,117 ---- } ! if ($num_smilies) { ! $smilies_count = ( $mode == 'inline' ) ? min( (($inline_columns * $inline_rows) - 1), $num_smilies) : $num_smilies; ! $smilies_split_row = ($mode == 'inline') ? $inline_columns - 1 : $window_columns - 1; $s_colspan = 0; *************** *** 122,143 **** $col = 0; ! while ( list( $smile_url, $data ) = @each( $rowset ) ) { ! if ( !$col ) { ! $template->assign_block_vars( 'smilies_row', array() ); } ! $template->assign_block_vars( 'smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ) ); ! $s_colspan = max( $s_colspan, $col + 1 ); ! if ( $col == $smilies_split_row ) { ! if ( $mode == 'inline' && $row == $inline_rows - 1 ) { break; --- 119,140 ---- $col = 0; ! while (list($smile_url, $data) = @each($rowset)) { ! if (!$col) { ! $template->assign_block_vars('smilies_row', array()); } ! $template->assign_block_vars('smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon']) ); ! $s_colspan = max($s_colspan, $col + 1); ! if ($col == $smilies_split_row) { ! if ($mode == 'inline' && $row == $inline_rows - 1) { break; *************** *** 152,213 **** } ! if ( $mode == 'inline' && $num_smilies > $inline_rows * $inline_columns ) { ! $template->assign_block_vars( 'switch_smilies_extra', array() ); ! $template->assign_vars( array( ! 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ); } ! $template->assign_vars( array( ! 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ) ); } } ! if ( $mode == 'window' ) { ! $template->pparse( 'smiliesbody' ); - if ( !$is_block ) - { - include( $mx_root_path . 'includes/page_tail.' . $phpEx ); - } } } ! function CanRated ( $picID, $userID ) { ! // PRE: deside if user can rate things on hot or not global $db, $album_sp_config, $userdata; ! ! if ( ! $userdata['session_logged_in'] && $album_sp_config['hon_rate_users'] == 1 ) { $alowed = true; } ! else if ( $userdata['session_logged_in'] && $album_sp_config['hon_rate_times'] == 0 ) { $sql = "SELECT * ! FROM " . ALBUM_RATE_TABLE . " ! WHERE rate_pic_id = $picID ! AND rate_user_id = $userID ! LIMIT 1"; ! ! if ( !$result = $db->sql_query( $sql ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not query rating information', '', __LINE__, __FILE__, $sql ); } ! if ( $db->sql_numrows( $result ) > 0 ) { ! $alowed = false; } else { ! $alowed = true; } } --- 149,211 ---- } ! if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) { ! $template->assign_block_vars('switch_smilies_extra', array()); ! $template->assign_vars(array( ! 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid("posting.$phpEx?mode=smilies")) ); } ! $template->assign_vars(array( ! 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan) ); } } ! if ($mode == 'window') { ! $template->pparse('smiliesbody'); ! ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_tail.'.$phpEx); ! } } } ! function CanRated ($picID, $userID) { ! //PRE: deside if user can rate things on hot or not global $db, $album_sp_config, $userdata; ! ! if (! $userdata['session_logged_in'] && $album_sp_config['hon_rate_users'] == 1) { $alowed = true; } ! else if ($userdata['session_logged_in'] && $album_sp_config['hon_rate_times'] == 0) { $sql = "SELECT * ! FROM ". ALBUM_RATE_TABLE ." ! WHERE rate_pic_id = $picID ! AND rate_user_id = $userID ! LIMIT 1"; ! ! if( !$result = $db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query rating information', '', __LINE__, __FILE__, $sql); } ! if ($db->sql_numrows($result) > 0) { ! $alowed = false; } else { ! $alowed = true; } } *************** *** 216,221 **** $alowed = true; } ! ! return ( $alowed ); } ?> \ No newline at end of file --- 214,220 ---- $alowed = true; } ! ! return ($alowed); } + ?> \ No newline at end of file --- NEW FILE: fap_mirror.png --- (This appears to be a binary file; contents omitted.) Index: album_hierarchy_sql.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_hierarchy_sql.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** album_hierarchy_sql.php 30 Jun 2006 21:10:55 -0000 1.5 --- album_hierarchy_sql.php 7 Jun 2007 20:13:16 -0000 1.6 *************** *** 1,32 **** <?php ! /** ! * ! * @package mxBB Portal Module - mx_smartor ! * @version $Id$ ! * @copyright (c) 2002-2006 [Smartor, Volodymyr (CLowN) Skoryk, IdleVoid, Jon Ohlsson] mxBB Project Team ! * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ! * ! */ ! [...3491 lines suppressed...] ! 'PIC_PREVIEW' => $pic_preview, ! 'DESC' => $commentsrow[$i]['pic_desc'], ! 'COMMENT_TEXT' => $commentsrow[$i]['comment_text'], ! 'PIC_ID' => $commentsrow[$i]['pic_id'], ! 'TITLE' => '<a href = "' . append_sid(this_smartor_mxurl("smartor_mode=album_showpage&pic_id=" . $commentsrow[$i]['pic_id'])) . '">' . $commentsrow[$i]['pic_title'] . '</a>', ! 'POSTER' => $poster, ! 'TIME' => create_date2($board_config['default_dateformat'], $commentsrow[$i]['comment_time'], $board_config['board_timezone']), ! 'VIEW' => $commentsrow[$i]['pic_view_count'], ! 'RATING' => ($album_config['rate'] == 1) ? ( '<a href="'. append_sid(this_smartor_mxurl("smartor_mode=album_showpage&pic_id=" . $commentsrow[$i]['pic_id'])) . '" ' . $image_rating_link_style .'>' . $lang['Rating'] . '</a>: ' . $image_rating . '<br />') : '', ! 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="' . append_sid(this_smartor_mxurl("smartor_mode=album_showpage&pic_id=" . $commentsrow[$i]['pic_id'])) . '">' . $lang['Comments'] . '</a>: ' . $image_comment . '<br />') : '', ! 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://whois.sc/' . decode_ip($commentsrow[$i]['pic_user_ip']) . '" target="_blank">' . decode_ip($commentsrow[$i]['pic_user_ip']) .'</a><br />' : '' ! ) ! ); ! } } } + + ?> \ No newline at end of file --- NEW FILE: rating_star_red.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: moo.ajax.js --- //based on prototype's ajax class //to be used with prototype.lite, moofx.mad4milk.net. ajax = Class.create(); ajax.prototype = { initialize: function(url, options) { this.transport = this.getTransport(); this.postBody = options.postBody || ''; this.method = options.method || 'post'; this.onComplete = options.onComplete || null; this.update = $(options.update) || null; this.request(url); }, request: function(url) { this.transport.open(this.method, url, true); this.transport.onreadystatechange = this.onStateChange.bind(this); if (this.method == 'post') { this.transport.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); if (this.transport.overrideMimeType) { this.transport.setRequestHeader('Connection', 'close'); } } this.transport.send(this.postBody); }, onStateChange: function() { if (this.transport.readyState == 4 && this.transport.status == 200) { if (this.onComplete) { setTimeout(function(){this.onComplete(this.transport);}.bind(this), 10); } if (this.update) { setTimeout(function(){this.update.innerHTML = this.transport.responseText;}.bind(this), 10); } this.transport.onreadystatechange = function(){}; } }, getTransport: function() { if (window.ActiveXObject) { return new ActiveXObject('Microsoft.XMLHTTP'); } else if { (window.XMLHttpRequest) return new XMLHttpRequest(); } else { return false; } } }; --- NEW FILE: mark_fap.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: moo.fx.pack.js --- /* moo.fx pack, effects extensions for moo.fx. by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE for more info visit (http://moofx.mad4milk.net). Tuesday, March 07, 2006 v 1.2.3 */ //smooth scroll fx.Scroll = Class.create(); fx.Scroll.prototype = Object.extend(new fx.Base(), { initialize: function(options) { this.setOptions(options); }, scrollTo: function(el) { var dest = Position.cumulativeOffset($(el))[1]; var client = window.innerHeight || document.documentElement.clientHeight; var full = document.documentElement.scrollHeight; var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop; if (dest+client > full) { this.custom(top, dest - client + (full-dest)); } else { this.custom(top, dest); } }, increase: function() { window.scrollTo(0, this.now); } }); //text size modify, now works with pixels too. fx.Text = Class.create(); fx.Text.prototype = Object.extend(new fx.Base(), { initialize: function(el, options) { this.el = $(el); this.setOptions(options); if (!this.options.unit) { this.options.unit = "em"; } }, increase: function() { this.el.style.fontSize = this.now + this.options.unit; } }); //composition effect: widht/height/opacity fx.Combo = Class.create(); fx.Combo.prototype = { setOptions: function(options) { this.options = { opacity: true, height: true, width: false } Object.extend(this.options, options || {}); }, initialize: function(el, options) { this.el = $(el); this.setOptions(options); if (this.options.opacity) { this.o = new fx.Opacity(el, options); options.onComplete = null; } if (this.options.height) { this.h = new fx.Height(el, options); options.onComplete = null; } if (this.options.width) { this.w = new fx.Width(el, options); } }, toggle: function() { this.checkExec('toggle'); }, hide: function(){ this.checkExec('hide'); }, clearTimer: function(){ this.checkExec('clearTimer'); }, checkExec: function(func) { if (this.o) this.o[func](); if (this.h) this.h[func](); if (this.w) this.w[func](); }, //only if width+height resizeTo: function(hto, wto) { if (this.h && this.w) { this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto); this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto); } }, customSize: function(hto, wto) { if (this.h && this.w) { this.h.custom(this.el.offsetHeight, hto); this.w.custom(this.el.offsetWidth, wto); } } } fx.Accordion = Class.create(); fx.Accordion.prototype = { setOptions: function(options) { this.options = { delay: 100, opacity: false } Object.extend(this.options, options || {}); }, initialize: function(togglers, elements, options) { this.elements = elements; this.setOptions(options); elements.each(function(el, i) { options.onComplete = function() { if (el.offsetHeight > 0) { el.style.height = '1%'; } } el.fx = new fx.Combo(el, options); el.fx.hide(); }); togglers.each(function(tog, i) { if(tog.onclick!=null) { var togAction = tog.onclick; } tog.onclick = function() { this.showThisHideOpen(elements[i],togAction); } .bind(this); } .bind(this)); }, showThisHideOpen: function(toShow,togAction) { if (toShow.offsetHeight == 0) { setTimeout(function(){this.clearAndToggle(toShow); togAction();}.bind(this), this.options.delay); } this.elements.each(function(el, i) { if (el.offsetHeight > 0 && el != toShow) { this.clearAndToggle(el); } } .bind(this)); }, clearAndToggle: function(el) { el.fx.clearTimer(); el.fx.toggle(); } } var Remember = new Object(); Remember = function(){}; Remember.prototype = { initialize: function(el, options) { this.el = $(el); this.days = 365; this.options = options; this.effect(); var cookie = this.readCookie(); if (cookie) { this.fx.now = cookie; this.fx.increase(); } }, //cookie functions based on code by Peter-Paul Koch setCookie: function(value) { var date = new Date(); date.setTime(date.getTime() + (this.days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); document.cookie = this.el + this.el.id + this.prefix + "=" + value + expires + "; path=/"; }, readCookie: function() { var nameEQ = this.el + this.el.id + this.prefix + "="; var ca = document.cookie.split(';'); for(var i=0;c=ca[i];i++) { while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); } } return false; }, custom: function(from, to) { if (this.fx.now != to) { this.setCookie(to); this.fx.custom(from, to); } } } fx.RememberHeight = Class.create(); fx.RememberHeight.prototype = Object.extend(new Remember(), { effect: function() { this.fx = new fx.Height(this.el, this.options); this.prefix = 'height'; }, toggle: function() { if (this.el.offsetHeight == 0) { this.setCookie(this.el.scrollHeight); } else { this.setCookie(0); } this.fx.toggle(); }, resize: function(to) { this.setCookie(this.el.offsetHeight+to); this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to); }, hide: function() { if (!this.readCookie()) { this.fx.hide(); } } }); fx.RememberText = Class.create(); fx.RememberText.prototype = Object.extend(new Remember(), { effect: function() { this.fx = new fx.Text(this.el, this.options); this.prefix = 'text'; } }); //useful for-replacement Array.prototype.each = function(func) { for(var i=0;ob=this[i];i++) func(ob, i); } //Easing Equations (c) 2003 Robert Penner, all rights reserved. //This work is subject to the terms in http://www.robertpenner.com/easing_terms_of_use.html. //expo fx.expoIn = function(pos) { return Math.pow(2, 10 * (pos - 1)); } fx.expoOut = function(pos) { return (-Math.pow(2, -10 * pos) + 1); } //quad fx.quadIn = function(pos) { return Math.pow(pos, 2); } fx.quadOut = function(pos) { return -(pos)*(pos-2); } //circ fx.circOut = function(pos) { return Math.sqrt(1 - Math.pow(pos-1,2)); } fx.circIn = function(pos) { return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1); } //back fx.backIn = function(pos) { return (pos)*pos*((2.7)*pos - 1.7); } fx.backOut = function(pos) { return ((pos-1)*(pos-1)*((2.7)*(pos-1) + 1.7) + 1); } //sine fx.sineOut = function(pos) { return Math.sin(pos * (Math.PI/2)); } fx.sineIn = function(pos) { return -Math.cos(pos * (Math.PI/2)) + 1; } fx.sineInOut = function(pos) { return -(Math.cos(Math.PI*pos) - 1)/2; } --- NEW FILE: fap_watermark.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mooshow.1.04.js --- // mooShow 1.04 // (c)2006 Stuart Eaton - http://www.eatpixels.com // // Credit where credit is due: Inspiration from Lightbox (http://www.huddletogether.com/projects/lightbox2/) // and Couloir (http://www.couloir.org/js_slideshow/) and of course moo.fx (http://moofx.mad4milk.net/ // moo.fx and prototype are covered by their own respective license terms. // -------------------------------------------------------------------------------------------------------------- var loadingImage = "images/fap/fap_loading.gif"; // loading image // -------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------- var mooShows = null; // ----------------------------------------------------------------------------------- function start() { // find any mooshows on the page find_mooshows(); } // ----------------------------------------------------------------------------------- function find_mooshows() { shows = document.getElementsByClassName("mooshow"); // find divs using the 'mooshow' class if(shows.length == 0) { shows = showsIE; // If can't find shows list get it from html page (hack for IE5.5) } mooShows = new Object(); for ( var i = 0; i < shows.length; i++ ) { showName = shows[i].id; // get shownames if(showName==null) { showName = shows[i]; // if we are getting show names from the html page (hack for IE5.5) } mooShows[ showName ] = new mooshow(showName); // create new mooshow objects create_mooshow(showName,i); // create the shows htmls } } // ----------------------------------------------------------------------------------- function create_mooshow( showName,shownumber ) { eval($(showName).innerHTML); //get slideshow settings photoArray = eval(showName); // set up image array based on id shownumber++; // add 1 to shownumber so it starts on 1 not 0 if(this.dropShadow=='yes') { this.outerContainerClass = 'mooshow_outerContainer dropShadowBorder'; } else { this.outerContainerClass = 'mooshow_outerContainer'; } var mooShow_html = '' + '<div id=\'' + showName + '_outerContainer\' class=\'' + this.outerContainerClass + '\' style=\'padding:' + this.border + 'px;\'> \n' + ' <div id=\'' + showName + '_topNav\' style=\'width:' + photoArray[0][1] + 'px;\' class=\'mooshow_topNav\'></div> \n' + ' <div id=\'' + showName + '_contentContainer\' class=\'mooshow_contentContainer\' > \n' + ' <img src=\'' + photoArray[0][0] + '\' class=\'mooshow_image\' width=\'' + photoArray[0][1] + '\' height=\'' + photoArray[0][2] + '\' id=\'' + showName + '_image\' /> \n' + ' <img src=\'' + loadingImage + '\' id=\'' + showName + '_loading\' class=\'mooshow_loading\' /> \n' + ' <div id=\'' + showName + '_copyright\' class=\'mooshow_copyright\'></div> \n' + ' <div id=\'' + showName + '_overlayNav\' class=\'mooshow_overlayNav\' style=\'height:' + photoArray[0][2] + 'px; width:' + photoArray[0][1] + 'px;\'> \n' + ' <a href=\'#' + shownumber + '\' id=\'' + showName + '_prevLink\' class=\'mooshow_prevLink\' onClick=\'mooShows['' + showName + ''].prevImage();\' ></a> \n' + ' <a href=\'#' + shownumber + '\' id=\'' + showName + '_nextLink\' class=\'mooshow_nextLink\' onClick=\'mooShows['' + showName + ''].nextImage();\' ></a> \n' + ' </div> \n' + ' <div id=\'' + showName + '_IPTC\' class=\'mooshow_IPTC\' style=\'width:' + photoArray[0][1] + 'px;\'></div> \n' + ' <a href=\'#' + shownumber + '\' ><img src=\'images/fap/fap_info.gif\' id=\'' + showName + '_IPTCbutton\' class=\'mooshow_IPTCbutton\' onClick=\'mooShows['' + showName + ''].updateIPTCinfoToggle();\' /></a> \n' + ' </div> \n' + ' <div id=\'' + showName + '_extras\' class=\'mooshow_extras\'> \n' + ' <div id=\'' + showName + '_captions\' class=\'mooshow_captions\' style=\'padding-top:' + this.border + 'px;padding-left:-' + this.border + 'px; width:' + photoArray[0][1] + 'px;\'>' + photoArray[0][7] + ' </div> \n' + ' <div id=\'' + showName + '_bottomNav\' class=\'mooshow_bottomNav\'></div> \n' + ' <div id=\'' + showName + '_temp\' class=\'mooshow_temp\'></div> \n' + ' </div> \n' + '</div> \n' + '<script></script>'; Element.setInnerHTML(showName, mooShow_html); // display or hide various options if(this.topNav == 'no') {Element.hide(showName+'_topNav');} else {mooShows[showName].updateTopNav(showName);} if(this.overlayNav == 'no') Element.hide(showName+'_overlayNav'); if(this.captions == 'no') Element.hide(showName+'_captions'); if(this.copyright == 'yes') Element.setInnerHTML(showName+'_copyright', photoArray[0][6]); if(this.IPTCinfo == 'no') Element.hide(showName+'_IPTCbutton'); Element.show(showName); } // ----------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------- var mooshow = Class.create(); mooshow.prototype = { // ----------------------------------------------------------------------------------- initialize: function(showName) { this.id = showName; this.busy = 0; this.counter = 0; this.photoArray = eval(this.id); this.numberOfImages = this.photoArray.length - 2; this.IPTCinfoStatus = 0; eval($(showName).innerHTML); //get slideshow settings (set inside the mooshow div) }, // ----------------------------------------------------------------------------------- nextImage: function() { if(this.busy<1) { this.busy=1; if(this.counter < this.numberOfImages) { this.counter ++; } else { this.counter = 0; } this.loadImage(); } }, // ----------------------------------------------------------------------------------- prevImage: function() { if(this.busy < 1) { this.busy = 1; if(this.counter > 0) { this.counter --; } else { this.counter = this.numberOfImages; } this.loadImage(); } }, // ----------------------------------------------------------------------------------- jumptoImage: function(counter) { if(this.busy<1) { this.busy=1; this.counter = counter-1; this.loadImage(); } }, // ----------------------------------------------------------------------------------- switchContent: function(newArray) { if(this.busy<1) { this.busy=1; this.photoArray = eval(newArray); this.numberOfImages = this.photoArray.length -2; this.counter = 0; this.loadImage(); } }, // ----------------------------------------------------------------------------------- updateIPTCinfo: function() { //get showname showName = this.id; // this.iptcHTML = '' + '<div class=\'mooshow_IPTC_left\'><br /><br />' + ' Image URL <br />' + ' Size <br />' + ' Dimensions <br />' + ' Title <br />' + ' Author <br />' + ' Copyright <br /><br />' + ' Description <br /><br />' + '</div>' + '<div class=\'mooshow_IPTC_right\'><br /><br />' + ' <a href=\'' + this.photoArray[this.counter][0] + '\'>' + this.photoArray[this.counter][0] + '</a><br />' + //img src ' ' + this.photoArray[this.counter][3] + '<br />' + // file size ' ' + this.photoArray[this.counter][1] + ' x ' + this.photoArray[this.counter][2] + ' pixels<br />' + // width * height ' ' + this.photoArray[this.counter][4] + '<br />' + //title ' ' + this.photoArray[this.counter][5] + '<br />' + // author ' ' + this.photoArray[this.counter][6] + '<br /><br />' + //copyright ' ' + this.photoArray[this.counter][7] + '<br /><br />' + // description '</div>'; Element.setInnerHTML(''+showName+'_IPTC', this.iptcHTML); }, // ----------------------------------------------------------------------------------- updateIPTCinfoToggle: function() { if(this.IPTCinfoStatus==1) { Element.hide(''+showName+'_IPTC'); this.IPTCinfoStatus=0; } else { Element.show(''+showName+'_IPTC'); this.IPTCinfoStatus=1; this.updateIPTCinfo(); } }, // ----------------------------------------------------------------------------------- updateTopNav: function(showName) { //Element.setWidth(showName+'_topNav', this.photoArray[this.counter][1]); Element.setInnerHTML(showName+'_topNav', ''); this.topNavContent = $(showName+'_topNav').innerHTML; this.topNavContent = (this.counter+1) + ' / ' + (this.photoArray.length-1) + ' <img src=\'images/fap/fap_blank.gif\' width=\'10\' height=\'1\' />'; for ( var i = 1; i < this.photoArray.length; i++ ) { if(i==this.counter+1) { this.topNavContent = this.topNavContent + i; } else { this.topNavContent = this.topNavContent + ' <a href=\'#' + i + '\' onClick=\'mooShows['' + showName + ''].jumptoImage(' + i + ');\'>' + i + '</a>'; } if(i<this.photoArray.length-1) { this.topNavContent = this.topNavContent + ' | '; } } document.getElementById(showName+'_topNav').innerHTML = this.topNavContent; }, // ----------------------------------------------------------------------------------- loadImage: function() { //get showname showName = this.id; // update top navigation if(this.topNav=='yes') { this.updateTopNav(showName); } // show laoding animation Element.show(showName + '_loading'); // hide IPTC info Element.hide(showName + '_IPTC'); Element.hide(showName + '_IPTCbutton'); // overlay navigation if(this.overlayNav == 'yes') { Element.hide(showName + '_overlayNav'); } // preload in new image newImgPreloader = new Image(); // if image is preloaded newImgPreloader.onload=function() { // when loaded // hide current photo Element.setSrc(showName + '_image','images/fap/fap_blank.gif'); Element.setOpacity(showName + '_image',0); // hide laoding animation Element.hide(showName + '_loading'); // set captions to blank space Element.setInnerHTML(showName + '_captions', ' '); // set copyright to blank Element.setInnerHTML(showName + '_copyright', ''); // get new sizes newHeight = newImgPreloader.height; newWidth = newImgPreloader.width; // resize containers to new size this.resizeTopNavWidth = new fx.Width(showName + '_topNav', {duration: mooShows[showName].speed}); this.resizeCaptionWidth = new fx.Width(showName + '_captions', {duration: mooShows[showName].speed}); this.resizeOuterContainerHeight = new fx.Height(showName + '_image', {duration: mooShows[showName].speed}); this.resizeOuterContainerWidth = new fx.Width(showName + '_image', {duration: mooShows[showName].speed, onComplete: function() { // set up next image Element.setSrc(showName + '_image',newImgPreloader.src); // reposition overlay nav Element.setHeight(showName + '_overlayNav',(newImgPreloader.height)); Element.setWidth(showName + '_overlayNav',(newImgPreloader.width)); //show captions if(mooShows[showName].captions=='yes') { Element.setInnerHTML(showName + '_captions', mooShows[showName].photoArray[mooShows[showName].counter][7] + ' '); } // copyright if(mooShows[showName].copyright == 'yes') { Element.setInnerHTML(showName + '_copyright', mooShows[showName].photoArray[mooShows[showName].counter][6]); } // new moo.fx 'fader' this.fader = new fx.Opacity(showName + '_image', {duration: mooShows[showName].fadeSpeed, onComplete:function() { mooShows[showName].busy = 0; // overlay navigation if(mooShows[showName].overlayNav == 'yes') { Element.show(showName + '_overlayNav'); } //IPTC panel height if(mooShows[showName].IPTCinfo == 'yes') { Element.show(showName + '_IPTCbutton'); } Element.setWidth(showName + '_IPTC', newImgPreloader.width); if(mooShows[showName].IPTCinfoStatus==1) { mooShows[showName].IPTCinfoStatus=0; mooShows[showName].updateIPTCinfoToggle(); } }}); // call fader fx this.fader.hide(); this.fader.toggle(); } }); // get current sizes oldHeight = Element.getHeight(showName + '_image'); oldWidth = Element.getWidth(showName + '_image'); // call moo.fx and when done switchImage() this.resizeTopNavWidth.custom(oldWidth,newWidth); this.resizeCaptionWidth.custom(oldWidth,newWidth); this.resizeOuterContainerHeight.custom(oldHeight,newHeight); this.resizeOuterContainerWidth.custom(oldWidth,newWidth); }; newImgPreloader.src = this.photoArray[this.counter][0]; // preloader src } // ----------------------------------------------------------------------------------- } // -------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------- // Additional methods for Element by SU, Couloir // - further additions by Lokesh Dhakar (huddletogether.com) // - and Stuart Eaton (eatpixels.com) Object.extend(Element, { getWidth: function(element) { element = $(element); return element.offsetWidth; }, getHeight: function(element) { element = $(element); return element.offsetHeight; }, setWidth: function(element,w) { element = $(element); element.style.width = w +"px"; }, setHeight: function(element,h) { element = $(element); element.style.height = h +"px"; }, setTop: function(element,t) { element = $(element); element.style.top = t +"px"; }, setSrc: function(element,src) { element = $(element); element.src = src; }, setAlt: function(element,alt) { element = $(element); element.alt = alt; }, setOpacity: function(element,opacity) { element = $(element); element.style.opacity = opacity; }, setHref: function(element,href) { element = $(element); element.href = href; }, setInnerHTML: function(element,content) { element = $(element); element.innerHTML = content; }, hide: function(element) { element = $(element); element.style.display = 'none'; }, show: function(element) { element = $(element); element.style.display = 'inline'; } }); // --------------------------------------------------- // addLoadEvent() // Adds event to window.onload without overwriting currently assigned onload functions. // Function found at Simon Willison's weblog - http://simon.incutio.com/ // function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } // --------------------------------------------------- function run() { start(); } addLoadEvent(run); // run initMooshow onLoad // -------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------- --- NEW FILE: fap_bw.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fap_screen.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: rating_star.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: archive.php --- <?php /*-------------------------------------------------- | TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.0 | By Devin Doucette | Copyright (c) 2004 Devin Doucette | Email: dar...@sh... +-------------------------------------------------- | Email bugs/suggestions to dar...@sh... +-------------------------------------------------- | This script has been created and released under | the GNU GPL and is free to use and redistribute | only if this copyright statement is not removed +--------------------------------------------------*/ // CTracker_Ignore: File Checked By Human // Tell the Security Scanner that reachable code in this file is not a security issue if ( !defined('IN_PORTAL') ) { die('Hacking attempt'); } class archive { function archive($name) { $this->options = array( 'basedir'=>".", 'name'=>$name, 'prepend'=>"", 'inmemory'=>0, 'overwrite'=>0, 'recurse'=>1, 'storepaths'=>1, 'level'=>3, 'method'=>1, 'sfx'=>"", 'type'=>"", 'comment'=>"" ); $this->files = array(); $this->exclude = array(); $this->storeonly = array(); $this->error = array(); } function set_options($options) { foreach($options as $key => $value) { $this->options[$key] = $value; } if(!empty($this->options['basedir'])) { $this->options['basedir'] = str_replace("\\","/",$this->options['basedir']); $this->options['basedir'] = preg_replace("/\/+/","/",$this->options['basedir']); $this->options['basedir'] = preg_replace("/\/$/","",$this->options['basedir']); } if(!empty($this->options['name'])) { $this->options['name'] = str_replace("\\","/",$this->options['name']); $this->options['name'] = preg_replace("/\/+/","/",$this->options['name']); } if(!empty($this->options['prepend'])) { $this->options['prepend'] = str_replace("\\","/",$this->options['prepend']); $this->options['prepend'] = preg_replace("/^(\.*\/+)+/","",$this->options['prepend']); $this->options['prepend'] = preg_replace("/\/+/","/",$this->options['prepend']); $this->options['prepend'] = preg_replace("/\/$/","",$this->options['prepend']) . "/"; } } function create_archive() { $this->make_list(); if($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if($this->options['overwrite'] == 0 && file_exists($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip"? ".tmp" : ""))) { $this->error[] = "File {$this->options['name']} already exists."; chdir($pwd); return 0; } else if($this->archive = @fopen($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip"? ".tmp" : ""),"wb+")) { chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else { $this->archive = ""; } switch($this->options['type']) { case "zip": if(!$this->create_zip()) { $this->error[] = "Could not create zip file."; return 0; } break; case "bzip": if(!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } if(!$this->create_bzip()) { $this->error[] = "Could not create bzip2 file."; return 0; } break; case "gzip": if(!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } if(!$this->create_gzip()) { $this->error[] = "Could not create gzip file."; return 0; } break; case "tar": if(!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } } if($this->options['inmemory'] == 0) { fclose($this->archive); if($this->options['type'] == "gzip" || $this->options['type'] == "bzip") { unlink($this->options['basedir'] . "/" . $this->options['name'] . ".tmp"); } } } function add_data($data) { if($this->options['inmemory'] == 0) { fwrite($this->archive,$data); } else { $this->archive .= $data; } } function make_list() { if(!empty($this->exclude)) { foreach($this->files as $key => $value) { foreach($this->exclude as $current) { if($value['name'] == $current['name']) { unset($this->files[$key]); } } } } if(!empty($this->storeonly)) { foreach($this->files as $key => $value) { foreach($this->storeonly as $current) { if($value['name'] == $current['name']) { $this->files[$key]['method'] = 0; } } } } unset($this->exclude,$this->storeonly); } function add_files($list) { $temp = $this->list_files($list); foreach($temp as $current) { $this->files[] = $current; } } function exclude_files($list) { $temp = $this->list_files($list); foreach($temp as $current) { $this->exclude[] = $current; } } function store_files($list) { $temp = $this->list_files($list); foreach($temp as $current) { $this->storeonly[] = $current; } } function list_files($list) { if(!is_array($list)) { $temp = $list; $list = array($temp); unset($temp); } $files = array(); $pwd = getcwd(); chdir($this->options['basedir']); foreach($list as $current) { $current = str_replace("\\","/",$current); $current = preg_replace("/\/+/","/",$current); $current = preg_replace("/\/$/","",$current); if(strstr($current,"*")) { $regex = preg_replace("/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/","\\\\\\1",$current); $regex = str_replace("*",".*",$regex); $dir = strstr($current,"/")? substr($current,0,strrpos($current,"/")) : "."; $temp = $this->parse_dir($dir); foreach($temp as $current2) { if(preg_match("/^{$regex}$/i",$current2['name'])) { $files[] = $current2; } } unset($regex,$dir,$temp,$current); } else if(@is_dir($current)) { $temp = $this->parse_dir($current); foreach($temp as $file) { $files[] = $file; } unset($temp,$file); } else if(@file_exists($current)) { $files[] = array('name'=>$current,'name2'=>$this->options['prepend'] . preg_replace("/(\.+\/+)+/","",($this->options['storepaths'] == 0 && strstr($current,"/"))? substr($current,strrpos($current,"/") + 1) : $current),'type'=>0, 'ext'=>substr($current,strrpos($current,".")),'stat'=>stat($current)); } } chdir($pwd); unset($current,$pwd); usort($files,array("archive","sort_files")); return $files; } function parse_dir($dirname) { if($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/",$dirname)) { $files = array(array('name'=>$dirname,'name2'=>$this->options['prepend'] . preg_replace("/(\.+\/+)+/","",($this->options['storepaths'] == 0 && strstr($dirname,"/"))? substr($dirname,strrpos($dirname,"/") + 1) : $dirname),'type'=>5,'stat'=>stat($dirname))); } else { $files = array(); } $dir = @opendir($dirname); while($file = @readdir($dir)) { if($file == "." || $file == "..") { continue; } else if(@is_dir($dirname."/".$file)) { if(empty($this->options['recurse'])) { continue; } $temp = $this->parse_dir($dirname."/".$file); foreach($temp as $file2) { $files[] = $file2; } } else if(@file_exists($dirname."/".$file)) { $files[] = array('name'=>$dirname."/".$file,'name2'=>$this->options['prepend'] . preg_replace("/(\.+\/+)+/","",($this->options['storepaths'] == 0 && strstr($dirname."/".$file,"/"))? substr($dirname."/".$file,strrpos($dirname."/".$file,"/") + 1) : $dirname."/".$file),'type'=>0, 'ext'=>substr($file,strrpos($file,".")),'stat'=>stat($dirname."/".$file)); } } @closedir($dir); return $files; } function sort_files($a,$b) { if($a['type'] != $b['type']) { return $a['type'] > $b['type']? -1 : 1; } else if($a['type'] == 5) { return strcmp(strtolower($a['name']),strtolower($b['name'])); } else { if($a['ext'] != $b['ext']) { return strcmp($a['ext'],$b['ext']); } else if($a['stat'][7] != $b['stat'][7]) { return $a['stat'][7] > $b['stat'][7]? -1 : 1; } else { return strcmp(strtolower($a['name']),strtolower($b['name'])); } } return 0; } function download_file() { if($this->options['inmemory'] == 0) { $this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster."; return; } switch($this->options['type']) { case "zip": header("Content-type:application/zip"); break; case "bzip": header("Content-type:application/x-compressed"); break; case "gzip": header("Content-type:application/x-compressed"); break; case "tar": header("Content-type:application/x-tar"); } $header = "Content-disposition: attachment; filename=\""; $header .= strstr($this->options['name'],"/")? substr($this->options['name'],strrpos($this->options['name'],"/") + 1) : $this->options['name']; $header .= "\""; header($header); header("Content-length: " . strlen($this->archive)); header("Content-transfer-encoding: binary"); header("Pragma: no-cache"); header("Expires: 0"); print($this->archive); } } class tar_file extends archive { function tar_file($name) { $this->archive($name); $this->options['type'] = "tar"; } function create_tar() { $pwd = getcwd(); chdir($this->options['basedir']); foreach($this->files as $current) { if($current['name'] == $this->options['name']) { continue; } if(strlen($current['name2']) > 99) { $path = substr($current['name2'],0,strpos($current['name2'],"/",strlen($current['name2']) - 100) + 1); $current['name2'] = substr($current['name2'],strlen($path)); if(strlen($path) > 154 || strlen($current['name2']) > 99) { $this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long."; continue; } } $block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12",$current['name2'],decoct($current['stat'][2]), sprintf("%6s ",decoct($current['stat'][4])),sprintf("%6s ",decoct($current['stat'][5])), sprintf("%11s ",decoct($current['stat'][7])),sprintf("%11s ",decoct($current['stat'][9])), " ",$current['type'],"","ustar","00","Unknown","Unknown","","",!empty($path)? $path : "",""); $checksum = 0; for($i = 0; $i < 512; $i++) { $checksum += ord(substr($block,$i,1)); } $checksum = pack("a8",sprintf("%6s ",decoct($checksum))); $block = substr_replace($block,$checksum,148,8); if($current['stat'][7] == 0) { $this->add_data($block); } else if($fp = @fopen($current['name'],"rb")) { $this->add_data($block); while($temp = fread($fp,1048576)) { $this->add_data($temp); } if($current['stat'][7] % 512 > 0) { $temp = ""; for($i = 0; $i < 512 - $current['stat'][7] % 512; $i++) { $temp .= "\0"; } $this->add_data($temp); } fclose($fp); } else { $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; } } $this->add_data(pack("a512","")); chdir($pwd); return 1; } function extract_files() { $pwd = getcwd(); chdir($this->options['basedir']); if($fp = $this->open_archive()) { if($this->options['inmemory'] == 1) { $this->files = array(); } while($block = fread($fp,512)) { $temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100temp/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp",$block); $file = array( 'name'=>$temp['prefix'] . $temp['name'], 'stat'=>array( 2=>$temp['mode'], 4=>octdec($temp['uid']), 5=>octdec($temp['gid']), 7=>octdec($temp['size']), 9=>octdec($temp['mtime']), ), 'checksum'=>octdec($temp['checksum']), 'type'=>$temp['type'], 'magic'=>$temp['magic'], ); if($file['checksum'] == 0x00000000) { break; } else if($file['magic'] != "ustar") { $this->error[] = "This script does not support extracting this type of tar file."; break; } $block = substr_replace($block," ",148,8); $checksum = 0; for($i = 0; $i < 512; $i++) { $checksum += ord(substr($block,$i,1)); } if($file['checksum'] != $checksum) { $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt."; } if($this->options['inmemory'] == 1) { $file['data'] = fread($fp,$file['stat'][7]); fread($fp,(512 - $file['stat'][7] % 512) == 512? 0 : (512 - $file['stat'][7] % 512)); unset($file['checksum'],$file['magic']); $this->files[] = $file; } else { if($file['type'] == 5) { if(!is_dir($file['name'])) { mkdir($file['name'],$file['stat'][2]); chown($file['name'],$file['stat'][4]); chgrp($file['name'],$file['stat'][5]); } } else if($this->options['overwrite'] == 0 && file_exists($file['name'])) { $this->error[] = "{$file['name']} already exists."; } else if($new = @fopen($file['name'],"wb")) { fwrite($new,fread($fp,$file['stat'][7])); fread($fp,(512 - $file['stat'][7] % 512) == 512? 0 : (512 - $file['stat'][7] % 512)); fclose($new); chmod($file['name'],$file['stat'][2]); chown($file['name'],$file['stat'][4]); chgrp($file['name'],$file['stat'][5]); } else { $this->error[] = "Could not open {$file['name']} for writing."; } } unset($file); } } else { $this->error[] = "Could not open file {$this->options['name']}"; } chdir($pwd); } function open_archive() { return @fopen($this->options['name'],"rb"); } } class gzip_file extends tar_file { function gzip_file($name) { $this->tar_file($name); $this->options['type'] = "gzip"; } function create_gzip() { if($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if($fp = gzopen($this->options['name'],"wb{$this->options['level']}")) { fseek($this->archive,0); while($temp = fread($this->archive,1048576)) { gzwrite($fp,$temp); } gzclose($fp); chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else { $this->archive = gzencode($this->archive,$this->options['level']); } return 1; } function open_archive() { return @gzopen($this->options['name'],"rb"); } } class bzip_file extends tar_file { function bzip_file($name) { $this->tar_file($name); $this->options['type'] = "bzip"; } function create_bzip() { if($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if($fp = bzopen($this->options['name'],"wb")) { fseek($this->archive,0); while($temp = fread($this->archive,1048576)) { bzwrite($fp,$temp); } bzclose($fp); chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else { $this->archive = bzcompress($this->archive,$this->options['level']); } return 1; } function open_archive() { return @bzopen($this->options['name'],"rb"); } } class zip_file extends archive { function zip_file($name) { $this->archive($name); $this->options['type'] = "zip"; } function create_zip() { $files = 0; $offset = 0; $central = ""; if(!empty($this->options['sfx'])) { if($fp = @fopen($this->options['sfx'],"rb")) { $temp = fread($fp,filesize($this->options['sfx'])); fclose($fp); $this->add_data($temp); $offset += strlen($temp); unset($temp); ... [truncated message content] |