<?php
/**********************************************************
* ______ ______ ___ _______ ___ ___ _______ *
* | _ \ | _ \ | | | _ || Y || _ | *
* |. | \|. | \|. | |. 1___||. || 1___| *
* |. | |. | |. |___ |. |___ |. \_/ ||____ | *
* |: 1 |: 1 |: 1 ||: 1 ||: | ||: 1 | *
* |::.. . /|::.. . /|::.. . ||::.. . ||::.|:. ||::.. . | *
* `------' `------' `-------'`-------'`--- ---'`-------' *
* _______ _______ *
* .--.--. | _ | | | *
* | | | |___| | __ |___| | *
* \___/ _(__ | |__| / ___/ *
* |: 1 | |: 1 \ *
* |::.. . | |::.. . | *
* `-------' `-------' *
* *
* Script: DDLCMS v3.2 *
* Author: Little Dragon *
* Email: hide@address.com *
* Website: http://www.ddlcms.com *
* *
* Please direct bug reports, suggestions or feedback *
* to the DDLCMS forums: *
* *
* http://www.ddlcms.com/forums *
* *
* DDLCMS is a commercial grade content management *
* system for DDL site owners. It is provided free *
* of charge, provided: *
* *
* 1. You keep the linkback to http://www.ddlcms.com *
* in the footer. *
* *
* 2. You keep the sponsored links to Sharingzone.net *
* on your site. *
* *
* By using this script, you agree that you will not *
* modify, remove, or replace any encoded parts of *
* this script. All encoded parts MUST remain intact *
* for your site to remain in good standing. *
* *
**********************************************************/
if(!defined('WWWROOT'))
{
define('WWWROOT', dirname(__FILE__) . '/');
}
# Ideally, the config would be included one level below
#define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
#require(BASEDIR . 'config.php');
class ddl extends config
{
var $get = false;
var $total = 0;
function init($q)
{
global $categories, $pagelimit, $type;
if(isset($_GET) && is_array($_GET) && count($_GET) > 0 && array_key_exists('page', $_GET) && ctype_digit($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}
$this->page = $page;
$this->page *= $pagelimit;
$this->page -= $pagelimit;
if(!in_array($type, $categories))
{
$hvahvor = "type != ''";
}
else
{
$hvahvor = "type = '" . $type . "'";
}
if(isset($_GET) && is_array($_GET) && count($_GET) > 0 && array_key_exists('filterURL', $_GET) && strlen(testURL($_GET['filterURL'], 'simple')) > 0)
{
$filterURL = mysql_escape_string($_GET['filterURL']);
$hvahvor .= " && surl LIKE 'http://$filterURL%'";
}
if($q)
{
global $spamSearch;
$spamSearch = FALSE;
$exp = explode(' ', sanitizeInput('name', $q));
$keywordList = implode('","', $exp);
$keywordList = '"' . $keywordList . '"';
$phrase = sanitizeInput('name', $q);
$bannedKeywordsQuery = dbcom('SELECT COUNT(*) FROM spamwords WHERE spamword IN(' . $keywordList . ') OR spamword = "' . $phrase . '";');
$numBannedWords = mysql_result($bannedKeywordsQuery, 0);
if($numBannedWords > 0)
{
$spamSearch = TRUE;
$hvahvor = "type != ''";
}
else
{
for($i = 0; $i < count($exp); $i++)
{
$hvahvor .= " && title LIKE '%$exp[$i]%'";
}
}
}
$g_total = dbcom("SELECT COUNT(id) AS TOTAL FROM downloads WHERE $hvahvor;");
$this->total = mysql_result($g_total,0);
$this->get = dbcom("SELECT id, type, title, url, sname, surl, UNIX_TIMESTAMP(date) AS theDate, email, views, reports, rating, ip FROM downloads WHERE $hvahvor ORDER BY id DESC LIMIT $this->page, $pagelimit;");
}
function get($q = '', $types)
{
global $categories, $row, $ddl_id, $ddl_name, $ddl_sname, $ddl_surl, $ddl_date, $ddl_views, $ddl_type;
if(isset($_GET) && is_array($_GET) && count($_GET) > 0 && array_key_exists('page', $_GET) && ctype_digit($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}
$this->init($q);
#echo $hvahvor;
}
}
?>