tweak year/agency modifer for queries
tweak year/agency modifer for queries

 Binary files a/admin/cmd.exe.lnk and b/admin/cmd.exe.lnk differ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>My Google AJAX Search API Application - http://contractdashboard.lambdacomplex.org</title> <title>My Google AJAX Search API Application - http://contractdashboard.lambdacomplex.org</title>
<script src="http://www.google.com/jsapi?key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBSgIPe2k9-DRgEVQvbvQDV8xmTiXRTBpHxrD7bSh5rl2lswY56769CyQQ" type="text/javascript"></script> <script src="http://www.google.com/jsapi?key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBSgIPe2k9-DRgEVQvbvQDV8xmTiXRTBpHxrD7bSh5rl2lswY56769CyQQ" type="text/javascript"></script>
<script language="Javascript" type="text/javascript"> <script language="Javascript" type="text/javascript">
//<![CDATA[ //<![CDATA[
   
google.load("search", "1"); google.load("search", "1");
   
function OnLoad() { function OnLoad() {
// Create a search control // Create a search control
var searchControl = new google.search.SearchControl(); var searchControl = new google.search.SearchControl();
   
// Add in a full set of searchers // Add in a full set of searchers
var localSearch = new google.search.LocalSearch(); var localSearch = new google.search.LocalSearch();
searchControl.addSearcher(localSearch); searchControl.addSearcher(localSearch);
searchControl.addSearcher(new google.search.WebSearch()); searchControl.addSearcher(new google.search.WebSearch());
searchControl.addSearcher(new google.search.VideoSearch()); searchControl.addSearcher(new google.search.VideoSearch());
searchControl.addSearcher(new google.search.BlogSearch()); searchControl.addSearcher(new google.search.BlogSearch());
   
// Set the Local Search center point // Set the Local Search center point
localSearch.setCenterPoint("New York, NY"); localSearch.setCenterPoint("New York, NY");
   
// Tell the searcher to draw itself and tell it where to attach // Tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchcontrol")); searchControl.draw(document.getElementById("searchcontrol"));
   
// Execute an inital search // Execute an inital search
searchControl.execute("Google"); searchControl.execute("Google");
} }
google.setOnLoadCallback(OnLoad); google.setOnLoadCallback(OnLoad);
   
//]]> //]]>
</script> </script>
</head> </head>
<body> <body>
<div id="searchcontrol">Loading...</div> <div id="searchcontrol">Loading...</div>
</body> </body>
</html> </html>
c:\wamp\bin\php\php5.3.0\php.exe import.php c:\wamp\bin\php\php5.3.0\php.exe import.php
<?php <?php
include_once("../lib/common.inc.php"); include_once("../lib/common.inc.php");
$path = '../data/'; $path = 'data/';
if ($_REQUEST["fname"] == "") { if ($_REQUEST["fname"] == "") {
echo "Get files from: https://www.tenders.gov.au/?event=public.reports.list<br>"; echo "Get files from: https://www.tenders.gov.au/?event=public.reports.list<br>";
$dhandle = opendir($path); $dhandle = opendir($path);
// define an array to hold the files // define an array to hold the files
$files = array(); $files = array();
   
if ($dhandle) { if ($dhandle) {
// loop through all of the files // loop through all of the files
while (false !== ($fname = readdir($dhandle))) { while (false !== ($fname = readdir($dhandle))) {
if (($fname != '.') && ($fname != '..')) { if (($fname != '.') && ($fname != '..')) {
echo "<a href=\"import.php?fname=$fname\">$fname</a>".filesize($path.$fname)."<br/>"; echo "<a href=\"import.php?fname=$fname\">$fname</a>".filesize($path.$fname)."<br/>";
} }
} }
} }
   
} else { } else {
$success =0; $success =0;
$fname = $_REQUEST["fname"]; $fname = $_REQUEST["fname"];
echo " ============== $fname ============== <br>"; echo " ============== $fname ============== <br>";
$row = 1; $row = 1;
$handle = fopen($path.$fname, "r"); $handle = fopen($path.$fname, "r");
//"t" mode string translates windows line breaks to unix //"t" mode string translates windows line breaks to unix
$datamapping0709 = Array("Agency" => "agencyName", "Parent CN ID" => "parentCN", "CN ID" => "CNID", "Publish Date" => "publishDate", "Amendment Date" => "amendDate", "Status" => "", "StartDate" => "contractStart" , "EndDate" => "contractEnd", "Value" => "value", "Description" => "description", "Agency Ref Id" => "agencyID", "Category" => "category", "Procurement Method" => "procurementMethod", "ATM ID" => "atmID", "SON ID" => "SONID","Confidentiality - Contract" => "confidentialityContract", "Confidentiality - Contract Reason(s)" => "confidentialityContractReason", "Confidentiality - Outputs" => "confidentialityOutputs", "Confidentiality - Outputs Reason(s)" => "confidentialityOutputsReason", "Consultancy" => "consultancy", "Consultancy Reason(s)" => "consultancyReason", "Amendment Reason" => "amendmentReason", "Supplier Name" => "supplierName", "Supplier Address" => "supplierAddress", "Supplier City" => "supplierCity", "Supplier Postcode" => "supplierPostcode", "Supplier Country" => "supplierCountry" , "Supplier ABNExempt" => "supplierABNExempt", "Supplier ABN" => "supplierABN" , "Agency Branch" => "contactBranch","Agency Divison" => "contactDivision", "Agency Postcode" => "contactPostcode" , "" => ""); $datamapping0709 = Array("Agency" => "agencyName", "Parent CN ID" => "parentCN", "CN ID" => "CNID", "Publish Date" => "publishDate", "Amendment Date" => "amendDate", "Status" => "", "StartDate" => "contractStart" , "EndDate" => "contractEnd", "Value" => "value", "Description" => "description", "Agency Ref Id" => "agencyID", "Category" => "category", "Procurement Method" => "procurementMethod", "ATM ID" => "atmID", "SON ID" => "SONID","Confidentiality - Contract" => "confidentialityContract", "Confidentiality - Contract Reason(s)" => "confidentialityContractReason", "Confidentiality - Outputs" => "confidentialityOutputs", "Confidentiality - Outputs Reason(s)" => "confidentialityOutputsReason", "Consultancy" => "consultancy", "Consultancy Reason(s)" => "consultancyReason", "Amendment Reason" => "amendmentReason", "Supplier Name" => "supplierName", "Supplier Address" => "supplierAddress", "Supplier City" => "supplierCity", "Supplier Postcode" => "supplierPostcode", "Supplier Country" => "supplierCountry" , "Supplier ABNExempt" => "supplierABNExempt", "Supplier ABN" => "supplierABN" , "Agency Branch" => "contactBranch","Agency Divison" => "contactDivision", "Agency Postcode" => "contactPostcode" , "" => "");
$headers; $headers;
$contractNoticeFields = Array("agencyName", "parentCN", "CNID", "publishDate", "amendDate", "contractStart" , "contractEnd", "value", "description", "agencyID", "category", "procurementMethod", "atmID", "SONID", "confidentialityContract", "confidentialityContractReason", "confidentialityOutputs", "confidentialityOutputsReason", "consultancy", "consultancyReason", "amendmentReason", "supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry" , "supplierABNExempt", "supplierABN", "contactBranch","contactDivision","contactPostcode" ); $contractNoticeFields = Array("agencyName", "parentCN", "CNID", "publishDate", "amendDate", "contractStart" , "contractEnd", "value", "description", "agencyID", "category", "procurementMethod", "atmID", "SONID", "confidentialityContract", "confidentialityContractReason", "confidentialityOutputs", "confidentialityOutputsReason", "consultancy", "consultancyReason", "amendmentReason", "supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry" , "supplierABNExempt", "supplierABN", "contactBranch","contactDivision","contactPostcode" );
$agencyFields = Array("agencyName"); $agencyFields = Array("agencyName");
$supplierFields = Array("supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry" , "supplierABNExempt", "supplierABN" ); $supplierFields = Array("supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry" , "supplierABNExempt", "supplierABN" );
   
while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) { while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) {
$num = count($data); $num = count($data);
   
if ($row == 3) if ($row == 3)
{ {
$headers = $data; $headers = $data;
} }
else if ($row > 3) else if ($row > 3)
{ {
if ($num > count($datamapping0709)) if ($num > count($datamapping0709))
{ {
die ("<font color=red>Error in data import; data mapping fields out of bounds or changed</font><br>".$fname.print_r($data)); die ("<font color=red>Error in data import; data mapping fields out of bounds or changed</font><br>".$fname.print_r($data));
} }
$firstCN= false; $firstCN= false;
$firstSupplier= true; $firstSupplier= true;
$firstAgency= true; $firstAgency= true;
$contractNoticeInsert = "INSERT INTO contractnotice (importFile, ".implode(" , ",$contractNoticeFields). ") VALUES ( \"$fname\" "; $contractNoticeInsert = "INSERT INTO contractnotice (importFile, ".implode(" , ",$contractNoticeFields). ") VALUES ( \"$fname\" ";
$supplierInsert = "INSERT INTO supplierdetails (".implode(" , ",$supplierFields). ") VALUES ("; $supplierInsert = "INSERT INTO supplierdetails (".implode(" , ",$supplierFields). ") VALUES (";
$agencyInsert = "INSERT INTO agency (".implode(" , ",$agencyFields). ") VALUES ("; $agencyInsert = "INSERT INTO agency (".implode(" , ",$agencyFields). ") VALUES (";
$keys = array_keys($datamapping0709); $keys = array_keys($datamapping0709);
for ($c=0; $c < $num; $c++) { for ($c=0; $c < $num; $c++) {
$data[$c] = trim($data[$c],"="); $data[$c] = trim($data[$c],"=");
$data[$c] = trim($data[$c], "\""); $data[$c] = trim($data[$c], "\"");
if (in_array(($datamapping0709[$headers[$c]]),$contractNoticeFields)) if (in_array(($datamapping0709[$headers[$c]]),$contractNoticeFields))
{ {
if (($datamapping0709[$headers[$c]]) == "parentCN" || ($datamapping0709[$headers[$c]]) == "CNID") if (($datamapping0709[$headers[$c]]) == "parentCN" || ($datamapping0709[$headers[$c]]) == "CNID")
{ {
$data[$c] = substr($data[$c],2); $data[$c] = substr($data[$c],2);
if ($data[$c] >0) if ($data[$c] >0)
{ {
$contractNoticeInsert .= ($firstCN ? "" : ","). mysql_real_escape_string($data[$c]); $contractNoticeInsert .= ($firstCN ? "" : ","). mysql_real_escape_string($data[$c]);
} else } else
{ {
$contractNoticeInsert .= ($firstCN ? "" : ",")."''"; $contractNoticeInsert .= ($firstCN ? "" : ",")."''";
} }
} else if (($datamapping0709[$headers[$c]]) == "amendDate" || ($datamapping0709[$headers[$c]]) == "publishDate" || ($datamapping0709[$headers[$c]]) == "contractStart" || ($datamapping0709[$headers[$c]]) == "contractEnd") } else if (($datamapping0709[$headers[$c]]) == "amendDate" || ($datamapping0709[$headers[$c]]) == "publishDate" || ($datamapping0709[$headers[$c]]) == "contractStart" || ($datamapping0709[$headers[$c]]) == "contractEnd")
{ {
$contractNoticeInsert .= ($firstCN ? "" : ","). "'".date( 'Y-m-d H:i:s', strtotime($data[$c])). "'"; $contractNoticeInsert .= ($firstCN ? "" : ","). "'".date( 'Y-m-d H:i:s', strtotime($data[$c])). "'";
} else } else
{ {
if (strstr("\" =",$data[$c] > 0)) if (strstr("\" =",$data[$c] > 0))
{ {
die ("Invalid Description field" . $contractNoticeInsert); die ("Invalid Description field" . $contractNoticeInsert);
} }
$contractNoticeInsert .= ($firstCN ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'"; $contractNoticeInsert .= ($firstCN ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'";
} }
$firstCN = false; $firstCN = false;
} }
if (in_array(($datamapping0709[$headers[$c]]),$supplierFields)) if (in_array(($datamapping0709[$headers[$c]]),$supplierFields))
{ {
$supplierInsert .= ($firstSupplier ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'"; $supplierInsert .= ($firstSupplier ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'";
$firstSupplier = false; $firstSupplier = false;
} }
if (in_array(($datamapping0709[$headers[$c]]),$agencyFields)) if (in_array(($datamapping0709[$headers[$c]]),$agencyFields))
{ {
$agencyInsert .= ($firstAgency ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'"; $agencyInsert .= ($firstAgency ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'";
$firstAgency = false; $firstAgency = false;
} }
} }
$contractNoticeInsert .= ");"; $contractNoticeInsert .= ");";
$supplierInsert .= ");"; $supplierInsert .= ");";
$agencyInsert .= ");"; $agencyInsert .= ");";
$result = mysql_query($contractNoticeInsert); $result = mysql_query($contractNoticeInsert);
if ($result) $success++; if ($result) $success++;
else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed CN insert.<br>". mysql_error() ." <br> $contractNoticeInsert <br><br>\n"; else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed CN insert.<br>". mysql_error() ." <br> $contractNoticeInsert <br><br>\n";
$result = mysql_query($agencyInsert); $result = mysql_query($agencyInsert);
if ($result) $success++; if ($result) $success++;
else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed agency insert.<br>". mysql_error() ." <br> $agencyInsert <br><br>\n"; else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed agency insert.<br>". mysql_error() ." <br> $agencyInsert <br><br>\n";
$result = mysql_query($supplierInsert); $result = mysql_query($supplierInsert);
if ($result) $success++; if ($result) $success++;
else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed supplier insert.<br>". mysql_error() ." <br> $supplierInsert <br><br>\n"; else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed supplier insert.<br>". mysql_error() ." <br> $supplierInsert <br><br>\n";
   
//echo "<hr>\n"; //echo "<hr>\n";
} }
$row++; $row++;
} }
echo "<br> $success records successfully created"; echo "<br> $success records successfully created";
fclose($handle); fclose($handle);
} }
?> ?>
   
SELECT min( `publishDate` ) AS w, week( `publishDate` ) AS wk, count( 1 ) SELECT min( `publishDate` ) AS w, week( `publishDate` ) AS wk, count( 1 )
FROM `contractnotice` FROM `contractnotice`
WHERE YEAR( `publishDate` ) =2009 WHERE YEAR( `publishDate` ) =2009
GROUP BY wk GROUP BY wk
ORDER BY w ORDER BY w
LIMIT 0 , 30 LIMIT 0 , 30
   
/* /*
================================================ ================================================
autosuggest, inquisitor style autosuggest, inquisitor style
================================================ ================================================
*/ */
   
body body
{ {
position: relative; position: relative;
} }
   
   
div.autosuggest div.autosuggest
{ {
position: absolute; position: absolute;
background-image: url(images/img_inquisitor/as_pointer.gif); background-image: url(images/img_inquisitor/as_pointer.gif);
background-position: top; background-position: top;
background-repeat: no-repeat; background-repeat: no-repeat;
padding: 10px 0 0 0; padding: 10px 0 0 0;
} }
   
div.autosuggest div.as_header, div.autosuggest div.as_header,
div.autosuggest div.as_footer div.autosuggest div.as_footer
{ {
position: relative; position: relative;
height: 6px; height: 6px;
padding: 0 6px; padding: 0 6px;
background-image: url(images/img_inquisitor/ul_corner_tr.gif); background-image: url(images/img_inquisitor/ul_corner_tr.gif);
background-position: top right; background-position: top right;
background-repeat: no-repeat; background-repeat: no-repeat;
overflow: hidden; overflow: hidden;
} }
div.autosuggest div.as_footer div.autosuggest div.as_footer
{ {
background-image: url(images/img_inquisitor/ul_corner_br.gif); background-image: url(images/img_inquisitor/ul_corner_br.gif);
} }
   
div.autosuggest div.as_header div.as_corner, div.autosuggest div.as_header div.as_corner,
div.autosuggest div.as_footer div.as_corner div.autosuggest div.as_footer div.as_corner
{ {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
height: 6px; height: 6px;
width: 6px; width: 6px;
background-image: url(images/img_inquisitor/ul_corner_tl.gif); background-image: url(images/img_inquisitor/ul_corner_tl.gif);
background-position: top left; background-position: top left;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
div.autosuggest div.as_footer div.as_corner div.autosuggest div.as_footer div.as_corner
{ {
background-image: url(images/img_inquisitor/ul_corner_bl.gif); background-image: url(images/img_inquisitor/ul_corner_bl.gif);
} }
div.autosuggest div.as_header div.as_bar, div.autosuggest div.as_header div.as_bar,
div.autosuggest div.as_footer div.as_bar div.autosuggest div.as_footer div.as_bar
{ {
height: 6px; height: 6px;
overflow: hidden; overflow: hidden;
background-color: #333; background-color: #333;
} }
   
   
div.autosuggest ul div.autosuggest ul
{ {
list-style: none; list-style: none;
margin: 0 0 -4px 0; margin: 0 0 -4px 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
background-color: #333; background-color: #333;
} }
   
div.autosuggest ul li div.autosuggest ul li
{ {
color: #ccc; color: #ccc;
padding: 0; padding: 0;
margin: 0 4px 4px; margin: 0 4px 4px;
text-align: left; text-align: left;
} }
   
div.autosuggest ul li a div.autosuggest ul li a
{ {
color: #ccc; color: #ccc;
display: block; display: block;
text-decoration: none; text-decoration: none;
background-color: transparent; background-color: transparent;
text-shadow: #000 0px 0px 5px; text-shadow: #000 0px 0px 5px;
position: relative; position: relative;
padding: 0; padding: 0;
width: 100%; width: 100%;
} }
div.autosuggest ul li a:hover div.autosuggest ul li a:hover
{ {
background-color: #444; background-color: #444;
} }
div.autosuggest ul li.as_highlight a:hover div.autosuggest ul li.as_highlight a:hover
{ {
background-color: #1B5CCD; background-color: #1B5CCD;
} }
   
div.autosuggest ul li a span div.autosuggest ul li a span
{ {
display: block; display: block;
padding: 3px 6px; padding: 3px 6px;
font-weight: bold; font-weight: bold;
} }
   
div.autosuggest ul li a span small div.autosuggest ul li a span small
{ {
font-weight: normal; font-weight: normal;
color: #999; color: #999;
} }
   
div.autosuggest ul li.as_highlight a span small div.autosuggest ul li.as_highlight a span small
{ {
color: #ccc; color: #ccc;
} }
   
div.autosuggest ul li.as_highlight a div.autosuggest ul li.as_highlight a
{ {
color: #fff; color: #fff;
background-color: #1B5CCD; background-color: #1B5CCD;
background-image: url(images/img_inquisitor/hl_corner_br.gif); background-image: url(images/img_inquisitor/hl_corner_br.gif);
background-position: bottom right; background-position: bottom right;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
   
div.autosuggest ul li.as_highlight a span div.autosuggest ul li.as_highlight a span
{ {
background-image: url(images/img_inquisitor/hl_corner_bl.gif); background-image: url(images/img_inquisitor/hl_corner_bl.gif);
background-position: bottom left; background-position: bottom left;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
   
div.autosuggest ul li a .tl, div.autosuggest ul li a .tl,
div.autosuggest ul li a .tr div.autosuggest ul li a .tr
{ {
background-image: transparent; background-image: transparent;
background-repeat: no-repeat; background-repeat: no-repeat;
width: 6px; width: 6px;
height: 6px; height: 6px;
position: absolute; position: absolute;
top: 0; top: 0;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
div.autosuggest ul li a .tr div.autosuggest ul li a .tr
{ {
right: 0; right: 0;
} }
   
div.autosuggest ul li.as_highlight a .tl div.autosuggest ul li.as_highlight a .tl
{ {
left: 0; left: 0;
background-image: url(images/img_inquisitor/hl_corner_tl.gif); background-image: url(images/img_inquisitor/hl_corner_tl.gif);
background-position: bottom left; background-position: bottom left;
} }
   
div.autosuggest ul li.as_highlight a .tr div.autosuggest ul li.as_highlight a .tr
{ {
right: 0; right: 0;
background-image: url(images/img_inquisitor/hl_corner_tr.gif); background-image: url(images/img_inquisitor/hl_corner_tr.gif);
background-position: bottom right; background-position: bottom right;
} }
   
   
   
div.autosuggest ul li.as_warning div.autosuggest ul li.as_warning
{ {
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
} }
   
div.autosuggest ul em div.autosuggest ul em
{ {
font-style: normal; font-style: normal;
color: #6EADE7; color: #6EADE7;
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Komodo Project File - DO NOT EDIT --> <!-- Komodo Project File - DO NOT EDIT -->
<project id="78e0995e-1430-4891-9aa9-b41f9d082425" kpf_version="4" name="contractDashboard.kpf"> <project id="78e0995e-1430-4891-9aa9-b41f9d082425" kpf_version="4" name="contractDashboard.kpf">
<preference-set idref="78e0995e-1430-4891-9aa9-b41f9d082425"> <preference-set idref="78e0995e-1430-4891-9aa9-b41f9d082425">
<string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store</string> <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store</string>
<string id="import_include_matches"></string> <string id="import_include_matches"></string>
<boolean id="import_live">1</boolean> <boolean id="import_live">1</boolean>
<boolean id="import_recursive">1</boolean> <boolean id="import_recursive">1</boolean>
<string id="import_type">useFolders</string> <string id="import_type">useFolders</string>
<string id="mappedPaths"></string> <string id="mappedPaths"></string>
</preference-set> </preference-set>
</project> </project>
   
CutePHP.com Software License Agreement CutePHP.com Software License Agreement
1. This Software License Agreement is a legal agreement between you, 1. This Software License Agreement is a legal agreement between you,
the end-user ("Licensee"), and Authors of software ("Authors"). By the end-user ("Licensee"), and Authors of software ("Authors"). By
using our software or storing it on a computer hard drive (or other using our software or storing it on a computer hard drive (or other
type of media), you are agreeing to be bound by the terms of this type of media), you are agreeing to be bound by the terms of this
Agreement. Agreement.
2. CutePHP Software IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS 2. CutePHP Software IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS
EXPRESSED OR IMPLIED. You Use our software AT YOUR OWN RISK. CutePHP EXPRESSED OR IMPLIED. You Use our software AT YOUR OWN RISK. CutePHP
Author hereby disclaims all warranties and guarantees regarding the Author hereby disclaims all warranties and guarantees regarding the
use, or the results of use, of the software in terms of correctness, use, or the results of use, of the software in terms of correctness,
accuracy, reliability or otherwise. The Author will not be responsible accuracy, reliability or otherwise. The Author will not be responsible
for any incidental, consequential, direct or indirect damages. You for any incidental, consequential, direct or indirect damages. You
also agree that the disclaimer is the complete and exclusive statement also agree that the disclaimer is the complete and exclusive statement
of agreement between the parties and supersede all proposals or prior of agreement between the parties and supersede all proposals or prior
agreements, oral or written, and any other communications between the agreements, oral or written, and any other communications between the
parties relating to the subject matter of the disclaimer. parties relating to the subject matter of the disclaimer.
3. All copyrights to "CutePHP.com" are exclusively owned by the author 3. All copyrights to "CutePHP.com" are exclusively owned by the author
- Georgi Avramov. - Georgi Avramov.
4. You can use CutePHP.com Software for free (non-commercial needs) as 4. You can use CutePHP.com Software for free (non-commercial needs) as
long as you do not remove / edit, and keep visible the "Powered by..." long as you do not remove / edit, and keep visible the "Powered by..."
line (displayed on every page where the script is included) without line (displayed on every page where the script is included) without
the explicit written permission of CutePHP.com or payed registration. the explicit written permission of CutePHP.com or payed registration.
The Software is licensed only to you. You may not rent, lease, The Software is licensed only to you. You may not rent, lease,
sublicense, sell, assign, pledge, transfer or otherwise dispose of the sublicense, sell, assign, pledge, transfer or otherwise dispose of the
Software in any form, on a temporary or permanent basis, without the Software in any form, on a temporary or permanent basis, without the
prior written consent of CutePHP.com prior written consent of CutePHP.com
5. Users may modify software code for their personal use (at their own 5. Users may modify software code for their personal use (at their own
risk), but any altered code must not be redistributed or resold in any risk), but any altered code must not be redistributed or resold in any
form without the explicit written permission of CutePHP.com form without the explicit written permission of CutePHP.com
6. Registered Users/Customers (purchased-license holders) are allowed 6. Registered Users/Customers (purchased-license holders) are allowed
to remove the 'Powered by...' line. to remove the 'Powered by...' line.
6.1 All customers must include the URL of the domain where the Script 6.1 All customers must include the URL of the domain where the Script
will be used. This is done through the Customer Area at CutePHP.com will be used. This is done through the Customer Area at CutePHP.com
6.2 Customers are allowed to install the script only on the domain 6.2 Customers are allowed to install the script only on the domain
stated in their license. This means that the Licensee can install the stated in their license. This means that the Licensee can install the
script only on one domain per license purchased. Multiple instances of script only on one domain per license purchased. Multiple instances of
the script (installations) are allowed in the scope of the licensed the script (installations) are allowed in the scope of the licensed
domain. domain.
6.3 Once you are in receipt of our software, License fees are 6.3 Once you are in receipt of our software, License fees are
non-refundable. We encourage you to verify (by installing the free non-refundable. We encourage you to verify (by installing the free
version) that the software is working on your server and no problems version) that the software is working on your server and no problems
are occurring. are occurring.
6.4 Un-Official technical support will be provided in our forums from 6.4 Un-Official technical support will be provided in our forums from
voluntary members to both Registered and Un-Registered Users. voluntary members to both Registered and Un-Registered Users.
TERMINATION TERMINATION
This Agreement will terminate automatically upon failure to comply This Agreement will terminate automatically upon failure to comply
with the limitations described herein or on written notice from an with the limitations described herein or on written notice from an
authorized representative of CutePHP.com. On termination, you must authorized representative of CutePHP.com. On termination, you must
destroy all copies of the Software within 48 hours. destroy all copies of the Software within 48 hours.
<html><head><title>CuteNews README</title> <html><head><title>CuteNews README</title>
<meta content="text/html; charset=iso-8859-1" http-equiv=Content-Type> <meta content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<style type=text/css> <style type=text/css>
A:link { color:#3E749F; text-decoration:none} A:link { color:#3E749F; text-decoration:none}
A:visited { color:#3E749F; text-decoration:none} A:visited { color:#3E749F; text-decoration:none}
A:hover { color:#3E749F; text-decoration:underline} A:hover { color:#3E749F; text-decoration:underline}
A:active { color:#3E749F; text-decoration:underline} A:active { color:#3E749F; text-decoration:underline}
A.menu:hover, A.menu:active{ color:black; text-decoration:none} A.menu:hover, A.menu:active{ color:black; text-decoration:none}
A.menu:link, A.menu:visited{ color:#305367; text-decoration:none} A.menu:link, A.menu:visited{ color:#305367; text-decoration:none}
BODY, P, LI, TD { BODY, P, LI, TD {
COLOR: #000000; FONT-FAMILY: verdana; FONT-SIZE: 11px; LINE-HEIGHT: 16px COLOR: #000000; FONT-FAMILY: verdana; FONT-SIZE: 11px; LINE-HEIGHT: 16px
} }
</STYLE> </STYLE>
</head> </head>
<body aLink=#cccccc bgColor=lightsteelblue link=#333333 vLink=#555555> <body aLink=#cccccc bgColor=lightsteelblue link=#333333 vLink=#555555>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<table align=center border=0 cellPadding=1 cellSpacing=0 width=733 height="1"> <table align=center border=0 cellPadding=1 cellSpacing=0 width=733 height="1">
<tbody> <tbody>
<tr> <tr>
<td bgColor=#000000 width="744" height="1"> <td bgColor=#000000 width="744" height="1">
<table border=0 cellSpacing=0 width="735" height="1"> <table border=0 cellSpacing=0 width="735" height="1">
<tbody> <tbody>
<tr> <tr>
<td bgColor=#ffffff width="731" colspan="4" align="center" valign="top" height="18"> <td bgColor=#ffffff width="731" colspan="4" align="center" valign="top" height="18">
<b><font size="4" color="#7BA0DD">CuteNews README</font></b></td></tr> <b><font size="4" color="#7BA0DD">CuteNews README</font></b></td></tr>
<tr> <tr>
<td bgColor=#ffffff width="731" valign="top" align="center" height="4" colspan="4"> <td bgColor=#ffffff width="731" valign="top" align="center" height="4" colspan="4">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#C2E4DB width="731" valign="top" align="center" height="6" colspan="4"> <td bgColor=#C2E4DB width="731" valign="top" align="center" height="6" colspan="4">
<p align="left">&nbsp;<font size="2"><b>Information About The Script</b></font> <p align="left">&nbsp;<font size="2"><b>Information About The Script</b></font>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="10" valign="top" align="center" height="9"> <td bgColor=#ffffff width="10" valign="top" align="center" height="9">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#ffffff width="721" valign="top" align="center" height="9" colspan="3"> <td bgColor=#ffffff width="721" valign="top" align="center" height="9" colspan="3">
<p align="left">CuteNews v1.4.6 by <a href="http://cutephp.com">CutePHP</a> <p align="left">CuteNews v1.4.6 by <a href="http://cutephp.com">CutePHP</a>
Team.<br /> Team.<br />
<br /> <br />
Cute news is a powerful and easy for using news management system that use flat files to store its database. It supports<br /> Cute news is a powerful and easy for using news management system that use flat files to store its database. It supports<br />
&nbsp;comments and archives that can be organized by months.<br /> &nbsp;comments and archives that can be organized by months.<br />
Please read the provided license.txt file to get familiar with the legal usage Please read the provided license.txt file to get familiar with the legal usage
of this script.<br> of this script.<br>
&nbsp;<a href="http://cutephp.com/cutenews/register/">Registered</a> Customers can seek support on at <a href="mailto:support%20[at]%20cutephp.com">our support mail</a> (technichal issues are discussed in our <a href="http://cutephp.com/forum">Forums</a>!) &nbsp;<a href="http://cutephp.com/cutenews/register/">Registered</a> Customers can seek support on at <a href="mailto:support%20[at]%20cutephp.com">our support mail</a> (technichal issues are discussed in our <a href="http://cutephp.com/forum">Forums</a>!)
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="731" valign="top" align="center" height="8" colspan="4"> <td bgColor=#ffffff width="731" valign="top" align="center" height="8" colspan="4">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#C2E4DB width="731" valign="top" align="center" height="8" colspan="4"> <td bgColor=#C2E4DB width="731" valign="top" align="center" height="8" colspan="4">
<p align="left"><font size="2">&nbsp;<b>Installing CuteNews</b></font> <p align="left"><font size="2">&nbsp;<b>Installing CuteNews</b></font>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="12" valign="top" align="center" height="7"> <td bgColor=#ffffff width="12" valign="top" align="center" height="7">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#ffffff width="719" valign="top" align="center" height="7" colspan="3"> <td bgColor=#ffffff width="719" valign="top" align="center" height="7" colspan="3">
<p align="left">The installation of CuteNews is really easy and you should do it <p align="left">The installation of CuteNews is really easy and you should do it
without any problems if you fallow these steps:</p> without any problems if you fallow these steps:</p>
<p align="left">&nbsp;<b>1</b>) Create a directory on your server ( e.g. <p align="left">&nbsp;<b>1</b>) Create a directory on your server ( e.g.
cutenews )<br /> cutenews )<br />
&nbsp;<b>2</b>) Upload the content of the cutenews.1.4.6.zip to the directory you &nbsp;<b>2</b>) Upload the content of the cutenews.1.4.6.zip to the directory you
created in step 1<br /> created in step 1<br />
&nbsp;<b>3</b>) Now You must &nbsp;<b>3</b>) Now You must
<a title="How do I CHMOD?" target="_blank" href="http://cutephp.com/forum/index.php?showtopic=81">CHMOD</a> the the directory cutenews/data/ and all files and&nbsp;<br> <a title="How do I CHMOD?" target="_blank" href="http://cutephp.com/forum/index.php?showtopic=81">CHMOD</a> the the directory cutenews/data/ and all files and&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp; folders under the data/&nbsp;directory must be also &nbsp;&nbsp;&nbsp;&nbsp; folders under the data/&nbsp;directory must be also
chmod'ed to 777.<br> chmod'ed to 777.<br>
<b>4</b>) Finally, go to http://yoursite.com/cutenews/index.php <b>4</b>) Finally, go to http://yoursite.com/cutenews/index.php
with you favorite browser and fallow the instructions. with you favorite browser and fallow the instructions.
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="731" valign="top" align="center" height="5" colspan="4"> <td bgColor=#ffffff width="731" valign="top" align="center" height="5" colspan="4">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#C2E4DB width="731" valign="top" align="center" height="13" colspan="4"> <td bgColor=#C2E4DB width="731" valign="top" align="center" height="13" colspan="4">
<p align="left"><font size="2"><b>&nbsp;Getting The News On Your Page...</b></font> <p align="left"><font size="2"><b>&nbsp;Getting The News On Your Page...</b></font>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="14" valign="top" align="center" height="1" rowspan="17"> <td bgColor=#ffffff width="14" valign="top" align="center" height="1" rowspan="17">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#ffffff width="717" valign="top" align="center" height="7" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="center" height="7" colspan="3">
<p align="left">You can show the news,&nbsp; archives on your page by using <p align="left">You can show the news,&nbsp; archives on your page by using
some of the following php codes in your page.&nbsp;<br /> some of the following php codes in your page.&nbsp;<br />
The page where you include news, should be with extension .php <br> The page where you include news, should be with extension .php <br>
If you want these codes to be auto-generated for you, login into CuteNews and go If you want these codes to be auto-generated for you, login into CuteNews and go
to Options &gt; <b>Integration Wizards</b></td> to Options &gt; <b>Integration Wizards</b></td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="center" height="9" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="center" height="9" colspan="3">
<hr width="70%"> <hr width="70%">
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="center" height="10" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="center" height="10" colspan="3">
<p align="center"><b>General</b> <p align="center"><b>General</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="center" height="10" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="center" height="10" colspan="3">
when showing news, archives you can use <font color="#993300">$number = when showing news, archives you can use <font color="#993300">$number =
<i>x</i>; </font>to limit the to <i>x</i> the number of maximum showed news on <i>x</i>; </font>to limit the to <i>x</i> the number of maximum showed news on
one page. If you use $number, &quot;next &gt;&gt;&quot; link to remaining news one page. If you use $number, &quot;next &gt;&gt;&quot; link to remaining news
will be displayed.&nbsp;<br> will be displayed.&nbsp;<br>
<br> <br>
if you want to show news, archives from certain category you can use <font color="#993300">$category if you want to show news, archives from certain category you can use <font color="#993300">$category
= &quot;ID&quot;; </font>where ID is the id of the category, you can choose and more that = &quot;ID&quot;; </font>where ID is the id of the category, you can choose and more that
one category like this: <font color="#993300">$category = one category like this: <font color="#993300">$category =
&quot;ID1,ID2,ID3&quot;;</font><br /> &quot;ID1,ID2,ID3&quot;;</font><br />
<br /> <br />
when you want to display news and headlines on one page for example, and want when a headline when you want to display news and headlines on one page for example, and want when a headline
is clicked, the article to be displayed on the place of the news you must use <font color="#993300">$static is clicked, the article to be displayed on the place of the news you must use <font color="#993300">$static
= TRUE; </font>before including headlines. = TRUE; </font>before including headlines.
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="center" height="10" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="center" height="10" colspan="3">
&nbsp; &nbsp;
<p><b>Showing Active News</b> <p><b>Showing Active News</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="20%" valign="top" align="center" height="10"> <td bgColor=#ffffff width="20%" valign="top" align="center" height="10">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#EDF1F8 width="326" valign="top" align="center" height="10"> <td bgColor=#EDF1F8 width="326" valign="top" align="center" height="10">
<p align="left">&lt;?PHP<br /> <p align="left">&lt;?PHP<br />
&nbsp;include(&quot;path/to/show_news.php&quot;);<br /> &nbsp;include(&quot;path/to/show_news.php&quot;);<br />
?&gt; ?&gt;
</td> </td>
<td bgColor=#ffffff width="20%" valign="top" align="center" height="10"> <td bgColor=#ffffff width="20%" valign="top" align="center" height="10">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="left" height="6" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="left" height="6" colspan="3">
&nbsp; &nbsp;
<p align="center"><b>Showing with Different Template</b> <p align="center"><b>Showing with Different Template</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff valign="top" align="center" height="8"> <td bgColor=#ffffff valign="top" align="center" height="8">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#EDF1F8 width="329" valign="top" align="left" height="8"> <td bgColor=#EDF1F8 width="329" valign="top" align="left" height="8">
&lt;?PHP<br> &lt;?PHP<br>
&nbsp;$template = &quot;YOUR_TEMPLATE_NAME&quot;;<br /> &nbsp;$template = &quot;YOUR_TEMPLATE_NAME&quot;;<br />
&nbsp;include(&quot;path/to/show_news.php&quot;);<br /> &nbsp;include(&quot;path/to/show_news.php&quot;);<br />
?&gt; ?&gt;
</td> </td>
<td bgColor=#ffffff valign="top" align="left" height="8"> <td bgColor=#ffffff valign="top" align="left" height="8">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="left" height="7" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="left" height="7" colspan="3">
&nbsp; &nbsp;
<p align="center"><b>Showing Archives</b> <p align="center"><b>Showing Archives</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff valign="top" align="center" height="6"> <td bgColor=#ffffff valign="top" align="center" height="6">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#EDF1F8 width="330" valign="top" align="left" height="6"> <td bgColor=#EDF1F8 width="330" valign="top" align="left" height="6">
&lt;?PHP<br /> &lt;?PHP<br />
&nbsp;include(&quot;path/to/show_archives.php&quot;);<br /> &nbsp;include(&quot;path/to/show_archives.php&quot;);<br />
?&gt; ?&gt;
</td> </td>
<td bgColor=#ffffff valign="top" align="left" height="6"> <td bgColor=#ffffff valign="top" align="left" height="6">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="left" height="10" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="left" height="10" colspan="3">
&nbsp; &nbsp;
<p align="center"><b>Showing 5 Latest News</b> <p align="center"><b>Showing 5 Latest News</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff valign="top" align="center" height="6"> <td bgColor=#ffffff valign="top" align="center" height="6">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#EDF1F8 width="330" valign="top" align="left" height="6"> <td bgColor=#EDF1F8 width="330" valign="top" align="left" height="6">
&lt;?PHP<br /> &lt;?PHP<br />
&nbsp;$number = &quot;5&quot;;<br /> &nbsp;$number = &quot;5&quot;;<br />
&nbsp;include(&quot;path/to/show_news.php&quot;);<br /> &nbsp;include(&quot;path/to/show_news.php&quot;);<br />
?&gt; ?&gt;
</td> </td>
<td bgColor=#ffffff valign="top" align="left" height="6"> <td bgColor=#ffffff valign="top" align="left" height="6">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="left" height="6" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="left" height="6" colspan="3">
&nbsp; &nbsp;
<p align="center"><b>Showing 5 News from Category with ID 2&nbsp;</b> <p align="center"><b>Showing 5 News from Category with ID 2&nbsp;</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff valign="top" align="center" height="4"> <td bgColor=#ffffff valign="top" align="center" height="4">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#EDF1F8 width="330" valign="top" align="left" height="4"> <td bgColor=#EDF1F8 width="330" valign="top" align="left" height="4">
&lt;?PHP<br /> &lt;?PHP<br />
&nbsp;$number = &quot;5&quot;;<br> &nbsp;$number = &quot;5&quot;;<br>
&nbsp;$category = &quot;2&quot;;<br /> &nbsp;$category = &quot;2&quot;;<br />
&nbsp;include(&quot;path/to/show_news.php&quot;);<br /> &nbsp;include(&quot;path/to/show_news.php&quot;);<br />
?&gt; ?&gt;
</td> </td>
<td bgColor=#ffffff valign="top" align="left" height="4"> <td bgColor=#ffffff valign="top" align="left" height="4">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="717" valign="top" align="left" height="2" colspan="3"> <td bgColor=#ffffff width="717" valign="top" align="left" height="2" colspan="3">
&nbsp; &nbsp;
<p align="center"><b>Showing All Headlines And The 1 Latest News Article&nbsp; On <p align="center"><b>Showing All Headlines And The 1 Latest News Article&nbsp; On
One Page</b> One Page</b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff valign="top" align="center" height="7"> <td bgColor=#ffffff valign="top" align="center" height="7">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#EDF1F8 width="330" valign="top" align="center" height="7"> <td bgColor=#EDF1F8 width="330" valign="top" align="center" height="7">
<p align="left"> <p align="left">
&lt;?PHP<br /> &lt;?PHP<br />
&nbsp;$static = TRUE;<br> &nbsp;$static = TRUE;<br>
&nbsp;$template = &quot;Headlines&quot;;<br /> &nbsp;$template = &quot;Headlines&quot;;<br />
&nbsp;include(&quot;path/to/show_news.php&quot;);<br /> &nbsp;include(&quot;path/to/show_news.php&quot;);<br />
<br /> <br />
&nbsp;$number = &quot;1&quot;;<br /> &nbsp;$number = &quot;1&quot;;<br />
&nbsp;include(&quot;path/to/show_news.php&quot;);<br /> &nbsp;include(&quot;path/to/show_news.php&quot;);<br />
?&gt; ?&gt;
</td> </td>
<td bgColor=#ffffff valign="top" align="center" height="7"> <td bgColor=#ffffff valign="top" align="center" height="7">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="711" valign="top" align="center" height="9" colspan="3"> <td bgColor=#ffffff width="711" valign="top" align="center" height="9" colspan="3">
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="731" valign="top" align="center" height="12" colspan="4"> <td bgColor=#ffffff width="731" valign="top" align="center" height="12" colspan="4">
<hr width="70%"> <hr width="70%">
<p><b>Remember that:</b></p> <p><b>Remember that:</b></p>
<ul> <ul>
<li>in all of the above examples you must replace path/to/... to with your <li>in all of the above examples you must replace path/to/... to with your
path where you installed CuteNews<br> path where you installed CuteNews<br>
and not to use the URL but the path<br> and not to use the URL but the path<br>
<font color="#FF0000">WRONG</font>: include(&quot;http://site.com/cutenews/show_news.php);<br> <font color="#FF0000">WRONG</font>: include(&quot;http://site.com/cutenews/show_news.php);<br>
<font color="#008000">CORRECT</font>: include(&quot;cutenews/show_news.php);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li> <font color="#008000">CORRECT</font>: include(&quot;cutenews/show_news.php);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
<li>in most cases when you include news and headlines in one page, you must <li>in most cases when you include news and headlines in one page, you must
use <font color="#993300">$static = TRUE; </font>.</li> use <font color="#993300">$static = TRUE; </font>.</li>
<li>when you use $number, $category, $template or any other variable, it must <li>when you use $number, $category, $template or any other variable, it must
be BEFORE include(&quot;show_news.php&quot;);</li> be BEFORE include(&quot;show_news.php&quot;);</li>
<li>if you have any problems, you can always go to our support forums and <li>if you have any problems, you can always go to our support forums and
we'll be more than glad to help you<br /> we'll be more than glad to help you<br />
&nbsp;</li> &nbsp;</li>
</ul> </ul>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#C2E4DB width="731" valign="top" align="center" height="4" colspan="4"> <td bgColor=#C2E4DB width="731" valign="top" align="center" height="4" colspan="4">
<p align="left"><b><font size="2">&nbsp;Help &amp; Support</font></b> <p align="left"><b><font size="2">&nbsp;Help &amp; Support</font></b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgColor=#ffffff width="16" valign="top" align="center" height="9"> <td bgColor=#ffffff width="16" valign="top" align="center" height="9">
&nbsp; &nbsp;
</td> </td>
<td bgColor=#ffffff width="715" valign="top" align="center" height="9" colspan="3"> <td bgColor=#ffffff width="715" valign="top" align="center" height="9" colspan="3">
<p align="left">If you have some problems with CuteNews you can go to our<a href="http://cutephp.com/forum/" target="_blank"> <p align="left">If you have some problems with CuteNews you can go to our<a href="http://cutephp.com/forum/" target="_blank">
support forum</a>.<br> support forum</a>.<br>
But before posting your problem on our forums, please look at the included Help But before posting your problem on our forums, please look at the included Help
Documentation with CuteNews. You can access it through CuteNews &gt; Help &gt; CuteNews internal Help Documentation Documentation with CuteNews. You can access it through CuteNews &gt; Help &gt; CuteNews internal Help Documentation
</td> </td>
</tr> </tr>
</tbody></table></td></tr></tbody></table> </tbody></table></td></tr></tbody></table>
</body></html> </body></html>
<?PHP <?PHP
///////////////////// TEMPLATE Default ///////////////////// ///////////////////// TEMPLATE Default /////////////////////
$template_active = <<<HTML $template_active = <<<HTML
<div style="width:420px; margin-bottom:30px;"> <div style="width:420px; margin-bottom:30px;">
<div><strong>{title}</strong></div> <div><strong>{title}</strong></div>
<div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{short-story}</div> <div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{short-story}</div>
<div><em>Posted on {date} by {author}</em></div> <div><em>Posted on {date} by {author}</em></div>
</div> </div>
HTML; HTML;
$template_full = <<<HTML $template_full = <<<HTML
<div style="width:420px; margin-bottom:15px;"> <div style="width:420px; margin-bottom:15px;">
<div><strong>{title}</strong></div> <div><strong>{title}</strong></div>
<div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{full-story}</div> <div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{full-story}</div>
<div style="float: right;">{comments-num} Comments</div> <div style="float: right;">{comments-num} Comments</div>
<div><em>Posted on {date} by {author}</em></div> <div><em>Posted on {date} by {author}</em></div>
</div> </div>
HTML; HTML;
$template_comment = <<<HTML $template_comment = <<<HTML
<div style="width: 400px; margin-bottom:20px;"> <div style="width: 400px; margin-bottom:20px;">
<div style="border-bottom:1px solid black;"> by <strong>{author}</strong> @ {date}</div> <div style="border-bottom:1px solid black;"> by <strong>{author}</strong> @ {date}</div>
<div style="padding:2px; background-color:#F9F9F9">{comment}</div> <div style="padding:2px; background-color:#F9F9F9">{comment}</div>
</div> </div>
HTML; HTML;
$template_form = <<<HTML $template_form = <<<HTML
<table border="0" width="370" cellspacing="0" cellpadding="0"> <table border="0" width="370" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="60">Name:</td> <td width="60">Name:</td>
<td><input type="text" name="name"></td> <td><input type="text" name="name"></td>
</tr> </tr>
<tr> <tr>
<td>E-mail:</td> <td>E-mail:</td>
<td><input type="text" name="mail"> (optional)</td> <td><input type="text" name="mail"> (optional)</td>
</tr> </tr>
<tr> <tr>
<td>Smile:</td> <td>Smile:</td>
<td>{smilies}</td> <td>{smilies}</td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<textarea cols="40" rows="6" id=commentsbox name="comments"></textarea><br /> <textarea cols="40" rows="6" id=commentsbox name="comments"></textarea><br />
<input type="submit" name="submit" value="Add My Comment"> <input type="submit" name="submit" value="Add My Comment">
<input type=checkbox name=CNremember id=CNremember value=1><label for=CNremember> Remember Me</label> | <input type=checkbox name=CNremember id=CNremember value=1><label for=CNremember> Remember Me</label> |
<a href="javascript:CNforget();">Forget Me</a> <a href="javascript:CNforget();">Forget Me</a>
</td> </td>
</tr> </tr>
</table> </table>
HTML; HTML;
$template_prev_next = <<<HTML $template_prev_next = <<<HTML
<p align="center">[prev-link]<< Previous[/prev-link] {pages} [next-link]Next >>[/next-link]</p> <p align="center">[prev-link]<< Previous[/prev-link] {pages} [next-link]Next >>[/next-link]</p>
HTML; HTML;
$template_comments_prev_next = <<<HTML $template_comments_prev_next = <<<HTML
<p align="center">[prev-link]<< Older[/prev-link] ({pages}) [next-link]Newest >>[/next-link]</p> <p align="center">[prev-link]<< Older[/prev-link] ({pages}) [next-link]Newest >>[/next-link]</p>
HTML; HTML;
?> ?>
<?PHP <?PHP
///////////////////// TEMPLATE Headlines ///////////////////// ///////////////////// TEMPLATE Headlines /////////////////////
$template_active = <<<HTML $template_active = <<<HTML
[link]{title}[/link], posted on {date} by {author}<br /> [link]{title}[/link], posted on {date} by {author}<br />
HTML; HTML;
   
   
$template_full = <<<HTML $template_full = <<<HTML
<div style="width:420px; margin-bottom:15px;"> <div style="width:420px; margin-bottom:15px;">
<div><strong>{title}</strong></div> <div><strong>{title}</strong></div>
<div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{full-story}</div> <div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{full-story}</div>
<div style="float: right;">{comments-num} Comments</div> <div style="float: right;">{comments-num} Comments</div>
<div><em>Posted on {date} by {author}</em></div> <div><em>Posted on {date} by {author}</em></div>
</div> </div>
HTML; HTML;
   
   
$template_comment = <<<HTML $template_comment = <<<HTML
<div style="width: 400px; margin-bottom:20px;"> <div style="width: 400px; margin-bottom:20px;">
<div style="border-bottom:1px solid black;">by <strong>{author}</strong> @ {date}</div> <div style="border-bottom:1px solid black;">by <strong>{author}</strong> @ {date}</div>
<div style="padding:2px; background-color:#F9F9F9">{comment}</div> <div style="padding:2px; background-color:#F9F9F9">{comment}</div>
</div> </div>
HTML; HTML;
   
   
$template_form = <<<HTML $template_form = <<<HTML
<table border="0" width="370" cellspacing="0" cellpadding="0"> <table border="0" width="370" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="60">Name:</td> <td width="60">Name:</td>
<td><input type="text" name="name"></td> <td><input type="text" name="name"></td>
</tr> </tr>
<tr> <tr>
<td>E-mail:</td> <td>E-mail:</td>
<td><input type="text" name="mail"> (optional)</td> <td><input type="text" name="mail"> (optional)</td>
</tr> </tr>
<tr> <tr>
<td>Smile:</td> <td>Smile:</td>
<td>{smilies}</td> <td>{smilies}</td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<textarea cols="40" rows="6" id=commentsbox name="comments"></textarea><br /> <textarea cols="40" rows="6" id=commentsbox name="comments"></textarea><br />
<input type="submit" name="submit" value="Add My Comment"> <input type="submit" name="submit" value="Add My Comment">
<input type=checkbox name=CNremember id=CNremember value=1><label for=CNremember> Remember Me</label> | <input type=checkbox name=CNremember id=CNremember value=1><label for=CNremember> Remember Me</label> |
<a href="javascript:CNforget();">Forget Me</a> <a href="javascript:CNforget();">Forget Me</a>
</td> </td>
</tr> </tr>
</table> </table>
HTML; HTML;
   
   
$template_prev_next = <<<HTML $template_prev_next = <<<HTML
   
HTML; HTML;
$template_comments_prev_next = <<<HTML $template_comments_prev_next = <<<HTML
   
HTML; HTML;
?> ?>
   
<HTML><TITLE>Accedd denied</TITLE><BODY> <HTML><TITLE>Accedd denied</TITLE><BODY>
<p>You can not view the content of this directory !!!</p> <p>You can not view the content of this directory !!!</p>
</BODY></HTML> </BODY></HTML>
   
<HTML><TITLE>Accedd denied</TITLE><BODY> <HTML><TITLE>Accedd denied</TITLE><BODY>
<p>You can not view the content of this directory !!!</p> <p>You can not view the content of this directory !!!</p>
</BODY></HTML> </BODY></HTML>
   
 Binary files a/cutenews/data/emoticons/angry.gif and b/cutenews/data/emoticons/angry.gif differ
 Binary files a/cutenews/data/emoticons/crying.gif and b/cutenews/data/emoticons/crying.gif differ
<HTML><TITLE>Accedd denied</TITLE><BODY> <HTML><TITLE>Accedd denied</TITLE><BODY>
<p>You can not view the content of this directory !!!</p> <p>You can not view the content of this directory !!!</p>
</BODY></HTML> </BODY></HTML>
   
 Binary files a/cutenews/data/emoticons/laughing.gif and b/cutenews/data/emoticons/laughing.gif differ
 Binary files a/cutenews/data/emoticons/sad.gif and b/cutenews/data/emoticons/sad.gif differ
 Binary files a/cutenews/data/emoticons/smile.gif and b/cutenews/data/emoticons/smile.gif differ
 Binary files a/cutenews/data/emoticons/tongue.gif and b/cutenews/data/emoticons/tongue.gif differ
 Binary files a/cutenews/data/emoticons/wassat.gif and b/cutenews/data/emoticons/wassat.gif differ
 Binary files a/cutenews/data/emoticons/wink.gif and b/cutenews/data/emoticons/wink.gif differ
<HTML><TITLE>Accedd denied</TITLE><BODY> <HTML><TITLE>Accedd denied</TITLE><BODY>
<p>You can not view the content of this directory !!!</p> <p>You can not view the content of this directory !!!</p>
</BODY></HTML> </BODY></HTML>
   
<?PHP <?PHP
///////////////////// TEMPLATE rss ///////////////////// ///////////////////// TEMPLATE rss /////////////////////
$template_active = <<<HTML $template_active = <<<HTML
<item> <item>
<title><![CDATA[{title}]]></title> <title><![CDATA[{title}]]></title>
<link>{rss-news-include-url}?subaction=showfull&amp;id={news-id}&amp;archive={archive-id}</link> <link>{rss-news-include-url}?subaction=showfull&amp;id={news-id}&amp;archive={archive-id}</link>
<description><![CDATA[{short-story}]]></description> <description><![CDATA[{short-story}]]></description>
<guid isPermaLink="false">{news-id}</guid> <guid isPermaLink="false">{news-id}</guid>
<pubDate>{date}</pubDate> <pubDate>{date}</pubDate>
</item> </item>
HTML; HTML;
   
   
$template_full = <<<HTML $template_full = <<<HTML
   
HTML; HTML;
   
   
$template_comment = <<<HTML $template_comment = <<<HTML
   
HTML; HTML;
   
   
$template_form = <<<HTML $template_form = <<<HTML
   
HTML; HTML;
   
   
$template_prev_next = <<<HTML $template_prev_next = <<<HTML
   
HTML; HTML;
$template_comments_prev_next = <<<HTML $template_comments_prev_next = <<<HTML
   
HTML; HTML;
?> ?>
   
 Binary files a/cutenews/data/upimages/cutenews-banner.gif and b/cutenews/data/upimages/cutenews-banner.gif differ
<HTML><TITLE>Accedd denied</TITLE><BODY> <HTML><TITLE>Accedd denied</TITLE><BODY>
<p>You can not view the content of this directory !!!</p> <p>You can not view the content of this directory !!!</p>
</BODY></HTML> </BODY></HTML>
   
<?PHP <?PHP
// ******************************************************************************** // ********************************************************************************
// CuteCode // CuteCode
// ******************************************************************************** // ********************************************************************************
if($action == "cutecode") if($action == "cutecode")
{ {
echo"<html> echo"<html>
<head> <head>
<title>CuteCode</title> <title>CuteCode</title>
<style type=\"text/css\"> <style type=\"text/css\">
<!-- <!--
BODY, TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;} BODY, TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
a:active,a:visited,a:link {color: #446488; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;} a:active,a:visited,a:link {color: #446488; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
a:hover {font-size : 8pt; color: #000000; font-family: verdana; text-decoration: none; } a:hover {font-size : 8pt; color: #000000; font-family: verdana; text-decoration: none; }
--> -->
</style> </style>
</head> </head>
<body bgcolor=#FFFFFF> <body bgcolor=#FFFFFF>
<script language=\"javascript\" type=\"text/javascript\"> <script language=\"javascript\" type=\"text/javascript\">
<!-- <!--
function insertcode(type,var1,var2) { function insertcode(type,var1,var2) {
if(var1 != null){ if(var1 != null){
if(var2 == null){ var2=' '; } if(var2 == null){ var2=' '; }
switch(type) { switch(type) {
case 'link': case 'link':
code = '<a href=\"' +var1+ '\">' +var2+ '</a>'; code = '<a href=\"' +var1+ '\">' +var2+ '</a>';
break; break;
case 'image': case 'image':
code = '<img src=\"' +var1+ '\" alt=\"\" style=\"border: none;\" />'; code = '<img src=\"' +var1+ '\" alt=\"\" style=\"border: none;\" />';
break; break;
case 'bold': case 'bold':
code = '<strong>' +var1+ '</strong>'; code = '<strong>' +var1+ '</strong>';
break; break;
case 'italic': case 'italic':
code = '<em>' +var1+ '</em>'; code = '<em>' +var1+ '</em>';
break; break;
case 'underline': case 'underline':
code = '<span style=\"text-decoration: underline;\">' +var1+ '</span>'; code = '<span style=\"text-decoration: underline;\">' +var1+ '</span>';
break; break;
case 'color': case 'color':
code = '<span style=\"color: ' +var1+ '\">' +var2+ '</span>'; code = '<span style=\"color: ' +var1+ '\">' +var2+ '</span>';
break; break;
case 'size': case 'size':
code = '<span style=\"font-size: ' +var1+ 'pt\">' +var2+ '</span>'; code = '<span style=\"font-size: ' +var1+ 'pt\">' +var2+ '</span>';
break; break;
case 'font': case 'font':
code = '<span style=\"font-family: ' +var1+ '\">' +var2+ '</span>'; code = '<span style=\"font-family: ' +var1+ '\">' +var2+ '</span>';
break; break;
case 'align': case 'align':
code = '<div style=\"text-align: ' +var1+ '\">' +var2+ '</div>'; code = '<div style=\"text-align: ' +var1+ '\">' +var2+ '</div>';
break; break;
case 'quote': case 'quote':
code = '[quote]' +var1+ '[/quote]'; code = '[quote]' +var1+ '[/quote]';
break; break;
case 'list': case 'list':
code = '<ul>\\n<li>Text1</li>\\n<li>Text2</li>\\n<li>Text3</li>\\n</ul>'; code = '<ul>\\n<li>Text1</li>\\n<li>Text2</li>\\n<li>Text3</li>\\n</ul>';
alert('Sample List will be inserted into the textarea'); alert('Sample List will be inserted into the textarea');
break; break;
default: default:
} }
code = ' ' + code + ' '; code = ' ' + code + ' ';
opener.document.addnews.$target.value += code; opener.document.addnews.$target.value += code;
if(document.my.ifClose.checked == true) if(document.my.ifClose.checked == true)
{ {
opener.document.addnews.$target.focus(); opener.document.addnews.$target.focus();
window.close(); window.close();
opener.document.addnews.$target.focus(); opener.document.addnews.$target.focus();
} }
} }
} }
//--> //-->
</script> </script>
<table border=0 height=247 width=320 cellspacing=\"0\" cellpadding=\"0\"> <table border=0 height=247 width=320 cellspacing=\"0\" cellpadding=\"0\">
<td height=\"15\" colspan=\"2\" width=\"21\"> <td height=\"15\" colspan=\"2\" width=\"21\">
<td height=\"15\" width=\"342\"> <td height=\"15\" width=\"342\">
<tr> <tr>
<td height=\"15\" colspan=\"2\" width=\"367\"> <td height=\"15\" colspan=\"2\" width=\"367\">
<font size=\"1\" face=\"Verdana\"><b>QuickTags</b></font> <font size=\"1\" face=\"Verdana\"><b>QuickTags</b></font>
<td height=\"15\" width=\"0\"> <td height=\"15\" width=\"0\">
</tr> </tr>
<tr bgcolor=#F7F6F4><td height=16 width=\"21\"> <tr bgcolor=#F7F6F4><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('link', prompt('Enter the complete URL of the hyperlink', 'http://'), prompt('Enter the title of the webpage', '') )\"> <a href=\"javascript:insertcode('link', prompt('Enter the complete URL of the hyperlink', 'http://'), prompt('Enter the title of the webpage', '') )\">
Insert Link</a> Insert Link</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[link=<font color=\"#808080\">URL</font>]<font color=\"#808080\">Text</font>[/link] [link=<font color=\"#808080\">URL</font>]<font color=\"#808080\">Text</font>[/link]
</tr> </tr>
<tr ><td height=16 width=\"21\"> <tr ><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('image', prompt('Enter URL of the Image:', 'http://') )\"> <a href=\"javascript:insertcode('image', prompt('Enter URL of the Image:', 'http://') )\">
Insert Image</a> Insert Image</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[image=<font color=\"#808080\">URL</font>] [image=<font color=\"#808080\">URL</font>]
</tr> </tr>
<tr bgcolor=#F7F6F4><td height=16 width=\"21\"> <tr bgcolor=#F7F6F4><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('quote', prompt('Text to Quote:', '') )\"> <a href=\"javascript:insertcode('quote', prompt('Text to Quote:', '') )\">
Instert Quote</a> Instert Quote</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[quote=<font color=\"#808080\">Name</font>]<font color=\"#808080\">Text</font>[/quote] [quote=<font color=\"#808080\">Name</font>]<font color=\"#808080\">Text</font>[/quote]
</tr> </tr>
<tr ><td height=16 width=\"21\"> <tr ><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('list', 'none' )\"> <a href=\"javascript:insertcode('list', 'none' )\">
Insert List</a> Insert List</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[list]<font color=\"#808080\">[*]Text1[*]Text2</font>[/list] [list]<font color=\"#808080\">[*]Text1[*]Text2</font>[/list]
</tr> </tr>
<tr bgcolor=#F7F6F4><td height=16 width=\"21\"> <tr bgcolor=#F7F6F4><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('bold', prompt('Enter Text you want to be BOLD', '') )\"> <a href=\"javascript:insertcode('bold', prompt('Enter Text you want to be BOLD', '') )\">
Bold Text</a> Bold Text</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[b]<font color=\"#808080\">Text</font>[/b] [b]<font color=\"#808080\">Text</font>[/b]
</tr><tr ><td height=16 width=\"21\"> </tr><tr ><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('italic', prompt('Enter Text you want to be Italic', '') )\"> <a href=\"javascript:insertcode('italic', prompt('Enter Text you want to be Italic', '') )\">
Italic Text</a> Italic Text</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[i]<font color=\"#808080\">Text</font>[/i] [i]<font color=\"#808080\">Text</font>[/i]
</tr><tr bgcolor=#F7F6F4><td height=16 width=\"21\"> </tr><tr bgcolor=#F7F6F4><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('underline', prompt('Enter Text you want to be Underlined', '') )\"> <a href=\"javascript:insertcode('underline', prompt('Enter Text you want to be Underlined', '') )\">
Underlined Text</a> Underlined Text</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[u]<font color=\"#808080\">Text</font>[/u] [u]<font color=\"#808080\">Text</font>[/u]
</tr> </tr>
<tr><td height=16 width=\"21\"> <tr><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('color', prompt('Enter color of the text (blue, red, green, fuchsia)',''), prompt('Enter the text to be in this color','') )\"> <a href=\"javascript:insertcode('color', prompt('Enter color of the text (blue, red, green, fuchsia)',''), prompt('Enter the text to be in this color','') )\">
Text Color</a> Text Color</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[color=<font color=\"#808080\">COLOR</font>]<font color=\"#808080\">Text</font>[/color] [color=<font color=\"#808080\">COLOR</font>]<font color=\"#808080\">Text</font>[/color]
</tr><tr bgcolor=#F7F6F4><td height=16 width=\"21\"> </tr><tr bgcolor=#F7F6F4><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('size', prompt('Enter size of the text (in points format)',''), prompt('Enter the text to be in this size','') )\"> <a href=\"javascript:insertcode('size', prompt('Enter size of the text (in points format)',''), prompt('Enter the text to be in this size','') )\">
Text Size</a> Text Size</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[size=<font color=\"#808080\">SIZE</font>]<font color=\"#808080\">Text</font>[/size] [size=<font color=\"#808080\">SIZE</font>]<font color=\"#808080\">Text</font>[/size]
</tr><tr><td height=16 width=\"21\"> </tr><tr><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('font', prompt('Enter font of the text (verdana, arial, times, courier)',''), prompt('Enter the text to be in this font','') )\"> <a href=\"javascript:insertcode('font', prompt('Enter font of the text (verdana, arial, times, courier)',''), prompt('Enter the text to be in this font','') )\">
Text Font</a> Text Font</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[font=<font color=\"#808080\">FONT</font>]<font color=\"#808080\">Text</font>[/font] [font=<font color=\"#808080\">FONT</font>]<font color=\"#808080\">Text</font>[/font]
</tr><tr bgcolor=#F7F6F4><td height=16 width=\"21\"> </tr><tr bgcolor=#F7F6F4><td height=16 width=\"21\">
&nbsp; &nbsp;
<td height=16 width=\"344\"> <td height=16 width=\"344\">
<a href=\"javascript:insertcode('align', prompt('Enter align of the text (right, left, center, justify)',''), prompt('Enter the text to be in this align','') )\"> <a href=\"javascript:insertcode('align', prompt('Enter align of the text (right, left, center, justify)',''), prompt('Enter the text to be in this align','') )\">
Text Align</a> Text Align</a>
<td height=16 width=\"0\"> <td height=16 width=\"0\">
[align=<font color=\"#808080\">ALIGN</font>]<font color=\"#808080\">Text</font>[/align] [align=<font color=\"#808080\">ALIGN</font>]<font color=\"#808080\">Text</font>[/align]
</tr><tr> </tr><tr>
<td width=21 height=\"57\"> <td width=21 height=\"57\">
&nbsp;<form name=my> &nbsp;<form name=my>
<td height=57 colspan=\"2\" width=\"342\"> <td height=57 colspan=\"2\" width=\"342\">
<label><input type=checkbox checked name=ifClose> Close this window after I insert code</label> <label><input type=checkbox checked name=ifClose> Close this window after I insert code</label>
</tr></form> </tr></form>
</table></body></HTML>"; </table></body></HTML>";
} }
else{ else{
echoheader("question", "Help / About"); echoheader("question", "Help / About");
if ( function_exists("md5_file") ){ if ( function_exists("md5_file") ){
$functions_md5 = md5_file("inc/functions.inc.php"); $functions_md5 = md5_file("inc/functions.inc.php");
}else{ }else{
$functions_md5 = "MD5NotSupported"; $functions_md5 = "MD5NotSupported";
} }
// echo"$functions_md5"; // echo"$functions_md5";
if(file_exists("./data/reg.php")){ include("./data/reg.php"); } if(file_exists("./data/reg.php")){ include("./data/reg.php"); }
echo"<table border=0 cellpading=0 cellspacing=0 width=\"654\" height=\"175\" > echo"<table border=0 cellpading=0 cellspacing=0 width=\"654\" height=\"175\" >
<tr> <tr>
<td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\"> <td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\">
&nbsp; <font size=\"2\"><b>Help &amp; Support</b></font>&nbsp; &nbsp; <font size=\"2\"><b>Help &amp; Support</b></font>&nbsp;
</tr> </tr>
<tr> <tr>
<td width=\"31\" valign=\"middle\" height=\"70\"> <td width=\"31\" valign=\"middle\" height=\"70\">
&nbsp;&nbsp; &nbsp;&nbsp;
<td width=\"619\" valign=\"middle\" colspan=\"2\" align=justify> <td width=\"619\" valign=\"middle\" colspan=\"2\" align=justify>
If you are experiencing any kind of problems, the first thing you should do before asking for help from us is look If you are experiencing any kind of problems, the first thing you should do before asking for help from us is look
at <a href=\"$PHP_SELF?mod=help\">CuteNews internal Help Documentation</a>. at <a href=\"$PHP_SELF?mod=help\">CuteNews internal Help Documentation</a>.
If you still can not solve your problem look at the <a href=\"http://cutephp.com/faq/\" target=\"_blank\">FAQ section of our site</a> or post your issues in our <a href=\"http://cutephp.com/forum/\" target=\"_blank\">support If you still can not solve your problem look at the <a href=\"http://cutephp.com/faq/\" target=\"_blank\">FAQ section of our site</a> or post your issues in our <a href=\"http://cutephp.com/forum/\" target=\"_blank\">support
forum</a>, but only after you have read the readme.html file included in the zip forum</a>, but only after you have read the readme.html file included in the zip
<ol style=\"margin-bottom:8px;\"> <ol style=\"margin-bottom:8px;\">
<li><a href=\"$PHP_SELF?mod=help\">Internal Help Documentation</a></li> <li><a href=\"$PHP_SELF?mod=help\">Internal Help Documentation</a></li>
<li><a href=\"http://cutephp.com/cutenews/readme.html\" target=_blank>Readme.html File (online)</a></li> <li><a href=\"http://cutephp.com/cutenews/readme.html\" target=_blank>Readme.html File (online)</a></li>
<li><a href=\"http://cutephp.com/forum/\" target=_blank>Support Forums</a></li> <li><a href=\"http://cutephp.com/forum/\" target=_blank>Support Forums</a></li>
</ol> </ol>
</tr> </tr>
<tr> <tr>
<td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\"> <td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\">
&nbsp;&nbsp;<font size=\"2\"><b>Version Check</b></font> &nbsp;&nbsp;<font size=\"2\"><b>Version Check</b></font>
</tr> </tr>
<tr> <tr>
<td width=\"29\" valign=\"middle\" height=\"24\"> <td width=\"29\" valign=\"middle\" height=\"24\">
<td width=\"100\" valign=\"middle\" height=\"24\"> <td width=\"100\" valign=\"middle\" height=\"24\">
Your version Your version
<td width=\"523\" valign=\"middle\" height=\"24\"> <td width=\"523\" valign=\"middle\" height=\"24\">
: $config_version_name &nbsp;&nbsp;(build Id - $config_version_id) : $config_version_name &nbsp;&nbsp;(build Id - $config_version_id)
</tr> </tr>
<tr> <tr>
<td width=\"29\" valign=\"middle\" height=\"23\"> <td width=\"29\" valign=\"middle\" height=\"23\">
<td width=\"100\" valign=\"top\" height=\"23\"> <td width=\"100\" valign=\"top\" height=\"23\">
Latest Version Latest Version
<td width=\"521\" valign=\"top\" height=\"23\"> <td width=\"521\" valign=\"top\" height=\"23\">
: <script type=\"text/javascript\" src=\"http://cutephp.com/cutenews/check_version.php?config_http_script_dir=$config_http_script_dir&mybid=$config_version_id&reglicense=$reg_site_key&functions_md5=$functions_md5\"></script> : <script type=\"text/javascript\" src=\"http://cutephp.com/cutenews/check_version.php?config_http_script_dir=$config_http_script_dir&mybid=$config_version_id&reglicense=$reg_site_key&functions_md5=$functions_md5\"></script>
</tr> </tr>
"; ";
if(!file_exists('./data/reg.php')){ echo" if(!file_exists('./data/reg.php')){ echo"
<tr> <tr>
<td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\"> <td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\">
&nbsp;&nbsp;<font size=\"2\" color=red><b>Unregistered</b></font> &nbsp;&nbsp;<font size=\"2\" color=red><b>Unregistered</b></font>
</tr> </tr>
<tr> <tr>
<td width=\"29\" valign=\"middle\" height=\"24\"> <td width=\"29\" valign=\"middle\" height=\"24\">
<td width=\"100\" valign=\"middle\" height=\"24\" style=\"color:red;\"> &raquo; &raquo; &raquo; <td width=\"100\" valign=\"middle\" height=\"24\" style=\"color:red;\"> &raquo; &raquo; &raquo;
<td width=\"523\" valign=\"middle\" height=\"24\">Your version of CuteNews is Unregistered - <b><a href=\"http://cutephp.com/cutenews/register/\" target=_blank>Find out how to register it</a></b><br> <td width=\"523\" valign=\"middle\" height=\"24\">Your version of CuteNews is Unregistered - <b><a href=\"http://cutephp.com/cutenews/register/\" target=_blank>Find out how to register it</a></b><br>
by registering your version, all 'powered by CuteNews...' lines will be removed by registering your version, all 'powered by CuteNews...' lines will be removed
</tr> </tr>
"; ";
} }
echo" echo"
<tr> <tr>
<td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\"> <td width=\"650\" valign=\"middle\" height=\"1\" bgcolor=\"#F7F6F4\" colspan=\"3\">
&nbsp; <font size=\"2\"><b>Rate our Script</b></font> &nbsp; <font size=\"2\"><b>Rate our Script</b></font>
</tr> </tr>
<tr> <tr>
<td width=\"33\" valign=\"middle\" height=\"47\"> <td width=\"33\" valign=\"middle\" height=\"47\">
<p> <p>
<form action=\"http://www.hotscripts.com/rate/21011.html\" method=\"POST\" target=\"_blank\"> <form action=\"http://www.hotscripts.com/rate/21011.html\" method=\"POST\" target=\"_blank\">
<td width=\"617\" valign=\"middle\" height=\"47\" colspan=\"2\"> <td width=\"617\" valign=\"middle\" height=\"47\" colspan=\"2\">
Please rate our script <a href=\"http://www.hotscripts.com/?RID=11206\" style=\"text-decoration: none\"> Please rate our script <a href=\"http://www.hotscripts.com/?RID=11206\" style=\"text-decoration: none\">
@ HotScripts.com @ HotScripts.com
</a> if you like it. &nbsp; </a> if you like it. &nbsp;
<select name=rating size=1> <select name=rating size=1>
<option value=5 selected>Excellent!</option> <option value=5 selected>Excellent!</option>
<option value=4>Very Good</option> <option value=4>Very Good</option>
<option value=3>Good</option> <option value=3>Good</option>
<option value=2>Fair</option> <option value=2>Fair</option>
<option value=1>Poor</option> <option value=1>Poor</option>
</select> </select>
<input type=\"submit\" value=\"Cast My Vote!\"> <input type=\"submit\" value=\"Cast My Vote!\">
<input type=\"hidden\" name=\"sexternal\" value=\"1\"> <input type=\"hidden\" name=\"sexternal\" value=\"1\">
</form> </form>
</tr> </tr>
</table>"; </table>";
echofooter(); echofooter();
} }
?> ?>
<?PHP <?PHP
if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to add news"); } if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to add news"); }
$orig_cat_lines = file("./data/category.db.php"); $orig_cat_lines = file("./data/category.db.php");
//only show allowed categories //only show allowed categories
$allowed_cats = array(); $allowed_cats = array();
$cat_lines = array(); $cat_lines = array();
foreach($orig_cat_lines as $single_line){ foreach($orig_cat_lines as $single_line){
$ocat_arr = explode("|", $single_line); $ocat_arr = explode("|", $single_line);
if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){ if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){
$cat_lines[] = $single_line; $cat_lines[] = $single_line;
$allowed_cats[] = $ocat_arr[0]; $allowed_cats[] = $ocat_arr[0];
} }
} }
if ($action == "addnews"){ if ($action == "addnews"){
echoheader("addnews", "Add News"); echoheader("addnews", "Add News");
$short_story_id = 'short_story'; $short_story_id = 'short_story';
$full_story_id = 'full_story'; $full_story_id = 'full_story';
// //
// Are we using the WYSIWYG ? // Are we using the WYSIWYG ?
// //
if($config_use_wysiwyg == "yes"){ if($config_use_wysiwyg == "yes"){
$use_wysiwyg = true; $use_wysiwyg = true;
$article_format_options = " $article_format_options = "
<label for='convert'> <label for='convert'>
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to &lt;br /&gt;</label> <input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to &lt;br /&gt;</label>
<br/> <br/>
<label for='html'> <label for='html'>
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label> <input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label>
<input type=hidden name=\"if_use_html\" value=\"yes\"> <input type=hidden name=\"if_use_html\" value=\"yes\">
<br/>"; <br/>";
}else{ }else{
$use_wysiwyg = false; $use_wysiwyg = false;
$article_format_options = " $article_format_options = "
<label for='convert'> <label for='convert'>
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to &lt;br /&gt;</label> <input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to &lt;br /&gt;</label>
<br/> <br/>
<label for='html'> <label for='html'>
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label> <input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label>
<br/>"; <br/>";
} }
echo " echo "
<SCRIPT LANGUAGE=\"JavaScript\"> <SCRIPT LANGUAGE=\"JavaScript\">
function preview(){ function preview(){
if(document.addnews.short_story.value == '' || document.addnews.title.value == ''){ alert('Your article must have at least Title and Short Story'); } if(document.addnews.short_story.value == '' || document.addnews.title.value == ''){ alert('Your article must have at least Title and Short Story'); }
else{ else{
dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1') dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1')
document.addnews.mod.value='preview';document.addnews.target='prv' document.addnews.mod.value='preview';document.addnews.target='prv'
document.addnews.submit();dd.focus() document.addnews.submit();dd.focus()
setTimeout(\"document.addnews.mod.value='addnews';document.addnews.target='_self'\",500) setTimeout(\"document.addnews.mod.value='addnews';document.addnews.target='_self'\",500)
} }
} }
function increaseTextarea(area){ function increaseTextarea(area){
if (document.getElementById(area).style.height == '') { if (document.getElementById(area).style.height == '') {
document.getElementById(area).style.height = '300px'; document.getElementById(area).style.height = '300px';
} }
else{ else{
var pattern = new RegExp(\"\\\\d+\",'ig'); var pattern = new RegExp(\"\\\\d+\",'ig');
var currHeight = document.getElementById(area).style.height.match(pattern); var currHeight = document.getElementById(area).style.height.match(pattern);
var newHeight = +currHeight + 100; var newHeight = +currHeight + 100;
document.getElementById(area).style.height = newHeight + 'px'; document.getElementById(area).style.height = newHeight + 'px';
} }
} }
function submitForm() { function submitForm() {
//make sure hidden and iframe values are in sync before submitting form //make sure hidden and iframe values are in sync before submitting form
//to sync only 1 rte, use updateRTE(rte) //to sync only 1 rte, use updateRTE(rte)
//to sync all rtes, use updateRTEs //to sync all rtes, use updateRTEs
updateRTE('short_story'); updateRTE('short_story');
updateRTE('full_story'); updateRTE('full_story');
//updateRTEs(); //updateRTEs();
//change the following line to true to submit form //change the following line to true to submit form
return true; return true;
} }
function increaseTextareaBug(){"; function increaseTextareaBug(){";
if($use_wysiwyg){ if($use_wysiwyg){
echo"var area = '$full_story_id'; echo"var area = '$full_story_id';
if (document.getElementById(area).style.height == '') { if (document.getElementById(area).style.height == '') {
document.getElementById(area).style.height = '250px'; document.getElementById(area).style.height = '250px';
} }
else{ else{
var pattern = new RegExp(\"\\\\d+\",'ig'); var pattern = new RegExp(\"\\\\d+\",'ig');
var currHeight = document.getElementById(area).style.height.match(pattern); var currHeight = document.getElementById(area).style.height.match(pattern);
var newHeight = +currHeight + 1; var newHeight = +currHeight + 1;
document.getElementById(area).style.height = newHeight + 'px'; document.getElementById(area).style.height = newHeight + 'px';
}"; }";
} }
echo"} echo"}
onload=focus;function focus(){document.forms[0].title.focus();} onload=focus;function focus(){document.forms[0].title.focus();}
</SCRIPT> </SCRIPT>
<form onSubmit = \"return submitForm();\" method=post name=addnews action=\"$PHP_SELF\"> <form onSubmit = \"return submitForm();\" method=post name=addnews action=\"$PHP_SELF\">
<table border=0 cellpading=0 cellspacing=0 width=\"654\" > <table border=0 cellpading=0 cellspacing=0 width=\"654\" >
<tr> <tr>
<td width=\"75\"> <td width=\"75\">
Title Title
<td width=\"575\" colspan=\"2\"> <td width=\"575\" colspan=\"2\">
<input type=text size=\"55\" name=\"title\" tabindex=1> <input type=text size=\"55\" name=\"title\" tabindex=1>
</tr>"; </tr>";
if($config_use_avatar == "yes"){ if($config_use_avatar == "yes"){
echo"<tr> echo"<tr>
<td width=\"75\"> <td width=\"75\">
Avatar URL Avatar URL
<td width=\"575\" colspan=\"2\"> <td width=\"575\" colspan=\"2\">
<input tabindex=2 type=text size=\"42\" value=\"$member_db[8]\" name=\"manual_avatar\" >&nbsp;&nbsp;&nbsp;<font style=\"font-size:7pt\">(optional)</font> <input tabindex=2 type=text size=\"42\" value=\"$member_db[8]\" name=\"manual_avatar\" >&nbsp;&nbsp;&nbsp;<font style=\"font-size:7pt\">(optional)</font>
</tr>"; </tr>";
} }
/* Old Single Category Code */ /* Old Single Category Code */
if(count($cat_lines) > 0){ if(count($cat_lines) > 0){
echo"<tr id='singlecat'> echo"<tr id='singlecat'>
<td width=\"75\"> <td width=\"75\">
Category Category
<td width=\"575\" colspan=\"2\"> <td width=\"575\" colspan=\"2\">
<select id='selecsinglecat' name=category tabindex=3>\n <select id='selecsinglecat' name=category tabindex=3>\n
<option value=\"\"> </option>\n"; <option value=\"\"> </option>\n";
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$if_is_selected = ""; $if_is_selected = "";
if($category == $cat_arr[0]){ $if_is_selected = " selected "; } if($category == $cat_arr[0]){ $if_is_selected = " selected "; }
echo"<option $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; echo"<option $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
} }
echo"</select> <a href=\"javascript:ShowOrHide('multicat','singlecat');\" onClick=\"javascript:document.getElementById('selecsinglecat').name='';\">(multiple categories)</a></tr>"; echo"</select> <a href=\"javascript:ShowOrHide('multicat','singlecat');\" onClick=\"javascript:document.getElementById('selecsinglecat').name='';\">(multiple categories)</a></tr>";
} }
/*### /*###
##### New Multy Category Code ##### New Multy Category Code
*/### */###
if(count($cat_lines) > 0){ if(count($cat_lines) > 0){
echo" echo"
<tr style=\"display:none;\" id='multicat'> <tr style=\"display:none;\" id='multicat'>
<td width=\"75\"> <td width=\"75\">
Category Category
<td>"; <td>";
echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">'; echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">';
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$if_is_selected = ""; $if_is_selected = "";
if($category == $cat_arr[0]){ $if_is_selected = " checked "; } if($category == $cat_arr[0]){ $if_is_selected = " checked "; }
// echo"<input name='category[]' type=checkbox $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1],\n"; // echo"<input name='category[]' type=checkbox $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1],\n";
echo" echo"
<td style='font-size:10px;' valign=top> <td style='font-size:10px;' valign=top>
<label for='cat{$cat_arr[0]}'> <label for='cat{$cat_arr[0]}'>
<input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>"; <input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>";
$i++; $i++;
if ($i%4 == 0){ echo'<tr>'; } if ($i%4 == 0){ echo'<tr>'; }
} }
echo"</tr></table> <td> </td> "; echo"</tr></table> <td> </td> ";
} }
echo" echo"
<tr> <tr>
<td width=\"75\" valign=\"top\"> <td width=\"75\" valign=\"top\">
<br />Short Story <br />Short Story
<td>"; <td>";
if ($use_wysiwyg) { if ($use_wysiwyg) {
echo" echo"
<script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script> <script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script>
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script> initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script>
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
writeRichText('short_story', '', 460, 250, true, false); writeRichText('short_story', '', 460, 250, true, false);
</script> </script>
"; ";
}else{ }else{
echo" echo"
<textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=4></textarea> <textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=4></textarea>
"; ";
} }
echo" echo"
<td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'> <td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'>
<p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\"><br /> <p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\"><br />
[insert image]</a><br /> [insert image]</a><br />
<!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=short_story', '_CuteCode', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[quick tags]</a><br /> --> <!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=short_story', '_CuteCode', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[quick tags]</a><br /> -->
<a href=# onclick=\"increaseTextarea('$short_story_id'); return false;\">[expand]</a> <a href=# onclick=\"increaseTextarea('$short_story_id'); return false;\">[expand]</a>
<br /><br /> <br /><br />
"; ";
echo insertSmilies("$short_story_id", 4, true, "$use_wysiwyg"); echo insertSmilies("$short_story_id", 4, true, "$use_wysiwyg");
echo" echo"
</tr> </tr>
<tr id='full-story' style='display:none;z-index:1;'> <tr id='full-story' style='display:none;z-index:1;'>
<td width=\"75\" valign=\"top\"> <td width=\"75\" valign=\"top\">
<br />Full Story<br /><font style=\"font-size:7pt\">(optional)</font> <br />Full Story<br /><font style=\"font-size:7pt\">(optional)</font>
<td> <td>
"; ";
if ($use_wysiwyg) { if ($use_wysiwyg) {
echo"<script language=\"JavaScript\" type=\"text/javascript\"> echo"<script language=\"JavaScript\" type=\"text/javascript\">
writeRichText('full_story', '', 460, 300, true, false); writeRichText('full_story', '', 460, 300, true, false);
</script>"; </script>";
}else{ }else{
echo"<textarea rows=\"12\" cols=\"74\" id=\"full_story\" name=\"full_story\" tabindex=5></textarea>"; echo"<textarea rows=\"12\" cols=\"74\" id=\"full_story\" name=\"full_story\" tabindex=5></textarea>";
} }
echo" echo"
<td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'> <td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'>
<p align=\"center\"><br /> <p align=\"center\"><br />
<a href=# onclick=\"window.open('$PHP_SELF?mod=images&action=quick&area=$full_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[insert image]</a><br /> <a href=# onclick=\"window.open('$PHP_SELF?mod=images&action=quick&area=$full_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[insert image]</a><br />
<!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=full_story', '_Addimage', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_CuteCode\">[quick tags]</a><br />--> <!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=full_story', '_Addimage', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_CuteCode\">[quick tags]</a><br />-->
<a href=# onclick=\"increaseTextarea('$full_story_id'); return false;\">[expand]</a> <a href=# onclick=\"increaseTextarea('$full_story_id'); return false;\">[expand]</a>
<br /><br /> <br /><br />
"; ";
echo insertSmilies("$full_story_id", 4, true, "$use_wysiwyg"); echo insertSmilies("$full_story_id", 4, true, "$use_wysiwyg");
echo" echo"
</tr> </tr>
<tr> <tr>
<td> <td>
<td> <td>
<table border=0 cellspacing=0 cellpadding=0 width=100%> <table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr> <tr>
<td width=50%> <td width=50%>
<input type=submit style='font-weight:bold' title=\"Post the New Article\" value=\" Add News \" accesskey=\"s\"> <input type=submit style='font-weight:bold' title=\"Post the New Article\" value=\" Add News \" accesskey=\"s\">
</td> </td>
<td width=50% align=right> <td width=50% align=right>
<input style='width:110px;'type=button onClick=\"ShowOrHide('full-story',''); setTimeout('increaseTextareaBug()',310);\" value=\"Toggle Full-Story\"> <input style='width:90px;' type=button onClick=\"ShowOrHide('options','');\" value=\"Article Options\"> <input style='width:110px;'type=button onClick=\"ShowOrHide('full-story',''); setTimeout('increaseTextareaBug()',310);\" value=\"Toggle Full-Story\"> <input style='width:90px;' type=button onClick=\"ShowOrHide('options','');\" value=\"Article Options\">
</td> </td>
</tr> </tr>
</table> </table>
</tr> </tr>
<tr id='options' style='display:none;'> <tr id='options' style='display:none;'>
<td width=\"75\"><br>Options <td width=\"75\"><br>Options
<td width=\"575\" colspan=\"4\"> <td width=\"575\" colspan=\"4\">
<br> <br>
$article_format_options $article_format_options
<label for='active'><input CHECKED id='active' style=\"border:0; background-color:transparent\" type=radio value=\"active\" name=\"postpone_draft\"> <label for='active'><input CHECKED id='active' style=\"border:0; background-color:transparent\" type=radio value=\"active\" name=\"postpone_draft\">
<b>Normal</b>, add article as active</label> <b>Normal</b>, add article as active</label>
<br /> <br />
<label for='draft'><input id='draft' style=\"border:0; background-color:transparent\" type=radio value=\"draft\" name=\"postpone_draft\"> <label for='draft'><input id='draft' style=\"border:0; background-color:transparent\" type=radio value=\"draft\" name=\"postpone_draft\">
<b>Draft</b>, add article as unapproved</label> <b>Draft</b>, add article as unapproved</label>
<br /> <br />
<label for='postpone'><input id='postpone' style=\"border:0; background-color:transparent\" type=radio value=\"postpone\" name=\"postpone_draft\"> <label for='postpone'><input id='postpone' style=\"border:0; background-color:transparent\" type=radio value=\"postpone\" name=\"postpone_draft\">
<b>Postpone</b>, make article active at</label> <b>Postpone</b>, make article active at</label>
<select name=from_date_day>"; <select name=from_date_day>";
for($i=1;$i<32;$i++){ for($i=1;$i<32;$i++){
if(date("j") == $i){ echo"<option selected value=$i>$i</option> \n"; } if(date("j") == $i){ echo"<option selected value=$i>$i</option> \n"; }
else{ echo"<option value=$i>$i</option> \n"; } else{ echo"<option value=$i>$i</option> \n"; }
} }
echo"</select> \n <select name=from_date_month> \n"; echo"</select> \n <select name=from_date_month> \n";
for($i=1;$i<13;$i++){ for($i=1;$i<13;$i++){
$timestamp = mktime(0,0,0,$i,1,2003); $timestamp = mktime(0,0,0,$i,1,2003);
if(date("n") == $i){ echo"<option selected value=$i>". date("M", $timestamp) ."</option> \n"; } if(date("n") == $i){ echo"<option selected value=$i>". date("M", $timestamp) ."</option> \n"; }
else{ echo"<option value=$i>". date("M", $timestamp) ."</option> \n"; } else{ echo"<option value=$i>". date("M", $timestamp) ."</option> \n"; }
} }
echo"</select> \n <select name=from_date_year>"; echo"</select> \n <select name=from_date_year>";
for($i=2005;$i<2011;$i++){ for($i=2005;$i<2011;$i++){
if(date("Y") == $i){ echo"<option selected value=$i>$i</option> \n"; } if(date("Y") == $i){ echo"<option selected value=$i>$i</option> \n"; }
else{ echo"<option value=$i>$i</option> \n"; } else{ echo"<option value=$i>$i</option> \n"; }
} }
$date_hour = date("H"); $date_hour = date("H");
$date_minutes = date("i"); $date_minutes = date("i");
echo" echo"
</select> </select>
@ <input value='$date_hour' title='24 Hour format [hh]' name=from_date_hour size=2 type=text /> : <input value='$date_minutes' title='Minutes [mm]' name=from_date_minutes size=2 type=text /> @ <input value='$date_hour' title='24 Hour format [hh]' name=from_date_hour size=2 type=text /> : <input value='$date_minutes' title='Minutes [mm]' name=from_date_minutes size=2 type=text />
</tr> </tr>
<input type=hidden name=mod value=addnews> <input type=hidden name=mod value=addnews>
<input type=hidden name=action value=doaddnews> <input type=hidden name=action value=doaddnews>
</table></form>"; </table></form>";
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Do add News to news.txt // Do add News to news.txt
// ******************************************************************************** // ********************************************************************************
elseif($action == "doaddnews") elseif($action == "doaddnews")
{ {
///// /////
///Format our categories variable ///Format our categories variable
///// /////
if( is_array($category) ){ //User has selected multiple categories if( is_array($category) ){ //User has selected multiple categories
$nice_category = ''; $nice_category = '';
$ccount = 0; $ccount = 0;
foreach($category as $ckey=>$cvalue){ foreach($category as $ckey=>$cvalue){
if( !in_array($cvalue,$allowed_cats) ){ die('not allowed category'); } if( !in_array($cvalue,$allowed_cats) ){ die('not allowed category'); }
if($ccount==0){ $nice_category = $cvalue; }//first cat if($ccount==0){ $nice_category = $cvalue; }//first cat
else{ $nice_category = $nice_category.','.$cvalue; } else{ $nice_category = $nice_category.','.$cvalue; }
$ccount++; $ccount++;
} }
}else{ //Single or Not category }else{ //Single or Not category
//don't format $nice_cats because we have not selected any. //don't format $nice_cats because we have not selected any.
if( $category !="" and isset($category) and !in_array($category,$allowed_cats) ){ die('not allowed category'); } if( $category !="" and isset($category) and !in_array($category,$allowed_cats) ){ die('not allowed category'); }
$nice_category = $category; $nice_category = $category;
} }
// die($nice_category); // die($nice_category);
if($member_db[1] == 3 or $postpone_draft == "draft"){ if($member_db[1] == 3 or $postpone_draft == "draft"){
//if the user is Journalist, add the article as unapproved //if the user is Journalist, add the article as unapproved
$decide_news_file = "./data/unapproved_news.txt"; $decide_news_file = "./data/unapproved_news.txt";
$added_time = time()+ ($config_date_adjust*60); $added_time = time()+ ($config_date_adjust*60);
$postpone = FALSE; $postpone = FALSE;
$unapproved_status_msg = "The article was marked as Unapproved!"; $unapproved_status_msg = "The article was marked as Unapproved!";
} }
elseif($postpone_draft == "postpone"){ elseif($postpone_draft == "postpone"){
if( !ereg("^[[:digit:]]{1,}$", $from_date_hour) or !ereg("^[[:digit:]]{1,}$", $from_date_minutes) ){ msg("error","Error !!!","You want to add a postponed article, but the hour format is invalid.", "javascript:history.go(-1)"); } if( !ereg("^[[:digit:]]{1,}$", $from_date_hour) or !ereg("^[[:digit:]]{1,}$", $from_date_minutes) ){ msg("error","Error !!!","You want to add a postponed article, but the hour format is invalid.", "javascript:history.go(-1)"); }
$postpone = TRUE; $postpone = TRUE;
$added_time = mktime($from_date_hour,$from_date_minutes,0,$from_date_month,$from_date_day,$from_date_year) + ($config_date_adjust*60); $added_time = mktime($from_date_hour,$from_date_minutes,0,$from_date_month,$from_date_day,$from_date_year) + ($config_date_adjust*60);
$decide_news_file = "./data/postponed_news.txt"; $decide_news_file = "./data/postponed_news.txt";
} }
else{ else{
$postpone = FALSE; $postpone = FALSE;
$added_time = time()+ ($config_date_adjust*60); $added_time = time()+ ($config_date_adjust*60);
$decide_news_file = "./data/news.txt"; $decide_news_file = "./data/news.txt";
} }
if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; } if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; }
if($if_use_html == "yes"){ $use_html = TRUE; } if($if_use_html == "yes"){ $use_html = TRUE; }
$full_story = replace_news("add", $full_story, $n_to_br, $use_html); $full_story = replace_news("add", $full_story, $n_to_br, $use_html);
$short_story = replace_news("add", $short_story, $n_to_br, $use_html); $short_story = replace_news("add", $short_story, $n_to_br, $use_html);
// $title = replace_news("add", $title, TRUE, $use_html); // $title = replace_news("add", $title, TRUE, $use_html);
$title = replace_news("add", $title, TRUE, FALSE); // HTML in title is not allowed $title = replace_news("add", $title, TRUE, FALSE); // HTML in title is not allowed
if(trim($title) == "" or !$title){ msg("error","Error !!!","The title can not be blank.", "javascript:history.go(-1)"); } if(trim($title) == "" or !$title){ msg("error","Error !!!","The title can not be blank.", "javascript:history.go(-1)"); }
if(trim($short_story) == "" or !$short_story){ msg("error","Error !!!","The story can not be blank.", "javascript:history.go(-1)"); } if(trim($short_story) == "" or !$short_story){ msg("error","Error !!!","The story can not be blank.", "javascript:history.go(-1)"); }
if($member_db[7] == 1){ $added_by_email = $member_db[5]; } if($member_db[7] == 1){ $added_by_email = $member_db[5]; }
else{ $added_by_email = "none"; } else{ $added_by_email = "none"; }
// Save The News Article In Active_News_File // Save The News Article In Active_News_File
$all_db = file("$decide_news_file"); $all_db = file("$decide_news_file");
foreach($all_db as $news_line){ foreach($all_db as $news_line){
$news_arr = explode("|", $news_line); $news_arr = explode("|", $news_line);
if($news_arr[0] == $added_time){ $added_time++; } if($news_arr[0] == $added_time){ $added_time++; }
} }
$news_file = fopen("$decide_news_file", "w"); $news_file = fopen("$decide_news_file", "w");
fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$nice_category||\n"); fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$nice_category||\n");
foreach ($all_db as $line){ fwrite($news_file, "$line");} foreach ($all_db as $line){ fwrite($news_file, "$line");}
fclose($news_file); fclose($news_file);
// Add Blank Comment In The Active_Comments_File // Add Blank Comment In The Active_Comments_File
$old_com_db = file("./data/comments.txt"); $old_com_db = file("./data/comments.txt");
$new_com_db = fopen("./data/comments.txt", "w"); $new_com_db = fopen("./data/comments.txt", "w");
fwrite($new_com_db, "$added_time|>|\n"); fwrite($new_com_db, "$added_time|>|\n");
foreach ($old_com_db as $line){ fwrite($new_com_db, "$line");} foreach ($old_com_db as $line){ fwrite($new_com_db, "$line");}
fclose($new_com_db); fclose($new_com_db);
// Incrase By 1 The Number of Written News for Current User // Incrase By 1 The Number of Written News for Current User
$old_user_db = file("./data/users.db.php"); $old_user_db = file("./data/users.db.php");
$new_user_db = fopen("./data/users.db.php", w); $new_user_db = fopen("./data/users.db.php", w);
foreach($old_user_db as $old_user_db_line){ foreach($old_user_db as $old_user_db_line){
$old_user_db_arr = explode("|", $old_user_db_line); $old_user_db_arr = explode("|", $old_user_db_line);
if($username!=$old_user_db_arr[2]){ if($username!=$old_user_db_arr[2]){
fwrite($new_user_db,"$old_user_db_line"); fwrite($new_user_db,"$old_user_db_line");
} }
else else
{ {
$countplus = $old_user_db_arr[6]+1; $countplus = $old_user_db_arr[6]+1;
fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$old_user_db_arr[4]|$old_user_db_arr[5]|$countplus|$old_user_db_arr[7]|$old_user_db_arr[8]|$old_user_db_arr[9]||\n"); fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$old_user_db_arr[4]|$old_user_db_arr[5]|$countplus|$old_user_db_arr[7]|$old_user_db_arr[8]|$old_user_db_arr[9]||\n");
} }
} }
fclose($new_user_db); fclose($new_user_db);
if($member_db[1] == 3){ if($member_db[1] == 3){
//user is journalist and the article needs to be approved, Notify !!! //user is journalist and the article needs to be approved, Notify !!!
if($config_notify_unapproved == "yes" and $config_notify_status == "active"){ if($config_notify_unapproved == "yes" and $config_notify_status == "active"){
send_mail("$config_notify_email", "CuteNews - Unapproved article was Added", "The user $member_db[2] (journalist) posted article '$title' which needs first to be Approved."); send_mail("$config_notify_email", "CuteNews - Unapproved article was Added", "The user $member_db[2] (journalist) posted article '$title' which needs first to be Approved.");
} }
} }
if($postpone){ if($postpone){
msg("info","News added (Postponed)", "The news item was successfully added to the database as postponed.<br/>It will be activated at ".date("r",$added_time)); msg("info","News added (Postponed)", "The news item was successfully added to the database as postponed.<br/>It will be activated at ".date("r",$added_time));
} }
else{ else{
msg("info","News added", "The news item was successfully added.</br>$unapproved_status_msg"); msg("info","News added", "The news item was successfully added.</br>$unapproved_status_msg");
} }
} }
?> ?>
<?PHP <?PHP
$result=""; $result="";
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission to edit categories"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission to edit categories"); }
// ******************************************************************************** // ********************************************************************************
// Add Category // Add Category
// ******************************************************************************** // ********************************************************************************
if($action == "add") if($action == "add")
{ {
$cat_name = htmlspecialchars(stripslashes($cat_name)); $cat_name = htmlspecialchars(stripslashes($cat_name));
if(!$cat_name){ msg("error","Error !!!","Please enter name of the category", "javascript:history.go(-1)"); } if(!$cat_name){ msg("error","Error !!!","Please enter name of the category", "javascript:history.go(-1)"); }
$cat_icon = preg_replace("/ /", "", $cat_icon); $cat_icon = preg_replace("/ /", "", $cat_icon);
if($cat_icon == "(optional)"){ $cat_icon = ""; } if($cat_icon == "(optional)"){ $cat_icon = ""; }
$big_num = file("./data/cat.num.php"); $big_num = file("./data/cat.num.php");
$big_num = $big_num[0]; $big_num = $big_num[0];
if(!$big_num or $big_num == ""){ $big_num = 1; } if(!$big_num or $big_num == ""){ $big_num = 1; }
$all_cats = file("./data/category.db.php"); $all_cats = file("./data/category.db.php");
foreach($all_cats as $cat_line) foreach($all_cats as $cat_line)
{ {
$cat_arr = explode("|", $cat_line); $cat_arr = explode("|", $cat_line);
if($cat_arr[1] == $cat_name){ msg("error", "Error !!!", "Category with this name already exist", "?mod=categories"); } if($cat_arr[1] == $cat_name){ msg("error", "Error !!!", "Category with this name already exist", "?mod=categories"); }
if($cat_arr[0] == $big_num){ $big_num = 33; } if($cat_arr[0] == $big_num){ $big_num = 33; }
} }
$new_cats = fopen("./data/category.db.php", "a"); $new_cats = fopen("./data/category.db.php", "a");
$cat_name = stripslashes( preg_replace(array("'\|'",), array("&#124",), $cat_name) ); $cat_name = stripslashes( preg_replace(array("'\|'",), array("&#124",), $cat_name) );
$cat_icon = stripslashes( preg_replace(array("'\|'",), array("&#124",), $cat_icon) ); $cat_icon = stripslashes( preg_replace(array("'\|'",), array("&#124",), $cat_icon) );
fwrite($new_cats, "$big_num|$cat_name|$cat_icon|$cat_access|||\n"); fwrite($new_cats, "$big_num|$cat_name|$cat_icon|$cat_access|||\n");
fclose($new_cats); fclose($new_cats);
$big_num ++; $big_num ++;
$num_file = fopen("./data/cat.num.php", "w"); $num_file = fopen("./data/cat.num.php", "w");
fwrite($num_file, $big_num); fwrite($num_file, $big_num);
fclose($num_file); fclose($num_file);
} }
// ******************************************************************************** // ********************************************************************************
// Remove Category // Remove Category
// ******************************************************************************** // ********************************************************************************
elseif($action == "remove") elseif($action == "remove")
{ {
if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); } if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); }
$old_cats = file("./data/category.db.php"); $old_cats = file("./data/category.db.php");
$new_cats = fopen("./data/category.db.php", "w"); $new_cats = fopen("./data/category.db.php", "w");
foreach($old_cats as $old_cats_line){ foreach($old_cats as $old_cats_line){
$cat_arr = explode("|", $old_cats_line); $cat_arr = explode("|", $old_cats_line);
if($cat_arr[0] != $catid){ if($cat_arr[0] != $catid){
fwrite($new_cats, $old_cats_line); fwrite($new_cats, $old_cats_line);
} }
} }
fclose($new_cats); fclose($new_cats);
} }
// ******************************************************************************** // ********************************************************************************
// Edit Category // Edit Category
// ******************************************************************************** // ********************************************************************************
elseif($action == "edit") elseif($action == "edit")
{ {
if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); } if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); }
$all_cats = file("./data/category.db.php"); $all_cats = file("./data/category.db.php");
foreach($all_cats as $cat_line){ foreach($all_cats as $cat_line){
$cat_arr = explode("|", $cat_line); $cat_arr = explode("|", $cat_line);
if($cat_arr[0] == $catid){ if($cat_arr[0] == $catid){
$if_all_access = ($cat_arr[3] == "" || $cat_arr[3] == "0") ? "selected" : ""; $if_all_access = ($cat_arr[3] == "" || $cat_arr[3] == "0") ? "selected" : "";
$if_1_access = ($cat_arr[3] == "1") ? "selected" : ""; $if_1_access = ($cat_arr[3] == "1") ? "selected" : "";
$if_2_access = ($cat_arr[3] == "2") ? "selected" : ""; $if_2_access = ($cat_arr[3] == "2") ? "selected" : "";
$msg=<<<HTML $msg=<<<HTML
<form action=$PHP_SELF?mod=categories method=post> <form action=$PHP_SELF?mod=categories method=post>
<table border="0" > <table border="0" >
<tr> <tr>
<td width="100" >Name</td> <td width="100" >Name</td>
<td ><input value="$cat_arr[1]" type=text name=cat_name></td> <td ><input value="$cat_arr[1]" type=text name=cat_name></td>
</tr> </tr>
<tr> <tr>
<td >Icon</td> <td >Icon</td>
<td ><input value="$cat_arr[2]" type=text name=cat_icon></td> <td ><input value="$cat_arr[2]" type=text name=cat_icon></td>
</tr> </tr>
<tr> <tr>
<td > <td >
Category Access Category Access
<td > <td >
<select name="cat_access"> <select name="cat_access">
<option $if_all_access value="0" selected>Everyone Can Write</option> <option $if_all_access value="0" selected>Everyone Can Write</option>
<option $if_2_access value="2">Only Editors and Admin</option> <option $if_2_access value="2">Only Editors and Admin</option>
<option $if_1_access value="1">Only Admin</option> <option $if_1_access value="1">Only Admin</option>
</select> </select>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td ><br><input type=submit value="Save Changes"</td> <td ><br><input type=submit value="Save Changes"</td>
</tr> </tr>
</table> </table>
<input type=hidden name=action value=doedit> <input type=hidden name=action value=doedit>
<input type=hidden name=catid value=$catid> <input type=hidden name=catid value=$catid>
</form> </form>
HTML; HTML;
msg("options", "Edit Category", $msg); msg("options", "Edit Category", $msg);
} }
} }
} }
// ******************************************************************************** // ********************************************************************************
// DO Edit Category // DO Edit Category
// ******************************************************************************** // ********************************************************************************
elseif($action == "doedit") elseif($action == "doedit")
{ {
$cat_name = htmlspecialchars(stripslashes($cat_name)); $cat_name = htmlspecialchars(stripslashes($cat_name));
if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); } if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); }
if($cat_name == ""){ msg("error", "Error !!!", "Category name can not be blank", "javascript:history.go(-1)"); } if($cat_name == ""){ msg("error", "Error !!!", "Category name can not be blank", "javascript:history.go(-1)"); }
$old_cats = file("./data/category.db.php"); $old_cats = file("./data/category.db.php");
$new_cats = fopen("./data/category.db.php", "w"); $new_cats = fopen("./data/category.db.php", "w");
foreach($old_cats as $cat_line){ foreach($old_cats as $cat_line){
$cat_arr = explode("|", $cat_line); $cat_arr = explode("|", $cat_line);
if($cat_arr[0] == $catid){ if($cat_arr[0] == $catid){
fwrite($new_cats, "$catid|$cat_name|$cat_icon|$cat_access|||\n"); fwrite($new_cats, "$catid|$cat_name|$cat_icon|$cat_access|||\n");
}else{ }else{
fwrite($new_cats, "$cat_line"); fwrite($new_cats, "$cat_line");
} }
} }
fclose($new_cats); fclose($new_cats);
} }
// ******************************************************************************** // ********************************************************************************
// List all Categories // List all Categories
// ******************************************************************************** // ********************************************************************************
echoheader("options", "Categories"); echoheader("options", "Categories");
echo<<<HTML echo<<<HTML
<table border=0 cellpading=0 cellspacing=0 width="645" > <table border=0 cellpading=0 cellspacing=0 width="645" >
<form method=post action="$PHP_SELF"> <form method=post action="$PHP_SELF">
<td width=321 height="33"> <td width=321 height="33">
<b>Add Category</b> <b>Add Category</b>
<table border=0 cellpading=0 cellspacing=0 width=300 class="panel" > <table border=0 cellpading=0 cellspacing=0 width=300 class="panel" >
<tr> <tr>
<td width=130 height="25"> <td width=130 height="25">
&nbsp;Name &nbsp;Name
<td height="25"> <td height="25">
<input type=text name=cat_name> <input type=text name=cat_name>
</tr> </tr>
<tr> <tr>
<td height="22"> <td height="22">
&nbsp;Icon URL &nbsp;Icon URL
<td height="22"> <td height="22">
<input onFocus="this.select()" value="(optional)" type=text name=cat_icon> <input onFocus="this.select()" value="(optional)" type=text name=cat_icon>
</tr> </tr>
<tr> <tr>
<td height="22"> <td height="22">
&nbsp;Category Access &nbsp;Category Access
<td height="22"> <td height="22">
<select name="cat_access"> <select name="cat_access">
<option value="0" selected>Everyone Can Write</option> <option value="0" selected>Everyone Can Write</option>
<option value="2">Only Editors and Admin</option> <option value="2">Only Editors and Admin</option>
<option value="1">Only Admin</option> <option value="1">Only Admin</option>
</select> </select>
</tr> </tr>
<tr> <tr>
<td width=98 height="32"> <td width=98 height="32">
&nbsp; &nbsp;
<td width=206 height="32"> <td width=206 height="32">
<input type=submit value=" Add Category "> <input type=submit value=" Add Category ">
<input type=hidden name=mod value=categories> <input type=hidden name=mod value=categories>
<input type=hidden name=action value=add> <input type=hidden name=action value=add>
</tr> </tr>
</form> </form>
</table> </table>
<td width=320 height="33" align="center"> <td width=320 height="33" align="center">
<!-- HELP --> <!-- HELP -->
<table height="25" cellspacing="0" cellpadding="0"> <table height="25" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td> <td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td>
<td >&nbsp;<a onClick="javascript:Help('categories')" href="#">What are categories and<br> <td >&nbsp;<a onClick="javascript:Help('categories')" href="#">What are categories and<br>
&nbsp;How to use them</a></td> &nbsp;How to use them</a></td>
</tr> </tr>
</table><br> </table><br>
<!-- END HELP --> <!-- END HELP -->
<tr> <tr>
<td width=654 colspan="2" height="11"> <td width=654 colspan="2" height="11">
<img height=20 border=0 src="skins/images/blank.gif" width=1> <img height=20 border=0 src="skins/images/blank.gif" width=1>
</tr> </tr>
HTML; HTML;
$all_cats = file("./data/category.db.php"); $all_cats = file("./data/category.db.php");
$count_categories = 0; $count_categories = 0;
foreach($all_cats as $cat_line) foreach($all_cats as $cat_line)
{ {
if($i%2 != 0){ $bg = "bgcolor=#F7F6F4"; }else{ $bg = ""; } if($i%2 != 0){ $bg = "bgcolor=#F7F6F4"; }else{ $bg = ""; }
$i++; $i++;
$cat_arr = explode("|", $cat_line); $cat_arr = explode("|", $cat_line);
$cat_arr[1] = stripslashes( preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"), $cat_arr[1]) ); $cat_arr[1] = stripslashes( preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"), $cat_arr[1]) );
$cat_help_names[] = $cat_arr[1]; $cat_help_names[] = $cat_arr[1];
$cat_help_ids[] = $cat_arr[0]; $cat_help_ids[] = $cat_arr[0];
$result .= " $result .= "
<tr> <tr>
<td $bg >&nbsp;<b>$cat_arr[0]</b></td> <td $bg >&nbsp;<b>$cat_arr[0]</b></td>
<td $bg >$cat_arr[1]</td> <td $bg >$cat_arr[1]</td>
<td $bg >"; <td $bg >";
if($cat_arr[2] != ""){ $result .= "<img border=0 src=\"$cat_arr[2]\" high=40 width=40 alt=\"$cat_arr[2]\">"; } if($cat_arr[2] != ""){ $result .= "<img border=0 src=\"$cat_arr[2]\" high=40 width=40 alt=\"$cat_arr[2]\">"; }
else{ $result .= "---"; } else{ $result .= "---"; }
$result .= "</td><td $bg >"; $result .= "</td><td $bg >";
$result .= ($cat_arr[3] == "" || $cat_arr[3] == "0") ? "<span title='Everyone can Write'>---</span>" : ""; $result .= ($cat_arr[3] == "" || $cat_arr[3] == "0") ? "<span title='Everyone can Write'>---</span>" : "";
$result .= ($cat_arr[3] == "1") ? "Only Admin" : ""; $result .= ($cat_arr[3] == "1") ? "Only Admin" : "";
$result .= ($cat_arr[3] == "2") ? "Only Editors & Admin" : ""; $result .= ($cat_arr[3] == "2") ? "Only Editors & Admin" : "";
$result .= "</td> $result .= "</td>
<td $bg ><a href=\"$PHP_SELF?mod=categories&action=edit&catid=$cat_arr[0]\">[edit]</a> <a href=\"$PHP_SELF?mod=categories&action=remove&catid=$cat_arr[0]\">[delete]</a></td> <td $bg ><a href=\"$PHP_SELF?mod=categories&action=edit&catid=$cat_arr[0]\">[edit]</a> <a href=\"$PHP_SELF?mod=categories&action=remove&catid=$cat_arr[0]\">[delete]</a></td>
</tr>"; </tr>";
$count_categories ++; $count_categories ++;
} }
if($count_categories == 0){ if($count_categories == 0){
echo"<tr> echo"<tr>
<td width=654 colspan=2 height=14> <td width=654 colspan=2 height=14>
<p align=center><br><b>You havn't defined any categories yet</b><br> <p align=center><br><b>You havn't defined any categories yet</b><br>
categories are optional and you can write your news without having categories<br> categories are optional and you can write your news without having categories<br>
</tr> </tr>
<tr>"; <tr>";
}else{ }else{
echo"<tr> echo"<tr>
<td width=654 colspan=2 height=14> <td width=654 colspan=2 height=14>
<b>Categories</b> <b>Categories</b>
</tr> </tr>
<tr> <tr>
<td width=654 colspan=2 height=1> <td width=654 colspan=2 height=1>
<table width=100% height=100% cellspacing=0 cellpadding=0> <table width=100% height=100% cellspacing=0 cellpadding=0>
<tr> <tr>
<td width=6% bgcolor=#F7F6F4>&nbsp;<u>ID</u></td> <td width=6% bgcolor=#F7F6F4>&nbsp;<u>ID</u></td>
<td width=30% bgcolor=#F7F6F4><u>name</u></td> <td width=30% bgcolor=#F7F6F4><u>name</u></td>
<td width=14% bgcolor=#F7F6F4><u>icon</u></td> <td width=14% bgcolor=#F7F6F4><u>icon</u></td>
<td width=20% bgcolor=#F7F6F4><u>restriction</u></td> <td width=20% bgcolor=#F7F6F4><u>restriction</u></td>
<td width=20% bgcolor=#F7F6F4><u>action</u></td> <td width=20% bgcolor=#F7F6F4><u>action</u></td>
</tr>"; </tr>";
echo $result; echo $result;
echo"</table>"; echo"</table>";
} }
echo" echo"
</table>"; </table>";
echofooter(); echofooter();
?> ?>
<?PHP <?PHP
echo"<center><b>CuteNews Debug Information:</b><hr><br />"; echo"<center><b>CuteNews Debug Information:</b><hr><br />";
echo"Script Version/ID:&nbsp&nbsp;$config_version_name / $config_version_id<br />"; echo"Script Version/ID:&nbsp&nbsp;$config_version_name / $config_version_id<br />";
echo"\$config_http_script_dir:&nbsp;&nbsp;$config_http_script_dir<br /><BR>"; echo"\$config_http_script_dir:&nbsp;&nbsp;$config_http_script_dir<br /><BR>";
echo"<hr>"; echo"<hr>";
phpinfo(); phpinfo();
echo"<hr><textarea cols=85 rows=24>"; echo"<hr><textarea cols=85 rows=24>";
print_r(ini_get_all()); print_r(ini_get_all());
echo"</textarea>"; echo"</textarea>";
exit(); exit();
?> ?>
<?PHP <?PHP
if($member_db[1] > 2){ msg("error", "Access Denied", "You don't have permission to edit comments"); } if($member_db[1] > 2){ msg("error", "Access Denied", "You don't have permission to edit comments"); }
// ******************************************************************************** // ********************************************************************************
// Edit Comment // Edit Comment
// ******************************************************************************** // ********************************************************************************
if($action == "editcomment") if($action == "editcomment")
{ {
if($source == ""){ $all_comments = file("./data/comments.txt"); } if($source == ""){ $all_comments = file("./data/comments.txt"); }
else{ $all_comments = file("./data/archives/${source}.comments.arch"); } else{ $all_comments = file("./data/archives/${source}.comments.arch"); }
foreach($all_comments as $comment_line) foreach($all_comments as $comment_line)
{ {
$comment_line_arr = explode("|>|", $comment_line); $comment_line_arr = explode("|>|", $comment_line);
if($comment_line_arr[0] == $newsid) if($comment_line_arr[0] == $newsid)
{ {
$comment_arr = explode("||", $comment_line_arr[1]); $comment_arr = explode("||", $comment_line_arr[1]);
foreach($comment_arr as $single_comment) foreach($comment_arr as $single_comment)
{ {
$single_arr = explode("|", $single_comment); $single_arr = explode("|", $single_comment);
if($comid == $single_arr[0]) if($comid == $single_arr[0])
{ {
break; break;
} }
} }
} }
} }
$single_arr[4] = str_replace("<br />","\n",$single_arr[4]); $single_arr[4] = str_replace("<br />","\n",$single_arr[4]);
$comdate = date("D, d F Y h:i:s", $single_arr[0]); $comdate = date("D, d F Y h:i:s", $single_arr[0]);
echo"<html> echo"<html>
<head> <head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\"> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">
<title>Edit user</title> <title>Edit user</title>
<style type=\"text/css\"> <style type=\"text/css\">
<!-- <!--
SELECT, option, textarea, input { SELECT, option, textarea, input {
BORDER-RIGHT: #808080 1px dotted; BORDER-RIGHT: #808080 1px dotted;
BORDER-TOP: #808080 1px dotted; BORDER-TOP: #808080 1px dotted;
BORDER-BOTTOM: #808080 1px dotted; BORDER-BOTTOM: #808080 1px dotted;
BORDER-LEFT: #808080 1px dotted; BORDER-LEFT: #808080 1px dotted;
COLOR: #000000; COLOR: #000000;
FONT-SIZE: 11px; FONT-SIZE: 11px;
FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff } FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff }
TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;} TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
BODY {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 3pt;} BODY {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 3pt;}
.header { font-size : 16px; font-weight: bold; color: #808080; font-family: verdana; text-decoration: none; } .header { font-size : 16px; font-weight: bold; color: #808080; font-family: verdana; text-decoration: none; }
--> -->
</style> </style>
</head> </head>
<body bgcolor=\"#FFFFFF\"> <body bgcolor=\"#FFFFFF\">
<form method=post action=\"$PHP_SELF\"> <form method=post action=\"$PHP_SELF\">
<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"> <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<td width=\"1108\" height=\"8%\" colspan=\"2\"> <td width=\"1108\" height=\"8%\" colspan=\"2\">
<div class=header>Edit Comment</div> <div class=header>Edit Comment</div>
<tr> <tr>
<td height=20 valign=middle width=\"102\" bgcolor=\"#F9F8F7\"> <td height=20 valign=middle width=\"102\" bgcolor=\"#F9F8F7\">
Poster Poster
<td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\"> <td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\">
<input type=text name=poster value=\"$single_arr[1]\"> <input type=text name=poster value=\"$single_arr[1]\">
</tr> </tr>
<tr> <tr>
<td height=20 valign=middle valign=\"top\" width=\"102\"> <td height=20 valign=middle valign=\"top\" width=\"102\">
Email Email
<td height=20 valign=middle width=\"1002\"> <td height=20 valign=middle width=\"1002\">
<input type=text name=mail value=\"$single_arr[2]\"> <input type=text name=mail value=\"$single_arr[2]\">
</tr> </tr>
<tr> <tr>
<td height=20 valign=middle valign=\"top\" width=\"102\" bgcolor=\"#F9F8F7\"> <td height=20 valign=middle valign=\"top\" width=\"102\" bgcolor=\"#F9F8F7\">
IP IP
<td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\"> <td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\">
<a href=\"http://www.ripe.net/perl/whois?searchtext=$single_arr[3]\" target=_blank title=\"Get more information about this ip\">$single_arr[3]</a> &nbsp; <a href=\"http://www.ripe.net/perl/whois?searchtext=$single_arr[3]\" target=_blank title=\"Get more information about this ip\">$single_arr[3]</a> &nbsp;
<a href=\"$PHP_SELF?mod=ipban&action=quickadd&add_ip=$single_arr[3]\">[ban this ip]</a> <a href=\"$PHP_SELF?mod=ipban&action=quickadd&add_ip=$single_arr[3]\">[ban this ip]</a>
</tr> </tr>
<tr> <tr>
<td height=20 valign=middle valign=\"top\" width=\"102\"> <td height=20 valign=middle valign=\"top\" width=\"102\">
Date Date
<td height=20 valign=middle width=\"1002\"> <td height=20 valign=middle width=\"1002\">
$comdate $comdate
</tr> </tr>
<tr> <tr>
<td height=20 valign=middle width=\"102\" bgcolor=\"#F9F8F7\"> <td height=20 valign=middle width=\"102\" bgcolor=\"#F9F8F7\">
Comments&nbsp; Comments&nbsp;
<td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\"> <td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\">
<textarea rows=\"8\" name=\"comment\" cols=\"45\">$single_arr[4]</textarea> <textarea rows=\"8\" name=\"comment\" cols=\"45\">$single_arr[4]</textarea>
</tr> </tr>
<tr> <tr>
<td valign=\"top\" width=\"1104\" colspan=\"2\"> <td valign=\"top\" width=\"1104\" colspan=\"2\">
<p align=\"left\"><br /> <p align=\"left\"><br />
<input type=submit value=\"Save Changes\" accesskey=\"s\">&nbsp; <input type=button value=Cencel onClick=\"window.close();\" accesskey=\"c\"> <input type=submit value=\"Save Changes\" accesskey=\"s\">&nbsp; <input type=button value=Cencel onClick=\"window.close();\" accesskey=\"c\">
<input type=hidden name=mod value=editcomments> <input type=hidden name=mod value=editcomments>
<input type=hidden name=newsid value=$newsid> <input type=hidden name=newsid value=$newsid>
<input type=hidden name=comid value=$comid> <input type=hidden name=comid value=$comid>
<input type=hidden name=source value=$source> <input type=hidden name=source value=$source>
<input type=hidden name=action value=doeditcomment> <input type=hidden name=action value=doeditcomment>
</tr> </tr>
</table> </table>
</form> </form>
</body> </body>
</html>"; </html>";
} }
// ******************************************************************************** // ********************************************************************************
// Do Save Comment // Do Save Comment
// ******************************************************************************** // ********************************************************************************
elseif($action == "doeditcomment") elseif($action == "doeditcomment")
{ {
if(!$poster and !$deletecomment){ echo"<br /><br><br />The poster can not be blank !!!"; exit(); } if(!$poster and !$deletecomment){ echo"<br /><br><br />The poster can not be blank !!!"; exit(); }
if($mail == "" and !$deletecomment){ $mail = "none"; } if($mail == "" and !$deletecomment){ $mail = "none"; }
if($poster == "" and !$deletecomment){ $poster = "Anonymous"; } if($poster == "" and !$deletecomment){ $poster = "Anonymous"; }
if($comment == "" and !$deletecomment){ die("comment can not be blank"); } if($comment == "" and !$deletecomment){ die("comment can not be blank"); }
$comment = str_replace("\r\n","<br />",$comment); $comment = str_replace("\r\n","<br />",$comment);
$comment = str_replace("|","I",$comment); $comment = str_replace("|","I",$comment);
if($source == ""){ $news_file = "./data/news.txt"; $com_file = "./data/comments.txt"; } if($source == ""){ $news_file = "./data/news.txt"; $com_file = "./data/comments.txt"; }
else{ $news_file = "./data/archives/$source.news.arch"; $com_file = "./data/archives/$source.comments.arch";} else{ $news_file = "./data/archives/$source.news.arch"; $com_file = "./data/archives/$source.comments.arch";}
$old_com = file("$com_file"); $old_com = file("$com_file");
$new_com = fopen("$com_file","w"); $new_com = fopen("$com_file","w");
foreach($old_com as $line) foreach($old_com as $line)
{ {
$line_arr = explode("|>|",$line); $line_arr = explode("|>|",$line);
if($line_arr[0] == $newsid) if($line_arr[0] == $newsid)
{ {
fwrite($new_com,"$line_arr[0]|>|"); fwrite($new_com,"$line_arr[0]|>|");
$comments = explode("||", $line_arr[1]); $comments = explode("||", $line_arr[1]);
foreach($comments as $single_comment) foreach($comments as $single_comment)
{ {
$single_comment = trim($single_comment); $single_comment = trim($single_comment);
$comment_arr = explode("|", $single_comment); $comment_arr = explode("|", $single_comment);
if($comment_arr[0] == $comid and $comment_arr[0] != "" and $delcomid != "all") if($comment_arr[0] == $comid and $comment_arr[0] != "" and $delcomid != "all")
{ {
fwrite($new_com,"$comment_arr[0]|$poster|$mail|$comment_arr[3]|$comment||"); fwrite($new_com,"$comment_arr[0]|$poster|$mail|$comment_arr[3]|$comment||");
} }
elseif($delcomid[$comment_arr[0]] != 1 and $comment_arr[0] != "" and $delcomid[all] != 1){ elseif($delcomid[$comment_arr[0]] != 1 and $comment_arr[0] != "" and $delcomid[all] != 1){
fwrite($new_com,"$single_comment||"); fwrite($new_com,"$single_comment||");
} }
} }
fwrite($new_com,"\n"); fwrite($new_com,"\n");
} }
else{ fwrite($new_com, "$line"); } else{ fwrite($new_com, "$line"); }
} }
if(isset($deletecomment) and $delcomid[all] == 1){ msg("info", "Comments Deleted", "All comments were deleted.", "$PHP_SELF?mod=editnews&action=editnews&id=$newsid&source=$source"); } if(isset($deletecomment) and $delcomid[all] == 1){ msg("info", "Comments Deleted", "All comments were deleted.", "$PHP_SELF?mod=editnews&action=editnews&id=$newsid&source=$source"); }
elseif(isset($deletecomment) and isset($delcomid)){ msg("info", "Comment Deleted", "The selected comment(s) has been deleted.", "$PHP_SELF?mod=editnews&action=editnews&id=$newsid&source=$source"); } elseif(isset($deletecomment) and isset($delcomid)){ msg("info", "Comment Deleted", "The selected comment(s) has been deleted.", "$PHP_SELF?mod=editnews&action=editnews&id=$newsid&source=$source"); }
else{ echo"<br /><br /><br /><br /><center><b>Comment is saved."; } else{ echo"<br /><br /><br /><br /><center><b>Comment is saved."; }
} }
?> ?>
<?PHP <?PHP
if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to edit news"); } if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to edit news"); }
$orig_cat_lines = file("./data/category.db.php"); $orig_cat_lines = file("./data/category.db.php");
//only show allowed categories //only show allowed categories
$allowed_cats = array(); $allowed_cats = array();
$cat_lines = array(); $cat_lines = array();
foreach($orig_cat_lines as $single_line){ foreach($orig_cat_lines as $single_line){
$ocat_arr = explode("|", $single_line); $ocat_arr = explode("|", $single_line);
$cat[$ocat_arr[0]] = $ocat_arr[1]; $cat[$ocat_arr[0]] = $ocat_arr[1];
if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){ if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){
$cat_lines[] = $single_line; $cat_lines[] = $single_line;
$allowed_cats[] = $ocat_arr[0]; $allowed_cats[] = $ocat_arr[0];
} }
} }
// ******************************************************************************** // ********************************************************************************
// List all news available for editing // List all news available for editing
// ******************************************************************************** // ********************************************************************************
if($action == "list") if($action == "list")
{ {
echoheader("editnews","Edit News"); echoheader("editnews","Edit News");
// How Many News to show on one page // How Many News to show on one page
if($news_per_page == ""){ $news_per_page = 21; } if($news_per_page == ""){ $news_per_page = 21; }
$all_db = array(); $all_db = array();
if($source == ""){ $all_db = file("./data/news.txt"); } if($source == ""){ $all_db = file("./data/news.txt"); }
elseif($source == "postponed"){ $all_db = file("./data/postponed_news.txt"); ResynchronizePostponed(); } elseif($source == "postponed"){ $all_db = file("./data/postponed_news.txt"); ResynchronizePostponed(); }
elseif($source == "unapproved"){ $all_db = file("./data/unapproved_news.txt");} elseif($source == "unapproved"){ $all_db = file("./data/unapproved_news.txt");}
else{ $all_db = file("./data/archives/${source}.news.arch"); } else{ $all_db = file("./data/archives/${source}.news.arch"); }
// choose only needed news items // choose only needed news items
if ($category != '' or $author != "" or $member_db[1] == 3){ if ($category != '' or $author != "" or $member_db[1] == 3){
foreach($all_db as $raw_line){ foreach($all_db as $raw_line){
$raw_arr = explode("|", $raw_line); $raw_arr = explode("|", $raw_line);
; ;
if ( if (
($category == '' or in_array($category, explode(',',$raw_arr[6]))) ($category == '' or in_array($category, explode(',',$raw_arr[6])))
and ($author == "" or $raw_arr[1] == $author) and ($author == "" or $raw_arr[1] == $author)
and ($member_db[1] != 3 or $raw_arr[1] == $member_db[2] ) and ($member_db[1] != 3 or $raw_arr[1] == $member_db[2] )
){ ){
$all_db_tmp[] = $raw_line; $all_db_tmp[] = $raw_line;
} }
} }
$all_db = $all_db_tmp; $all_db = $all_db_tmp;
} }
// Prelist Entries // Prelist Entries
$flag = 1; $flag = 1;
if($start_from == "0"){ $start_from = ""; } if($start_from == "0"){ $start_from = ""; }
$i = $start_from; $i = $start_from;
$entries_showed = 0; $entries_showed = 0;
if(!empty($all_db)){ if(!empty($all_db)){
foreach ($all_db as $line){ foreach ($all_db as $line){
if($j < $start_from){ $j++; continue; } if($j < $start_from){ $j++; continue; }
$i++; $i++;
$item_db = explode("|",$line); $item_db = explode("|",$line);
$itemdate = date("d/m/y",$item_db[0]); $itemdate = date("d/m/y",$item_db[0]);
if($flag == 1){ $bg="#F7F6F4"; $flag = 0; } if($flag == 1){ $bg="#F7F6F4"; $flag = 0; }
else {$bg = "#FFFFFF"; $flag = 1;} else {$bg = "#FFFFFF"; $flag = 1;}
if(strlen($item_db[2]) > 74){ $title = substr($item_db[2],0,70)." ..."; } if(strlen($item_db[2]) > 74){ $title = substr($item_db[2],0,70)." ..."; }
$title = stripslashes( preg_replace(array("'\|'", "'\"'", "'\''"), array("I", "&quot;", "&#039;"), $item_db[2]) ); $title = stripslashes( preg_replace(array("'\|'", "'\"'", "'\''"), array("I", "&quot;", "&#039;"), $item_db[2]) );
$title = ereg_replace("<[^>]*>","",$title); $title = ereg_replace("<[^>]*>","",$title);
$entries .= "<tr> $entries .= "<tr>
<td height=18 bgcolor=$bg> <td height=18 bgcolor=$bg>
<!-- ID: $item_db[0]--><a title='EDIT: $item_db[2]' href=\"$PHP_SELF?mod=editnews&action=editnews&id=$item_db[0]&source=$source\">$title</a> <!-- ID: $item_db[0]--><a title='EDIT: $item_db[2]' href=\"$PHP_SELF?mod=editnews&action=editnews&id=$item_db[0]&source=$source\">$title</a>
<td height=18 bgcolor=$bg align=right>"; <td height=18 bgcolor=$bg align=right>";
$count_comments = countComments($item_db[0], $source); $count_comments = countComments($item_db[0], $source);
if($count_comments == 0){$entries .= "<font color=gray>$count_comments</font>";} if($count_comments == 0){$entries .= "<font color=gray>$count_comments</font>";}
else{$entries .= "$count_comments";} else{$entries .= "$count_comments";}
$entries .= "&nbsp;&nbsp;&nbsp;&nbsp;<td height=18 bgcolor=$bg nowrap>&nbsp;&nbsp;&nbsp;"; $entries .= "&nbsp;&nbsp;&nbsp;&nbsp;<td height=18 bgcolor=$bg nowrap>&nbsp;&nbsp;&nbsp;";
if($item_db[6] == ""){ $my_cat = "<font color=gray>---</font>"; } if($item_db[6] == ""){ $my_cat = "<font color=gray>---</font>"; }
// elseif($cat[$item_db[6]] == ""){ $my_cat = "<font color=red title='The news article is posted in category which does not exist anymore'>(ID: <b>$item_db[6]</b>)</font>"; } // elseif($cat[$item_db[6]] == ""){ $my_cat = "<font color=red title='The news article is posted in category which does not exist anymore'>(ID: <b>$item_db[6]</b>)</font>"; }
elseif(strstr($item_db[6],',')){ elseif(strstr($item_db[6],',')){
$all_this_cats_arr = explode(',',$item_db[6]); $all_this_cats_arr = explode(',',$item_db[6]);
$my_multy_cat_labels = ''; $my_multy_cat_labels = '';
foreach($all_this_cats_arr as $this_single_cat){ foreach($all_this_cats_arr as $this_single_cat){
$my_multy_cat_labels .= "$cat[$this_single_cat], "; $my_multy_cat_labels .= "$cat[$this_single_cat], ";
} }
$my_cat = "<span onmouseover=\" window.status='categories: $my_multy_cat_labels'; return true\" onmouseout=\"window.status=''; return true\"><font color=#7979FF title='$my_multy_cat_labels'>(multiple)</font></span>"; $my_cat = "<span onmouseover=\" window.status='categories: $my_multy_cat_labels'; return true\" onmouseout=\"window.status=''; return true\"><font color=#7979FF title='$my_multy_cat_labels'>(multiple)</font></span>";
} }
else{ $my_cat = $cat[$item_db[6]]; } else{ $my_cat = $cat[$item_db[6]]; }
$entries .= "$my_cat&nbsp;<td height=18 bgcolor=$bg> $entries .= "$my_cat&nbsp;<td height=18 bgcolor=$bg>
$itemdate $itemdate
<td height=18 bgcolor=$bg> <td height=18 bgcolor=$bg>
$item_db[1] $item_db[1]
<td align=center bgcolor=$bg><input name=\"selected_news[]\" value=\"{$item_db[0]}\" style=\"border:0; background-color:$bg\" type='checkbox'> <td align=center bgcolor=$bg><input name=\"selected_news[]\" value=\"{$item_db[0]}\" style=\"border:0; background-color:$bg\" type='checkbox'>
</tr> </tr>
"; ";
$entries_showed ++; $entries_showed ++;
if($i >= $news_per_page + $start_from){ break; } if($i >= $news_per_page + $start_from){ break; }
}//foreach news line }//foreach news line
} }
// End prelisting // End prelisting
$all_count_news = count($all_db); $all_count_news = count($all_db);
if($category != ""){ $cat_msg = "Category: <b>$cat[$category]</b>;"; } if($category != ""){ $cat_msg = "Category: <b>$cat[$category]</b>;"; }
if($source == "postponed"){ $source_msg = "<span style='background-color:yellow;'>Postponed News, <a title='Refresh the postponed news file' href=\"$PHP_SELF?mod=editnews&action=list&source=postponed\">[Resynchronize]</a></span>"; $postponed_selected = " selected ";} if($source == "postponed"){ $source_msg = "<span style='background-color:yellow;'>Postponed News, <a title='Refresh the postponed news file' href=\"$PHP_SELF?mod=editnews&action=list&source=postponed\">[Resynchronize]</a></span>"; $postponed_selected = " selected ";}
elseif($source == "unapproved"){ $source_msg = "<span style='background-color:yellow;'>Unapproved News</span>"; $unapproved_selected = " selected ";} elseif($source == "unapproved"){ $source_msg = "<span style='background-color:yellow;'>Unapproved News</span>"; $unapproved_selected = " selected ";}
elseif($source != "" ){ elseif($source != "" ){
$news_lines = file("./data/archives/$source.news.arch"); $news_lines = file("./data/archives/$source.news.arch");
$count = count($news_lines); $count = count($news_lines);
$last = $count-1; $last = $count-1;
$first_news_arr = explode("|", $news_lines[$last]); $first_news_arr = explode("|", $news_lines[$last]);
$last_news_arr = explode("|", $news_lines[0]); $last_news_arr = explode("|", $news_lines[0]);
$first_timestamp = $first_news_arr[0]; $first_timestamp = $first_news_arr[0];
$last_timestamp = $last_news_arr[0]; $last_timestamp = $last_news_arr[0];
$source_msg = "Archive: <b>". date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp) ."</b>;"; $source_msg = "Archive: <b>". date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp) ."</b>;";
} }
/////////////////////////////////////////// ///////////////////////////////////////////
// Options Bar // Options Bar
echo" echo"
<table class=panel border=0 cellpading=0 cellspacing=0 width=99% > <table class=panel border=0 cellpading=0 cellspacing=0 width=99% >
<tr> <tr>
<td title='Show More Options' style=\"cursor:pointer;\" onClick=\"getElementById('options').style.display='';\"> <td title='Show More Options' style=\"cursor:pointer;\" onClick=\"getElementById('options').style.display='';\">
Showing <b>$entries_showed</b> articles from total <b>$all_count_news</b>; $cat_msg $source_msg Showing <b>$entries_showed</b> articles from total <b>$all_count_news</b>; $cat_msg $source_msg
</td> </td>
<td > <td >
<p align=\"right\"><a href=\"javascript:ShowOrHide('options','')\">show options&nbsp;</a> <p align=\"right\"><a href=\"javascript:ShowOrHide('options','')\">show options&nbsp;</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan=\"2\" > <td colspan=\"2\" >
<div id='options' style='display:none;z-index:1;' > <div id='options' style='display:none;z-index:1;' >
<form action=\"$PHP_SELF?mod=editnews&action=list\" method=POST name=options_bar> <form action=\"$PHP_SELF?mod=editnews&action=list\" method=POST name=options_bar>
<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"> <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr> <tr>
<td height=\"1\" style=\"border-top: 1px dashed silver\" width=\"100%\" align=\"right\" colspan=\"3\"> <td height=\"1\" style=\"border-top: 1px dashed silver\" width=\"100%\" align=\"right\" colspan=\"3\">
<p align=\"center\">&nbsp; <p align=\"center\">&nbsp;
</td> </td>
</tr> </tr>
<tr > <tr >
<td height=\"1\" width=\"286\" align=\"right\"> <td height=\"1\" width=\"286\" align=\"right\">
Source&nbsp; Source&nbsp;
</td> </td>
<td height=\"1\" width=\"180\"> <td height=\"1\" width=\"180\">
<select name=\"source\" size=\"1\"><option value=\"\">- Active News -</option> \n <option $postponed_selected value=\"postponed\">- Postponed News -</option> \n <option $unapproved_selected value=\"unapproved\">- Unapproved News -</option>"; <select name=\"source\" size=\"1\"><option value=\"\">- Active News -</option> \n <option $postponed_selected value=\"postponed\">- Postponed News -</option> \n <option $unapproved_selected value=\"unapproved\">- Unapproved News -</option>";
if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory ./data/archives "); } if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory ./data/archives "); }
while (false !== ($file = readdir($handle))) while (false !== ($file = readdir($handle)))
{ {
if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file)) if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file))
{ {
$file_arr = explode(".", $file); $file_arr = explode(".", $file);
$id = $file_arr[0]; $id = $file_arr[0];
$news_lines = file("./data/archives/$file"); $news_lines = file("./data/archives/$file");
$count = count($news_lines); $count = count($news_lines);
$last = $count-1; $last = $count-1;
$first_news_arr = explode("|", $news_lines[$last]); $first_news_arr = explode("|", $news_lines[$last]);
$last_news_arr = explode("|", $news_lines[0]); $last_news_arr = explode("|", $news_lines[0]);
$first_timestamp = $first_news_arr[0]; $first_timestamp = $first_news_arr[0];
$last_timestamp = $last_news_arr[0]; $last_timestamp = $last_news_arr[0];
$arch_date = date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp); $arch_date = date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp);
$ifselected = ""; $ifselected = "";
if($source == $file_arr[0]){ $ifselected = "selected"; } if($source == $file_arr[0]){ $ifselected = "selected"; }
echo "<option $ifselected value=\"$file_arr[0]\">Archive: $arch_date ($count)</option>"; echo "<option $ifselected value=\"$file_arr[0]\">Archive: $arch_date ($count)</option>";
} }
} }
closedir($handle); closedir($handle);
echo"</select> echo"</select>
</td> </td>
<td height=\"1\" width=\"182\"> <td height=\"1\" width=\"182\">
</td> </td>
</tr> </tr>
<tr> <tr>
<td height=\"1\" width=\"284\" align=\"right\" > <td height=\"1\" width=\"284\" align=\"right\" >
Category&nbsp; Category&nbsp;
</td> </td>
<td height=\"1\" width=\"178\" > <td height=\"1\" width=\"178\" >
<select name=\"category\" ><option selected value=\"\">- All -</option>"; <select name=\"category\" ><option selected value=\"\">- All -</option>";
//$cat_lines = file("./data/category.db.php"); commented-out because can lines are already opened before, and filtered with propper restrictions for user //$cat_lines = file("./data/category.db.php"); commented-out because can lines are already opened before, and filtered with propper restrictions for user
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$ifselected = ""; $ifselected = "";
if($category == $cat_arr[0]){ $ifselected = "selected"; } if($category == $cat_arr[0]){ $ifselected = "selected"; }
echo"<option $ifselected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; echo"<option $ifselected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
} }
echo"</select> echo"</select>
</td> </td>
<td height=\"1\" width=\"180\" > <td height=\"1\" width=\"180\" >
</td> </td>
</tr> </tr>
"; ";
if($member_db[1] != 3){ if($member_db[1] != 3){
echo" echo"
<tr> <tr>
<td height=\"1\" width=\"284\" align=\"right\" > <td height=\"1\" width=\"284\" align=\"right\" >
Author&nbsp; Author&nbsp;
</td> </td>
<td height=\"1\" width=\"178\" > <td height=\"1\" width=\"178\" >
<select name=author size=\"1\"><option value=\"\">- Any -</option>"; <select name=author size=\"1\"><option value=\"\">- Any -</option>";
$user_lines = file("./data/users.db.php"); $user_lines = file("./data/users.db.php");
foreach($user_lines as $single_line){ foreach($user_lines as $single_line){
if(!eregi("<\?", $single_line)){ if(!eregi("<\?", $single_line)){
$user_arr = explode("|", $single_line); $user_arr = explode("|", $single_line);
$ifselected = ""; $ifselected = "";
if($user_arr[1] != 4){ if($user_arr[1] != 4){
if($author == $user_arr[2]){ $ifselected = "selected"; } if($author == $user_arr[2]){ $ifselected = "selected"; }
echo"<option $ifselected value=\"$user_arr[2]\">$user_arr[2]</option>\n"; echo"<option $ifselected value=\"$user_arr[2]\">$user_arr[2]</option>\n";
} }
} }
} }
echo"</select> echo"</select>
</td> </td>
<td height=\"1\" width=\"180\" > <td height=\"1\" width=\"180\" >
</td> </td>
</tr> </tr>
"; ";
} }
echo" echo"
<tr> <tr>
<td height=\"1\" width=\"284\" align=\"right\" > <td height=\"1\" width=\"284\" align=\"right\" >
News per page&nbsp; News per page&nbsp;
</td> </td>
<td height=\"1\" width=\"178\" > <td height=\"1\" width=\"178\" >
<input style=\"text-align: Center\" name=\"news_per_page\" value=\"$news_per_page\" type=text size=3> <input style=\"text-align: Center\" name=\"news_per_page\" value=\"$news_per_page\" type=text size=3>
</td> </td>
<td height=\"1\" width=\"180\" > <td height=\"1\" width=\"180\" >
</td> </td>
</tr> </tr>
<tr> <tr>
<td height=\"1\" width=\"284\" align=\"right\" > <td height=\"1\" width=\"284\" align=\"right\" >
</td> </td>
<td height=\"1\" width=\"178\" > <td height=\"1\" width=\"178\" >
<br><input type=submit value=\"Show\"> <br><input type=submit value=\"Show\">
</td> </td>
<td height=\"1\" width=\"180\" > <td height=\"1\" width=\"180\" >
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</div> </div>
</td> </td>
</tr> </tr>
</table>&nbsp;"; </table>&nbsp;";
// End Options Bar // End Options Bar
//////////////////////////////////////////////////////////////////////////////// Showing List of News //////////////////////////////////////////////////////////////////////////////// Showing List of News
if($entries_showed == 0){ if($entries_showed == 0){
echo"<table border=0 cellpading=0 cellspacing=0 width=100% > echo"<table border=0 cellpading=0 cellspacing=0 width=100% >
<form method=post name=editnews> <form method=post name=editnews>
<td colspan=6 ><p style=\"border: solid black 1px; margin: 22px 22px 22px 22px; padding: 4px 4px 4px 4px;\" align=center>- No news were found matching your criteria -<br><a href=\"#\" onClick=\"getElementById('options').style.display='';\">[options]</a></p>"; <td colspan=6 ><p style=\"border: solid black 1px; margin: 22px 22px 22px 22px; padding: 4px 4px 4px 4px;\" align=center>- No news were found matching your criteria -<br><a href=\"#\" onClick=\"getElementById('options').style.display='';\">[options]</a></p>";
} }
else{ else{
echo<<<JSCRIPT echo<<<JSCRIPT
<script language='JavaScript' type="text/javascript"> <script language='JavaScript' type="text/javascript">
<!-- <!--
function ckeck_uncheck_all() { function ckeck_uncheck_all() {
var frm = document.editnews; var frm = document.editnews;
for (var i=0;i<frm.elements.length;i++) { for (var i=0;i<frm.elements.length;i++) {
var elmnt = frm.elements[i]; var elmnt = frm.elements[i];
if (elmnt.type=='checkbox') { if (elmnt.type=='checkbox') {
if(frm.master_box.checked == true){ elmnt.checked=false; } if(frm.master_box.checked == true){ elmnt.checked=false; }
else{ elmnt.checked=true; } else{ elmnt.checked=true; }
} }
} }
if(frm.master_box.checked == true){ frm.master_box.checked = false; } if(frm.master_box.checked == true){ frm.master_box.checked = false; }
else{ frm.master_box.checked = true; } else{ frm.master_box.checked = true; }
} }
--> -->
</script> </script>
JSCRIPT; JSCRIPT;
echo"<table border=0 cellpading=0 cellspacing=0 width=99% > echo"<table border=0 cellpading=0 cellspacing=0 width=99% >
<form method=post name=editnews> <form method=post name=editnews>
<td width=347> <td width=347>
Title Title
<td width=65> <td width=65>
Comments Comments
<td width=65> <td width=65>
&nbsp;Category &nbsp;Category
<td width=58> <td width=58>
&nbsp;Date &nbsp;Date
<td width=78> <td width=78>
Author Author
<td width=21 align=center> <input style=\"border: 0px; background:transparent;\" type=checkbox name=master_box title=\"Check All\" onclick=\"javascript:ckeck_uncheck_all()\"> </a> "; <td width=21 align=center> <input style=\"border: 0px; background:transparent;\" type=checkbox name=master_box title=\"Check All\" onclick=\"javascript:ckeck_uncheck_all()\"> </a> ";
} }
##################################################################################################################### #####################################################################################################################
echo $entries; echo $entries;
##################################################################################################################### #####################################################################################################################
if($start_from > 0) if($start_from > 0)
{ {
$previous = $start_from - $news_per_page; $previous = $start_from - $news_per_page;
$npp_nav .= "<a href=\"$PHP_SELF?mod=editnews&action=list&start_from=$previous&category=$category&author=$author&source=$source&news_per_page=$news_per_page\"><< Previous</a>"; $npp_nav .= "<a href=\"$PHP_SELF?mod=editnews&action=list&start_from=$previous&category=$category&author=$author&source=$source&news_per_page=$news_per_page\"><< Previous</a>";
$tmp = 1; $tmp = 1;
} }
if(count($all_db) > $i) if(count($all_db) > $i)
{ {
if($tmp){ $npp_nav .= "&nbsp;&nbsp;||&nbsp;&nbsp;";} if($tmp){ $npp_nav .= "&nbsp;&nbsp;||&nbsp;&nbsp;";}
$how_next = count($all_db) - $i; $how_next = count($all_db) - $i;
if($how_next > $news_per_page){ $how_next = $news_per_page; } if($how_next > $news_per_page){ $how_next = $news_per_page; }
$npp_nav .= "<a href=\"$PHP_SELF?mod=editnews&action=list&start_from=$i&category=$category&author=$author&source=$source&news_per_page=$news_per_page\">Next $how_next >></a>"; $npp_nav .= "<a href=\"$PHP_SELF?mod=editnews&action=list&start_from=$i&category=$category&author=$author&source=$source&news_per_page=$news_per_page\">Next $how_next >></a>";
} }
if($entries_showed != 0){ if($entries_showed != 0){
echo<<<HTML echo<<<HTML
<tr> <tr>
<td colspan=7 align=right>&nbsp; <td colspan=7 align=right>&nbsp;
</tr> </tr>
<tr> <tr>
<td> <td>
$npp_nav $npp_nav
<td colspan=7 align=right> <td colspan=7 align=right>
With selected: With selected:
<select name=action> <select name=action>
<option value="">-- Choose Action --</option> <option value="">-- Choose Action --</option>
<option title="delete all selected news" value="mass_delete">Delete</option> <option title="delete all selected news" value="mass_delete">Delete</option>
HTML; HTML;
if($member_db[1] == 1){ echo"<option title=\"make new archive with all selected news\" value=\"mass_archive\">Send to Archive</option>"; } if($member_db[1] == 1){ echo"<option title=\"make new archive with all selected news\" value=\"mass_archive\">Send to Archive</option>"; }
if( $source == "unapproved" ){ $if_mass_appr = "SELECTED"; } else {$if_mass_appr = ''; } if( $source == "unapproved" ){ $if_mass_appr = "SELECTED"; } else {$if_mass_appr = ''; }
if( $source == "unapproved" and ($member_db[1] == 1 or $member_db[1] == 2)){ echo"<option $if_mass_appr title=\"approve selected news\" value=\"mass_approve\">Approve News</option>"; } if( $source == "unapproved" and ($member_db[1] == 1 or $member_db[1] == 2)){ echo"<option $if_mass_appr title=\"approve selected news\" value=\"mass_approve\">Approve News</option>"; }
if($member_db[1] == 1){ echo"<option title=\"move all selected news to one category\" value=\"mass_move_to_cat\">Change Category</option>"; } if($member_db[1] == 1){ echo"<option title=\"move all selected news to one category\" value=\"mass_move_to_cat\">Change Category</option>"; }
echo<<<HTML echo<<<HTML
</select> </select>
<input type=hidden name=source value="$source"> <input type=hidden name=source value="$source">
<input type=hidden name=mod value="massactions"> <input type=hidden name=mod value="massactions">
<input type=submit value=Go> <input type=submit value=Go>
</tr> </tr>
HTML; HTML;
} }
echo<<<HTML echo<<<HTML
</tr> </tr>
<tr> <tr>
<td colspan=1> <td colspan=1>
</tr> </tr>
<tr> <tr>
<td colspan=6> <td colspan=6>
</tr> </tr>
</form></table> </form></table>
HTML; HTML;
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Edit News Article // Edit News Article
// ******************************************************************************** // ********************************************************************************
elseif($action == "editnews") elseif($action == "editnews")
{ {
// Show The Article for Editing // Show The Article for Editing
if($source == ""){ $all_db = file("./data/news.txt"); } if($source == ""){ $all_db = file("./data/news.txt"); }
elseif($source == "postponed"){ $all_db = file("./data/postponed_news.txt"); } elseif($source == "postponed"){ $all_db = file("./data/postponed_news.txt"); }
elseif($source == "unapproved"){ $all_db = file("./data/unapproved_news.txt"); } elseif($source == "unapproved"){ $all_db = file("./data/unapproved_news.txt"); }
else{ $all_db = file("./data/archives/$source.news.arch"); } else{ $all_db = file("./data/archives/$source.news.arch"); }
$found = FALSE; $found = FALSE;
foreach ($all_db as $line) foreach ($all_db as $line)
{ {
$item_db=explode("|",$line); $item_db=explode("|",$line);
if ($id == $item_db[0]){ $found = TRUE; break;} if ($id == $item_db[0]){ $found = TRUE; break;}
}//foreach news line }//foreach news line
$have_perm = 0; $have_perm = 0;
if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
elseif($member_db[1] == 3 and $item_db[1] == $member_db[2]) {$have_perm = 1;} elseif($member_db[1] == 3 and $item_db[1] == $member_db[2]) {$have_perm = 1;}
if(!$have_perm){ msg("error", "NO Access", "You dont have access for this action", "$PHP_SELF?mod=editnews&action=list"); } if(!$have_perm){ msg("error", "NO Access", "You dont have access for this action", "$PHP_SELF?mod=editnews&action=list"); }
if(strstr($item_db[6], ',')){ if(strstr($item_db[6], ',')){
$all_these_cats = explode(',',$item_db[6]); $all_these_cats = explode(',',$item_db[6]);
foreach($all_these_cats as $all_this_cat){ foreach($all_these_cats as $all_this_cat){
if($member_db[1] != 1 and !in_array($all_this_cat,$allowed_cats) ){ msg("error", "Access Denied", "This article is posted under category which you are not allowed to access."); } if($member_db[1] != 1 and !in_array($all_this_cat,$allowed_cats) ){ msg("error", "Access Denied", "This article is posted under category which you are not allowed to access."); }
} }
} }
else{ else{
if($member_db[1] != 1 and !in_array($item_db[6],$allowed_cats) ){ msg("error", "Access Denied", "This article is posted under category which you are not allowed to access."); } if($member_db[1] != 1 and !in_array($item_db[6],$allowed_cats) ){ msg("error", "Access Denied", "This article is posted under category which you are not allowed to access."); }
} }
if (!$found){ msg("error","Error !!!","The selected news item can <b>not</b> be found."); } if (!$found){ msg("error","Error !!!","The selected news item can <b>not</b> be found."); }
$newstime = date("D, d F Y h:i:s", $item_db[0]); $newstime = date("D, d F Y h:i:s", $item_db[0]);
$item_db[2] = stripslashes( preg_replace(array("'\|'", "'\"'", "'\''"), array("I", "&quot;", "&#039;"), $item_db[2]) ); $item_db[2] = stripslashes( preg_replace(array("'\|'", "'\"'", "'\''"), array("I", "&quot;", "&#039;"), $item_db[2]) );
$short_story_id = 'short_story'; $short_story_id = 'short_story';
$full_story_id = 'full_story'; $full_story_id = 'full_story';
// //
// Are we using the WYSIWYG ? // Are we using the WYSIWYG ?
// //
if($config_use_wysiwyg == "yes"){ if($config_use_wysiwyg == "yes"){
$use_wysiwyg = true; $use_wysiwyg = true;
$article_format_options = " $article_format_options = "
<label for='convert'> <label for='convert'>
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to &lt;br /&gt;</label> <input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to &lt;br /&gt;</label>
<br/> <br/>
<label for='html'> <label for='html'>
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label> <input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label>
<input type=hidden name=\"if_use_html\" value=\"yes\"> <input type=hidden name=\"if_use_html\" value=\"yes\">
<br/>"; <br/>";
}else{ }else{
$use_wysiwyg = false; $use_wysiwyg = false;
$article_format_options = " $article_format_options = "
<label for='convert'> <label for='convert'>
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to &lt;br /&gt;</label> <input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to &lt;br /&gt;</label>
<br/> <br/>
<label for='html'> <label for='html'>
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label> <input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label>
<br/>"; <br/>";
} }
$item_db[3] = replace_news("admin", $item_db[3], $use_wysiwyg); $item_db[3] = replace_news("admin", $item_db[3], $use_wysiwyg);
$item_db[4] = replace_news("admin", $item_db[4], $use_wysiwyg); $item_db[4] = replace_news("admin", $item_db[4], $use_wysiwyg);
echoheader("editnews","Edit News"); echoheader("editnews","Edit News");
echo" echo"
<SCRIPT LANGUAGE=\"JavaScript\"> <SCRIPT LANGUAGE=\"JavaScript\">
function preview(){ function preview(){
dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1') dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1')
document.addnews.mod.value='preview';document.addnews.target='prv' document.addnews.mod.value='preview';document.addnews.target='prv'
document.addnews.submit();dd.focus() document.addnews.submit();dd.focus()
setTimeout(\"document.addnews.mod.value='editnews';document.addnews.target='_self'\",500) setTimeout(\"document.addnews.mod.value='editnews';document.addnews.target='_self'\",500)
} }
function confirmDelete(url){ function confirmDelete(url){
var agree=confirm(\"Do you really want to permanently delete this article ?\"); var agree=confirm(\"Do you really want to permanently delete this article ?\");
if (agree) if (agree)
document.location=url; document.location=url;
} }
function increaseTextarea(area){ function increaseTextarea(area){
if (document.getElementById(area).style.height == '') { if (document.getElementById(area).style.height == '') {
document.getElementById(area).style.height = '300px'; document.getElementById(area).style.height = '300px';
} }
else{ else{
var pattern = new RegExp(\"\\\\d+\",'ig'); var pattern = new RegExp(\"\\\\d+\",'ig');
var currHeight = document.getElementById(area).style.height.match(pattern); var currHeight = document.getElementById(area).style.height.match(pattern);
var newHeight = +currHeight + 100; var newHeight = +currHeight + 100;
document.getElementById(area).style.height = newHeight + 'px'; document.getElementById(area).style.height = newHeight + 'px';
} }
} }
function submitForm() { function submitForm() {
//make sure hidden and iframe values are in sync before submitting form //make sure hidden and iframe values are in sync before submitting form
//to sync only 1 rte, use updateRTE(rte) //to sync only 1 rte, use updateRTE(rte)
//to sync all rtes, use updateRTEs //to sync all rtes, use updateRTEs
updateRTE('short_story'); updateRTE('short_story');
updateRTE('full_story'); updateRTE('full_story');
//updateRTEs(); //updateRTEs();
//change the following line to true to submit form //change the following line to true to submit form
return true; return true;
} }
</SCRIPT> </SCRIPT>
<form onSubmit = \"return submitForm();\" method=POST name=addnews action=\"$PHP_SELF\"> <form onSubmit = \"return submitForm();\" method=POST name=addnews action=\"$PHP_SELF\">
<table border=0 cellpading=0 cellspacing=0 width=\"654\" height=\"100%\" > <table border=0 cellpading=0 cellspacing=0 width=\"654\" height=\"100%\" >
<td valign=middle width=\"75\"> <td valign=middle width=\"75\">
Info. Info.
<td width=\"571\" colspan=\"6\"> <td width=\"571\" colspan=\"6\">
Posted on $newstime by $item_db[1] Posted on $newstime by $item_db[1]
<tr> <tr>
<td valign=middle width=\"75\" valign=\"top\"> <td valign=middle width=\"75\" valign=\"top\">
Title Title
<td width=\"464\" colspan=\"3\"> <td width=\"464\" colspan=\"3\">
<input type=text name=title value=\"$item_db[2]\" size=55 tabindex=1> <input type=text name=title value=\"$item_db[2]\" size=55 tabindex=1>
<td width=\"103\" valign=\"top\"> <td width=\"103\" valign=\"top\">
</tr>"; </tr>";
if($config_use_avatar == "yes"){ if($config_use_avatar == "yes"){
echo" echo"
<tr> <tr>
<td valign=middle width=\"75\" valign=\"top\"> <td valign=middle width=\"75\" valign=\"top\">
Avatar URL Avatar URL
<td width=\"464\" colspan=\"3\"> <td width=\"464\" colspan=\"3\">
<input type=text name=editavatar value=\"$item_db[5]\" size=42 tabindex=2>&nbsp;&nbsp;&nbsp;<font style=\"font-size:7pt\">(optional)</font> <input type=text name=editavatar value=\"$item_db[5]\" size=42 tabindex=2>&nbsp;&nbsp;&nbsp;<font style=\"font-size:7pt\">(optional)</font>
<td width=\"103\" valign=\"top\"> <td width=\"103\" valign=\"top\">
</tr>"; </tr>";
} }
/* Old Single Category Code /* Old Single Category Code
echo"<tr> echo"<tr>
<td valign=middle width=\"75\" valign=\"top\"> <td valign=middle width=\"75\" valign=\"top\">
Category Category
<td width=\"464\" colspan=\"3\"> <td width=\"464\" colspan=\"3\">
<select name=\"category\" >"; <select name=\"category\" >";
$cat_lines = file("./data/category.db.php"); $cat_lines = file("./data/category.db.php");
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
if($item_db[6] == $cat_arr[0]){ if($item_db[6] == $cat_arr[0]){
echo"<option selected=\"selected\" value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; echo"<option selected=\"selected\" value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
$selected = TRUE; $selected = TRUE;
}else{ echo"<option value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; } }else{ echo"<option value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; }
} }
if(!$selected){ echo"<option selected value=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>"; } if(!$selected){ echo"<option selected value=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>"; }
else{ echo"<option value=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>"; } else{ echo"<option value=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>"; }
echo"</select> echo"</select>
<td width=\"105\" valign=\"top\"> <td width=\"105\" valign=\"top\">
</tr>"; </tr>";
*/ */
echo"<tr> echo"<tr>
<td valign=middle width=\"75\" valign=\"top\"> <td valign=middle width=\"75\" valign=\"top\">
Category Category
<td width=\"464\" colspan=\"3\">"; <td width=\"464\" colspan=\"3\">";
echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">'; echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">';
// $cat_lines = file("./data/category.db.php"); commented-out because can lines are already opened before, and filtered with propper restrictions for user // $cat_lines = file("./data/category.db.php"); commented-out because can lines are already opened before, and filtered with propper restrictions for user
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
echo" echo"
<td style='font-size:10px;' valign=top> <td style='font-size:10px;' valign=top>
<label for='cat{$cat_arr[0]}'>"; <label for='cat{$cat_arr[0]}'>";
if( in_array($cat_arr[0], explode(',',$item_db[6])) ){ if( in_array($cat_arr[0], explode(',',$item_db[6])) ){
echo"<input checked style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>"; echo"<input checked style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>";
}else{ }else{
echo"<input style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>"; echo"<input style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>";
} }
$i++; $i++;
if ($i%4 == 0){ echo'<tr>'; } if ($i%4 == 0){ echo'<tr>'; }
} }
echo"</tr>"; echo"</tr>";
echo" </table> <td> </td> </tr>"; echo" </table> <td> </td> </tr>";
echo" <tr> echo" <tr>
<td valign=\"top\"> <td valign=\"top\">
<br />Short Story <br />Short Story
<td width=\"464\" colspan=\"3\"> <td width=\"464\" colspan=\"3\">
"; ";
if ($use_wysiwyg) { if ($use_wysiwyg) {
echo" echo"
<script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script> <script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script>
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script> initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script>
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
writeRichText('short_story', '".rteSafe($item_db[3])."', 460, 250, true, false); writeRichText('short_story', '".rteSafe($item_db[3])."', 460, 250, true, false);
</script> </script>
"; ";
}else{ }else{
echo" echo"
<textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=3>$item_db[3]</textarea> <textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=3>$item_db[3]</textarea>
"; ";
} }
echo" echo"
<td width=\"165\" valign=\"top\" align=center style='background: url(skins/images/baloon.gif) no-repeat top left'> <td width=\"165\" valign=\"top\" align=center style='background: url(skins/images/baloon.gif) no-repeat top left'>
<p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\"><br /> <p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\"><br />
[insert image]</a><br /> [insert image]</a><br />
<!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=short_story', '_CuteCode', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[quick tags]</a><br /> --> <!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=short_story', '_CuteCode', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[quick tags]</a><br /> -->
<a href=# onclick=\"increaseTextarea('$short_story_id'); return false;\">[expand]</a> <a href=# onclick=\"increaseTextarea('$short_story_id'); return false;\">[expand]</a>
<br /><br /> <br /><br />
"; ";
echo insertSmilies("$short_story_id", 4, true, "$use_wysiwyg"); echo insertSmilies("$short_story_id", 4, true, "$use_wysiwyg");
echo"</tr> echo"</tr>
<tr> <tr>
<td width=\"75\" valign=\"top\"> <td width=\"75\" valign=\"top\">
<br />Full Story<br /><font style=\"font-size:7pt\">(optional)</font> <br />Full Story<br /><font style=\"font-size:7pt\">(optional)</font>
<td width=\"464\" colspan=\"3\"> <td width=\"464\" colspan=\"3\">
"; ";
if ($use_wysiwyg) { if ($use_wysiwyg) {
echo" echo"
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
writeRichText('full_story', '".rteSafe($item_db[4])."', 460, 250, true, false); writeRichText('full_story', '".rteSafe($item_db[4])."', 460, 250, true, false);
</script> </script>
"; ";
}else{ }else{
echo" echo"
<textarea rows=\"12\" cols=\"74\" id=\"full_story\" name=\"full_story\" tabindex=4>$item_db[4]</textarea> <textarea rows=\"12\" cols=\"74\" id=\"full_story\" name=\"full_story\" tabindex=4>$item_db[4]</textarea>
"; ";
} }
echo" echo"
<td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'> <td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'>
<p align=\"center\"><br /> <p align=\"center\"><br />
<a href=# onclick=\"window.open('$PHP_SELF?mod=images&action=quick&area=$full_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[insert image]</a><br /> <a href=# onclick=\"window.open('$PHP_SELF?mod=images&action=quick&area=$full_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[insert image]</a><br />
<!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=full_story', '_Addimage', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_CuteCode\">[quick tags]</a><br />--> <!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=full_story', '_Addimage', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_CuteCode\">[quick tags]</a><br />-->
<a href=# onclick=\"increaseTextarea('$full_story_id'); return false;\">[expand]</a> <a href=# onclick=\"increaseTextarea('$full_story_id'); return false;\">[expand]</a>
<br /><br />"; <br /><br />";
echo insertSmilies("$full_story_id", 4, true, "$use_wysiwyg"); echo insertSmilies("$full_story_id", 4, true, "$use_wysiwyg");
echo"</tr> echo"</tr>
<tr> <tr>
<td> <td>
<td colspan=\"3\"> <td colspan=\"3\">
<input type=hidden name=id value=$id> <input type=hidden name=id value=$id>
<input type=hidden name=action value=doeditnews> <input type=hidden name=action value=doeditnews>
<input type=hidden name=mod value=editnews> <input type=hidden name=mod value=editnews>
<input type=hidden name=source value=$source> <input type=hidden name=source value=$source>
<table border=0 cellspacing=0 cellpadding=0 width=100%> <table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr> <tr>
<td width=50%> <td width=50%>
<input type=submit style='font-weight:bold' value=\"Save Changes\" accesskey=\"s\">&nbsp; <input type=submit style='font-weight:bold' value=\"Save Changes\" accesskey=\"s\">&nbsp;
<!--<input type=button value=\"Preview\" onClick=\"preview()\" accesskey=\"p\">--> <!--<input type=button value=\"Preview\" onClick=\"preview()\" accesskey=\"p\">-->
</td> </td>
<td width=50% align=right> <td width=50% align=right>
"; ";
if($source == 'unapproved'){ if($source == 'unapproved'){
echo"<input type=button value=\"Approve\" onClick=\"javascript:document.location=('$PHP_SELF?mod=massactions&selected_news[]=$id&action=mass_approve&source=unapproved');\"> &nbsp;"; echo"<input type=button value=\"Approve\" onClick=\"javascript:document.location=('$PHP_SELF?mod=massactions&selected_news[]=$id&action=mass_approve&source=unapproved');\"> &nbsp;";
} }
echo"<input type=button value=\"Delete\" onClick=\"confirmDelete('$PHP_SELF?mod=editnews&action=doeditnews&source=$source&ifdelete=yes&id=$id')\"> &nbsp; echo"<input type=button value=\"Delete\" onClick=\"confirmDelete('$PHP_SELF?mod=editnews&action=doeditnews&source=$source&ifdelete=yes&id=$id')\"> &nbsp;
<input style='width:90px;' type=button onClick=\"ShowOrHide('options','')\" value=\"Article Options\"> <input style='width:90px;' type=button onClick=\"ShowOrHide('options','')\" value=\"Article Options\">
</td> </td>
</tr> </tr>
</table> </table>
</tr> </tr>
<tr id='options' style='display:none;'> <tr id='options' style='display:none;'>
<td width=\"75\"> <td width=\"75\">
<br>Options <br>Options
<td width=\"565\" colspan=\"4\"> <td width=\"565\" colspan=\"4\">
&nbsp;<br> &nbsp;<br>
$article_format_options $article_format_options
</tr> </tr>
</form> </form>
<tr> <tr>
<td width=\"75\"><br> <td width=\"75\"><br>
<td width=\"561\" colspan=\"4\"><br> <td width=\"561\" colspan=\"4\"><br>
</tr> </tr>
<tr> <tr>
<td width=\"75\"> <td width=\"75\">
Comments"; Comments";
// Show the Comments for Editing // Show the Comments for Editing
if($source == "" or $source == "postponed" or $source == "unapproved"){ $all_comments_db = file("./data/comments.txt"); } if($source == "" or $source == "postponed" or $source == "unapproved"){ $all_comments_db = file("./data/comments.txt"); }
else{ $all_comments_db = file("./data/archives/${source}.comments.arch"); } else{ $all_comments_db = file("./data/archives/${source}.comments.arch"); }
$found_newsid = FALSE; $found_newsid = FALSE;
foreach($all_comments_db as $comment_line) foreach($all_comments_db as $comment_line)
{ {
$comment_line = trim($comment_line); $comment_line = trim($comment_line);
$comments_arr = explode("|>|",$comment_line); $comments_arr = explode("|>|",$comment_line);
if($comments_arr[0] == $id) if($comments_arr[0] == $id)
{//if these are comments for our story {//if these are comments for our story
$found_newsid = TRUE; $found_newsid = TRUE;
if ($comments_arr[1] != "") if ($comments_arr[1] != "")
{ {
echo" <td width=290> echo" <td width=290>
<b>&nbsp;&nbsp;Poster</b>, Comment preview <b>&nbsp;&nbsp;Poster</b>, Comment preview
<td width=120> <td width=120>
<b>Date</b> <b>Date</b>
<td width=1> <td width=1>
<td width=100> <td width=100>
</tr> </tr>
<form method=post name=comments action=\"$PHP_SELF\">"; <form method=post name=comments action=\"$PHP_SELF\">";
$flag = 1; $flag = 1;
$different_posters = explode("||",$comments_arr[1]); $different_posters = explode("||",$comments_arr[1]);
foreach($different_posters as $individual_comment) foreach($different_posters as $individual_comment)
{ {
if($flag == 1){ $bg = "bgcolor=#F7F6F4"; $flag = 0;} if($flag == 1){ $bg = "bgcolor=#F7F6F4"; $flag = 0;}
else{$bg = ""; $flag = 1;} else{$bg = ""; $flag = 1;}
$comment_arr = explode("|",$individual_comment); $comment_arr = explode("|",$individual_comment);
$comtime = date("d/m/y h:i:s",$comment_arr[0]); $comtime = date("d/m/y h:i:s",$comment_arr[0]);
$comm_value = stripslashes(strip_tags($comment_arr[4])); $comm_value = stripslashes(strip_tags($comment_arr[4]));
$comm_excerpt_lenght = 43 - strlen($comment_arr[1]); $comm_excerpt_lenght = 43 - strlen($comment_arr[1]);
if($comm_excerpt_lenght < strlen($comm_value)){ if($comm_excerpt_lenght < strlen($comm_value)){
$comm_excerpt = substr($comm_value,0, $comm_excerpt_lenght).'...'; $comm_excerpt = substr($comm_value,0, $comm_excerpt_lenght).'...';
}else{ }else{
$comm_excerpt = $comm_value; $comm_excerpt = $comm_value;
} }
if($comment_arr[1]) if($comment_arr[1])
{ {
if(strlen($comment_arr[1]) > 25){ $comment_arr[1] = substr($comment_arr[1],0,22)."..."; } if(strlen($comment_arr[1]) > 25){ $comment_arr[1] = substr($comment_arr[1],0,22)."..."; }
echo"<tr> echo"<tr>
<td > <td >
<td $bg> <td $bg>
&nbsp; <a title=\"edit this comment\nip:$comment_arr[3]\" href=\"$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source\" onclick=\"window.open('$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source', 'Comments', 'HEIGHT=270,resizable=yes,scrollbars=yes,WIDTH=400');return false;\">$comment_arr[1]</a>, &nbsp; <a title=\"edit this comment\nip:$comment_arr[3]\" href=\"$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source\" onclick=\"window.open('$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source', 'Comments', 'HEIGHT=270,resizable=yes,scrollbars=yes,WIDTH=400');return false;\">$comment_arr[1]</a>,
$comm_excerpt $comm_excerpt
<td $bg> <td $bg>
<a title=\"edit this comment\nip:$comment_arr[3]\" href=\"$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source\" onclick=\"window.open('$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source', 'Comments', 'HEIGHT=270,resizable=yes,scrollbars=yes,WIDTH=400');return false;\">$comtime</a> <a title=\"edit this comment\nip:$comment_arr[3]\" href=\"$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source\" onclick=\"window.open('$PHP_SELF?mod=editcomments&action=editcomment&newsid=$id&comid=$comment_arr[0]&source=$source', 'Comments', 'HEIGHT=270,resizable=yes,scrollbars=yes,WIDTH=400');return false;\">$comtime</a>
<td width=\"1\" $bg> <td width=\"1\" $bg>
<input type=checkbox name=\"delcomid[$comment_arr[0]]\" value=1> <input type=checkbox name=\"delcomid[$comment_arr[0]]\" value=1>
<td $bg> <td $bg>
</tr>"; </tr>";
}//if not blank }//if not blank
}//foreach comment }//foreach comment
echo"<tr> echo"<tr>
<td > <td >
<td > <td >
<td > <td >
<p align=\"right\">delete all? <p align=\"right\">delete all?
<td > <td >
<input type=checkbox name=delcomid[all] value=1> <input type=checkbox name=delcomid[all] value=1>
<td > <td >
</tr> </tr>
<tr> <tr>
<td > <td >
<td colspan=\"3\"> <td colspan=\"3\">
<p align=\"right\"><input type=submit value=\"Delete Selected\"> <p align=\"right\"><input type=submit value=\"Delete Selected\">
<td > <td >
</tr> </tr>
<input type=hidden name=newsid value=$id> <input type=hidden name=newsid value=$id>
<input type=hidden name=deletecomment value=yes> <input type=hidden name=deletecomment value=yes>
<input type=hidden name=action value=doeditcomment> <input type=hidden name=action value=doeditcomment>
<input type=hidden name=mod value=editcomments> <input type=hidden name=mod value=editcomments>
<input type=hidden name=source value=$source> <input type=hidden name=source value=$source>
</form> </form>
</table>"; </table>";
break;//foreach comment line break;//foreach comment line
}//if there are any comments }//if there are any comments
else else
{ {
echo"<td width=\"210\"> echo"<td width=\"210\">
No Comments No Comments
<td width=\"219\"> <td width=\"219\">
<td width=\"1\"> <td width=\"1\">
<td width=\"105\"> <td width=\"105\">
</tr> </tr>
</tr> </tr>
</table>"; </table>";
} }
}//if these are comments for our story }//if these are comments for our story
}//foreach comments line }//foreach comments line
if($found_newsid == FALSE){ if($found_newsid == FALSE){
echo"<td width=\"210\"> echo"<td width=\"210\">
No Comments No Comments
<td width=\"219\"> <td width=\"219\">
<td width=\"1\"> <td width=\"1\">
<td width=\"105\"> <td width=\"105\">
</tr> </tr>
</tr> </tr>
</table>"; </table>";
} }
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Do Edit News // Do Edit News
// ******************************************************************************** // ********************************************************************************
elseif($action == "doeditnews") elseif($action == "doeditnews")
{ {
///// /////
///Format our categories variable ///Format our categories variable
///// /////
if( is_array($category) ){ //User has selected multiple categories if( is_array($category) ){ //User has selected multiple categories
$nice_category = ''; $nice_category = '';
$ccount = 0; $ccount = 0;
foreach($category as $ckey=>$cvalue){ foreach($category as $ckey=>$cvalue){
if( !in_array($cvalue,$allowed_cats) ){ die('not allowed category'); } if( !in_array($cvalue,$allowed_cats) ){ die('not allowed category'); }
if($ccount==0){ $nice_category = $cvalue; }//first cat if($ccount==0){ $nice_category = $cvalue; }//first cat
else{ $nice_category = $nice_category.','.$cvalue; } else{ $nice_category = $nice_category.','.$cvalue; }
$ccount++; $ccount++;
} }
}else{ //Not in a category }else{ //Not in a category
if( $category !="" and isset($category) and !in_array($category,$allowed_cats) ){ die('not allowed category'); } if( $category !="" and isset($category) and !in_array($category,$allowed_cats) ){ die('not allowed category'); }
//don't format $nice_cats because we have not selected any. //don't format $nice_cats because we have not selected any.
} }
if(trim($title) == "" and $ifdelete != "yes"){ msg("error","Error !!!","The title can not be blank.", "javascript:history.go(-1)"); } if(trim($title) == "" and $ifdelete != "yes"){ msg("error","Error !!!","The title can not be blank.", "javascript:history.go(-1)"); }
if($short_story == "" and $ifdelete != "yes"){ msg("error","Error !!!","The story can not be blank.", "javascript:history.go(-1)"); } if($short_story == "" and $ifdelete != "yes"){ msg("error","Error !!!","The story can not be blank.", "javascript:history.go(-1)"); }
if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; } if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; }
if($if_use_html == "yes"){ $use_html = TRUE; } if($if_use_html == "yes"){ $use_html = TRUE; }
$short_story = replace_news("add", rtrim($short_story), $n_to_br, $use_html); $short_story = replace_news("add", rtrim($short_story), $n_to_br, $use_html);
$full_story = replace_news("add", rtrim($full_story), $n_to_br, $use_html); $full_story = replace_news("add", rtrim($full_story), $n_to_br, $use_html);
$title = stripslashes( preg_replace(array("'\|'", "'\n'", "''"), array("I", "<br />", ""), $title) ); $title = stripslashes( preg_replace(array("'\|'", "'\n'", "''"), array("I", "<br />", ""), $title) );
$avatar = stripslashes( preg_replace(array("'\|'", "'\n'", "''"), array("I", "<br />", ""), $avatar) ); $avatar = stripslashes( preg_replace(array("'\|'", "'\n'", "''"), array("I", "<br />", ""), $avatar) );
if($source == ""){ $news_file = "./data/news.txt"; $com_file = "./data/comments.txt"; } if($source == ""){ $news_file = "./data/news.txt"; $com_file = "./data/comments.txt"; }
elseif($source == "postponed"){ $news_file = "./data/postponed_news.txt"; $com_file = "./data/comments.txt"; } elseif($source == "postponed"){ $news_file = "./data/postponed_news.txt"; $com_file = "./data/comments.txt"; }
elseif($source == "unapproved"){ $news_file = "./data/unapproved_news.txt"; $com_file = "./data/comments.txt"; } elseif($source == "unapproved"){ $news_file = "./data/unapproved_news.txt"; $com_file = "./data/comments.txt"; }
else{ $news_file = "./data/archives/$source.news.arch"; $com_file = "./data/archives/$source.comments.arch";} else{ $news_file = "./data/archives/$source.news.arch"; $com_file = "./data/archives/$source.comments.arch";}
$old_db = file("$news_file"); $old_db = file("$news_file");
$new_db = fopen("$news_file", w); $new_db = fopen("$news_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if($id != $old_db_arr[0]){ if($id != $old_db_arr[0]){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
$have_perm = 0; $have_perm = 0;
if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;} elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;}
if($have_perm){ if($have_perm){
if($ifdelete != "yes") if($ifdelete != "yes")
{ {
$okchanges = TRUE; $okchanges = TRUE;
fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$nice_category||\n"); fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$nice_category||\n");
} }
else else
{ {
$okdeleted = TRUE; $okdeleted = TRUE;
$all_file = file("$com_file"); $all_file = file("$com_file");
$new_com=fopen("$com_file","w"); $new_com=fopen("$com_file","w");
foreach($all_file as $line) foreach($all_file as $line)
{ {
$line_arr = explode("|>|",$line); $line_arr = explode("|>|",$line);
if($line_arr[0] == $id){ $okdelcom = TRUE; } if($line_arr[0] == $id){ $okdelcom = TRUE; }
else{ fwrite($new_com,"$line"); } else{ fwrite($new_com,"$line"); }
} }
fclose($new_com); fclose($new_com);
} }
}else{ fwrite($new_db,"$old_db_line"); $no_permission = TRUE; } }else{ fwrite($new_db,"$old_db_line"); $no_permission = TRUE; }
} }
} }
fclose($new_db); fclose($new_db);
if($no_permission){ msg("error", "NO Access", "You dont have access for this action", "$PHP_SELF?mod=editnews&action=list"); } if($no_permission){ msg("error", "NO Access", "You dont have access for this action", "$PHP_SELF?mod=editnews&action=list"); }
if($okdeleted and $okdelcom){ msg("info","News Deleted","The news item successfully was deleted.<br />If there were comments for this article they are also deleted."); } if($okdeleted and $okdelcom){ msg("info","News Deleted","The news item successfully was deleted.<br />If there were comments for this article they are also deleted."); }
if($okdeleted and !$okdelcom){ msg("info","News Deleted","The news item successfully was deleted.<br />If there were comments for this article they are also deleted.<br /><font color=red>But can not delete comments of this article !!!</font>"); } if($okdeleted and !$okdelcom){ msg("info","News Deleted","The news item successfully was deleted.<br />If there were comments for this article they are also deleted.<br /><font color=red>But can not delete comments of this article !!!</font>"); }
elseif($okchanges){ msg("info","Changes Saved","The changes were successfully saved", "$PHP_SELF?mod=editnews&action=editnews&id=$id&source=$source"); } elseif($okchanges){ msg("info","Changes Saved","The changes were successfully saved", "$PHP_SELF?mod=editnews&action=editnews&id=$id&source=$source"); }
else{ msg("error","Error !!!","The news item can not be found or there is an error with the news database file."); } else{ msg("error","Error !!!","The news item can not be found or there is an error with the news database file."); }
} }
?> ?>
<?PHP <?PHP
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission to edit users"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission to edit users"); }
// ******************************************************************************** // ********************************************************************************
// List All Available Users + Show Add User Form // List All Available Users + Show Add User Form
// ******************************************************************************** // ********************************************************************************
if($action == "list") if($action == "list")
{ {
echoheader("users","Manage Users"); echoheader("users","Manage Users");
echo'<script language="javascript"> echo'<script language="javascript">
<!-- begin <!-- begin
function popupedit(id){ function popupedit(id){
window.open(\''.$PHP_SELF.'?mod=editusers&action=edituser&id=\'+id,\'User\',\'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=360,height=210\'); window.open(\''.$PHP_SELF.'?mod=editusers&action=edituser&id=\'+id,\'User\',\'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=360,height=210\');
} }
function confirmdelete(id){ function confirmdelete(id){
var agree=confirm("Are you sure you want to delete this user ?"); var agree=confirm("Are you sure you want to delete this user ?");
if (agree) if (agree)
document.location="'.$PHP_SELF.'?mod=editusers&action=dodeleteuser&id="+id; document.location="'.$PHP_SELF.'?mod=editusers&action=dodeleteuser&id="+id;
} }
// end --> // end -->
</script> </script>
<table border=0 cellpading=0 cellspacing=0 width=654> <table border=0 cellpading=0 cellspacing=0 width=654>
<tr> <tr>
<td width=654 colspan="6"> <td width=654 colspan="6">
<!-- Start add edit users table + info + help --> <!-- Start add edit users table + info + help -->
<table border="0" width="657" cellspacing="0" cellpadding="0" height="81" > <table border="0" width="657" cellspacing="0" cellpadding="0" height="81" >
<tr> <tr>
<td valign="bottom" width="311" valign="top" height="1"> <td valign="bottom" width="311" valign="top" height="1">
<b>Add User</b> <b>Add User</b>
</td> </td>
<td width="5" valign="top" rowspan="3" height="81"> <td width="5" valign="top" rowspan="3" height="81">
</td> </td>
<td valign="bottom" width="330" height="1"><b>User Levels</b></td> <td valign="bottom" width="330" height="1"><b>User Levels</b></td>
</tr> </tr>
<tr> <tr>
<td width="311" rowspan="2" valign="top" height="60" > <td width="311" rowspan="2" valign="top" height="60" >
<!-- Add User Table --> <!-- Add User Table -->
<table class="panel" cellspacing="0" cellpadding="0" width="100%"> <table class="panel" cellspacing="0" cellpadding="0" width="100%">
<form method=post action="'.$PHP_SELF.'"> <form method=post action="'.$PHP_SELF.'">
<tr> <tr>
<td >&nbsp;Username</td> <td >&nbsp;Username</td>
<td ><input size=21 type=text name=regusername></td> <td ><input size=21 type=text name=regusername></td>
</tr> </tr>
<tr> <tr>
<td >&nbsp;Password</td> <td >&nbsp;Password</td>
<td ><input size=21 type=text name=regpassword></td> <td ><input size=21 type=text name=regpassword></td>
</tr> </tr>
<tr> <tr>
<td >&nbsp;Nickname</td> <td >&nbsp;Nickname</td>
<td ><input size=21 type=text name=regnickname></td> <td ><input size=21 type=text name=regnickname></td>
</tr> </tr>
<tr> <tr>
<td >&nbsp;Email</td> <td >&nbsp;Email</td>
<td ><input size=21 type=text name=regemail></td> <td ><input size=21 type=text name=regemail></td>
</tr> </tr>
<tr> <tr>
<td >&nbsp;Access Level</td> <td >&nbsp;Access Level</td>
<td ><select name=reglevel> <td ><select name=reglevel>
<option value=4>4 (commenter)</option> <option value=4>4 (commenter)</option>
<option selected value=3>3 (journalist)</option> <option selected value=3>3 (journalist)</option>
<option value=2>2 (editor)</option> <option value=2>2 (editor)</option>
<option value=1>1 (administrator)</option> <option value=1>1 (administrator)</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td >&nbsp;</td> <td >&nbsp;</td>
<td height="35"><input type=submit value="Add User"> <td height="35"><input type=submit value="Add User">
<input type=hidden name=action value=adduser> <input type=hidden name=action value=adduser>
<input type=hidden name=mod value=editusers> <input type=hidden name=mod value=editusers>
</td> </td>
</tr> </tr>
</form> </form>
</table> </table>
<!-- End Add User Table --> <!-- End Add User Table -->
</td> </td>
<td width="330" height="1" valign="top" > <td width="330" height="1" valign="top" >
<!-- User Levels Table --> <!-- User Levels Table -->
<table class="panel" cellspacing="3" cellpadding="0" width="100%"> <table class="panel" cellspacing="3" cellpadding="0" width="100%">
<tr> <tr>
<td valign="top">&nbsp;Administrator : have full access and privilegies<br> <td valign="top">&nbsp;Administrator : have full access and privilegies<br>
&nbsp;Editor : can add news and edit others posts<br> &nbsp;Editor : can add news and edit others posts<br>
&nbsp;Journalist : can only add news (must be approved)<br> &nbsp;Journalist : can only add news (must be approved)<br>
&nbsp;Commenter : only post comments</td> &nbsp;Commenter : only post comments</td>
</tr> </tr>
</table> </table>
<!-- End User Levels Table --> <!-- End User Levels Table -->
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="330" valign="top" align=center height="70"><br> <td width="330" valign="top" align=center height="70"><br>
<!-- HELP --> <!-- HELP -->
<table height="25" cellspacing="0" cellpadding="0"> <table height="25" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="25" align=middle><img border="0" src="skins/images/help_small.gif" width="25" height="25"></td> <td width="25" align=middle><img border="0" src="skins/images/help_small.gif" width="25" height="25"></td>
<td >&nbsp;<a onClick="javascript:Help(\'users\')" href="#">Understanding user levels</a>&nbsp;</td> <td >&nbsp;<a onClick="javascript:Help(\'users\')" href="#">Understanding user levels</a>&nbsp;</td>
</tr> </tr>
</table> </table>
<!-- END HELP --> <!-- END HELP -->
</td> </td>
</tr> </tr>
</table> </table>
<!-- END add edit users table + info + help --> <!-- END add edit users table + info + help -->
</tr> </tr>
<tr> <tr>
<td width=654 colspan="6"> <td width=654 colspan="6">
</tr> </tr>
<tr> <tr>
<td width=650 colspan="6"> <td width=650 colspan="6">
<img height=20 border=0 src="skins/images/blank.gif" width=1><br> <img height=20 border=0 src="skins/images/blank.gif" width=1><br>
<b>Edit Users</b> <b>Edit Users</b>
</tr> </tr>
<tr> <tr>
<td width=130 bgcolor="#F7F6F4"> <td width=130 bgcolor="#F7F6F4">
&nbsp;<u>Username</u> &nbsp;<u>Username</u>
<td width=197 bgcolor="#F7F6F4"> <td width=197 bgcolor="#F7F6F4">
<u>registration date</u> <u>registration date</u>
<td width=2 bgcolor="#F7F6F4"> <td width=2 bgcolor="#F7F6F4">
&nbsp; &nbsp;
<td width=83 bgcolor="#F7F6F4"> <td width=83 bgcolor="#F7F6F4">
<u>written news</u> <u>written news</u>
<td width=132 bgcolor="#F7F6F4"> <td width=132 bgcolor="#F7F6F4">
<u>Access Level</u> <u>Access Level</u>
<td width=93 bgcolor="#F7F6F4"> <td width=93 bgcolor="#F7F6F4">
<u>action</u> <u>action</u>
</tr>'; </tr>';
$all_users = file("./data/users.db.php"); $all_users = file("./data/users.db.php");
$i = 1; $i = 1;
foreach($all_users as $user_line) foreach($all_users as $user_line)
{ {
$i++; $bg = ""; $i++; $bg = "";
if($i%2 == 0){ $bg = "bgcolor=\"#f7f6f4\""; } if($i%2 == 0){ $bg = "bgcolor=\"#f7f6f4\""; }
if(!eregi("<\?",$user_line)){ if(!eregi("<\?",$user_line)){
$user_arr = explode("|", $user_line); $user_arr = explode("|", $user_line);
if(isset($user_arr[9]) and $user_arr[9] != ''){ $last_login = date('r',$user_arr[9]); } if(isset($user_arr[9]) and $user_arr[9] != ''){ $last_login = date('r',$user_arr[9]); }
else{ $last_login = 'never'; } else{ $last_login = 'never'; }
switch($user_arr[1]){ switch($user_arr[1]){
case 1: $user_level = "administrator"; break; case 1: $user_level = "administrator"; break;
case 2: $user_level = "editor"; break; case 2: $user_level = "editor"; break;
case 3: $user_level = "journalist"; break; case 3: $user_level = "journalist"; break;
case 4: $user_level = "commenter"; break; case 4: $user_level = "commenter"; break;
} }
echo"<tr $bg title='$user_arr[2]&#039;s last login was on: $last_login'> echo"<tr $bg title='$user_arr[2]&#039;s last login was on: $last_login'>
<td width=143> <td width=143>
&nbsp;$user_arr[2] &nbsp;$user_arr[2]
<td width=197>"; <td width=197>";
echo( date("F, d Y @ H:i a",$user_arr[0]) ); echo( date("F, d Y @ H:i a",$user_arr[0]) );
echo"<td width=2> echo"<td width=2>
<td width=83 > <td width=83 >
&nbsp;&nbsp;$user_arr[6] &nbsp;&nbsp;$user_arr[6]
<td width=122> <td width=122>
&nbsp;$user_level &nbsp;$user_level
<td width=80 title=''> <td width=80 title=''>
<a onClick=\"javascript:popupedit('$user_arr[0]'); return(false)\" href=#>[edit]</a>&nbsp;<a onClick=\"javascript:confirmdelete('$user_arr[0]'); return(false)\" href=\"$PHP_SELF?mod=editusers&action=dodeleteuser&id=$user_arr[0]\">[delete]</a> <a onClick=\"javascript:popupedit('$user_arr[0]'); return(false)\" href=#>[edit]</a>&nbsp;<a onClick=\"javascript:confirmdelete('$user_arr[0]'); return(false)\" href=\"$PHP_SELF?mod=editusers&action=dodeleteuser&id=$user_arr[0]\">[delete]</a>
</tr>"; </tr>";
} }
} }
echo"</table>"; echo"</table>";
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Add User // Add User
// ******************************************************************************** // ********************************************************************************
elseif($action == "adduser") elseif($action == "adduser")
{ {
if(!$regusername){ msg("error","Error !!!", "Username can not be blank", "javascript:history.go(-1)"); } if(!$regusername){ msg("error","Error !!!", "Username can not be blank", "javascript:history.go(-1)"); }
if(!$regpassword){ msg("error","Error !!!", "Password can not be blank", "javascript:history.go(-1)"); } if(!$regpassword){ msg("error","Error !!!", "Password can not be blank", "javascript:history.go(-1)"); }
$all_users = file("./data/users.db.php"); $all_users = file("./data/users.db.php");
foreach($all_users as $user_line) foreach($all_users as $user_line)
{ {
$user_arr = explode("|", $user_line); $user_arr = explode("|", $user_line);
if($user_arr[2] == $regusername){ msg("error", "Error !!!", "Sory but user with this username already exist", "javascript:history.go(-1)"); } if($user_arr[2] == $regusername){ msg("error", "Error !!!", "Sory but user with this username already exist", "javascript:history.go(-1)"); }
} }
$add_time = time()+($config_date_adjust*60); $add_time = time()+($config_date_adjust*60);
$regpassword = md5($regpassword); $regpassword = md5($regpassword);
$old_users_file = file("./data/users.db.php"); $old_users_file = file("./data/users.db.php");
$new_users_file = fopen("./data/users.db.php", "a"); $new_users_file = fopen("./data/users.db.php", "a");
fwrite($new_users_file, "$add_time|$reglevel|$regusername|$regpassword|$regnickname|$regemail|0|0||||\n"); fwrite($new_users_file, "$add_time|$reglevel|$regusername|$regpassword|$regnickname|$regemail|0|0||||\n");
fclose($new_users_file); fclose($new_users_file);
switch($reglevel){ switch($reglevel){
case "1": $level = "administrator"; break; case "1": $level = "administrator"; break;
case "2": $level = "editor"; break; case "2": $level = "editor"; break;
case "3": $level = "journalist"; break; case "3": $level = "journalist"; break;
case "4": $level = "commenter"; break; case "4": $level = "commenter"; break;
} }
msg("info","User Added","The user <b>$regusername</b> was successfully added as <b>$level</b>", "$PHP_SELF?mod=editusers&action=list"); msg("info","User Added","The user <b>$regusername</b> was successfully added as <b>$level</b>", "$PHP_SELF?mod=editusers&action=list");
} }
// ******************************************************************************** // ********************************************************************************
// Edit User Details // Edit User Details
// ******************************************************************************** // ********************************************************************************
elseif($action == "edituser") elseif($action == "edituser")
{ {
$users_file = file("./data/users.db.php"); $users_file = file("./data/users.db.php");
foreach($users_file as $user_line){ foreach($users_file as $user_line){
$user_arr = explode("|", $user_line); $user_arr = explode("|", $user_line);
if($id == $user_arr[0]){ if($id == $user_arr[0]){
break; break;
} }
} }
if(isset($user_arr[9]) and $user_arr[9] != ''){ $last_login = date('r',$user_arr[9]); } if(isset($user_arr[9]) and $user_arr[9] != ''){ $last_login = date('r',$user_arr[9]); }
else{ $last_login = 'never'; } else{ $last_login = 'never'; }
echo"<html><head> echo"<html><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\"> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">
<title>Edit Users</title> <title>Edit Users</title>
<style type=\"text/css\"> <style type=\"text/css\">
<!-- <!--
select, option, textarea, input { select, option, textarea, input {
BORDER-RIGHT: #808080 1px solid; BORDER-RIGHT: #808080 1px solid;
BORDER-TOP: #808080 1px solid; BORDER-TOP: #808080 1px solid;
BORDER-BOTTOM: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid;
BORDER-LEFT: #808080 1px solid; BORDER-LEFT: #808080 1px solid;
COLOR: #000000; COLOR: #000000;
FONT-SIZE: 11px; FONT-SIZE: 11px;
FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff } FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff }
TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;} TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
BODY {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 3pt;} BODY {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 3pt;}
.header { font-size : 16px; font-weight: bold; color: #808080; font-family: verdana; text-decoration: none; } .header { font-size : 16px; font-weight: bold; color: #808080; font-family: verdana; text-decoration: none; }
--> -->
</style> </style>
</head> </head>
<body> <body>
<form action=\"$PHP_SELF\" method=post><table width=\"828\" cellspacing=\"0\" cellpadding=\"0\" height=\"13\"> <form action=\"$PHP_SELF\" method=post><table width=\"828\" cellspacing=\"0\" cellpadding=\"0\" height=\"13\">
<td width=\"826\" height=\"21\" colspan=\"2\"><div class=header>$user_arr[2] <font size=\"2\">($user_arr[4])</font></div> <td width=\"826\" height=\"21\" colspan=\"2\"><div class=header>$user_arr[2] <font size=\"2\">($user_arr[4])</font></div>
<tr> <tr>
<td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\">written news <td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\">written news
<td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\"> <td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\">
$user_arr[6] $user_arr[6]
</tr> </tr>
<tr> <tr>
<td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\">last login date <td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\">last login date
<td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\"> <td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\">
$last_login $last_login
</tr> </tr>
<tr> <tr>
<td width=\"126\" height=\"20\"> <td width=\"126\" height=\"20\">
registration date registration date
<td height=\"20\" width=\"698\">"; <td height=\"20\" width=\"698\">";
echo date("r", $user_arr[0]); echo date("r", $user_arr[0]);
echo" echo"
</tr> </tr>
<tr> <tr>
<td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\"> <td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\">
Email Email
<td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\"> <td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\">
$user_arr[5] $user_arr[5]
</tr> </tr>
<tr> <tr>
<td width=\"126\" height=\"20\"> <td width=\"126\" height=\"20\">
New Password New Password
<td height=\"20\" width=\"698\"> <td height=\"20\" width=\"698\">
<input size=\"20\" name=\"editpassword\" > <input size=\"20\" name=\"editpassword\" >
</tr> </tr>
<tr> <tr>
<td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\"> <td width=\"126\" height=\"20\" bgcolor=\"#f7f6f4\">
Access Level Access Level
<td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\"> <td height=\"20\" bgcolor=\"#f7f6f4\" width=\"698\">
<select name=editlevel>"; <select name=editlevel>";
if($user_arr[1] == 4){echo" <option value=4 selected>4 (commenter)</option>";} else {echo" <option value=4>4 (commenter)</option>";} if($user_arr[1] == 4){echo" <option value=4 selected>4 (commenter)</option>";} else {echo" <option value=4>4 (commenter)</option>";}
if($user_arr[1] == 3){echo" <option value=3 selected>3 (journalist)</option>";} else {echo" <option value=3>3 (journalist)</option>";} if($user_arr[1] == 3){echo" <option value=3 selected>3 (journalist)</option>";} else {echo" <option value=3>3 (journalist)</option>";}
if($user_arr[1] == 2){echo" <option value=2 selected>2 (editor)</option>";} else {echo" <option value=2>2 (editor)</option>";} if($user_arr[1] == 2){echo" <option value=2 selected>2 (editor)</option>";} else {echo" <option value=2>2 (editor)</option>";}
if($user_arr[1] == 1){echo" <option value=1 selected>1 (administrator)</option>";}else {echo" <option value=1>1 (administrator)</option>";} if($user_arr[1] == 1){echo" <option value=1 selected>1 (administrator)</option>";}else {echo" <option value=1>1 (administrator)</option>";}
echo"</select> echo"</select>
</tr> </tr>
<tr> <tr>
<td width=\"826\" height=\"7\" colspan=\"2\"> <td width=\"826\" height=\"7\" colspan=\"2\">
<br /> <br />
<input type=submit value=\"Save Changes\"> <input type=button value=\"Cancel\" onClick=\"window.close();\"> <input type=submit value=\"Save Changes\"> <input type=button value=\"Cancel\" onClick=\"window.close();\">
<input type=hidden name=id value=$id> <input type=hidden name=id value=$id>
<input type=hidden name=mod value=editusers> <input type=hidden name=mod value=editusers>
<input type=hidden name=action value=doedituser> <input type=hidden name=action value=doedituser>
</tr> </tr>
</table></form> </table></form>
</body> </body>
</html>"; </html>";
} }
// ******************************************************************************** // ********************************************************************************
// Do Edit User // Do Edit User
// ******************************************************************************** // ********************************************************************************
elseif($action == "doedituser") elseif($action == "doedituser")
{ {
if(!$id){ die("This is not a valid user."); } if(!$id){ die("This is not a valid user."); }
$old_db = file("./data/users.db.php"); $old_db = file("./data/users.db.php");
$new_db = fopen("./data/users.db.php", "w"); $new_db = fopen("./data/users.db.php", "w");
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if($id != $old_db_arr[0]){ if($id != $old_db_arr[0]){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
}else{ }else{
if($editpassword != ""){ if($editpassword != ""){
$old_db_arr[3] = md5($editpassword); $old_db_arr[3] = md5($editpassword);
if($old_db_arr[2] == $username){setcookie("md5_password", $old_db_arr[3]); } if($old_db_arr[2] == $username){setcookie("md5_password", $old_db_arr[3]); }
} }
fwrite($new_db,"$old_db_arr[0]|$editlevel|$old_db_arr[2]|$old_db_arr[3]|$old_db_arr[4]|$old_db_arr[5]|$old_db_arr[6]|$old_db_arr[7]|$old_db_arr[8]|$old_db_arr[9]||\n"); fwrite($new_db,"$old_db_arr[0]|$editlevel|$old_db_arr[2]|$old_db_arr[3]|$old_db_arr[4]|$old_db_arr[5]|$old_db_arr[6]|$old_db_arr[7]|$old_db_arr[8]|$old_db_arr[9]||\n");
} }
} }
fclose($new_db); fclose($new_db);
$result = "Changes Saved"; $result = "Changes Saved";
echo"<html> echo"<html>
<head> <head>
<title>Edit Users</title> <title>Edit Users</title>
</head> </head>
<body bgcolor=#FFFFFF> <body bgcolor=#FFFFFF>
<table border=0 cellpading=0 cellspacing=0 width=100% height=100% > <table border=0 cellpading=0 cellspacing=0 width=100% height=100% >
<tr><td align=middle width=154> <tr><td align=middle width=154>
<p align=right><img border=0 src=\"skins/images/info.gif\" width=60 height=57> <p align=right><img border=0 src=\"skins/images/info.gif\" width=60 height=57>
</td><td align=middle width=558> </td><td align=middle width=558>
<p align=left>$result <p align=left>$result
</td></tr> </td></tr>
</table> </table>
</body> </body>
</html>"; </html>";
} }
// ******************************************************************************** // ********************************************************************************
// Delete User // Delete User
// ******************************************************************************** // ********************************************************************************
elseif($action == "dodeleteuser") elseif($action == "dodeleteuser")
{ {
if(!$id){ die("This is not a valid user."); } if(!$id){ die("This is not a valid user."); }
$old_users_file = file("./data/users.db.php"); $old_users_file = file("./data/users.db.php");
$new_users_file = fopen("./data/users.db.php", "w"); $new_users_file = fopen("./data/users.db.php", "w");
foreach($old_users_file as $old_user_line){ foreach($old_users_file as $old_user_line){
$old_user_line_arr = explode("|", $old_user_line); $old_user_line_arr = explode("|", $old_user_line);
if($id != $old_user_line_arr[0]){ if($id != $old_user_line_arr[0]){
fwrite($new_users_file, $old_user_line); fwrite($new_users_file, $old_user_line);
}else{ }else{
$deleted = TRUE; $user = $old_user_line_arr[2]; $deleted = TRUE; $user = $old_user_line_arr[2];
} }
} }
fclose($new_users_file); fclose($new_users_file);
msg("info","User Deleted","The user $user was successfully deleted.", "$PHP_SELF?mod=editusers&action=list"); msg("info","User Deleted","The user $user was successfully deleted.", "$PHP_SELF?mod=editusers&action=list");
} }
?> ?>
<?PHP <?PHP
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Our Help Sections Our Help Sections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$help_sections = array(); $help_sections = array();
//---------------------------------- //----------------------------------
// Including the News // Including the News
//---------------------------------- //----------------------------------
$help_sections["including"] = <<<HTML $help_sections["including"] = <<<HTML
<h1>Including The News</h1> <h1>Including The News</h1>
After CuteNews is successfully installed you can start posting your news. To display the news you must include the After CuteNews is successfully installed you can start posting your news. To display the news you must include the
file <b>show_news.php</b> (located in the main cutenews folder). To include show_news.php on your page you must use a code like this: file <b>show_news.php</b> (located in the main cutenews folder). To include show_news.php on your page you must use a code like this:
<div class="code">&lt;?PHP<br> <div class="code">&lt;?PHP<br>
include("path/to/show_news.php");<br> include("path/to/show_news.php");<br>
?&gt;</div> ?&gt;</div>
And you must replace <i>path/to/show_news.php</i> with the real path to show_news.php, <b>NOT</b> the URL !!!<br> And you must replace <i>path/to/show_news.php</i> with the real path to show_news.php, <b>NOT</b> the URL !!!<br>
Examples:<br> Examples:<br>
<font color=green>CORRECT</font>: include("cutenews/show_news.php");<br> <font color=green>CORRECT</font>: include("cutenews/show_news.php");<br>
<font color=red>WRONG&nbsp;&nbsp;&nbsp;</font>: include("http://site.com/cutenews/show_news.php");<br> <font color=red>WRONG&nbsp;&nbsp;&nbsp;</font>: include("http://site.com/cutenews/show_news.php");<br>
<br> <br>
Remember that to be able to use the php code, the extension of the file where you include it must be .php<br> Remember that to be able to use the php code, the extension of the file where you include it must be .php<br>
If you want to include the code in .html page, you can rename he .html to .php and everything will work normal If you want to include the code in .html page, you can rename he .html to .php and everything will work normal
HTML; HTML;
//---------------------------------- //----------------------------------
// All possible variables while including // All possible variables while including
//---------------------------------- //----------------------------------
$help_sections["variables"] = <<<HTML $help_sections["variables"] = <<<HTML
<h1>All Variables You are Allowed to Use</h1> <h1>All Variables You are Allowed to Use</h1>
Here is a list of all possible variables that you are allowed to use when including news or archives:<BR> Here is a list of all possible variables that you are allowed to use when including news or archives:<BR>
<div class="code" style='font-family: Verdana, Arial, Helvetica, sans-serif;'>&lt;?PHP<br><br> <div class="code" style='font-family: Verdana, Arial, Helvetica, sans-serif;'>&lt;?PHP<br><br>
<b>\$number = "&lt;X&gt;";</b>&nbsp;&nbsp;<i>// show only the X newest articles.</i><br> <b>\$number = "&lt;X&gt;";</b>&nbsp;&nbsp;<i>// show only the X newest articles.</i><br>
<b>\$template = "&lt;NAME&gt;";</b>&nbsp;&nbsp;<i>// load another template, if you don't use it the default template will be loaded.</i><br> <b>\$template = "&lt;NAME&gt;";</b>&nbsp;&nbsp;<i>// load another template, if you don't use it the default template will be loaded.</i><br>
<b>\$static = TRUE;</b>&nbsp;&nbsp;<i>// included news will not load on this location, for more info see 'Using Multiple Includes'.</i><br> <b>\$static = TRUE;</b>&nbsp;&nbsp;<i>// included news will not load on this location, for more info see 'Using Multiple Includes'.</i><br>
<b>\$category = "&lt;ID&gt;";</b>&nbsp;&nbsp;<i>// show only news from the selected category where &lt;ID&gt; is the id of category.</i><br> <b>\$category = "&lt;ID&gt;";</b>&nbsp;&nbsp;<i>// show only news from the selected category where &lt;ID&gt; is the id of category.</i><br>
<b>\$start_from = "&lt;NUMBER&gt;";</b>&nbsp;&nbsp;<i>// show the news starting not from the first newest but from &lt;NUMBER&gt;, it is required to use \$start_from = "&lt;NUMBER&gt;"; <b>\$start_from = "&lt;NUMBER&gt;";</b>&nbsp;&nbsp;<i>// show the news starting not from the first newest but from &lt;NUMBER&gt;, it is required to use \$start_from = "&lt;NUMBER&gt;";
only when you use \$number = "X";.</i><br> only when you use \$number = "X";.</i><br>
<br>include("path/to/show_news.php");<br> <br>include("path/to/show_news.php");<br>
?&gt;</div> ?&gt;</div>
All of the above variables are optional and you may wish don't to use them. All of the above variables are optional and you may wish don't to use them.
HTML; HTML;
//---------------------------------- //----------------------------------
// Using Multiple Includes // Using Multiple Includes
//---------------------------------- //----------------------------------
$help_sections["multiple_includes"] = <<<HTML $help_sections["multiple_includes"] = <<<HTML
<h1>Using Multiple Includes on One Page</h1> <h1>Using Multiple Includes on One Page</h1>
Now will examine the situation when you want to use more than one include on a single page. For example if you want to show 5 headlines (using template headlines) Now will examine the situation when you want to use more than one include on a single page. For example if you want to show 5 headlines (using template headlines)
and below them to be shown all other news. The problem in this situatuion situation is that when you click on a headline CuteNews won't understand where to show the result, and below them to be shown all other news. The problem in this situatuion situation is that when you click on a headline CuteNews won't understand where to show the result,
on the headlines part or where all other news are included. The solution is to use the variable <b>$static = TRUE;</b> before including the headlines. When you use on the headlines part or where all other news are included. The solution is to use the variable <b>$static = TRUE;</b> before including the headlines. When you use
this variable CuteNews won't display any result on the place where you use $static.<br> this variable CuteNews won't display any result on the place where you use $static.<br>
Here is the correct code of the above example with the headlines and news: Here is the correct code of the above example with the headlines and news:
<div class="code">&lt;?PHP<br> <div class="code">&lt;?PHP<br>
<u>Our Latest 5 Headlines</u>:<br> <u>Our Latest 5 Headlines</u>:<br>
\$static = TRUE;<br> \$static = TRUE;<br>
\$number = "5";<br> \$number = "5";<br>
\$template = "Headlines";<br> \$template = "Headlines";<br>
include("path/to/show_news.php");<br> include("path/to/show_news.php");<br>
<br> <br>
<u>The News</u><br> <u>The News</u><br>
include("path/to/show_news.php");<br> include("path/to/show_news.php");<br>
?&gt;</div> ?&gt;</div>
Now When you click on a headline it will be displayed on the place of the other news and the Now When you click on a headline it will be displayed on the place of the other news and the
list with the latest 5 headlines will still be showed.<br><br> list with the latest 5 headlines will still be showed.<br><br>
Make some test with <b>\$static = TRUE;</b> yourself to understand how it works exactly and how powerful Make some test with <b>\$static = TRUE;</b> yourself to understand how it works exactly and how powerful
it can be. it can be.
HTML; HTML;
//---------------------------------- //----------------------------------
// Users Section // Users Section
//---------------------------------- //----------------------------------
$help_sections["users"] = <<<HTML $help_sections["users"] = <<<HTML
<h1>Understanding User Levels</h1> <h1>Understanding User Levels</h1>
For better security and control of your users there four types of user-levels implemented in CuteNews. For better security and control of your users there four types of user-levels implemented in CuteNews.
Each user-level has limited permissions in doing specified actions and these permissions can not be changed.<br> Each user-level has limited permissions in doing specified actions and these permissions can not be changed.<br>
The user-levels are as fallows:<br> The user-levels are as fallows:<br>
<ol> <ol>
<li><b>Administrators</b> - administrators are allowed to do anything they want: edit others posts, comments, ban users, edit system configurations <li><b>Administrators</b> - administrators are allowed to do anything they want: edit others posts, comments, ban users, edit system configurations
and everything else ... so be careful when adding users as administrators !!!</li> and everything else ... so be careful when adding users as administrators !!!</li>
<br> <br>
<li><b>Editors</b> - the users from this level are allowed to post news, they can edit own posts and the news posted from all other users. They can also approve news which are added by the 'Journalists'</li> <li><b>Editors</b> - the users from this level are allowed to post news, they can edit own posts and the news posted from all other users. They can also approve news which are added by the 'Journalists'</li>
<br> <br>
<li><b>Journalists</b> - this level is for users who only need to post and edit news. They can edit only own posts !. When journalist add's new article it will not be active and instead will be marked as 'Unapproved', In order for this article to become visible admin or editor must approve it.</li> <li><b>Journalists</b> - this level is for users who only need to post and edit news. They can edit only own posts !. When journalist add's new article it will not be active and instead will be marked as 'Unapproved', In order for this article to become visible admin or editor must approve it.</li>
<br> <br>
<li><b>Commenters</b> - when users from this level login, they are allowed only to change their passwords. Can not post, edit news or perform any other action. <li><b>Commenters</b> - when users from this level login, they are allowed only to change their passwords. Can not post, edit news or perform any other action.
This is useful when some user wants his username to be password protected when posting comments and no one else to be able to post with his username. You can also deny unregistered users to be able to post comments.</li> This is useful when some user wants his username to be password protected when posting comments and no one else to be able to post with his username. You can also deny unregistered users to be able to post comments.</li>
</ol> </ol>
HTML; HTML;
//---------------------------------- //----------------------------------
// Categories Section // Categories Section
//---------------------------------- //----------------------------------
$help_sections["categories"] = <<<HTML $help_sections["categories"] = <<<HTML
<h1>What are Categories and How To Use Them</h1> <h1>What are Categories and How To Use Them</h1>
When adding new category, it will appear in the "Add News" section. Therefore when you post your news you'll be able to When adding new category, it will appear in the "Add News" section. Therefore when you post your news you'll be able to
specify a category to which the article will belong (selecting category it optional), that way you can organize your news. specify a category to which the article will belong (selecting category it optional), that way you can organize your news.
Now, when adding new category you'll be able to specify name for this category and optionally URL to icon for this category. Now, when adding new category you'll be able to specify name for this category and optionally URL to icon for this category.
Automatically an ID number will be set for the new category, this ID is used when using include script to show all news <b>only</b> Automatically an ID number will be set for the new category, this ID is used when using include script to show all news <b>only</b>
from this category. Example code:<div class="code">&lt;?PHP<br> from this category. Example code:<div class="code">&lt;?PHP<br>
\$category = "<b>2</b>";<br>include("path/to/show_news.php");<br> \$category = "<b>2</b>";<br>include("path/to/show_news.php");<br>
?&gt;</div> ?&gt;</div>
the above PHP code included on your page will display all news from category with ID 2<br> the above PHP code included on your page will display all news from category with ID 2<br>
If you for example have 5 categories and want to display news on one page from only 3 of the categories, you can use the fallowing code: If you for example have 5 categories and want to display news on one page from only 3 of the categories, you can use the fallowing code:
<div class="code">&lt;?PHP<br> <div class="code">&lt;?PHP<br>
\$category = "<b>2</b>,<b>3</b>,<b>5</b>";<br>include("path/to/show_news.php");<br> \$category = "<b>2</b>,<b>3</b>,<b>5</b>";<br>include("path/to/show_news.php");<br>
?&gt;</div> ?&gt;</div>
the above code will display all news from categories with ID 2, 3 and 5.<br> the above code will display all news from categories with ID 2, 3 and 5.<br>
When you does <b>not</b> use \$category = "&lt;ID&gt;"; CuteNews will display the news from all categories, but when using this code, only news from the specified category(s) will be shown.<br><br> When you does <b>not</b> use \$category = "&lt;ID&gt;"; CuteNews will display the news from all categories, but when using this code, only news from the specified category(s) will be shown.<br><br>
The category icon can be shown together with your news, to do this you must put {category-icon} in your news templates. The category icon can be shown together with your news, to do this you must put {category-icon} in your news templates.
HTML; HTML;
//---------------------------------- //----------------------------------
// Templates Section // Templates Section
//---------------------------------- //----------------------------------
$help_sections["templates"] = <<<HTML $help_sections["templates"] = <<<HTML
<h1>Understanding Templates</h1> <h1>Understanding Templates</h1>
Templates are used for easy editing the news look and the way news are displayed. Templates are used for easy editing the news look and the way news are displayed.
You can view the different parts of the template that are used for different parts of your news look. You can view the different parts of the template that are used for different parts of your news look.
For example the "Active News" part of the default template is used to modify the look of the active news, "Full Story" for the way your full story will look like, For example the "Active News" part of the default template is used to modify the look of the active news, "Full Story" for the way your full story will look like,
"Comment" is the part corresponding to the appearance of the comments posted by users etc.<br><br> "Comment" is the part corresponding to the appearance of the comments posted by users etc.<br><br>
When editing parts of the template you can use HTML in them to build different structures etc. Now you'll need to add some special tags in your templates When editing parts of the template you can use HTML in them to build different structures etc. Now you'll need to add some special tags in your templates
to specify the place where the title of your news will be displayed and the author name and the date when the news was pasted etc... these tags are to specify the place where the title of your news will be displayed and the author name and the date when the news was pasted etc... these tags are
explained above each part of the template.<br> explained above each part of the template.<br>
Lets take the "Active News" part for example: when you expand this part, a list of allowed tags for this part will be displayed and under them will be the Lets take the "Active News" part for example: when you expand this part, a list of allowed tags for this part will be displayed and under them will be the
text area. One very common and easy tag is <b>{title}</b>, wherever you put this tag in your template it will be replaced with the real title of your news.<br><br> text area. One very common and easy tag is <b>{title}</b>, wherever you put this tag in your template it will be replaced with the real title of your news.<br><br>
You can have more than one template, this is useful if you want to include the news on different pages of your site with different look of the news.<br> You can have more than one template, this is useful if you want to include the news on different pages of your site with different look of the news.<br>
After creating more templates you must use specific code when including news to indicate whit which template the news to be shown.<br> After creating more templates you must use specific code when including news to indicate whit which template the news to be shown.<br>
example code:<div class="code">&lt;?PHP<br> example code:<div class="code">&lt;?PHP<br>
\$template = "my_test_template";<br>include("path/to/show_news.php");<br> \$template = "my_test_template";<br>include("path/to/show_news.php");<br>
?&gt;</div>With the above code, all news will be showed using the my_test_template that you have created yourself. ?&gt;</div>With the above code, all news will be showed using the my_test_template that you have created yourself.
if you don't specify what template to use, all news will use Default template which can not be deleted. if you don't specify what template to use, all news will use Default template which can not be deleted.
HTML; HTML;
//---------------------------------- //----------------------------------
// Archives Section // Archives Section
//---------------------------------- //----------------------------------
$help_sections["archives"] = <<<HTML $help_sections["archives"] = <<<HTML
<h1>Explaining Archives and Their Usage</h1> <h1>Explaining Archives and Their Usage</h1>
When you send your news to the archive, CuteNews will automatically create a new archive file under the ./archives/ folder with extension .arch . When you send your news to the archive, CuteNews will automatically create a new archive file under the ./archives/ folder with extension .arch .
Then all news that you selected for archiving will be moved from news.txt (where only the active news are hold) to the newly created file in archives/ Then all news that you selected for archiving will be moved from news.txt (where only the active news are hold) to the newly created file in archives/
Therefore the news you have archived won't be visible from show_news.php but from show_archives.php where all available archives are nicely listed.<br> Therefore the news you have archived won't be visible from show_news.php but from show_archives.php where all available archives are nicely listed.<br>
Once the news are archived CuteNews don't have built-in feature for moving back news from archive to active news, so the only way to do it is by manually Once the news are archived CuteNews don't have built-in feature for moving back news from archive to active news, so the only way to do it is by manually
opening the archive file and copying its content to news.txt<br><br> opening the archive file and copying its content to news.txt<br><br>
When you send all your active news to the archive there won't be left active news, but if you use<br> \$number = <b>X</b>; in your include code, CuteNews will When you send all your active news to the archive there won't be left active news, but if you use<br> \$number = <b>X</b>; in your include code, CuteNews will
automatically show the X newest news from the archive.<br><br> automatically show the X newest news from the archive.<br><br>
Sending your news to archive is optional and you may never use it, but it is useful if you have many news articles and Sending your news to archive is optional and you may never use it, but it is useful if you have many news articles and
want to organize them. Using archive is also recommended when you have more than 3000 active news. want to organize them. Using archive is also recommended when you have more than 3000 active news.
HTML; HTML;
//---------------------------------- //----------------------------------
// Adding News Options // Adding News Options
//---------------------------------- //----------------------------------
$help_sections["addnews_options"] = <<<HTML $help_sections["addnews_options"] = <<<HTML
<h1>Options When Adding News</h1> <h1>Options When Adding News</h1>
When adding/editing news, you have several options that you can choose to apply to the specified article. When adding/editing news, you have several options that you can choose to apply to the specified article.
<ul> <ul>
<li><b>Convert new lines to &lt;br /&gt;</b> - if checked, this option will convert all the new lines in your article to the HTML equivalent for new line.</li> <li><b>Convert new lines to &lt;br /&gt;</b> - if checked, this option will convert all the new lines in your article to the HTML equivalent for new line.</li>
<li><b>Use HTML in this article </b> - if checked, CuteNews will parse this article as HTML elements + text, if unchecked - your article will be treated as pute text.</li> <li><b>Use HTML in this article </b> - if checked, CuteNews will parse this article as HTML elements + text, if unchecked - your article will be treated as pute text.</li>
<li><b>Normal</b> adding of Article - if you are adding your article as normal it will be immediately desplayed</li> <li><b>Normal</b> adding of Article - if you are adding your article as normal it will be immediately desplayed</li>
<li><b>Draft</b> adding of Article - this option will add the article but it will not be visible for your visitors until you activate (approve) it later. <li><b>Draft</b> adding of Article - this option will add the article but it will not be visible for your visitors until you activate (approve) it later.
<li><b>Postpone</b> Article - if you postpone your article you must select a date when it will automatically be published and became visible for your visitors, when the specified that is reached the article will be added as new with this date. <li><b>Postpone</b> Article - if you postpone your article you must select a date when it will automatically be published and became visible for your visitors, when the specified that is reached the article will be added as new with this date.
</ul> </ul>
HTML; HTML;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Load the specified section in PopUp Window Load the specified section in PopUp Window
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if(isset($section)){ if(isset($section)){
if(!isset($help_sections["$section"])){ die("Can not find the specified section <b>$section</b>"); } if(!isset($help_sections["$section"])){ die("Can not find the specified section <b>$section</b>"); }
echo"<HTML> echo"<HTML>
<style type=\"text/css\"> <style type=\"text/css\">
<!-- <!--
a:active,a:visited,a:link {color: #446488; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;} a:active,a:visited,a:link {color: #446488; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
a:hover {color: #00004F; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; } a:hover {color: #00004F; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; }
.code { .code {
font-family : Andale Mono, Courier; font-family : Andale Mono, Courier;
border: 1px solid #BBCDDB; border: 1px solid #BBCDDB;
margin:10px; margin:10px;
padding:4px; padding:4px;
background:#FBFFFF; background:#FBFFFF;
} }
h1 { h1 {
background-color : #BBCDDB; background-color : #BBCDDB;
border-bottom : #000000 1px solid; border-bottom : #000000 1px solid;
border-top : #000000 1px solid; border-top : #000000 1px solid;
color : #000000; color : #000000;
font-family : Tahoma, Verdana, Arial, Helvetica, sans-serif; font-family : Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size : 16px; font-size : 16px;
font-weight : bold; font-weight : bold;
margin : -10px 0px 10px 0px; margin : -10px 0px 10px 0px;
padding-bottom : 5px; padding-bottom : 5px;
padding-left : 10px; padding-left : 10px;
padding-right : 10px; padding-right : 10px;
padding-top : 5px; padding-top : 5px;
text-decoration : none; text-decoration : none;
margin-left: -10px; margin-left: -10px;
margin-right: -8px; margin-right: -8px;
} }
BODY, TD, TR {text-align:justify ;padding: 0; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; cursor: default;} BODY, TD, TR {text-align:justify ;padding: 0; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; cursor: default;}
--> -->
</style> </style>
<TITLE>HELP - $section</TITLE> <TITLE>HELP - $section</TITLE>
<BODY> <BODY>
". $help_sections["$section"] ." ". $help_sections["$section"] ."
</BODY></HTML>"; </BODY></HTML>";
} }
else{ else{
echoheader("question", "Help Documentation"); echoheader("question", "Help Documentation");
echo"<style type=\"text/css\"> echo"<style type=\"text/css\">
<!-- <!--
.code { .code {
font-family : Andale Mono, Courier; font-family : Andale Mono, Courier;
border: 1px solid #BBCDDB; border: 1px solid #BBCDDB;
margin:10px; margin:10px;
padding:4px; padding:4px;
background:#FBFFFF; background:#FBFFFF;
} }
h1 { h1 {
background-color : #EAF0F4; background-color : #EAF0F4;
border-bottom : #000000 1px solid; border-bottom : #000000 1px solid;
border-top : #000000 1px solid; border-top : #000000 1px solid;
border-left : #000000 1px solid; border-left : #000000 1px solid;
color : #000000; color : #000000;
font-family : Tahoma, Verdana, Arial, Helvetica, sans-serif; font-family : Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size : 15px; font-size : 15px;
font-weight : bold; font-weight : bold;
padding-bottom : 5px; padding-bottom : 5px;
padding-left : 10px; padding-left : 10px;
padding-right : 10px; padding-right : 10px;
padding-top : 5px; padding-top : 5px;
text-decoration : none; text-decoration : none;
} }
--> -->
</style>"; </style>";
foreach($help_sections as $help_section){ foreach($help_sections as $help_section){
echo"$help_section<BR><br>"; echo"$help_section<BR><br>";
} }
echofooter(); echofooter();
} }
?> ?>
<?PHP <?PHP
if($member_db[1] > 3 or ($member_db[1] != 1 and $action == "doimagedelete")){ msg("error", "Access Denied", "You don't have permission to manage images"); } if($member_db[1] > 3 or ($member_db[1] != 1 and $action == "doimagedelete")){ msg("error", "Access Denied", "You don't have permission to manage images"); }
$allowed_extensions = array("gif", "jpg", "png", "bmp", "jpe", "jpeg"); $allowed_extensions = array("gif", "jpg", "png", "bmp", "jpe", "jpeg");
// ******************************************************************************** // ********************************************************************************
// Show Preview of Image // Show Preview of Image
// ******************************************************************************** // ********************************************************************************
if($action == "preview"){ if($action == "preview"){
echo <<<PREVIEWHTML echo <<<PREVIEWHTML
<HTML> <HTML>
<HEAD> <HEAD>
<TITLE>Image Preview</TITLE> <TITLE>Image Preview</TITLE>
<script language='javascript'> <script language='javascript'>
var NS = (navigator.appName=="Netscape")?true:false; var NS = (navigator.appName=="Netscape")?true:false;
function fitPic() { function fitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth; iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight; iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iWidth = document.images[0].width - iWidth; iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight; iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight-1); window.resizeBy(iWidth, iHeight-1);
self.focus(); self.focus();
}; };
</script> </script>
</HEAD> </HEAD>
<BODY bgcolor="#FFFFFF" onload='fitPic();' topmargin="0" marginheight="0" leftmargin="0" marginwidth="0"> <BODY bgcolor="#FFFFFF" onload='fitPic();' topmargin="0" marginheight="0" leftmargin="0" marginwidth="0">
<script language='javascript'> <script language='javascript'>
document.write( "<img src='$config_http_script_dir/data/upimages/$image' border=0>" ); document.write( "<img src='$config_http_script_dir/data/upimages/$image' border=0>" );
</script> </script>
</BODY> </BODY>
</HTML> </HTML>
PREVIEWHTML; PREVIEWHTML;
} }
// ******************************************************************************** // ********************************************************************************
// Show Images List // Show Images List
// ******************************************************************************** // ********************************************************************************
elseif($action != "doimagedelete") elseif($action != "doimagedelete")
{ {
if($action == "quick") if($action == "quick")
{ {
echo"<html> echo"<html>
<head> <head>
<title>Insert Image</title> <title>Insert Image</title>
<style type=\"text/css\"> <style type=\"text/css\">
<!-- <!--
select, option, textarea, input { select, option, textarea, input {
BORDER: #808080 1px solid; BORDER: #808080 1px solid;
COLOR: #000000; COLOR: #000000;
FONT-SIZE: 11px; FONT-SIZE: 11px;
FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff
} }
BODY, TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;} BODY, TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
a:active,a:visited,a:link {font-size : 10px; color: #808080; font-family: verdana; text-decoration: none;} a:active,a:visited,a:link {font-size : 10px; color: #808080; font-family: verdana; text-decoration: none;}
a:hover {font-size : 10px; color: darkblue; font-weight:bold; text-decoration: none; } a:hover {font-size : 10px; color: darkblue; font-weight:bold; text-decoration: none; }
.panel { border: 1px dotted silver; background-color: #F7F6F4;} .panel { border: 1px dotted silver; background-color: #F7F6F4;}
--> -->
</style> </style>
</head> </head>
<body bgcolor=#FFFFFF> <body bgcolor=#FFFFFF>
<script language=\"javascript\" type=\"text/javascript\"> <script language=\"javascript\" type=\"text/javascript\">
<!-- <!--
function insertimage(selectedImage) { function insertimage(selectedImage) {
var area = '$area'; var area = '$area';
alternativeText = document.forms['properties'].alternativeText.value; alternativeText = document.forms['properties'].alternativeText.value;
imageAlign = document.forms['properties'].imageAlign.value; imageAlign = document.forms['properties'].imageAlign.value;
imageBorder = document.forms['properties'].imageBorder.value; imageBorder = document.forms['properties'].imageBorder.value;
//finalImage = \" <img style=\\\"border:\"+ imageBorder +\"; vertical-align:\"+ imageAlign +\";\\\" alt=\\\"\"+ alternativeText +\"\\\" src=\\\"$config_http_script_dir/data/upimages/\"+ selectedImage +\"\\\">\"; //finalImage = \" <img style=\\\"border:\"+ imageBorder +\"; vertical-align:\"+ imageAlign +\";\\\" alt=\\\"\"+ alternativeText +\"\\\" src=\\\"$config_http_script_dir/data/upimages/\"+ selectedImage +\"\\\">\";
finalImage = \" <img border=\\\"\"+ imageBorder +\"\\\" align=\\\"\"+ imageAlign +\"\\\" alt=\\\"\"+ alternativeText +\"\\\" src=\\\"$config_http_script_dir/data/upimages/\"+ selectedImage +\"\\\">\"; finalImage = \" <img border=\\\"\"+ imageBorder +\"\\\" align=\\\"\"+ imageAlign +\"\\\" alt=\\\"\"+ alternativeText +\"\\\" src=\\\"$config_http_script_dir/data/upimages/\"+ selectedImage +\"\\\">\";
"; ";
if($wysiwyg){ if($wysiwyg){
echo" echo"
MYRTE=window.opener.document.getElementById(area).contentWindow; MYRTE=window.opener.document.getElementById(area).contentWindow;
window.opener.currentRTE=area; MYRTE.document.execCommand('InsertImage', false, '-my-temp-img-url-'); window.opener.currentRTE=area; MYRTE.document.execCommand('InsertImage', false, '-my-temp-img-url-');
replacement = \"$config_http_script_dir/data/upimages/\" + selectedImage + \"\\\" alt=\\\"\" + alternativeText + \"\\\" border=\\\"\" + imageBorder + \"\\\" align=\\\"\" + imageAlign; replacement = \"$config_http_script_dir/data/upimages/\" + selectedImage + \"\\\" alt=\\\"\" + alternativeText + \"\\\" border=\\\"\" + imageBorder + \"\\\" align=\\\"\" + imageAlign;
MYRTE.document.body.innerHTML = MYRTE.document.body.innerHTML.replace(/-my-temp-img-url-/gi,replacement); MYRTE.document.body.innerHTML = MYRTE.document.body.innerHTML.replace(/-my-temp-img-url-/gi,replacement);
"; ";
} }
else{ echo"opener.document.getElementById(area).value += finalImage;"; } else{ echo"opener.document.getElementById(area).value += finalImage;"; }
// echo"alert(finalImage);"; // echo"alert(finalImage);";
echo" echo"
window.close(); window.close();
//opener.document.getElementById(area).focus(); //opener.document.getElementById(area).focus();
} }
function PopupPic(sPicURL) { function PopupPic(sPicURL) {
window.open('$PHP_SELF?mod=images&action=preview&image='+sPicURL, '', 'resizable=1,HEIGHT=200,WIDTH=200'); window.open('$PHP_SELF?mod=images&action=preview&image='+sPicURL, '', 'resizable=1,HEIGHT=200,WIDTH=200');
} }
window.resizeTo(410, 550); window.resizeTo(410, 550);
self.focus(); self.focus();
//--> //-->
</script>"; </script>";
}else{ echoheader("images","Manage Images"); } }else{ echoheader("images","Manage Images"); }
// ******************************************************************************** // ********************************************************************************
// Upload Image(s) // Upload Image(s)
// ******************************************************************************** // ********************************************************************************
if($subaction == "upload") if($subaction == "upload")
{ {
for ($image_i = 1; $image_i < ($images_number+1); $image_i++) { for ($image_i = 1; $image_i < ($images_number+1); $image_i++) {
$current_image = 'image_'.$image_i; $current_image = 'image_'.$image_i;
$image = $_FILES[$current_image]['tmp_name']; $image = $_FILES[$current_image]['tmp_name'];
$image_name = $_FILES[$current_image]['name']; $image_name = $_FILES[$current_image]['name'];
$image_name = str_replace(" ", "_", $image_name); $image_name = str_replace(" ", "_", $image_name);
$img_name_arr = explode(".",$image_name); $img_name_arr = explode(".",$image_name);
$type = end($img_name_arr); $type = end($img_name_arr);
if($image_name == ""){ $img_result .= "<br><font color=red>$current_image -> No File Specified For Upload!</font>"; } if($image_name == ""){ $img_result .= "<br><font color=red>$current_image -> No File Specified For Upload!</font>"; }
elseif( !isset($overwrite) and file_exists($config_path_image_upload."/".$image_name)){ $img_result .= "<br><font color=red>$image_name -> Image already exist!</font>";} elseif( !isset($overwrite) and file_exists($config_path_image_upload."/".$image_name)){ $img_result .= "<br><font color=red>$image_name -> Image already exist!</font>";}
elseif( !(in_array($type, $allowed_extensions) or in_array(strtolower($type), $allowed_extensions)) ){ elseif( !(in_array($type, $allowed_extensions) or in_array(strtolower($type), $allowed_extensions)) ){
$img_result .= "<br><font color=red>$image_name ->This type of file is not allowed !!!</font>"; $img_result .= "<br><font color=red>$image_name ->This type of file is not allowed !!!</font>";
} }
else{ //Image is OK, upload it else{ //Image is OK, upload it
@copy($image, $config_path_image_upload."/".$image_name) or $img_result .= "<br><font color=red>$image_name -> Couldn't copy image to server</font><br />Check if file_uploads is allowed in the php.ini file of your server"; @copy($image, $config_path_image_upload."/".$image_name) or $img_result .= "<br><font color=red>$image_name -> Couldn't copy image to server</font><br />Check if file_uploads is allowed in the php.ini file of your server";
if(file_exists($config_path_image_upload."/".$image_name)) if(file_exists($config_path_image_upload."/".$image_name))
{ {
$img_result .= "<br><font color=green>$image_name -> Image was uploaded</font>"; $img_result .= "<br><font color=green>$image_name -> Image was uploaded</font>";
if($action == "quick"){ if($action == "quick"){
$img_result .= " <a title=\"Inser this image in the $my_area\" href=\"javascript:insertimage('$image_name');\">[insert it]</a>"; $img_result .= " <a title=\"Inser this image in the $my_area\" href=\"javascript:insertimage('$image_name');\">[insert it]</a>";
} }
}//if file is uploaded succesfully }//if file is uploaded succesfully
} }
} }
} }
// //
// Add the JS for multyple image upload. // Add the JS for multyple image upload.
// //
echo<<<HTMLJS echo<<<HTMLJS
<script language='javascript'> <script language='javascript'>
function AddRowsToTable() { function AddRowsToTable() {
var tbl = document.getElementById('tblSample'); var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length; var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1 // if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow+1; var iteration = lastRow+1;
var row = tbl.insertRow(lastRow); var row = tbl.insertRow(lastRow);
var cellRight = row.insertCell(0); var cellRight = row.insertCell(0);
var el = document.createElement('input'); var el = document.createElement('input');
el.setAttribute('type', 'file'); el.setAttribute('type', 'file');
el.setAttribute('name', 'image_' + iteration); el.setAttribute('name', 'image_' + iteration);
el.setAttribute('size', '30'); el.setAttribute('size', '30');
el.setAttribute('value', iteration); el.setAttribute('value', iteration);
cellRight.appendChild(el); cellRight.appendChild(el);
document.getElementById('images_number').value = iteration; document.getElementById('images_number').value = iteration;
} }
function RemoveRowFromTable() { function RemoveRowFromTable() {
var tbl = document.getElementById('tblSample'); var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length; var lastRow = tbl.rows.length;
if (lastRow > 1){ if (lastRow > 1){
tbl.deleteRow(lastRow - 1); tbl.deleteRow(lastRow - 1);
document.getElementById('images_number').value = document.getElementById('images_number').value - 1; document.getElementById('images_number').value = document.getElementById('images_number').value - 1;
} }
} }
</script> </script>
HTMLJS; HTMLJS;
echo<<<HTML echo<<<HTML
<form name="form" id="form" action="$PHP_SELF?mod=images" method="post" enctype="multipart/form-data"> <form name="form" id="form" action="$PHP_SELF?mod=images" method="post" enctype="multipart/form-data">
<table border=0 cellpading=0 cellspacing=0 width=100%> <table border=0 cellpading=0 cellspacing=0 width=100%>
<td height=33> <td height=33>
<b>Upload Image</b> <b>Upload Image</b>
<table border=0 cellpading=0 cellspacing=0 class="panel" cellpadding=8> <table border=0 cellpading=0 cellspacing=0 class="panel" cellpadding=8>
<tr> <tr>
<td height=25> <td height=25>
<table border="0" cellspacing="0" cellpadding="0" id="tblSample"> <table border="0" cellspacing="0" cellpadding="0" id="tblSample">
<tr id="row"> <tr id="row">
<td width="1" colspan="2"><input type="file" size="30" name="image_1"></td> <td width="1" colspan="2"><input type="file" size="30" name="image_1"></td>
</tr> </tr>
</table> </table>
<table border="0" cellspacing="0" cellpadding="0" style="margin-top:5px;"> <table border="0" cellspacing="0" cellpadding="0" style="margin-top:5px;">
<tr> <tr>
<td> <td>
<INPUT TYPE="SUBMIT" name="submit" VALUE="Upload" style="font-weight:bold;"> &nbsp; <INPUT TYPE="SUBMIT" name="submit" VALUE="Upload" style="font-weight:bold;"> &nbsp;
<input type=button value='-' style="font-weight:bold; width:22px;" title='Remove last file input box' onClick="RemoveRowFromTable();return false;"> <input type=button value='-' style="font-weight:bold; width:22px;" title='Remove last file input box' onClick="RemoveRowFromTable();return false;">
<input type=button value='+' style="font-weight:bold; width:22px;" title='Add another file input box' onClick="AddRowsToTable();return false;"> &nbsp; <input type=button value='+' style="font-weight:bold; width:22px;" title='Add another file input box' onClick="AddRowsToTable();return false;"> &nbsp;
<input style="border:0px; background-color:#F7F6F4;" type=checkbox name=overwrite id=overwrite value=1><label title='Overwrite file(s) if exist' for=overwrite> Overwrite</label> <input style="border:0px; background-color:#F7F6F4;" type=checkbox name=overwrite id=overwrite value=1><label title='Overwrite file(s) if exist' for=overwrite> Overwrite</label>
</td> </td>
</tr> </tr>
</table> </table>
$img_result $img_result
</table> </table>
<input type=hidden name=wysiwyg value='$wysiwyg'> <input type=hidden name=wysiwyg value='$wysiwyg'>
<input type=hidden name=subaction value=upload> <input type=hidden name=subaction value=upload>
<input type=hidden name=area value='$area'> <input type=hidden name=area value='$area'>
<input type=hidden name=action value='$action'> <input type=hidden name=action value='$action'>
<input type=hidden name='images_number' id='images_number' value='1'> <input type=hidden name='images_number' id='images_number' value='1'>
</form> </form>
HTML; HTML;
if($action == "quick"){ if($action == "quick"){
echo" echo"
<form name=properties> <form name=properties>
<table style='margin-top:10px;' border=0 cellpading=0 cellspacing=0 width=100%> <table style='margin-top:10px;' border=0 cellpading=0 cellspacing=0 width=100%>
<td height=33> <td height=33>
<b>Image Properties</b> <b>Image Properties</b>
<table border=0 cellpading=0 cellspacing=0 class=\"panel\" style='padding:5px'width=290px; > <table border=0 cellpading=0 cellspacing=0 class=\"panel\" style='padding:5px'width=290px; >
<tr> <tr>
<td width=80>Alt. Text: </td> <td width=80>Alt. Text: </td>
<td><input tabindex=1 type=text name=alternativeText style=\"width:150;\"></td> <td><input tabindex=1 type=text name=alternativeText style=\"width:150;\"></td>
</tr> </tr>
<tr> <tr>
<td>Image Align</td> <td>Image Align</td>
<td> <td>
<select name='imageAlign' style='width:150'> <select name='imageAlign' style='width:150'>
<option value=none>None</option> <option value=none>None</option>
<option value=left>Left</option> <option value=left>Left</option>
<option value=right>Right</option> <option value=right>Right</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Border</td> <td>Border</td>
<td><input type=text value='0' name=imageBorder style=\"width:35\"> pixels</td> <td><input type=text value='0' name=imageBorder style=\"width:35\"> pixels</td>
</tr> </tr>
</table> </table>
</table></form>"; </table></form>";
} }
echo"<tr><td><img height=1 style=\"height: 13px !important; height: 1px;\" border=0 src=\"skins/images/blank.gif\" width=1></tr><tr><td> echo"<tr><td><img height=1 style=\"height: 13px !important; height: 1px;\" border=0 src=\"skins/images/blank.gif\" width=1></tr><tr><td>
<b>Uploaded Images</b> <b>Uploaded Images</b>
</tr> </tr>
<tr > <tr >
<td height=1> <td height=1>
<FORM action='$PHP_SELF?mod=images' METHOD='POST'> <FORM action='$PHP_SELF?mod=images' METHOD='POST'>
<table width=100% height=100% cellspacing=0 cellpadding=0>"; <table width=100% height=100% cellspacing=0 cellpadding=0>";
$img_dir = opendir($config_path_image_upload); $img_dir = opendir($config_path_image_upload);
$i = 0; $i = 0;
while ($file = readdir($img_dir)) while ($file = readdir($img_dir))
{ {
//Yes we'll store them in array for sorting //Yes we'll store them in array for sorting
$images_in_dir[] = $file; $images_in_dir[] = $file;
} }
natcasesort($images_in_dir); natcasesort($images_in_dir);
reset($images_in_dir); reset($images_in_dir);
foreach ($images_in_dir as $file) { foreach ($images_in_dir as $file) {
$img_name_arr = explode(".",$file); $img_name_arr = explode(".",$file);
$img_type = end($img_name_arr); $img_type = end($img_name_arr);
if ( (in_array($img_type, $allowed_extensions) or in_array(strtolower($img_type), $allowed_extensions)) and $file != ".." and $file != "." and is_file($config_path_image_upload."/".$file)) if ( (in_array($img_type, $allowed_extensions) or in_array(strtolower($img_type), $allowed_extensions)) and $file != ".." and $file != "." and is_file($config_path_image_upload."/".$file))
{ {
$i++; $i++;
$this_size = filesize($config_path_image_upload."/".$file); $this_size = filesize($config_path_image_upload."/".$file);
$total_size += $this_size; $total_size += $this_size;
$img_info = getimagesize($config_path_image_upload."/".$file); $img_info = getimagesize($config_path_image_upload."/".$file);
if( $i%2 != 0 ){ $bg = "bgcolor=#F7F6F4"; } if( $i%2 != 0 ){ $bg = "bgcolor=#F7F6F4"; }
else{ $bg = ""; } else{ $bg = ""; }
if($action == "quick") if($action == "quick")
{ {
$my_area = str_replace("_", " ", $area); $my_area = str_replace("_", " ", $area);
echo" echo"
<tr $bg><td height=16 width=1px> <a title='Preview this image' href=\"javascript:PopupPic('$file')\"><img style='border:0px;' src='skins/images/view_image.gif'></a> <tr $bg><td height=16 width=1px> <a title='Preview this image' href=\"javascript:PopupPic('$file')\"><img style='border:0px;' src='skins/images/view_image.gif'></a>
<td height=16 width=100%> <td height=16 width=100%>
<a title=\"Insert this image in the $my_area\" href=\"javascript:insertimage('$file')\">$file</a> <a title=\"Insert this image in the $my_area\" href=\"javascript:insertimage('$file')\">$file</a>
<td height=16 align=right> <td height=16 align=right>
$img_info[0]x$img_info[1]&nbsp;&nbsp; $img_info[0]x$img_info[1]&nbsp;&nbsp;
<td height=16 align=right> <td height=16 align=right>
&nbsp;". formatsize($this_size) ." &nbsp;". formatsize($this_size) ."
</tr>"; </tr>";
} }
else else
{ {
echo"<tr $bg><td height=16> echo"<tr $bg><td height=16>
&nbsp; &nbsp;
<td height=16 width=63% > <td height=16 width=63% >
<a target=_blank href=\"". $config_path_image_upload ."/$file\">$file</a> <a target=_blank href=\"". $config_path_image_upload ."/$file\">$file</a>
<td height=16 align=right> <td height=16 align=right>
$img_info[0]x$img_info[1] $img_info[0]x$img_info[1]
<td height=16 align=right> <td height=16 align=right>
&nbsp;". formatsize($this_size) ." &nbsp;". formatsize($this_size) ."
<td width=70 height=16 align=right> <td width=70 height=16 align=right>
<input type=checkbox name=images[$file] value=\"$file\"> <input type=checkbox name=images[$file] value=\"$file\">
</tr>"; </tr>";
} }
} }
} }
if($i > 0){ if($i > 0){
echo"<tr ><td height=16>"; echo"<tr ><td height=16>";
if($action != "quick"){ if($action != "quick"){
echo" <td colspan=4 align=right> echo" <td colspan=4 align=right>
<br><input type=submit value='Delete Selected Images'> <br><input type=submit value='Delete Selected Images'>
</tr>"; </tr>";
} }
echo"<tr heigh=1> echo"<tr heigh=1>
<td width=14> <td width=14>
&nbsp; &nbsp;
<td > <td >
<br /><b>Total size</b> <br /><b>Total size</b>
<td>&nbsp; <td>&nbsp;
<td align=right> <td align=right>
<br /><b>". formatsize($total_size) .'</b> <br /><b>". formatsize($total_size) .'</b>
</tr>'; </tr>';
} }
echo' echo'
</table><input type=hidden name=action value=doimagedelete></form></table>'; </table><input type=hidden name=action value=doimagedelete></form></table>';
if($action != "quick"){ echofooter(); } if($action != "quick"){ echofooter(); }
} }
// ******************************************************************************** // ********************************************************************************
// Delete Image // Delete Image
// ******************************************************************************** // ********************************************************************************
elseif($action == "doimagedelete") elseif($action == "doimagedelete")
{ {
if(!isset($images)){ msg("info","No Images selected","You must select images to be deleted.", "$PHP_SELF?mod=images"); } if(!isset($images)){ msg("info","No Images selected","You must select images to be deleted.", "$PHP_SELF?mod=images"); }
// if(!file_exists($config_path_image_upload."/".$image) or !$image){ msg("error","Error !!!","Could not delete image", "$PHP_SELF?mod=images"); } // if(!file_exists($config_path_image_upload."/".$image) or !$image){ msg("error","Error !!!","Could not delete image", "$PHP_SELF?mod=images"); }
foreach($images as $image){ foreach($images as $image){
unlink($config_path_image_upload."/".$image) or print("Could not delete image <b>$file</b>"); unlink($config_path_image_upload."/".$image) or print("Could not delete image <b>$file</b>");
} }
msg("info","Image(s) Deleted","The image was successfully deleted.", "$PHP_SELF?mod=images"); msg("info","Image(s) Deleted","The image was successfully deleted.", "$PHP_SELF?mod=images");
} }
?> ?>
<?PHP <?PHP
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); }
// ******************************************************************************** // ********************************************************************************
// Add IP // Add IP
// ******************************************************************************** // ********************************************************************************
if($action == "add" OR $action == "quickadd") if($action == "add" OR $action == "quickadd")
{ {
if(!$add_ip){ msg("error","Error !!!","The IP can not be blank", "$PHP_SELF?mod=ipban"); } if(!$add_ip){ msg("error","Error !!!","The IP can not be blank", "$PHP_SELF?mod=ipban"); }
$all_ip = file("./data/ipban.db.php"); $all_ip = file("./data/ipban.db.php");
$exist = FALSE; $exist = FALSE;
foreach($all_ip as $ip_line) foreach($all_ip as $ip_line)
{ {
$ip_arr = explode("|", $ip_line); $ip_arr = explode("|", $ip_line);
if($ip_arr[0] == $add_ip){ $exist = TRUE; } if($ip_arr[0] == $add_ip){ $exist = TRUE; }
} }
if(!$exist) if(!$exist)
{ {
$new_ips = fopen("./data/ipban.db.php", "a"); $new_ips = fopen("./data/ipban.db.php", "a");
$add_ip = stripslashes( preg_replace(array("'\|'",), array("I",), $add_ip) ); $add_ip = stripslashes( preg_replace(array("'\|'",), array("I",), $add_ip) );
fwrite($new_ips, "$add_ip|0||\n"); fwrite($new_ips, "$add_ip|0||\n");
fclose($new_ips); fclose($new_ips);
} }
if($action == "quickadd"){ die('The IP '.$add_ip.' is now banned from commenting.'); } if($action == "quickadd"){ die('The IP '.$add_ip.' is now banned from commenting.'); }
} }
// ******************************************************************************** // ********************************************************************************
// Remove IP // Remove IP
// ******************************************************************************** // ********************************************************************************
elseif($action == "remove") elseif($action == "remove")
{ {
if(!$remove_ip){ msg("error","Error !!!","The IP can not be blank", "$PHP_SELF?mod=ipban"); } if(!$remove_ip){ msg("error","Error !!!","The IP can not be blank", "$PHP_SELF?mod=ipban"); }
$old_ips = file("./data/ipban.db.php"); $old_ips = file("./data/ipban.db.php");
$new_ips = fopen("./data/ipban.db.php", "w"); $new_ips = fopen("./data/ipban.db.php", "w");
foreach($old_ips as $old_ip_line){ foreach($old_ips as $old_ip_line){
$ip_arr = explode("|", $old_ip_line); $ip_arr = explode("|", $old_ip_line);
if($ip_arr[0] != stripslashes($remove_ip)){ if($ip_arr[0] != stripslashes($remove_ip)){
fwrite($new_ips, $old_ip_line); fwrite($new_ips, $old_ip_line);
} }
} }
fclose($new_ips); fclose($new_ips);
} }
// ******************************************************************************** // ********************************************************************************
// List all IP // List all IP
// ******************************************************************************** // ********************************************************************************
echoheader("options", "IP Blocking"); echoheader("options", "IP Blocking");
echo'<table border=0 cellpading=0 cellspacing=0 width="645" > echo'<table border=0 cellpading=0 cellspacing=0 width="645" >
<form method=post action="'.$PHP_SELF.'"> <form method=post action="'.$PHP_SELF.'">
<td width=321 height="33"> <td width=321 height="33">
<b>Block IP</b> <b>Block IP</b>
<table border=0 cellpading=0 cellspacing=0 width=379 class="panel" cellpadding="7" > <table border=0 cellpading=0 cellspacing=0 width=379 class="panel" cellpadding="7" >
<tr> <tr>
<td width=79 height="25"> <td width=79 height="25">
&nbsp;IP Address : <br>&nbsp;<br>&nbsp; &nbsp;IP Address : <br>&nbsp;<br>&nbsp;
<td width=274 height="25"> <td width=274 height="25">
<input type=text name=add_ip>&nbsp;&nbsp; <input type=submit value="Block this IP"><br> <br> <input type=text name=add_ip>&nbsp;&nbsp; <input type=submit value="Block this IP"><br> <br>
example: <i>129.32.31.44</i> or <i>129.32.*.*</i> example: <i>129.32.31.44</i> or <i>129.32.*.*</i>
</tr> </tr>
<input type=hidden name=action value=add> <input type=hidden name=action value=add>
<input type=hidden name=mod value=ipban> <input type=hidden name=mod value=ipban>
</form> </form>
</table> </table>
<tr> <tr>
<td width=654 height="11"> <td width=654 height="11">
<img height=20 border=0 src="skins/images/blank.gif" width=1> <img height=20 border=0 src="skins/images/blank.gif" width=1>
</tr><tr> </tr><tr>
<td width=654 height=14> <td width=654 height=14>
<b>Blocked IP Addresses</b> <b>Blocked IP Addresses</b>
</tr> </tr>
<tr> <tr>
<td width=654 height=1> <td width=654 height=1>
<table width=641 height=100% cellspacing=0 cellpadding=0> <table width=641 height=100% cellspacing=0 cellpadding=0>
<tr> <tr>
<td width=15 bgcolor=#F7F6F4></td> <td width=15 bgcolor=#F7F6F4></td>
<td width=260 bgcolor=#F7F6F4><u>IP</u></td> <td width=260 bgcolor=#F7F6F4><u>IP</u></td>
<td width=218 bgcolor=#F7F6F4><u>times been blocked</u></td> <td width=218 bgcolor=#F7F6F4><u>times been blocked</u></td>
<td width=140 bgcolor=#F7F6F4>&nbsp;<u>unblock</u></td> <td width=140 bgcolor=#F7F6F4>&nbsp;<u>unblock</u></td>
</tr>'; </tr>';
$all_ips = file("./data/ipban.db.php"); $all_ips = file("./data/ipban.db.php");
$i = 0; $i = 0;
foreach($all_ips as $ip_line) foreach($all_ips as $ip_line)
{ {
if(!eregi("<\?",$ip_line)) if(!eregi("<\?",$ip_line))
{ {
if($i%2 != 0){ $bg = "bgcolor=#F7F6F4"; }else{ $bg = ""; } if($i%2 != 0){ $bg = "bgcolor=#F7F6F4"; }else{ $bg = ""; }
$i++; $i++;
$ip_arr = explode("|", $ip_line); $ip_arr = explode("|", $ip_line);
$ip_arr[0] = stripslashes( preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"), $ip_arr[0]) ); $ip_arr[0] = stripslashes( preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"), $ip_arr[0]) );
echo" echo"
<tr $bg height=18> <tr $bg height=18>
<td></td> <td></td>
<td> <td>
<a href=\"http://www.ripe.net/perl/whois?searchtext=$ip_arr[0]\" target=_blank title=\"Get more information about this ip\">$ip_arr[0]</a> <a href=\"http://www.ripe.net/perl/whois?searchtext=$ip_arr[0]\" target=_blank title=\"Get more information about this ip\">$ip_arr[0]</a>
</td> </td>
<td>$ip_arr[1]</td> <td>$ip_arr[1]</td>
<td> <td>
<a href=\"$PHP_SELF?mod=ipban&action=remove&remove_ip=$ip_arr[0]\">[unblock]</a></td> <a href=\"$PHP_SELF?mod=ipban&action=remove&remove_ip=$ip_arr[0]\">[unblock]</a></td>
</tr> </tr>
"; ";
} }
} }
if($i == 0){ echo"<tr><td align=center colspan=5><br> &nbsp;No blocked IP's</td></tr>"; } if($i == 0){ echo"<tr><td align=center colspan=5><br> &nbsp;No blocked IP's</td></tr>"; }
echo'</table></table>'; echo'</table></table>';
echofooter(); echofooter();
?> ?>
<?PHP <?PHP
//If member access level is commenter, redirect him to personal options //If member access level is commenter, redirect him to personal options
if($member_db[1] == 4 and $action == "dologin"){ header("Location: $config_http_script_dir/index.php?mod=options&action=personal"); exit; } if($member_db[1] == 4 and $action == "dologin"){ header("Location: $config_http_script_dir/index.php?mod=options&action=personal"); exit; }
echoheader("home", "Welcome"); echoheader("home", "Welcome");
if(!is_readable("./data/archives")){ die("Error !!!<br />Can not open directory ./archives for reading, check if it exists or is properly CHMOD'ed"); } if(!is_readable("./data/archives")){ die("Error !!!<br />Can not open directory ./archives for reading, check if it exists or is properly CHMOD'ed"); }
if(!is_readable("./data/news.txt")){ die("Error !!!<br />Can not open file news.txt for reading, check if it exists or is properly CHMOD'ed"); } if(!is_readable("./data/news.txt")){ die("Error !!!<br />Can not open file news.txt for reading, check if it exists or is properly CHMOD'ed"); }
if(!is_readable("./data/comments.txt")){ die("Error !!!<br />Can not open file comments.txt for reading, check if it exists or is properly CHMOD'ed"); } if(!is_readable("./data/comments.txt")){ die("Error !!!<br />Can not open file comments.txt for reading, check if it exists or is properly CHMOD'ed"); }
// Some Stats // Some Stats
$count_postponed_news = 0; $count_postponed_news = 0;
$count_unapproved_news = 0; $count_unapproved_news = 0;
$todaynews = 0; $todaynews = 0;
$count_comments = 0; $count_comments = 0;
$count_my_news = 0; $count_my_news = 0;
$count_new_news = 0; $count_new_news = 0;
$news_db = file("./data/news.txt"); $news_db = file("./data/news.txt");
foreach ($news_db as $line) foreach ($news_db as $line)
{ {
$item_db = explode("|",$line); $item_db = explode("|",$line);
$itemdate = date("d/m/y",$item_db[0]); $itemdate = date("d/m/y",$item_db[0]);
if($itemdate == date("d/m/y")) { if($itemdate == date("d/m/y")) {
$todaynews++; $todaynews++;
if($item_db[1] == $member_db[2]) $count_my_news++; if($item_db[1] == $member_db[2]) $count_my_news++;
if(($item_db[0] > $member_db[9]) and ($member_db[9] != '')) $count_new_news++; if(($item_db[0] > $member_db[9]) and ($member_db[9] != '')) $count_new_news++;
} }
} }
$stats_news = count( $news_db ); $stats_news = count( $news_db );
$stats_users = count( file("./data/users.db.php") ) - 1; $stats_users = count( file("./data/users.db.php") ) - 1;
$count_postponed_news = count( file("./data/postponed_news.txt") ); $count_postponed_news = count( file("./data/postponed_news.txt") );
if($count_postponed_news > 0){ if($count_postponed_news > 0){
ResynchronizePostponed(); ResynchronizePostponed();
} }
if($config_auto_archive == "yes"){ if($config_auto_archive == "yes"){
ResynchronizeAutoArchive(); ResynchronizeAutoArchive();
} }
$count_unapproved_news = count( file("./data/unapproved_news.txt") ); $count_unapproved_news = count( file("./data/unapproved_news.txt") );
$stats_archives = 0; $stats_archives = 0;
$handle = opendir("./data/archives"); $handle = opendir("./data/archives");
while (FALSE !== ($file = readdir($handle))) while (FALSE !== ($file = readdir($handle)))
{ {
if( preg_match("/.news.arch/",$file) ){$stats_archives++;} if( preg_match("/.news.arch/",$file) ){$stats_archives++;}
} }
closedir($handle); closedir($handle);
// $stats_news_size = formatsize(filesize("./data/news.txt")); // $stats_news_size = formatsize(filesize("./data/news.txt"));
// $stats_comments_size = formatsize(filesize("./data/comments.txt")); // $stats_comments_size = formatsize(filesize("./data/comments.txt"));
// Count Comments // Count Comments
$all_comments = file("./data/comments.txt"); $all_comments = file("./data/comments.txt");
foreach($all_comments as $news_comments){ foreach($all_comments as $news_comments){
$single_news_comments = explode("|>|", $news_comments); $single_news_comments = explode("|>|", $news_comments);
$individual_comments = explode("||", $single_news_comments[1]); $individual_comments = explode("||", $single_news_comments[1]);
$count_comments += count($individual_comments) - 1; $count_comments += count($individual_comments) - 1;
} }
// Define Welcome Message // Define Welcome Message
echo"<table border=0 cellpading=0 cellspacing=0 width=654> echo"<table border=0 cellpading=0 cellspacing=0 width=654>
<tr><td width=650 colspan=5 height=1> <tr><td width=650 colspan=5 height=1>
&nbsp; &nbsp;
<SCRIPT LANGUAGE=\"JavaScript\"> <SCRIPT LANGUAGE=\"JavaScript\">
<!-- Begin <!-- Begin
datetoday = new Date(); datetoday = new Date();
timenow=datetoday.getTime(); timenow=datetoday.getTime();
datetoday.setTime(timenow); datetoday.setTime(timenow);
thehour = datetoday.getHours(); thehour = datetoday.getHours();
if (thehour < 9 ) display = \"Morning\"; if (thehour < 9 ) display = \"Morning\";
else if (thehour < 12) display = \"Day\"; else if (thehour < 12) display = \"Day\";
else if (thehour < 17) display = \"Afternoon\"; else if (thehour < 17) display = \"Afternoon\";
else if (thehour < 20) display = \"Evening\"; else if (thehour < 20) display = \"Evening\";
else display = \"Night\"; else display = \"Night\";
var greeting = (\"Good \" + display); var greeting = (\"Good \" + display);
document.write(greeting); document.write(greeting);
// End --> // End -->
</script> </script>
$member_db[2]"; $member_db[2]";
if($todaynews != 1){ $s = "s"; } if($todaynews != 1){ $s = "s"; }
if($member_db[1] != 4){ if($member_db[1] != 4){
if($stats_users > 1){ if($stats_users > 1){
$rand_msg[] = ", we have <b>$count_new_news</b> new articles since your last login (@ ".date("r",$member_db[9])." )"; $rand_msg[] = ", we have <b>$count_new_news</b> new articles since your last login (@ ".date("r",$member_db[9])." )";
$rand_msg[] = ", we have <b>$count_new_news</b> new articles since your last login (@ ".date("r",$member_db[9])." )"; $rand_msg[] = ", we have <b>$count_new_news</b> new articles since your last login (@ ".date("r",$member_db[9])." )";
$rand_msg[] = ", we have <b>$count_new_news</b> new articles since your last login (@ ".date("r",$member_db[9])." )"; $rand_msg[] = ", we have <b>$count_new_news</b> new articles since your last login (@ ".date("r",$member_db[9])." )";
} }
if($todaynews == 0){ if($todaynews == 0){
$rand_msg[] = ", we don't have new articles today"; $rand_msg[] = ", we don't have new articles today";
$rand_msg[] = ", we don't have new articles today"; $rand_msg[] = ", we don't have new articles today";
$rand_msg[] = ", we don't have new articles today, the first one can be yours."; $rand_msg[] = ", we don't have new articles today, the first one can be yours.";
$rand_msg[] = ", we don't have new articles today, the first one can be yours."; $rand_msg[] = ", we don't have new articles today, the first one can be yours.";
} }
elseif($count_my_news == 0){ elseif($count_my_news == 0){
if($todaynews == 1){ if($todaynews == 1){
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} but it is not yours"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} but it is not yours";
}else{ }else{
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} but <b>$count_my_news</b> of them are yours"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} but <b>$count_my_news</b> of them are yours";
} }
} }
elseif($count_my_news == $todaynews){ elseif($count_my_news == $todaynews){
if($count_my_news == 1){ if($count_my_news == 1){
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote it"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote it";
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote it"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote it";
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote it"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote it";
}else{ }else{
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote all of them"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and you wrote all of them";
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and all are yours"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s} and all are yours";
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, want to <a href=\"$PHP_SELF?mod=addnews&action=addnews\"><b>add</b></a> some more?"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, want to <a href=\"$PHP_SELF?mod=addnews&action=addnews\"><b>add</b></a> some more?";
} }
} }
else{ else{
if($count_my_news == 1){ $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, <b>1</b> of them is yours"; } if($count_my_news == 1){ $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, <b>1</b> of them is yours"; }
else{ $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, <b>$count_my_news</b> of them are yours"; } else{ $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, <b>$count_my_news</b> of them are yours"; }
} }
$rand_msg[] = ", are you in a mood of <a href=\"$PHP_SELF?mod=addnews&action=addnews\"><b>adding</b></a> some news?"; $rand_msg[] = ", are you in a mood of <a href=\"$PHP_SELF?mod=addnews&action=addnews\"><b>adding</b></a> some news?";
$rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, from total <b>$stats_news</b>"; $rand_msg[] = ", today we have <b>$todaynews</b> new article{$s}, from total <b>$stats_news</b>";
if($member_db[9] != ""){ if($member_db[9] != ""){
$rand_msg[] = ", your last login was on ".date("d M Y H:i:s", $member_db[9]); $rand_msg[] = ", your last login was on ".date("d M Y H:i:s", $member_db[9]);
$rand_msg[] = ", your last login was on ".date("d M Y H:i:s", $member_db[9]); $rand_msg[] = ", your last login was on ".date("d M Y H:i:s", $member_db[9]);
} }
$rand_msg[] = ""; $rand_msg[] = "";
srand((double) microtime() * 1000000); srand((double) microtime() * 1000000);
echo $rand_msg[rand(0, count($rand_msg)-1)]."<br /><br /></td></tr>"; echo $rand_msg[rand(0, count($rand_msg)-1)]."<br /><br /></td></tr>";
} }
//---------------------------------- //----------------------------------
// Notify user if the news were auto-archived // Notify user if the news were auto-archived
//---------------------------------- //----------------------------------
//get last auto-archive date //get last auto-archive date
$ladb_content = file("$cutepath/data/auto_archive.db.php"); $ladb_content = file("$cutepath/data/auto_archive.db.php");
list($last_archived[year], $last_archived[month]) = split("\|", $ladb_content[0] ); list($last_archived[year], $last_archived[month]) = split("\|", $ladb_content[0] );
$last_login_year = date("Y", ($member_db[9] || time()) ); $last_login_year = date("Y", ($member_db[9] || time()) );
$last_login_month = date("n", ($member_db[9] || time()) ); $last_login_month = date("n", ($member_db[9] || time()) );
if((int)$last_login_month < (int)$last_archived[month] and $last_login_year <= $last_archived[year]){ if((int)$last_login_month < (int)$last_archived[month] and $last_login_year <= $last_archived[year]){
echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1> echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1>
<b>Attention!</b><br> <b>Attention!</b><br>
CuteNews has performed auto-archive opperation since your last login at ".date("d M Y H:i:s", $member_db[9])."<br> CuteNews has performed auto-archive opperation since your last login at ".date("d M Y H:i:s", $member_db[9])."<br>
If you don't want your news to be auto-archived every month,<br> If you don't want your news to be auto-archived every month,<br>
you can swith this option off from <a href=\"?mod=options&action=syscon\">System Configurations</a>. you can swith this option off from <a href=\"?mod=options&action=syscon\">System Configurations</a>.
</td></tr>"; </td></tr>";
} }
//---------------------------------- //----------------------------------
// Do we have enough free space ? // Do we have enough free space ?
//---------------------------------- //----------------------------------
$dfs = @disk_free_space("./"); $dfs = @disk_free_space("./");
// $dfs = 5341; // $dfs = 5341;
if($dfs and $dfs < 10240){ if($dfs and $dfs < 10240){
$freespace = formatsize($dfs); $freespace = formatsize($dfs);
echo"<tr><td style='padding:3px; border:1px dashed red; background-color:#FFB9B9;' colspan=5 height=1> echo"<tr><td style='padding:3px; border:1px dashed red; background-color:#FFB9B9;' colspan=5 height=1>
<b>Warning!</b><br> <b>Warning!</b><br>
According to CuteNews, your estimated free space is $freespace. Take action to enlarge your free space or According to CuteNews, your estimated free space is $freespace. Take action to enlarge your free space or
some data files could be damaged during the writing procedure. <a href=\"?mod=tools&action=backup\">Backup your data now</a>. some data files could be damaged during the writing procedure. <a href=\"?mod=tools&action=backup\">Backup your data now</a>.
</td></tr>"; </td></tr>";
} }
//---------------------------------- //----------------------------------
// Install script still exists ? // Install script still exists ?
//---------------------------------- //----------------------------------
if ($action == 'delete-install'){ @unlink('./inc/install.mdu'); } if ($action == 'delete-install'){ @unlink('./inc/install.mdu'); }
if(file_exists('./inc/install.mdu')){ if(file_exists('./inc/install.mdu')){
$freespace = formatsize($dfs); $freespace = formatsize($dfs);
echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1> echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1>
<b>Attention!</b><br> <b>Attention!</b><br>
CuteNews found that the installation module is still located in the /inc folder.<br> CuteNews found that the installation module is still located in the /inc folder.<br>
Please delete or rename the <b>/inc/install.mdu</b> file for security reasons.<br><br> Please delete or rename the <b>/inc/install.mdu</b> file for security reasons.<br><br>
<a href='$PHP_SELFT?mod=main&action=delete-install'><b>(try to delete the file automatically)</b></a><br>&nbsp; <a href='$PHP_SELFT?mod=main&action=delete-install'><b>(try to delete the file automatically)</b></a><br>&nbsp;
</td></tr>"; </td></tr>";
} }
//---------------------------------- //----------------------------------
// Are we using SafeSkin ? // Are we using SafeSkin ?
//---------------------------------- //----------------------------------
if($using_safe_skin){ if($using_safe_skin){
$freespace = formatsize($dfs); $freespace = formatsize($dfs);
echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1> echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1>
<b>Attention!</b><br> <b>Attention!</b><br>
CuteNews was unable to load the selected '$config_skin' skin, and automatically reverted to the default one.<br> CuteNews was unable to load the selected '$config_skin' skin, and automatically reverted to the default one.<br>
Please ensure that the proper skin files exist, or select another skin. Please ensure that the proper skin files exist, or select another skin.
</td></tr>"; </td></tr>";
} }
//---------------------------------- //----------------------------------
// Is our PHP version old ? // Is our PHP version old ?
//---------------------------------- //----------------------------------
if($phpversion and $phpversion < '4.1.0'){ if($phpversion and $phpversion < '4.1.0'){
$freespace = formatsize($dfs); $freespace = formatsize($dfs);
echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1> echo"<tr><td style='padding:3px; border:1px dashed orange; background-color:yellow;' colspan=5 height=1>
<b>Attention!</b><br> <b>Attention!</b><br>
Your version of PHP ($phpversion) is too old. Please consider contacting your server administrator and updating to the Your version of PHP ($phpversion) is too old. Please consider contacting your server administrator and updating to the
latest stable PHP version. latest stable PHP version.
</td></tr>"; </td></tr>";
} }
// Show Some stats // Show Some stats
if($member_db[1] == 1){ if($member_db[1] == 1){
echo "<tr><td valign=middle height=1 bgcolor=#F7F6F4 width=286 colspan=2> echo "<tr><td valign=middle height=1 bgcolor=#F7F6F4 width=286 colspan=2>
&nbsp;<b>Some stats</b> &nbsp;<b>Some stats</b>
<td valign=middle height=1 width=35> <td valign=middle height=1 width=35>
<td valign=middle height=1 bgcolor=#F7F6F4 width=326 colspan=2> <td valign=middle height=1 bgcolor=#F7F6F4 width=326 colspan=2>
&nbsp;<b>System SelfCheck</b> &nbsp;<b>System SelfCheck</b>
</tr> </tr>
<tr> <tr>
<td valign=middle height=1 width=137> <td valign=middle height=1 width=137>
&nbsp; <a title='View all Active News (Edit News)' href='$PHP_SELF?mod=editnews&action=list'>Active News</a> &nbsp; <a title='View all Active News (Edit News)' href='$PHP_SELF?mod=editnews&action=list'>Active News</a>
<td valign=middle height=1 width=146> <td valign=middle height=1 width=146>
$stats_news $stats_news
<td valign=middle height=1 width=37> <td valign=middle height=1 width=37>
<td valign=middle height=1 width=201> <td valign=middle height=1 width=201>
&nbsp; Can write to news.txt &nbsp; Can write to news.txt
<td valign=middle style='text-align:center' height=1 >"; <td valign=middle style='text-align:center' height=1 >";
if(is_writable("./data/news.txt")){ echo "<font color=green>Yes</font>"; } if(is_writable("./data/news.txt")){ echo "<font color=green>Yes</font>"; }
else{ echo "<font color=red>No</font>"; } else{ echo "<font color=red>No</font>"; }
echo"</tr> echo"</tr>
<tr> <tr>
<td valign=middle height=1 width=137> <td valign=middle height=1 width=137>
&nbsp; <a title='View all Postponed Articles' href='$PHP_SELF?mod=editnews&action=list&source=postponed'>Postponed News</a> &nbsp; <a title='View all Postponed Articles' href='$PHP_SELF?mod=editnews&action=list&source=postponed'>Postponed News</a>
<td valign=middle height=1 width=146> <td valign=middle height=1 width=146>
$count_postponed_news $count_postponed_news
<td valign=middle height=1 width=37> <td valign=middle height=1 width=37>
<td valign=middle height=1 width=201> <td valign=middle height=1 width=201>
&nbsp; Can write to postponed_news.txt &nbsp; Can write to postponed_news.txt
<td valign=middle height=1 style='text-align:center' >"; <td valign=middle height=1 style='text-align:center' >";
if(is_writable("./data/postponed_news.txt")){ echo "<font color=green>Yes</font>"; } if(is_writable("./data/postponed_news.txt")){ echo "<font color=green>Yes</font>"; }
else{ echo "<font color=red>No</font>"; } else{ echo "<font color=red>No</font>"; }
echo"</tr> echo"</tr>
<tr> <tr>
<td valign=middle height=1 width=137> <td valign=middle height=1 width=137>
&nbsp; <a title='View all Unapproved Articles' href='$PHP_SELF?mod=editnews&action=list&source=unapproved'>Unapproved News</a> &nbsp; <a title='View all Unapproved Articles' href='$PHP_SELF?mod=editnews&action=list&source=unapproved'>Unapproved News</a>
<td valign=middle height=1 width=146> "; <td valign=middle height=1 width=146> ";
if($count_unapproved_news > 0){ if($count_unapproved_news > 0){
echo"<span style='background-color:yellow;'>$count_unapproved_news</span>"; echo"<span style='background-color:yellow;'>$count_unapproved_news</span>";
}else{ }else{
echo"$count_unapproved_news"; echo"$count_unapproved_news";
} }
echo"<td valign=middle height=1 width=37> echo"<td valign=middle height=1 width=37>
<td valign=middle height=1 width=201> <td valign=middle height=1 width=201>
&nbsp; Can write to unapproved news &nbsp; Can write to unapproved news
<td valign=middle height=1 style='text-align:center'>"; <td valign=middle height=1 style='text-align:center'>";
if(is_writable("./data/unapproved_news.txt")){ echo "<font color=green>Yes</font>"; } if(is_writable("./data/unapproved_news.txt")){ echo "<font color=green>Yes</font>"; }
else{ echo "<font color=red>No</font>"; } else{ echo "<font color=red>No</font>"; }
echo"</tr> echo"</tr>
<tr> <tr>
<td valign=middle height=1 width=137> <td valign=middle height=1 width=137>
&nbsp; Active Comments &nbsp; Active Comments
<td valign=middle height=1 width=146> <td valign=middle height=1 width=146>
$count_comments $count_comments
<td valign=middle height=1 width=37> <td valign=middle height=1 width=37>
<td valign=middle height=1 width=201> <td valign=middle height=1 width=201>
&nbsp; Can write to comments.txt &nbsp; Can write to comments.txt
<td valign=middle height=1 style='text-align:center'>"; <td valign=middle height=1 style='text-align:center'>";
if(is_writable("./data/comments.txt")){ echo "<font color=green>Yes</font>"; } if(is_writable("./data/comments.txt")){ echo "<font color=green>Yes</font>"; }
else{ echo "<font color=red>No</font>"; } else{ echo "<font color=red>No</font>"; }
echo"</tr> echo"</tr>
<tr> <tr>
<td width=137 valign=middle height=1> <td width=137 valign=middle height=1>
&nbsp; <a title='View all Archives (Archives Manager)' href='$PHP_SELF?mod=tools&action=archive'>Archives</a> &nbsp; <a title='View all Archives (Archives Manager)' href='$PHP_SELF?mod=tools&action=archive'>Archives</a>
<td width=146 valign=middle height=1> <td width=146 valign=middle height=1>
$stats_archives $stats_archives
<td width=37 valign=middle height=1> <td width=37 valign=middle height=1>
<td width=201 valign=middle height=1> <td width=201 valign=middle height=1>
&nbsp; Can write to users.db.php &nbsp; Can write to users.db.php
<td width=121 valign=middle style='text-align:center' height=1>"; <td width=121 valign=middle style='text-align:center' height=1>";
if(is_writable("./data/users.db.php")){ echo "<font color=green>Yes</font>"; } if(is_writable("./data/users.db.php")){ echo "<font color=green>Yes</font>"; }
else{ echo "<font color=red>No</font>"; } else{ echo "<font color=red>No</font>"; }
echo"</tr> echo"</tr>
<tr> <tr>
<td width=137 valign=middle height=1> <td width=137 valign=middle height=1>
&nbsp; <a title='View all Users (Add/Edit Users)' href='$PHP_SELF?mod=editusers&action=list'>Users</a> &nbsp; <a title='View all Users (Add/Edit Users)' href='$PHP_SELF?mod=editusers&action=list'>Users</a>
<td width=146 valign=middle height=1> <td width=146 valign=middle height=1>
$stats_users $stats_users
<td width=37 valign=middle height=1> <td width=37 valign=middle height=1>
<td width=201 valign=middle height=1> <td width=201 valign=middle height=1>
&nbsp; Can write to archives dir &nbsp; Can write to archives dir
<td width=121 valign=middle style='text-align:center' height=1>"; <td width=121 valign=middle style='text-align:center' height=1>";
if(is_writable("./data/archives")){ echo "<font color=green>Yes</font>"; } if(is_writable("./data/archives")){ echo "<font color=green>Yes</font>"; }
else{ echo "<font color=red>No</font>"; } else{ echo "<font color=red>No</font>"; }
echo"</tr> echo"</tr>
"; ";
} }
echo"</table>"; echo"</table>";
echofooter(); echofooter();
?> ?>
<?PHP <?PHP
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mass Delete Mass Delete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($action == "mass_delete"){ if($action == "mass_delete"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
echoheader("options", "Delete News"); echoheader("options", "Delete News");
echo "<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td > echo "<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >
Are you sure you want to delete all selected news (<b>".count($selected_news)."</b>) ?<br><br> Are you sure you want to delete all selected news (<b>".count($selected_news)."</b>) ?<br><br>
<input type=button value=\" No \" onclick=\"javascript:document.location='$PHP_SELF?mod=editnews&action=list&source=$source'\"> &nbsp; <input type=submit value=\" Yes \"> <input type=button value=\" No \" onclick=\"javascript:document.location='$PHP_SELF?mod=editnews&action=list&source=$source'\"> &nbsp; <input type=submit value=\" Yes \">
<input type=hidden name=action value=\"do_mass_delete\"> <input type=hidden name=action value=\"do_mass_delete\">
<input type=hidden name=mod value=\"massactions\"> <input type=hidden name=mod value=\"massactions\">
<input type=hidden name=source value=\"$source\">"; <input type=hidden name=source value=\"$source\">";
foreach($selected_news as $newsid){ foreach($selected_news as $newsid){
echo "<input type=hidden name=selected_news[] value=\"$newsid\">\n"; echo "<input type=hidden name=selected_news[] value=\"$newsid\">\n";
} }
echo "</td></tr></table></form>"; echo "</td></tr></table></form>";
echofooter(); echofooter();
exit; exit;
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do Mass Delete Do Mass Delete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "do_mass_delete"){ elseif($action == "do_mass_delete"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles to be deleted", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles to be deleted", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if($source == ""){ $news_file = "data/news.txt"; $comm_file = "data/comments.txt";} if($source == ""){ $news_file = "data/news.txt"; $comm_file = "data/comments.txt";}
elseif($source == "postponed"){ $news_file = "data/postponed_news.txt"; $comm_file = "data/comments.txt"; } elseif($source == "postponed"){ $news_file = "data/postponed_news.txt"; $comm_file = "data/comments.txt"; }
elseif($source == "unapproved"){ $news_file = "data/unapproved_news.txt"; $comm_file = "data/comments.txt"; } elseif($source == "unapproved"){ $news_file = "data/unapproved_news.txt"; $comm_file = "data/comments.txt"; }
else{ $news_file = "./data/archives/$source.news.arch"; $comm_file = "./data/archives/$source.comments.arch"; } else{ $news_file = "./data/archives/$source.news.arch"; $comm_file = "./data/archives/$source.comments.arch"; }
$deleted_articles = 0; $deleted_articles = 0;
// Delete News // Delete News
$old_db = file("$news_file"); $old_db = file("$news_file");
$new_db = fopen("$news_file", w); $new_db = fopen("$news_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if(@!in_array($old_db_arr[0], $selected_news)){ if(@!in_array($old_db_arr[0], $selected_news)){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
$have_perm = 0; $have_perm = 0;
if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;} elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;}
if(!$have_perm){ fwrite($new_db,"$old_db_line"); } if(!$have_perm){ fwrite($new_db,"$old_db_line"); }
else{$deleted_articles ++;} else{$deleted_articles ++;}
} }
} }
fclose($new_db); fclose($new_db);
// Delete Comments // Delete Comments
$old_db = file("$comm_file"); $old_db = file("$comm_file");
$new_db = fopen("$comm_file", w); $new_db = fopen("$comm_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if(@!in_array($old_db_arr[0], $selected_news)){ if(@!in_array($old_db_arr[0], $selected_news)){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
$have_perm = 0; $have_perm = 0;
if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;} elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;}
if(!$have_perm){ fwrite($new_db,"$old_db_line"); } if(!$have_perm){ fwrite($new_db,"$old_db_line"); }
else{ /* Do Nothing => Delete :) */ } else{ /* Do Nothing => Delete :) */ }
} }
} }
fclose($new_db); fclose($new_db);
if(count($selected_news) == $deleted_articles){ msg("info", "Deleted News", "All articles that you selected (<b>$deleted_articles</b>) were deleted", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(count($selected_news) == $deleted_articles){ msg("info", "Deleted News", "All articles that you selected (<b>$deleted_articles</b>) were deleted", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
else{ msg("error", "Deleted News (some errors occured !!!)", "$deleted_articles of ".count($selected_news)." articles that you selected were deleted", "$PHP_SELF?mod=editnews&action=list&source=$source"); } else{ msg("error", "Deleted News (some errors occured !!!)", "$deleted_articles of ".count($selected_news)." articles that you selected were deleted", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mass Approve Mass Approve
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "mass_approve"){ elseif($action == "mass_approve"){
if($member_db[1] != 1 and $member_db[1] != 2){ msg("error", "Error", "You do not have permissions for this action.", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if($member_db[1] != 1 and $member_db[1] != 2){ msg("error", "Error", "You do not have permissions for this action.", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
$news_file = "./data/unapproved_news.txt"; $news_file = "./data/unapproved_news.txt";
$approved_articles = 0; $approved_articles = 0;
$old_db = file("$news_file"); $old_db = file("$news_file");
$new_db = fopen("$news_file", w); $new_db = fopen("$news_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if(@!in_array($old_db_arr[0], $selected_news)){ if(@!in_array($old_db_arr[0], $selected_news)){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
//Move the article to Active News //Move the article to Active News
$all_active_db = file("$cutepath/data/news.txt"); $all_active_db = file("$cutepath/data/news.txt");
$active_news_file = fopen("$cutepath/data/news.txt", "w"); $active_news_file = fopen("$cutepath/data/news.txt", "w");
@flock ($active_news_file,2); @flock ($active_news_file,2);
fwrite($active_news_file,"$old_db_line"); fwrite($active_news_file,"$old_db_line");
foreach ($all_active_db as $active_line){ fwrite($active_news_file, "$active_line");} foreach ($all_active_db as $active_line){ fwrite($active_news_file, "$active_line");}
@flock ($active_news_file,3); @flock ($active_news_file,3);
fclose($active_news_file); fclose($active_news_file);
$approved_articles++; $approved_articles++;
} }
} }
fclose($new_db); fclose($new_db);
if(count($selected_news) == $approved_articles){ msg("info", "News Approved", "All articles that you selected ($approved_articles) were approved and are now active", "$PHP_SELF?mod=editnews&action=list"); } if(count($selected_news) == $approved_articles){ msg("info", "News Approved", "All articles that you selected ($approved_articles) were approved and are now active", "$PHP_SELF?mod=editnews&action=list"); }
else{ msg("error", "News Approved (with errors)", "$approved_articles of ".count($selected_news)." articles that you selected were approved", "$PHP_SELF?mod=editnews&action=list"); } else{ msg("error", "News Approved (with errors)", "$approved_articles of ".count($selected_news)." articles that you selected were approved", "$PHP_SELF?mod=editnews&action=list"); }
exit; exit;
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mass Move to Cat Mass Move to Cat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "mass_move_to_cat"){ elseif($action == "mass_move_to_cat"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
$orig_cat_lines = file("./data/category.db.php"); $orig_cat_lines = file("./data/category.db.php");
//only show allowed categories //only show allowed categories
$allowed_cats = array(); $allowed_cats = array();
$cat_lines = array(); $cat_lines = array();
foreach($orig_cat_lines as $single_line){ foreach($orig_cat_lines as $single_line){
$ocat_arr = explode("|", $single_line); $ocat_arr = explode("|", $single_line);
$cat[$ocat_arr[0]] = $ocat_arr[1]; $cat[$ocat_arr[0]] = $ocat_arr[1];
if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){ if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){
$cat_lines[] = $single_line; $cat_lines[] = $single_line;
$allowed_cats[] = $ocat_arr[0]; $allowed_cats[] = $ocat_arr[0];
} }
} }
echoheader("options", "Move Articles to Category"); echoheader("options", "Move Articles to Category");
echo "<form action=\"$PHP_SELF\" method=post><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >Move selected articles (<b>".count($selected_news)."</b>) to category:"; echo "<form action=\"$PHP_SELF\" method=post><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >Move selected articles (<b>".count($selected_news)."</b>) to category:";
echo'<table width="80%" border="0" cellspacing="0" cellpadding="0" class="panel">'; echo'<table width="80%" border="0" cellspacing="0" cellpadding="0" class="panel">';
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
echo" echo"
<td style='font-size:10px;' valign=top> <td style='font-size:10px;' valign=top>
<label for='cat{$cat_arr[0]}'> <label for='cat{$cat_arr[0]}'>
<input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>"; <input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>";
$i++; $i++;
if ($i%4 == 0){ echo'<tr>'; } if ($i%4 == 0){ echo'<tr>'; }
} }
echo"</tr>"; echo"</tr>";
echo "</table>"; echo "</table>";
foreach($selected_news as $newsid){ foreach($selected_news as $newsid){
echo "<input type=hidden name=selected_news[] value=\"$newsid\">"; echo "<input type=hidden name=selected_news[] value=\"$newsid\">";
} }
echo "<br><input type=hidden name=action value=\"do_mass_move_to_cat\"><input type=hidden name=source value=\"$source\"><input type=hidden name=mod value=\"massactions\">&nbsp;<input type=submit value=\"Move\"></td></tr></table></form>"; echo "<br><input type=hidden name=action value=\"do_mass_move_to_cat\"><input type=hidden name=source value=\"$source\"><input type=hidden name=mod value=\"massactions\">&nbsp;<input type=submit value=\"Move\"></td></tr></table></form>";
echofooter(); echofooter();
exit; exit;
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DO Mass Move to One Category DO Mass Move to One Category
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "do_mass_move_to_cat"){ elseif($action == "do_mass_move_to_cat"){
if($member_db[1] != 1){ msg("error", "Error", "You do not have permissions for this action.", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if($member_db[1] != 1){ msg("error", "Error", "You do not have permissions for this action.", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
///// /////
///Format our categories variable ///Format our categories variable
///// /////
$orig_cat_lines = file("./data/category.db.php"); $orig_cat_lines = file("./data/category.db.php");
//only show allowed categories //only show allowed categories
$allowed_cats = array(); $allowed_cats = array();
$cat_lines = array(); $cat_lines = array();
foreach($orig_cat_lines as $single_line){ foreach($orig_cat_lines as $single_line){
$ocat_arr = explode("|", $single_line); $ocat_arr = explode("|", $single_line);
$cat[$ocat_arr[0]] = $ocat_arr[1]; $cat[$ocat_arr[0]] = $ocat_arr[1];
if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){ if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){
$cat_lines[] = $single_line; $cat_lines[] = $single_line;
$allowed_cats[] = $ocat_arr[0]; $allowed_cats[] = $ocat_arr[0];
} }
} }
if( is_array($category) ){ //User has selected multiple categories if( is_array($category) ){ //User has selected multiple categories
$nice_category = ''; $nice_category = '';
$ccount = 0; $ccount = 0;
foreach($category as $ckey=>$cvalue){ foreach($category as $ckey=>$cvalue){
if($ccount==0){ $nice_category = $cvalue; }//first cat if($ccount==0){ $nice_category = $cvalue; }//first cat
else{ $nice_category = $nice_category.','.$cvalue; } else{ $nice_category = $nice_category.','.$cvalue; }
$ccount++; $ccount++;
} }
}else{ //Single or Not category }else{ //Single or Not category
//don't format $nice_cats because we have not selected any. //don't format $nice_cats because we have not selected any.
$nice_category = $category; $nice_category = $category;
} }
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if($source == ""){ $news_file = "./data/news.txt";} if($source == ""){ $news_file = "./data/news.txt";}
elseif($source == "postponed"){ $news_file = "data/postponed_news.txt"; } elseif($source == "postponed"){ $news_file = "data/postponed_news.txt"; }
elseif($source == "unapproved"){ $news_file = "data/unapproved_news.txt"; } elseif($source == "unapproved"){ $news_file = "data/unapproved_news.txt"; }
else{ $news_file = "./data/archives/$source.news.arch"; } else{ $news_file = "./data/archives/$source.news.arch"; }
$moved_articles = 0; $moved_articles = 0;
$old_db = file("$news_file"); $old_db = file("$news_file");
$new_db = fopen("$news_file", w); $new_db = fopen("$news_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if(@!in_array($old_db_arr[0], $selected_news)){ if(@!in_array($old_db_arr[0], $selected_news)){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
$have_perm = 0; $have_perm = 0;
if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;} elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;}
if(!$have_perm){ fwrite($new_db,"$old_db_line"); } if(!$have_perm){ fwrite($new_db,"$old_db_line"); }
else{ else{
fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$old_db_arr[2]|$old_db_arr[3]|$old_db_arr[4]|$old_db_arr[5]|$nice_category|||\n"); fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$old_db_arr[2]|$old_db_arr[3]|$old_db_arr[4]|$old_db_arr[5]|$nice_category|||\n");
$moved_articles ++; $moved_articles ++;
} }
} }
} }
fclose($new_db); fclose($new_db);
if(count($selected_news) == $moved_articles){ msg("info", "News Moved", "All articles that you selected ($moved_articles) were moved to the specified category", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(count($selected_news) == $moved_articles){ msg("info", "News Moved", "All articles that you selected ($moved_articles) were moved to the specified category", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
else{ msg("error", "News Moved (with errors)", "$moved_articles of ".count($selected_news)." articles that you selected were moved to the specified category", "$PHP_SELF?mod=editnews&action=list&source=$source"); } else{ msg("error", "News Moved (with errors)", "$moved_articles of ".count($selected_news)." articles that you selected were moved to the specified category", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mass Archive Mass Archive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "mass_archive"){ elseif($action == "mass_archive"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if($source != ""){ msg("error", "Error", "These news are already archived or are in postpone queue", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if($source != ""){ msg("error", "Error", "These news are already archived or are in postpone queue", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
echoheader("options", "Send News To Archive"); echoheader("options", "Send News To Archive");
echo "<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td > echo "<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >
Are you sure you want to send all selected news (<b>".count($selected_news)."</b>) to the archive ?<br><br> Are you sure you want to send all selected news (<b>".count($selected_news)."</b>) to the archive ?<br><br>
<input type=button value=\" No \" onclick=\"javascript:document.location='$PHP_SELF?mod=editnews&action=list&source=$source'\"> &nbsp; <input type=submit value=\" Yes \"> <input type=button value=\" No \" onclick=\"javascript:document.location='$PHP_SELF?mod=editnews&action=list&source=$source'\"> &nbsp; <input type=submit value=\" Yes \">
<input type=hidden name=action value=\"do_mass_archive\"> <input type=hidden name=action value=\"do_mass_archive\">
<input type=hidden name=mod value=\"massactions\">"; <input type=hidden name=mod value=\"massactions\">";
foreach($selected_news as $newsid){ foreach($selected_news as $newsid){
echo"<input type=hidden name=selected_news[] value=\"$newsid\">\n"; echo"<input type=hidden name=selected_news[] value=\"$newsid\">\n";
} }
echo"</td></tr></table></form>"; echo"</td></tr></table></form>";
echofooter(); echofooter();
exit; exit;
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DO Mass Send To Archive DO Mass Send To Archive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "do_mass_archive"){ elseif($action == "do_mass_archive"){
if($member_db[1] != 1){ msg("error", "Access Denied", "You can not perfor this action if you are not admin"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You can not perfor this action if you are not admin"); }
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); } if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if(!is_writable("./data/archives/")){ msg("error", "Error", "The ./data/archives/ directory is not writable, CHMOD it to 777"); } if(!is_writable("./data/archives/")){ msg("error", "Error", "The ./data/archives/ directory is not writable, CHMOD it to 777"); }
$news_file = "./data/news.txt"; $news_file = "./data/news.txt";
$comm_file = "./data/comments.txt"; $comm_file = "./data/comments.txt";
$prepeared_for_archive = array(); $prepeared_for_archive = array();
$prepeared_comments_for_archive = array(); $prepeared_comments_for_archive = array();
$archived_news = 0; $archived_news = 0;
// Prepear the news for Archiving // Prepear the news for Archiving
$old_db = file("$news_file"); $old_db = file("$news_file");
$new_db = fopen("$news_file", w); $new_db = fopen("$news_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if(@!in_array($old_db_arr[0], $selected_news)){ if(@!in_array($old_db_arr[0], $selected_news)){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
$have_perm = 0; $have_perm = 0;
if( ($member_db[1] == 1) or ($member_db[1] == 2) ){ $have_perm = 1; } if( ($member_db[1] == 1) or ($member_db[1] == 2) ){ $have_perm = 1; }
elseif( ($member_db[1] == 3) and ($old_db_arr[1] == $member_db[2]) ){ $have_perm = 1; } elseif( ($member_db[1] == 3) and ($old_db_arr[1] == $member_db[2]) ){ $have_perm = 1; }
if( !$have_perm ){ fwrite($new_db,"$old_db_line"); } if( !$have_perm ){ fwrite($new_db,"$old_db_line"); }
else{ else{
$prepeared_news_for_archive[] = $old_db_line; $prepeared_news_for_archive[] = $old_db_line;
$archived_news++; $archived_news++;
} }
} }
} }
fclose($new_db); fclose($new_db);
if($archived_news == 0){ msg("error", "Error", "No news were found for archiving."); } if($archived_news == 0){ msg("error", "Error", "No news were found for archiving."); }
// Prepear the comments for Archiving // Prepear the comments for Archiving
$old_db = file("$comm_file"); $old_db = file("$comm_file");
$new_db = fopen("$comm_file", w); $new_db = fopen("$comm_file", w);
foreach($old_db as $old_db_line){ foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line); $old_db_arr = explode("|", $old_db_line);
if(@!in_array($old_db_arr[0], $selected_news)){ if(@!in_array($old_db_arr[0], $selected_news)){
fwrite($new_db,"$old_db_line"); fwrite($new_db,"$old_db_line");
} }
else else
{ {
$have_perm = 0; $have_perm = 0;
if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;} elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;}
if(!$have_perm){ fwrite($new_db,"$old_db_line"); } if(!$have_perm){ fwrite($new_db,"$old_db_line"); }
else{ else{
$prepeared_comments_for_archive[] = $old_db_line; $prepeared_comments_for_archive[] = $old_db_line;
} }
} }
} }
fclose($new_db); fclose($new_db);
// Start Archiving // Start Archiving
$arch_name = time()+($config_date_adjust*60); $arch_name = time()+($config_date_adjust*60);
$arch_news = fopen("./data/archives/$arch_name.news.arch", w); $arch_news = fopen("./data/archives/$arch_name.news.arch", w);
foreach($prepeared_news_for_archive as $item){ foreach($prepeared_news_for_archive as $item){
fwrite($arch_news, "$item"); fwrite($arch_news, "$item");
} }
fclose($arch_news); fclose($arch_news);
$arch_comm = fopen("./data/archives/$arch_name.comments.arch", w); $arch_comm = fopen("./data/archives/$arch_name.comments.arch", w);
foreach($prepeared_comments_for_archive as $item){ foreach($prepeared_comments_for_archive as $item){
fwrite($arch_comm, "$item"); fwrite($arch_comm, "$item");
} }
fclose($arch_comm); fclose($arch_comm);
msg("info", "News Archived", "All articles that you selected ($archived_news) are now archived under ./data/archives/<b>$arch_name</b>.news.arch", "$PHP_SELF?mod=editnews&action=list&source=$source"); msg("info", "News Archived", "All articles that you selected ($archived_news) are now archived under ./data/archives/<b>$arch_name</b>.news.arch", "$PHP_SELF?mod=editnews&action=list&source=$source");
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If No Action Is Choosed If No Action Is Choosed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
else{ else{
msg("info", "Choose Action", "Please choose action from the drop-down menu", "$PHP_SELF?mod=editnews&action=list&source=$source"); msg("info", "Choose Action", "Please choose action from the drop-down menu", "$PHP_SELF?mod=editnews&action=list&source=$source");
} }
?> ?>
<?PHP <?PHP
if($member_db[1] == 4 and ($action != 'personal' and $action != 'options')){ msg('error', 'Error!', 'Access Denied for your user-level (commenter)'); } if($member_db[1] == 4 and ($action != 'personal' and $action != 'options')){ msg('error', 'Error!', 'Access Denied for your user-level (commenter)'); }
// ******************************************************************************** // ********************************************************************************
// Options Menu // Options Menu
// ******************************************************************************** // ********************************************************************************
if($action == "options" or $action == '') if($action == "options" or $action == '')
{ {
echoheader("options","Options"); echoheader("options","Options");
//---------------------------------- //----------------------------------
// Predefine Options // Predefine Options
//---------------------------------- //----------------------------------
// access means the lower level of user allowed; 1:admin, 2:editor+admin, 3:editor+admin+journalist, 4:all // access means the lower level of user allowed; 1:admin, 2:editor+admin, 3:editor+admin+journalist, 4:all
$options = array( $options = array(
array( array(
'name' => "Personal Options", 'name' => "Personal Options",
'url' => "$PHP_SELF?mod=options&action=personal", 'url' => "$PHP_SELF?mod=options&action=personal",
'access' => "4", 'access' => "4",
), ),
array( array(
'name' => "Block IP's from posting comments", 'name' => "Block IP's from posting comments",
'url' => "$PHP_SELF?mod=ipban", 'url' => "$PHP_SELF?mod=ipban",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "System Configurations", 'name' => "System Configurations",
'url' => "$PHP_SELF?mod=options&action=syscon&rand=".time(), 'url' => "$PHP_SELF?mod=options&action=syscon&rand=".time(),
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Integration Wizards (News and RSS)", 'name' => "Integration Wizards (News and RSS)",
'url' => "$PHP_SELF?mod=wizards", 'url' => "$PHP_SELF?mod=wizards",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Edit Templates", 'name' => "Edit Templates",
'url' => "$PHP_SELF?mod=options&action=templates", 'url' => "$PHP_SELF?mod=options&action=templates",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Add/Edit Users", 'name' => "Add/Edit Users",
'url' => "$PHP_SELF?mod=editusers&action=list", 'url' => "$PHP_SELF?mod=editusers&action=list",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Archives Manager", 'name' => "Archives Manager",
'url' => "$PHP_SELF?mod=tools&action=archive", 'url' => "$PHP_SELF?mod=tools&action=archive",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Manage Uploaded Images", 'name' => "Manage Uploaded Images",
'url' => "$PHP_SELF?mod=images", 'url' => "$PHP_SELF?mod=images",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Backup Tool", 'name' => "Backup Tool",
'url' => "$PHP_SELF?mod=tools&action=backup", 'url' => "$PHP_SELF?mod=tools&action=backup",
'access' => "1", 'access' => "1",
), ),
array( array(
'name' => "Edit Categories", 'name' => "Edit Categories",
'url' => "$PHP_SELF?mod=categories", 'url' => "$PHP_SELF?mod=categories",
'access' => "1", 'access' => "1",
), ),
); );
//------------------------------------------------ //------------------------------------------------
// Cut the options for wich we don't have access // Cut the options for wich we don't have access
//------------------------------------------------ //------------------------------------------------
$count_options = count($options); $count_options = count($options);
for($i=0; $i<$count_options; $i++){ for($i=0; $i<$count_options; $i++){
if($member_db[1] > $options[$i]['access']){ if($member_db[1] > $options[$i]['access']){
unset($options[$i]); unset($options[$i]);
} }
} }
echo'<table border="0" width="100%"><tr>'; echo'<table border="0" width="100%"><tr>';
$i = 0; $i = 0;
foreach($options as $option){ foreach($options as $option){
if($i%2 == 0){ echo"</tr>\n<tr>\n<td width='47%'>&nbsp;&nbsp;&nbsp;<a href='".$option['url']."'><b>".$option['name']."</b></a></td>\n"; } if($i%2 == 0){ echo"</tr>\n<tr>\n<td width='47%'>&nbsp;&nbsp;&nbsp;<a href='".$option['url']."'><b>".$option['name']."</b></a></td>\n"; }
else{ echo"\n<td width='53%'><a href='".$option['url']."'><b>".$option['name']."</b></a></td>\n"; } else{ echo"\n<td width='53%'><a href='".$option['url']."'><b>".$option['name']."</b></a></td>\n"; }
$i++; $i++;
} }
echo'</tr></table>'; echo'</tr></table>';
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Show Personal Options // Show Personal Options
// ******************************************************************************** // ********************************************************************************
elseif($action == "personal") elseif($action == "personal")
{ {
echoheader("user","Personal Options"); echoheader("user","Personal Options");
$registrationdate = date("D, d F Y",$member_db[0]); //registration date $registrationdate = date("D, d F Y",$member_db[0]); //registration date
if($member_db[7] == 1){ $ifchecked = "Checked"; } //if user wants to hide his e-mail if($member_db[7] == 1){ $ifchecked = "Checked"; } //if user wants to hide his e-mail
foreach($member_db as $key=>$value){ foreach($member_db as $key=>$value){
$member_db[$key] = stripslashes(preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"),$member_db[$key])); $member_db[$key] = stripslashes(preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"),$member_db[$key]));
} }
echo" echo"
<table border=0 height=1 width=617 cellspacing=\"0\" cellpadding=\"0\"> <table border=0 height=1 width=617 cellspacing=\"0\" cellpadding=\"0\">
<form method=POST action=\"$PHP_SELF\" name=personal> <form method=POST action=\"$PHP_SELF\" name=personal>
<td height=\"21\" width=\"99\" bgcolor=#F7F6F4 > <td height=\"21\" width=\"99\" bgcolor=#F7F6F4 >
&nbsp; Username &nbsp; Username
<td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2> <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2>
$member_db[2] $member_db[2]
<tr> <tr>
<td height=\"21\" width=\"200\"> <td height=\"21\" width=\"200\">
&nbsp; New Password &nbsp; New Password
<td height=\"21\" width=\"400\" colspan=2> <td height=\"21\" width=\"400\" colspan=2>
<input name=editpassword >&nbsp;&nbsp;&nbsp;Only if you want to change the current <input name=editpassword >&nbsp;&nbsp;&nbsp;Only if you want to change the current
</tr> </tr>
<tr> <tr>
<td height=\"21\" width=\"200\" bgcolor=#F7F6F4> <td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
&nbsp; Nickname &nbsp; Nickname
<td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2> <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2>
<input type=text name=editnickname value=\"$member_db[4]\"> <input type=text name=editnickname value=\"$member_db[4]\">
</tr> </tr>
<tr> <tr>
<td height=\"21\" width=\"200\" > <td height=\"21\" width=\"200\" >
&nbsp; Email &nbsp; Email
<td height=\"21\" width=\"400\" colspan=2> <td height=\"21\" width=\"400\" colspan=2>
<input type=text name=editmail value=\"$member_db[5]\">&nbsp;&nbsp;&nbsp;<input type=checkbox name=edithidemail $ifchecked>&nbsp;Hide my e-mail from visitors <input type=text name=editmail value=\"$member_db[5]\">&nbsp;&nbsp;&nbsp;<input type=checkbox name=edithidemail $ifchecked>&nbsp;Hide my e-mail from visitors
</tr>"; </tr>";
if($member_db[1] != 4){echo"<tr> if($member_db[1] != 4){echo"<tr>
<td height=\"21\" width=\"200\" bgcolor=#F7F6F4> <td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
&nbsp; Default Avatar URL &nbsp; Default Avatar URL
<td height=\"21\" width=\"400\" bgcolor=#F7F6F4 > <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 >
<input type=text name=change_avatar value=\"$member_db[8]\">&nbsp;&nbsp;&nbsp;&nbsp;will appear on 'Add News' page <input type=text name=change_avatar value=\"$member_db[8]\">&nbsp;&nbsp;&nbsp;&nbsp;will appear on 'Add News' page
</tr>"; }else{ $bg = "bgcolor=#F7F6F4"; } </tr>"; }else{ $bg = "bgcolor=#F7F6F4"; }
echo"<tr> echo"<tr>
<td height=\"21\" width=\"200\" $bg> <td height=\"21\" width=\"200\" $bg>
&nbsp; Access Level &nbsp; Access Level
<td height=\"21\" width=\"400\" $bg colspan=2>"; <td height=\"21\" width=\"400\" $bg colspan=2>";
if ($member_db[1] == 4){ echo "commenter"; } if ($member_db[1] == 4){ echo "commenter"; }
elseif ($member_db[1] == 3){ echo "journalist"; } elseif ($member_db[1] == 3){ echo "journalist"; }
elseif ($member_db[1] == 2){ echo "editor"; } elseif ($member_db[1] == 2){ echo "editor"; }
elseif ($member_db[1] == 1){ echo "administrator"; } elseif ($member_db[1] == 1){ echo "administrator"; }
if($member_db[1] != 4){ echo"</tr> if($member_db[1] != 4){ echo"</tr>
<tr> <tr>
<td height=\"21\" width=\"200\" bgcolor=#F7F6F4> <td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
&nbsp; written news &nbsp; written news
<td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2> <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2>
$member_db[6] $member_db[6]
</tr>"; } </tr>"; }
echo"<tr> echo"<tr>
<td height=\"21\" width=\"200\" > <td height=\"21\" width=\"200\" >
&nbsp; registration date &nbsp; registration date
<td height=\"21\" width=\"400\" colspan=2> <td height=\"21\" width=\"400\" colspan=2>
$registrationdate $registrationdate
</tr> </tr>
<tr> <tr>
<td height=\"1\" width=\"611\" colspan=\"2\" colspan=3> <td height=\"1\" width=\"611\" colspan=\"2\" colspan=3>
<br /><input type=submit value=\"Save Changes\" accesskey=\"s\"> <br /><input type=submit value=\"Save Changes\" accesskey=\"s\">
</tr> </tr>
<input type=hidden name=mod value=options><input type=hidden name=action value=dosavepersonal> <input type=hidden name=mod value=options><input type=hidden name=action value=dosavepersonal>
</form> </form>
</table>"; </table>";
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Save Personal Options // Save Personal Options
// ******************************************************************************** // ********************************************************************************
elseif($action == "dosavepersonal") elseif($action == "dosavepersonal")
{ {
if($editpassword != "" and ($oldpassword == "" or !$oldpassword)){ if($editpassword != "" and ($oldpassword == "" or !$oldpassword)){
msg("info", "Old Password Verification", "<form method=POST action=\"$PHP_SELF\"> You have requested to change your password.<br>In order to complete this action you must enter your old password: <input type=text name=oldpassword> <input type=submit value='Submit'><input type=hidden name=mod value=options><input type=hidden name=action value=dosavepersonal><input type=hidden name=editpassword value='$editpassword'><input type=hidden name=editnickname value='$editnickname'><input type=hidden name=editmail value='$editmail'><input type=hidden name=edithidemail value='$edithidemail'><input type=hidden name=change_avatar value='$change_avatar'></form>"); msg("info", "Old Password Verification", "<form method=POST action=\"$PHP_SELF\"> You have requested to change your password.<br>In order to complete this action you must enter your old password: <input type=text name=oldpassword> <input type=submit value='Submit'><input type=hidden name=mod value=options><input type=hidden name=action value=dosavepersonal><input type=hidden name=editpassword value='$editpassword'><input type=hidden name=editnickname value='$editnickname'><input type=hidden name=editmail value='$editmail'><input type=hidden name=edithidemail value='$edithidemail'><input type=hidden name=change_avatar value='$change_avatar'></form>");
}elseif($editpassword != "" and (md5($oldpassword) != $member_db[3])){ }elseif($editpassword != "" and (md5($oldpassword) != $member_db[3])){
msg("error","Error!","You did not enter correctly your old password."); msg("error","Error!","You did not enter correctly your old password.");
} }
$editnickname = replace_comment("add",$editnickname); $editnickname = replace_comment("add",$editnickname);
$editmail = replace_comment("add",$editmail); $editmail = replace_comment("add",$editmail);
$edithidemail = replace_comment("add",$edithidemail); $edithidemail = replace_comment("add",$edithidemail);
$change_avatar = replace_comment("add",$change_avatar); $change_avatar = replace_comment("add",$change_avatar);
if($editpassword != "" and !preg_match("/^[\.A-z0-9_\-]{1,15}$/i", $editpassword)){ msg("error","Error !!!", "Your password must conatain only valid characters and numbers"); } if($editpassword != "" and !preg_match("/^[\.A-z0-9_\-]{1,15}$/i", $editpassword)){ msg("error","Error !!!", "Your password must conatain only valid characters and numbers"); }
if($edithidemail){ $edithidemail = 1;}else{ $edithidemail = 0; } if($edithidemail){ $edithidemail = 1;}else{ $edithidemail = 0; }
$avatars = preg_replace(array("'\|'","'\n'","' '"), array("","","_"), $avatars); $avatars = preg_replace(array("'\|'","'\n'","' '"), array("","","_"), $avatars);
$old_user_db = file("./data/users.db.php"); $old_user_db = file("./data/users.db.php");
$new_user_db = fopen("./data/users.db.php", w); $new_user_db = fopen("./data/users.db.php", w);
$personal_success = FALSE; $personal_success = FALSE;
foreach($old_user_db as $old_user_db_line){ foreach($old_user_db as $old_user_db_line){
$old_user_db_arr = explode("|", $old_user_db_line); $old_user_db_arr = explode("|", $old_user_db_line);
if(strtolower($username) != strtolower($old_user_db_arr[2])){ if(strtolower($username) != strtolower($old_user_db_arr[2])){
fwrite($new_user_db,"$old_user_db_line"); fwrite($new_user_db,"$old_user_db_line");
} }
else{ else{
if($editpassword != ""){ if($editpassword != ""){
$old_user_db_arr[3] = md5($editpassword); $old_user_db_arr[3] = md5($editpassword);
if($config_use_cookies == TRUE){ setcookie("md5_password", $old_user_db_arr[3]); } if($config_use_cookies == TRUE){ setcookie("md5_password", $old_user_db_arr[3]); }
$_SESSION['md5_password'] = $old_user_db_arr[3]; $_SESSION['md5_password'] = $old_user_db_arr[3];
} }
fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$editnickname|$editmail|$old_user_db_arr[6]|$edithidemail|$change_avatar|$old_user_db_arr[9]||\n"); fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$editnickname|$editmail|$old_user_db_arr[6]|$edithidemail|$change_avatar|$old_user_db_arr[9]||\n");
$personal_success = TRUE; $personal_success = TRUE;
} }
} }
fclose($new_user_db); fclose($new_user_db);
if($personal_success){ msg("info", "Changes Saved", "Your personal information was saved.", "$PHP_SELF?mod=options&action=personal"); } if($personal_success){ msg("info", "Changes Saved", "Your personal information was saved.", "$PHP_SELF?mod=options&action=personal"); }
else{ msg("error", "Error !!!", "Error while listing users, $username not found", "$PHP_SELF?mod=options&action=personal"); } else{ msg("error", "Error !!!", "Error while listing users, $username not found", "$PHP_SELF?mod=options&action=personal"); }
} }
// ******************************************************************************** // ********************************************************************************
// Edit Templates // Edit Templates
// ******************************************************************************** // ********************************************************************************
elseif($action == "templates") elseif($action == "templates")
{ {
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Detect all template packs we have Detect all template packs we have
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$templates_list = array(); $templates_list = array();
if(!$handle = opendir("./data")){ die("<center>Can not open directory $cutepath/data "); } if(!$handle = opendir("./data")){ die("<center>Can not open directory $cutepath/data "); }
while (false !== ($file = readdir($handle))){ while (false !== ($file = readdir($handle))){
if(eregi(".tpl", $file)){ if(eregi(".tpl", $file)){
$file_arr = explode(".", $file); $file_arr = explode(".", $file);
$templates_list[]= $file_arr[0]; $templates_list[]= $file_arr[0];
} }
} }
closedir($handle); closedir($handle);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we want to create new template If we want to create new template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "new"){ if($subaction == "new"){
echoheader("options", "New Template"); echoheader("options", "New Template");
echo"<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >Create new template based on: <select name=base_template>"; echo"<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >Create new template based on: <select name=base_template>";
foreach($templates_list as $single_template){ foreach($templates_list as $single_template){
echo "<option value=\"$single_template\">$single_template</option>"; echo "<option value=\"$single_template\">$single_template</option>";
} }
echo '</select> with name <input type=text name=template_name> &nbsp;<input type=submit value="Create Template"> echo '</select> with name <input type=text name=template_name> &nbsp;<input type=submit value="Create Template">
<input type=hidden name=mod value=options> <input type=hidden name=mod value=options>
<input type=hidden name=action value=templates> <input type=hidden name=action value=templates>
<input type=hidden name=subaction value=donew> <input type=hidden name=subaction value=donew>
</td></tr></table></form>'; </td></tr></table></form>';
echofooter(); echofooter();
exit; exit;
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do Create the new template Do Create the new template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "donew"){ if($subaction == "donew"){
if(!eregi("^[a-z0-9_-]+$", $template_name)){ msg("error", "Error", "The name of the template must be only with letters and numbers", "$PHP_SELF?mod=options&subaction=new&action=templates"); } if(!eregi("^[a-z0-9_-]+$", $template_name)){ msg("error", "Error", "The name of the template must be only with letters and numbers", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
if(file_exists("./data/${template_name}.tpl")){ msg("error", "Error", "Template with this name already exists", "$PHP_SELF?mod=options&subaction=new&action=templates"); } if(file_exists("./data/${template_name}.tpl")){ msg("error", "Error", "Template with this name already exists", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
if($base_template != ""){ $base_file = "./data/${base_template}.tpl"; } if($base_template != ""){ $base_file = "./data/${base_template}.tpl"; }
else{ $base_file = "./data/Default.tpl"; } else{ $base_file = "./data/Default.tpl"; }
if (!copy($base_file, "./data/${template_name}.tpl")) { if (!copy($base_file, "./data/${template_name}.tpl")) {
msg("error", "Error", "Can not copy file $base_file to ./data/ folder with name ${template_name}.tpl"); msg("error", "Error", "Can not copy file $base_file to ./data/ folder with name ${template_name}.tpl");
} }
@chmod("./data/${template_name}.tpl", 0777); @chmod("./data/${template_name}.tpl", 0777);
msg("info", "Template Created", "A new template was created with name <b>${template_name}</b><br>", "$PHP_SELF?mod=options&action=templates"); msg("info", "Template Created", "A new template was created with name <b>${template_name}</b><br>", "$PHP_SELF?mod=options&action=templates");
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Deleting template, preparation Deleting template, preparation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "delete"){ if($subaction == "delete"){
if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); } if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); }
if(strtolower($do_template) == "rss"){ msg("Error", "Error !!!", "You can not delete the RSS template, it is not even supposed you to edit it.", "$PHP_SELF?mod=options&action=templates"); } if(strtolower($do_template) == "rss"){ msg("Error", "Error !!!", "You can not delete the RSS template, it is not even supposed you to edit it.", "$PHP_SELF?mod=options&action=templates"); }
$msg = "<form method=post action=\"$PHP_SELF\">Are you sure you want to delete the template <b>$do_template</b> ?<br><br> $msg = "<form method=post action=\"$PHP_SELF\">Are you sure you want to delete the template <b>$do_template</b> ?<br><br>
<input type=submit value=\" Yes, Delete This Template\"> &nbsp;<input onClick=\"document.location='$PHP_SELF?mod=options&action=templates';\" type=button value=\"Cancel\"> <input type=submit value=\" Yes, Delete This Template\"> &nbsp;<input onClick=\"document.location='$PHP_SELF?mod=options&action=templates';\" type=button value=\"Cancel\">
<input type=hidden name=mod value=options> <input type=hidden name=mod value=options>
<input type=hidden name=action value=templates> <input type=hidden name=action value=templates>
<input type=hidden name=subaction value=dodelete> <input type=hidden name=subaction value=dodelete>
<input type=hidden name=do_template value=\"$do_template\"> <input type=hidden name=do_template value=\"$do_template\">
</form>"; </form>";
msg("info", "Deleting Template", $msg); msg("info", "Deleting Template", $msg);
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DO Deleting template DO Deleting template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "dodelete"){ if($subaction == "dodelete"){
if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); } if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); }
$unlink = unlink("./data/${do_template}.tpl"); $unlink = unlink("./data/${do_template}.tpl");
if(!$unlink){ msg("error", "Error", "Can not delete file ./data/${do_template}.tpl <br>maybe the is no permission from the server"); } if(!$unlink){ msg("error", "Error", "Can not delete file ./data/${do_template}.tpl <br>maybe the is no permission from the server"); }
else{ msg("info", "Template Deleted", "The template <b>${do_template}</b> was deleted.", "$PHP_SELF?mod=options&action=templates"); } else{ msg("info", "Template Deleted", "The template <b>${do_template}</b> was deleted.", "$PHP_SELF?mod=options&action=templates"); }
} }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Show The Template Manager Show The Template Manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($do_template == '' or !$do_template){ if($do_template == '' or !$do_template){
$do_template = 'Default'; $do_template = 'Default';
$show_delete_link = ''; $show_delete_link = '';
}elseif(strtolower($do_template) != 'default'){ }elseif(strtolower($do_template) != 'default'){
$show_delete_link = "<a href=\"$PHP_SELF?action=templates&mod=options&subaction=delete&do_template=$do_template\">[delete this template]</a>"; $show_delete_link = "<a href=\"$PHP_SELF?action=templates&mod=options&subaction=delete&do_template=$do_template\">[delete this template]</a>";
} }
require("./data/${do_template}.tpl"); require("./data/${do_template}.tpl");
if(eregi("opera", $HTTP_USER_AGENT)){ $tr_hidden = ""; } if(eregi("opera", $HTTP_USER_AGENT)){ $tr_hidden = ""; }
else{ $tr_hidden = " style='display:none'"; } else{ $tr_hidden = " style='display:none'"; }
$templates_names = array("template_active", "template_comment", "template_form", "template_full", "template_prev_next", "template_comments_prev_next"); $templates_names = array("template_active", "template_comment", "template_form", "template_full", "template_prev_next", "template_comments_prev_next");
foreach($templates_names as $template) foreach($templates_names as $template)
{ {
$$template = preg_replace("/</","&lt;",$$template); $$template = preg_replace("/</","&lt;",$$template);
$$template = preg_replace("/>/","&gt;",$$template); $$template = preg_replace("/>/","&gt;",$$template);
} }
echoheader("options","Templates"); echoheader("options","Templates");
echo'<table border=0 cellpading=0 cellspacing=0 height="77" > echo'<table border=0 cellpading=0 cellspacing=0 height="77" >
<tr> <tr>
<td width=373 height="75"> <td width=373 height="75">
<b>Manage Templates</b> <b>Manage Templates</b>
<table border=0 cellpading=0 cellspacing=0 width=347 class="panel" height="50" > <table border=0 cellpading=0 cellspacing=0 width=347 class="panel" height="50" >
<form method=get action="'.$PHP_SELF.'"> <form method=get action="'.$PHP_SELF.'">
<tr> <tr>
<td width=126height="23"> <td width=126height="23">
&nbsp;Editing Template &nbsp;Editing Template
<td width=225height="23"> <td width=225height="23">
:&nbsp; <b>'.$do_template.'</b> :&nbsp; <b>'.$do_template.'</b>
</tr> </tr>
<tr> <tr>
<td width=126 height="27"> <td width=126 height="27">
&nbsp;Switch to Template &nbsp;Switch to Template
<td width=225 height="27"> <td width=225 height="27">
:&nbsp; <select size=1 name=do_template>'; :&nbsp; <select size=1 name=do_template>';
foreach($templates_list as $single_template){ foreach($templates_list as $single_template){
if($single_template == $do_template){ echo"<option selected value=\"$single_template\">$single_template</option>"; } if($single_template == $do_template){ echo"<option selected value=\"$single_template\">$single_template</option>"; }
else{ echo"<option value=\"$single_template\">$single_template</option>"; } else{ echo"<option value=\"$single_template\">$single_template</option>"; }
} }
echo'</select> echo'</select>
<input type=submit value=Go> <input type=submit value=Go>
</tr> </tr>
<tr> <tr>
<td width=351 height="25" colspan="2"> <td width=351 height="25" colspan="2">
&nbsp;<a href="'.$PHP_SELF.'?mod=options&subaction=new&action=templates">[create new template]</a>&nbsp; &nbsp;<a href="'.$PHP_SELF.'?mod=options&subaction=new&action=templates">[create new template]</a>&nbsp;
'.$show_delete_link.'</tr> '.$show_delete_link.'</tr>
<input type=hidden name=action value=templates><input type=hidden name=mod value=options> <input type=hidden name=action value=templates><input type=hidden name=mod value=options>
</form> </form>
</table> </table>
<td width=268 height="75" align="center"> <td width=268 height="75" align="center">
<!-- HELP --> <!-- HELP -->
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td> <td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td>
<td >&nbsp;<a onClick="javascript:Help(\'templates\')" href="#">Understanding Templates</a></td> <td >&nbsp;<a onClick="javascript:Help(\'templates\')" href="#">Understanding Templates</a></td>
</tr> </tr>
</table> </table>
<!-- END HELP --> <!-- END HELP -->
</tr> </tr>
</table> </table>
<img height=20 border=0 src="skins/images/blank.gif" width=1> <img height=20 border=0 src="skins/images/blank.gif" width=1>
<br> <br>
<b>Edit Template Parts</b><table width="100%"><form method=post action="'.$PHP_SELF.'"> <b>Edit Template Parts</b><table width="100%"><form method=post action="'.$PHP_SELF.'">
<tr> <!- start active news --> <tr> <!- start active news -->
<td height="7" bgcolor=#F7F6F4 colspan="2"> <td height="7" bgcolor=#F7F6F4 colspan="2">
<b><a style="font-size:16px" href="javascript:ShowOrHide(\'active-news1\',\'active-news2\')" >Active News</a></b> <b><a style="font-size:16px" href="javascript:ShowOrHide(\'active-news1\',\'active-news2\')" >Active News</a></b>
</tr> </tr>
<tr id=\'active-news1\' '.$tr_hidden.'> <tr id=\'active-news1\' '.$tr_hidden.'>
<td height="9" width="200" valign="top"> <td height="9" width="200" valign="top">
<b>{title}<br /> <b>{title}<br />
{avatar}<br /> {avatar}<br />
{short-story}<br /> {short-story}<br />
{full-story}<br /> {full-story}<br />
{author}<br /> {author}<br />
{author-name}<br /> {author-name}<br />
[mail] </b>and<b> [/mail]<br /> [mail] </b>and<b> [/mail]<br />
{date}<br /> {date}<br />
[link] </b>and<b> [/link]<br /> [link] </b>and<b> [/link]<br />
[full-link] </b>and<b> [/full-link]<br /> [full-link] </b>and<b> [/full-link]<br />
[com-link] </b>and<b> [/com-link]<br /> [com-link] </b>and<b> [/com-link]<br />
{comments-num}<br /> {comments-num}<br />
{category}<br /> {category}<br />
{category-icon} {category-icon}
<td height="9" valign="top" width=430> <td height="9" valign="top" width=430>
- Title of the article<br /> - Title of the article<br />
- Show Avatar image (if any)<br /> - Show Avatar image (if any)<br />
- Short story of news item<br /> - Short story of news item<br />
- The full story<br /> - The full story<br />
- Author of the article, with link to his email (if any)<br /> - Author of the article, with link to his email (if any)<br />
- The name of the author, without email<br /> - The name of the author, without email<br />
- Will generate a link to the author mail (if any) eg. [mail]Email[/mail]<br /> - Will generate a link to the author mail (if any) eg. [mail]Email[/mail]<br />
- Date when the story is written<br /> - Date when the story is written<br />
- Will generate a permanent link to the full story<br /> - Will generate a permanent link to the full story<br />
- Link to the full story of article, only if there is full story<br /> - Link to the full story of article, only if there is full story<br />
- Generate link to the comments of article<br /> - Generate link to the comments of article<br />
- This will display the number of comments posted for article<br /> - This will display the number of comments posted for article<br />
- Name of the category where article is posted (if any)<br /> - Name of the category where article is posted (if any)<br />
- Shows the category icon (if any)<br /> - Shows the category icon (if any)<br />
</tr> </tr>
<tr id=\'active-news2\' '.$tr_hidden.'> <tr id=\'active-news2\' '.$tr_hidden.'>
<td height="8" colspan="2"> <td height="8" colspan="2">
<textarea rows="9" cols="98" name="edit_active">'.$template_active.'</textarea> <textarea rows="9" cols="98" name="edit_active">'.$template_active.'</textarea>
<br /> <br />
&nbsp; &nbsp;
</tr> <!-- End active news --> </tr> <!-- End active news -->
<tr> <!-- Start full story --> <tr> <!-- Start full story -->
<td height="7" bgcolor=#F7F6F4 colspan="2"> <td height="7" bgcolor=#F7F6F4 colspan="2">
<b><a style="font-size:16px" href="javascript:ShowOrHide(\'full-story1\',\'full-story2\')" >Full Story</a></b> <b><a style="font-size:16px" href="javascript:ShowOrHide(\'full-story1\',\'full-story2\')" >Full Story</a></b>
</tr> </tr>
<tr id=\'full-story1\' '.$tr_hidden.'> <tr id=\'full-story1\' '.$tr_hidden.'>
<td height="9" width="200" valign="top"> <td height="9" width="200" valign="top">
<b> {title}<br /> <b> {title}<br />
{avatar}<br /> {avatar}<br />
{full-story}<br /> {full-story}<br />
{short-story}</b><b><br /> {short-story}</b><b><br />
{author}<br /> {author}<br />
{author-name}<br /> {author-name}<br />
[mail] </b>and<b> [/mail]<br /> [mail] </b>and<b> [/mail]<br />
{date}<br /> {date}<br />
{comments-num}<br /> {comments-num}<br />
{category} <br /> {category} <br />
{category-icon} </b> {category-icon} </b>
<td height="9" valign="top"> <td height="9" valign="top">
- Title of the article<br /> - Title of the article<br />
- Show Avatar image (if any)<br /> - Show Avatar image (if any)<br />
- The full story<br /> - The full story<br />
- Short story of news item<br /> - Short story of news item<br />
- Author of the article, with link to his email (if any)<br /> - Author of the article, with link to his email (if any)<br />
- The name of the author, without email<br /> - The name of the author, without email<br />
- Will generate a link to the author mail (if any) eg. [mail]Email[/mail]<br /> - Will generate a link to the author mail (if any) eg. [mail]Email[/mail]<br />
- Date when the story is written<br /> - Date when the story is written<br />
- This will display the number of comments posted for article<br /> - This will display the number of comments posted for article<br />
- Name of the category where article is posted (if any)<br /> - Name of the category where article is posted (if any)<br />
- Shows the category icon (if any)<br /> - Shows the category icon (if any)<br />
</tr> </tr>
<tr id=\'full-story2\' '.$tr_hidden.'> <tr id=\'full-story2\' '.$tr_hidden.'>
<td height="8" colspan="2"> <td height="8" colspan="2">
<textarea rows="9" cols="98" name="edit_full">'.$template_full.'</textarea> <textarea rows="9" cols="98" name="edit_full">'.$template_full.'</textarea>
<br /> <br />
&nbsp; &nbsp;
</tr> <!-- End full story --> </tr> <!-- End full story -->
<tr> <!-- Start comment --> <tr> <!-- Start comment -->
<td height="7" bgcolor=#F7F6F4 colspan="2"> <td height="7" bgcolor=#F7F6F4 colspan="2">
<b><a style="font-size:16px" href="javascript:ShowOrHide(\'comment1\',\'comment2\')" >Comment</a></b> <b><a style="font-size:16px" href="javascript:ShowOrHide(\'comment1\',\'comment2\')" >Comment</a></b>
</tr> </tr>
<tr id=\'comment1\' '.$tr_hidden.'> <tr id=\'comment1\' '.$tr_hidden.'>
<td height="9" width="200" valign="top"> <td height="9" width="200" valign="top">
<b> {author}<br /> <b> {author}<br />
{mail}<br /> {mail}<br />
{date}<br /> {date}<br />
{comment}<br /> {comment}<br />
{comment-iteration}</b> {comment-iteration}</b>
<td height="9" valign="top"> <td height="9" valign="top">
- Name of the comment poster<br /> - Name of the comment poster<br />
- E-mail of the poster<br /> - E-mail of the poster<br />
- Date when the comment was posted<br /> - Date when the comment was posted<br />
- The Comment<br /> - The Comment<br />
- Show the sequential number of individual comment - Show the sequential number of individual comment
</tr> </tr>
<tr id=\'comment2\' '.$tr_hidden.'> <tr id=\'comment2\' '.$tr_hidden.'>
<td height="8" colspan="2"> <td height="8" colspan="2">
<textarea rows="9" cols="98" name="edit_comment">'.$template_comment.'</textarea> <textarea rows="9" cols="98" name="edit_comment">'.$template_comment.'</textarea>
<br /> <br />
&nbsp; &nbsp;
</tr> <!-- End comment --> </tr> <!-- End comment -->
<tr> <!-- Start add comment form --> <tr> <!-- Start add comment form -->
<td height="7" bgcolor=#F7F6F4 colspan="2"> <td height="7" bgcolor=#F7F6F4 colspan="2">
<b><a style="font-size:16px" href="javascript:ShowOrHide(\'add-comment-form1\',\'add-comment-form2\')" >Add comment form</a></b> <b><a style="font-size:16px" href="javascript:ShowOrHide(\'add-comment-form1\',\'add-comment-form2\')" >Add comment form</a></b>
</tr> </tr>
<tr id=\'add-comment-form1\' '.$tr_hidden.'> <tr id=\'add-comment-form1\' '.$tr_hidden.'>
<td height="9" width="1094" valign="top" colspan="2"> <td height="9" width="1094" valign="top" colspan="2">
Please do not edit this unless you have basic HTML knowledge !!! Please do not edit this unless you have basic HTML knowledge !!!
</tr> </tr>
<tr id=\'add-comment-form2\' '.$tr_hidden.'> <tr id=\'add-comment-form2\' '.$tr_hidden.'>
<td height="8" colspan="2"> <td height="8" colspan="2">
<textarea rows="9" cols="98" name="edit_form">'.$template_form.'</textarea> <textarea rows="9" cols="98" name="edit_form">'.$template_form.'</textarea>
<br /> <br />
&nbsp; &nbsp;
</tr> <!-- End add comment form --> </tr> <!-- End add comment form -->
<tr> <!-- Start previous & next --> <tr> <!-- Start previous & next -->
<td height="7" bgcolor=#F7F6F4 colspan="2"> <td height="7" bgcolor=#F7F6F4 colspan="2">
<b><a style="font-size:16px" href="javascript:ShowOrHide(\'previous-next1\',\'previous-next2\')" >News Pagination</a></b> <b><a style="font-size:16px" href="javascript:ShowOrHide(\'previous-next1\',\'previous-next2\')" >News Pagination</a></b>
</tr> </tr>
<tr id=\'previous-next1\' '.$tr_hidden.'> <tr id=\'previous-next1\' '.$tr_hidden.'>
<td height="9" width="200" valign="top"> <td height="9" width="200" valign="top">
<b> [prev-link] </b>and<b> [/prev-link]<br /> <b> [prev-link] </b>and<b> [/prev-link]<br />
[next-link] </b>and<b> [/next-link]<br /> [next-link] </b>and<b> [/next-link]<br />
{pages}<br /> {pages}<br />
<td height="9" valign="top"> <td height="9" valign="top">
- Will generate a link to preveous page (if there is)<br /> - Will generate a link to preveous page (if there is)<br />
- Will generate a link to next page (if there is)<br /> - Will generate a link to next page (if there is)<br />
- Shows linked numbers of the pages; example: <a href=\'#\'>1</a> <a href=\'#\'>2</a> <a href=\'#\'>3</a> <a href=\'#\'>4</a> - Shows linked numbers of the pages; example: <a href=\'#\'>1</a> <a href=\'#\'>2</a> <a href=\'#\'>3</a> <a href=\'#\'>4</a>
</tr> </tr>
<tr id=\'previous-next2\' '.$tr_hidden.'> <tr id=\'previous-next2\' '.$tr_hidden.'>
<td height="8" colspan="2"> <td height="8" colspan="2">
<textarea rows="3" cols="98" name="edit_prev_next">'.$template_prev_next.'</textarea> <textarea rows="3" cols="98" name="edit_prev_next">'.$template_prev_next.'</textarea>
</tr> <!-- End previous & next --> </tr> <!-- End previous & next -->
<tr> <!-- Start previous & next COMMENTS--> <tr> <!-- Start previous & next COMMENTS-->
<td height="7" bgcolor=#F7F6F4 colspan="2"> <td height="7" bgcolor=#F7F6F4 colspan="2">
<b><a style="font-size:16px" href="javascript:ShowOrHide(\'previous-next21\',\'previous-next22\')" >Comments Pagination</a></b> <b><a style="font-size:16px" href="javascript:ShowOrHide(\'previous-next21\',\'previous-next22\')" >Comments Pagination</a></b>
</tr> </tr>
<tr id=\'previous-next21\' '.$tr_hidden.'> <tr id=\'previous-next21\' '.$tr_hidden.'>
<td height="9" width="200" valign="top"> <td height="9" width="200" valign="top">
<b> [prev-link] </b>and<b> [/prev-link]<br /> <b> [prev-link] </b>and<b> [/prev-link]<br />
[next-link] </b>and<b> [/next-link]<br /> [next-link] </b>and<b> [/next-link]<br />
{pages}<br /> {pages}<br />
<td height="9" valign="top"> <td height="9" valign="top">
- Will generate a link to preveous page (if there is)<br /> - Will generate a link to preveous page (if there is)<br />
- Will generate a link to next page (if there is)<br /> - Will generate a link to next page (if there is)<br />
- Shows linked numbers of the pages; example: <a href=\'#\'>1</a> <a href=\'#\'>2</a> <a href=\'#\'>3</a> <a href=\'#\'>4</a> - Shows linked numbers of the pages; example: <a href=\'#\'>1</a> <a href=\'#\'>2</a> <a href=\'#\'>3</a> <a href=\'#\'>4</a>
</tr> </tr>
<tr id=\'previous-next22\' '.$tr_hidden.'> <tr id=\'previous-next22\' '.$tr_hidden.'>
<td height="8" colspan="2"> <td height="8" colspan="2">
<textarea rows="3" cols="98" name="edit_comments_prev_next">'.$template_comments_prev_next.'</textarea> <textarea rows="3" cols="98" name="edit_comments_prev_next">'.$template_comments_prev_next.'</textarea>
</tr> <!-- End previous & next COMMENTS --> </tr> <!-- End previous & next COMMENTS -->
<tr> <tr>
<td height="8" colspan="2"> <td height="8" colspan="2">
<input type=hidden name=mod value=options> <input type=hidden name=mod value=options>
<input type=hidden name=action value=dosavetemplates> <input type=hidden name=action value=dosavetemplates>
<input type=hidden name=do_template value="'.$do_template.'"> <input type=hidden name=do_template value="'.$do_template.'">
<br /><input type=submit value=" Save Changes " accesskey="s"> <br /><input type=submit value=" Save Changes " accesskey="s">
</tr></form> </tr></form>
</table>'; </table>';
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Do Save Changes to Templates // Do Save Changes to Templates
// ******************************************************************************** // ********************************************************************************
elseif($action == "dosavetemplates") elseif($action == "dosavetemplates")
{ {
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
$templates_names = array("edit_active", "edit_comment", "edit_form", "edit_full", "edit_prev_next", "edit_comments_prev_next"); $templates_names = array("edit_active", "edit_comment", "edit_form", "edit_full", "edit_prev_next", "edit_comments_prev_next");
foreach($templates_names as $template) foreach($templates_names as $template)
{ {
$$template = stripslashes($$template); $$template = stripslashes($$template);
} }
if($do_template == "" or !$do_template){ $do_template = "Default"; } if($do_template == "" or !$do_template){ $do_template = "Default"; }
$template_file = "./data/${do_template}.tpl"; $template_file = "./data/${do_template}.tpl";
if($do_template == "rss"){ $edit_active = str_replace("&", "&amp;",$edit_active); } if($do_template == "rss"){ $edit_active = str_replace("&", "&amp;",$edit_active); }
$handle = fopen("$template_file","w"); $handle = fopen("$template_file","w");
fwrite($handle, "<?PHP\n///////////////////// TEMPLATE $do_template /////////////////////\n"); fwrite($handle, "<?PHP\n///////////////////// TEMPLATE $do_template /////////////////////\n");
fwrite($handle, "\$template_active = <<<HTML\n$edit_active\nHTML;\n\n\n"); fwrite($handle, "\$template_active = <<<HTML\n$edit_active\nHTML;\n\n\n");
fwrite($handle, "\$template_full = <<<HTML\n$edit_full\nHTML;\n\n\n"); fwrite($handle, "\$template_full = <<<HTML\n$edit_full\nHTML;\n\n\n");
fwrite($handle, "\$template_comment = <<<HTML\n$edit_comment\nHTML;\n\n\n"); fwrite($handle, "\$template_comment = <<<HTML\n$edit_comment\nHTML;\n\n\n");
fwrite($handle, "\$template_form = <<<HTML\n$edit_form\nHTML;\n\n\n"); fwrite($handle, "\$template_form = <<<HTML\n$edit_form\nHTML;\n\n\n");
fwrite($handle, "\$template_prev_next = <<<HTML\n$edit_prev_next\nHTML;\n"); fwrite($handle, "\$template_prev_next = <<<HTML\n$edit_prev_next\nHTML;\n");
fwrite($handle, "\$template_comments_prev_next = <<<HTML\n$edit_comments_prev_next\nHTML;\n"); fwrite($handle, "\$template_comments_prev_next = <<<HTML\n$edit_comments_prev_next\nHTML;\n");
fwrite($handle, "?>\n"); fwrite($handle, "?>\n");
msg("info","Changes Saved","The changes to template <b>$do_template</b> were successfully saved.","$PHP_SELF?mod=options&action=templates&do_template=$do_template"); msg("info","Changes Saved","The changes to template <b>$do_template</b> were successfully saved.","$PHP_SELF?mod=options&action=templates&do_template=$do_template");
} }
// ******************************************************************************** // ********************************************************************************
// System Configuration // System Configuration
// ******************************************************************************** // ********************************************************************************
elseif($action == "syscon") elseif($action == "syscon")
{ {
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions to access this section"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions to access this section"); }
echoheader("options", "System Configuration"); echoheader("options", "System Configuration");
function showRow($title="", $description="", $field="") function showRow($title="", $description="", $field="")
{ {
global $i; global $i;
if( $i%2 == 0 and $title != ""){ $bg = "bgcolor=#F7F6F4"; } if( $i%2 == 0 and $title != ""){ $bg = "bgcolor=#F7F6F4"; }
echo"<tr $bg > echo"<tr $bg >
<td colspan=\"2\" style=\"padding:4\"> <td colspan=\"2\" style=\"padding:4\">
&nbsp;<b>$title</b> &nbsp;<b>$title</b>
<td width=294 rowspan=\"2\" valign=\"middle\" align=middle> <td width=294 rowspan=\"2\" valign=\"middle\" align=middle>
$field<br />&nbsp; $field<br />&nbsp;
</tr> </tr>
<tr $bg > <tr $bg >
<td height=15 width=\"27\" style=\"padding:4\"> <td height=15 width=\"27\" style=\"padding:4\">
&nbsp; &nbsp;
<td height=15 width=\"299\" valign=top> <td height=15 width=\"299\" valign=top>
<font color=\"#808080\">$description</font> <font color=\"#808080\">$description</font>
</tr>"; </tr>";
$bg = ""; $i++; $bg = ""; $i++;
} }
function makeDropDown($options, $name, $selected) function makeDropDown($options, $name, $selected)
{ {
$output = "<select size=1 name=\"$name\">\r\n"; $output = "<select size=1 name=\"$name\">\r\n";
foreach($options as $value=>$description) foreach($options as $value=>$description)
{ {
$output .= "<option value=\"$value\""; $output .= "<option value=\"$value\"";
if($selected == $value){ $output .= " selected "; } if($selected == $value){ $output .= " selected "; }
$output .= ">$description</option>\n"; $output .= ">$description</option>\n";
} }
$output .= "</select>"; $output .= "</select>";
return $output; return $output;
} }
echo"<table border=0 cellpading=0 cellspacing=0 width=654 ><form action=\"$PHP_SELF\" method=post>"; echo"<table border=0 cellpading=0 cellspacing=0 width=654 ><form action=\"$PHP_SELF\" method=post>";
echo <<<HTML echo <<<HTML
<script language='JavaScript' type="text/javascript"> <script language='JavaScript' type="text/javascript">
function ChangeOption(selectedButton, selectedOption) { function ChangeOption(selectedButton, selectedOption) {
document.getElementById('general').style.display = "none"; document.getElementById('general').style.display = "none";
document.getElementById('news').style.display = "none"; document.getElementById('news').style.display = "none";
document.getElementById('comments').style.display = "none"; document.getElementById('comments').style.display = "none";
document.getElementById('notifications').style.display = "none"; document.getElementById('notifications').style.display = "none";
document.getElementById('button1').style.backgroundColor = ""; document.getElementById('button1').style.backgroundColor = "";
document.getElementById('button2').style.backgroundColor = ""; document.getElementById('button2').style.backgroundColor = "";
document.getElementById('button3').style.backgroundColor = ""; document.getElementById('button3').style.backgroundColor = "";
document.getElementById('button4').style.backgroundColor = ""; document.getElementById('button4').style.backgroundColor = "";
if(selectedOption == 'general') {document.getElementById('general').style.display = "";} if(selectedOption == 'general') {document.getElementById('general').style.display = "";}
if(selectedOption == 'news') {document.getElementById('news').style.display = "";} if(selectedOption == 'news') {document.getElementById('news').style.display = "";}
if(selectedOption == 'comments') {document.getElementById('comments').style.display = "";} if(selectedOption == 'comments') {document.getElementById('comments').style.display = "";}
if(selectedOption == 'notifications') {document.getElementById('notifications').style.display = "";} if(selectedOption == 'notifications') {document.getElementById('notifications').style.display = "";}
document.getElementById(selectedButton).style.backgroundColor = "#EBE8E2"; document.getElementById(selectedButton).style.backgroundColor = "#EBE8E2";
} }
</script> </script>
<tr style="position:relative" valign=top> <tr style="position:relative" valign=top>
<td style="padding-bottom:30px;" colspan="3" > <td style="padding-bottom:30px;" colspan="3" >
<table style="text-align:center; padding:0px; margin:0px;" width="100%" height=35px cellpadding="0" cellspacing="0"> <table style="text-align:center; padding:0px; margin:0px;" width="100%" height=35px cellpadding="0" cellspacing="0">
<tr style="border:1px solid black; vertical-align:middle;" > <tr style="border:1px solid black; vertical-align:middle;" >
<td id=button1 style="background-color:#EBE8E2; border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button1','general');">General</a> <td id=button1 style="background-color:#EBE8E2; border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button1','general');">General</a>
<td id=button2 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button2','news');">News</a> <td id=button2 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button2','news');">News</a>
<td id=button3 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button3','comments');">Comments</a> <td id=button3 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button3','comments');">Comments</a>
<td id=button4 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button4','notifications');">Notifications</a> <td id=button4 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button4','notifications');">Notifications</a>
</tr> </tr>
</table> </table>
</tr> </tr>
HTML; HTML;
if(!$handle = opendir("./skins")){ die("Can not open directory ./skins "); } if(!$handle = opendir("./skins")){ die("Can not open directory ./skins "); }
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
$file_arr = explode(".",$file); $file_arr = explode(".",$file);
if($file_arr[1] == "skin"){ if($file_arr[1] == "skin"){
$sys_con_skins_arr[$file_arr[0]] = $file_arr[0]; $sys_con_skins_arr[$file_arr[0]] = $file_arr[0];
}elseif($file_arr[1] == "lang"){ }elseif($file_arr[1] == "lang"){
$sys_con_langs_arr[$file_arr[0]] = $file_arr[0]; $sys_con_langs_arr[$file_arr[0]] = $file_arr[0];
} }
} }
closedir($handle); closedir($handle);
// General // General
echo"<tr style='' id=general width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>"; echo"<tr style='' id=general width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
showRow("Full URL to CuteNews Directory", "example: http://yoursite.com/cutenews", "<input type=text style=\"text-align: center;\" name='save_con[http_script_dir]' value='$config_http_script_dir' size=40>"); showRow("Full URL to CuteNews Directory", "example: http://yoursite.com/cutenews", "<input type=text style=\"text-align: center;\" name='save_con[http_script_dir]' value='$config_http_script_dir' size=40>");
showRow("CuteNews Skin", "you can download more from our website", makeDropDown($sys_con_skins_arr, "save_con[skin]", "$config_skin")); showRow("CuteNews Skin", "you can download more from our website", makeDropDown($sys_con_skins_arr, "save_con[skin]", "$config_skin"));
showRow("Time Adjustment", "in minutes; eg. : <b>180</b>=+3 hours; <b>-120</b>=-2 hours", "<input type=text style=\"text-align: center;\" name='save_con[date_adjust]' value=\"$config_date_adjust\" size=10>"); showRow("Time Adjustment", "in minutes; eg. : <b>180</b>=+3 hours; <b>-120</b>=-2 hours", "<input type=text style=\"text-align: center;\" name='save_con[date_adjust]' value=\"$config_date_adjust\" size=10>");
showRow("Smilies", "Separate them with commas (<b>,</b>)", "<input type=text style=\"text-align: center;\" name='save_con[smilies]' value=\"$config_smilies\" size=40>"); showRow("Smilies", "Separate them with commas (<b>,</b>)", "<input type=text style=\"text-align: center;\" name='save_con[smilies]' value=\"$config_smilies\" size=40>");
showRow("Auto-Archive every Month", "if yes, evrery month the active news will be archived", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[auto_archive]", "$config_auto_archive")); showRow("Auto-Archive every Month", "if yes, evrery month the active news will be archived", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[auto_archive]", "$config_auto_archive"));
showRow("Allow Self-Registration", "allow users to auto-register", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[allow_registration]", "$config_allow_registration")); showRow("Allow Self-Registration", "allow users to auto-register", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[allow_registration]", "$config_allow_registration"));
showRow("Self-Registration Level", "with what access level are users auto-registerd ?", makeDropDown(array("3"=>"Journalist","4"=>"Commenter"), "save_con[registration_level]", "$config_registration_level")); showRow("Self-Registration Level", "with what access level are users auto-registerd ?", makeDropDown(array("3"=>"Journalist","4"=>"Commenter"), "save_con[registration_level]", "$config_registration_level"));
echo"</table></td></tr>"; echo"</table></td></tr>";
// News // News
echo"<tr style='display:none' id=news width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>"; echo"<tr style='display:none' id=news width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
showRow("Use Avatars", "if not, the avatar URL field wont be shown", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_avatar]", "$config_use_avatar")); showRow("Use Avatars", "if not, the avatar URL field wont be shown", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_avatar]", "$config_use_avatar"));
showRow("Use WYSIWYG Editor","use (or not) the advanced editor", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_wysiwyg]", "$config_use_wysiwyg")); showRow("Use WYSIWYG Editor","use (or not) the advanced editor", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_wysiwyg]", "$config_use_wysiwyg"));
showRow("Reverse News", "if yes, older news will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_active]", "$config_reverse_active")); showRow("Reverse News", "if yes, older news will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_active]", "$config_reverse_active"));
showRow("Time Format For News", "view help for time formatting <a href=\"http://www.php.net/manual/en/function.date.php\" target=\"_blank\">here</a>", "<input type=text style=\"text-align: center;\" name='save_con[timestamp_active]' value='$config_timestamp_active' size=40>"); showRow("Time Format For News", "view help for time formatting <a href=\"http://www.php.net/manual/en/function.date.php\" target=\"_blank\">here</a>", "<input type=text style=\"text-align: center;\" name='save_con[timestamp_active]' value='$config_timestamp_active' size=40>");
showRow("Show Full Story In PopUp", "full Story will be opened in PopUp window", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[full_popup]", "$config_full_popup")); showRow("Show Full Story In PopUp", "full Story will be opened in PopUp window", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[full_popup]", "$config_full_popup"));
showRow("Settings for Full Story PopUp", "only if 'Show Full Story In PopUp' is enabled", "<input type=text style=\"text-align: center;\" name='save_con[full_popup_string]' value=\"$config_full_popup_string\" size=40>"); showRow("Settings for Full Story PopUp", "only if 'Show Full Story In PopUp' is enabled", "<input type=text style=\"text-align: center;\" name='save_con[full_popup_string]' value=\"$config_full_popup_string\" size=40>");
showRow("Show Comments When Showing Full Story", "if yes, comments will be shown under the story", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[show_comments_with_full]", "$config_show_comments_with_full")); showRow("Show Comments When Showing Full Story", "if yes, comments will be shown under the story", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[show_comments_with_full]", "$config_show_comments_with_full"));
echo"</table></td></tr>"; echo"</table></td></tr>";
// Comments // Comments
echo"<tr style='display:none' id=comments width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>"; echo"<tr style='display:none' id=comments width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
showRow("Auto Wrap Comments", "any word that is longer than this will be wrapped", "<input type=text style=\"text-align: center;\" name='save_con[auto_wrap]' value=\"$config_auto_wrap\" size=10>"); showRow("Auto Wrap Comments", "any word that is longer than this will be wrapped", "<input type=text style=\"text-align: center;\" name='save_con[auto_wrap]' value=\"$config_auto_wrap\" size=10>");
showRow("Reverse Comments", "if yes, newest comments will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_comments]", "$config_reverse_comments")); showRow("Reverse Comments", "if yes, newest comments will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_comments]", "$config_reverse_comments"));
showRow("Comments Flood Protection", "in seconds; 0 = no protection", "<input type=text style=\"text-align: center;\" name='save_con[flood_time]' value=\"$config_flood_time\" size=10>"); showRow("Comments Flood Protection", "in seconds; 0 = no protection", "<input type=text style=\"text-align: center;\" name='save_con[flood_time]' value=\"$config_flood_time\" size=10>");
showRow("Max. Length of Comments in Characters", "enter <b>0</b> to disable checking", "<input type=text style=\"text-align: center;\" name='save_con[comment_max_long]' value='$config_comment_max_long' size=10>"); showRow("Max. Length of Comments in Characters", "enter <b>0</b> to disable checking", "<input type=text style=\"text-align: center;\" name='save_con[comment_max_long]' value='$config_comment_max_long' size=10>");
showRow("Comments Per Page (Pagination)", "enter <b>0</b> or leave empty to disable pagination", "<input type=text style=\"text-align: center;\" name='save_con[comments_per_page]' value='$config_comments_per_page' size=10>"); showRow("Comments Per Page (Pagination)", "enter <b>0</b> or leave empty to disable pagination", "<input type=text style=\"text-align: center;\" name='save_con[comments_per_page]' value='$config_comments_per_page' size=10>");
showRow("Only Registered Users Can Post Comments", "if yes, only registered users can post comments", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[only_registered_comment]", "$config_only_registered_comment")); showRow("Only Registered Users Can Post Comments", "if yes, only registered users can post comments", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[only_registered_comment]", "$config_only_registered_comment"));
showRow("Allow Mail Field to Act and as URL Field", "visitors will be able to put their site URL insted of mail", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[allow_url_instead_mail]", "$config_allow_url_instead_mail")); showRow("Allow Mail Field to Act and as URL Field", "visitors will be able to put their site URL insted of mail", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[allow_url_instead_mail]", "$config_allow_url_instead_mail"));
showRow("Time Format For Comments", "view help for time formatting <a href=\"http://www.php.net/manual/en/function.date.php\" target=\"_blank\">here</a>", "<input type=text style=\"text-align: center;\" name='save_con[timestamp_comment]' value='$config_timestamp_comment' size=40>"); showRow("Time Format For Comments", "view help for time formatting <a href=\"http://www.php.net/manual/en/function.date.php\" target=\"_blank\">here</a>", "<input type=text style=\"text-align: center;\" name='save_con[timestamp_comment]' value='$config_timestamp_comment' size=40>");
showRow("Show Comments In PopUp", "comments will be opened in PopUp window", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[comments_popup]", "$config_comments_popup")); showRow("Show Comments In PopUp", "comments will be opened in PopUp window", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[comments_popup]", "$config_comments_popup"));
showRow("Settings for Comments PopUp", "only if 'Show Comments In PopUp' is enabled", "<input type=text style=\"text-align: center;\" name=\"save_con[comments_popup_string]\" value=\"$config_comments_popup_string\" size=40>"); showRow("Settings for Comments PopUp", "only if 'Show Comments In PopUp' is enabled", "<input type=text style=\"text-align: center;\" name=\"save_con[comments_popup_string]\" value=\"$config_comments_popup_string\" size=40>");
showRow("Show Full Story When Showing Comments", "if yes, comments will be shown under the story", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[show_full_with_comments]", "$config_show_full_with_comments")); showRow("Show Full Story When Showing Comments", "if yes, comments will be shown under the story", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[show_full_with_comments]", "$config_show_full_with_comments"));
echo"</table></td></tr>"; echo"</table></td></tr>";
// Notifications // Notifications
echo"<tr style='display:none' id=notifications width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>"; echo"<tr style='display:none' id=notifications width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
showRow("Email(s)", "Where the notification will be send, separate multyple emails by comma", "<input type=text style=\"text-align: center;\" name='save_con[notify_email]' value=\"$config_notify_email\" size=40>"); showRow("Email(s)", "Where the notification will be send, separate multyple emails by comma", "<input type=text style=\"text-align: center;\" name='save_con[notify_email]' value=\"$config_notify_email\" size=40>");
showRow("Notifications - Active/Disabled", "global status of notifications", makeDropDown(array("active"=>"Active","disabled"=>"Disabled"), "save_con[notify_status]", "$config_notify_status")); showRow("Notifications - Active/Disabled", "global status of notifications", makeDropDown(array("active"=>"Active","disabled"=>"Disabled"), "save_con[notify_status]", "$config_notify_status"));
showRow("Notify of New Registrations", "when new user auto-registers", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_registration]", "$config_notify_registration")); showRow("Notify of New Registrations", "when new user auto-registers", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_registration]", "$config_notify_registration"));
showRow("Notify of New Comments", "when new comment is added", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_comment]", "$config_notify_comment")); showRow("Notify of New Comments", "when new comment is added", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_comment]", "$config_notify_comment"));
showRow("Notify of Unapproved News", "when unapproved article is posted (by journalists)", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_unapproved]", "$config_notify_unapproved")); showRow("Notify of Unapproved News", "when unapproved article is posted (by journalists)", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_unapproved]", "$config_notify_unapproved"));
showRow("Notify of Auto-Archiving", "when (if) news are auto-archived", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_archive]", "$config_notify_archive")); showRow("Notify of Auto-Archiving", "when (if) news are auto-archived", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_archive]", "$config_notify_archive"));
showRow("Notify of Activated Postponed Articles", "when postponed article is activated", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_postponed]", "$config_notify_postponed")); showRow("Notify of Activated Postponed Articles", "when postponed article is activated", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_postponed]", "$config_notify_postponed"));
echo"</table></td></tr>"; echo"</table></td></tr>";
echo" echo"
<input type=hidden name=mod value=options> <input type=hidden name=mod value=options>
<input type=hidden name=action value=dosavesyscon>". <input type=hidden name=action value=dosavesyscon>".
showRow("","","<br /><input style='font-weight:bold;font-size:120%;' type=submit value=\" Save Changes \" accesskey=\"s\">")." showRow("","","<br /><input style='font-weight:bold;font-size:120%;' type=submit value=\" Save Changes \" accesskey=\"s\">")."
</form></table>"; </form></table>";
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Save System Configuration // Save System Configuration
// ******************************************************************************** // ********************************************************************************
elseif($action == "dosavesyscon") elseif($action == "dosavesyscon")
{ {
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); }
$handler = fopen("./data/config.php", "w"); $handler = fopen("./data/config.php", "w");
fwrite($handler, "<?PHP \n\n//System Configurations (Auto Generated file)\n\n"); fwrite($handler, "<?PHP \n\n//System Configurations (Auto Generated file)\n\n");
foreach($save_con as $name=>$value) foreach($save_con as $name=>$value)
{ {
fwrite($handler, "\$config_$name = \"".htmlspecialchars($value)."\";\n\n"); fwrite($handler, "\$config_$name = \"".htmlspecialchars($value)."\";\n\n");
} }
fwrite($handler, "?>"); fwrite($handler, "?>");
fclose($handler); fclose($handler);
include("./skins/".$save_con["skin"].".skin.php"); include("./skins/".$save_con["skin"].".skin.php");
msg("info", "Configurations Saved", "The System Configurations were successfully saved."); msg("info", "Configurations Saved", "The System Configurations were successfully saved.");
} }
?> ?>
<HTML> <HTML>
<TITLE>Preview</TITLE> <TITLE>Preview</TITLE>
<BODY> <BODY>
<center> <center>
<?PHP <?PHP
require("./data/Default.tpl"); require("./data/Default.tpl");
$cat_lines = @file("./data/category.db.php"); $cat_lines = @file("./data/category.db.php");
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$cat[$cat_arr[0]] = $cat_arr[1]; $cat[$cat_arr[0]] = $cat_arr[1];
$cat_icon[$cat_arr[0]]=$cat_arr[2]; $cat_icon[$cat_arr[0]]=$cat_arr[2];
} }
if($manual_avatar != ""){ $avatar = $manual_avatar; } if($manual_avatar != ""){ $avatar = $manual_avatar; }
elseif( $select_avatar != "" and $select_avatar != "none" ){ $avatar = $select_avatar; } elseif( $select_avatar != "" and $select_avatar != "none" ){ $avatar = $select_avatar; }
else{ $avatar = ""; } else{ $avatar = ""; }
if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; } if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; }
if($if_use_html == "yes"){ $use_html = TRUE; } if($if_use_html == "yes"){ $use_html = TRUE; }
$full_story = replace_news("add", $full_story, $n_to_br, $use_html); $full_story = replace_news("add", $full_story, $n_to_br, $use_html);
$short_story = replace_news("add", $short_story, $n_to_br, $use_html); $short_story = replace_news("add", $short_story, $n_to_br, $use_html);
$title = replace_news("add", $title, TRUE, $use_html); $title = replace_news("add", $title, TRUE, $use_html);
if($member_db[4] != ""){ if($member_db[4] != ""){
if($member_db[7] != 1 and $member_db[5] != ""){ $author = "<a href=mailto:$member_db[5]>$member_db[4]</a>"; } if($member_db[7] != 1 and $member_db[5] != ""){ $author = "<a href=mailto:$member_db[5]>$member_db[4]</a>"; }
else{ $author = "$member_db[4]"; } else{ $author = "$member_db[4]"; }
}else{ }else{
if($member_db[7] != 1 and $member_db[5] != ""){ $author = "<a href=mailto:$member_db[5]>$member_db[2]</a>"; } if($member_db[7] != 1 and $member_db[5] != ""){ $author = "<a href=mailto:$member_db[5]>$member_db[2]</a>"; }
else{ $author = "$member_db[2]"; } else{ $author = "$member_db[2]"; }
} }
$output = $template_active; $output = $template_active;
$output = str_replace("{title}", $title, $output); $output = str_replace("{title}", $title, $output);
$output = str_replace("{date}", date($config_timestamp_active, time()), $output); $output = str_replace("{date}", date($config_timestamp_active, time()), $output);
$output = str_replace("{author}", $author, $output); $output = str_replace("{author}", $author, $output);
if($avatar != ""){$output = str_replace("{avatar}", "<img src=\"$avatar\" border=0>", $output); } if($avatar != ""){$output = str_replace("{avatar}", "<img src=\"$avatar\" border=0>", $output); }
else{ $output = str_replace("{avatar}", "", $output); } else{ $output = str_replace("{avatar}", "", $output); }
$output = str_replace("[link]","<a href=#>", $output); $output = str_replace("[link]","<a href=#>", $output);
$output = str_replace("[/link]","</a>", $output); $output = str_replace("[/link]","</a>", $output);
$output = str_replace("{comments-num}", countComments($id), $output); $output = str_replace("{comments-num}", countComments($id), $output);
$output = str_replace("{short-story}", $short_story, $output); $output = str_replace("{short-story}", $short_story, $output);
$output = str_replace("{full-story}", $full_story, $output); $output = str_replace("{full-story}", $full_story, $output);
if($full_story){ if($full_story){
$output = str_replace("[full-link]", "<a href=#>", $output); } $output = str_replace("[full-link]", "<a href=#>", $output); }
else{ else{
$output = preg_replace("'\[full-link\].*?\[/full-link\]'","", $output); $output = preg_replace("'\[full-link\].*?\[/full-link\]'","", $output);
} }
$output = str_replace("[/full-link]", "</a>", $output); $output = str_replace("[/full-link]", "</a>", $output);
$output = str_replace("[com-link]", "<a href=#>", $output); $output = str_replace("[com-link]", "<a href=#>", $output);
$output = str_replace("[/com-link]", "</a>", $output); $output = str_replace("[/com-link]", "</a>", $output);
$output = str_replace("{category}", $cat[$category], $output); $output = str_replace("{category}", $cat[$category], $output);
$output = str_replace("{category-id}", $category, $output); $output = str_replace("{category-id}", $category, $output);
if($cat_icon[$category] != ""){ $output = str_replace("{category-icon}", "<img border=0 src=\"".$cat_icon[$category]."\">", $output); } if($cat_icon[$category] != ""){ $output = str_replace("{category-icon}", "<img border=0 src=\"".$cat_icon[$category]."\">", $output); }
else{ $output = str_replace("{category-icon}", "", $output); } else{ $output = str_replace("{category-icon}", "", $output); }
$output = str_replace("{author-name}", $member_db[2], $output); $output = str_replace("{author-name}", $member_db[2], $output);
if($member_db[5] != ""){ if($member_db[5] != ""){
$output = str_replace("[mail]","<a href=\"mailto:". $member_db[5] ."\">", $output); $output = str_replace("[mail]","<a href=\"mailto:". $member_db[5] ."\">", $output);
$output = str_replace("[/mail]","</a>", $output); $output = str_replace("[/mail]","</a>", $output);
}else{ }else{
$output = str_replace("[mail]","", $output); $output = str_replace("[mail]","", $output);
$output = str_replace("[/mail]","", $output); $output = str_replace("[/mail]","", $output);
} }
$output = str_replace("{news-id}", "ID Unknown", $output); $output = str_replace("{news-id}", "ID Unknown", $output);
$output = str_replace("{archive-id}", $archive, $output); $output = str_replace("{archive-id}", $archive, $output);
$output = str_replace("{php-self}", $PHP_SELF, $output); $output = str_replace("{php-self}", $PHP_SELF, $output);
$output = str_replace("{cute-http-path}", $config_http_script_dir, $output); $output = str_replace("{cute-http-path}", $config_http_script_dir, $output);
$output = replace_news("show", $output); $output = replace_news("show", $output);
echo("<fieldset style=\"border-style:solid; border-width:1; border-color:black;\"><legend> <span style=\"font-size: 13px;\">Active News:</span> </legend>".$output."</fieldset>"); echo("<fieldset style=\"border-style:solid; border-width:1; border-color:black;\"><legend> <span style=\"font-size: 13px;\">Active News:</span> </legend>".$output."</fieldset>");
if($full_story){ if($full_story){
$output = $template_full; $output = $template_full;
$output = str_replace("{title}", $title, $output); $output = str_replace("{title}", $title, $output);
$output = str_replace("{date}", date($config_timestamp_active, time()), $output); $output = str_replace("{date}", date($config_timestamp_active, time()), $output);
$output = str_replace("{author}", $author, $output); $output = str_replace("{author}", $author, $output);
if($avatar != ""){$output = str_replace("{avatar}", "<img src=\"$avatar\" border=0>", $output); } if($avatar != ""){$output = str_replace("{avatar}", "<img src=\"$avatar\" border=0>", $output); }
else{ $output = str_replace("{avatar}", "", $output); } else{ $output = str_replace("{avatar}", "", $output); }
$output = str_replace("[link]","<a href=#>", $output); $output = str_replace("[link]","<a href=#>", $output);
$output = str_replace("[/link]","</a>", $output); $output = str_replace("[/link]","</a>", $output);
$output = str_replace("{comments-num}", countComments($id), $output); $output = str_replace("{comments-num}", countComments($id), $output);
$output = str_replace("{short-story}", $short_story, $output); $output = str_replace("{short-story}", $short_story, $output);
$output = str_replace("{full-story}", $full_story, $output); $output = str_replace("{full-story}", $full_story, $output);
if($full_story){ if($full_story){
$output = str_replace("[full-link]", "<a href=#>", $output); } $output = str_replace("[full-link]", "<a href=#>", $output); }
else{ else{
$output = preg_replace("'\[full-link\].*?\[/full-link\]'","", $output); $output = preg_replace("'\[full-link\].*?\[/full-link\]'","", $output);
} }
$output = str_replace("[/full-link]", "</a>", $output); $output = str_replace("[/full-link]", "</a>", $output);
$output = str_replace("[com-link]", "<a href=#>", $output); $output = str_replace("[com-link]", "<a href=#>", $output);
$output = str_replace("[/com-link]", "</a>", $output); $output = str_replace("[/com-link]", "</a>", $output);
$output = str_replace("{category}", $cat[$category], $output); $output = str_replace("{category}", $cat[$category], $output);
$output = str_replace("{category-id}", $category, $output); $output = str_replace("{category-id}", $category, $output);
if($cat_icon[$category] != ""){ $output = str_replace("{category-icon}", "<img border=0 src=\"".$cat_icon[$category]."\">", $output); } if($cat_icon[$category] != ""){ $output = str_replace("{category-icon}", "<img border=0 src=\"".$cat_icon[$category]."\">", $output); }
else{ $output = str_replace("{category-icon}", "", $output); } else{ $output = str_replace("{category-icon}", "", $output); }
$output = str_replace("{author-name}", $member_db[2], $output); $output = str_replace("{author-name}", $member_db[2], $output);
if($member_db[5] != ""){ if($member_db[5] != ""){
$output = str_replace("[mail]","<a href=\"mailto:". $member_db[5] ."\">", $output); $output = str_replace("[mail]","<a href=\"mailto:". $member_db[5] ."\">", $output);
$output = str_replace("[/mail]","</a>", $output); $output = str_replace("[/mail]","</a>", $output);
}else{ }else{
$output = str_replace("[mail]","", $output); $output = str_replace("[mail]","", $output);
$output = str_replace("[/mail]","", $output); $output = str_replace("[/mail]","", $output);
} }
$output = str_replace("{news-id}", "ID Unknown", $output); $output = str_replace("{news-id}", "ID Unknown", $output);
$output = str_replace("{archive-id}", $archive, $output); $output = str_replace("{archive-id}", $archive, $output);
$output = str_replace("{php-self}", $PHP_SELF, $output); $output = str_replace("{php-self}", $PHP_SELF, $output);
$output = str_replace("{cute-http-path}", $config_http_script_dir, $output); $output = str_replace("{cute-http-path}", $config_http_script_dir, $output);
$output = replace_news("show", $output); $output = replace_news("show", $output);
echo("<br /><fieldset style=\"border-style:solid; border-width:1; border-color:black;\"><legend> <span style=\"font-size: 13px;\">Full Story:</span> </legend>".$output."</fieldset>"); echo("<br /><fieldset style=\"border-style:solid; border-width:1; border-color:black;\"><legend> <span style=\"font-size: 13px;\">Full Story:</span> </legend>".$output."</fieldset>");
} }
?> ?>
</center> </center>
</BODY> </BODY>
</HTML> </HTML>
<?PHP <?PHP
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); }
$success = FALSE; $success = FALSE;
// ******************************************************************************** // ********************************************************************************
// Archive // Archive
// ******************************************************************************** // ********************************************************************************
if($action == "archive") if($action == "archive")
{ {
// *************************** // ***************************
// Un-Archive // Un-Archive
// *************************** // ***************************
if($subaction == "unarchive" and $aid != "" and isset($aid)){ if($subaction == "unarchive" and $aid != "" and isset($aid)){
if(!$handle = opendir("$cutepath/data/archives")){ die("<center>Unable to open directory $cutepath/data/archive</center>"); } if(!$handle = opendir("$cutepath/data/archives")){ die("<center>Unable to open directory $cutepath/data/archive</center>"); }
while (false !== ($file = readdir($handle))) while (false !== ($file = readdir($handle)))
{ {
if ($file == "$aid.news.arch") if ($file == "$aid.news.arch")
{ {
$newsfile = fopen("$cutepath/data/news.txt", 'a'); $newsfile = fopen("$cutepath/data/news.txt", 'a');
$newsarch = file("$cutepath/data/archives/$file"); $newsarch = file("$cutepath/data/archives/$file");
foreach ($newsarch as $newsline) foreach ($newsarch as $newsline)
{ {
fwrite($newsfile,$newsline); fwrite($newsfile,$newsline);
} }
fclose($newsfile); fclose($newsfile);
unlink("$cutepath/data/archives/$file"); unlink("$cutepath/data/archives/$file");
} }
elseif ($file == "$aid.comments.arch") elseif ($file == "$aid.comments.arch")
{ {
$commfile = fopen("$cutepath/data/comments.txt", 'a'); $commfile = fopen("$cutepath/data/comments.txt", 'a');
$commarch = file("$cutepath/data/archives/$file"); $commarch = file("$cutepath/data/archives/$file");
foreach ($commarch as $commline) foreach ($commarch as $commline)
{ {
fwrite($commfile,$commline); fwrite($commfile,$commline);
} }
fclose($commfile); fclose($commfile);
unlink("$cutepath/data/archives/$file"); unlink("$cutepath/data/archives/$file");
} }
} }
closedir($handle); closedir($handle);
}//end Un-Archive function }//end Un-Archive function
echoheader("archives", "Archives"); echoheader("archives", "Archives");
echo<<<HTML echo<<<HTML
<script language="javascript"> <script language="javascript">
function confirmdelete(id,news){ function confirmdelete(id,news){
var agree=confirm("Do you really want to permanently delete this archive ?\\nAll ("+news+") news and comments in it will be deleted."); var agree=confirm("Do you really want to permanently delete this archive ?\\nAll ("+news+") news and comments in it will be deleted.");
if (agree) if (agree)
document.location="$PHP_SELF?mod=tools&action=dodeletearchive&archive="+id; document.location="$PHP_SELF?mod=tools&action=dodeletearchive&archive="+id;
} }
</script> </script>
<form method=post action="$PHP_SELF"><table border=0 cellpading=0 cellspacing=0 width="645" > <form method=post action="$PHP_SELF"><table border=0 cellpading=0 cellspacing=0 width="645" >
<td width=321 height="33"> <td width=321 height="33">
<b>Send news to archive</b> <b>Send news to archive</b>
<table border=0 cellpading=0 cellspacing=0 width=300 class="panel" cellpadding="10" > <table border=0 cellpading=0 cellspacing=0 width=300 class="panel" cellpadding="10" >
<tr> <tr>
<td width=304 height="25"> <td width=304 height="25">
<p align="center"> <p align="center">
<input type=submit value="Proceed with archiving ..."> <input type=submit value="Proceed with archiving ...">
</tr> </tr>
</table> </table>
<input type=hidden name=action value=doarchive> <input type=hidden name=action value=doarchive>
<input type=hidden name=mod value=tools> <input type=hidden name=mod value=tools>
</form> </form>
<td width=320 height="33" align="center"> <td width=320 height="33" align="center">
<!-- HELP --> <!-- HELP -->
<table height="25" cellspacing="0" cellpadding="0"> <table height="25" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td> <td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td>
<td >&nbsp;<a onClick="javascript:Help('archives')" href="#">Explaining archives and<br> <td >&nbsp;<a onClick="javascript:Help('archives')" href="#">Explaining archives and<br>
&nbsp;Their usage</a></td> &nbsp;Their usage</a></td>
</tr> </tr>
</table> </table>
<tr> <tr>
<td width=654 colspan="2" height="11"> <td width=654 colspan="2" height="11">
<img height=20 border=0 src="skins/images/blank.gif" width=1> <img height=20 border=0 src="skins/images/blank.gif" width=1>
<br> </tr> <br> </tr>
<tr> <tr>
<td width=654 colspan=2 height=14> <td width=654 colspan=2 height=14>
<b>Available archives</b> <b>Available archives</b>
</tr> </tr>
<tr> <tr>
<td width=654 colspan=2 height=1> <td width=654 colspan=2 height=1>
<table width=641 height=100% cellspacing=0 cellpadding=0> <table width=641 height=100% cellspacing=0 cellpadding=0>
<tr> <tr>
<td width=8 bgcolor=#F7F6F4>&nbsp;</td> <td width=8 bgcolor=#F7F6F4>&nbsp;</td>
<td width=160 bgcolor=#F7F6F4><u>archivation date</u></td> <td width=160 bgcolor=#F7F6F4><u>archivation date</u></td>
<td width=222 bgcolor=#F7F6F4><u>duration</u></td> <td width=222 bgcolor=#F7F6F4><u>duration</u></td>
<td width=81 bgcolor=#F7F6F4><u>news</u></td> <td width=81 bgcolor=#F7F6F4><u>news</u></td>
<td width=110 bgcolor=#F7F6F4><u><!--action--></u></td> <td width=110 bgcolor=#F7F6F4><u><!--action--></u></td>
</tr> </tr>
HTML; HTML;
if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory $cutepath/data/archives "); } if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory $cutepath/data/archives "); }
while (false !== ($file = readdir($handle))) while (false !== ($file = readdir($handle)))
{ {
if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file)) if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file))
{ {
$file_arr = explode(".", $file); $file_arr = explode(".", $file);
$id = $file_arr[0]; $id = $file_arr[0];
$news_lines = file("./data/archives/$file"); $news_lines = file("./data/archives/$file");
$creation_date = date("d F Y",$file_arr[0]); $creation_date = date("d F Y",$file_arr[0]);
$count = count($news_lines); $count = count($news_lines);
$last = $count-1; $last = $count-1;
$first_news_arr = explode("|", $news_lines[$last]); $first_news_arr = explode("|", $news_lines[$last]);
$last_news_arr = explode("|", $news_lines[0]); $last_news_arr = explode("|", $news_lines[0]);
$first_timestamp = $first_news_arr[0]; $first_timestamp = $first_news_arr[0];
$last_timestamp = $last_news_arr[0]; $last_timestamp = $last_news_arr[0];
$duration = (date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp) ); $duration = (date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp) );
echo " echo "
<tr> <tr>
<td ></td> <td ></td>
<td >$creation_date</td> <td >$creation_date</td>
<td >$duration</td> <td >$duration</td>
<td >$count</td> <td >$count</td>
<td ><a title='Edit the news in this archive' href=\"$PHP_SELF?mod=editnews&action=list&source=$id\">[edit]</a> <a title='restore news from this archive to active news' href=\"$PHP_SELF?mod=tools&action=archive&subaction=unarchive&aid=$id\">[unarchive]</a> <a title='Delete this archive' onClick=\"javascript:confirmdelete('$id', '$count');\" href=\"#\">[delete]</a></td> <td ><a title='Edit the news in this archive' href=\"$PHP_SELF?mod=editnews&action=list&source=$id\">[edit]</a> <a title='restore news from this archive to active news' href=\"$PHP_SELF?mod=tools&action=archive&subaction=unarchive&aid=$id\">[unarchive]</a> <a title='Delete this archive' onClick=\"javascript:confirmdelete('$id', '$count');\" href=\"#\">[delete]</a></td>
</tr> </tr>
"; ";
} }
} }
closedir($handle); closedir($handle);
if($count == 0){ if($count == 0){
echo"<tr><td align=center colspan=6><br>There are no archives</td></tr>"; echo"<tr><td align=center colspan=6><br>There are no archives</td></tr>";
} }
echo<<<HTML echo<<<HTML
</table> </table>
</table> </table>
HTML; HTML;
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Make Archive // Make Archive
// ******************************************************************************** // ********************************************************************************
elseif($action == "doarchive") elseif($action == "doarchive")
{ {
if(filesize("./data/news.txt") == 0){ msg("error", "Error !!!", "Sorry but there are no news to be archived", "$PHP_SELF?mod=tools&action=archive"); } if(filesize("./data/news.txt") == 0){ msg("error", "Error !!!", "Sorry but there are no news to be archived", "$PHP_SELF?mod=tools&action=archive"); }
if(filesize("./data/comments.txt") == 0){ msg("error", "Error !!!", "The comments file is empty and can not be archived", "$PHP_SELF?mod=tools&action=archive"); } if(filesize("./data/comments.txt") == 0){ msg("error", "Error !!!", "The comments file is empty and can not be archived", "$PHP_SELF?mod=tools&action=archive"); }
$arch_name = time()+($config_date_adjust*60); $arch_name = time()+($config_date_adjust*60);
if(!@copy("./data/news.txt","./data/archives/$arch_name.news.arch")) { msg("error","Error !!!","Can not create file ./data/archives/$arch_name.news.arch", "$PHP_SELF?mod=tools&action=archive");} if(!@copy("./data/news.txt","./data/archives/$arch_name.news.arch")) { msg("error","Error !!!","Can not create file ./data/archives/$arch_name.news.arch", "$PHP_SELF?mod=tools&action=archive");}
if(!@copy("./data/comments.txt","./data/archives/$arch_name.comments.arch")) { msg("error","Error !!!","Can not create file ./data/archives/$arch_name.comments.arch", "$PHP_SELF?mod=tools&action=archive");} if(!@copy("./data/comments.txt","./data/archives/$arch_name.comments.arch")) { msg("error","Error !!!","Can not create file ./data/archives/$arch_name.comments.arch", "$PHP_SELF?mod=tools&action=archive");}
$handle = fopen("./data/news.txt","w"); $handle = fopen("./data/news.txt","w");
fclose($handle); fclose($handle);
$handle = fopen("./data/comments.txt","w"); $handle = fopen("./data/comments.txt","w");
fclose($handle); fclose($handle);
msg("archives", "Archive Saved", "&nbsp&nbsp; All active news were successfully added to archives file with name <b>$arch_name.news.arch</b>", "$PHP_SELF?mod=tools&action=archive"); msg("archives", "Archive Saved", "&nbsp&nbsp; All active news were successfully added to archives file with name <b>$arch_name.news.arch</b>", "$PHP_SELF?mod=tools&action=archive");
} }
// ******************************************************************************** // ********************************************************************************
// Do Delete Archive // Do Delete Archive
// ******************************************************************************** // ********************************************************************************
elseif($action == "dodeletearchive"){ elseif($action == "dodeletearchive"){
$success = 0; $success = 0;
if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory $cutepath/data/archive "); } if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory $cutepath/data/archive "); }
while (false !== ($file = readdir($handle))){ while (false !== ($file = readdir($handle))){
if($file == "$archive.news.arch" or $file == "$archive.comments.arch"){ if($file == "$archive.news.arch" or $file == "$archive.comments.arch"){
unlink("./data/archives/$file"); $success ++; unlink("./data/archives/$file"); $success ++;
} }
} }
closedir($handle); closedir($handle);
if($success == 2){ if($success == 2){
msg("info", "Arhcive Deleted", "The archive was successfully deleted", "$PHP_SELF?mod=tools&action=archive"); msg("info", "Arhcive Deleted", "The archive was successfully deleted", "$PHP_SELF?mod=tools&action=archive");
}elseif($success == 1){ }elseif($success == 1){
msg("error", "Error !!!", "Either the comments part or the news part of the archive was not deleted", "$PHP_SELF?mod=tools&action=archive"); msg("error", "Error !!!", "Either the comments part or the news part of the archive was not deleted", "$PHP_SELF?mod=tools&action=archive");
}else{ }else{
msg("error", "Error !!!", "The archive you specified was not deleted, it is not on the server or you don't have permissions to delete it", "$PHP_SELF?mod=tools&action=archive"); msg("error", "Error !!!", "The archive you specified was not deleted, it is not on the server or you don't have permissions to delete it", "$PHP_SELF?mod=tools&action=archive");
} }
} }
// ******************************************************************************** // ********************************************************************************
// Backup News and archives // Backup News and archives
// ******************************************************************************** // ********************************************************************************
elseif($action == "backup") elseif($action == "backup")
{ {
echoheader("options", "Backup"); echoheader("options", "Backup");
echo' echo'
<script language="javascript"> <script language="javascript">
function confirmdelete(id){ function confirmdelete(id){
var agree=confirm("Do you really want to permanently delete this backup ?"); var agree=confirm("Do you really want to permanently delete this backup ?");
if (agree) if (agree)
document.location="index.php?mod=tools&action=dodeletebackup&backup="+id; document.location="index.php?mod=tools&action=dodeletebackup&backup="+id;
} }
function confirmrestore(id){ function confirmrestore(id){
var agree=confirm("Do you really want to restore your news from this backup ?\nAll current news and archives will be overwritten."); var agree=confirm("Do you really want to restore your news from this backup ?\nAll current news and archives will be overwritten.");
if (agree) if (agree)
document.location="index.php?mod=tools&action=dorestorebackup&backup="+id; document.location="index.php?mod=tools&action=dorestorebackup&backup="+id;
} }
</script> </script>
<table border=0 cellpading=0 cellspacing=0 width="645" > <table border=0 cellpading=0 cellspacing=0 width="645" >
<td width=321 height="33"> <td width=321 height="33">
<b>Create BackUp</b> <b>Create BackUp</b>
<table border=0 cellpading=0 cellspacing=0 class="panel" cellpadding="10" width="390" > <table border=0 cellpading=0 cellspacing=0 class="panel" cellpadding="10" width="390" >
<form method=post action="'.$PHP_SELF.'"> <form method=post action="'.$PHP_SELF.'">
<tr> <tr>
<td height="25" width="366"> <td height="25" width="366">
Name of the BackUp: <input type=text name=back_name>&nbsp; <input type=submit value=" Proceed "> Name of the BackUp: <input type=text name=back_name>&nbsp; <input type=submit value=" Proceed ">
</td> </td>
</tr> </tr>
<input type=hidden name=action value=dobackup> <input type=hidden name=action value=dobackup>
<input type=hidden name=mod value=tools> <input type=hidden name=mod value=tools>
</form> </form>
</table> </table>
<tr> <tr>
<td width=654 height="11"> <td width=654 height="11">
<img height=20 border=0 src="skins/images/blank.gif" width=1> <img height=20 border=0 src="skins/images/blank.gif" width=1>
<br> </tr> <br> </tr>
<tr> <tr>
<td width=654 height=14> <td width=654 height=14>
<b>Available BackUps</b> <b>Available BackUps</b>
</tr> </tr>
<tr> <tr>
<td width=654 height=1> <td width=654 height=1>
<table width=641 height=100% cellspacing=0 cellpadding=0> <table width=641 height=100% cellspacing=0 cellpadding=0>
<tr> <tr>
<td width=2% bgcolor=#F7F6F4>&nbsp;</td> <td width=2% bgcolor=#F7F6F4>&nbsp;</td>
<td width=40% bgcolor=#F7F6F4><u>name</u></td> <td width=40% bgcolor=#F7F6F4><u>name</u></td>
<td width=22% bgcolor=#F7F6F4><u>active news</u></td> <td width=22% bgcolor=#F7F6F4><u>active news</u></td>
<td width=16% bgcolor=#F7F6F4><u>archives</u></td> <td width=16% bgcolor=#F7F6F4><u>archives</u></td>
<td width=20% bgcolor=#F7F6F4><u>action</u></td> <td width=20% bgcolor=#F7F6F4><u>action</u></td>
</tr>'; </tr>';
$count = 0; $count = 0;
if(!$handle = opendir("./data/backup")){ die("<center>Can not open directory $cutepath/data/backup "); } if(!$handle = opendir("./data/backup")){ die("<center>Can not open directory $cutepath/data/backup "); }
while (false !== ($file = readdir($handle))) while (false !== ($file = readdir($handle)))
{ {
if($file != "." and $file != ".." and is_dir("./data/backup/$file")) if($file != "." and $file != ".." and is_dir("./data/backup/$file"))
{ {
$archives_count = 0; $archives_count = 0;
$archives_handle = @opendir("./data/backup/$file/archives"); $archives_handle = @opendir("./data/backup/$file/archives");
while (false !== ($arch = readdir($archives_handle))){ while (false !== ($arch = readdir($archives_handle))){
if(eregi(".news.arch", $arch)){ $archives_count++; } if(eregi(".news.arch", $arch)){ $archives_count++; }
} }
closedir($archives_handle); closedir($archives_handle);
$news_count = count(file("./data/backup/$file/news.txt")); $news_count = count(file("./data/backup/$file/news.txt"));
echo "<tr> echo "<tr>
<td></td> <td></td>
<td>$file</td> <td>$file</td>
<td>&nbsp;$news_count</td> <td>&nbsp;$news_count</td>
<td>&nbsp;$archives_count</td> <td>&nbsp;$archives_count</td>
<td><a onClick=\"javascript:confirmdelete('$file'); return(false)\" href=\"$PHP_SELF?mod=tools&action=dodeletebackup&backup=$file\">[delete]</a> <a onClick=\"javascript:confirmrestore('$file'); return(false)\" href=\"$PHP_SELF?mod=tools&action=dorestorebackup&backup=$file\">[restore]</a></td> <td><a onClick=\"javascript:confirmdelete('$file'); return(false)\" href=\"$PHP_SELF?mod=tools&action=dodeletebackup&backup=$file\">[delete]</a> <a onClick=\"javascript:confirmrestore('$file'); return(false)\" href=\"$PHP_SELF?mod=tools&action=dorestorebackup&backup=$file\">[restore]</a></td>
</tr>"; </tr>";
$count++; $count++;
} }
} }
closedir($handle); closedir($handle);
if($count == 0){ if($count == 0){
echo"<tr><td colspan=5><p align=center><br>There are no backups</p></td></tr>"; echo"<tr><td colspan=5><p align=center><br>There are no backups</p></td></tr>";
} }
echo'</table></table>'; echo'</table></table>';
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Do Delete Backup // Do Delete Backup
// ******************************************************************************** // ********************************************************************************
elseif($action == "dodeletebackup") elseif($action == "dodeletebackup")
{ {
function listdir($dir){ function listdir($dir){
$current_dir = opendir($dir); $current_dir = opendir($dir);
while($entryname = readdir($current_dir)){ while($entryname = readdir($current_dir)){
if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){ if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){
listdir("${dir}/${entryname}"); listdir("${dir}/${entryname}");
}elseif($entryname != "." and $entryname!=".."){ }elseif($entryname != "." and $entryname!=".."){
unlink("${dir}/${entryname}"); unlink("${dir}/${entryname}");
} }
} }
@closedir($current_dir); @closedir($current_dir);
rmdir(${dir}); rmdir(${dir});
} }
listdir("./data/backup/$backup"); listdir("./data/backup/$backup");
msg("info", "Backup Deleted", "The backup was successfully deleted.", "$PHP_SELF?mod=tools&action=backup"); msg("info", "Backup Deleted", "The backup was successfully deleted.", "$PHP_SELF?mod=tools&action=backup");
} }
// ******************************************************************************** // ********************************************************************************
// Do restore backup // Do restore backup
// ******************************************************************************** // ********************************************************************************
elseif($action == "dorestorebackup"){ elseif($action == "dorestorebackup"){
if(!@copy("./data/backup/$backup/news.txt", "./data/news.txt")){ msg("error", "error", "./data/backup/$backup/news.txt", "$PHP_SELF?mod=tools&action=backup"); } if(!@copy("./data/backup/$backup/news.txt", "./data/news.txt")){ msg("error", "error", "./data/backup/$backup/news.txt", "$PHP_SELF?mod=tools&action=backup"); }
if(!@copy("./data/backup/$backup/comments.txt", "./data/comments.txt")){ msg("error", "error", "./data/backup/$backup/comments.txt", "$PHP_SELF?mod=tools&action=backup"); } if(!@copy("./data/backup/$backup/comments.txt", "./data/comments.txt")){ msg("error", "error", "./data/backup/$backup/comments.txt", "$PHP_SELF?mod=tools&action=backup"); }
$dirp = opendir("./data/backup/$backup/archives"); $dirp = opendir("./data/backup/$backup/archives");
while($entryname = readdir($dirp)){ while($entryname = readdir($dirp)){
if(!is_dir("./data/backup/$backup/archives/$entryname") and $entryname!="." and $entryname!=".."){ if(!is_dir("./data/backup/$backup/archives/$entryname") and $entryname!="." and $entryname!=".."){
if(!@copy("./data/backup/$backup/archives/$entryname", "./data/archives/$entryname")){ msg("error", "error", "Can not copy ./data/backup/$backup/archives/$entryname"); } if(!@copy("./data/backup/$backup/archives/$entryname", "./data/archives/$entryname")){ msg("error", "error", "Can not copy ./data/backup/$backup/archives/$entryname"); }
} }
} }
msg("info", "Backup Restored", "The backup was successfully restored.", "$PHP_SELF?mod=tools&action=backup"); msg("info", "Backup Restored", "The backup was successfully restored.", "$PHP_SELF?mod=tools&action=backup");
} }
// ******************************************************************************** // ********************************************************************************
// Make The BackUp // Make The BackUp
// ******************************************************************************** // ********************************************************************************
elseif($action == "dobackup") elseif($action == "dobackup")
{ {
$back_name = eregi_replace(" ", "-", $back_name); $back_name = eregi_replace(" ", "-", $back_name);
if(filesize("./data/news.txt") == 0){msg("error", "Error !!!", "The news file is empty and can not be backed-up", "$PHP_SELF?mod=tools&action=backup");} if(filesize("./data/news.txt") == 0){msg("error", "Error !!!", "The news file is empty and can not be backed-up", "$PHP_SELF?mod=tools&action=backup");}
if(filesize("./data/comments.txt") == 0){msg("error", "Error !!!", "The comments file is empty and can not be backed-up", "$PHP_SELF?mod=tools&action=backup");} if(filesize("./data/comments.txt") == 0){msg("error", "Error !!!", "The comments file is empty and can not be backed-up", "$PHP_SELF?mod=tools&action=backup");}
if(is_readable("./data/backup/$back_name")){ msg("error", "Error !!!", "A backup with this name already exist", "$PHP_SELF?mod=tools&action=backup"); } if(is_readable("./data/backup/$back_name")){ msg("error", "Error !!!", "A backup with this name already exist", "$PHP_SELF?mod=tools&action=backup"); }
if(!is_readable("./data/backup")){ mkdir("./backup", 0777); } if(!is_readable("./data/backup")){ mkdir("./backup", 0777); }
if(!is_writable("./data/backup")){ msg("error", "Error !!!", "The directory ./data/backup is not writable, please chmod it"); } if(!is_writable("./data/backup")){ msg("error", "Error !!!", "The directory ./data/backup is not writable, please chmod it"); }
mkdir("./data/backup/$back_name", 0777); mkdir("./data/backup/$back_name", 0777);
mkdir("./data/backup/$back_name/archives", 0777); mkdir("./data/backup/$back_name/archives", 0777);
if(!@copy("./data/news.txt", "./data/backup/$back_name/news.txt")){ die("Can not copy news.txt file to ./data/backup/$back_name :("); } if(!@copy("./data/news.txt", "./data/backup/$back_name/news.txt")){ die("Can not copy news.txt file to ./data/backup/$back_name :("); }
if(!@copy("./data/comments.txt","./data/backup/$back_name/comments.txt")){ die("Can not copy comments.txt file to ./data/backup/$back_name :("); } if(!@copy("./data/comments.txt","./data/backup/$back_name/comments.txt")){ die("Can not copy comments.txt file to ./data/backup/$back_name :("); }
if(!$handle = opendir("./data/archives")){ die("Can not create file"); } if(!$handle = opendir("./data/archives")){ die("Can not create file"); }
while(false !== ($file = readdir($handle))) while(false !== ($file = readdir($handle)))
{ {
if($file != "." and $file != "..") if($file != "." and $file != "..")
{ {
if(!@copy("./data/archives/$file", "./data/backup/$back_name/archives/$file")){ die("Can not copy archive file to ./data/backup/$back_name/archives/$file :("); } if(!@copy("./data/archives/$file", "./data/backup/$back_name/archives/$file")){ die("Can not copy archive file to ./data/backup/$back_name/archives/$file :("); }
} }
} }
closedir($handle); closedir($handle);
msg("info", "Backup", "All news and archives were successfully BackedUp under directory './data/backup/$back_name'", "$PHP_SELF?mod=tools&action=backup"); msg("info", "Backup", "All news and archives were successfully BackedUp under directory './data/backup/$back_name'", "$PHP_SELF?mod=tools&action=backup");
} }
?> ?>
<?PHP <?PHP
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); } if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); }
if($action == "" or !$action){ if($action == "" or !$action){
$wizard_options = <<<HTMLWIZARDS $wizard_options = <<<HTMLWIZARDS
<ol> <ol>
<li style="margin-bottom:5px;"><a href='$PHP_SELF?mod=wizards&action=rss'><b>Rss</b> Setup and Integration</a></li> <li style="margin-bottom:5px;"><a href='$PHP_SELF?mod=wizards&action=rss'><b>Rss</b> Setup and Integration</a></li>
<li><a href='$PHP_SELF?mod=wizards&action=news'>Integrate <b>News</b> into your site</a></li> <li><a href='$PHP_SELF?mod=wizards&action=news'>Integrate <b>News</b> into your site</a></li>
</ol> </ol>
HTMLWIZARDS; HTMLWIZARDS;
msg("wizard", "Choose Wizard", "$wizard_options"); msg("wizard", "Choose Wizard", "$wizard_options");
} }
// ******************************************************************************** // ********************************************************************************
// Initiate the News Integration Wizard // Initiate the News Integration Wizard
// ******************************************************************************** // ********************************************************************************
if($action == "news"){ if($action == "news"){
//Gather the Templates //Gather the Templates
$templates_list = array(); $templates_list = array();
if(!$handle = opendir("./data")){ /*die("<center>Can not open directory $cutepath/data ");*/ } if(!$handle = opendir("./data")){ /*die("<center>Can not open directory $cutepath/data ");*/ }
while (false !== ($file = readdir($handle))){ while (false !== ($file = readdir($handle))){
if(eregi(".tpl", $file)){ if(eregi(".tpl", $file)){
$file_arr = explode(".", $file); $file_arr = explode(".", $file);
$templates_list[]= $file_arr[0]; $templates_list[]= $file_arr[0];
} }
} }
closedir($handle); closedir($handle);
$templates_html = "<select name=w_template>"; $templates_html = "<select name=w_template>";
foreach($templates_list as $single_template){ foreach($templates_list as $single_template){
if($single_template != "rss"){ if($single_template != "rss"){
if($single_template == "Default"){ if($single_template == "Default"){
$templates_html .= "<option selected value=\"$single_template\">$single_template</option>"; $templates_html .= "<option selected value=\"$single_template\">$single_template</option>";
}else{ }else{
$templates_html .= "<option value=\"$single_template\">$single_template</option>"; $templates_html .= "<option value=\"$single_template\">$single_template</option>";
} }
} }
} }
$templates_html .= "</select>"; $templates_html .= "</select>";
//Gather the Categories //Gather the Categories
$cat_lines = file("./data/category.db.php"); $cat_lines = file("./data/category.db.php");
if($cat_lines){ if($cat_lines){
$cat_html = "<select style='display:;' name=w_category[] id=category multiple>"; $cat_html = "<select style='display:;' name=w_category[] id=category multiple>";
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$cat_html .= "<option value=\"$cat_arr[0]\">(ID:$cat_arr[0]) $cat_arr[1]</option>\n"; $cat_html .= "<option value=\"$cat_arr[0]\">(ID:$cat_arr[0]) $cat_arr[1]</option>\n";
} }
$cat_html .= "</select><br><label for=allcategory><input id=allcategory onClick=\"if(this.checked){getElementById('category').style.display='none';}else{getElementById('category').style.display='';}\" type=checkbox value='yes' name='w_allcategory'> Or Show from All Categories</label>"; $cat_html .= "</select><br><label for=allcategory><input id=allcategory onClick=\"if(this.checked){getElementById('category').style.display='none';}else{getElementById('category').style.display='';}\" type=checkbox value='yes' name='w_allcategory'> Or Show from All Categories</label>";
}else{ }else{
$cat_html = "You have no categories"; $cat_html = "You have no categories";
} }
echoheader("wizard", "News Integration Wizard"); echoheader("wizard", "News Integration Wizard");
echo<<<WIZARDHTML echo<<<WIZARDHTML
<table border=0 cellpading=0 cellspacing=0 width=100% height=100%><form method="post" action="$PHP_SELF"><tr><td > <table border=0 cellpading=0 cellspacing=0 width=100% height=100%><form method="post" action="$PHP_SELF"><tr><td >
<table cellspacing="0" cellpadding="3" width="645" height="100%" border="0" style="border-collapse: collapse" bordercolor="#111111"><tr> <table cellspacing="0" cellpadding="3" width="645" height="100%" border="0" style="border-collapse: collapse" bordercolor="#111111"><tr>
<td width="639" colspan="2"> <td width="639" colspan="2">
Welcome to the News Integration Wizard. This tool will help you to integrate the Welcome to the News Integration Wizard. This tool will help you to integrate the
news that you have published using CuteNews, into your existing Webpage. <br> news that you have published using CuteNews, into your existing Webpage. <br>
&nbsp;</td></tr> &nbsp;</td></tr>
<tr> <tr>
<td bgcolor="#F7F6F4" style="padding:3px; border-bottom:1px solid gray;" width="639" colspan="2"> <td bgcolor="#F7F6F4" style="padding:3px; border-bottom:1px solid gray;" width="639" colspan="2">
<b><font size="2">Quick Customization...</font></b></td> <b><font size="2">Quick Customization...</font></b></td>
</tr> </tr>
<tr> <tr>
<td width="356" > <td width="356" >
<b><br> <b><br>
Number of Active News to Display:</b></td> Number of Active News to Display:</b></td>
<td width="277" rowspan="2" valign="top" align="center"> <td width="277" rowspan="2" valign="top" align="center">
<br> <br>
<input style="text-align: center" name="w_number" size="11"></td> <input style="text-align: center" name="w_number" size="11"></td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px; "> <td width="356" style="padding-left:10px; ">
<p align="justify"><i>if the active news are less then the specified number to show, the rest of the <p align="justify"><i>if the active news are less then the specified number to show, the rest of the
news will be fetched from the archives (if any)</i></td> news will be fetched from the archives (if any)</i></td>
</tr> </tr>
<tr> <tr>
<td width="356" > <td width="356" >
<b><br> <b><br>
Template to Use When Displaying News:</b></td> Template to Use When Displaying News:</b></td>
<td width="277" rowspan="2" valign="top" align="center"> <td width="277" rowspan="2" valign="top" align="center">
<br> <br>
$templates_html $templates_html
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px; "> <td width="356" style="padding-left:10px; ">
<p align="justify"><i>using different templates you can customize the look of <p align="justify"><i>using different templates you can customize the look of
your news, comments etc.</i></td> your news, comments etc.</i></td>
</tr> </tr>
<tr> <tr>
<td width="356" > <td width="356" >
<b><br> <b><br>
Categories to Show News From:</b></td> Categories to Show News From:</b></td>
<td width="277" rowspan="2" valign="top" align="center"> <td width="277" rowspan="2" valign="top" align="center">
<br> <br>
$cat_html $cat_html
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px; "> <td width="356" style="padding-left:10px; ">
<p align="justify"><i>you can specify only from which categories news will be <p align="justify"><i>you can specify only from which categories news will be
displayed, hold CTRL to select multiple categories (if any)<br> displayed, hold CTRL to select multiple categories (if any)<br>
&nbsp;</i></td> &nbsp;</i></td>
</tr> </tr>
<tr> <tr>
<td bgcolor="#F7F6F4" style="padding:3px; border-bottom:1px solid gray; " width="639" colspan="2"> <td bgcolor="#F7F6F4" style="padding:3px; border-bottom:1px solid gray; " width="639" colspan="2">
<b><font size="2">Advanced Settings...</font></b></td> <b><font size="2">Advanced Settings...</font></b></td>
</tr> </tr>
<tr> <tr>
<td width="356" > <td width="356" >
<b><br> <b><br>
Start 'Displaying' From...</b></td> Start 'Displaying' From...</b></td>
<td width="277" rowspan="2" align="center" valign="top"> <td width="277" rowspan="2" align="center" valign="top">
<br> <br>
<input name="w_start_from" size="11" style="text-align: center"></td> <input name="w_start_from" size="11" style="text-align: center"></td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px; "> <td width="356" style="padding-left:10px; ">
<i>if Set, the displaying of the news will be started from the specified number <i>if Set, the displaying of the news will be started from the specified number
(eg. if set to 2 - the first 2 news will be skipped and the rest shown)</i></td> (eg. if set to 2 - the first 2 news will be skipped and the rest shown)</i></td>
</tr> </tr>
<tr> <tr>
<td width="356" > <td width="356" >
<b><br> <b><br>
Reverse News Order:</b></td> Reverse News Order:</b></td>
<td width="277" rowspan="2" align="center" valign="top"> <td width="277" rowspan="2" align="center" valign="top">
<br> <br>
&nbsp;<input type=checkbox value="yes" name="w_reverse"></td> &nbsp;<input type=checkbox value="yes" name="w_reverse"></td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px; "> <td width="356" style="padding-left:10px; ">
<i>if Yes, the order of which the news are shown will be reversed</i></td> <i>if Yes, the order of which the news are shown will be reversed</i></td>
</tr> </tr>
<tr> <tr>
<td width="356" > <td width="356" >
<b><br> <b><br>
Show Only Active News:</b></td> Show Only Active News:</b></td>
<td width="277" rowspan="2" align="center" valign="top"> <td width="277" rowspan="2" align="center" valign="top">
<br> <br>
<input type=checkbox value="yes" name="w_only_active"></td> <input type=checkbox value="yes" name="w_only_active"></td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px; "> <td width="356" style="padding-left:10px; ">
<i>if Yes, even if the number of news you requested to be shown is bigger than <i>if Yes, even if the number of news you requested to be shown is bigger than
all active news, no news from the archives will be shown</i></td> all active news, no news from the archives will be shown</i></td>
</tr> </tr>
<tr> <tr>
<td width="356"> <td width="356">
<b><br> <b><br>
Static Include:</b></td> Static Include:</b></td>
<td width="277" rowspan="2" align="center" valign="top"> <td width="277" rowspan="2" align="center" valign="top">
<br> <br>
<input type=checkbox value="yes" name="w_static"></td> <input type=checkbox value="yes" name="w_static"></td>
</tr> </tr>
<tr> <tr>
<td width="356" style="padding-left:10px;"> <td width="356" style="padding-left:10px;">
<i>if Yes, the news will be displayed but will not show the full story and <i>if Yes, the news will be displayed but will not show the full story and
comment pages when requested. useful for <a href=# onclick="javascript:Help('multiple_includes')">multiple includes</a>.</i></td> comment pages when requested. useful for <a href=# onclick="javascript:Help('multiple_includes')">multiple includes</a>.</i></td>
</tr> </tr>
<tr> <tr>
<td width="639" colspan="2"> <td width="639" colspan="2">
&nbsp;</td> &nbsp;</td>
</tr> </tr>
<tr> <tr>
<td width="639" colspan="2" style="border-top:1px solid gray; padding-top:10px;"> <td width="639" colspan="2" style="border-top:1px solid gray; padding-top:10px;">
<center><input type=submit style="font-weight:bold;" value="Proceed to Integration >>"></center> <center><input type=submit style="font-weight:bold;" value="Proceed to Integration >>"></center>
&nbsp;</td> &nbsp;</td>
</tr> </tr>
</table> </table>
<input type=hidden name=mod value=wizards> <input type=hidden name=mod value=wizards>
<input type=hidden name=action value=news_step2> <input type=hidden name=action value=news_step2>
</td></tr></form></table> </td></tr></form></table>
WIZARDHTML; WIZARDHTML;
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Show The News Integration Code // Show The News Integration Code
// ******************************************************************************** // ********************************************************************************
if($action == "news_step2"){ if($action == "news_step2"){
echoheader("wizard", "News Integration"); echoheader("wizard", "News Integration");
$the_code = '&lt;?PHP'."\n"; $the_code = '&lt;?PHP'."\n";
// Try to determine include path // Try to determine include path
$include_path = dirname(dirname(__FILE__)) .'/show_news.php'; $include_path = dirname(dirname(__FILE__)) .'/show_news.php';
if($w_number and $w_number != ''){ if($w_number and $w_number != ''){
$the_code .= '$number='.$w_number.";\n"; $the_code .= '$number='.$w_number.";\n";
} }
if($w_template != 'Default'){ if($w_template != 'Default'){
$the_code .= '$template="'.$w_template."\";\n"; $the_code .= '$template="'.$w_template."\";\n";
} }
// Get ready with Categories (if any) // Get ready with Categories (if any)
if($w_allcategory != 'yes' and isset($w_category) and $w_category != ''){ if($w_allcategory != 'yes' and isset($w_category) and $w_category != ''){
$i=0; $i=0;
foreach($w_category as $category){ foreach($w_category as $category){
$i++; $i++;
$my_category .= "$category"; $my_category .= "$category";
if(count($w_category) != $i){ $my_category .= ','; } if(count($w_category) != $i){ $my_category .= ','; }
} }
if(count($w_category) > 1){ $the_code .= '$category="'.$my_category."\";\n"; } if(count($w_category) > 1){ $the_code .= '$category="'.$my_category."\";\n"; }
else{ $the_code .= '$category='.$my_category.";\n"; } else{ $the_code .= '$category='.$my_category.";\n"; }
} }
if($w_reverse == 'yes'){ if($w_reverse == 'yes'){
$the_code .= "\$reverse=TRUE;\n"; $the_code .= "\$reverse=TRUE;\n";
} }
if($w_only_active == 'yes'){ if($w_only_active == 'yes'){
$the_code .= "\$only_active=TRUE;\n"; $the_code .= "\$only_active=TRUE;\n";
} }
if($w_static == 'yes'){ if($w_static == 'yes'){
$the_code .= "\$static=TRUE;\n"; $the_code .= "\$static=TRUE;\n";
} }
if($w_start_from and $w_start_from != ''){ if($w_start_from and $w_start_from != ''){
$the_code .= "\$start_from=$w_start_from;\n"; $the_code .= "\$start_from=$w_start_from;\n";
} }
$the_code .= "include(\"$include_path\");\n?&gt;"; $the_code .= "include(\"$include_path\");\n?&gt;";
echo"CuteNews determined your full path to show_news.php to be: '<b>$include_path</b>'<br> echo"CuteNews determined your full path to show_news.php to be: '<b>$include_path</b>'<br>
If for some reasons the include path is incorrect or does not work, please determine<br> If for some reasons the include path is incorrect or does not work, please determine<br>
the relative path for including <i>show_news.php</i> yourself or the relative path for including <i>show_news.php</i> yourself or
consult your administrator.<br> consult your administrator.<br>
<br> <br>
<center>To show your news, insert (copy & paste) the code into some of your pages (*.php) :<br><br> <center>To show your news, insert (copy & paste) the code into some of your pages (*.php) :<br><br>
<textarea style='sfont-weight:bold;' cols=70 rows=10>$the_code</textarea></center><br>"; <textarea style='sfont-weight:bold;' cols=70 rows=10>$the_code</textarea></center><br>";
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Initiate the RSS Wizard // Initiate the RSS Wizard
// ******************************************************************************** // ********************************************************************************
if($action == "rss"){ if($action == "rss"){
echoheader("wizard", "RSS Set-Up Wizard"); echoheader("wizard", "RSS Set-Up Wizard");
echo"Rich Site Summary (sometimes referred to as Really Simple Syndication);<br> echo"Rich Site Summary (sometimes referred to as Really Simple Syndication);<br>
RSS allows a web developer to share the content on his/her site. RSS repackages the web content <br> RSS allows a web developer to share the content on his/her site. RSS repackages the web content <br>
as a list of data items, to which you can subscribe from a directory of RSS publishers. <br> as a list of data items, to which you can subscribe from a directory of RSS publishers. <br>
RSS 'feeds' can be read with a web browser or special RSS reader called a content aggregator. RSS 'feeds' can be read with a web browser or special RSS reader called a content aggregator.
<br><br><input onClick=\"document.location='$PHP_SELF?mod=wizards&action=rss_step2';\" type=button value='Proceed with RSS Configuration >>'><br><br> <br><br><input onClick=\"document.location='$PHP_SELF?mod=wizards&action=rss_step2';\" type=button value='Proceed with RSS Configuration >>'><br><br>
"; ";
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Show the RSS config // Show the RSS config
// ******************************************************************************** // ********************************************************************************
if($action == "rss_step2"){ if($action == "rss_step2"){
include("./data/rss_config.php"); include("./data/rss_config.php");
if($rss_language == '' or !$rss_language){ $rss_language = 'en-us'; } if($rss_language == '' or !$rss_language){ $rss_language = 'en-us'; }
if($rss_encoding == '' or !$rss_encoding){ $rss_encoding = 'UTF-8'; } if($rss_encoding == '' or !$rss_encoding){ $rss_encoding = 'UTF-8'; }
echoheader("wizard", "RSS Configuration"); echoheader("wizard", "RSS Configuration");
echo<<<HTML echo<<<HTML
<table border=0 height=1 width=617 cellspacing="0" cellpadding="0"> <table border=0 height=1 width=617 cellspacing="0" cellpadding="0">
<form method=POST action="index.php"> <form method=POST action="index.php">
<td height="21" width=400 bgcolor=#F7F6F4 > <td height="21" width=400 bgcolor=#F7F6F4 >
&nbsp;<b>URL of the page where you include your news</b><br> &nbsp;<b>URL of the page where you include your news</b><br>
&nbsp;<i>example: http://mysite.com/news.php</i><br> &nbsp;<i>example: http://mysite.com/news.php</i><br>
&nbsp;<i>or: $config_http_script_dir/example2.php</i> &nbsp;<i>or: $config_http_script_dir/example2.php</i>
<td height="21" bgcolor=#F7F6F4 colspan=2> <td height="21" bgcolor=#F7F6F4 colspan=2>
<input name="rss_news_include_url" value="$rss_news_include_url" type=text size=30> <input name="rss_news_include_url" value="$rss_news_include_url" type=text size=30>
<tr> <tr>
<td height="21" > <td height="21" >
<br> <br>
&nbsp;Title of the RSS feed &nbsp;Title of the RSS feed
<td height="21" colspan=2> <td height="21" colspan=2>
<br> <br>
<input name="rss_title" value="$rss_title" size=30 > <input name="rss_title" value="$rss_title" size=30 >
</tr> </tr>
<tr> <tr>
<td height="21" bgcolor=#F7F6F4 > <td height="21" bgcolor=#F7F6F4 >
<br> <br>
&nbsp;Character Encoding (default: <i>UTF-8</i>) &nbsp;Character Encoding (default: <i>UTF-8</i>)
<td height="21" colspan=2 bgcolor=#F7F6F4 > <td height="21" colspan=2 bgcolor=#F7F6F4 >
<br> <br>
<input name="rss_encoding" value="$rss_encoding" size=20 > <input name="rss_encoding" value="$rss_encoding" size=20 >
</tr> </tr>
<tr> <tr>
<td height="21" > <td height="21" >
<br> <br>
&nbsp;Language (default: <i>en-us</i>) &nbsp;Language (default: <i>en-us</i>)
<td height="21"> <td height="21">
<br> <br>
<input name="rss_language" value="$rss_language" size=5 > <input name="rss_language" value="$rss_language" size=5 >
</tr> </tr>
<tr> <tr>
<td height="1" colspan="2" colspan=3> <td height="1" colspan="2" colspan=3>
<br /><br><input type=submit style="font-weight:bold; font-size:110%;" value="Save Configurations and Proceed >>" accesskey="s"> &nbsp; <br /><br><input type=submit style="font-weight:bold; font-size:110%;" value="Save Configurations and Proceed >>" accesskey="s"> &nbsp;
<input style="font-size:90%;" onClick="document.location='$PHP_SELF?mod=wizards&action=customizerss';" type=button value='Skip to Customization >>'> <input style="font-size:90%;" onClick="document.location='$PHP_SELF?mod=wizards&action=customizerss';" type=button value='Skip to Customization >>'>
</tr> </tr>
<input type=hidden name=mod value=wizards> <input type=hidden name=mod value=wizards>
<input type=hidden name=action value=dosaverss> <input type=hidden name=action value=dosaverss>
</form> </form>
</table> </table>
HTML; HTML;
echofooter(); echofooter();
} }
// ******************************************************************************** // ********************************************************************************
// Save the RSS Configuration // Save the RSS Configuration
// ******************************************************************************** // ********************************************************************************
if($action == "dosaverss"){ if($action == "dosaverss"){
if(!eregi("http://", "$rss_news_include_url")){ msg("error","Error", "The URL where you include your news must start with <b>http://</b> "); } if(!eregi("http://", "$rss_news_include_url")){ msg("error","Error", "The URL where you include your news must start with <b>http://</b> "); }
$handler = fopen("./data/rss_config.php", "w") or msg("error", "Error", "Can not open file ./data/rss_config.php"); $handler = fopen("./data/rss_config.php", "w") or msg("error", "Error", "Can not open file ./data/rss_config.php");
fwrite($handler, "<?PHP \n\n//RSS Configurations (Auto Generated file)\n\n"); fwrite($handler, "<?PHP \n\n//RSS Configurations (Auto Generated file)\n\n");
fwrite($handler, "\$rss_news_include_url = \"".htmlspecialchars($rss_news_include_url)."\";\n\n"); fwrite($handler, "\$rss_news_include_url = \"".htmlspecialchars($rss_news_include_url)."\";\n\n");
fwrite($handler, "\$rss_title = \"".htmlspecialchars($rss_title)."\";\n\n"); fwrite($handler, "\$rss_title = \"".htmlspecialchars($rss_title)."\";\n\n");
fwrite($handler, "\$rss_encoding = \"".htmlspecialchars($rss_encoding)."\";\n\n"); fwrite($handler, "\$rss_encoding = \"".htmlspecialchars($rss_encoding)."\";\n\n");
fwrite($handler, "\$rss_language = \"".htmlspecialchars($rss_language)."\";\n\n"); fwrite($handler, "\$rss_language = \"".htmlspecialchars($rss_language)."\";\n\n");
fwrite($handler, "?>"); fwrite($handler, "?>");
fclose($handler); fclose($handler);
msg("wizard", "RSS Configuration Saved", "The configurations were saved successfuly.<br><br><input onClick=\"document.location='$PHP_SELF?mod=wizards&action=customizerss';\" type=button value='Proceed With RSS Customization >>'>"); msg("wizard", "RSS Configuration Saved", "The configurations were saved successfuly.<br><br><input onClick=\"document.location='$PHP_SELF?mod=wizards&action=customizerss';\" type=button value='Proceed With RSS Customization >>'>");
} }
// ******************************************************************************** // ********************************************************************************
// Save the RSS Configuration // Save the RSS Configuration
// ******************************************************************************** // ********************************************************************************
if($action == "customizerss"){ if($action == "customizerss"){
echoheader("wizard", "RSS Customization"); echoheader("wizard", "RSS Customization");
// //
// Detect the categories (if any) // Detect the categories (if any)
// //
$cat_lines = file("./data/category.db.php"); $cat_lines = file("./data/category.db.php");
if(count($cat_lines) > 0){ if(count($cat_lines) > 0){
$cat_options .= "<select style=\"\" id=categories multiple size=5> \n"; $cat_options .= "<select style=\"\" id=categories multiple size=5> \n";
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$cat_options .= "<option value=\"$cat_arr[0]\">(ID:$cat_arr[0]) $cat_arr[1]</option>\n"; $cat_options .= "<option value=\"$cat_arr[0]\">(ID:$cat_arr[0]) $cat_arr[1]</option>\n";
} }
$cat_options .= "</select> <br><label for=allcategories><input onClick=\"if(this.checked){getElementById('categories').style.display='none';}else{getElementById('categories').style.display='';}\" type=checkbox id=allcategories value=yes>Or show from all Categories</label>"; $cat_options .= "</select> <br><label for=allcategories><input onClick=\"if(this.checked){getElementById('categories').style.display='none';}else{getElementById('categories').style.display='';}\" type=checkbox id=allcategories value=yes>Or show from all Categories</label>";
}else{ }else{
$cat_options = "You do not have any categories. <input type=hidden id=categories><input type=hidden id=allcategories>"; $cat_options = "You do not have any categories. <input type=hidden id=categories><input type=hidden id=allcategories>";
} }
// //
// Show the HTML // Show the HTML
// //
echo<<<HTMLECHO echo<<<HTMLECHO
<SCRIPT type="text/javascript"> <SCRIPT type="text/javascript">
function generateCode(){ function generateCode(){
sbox = document.getElementById('categories'); sbox = document.getElementById('categories');
var categoryString = ''; var categoryString = '';
var firstDone = 0; var firstDone = 0;
for (var i=0; i<sbox.length; i++) { for (var i=0; i<sbox.length; i++) {
if (sbox[i].selected) { if (sbox[i].selected) {
if(firstDone == 1){ categoryString = categoryString + ','; } if(firstDone == 1){ categoryString = categoryString + ','; }
categoryString = categoryString + sbox[i].value; categoryString = categoryString + sbox[i].value;
firstDone = 1; firstDone = 1;
} }
} }
var number = document.getElementById('number').value; var number = document.getElementById('number').value;
var string = '$config_http_script_dir/rss.php'; var string = '$config_http_script_dir/rss.php';
if(document.getElementById('allcategories').checked || categoryString == ''){ if(document.getElementById('allcategories').checked || categoryString == ''){
if(number != ''){ string += '?number='+number; } if(number != ''){ string += '?number='+number; }
}else{ }else{
string += '?category=' + categoryString; string += '?category=' + categoryString;
if(number != ''){ string += '&number='+number; } if(number != ''){ string += '&number='+number; }
} }
//alert(string); //alert(string);
var htmlcode = '<a title="RSS Feed" href="' + string + '">\\n<img src="$config_http_script_dir/skins/images/rss_icon.gif" border=0 />\\n</a>'; var htmlcode = '<a title="RSS Feed" href="' + string + '">\\n<img src="$config_http_script_dir/skins/images/rss_icon.gif" border=0 />\\n</a>';
document.getElementById('result').value = htmlcode; document.getElementById('result').value = htmlcode;
} }
</SCRIPT> </SCRIPT>
<table cellspacing="0" cellpadding="5" width="647" height="100%" border="0" style="border-collapse: collapse" bordercolor="#111111"><tr> <table cellspacing="0" cellpadding="5" width="647" height="100%" border="0" style="border-collapse: collapse" bordercolor="#111111"><tr>
<td width="647" colspan="3">After You have configured your RSS options, the <td width="647" colspan="3">After You have configured your RSS options, the
RSS feed is ready to be used.<br> RSS feed is ready to be used.<br>
<br> <br>
URL Address of your RSS: <b><a href="$config_http_script_dir/rss.php"> URL Address of your RSS: <b><a href="$config_http_script_dir/rss.php">
$config_http_script_dir/rss.php</a><br> $config_http_script_dir/rss.php</a><br>
&nbsp;</b></td></tr> &nbsp;</b></td></tr>
<tr> <tr>
<td bgcolor="#F7F6F4" style="border-bottom:1px solid gray;" width="647" colspan="3"><b><font size="2">&nbsp;Customizing <td bgcolor="#F7F6F4" style="border-bottom:1px solid gray;" width="647" colspan="3"><b><font size="2">&nbsp;Customizing
your RSS feed:</font></b></td> your RSS feed:</font></b></td>
</tr> </tr>
<tr> <tr>
<td width="647" colspan="3">&nbsp;</td> <td width="647" colspan="3">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td width="58">&nbsp;</td><td width="393">Number of articles to be shown in <td width="58">&nbsp;</td><td width="393">Number of articles to be shown in
the RSS (default:10):</td><td width="196"><input id=number size=5 type="text" size="20"></td> the RSS (default:10):</td><td width="196"><input id=number size=5 type="text" size="20"></td>
</tr> </tr>
<tr> <tr>
<td width="58">&nbsp;</td><td width="393">Show articles only from these <td width="58">&nbsp;</td><td width="393">Show articles only from these
categories:</td><td width="196"> categories:</td><td width="196">
$cat_options $cat_options
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="3" style="padding:40px;">After you have selected your preferred settings, click the <td colspan="3" style="padding:40px;">After you have selected your preferred settings, click the
'Generate HTML Code' button and you are ready to insert this code into your 'Generate HTML Code' button and you are ready to insert this code into your
page. The generated code will be of a linked RSS image that will be pointing page. The generated code will be of a linked RSS image that will be pointing
to your RSS feed (rss.php). to your RSS feed (rss.php).
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="647" colspan="3"> <td width="647" colspan="3">
<p align="center"> <p align="center">
<input type=button value="Generate HTML Code" onClick="generateCode();" style="font-weight: bold; font-size:120%;" ><br> <input type=button value="Generate HTML Code" onClick="generateCode();" style="font-weight: bold; font-size:120%;" ><br>
<br> <br>
<textarea id=result rows="5" cols="100"></textarea> </td> <textarea id=result rows="5" cols="100"></textarea> </td>
</tr> </tr>
<tr> <tr>
<td width="647" colspan="3">&nbsp;</td> <td width="647" colspan="3">&nbsp;</td>
</tr> </tr>
</table> </table>
HTMLECHO; HTMLECHO;
echofooter(); echofooter();
} }
?> ?>
function CNreadCookie() { function CNreadCookie() {
var CNname = CNGetCookie('CNname'); var CNname = CNGetCookie('CNname');
var CNmail = CNGetCookie('CNmail'); var CNmail = CNGetCookie('CNmail');
if(CNname != null){ document.comment.name.value = CNname; } if(CNname != null){ document.comment.name.value = CNname; }
if(CNmail != null){ document.comment.mail.value = CNmail; } if(CNmail != null){ document.comment.mail.value = CNmail; }
} }
function CNforget() { function CNforget() {
var expDate = new Date(); var expDate = new Date();
CNSetCookie('name', '', expDate); CNSetCookie('name', '', expDate);
CNSetCookie('CNpass', '', expDate); CNSetCookie('CNpass', '', expDate);
CNSetCookie('CNname', '', expDate); CNSetCookie('CNname', '', expDate);
CNSetCookie('CNmail', '', expDate); CNSetCookie('CNmail', '', expDate);
document.comment.name.value = ''; document.comment.name.value = '';
document.comment.mail.value = ''; document.comment.mail.value = '';
alert("All Your personal information collected by CuteNews has been deleted!\nEnjoy your anonymity."); alert("All Your personal information collected by CuteNews has been deleted!\nEnjoy your anonymity.");
} }
function CNSubmitComment() { function CNSubmitComment() {
if(document.comment.CNremember.checked){ if(document.comment.CNremember.checked){
var expDays = 365; var expDays = 365;
var expDate = new Date(); var expDate = new Date();
expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * expDays)); expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * expDays));
CNSetCookie('CNname', document.comment.name.value, expDate); CNSetCookie('CNname', document.comment.name.value, expDate);
CNSetCookie('CNmail', document.comment.mail.value, expDate); CNSetCookie('CNmail', document.comment.mail.value, expDate);
} }
return true; return true;
} }
function CNRememberPass(pass) { function CNRememberPass(pass) {
var expDays = 365; var expDays = 365;
var expDate = new Date(); var expDate = new Date();
expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * expDays)); expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * expDays));
CNSetCookie('CNpass', pass, expDate); CNSetCookie('CNpass', pass, expDate);
} }
function CNGetCookieVal (offset) { function CNGetCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset); var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) if (endstr == -1)
endstr = document.cookie.length; endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); return unescape(document.cookie.substring(offset, endstr));
} }
function CNGetCookie (name) { function CNGetCookie (name) {
var arg = name + "="; var arg = name + "=";
var alen = arg.length; var alen = arg.length;
var clen = document.cookie.length; var clen = document.cookie.length;
var i = 0; var i = 0;
while (i < clen) { while (i < clen) {
var j = i + alen; var j = i + alen;
if (document.cookie.substring(i, j) == arg) if (document.cookie.substring(i, j) == arg)
return CNGetCookieVal (j); return CNGetCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1; i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break; if (i == 0) break;
} }
return null; return null;
} }
function CNSetCookie (name, value) { function CNSetCookie (name, value) {
var argv = CNSetCookie.arguments; var argv = CNSetCookie.arguments;
var argc = CNSetCookie.arguments.length; var argc = CNSetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null; var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null; var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null; var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false; var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) + document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) + ((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) + ((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : ""); ((secure == true) ? "; secure" : "");
} }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title></title> <title></title>
</head> </head>
<body> <body>
</body> </body>
</html> </html>
   
 Binary files a/cutenews/rte/images/Thumbs.db and b/cutenews/rte/images/Thumbs.db differ
 Binary files a/cutenews/rte/images/bgcolor.gif and b/cutenews/rte/images/bgcolor.gif differ
 Binary files a/cutenews/rte/images/blackdot.gif and b/cutenews/rte/images/blackdot.gif differ
 Binary files a/cutenews/rte/images/bold.gif and b/cutenews/rte/images/bold.gif differ
 Binary files a/cutenews/rte/images/centre.gif and b/cutenews/rte/images/centre.gif differ
 Binary files a/cutenews/rte/images/copy.gif and b/cutenews/rte/images/copy.gif differ
 Binary files a/cutenews/rte/images/cut.gif and b/cutenews/rte/images/cut.gif differ
 Binary files a/cutenews/rte/images/hr.gif and b/cutenews/rte/images/hr.gif differ
 Binary files a/cutenews/rte/images/hyperlink.gif and b/cutenews/rte/images/hyperlink.gif differ
 Binary files a/cutenews/rte/images/image.gif and b/cutenews/rte/images/image.gif differ
 Binary files a/cutenews/rte/images/indent.gif and b/cutenews/rte/images/indent.gif differ
 Binary files a/cutenews/rte/images/insert_table.gif and b/cutenews/rte/images/insert_table.gif differ
 Binary files a/cutenews/rte/images/italic.gif and b/cutenews/rte/images/italic.gif differ
 Binary files a/cutenews/rte/images/justifyfull.gif and b/cutenews/rte/images/justifyfull.gif differ
 Binary files a/cutenews/rte/images/left_just.gif and b/cutenews/rte/images/left_just.gif differ
 Binary files a/cutenews/rte/images/list.gif and b/cutenews/rte/images/list.gif differ
 Binary files a/cutenews/rte/images/numbered_list.gif and b/cutenews/rte/images/numbered_list.gif differ
 Binary files a/cutenews/rte/images/outdent.gif and b/cutenews/rte/images/outdent.gif differ
 Binary files a/cutenews/rte/images/paste.gif and b/cutenews/rte/images/paste.gif differ
 Binary files a/cutenews/rte/images/redo.gif and b/cutenews/rte/images/redo.gif differ
 Binary files a/cutenews/rte/images/right_just.gif and b/cutenews/rte/images/right_just.gif differ
 Binary files a/cutenews/rte/images/smiley.gif and b/cutenews/rte/images/smiley.gif differ
 Binary files a/cutenews/rte/images/spellcheck.gif and b/cutenews/rte/images/spellcheck.gif differ
 Binary files a/cutenews/rte/images/textcolor.gif and b/cutenews/rte/images/textcolor.gif differ
 Binary files a/cutenews/rte/images/underline.gif and b/cutenews/rte/images/underline.gif differ
 Binary files a/cutenews/rte/images/undo.gif and b/cutenews/rte/images/undo.gif differ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>Insert Link</title> <title>Insert Link</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
<!-- <!--
function AddLink() { function AddLink() {
var oForm = document.linkForm; var oForm = document.linkForm;
//validate form //validate form
if (oForm.url.value == '') { if (oForm.url.value == '') {
alert('Please enter a url.'); alert('Please enter a url.');
return false; return false;
} }
if (oForm.linkText.value == '') { if (oForm.linkText.value == '') {
alert('Please enter link text.'); alert('Please enter link text.');
return false; return false;
} }
var html = '<a href="' + document.linkForm.url.value + '" target="' + document.linkForm.linkTarget.options[document.linkForm.linkTarget.selectedIndex].value + '">' + document.linkForm.linkText.value + '</a>'; var html = '<a href="' + document.linkForm.url.value + '" target="' + document.linkForm.linkTarget.options[document.linkForm.linkTarget.selectedIndex].value + '">' + document.linkForm.linkText.value + '</a>';
window.opener.insertHTML(html); window.opener.insertHTML(html);
window.close(); window.close();
return true; return true;
} }
//--> //-->
</script> </script>
</head> </head>
<body style="margin: 10px; background: #D3D3D3;"> <body style="margin: 10px; background: #D3D3D3;">
<form name="linkForm" onSubmit="return AddLink();"> <form name="linkForm" onSubmit="return AddLink();">
<table cellpadding="4" cellspacing="0" border="0"> <table cellpadding="4" cellspacing="0" border="0">
<tr><td colspan="2"><span style="font-style: italic; font-size: x-small;"><b>Tip:</b> To insert an email link, start your URL with "mailto:"</span></td></tr> <tr><td colspan="2"><span style="font-style: italic; font-size: x-small;"><b>Tip:</b> To insert an email link, start your URL with "mailto:"</span></td></tr>
<tr> <tr>
<td align="right">URL:</td> <td align="right">URL:</td>
<td><input name="url" type="text" id="url" size="40"></td> <td><input name="url" type="text" id="url" size="40"></td>
</tr> </tr>
<tr> <tr>
<td align="right">Text:</td> <td align="right">Text:</td>
<td><input name="linkText" type="text" id="linkText" size="40"></td> <td><input name="linkText" type="text" id="linkText" size="40"></td>
</tr> </tr>
<tr> <tr>
<td align="right">Target:</td> <td align="right">Target:</td>
<td align="left"> <td align="left">
<select name="linkTarget" id="linkTarget"> <select name="linkTarget" id="linkTarget">
<option value="_blank">_blank</option> <option value="_blank">_blank</option>
<option value="_parent">_parent</option> <option value="_parent">_parent</option>
<option value="_self" selected>_self</option> <option value="_self" selected>_self</option>
<option value="_top">_top</option> <option value="_top">_top</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="3" align="center"> <td colspan="3" align="center">
<input type="submit" value="Insert Link" /> <input type="submit" value="Insert Link" />
<input type="button" value="Cancel" onClick="window.close();" /> <input type="button" value="Cancel" onClick="window.close();" />
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</body> </body>
</html> </html>
   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>Insert Table</title> <title>Insert Table</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
<!-- <!--
function AddTable() { function AddTable() {
var widthType = (document.tableForm.widthType.value == "pixels") ? "" : "%"; var widthType = (document.tableForm.widthType.value == "pixels") ? "" : "%";
var html = '<table border="' + document.tableForm.border.value + '" cellpadding="' + document.tableForm.padding.value + '" '; var html = '<table border="' + document.tableForm.border.value + '" cellpadding="' + document.tableForm.padding.value + '" ';
html += 'cellspacing="' + document.tableForm.spacing.value + '" width="' + document.tableForm.width.value + widthType + '">\n'; html += 'cellspacing="' + document.tableForm.spacing.value + '" width="' + document.tableForm.width.value + widthType + '">\n';
for (var rows = 0; rows < document.tableForm.rows.value; rows++) { for (var rows = 0; rows < document.tableForm.rows.value; rows++) {
html += "<tr>\n"; html += "<tr>\n";
for (cols = 0; cols < document.tableForm.columns.value; cols++) { for (cols = 0; cols < document.tableForm.columns.value; cols++) {
html += "<td>&nbsp;</td>\n"; html += "<td>&nbsp;</td>\n";
} }
html+= "</tr>\n"; html+= "</tr>\n";
} }
html += "</table>\n"; html += "</table>\n";
window.opener.insertHTML(html); window.opener.insertHTML(html);
window.close(); window.close();
} }
//--> //-->
</script> </script>
</head> </head>
<body style="margin: 10px; background: #D3D3D3;"> <body style="margin: 10px; background: #D3D3D3;">
<form name="tableForm"> <form name="tableForm">
<table cellpadding="4" cellspacing="0" border="0"> <table cellpadding="4" cellspacing="0" border="0">
<tr> <tr>
<td align="right">Rows:</td> <td align="right">Rows:</td>
<td><input name="rows" type="text" id="rows" value="2" size="4"></td> <td><input name="rows" type="text" id="rows" value="2" size="4"></td>
<td align="left">Columns: <input name="columns" type="text" id="columns" value="2" size="4"></td> <td align="left">Columns: <input name="columns" type="text" id="columns" value="2" size="4"></td>
</tr> </tr>
<tr> <tr>
<td align="right">Table width:</td> <td align="right">Table width:</td>
<td><input name="width" type="text" id="width" value="100" size="4"></td> <td><input name="width" type="text" id="width" value="100" size="4"></td>
<td align="left"> <td align="left">
<select name="widthType" id="widthType"> <select name="widthType" id="widthType">
<option value="pixels">pixels</option> <option value="pixels">pixels</option>
<option value="percent" selected>percent</option> <option value="percent" selected>percent</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="right">Border thickness:</td> <td align="right">Border thickness:</td>
<td><input name="border" type="text" id="border" value="1" size="4"></td> <td><input name="border" type="text" id="border" value="1" size="4"></td>
<td align="left">pixels</td> <td align="left">pixels</td>
</tr> </tr>
<tr> <tr>
<td align="right">Cell padding:</td> <td align="right">Cell padding:</td>
<td><input name="padding" type="text" id="padding" value="4" size="4"></td> <td><input name="padding" type="text" id="padding" value="4" size="4"></td>
<td>Cell spacing: <input name="spacing" type="text" id="0" value="0" size="4"></td> <td>Cell spacing: <input name="spacing" type="text" id="0" value="0" size="4"></td>
</tr> </tr>
<tr> <tr>
<td colspan="3" align="center"> <td colspan="3" align="center">
<input type="button" value="Insert Table" onClick="AddTable();" /> <input type="button" value="Insert Table" onClick="AddTable();" />
<input type="button" value="Cancel" onClick="window.close();" /> <input type="button" value="Cancel" onClick="window.close();" />
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</body> </body>
</html> </html>
   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>Text Color</title> <title>Text Color</title>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
<!-- <!--
function selectColor(color) { function selectColor(color) {
self.parent.setColor(color); self.parent.setColor(color);
} }
function InitColorPalette() { function InitColorPalette() {
if (document.getElementsByTagName) if (document.getElementsByTagName)
var x = document.getElementsByTagName('TD'); var x = document.getElementsByTagName('TD');
else if (document.all) else if (document.all)
var x = document.all.tags('TD'); var x = document.all.tags('TD');
for (var i=0; i < x.length; i++) { for (var i=0; i < x.length; i++) {
x[i].onmouseover = over; x[i].onmouseover = over;
x[i].onmouseout = out; x[i].onmouseout = out;
x[i].onclick = click; x[i].onclick = click;
} }
} }
function over() { function over() {
this.style.border = '1px dotted white'; this.style.border = '1px dotted white';
} }
function out() { function out() {
this.style.border = '1px solid gray'; this.style.border = '1px solid gray';
} }
function click() { function click() {
selectColor(this.id); selectColor(this.id);
} }
//--> //-->
</script> </script>
</head> </head>
<body bgcolor="white" onLoad="InitColorPalette()" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0"> <body bgcolor="white" onLoad="InitColorPalette()" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0">
<table width="150" height="100" cellpadding="0" cellspacing="1" border="1" align="center"> <table width="150" height="100" cellpadding="0" cellspacing="1" border="1" align="center">
<tr> <tr>
<td id="#FFFFFF" bgcolor="#FFFFFF" width="10" height="10"><img width="1" height="1"></td> <td id="#FFFFFF" bgcolor="#FFFFFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFCCCC" bgcolor="#FFCCCC" width="10" height="10"><img width="1" height="1"></td> <td id="#FFCCCC" bgcolor="#FFCCCC" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFCC99" bgcolor="#FFCC99" width="10" height="10"><img width="1" height="1"></td> <td id="#FFCC99" bgcolor="#FFCC99" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFFF99" bgcolor="#FFFF99" width="10" height="10"><img width="1" height="1"></td> <td id="#FFFF99" bgcolor="#FFFF99" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFFFCC" bgcolor="#FFFFCC" width="10" height="10"><img width="1" height="1"></td> <td id="#FFFFCC" bgcolor="#FFFFCC" width="10" height="10"><img width="1" height="1"></td>
<td id="#99FF99" bgcolor="#99FF99" width="10" height="10"><img width="1" height="1"></td> <td id="#99FF99" bgcolor="#99FF99" width="10" height="10"><img width="1" height="1"></td>
<td id="#99FFFF" bgcolor="#99FFFF" width="10" height="10"><img width="1" height="1"></td> <td id="#99FFFF" bgcolor="#99FFFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#CCFFFF" bgcolor="#CCFFFF" width="10" height="10"><img width="1" height="1"></td> <td id="#CCFFFF" bgcolor="#CCFFFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#CCCCFF" bgcolor="#CCCCFF" width="10" height="10"><img width="1" height="1"></td> <td id="#CCCCFF" bgcolor="#CCCCFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFCCFF" bgcolor="#FFCCFF" width="10" height="10"><img width="1" height="1"></td> <td id="#FFCCFF" bgcolor="#FFCCFF" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
<tr> <tr>
<td id="#CCCCCC" bgcolor="#CCCCCC" width="10" height="10"><img width="1" height="1"></td> <td id="#CCCCCC" bgcolor="#CCCCCC" width="10" height="10"><img width="1" height="1"></td>
<td id="#FF6666" bgcolor="#FF6666" width="10" height="10"><img width="1" height="1"></td> <td id="#FF6666" bgcolor="#FF6666" width="10" height="10"><img width="1" height="1"></td>
<td id="#FF9966" bgcolor="#FF9966" width="10" height="10"><img width="1" height="1"></td> <td id="#FF9966" bgcolor="#FF9966" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFFF66" bgcolor="#FFFF66" width="10" height="10"><img width="1" height="1"></td> <td id="#FFFF66" bgcolor="#FFFF66" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFFF33" bgcolor="#FFFF33" width="10" height="10"><img width="1" height="1"></td> <td id="#FFFF33" bgcolor="#FFFF33" width="10" height="10"><img width="1" height="1"></td>
<td id="#66FF99" bgcolor="#66FF99" width="10" height="10"><img width="1" height="1"></td> <td id="#66FF99" bgcolor="#66FF99" width="10" height="10"><img width="1" height="1"></td>
<td id="#33FFFF" bgcolor="#33FFFF" width="10" height="10"><img width="1" height="1"></td> <td id="#33FFFF" bgcolor="#33FFFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#66FFFF" bgcolor="#66FFFF" width="10" height="10"><img width="1" height="1"></td> <td id="#66FFFF" bgcolor="#66FFFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#9999FF" bgcolor="#9999FF" width="10" height="10"><img width="1" height="1"></td> <td id="#9999FF" bgcolor="#9999FF" width="10" height="10"><img width="1" height="1"></td>
<td id="#FF99FF" bgcolor="#FF99FF" width="10" height="10"><img width="1" height="1"></td> <td id="#FF99FF" bgcolor="#FF99FF" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
<tr> <tr>
<td id="#C0C0C0" bgcolor="#C0C0C0" width="10" height="10"><img width="1" height="1"></td> <td id="#C0C0C0" bgcolor="#C0C0C0" width="10" height="10"><img width="1" height="1"></td>
<td id="#FF0000" bgcolor="#FF0000" width="10" height="10"><img width="1" height="1"></td> <td id="#FF0000" bgcolor="#FF0000" width="10" height="10"><img width="1" height="1"></td>
<td id="#FF9900" bgcolor="#FF9900" width="10" height="10"><img width="1" height="1"></td> <td id="#FF9900" bgcolor="#FF9900" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFCC66" bgcolor="#FFCC66" width="10" height="10"><img width="1" height="1"></td> <td id="#FFCC66" bgcolor="#FFCC66" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFFF00" bgcolor="#FFFF00" width="10" height="10"><img width="1" height="1"></td> <td id="#FFFF00" bgcolor="#FFFF00" width="10" height="10"><img width="1" height="1"></td>
<td id="#33FF33" bgcolor="#33FF33" width="10" height="10"><img width="1" height="1"></td> <td id="#33FF33" bgcolor="#33FF33" width="10" height="10"><img width="1" height="1"></td>
<td id="#66CCCC" bgcolor="#66CCCC" width="10" height="10"><img width="1" height="1"></td> <td id="#66CCCC" bgcolor="#66CCCC" width="10" height="10"><img width="1" height="1"></td>
<td id="#33CCFF" bgcolor="#33CCFF" width="10" height="10"><img width="1" height="1"></td> <td id="#33CCFF" bgcolor="#33CCFF" width="10" height="10"><img width="1" height="1"></td>
<td id="#6666CC" bgcolor="#6666CC" width="10" height="10"><img width="1" height="1"></td> <td id="#6666CC" bgcolor="#6666CC" width="10" height="10"><img width="1" height="1"></td>
<td id="#CC66CC" bgcolor="#CC66CC" width="10" height="10"><img width="1" height="1"></td> <td id="#CC66CC" bgcolor="#CC66CC" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
<tr> <tr>
<td id="#999999" bgcolor="#999999" width="10" height="10"><img width="1" height="1"></td> <td id="#999999" bgcolor="#999999" width="10" height="10"><img width="1" height="1"></td>
<td id="#CC0000" bgcolor="#CC0000" width="10" height="10"><img width="1" height="1"></td> <td id="#CC0000" bgcolor="#CC0000" width="10" height="10"><img width="1" height="1"></td>
<td id="#FF6600" bgcolor="#FF6600" width="10" height="10"><img width="1" height="1"></td> <td id="#FF6600" bgcolor="#FF6600" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFCC33" bgcolor="#FFCC33" width="10" height="10"><img width="1" height="1"></td> <td id="#FFCC33" bgcolor="#FFCC33" width="10" height="10"><img width="1" height="1"></td>
<td id="#FFCC00" bgcolor="#FFCC00" width="10" height="10"><img width="1" height="1"></td> <td id="#FFCC00" bgcolor="#FFCC00" width="10" height="10"><img width="1" height="1"></td>
<td id="#33CC00" bgcolor="#33CC00" width="10" height="10"><img width="1" height="1"></td> <td id="#33CC00" bgcolor="#33CC00" width="10" height="10"><img width="1" height="1"></td>
<td id="#00CCCC" bgcolor="#00CCCC" width="10" height="10"><img width="1" height="1"></td> <td id="#00CCCC" bgcolor="#00CCCC" width="10" height="10"><img width="1" height="1"></td>
<td id="#3366FF" bgcolor="#3366FF" width="10" height="10"><img width="1" height="1"></td> <td id="#3366FF" bgcolor="#3366FF" width="10" height="10"><img width="1" height="1"></td>
<td id="#6633FF" bgcolor="#6633FF" width="10" height="10"><img width="1" height="1"></td> <td id="#6633FF" bgcolor="#6633FF" width="10" height="10"><img width="1" height="1"></td>
<td id="#CC33CC" bgcolor="#CC33CC" width="10" height="10"><img width="1" height="1"></td> <td id="#CC33CC" bgcolor="#CC33CC" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
<tr> <tr>
<td id="#666666" bgcolor="#666666" width="10" height="10"><img width="1" height="1"></td> <td id="#666666" bgcolor="#666666" width="10" height="10"><img width="1" height="1"></td>
<td id="#990000" bgcolor="#990000" width="10" height="10"><img width="1" height="1"></td> <td id="#990000" bgcolor="#990000" width="10" height="10"><img width="1" height="1"></td>
<td id="#CC6600" bgcolor="#CC6600" width="10" height="10"><img width="1" height="1"></td> <td id="#CC6600" bgcolor="#CC6600" width="10" height="10"><img width="1" height="1"></td>
<td id="#CC9933" bgcolor="#CC9933" width="10" height="10"><img width="1" height="1"></td> <td id="#CC9933" bgcolor="#CC9933" width="10" height="10"><img width="1" height="1"></td>
<td id="#999900" bgcolor="#999900" width="10" height="10"><img width="1" height="1"></td> <td id="#999900" bgcolor="#999900" width="10" height="10"><img width="1" height="1"></td>
<td id="#009900" bgcolor="#009900" width="10" height="10"><img width="1" height="1"></td> <td id="#009900" bgcolor="#009900" width="10" height="10"><img width="1" height="1"></td>
<td id="#339999" bgcolor="#339999" width="10" height="10"><img width="1" height="1"></td> <td id="#339999" bgcolor="#339999" width="10" height="10"><img width="1" height="1"></td>
<td id="#3333FF" bgcolor="#3333FF" width="10" height="10"><img width="1" height="1"></td> <td id="#3333FF" bgcolor="#3333FF" width="10" height="10"><img width="1" height="1"></td>
<td id="#6600CC" bgcolor="#6600CC" width="10" height="10"><img width="1" height="1"></td> <td id="#6600CC" bgcolor="#6600CC" width="10" height="10"><img width="1" height="1"></td>
<td id="#993399" bgcolor="#993399" width="10" height="10"><img width="1" height="1"></td> <td id="#993399" bgcolor="#993399" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
<tr> <tr>
<td id="#333333" bgcolor="#333333" width="10" height="10"><img width="1" height="1"></td> <td id="#333333" bgcolor="#333333" width="10" height="10"><img width="1" height="1"></td>
<td id="#660000" bgcolor="#660000" width="10" height="10"><img width="1" height="1"></td> <td id="#660000" bgcolor="#660000" width="10" height="10"><img width="1" height="1"></td>
<td id="#993300" bgcolor="#993300" width="10" height="10"><img width="1" height="1"></td> <td id="#993300" bgcolor="#993300" width="10" height="10"><img width="1" height="1"></td>
<td id="#996633" bgcolor="#996633" width="10" height="10"><img width="1" height="1"></td> <td id="#996633" bgcolor="#996633" width="10" height="10"><img width="1" height="1"></td>
<td id="#666600" bgcolor="#666600" width="10" height="10"><img width="1" height="1"></td> <td id="#666600" bgcolor="#666600" width="10" height="10"><img width="1" height="1"></td>
<td id="#006600" bgcolor="#006600" width="10" height="10"><img width="1" height="1"></td> <td id="#006600" bgcolor="#006600" width="10" height="10"><img width="1" height="1"></td>
<td id="#336666" bgcolor="#336666" width="10" height="10"><img width="1" height="1"></td> <td id="#336666" bgcolor="#336666" width="10" height="10"><img width="1" height="1"></td>
<td id="#000099" bgcolor="#000099" width="10" height="10"><img width="1" height="1"></td> <td id="#000099" bgcolor="#000099" width="10" height="10"><img width="1" height="1"></td>
<td id="#333399" bgcolor="#333399" width="10" height="10"><img width="1" height="1"></td> <td id="#333399" bgcolor="#333399" width="10" height="10"><img width="1" height="1"></td>
<td id="#663366" bgcolor="#663366" width="10" height="10"><img width="1" height="1"></td> <td id="#663366" bgcolor="#663366" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
<tr> <tr>
<td id="#000000" bgcolor="#000000" width="10" height="10"><img width="1" height="1"></td> <td id="#000000" bgcolor="#000000" width="10" height="10"><img width="1" height="1"></td>
<td id="#330000" bgcolor="#330000" width="10" height="10"><img width="1" height="1"></td> <td id="#330000" bgcolor="#330000" width="10" height="10"><img width="1" height="1"></td>
<td id="#663300" bgcolor="#663300" width="10" height="10"><img width="1" height="1"></td> <td id="#663300" bgcolor="#663300" width="10" height="10"><img width="1" height="1"></td>
<td id="#663333" bgcolor="#663333" width="10" height="10"><img width="1" height="1"></td> <td id="#663333" bgcolor="#663333" width="10" height="10"><img width="1" height="1"></td>
<td id="#333300" bgcolor="#333300" width="10" height="10"><img width="1" height="1"></td> <td id="#333300" bgcolor="#333300" width="10" height="10"><img width="1" height="1"></td>
<td id="#003300" bgcolor="#003300" width="10" height="10"><img width="1" height="1"></td> <td id="#003300" bgcolor="#003300" width="10" height="10"><img width="1" height="1"></td>
<td id="#003333" bgcolor="#003333" width="10" height="10"><img width="1" height="1"></td> <td id="#003333" bgcolor="#003333" width="10" height="10"><img width="1" height="1"></td>
<td id="#000066" bgcolor="#000066" width="10" height="10"><img width="1" height="1"></td> <td id="#000066" bgcolor="#000066" width="10" height="10"><img width="1" height="1"></td>
<td id="#330099" bgcolor="#330099" width="10" height="10"><img width="1" height="1"></td> <td id="#330099" bgcolor="#330099" width="10" height="10"><img width="1" height="1"></td>
<td id="#330033" bgcolor="#330033" width="10" height="10"><img width="1" height="1"></td> <td id="#330033" bgcolor="#330033" width="10" height="10"><img width="1" height="1"></td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>
   
// Cross-Browser Rich Text Editor // Cross-Browser Rich Text Editor
// http://www.kevinroth.com/rte/demo.htm // http://www.kevinroth.com/rte/demo.htm
// Written by Kevin Roth (kevin@NOSPAMkevinroth.com - remove NOSPAM) // Written by Kevin Roth (kevin@NOSPAMkevinroth.com - remove NOSPAM)
// Visit the support forums at http://www.kevinroth.com/forums/index.php?c=2 // Visit the support forums at http://www.kevinroth.com/forums/index.php?c=2
// This code is public domain. Redistribution and use of this code, with or without modification, is permitted. // This code is public domain. Redistribution and use of this code, with or without modification, is permitted.
//init variables //init variables
var isRichText = false; var isRichText = false;
var rng; var rng;
var currentRTE; var currentRTE;
var allRTEs = ""; var allRTEs = "";
var isIE; var isIE;
var isGecko; var isGecko;
var isSafari; var isSafari;
var isKonqueror; var isKonqueror;
var imagesPath; var imagesPath;
var includesPath; var includesPath;
var cssFile; var cssFile;
var generateXHTML; var generateXHTML;
var lang = "en"; var lang = "en";
var encoding = "iso-8859-1"; var encoding = "iso-8859-1";
/////////////////////////////////// ///////////////////////////////////
/////////// ///////////
///////// javascript: currentRTE='short_story'; insertHTML("<b>Done!</b>") ///////// javascript: currentRTE='short_story'; insertHTML("<b>Done!</b>")
////////// //////////
/////////////////////////////////// ///////////////////////////////////
function initRTE(imgPath, incPath, css, genXHTML) { function initRTE(imgPath, incPath, css, genXHTML) {
//set browser vars //set browser vars
var ua = navigator.userAgent.toLowerCase(); var ua = navigator.userAgent.toLowerCase();
isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)); isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));
isGecko = (ua.indexOf("gecko") != -1); isGecko = (ua.indexOf("gecko") != -1);
isSafari = (ua.indexOf("safari") != -1); isSafari = (ua.indexOf("safari") != -1);
isKonqueror = (ua.indexOf("konqueror") != -1); isKonqueror = (ua.indexOf("konqueror") != -1);
generateXHTML = genXHTML; generateXHTML = genXHTML;
//check to see if designMode mode is available //check to see if designMode mode is available
//Safari/Konqueror think they are designMode capable even though they are not //Safari/Konqueror think they are designMode capable even though they are not
if (document.getElementById && document.designMode && !isSafari && !isKonqueror) { if (document.getElementById && document.designMode && !isSafari && !isKonqueror) {
isRichText = true; isRichText = true;
} }
if (isIE) { if (isIE) {
document.onmouseover = raiseButton; document.onmouseover = raiseButton;
document.onmouseout = normalButton; document.onmouseout = normalButton;
document.onmousedown = lowerButton; document.onmousedown = lowerButton;
document.onmouseup = raiseButton; document.onmouseup = raiseButton;
} }
//set paths vars //set paths vars
imagesPath = imgPath; imagesPath = imgPath;
includesPath = incPath; includesPath = incPath;
cssFile = css; cssFile = css;
if (isRichText) document.writeln('<style type="text/css">@import "' + includesPath + 'rte.css";</style>'); if (isRichText) document.writeln('<style type="text/css">@import "' + includesPath + 'rte.css";</style>');
//for testing standard textarea, uncomment the following line //for testing standard textarea, uncomment the following line
//isRichText = false; //isRichText = false;
} }
function writeRichText(rte, html, width, height, buttons, readOnly) { function writeRichText(rte, html, width, height, buttons, readOnly) {
if (isRichText) { if (isRichText) {
if (allRTEs.length > 0) allRTEs += ";"; if (allRTEs.length > 0) allRTEs += ";";
allRTEs += rte; allRTEs += rte;
if (readOnly) buttons = false; if (readOnly) buttons = false;
//adjust minimum table widths //adjust minimum table widths
if (isIE) { if (isIE) {
// if (buttons && (width < 540)) width = 540; // if (buttons && (width < 540)) width = 540;
var tablewidth = width; var tablewidth = width;
} else { } else {
// if (buttons && (width < 540)) width = 540; // if (buttons && (width < 540)) width = 540;
var tablewidth = width + 4; var tablewidth = width + 4;
} }
document.writeln('<div class="rteDiv">'); document.writeln('<div class="rteDiv">');
if (buttons == true) { if (buttons == true) {
document.writeln('<table class="rteBack" cellpadding=2 cellspacing=0 id="Buttons1_' + rte + '" width="' + tablewidth + '">'); document.writeln('<table class="rteBack" cellpadding=2 cellspacing=0 id="Buttons1_' + rte + '" width="' + tablewidth + '">');
document.writeln(' <tr>'); document.writeln(' <tr>');
document.writeln(' <td>'); document.writeln(' <td>');
document.writeln(' <select style="margin: 1px; font-size: 12px; height: 18px;" id="formatblock_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id);">'); document.writeln(' <select style="margin: 1px; font-size: 12px; height: 18px;" id="formatblock_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id);">');
document.writeln(' <option value="">[Style]</option>'); document.writeln(' <option value="">[Style]</option>');
document.writeln(' <option value="<p>">Paragraph &lt;p&gt;</option>'); document.writeln(' <option value="<p>">Paragraph &lt;p&gt;</option>');
document.writeln(' <option value="<h1>">Heading 1 &lt;h1&gt;</option>'); document.writeln(' <option value="<h1>">Heading 1 &lt;h1&gt;</option>');
document.writeln(' <option value="<h2>">Heading 2 &lt;h2&gt;</option>'); document.writeln(' <option value="<h2>">Heading 2 &lt;h2&gt;</option>');
document.writeln(' <option value="<h3>">Heading 3 &lt;h3&gt;</option>'); document.writeln(' <option value="<h3>">Heading 3 &lt;h3&gt;</option>');
document.writeln(' <option value="<h4>">Heading 4 &lt;h4&gt;</option>'); document.writeln(' <option value="<h4>">Heading 4 &lt;h4&gt;</option>');
document.writeln(' <option value="<h5>">Heading 5 &lt;h5&gt;</option>'); document.writeln(' <option value="<h5>">Heading 5 &lt;h5&gt;</option>');
document.writeln(' <option value="<h6>">Heading 6 &lt;h6&gt;</option>'); document.writeln(' <option value="<h6>">Heading 6 &lt;h6&gt;</option>');
document.writeln(' <option value="<address>">Address &lt;ADDR&gt;</option>'); document.writeln(' <option value="<address>">Address &lt;ADDR&gt;</option>');
document.writeln(' <option value="<pre>">Formatted &lt;pre&gt;</option>'); document.writeln(' <option value="<pre>">Formatted &lt;pre&gt;</option>');
document.writeln(' </select>'); document.writeln(' </select>');
document.writeln(' </td>'); document.writeln(' </td>');
document.writeln(' <td>'); document.writeln(' <td>');
document.writeln(' <select style="margin: 1px; font-size: 12px; height: 18px;" id="fontname_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id)">'); document.writeln(' <select style="margin: 1px; font-size: 12px; height: 18px;" id="fontname_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id)">');
document.writeln(' <option value="Font" selected>[Font]</option>'); document.writeln(' <option value="Font" selected>[Font]</option>');
document.writeln(' <option value="Arial, Helvetica, sans-serif">Arial</option>'); document.writeln(' <option value="Arial, Helvetica, sans-serif">Arial</option>');
document.writeln(' <option value="Courier New, Courier, mono">Courier New</option>'); document.writeln(' <option value="Courier New, Courier, mono">Courier New</option>');
document.writeln(' <option value="Times New Roman, Times, serif">Times New Roman</option>'); document.writeln(' <option value="Times New Roman, Times, serif">Times New Roman</option>');
document.writeln(' <option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>'); document.writeln(' <option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>');
document.writeln(' <option value="Helvetica, Verdana, Arial, sans-serif">Helvetica</option>'); document.writeln(' <option value="Helvetica, Verdana, Arial, sans-serif">Helvetica</option>');
document.writeln(' </select>'); document.writeln(' </select>');
document.writeln(' </td>'); document.writeln(' </td>');
document.writeln(' <td>'); document.writeln(' <td>');
document.writeln(' <select style="margin: 1px; font-size: 12px; height: 18px;" unselectable="on" id="fontsize_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id);">'); document.writeln(' <select style="margin: 1px; font-size: 12px; height: 18px;" unselectable="on" id="fontsize_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id);">');
document.writeln(' <option value="Size">[Size]</option>'); document.writeln(' <option value="Size">[Size]</option>');
document.writeln(' <option value="1">1</option>'); document.writeln(' <option value="1">1</option>');
document.writeln(' <option value="2">2</option>'); document.writeln(' <option value="2">2</option>');
document.writeln(' <option value="3">3</option>'); document.writeln(' <option value="3">3</option>');
document.writeln(' <option value="4">4</option>'); document.writeln(' <option value="4">4</option>');
document.writeln(' <option value="5">5</option>'); document.writeln(' <option value="5">5</option>');
document.writeln(' <option value="6">6</option>'); document.writeln(' <option value="6">6</option>');
document.writeln(' <option value="7">7</option>'); document.writeln(' <option value="7">7</option>');
document.writeln(' </select>'); document.writeln(' </select>');
document.writeln(' </td>'); document.writeln(' </td>');
document.writeln(' <td width="100%">'); document.writeln(' <td width="100%">');
document.writeln(' </td>'); document.writeln(' </td>');
document.writeln(' </tr>'); document.writeln(' </tr>');
document.writeln('</table>'); document.writeln('</table>');
document.writeln('<table class="rteBack" cellpadding="0" cellspacing="0" id="Buttons2_' + rte + '" width="' + tablewidth + '">'); document.writeln('<table class="rteBack" cellpadding="0" cellspacing="0" id="Buttons2_' + rte + '" width="' + tablewidth + '">');
document.writeln(' <tr>'); document.writeln(' <tr>');
document.writeln(' <td><img id="bold" class="rteImage" src="' + imagesPath + 'bold.gif" width="25" height="24" alt="Bold" title="Bold" onClick="rteCommand(\'' + rte + '\', \'bold\', \'\')"></td>'); document.writeln(' <td><img id="bold" class="rteImage" src="' + imagesPath + 'bold.gif" width="25" height="24" alt="Bold" title="Bold" onClick="rteCommand(\'' + rte + '\', \'bold\', \'\')"></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'italic.gif" width="25" height="24" alt="Italic" title="Italic" onClick="rteCommand(\'' + rte + '\', \'italic\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'italic.gif" width="25" height="24" alt="Italic" title="Italic" onClick="rteCommand(\'' + rte + '\', \'italic\', \'\')"></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'underline.gif" width="25" height="24" alt="Underline" title="Underline" onClick="rteCommand(\'' + rte + '\', \'underline\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'underline.gif" width="25" height="24" alt="Underline" title="Underline" onClick="rteCommand(\'' + rte + '\', \'underline\', \'\')"></td>');
document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'left_just.gif" width="25" height="24" alt="Align Left" title="Align Left" onClick="rteCommand(\'' + rte + '\', \'justifyleft\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'left_just.gif" width="25" height="24" alt="Align Left" title="Align Left" onClick="rteCommand(\'' + rte + '\', \'justifyleft\', \'\')"></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'centre.gif" width="25" height="24" alt="Center" title="Center" onClick="rteCommand(\'' + rte + '\', \'justifycenter\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'centre.gif" width="25" height="24" alt="Center" title="Center" onClick="rteCommand(\'' + rte + '\', \'justifycenter\', \'\')"></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'right_just.gif" width="25" height="24" alt="Align Right" title="Align Right" onClick="rteCommand(\'' + rte + '\', \'justifyright\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'right_just.gif" width="25" height="24" alt="Align Right" title="Align Right" onClick="rteCommand(\'' + rte + '\', \'justifyright\', \'\')"></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'justifyfull.gif" width="25" height="24" alt="Justify Full" title="Justify Full" onclick="rteCommand(\'' + rte + '\', \'justifyfull\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'justifyfull.gif" width="25" height="24" alt="Justify Full" title="Justify Full" onclick="rteCommand(\'' + rte + '\', \'justifyfull\', \'\')"></td>');
document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'hr.gif" width="25" height="24" alt="Horizontal Rule" title="Horizontal Rule" onClick="rteCommand(\'' + rte + '\', \'inserthorizontalrule\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'hr.gif" width="25" height="24" alt="Horizontal Rule" title="Horizontal Rule" onClick="rteCommand(\'' + rte + '\', \'inserthorizontalrule\', \'\')"></td>');
document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'numbered_list.gif" width="25" height="24" alt="Ordered List" title="Ordered List" onClick="rteCommand(\'' + rte + '\', \'insertorderedlist\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'numbered_list.gif" width="25" height="24" alt="Ordered List" title="Ordered List" onClick="rteCommand(\'' + rte + '\', \'insertorderedlist\', \'\')"></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'list.gif" width="25" height="24" alt="Unordered List" title="Unordered List" onClick="rteCommand(\'' + rte + '\', \'insertunorderedlist\', \'\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'list.gif" width="25" height="24" alt="Unordered List" title="Unordered List" onClick="rteCommand(\'' + rte + '\', \'insertunorderedlist\', \'\')"></td>');
document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'outdent.gif" width="25" height="24" alt="Outdent" title="Outdent" onClick="rteCommand(\'' + rte + '\', \'outdent\', \'\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'outdent.gif" width="25" height="24" alt="Outdent" title="Outdent" onClick="rteCommand(\'' + rte + '\', \'outdent\', \'\')"></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'indent.gif" width="25" height="24" alt="Indent" title="Indent" onClick="rteCommand(\'' + rte + '\', \'indent\', \'\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'indent.gif" width="25" height="24" alt="Indent" title="Indent" onClick="rteCommand(\'' + rte + '\', \'indent\', \'\')"></td>');
document.writeln(' <td><div id="forecolor_' + rte + '"><img class="rteImage" src="' + imagesPath + 'textcolor.gif" width="25" height="24" alt="Text Color" title="Text Color" onClick="dlgColorPalette(\'' + rte + '\', \'forecolor\', \'\')"></div></td>'); document.writeln(' <td><div id="forecolor_' + rte + '"><img class="rteImage" src="' + imagesPath + 'textcolor.gif" width="25" height="24" alt="Text Color" title="Text Color" onClick="dlgColorPalette(\'' + rte + '\', \'forecolor\', \'\')"></div></td>');
document.writeln(' <td><div id="hilitecolor_' + rte + '"><img class="rteImage" src="' + imagesPath + 'bgcolor.gif" width="25" height="24" alt="Background Color" title="Background Color" onClick="dlgColorPalette(\'' + rte + '\', \'hilitecolor\', \'\')"></div></td>'); document.writeln(' <td><div id="hilitecolor_' + rte + '"><img class="rteImage" src="' + imagesPath + 'bgcolor.gif" width="25" height="24" alt="Background Color" title="Background Color" onClick="dlgColorPalette(\'' + rte + '\', \'hilitecolor\', \'\')"></div></td>');
document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'hyperlink.gif" width="25" height="24" alt="Insert Link" title="Insert Link" onClick="dlgInsertLink(\'' + rte + '\', \'link\')"></td>'); document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'hyperlink.gif" width="25" height="24" alt="Insert Link" title="Insert Link" onClick="dlgInsertLink(\'' + rte + '\', \'link\')"></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'image.gif" width="25" height="24" alt="Add Image" title="Add Image" onClick="addImage(\'' + rte + '\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'image.gif" width="25" height="24" alt="Add Image" title="Add Image" onClick="addImage(\'' + rte + '\')"></td>');
document.writeln(' <td><div id="table_' + rte + '"><img class="rteImage" src="' + imagesPath + 'insert_table.gif" width="25" height="24" alt="Insert Table" title="Insert Table" onClick="dlgInsertTable(\'' + rte + '\', \'table\', \'\')"></div></td>'); document.writeln(' <td><div id="table_' + rte + '"><img class="rteImage" src="' + imagesPath + 'insert_table.gif" width="25" height="24" alt="Insert Table" title="Insert Table" onClick="dlgInsertTable(\'' + rte + '\', \'table\', \'\')"></div></td>');
if (isIE) { if (isIE) {
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'spellcheck.gif" width="25" height="24" alt="Spell Check" title="Spell Check" onClick="checkspell()"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'spellcheck.gif" width="25" height="24" alt="Spell Check" title="Spell Check" onClick="checkspell()"></td>');
} }
// document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); // document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'cut.gif" width="25" height="24" alt="Cut" title="Cut" onClick="rteCommand(\'' + rte + '\', \'cut\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'cut.gif" width="25" height="24" alt="Cut" title="Cut" onClick="rteCommand(\'' + rte + '\', \'cut\')"></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'copy.gif" width="25" height="24" alt="Copy" title="Copy" onClick="rteCommand(\'' + rte + '\', \'copy\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'copy.gif" width="25" height="24" alt="Copy" title="Copy" onClick="rteCommand(\'' + rte + '\', \'copy\')"></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'paste.gif" width="25" height="24" alt="Paste" title="Paste" onClick="rteCommand(\'' + rte + '\', \'paste\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'paste.gif" width="25" height="24" alt="Paste" title="Paste" onClick="rteCommand(\'' + rte + '\', \'paste\')"></td>');
// document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>'); // document.writeln(' <td><img class="rteVertSep" src="' + imagesPath + 'blackdot.gif" width="1" height="20" border="0" alt=""></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'undo.gif" width="25" height="24" alt="Undo" title="Undo" onClick="rteCommand(\'' + rte + '\', \'undo\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'undo.gif" width="25" height="24" alt="Undo" title="Undo" onClick="rteCommand(\'' + rte + '\', \'undo\')"></td>');
// document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'redo.gif" width="25" height="24" alt="Redo" title="Redo" onClick="rteCommand(\'' + rte + '\', \'redo\')"></td>'); // document.writeln(' <td><img class="rteImage" src="' + imagesPath + 'redo.gif" width="25" height="24" alt="Redo" title="Redo" onClick="rteCommand(\'' + rte + '\', \'redo\')"></td>');
document.writeln(' <td width="100%"></td>'); document.writeln(' <td width="100%"></td>');
document.writeln(' </tr>'); document.writeln(' </tr>');
document.writeln('</table>'); document.writeln('</table>');
} }
document.writeln('<iframe id="' + rte + '" name="' + rte + '" width="' + width + 'px" height="' + height + 'px" src="' + includesPath + 'blank.htm"></iframe>'); document.writeln('<iframe id="' + rte + '" name="' + rte + '" width="' + width + 'px" height="' + height + 'px" src="' + includesPath + 'blank.htm"></iframe>');
if (!readOnly) document.writeln('<br /><input type="checkbox" id="chkSrc' + rte + '" onclick="toggleHTMLSrc(\'' + rte + '\',' + buttons + ');" />&nbsp;<label for="chkSrc' + rte + '">View Source</label>'); if (!readOnly) document.writeln('<br /><input type="checkbox" id="chkSrc' + rte + '" onclick="toggleHTMLSrc(\'' + rte + '\',' + buttons + ');" />&nbsp;<label for="chkSrc' + rte + '">View Source</label>');
document.writeln('<iframe width="154" height="104" id="cp' + rte + '" src="' + includesPath + 'palette.htm" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; position: absolute;"></iframe>'); document.writeln('<iframe width="154" height="104" id="cp' + rte + '" src="' + includesPath + 'palette.htm" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; position: absolute;"></iframe>');
document.writeln('<input type="hidden" id="hdn' + rte + '" name="' + rte + '" value="">'); document.writeln('<input type="hidden" id="hdn' + rte + '" name="' + rte + '" value="">');
document.writeln('</div>'); document.writeln('</div>');
document.getElementById('hdn' + rte).value = html; document.getElementById('hdn' + rte).value = html;
enableDesignMode(rte, html, readOnly); enableDesignMode(rte, html, readOnly);
} else { } else {
if (!readOnly) { if (!readOnly) {
document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + width + 'px; height: ' + height + 'px;">' + html + '</textarea>'); document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + width + 'px; height: ' + height + 'px;">' + html + '</textarea>');
} else { } else {
document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + width + 'px; height: ' + height + 'px;" readonly>' + html + '</textarea>'); document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + width + 'px; height: ' + height + 'px;" readonly>' + html + '</textarea>');
} }
} }
} }
function enableDesignMode(rte, html, readOnly) { function enableDesignMode(rte, html, readOnly) {
var frameHtml = "<html id=\"" + rte + "\">\n"; var frameHtml = "<html id=\"" + rte + "\">\n";
frameHtml += "<head>\n"; frameHtml += "<head>\n";
//to reference your stylesheet, set href property below to your stylesheet path and uncomment //to reference your stylesheet, set href property below to your stylesheet path and uncomment
if (cssFile.length > 0 ) { if (cssFile.length > 0 ) {
frameHtml += "<link media=\"all\" type=\"text/css\" href=\"" + includesPath + "rte.css\" rel=\"stylesheet\">\n"; frameHtml += "<link media=\"all\" type=\"text/css\" href=\"" + includesPath + "rte.css\" rel=\"stylesheet\">\n";
} else { } else {
frameHtml += "<style>\n"; frameHtml += "<style>\n";
frameHtml += "body {\n"; frameHtml += "body {\n";
frameHtml += " background: #FFFFFF;\n"; frameHtml += " background: #FFFFFF;\n";
frameHtml += " margin: 0px;\n"; frameHtml += " margin: 0px;\n";
frameHtml += " padding: 0px;\n"; frameHtml += " padding: 0px;\n";
frameHtml += "}\n"; frameHtml += "}\n";
frameHtml += "</style>\n"; frameHtml += "</style>\n";
} }
frameHtml += "</head>\n"; frameHtml += "</head>\n";
frameHtml += "<body>\n"; frameHtml += "<body>\n";
frameHtml += html + "\n"; frameHtml += html + "\n";
frameHtml += "</body>\n"; frameHtml += "</body>\n";
frameHtml += "</html>"; frameHtml += "</html>";
if (document.all) { if (document.all) {
var oRTE = frames[rte].document; var oRTE = frames[rte].document;
oRTE.open(); oRTE.open();
oRTE.write(frameHtml); oRTE.write(frameHtml);
oRTE.close(); oRTE.close();
if (!readOnly) { if (!readOnly) {
oRTE.designMode = "On"; oRTE.designMode = "On";
frames[rte].document.attachEvent("onkeypress", function evt_ie_keypress(event) {ieKeyPress(event, rte);}); frames[rte].document.attachEvent("onkeypress", function evt_ie_keypress(event) {ieKeyPress(event, rte);});
} }
} else { } else {
try { try {
if (!readOnly) document.getElementById(rte).contentDocument.designMode = "on"; if (!readOnly) document.getElementById(rte).contentDocument.designMode = "on";
try { try {
var oRTE = document.getElementById(rte).contentWindow.document; var oRTE = document.getElementById(rte).contentWindow.document;
oRTE.open(); oRTE.open();
oRTE.write(frameHtml); oRTE.write(frameHtml);
oRTE.close(); oRTE.close();
if (isGecko && !readOnly) { if (isGecko && !readOnly) {
//attach a keyboard handler for gecko browsers to make keyboard shortcuts work //attach a keyboard handler for gecko browsers to make keyboard shortcuts work
oRTE.addEventListener("keypress", geckoKeyPress, true); oRTE.addEventListener("keypress", geckoKeyPress, true);
} }
} catch (e) { } catch (e) {
alert("Error preloading content."); alert("Error preloading content.");
} }
} catch (e) { } catch (e) {
//gecko may take some time to enable design mode. //gecko may take some time to enable design mode.
//Keep looping until able to set. //Keep looping until able to set.
if (isGecko) { if (isGecko) {
setTimeout("enableDesignMode('" + rte + "', '" + html + "', " + readOnly + ");", 10); setTimeout("enableDesignMode('" + rte + "', '" + html + "', " + readOnly + ");", 10);
} else { } else {
return false; return false;
} }
} }
} }
} }
function updateRTE(rte) { function updateRTE(rte) {
if (!isRichText) return; if (!isRichText) return;
//check for readOnly mode //check for readOnly mode
var readOnly = false; var readOnly = false;
if (document.all) { if (document.all) {
if (frames[rte].document.designMode != "On") readOnly = true; if (frames[rte].document.designMode != "On") readOnly = true;
} else { } else {
if (document.getElementById(rte).contentDocument.designMode != "on") readOnly = true; if (document.getElementById(rte).contentDocument.designMode != "on") readOnly = true;
} }
if (isRichText && !readOnly) { if (isRichText && !readOnly) {
//if viewing source, switch back to design view //if viewing source, switch back to design view
if (document.getElementById("chkSrc" + rte).checked) document.getElementById("chkSrc" + rte).click(); if (document.getElementById("chkSrc" + rte).checked) document.getElementById("chkSrc" + rte).click();
setHiddenVal(rte); setHiddenVal(rte);
} }
} }
function setHiddenVal(rte) { function setHiddenVal(rte) {
//set hidden form field value for current rte //set hidden form field value for current rte
var oHdnField = document.getElementById('hdn' + rte); var oHdnField = document.getElementById('hdn' + rte);
//convert html output to xhtml (thanks Timothy Bell and Vyacheslav Smolin!) //convert html output to xhtml (thanks Timothy Bell and Vyacheslav Smolin!)
if (oHdnField.value == null) oHdnField.value = ""; if (oHdnField.value == null) oHdnField.value = "";
if (document.all) { if (document.all) {
if (generateXHTML) { if (generateXHTML) {
oHdnField.value = get_xhtml(frames[rte].document.body, lang, encoding); oHdnField.value = get_xhtml(frames[rte].document.body, lang, encoding);
} else { } else {
oHdnField.value = frames[rte].document.body.innerHTML; oHdnField.value = frames[rte].document.body.innerHTML;
} }
} else { } else {
if (generateXHTML) { if (generateXHTML) {
oHdnField.value = get_xhtml(document.getElementById(rte).contentWindow.document.body, lang, encoding); oHdnField.value = get_xhtml(document.getElementById(rte).contentWindow.document.body, lang, encoding);
} else { } else {
oHdnField.value = document.getElementById(rte).contentWindow.document.body.innerHTML; oHdnField.value = document.getElementById(rte).contentWindow.document.body.innerHTML;
} }
} }
//if there is no content (other than formatting) set value to nothing //if there is no content (other than formatting) set value to nothing
if (stripHTML(oHdnField.value.replace("&nbsp;", " ")) == "" && if (stripHTML(oHdnField.value.replace("&nbsp;", " ")) == "" &&
oHdnField.value.toLowerCase().search("<hr") == -1 && oHdnField.value.toLowerCase().search("<hr") == -1 &&
oHdnField.value.toLowerCase().search("<img") == -1) oHdnField.value = ""; oHdnField.value.toLowerCase().search("<img") == -1) oHdnField.value = "";
} }
function updateRTEs() { function updateRTEs() {
var vRTEs = allRTEs.split(";"); var vRTEs = allRTEs.split(";");
for (var i = 0; i < vRTEs.length; i++) { for (var i = 0; i < vRTEs.length; i++) {
updateRTE(vRTEs[i]); updateRTE(vRTEs[i]);
} }
} }
function rteCommand(rte, command, option) { function rteCommand(rte, command, option) {
//function to perform command //function to perform command
var oRTE; var oRTE;
if (document.all) { if (document.all) {
oRTE = frames[rte]; oRTE = frames[rte];
} else { } else {
oRTE = document.getElementById(rte).contentWindow; oRTE = document.getElementById(rte).contentWindow;
} }
try { try {
oRTE.focus(); oRTE.focus();
oRTE.document.execCommand(command, false, option); oRTE.document.execCommand(command, false, option);
oRTE.focus(); oRTE.focus();
} catch (e) { } catch (e) {
// alert(e); // alert(e);
// setTimeout("rteCommand('" + rte + "', '" + command + "', '" + option + "');", 10); // setTimeout("rteCommand('" + rte + "', '" + command + "', '" + option + "');", 10);
} }
} }
function toggleHTMLSrc(rte, buttons) { function toggleHTMLSrc(rte, buttons) {
//contributed by Bob Hutzel (thanks Bob!) //contributed by Bob Hutzel (thanks Bob!)
var oHdnField = document.getElementById('hdn' + rte); var oHdnField = document.getElementById('hdn' + rte);
if (document.getElementById("chkSrc" + rte).checked) { if (document.getElementById("chkSrc" + rte).checked) {
//we are checking the box //we are checking the box
rteCommand(rte,'selectall',''); rteCommand(rte,'selectall','');
if (buttons) { if (buttons) {
showHideElement("Buttons1_" + rte, "hide"); showHideElement("Buttons1_" + rte, "hide");
showHideElement("Buttons2_" + rte, "hide"); showHideElement("Buttons2_" + rte, "hide");
} }
setHiddenVal(rte); setHiddenVal(rte);
if (document.all) { if (document.all) {
frames[rte].document.body.innerText = oHdnField.value; frames[rte].document.body.innerText = oHdnField.value;
} else { } else {
var oRTE = document.getElementById(rte).contentWindow.document; var oRTE = document.getElementById(rte).contentWindow.document;
var htmlSrc = oRTE.createTextNode(oHdnField.value); var htmlSrc = oRTE.createTextNode(oHdnField.value);
oRTE.body.innerHTML = ""; oRTE.body.innerHTML = "";
oRTE.body.appendChild(htmlSrc); oRTE.body.appendChild(htmlSrc);
} }
} else { } else {
//we are unchecking the box //we are unchecking the box
if (buttons) { if (buttons) {
showHideElement("Buttons1_" + rte, "show"); showHideElement("Buttons1_" + rte, "show");
showHideElement("Buttons2_" + rte, "show"); showHideElement("Buttons2_" + rte, "show");
} }
if (document.all) { if (document.all) {
//fix for IE //fix for IE
var output = escape(frames[rte].document.body.innerText); var output = escape(frames[rte].document.body.innerText);
output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E"); output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E");
output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E"); output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E");
frames[rte].document.body.innerHTML = unescape(output); frames[rte].document.body.innerHTML = unescape(output);
} else { } else {
var oRTE = document.getElementById(rte).contentWindow.document; var oRTE = document.getElementById(rte).contentWindow.document;
var htmlSrc = oRTE.body.ownerDocument.createRange(); var htmlSrc = oRTE.body.ownerDocument.createRange();
htmlSrc.selectNodeContents(oRTE.body); htmlSrc.selectNodeContents(oRTE.body);
oRTE.body.innerHTML = htmlSrc.toString(); oRTE.body.innerHTML = htmlSrc.toString();
} }
} }
} }
function dlgColorPalette(rte, command) { function dlgColorPalette(rte, command) {
//function to display or hide color palettes //function to display or hide color palettes
setRange(rte); setRange(rte);
//get dialog position //get dialog position
var oDialog = document.getElementById('cp' + rte); var oDialog = document.getElementById('cp' + rte);
var buttonElement = document.getElementById(command + '_' + rte); var buttonElement = document.getElementById(command + '_' + rte);
var iLeftPos = getOffsetLeft(buttonElement); var iLeftPos = getOffsetLeft(buttonElement);
var iTopPos = getOffsetTop(buttonElement) + (buttonElement.offsetHeight + 4); var iTopPos = getOffsetTop(buttonElement) + (buttonElement.offsetHeight + 4);
oDialog.style.left = (iLeftPos) + "px"; oDialog.style.left = (iLeftPos) + "px";
oDialog.style.top = (iTopPos) + "px"; oDialog.style.top = (iTopPos) + "px";
if ((command == parent.command) && (rte == currentRTE)) { if ((command == parent.command) && (rte == currentRTE)) {
//if current command dialog is currently open, close it //if current command dialog is currently open, close it
if (oDialog.style.visibility == "hidden") { if (oDialog.style.visibility == "hidden") {
showHideElement(oDialog, 'show'); showHideElement(oDialog, 'show');
} else { } else {
showHideElement(oDialog, 'hide'); showHideElement(oDialog, 'hide');
} }
} else { } else {
//if opening a new dialog, close all others //if opening a new dialog, close all others
var vRTEs = allRTEs.split(";"); var vRTEs = allRTEs.split(";");
for (var i = 0; i < vRTEs.length; i++) { for (var i = 0; i < vRTEs.length; i++) {
showHideElement('cp' + vRTEs[i], 'hide'); showHideElement('cp' + vRTEs[i], 'hide');
} }
showHideElement(oDialog, 'show'); showHideElement(oDialog, 'show');
} }
//save current values //save current values
parent.command = command; parent.command = command;
currentRTE = rte; currentRTE = rte;
} }
function dlgInsertTable(rte, command) { function dlgInsertTable(rte, command) {
//function to open/close insert table dialog //function to open/close insert table dialog
//save current values //save current values
parent.command = command; parent.command = command;
currentRTE = rte; currentRTE = rte;
InsertTable = popUpWin(includesPath + 'insert_table.htm', 'InsertTable', 360, 180, ''); InsertTable = popUpWin(includesPath + 'insert_table.htm', 'InsertTable', 360, 180, '');
} }
function dlgInsertLink(rte, command) { function dlgInsertLink(rte, command) {
//function to open/close insert table dialog //function to open/close insert table dialog
//save current values //save current values
parent.command = command; parent.command = command;
currentRTE = rte; currentRTE = rte;
InsertLink = popUpWin(includesPath + 'insert_link.htm', 'InsertLink', 360, 180, ''); InsertLink = popUpWin(includesPath + 'insert_link.htm', 'InsertLink', 360, 180, '');
//get currently highlighted text and set link text value //get currently highlighted text and set link text value
setRange(rte); setRange(rte);
var linkText = ''; var linkText = '';
if (isIE) { if (isIE) {
linkText = stripHTML(rng.htmlText); linkText = stripHTML(rng.htmlText);
} else { } else {
linkText = stripHTML(rng.toString()); linkText = stripHTML(rng.toString());
} }
setLinkText(linkText); setLinkText(linkText);
} }
function setLinkText(linkText) { function setLinkText(linkText) {
//set link text value in insert link dialog //set link text value in insert link dialog
try { try {
window.InsertLink.document.linkForm.linkText.value = linkText; window.InsertLink.document.linkForm.linkText.value = linkText;
} catch (e) { } catch (e) {
//may take some time to create dialog window. //may take some time to create dialog window.
//Keep looping until able to set. //Keep looping until able to set.
setTimeout("setLinkText('" + linkText + "');", 10); setTimeout("setLinkText('" + linkText + "');", 10);
} }
} }
function popUpWin (url, win, width, height, options) { function popUpWin (url, win, width, height, options) {
var leftPos = (screen.availWidth - width) / 2; var leftPos = (screen.availWidth - width) / 2;
var topPos = (screen.availHeight - height) / 2; var topPos = (screen.availHeight - height) / 2;
options += 'width=' + width + ',height=' + height + ',left=' + leftPos + ',top=' + topPos; options += 'width=' + width + ',height=' + height + ',left=' + leftPos + ',top=' + topPos;
return window.open(url, win, options); return window.open(url, win, options);
} }
function setColor(color) { function setColor(color) {
//function to set color //function to set color
var rte = currentRTE; var rte = currentRTE;
var parentCommand = parent.command; var parentCommand = parent.command;
if (document.all) { if (document.all) {
if (parentCommand == "hilitecolor") parentCommand = "backcolor"; if (parentCommand == "hilitecolor") parentCommand = "backcolor";
//retrieve selected range //retrieve selected range
rng.select(); rng.select();
} }
rteCommand(rte, parentCommand, color); rteCommand(rte, parentCommand, color);
showHideElement('cp' + rte, "hide"); showHideElement('cp' + rte, "hide");
} }
function addImage(rte) { function addImage(rte) {
//function to add image //function to add image
imagePath = prompt('Enter Image URL:', 'http://'); imagePath = prompt('Enter Image URL:', 'http://');
if ((imagePath != null) && (imagePath != "")) { if ((imagePath != null) && (imagePath != "")) {
rteCommand(rte, 'InsertImage', imagePath); rteCommand(rte, 'InsertImage', imagePath);
} }
} }
// Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div. // Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div.
// KJR 11/12/2004 Changed to position palette based on parent div, so palette will always appear in proper location regardless of nested divs // KJR 11/12/2004 Changed to position palette based on parent div, so palette will always appear in proper location regardless of nested divs
function getOffsetTop(elm) { function getOffsetTop(elm) {
var mOffsetTop = elm.offsetTop; var mOffsetTop = elm.offsetTop;
var mOffsetParent = elm.offsetParent; var mOffsetParent = elm.offsetParent;
var parents_up = 2; //the positioning div is 2 elements up the tree var parents_up = 2; //the positioning div is 2 elements up the tree
while(parents_up > 0) { while(parents_up > 0) {
mOffsetTop += mOffsetParent.offsetTop; mOffsetTop += mOffsetParent.offsetTop;
mOffsetParent = mOffsetParent.offsetParent; mOffsetParent = mOffsetParent.offsetParent;
parents_up--; parents_up--;
} }
return mOffsetTop; return mOffsetTop;
} }
// Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div. // Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div.
// KJR 11/12/2004 Changed to position palette based on parent div, so palette will always appear in proper location regardless of nested divs // KJR 11/12/2004 Changed to position palette based on parent div, so palette will always appear in proper location regardless of nested divs
function getOffsetLeft(elm) { function getOffsetLeft(elm) {
var mOffsetLeft = elm.offsetLeft; var mOffsetLeft = elm.offsetLeft;
var mOffsetParent = elm.offsetParent; var mOffsetParent = elm.offsetParent;
var parents_up = 2; var parents_up = 2;
while(parents_up > 0) { while(parents_up > 0) {
mOffsetLeft += mOffsetParent.offsetLeft; mOffsetLeft += mOffsetParent.offsetLeft;
mOffsetParent = mOffsetParent.offsetParent; mOffsetParent = mOffsetParent.offsetParent;
parents_up--; parents_up--;
} }
return mOffsetLeft; return mOffsetLeft;
} }
function selectFont(rte, selectname) { function selectFont(rte, selectname) {
//function to handle font changes //function to handle font changes
var idx = document.getElementById(selectname).selectedIndex; var idx = document.getElementById(selectname).selectedIndex;
// First one is always a label // First one is always a label
if (idx != 0) { if (idx != 0) {
var selected = document.getElementById(selectname).options[idx].value; var selected = document.getElementById(selectname).options[idx].value;
var cmd = selectname.replace('_' + rte, ''); var cmd = selectname.replace('_' + rte, '');
rteCommand(rte, cmd, selected); rteCommand(rte, cmd, selected);
document.getElementById(selectname).selectedIndex = 0; document.getElementById(selectname).selectedIndex = 0;
} }
} }
function insertHTML(html) { function insertHTML(html) {
//function to add HTML -- thanks dannyuk1982 //function to add HTML -- thanks dannyuk1982
var rte = currentRTE; var rte = currentRTE;
var oRTE; var oRTE;
if (document.all) { if (document.all) {
oRTE = frames[rte]; oRTE = frames[rte];
} else { } else {
oRTE = document.getElementById(rte).contentWindow; oRTE = document.getElementById(rte).contentWindow;
} }
oRTE.focus(); oRTE.focus();
if (document.all) { if (document.all) {
var oRng = oRTE.document.selection.createRange(); var oRng = oRTE.document.selection.createRange();
oRng.pasteHTML(html); oRng.pasteHTML(html);
oRng.collapse(false); oRng.collapse(false);
oRng.select(); oRng.select();
} else { } else {
oRTE.document.execCommand('insertHTML', false, html); oRTE.document.execCommand('insertHTML', false, html);
} }
} }
function showHideElement(element, showHide) { function showHideElement(element, showHide) {
//function to show or hide elements //function to show or hide elements
//element variable can be string or object //element variable can be string or object
if (document.getElementById(element)) { if (document.getElementById(element)) {
element = document.getElementById(element); element = document.getElementById(element);
} }
if (showHide == "show") { if (showHide == "show") {
element.style.visibility = "visible"; element.style.visibility = "visible";
} else if (showHide == "hide") { } else if (showHide == "hide") {
element.style.visibility = "hidden"; element.style.visibility = "hidden";
} }
} }
function setRange(rte) { function setRange(rte) {
//function to store range of current selection //function to store range of current selection
var oRTE; var oRTE;
if (document.all) { if (document.all) {
oRTE = frames[rte]; oRTE = frames[rte];
var selection = oRTE.document.selection; var selection = oRTE.document.selection;
if (selection != null) rng = selection.createRange(); if (selection != null) rng = selection.createRange();
} else { } else {
oRTE = document.getElementById(rte).contentWindow; oRTE = document.getElementById(rte).contentWindow;
var selection = oRTE.getSelection(); var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange(); rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
} }
return rng; return rng;
} }
function stripHTML(oldString) { function stripHTML(oldString) {
//function to strip all html //function to strip all html
var newString = oldString.replace(/(<([^>]+)>)/ig,""); var newString = oldString.replace(/(<([^>]+)>)/ig,"");
//replace carriage returns and line feeds //replace carriage returns and line feeds
newString = newString.replace(/\r\n/g," "); newString = newString.replace(/\r\n/g," ");
newString = newString.replace(/\n/g," "); newString = newString.replace(/\n/g," ");
newString = newString.replace(/\r/g," "); newString = newString.replace(/\r/g," ");
//trim string //trim string
newString = trim(newString); newString = trim(newString);
return newString; return newString;
} }
function trim(inputString) { function trim(inputString) {
// Removes leading and trailing spaces from the passed string. Also removes // Removes leading and trailing spaces from the passed string. Also removes
// consecutive spaces and replaces it with one space. If something besides // consecutive spaces and replaces it with one space. If something besides
// a string is passed in (null, custom object, etc.) then return the input. // a string is passed in (null, custom object, etc.) then return the input.
if (typeof inputString != "string") return inputString; if (typeof inputString != "string") return inputString;
var retValue = inputString; var retValue = inputString;
var ch = retValue.substring(0, 1); var ch = retValue.substring(0, 1);
while (ch == " ") { // Check for spaces at the beginning of the string while (ch == " ") { // Check for spaces at the beginning of the string
retValue = retValue.substring(1, retValue.length); retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1); ch = retValue.substring(0, 1);
} }
ch = retValue.substring(retValue.length - 1, retValue.length); ch = retValue.substring(retValue.length - 1, retValue.length);
while (ch == " ") { // Check for spaces at the end of the string while (ch == " ") { // Check for spaces at the end of the string
retValue = retValue.substring(0, retValue.length - 1); retValue = retValue.substring(0, retValue.length - 1);
ch = retValue.substring(retValue.length - 1, retValue.length); ch = retValue.substring(retValue.length - 1, retValue.length);
} }
// Note that there are two spaces in the string - look for multiple spaces within the string // Note that there are two spaces in the string - look for multiple spaces within the string
while (retValue.indexOf(" ") != -1) { while (retValue.indexOf(" ") != -1) {
// Again, there are two spaces in each of the strings // Again, there are two spaces in each of the strings
retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ") + 1, retValue.length); retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ") + 1, retValue.length);
} }
return retValue; // Return the trimmed string back to the user return retValue; // Return the trimmed string back to the user
} }
//******************** //********************
//Gecko-Only Functions //Gecko-Only Functions
//******************** //********************
function geckoKeyPress(evt) { function geckoKeyPress(evt) {
//function to add bold, italic, and underline shortcut commands to gecko RTEs //function to add bold, italic, and underline shortcut commands to gecko RTEs
//contributed by Anti Veeranna (thanks Anti!) //contributed by Anti Veeranna (thanks Anti!)
var rte = evt.target.id; var rte = evt.target.id;
if (evt.ctrlKey) { if (evt.ctrlKey) {
var key = String.fromCharCode(evt.charCode).toLowerCase(); var key = String.fromCharCode(evt.charCode).toLowerCase();
var cmd = ''; var cmd = '';
switch (key) { switch (key) {
case 'b': cmd = "bold"; break; case 'b': cmd = "bold"; break;
case 'i': cmd = "italic"; break; case 'i': cmd = "italic"; break;
case 'u': cmd = "underline"; break; case 'u': cmd = "underline"; break;
}; };
if (cmd) { if (cmd) {
rteCommand(rte, cmd, null); rteCommand(rte, cmd, null);
// stop the event bubble // stop the event bubble
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation(); evt.stopPropagation();
} }
} }
} }
//***************** //*****************
//IE-Only Functions //IE-Only Functions
//***************** //*****************
function ieKeyPress(evt, rte) { function ieKeyPress(evt, rte) {
var key = (evt.which || evt.charCode || evt.keyCode); var key = (evt.which || evt.charCode || evt.keyCode);
var stringKey = String.fromCharCode(key).toLowerCase(); var stringKey = String.fromCharCode(key).toLowerCase();
//the following breaks list and indentation functionality in IE (don't use) //the following breaks list and indentation functionality in IE (don't use)
// switch (key) { // switch (key) {
// case 13: // case 13:
// //insert <br> tag instead of <p> // //insert <br> tag instead of <p>
// //change the key pressed to null // //change the key pressed to null
// evt.keyCode = 0; // evt.keyCode = 0;
// //
// //insert <br> tag // //insert <br> tag
// currentRTE = rte; // currentRTE = rte;
// insertHTML('<br>'); // insertHTML('<br>');
// break; // break;
// }; // };
} }
function checkspell() { function checkspell() {
//function to perform spell check //function to perform spell check
try { try {
var tmpis = new ActiveXObject("ieSpell.ieSpellExtension"); var tmpis = new ActiveXObject("ieSpell.ieSpellExtension");
tmpis.CheckAllLinkedDocuments(document); tmpis.CheckAllLinkedDocuments(document);
} }
catch(exception) { catch(exception) {
if(exception.number==-2146827859) { if(exception.number==-2146827859) {
if (confirm("ieSpell not detected. Click Ok to go to download page.")) if (confirm("ieSpell not detected. Click Ok to go to download page."))
window.open("http://www.iespell.com/download.php","DownLoad"); window.open("http://www.iespell.com/download.php","DownLoad");
} else { } else {
alert("Error Loading ieSpell: Exception " + exception.number); alert("Error Loading ieSpell: Exception " + exception.number);
} }
} }
} }
function raiseButton(e) { function raiseButton(e) {
var el = window.event.srcElement; var el = window.event.srcElement;
className = el.className; className = el.className;
if (className == 'rteImage' || className == 'rteImageLowered') { if (className == 'rteImage' || className == 'rteImageLowered') {
el.className = 'rteImageRaised'; el.className = 'rteImageRaised';
} }
} }
function normalButton(e) { function normalButton(e) {
var el = window.event.srcElement; var el = window.event.srcElement;
className = el.className; className = el.className;
if (className == 'rteImageRaised' || className == 'rteImageLowered') { if (className == 'rteImageRaised' || className == 'rteImageLowered') {
el.className = 'rteImage'; el.className = 'rteImage';
} }
} }
function lowerButton(e) { function lowerButton(e) {
var el = window.event.srcElement; var el = window.event.srcElement;
className = el.className; className = el.className;
if (className == 'rteImage' || className == 'rteImageRaised') { if (className == 'rteImage' || className == 'rteImageRaised') {
el.className = 'rteImageLowered'; el.className = 'rteImageLowered';
} }
} }
.rteImage { .rteImage {
background: #D3D3D3; background: #D3D3D3;
background: #ECE9D8; background: #ECE9D8;
border: 1px solid #ECE9D8; border: 1px solid #ECE9D8;
} }
.rteImageRaised, .rteImage:hover { .rteImageRaised, .rteImage:hover {
background: #D3D3D3; background: #D3D3D3;
border: 1px outset; border: 1px outset;
} }
.rteImageLowered, .rteImage:active { .rteImageLowered, .rteImage:active {
background: #D3D3D3; background: #D3D3D3;
border: 1px inset; border: 1px inset;
} }
.rteVertSep { .rteVertSep {
margin: 0 4px 0 4px; margin: 0 4px 0 4px;
} }
.rteBack { .rteBack {
background: #D3D3D3; background: #D3D3D3;
background: #ECE9D8; background: #ECE9D8;
border: 1px outset; border: 1px outset;
letter-spacing: 0; letter-spacing: 0;
} }
.rteBack tbody tr td, .rteBack tr td { .rteBack tbody tr td, .rteBack tr td {
background: #D3D3D3; background: #D3D3D3;
background: #ECE9D8; background: #ECE9D8;
padding: 0; padding: 0;
} }
.rteDiv { .rteDiv {
display: block; display: block;
position: relative; position: relative;
} }
.rteImage {background:#EFEDDE;border:1px solid #EFEDDE;width:25px;height:24px;margin:0px;} .rteImage {background:#EFEDDE;border:1px solid #EFEDDE;width:25px;height:24px;margin:0px;}
.rteImageRaised,.rteImage:hover {background:#cddbf3;border:1px solid #6e9ce6;width:25px;height:24px;margin:0px;} .rteImageRaised,.rteImage:hover {background:#cddbf3;border:1px solid #6e9ce6;width:25px;height:24px;margin:0px;}
.rteImageLowered,.rteImage:active {background:#C1D2EE;border:1px solid #316ac5;width:25px;height:24px;margin:0px;} .rteImageLowered,.rteImage:active {background:#C1D2EE;border:1px solid #316ac5;width:25px;height:24px;margin:0px;}
.rteSep {margin:0 2px 0 2px;width:1px;height:20px;border:0px} .rteSep {margin:0 2px 0 2px;width:1px;height:20px;border:0px}
.rteBar { .rteBar {
margin:0 2px 0 4px; margin:0 2px 0 4px;
width:3px; width:3px;
height:15px; height:15px;
border:0px border:0px
} }
.rteBack { .rteBack {
background:#EFEDDE; background:#EFEDDE;
letter-spacing:0; letter-spacing:0;
height:24px; height:24px;
border:0px; border:0px;
border-top: 1px solid gray; border-top: 1px solid gray;
border-left: 1px solid gray; border-left: 1px solid gray;
border-right: 1px solid gray; border-right: 1px solid gray;
padding: 2px; padding: 2px;
} }
.rteBack tbody tr td, .rteBk tr td {background:#EFEDDE;height:24px} .rteBack tbody tr td, .rteBk tr td {background:#EFEDDE;height:24px}
.rteDiv {display:block;position:relative} .rteDiv {display:block;position:relative}
   
function Help(section) { function Help(section) {
q=window.open('index.php?mod=help&section='+section, 'Help', 'scrollbars=1,resizable=1,width=450,height=400'); q=window.open('index.php?mod=help&section='+section, 'Help', 'scrollbars=1,resizable=1,width=450,height=400');
} }
function ShowOrHide(d1, d2) { function ShowOrHide(d1, d2) {
if (d1 != '') DoDiv(d1); if (d1 != '') DoDiv(d1);
if (d2 != '') DoDiv(d2); if (d2 != '') DoDiv(d2);
} }
function DoDiv(id) { function DoDiv(id) {
var item = null; var item = null;
if (document.getElementById) { if (document.getElementById) {
item = document.getElementById(id); item = document.getElementById(id);
} else if (document.all){ } else if (document.all){
item = document.all[id]; item = document.all[id];
} else if (document.layers){ } else if (document.layers){
item = document.layers[id]; item = document.layers[id];
} }
if (!item) { if (!item) {
} }
else if (item.style) { else if (item.style) {
if (item.style.display == "none"){ item.style.display = ""; } if (item.style.display == "none"){ item.style.display = ""; }
else {item.style.display = "none"; } else {item.style.display = "none"; }
}else{ item.visibility = "show"; } }else{ item.visibility = "show"; }
} }
 Binary files a/cutenews/skins/images/Thumbs.db and b/cutenews/skins/images/Thumbs.db differ
 Binary files a/cutenews/skins/images/addnews.gif and b/cutenews/skins/images/addnews.gif differ
 Binary files a/cutenews/skins/images/archives.gif and b/cutenews/skins/images/archives.gif differ
 Binary files a/cutenews/skins/images/baloon.gif and b/cutenews/skins/images/baloon.gif differ
 Binary files a/cutenews/skins/images/blank.gif and b/cutenews/skins/images/blank.gif differ
 Binary files a/cutenews/skins/images/editnews.gif and b/cutenews/skins/images/editnews.gif differ
 Binary files a/cutenews/skins/images/error.gif and b/cutenews/skins/images/error.gif differ
 Binary files a/cutenews/skins/images/help_small.gif and b/cutenews/skins/images/help_small.gif differ
 Binary files a/cutenews/skins/images/home.gif and b/cutenews/skins/images/home.gif differ
 Binary files a/cutenews/skins/images/images.gif and b/cutenews/skins/images/images.gif differ
 Binary files a/cutenews/skins/images/info.gif and b/cutenews/skins/images/info.gif differ
 Binary files a/cutenews/skins/images/options.gif and b/cutenews/skins/images/options.gif differ
 Binary files a/cutenews/skins/images/question.gif and b/cutenews/skins/images/question.gif differ
 Binary files a/cutenews/skins/images/rss_icon.gif and b/cutenews/skins/images/rss_icon.gif differ
 Binary files a/cutenews/skins/images/user.gif and b/cutenews/skins/images/user.gif differ
 Binary files a/cutenews/skins/images/users.gif and b/cutenews/skins/images/users.gif differ
 Binary files a/cutenews/skins/images/view_image.gif and b/cutenews/skins/images/view_image.gif differ
 Binary files a/cutenews/skins/images/wizard.gif and b/cutenews/skins/images/wizard.gif differ
rss { rss {
display: block; display: block;
font-family: verdana, arial; font-family: verdana, arial;
} }
channel title { channel title {
display:block; display:block;
margin: 5px; margin: 5px;
padding: 2px; padding: 2px;
color: gray; color: gray;
border-bottom: 1px solid silver; border-bottom: 1px solid silver;
font-weight:bold; font-weight:bold;
} }
channel link { channel link {
display:none; display:none;
} }
item link{ item link{
display: block; display: block;
margin: 5px; margin: 5px;
padding: 2px; padding: 2px;
font-size:70%; font-size:70%;
color: #91A7BA; color: #91A7BA;
} }
item title { item title {
display: block; display: block;
margin: 5px; margin: 5px;
padding: 2px; padding: 2px;
border-bottom: 1px solid silver; border-bottom: 1px solid silver;
font-weight:bold; font-weight:bold;
color:black; color:black;
background-color:lightblue; background-color:lightblue;
-moz-border-radius: .5em .5em .5em .5em; -moz-border-radius: .5em .5em .5em .5em;
} }
item { item {
display: block; display: block;
padding: 2px 30px 2px 30px; padding: 2px 30px 2px 30px;
} }
item description { item description {
color: black; color: black;
margin: 12px; margin: 12px;
font-size: small; font-size: small;
} }
docs { docs {
display: block; display: block;
background-color: #ffffe6; background-color: #ffffe6;
margin: 20px; margin: 20px;
text-align: center; text-align: center;
padding: 5px; padding: 5px;
color: #7f7f7f; color: #7f7f7f;
border: 1px solid orange; border: 1px solid orange;
} }
/* all hidden elements */ /* all hidden elements */
language, lastBuildDate, ttl, guid, category, generator, pubDate { language, lastBuildDate, ttl, guid, category, generator, pubDate {
display: none; display: none;
} }
channel:before{ background-color:yellow; padding:1px; -moz-border-radius:0 0 1em 0; font-size:111%; letter-spacing:0.05em; border-bottom:3px solid red; border-right:3px solid red; color:red; text-align: center; content:"This is an RSS 2.0 file intended to be viewed in a newsreader or syndicated to another site." } channel:before{ background-color:yellow; padding:1px; -moz-border-radius:0 0 1em 0; font-size:111%; letter-spacing:0.05em; border-bottom:3px solid red; border-right:3px solid red; color:red; text-align: center; content:"This is an RSS 2.0 file intended to be viewed in a newsreader or syndicated to another site." }
<?php <?php
include_once ("./lib/common.inc.php"); include_once ("./lib/common.inc.php");
include_header("Amendments"); include_header("Amendments");
$query = "select CNID, description, value, pvalue, (value - pvalue) as diff from contractnotice, (SELECT CNID as cn, childCN as ccn, value as pvalue FROM contractnotice where childCN > 0) a where CNID = ccn order by diff DESC"; $query = "select CNID, description, value, pvalue, (value - pvalue) as diff from contractnotice, (SELECT CNID as cn, childCN as ccn, value as pvalue FROM contractnotice where childCN > 0) a".
  " where ".$agencyQ.$yearQ."CNID = ccn AND (value - pvalue) <> 0 order by diff DESC";
$result = mysql_query($query); $result = mysql_query($query);
  echo $query;
echo "<table>"; echo "<table>";
  if ($result) {
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
setlocale(LC_MONETARY, 'en_US'); setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row['value']) , 2); $value = number_format(doubleval($row['value']) , 2);
$pvalue = number_format(doubleval($row['pvalue']) , 2); $pvalue = number_format(doubleval($row['pvalue']) , 2);
$diff = number_format(doubleval($row['diff']) , 2); $diff = number_format(doubleval($row['diff']) , 2);
echo ("<tr>"); echo ("<tr>");
echo "<td><A href=\"displayContract.php?CNID={$row['CNID']}\"><b>{$row['description']}</b></a></td>"; echo "<td><A href=\"displayContract.php?CNID={$row['CNID']}\"><b>{$row['description']}</b></a></td>";
echo "<td>\$$pvalue</td><td>\$$value</td><td>\$$diff</td></tr>"; echo "<td>\$$pvalue</td><td>\$$value</td><td>\$$diff</td></tr>";
} }
  } else {
  echo mysql_error();
  }
echo "</table>"; echo "</table>";
mysql_free_result($result); mysql_free_result($result);
include_footer(); include_footer();
?> ?>
   
<?php <?php
include_once ("../lib/common.inc.php"); include_once ("../lib/common.inc.php");
// Width and height of the graph // Width and height of the graph
$width = 800; $width = 800;
$height = 300; $height = 300;
$query = "select procurementMethod, count(1) as count, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice` $query = "select procurementMethod, count(1) as count, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice`
where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month"; where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month";
$result = mysql_query($query); $result = mysql_query($query);
$methods = Array("Direct","Open","Select"); $methods = Array("Direct","Open","Select");
$dates = Array(); $dates = Array();
$methodCountsP = Array(); $methodCountsP = Array();
$methodCounts = Array(); $methodCounts = Array();
$maxValue = 0; $maxValue = 0;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
setlocale(LC_MONETARY, 'en_US'); setlocale(LC_MONETARY, 'en_US');
if ($row['value'] > $maxValue) $maxValue = $row['value']; if ($row['value'] > $maxValue) $maxValue = $row['value'];
$date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"]; $date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"];
if (array_search($date,$dates) === false ) { if (array_search($date,$dates) === false ) {
$dates[$row["year"]*100 + $row["month"]] = $date; $dates[$row["year"]*100 + $row["month"]] = $date;
ksort($dates); ksort($dates);
} }
$methodCountsP[$row["procurementMethod"]][$date] = $row["count"]; $methodCountsP[$row["procurementMethod"]][$date] = $row["count"];
} }
foreach ($methods as $method) { foreach ($methods as $method) {
foreach($dates as $date) { foreach($dates as $date) {
if ($methodCountsP[$method][$date] > 0) $methodCounts[$method][] = $methodCountsP[$method][$date]; if ($methodCountsP[$method][$date] > 0) $methodCounts[$method][] = $methodCountsP[$method][$date];
else $methodCounts[$method][] = 0; else $methodCounts[$method][] = 0;
} }
} }
$dates = array_values($dates); $dates = array_values($dates);
$totalRecords = array_sum_all($methodCounts); $totalRecords = array_sum_all($methodCounts);
mysql_free_result($result); mysql_free_result($result);
function formatCallback($aVal) { function formatCallback($aVal) {
global $totalRecords; global $totalRecords;
return percent($aVal, $totalRecords) . "%"; return percent($aVal, $totalRecords) . "%";
} }
$attributes = Array(); $attributes = Array();
$attributeNames = Array( $attributeNames = Array(
"Consultancies", "Consultancies",
"Confidentialities" "Confidentialities"
); );
$query = "SELECT 'consultancy', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ consultancy='Yes' AND childCN = 0;"; $query = "SELECT 'consultancy', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ consultancy='Yes' AND childCN = 0;";
$result = mysql_query($query); $result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH); $row = mysql_fetch_array($result, MYSQL_BOTH);
$attributes[0] = $row[1]; $attributes[0] = $row[1];
$query = "SELECT 'confidentiality', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ (confidentialityContract='Yes' OR confidentialityOutputs='Yes') AND childCN = 0;"; $query = "SELECT 'confidentiality', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ (confidentialityContract='Yes' OR confidentialityOutputs='Yes') AND childCN = 0;";
$result = mysql_query($query); $result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH); $row = mysql_fetch_array($result, MYSQL_BOTH);
$attributes[1] = $row[1]; $attributes[1] = $row[1];
mysql_free_result($result); mysql_free_result($result);
// Create a graph instance // Create a graph instance
$graph2 = new Graph($width, $height); $graph2 = new Graph($width, $height);
$graph2->SetScale('textlin',0,$totalRecords); $graph2->SetScale('textlin',0,$totalRecords);
$graph2->Set90AndMargin(105, 45, 45, 45); $graph2->Set90AndMargin(105, 45, 45, 45);
// Setup a title for the graph // Setup a title for the graph
$graph2->title->Set($agency); $graph2->title->Set($agency);
$graph2->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); $graph2->SetUserFont("liberation/LiberationSans-Regular.ttf");
$graph2->title->SetFont(FF_USERFONT, FS_NORMAL, 12); $graph2->title->SetFont(FF_USERFONT, FS_NORMAL, 12);
// Setup font for axis // Setup font for axis
$graph2->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); $graph2->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10);
$graph2->xaxis->SetTickLabels($attributeNames); $graph2->xaxis->SetTickLabels($attributeNames);
$graph2->yaxis->hide(); $graph2->yaxis->hide();
$attb1plot = new BarPlot($attributes); $attb1plot = new BarPlot($attributes);
$attb1plot->value->Show(); $attb1plot->value->Show();
$attb1plot->SetValuePos('top'); $attb1plot->SetValuePos('top');
$attb1plot->value->SetFont(FF_USERFONT, FS_NORMAL, 12); $attb1plot->value->SetFont(FF_USERFONT, FS_NORMAL, 12);
$attb1plot->value->SetAngle(45); $attb1plot->value->SetAngle(45);
$attb1plot->value->SetFormatCallback("formatCallback"); $attb1plot->value->SetFormatCallback("formatCallback");
$attb1plot->SetFillColor("orange"); $attb1plot->SetFillColor("orange");
// ...and add it to the graPH // ...and add it to the graPH
$graph2->Add($attb1plot); $graph2->Add($attb1plot);
$graph2->Stroke(); $graph2->Stroke();
?> ?>
   
<?php <?php
include_once("../lib/common.inc.php"); include_once("../lib/common.inc.php");
$query = "SELECT YEAR(publishDate), MONTH(publishDate), $query = "SELECT YEAR(publishDate), MONTH(publishDate),
value, count(1) as count FROM `contractnotice` value, count(1) as count FROM `contractnotice`
WHERE (YEAR(publishDate) >= 2008) WHERE (YEAR(publishDate) >= 2008)
AND childCN = 0 AND childCN = 0
GROUP BY MONTH(publishDate), YEAR(publishDate) GROUP BY MONTH(publishDate), YEAR(publishDate)
ORDER BY YEAR(publishDate), MONTH(publishDate)"; ORDER BY YEAR(publishDate), MONTH(publishDate)";
$result = mysql_query($query); $result = mysql_query($query);
$dates = Array(); $dates = Array();
$values = Array(); $values = Array();
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
setlocale(LC_MONETARY, 'en_US'); setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row["value"]),2); $value = number_format(doubleval($row["value"]),2);
$month_name = date( 'F', mktime(0, 0, 0, $row[1]) ); $month_name = date( 'F', mktime(0, 0, 0, $row[1]) );
$dates[] = $month_name." {$row[0]}"; $dates[] = $month_name." {$row[0]}";
$counts[] = doubleval($row["count"]); $counts[] = doubleval($row["count"]);
$values[] = doubleval($row["value"]); $values[] = doubleval($row["value"]);
} }
mysql_free_result($result); mysql_free_result($result);
// Width and height of the graph // Width and height of the graph
$width = 1000; $height = 400; $width = 1000; $height = 400;
// Create a graph instance // Create a graph instance
$graph = new Graph($width,$height); $graph = new Graph($width,$height);
$graph->SetMargin(85,45,45,115); $graph->SetMargin(85,45,45,115);
// Specify what scale we want to use, // Specify what scale we want to use,
$graph->SetScale('textlog'); $graph->SetScale('textlog');
// Setup a title for the graph // Setup a title for the graph
$graph->title->Set('Contracts Starting - All Agencies since July 2008'); $graph->title->Set('Contracts Starting - All Agencies since July 2008');
$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); $graph->SetUserFont("liberation/LiberationSans-Regular.ttf");
$graph->title->SetFont(FF_USERFONT,FS_NORMAL,12); $graph->title->SetFont(FF_USERFONT,FS_NORMAL,12);
// Setup font for axis // Setup font for axis
$graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,10); $graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,10);
$graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,10); $graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,10);
// Setup titles and X-axis labels // Setup titles and X-axis labels
$graph->xaxis->SetTickLabels($dates); $graph->xaxis->SetTickLabels($dates);
$graph->xaxis->SetLabelAngle(50); $graph->xaxis->SetLabelAngle(50);
// Create the linear plot // Create the linear plot
$valueplot=new LinePlot($values); $valueplot=new LinePlot($values);
$valueplot->SetFillColor('orange@0.5'); $valueplot->SetFillColor('orange@0.5');
$valueplot->SetLegend("Total Value"); $valueplot->SetLegend("Total Value");
$countplot=new LinePlot($counts); $countplot=new LinePlot($counts);
$countplot->SetFillColor('red@0.5'); $countplot->SetFillColor('red@0.5');
$countplot->SetLegend("Number of Contracts"); $countplot->SetLegend("Number of Contracts");
// Add the plot to the graph // Add the plot to the graph
$graph->Add($valueplot); $graph->Add($valueplot);
$graph->SetYScale(0,'lin'); $graph->SetYScale(0,'lin');
$graph->ynaxis[0]->SetColor('red'); $graph->ynaxis[0]->SetColor('red');
$graph->AddY(0,$countplot); $graph->AddY(0,$countplot);
// Display the graph // Display the graph
$graph->Stroke(); $graph->Stroke();
?> ?>
   
<?php <?php
include_once("../lib/common.inc.php"); include_once("../lib/common.inc.php");
$query = "SELECT YEAR(contractStart), MONTH(contractStart), $query = "SELECT YEAR(contractStart), MONTH(contractStart),
value, count(1) as count FROM `contractnotice` value, count(1) as count FROM `contractnotice`
WHERE (YEAR(contractStart) >= 2008) WHERE (YEAR(contractStart) >= 2008)
AND childCN = 0 AND childCN = 0
GROUP BY MONTH(contractStart), YEAR(contractStart) GROUP BY MONTH(contractStart), YEAR(contractStart)
ORDER BY YEAR(contractStart), MONTH(contractStart)"; ORDER BY YEAR(contractStart), MONTH(contractStart)";
$result = mysql_query($query); $result = mysql_query($query);
$dates = Array(); $dates = Array();
$values = Array(); $values = Array();
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
setlocale(LC_MONETARY, 'en_US'); setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row["value"]),2); $value = number_format(doubleval($row["value"]),2);
$month_name = date( 'F', mktime(0, 0, 0, $row[1]) ); $month_name = date( 'F', mktime(0, 0, 0, $row[1]) );
$dates[] = $month_name." {$row[0]}"; $dates[] = $month_name." {$row[0]}";
$counts[] = doubleval($row["count"]); $counts[] = doubleval($row["count"]);
$values[] = doubleval($row["value"]); $values[] = doubleval($row["value"]);
} }
mysql_free_result($result); mysql_free_result($result);
// Width and height of the graph // Width and height of the graph
$width = 1000; $height = 400; $width = 1000; $height = 400;
// Create a graph instance // Create a graph instance
$graph = new Graph($width,$height); $graph = new Graph($width,$height);
$graph->SetMargin(85,45,45,115); $graph->SetMargin(85,45,45,115);
// Specify what scale we want to use, // Specify what scale we want to use,
$graph->SetScale('textlog'); $graph->SetScale('textlog');
// Setup a title for the graph // Setup a title for the graph
$graph->title->Set('Contracts Starting - All Agencies since July 2008'); $graph->title->Set('Contracts Starting - All Agencies since July 2008');
$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); $graph->SetUserFont("liberation/LiberationSans-Regular.ttf");
$graph->title->SetFont(FF_USERFONT,FS_NORMAL,12); $graph->title->SetFont(FF_USERFONT,FS_NORMAL,12);
// Setup font for axis // Setup font for axis
$graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,10); $graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,10);
$graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,10); $graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,10);
// Setup titles and X-axis labels // Setup titles and X-axis labels
$graph->xaxis->SetTickLabels($dates); $graph->xaxis->SetTickLabels($dates);
$graph->xaxis->SetLabelAngle(50); $graph->xaxis->SetLabelAngle(50);
// Create the linear plot // Create the linear plot
$valueplot=new LinePlot($values); $valueplot=new LinePlot($values);
$valueplot->SetFillColor('orange@0.5'); $valueplot->SetFillColor('orange@0.5');
$valueplot->SetLegend("Total Value"); $valueplot->SetLegend("Total Value");
$countplot=new LinePlot($counts); $countplot=new LinePlot($counts);
$countplot->SetFillColor('red@0.5'); $countplot->SetFillColor('red@0.5');
$countplot->SetLegend("Number of Contracts"); $countplot->SetLegend("Number of Contracts");
// Add the plot to the graph // Add the plot to the graph
$graph->Add($valueplot); $graph->Add($valueplot);
$graph->SetYScale(0,'lin'); $graph->SetYScale(0,'lin');
$graph->ynaxis[0]->SetColor('red'); $graph->ynaxis[0]->SetColor('red');
$graph->AddY(0,$countplot); $graph->AddY(0,$countplot);
// Display the graph // Display the graph
$graph->Stroke(); $graph->Stroke();
?> ?>
   
<?php <?php
include_once ("../lib/common.inc.php"); include_once ("../lib/common.inc.php");
// Width and height of the graph // Width and height of the graph
$width = 800; $width = 800;
$height = 300; $height = 300;
$query = "select procurementMethod, count(1) as count, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice` $query = "select procurementMethod, count(1) as count, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice`
where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month"; where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month";
$result = mysql_query($query); $result = mysql_query($query);
$methods = Array("Direct","Open","Select"); $methods = Array("Direct","Open","Select");
$dates = Array(); $dates = Array();
$methodCountsP = Array(); $methodCountsP = Array();
$methodCounts = Array(); $methodCounts = Array();
$maxValue = 0; $maxValue = 0;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
setlocale(LC_MONETARY, 'en_US'); setlocale(LC_MONETARY, 'en_US');
if ($row['value'] > $maxValue) $maxValue = $row['value']; if ($row['value'] > $maxValue) $maxValue = $row['value'];
$date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"]; $date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"];
if (array_search($date,$dates) === false ) { if (array_search($date,$dates) === false ) {
$dates[$row["year"]*100 + $row["month"]] = $date; $dates[$row["year"]*100 + $row["month"]] = $date;
ksort($dates); ksort($dates);
} }
$methodCountsP[$row["procurementMethod"]][$date] = $row["count"]; $methodCountsP[$row["procurementMethod"]][$date] = $row["count"];
} }
foreach ($methods as $method) { foreach ($methods as $method) {
foreach($dates as $date) { foreach($dates as $date) {
if ($methodCountsP[$method][$date] > 0) $methodCounts[$method][] = $methodCountsP[$method][$date]; if ($methodCountsP[$method][$date] > 0) $methodCounts[$method][] = $methodCountsP[$method][$date];
else $methodCounts[$method][] = 0; else $methodCounts[$method][] = 0;
} }
} }
$dates = array_values($dates); $dates = array_values($dates);
$totalRecords = array_sum_all($methodCounts); $totalRecords = array_sum_all($methodCounts);
mysql_free_result($result); mysql_free_result($result);
// Create a graph instance // Create a graph instance
$graph = new Graph($width, $height); $graph = new Graph($width, $height);
$graph->SetScale('datint'); $graph->SetScale('datint');
$graph->SetMargin(95, 145, 45, 100); $graph->SetMargin(95, 145, 45, 100);
// Setup a title for the graph // Setup a title for the graph
$graph->title->Set($agencyQ.$supplierQ); $graph->title->Set($agencyQ.$supplierQ);
$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); $graph->SetUserFont("liberation/LiberationSans-Regular.ttf");
$graph->title->SetFont(FF_USERFONT, FS_NORMAL, 12); $graph->title->SetFont(FF_USERFONT, FS_NORMAL, 12);
// Setup font for axis // Setup font for axis
$graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); $graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10);
$graph->xaxis->SetTickLabels($dates); $graph->xaxis->SetTickLabels($dates);
$graph->xaxis->SetLabelAngle(50); $graph->xaxis->SetLabelAngle(50);
$colors = Array ("orange","red","blue"); $colors = Array ("orange","red","blue");
for ($i = 0; $i <= 2;$i++) { for ($i = 0; $i <= 2;$i++) {
$lplot[$i] = new LinePlot($methodCounts[$methods[$i]]); $lplot[$i] = new LinePlot($methodCounts[$methods[$i]]);
$lplot[$i]->SetLegend($methods[$i]); $lplot[$i]->SetLegend($methods[$i]);
$lplot[$i]->SetFillColor($colors[$i]); $lplot[$i]->SetFillColor($colors[$i]);
} }
// Create the grouped bar plot // Create the grouped bar plot
$alplot = new AccLinePlot($lplot); $alplot = new AccLinePlot($lplot);
// ...and add it to the graPH // ...and add it to the graPH
$graph->Add($alplot); $graph->Add($alplot);
$graph->Stroke(); $graph->Stroke();
function formatCallback($aVal) { function formatCallback($aVal) {
global $totalRecords; global $totalRecords;
return percent($aVal, $totalRecords) . "%"; return percent($aVal, $totalRecords) . "%";
} }
$attributes = Array(); $attributes = Array();
$attributeNames = Array( $attributeNames = Array(
"Consultancies", "Consultancies",
"Confidentialities" "Confidentialities"
); );
$query = "SELECT 'consultancy', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ consultancy='Yes' AND childCN = 0;"; $query = "SELECT 'consultancy', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ consultancy='Yes' AND childCN = 0;";
$result = mysql_query($query); $result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH); $row = mysql_fetch_array($result, MYSQL_BOTH);
$attributes[0] = $row[1]; $attributes[0] = $row[1];
$query = "SELECT 'confidentiality', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ (confidentialityContract='Yes' OR confidentialityOutputs='Yes') AND childCN = 0;"; $query = "SELECT 'confidentiality', count(1) FROM `contractnotice` WHERE $agencyQ $supplierQ (confidentialityContract='Yes' OR confidentialityOutputs='Yes') AND childCN = 0;";
$result = mysql_query($query); $result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH); $row = mysql_fetch_array($result, MYSQL_BOTH);
$attributes[1] = $row[1]; $attributes[1] = $row[1];
mysql_free_result($result); mysql_free_result($result);
// Create a graph instance // Create a graph instance
$graph2 = new Graph($width, $height); $graph2 = new Graph($width, $height);
$graph2->SetScale('textlin',0,$totalRecords); $graph2->SetScale('textlin',0,$totalRecords);
$graph2->Set90AndMargin(105, 45, 45, 45); $graph2->Set90AndMargin(105, 45, 45, 45);
// Setup a title for the graph // Setup a title for the graph
$graph2->title->Set($agency); $graph2->title->Set($agency);
$graph2->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); $graph2->SetUserFont("liberation/LiberationSans-Regular.ttf");
$graph2->title->SetFont(FF_USERFONT, FS_NORMAL, 12); $graph2->title->SetFont(FF_USERFONT, FS_NORMAL, 12);
// Setup font for axis // Setup font for axis
$graph2->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); $graph2->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10);
$graph2->xaxis->SetTickLabels($attributeNames); $graph2->xaxis->SetTickLabels($attributeNames);
$graph2->yaxis->hide(); $graph2->yaxis->hide();
$attb1plot = new BarPlot($attributes); $attb1plot = new BarPlot($attributes);
$attb1plot->value->Show(); $attb1plot->value->Show();
$attb1plot->SetValuePos('top'); $attb1plot->SetValuePos('top');
$attb1plot->value->SetFont(FF_USERFONT, FS_NORMAL, 12); $attb1plot->value->SetFont(FF_USERFONT, FS_NORMAL, 12);
$attb1plot->value->SetAngle(45); $attb1plot->value->SetAngle(45);
$attb1plot->value->SetFormatCallback("formatCallback"); $attb1plot->value->SetFormatCallback("formatCallback");
$attb1plot->SetFillColor("orange"); $attb1plot->SetFillColor("orange");
// ...and add it to the graPH // ...and add it to the graPH
$graph2->Add($attb1plot); $graph2->Add($attb1plot);
//----------------------- //-----------------------
// Create a multigraph // Create a multigraph
//---------------------- //----------------------
$mgraph = new MGraph(); $mgraph = new MGraph();
$mgraph->SetMargin(2, 2, 2, 2); $mgraph->SetMargin(2, 2, 2, 2);
$mgraph->Add($graph, 0, 0); $mgraph->Add($graph, 0, 0);
$mgraph->Add($graph2, 0, ($height) + 5); $mgraph->Add($graph2, 0, ($height) + 5);
$mgraph->Stroke(); $mgraph->Stroke();
?> ?>
   
<?php <?php
include_once ("../lib/common.inc.php"); include_once ("../lib/common.inc.php");
// Width and height of the graph // Width and height of the graph
$width = 800; $width = 800;
$height = 300; $height = 300;
$query = "select procurementMethod, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice` $query = "select procurementMethod, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice`
where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month"; where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month";
$result = mysql_query($query); $result = mysql_query($query);
$methods = Array("Direct","Open","Select"); $methods = Array("Direct","Open","Select");
$dates = Array(); $dates = Array();
$methodValuesP = Array(); $methodValuesP = Array();
$methodValues = Array(); $methodValues = Array();
$maxValue = 0; $maxValue = 0;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
setlocale(LC_MONETARY, 'en_US'); setlocale(LC_MONETARY, 'en_US');
if ($row['value'] > $maxValue) $maxValue = $row['value']; if ($row['value'] > $maxValue) $maxValue = $row['value'];
$date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"]; $date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"];
if (array_search($date,$dates) === false ) { if (array_search($date,$dates) === false ) {
$dates[$row["year"]*100 + $row["month"]] = $date; $dates[$row["year"]*100 + $row["month"]] = $date;
ksort($dates); ksort($dates);
} }
$methodValuesP[$row["procurementMethod"]][$date] = $row["value"]; $methodValuesP[$row["procurementMethod"]][$date] = $row["value"];
} }
foreach ($methods as $method) { foreach ($methods as $method) {
foreach($dates as $date) { foreach($dates as $date) {
if ($methodValuesP[$method][$date] > 0) $methodValues[$method][] = $methodValuesP[$method][$date]; if ($methodValuesP[$method][$date] > 0) $methodValues[$method][] = $methodValuesP[$method][$date];
else $methodValues[$method][] = 0; else $methodValues[$method][] = 0;
} }
} }
$dates = array_values($dates); $dates = array_values($dates);
$totalRecords = array_sum_all($methodValues); $totalRecords = array_sum_all($methodValues);
mysql_free_result($result); mysql_free_result($result);
// Create a graph instance // Create a graph instance
$graph = new Graph($width, $height); $graph = new Graph($width, $height);
$graph->SetScale('datint'); $graph->SetScale('datint');
$graph->SetMargin(95, 145, 45, 100); $graph->SetMargin(95, 145, 45, 100);
// Setup a title for the graph // Setup a title for the graph
$graph->title->Set($agencyQ.$supplierQ); $graph->title->Set($agencyQ.$supplierQ);
$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); $graph->SetUserFont("liberation/LiberationSans-Regular.ttf");
$graph->title->SetFont(FF_USERFONT, FS_NORMAL, 12); $graph->title->SetFont(FF_USERFONT, FS_NORMAL, 12);
// Setup font for axis // Setup font for axis
$graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); $graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10);
$graph->xaxis->SetTickLabels($dates); $graph->xaxis->SetTickLabels($dates);
$graph->xaxis->SetLabelAngle(50); $graph->xaxis->SetLabelAngle(50);
$colors = Array ("orange","red","blue"); $colors = Array ("orange","red","blue");
for ($i = 0; $i <= 2;$i++) { for ($i = 0; $i <= 2;$i++) {
$lplot[$i] = new LinePlot($methodValues[$methods[$i]]); $lplot[$i] = new LinePlot($methodValues[$methods[$i]]);
$lplot[$i]->SetLegend($methods[$i]); $lplot[$i]->SetLegend($methods[$i]);
$lplot[$i]->SetFillColor($colors[$i]); $lplot[$i]->SetFillColor($colors[$i]);
} }
// Create the grouped bar plot // Create the grouped bar plot
$alplot = new AccLinePlot($lplot); $alplot = new AccLinePlot($lplot);
// ...and add it to the graPH // ...and add it to the graPH
$graph->Add($alplot); $graph->Add($alplot);
$graph->Stroke(); $graph->Stroke();
?> ?>
   
 Binary files a/images/australia.png and b/images/australia.png differ
 Binary files a/images/img_inquisitor/_source/as_pointer.png and b/images/img_inquisitor/_source/as_pointer.png differ
 Binary files a/images/img_inquisitor/_source/li_corner.png and b/images/img_inquisitor/_source/li_corner.png differ
 Binary files a/images/img_inquisitor/_source/ul_corner.png and b/images/img_inquisitor/_source/ul_corner.png differ
 Binary files a/images/img_inquisitor/as_pointer.gif and b/images/img_inquisitor/as_pointer.gif differ
 Binary files a/images/img_inquisitor/hl_corner_bl.gif and b/images/img_inquisitor/hl_corner_bl.gif differ
 Binary files a/images/img_inquisitor/hl_corner_br.gif and b/images/img_inquisitor/hl_corner_br.gif differ
 Binary files a/images/img_inquisitor/hl_corner_tl.gif and b/images/img_inquisitor/hl_corner_tl.gif differ
 Binary files a/images/img_inquisitor/hl_corner_tr.gif and b/images/img_inquisitor/hl_corner_tr.gif differ
 Binary files a/images/img_inquisitor/ul_corner_bl.gif and b/images/img_inquisitor/ul_corner_bl.gif differ
 Binary files a/images/img_inquisitor/ul_corner_br.gif and b/images/img_inquisitor/ul_corner_br.gif differ
 Binary files a/images/img_inquisitor/ul_corner_tl.gif and b/images/img_inquisitor/ul_corner_tl.gif differ
 Binary files a/images/img_inquisitor/ul_corner_tr.gif and b/images/img_inquisitor/ul_corner_tr.gif differ
<?php <?php
  date_default_timezone_set("Australia/ACT");
   
require_once ('jpgraph/jpgraph.php'); require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php'); require_once ('jpgraph/jpgraph_line.php');
require_once ('jpgraph/jpgraph_log.php'); require_once ('jpgraph/jpgraph_log.php');
require_once ('jpgraph/jpgraph_mgraph.php'); require_once ('jpgraph/jpgraph_mgraph.php');
require_once ('jpgraph/jpgraph_pie.php'); require_once ('jpgraph/jpgraph_pie.php');
require_once ('jpgraph/jpgraph_bar.php'); require_once ('jpgraph/jpgraph_bar.php');
require_once ('jpgraph/jpgraph_date.php'); require_once ('jpgraph/jpgraph_date.php');
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
   
$link = mysql_connect('localhost', 'root', ''); $link = mysql_connect('localhost', 'root', '');
if (!$link) { if (!$link) {
die('Could not connect: ' . mysql_error()); die('Could not connect: ' . mysql_error());
} }
@mysql_select_db("contractDashboard") or die("Unable to select database"); @mysql_select_db("contractDashboard") or die("Unable to select database");
function ucsmart($str) { function ucsmart($str) {
return preg_replace("/(?<=(?<!:|’s)\W) return preg_replace("/(?<=(?<!:|’s)\W)
(A|An|And|At|For|In|Of|On|Or|The|To|With) (A|An|And|At|For|In|Of|On|Or|The|To|With)
(?=\W)/e", 'strtolower("$1")', ucwords(strtolower($str))); (?=\W)/e", 'strtolower("$1")', ucwords(strtolower($str)));
} }
function percent($num_amount, $num_total) { function percent($num_amount, $num_total) {
$count1 = $num_amount / $num_total; $count1 = $num_amount / $num_total;
$count2 = $count1 * 100; $count2 = $count1 * 100;
$count = number_format($count2, 2); $count = number_format($count2, 2);
return $count; return $count;
} }
function array_sum_all($a) { function array_sum_all($a) {
if(!is_array($a)) return $a; if(!is_array($a)) return $a;
foreach($a as $key=>$value) foreach($a as $key=>$value)
$totale += array_sum_all($value); $totale += array_sum_all($value);
return $totale; return $totale;
} }
  // magic query modifiers
$agency = mysql_real_escape_string(stripslashes($_REQUEST['agency'])); $agency = mysql_real_escape_string(stripslashes($_REQUEST['agency']));
if ($agency != "") $agencyQ = "agencyName = '" . $agency . "' AND"; if ($agency != "") $agencyQ = "agencyName = '" . $agency . "' AND ";
$supplier = mysql_real_escape_string(stripslashes($_REQUEST['supplier'])); $supplier = mysql_real_escape_string(stripslashes($_REQUEST['supplier']));
if ($supplier != "") { if ($supplier != "") {
$supplierParts = explode("-", $supplier); $supplierParts = explode("-", $supplier);
if ($supplierParts[0] > 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND"; if ($supplierParts[0] > 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND ";
else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND"; else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND ";
} }
$year = mysql_real_escape_string(stripslashes($_REQUEST['year'])); $year = mysql_real_escape_string(stripslashes($_REQUEST['year']));
if ($year != "") $yearQ = "agencyName = '" . $agency . "' AND"; if ($year != "") $yearQ = "YEAR(publishDate) = " . $year . " AND ";
$start =0.0; $start =0.0;
function include_header($title) { function include_header($title) {
global $start; global $start;
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> "http://www.w3.org/TR/html4/strict.dtd">
<html> <html>
<head> <head>
<title>Contract Dashboard - <?=$title?></title> <title>Contract Dashboard - <?=$title?></title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css"> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css">
<link type="text/css" rel="stylesheet" href="style.css"> <link type="text/css" rel="stylesheet" href="style.css">
<script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script> <script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script>
<link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() $(document).ready(function()
{ {
//hide the all of the element with class msg_body //hide the all of the element with class msg_body
$(".msg_body").hide(); $(".msg_body").hide();
//toggle the componenet with class msg_body //toggle the componenet with class msg_body
$(".msg_head").click(function() $(".msg_head").click(function()
{ {
$(this).next(".msg_body").slideToggle(600); $(this).next(".msg_body").slideToggle(600);
}); });
}); });
</script> </script>
</head> </head>
<body><div id="doc3" class="yui-t4"> <body><div id="doc3" class="yui-t4">
<div id="hd"> <div id="hd">
<h1> contract dashboard</h1> <h1> contract dashboard</h1>
</div> </div>
<div id="sitenav"> <div id="sitenav">
<a href="displayAgency.php">agencies</a> <a href="displayAgency.php">agencies</a>
<a href="displaySupplier.php">suppliers</a> <a href="displaySupplier.php">suppliers</a>
<a href="displayCategory.php">product/service categories</a> <a href="displayCategory.php">product/service categories</a>
<a href="displayCalendar.php">time periods</a> <a href="displayCalendar.php">time periods</a>
| metrics | | metrics |
<a href="displayProcurementMethod.php">procurement method</a> <a href="displayProcurementMethod.php">procurement method</a>
<a href="displayConfidentialities.php">contractual confidentiality</a> <a href="displayConfidentialities.php">contractual confidentiality</a>
<a href="displayConsultancies.php">consultancies</a> <a href="displayConsultancies.php">consultancies</a>
<a href="displayAmendments.php">consultancies</a> <a href="displayAmendments.php">amendments</a>
<a href="displayMap.php">postcodes</a> <a href="displayMap.php">postcodes</a>
<div id="search"><form method="post" action="search.php" class="asholder"> <div id="search"><form method="post" action="search.php" class="asholder">
<label for="searchKeyword">search</label> <label for="searchKeyword">search</label>
<input type="text" id="searchKeyword" name="searchKeyword" value="" style="width:150px" /> <input type="text" id="searchKeyword" name="searchKeyword" value="" style="width:150px" />
<input type="hidden" id="searchID" name="searchID" value=""/><input type="submit" value="submit" /> <input type="hidden" id="searchID" name="searchID" value=""/><input type="submit" value="submit" />
</form></div> </form></div>
<script type="text/javascript"> <script type="text/javascript">
var options_xml = { var options_xml = {
script: function (input) { return "search_autosuggest.php?input="+input; }, script: function (input) { return "search_autosuggest.php?input="+input; },
varname:"input", varname:"input",
callback: function (obj) { document.getElementById('searchID').value = obj.id; } callback: function (obj) { document.getElementById('searchID').value = obj.id; }
}; };
var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml); var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml);
</script> </script>
</div> </div>
<div id="bd" role="main"> <div id="bd" role="main">
<div id="yui-main"> <div id="yui-main">
<div class="yui-b"><div class="yui-g"> <div class="yui-b"><div class="yui-g">
<?php <?php
$start = (float) array_sum(explode(' ',microtime())); $start = (float) array_sum(explode(' ',microtime()));
} }
function include_footer() { function include_footer() {
global $start; global $start;
$end = (float) array_sum(explode(' ',microtime())); $end = (float) array_sum(explode(' ',microtime()));
?> ?>
</div> </div>
</div> </div>
</div> </div>
<div class="yui-b"> <div class="yui-b">
Filter by:<ul> Filter by:<ul>
<li>year <li>year
<ul><li>2008</li> <ul><li>2008</li>
</ul> </ul>
</li> </li>
</ul> <br> </div> </div> </ul> <br> </div> </div>
<?php <?php
echo '<div id="ft"><p>'."Processing time: ". sprintf("%.4f", ($end-$start))." seconds".'</p></div>'; echo '<div id="ft"><p>'."Processing time: ". sprintf("%.4f", ($end-$start))." seconds".'</p></div>';
echo '</div> </body> </html>'; echo '</div> </body> </html>';
} }
?> ?>
   
Designer: Designer:
   
Steve Matteson (Ascender Corp.) Steve Matteson (Ascender Corp.)
http://www.ascendercorp.com/typedesigners.html http://www.ascendercorp.com/typedesigners.html
   
Maintainer: Maintainer:
   
Caius 'kaio' Chance <k AT kaio.me> Caius 'kaio' Chance <k AT kaio.me>
   
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
   
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
   
Preamble Preamble
   
The licenses for most software are designed to take away your The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to the GNU Library General Public License instead.) You can apply it to
your programs, too. your programs, too.
   
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things. in new free programs; and that you know you can do these things.
   
To protect your rights, we need to make restrictions that forbid To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights. anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it. distribute copies of the software, or if you modify it.
   
For example, if you distribute copies of such a program, whether For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their source code. And you must show them these terms so they know their
rights. rights.
   
We protect your rights with two steps: (1) copyright the software, and We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy, (2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software. distribute and/or modify the software.
   
Also, for each author's protection and ours, we want to make certain Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original that any problems introduced by others will not reflect on the original
authors' reputations. authors' reputations.
   
Finally, any free program is threatened constantly by software Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all. patent must be licensed for everyone's free use or not licensed at all.
   
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
   
0. This License applies to any program or other work which contains 0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below, under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program" refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law: means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it, that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you". the term "modification".) Each licensee is addressed as "you".
   
Activities other than copying, distribution and modification are not Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program). Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does. Whether that is true depends on what the Program does.
   
1. You may copy and distribute verbatim copies of the Program's 1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty; notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License and give any other recipients of the Program a copy of this License
along with the Program. along with the Program.
   
You may charge a fee for the physical act of transferring a copy, and You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee. you may at your option offer warranty protection in exchange for a fee.
   
2. You may modify your copy or copies of the Program or any portion 2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1 distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions: above, provided that you also meet all of these conditions:
   
a) You must cause the modified files to carry prominent notices a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change. stating that you changed the files and the date of any change.
   
b) You must cause any work that you distribute or publish, that in b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License. parties under the terms of this License.
   
c) If the modified program normally reads commands interactively c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it. entire whole, and thus to each and every part regardless of who wrote it.
   
Thus, it is not the intent of this section to claim rights or contest Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or exercise the right to control the distribution of derivative or
collective works based on the Program. collective works based on the Program.
   
In addition, mere aggregation of another work not based on the Program In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under a storage or distribution medium does not bring the other work under
the scope of this License. the scope of this License.
   
3. You may copy and distribute the Program (or a work based on it, 3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following: Sections 1 and 2 above provided that you also do one of the following:
   
a) Accompany it with the complete corresponding machine-readable a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or, 1 and 2 above on a medium customarily used for software interchange; or,
   
b) Accompany it with a written offer, valid for at least three b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or, customarily used for software interchange; or,
   
c) Accompany it with the information you received as to the offer c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such received the program in object code or executable form with such
an offer, in accord with Subsection b above.) an offer, in accord with Subsection b above.)
   
The source code for a work means the preferred form of the work for The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component operating system on which the executable runs, unless that component
itself accompanies the executable. itself accompanies the executable.
   
If distribution of executable or object code is made by offering If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License. void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such this License will not have their licenses terminated so long as such
parties remain in full compliance. parties remain in full compliance.
   
5. You are not required to accept this License, since you have not 5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying all its terms and conditions for copying, distributing or modifying
the Program or works based on it. the Program or works based on it.
   
6. Each time you redistribute the Program (or any work based on the 6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein. restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to You are not responsible for enforcing compliance by third parties to
this License. this License.
   
7. If, as a consequence of a court judgment or allegation of patent 7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program. refrain entirely from distribution of the Program.
   
If any portion of this section is held invalid or unenforceable under If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other apply and the section as a whole is intended to apply in other
circumstances. circumstances.
   
It is not the purpose of this section to induce you to infringe any It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is integrity of the free software distribution system, which is
implemented by public license practices. Many people have made implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot to distribute software through any other system and a licensee cannot
impose that choice. impose that choice.
   
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License. the limitation as if written in the body of this License.
   
9. The Free Software Foundation may publish revised and/or new versions 9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to be similar in spirit to the present version, but may differ in detail to
address new problems or concerns. address new problems or concerns.
   
Each version is given a distinguishing version number. If the Program Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software this License, you may choose any version ever published by the Free Software
Foundation. Foundation.
   
10. If you wish to incorporate parts of the Program into other free 10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally. of promoting the sharing and reuse of software generally.
   
NO WARRANTY NO WARRANTY
   
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION. REPAIR OR CORRECTION.
   
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
   
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs How to Apply These Terms to Your New Programs
   
If you develop a new program, and you want it to be of the greatest If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms. free software which everyone can redistribute and change under these terms.
   
To do so, attach the following notices to the program. It is safest To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
   
<one line to give the program's name and a brief idea of what it does.> <one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author> Copyright (C) <year> <name of author>
   
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
   
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
   
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   
   
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
   
If the program is interactive, make it output a short notice like this If the program is interactive, make it output a short notice like this
when it starts in an interactive mode: when it starts in an interactive mode:
   
Gnomovision version 69, Copyright (C) year name of author Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.
   
The hypothetical commands `show w' and `show c' should show the appropriate The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program. mouse-clicks or menu items--whatever suits your program.
   
You should also get your employer (if you work as a programmer) or your You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names: necessary. Here is a sample; alter the names:
   
Yoyodyne, Inc., hereby disclaims all copyright interest in the program Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker. `Gnomovision' (which makes passes at compilers) written by James Hacker.
   
<signature of Ty Coon>, 1 April 1989 <signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice Ty Coon, President of Vice
   
This General Public License does not permit incorporating your program into This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General library. If this is what you want to do, use the GNU Library General
Public License instead of this License. Public License instead of this License.
   
* Tue 14 Jul 2009 Caius 'kaio' Chance <me AT kaio.me> * Tue 14 Jul 2009 Caius 'kaio' Chance <me AT kaio.me>
- Generated TTFs with tradition kern table, with fontforge ver 20090408. - Generated TTFs with tradition kern table, with fontforge ver 20090408.
- Added make target alias dist-src as dist-sfd. - Added make target alias dist-src as dist-sfd.
   
* Mon 13 Jul 2009 Caius 'kaio' Chance <me AT kaio.me> * Mon 13 Jul 2009 Caius 'kaio' Chance <me AT kaio.me>
- Updated for generation of traditional kern table via scripts. - Updated for generation of traditional kern table via scripts.
   
* Mon 06 Jul 2009 Caius 'kaio' Chance <me AT kaio.me> * Mon 06 Jul 2009 Caius 'kaio' Chance <me AT kaio.me>
- Reconverted SFDs from original TTFs with traditional kern table. - Reconverted SFDs from original TTFs with traditional kern table.
- Updated "clean" target in Makefile. - Updated "clean" target in Makefile.
   
* Tue 30 Jun 2009 Caius 'kaio' Chance <me AT kaio.me> * Tue 30 Jun 2009 Caius 'kaio' Chance <me AT kaio.me>
- Reconverted SFDs from original TTFs with traditional kern table. - Reconverted SFDs from original TTFs with traditional kern table.
- Updated "clean" target in Makefile. - Updated "clean" target in Makefile.
   
* Tue 30 Jun 2009 Caius 'kaio' Chance <me AT kaio.me> * Tue 30 Jun 2009 Caius 'kaio' Chance <me AT kaio.me>
- Generated cleaner SFD from original TTFs. - Generated cleaner SFD from original TTFs.
- Include Makefile in sources tarball. - Include Makefile in sources tarball.
   
* Wed 24 Jun 2009 Caius 'kaio' Chance <me AT kaio.me> * Wed 24 Jun 2009 Caius 'kaio' Chance <me AT kaio.me>
- Makefile: pack SFD files as source tarball. - Makefile: pack SFD files as source tarball.
- Makefile: pack TTF files as ttf packs. - Makefile: pack TTF files as ttf packs.
- Tidy up repository. - Tidy up repository.
- Updated documents. - Updated documents.
   
* Mon 12 Jan 2009 Caius Chance <cchance@redhat.com> * Mon 12 Jan 2009 Caius Chance <cchance@redhat.com>
- Fixed copyright holder name typo for Sans Regular font (rhbz#479521). - Fixed copyright holder name typo for Sans Regular font (rhbz#479521).
   
* Tue 09 Dec 2008 Caius Chance <cchance@redhat.com> * Tue 09 Dec 2008 Caius Chance <cchance@redhat.com>
- Changed cent sign glyph (U+00A2) to be coressed in Sans and Mono - Changed cent sign glyph (U+00A2) to be coressed in Sans and Mono
(rhbz#474522). (rhbz#474522).
   
* Wed 03 Dec 2008 Caius Chance <cchance@redhat.com> * Wed 03 Dec 2008 Caius Chance <cchance@redhat.com>
- Started 1.04.93.devel. - Started 1.04.93.devel.
- Fixed blurriness of U+03BC for Sans Regular font (rhbz#473481). - Fixed blurriness of U+03BC for Sans Regular font (rhbz#473481).
- Fixed src tarball mis-inclusion of dist files in Makefile. - Fixed src tarball mis-inclusion of dist files in Makefile.
   
* Fri 28 Nov 2008 Caius Chance <cchance@redhat.com> * Fri 28 Nov 2008 Caius Chance <cchance@redhat.com>
- Corrected version number in Makefile. - Corrected version number in Makefile.
- Fixed make target of source tarball. - Fixed make target of source tarball.
- Uploaded 1.04.92 source tarball to release area. - Uploaded 1.04.92 source tarball to release area.
   
* Wed 15 Oct 2008 Caius Chance <cchance@redhat.com> * Wed 15 Oct 2008 Caius Chance <cchance@redhat.com>
- Fixed blurred 'u' and 'W' for Sans Bold font (rhbz#463036). - Fixed blurred 'u' and 'W' for Sans Bold font (rhbz#463036).
- Released as version 1.04.92 - Released as version 1.04.92
   
* Wed 17 Sep 2008 Caius Chance <cchance@redhat.com> * Wed 17 Sep 2008 Caius Chance <cchance@redhat.com>
- Fixed missing hinting instructions for all Mono fonts (rhbz#460090). - Fixed missing hinting instructions for all Mono fonts (rhbz#460090).
- Fixed missing hinting instructions for all Sans fonts (rhbz#460090). - Fixed missing hinting instructions for all Sans fonts (rhbz#460090).
- Fixed missing hinting instructions for all Serif fonts (rhbz#460090). - Fixed missing hinting instructions for all Serif fonts (rhbz#460090).
- Released as version 1.04.91 - Released as version 1.04.91
   
* Tue 09 Sep 2008 Caius Chance <cchance@redhat.com> * Tue 09 Sep 2008 Caius Chance <cchance@redhat.com>
- Backed up all released files in ./dist directory. - Backed up all released files in ./dist directory.
   
* Fri 05 Sep 2008 Caius Chance <cchance@redhat.com> * Fri 05 Sep 2008 Caius Chance <cchance@redhat.com>
- Fixed incorrect glyph points and missing hinting instructions for: - Fixed incorrect glyph points and missing hinting instructions for:
Mono Bold Italic (up to U+2012) (rhbz#460090). Mono Bold Italic (up to U+2012) (rhbz#460090).
   
* Mon 25 Aug 2008 Caius Chance <cchance@redhat.com> * Mon 25 Aug 2008 Caius Chance <cchance@redhat.com>
- Fixed incorrect glyph points and missing hinting instructions for: - Fixed incorrect glyph points and missing hinting instructions for:
U+0079, U+03BC, U+0431, U+2010..2012, U+1114117 (rhbz#458592). U+0079, U+03BC, U+0431, U+2010..2012, U+1114117 (rhbz#458592).
- Released as version 1.04.90. - Released as version 1.04.90.
   
* Thu 13 Jul 2008 Caius Chance <cchance@redhat.com> * Thu 13 Jul 2008 Caius Chance <cchance@redhat.com>
- Released as version 1.04. - Released as version 1.04.
   
* Thu 12 Jun 2008 Caius Chance <cchance@redhat.com> * Thu 12 Jun 2008 Caius Chance <cchance@redhat.com>
- Released as version 1.04.beta2 (1.03.99). - Released as version 1.04.beta2 (1.03.99).
- Added ZIP package building for non-tar users. - Added ZIP package building for non-tar users.
- rhbz#440992: - rhbz#440992:
- Created Romanian "T/t/S/s with comma below" (U+0218..021B) on all fonts. - Created Romanian "T/t/S/s with comma below" (U+0218..021B) on all fonts.
- Fixed "T/s with cedilla below" (U+0162/0163) on all fonts. - Fixed "T/s with cedilla below" (U+0162/0163) on all fonts.
- Created "Hyphen" and "Non-Breaking Hyphen" (U+2010..2011) on all fonts. - Created "Hyphen" and "Non-Breaking Hyphen" (U+2010..2011) on all fonts.
   
* Wed 11 Jun 2008 Caius Chance <cchance@redhat.com> * Wed 11 Jun 2008 Caius Chance <cchance@redhat.com>
- Added last Version 1.03 from original manufacturer. - Added last Version 1.03 from original manufacturer.
- Renamed directory 'archive' to 'sandbox'. - Renamed directory 'archive' to 'sandbox'.
- Added directory description in hosting home directory. - Added directory description in hosting home directory.
- Created ZIP packages for Version 1.03 and 1.04.beta. - Created ZIP packages for Version 1.03 and 1.04.beta.
   
* Tue 04 Jun 2008 Caius Chance <cchance@redhat.com> * Tue 04 Jun 2008 Caius Chance <cchance@redhat.com>
- rhbz#440992: - rhbz#440992:
- Created "Hyphen" and "Non-Breaking Hyphen" (U+2010..2011) on Sans Regular. - Created "Hyphen" and "Non-Breaking Hyphen" (U+2010..2011) on Sans Regular.
   
* Mon 03 Jun 2008 Caius Chance <cchance@redhat.com> * Mon 03 Jun 2008 Caius Chance <cchance@redhat.com>
- rhbz#440992: - rhbz#440992:
- Created Romanian "T/t/S/s with comma below" (U+0218..021B) on Sans Regular. - Created Romanian "T/t/S/s with comma below" (U+0218..021B) on Sans Regular.
- Fixed "T/s with cedilla below" (U+0162/0163) on Sans Regular. - Fixed "T/s with cedilla below" (U+0162/0163) on Sans Regular.
   
* Fri 30 May 2008 Caius Chance <cchance@redhat.com> * Fri 30 May 2008 Caius Chance <cchance@redhat.com>
- Release Version 1.04.beta (liberation-fonts-1_04_beta). - Release Version 1.04.beta (liberation-fonts-1_04_beta).
   
* Thu 29 May 2008 Caius Chance <cchance@redhat.com> * Thu 29 May 2008 Caius Chance <cchance@redhat.com>
- Correct SFD version numbers in "TTF Info" categor for correct version - Correct SFD version numbers in "TTF Info" categor for correct version
number during export to TTFs. number during export to TTFs.
   
* Wed 28 May 2008 Caius Chance <cchance@redhat.com> * Wed 28 May 2008 Caius Chance <cchance@redhat.com>
- Reencoded with "Glyph Order" by FontForge. - Reencoded with "Glyph Order" by FontForge.
- Corrected font name for all Regular fonts. - Corrected font name for all Regular fonts.
- Generated TTFs (experimantal, in "archive") with old stle kern and dummy - Generated TTFs (experimantal, in "archive") with old stle kern and dummy
DSIG table. DSIG table.
- Updated README in 1.04b TTFs (experimental, in "archive"). - Updated README in 1.04b TTFs (experimental, in "archive").
   
* Tue 27 May 2008 Caius Chance <cchance@redhat.com> * Tue 27 May 2008 Caius Chance <cchance@redhat.com>
- Fixed Unicode name mis-mapping of Sans and Serif TTF files. - Fixed Unicode name mis-mapping of Sans and Serif TTF files.
- Regenerate SFD files from Unicode name mis-mapping fixed Sans and Serif TTF - Regenerate SFD files from Unicode name mis-mapping fixed Sans and Serif TTF
files. files.
   
* Mon 26 May 2008 Caius Chance <cchance@redhat.com> * Mon 26 May 2008 Caius Chance <cchance@redhat.com>
- Fixed Unicode name mis-mapping of Mono TTF files. - Fixed Unicode name mis-mapping of Mono TTF files.
- Regenerate SFD files from Unicode name mis-mapping fixed Mono TTF files. - Regenerate SFD files from Unicode name mis-mapping fixed Mono TTF files.
========== ==========
- Applied following patches submitted by Nicolas Spalinger - Applied following patches submitted by Nicolas Spalinger
<nicolas_spalinger sil org>: <nicolas_spalinger sil org>:
- We-need-versioned-tarballs. - We-need-versioned-tarballs.
- Add-ignore-file-so-the-VCS-does-not-track-the-folder. - Add-ignore-file-so-the-VCS-does-not-track-the-folder.
- Adjust-path-for-various-Makefile-targets-subfolders. - Adjust-path-for-various-Makefile-targets-subfolders.
- Fix-versionning-mismatch-in-the-binary-font-metadata. - Fix-versionning-mismatch-in-the-binary-font-metadata.
- Add-some-description-and-extra-lines-to-the-build-ta. - Add-some-description-and-extra-lines-to-the-build-ta.
- Reword-and-restructure-maintainers-recommendations. - Reword-and-restructure-maintainers-recommendations.
- Some-rewording-of-the-readme-file. - Some-rewording-of-the-readme-file.
========== ==========
* Thu May 22 2008 Caius Chance <cchance@redhat.com> * Thu May 22 2008 Caius Chance <cchance@redhat.com>
- Added latest (1.03) TTF files from Ascender. (in 'archive') - Added latest (1.03) TTF files from Ascender. (in 'archive')
   
* Fri May 16 2008 Caius Chance <cchance@redhat.com> * Fri May 16 2008 Caius Chance <cchance@redhat.com>
- Change source tree as 'trunk', 'tags', 'branches'. - Change source tree as 'trunk', 'tags', 'branches'.
========== ==========
- Applied following patches submitted by Nicolas Spalinger - Applied following patches submitted by Nicolas Spalinger
<nicolas_spalinger sil org>: <nicolas_spalinger sil org>:
- Add-more-information-about-the-upstream-designer. - Add-more-information-about-the-upstream-designer.
- Minor-typo-and-layout-fixes. - Minor-typo-and-layout-fixes.
- Adjust-fontforge-path-with-env-as-a-source-build. - Adjust-fontforge-path-with-env-as-a-source-build.
========== ==========
   
* Wed May 14 2008 Caius Chance <cchance@redhat.com> * Wed May 14 2008 Caius Chance <cchance@redhat.com>
- Renamed target 'ttf' to 'build'. - Renamed target 'ttf' to 'build'.
- Removed 'Re-Package' chapter from README and refine contents. - Removed 'Re-Package' chapter from README and refine contents.
- Changed AUTHORS contents. - Changed AUTHORS contents.
- Created maintainer documentation MAINTAINER. - Created maintainer documentation MAINTAINER.
   
* Tue May 06 2008 Caius Chance <cchance@redhat.com> * Tue May 06 2008 Caius Chance <cchance@redhat.com>
- Refined clean target. - Refined clean target.
- Removed TTFs from git. - Removed TTFs from git.
   
* Fri May 02 2008 Caius Chance <cchance@redhat.com> * Fri May 02 2008 Caius Chance <cchance@redhat.com>
- Imported into fedorahosted.org repository and be hosted. - Imported into fedorahosted.org repository and be hosted.
https://fedorahosted.org/liberation-fonts/ https://fedorahosted.org/liberation-fonts/
- Modified source root directory name definition in Makefile. - Modified source root directory name definition in Makefile.
- Created 'dist' target for binary TTF tarball and 'src' for source tarball. - Created 'dist' target for binary TTF tarball and 'src' for source tarball.
- Corrected Regular fonts filenames. - Corrected Regular fonts filenames.
- Added TTF -> SFD make target. - Added TTF -> SFD make target.
   
* Thu May 01 2008 Caius Chance <cchance@redhat.com> * Thu May 01 2008 Caius Chance <cchance@redhat.com>
- Converted previous TTF files into SFD files to be open source. - Converted previous TTF files into SFD files to be open source.
- Created fontforge SFD -> TTF scripts. - Created fontforge SFD -> TTF scripts.
- Created Makefile. - Created Makefile.
- Added documentations: AUTHORS, ChangeLog, README. - Added documentations: AUTHORS, ChangeLog, README.
   
* Thu Apr 10 2008 Caius Chance <cchance@redhat.com> * Thu Apr 10 2008 Caius Chance <cchance@redhat.com>
- Fixed exchanged and incomplete glyphs (from Ascender). - Fixed exchanged and incomplete glyphs (from Ascender).
- Repacked source tarball. - Repacked source tarball.
- Released version 1.03. - Released version 1.03.
   
* Tue Mar 25 2008 Caius Chance <cchance@redhat.com> * Tue Mar 25 2008 Caius Chance <cchance@redhat.com>
- Fixed alignment mismatch of dot accents (from Ascender). - Fixed alignment mismatch of dot accents (from Ascender).
- Released version 1.02. - Released version 1.02.
   
* Mon Jan 14 2008 Caius Chance <cchance@redhat.com> * Mon Jan 14 2008 Caius Chance <cchance@redhat.com>
- Updated new source tarball from Ascender. - Updated new source tarball from Ascender.
- Released version 1.0. - Released version 1.0.
   
* Thu Jun 14 2007 Caius Chance <cchance@redhat.com> * Thu Jun 14 2007 Caius Chance <cchance@redhat.com>
- Updated new source tarball from Ascender. - Updated new source tarball from Ascender.
   
 Binary files a/lib/fonts/LiberationMono-Bold.ttf and b/lib/fonts/LiberationMono-Bold.ttf differ
 Binary files a/lib/fonts/LiberationMono-BoldItalic.ttf and b/lib/fonts/LiberationMono-BoldItalic.ttf differ
 Binary files a/lib/fonts/LiberationMono-Italic.ttf and b/lib/fonts/LiberationMono-Italic.ttf differ
 Binary files a/lib/fonts/LiberationMono-Regular.ttf and b/lib/fonts/LiberationMono-Regular.ttf differ
 Binary files a/lib/fonts/LiberationSans-Bold.ttf and b/lib/fonts/LiberationSans-Bold.ttf differ
 Binary files a/lib/fonts/LiberationSans-BoldItalic.ttf and b/lib/fonts/LiberationSans-BoldItalic.ttf differ
 Binary files a/lib/fonts/LiberationSans-Italic.ttf and b/lib/fonts/LiberationSans-Italic.ttf differ
 Binary files a/lib/fonts/LiberationSans-Regular.ttf and b/lib/fonts/LiberationSans-Regular.ttf differ
 Binary files a/lib/fonts/LiberationSerif-Bold.ttf and b/lib/fonts/LiberationSerif-Bold.ttf differ
 Binary files a/lib/fonts/LiberationSerif-BoldItalic.ttf and b/lib/fonts/LiberationSerif-BoldItalic.ttf differ
 Binary files a/lib/fonts/LiberationSerif-Italic.ttf and b/lib/fonts/LiberationSerif-Italic.ttf differ
 Binary files a/lib/fonts/LiberationSerif-Regular.ttf and b/lib/fonts/LiberationSerif-Regular.ttf differ
LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY
LIBERATION FONT SOFTWARE LIBERATION FONT SOFTWARE
   
This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as are set forth in this End User License Agreement. This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as are set forth in this End User License Agreement.
   
1. The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans-serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions: 1. The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans-serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions:
   
(a) As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. (a) As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
   
(b) As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it. (b) As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it.
   
2. Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software. 2. Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software.
   
3. Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation. 3. Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation.
   
4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages. 4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages.
   
5. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply. 5. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply.
Copyright © 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc. Copyright © 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
   
1. What's this? 1. What's this?
================= =================
   
The Liberation Fonts is font collection which aims display compatibility to The Liberation Fonts is font collection which aims display compatibility to
document files that used Times New Roman, Arial, Courier New as fonts. document files that used Times New Roman, Arial, Courier New as fonts.
   
   
2. Requirements 2. Requirements
================= =================
   
* fontforge to be installed. * fontforge to be installed.
(http://fontforge.sourceforge.net) (http://fontforge.sourceforge.net)
   
   
3. Install 3. Install
============ ============
   
3.1 Decompress tarball 3.1 Decompress tarball
   
You can extract the files by following command: You can extract the files by following command:
   
$ tar zxvf liberation-fonts-[VERSION].tar.gz $ tar zxvf liberation-fonts-[VERSION].tar.gz
   
3.2 Build from the source 3.2 Build from the source
   
Change into directory liberation-fonts-[VERSION]/ and build from sources by Change into directory liberation-fonts-[VERSION]/ and build from sources by
following commands: following commands:
   
$ cd liberation-fonts-[VERSION] $ cd liberation-fonts-[VERSION]
$ make $ make
   
The built font files will be available in 'build' directory. The built font files will be available in 'build' directory.
   
3.3 Install to system 3.3 Install to system
   
You can manually install the fonts by copying the TTFs to ~/.fonts for user You can manually install the fonts by copying the TTFs to ~/.fonts for user
wide usage, or to /usr/share/fonts/truetype/liberation for system-wide wide usage, or to /usr/share/fonts/truetype/liberation for system-wide
availability. availability.
   
   
4. Usage 4. Usage
========== ==========
   
The fonts should be installed and detected by the system after installation. The fonts should be installed and detected by the system after installation.
Simply select preferred liberation font in applications and start using. Simply select preferred liberation font in applications and start using.
   
   
5. License 5. License
============ ============
   
For redistribution information, please read the GPL license file 'COPYING'. For redistribution information, please read the GPL license file 'COPYING'.
   
For EULA information, please read file 'License.txt'. For EULA information, please read file 'License.txt'.
   
   
6. Maintainers 6. Maintainers
================ ================
   
(FIXME) (FIXME)
Before packaging a new release based on a new source tarball, you have to Before packaging a new release based on a new source tarball, you have to
update the version number in the Makefile: update the version number in the Makefile:
   
VER = [VERSION] VER = [VERSION]
   
Make sure that the defined version corresponds to the font software metadata Make sure that the defined version corresponds to the font software metadata
which you can check with ftinfo/otfinfo or fontforge itself. It is highly recommended that file 'ChangeLog' is updated to reflect which you can check with ftinfo/otfinfo or fontforge itself. It is highly recommended that file 'ChangeLog' is updated to reflect
changes. changes.
   
Create a tarball with the following command: Create a tarball with the following command:
$ make dist $ make dist
   
The new versionned tarball will be available in the dist/ folder as The new versionned tarball will be available in the dist/ folder as
'liberation-fonts-[NEW_VERSION].tar.gz'. 'liberation-fonts-[NEW_VERSION].tar.gz'.
(FIXME) (FIXME)
   
7. Credits 7. Credits
============ ============
   
Special thanks to all involved to the proejct of Liberation Fonts! Special thanks to all involved to the proejct of Liberation Fonts!
   
* Caius 'kaio' Chance <k AT kaio.me> * Caius 'kaio' Chance <k AT kaio.me>
- Current project maintainer. - Current project maintainer.
   
* Mark Webbink <mwebbink AT redhat.com> * Mark Webbink <mwebbink AT redhat.com>
- Release coordinator, Red Hat Inc. - Release coordinator, Red Hat Inc.
   
* Steve Matteson * Steve Matteson
- Designer, Ascender Corp. - Designer, Ascender Corp.
   
* And, all other anonymous participants. * And, all other anonymous participants.
   
class JpCountryFlags { class JpCountryFlags {
   
$iCountryFlags = array( $iCountryFlags = array(
'Afghanistan' => 'afgh.gif', 'Afghanistan' => 'afgh.gif',
'Republic of Angola' => 'agla.gif', 'Republic of Angola' => 'agla.gif',
'Republic of Albania' => 'alba.gif', 'Republic of Albania' => 'alba.gif',
'Alderney' => 'alde.gif', 'Alderney' => 'alde.gif',
'Democratic and Popular Republic of Algeria' => 'alge.gif', 'Democratic and Popular Republic of Algeria' => 'alge.gif',
'Territory of American Samoa' => 'amsa.gif', 'Territory of American Samoa' => 'amsa.gif',
'Principality of Andorra' => 'andr.gif', 'Principality of Andorra' => 'andr.gif',
'British Overseas Territory of Anguilla' => 'angu.gif', 'British Overseas Territory of Anguilla' => 'angu.gif',
'Antarctica' => 'anta.gif', 'Antarctica' => 'anta.gif',
'Argentine Republic' => 'arge.gif', 'Argentine Republic' => 'arge.gif',
'League of Arab States' => 'arle.gif', 'League of Arab States' => 'arle.gif',
'Republic of Armenia' => 'arme.gif', 'Republic of Armenia' => 'arme.gif',
'Aruba' => 'arub.gif', 'Aruba' => 'arub.gif',
'Commonwealth of Australia' => 'astl.gif', 'Commonwealth of Australia' => 'astl.gif',
'Republic of Austria' => 'aust.gif', 'Republic of Austria' => 'aust.gif',
'Azerbaijani Republic' => 'azer.gif', 'Azerbaijani Republic' => 'azer.gif',
'British Antarctic Territory' => 'bant.gif', 'British Antarctic Territory' => 'bant.gif',
'Kingdom of Belgium' => 'belg.gif', 'Kingdom of Belgium' => 'belg.gif',
'British Overseas Territory of Bermuda' => 'berm.gif', 'British Overseas Territory of Bermuda' => 'berm.gif',
'Commonwealth of the Bahamas' => 'bhms.gif', 'Commonwealth of the Bahamas' => 'bhms.gif',
'Kingdom of Bahrain' => 'bhrn.gif', 'Kingdom of Bahrain' => 'bhrn.gif',
'Republic of Belarus' => 'blru.gif', 'Republic of Belarus' => 'blru.gif',
'Republic of Bolivia' => 'blva.gif', 'Republic of Bolivia' => 'blva.gif',
'Belize' => 'blze.gif', 'Belize' => 'blze.gif',
'Republic of Benin' => 'bnin.gif', 'Republic of Benin' => 'bnin.gif',
'Republic of Botswana' => 'bots.gif', 'Republic of Botswana' => 'bots.gif',
'Federative Republic of Brazil' => 'braz.gif', 'Federative Republic of Brazil' => 'braz.gif',
'Barbados' => 'brbd.gif', 'Barbados' => 'brbd.gif',
'British Indian Ocean Territory' => 'brin.gif', 'British Indian Ocean Territory' => 'brin.gif',
'Brunei Darussalam' => 'brun.gif', 'Brunei Darussalam' => 'brun.gif',
'Republic of Burkina' => 'bufa.gif', 'Republic of Burkina' => 'bufa.gif',
'Republic of Bulgaria' => 'bulg.gif', 'Republic of Bulgaria' => 'bulg.gif',
'Republic of Burundi' => 'buru.gif', 'Republic of Burundi' => 'buru.gif',
'Overseas Territory of the British Virgin Islands' => 'bvis.gif', 'Overseas Territory of the British Virgin Islands' => 'bvis.gif',
'Central African Republic' => 'cafr.gif', 'Central African Republic' => 'cafr.gif',
'Kingdom of Cambodia' => 'camb.gif', 'Kingdom of Cambodia' => 'camb.gif',
'Republic of Cameroon' => 'came.gif', 'Republic of Cameroon' => 'came.gif',
'Dominion of Canada' => 'cana.gif', 'Dominion of Canada' => 'cana.gif',
'Caribbean Community' => 'cari.gif', 'Caribbean Community' => 'cari.gif',
'Republic of Cape Verde' => 'cave.gif', 'Republic of Cape Verde' => 'cave.gif',
'Republic of Chad' => 'chad.gif', 'Republic of Chad' => 'chad.gif',
'Republic of Chile' => 'chil.gif', 'Republic of Chile' => 'chil.gif',
'Territory of Christmas Island' => 'chms.gif', 'Territory of Christmas Island' => 'chms.gif',
'Commonwealth of Independent States' => 'cins.gif', 'Commonwealth of Independent States' => 'cins.gif',
'Cook Islands' => 'ckis.gif', 'Cook Islands' => 'ckis.gif',
'Republic of Colombia' => 'clmb.gif', 'Republic of Colombia' => 'clmb.gif',
'Territory of Cocos Islands' => 'cois.gif', 'Territory of Cocos Islands' => 'cois.gif',
'Commonwealth' => 'comn.gif', 'Commonwealth' => 'comn.gif',
'Union of the Comoros' => 'como.gif', 'Union of the Comoros' => 'como.gif',
'Republic of the Congo' => 'cong.gif', 'Republic of the Congo' => 'cong.gif',
'Republic of Costa Rica' => 'corc.gif', 'Republic of Costa Rica' => 'corc.gif',
'Republic of Croatia' => 'croa.gif', 'Republic of Croatia' => 'croa.gif',
'Republic of Cuba' => 'cuba.gif', 'Republic of Cuba' => 'cuba.gif',
'British Overseas Territory of the Cayman Islands' => 'cyis.gif', 'British Overseas Territory of the Cayman Islands' => 'cyis.gif',
'Republic of Cyprus' => 'cypr.gif', 'Republic of Cyprus' => 'cypr.gif',
'The Czech Republic' => 'czec.gif', 'The Czech Republic' => 'czec.gif',
'Kingdom of Denmark' => 'denm.gif', 'Kingdom of Denmark' => 'denm.gif',
'Republic of Djibouti' => 'djib.gif', 'Republic of Djibouti' => 'djib.gif',
'Commonwealth of Dominica' => 'domn.gif', 'Commonwealth of Dominica' => 'domn.gif',
'Dominican Republic' => 'dore.gif', 'Dominican Republic' => 'dore.gif',
'Republic of Ecuador' => 'ecua.gif', 'Republic of Ecuador' => 'ecua.gif',
'Arab Republic of Egypt' => 'egyp.gif', 'Arab Republic of Egypt' => 'egyp.gif',
'Republic of El Salvador' => 'elsa.gif', 'Republic of El Salvador' => 'elsa.gif',
'England' => 'engl.gif', 'England' => 'engl.gif',
'Republic of Equatorial Guinea' => 'eqgu.gif', 'Republic of Equatorial Guinea' => 'eqgu.gif',
'State of Eritrea' => 'erit.gif', 'State of Eritrea' => 'erit.gif',
'Republic of Estonia' => 'estn.gif', 'Republic of Estonia' => 'estn.gif',
'Ethiopia' => 'ethp.gif', 'Ethiopia' => 'ethp.gif',
'European Union' => 'euun.gif', 'European Union' => 'euun.gif',
'British Overseas Territory of the Falkland Islands' => 'fais.gif', 'British Overseas Territory of the Falkland Islands' => 'fais.gif',
'International Federation of Vexillological Associations' => 'fiav.gif', 'International Federation of Vexillological Associations' => 'fiav.gif',
'Republic of Fiji' => 'fiji.gif', 'Republic of Fiji' => 'fiji.gif',
'Republic of Finland' => 'finl.gif', 'Republic of Finland' => 'finl.gif',
'Territory of French Polynesia' => 'fpol.gif', 'Territory of French Polynesia' => 'fpol.gif',
'French Republic' => 'fran.gif', 'French Republic' => 'fran.gif',
'Overseas Department of French Guiana' => 'frgu.gif', 'Overseas Department of French Guiana' => 'frgu.gif',
'Gabonese Republic' => 'gabn.gif', 'Gabonese Republic' => 'gabn.gif',
'Republic of the Gambia' => 'gamb.gif', 'Republic of the Gambia' => 'gamb.gif',
'Republic of Georgia' => 'geor.gif', 'Republic of Georgia' => 'geor.gif',
'Federal Republic of Germany' => 'germ.gif', 'Federal Republic of Germany' => 'germ.gif',
'Republic of Ghana' => 'ghan.gif', 'Republic of Ghana' => 'ghan.gif',
'Gibraltar' => 'gibr.gif', 'Gibraltar' => 'gibr.gif',
'Hellenic Republic' => 'grec.gif', 'Hellenic Republic' => 'grec.gif',
'State of Grenada' => 'gren.gif', 'State of Grenada' => 'gren.gif',
'Overseas Department of Guadeloupe' => 'guad.gif', 'Overseas Department of Guadeloupe' => 'guad.gif',
'Territory of Guam' => 'guam.gif', 'Territory of Guam' => 'guam.gif',
'Republic of Guatemala' => 'guat.gif', 'Republic of Guatemala' => 'guat.gif',
'The Bailiwick of Guernsey' => 'guer.gif', 'The Bailiwick of Guernsey' => 'guer.gif',
'Republic of Guinea' => 'guin.gif', 'Republic of Guinea' => 'guin.gif',
'Republic of Haiti' => 'hait.gif', 'Republic of Haiti' => 'hait.gif',
'Hong Kong Special Administrative Region' => 'hokn.gif', 'Hong Kong Special Administrative Region' => 'hokn.gif',
'Republic of Honduras' => 'hond.gif', 'Republic of Honduras' => 'hond.gif',
'Republic of Hungary' => 'hung.gif', 'Republic of Hungary' => 'hung.gif',
'Republic of Iceland' => 'icel.gif', 'Republic of Iceland' => 'icel.gif',
'International Committee of the Red Cross' => 'icrc.gif', 'International Committee of the Red Cross' => 'icrc.gif',
'Republic of India' => 'inda.gif', 'Republic of India' => 'inda.gif',
'Republic of Indonesia' => 'indn.gif', 'Republic of Indonesia' => 'indn.gif',
'Republic of Iraq' => 'iraq.gif', 'Republic of Iraq' => 'iraq.gif',
'Republic of Ireland' => 'irel.gif', 'Republic of Ireland' => 'irel.gif',
'Organization of the Islamic Conference' => 'isco.gif', 'Organization of the Islamic Conference' => 'isco.gif',
'Isle of Man' => 'isma.gif', 'Isle of Man' => 'isma.gif',
'State of Israel' => 'isra.gif', 'State of Israel' => 'isra.gif',
'Italian Republic' => 'ital.gif', 'Italian Republic' => 'ital.gif',
'Jamaica' => 'jama.gif', 'Jamaica' => 'jama.gif',
'Japan' => 'japa.gif', 'Japan' => 'japa.gif',
'The Bailiwick of Jersey' => 'jers.gif', 'The Bailiwick of Jersey' => 'jers.gif',
'Hashemite Kingdom of Jordan' => 'jord.gif', 'Hashemite Kingdom of Jordan' => 'jord.gif',
'Republic of Kazakhstan' => 'kazk.gif', 'Republic of Kazakhstan' => 'kazk.gif',
'Republic of Kenya' => 'keny.gif', 'Republic of Kenya' => 'keny.gif',
'Republic of Kiribati' => 'kirb.gif', 'Republic of Kiribati' => 'kirb.gif',
'State of Kuwait' => 'kuwa.gif', 'State of Kuwait' => 'kuwa.gif',
'Kyrgyz Republic' => 'kyrg.gif', 'Kyrgyz Republic' => 'kyrg.gif',
'Republic of Latvia' => 'latv.gif', 'Republic of Latvia' => 'latv.gif',
'Lebanese Republic' => 'leba.gif', 'Lebanese Republic' => 'leba.gif',
'Kingdom of Lesotho' => 'lest.gif', 'Kingdom of Lesotho' => 'lest.gif',
'Republic of Liberia' => 'libe.gif', 'Republic of Liberia' => 'libe.gif',
'Principality of Liechtenstein' => 'liec.gif', 'Principality of Liechtenstein' => 'liec.gif',
'Republic of Lithuania' => 'lith.gif', 'Republic of Lithuania' => 'lith.gif',
'Grand Duchy of Luxembourg' => 'luxe.gif', 'Grand Duchy of Luxembourg' => 'luxe.gif',
'Macao Special Administrative Region' => 'maca.gif', 'Macao Special Administrative Region' => 'maca.gif',
'Republic of Macedonia' => 'mace.gif', 'Republic of Macedonia' => 'mace.gif',
'Republic of Madagascar' => 'mada.gif', 'Republic of Madagascar' => 'mada.gif',
'Republic of the Marshall Islands' => 'mais.gif', 'Republic of the Marshall Islands' => 'mais.gif',
'Republic of Maldives' => 'mald.gif', 'Republic of Maldives' => 'mald.gif',
'Republic of Mali' => 'mali.gif', 'Republic of Mali' => 'mali.gif',
'Federation of Malaysia' => 'mals018.gif', 'Federation of Malaysia' => 'mals018.gif',
'Republic of Malta' => 'malt.gif', 'Republic of Malta' => 'malt.gif',
'Republic of Malawi' => 'malw.gif', 'Republic of Malawi' => 'malw.gif',
'Overseas Department of Martinique' => 'mart.gif', 'Overseas Department of Martinique' => 'mart.gif',
'Islamic Republic of Mauritania' => 'maur.gif', 'Islamic Republic of Mauritania' => 'maur.gif',
'Territorial Collectivity of Mayotte' => 'mayt.gif', 'Territorial Collectivity of Mayotte' => 'mayt.gif',
'United Mexican States' => 'mexc.gif', 'United Mexican States' => 'mexc.gif',
'Federated States of Micronesia' => 'micr.gif', 'Federated States of Micronesia' => 'micr.gif',
'Midway Islands' => 'miis.gif', 'Midway Islands' => 'miis.gif',
'Republic of Moldova' => 'mold.gif', 'Republic of Moldova' => 'mold.gif',
'Principality of Monaco' => 'mona.gif', 'Principality of Monaco' => 'mona.gif',
'Republic of Mongolia' => 'mong.gif', 'Republic of Mongolia' => 'mong.gif',
'British Overseas Territory of Montserrat' => 'mont.gif', 'British Overseas Territory of Montserrat' => 'mont.gif',
'Kingdom of Morocco' => 'morc.gif', 'Kingdom of Morocco' => 'morc.gif',
'Republic of Mozambique' => 'moza.gif', 'Republic of Mozambique' => 'moza.gif',
'Republic of Mauritius' => 'mrts.gif', 'Republic of Mauritius' => 'mrts.gif',
'Union of Myanmar' => 'myan.gif', 'Union of Myanmar' => 'myan.gif',
'Republic of Namibia' => 'namb.gif', 'Republic of Namibia' => 'namb.gif',
'North Atlantic Treaty Organization' => 'nato.gif', 'North Atlantic Treaty Organization' => 'nato.gif',
'Republic of Nauru' => 'naur.gif', 'Republic of Nauru' => 'naur.gif',
'Turkish Republic of Northern Cyprus' => 'ncyp.gif', 'Turkish Republic of Northern Cyprus' => 'ncyp.gif',
'Netherlands Antilles' => 'nean.gif', 'Netherlands Antilles' => 'nean.gif',
'Kingdom of Nepal' => 'nepa.gif', 'Kingdom of Nepal' => 'nepa.gif',
'Kingdom of the Netherlands' => 'neth.gif', 'Kingdom of the Netherlands' => 'neth.gif',
'Territory of Norfolk Island' => 'nfis.gif', 'Territory of Norfolk Island' => 'nfis.gif',
'Federal Republic of Nigeria' => 'ngra.gif', 'Federal Republic of Nigeria' => 'ngra.gif',
'Republic of Nicaragua' => 'nica.gif', 'Republic of Nicaragua' => 'nica.gif',
'Republic of Niger' => 'nigr.gif', 'Republic of Niger' => 'nigr.gif',
'Niue' => 'niue.gif', 'Niue' => 'niue.gif',
'Commonwealth of the Northern Mariana Islands' => 'nmar.gif', 'Commonwealth of the Northern Mariana Islands' => 'nmar.gif',
'Province of Northern Ireland' => 'noir.gif', 'Province of Northern Ireland' => 'noir.gif',
'Nordic Council' => 'nord.gif', 'Nordic Council' => 'nord.gif',
'Kingdom of Norway' => 'norw.gif', 'Kingdom of Norway' => 'norw.gif',
'Territory of New Caledonia and Dependencies' => 'nwca.gif', 'Territory of New Caledonia and Dependencies' => 'nwca.gif',
'New Zealand' => 'nwze.gif', 'New Zealand' => 'nwze.gif',
'Organization of American States' => 'oast.gif', 'Organization of American States' => 'oast.gif',
'Organization of African Unity' => 'oaun.gif', 'Organization of African Unity' => 'oaun.gif',
'International Olympic Committee' => 'olym.gif', 'International Olympic Committee' => 'olym.gif',
'Sultanate of Oman' => 'oman.gif', 'Sultanate of Oman' => 'oman.gif',
'Organization of Petroleum Exporting Countries' => 'opec.gif', 'Organization of Petroleum Exporting Countries' => 'opec.gif',
'Islamic Republic of Pakistan' => 'paks.gif', 'Islamic Republic of Pakistan' => 'paks.gif',
'Republic of Palau' => 'pala.gif', 'Republic of Palau' => 'pala.gif',
'Independent State of Papua New Guinea' => 'pang.gif', 'Independent State of Papua New Guinea' => 'pang.gif',
'Republic of Paraguay' => 'para.gif', 'Republic of Paraguay' => 'para.gif',
'Republic of the Philippines' => 'phil.gif', 'Republic of the Philippines' => 'phil.gif',
'British Overseas Territory of the Pitcairn Islands' => 'piis.gif', 'British Overseas Territory of the Pitcairn Islands' => 'piis.gif',
'Republic of Poland' => 'pola.gif', 'Republic of Poland' => 'pola.gif',
'Republic of Portugal' => 'port.gif', 'Republic of Portugal' => 'port.gif',
'Commonwealth of Puerto Rico' => 'purc.gif', 'Commonwealth of Puerto Rico' => 'purc.gif',
'State of Qatar' => 'qata.gif', 'State of Qatar' => 'qata.gif',
'Russian Federation' => 'russ.gif', 'Russian Federation' => 'russ.gif',
'Republic of Rwanda' => 'rwan.gif', 'Republic of Rwanda' => 'rwan.gif',
'Kingdom of Saudi Arabia' => 'saar.gif', 'Kingdom of Saudi Arabia' => 'saar.gif',
'Republic of San Marino' => 'sama.gif', 'Republic of San Marino' => 'sama.gif',
'Nordic Sami Conference' => 'sami.gif', 'Nordic Sami Conference' => 'sami.gif',
'Sark' => 'sark.gif', 'Sark' => 'sark.gif',
'Scotland' => 'scot.gif', 'Scotland' => 'scot.gif',
'Principality of Seborga' => 'sebo.gif', 'Principality of Seborga' => 'sebo.gif',
'Republic of Sierra Leone' => 'sile.gif', 'Republic of Sierra Leone' => 'sile.gif',
'Republic of Singapore' => 'sing.gif', 'Republic of Singapore' => 'sing.gif',
'Republic of Korea' => 'skor.gif', 'Republic of Korea' => 'skor.gif',
'Republic of Slovenia' => 'slva.gif', 'Republic of Slovenia' => 'slva.gif',
'Somali Republic' => 'smla.gif', 'Somali Republic' => 'smla.gif',
'Republic of Somaliland' => 'smld.gif', 'Republic of Somaliland' => 'smld.gif',
'Republic of South Africa' => 'soaf.gif', 'Republic of South Africa' => 'soaf.gif',
'Solomon Islands' => 'sois.gif', 'Solomon Islands' => 'sois.gif',
'Kingdom of Spain' => 'span.gif', 'Kingdom of Spain' => 'span.gif',
'Secretariat of the Pacific Community' => 'spco.gif', 'Secretariat of the Pacific Community' => 'spco.gif',
'Democratic Socialist Republic of Sri Lanka' => 'srla.gif', 'Democratic Socialist Republic of Sri Lanka' => 'srla.gif',
'Saint Lucia' => 'stlu.gif', 'Saint Lucia' => 'stlu.gif',
'Republic of the Sudan' => 'suda.gif', 'Republic of the Sudan' => 'suda.gif',
'Republic of Suriname' => 'surn.gif', 'Republic of Suriname' => 'surn.gif',
'Slovak Republic' => 'svka.gif', 'Slovak Republic' => 'svka.gif',
'Kingdom of Sweden' => 'swdn.gif', 'Kingdom of Sweden' => 'swdn.gif',
'Swiss Confederation' => 'swit.gif', 'Swiss Confederation' => 'swit.gif',
'Syrian Arab Republic' => 'syra.gif', 'Syrian Arab Republic' => 'syra.gif',
'Kingdom of Swaziland' => 'szld.gif', 'Kingdom of Swaziland' => 'szld.gif',
'Republic of China' => 'taiw.gif', 'Republic of China' => 'taiw.gif',
'Republic of Tajikistan' => 'tajk.gif', 'Republic of Tajikistan' => 'tajk.gif',
'United Republic of Tanzania' => 'tanz.gif', 'United Republic of Tanzania' => 'tanz.gif',
'Kingdom of Thailand' => 'thal.gif', 'Kingdom of Thailand' => 'thal.gif',
'Autonomous Region of Tibet' => 'tibe.gif', 'Autonomous Region of Tibet' => 'tibe.gif',
'Turkmenistan' => 'tkst.gif', 'Turkmenistan' => 'tkst.gif',
'Togolese Republic' => 'togo.gif', 'Togolese Republic' => 'togo.gif',
'Tokelau' => 'toke.gif', 'Tokelau' => 'toke.gif',
'Kingdom of Tonga' => 'tong.gif', 'Kingdom of Tonga' => 'tong.gif',
'Tristan da Cunha' => 'trdc.gif', 'Tristan da Cunha' => 'trdc.gif',
'Tromelin' => 'tris.gif', 'Tromelin' => 'tris.gif',
'Republic of Tunisia' => 'tuns.gif', 'Republic of Tunisia' => 'tuns.gif',
'Republic of Turkey' => 'turk.gif', 'Republic of Turkey' => 'turk.gif',
'Tuvalu' => 'tuva.gif', 'Tuvalu' => 'tuva.gif',
'United Arab Emirates' => 'uaem.gif', 'United Arab Emirates' => 'uaem.gif',
'Republic of Uganda' => 'ugan.gif', 'Republic of Uganda' => 'ugan.gif',
'Ukraine' => 'ukrn.gif', 'Ukraine' => 'ukrn.gif',
'United Kingdom of Great Britain' => 'unkg.gif', 'United Kingdom of Great Britain' => 'unkg.gif',
'United Nations' => 'unna.gif', 'United Nations' => 'unna.gif',
'United States of America' => 'unst.gif', 'United States of America' => 'unst.gif',
'Oriental Republic of Uruguay' => 'urgy.gif', 'Oriental Republic of Uruguay' => 'urgy.gif',
'Virgin Islands of the United States' => 'usvs.gif', 'Virgin Islands of the United States' => 'usvs.gif',
'Republic of Uzbekistan' => 'uzbk.gif', 'Republic of Uzbekistan' => 'uzbk.gif',
'State of the Vatican City' => 'vacy.gif', 'State of the Vatican City' => 'vacy.gif',
'Republic of Vanuatu' => 'vant.gif', 'Republic of Vanuatu' => 'vant.gif',
'Bolivarian Republic of Venezuela' => 'venz.gif', 'Bolivarian Republic of Venezuela' => 'venz.gif',
'Republic of Yemen' => 'yemn.gif', 'Republic of Yemen' => 'yemn.gif',
'Democratic Republic of Congo' => 'zare.gif', 'Democratic Republic of Congo' => 'zare.gif',
'Republic of Zimbabwe' => 'zbwe.gif' 'Republic of Zimbabwe' => 'zbwe.gif'
) ; ) ;
   
   
   
 Binary files a/lib/jpgraph/flags.dat and b/lib/jpgraph/flags.dat differ
 Binary files a/lib/jpgraph/flags_thumb100x100.dat and b/lib/jpgraph/flags_thumb100x100.dat differ
 Binary files a/lib/jpgraph/flags_thumb35x35.dat and b/lib/jpgraph/flags_thumb35x35.dat differ
 Binary files a/lib/jpgraph/flags_thumb60x60.dat and b/lib/jpgraph/flags_thumb60x60.dat differ
symlink:b/liberation (new)
  /usr/share/fonts/liberation/
file:a/style.css -> file:b/style.css
body { body {
font-family: "Arial"; font-family: "Arial";
} }
   
h1 { h1 {
font-size:27px; font-size:27px;
} }
   
li { li {
padding-left: 20px; padding-left: 20px;
} }
   
#search, form { #search, form {
float: right; float: right;
margin-top: -1px; margin-top: -1px;
} }
   
#sitenav { #sitenav {
   
width: 99%; width: 99%;
text-align: left; text-align: left;
padding: 5px; padding: 5px;
border-top:1px solid black; border-top:1px solid black;
border-bottom:1px solid black; border-bottom:1px solid black;
} }
   
#sitenav.a { #sitenav.a {
   
display: inline; display: inline;
} }
   
#content { #content {
margin: 10px; margin: 10px;
padding: 5px; padding: 5px;
width: auto; width: auto;
} }
   
#sidebar { #sidebar {
width: 100px; width: 100px;
border-right: 3px solid black; border-right: 3px solid black;
height: 100%; height: 100%;
float: left; float: left;
} }
   
#ft { #ft {
font-size: 66%; font-size: 66%;
} }
   
// div collapse from http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html // div collapse from http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html
p { p {
padding: 0 0 1em; padding: 0 0 1em;
} }
.msg_list { .msg_list {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
width: 383px; width: 383px;
} }
.msg_head { .msg_head {
padding: 5px 10px; padding: 5px 10px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
background-color:#FFCCCC; background-color:#FFCCCC;
margin:1px; margin:1px;
} }
.msg_body { .msg_body {
padding: 5px 10px 15px; padding: 5px 10px 15px;
background-color:#F4F4F8; background-color:#F4F4F8;
} }
// div collapse // div collapse
file:a/todo.txt -> file:b/todo.txt
can we merge accountablity-avoiding contract notices (ie sequential/similar agencyInternalID/description to same vendor, same publish date) can we merge accountablity-avoiding contract notices (ie sequential/similar agencyInternalID/description to same vendor, same publish date)
can we merge ABN splitting companies like PWC/Dell Finance? can we merge ABN splitting companies like PWC/Dell Finance?
can we add google news? lobbyist officers? can we add google news? lobbyist officers?
compile database of file lists compile database of file lists
compile database of employees compile database of employees