From 05602d9aaf42e2e678182b02d091c07434ea614d Mon Sep 17 00:00:00 2001 From: mensonge Date: Sun, 1 Jun 2008 13:17:54 +0000 Subject: New feature: add Google Custom Search into gsearch folder git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@133 b3834d28-1941-0410-a4f8-b48e95affb8f --- api/export_gcs.php | 75 +++++++++++++++++++++++++++++++------------------- config.inc.php.example | 3 +- constants.inc.php | 3 +- gsearch/context.php | 20 ++++++++++++++ gsearch/index.php | 36 ++++++++++++++++++++++++ upgrade.txt | 2 ++ 6 files changed, 108 insertions(+), 31 deletions(-) create mode 100644 gsearch/context.php create mode 100644 gsearch/index.php diff --git a/api/export_gcs.php b/api/export_gcs.php index c8bf59d..48d51c1 100644 --- a/api/export_gcs.php +++ b/api/export_gcs.php @@ -1,13 +1,13 @@ isAdmin($userservice->getCurrentUserId())) { die(T_('You are not allowed to do this action (admin access)')); }*/ - - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) - $tag = trim($_REQUEST['tag']); -else - $tag = NULL; - -// Get the posts relevant to the passed-in variables. -$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder()); - -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; - -// Set up the plain file and output all the posts. -header('Content-Type: text/plain'); -foreach($bookmarks['bookmarks'] as $row) { - echo $row['bAddress']."\n"; -} - - -?> +// Check if queried format is xml +if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1)) + $xml = true; +else + $xml = false; + +// Check to see if a tag was specified. +if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) + $tag = trim($_REQUEST['tag']); +else + $tag = NULL; + +// Get the posts relevant to the passed-in variables. +$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder()); + +$currentuser = $userservice->getCurrentUser(); +$currentusername = $currentuser[$userservice->getFieldName('username')]; + +// Set up the plain file and output all the posts. +header('Content-Type: text/plain'); +if(!$xml) { + header('Content-Type: text/plain'); + foreach($bookmarks['bookmarks'] as $row) { + echo $row['bAddress']."\n"; + } +} else { + header('Content-Type: application/xml'); + echo ''."\n"; + echo ' '."\n"; + foreach($bookmarks['bookmarks'] as $row) { + if(substr($row['bAddress'], 0, 7) == "http://") { + echo ' '."\n"; + echo ' '."\n"; + } + } + echo ' '."\n"; + echo ''."\n"; +} + +?> diff --git a/config.inc.php.example b/config.inc.php.example index cf0fed0..7b9eff9 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -9,7 +9,7 @@ #### System #### $sitename = 'SemanticScuttle'; #The name of this site. $welcomeMessage = 'Welcome to SemanticScuttle! More than a social bookmarking tool.'; # The welcome message of this site -$root = NULL; # Set to NULL to autodetect the root url of the website +$root = NULL; # Set to NULL to autodetect the root url of the website. If your installation is into a subdirectory like "www.example.com/semanticscuttle/" then replace NULL by your address (between "" and with final '/'); $locale = 'en_GB'; #locale used in /locales/ {de_DE en_GB fr_FR ...} $usecache = false; # use cache ? {true,false} $dir_cache = dirname(__FILE__) .'/cache/'; # directory where cache files will be stored @@ -77,6 +77,7 @@ $maxSizeMenuBlock = 7; # maximum number of items (tags) appearing into menu box ### Other ### $sizeSearchHistory = 10; # number of users' searches that are saved {1..10[Default]..-1[Unlimited]} +$enableGoogleCustomSearch = true; #Enable Google Search Engine into "gsearch/" folder include_once('debug.inc.php'); ?> diff --git a/constants.inc.php b/constants.inc.php index 256ea2a..cadaffa 100644 --- a/constants.inc.php +++ b/constants.inc.php @@ -13,8 +13,7 @@ define('PAGE_BOOKMARKS', "bookmarks"); // Miscellanous -// INSTALLATION_ID is based on directory path and used as prefix (in session and cookie) to prevent mutual login for different installations on the same host server -//define('INSTALLATION_ID', md5(dirname(realpath('.')))); +// INSTALLATION_ID is based on directory DB and used as prefix (in session and cookie) to prevent mutual login for different installations on the same host server define('INSTALLATION_ID', md5($GLOBALS['dbname'].$GLOBALS['tableprefix'])); ?> diff --git a/gsearch/context.php b/gsearch/context.php new file mode 100644 index 0000000..a48179f --- /dev/null +++ b/gsearch/context.php @@ -0,0 +1,20 @@ + + + + + + <?php echo $GLOBALS['sitename'] ?> + + + + + + + + + + + + + diff --git a/gsearch/index.php b/gsearch/index.php new file mode 100644 index 0000000..d4f596d --- /dev/null +++ b/gsearch/index.php @@ -0,0 +1,36 @@ + + + +<?php echo $GLOBALS['sitename'] ?> + +
+
+ + +
+ + + +
+ + +Based on Google Custom Search over this list of websites from . + + + + + + +
+ + + + diff --git a/upgrade.txt b/upgrade.txt index 792c04c..163fce7 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -37,5 +37,7 @@ $sizeSearchHistory = 10; - add sidebar block index line: $index_sidebar_blocks = array('search','menu','users','popular'); + - add line: + $enableGoogleCustomSearch = true; -- cgit v1.2.3