Example #1
0
        $image = @imagecreate($copyx, $copyy) or die("cannot create image copy");
        for ($i = 0; $i < 256; $i++) {
            imagecolorallocate($image, $i, $i, $i);
        }
        return $image;
    }
}
$caption = array_key_exists("caption", $_GET) ? intval($_GET["caption"]) : 12;
$border = array_key_exists("border", $_GET) ? intval($_GET["border"]) : 1;
$size = $_GET["size"];
$id = $_GET["id"];
$index = $_GET["index"];
$error = "";
$text = ValueFromSql($con, "SELECT concat(`introtext`,`fulltext`) 'text'\n\t\t\t\t\t\t\t\tFROM jos_content \n\t\t\t\t\t\t\t\tWHERE id={$id}");
$rtfpagewidth = ValueFromSql($con, "SELECT value \n\t\t\t\t\t\t\t\tFROM ctcweb9_newsletter.fields\n\t\t\t\t\t\t\t\tWHERE name='rtfpagewidth'");
$rtfincolour = ValueFromSql($con, "SELECT value \n\t\t\t\t\t\t\t\tFROM ctcweb9_newsletter.fields\n\t\t\t\t\t\t\t\tWHERE name='rtfincolour'") == '1';
$size = floatval($size) * floatval($rtfpagewidth);
if ($size < 10) {
    $error = "size is too small ({$size})";
    $size = 200;
} else {
    if ($caption > 0 && $size < $caption) {
        $error = "size is smaller than caption ({$size}/{$caption})";
        $size = 200;
    } else {
        if ($text == "") {
            $captiontext = "Invalid content id ({$id})";
        } else {
            $images = FieldExplode($text, "{mostripimage ", "}");
            $image = $images[$index * 2 - 1];
            if ($image == "") {
Example #2
0
    }
}
$generator = new RtfGenerator($con);
$db = !isset($_GET['db']) || $_GET['db'] == '' ? 'ctcweb9_newsletter' : $_GET['db'];
$table = !isset($_GET['table']) || $_GET['table'] == '' ? 'documents' : $_GET['table'];
$col = !isset($_GET['col']) || $_GET['col'] == '' ? 'data' : $_GET['col'];
//$random        = $_GET['random']  == '' ? date('Ymd_His')      : $_GET['random'];
// Changed above to below, RJL 26/1/09
$random = date('Ymd_His');
$query = !isset($_GET['source']) || $_GET['source'] == '' ? $db . '.' . $table : '(' . $generator->fielddata[$_GET['source']]["sql"] . ') q';
$idcol = !isset($_GET['id']) || $_GET['id'] == '' ? 'name' : 'id';
$id = (!isset($_GET['id']) ? '' : $_GET['id']) . (!isset($_GET['name']) ? '' : $_GET['name']) . (!isset($_GET['expand']) ? '' : $_GET['expand']);
$pos = strrpos($id, '.');
$ext = $pos === false ? 'html' : str_replace('.', '', strtolower(substr($id, $pos)));
$filename = $pos === false ? $id : substr($id, 0, $pos);
$data = ValueFromSql($con, "SELECT `{$col}` FROM {$query} WHERE `{$idcol}` = '{$id}'");
$len = strlen($data);
if ($len == 0) {
    die("<h1>{$idcol} with {$id} not found in {$table}</h1>");
}
header("Cache-Control: no-cache");
// RJL 25/3/09. Kill the caching problem at last?!
switch ($ext) {
    case "rtf":
        if ($_GET["expand"] != "") {
            $data = $generator->Generate($data);
            $len = strlen($data);
        }
        // Output the RTF file
        header("Content-type: application/rtf");
        header("Content-length: {$len}");
	<script>
		<?php 
$table = 'ctcweb9_newsletter.historyitem';
$detail = 'ctcweb9_newsletter.historydetail';
$tablecols = JsonFromQuery($con, "SHOW FULL COLUMNS FROM {$table}");
$detailcols = JsonFromQuery($con, "SHOW FULL COLUMNS FROM {$detail}");
$where = "1=1";
$filterdate = $_POST["filterdate"];
$filtertable = $_POST["filtertable"];
$filterids = $_POST["filterids"];
$filterlimit = $_POST["filterlimit"];
$filterids = trim($filterids, ',');
$filtertables = array("All" => "Select history for all tables", "ctcweb9_newsletter.events" => "Select history for this table", "ctcweb9_newsletter.notices" => "Select history for this table", "ctcweb9_newsletter.reports" => "Select history for this table", "ctcweb9_newsletter.fields" => "Select history for this table", "ctcweb9_newsletter.newsletters" => "Select history for this table");
$filterdates = array("All" => "Select history for all dates", "Current" => "Select history for the current newsletter");
$filterdates += ArrayFromQuery($con, "SELECT\tdistinct date_format(datetime,'%Y-%m')\tvalue, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Select history for this month' \t\ttitle\n\t\t\t\t\t\t\t\t\t\t\t\tFROM   {$table}");
$startdate = ValueFromSql($con, "SELECT max(DATE_ADD(prev.issuedate,INTERVAL 1 DAY)) \n\t\t\t\t\t\t\t\t\t\t\t FROM   ctcweb9_newsletter.newsletters prev,\n\t\t\t\t\t\t\t\t\t\t\t\t\tctcweb9_newsletter.newsletters curr\n\t\t\t\t\t\t\t\t\t\t\t WHERE  prev.issuedate < curr.issuedate AND curr.iscurrent");
if (!array_key_exists($filtertable, $filtertables)) {
    $filtertable = "All";
}
if ($filtertable != "All") {
    $where .= " AND `table` = '{$filtertable}'";
}
if ($filterids != "") {
    $where .= " AND `id` in ({$filterids})";
}
if ($filterids != "" && $filterdate == "") {
    $filterdate = "All";
}
if ($filterlimit == "" || $filterlimit == "0") {
    $filterlimit = "1000";
}