diff --git a/foto_check.php b/foto_check.php index 989249a..ad93c47 100644 --- a/foto_check.php +++ b/foto_check.php @@ -75,12 +75,4 @@ echo ' - ' .$I18N->msg( 'purge_cache') . ''; } -function print_debug($str) -{ - global $is_debug; - if(isset($is_debug) && $is_debug) - { - echo $str."\n"; - } -} ?> \ No newline at end of file diff --git a/foto_range.php b/foto_range.php index 7d2399a..3789bb2 100644 --- a/foto_range.php +++ b/foto_range.php @@ -50,15 +50,6 @@ echo ''. $I18N->msg( 'check_users') . ''; echo ' - by Flominator'; echo $I18N->getFooterLine( TSINT_HELP_ALL ); - -function print_debug($str) -{ - global $is_debug; - if(isset($is_debug) && $is_debug) - { - echo $str."\n"; - } -} function log_search () { diff --git a/shared_inc/wiki_functions.inc.php b/shared_inc/wiki_functions.inc.php index dde8300..13a7c7d 100644 --- a/shared_inc/wiki_functions.inc.php +++ b/shared_inc/wiki_functions.inc.php @@ -1 +1 @@ -".$server.$page.":\n"; echo "Fehler $errno - $errstr
\n"; } else { if (!defined ('USERAGENT')) { define('USERAGENT', "script by de_user_Flominator"); } $buf = ""; $http_command = "GET $page HTTP/1.0\r\nHost: $server \r\nUser-Agent: ".USERAGENT."\r\n\r\n"; //echo $http_command; fputs ($fp,$http_command); while (!feof($fp)) { $buf.= fgets($fp,128); } fclose($fp); //$buf2=getheaders($buf); //preg_match('@Location: http://(.*)/(.*)\r\n@iU',$buf2,$hit); /* Hit is undefined... if($hit[1]!="" && (!$ignore_redir)) { $buf=get_request($hit[1],"/".$hit[2]); } */ // flush(); // Commented out by Lupo, 2010-05-10. This flushes the output buffer and causes // the "Cannot modify header information - headers already sent" error! return $buf; } } //http://www.php-faq.de/q-code-post.html function post_request($host, $path, $referer, $data_to_send) { $fp = fsockopen($host, 80); //printf("Open!\n"); fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Referer: $referer\r\n"); if (!defined ('USERAGENT')) { define('USERAGENT', "script by de_user_Flominator"); } fputs($fp, "User-Agent: ".USERAGENT."\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data_to_send); //printf("Sent!\n"); while(!feof($fp)) { $res .= fgets($fp, 128); } //printf("Done!\n"); fclose($fp); return $res; } function name_in_url ($name) { $name = str_replace(' ', '_', $name); $name = urlencode($name); return $name; } //fetches all versions function get_history($server, $articleenc, $limit=50, $offset="") { if($offset=="") { $offset = strftime("%Y%m%d%H%M%S"); } $historyurl = "http://".$server."/w/index.php?title=".$articleenc."&action=history&limit=$limit&offset=$offset"; return get_request($server, $historyurl); } function create_images($was_found) { if($was_found) { //$bild = imagecreatefrompng('shared_inc/ok.png'); $hoch = 15; $breit = 25; $bild = imagecreate($breit, $hoch); $hg = imagecolorallocate($bild, 255,255,255); imagefilledrectangle($bild, 1, 1, $breit, $hoch, $hg); $font = 5; $farbe = imagecolorallocate($bild, 0,255,0); $meldung = "ok"; } else { $hoch = 30; $breit = 50; $bild = imagecreate($breit, $hoch); $hg = imagecolorallocate($bild, 255,255,255); imagefilledrectangle($bild, 1, 1, $breit, $hoch, $hg); $font = 5; //$bild = imagecreatefrompng('shared_inc/no.png'); $farbe = imagecolorallocate($bild, 255, 0,0); $meldung = "fehlt"; } imagestring($bild, $font, 5, 5, $meldung, $farbe); imagepng($bild); imagedestroy($bild); } function datedrop_with_months ($name, $varanf="", $intab=true, $jahranf="", $jahrbis="", $seljahr="", $selmon="", $seltag="", $the_months, $date_format) { if($jahranf=="") { $jahranf = date("Y"); } if($jahrbis=="") { $jahrbis = date("Y")+1; } if($seltag=="") { $seltag=date("dSSS"); } if($selmon=="") { $selmon=date("m"); } if($seljahr=="") { $seljahr=date("Y"); } if($intab==true) { $headers = "\n"; $headers.="\n"; $headers.="$name\n"; $headers.="\n"; $headers.="\n"; $trailers = " \n\n"; } $date_format = strtoupper($date_format); if($date_format=="" || !stristr($date_format, "DD") || !stristr($date_format, "MM") || !stristr($date_format, "YYYY") ) { $date_format = "DD-MM-YYYY"; } echo $headers; $drop_down_text = str_replace("DD", dropdown ($varanf."tag", 1, 31, 1, "", "", $seltag), $date_format); $drop_down_text = str_replace("MM", array_drop ($varanf."mon", $the_months, 1, "", "", $the_months[($selmon-1)]), $drop_down_text); $drop_down_text = str_replace("YYYY", dropdown ($varanf."jahr", $jahranf, $jahrbis, 1, "", "", $seljahr), $drop_down_text); echo $drop_down_text; echo $trailers; } /** @brief creates a select box with integers . e.g. for use in datum form fields @param $name name attribute of the form field @param $start integer to begin at @param $ende integer to end at @param $ruck step size @param $size size/length of the form field @param $onchange javascript function to run on change */ function dropdown ($name, $start, $ende, $ruck=0, $size="", $onchange="", $selected="") { $result = ""; $vorne = ""; for($i=0;$i<$ruck;$i++) { $vorne = $vorne." "; } if($size!='') { $result.= $vorne."$startwert\n"; } for($i=0;$i$werte[$i]\n"; } else { $result.= $vorne." \n"; } } $result.= $vorne."\n"; return $result; } function analyse_array($arr) { echo ""; echo count($arr)." Element(e)
"; $keys = array_keys($arr); foreach($keys as $key) { echo "Array[".$key."]=".$arr[$key]."
"; if(is_array($arr[$key])) { analyse_array($arr[$key]); } } echo "
"; } function chop_content($art_text) { //echo "chopping text"; $content_begins = strpos($art_text, '
'); $content_ends = strpos($art_text, '
'); $content = substr($art_text, $content_begins, $content_ends-$content_begins); //echo "

start content

$content

end content

"; return str_replace('[bearbeiten]', '', $content); } function set_up_media_wiki_input_fields($summary, $button) { $time_on_wm_server = time() - 7*60*60 ; //change according to http://www.zeitzonen.de/central_standard_time_cst_-_usa.html echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; } function extract_template_parameter($template_text, $parameter) { $str_return = ""; if(stristr($template_text, $parameter)) { $index_of_label = strpos($template_text, $parameter); $index_of_equal_sign = strpos($template_text, "=", $index_of_label); $index_of_pipe_sign = strpos($template_text, "|" , $index_of_label); $index_of_template_end_sign = strpos($template_text, "}" , $index_of_label); $index_of_sign_after_parameter = $index_of_pipe_sign ; if($index_of_sign_after_parameter == 0 || $index_of_template_end_sign < $index_of_pipe_sign) { $index_of_sign_after_parameter = $index_of_template_end_sign; } $length_of_location = $index_of_sign_after_parameter - $index_of_equal_sign -2; // print_debug("location_label = $parameter"); // print_debug("index_of_label = $index_of_label"); // print_debug("index_of_equal_sign = $index_of_equal_sign"); // print_debug("index_of_pipe_sign = $index_of_pipe_sign"); // print_debug("index_of_template_end_sign = $index_of_template_end_sign"); // print_debug("index_of_sign_after_parameter= index_of_sign_after_parameter"); // print_debug("length_of_location = $length_of_location"); $str_return = substr($template_text, $index_of_equal_sign+1, $length_of_location); } return $str_return ; } function extract_link_target($source_part, $remove_namespace=false) { $ret_val = false; if(stristr($source_part, "[[") && stristr($source_part, "]]")) { //echo "source-part= $source_part"; $index_after_opening_brackets = strpos($source_part, "[[") + strlen("[["); //echo "index_opening_brackets= $index_opening_brackets"; $index_before_closing_brackets = strpos($source_part, "]]"); // echo "index_closing_brackets= $index_closing_brackets"; $index_after_colon = strpos($source_part, ":") + strlen(":");; //echo "index_colon= $index_colon"; $index_before_pipe = strpos($source_part, "|"); // echo "index_pipe= $index_pipe"; $beginning = $index_after_opening_brackets; //echo "beginning= $beginning"; if($index_after_colon >1 && $remove_namespace==true) { $beginning = $index_after_colon; } //echo "beginning= $beginning"; $ending = $index_before_closing_brackets; //echo "ending= $ending"; if($index_before_pipe > 0 && $index_before_pipe < $ending) { $ending = $index_before_pipe; } //echo "ending= $ending"; $ret_val = substr($source_part, $beginning, $ending-$beginning); } return $ret_val; } ?> \ No newline at end of file +".$server.$page.":\n"; echo "Fehler $errno - $errstr
\n"; } else { if (!defined ('USERAGENT')) { define('USERAGENT', "script by de_user_Flominator"); } $buf = ""; $http_command = "GET $page HTTP/1.0\r\nHost: $server \r\nUser-Agent: ".USERAGENT."\r\n\r\n"; //echo $http_command; fputs ($fp,$http_command); while (!feof($fp)) { $buf.= fgets($fp,128); } fclose($fp); //$buf2=getheaders($buf); //preg_match('@Location: http://(.*)/(.*)\r\n@iU',$buf2,$hit); /* Hit is undefined... if($hit[1]!="" && (!$ignore_redir)) { $buf=get_request($hit[1],"/".$hit[2]); } */ // flush(); // Commented out by Lupo, 2010-05-10. This flushes the output buffer and causes // the "Cannot modify header information - headers already sent" error! return $buf; } } //http://www.php-faq.de/q-code-post.html function post_request($host, $path, $referer, $data_to_send) { $fp = fsockopen($host, 80); //printf("Open!\n"); fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Referer: $referer\r\n"); if (!defined ('USERAGENT')) { define('USERAGENT', "script by de_user_Flominator"); } fputs($fp, "User-Agent: ".USERAGENT."\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data_to_send); //printf("Sent!\n"); while(!feof($fp)) { $res .= fgets($fp, 128); } //printf("Done!\n"); fclose($fp); return $res; } function name_in_url ($name) { $name = str_replace(' ', '_', $name); $name = urlencode($name); return $name; } //fetches all versions function get_history($server, $articleenc, $limit=50, $offset="") { if($offset=="") { $offset = strftime("%Y%m%d%H%M%S"); } $historyurl = "http://".$server."/w/index.php?title=".$articleenc."&action=history&limit=$limit&offset=$offset"; return get_request($server, $historyurl); } function create_images($was_found) { if($was_found) { //$bild = imagecreatefrompng('shared_inc/ok.png'); $hoch = 15; $breit = 25; $bild = imagecreate($breit, $hoch); $hg = imagecolorallocate($bild, 255,255,255); imagefilledrectangle($bild, 1, 1, $breit, $hoch, $hg); $font = 5; $farbe = imagecolorallocate($bild, 0,255,0); $meldung = "ok"; } else { $hoch = 30; $breit = 50; $bild = imagecreate($breit, $hoch); $hg = imagecolorallocate($bild, 255,255,255); imagefilledrectangle($bild, 1, 1, $breit, $hoch, $hg); $font = 5; //$bild = imagecreatefrompng('shared_inc/no.png'); $farbe = imagecolorallocate($bild, 255, 0,0); $meldung = "fehlt"; } imagestring($bild, $font, 5, 5, $meldung, $farbe); imagepng($bild); imagedestroy($bild); } function datedrop_with_months ($name, $varanf="", $intab=true, $jahranf="", $jahrbis="", $seljahr="", $selmon="", $seltag="", $the_months, $date_format) { if($jahranf=="") { $jahranf = date("Y"); } if($jahrbis=="") { $jahrbis = date("Y")+1; } if($seltag=="") { $seltag=date("dSSS"); } if($selmon=="") { $selmon=date("m"); } if($seljahr=="") { $seljahr=date("Y"); } if($intab==true) { $headers = "\n"; $headers.="\n"; $headers.="$name\n"; $headers.="\n"; $headers.="\n"; $trailers = " \n\n"; } $date_format = strtoupper($date_format); if($date_format=="" || !stristr($date_format, "DD") || !stristr($date_format, "MM") || !stristr($date_format, "YYYY") ) { $date_format = "DD-MM-YYYY"; } echo $headers; $drop_down_text = str_replace("DD", dropdown ($varanf."tag", 1, 31, 1, "", "", $seltag), $date_format); $drop_down_text = str_replace("MM", array_drop ($varanf."mon", $the_months, 1, "", "", $the_months[($selmon-1)]), $drop_down_text); $drop_down_text = str_replace("YYYY", dropdown ($varanf."jahr", $jahranf, $jahrbis, 1, "", "", $seljahr), $drop_down_text); echo $drop_down_text; echo $trailers; } /** @brief creates a select box with integers . e.g. for use in datum form fields @param $name name attribute of the form field @param $start integer to begin at @param $ende integer to end at @param $ruck step size @param $size size/length of the form field @param $onchange javascript function to run on change */ function dropdown ($name, $start, $ende, $ruck=0, $size="", $onchange="", $selected="") { $result = ""; $vorne = ""; for($i=0;$i<$ruck;$i++) { $vorne = $vorne." "; } if($size!='') { $result.= $vorne."$startwert\n"; } for($i=0;$i$werte[$i]\n"; } else { $result.= $vorne." \n"; } } $result.= $vorne."\n"; return $result; } function analyse_array($arr) { echo ""; echo count($arr)." Element(e)
"; $keys = array_keys($arr); foreach($keys as $key) { echo "Array[".$key."]=".$arr[$key]."
"; if(is_array($arr[$key])) { analyse_array($arr[$key]); } } echo "
"; } function chop_content($art_text) { //echo "chopping text"; $content_begins = strpos($art_text, '
'); $content_ends = strpos($art_text, '
'); $content = substr($art_text, $content_begins, $content_ends-$content_begins); //echo "

start content

$content

end content

"; return str_replace('[bearbeiten]', '', $content); } function set_up_media_wiki_input_fields($summary, $button) { $time_on_wm_server = time() - 7*60*60 ; //change according to http://www.zeitzonen.de/central_standard_time_cst_-_usa.html echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; } function extract_template_parameter($template_text, $parameter) { $str_return = ""; if(stristr($template_text, $parameter)) { $index_of_label = strpos($template_text, $parameter); $index_of_equal_sign = strpos($template_text, "=", $index_of_label); $index_of_pipe_sign = strpos($template_text, "|" , $index_of_label); $index_of_template_end_sign = strpos($template_text, "}" , $index_of_label); $index_of_sign_after_parameter = $index_of_pipe_sign ; if($index_of_sign_after_parameter == 0 || $index_of_template_end_sign < $index_of_pipe_sign) { $index_of_sign_after_parameter = $index_of_template_end_sign; } $length_of_location = $index_of_sign_after_parameter - $index_of_equal_sign -2; // print_debug("location_label = $parameter"); // print_debug("index_of_label = $index_of_label"); // print_debug("index_of_equal_sign = $index_of_equal_sign"); // print_debug("index_of_pipe_sign = $index_of_pipe_sign"); // print_debug("index_of_template_end_sign = $index_of_template_end_sign"); // print_debug("index_of_sign_after_parameter= index_of_sign_after_parameter"); // print_debug("length_of_location = $length_of_location"); $str_return = substr($template_text, $index_of_equal_sign+1, $length_of_location); } return $str_return ; } function extract_link_target($source_part, $remove_namespace=false) { $ret_val = false; if(stristr($source_part, "[[") && stristr($source_part, "]]")) { //echo "source-part= $source_part"; $index_after_opening_brackets = strpos($source_part, "[[") + strlen("[["); //echo "index_opening_brackets= $index_opening_brackets"; $index_before_closing_brackets = strpos($source_part, "]]"); // echo "index_closing_brackets= $index_closing_brackets"; $index_after_colon = strpos($source_part, ":") + strlen(":");; //echo "index_colon= $index_colon"; $index_before_pipe = strpos($source_part, "|"); // echo "index_pipe= $index_pipe"; $beginning = $index_after_opening_brackets; //echo "beginning= $beginning"; if($index_after_colon >1 && $remove_namespace==true) { $beginning = $index_after_colon; } //echo "beginning= $beginning"; $ending = $index_before_closing_brackets; //echo "ending= $ending"; if($index_before_pipe > 0 && $index_before_pipe < $ending) { $ending = $index_before_pipe; } //echo "ending= $ending"; $ret_val = substr($source_part, $beginning, $ending-$beginning); } return $ret_val; } function print_debug($str) { global $is_debug; if(isset($is_debug) && $is_debug) { echo $str."\n"; } } ?> \ No newline at end of file