示例#1
0
function &GetLinksSearch(&$attrs)
{
    global $C;
    $DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
    $DB->Connect();
    $links = array('links' => array(), 'pagination' => FALSE);
    $per_page = isset($attrs['perpage']) ? $attrs['perpage'] : 20;
    $page = isset($_GET['p']) ? $_GET['p'] : 1;
    $order_clause = empty($attrs['order']) ? '' : "ORDER BY {$attrs['order']}";
    $query = "SELECT * FROM lx_links WHERE status='active' AND MATCH(title,description,keywords) AGAINST (? IN BOOLEAN MODE) {$order_clause}";
    $binds = array($_GET['s']);
    $links['pagination'] = $DB->QueryWithPagination($query, $binds, $page, $per_page);
    if ($links['pagination']['result']) {
        while ($link = $DB->NextRow($links['pagination']['result'])) {
            $user_fields = $DB->Row('SELECT * FROM lx_link_fields WHERE link_id=?', array($link['link_id']));
            $link = array_merge($link, $user_fields);
            $link['date_added'] = strtotime($link['date_added']);
            $links['links'][] = $link;
        }
        $DB->Free($links['pagination']['result']);
    }
    unset($links['pagination']['result']);
    return $links;
}
示例#2
0
    $has_recent = $DB->Count('SELECT COUNT(*) FROM lx_link_comments WHERE link_id=? AND (email=? OR submit_ip=?) AND date_added >= DATE_ADD(?, INTERVAL ? SECOND)', array($_REQUEST['link_id'], $_REQUEST['email'], $_SERVER['REMOTE_ADDR'], MYSQL_NOW, -$C['comment_delay']));
}
if ($has_recent) {
    $v->SetError(sprintf($L['COMMENT_LIMIT'], $C['comment_delay']));
}
// Check dsbl.org for spam submissions
if ($C['dsbl_comment'] && CheckDsbl($_SERVER['REMOTE_ADDR'])) {
    $v->SetError($L['DSBL_MATCHED']);
}
if (!$v->Validate()) {
    $errors = join('<br />', $v->GetErrors());
    $t->assign('error', $errors);
    $t->display('error-nice.tpl');
    exit;
}
$link = $DB->Row('SELECT * FROM lx_links WHERE link_id=?', array($_REQUEST['link_id']));
if ($link) {
    $status = $C['approve_comments'] ? 'pending' : 'approved';
    $username = $account ? $account['username'] : '';
    $DB->Update('INSERT INTO lx_link_comments VALUES (?,?,?,?,?,?,?,?,?)', array(null, $link['link_id'], $username, $_REQUEST['email'], $_REQUEST['name'], $_SERVER['REMOTE_ADDR'], MYSQL_NOW, $status, $_REQUEST['comment']));
    if ($status == 'approved') {
        $DB->Update('UPDATE lx_links SET comments=comments+1 WHERE link_id=?', array($link['link_id']));
    }
    $_REQUEST['comment_id'] = $DB->InsertID();
    $t->assign_by_ref('comment', $_REQUEST);
    // Send e-mail to appropriate administrators
    $result = $DB->Query('SELECT * FROM lx_administrators');
    while ($admin = $DB->NextRow($result)) {
        if ($admin['notifications'] & E_COMMENT) {
            SendMail($admin['email'], 'email-admin-comment.tpl', $t);
        }
示例#3
0
    date_default_timezone_set('America/Chicago');
}
if (get_magic_quotes_gpc()) {
    _astripslashes($_GET);
}
$_GET['s'] = trim($_GET['s']);
$page = isset($_GET['p']) ? $_GET['p'] : 1;
$per_page = isset($_GET['pp']) ? $_GET['pp'] : 20;
$too_short = strlen($_GET['s']) < 4;
$search_id = md5("{$_GET['s']}-{$page}-{$_GET['c']}-{$_GET['f']}");
$t = new Template();
$t->caching = TRUE;
$t->cache_lifetime = 3600;
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
$domain = $DB->Row('SELECT * FROM `tx_domains` WHERE `domain`=?', array(preg_replace('~^www\\.~i', '', strtolower($_SERVER['HTTP_HOST']))));
if ($domain) {
    $C['cookie_domain'] = $domain['domain'];
}
if (!$too_short && !$t->is_cached($domain['template_prefix'] . 'search-results.tpl', $search_id)) {
    $categories =& $DB->FetchAll('SELECT `name`,`tag` FROM `tx_categories` WHERE `hidden`=0 ORDER BY `name`', null, 'tag');
    $galleries = array();
    $search_wheres = array('MATCH(`description`,`keywords`) AGAINST(? IN BOOLEAN MODE)', '`status` IN (?,?)');
    $search_binds = array($_GET['s'], 'used', 'holding');
    // If category was specified, add it to the where clause
    if ($_GET['c']) {
        $search_wheres[] = 'MATCH(`categories`) AGAINST(? IN BOOLEAN MODE)';
        $search_binds[] = $_GET['c'];
    }
    // If format was specified, add it to the where clause
    if ($_GET['f']) {
示例#4
0
// See the License for the specific language governing permissions and
// limitations under the License.
// If you are using this script on one of the domains you have defined in the
// Manage Domains interface, uncomment the following line and set the directory
// path to your TGPX Server Edition installation
//chdir('/full/path/to/tgpxse/install');
require_once 'includes/common.php';
require_once "{$GLOBALS['BASE_DIR']}/includes/template.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/mysql.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/validator.class.php";
SetupRequest();
$t = new Template();
$t->assign_by_ref('config', $C);
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
$domain = $DB->Row('SELECT * FROM `tx_domains` WHERE `domain`=?', array(preg_replace('~^www\\.~i', '', strtolower($_SERVER['HTTP_HOST']))));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    txReportAdd();
} else {
    txShReportAdd();
}
$DB->Disconnect();
function txShReportAdd($errors = null)
{
    global $DB, $C, $L, $t, $domain;
    $gallery = $DB->Row('SELECT * FROM `tx_galleries` WHERE `gallery_id`=?', array($_REQUEST['id']));
    if (!$gallery) {
        $t->assign('error', $L['BAD_GALLERY_ID']);
        $t->display($domain['template_prefix'] . 'error-nice.tpl');
        return;
    }
示例#5
0
}
require_once '../includes/common.php';
require_once "{$GLOBALS['BASE_DIR']}/includes/mysql.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/template.class.php";
require_once "{$GLOBALS['BASE_DIR']}/admin/includes/functions.php";
// Get the configuration ID from command line parameter
$config_id = $GLOBALS['argv'][1];
// Define penalties
$penalties = array('ignore' => 0x0, 'report' => 0x1, 'disable' => 0x2, 'delete' => 0x4, 'blacklist' => 0x8);
// Exception bitmasks
$exceptions = array('connect' => 0x1, 'forward' => 0x2, 'broken' => 0x4, 'blacklist' => 0x8);
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
// Get scanner configuration information
$config = $DB->Row('SELECT * FROM `tlx_scanner_configs` WHERE `config_id`=?', array($config_id));
if (!$config) {
    echo "Invalid configuration ID {$config_id}\n";
    exit;
}
$configuration = unserialize($config['configuration']);
// See if another instance of this scanner configuration is already running
if ($config['pid'] != 0 && $config['status_updated'] > time() - 300) {
    echo "This scanner configuration is already running\n";
    exit;
}
// Clear previous scan results
$DB->Update('DELETE FROM `tlx_scanner_results` WHERE `config_id`=?', array($config_id));
// Set the last run time, pid, and status
$DB->Update('UPDATE `tlx_scanner_configs` SET `current_status`=?,`status_updated`=?,`date_last_run`=?,`pid`=? WHERE `config_id`=?', array('Starting...', time(), MYSQL_NOW, getmypid(), $config_id));
// Setup the MySQL query
示例#6
0
}
// Remove status index of the lx_links table
$indexes =& $DB->FetchAll('SHOW INDEX FROM `lx_links`', null, 'Column_name');
if (isset($indexes['status'])) {
    $DB->Update('ALTER TABLE `lx_links` DROP INDEX `status`');
}
// Add index to the path row of the lx_categories table
$indexes =& $DB->FetchAll('SHOW INDEX FROM `lx_categories`', null, 'Column_name');
if (!isset($indexes['path'])) {
    $DB->Update('ALTER TABLE `lx_categories` ADD INDEX (`path`(255))');
}
$columns = $DB->GetColumns('lx_categories');
if (!in_array('url_name', $columns)) {
    $DB->Update('ALTER TABLE `lx_categories` ADD COLUMN `url_name` TEXT AFTER `name`');
}
$describe = $DB->Row('DESCRIBE `lx_reports` `date_added`');
if (stristr($describe['Type'], 'date') === FALSE) {
    $DB->Update('ALTER TABLE `lx_reports` MODIFY COLUMN `date_added` TEXT');
    $DB->Update('UPDATE `lx_reports` SET `date_added`=FROM_UNIXTIME(`date_added`)');
    $DB->Update('ALTER TABLE `lx_reports` MODIFY COLUMN `date_added` DATETIME');
}
$describe = $DB->Row('DESCRIBE `lx_news` `date_added`');
if (stristr($describe['Type'], 'date') === FALSE) {
    $DB->Update('ALTER TABLE `lx_news` MODIFY COLUMN `date_added` TEXT');
    $DB->Update('UPDATE `lx_news` SET `date_added`=FROM_UNIXTIME(`date_added`)');
    $DB->Update('ALTER TABLE `lx_news` MODIFY COLUMN `date_added` DATETIME');
}
$describe = $DB->Row('DESCRIBE `lx_link_comments` `date_added`');
if (stristr($describe['Type'], 'date') === FALSE) {
    $DB->Update('ALTER TABLE `lx_link_comments` MODIFY COLUMN `date_added` TEXT');
    $DB->Update('UPDATE `lx_link_comments` SET `date_added`=FROM_UNIXTIME(`date_added`)');
示例#7
0
require_once '../includes/common.php';
require_once "{$GLOBALS['BASE_DIR']}/includes/mysql.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/htmlparser.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/template.class.php";
require_once "{$GLOBALS['BASE_DIR']}/admin/includes/functions.php";
// Get the configuration ID from command line parameter
$config_id = $GLOBALS['argv'][1];
// Define penalties
$penalties = array('ignore' => 0x0, 'report' => 0x1, 'disable' => 0x2, 'delete' => 0x4, 'blacklist' => 0x8);
// Exception bitmasks
$exceptions = array('connect' => 0x1, 'forward' => 0x2, 'broken' => 0x4, 'blacklist' => 0x8, 'norecip' => 0x10);
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
// Get scanner configuration information
$config = $DB->Row('SELECT * FROM lx_scanner_configs WHERE config_id=?', array($config_id));
if (!$config) {
    echo "Invalid configuration ID {$config_id}\n";
    exit;
}
$configuration = unserialize($config['configuration']);
// See if another instance of this scanner configuration is already running
if ($config['pid'] != 0 && $config['status_updated'] > time() - 300) {
    echo "This scanner configuration is already running\n";
    exit;
}
// Clear previous scan results
$DB->Update('DELETE FROM lx_scanner_results WHERE config_id=?', array($config_id));
// Set the last run time, pid, and status
$DB->Update('UPDATE lx_scanner_configs SET current_status=?,status_updated=?,date_last_run=?,pid=? WHERE config_id=?', array('Starting...', time(), MYSQL_NOW, getmypid(), $config_id));
// Setup the MySQL query qualifier
示例#8
0
$t->caching = TRUE;
$t->cache_lifetime = 3600;
$t->assign('search_term', $_POST['s']);
$t->assign('search_category', $_POST['c']);
$t->assign('page', $page);
$t->assign('per_page', $per_page);
$t->assign('search_too_short', $too_short);
$t->assign_by_ref('config', $C);
if (!$too_short && !$t->is_cached('search-results.tpl', $search_id)) {
    $DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
    $DB->Connect();
    $accounts = array();
    $result = $DB->QueryWithPagination('SELECT * FROM `tlx_accounts` JOIN `tlx_account_hourly_stats` USING (`username`) WHERE ' . 'MATCH(`title`,`description`,`keywords`) AGAINST(? IN BOOLEAN MODE) AND ' . '`status`=? AND ' . '`disabled`=0 ' . (!empty($_POST['c']) && is_numeric($_POST['c']) ? ' AND `category_id`=' . $DB->Escape($_POST['c']) . ' ' : '') . 'ORDER BY `unique_in_total` DESC', array($_POST['s'], 'active'), $page, $per_page);
    if ($result['result']) {
        while ($account = $DB->NextRow($result['result'])) {
            $accounts[] = array_merge($account, $DB->Row('SELECT * FROM `tlx_account_fields` WHERE `username`=?', array($account['username'])));
        }
        $DB->Free($result['result']);
        unset($result['result']);
    }
    $categories = $DB->FetchAll('SELECT * FROM `tlx_categories` ORDER BY `name`');
    if (!$categories) {
        $categories = array();
    }
    $t->assign_by_ref('categories', $categories);
    $t->assign_by_ref('pagination', $result);
    $t->assign_by_ref('results', $accounts);
    $DB->Disconnect();
} else {
    if ($too_short) {
        $DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
示例#9
0
require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/template.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/imager.class.php";
require_once "{$GLOBALS['BASE_DIR']}/admin/includes/functions.php";
// Get imager object for preview cropping/resizing
$imager = GetImager();
// Get the configuration ID from command line parameter
$config_id = $GLOBALS['argv'][1];
// Define penalties
$penalties = array('ignore' => 0x0, 'report' => 0x1, 'disable' => 0x2, 'delete' => 0x4, 'blacklist' => 0x8);
// Exception bitmasks
$exceptions = array('connect' => 0x1, 'forward' => 0x2, 'broken' => 0x4, 'blacklist' => 0x8, 'norecip' => 0x10, 'no2257' => 0x20, 'excessivelinks' => 0x40, 'thumbchange' => 0x80, 'pagechange' => 0x100, 'content_server' => 0x200, 'badformat' => 0x400);
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
// Get scanner configuration information
$config = $DB->Row('SELECT * FROM `tx_scanner_configs` WHERE `config_id`=?', array($config_id));
if (!$config) {
    echo "Invalid configuration ID {$config_id}\n";
    exit;
}
$configuration = unserialize($config['configuration']);
// See if another instance of this scanner configuration is already running
if ($config['pid'] != 0 && $config['status_updated'] > time() - 300) {
    echo "This scanner configuration is already running\n";
    exit;
}
// Clear previous scan results
$DB->Update('DELETE FROM `tx_scanner_results` WHERE `config_id`=?', array($config_id));
// Make sure safe_mode is disabled
if (ini_get('safe_mode')) {
    $DB->Update('UPDATE `tx_scanner_configs` SET `current_status`=?,`status_updated`=?,`date_last_run`=?,`pid`=? WHERE `config_id`=?', array('ERROR: The CLI version of PHP is running with safe_mode enabled', time(), MYSQL_NOW, getmypid(), $config_id));
示例#10
0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
require_once 'includes/common.php';
require_once "{$GLOBALS['BASE_DIR']}/includes/template.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/mysql.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/validator.class.php";
SetupRequest();
$t = new Template();
$t->assign_by_ref('config', $C);
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
$account = $DB->Row('SELECT * FROM `tlx_accounts` WHERE `username`=?', array($_REQUEST['id']));
if ($account) {
    $page = isset($_REQUEST['p']) ? $_REQUEST['p'] : 1;
    $per_page = isset($_REQUEST['pp']) ? $_REQUEST['pp'] : 20;
    $result = $DB->QueryWithPagination('SELECT * FROM `tlx_account_comments` WHERE `status`=? AND `username`=? ORDER BY `date_submitted` DESC', array('approved', $_REQUEST['id']), $page, $per_page);
    if ($result['result']) {
        while ($comment = $DB->NextRow($result['result'])) {
            $comment['date'] = strtotime($comment['date_submitted']);
            $comments[] = $comment;
        }
        $DB->Free($result['result']);
        unset($result['result']);
    }
    $t->assign_by_ref('pagination', $result);
    $t->assign_by_ref('comments', $comments);
    $t->assign_by_ref('account', $account);
示例#11
0
文件: rss.php 项目: hackingman/LinkX
    _ArrayStripSlashes($_GET);
}
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$cache_id = null;
$views = array('top' => array('template' => 'rss-directory-top-rated.tpl', 'cache' => $C['cache_top']), 'popular' => array('template' => 'rss-directory-popular.tpl', 'cache' => $C['cache_popular']), 'new' => array('template' => 'rss-directory-new.tpl', 'cache' => $C['cache_new']));
$t = new Template();
$t->assign_by_ref('config', $C);
if (isset($views[$_GET['p']])) {
    $view = $views[$_GET['p']];
} else {
    $view = array('template' => 'rss-directory-category.tpl', 'cache' => $C['cache_category']);
    $_GET['p'] = isset($_GET['p']) ? $_GET['p'] : 1;
    $cache_id = md5($_GET['c'] . '-' . $_GET['p']);
    if (!$t->is_cached($view['template'], $cache_id)) {
        $DB->Connect();
        $category = $DB->Row('SELECT * FROM `lx_categories` WHERE `category_id`=?', array($_GET['c']));
        if (!$category) {
            require_once 'includes/language.php';
            $t->caching = FALSE;
            $t->assign('error', $L['NO_SUCH_PAGE']);
            $t->display('error-nice.tpl');
            return;
        }
        $category['path_parts'] = unserialize($category['path_parts']);
        $t->assign_by_ref('this_category', $category);
        $t->assign('page_num', $_GET['p']);
        $t->assign('get_c', $_GET['c']);
        $t->assign_by_ref('request', $_GET);
    }
}
$t->caching = TRUE;
示例#12
0
if (get_magic_quotes_gpc()) {
    _ArrayStripSlashes($_GET);
}
$link = array('link_id' => $_GET['id']);
$cache_id = md5($_GET['id']);
// Indicate if logged in
$C['logged_in'] = isset($_COOKIE['linkxuser']);
$t = new Template();
$t->caching = $C['cache_details'] > 0;
$t->cache_lifetime = $C['cache_details'];
$t->cache_dir = 'templates/cache_details';
$t->assign_by_ref('link', $link);
if (!$t->is_cached('directory-link-details.tpl', $cache_id)) {
    $DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
    $DB->Connect();
    $link = $DB->Row('SELECT * FROM lx_links JOIN lx_link_fields USING (link_id) WHERE lx_links.link_id=?', array($_GET['id']));
    if (!$link) {
        require_once 'includes/language.php';
        $t->caching = FALSE;
        $t->assign('error', $L['NO_SUCH_PAGE']);
        $t->assign_by_ref('config', $C);
        $t->display('error-nice.tpl');
        return;
    }
    // Get all categories for this link
    $categories = array();
    $result = $DB->Query('SELECT * FROM lx_link_cats JOIN lx_categories USING (category_id) WHERE link_id=?', array($_GET['id']));
    while ($category = $DB->NextRow($result)) {
        $category['path_parts'] = unserialize($category['path_parts']);
        $categories[] = $category;
    }