GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   TGPX help (https://gfy.com/showthread.php?t=922926)

studiosx 08-20-2009 06:28 PM

TGPX help
 
First of all, sorry for my english.

If anybody can help me ....
I'm using TGPX and my question is about search form and search result.

if someone enters foot fetish in the search form, It will come up in the search result as two words, foot and fetish.

I want that search result to be as one word foot fetish (like an exact phrase), without using quotes.

I want to know how to modify search.php to do that!

The TGPX Tech Support don't answered me.

ascii 08-20-2009 07:59 PM

I don't have the script (nor have I ever seen it) but if you can show me what search.php looks like I can help.

studiosx 08-21-2009 05:02 AM

<?php
################################################## ##################
# TGPX - Copyright ? 2006 JMB Software, Inc. All Rights Reserved. #
# This file may not be redistributed in whole or significant part. #
# TGPX IS NOT FREE SOFTWARE # #
################################################## ##################


if( !defined('E_STRICT') ) define('E_STRICT', 2048);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);

require_once('includes/config.php');
require_once('includes/template.class.php');
require_once('includes/mysql.class.php');

set_magic_quotes_runtime(0);

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;

$domain = array('template_prefix' => '', 'tags' => null);




if( !$too_short && !$t->is_cached($domain['template_prefix'].'search-results.tpl', $search_id) )
{

$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();


$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'] )
{
$search_wheres[] = '`format`=?';
$search_binds[] = $_GET['f'];
}

$result = $DB->QueryWithPagination('SELECT * FROM `tx_galleries` WHERE ' . join(' AND ', $search_wheres), $search_binds, $page, $per_page);

if( $result['result'] )
{
while( $gallery = $DB->NextRow($result['result']) )
{
$fields = $DB->Row('SELECT * FROM `tx_gallery_fields` WHERE `gallery_id`=?', array($gallery['gallery_id']));

if( $fields )
{
$gallery = array_merge($gallery, $fields);
}

// Get the gallery preview thumbnail, if it has one
if( $gallery['has_preview'] )
{
$prev_wheres = array('`gallery_id`=?');
$prev_binds = array($gallery['gallery_id']);

// User has specified the thumbnail size to get
if( $_GET['pt'] && $gallery['format'] == 'pictures' )
{
$prev_wheres[] = '`dimensions`=?';
$prev_binds[] = $_GET['pt'];
}
else if( $_GET['mt'] && $gallery['format'] == 'movies' )
{
$prev_wheres[] = '`dimensions`=?';
$prev_binds[] = $_GET['mt'];
}

$preview = $DB->Row('SELECT * FROM `tx_gallery_previews` WHERE ' . join(' AND ', $prev_wheres) . ' LIMIT 1', $prev_binds);

if( $preview )
{
$gallery = array_merge($gallery, $preview);
}
}

$temp_categories = array();
foreach( explode(' ', $gallery['categories']) as $category_tag )
{
if( $categories[$category_tag] )
{
$temp_categories[] = $categories[$category_tag];
}
}

$gallery['categories'] = $temp_categories;
$gallery['category'] = $gallery['categories'][0]['name'];
$galleries[] = $gallery;
}

$DB->Free($result['result']);
unset($result['result']);
}

$t->assign_by_ref('search_categories', $categories);
$t->assign_by_ref('pagination', $result);
$t->assign_by_ref('results', $galleries);

}

if( !$too_short && $page == 1 && $C['log_searches'] )
{
if( $_COOKIE['txsearch'] != $_GET['s'] )
{
logsearch();
}

setcookie('txsearch', $_GET['s'], time()+86400, '/', $C['cookie_domain']);
}

$t->assign_by_ref('config', $C);
$t->assign('search_term', $_GET['s']);
$t->assign('search_category', $_GET['c']);
$t->assign('search_format', $_GET['f']);
$t->assign('search_too_short', $too_short);
$t->assign('page', $page);
$t->assign('per_page', $per_page);
$t->assign('picture_thumb', $_GET['pt']);
$t->assign('movie_thumb', $_GET['mt']);
$t->assign('search_formats', array(array('format' => 'pictures', 'name' => 'Pictures'), array('format' => 'movies', 'name' => 'Movies')));

$t->display($domain['template_prefix'].'search-results.tpl', $search_id);

if( isset($DB) )
{
$DB->Disconnect();
}

function logsearch()
{
global $DB, $C;

if( !isset($DB) )
{
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
}

if( preg_match_all('~[\'"]([^\'"]+)[\'"]|(\b\w+\b)~', $_GET['s'], $matches) )
{
$date = gmdate('Y-m-d H:i:s', _timewithtz());

foreach( $matches[0] as $match )
{
$match = str_replace(array('"', '\''), '', $match);
if( $DB->Update('UPDATE `tx_search_terms` SET `searches`=`searches`+1,`date_last_search`=? WHERE `term`=?', array($date, $match)) < 1 )
{
$DB->Update('INSERT INTO `tx_search_terms` VALUES (?,?,?,?)', array(null, $match, 1, $date));
}
}
}
}

function _timewithtz($timestamp = null)
{
global $C;

$timezone = $C['timezone'];

if( $timestamp == null )
{
$timestamp = time();
}

if( date('I', $timestamp) )
{
$timezone++;
}

return $timestamp + 3600 * $timezone;
}

function thilite($string)
{
$term = $_GET['s'];

if( $term )
{
if( isset($GLOBALS['re_matches']) || preg_match_all('~("[^"]+"|\b\w+\b)~', $term, $GLOBALS['re_matches']) )
{
foreach( $GLOBALS['re_matches'][0] as $match )
{
$match = preg_quote(str_replace(array('+', '-', '*', '"', '(', ')'), '', $match));
$string = preg_replace("/\b($match)\b/i", "<span class=\"hilite\">$1</span>", $string);
}
}
}

return $string;
}

function _astripslashes(&$array)
{
foreach($array as $key => $value)
{
if( is_array($array[$key]) )
{
_astripslashes($array[$key]);
}
else
{
$array[$key] = stripslashes($value);
}
}
}

?>

purecharlie 08-27-2009 08:22 PM

Quote:

Originally Posted by studiosx (Post 16215298)
The TGPX Tech Support don't answered me.

That's very strange, Jeremy is normally very good at answering support queries. He helped me out several times only recently. Give their support forum another try my friend!


All times are GMT -7. The time now is 06:51 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123