function parse_palmdesktop($file, $exc_private = 1)
{
    exec(EscapeShellCmd("perl tools/palm_datebook.pl {$file} {$exc_private}"), $Entries);
    $data = array();
    while (list($line_num, $line) = each($Entries)) {
        $data[] = ParseLine($line);
    }
    return $data;
}
function shellclean($array, $index, $maxlength)
{
    if (isset($array["{$index}"])) {
        $input = substr($array["{$index}"], 0, $maxlength);
        $input = EscapeShellCmd($input);
        return $input;
    }
    return NULL;
}
Example #3
0
/**
 * filechecks_gz(0 - Verify the integrity of a .gz file.
 *
 * @param		string	The name of the gz file to check.
 */
function filechecks_gz($filename)
{
    exec("gunzip -t {$GLOBALS['FTPINCOMING_DIR']}/" . EscapeShellCmd($filename), $output, $ret);
    if ($ret) {
        for ($i = 0; $i < count($output); $i++) {
            $exitout .= "<br />" . $output[$i] . "\n";
        }
        exit_error("Failed gzip integrity check.", "Output follows: <p>{$exitout}</p>");
    }
}
	public function clean ($input, $maxlength) {
		$input = substr($input, 0, $maxlength);
		$input = EscapeShellCmd($input);
		return ($input);
	}
 function ManPageLookup($cmd = "")
 {
     $this->command = $cmd == "" ? "man" : $cmd;
     // make sure not to include any /, <, ;, etc
     $this->command = eregi_replace("[^a-zA-Z0-9 -]", "", $this->command);
     $exe = "man " . EscapeShellCmd($this->command);
     $pipe = popen($exe, "r");
     if (!$pipe) {
         print "<p>Cannot open a pipe to the man page.</p>";
         return;
     }
     $this->raw_data = "";
     $this->output = "";
     while (!feof($pipe)) {
         $s = fgets($pipe, 512);
         for ($i = 0; $i < strlen($s); $i++) {
             switch (ord($s[$i])) {
                 case 8:
                     break;
                 default:
                     if (ord($s[$i + 1]) == 8) {
                         break;
                     }
                     if (ord($s[$i - 1]) == 8) {
                         if ($s[$i - 2] == $s[$i]) {
                             if ($italic) {
                                 $this->output .= "</i></font>";
                                 $italic = 0;
                             }
                             if ($bold) {
                                 $this->raw_data .= $s[$i];
                                 $this->output .= htmlentities($s[$i]);
                             } else {
                                 $this->raw_data .= $s[$i];
                                 $this->output .= "<b>" . htmlentities($s[$i]);
                                 $bold = 1;
                             }
                         } else {
                             if ($s[$i - 2] == '_') {
                                 if ($bold) {
                                     $this->output .= "</b>";
                                     $bold = 0;
                                 }
                                 if ($italic) {
                                     $this->raw_data .= $s[$i];
                                     $this->output .= htmlentities($s[$i]);
                                 } else {
                                     $this->raw_data .= $s[$i];
                                     $this->output .= "<font color=\"#0000FF\"><i>" . htmlentities($s[$i]);
                                     $italic = 1;
                                 }
                             }
                         }
                     } else {
                         if ($italic) {
                             $this->output .= "</i></font>";
                             $italic = 0;
                         }
                         if ($bold) {
                             $this->output .= "</b>";
                             $bold = 0;
                         }
                         $this->raw_data .= $s[$i];
                         $this->output .= htmlentities($s[$i]);
                     }
                     break;
             }
         }
     }
     pclose($pipe);
     $this->output = ereg_replace("\n\n\n+", "\n\n", $this->output);
 }
 function getRevisionTree($file)
 {
     global $conf;
     // run rlog
     $f = EscapeShellCmd($file);
     $rlog = $conf['bin']['rlog'];
     exec("{$rlog} {$f},v", $log);
     $info = null;
     // retrieve head info
     for ($i = 0; $i < count($log) && !ereg("^-+\$", $log[$i]); $i++) {
         if (ereg("^([^:]+): *(.*)\$", $log[$i], $regs)) {
             $key = ereg_replace(" ", "_", strtoupper($regs[1]));
             switch ($regs[1]) {
                 case 'head':
                 case 'branch':
                     $info['branch'] = $regs[2];
                     break;
                 case 'symbolic names':
                     while (ereg("^\t([^:]*): (.*)\$", $log[++$i], $regs)) {
                         $info['tagsr'][$regs[1]] = $regs[2];
                         if (!is_array($info['tagsr'][$regs[2]])) {
                             $info['tagsr'][$regs[2]] = array();
                         }
                         array_push($info['tagsr'][$regs[2]], $regs[1]);
                     }
                     $i--;
                     break;
                 case 'description':
                     while (++$i < count($log) && !ereg("^-+\$", $log[$i])) {
                         $info[$key] .= ereg_replace("\n\$", "", $log[$i]);
                     }
                     $i--;
                     break;
             }
         }
     }
     $i++;
     // retrieve log info
     while ($i < count($log)) {
         // pick revision number
         if (!ereg("^revision *([0-9.]+)\$", $log[$i], $regs)) {
             break;
         }
         $rev = $regs[1];
         $i++;
         // pick IDs
         if (ereg("^date: ([0-9/]+ [0-9:]+);.* author: ([^;]+);.*\$", $log[$i], $regs)) {
             $info['log'][$rev]['date'] = $regs[1];
             $info['log'][$rev]['auth'] = $regs[2];
         }
         if (ereg("lines: (.+)", $log[$i], $regs)) {
             $info['log'][$rev]['lines'] = $regs[1];
         }
         $i++;
         // pick branch
         while ($i < count($log) && ereg("^branches: *([0-9.]+)", $log[$i], $regs)) {
             $info['log'][$rev]['branches'] = array();
             foreach (split(";", $regs[1]) as $branches) {
                 array_push($info['log'][$rev]['branches'], trim($branches));
             }
             $i++;
         }
         // pick comment lines
         while ($i < count($log) && !ereg("^(-+|=+)\$", $log[$i])) {
             $info['log'][$rev]['comment'] .= $log[$i++] . "\n";
         }
         $i++;
     }
     // sort log entries
     uksort($info['log'], "{$this->rrevcmp}");
     return $info;
 }
function picture_resize($key, $data, $args = array())
{
    set_time_limit(30);
    global $site;
    global $timer;
    # new by Pavel, image_mode 1 if imagemagick, 0 if gdi
    $mode = $site->CONF['image_mode'];
    $uploaded_file = $data['tmp_name'];
    if ($args['file']) {
        $uploaded_file = $args['file'];
    }
    $uploaded_image = $uploaded_file . "_image";
    if ($args['image']) {
        $uploaded_image = $args['image'];
    }
    $uploaded_thumb = $uploaded_file . "_thumb";
    if ($args['thumb']) {
        $uploaded_thumb = $args['thumb'];
    }
    $thumb_width = $site->CONF['thumb_width'];
    if ($args['thumb_width']) {
        $thumb_width = $args['thumb_width'];
    }
    $image_width = $site->CONF['image_width'];
    if ($args['image_width']) {
        $image_width = $args['image_width'];
    }
    if ($mode == "imagemagick") {
        $imagemagick_path = $site->CONF['imagemagick_path'];
        $imagemagick_path = trim($imagemagick_path);
        if ($imagemagick_path) {
            if (strstr(PHP_OS, "WIN")) {
                $imagemagick_path = "\"" . $imagemagick_path . "\"\\";
            } else {
                # slash l�ppu!
                if (!preg_match("/\\/\$/", $imagemagick_path)) {
                    $imagemagick_path .= "/";
                }
                $imagemagick_path = preg_replace("/\\s+/", "_", $imagemagick_path);
            }
        }
        $ident_exec = $imagemagick_path . "identify " . $uploaded_file;
        $ident_exec = strstr(PHP_OS, "WIN") ? $ident_exec : EscapeShellCmd($ident_exec);
        # old: $fileinfo = system($ident_exec);
        # new by Evgeny:
        ob_start();
        $tmp = system($ident_exec);
        $fileinfo = ob_get_contents();
        ob_end_clean();
        $site->debug->msg("Using Imagemagick for image proccessing.");
        $site->debug->msg("Path to identify executable: " . $imagemagick_path);
        $site->debug->msg("Identify: " . $ident_exec . "; " . $fileinfo);
        $site->debug->msg("File info for image: " . $fileinfo . "; Got: identify " . $uploaded_file);
        ##############################
        # if file identified successfully
        if (preg_match("/\\s(\\d+)x(\\d+)/i", $fileinfo, $matches)) {
            $cur_x = $matches[1];
            $cur_y = $matches[2];
            $site->debug->msg("Found: {$cur_x} x {$cur_y}");
            ###############################
            # Image is larger than thumb measures - will resize
            if ($cur_x > $thumb_width) {
                ############
                # find image size
                $image_rate = max($cur_x / $image_width, $cur_y / $image_width);
                $site->debug->msg("Image rate is {$image_rate}");
                $new_x = round($cur_x / $image_rate);
                $new_y = round($cur_y / $image_rate);
                ############
                # convert to image size
                $image_exec = $imagemagick_path . "convert -size " . $new_x . "x" . $new_y . " {$uploaded_file} -geometry " . $new_x . "x" . $new_y . " +profile '*' " . $uploaded_image;
                $image_exec = strstr(PHP_OS, "WIN") ? $image_exec : EscapeShellCmd($image_exec);
                $exec = system($image_exec);
                $site->debug->msg("Konverteeri: {$image_exec}: {$exec}");
                #print "<br>time after convert:".$timer->get_aeg()." <br>";
                ############
                # read image
                if (file_exists($uploaded_image)) {
                    $fd = fopen($uploaded_image, "rb");
                    $cs_image = fread($fd, filesize($uploaded_image));
                    fclose($fd);
                    #Is unlinked below
                    #unlink("$uploaded_file_image");
                } else {
                    $cs_image = "";
                }
                $site->debug->msg("image size: " . strlen($cs_image));
                ############
                # find thumb size
                $thumb_rate = max($cur_x / $thumb_width, $cur_y / $thumb_width);
                $site->debug->msg("Thumb rate is {$thumb_rate}");
                $new_x = round($cur_x / $thumb_rate);
                $new_y = round($cur_y / $thumb_rate);
                ############
                # convert to thumbnail size
                if (file_exists($uploaded_image)) {
                    //Hack kuna imagemagik konverteerib m�nikord v�iksed pildid valesti
                    $thumb_exec = $imagemagick_path . "convert -size " . $new_x . "x" . $new_y . " " . $uploaded_image . " -geometry " . $new_x . "x" . $new_y . " +profile '*' " . $uploaded_thumb;
                    $thumb_exec = strstr(PHP_OS, "WIN") ? $thumb_exec : EscapeShellCmd($thumb_exec);
                    $exec = system($thumb_exec);
                    //if(!$args['no_unlink']) unlink($uploaded_image);
                    unlink($uploaded_image);
                } else {
                    //vana kood
                    $thumb_exec = $imagemagick_path . "convert -size " . $new_x . "x" . $new_y . " {$uploaded_file} -geometry " . $new_x . "x" . $new_y . " +profile '*' " . $uploaded_thumb;
                    $thumb_exec = strstr(PHP_OS, "WIN") ? $thumb_exec : EscapeShellCmd($thumb_exec);
                    $exec = system($thumb_exec);
                }
                $site->debug->msg("{$thumb_exec}: {$exec}");
                ############
                # read thumb
                if (file_exists($uploaded_thumb)) {
                    $fd = fopen($uploaded_thumb, "rb");
                    $cs_thumb = fread($fd, filesize($uploaded_thumb));
                    fclose($fd);
                    //if(!$args['no_unlink']) unlink($uploaded_thumb);
                    unlink($uploaded_thumb);
                } else {
                    $cs_thumb = "";
                }
                $site->debug->msg("thumb size: " . strlen($cs_thumb));
            } else {
                $site->debug->msg("Thumb not resized: ");
                //Read file
                if (file_exists("{$uploaded_file}")) {
                    $fd = fopen("{$uploaded_file}", "rb");
                    $cs_thumb = fread($fd, filesize("{$uploaded_file}"));
                    fclose($fd);
                    $cs_image = $cs_thumb;
                } else {
                    $cs_thumb = "";
                    $cs_image = "";
                }
                $site->debug->msg("If identyfy");
            }
            $site->debug->msg("If data");
            ###############################
            # save also original file, if needed
            if ($site->CONF['original_picture_saved'] == 1) {
                ############
                # read original image
                if (file_exists($uploaded_file)) {
                    $fd = fopen($uploaded_file, "rb");
                    $cs_orig = fread($fd, filesize($uploaded_file));
                    fclose($fd);
                }
            } else {
                $cs_orig = "";
            }
            ###############################
            # delete uploaded file
            if (!$args['no_unlink']) {
                unlink($uploaded_file);
            }
            ###############################
            # return image data
            $img_array = array("thumb" => $cs_thumb, "image" => $cs_image, "orig" => $cs_orig);
            return $img_array;
        } else {
            $site->debug->msg("File not identified");
            if (!$args['no_unlink']) {
                unlink($uploaded_file);
            }
        }
        return 0;
    } else {
        if ($mode == "gd lib") {
            ##############################
            # if file identified successfully
            $imagesize = getimagesize($uploaded_file);
            # if we have JPEG pic and GD functions are ok - proceed
            if ($imagesize[2] == 2 and (function_exists('getimagesize') and function_exists('imageCreateTrueColor') and function_exists('imagecreatefromjpeg') and function_exists('imagecopyresampled') and function_exists('imagesx') and function_exists('imagesy'))) {
                $site->debug->msg("Using GD for image proccessing.");
                $cur_x = $imagesize[0];
                $cur_y = $imagesize[1];
                $site->debug->msg("Found: {$cur_x} x {$cur_y}");
                ###############################
                # Image is larger than thumb measures - will resize
                if ($cur_x > $thumb_width) {
                    ############
                    # find image size
                    $image_rate = max($cur_x / $image_width, $cur_y / $image_width);
                    $site->debug->msg("Image rate is {$image_rate}");
                    $new_x = round($cur_x / $image_rate);
                    $new_y = round($cur_y / $image_rate);
                    ############
                    # convert to image size
                    $src_img = imagecreatefromjpeg($uploaded_file);
                    $dst_img = imageCreateTrueColor($new_x, $new_y);
                    imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_x, $new_y, imagesx($src_img), imagesy($src_img));
                    imagejpeg($dst_img, $uploaded_image);
                    #echo $uploaded_image; exit;
                    ############
                    # read image
                    if (file_exists($uploaded_image)) {
                        #echo "yeahhhoo!";
                        $fd = fopen($uploaded_image, "rb");
                        $cs_image = fread($fd, filesize($uploaded_image));
                        fclose($fd);
                        #Is unlinked below
                        #unlink("$uploaded_file_image");
                    } else {
                        $cs_image = "";
                    }
                    $site->debug->msg("Image created: {$dst_img}");
                    $site->debug->msg("image size: " . strlen($cs_image));
                    imagedestroy($dst_img);
                    imagedestroy($src_img);
                    ############
                    # find thumb size
                    $thumb_rate = max($cur_x / $thumb_width, $cur_y / $thumb_width);
                    $site->debug->msg("Thumb rate is {$thumb_rate}");
                    $new_x = round($cur_x / $thumb_rate);
                    $new_y = round($cur_y / $thumb_rate);
                    ############
                    # convert to thumbnail size
                    $src_img = imagecreatefromjpeg($uploaded_file);
                    $dst_img = imageCreateTrueColor($new_x, $new_y);
                    imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_x, $new_y, imagesx($src_img), imagesy($src_img));
                    $site->debug->msg("Thumbnail created: {$dst_img}");
                    imagejpeg($dst_img, $uploaded_thumb);
                    ############
                    # read image
                    if (file_exists($uploaded_thumb)) {
                        $fd = fopen($uploaded_thumb, "rb");
                        $cs_thumb = fread($fd, filesize($uploaded_thumb));
                        fclose($fd);
                        #Is unlinked below
                        #unlink("$uploaded_file_image");
                    } else {
                        $cs_thumb = "";
                    }
                    $site->debug->msg("thumb size: " . strlen($cs_thumb));
                    imagedestroy($dst_img);
                    imagedestroy($src_img);
                } else {
                    $site->debug->msg("Thumb not resized: ");
                    //Read file
                    if (file_exists("{$uploaded_file}")) {
                        $fd = fopen("{$uploaded_file}", "rb");
                        $cs_thumb = fread($fd, filesize("{$uploaded_file}"));
                        fclose($fd);
                        $cs_image = $cs_thumb;
                    } else {
                        $cs_thumb = "";
                        $cs_image = "";
                    }
                    $site->debug->msg("If identyfy");
                }
                $site->debug->msg("If data");
                ###############################
                # save also original file, if needed
                if ($site->CONF['original_picture_saved'] == 1) {
                    ############
                    # read original image
                    if (file_exists($uploaded_file)) {
                        $fd = fopen($uploaded_file, "rb");
                        $cs_orig = fread($fd, filesize($uploaded_file));
                        fclose($fd);
                    }
                } else {
                    $cs_orig = "";
                }
                ###############################
                # delete uploaded file
                if (!$args['no_unlink']) {
                    unlink($uploaded_file);
                }
                ###############################
                # return image data
                $img_array = array("thumb" => $cs_thumb, "image" => $cs_image, "orig" => $cs_orig);
                return $img_array;
            } else {
                $site->debug->msg("GD-library not supported or is not JPEG file");
                if (!$args['no_unlink']) {
                    unlink($uploaded_file);
                }
            }
            return 0;
        }
    }
}
Example #8
0
<?php

$file = $_REQUEST['file'];
$file = EscapeShellCmd($file);
if (empty($file)) {
    exit;
}
$errmsg = "";
if (!@mysql_connect("localhost", "stockchase", "abcde")) {
    $errmsg = "Cannot connect to database";
}
@mysql_select_db("stockchase");
$query = "SELECT pixUrl,clickCount from New_pictures where id={$file}";
if (!($result = @mysql_query($query))) {
    die('Error' . mysql_errno() . " : " . mysql_error());
}
$data = @mysql_fetch_array($result);
if (!empty($data["pixUrl"])) {
    if (!isset($_REQUEST['count'])) {
        $count = $data['clickCount'];
        $count = 1 + $count;
        $query = "Update New_pictures set clickCount = '{$count}' where id={$file}";
        @mysql_query($query);
    }
    header("Location: " . $data["pixUrl"]);
} else {
    header("Location: http://www.stockchase.com");
}
?>

Example #9
0
function clean_url($str)
{
    $url = EscapeShellCmd($str);
    return $str;
}
Example #10
0
error_reporting(7);
print "<BODY>";
if ($page_url == "") {
    print "<H2>PHP Source Code Viewer</H2>";
    print "Type in the File Name to be viewed:<P>";
    print "<form method=post action=source.php>";
    print "<input type=text name=page_url><p>";
    print "<TABLE>";
    print "<TR>";
    print "<TD><input name=submit value=Submit type=SUBMIT></TD>";
    print "<TD><input name=reset value=Reset type=RESET></TD>";
    print "</TR>";
    print "</TABLE>";
    print "</form>";
} else {
    $page_url = EscapeShellCmd($page_url);
    print "<B>Source of: {$page_url}</B><BR>";
    print "<HR NOSHADE><FONT SIZE=3>";
    if ($page_url == "action.php" || $page_url == "index.php" || $page_url == "presents.php") {
        $page_name = $page_url;
        if (file_exists($page_name)) {
            show_source($page_name);
        }
    } else {
        if (is_dir($page_name)) {
            print "<P>Can't show source for a directory.</P>";
        } else {
            print "Filename Not Found or Not Permitted. Try Again.<P>";
        }
    }
    print "<CENTER><FORM METHOD=\"GET\" ACTION=\"index.html\">";
Example #11
0
if ($zflag1 & $flag_zonesplitcc) {
    $cc_number = ereg_replace(" ", "", $cc_number);
    $cc_number = ereg_replace("-", "", $cc_number);
    // split out the last 6 digits
    $cc_lastsix = substr((string) $cc_number, -6, 6);
    // split out all but the last 6 digits
    $cc_number = substr((string) $cc_number, 0, -6) . "......";
}
// this file is included, already queried vendor table
//$fcv = new FC_SQL;
//$fcv->query("select * from vend where vendzid=$zid");
//$fcv->next_record();
if ('' != '') {
    // if using gpg instead of pgp...
    // $pname="/usr/bin/gpg --lock-never --batch -r  -ea | mail -s [Order] ".$fcv->f("vendoemail");
    $vemail = EscapeShellCmd($fcv->f("vendoemail"));
    $pname = 'pgp -feat +batchmode  | mail -s Order ' . $vemail;
} else {
    $pname = 'mail -s Order ' . $fcv->f("vendoemail");
}
$cf = popen($pname, "w");
/* BILLING INFORMATION BLOCK */
fputs($cf, "\n");
$tmp = sprintf("Billing Information:  %s %s %s\n", $billing_first, $billing_mi, $billing_last);
fputs($cf, "{$tmp}");
if ($billing_company) {
    $tmp = sprintf("                      %s\n", $billing_company);
    fputs($cf, $tmp);
}
if ($billing_address1) {
    $tmp = sprintf("                      %s\n", $billing_address1);