$v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process); } $file = __FILE__; $title = "RCTS"; $body = "about"; $zzz_form_id = 0; $photo_id = 20; require("php/dbinit.inc"); function _HAS( $s ) { $HAS_t = $_POST[ $s ]; if (( is_null( $HAS_t )) || ( strlen( $HAS_t ) == 0 )) { $HAS_t = $_GET[ $s ]; } return $HAS_t; } require("php/rawhdr.inc"); function legitimate( $s ) { if ( is_null( $s )) { return 1; } $n = strlen( $s ); for ( $i=0; $i<$n-1; $i++ ) { if (((( substr( $s, $i, 1 ) == "<" ) && ( substr( $s, $i+1, 5 ) == "photo" )) || ( substr( $s, $i, 1 ) == "[" )) && ( substr( $s, $i+1, 1 ) != " " )) { return 0; } } return 1; } function score_legitimacy( $s, $domain, $inc ) { if ( is_null( $s )) { return 0; } $n = strlen( $s ); $legit = 0; $results = mysql_query( "SELECT text, score FROM spamwords" ); while ( $row = mysql_fetch_assoc( $results )) { $word = $row[ "text" ]; $word_len = strlen( $word ); $score = $row[ "score" ]; $l_ch = ' '; echo "check " . $word . "
"; for ( $i=0; $i<$n; $i++ ) { $ch = $s[ $i ]; if (( ! ctype_alpha( $ch )) || ( ! ctype_alpha( $l_ch ))) { if ( strcasecmp( substr( $s, $i, $word_len ), $word ) == 0 ) { $legit += $score; echo "spam score" . $legit . "
"; } } $l_ch = $ch; } } mysql_free_result( $results ); for ( $i=0; $i<$n; $i++ ) { if ( substr( $s, $i, 4 ) == "[url" ) { return 10 * $inc; } if ( strcasecmp( substr( $s, $i, 13 ), "fake passport" ) == 0 ) { return 10 * $inc; } if ( strcasecmp( substr( $s, $i, 11 ), "tnaflix.com" ) == 0 ) { $legit += 100; } if ( strcasecmp( substr( $s, $i, 14 ), "members.mdi.me" ) == 0 ) { $legit += 100; } if ( strcasecmp( substr( $s, $i, 11 ), "top.wink.ws" ) == 0 ) { $legit += 100; } if ( strcasecmp( substr( $s, $i, 5 ), " seo " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 6 ), " porn " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 8 ), " vagina " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 6 ), " pedo " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 6 ), " fuck " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 8 ), " fucked " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 9 ), " fucking " ) == 0 ) { $legit += 5 * $inc; } if ( strcasecmp( substr( $s, $i, 5 ), "href=" ) == 0 ) { $legit += $inc; } if ( strcasecmp( substr( $s, $i, 7 ), "http://" ) == 0 ) { $legit += $inc; } if ( strcasecmp( substr( $s, $i, 8 ), "https://" ) == 0 ) { $legit += $inc; } if ( strcasecmp( substr( $s, $i, 4 ), "www." ) == 0 ) { $legit += $inc; } if ( $domain ) { if ( strcasecmp( substr( $s, $i, 4 ), ".com" ) == 0 ) { $legit += $inc; } if ( strcasecmp( substr( $s, $i, 6 ), ".co.uk" ) == 0 ) { $legit += $inc; } if ( strcasecmp( substr( $s, $i, 3 ), ".us" ) == 0 ) { $legit += $inc; } } } return $legit; } function legitimate2( $s, $location, $email ) { $legit = 0; if ( $s == $location ) { $legit += 16; } $legit += score_legitimacy( $s, true, 2 ); if ( strlen( $location ) > 30 ) { $legit += strlen( $location ) - 30; } if ( $location == "return editkey5(event)" ) { $legit += 100; } else if ( $location == "New York" ) { $legit += 100; } else if ( substr( $location, 0, 14 ) == "return editkey" ) { $legit += 20; } $legit += score_legitimacy( $location, true, 10 ); $legit += score_legitimacy( $email, false, 2 ); $where = "( comments.sys_email = '" . mysql_real_escape_string( $email ) . "' )"; $where2 = "( comments.sys_expires > NOW() ) AND (( comments.sys_approved < NOW() ) OR ( comments.sys_ip = '" . $_SERVER['REMOTE_ADDR'] . "' ))"; if ( $_SESSION["authority_id"] == "webmaster" ) { if ( $_GET["img"] == "all" ) { $where2 = "( comments.sys_expires > NOW() ) AND ( comments.sys_approved IS NULL )"; } else { $where2 = "( comments.sys_expires > NOW() )"; } } if ( $where == "" ) { $where = $where2; } else { $where = "(" . $where . ") AND " . $where2 ; } $sql = "SELECT COUNT(*) AS cnt FROM comments WHERE " . $where . " AND ( NOW() < comments.sys_expires )"; $result = mysql_query( $sql ); $row = mysql_fetch_assoc( $result ); if (( is_null( $row )) || ( $row[ "cnt" ] == 0 )) { $legit += 2; ;} if ( $legit >= 60 ) { return -1; } return $legit; } function getentities( $s ) { return htmlentities( str_replace( "&", "%26", $s )); } function _getattribute( $tbl, $key, $attr ) { $getattribute_text = ""; $getattribute_sql = "SELECT text FROM " . mysql_real_escape_string( $tbl ) . " WHERE id = '" . mysql_real_escape_string( $key ) . "' AND attr = '" . mysql_real_escape_string( $attr ) . "' AND ( sys_expires > NOW() ) LIMIT 0, 1"; $getattribute_count = 0; $getattribute_result = mysql_query( $getattribute_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $getattribute_result ) { while ( $getattribute_row = mysql_fetch_assoc( $getattribute_result )) { $getattribute_count++; $getattribute_text = $getattribute_row[ "text" ]; } mysql_free_result( $getattribute_result ); } return $getattribute_text; } function getattribute( $tbl, $key_cl, $key_img, $attr ) { return _getattribute( $tbl, $key_cl . "/". $key_img, $attr ); } function _getattributes( $tbl, $key, $attr ) { $getattributes_text = array(); $getattribute_sql = "SELECT serial, text FROM " . mysql_real_escape_string( $tbl ) . " WHERE id = '" . mysql_real_escape_string( $key ) . "' AND attr = '" . mysql_real_escape_string( $attr ) . "' AND ( sys_expires > NOW() ) ORDER BY serial ASC"; $getattribute_count = 0; $getattribute_result = mysql_query( $getattribute_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $getattribute_result ) { while ( $getattribute_row = mysql_fetch_assoc( $getattribute_result )) { $getattribute_count++; $getattributes_text[] = $getattribute_row[ "serial" ]; $getattributes_text[] = $getattribute_row[ "text" ]; } mysql_free_result( $getattribute_result ); } return $getattributes_text; } function getattributes( $tbl, $key_cl, $key_img, $attr ) { return _getattributes( $tbl, $key_cl . "/". $key_img, $attr ); } function getbrackets( $key_cl, $key_img ) { return _getattributes( "brackets", $key_cl . "/". $key_img, "bracket" ); } function addattribute( $tbl, $key, $parent_row_id, $attr, $v, $serial ) { $debug = 2; echo "set " . $key . " row_id=" . $parent_row_id . " attr=" . $attr . " serial=[" . $serial . "]=" . $v . "
"; $setattribute2_sql = "INSERT INTO " . mysql_real_escape_string( $tbl ) . " ( sys_created, sys_approved, sys_expires, id, parent_row_id, attr, text, serial ) VALUES ( STR_TO_DATE( '" . date( "d/m/Y" ) . "', '%d/%m/%Y' ), STR_TO_DATE( '" . date( "d/m/Y" ) . "', '%d/%m/%Y' ), STR_TO_DATE( '" . mysql_real_escape_string( '31/12/2099' ) . "', '%d/%m/%Y' ), '" . mysql_real_escape_string( $key ) . "', $parent_row_id, '" . mysql_real_escape_string( $attr ) . "', '" . mysql_real_escape_string( $v ) . "', '" . mysql_real_escape_string( $serial ) . "')"; $setattribute2_result = mysql_query( $setattribute2_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $debug > 0 ) { if ( ! $setattribute2_result ) { echo "SQL " . $setattribute2_sql . "
"; echo mysql_error() . "
"; } } } function _clearattribute( $tbl, $key, $parent_row_id, $attr, $serial ) { echo "_clear " . $key . $parent_row_id . $attr . "[" . $serial . "]"; $clearattribute2_sql = "DELETE FROM " . mysql_real_escape_string( $tbl ) . " WHERE id = '" . mysql_real_escape_string( $key ) . "' AND parent_row_id = " . $parent_row_id . " AND attr = '" . mysql_real_escape_string( $attr ) . "' AND serial = '" . mysql_real_escape_string( $serial ) . "'"; $clearattribute2_result = mysql_query( $clearattribute2_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $debug > 0 ) { if ( ! $clearattribute2_result ) { echo "SQL " . $clearattribute2_sql . "
"; echo mysql_error() . "
"; } } } function setattribute( $tbl, $key, $parent_row_id, $attr, $v ) { setattribute2( $tbl, $key, $parent_row_id, $attr, $v, 0 ); } function setattribute2( $tbl, $key, $parent_row_id, $attr, $v, $serial ) { $debug = 2; echo "setattribute2 " . $tbl . " " . $key . $parent_row_id . $attr . $v . "
"; $setattribute_sql = "SELECT row_id FROM " . mysql_real_escape_string( $tbl ) . " WHERE id = '" . mysql_real_escape_string( $key ) . "' AND attr = '" . mysql_real_escape_string( $attr ) . "' AND serial = '" . mysql_real_escape_string( $serial ) . "' AND ( sys_expires > NOW() )"; $setattribute_count = 0; $setattribute_result = mysql_query( $setattribute_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $setattribute_result ) { while ( $setattribute_row = mysql_fetch_assoc( $setattribute_result )) { $setattribute_count++; $setattribute2_sql = "UPDATE " . mysql_real_escape_string( $tbl ) . " SET text = '" . mysql_real_escape_string( $v ) . "', parent_row_id = " . $parent_row_id . ", sys_sync = 0, sys_updated = STR_TO_DATE( '" . date( "d/m/Y" ) . "', '%d/%m/%Y' ) WHERE row_id = " . $setattribute_row[ "row_id" ]; $setattribute2_result = mysql_query( $setattribute2_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $debug > 0 ) { if ( ! $setattribute2_result ) { echo "SQL " . $setattribute2_sql . "
"; echo mysql_error() . "
"; } } } mysql_free_result( $setattribute_result ); } if ( $setattribute_count == 0 ) { echo "attribute not found - using addattribute for " . $tbl . "." . $key . "." . $attr . "=" . $v . "
"; addattribute( $tbl, $key, $parent_row_id, $attr, $v, $serial ); } } function saveattributes( $cl, $img, $subject, $location ) { $saveattributes_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $saveattributes_count = 0; $saveattributes_result = mysql_query( $saveattributes_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattributes_result ) { while ( $saveattributes_row = mysql_fetch_assoc( $saveattributes_result )) { $saveattributes_count++; if ( $subject != "" ) { setattribute( "attributes", $cl . "/" . $img, $saveattributes_row[ "row_id" ], "subject", $subject ); } if ( $location != "" ) { setattribute( "attributes", $cl . "/" . $img, $saveattributes_row[ "row_id" ], "location", $location ); } } mysql_free_result( $saveattributes_result ); } } global $___table; $___table = ""; global $___attribute_table; $___attribute_table = ""; global $___cl; $___cl = ""; global $___img; $___img = ""; function saveattributesxml( $table, $attribute_table, $cl, $img, $attributes ) { echo "saveattributesxml " . $attributes . "
"; global $___table; $___table = $table; global $___attribute_table; $___attribute_table = $attribute_table; global $___cl; $___cl = $cl; global $___img; $___img = $img; $xml_parser = xml_parser_create(); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 0); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "contents"); if ( ! xml_parse( $xml_parser, $attributes, true )) { die( sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } xml_parser_free( $xml_parser ); } global $___content; $___content = ""; function startElement($parser, $name, $attrs) { global $___content; $___content = ""; echo "start " . $name . "
"; } function endElement($parser, $name) { global $___content; if (( $name != "root" ) && ( strlen( $___content ) > 0 )) { global $___table; global $___attribute_table; global $___cl; global $___img; echo "endElement
"; echo "table " . $___table . "
"; echo "attribute_table " . $___attribute_table . "
"; echo "cl " . $___cl . "
"; echo "img " . $___img . "
"; echo "name " . $name . "
"; echo "content " . $___content . "
"; saveattribute( $___table, $___attribute_table, $___cl, $___img, str_replace( "_", " ", $name ), $___content ); $___content = ""; } } function contents($parser, $data) { global $___content; $___content = $___content . $data; } function savewatermark( $cl, $img, $watermark ) { $saveattributes_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $saveattributes_count = 0; $saveattributes_result = mysql_query( $saveattributes_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattributes_result ) { while ( $saveattributes_row = mysql_fetch_assoc( $saveattributes_result )) { $saveattributes_count++; if ( $watermark != "" ) { setattribute( "attributes", $cl . "/" . $img, $saveattributes_row[ "row_id" ], "watermark", $watermark ); } } mysql_free_result( $saveattributes_result ); } } function savestatus( $cl, $img, $status ) { $saveattributes_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $saveattributes_count = 0; $saveattributes_result = mysql_query( $saveattributes_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattributes_result ) { while ( $saveattributes_row = mysql_fetch_assoc( $saveattributes_result )) { $saveattributes_count++; if ( $status != "" ) { setattribute( "attributes", $cl . "/" . $img, $saveattributes_row[ "row_id" ], "status", $status ); } } mysql_free_result( $saveattributes_result ); } } function savetext( $cl, $img, $text ) { $saveattributes_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $saveattributes_count = 0; $saveattributes_result = mysql_query( $saveattributes_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattributes_result ) { while ( $saveattributes_row = mysql_fetch_assoc( $saveattributes_result )) { $saveattributes_count++; if ( $text != "" ) { setattribute( "attributes", $cl . "/" . $img, $saveattributes_row[ "row_id" ], "text", $text ); } } mysql_free_result( $saveattributes_result ); } } function savebracket( $cl, $img, $bracket, $serial ) { echo "save bracket " . $cl . $img . "=" . $bracket . "
"; $saveattributes_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $saveattributes_count = 0; $saveattributes_result = mysql_query( $saveattributes_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattributes_result ) { while ( $saveattributes_row = mysql_fetch_assoc( $saveattributes_result )) { $saveattributes_count++; if ( $bracket != "" ) { addattribute( "brackets", $cl . "/" . $img, $saveattributes_row[ "row_id" ], "bracket", $bracket, $serial ); } } mysql_free_result( $saveattributes_result ); } } function clearattribute( $cl, $img, $attr, $serial ) { echo "clearattribute " . $cl . $img . "." . $attr . "[" . $serial . "]" . "
"; $clearattribute_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $clearattribute_count = 0; $clearattribute_result = mysql_query( $clearattribute_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $clearattribute_result ) { while ( $clearattribute_row = mysql_fetch_assoc( $clearattribute_result )) { $clearattribute_count++; _clearattribute( "attributes", $cl . "/" . $img, $clearattribute_row[ "row_id" ], $attr, $serial ); } mysql_free_result( $clearattribute_result ); } } function clearbracket( $cl, $img, $serial ) { echo "clearbracket " . $cl . $img . ".bracket, [" . $serial . "]" . "
"; $clearbracket_sql = "SELECT row_id FROM photographs WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $clearbracket_count = 0; $clearbracket_result = mysql_query( $clearbracket_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $clearbracket_result ) { while ( $clearbracket_row = mysql_fetch_assoc( $clearbracket_result )) { $clearbracket_count++; _clearattribute( "brackets", $cl . "/" . $img, $clearbracket_row[ "row_id" ], "bracket", $serial ); } mysql_free_result( $clearbracket_result ); } } function saveattribute( $tbl1, $tbl2, $cl, $img, $attr, $text ) { $saveattribute_sql = "SELECT row_id FROM " . mysql_real_escape_string( $tbl1 ) . " WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( img = '" . mysql_real_escape_string( $img ) . "' ) AND ( sys_expires > NOW() )"; $saveattribute_count = 0; $saveattribute_result = mysql_query( $saveattribute_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattribute_result ) { while ( $saveattribute_row = mysql_fetch_assoc( $saveattribute_result )) { $saveattribute_count++; if ( $text != "" ) { echo "saveattribute " . $cl . $img . $attr . "=" . $text . "
"; setattribute( $tbl2, $cl . "/" . $img, $saveattribute_row[ "row_id" ], $attr, $text ); } } mysql_free_result( $saveattribute_result ); } } function savevaultattribute( $cl, $ref, $attr, $text ) { $saveattributes_sql = "SELECT row_id FROM vault WHERE ( cl = '" . mysql_real_escape_string( $cl ) . "' ) AND ( ref = '" . mysql_real_escape_string( $ref ) . "' ) AND ( sys_expires > NOW() )"; $saveattributes_count = 0; $saveattributes_result = mysql_query( $saveattributes_sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } if ( $saveattributes_result ) { while ( $saveattributes_row = mysql_fetch_assoc( $saveattributes_result )) { $saveattributes_count++; if ( $text != "" ) { setattribute( "vault_attributes", $cl . "/" . $ref, $saveattributes_row[ "row_id" ], $attr, $text ); } } mysql_free_result( $saveattributes_result ); } } ?> logout: " . $_SESSION["authority_user"] . "
"; echo "change password

"; } ?> = 5.1, which improves the performance considerably. Unsharp masking is a traditional darkroom technique that has proven very suitable for digital imaging. The principle of unsharp masking is to create a blurred copy of the image and compare it to the underlying original. The difference in colour values between the two images is greatest for the pixels near sharp edges. When this difference is subtracted from the original image, the edges will be accentuated. The Amount parameter simply says how much of the effect you want. 100 is 'normal'. Radius is the radius of the blurring circle of the mask. 'Threshold' is the least difference in colour values that is allowed between the original and the mask. In practice this means that low-contrast areas of the picture are left unrendered whereas edges are treated normally. This is good for pictures of e.g. skin or blue skies. Any suggenstions for improvement of the algorithm, expecially regarding the speed and the roundoff errors in the Gaussian blur process, are welcome. */ function UnsharpMask($img, $amount, $radius, $threshold) { //////////////////////////////////////////////////////////////////////////////////////////////// //// //// Unsharp Mask for PHP - version 2.1.1 //// //// Unsharp mask algorithm by Torstein Hønsi 2003-07. //// thoensi_at_netcom_dot_no. //// Please leave this notice. //// /////////////////////////////////////////////////////////////////////////////////////////////// // $img is an image that is already created within php using // imgcreatetruecolor. No url! $img must be a truecolor image. // Attempt to calibrate the parameters to Photoshop: if ($amount > 500) $amount = 500; $amount = $amount * 0.016; if ($radius > 50) $radius = 50; $radius = $radius * 2; if ($threshold > 255) $threshold = 255; $radius = abs(round($radius)); // Only integers make sense. if ($radius == 0) { return $img; imagedestroy($img); } $w = imagesx($img); $h = imagesy($img); $imgCanvas = imagecreatetruecolor($w, $h); $imgBlur = imagecreatetruecolor($w, $h); // Gaussian blur matrix: // // 1 2 1 // 2 4 2 // 1 2 1 // ////////////////////////////////////////////////// if (function_exists('imageconvolution')) { // PHP >= 5.1 $matrix = array( array( 1, 2, 1 ), array( 2, 4, 2 ), array( 1, 2, 1 ) ); imagecopy ($imgBlur, $img, 0, 0, 0, 0, $w, $h); imageconvolution($imgBlur, $matrix, 16, 0); } else { // Move copies of the image around one pixel at the time and merge them with weight // according to the matrix. The same matrix is simply repeated for higher radii. for ($i = 0; $i < $radius; $i++) { imagecopy ($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left imagecopymerge ($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right imagecopymerge ($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center imagecopy ($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333 ); // up imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down } } if($threshold>0){ // Calculate the difference between the blurred pixels and the original // and set the pixels for ($x = 0; $x < $w-1; $x++) { // each row for ($y = 0; $y < $h; $y++) { // each pixel $rgbOrig = ImageColorAt($img, $x, $y); $rOrig = (($rgbOrig >> 16) & 0xFF); $gOrig = (($rgbOrig >> 8) & 0xFF); $bOrig = ($rgbOrig & 0xFF); $rgbBlur = ImageColorAt($imgBlur, $x, $y); $rBlur = (($rgbBlur >> 16) & 0xFF); $gBlur = (($rgbBlur >> 8) & 0xFF); $bBlur = ($rgbBlur & 0xFF); // When the masked pixels differ less from the original // than the threshold specifies, they are set to their original value. $rNew = (abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig; $gNew = (abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig; $bNew = (abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig; if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) { $pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew); ImageSetPixel($img, $x, $y, $pixCol); } } } } else{ for ($x = 0; $x < $w; $x++) { // each row for ($y = 0; $y < $h; $y++) { // each pixel $rgbOrig = ImageColorAt($img, $x, $y); $r = (($rgbOrig >> 16) & 0xFF); $g = (($rgbOrig >> 8) & 0xFF); $b = ($rgbOrig & 0xFF); $rgbBlur = ImageColorAt($imgBlur, $x, $y); $r = ($amount * ($r - (($rgbBlur >> 16) & 0xFF))) + $r; if($r>255){$r=255;} elseif($r<0){$r=0;} $g = ($amount * ($g - (($rgbBlur >> 8) & 0xFF))) + $g; if($g>255){$g=255;} elseif($g<0){$g=0;} $b = ($amount * ($b - ($rgbBlur & 0xFF))) + $b; if($b>255){$b=255;} elseif($b<0){$b=0;} $rgb = ($r << 16) + ($g <<8) + $b; if ( $rgb != $rgbOrig ) { ImageSetPixel($img, $x, $y, $rgb); } } } } imagedestroy($imgCanvas); imagedestroy($imgBlur); return $img; } ?> "; } function _PhotographW( $src, &$w, &$h, $watermark ) { $photograph_val = _ImageCache( "photographs/" . $src, $src, $w, $h, $watermark, 10 ); if (( is_null( $photograph_val )) || ( strlen( $photograph_val ) == 0 )) { return "/photographs/" . $src; } return $photograph_val; } function ImageSave( $src, $dest, $w, $h, $watermark, $font_size ) { return _ImageReSize( $src, $dest, $w, $h, $watermark, $font_size, 1 ); } function xmkdir( $s ) { for ( $i=0; $i 1 ) { echo "line 1 " . $width . "x" . $height . " " . $src . "
"; } if (( $h == 0 ) || (( $w > 0 ) && ( $w * $height <= $h * $width ))) { if ( $w > $width ) { $w = $width; } $h = $height * $w / $width; } else { if ( $h > $height ) { $h = $height; } $w = $width * $h / $height; } if (( $w == $width ) && ( ! $force )) { return 1; } if ( $debug > 1 ) { echo "2"; } $image_p = imagecreatetruecolor( $w, $h ); if ( $debug > 1 ) { echo "3"; } $image = imagecreatefromjpeg( $src ); if ( ! $image ) { if ( $debug > 0 ) { echo "imagecreatefromjpeg " . $src . "FAIL
"; } } if ( $debug > 1 ) { echo "4"; } imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $w, $h, $width, $height ); if ( $debug > 1 ) { echo "5"; } imagedestroy($image); if ( $debug > 1 ) { echo "7"; } if ( $debug > 1 ) { echo "TEST ImageReSize " . $watermark; } if (( ! is_null( $watermark )) && ( strlen( $watermark ) > 0 )) { if ( $debug > 1 ) { echo "OK ImageReSize " . $watermark; } $white = imagecolorallocate($image_p, 255, 255, 255); $font = 'arial.ttf'; if ( $debug > 1 ) { echo " w x h="; } if ( $debug > 1 ) { echo $w; } if ( $debug > 1 ) { echo " x "; } if ( $debug > 1 ) { echo $h; } if ( $debug > 1 ) { echo " watermark="; } if ( $debug > 1 ) { echo $w - 2 * $font_size * strlen( $watermark ) / 3; } if ( $debug > 1 ) { echo " x "; } if ( $debug > 1 ) { echo $h - 12; } if ( $debug > 1 ) { echo "-"; } if ( $debug > 1 ) { echo $watermark; } if ( $debug > 1 ) { echo "- fs="; } if ( $debug > 1 ) { echo $font_size; } if ( $debug > 1 ) { echo "- font file="; } if ( $debug > 1 ) { echo $font; } $return_value = imagettftext( $image_p, $font_size, 0, $w - 2 * $font_size * strlen( $watermark ) / 3, $h - 12, $white, $font, $watermark ); if ( $debug > 1 ) { echo "- returned "; } if ( $debug > 1 ) { echo $return_value; } if ( $debug > 1 ) { echo " [ends]
"; } } if ( $debug > 1 ) { echo "start call UnsharpMask " . $w . " x " . $h . "
"; } UnsharpMask( $image_p, 100, 1, 0 ); if ( ! imagejpeg( $image_p, $dest, 90 )) { if ( $debug > 0 ) { echo "imagejpeg FAIL
"; } } if ( $debug > 1 ) { echo "written "; } if ( $debug > 1 ) { echo $dest; } if ( $debug > 1 ) { echo "
"; } if ( $debug > 1 ) { echo "6"; } imagedestroy($image_p); return 0; } function Watermark( $src, $watermark, $font_size ) { list( $w, $h ) = getimagesize( $src ); $image = imagecreatefromjpeg( $src ); $white = imagecolorallocate($image, 255, 255, 255); $font = 'arial'; if ( $debug > 1 ) { echo " w="; } if ( $debug > 1 ) { echo $w; } if ( $debug > 1 ) { echo " "; } if ( $debug > 1 ) { echo $w - 7 * strlen( $watermark ); } if ( $debug > 1 ) { echo " h-"; } if ( $debug > 1 ) { echo $h - 12; } if ( $debug > 1 ) { echo "-"; } if ( $debug > 1 ) { echo $watermark; } if ( $debug > 1 ) { echo "- fs="; } if ( $debug > 1 ) { echo $font_size; } if ( $debug > 1 ) { echo "-"; } if ( $debug > 1 ) { echo $font; } $return_value = imagettftext( $image, $font_size, 0, $w - 8 - 4 * $font_size * strlen( $watermark ) / 5, $h - 12, $white, $font, $watermark ); if ( $debug > 1 ) { echo "-"; } if ( $debug > 1 ) { echo $return_value; } if ( $debug > 1 ) { echo " [ends]"; } imagejpeg( $image, $src, 80 ); if ( $debug > 1 ) { echo "written"; } if ( $debug > 1 ) { echo "6"; } imagedestroy($image); } ?> NOW() )"; $detag_result = mysql_query( $detag_sql ); $detag_link = ""; $detag_link2 = ""; $detag_text = ""; $detag_watermark = getattribute( "attributes", $detag_cl, $pic, "watermark" ); if ( $debug > 1 ) { echo "watermark = " . $detag_watermark; } if ( $detag_row = mysql_fetch_assoc( $detag_result )) { $detag_href = $detag_row[ "href" ]; $detag_width = $siz; $detag_height = 0; if ( $style == "raw" ) { $detag_href = _PhotographW( $detag_row[ "href" ], $detag_width, $detag_height, $detag_watermark ); } else if ( $style == "thumb" ) { if ( $id == NULL ) { $detag_link = ""; } else { $detag_link = ""; } $detag_link2 = ""; $detag_text = getattribute( "attributes", $detag_cl, $pic, "subject" ) . "   " . getattribute( $detag_cl . "/" . $pic, "location" ); $detag_href = _PhotographW( $detag_row[ "href" ], $detag_width, $detag_height, $detag_watermark ); } else { if ( $sizset > 0 ) { if ( $id == NULL ) { $detag_link = ""; } else { $detag_link = ""; } $detag_link2 = ""; $detag_href = _PhotographW( $detag_row[ "href" ], $detag_width, $detag_height, $detag_watermark ); } else { $detag_href = "/photographs/" . $detag_row[ "href" ]; list( $detag_width, $detag_height ) = getimagesize( "photographs/" . $detag_row[ "href" ] ); } $detag_text = $detag_row[ "text" ] . "   " . $detag_row[ "name" ]; } if ( ! $link ) { $detag_link = ""; $detag_link2 = ""; } $border = ""; $nbsp = "  "; if ( $align == "thumb" ) { $nbsp = ""; $border = " border=1"; } if ( $align == "thumb" ) { $align = " width=\"" . $siz . "px\" align=\"left\""; } else if ( $align == "none" ) { $align = ""; } else { $align = " align=\"" . $align . "\""; } $detag_class = ""; if ( $_class ) { $detag_class = " class=\"" . $_class . "\""; } $detag_ratio = 0; if (( $detag_height > 0 ) && ( $detag_width > 0 )) { $detag_ratio = $detag_height / $detag_width; } $detag_img = ""; if ( $style != "raw" ) { $detag_img = " "; if ( $caption ) { $detag_img .= " "; } $detag_img .= "
" . $nbsp . "
" . $detag_link . $detag_img . $detag_link2 . "
" . $nbsp . " " . $detag_link . "" . $detag_text . "" . $detag_link2 . "
"; } } else { $detag_img = "/" . $pic . " not found"; } return $detag_img; } function ____arch( $img, $jpg, $_class, $pg, $company, $subtype, $class, $location, $srch ) { $result = mysql_query( "SELECT img, company, text, subtype, quality FROM archive WHERE ( img = '" . mysql_real_escape_string( $img ) . "' )" ); if ( $row = mysql_fetch_assoc( $result )) { $detag_href = "/photographs/archive/380/" . $jpg; $detag_width = 380; $detag_height = 0; list( $detag_width, $detag_height ) = getimagesize( "photographs/archive/380/" . $jpg ); $detag_text = $row[ "text" ]; $detag_class = ""; if ( $_class ) { $detag_class = " class=\"" . $_class . "\""; } $detag_ratio = 0; if (( $detag_height > 0 ) && ( $detag_width > 0 )) { $detag_ratio = $detag_height / $detag_width; } $align = ""; $detag_link = ""; $detag_link2 = ""; $detag_img = ""; $nbsp = "  "; $detag_img = " "; $detag_img .= " "; $detag_img .= " "; $detag_img .= ""; $detag_img .= "
" . $nbsp . "
" . $detag_link . $detag_img . $detag_link2 . "
" . $nbsp . "
" . $nbsp . " " . $detag_link . "" . $detag_text . "" . $detag_link2 . "
" . $nbsp . "
Purchased images are not watermarked.
For permission to publish images contact photoarchive@rcts.org.uk
A reproduction fee will usually be payable
"; $detag_img .= ""; $detag_img .= ""; $detag_img .= "
"; } return $detag_img; } function img( $s, $align, $siz ) { return __img( $s, "raw", $align, 1, $siz ); } function detag( $s ) { global $photo_id; while ( ! (( $a = strpos( $s, "" )) === FALSE )) { $b = strpos( $s, "", $a ); if ( $b === FALSE ) { break; } $code = substr( $s, $a+10, $b-$a-10 ); $s = substr( $s, 0, $a ) . "" . $code . "" . substr( $s, $b+11 ); } while ( ! (( $a = strpos( $s, "

" )) === FALSE )) { $s = substr( $s, 0, $a ) . "

" . substr( $s, $a+3 ); } while ( ! (( $a = strpos( $s, "

" )) === FALSE )) { $s = substr( $s, 0, $a ) . "

" . substr( $s, $a+3 ); } $a = 0; while ( ! (( $a = strpos( $s, "", $a )) === FALSE )) { $s2 = "
"; $s = substr( $s, 0, $a ) . $s2 . substr( $s, $a+7 ); $a += strlen( "
" ); } $a = 0; while ( ! (( $a = strpos( $s, "

", $a )) === FALSE )) { $s2 = "
"; $s = substr( $s, 0, $a ) . $s2 . substr( $s, $a+7 ); $a += strlen( "
" ); } $a = 0; while ( ! (( $a = strpos( $s, "
", $a ); if ( $b === FALSE ) { break; } $len = 6; while (( $s[ $a+$len ] >= '0' ) && ( $s[ $a+$len ] <= '9' )){ $len++; ; } ; $sizset = 0; if ( $len == 6 ) { $siz = "192"; } else { $siz = substr( $s, $a+6, $len-6 ); $sizset = 1; } while ( $s[ $a+$len ] == ' ' ) { $len++; ; } ; $pic = substr( $s, $a+$len, $b-$a-$len ); $align = "center"; $caption = 1; $link = 1; if ( $detag_style == "thumb" ) { $align = "thumb"; } if ( substr( $pic, 0, 4 ) == "raw " ) { $align = "none"; $detag_style = "raw"; $pic = substr( $pic, 4 ); } else if ( substr( $pic, 0, 5 ) == "none " ) { $align = "none"; $pic = substr( $pic, 5 ); } else if ( substr( $pic, 0, 7 ) == "center " ) { $align = "center"; $pic = substr( $pic, 7 ); } else if ( substr( $pic, 0, 5 ) == "left " ) { $align = "left"; $pic = substr( $pic, 5 ); } else if ( substr( $pic, 0, 6 ) == "right " ) { $align = "right"; $pic = substr( $pic, 6 ); } if ( substr( $pic, 0, 10 ) == "nocaption " ) { $caption = 0; $pic = substr( $pic, 10 ); } if ( substr( $pic, 0, 7 ) == "nolink " ) { $link = 0; $pic = substr( $pic, 7 ); } $photo_id++; $t_photo = NULL; if ( $link > 0 ) { $t_photo = "photo" . $photo_id; } $detag_img = ____img( $t_photo, $pic, $detag_style, $align, $sizset, $siz, $caption, $link, NULL ); $detag_img2 = ____img( NULL, $pic, $detag_style, "center", 1, 1200, $caption, 0, "dynamic_image" ); $photo_cnt++; $s = substr( $s, 0, $a ) . $detag_img . substr( $s, $b+1 ) . "
" . $detag_img2 . "
"; } if ( $photo_cnt > 0 ) { $s = $s . "
"; } return $s; } function mailto( $href, $name ) { if (( $a = strpos( $href, "@" )) === FALSE ) { return "" . $name . ""; } return "" . $name . ""; } function html( $s ) { $a = 0; while (( $a = strpos( $s, "&", $a )) !== FALSE ) { $s = substr( $s, 0, $a ) . "&" . substr( $s, $a+1 ); $a += 5; } return $s; } ?> 15 )) { $s = substr( $s, 0, strlen( $s ) - strlen( $a ) ) . "/19" . substr( $a, 1 ); } $j = 0; for ( $i=0; $i "; $sql = "SELECT photographs.row_id AS row_id, cl, photographs.href AS href, width, photographs.sys_order AS sys_order, photographs.text AS text, DATE_FORMAT( date, '%d/%m/%Y' ) AS dates, name, photographs.img AS img FROM photographs WHERE ( photographs.img = '" . mysql_real_escape_string( $_GET["img"] ) . "' ) AND ( cl = '" . mysql_real_escape_string( $_GET["cl"] ) . "' ) AND ( photographs.sys_expires > NOW() )" . ""; $result = mysql_query( $sql ); if ( $_SESSION["authority_id"] == "webmaster" ) { if ( mysql_errno ) { echo mysql_error(); } } $rowcount = 0; if ( $row = mysql_fetch_assoc( $result )) { $width = $row[ "width" ]; if (( $width == 0 ) || ( $width > 1200 )) { $width = 1200; } echo ""; $watermark = html_entity_decode( getattribute( "attributes", $row[ "cl" ], $row[ "img" ], "watermark" )); if (( is_null( $bracket )) || ( strlen( $bracket ) == 0 )) { $img = $row[ "href" ]; } else { $img = $row[ "cl" ] . "/" . $bracket; } echo doimg4( $img, $width, 800, $watermark ); echo ""; echo ""; $t_row = "row" . $rowcount; if ( $_SESSION["authority_id"] == "webmaster" ) { echo " "; } if (( $isedit ) && ( isset( $_POST[$t_row] ))) { if (( $isedit ) && ( isset( $_POST[$t_row] ))) { echo ""; $save = 1; } else { echo htmlentities( $row[ "cl" ]); } echo " serial:"; if (( $isedit ) && ( isset( $_POST[$t_row] ))) { echo ""; $save = 1; } else { $tmp = $row[ "sys_order" ]; echo htmlentities( $tmp ); } } $subjectorlocation = 0; if (( $_SESSION["authority_id"] == "webmaster" ) && ( ! $isedit )) { echo "
"; echo "Subject"; $select_row_value = getattribute( "attributes", $row[ "cl" ], $row[ "img" ], "subject" ); if ( strpos( $_SERVER['HTTP_USER_AGENT'], "Googlebot" ) === FALSE ) { $selected_array = array(); $text_array = array(); $selected_row_ok = 0; $selected_sql = "SELECT DISTINCT text FROM attributes WHERE ( attr = 'subject' ) AND ( sys_expires > NOW()) AND ( sys_approved < NOW()) ORDER BY text ASC"; $select_result = mysql_query( $selected_sql ); if ( $debug > 0 ) { if ( ! $select_result ) { echo "SQL " . $selected_sql . "
"; echo mysql_error() . "
"; } } while ( $select_row = mysql_fetch_assoc( $select_result )) { $selected_array[] = $select_row[ 'text' ]; $text_array[] = $select_row[ 'text' ]; if ( $select_row_value == $select_row[ 'text' ] ) { $selected_row_ok = 1; } } mysql_free_result( $select_result ); $selected_array_count = count( $selected_array ); if ( $selected_array_count > 0 ) { echo " "; } } else { echo ""; } echo " "; echo "
"; echo "Location"; $select_row_value = getattribute( "attributes", $row[ "cl" ], $row[ "img" ], "location" ); $selected_array = array(); $text_array = array(); $selected_row_ok = 0; $selected_sql = "SELECT DISTINCT text FROM attributes WHERE ( attr = 'location' ) AND ( sys_expires > NOW()) AND ( sys_approved < NOW()) ORDER BY text ASC"; $select_result = mysql_query( $selected_sql ); if ( $debug > 0 ) { if ( ! $select_result ) { echo "SQL " . $selected_sql . "
"; echo mysql_error() . "
"; } } while ( $select_row = mysql_fetch_assoc( $select_result )) { $selected_array[] = $select_row[ 'text' ]; $text_array[] = $select_row[ 'text' ]; if ( $select_row_value == $select_row[ 'text' ] ) { $selected_row_ok = 1; } } mysql_free_result( $select_result ); $selected_array_count = count( $selected_array ); ?> 40 ) { echo " "; ?> " name="" autocomplete="off" "; ?>
" style="display:none;position:absolute;height:200px;left:0px;top:0px;overflow:auto;padding:0px;background:white;border:2px solid #2266AA;z-index:1" > "; } else if ( $selected_array_count > 0 ) { echo " "; } else { echo " "; } echo "
"; echo "Text"; $select_row_value = getattribute( "attributes", $row[ "cl" ], $row[ "img" ], "text" ); echo " "; echo "
"; if ( ! $isedit ) { echo " "; echo " "; echo " "; } echo $comment_row[ "text2" ] . "
"; $subjectorlocation++; } else if ( ! $isedit ) { $show_subject = getattribute( "attributes", $row[ "cl" ], $row[ "img" ], "subject" ); if ( $show_subject != "" ) { echo "" . $show_subject . ""; $subjectorlocation++; } $show_location = getattribute( "attributes", $row[ "cl" ], $row[ "img" ], "location" ); if ( $show_location != "" ) { if ( $subjectorlocation > 0 ) { echo " "; } echo "" . $show_location . ""; $subjectorlocation++; } } else if (( $row[ "location" ] != "" ) || (( $isedit ) && ( isset( $_POST[$t_row] )))) { if (( $isedit )) { echo "
"; echo "Location"; $select_row_value = $row[ "location" ]; if ( strpos( $_SERVER['HTTP_USER_AGENT'], "Googlebot" ) === FALSE ) { $selected_array = array(); $text_array = array(); $selected_row_ok = 0; $selected_sql = "SELECT DISTINCT text FROM attributes WHERE ( attr = 'location' ) AND ( sys_expires > NOW()) AND ( sys_approved < NOW()) ORDER BY text ASC"; $select_result = mysql_query( $selected_sql ); if ( $debug > 0 ) { if ( ! $select_result ) { echo "SQL " . $selected_sql . "
"; echo mysql_error() . "
"; } } while ( $select_row = mysql_fetch_assoc( $select_result )) { $selected_array[] = $select_row[ 'text' ]; $text_array[] = $select_row[ 'text' ]; if ( $select_row_value == $select_row[ 'text' ] ) { $selected_row_ok = 1; } } mysql_free_result( $select_result ); $selected_array_count = count( $selected_array ); if ( $selected_array_count > 0 ) { echo " "; } } else { echo ""; } echo " "; echo "
"; if ( ! $isedit ) { echo " "; } } $subjectorlocation++; } if ( $subjectorlocation > 0 ) { echo "
"; } if ( $row[ "name" ] == '' ) { $x = strlen( $row["text"] ); } else { $x = strpos( $row["text"], $row["name"] ); if ( $x === FALSE ) { $x = strpos( htmlentities( $row["text"] ), $row["name"] ); } if ( $x === FALSE ) { $x = strlen( $row["text"] ); } } if (( $isedit ) && ( isset( $_POST[$t_row] ))) { echo ""; $save = 1; } else { echo substr( $row[ "text" ], 0, $x ); } echo "
"; if ( $row[ "name" ] != '' ){ $x = strpos( $row[ "name" ], " (" ); if ( $x === FALSE ) { $x = strlen( $row[ "name" ] ); } echo ""; echo substr( $row[ "name" ], 0, $x ); echo ""; } echo " "; if ( $row[ "dates" ] != '00/00/0000' ) { list( $day, $month, $year) = split("/", $row[ "dates" ] ); $dt = mktime( 0, 0, 0, $month, $day, $year ); if (( strpos( $row[ "text" ], date( "jS F Y", $dt )) === FALSE ) && ( strpos( $row[ "text" ], date( "d/m/", $dt )) === FALSE )) { echo $row[ "dates" ]; } } echo "\n"; } mysql_free_result( $result ); $rowcount++; ?>