Merge branch 'master' into privatekey2
This commit is contained in:
commit
b105867e75
13 changed files with 139 additions and 66 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,4 +3,6 @@ dist/
|
||||||
build.properties
|
build.properties
|
||||||
package.xml
|
package.xml
|
||||||
semanticscuttle-dump.sql
|
semanticscuttle-dump.sql
|
||||||
data/config.unittest.php
|
data/config.php
|
||||||
|
data/config.testing.php
|
||||||
|
data/config.testing-tmp.php
|
||||||
|
|
1
data/.gitignore
vendored
1
data/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
config.php
|
|
|
@ -14,6 +14,7 @@ ChangeLog for SemantiScuttle
|
||||||
- Update php-gettext library to 1.0.10
|
- Update php-gettext library to 1.0.10
|
||||||
- api/posts/add respects the "replace" parameter now
|
- api/posts/add respects the "replace" parameter now
|
||||||
- Fix privacy issue when fetching tags of several users
|
- Fix privacy issue when fetching tags of several users
|
||||||
|
- Fix Google custom search XML
|
||||||
- Only URLs with an allowed protocol may be added to the database
|
- Only URLs with an allowed protocol may be added to the database
|
||||||
- Support HTTPS connections when $root is not configured
|
- Support HTTPS connections when $root is not configured
|
||||||
- SQL schema version table to ease future database upgrades
|
- SQL schema version table to ease future database upgrades
|
||||||
|
|
|
@ -96,6 +96,13 @@ Apache configuration
|
||||||
To make use of SSL client certificates, you need to deliver SemanticScuttle
|
To make use of SSL client certificates, you need to deliver SemanticScuttle
|
||||||
via HTTPS.
|
via HTTPS.
|
||||||
|
|
||||||
|
Note that you can equip several virtual hosts with SSL certificates
|
||||||
|
and keep them on the same, standard SSL port by using SNI -
|
||||||
|
`Server Name Indication`__.
|
||||||
|
|
||||||
|
.. _SNI: http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI
|
||||||
|
__ SNI_
|
||||||
|
|
||||||
A basic virtual host configuration with SSL looks like this:
|
A basic virtual host configuration with SSL looks like this:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
|
@ -130,7 +130,7 @@ class SemanticScuttle_Service_AuthUser extends SemanticScuttle_Service_User
|
||||||
//FIXME: caching?
|
//FIXME: caching?
|
||||||
$name = $this->auth->getUsername();
|
$name = $this->auth->getUsername();
|
||||||
if (!$name) {
|
if (!$name) {
|
||||||
return false;
|
return parent::getCurrentUserId();
|
||||||
}
|
}
|
||||||
return $this->getIdFromUser($name);
|
return $this->getIdFromUser($name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,8 +455,8 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||||
if ($ssls->hasValidCert()) {
|
if ($ssls->hasValidCert()) {
|
||||||
$id = $ssls->getUserIdFromCert();
|
$id = $ssls->getUserIdFromCert();
|
||||||
if ($id !== false) {
|
if ($id !== false) {
|
||||||
$this->setCurrentUserId($id);
|
$this->setCurrentUserId($id, true);
|
||||||
return (int)$_SESSION[$this->getSessionKey()];
|
return $this->currentuserId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
* @link http://sourceforge.net/projects/semanticscuttle
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
*/
|
*/
|
||||||
$_SERVER['HTTP_HOST'] = 'http://localhost/';
|
$_SERVER['HTTP_HOST'] = 'http://localhost/';
|
||||||
define('UNIT_TEST_MODE', true);
|
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/header.php';
|
require_once dirname(__FILE__) . '/header.php';
|
||||||
?>
|
?>
|
|
@ -46,14 +46,21 @@ if (isset($_GET['unittestMode']) && $_GET['unittestMode'] == 1
|
||||||
die("Unittestmode is not allowed\n");
|
die("Unittestmode is not allowed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$unittestConfigFile = $datadir . '/config.unittest.php';
|
|
||||||
if (file_exists($unittestConfigFile)) {
|
|
||||||
require_once $unittestConfigFile;
|
|
||||||
}
|
|
||||||
define('HTTP_UNIT_TEST_MODE', true);
|
define('HTTP_UNIT_TEST_MODE', true);
|
||||||
define('UNIT_TEST_MODE', true);
|
define('UNIT_TEST_MODE', true);
|
||||||
}
|
}
|
||||||
if (defined('UNIT_TEST_MODE')) {
|
if (defined('UNIT_TEST_MODE')) {
|
||||||
|
//load configuration for unit tests
|
||||||
|
$testingConfigFile = $datadir . '/config.testing.php';
|
||||||
|
if (file_exists($testingConfigFile)) {
|
||||||
|
require_once $testingConfigFile;
|
||||||
|
}
|
||||||
|
//test-specific configuration file
|
||||||
|
$unittestConfigFile = $datadir . '/config.testing-tmp.php';
|
||||||
|
if (file_exists($unittestConfigFile)) {
|
||||||
|
require_once $unittestConfigFile;
|
||||||
|
}
|
||||||
|
|
||||||
//make local config vars global - needed for unit tests
|
//make local config vars global - needed for unit tests
|
||||||
//run with phpunit
|
//run with phpunit
|
||||||
foreach (get_defined_vars() as $var => $value) {
|
foreach (get_defined_vars() as $var => $value) {
|
||||||
|
@ -107,7 +114,7 @@ T_bind_textdomain_codeset($domain, 'UTF-8');
|
||||||
T_textdomain($domain);
|
T_textdomain($domain);
|
||||||
|
|
||||||
// 4 // Session
|
// 4 // Session
|
||||||
if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) {
|
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||||
session_start();
|
session_start();
|
||||||
if ($GLOBALS['enableVoting']) {
|
if ($GLOBALS['enableVoting']) {
|
||||||
if (isset($_SESSION['lastUrl'])) {
|
if (isset($_SESSION['lastUrl'])) {
|
||||||
|
|
|
@ -50,8 +50,9 @@ class TestBaseApi extends TestBase
|
||||||
$this->url = $GLOBALS['unittestUrl'] . $this->urlPart;
|
$this->url = $GLOBALS['unittestUrl'] . $this->urlPart;
|
||||||
|
|
||||||
//clean up before test
|
//clean up before test
|
||||||
if (file_exists($GLOBALS['datadir'] . '/config.unittest.php')) {
|
$configFile = $GLOBALS['datadir'] . '/config.testing-tmp.php';
|
||||||
unlink($GLOBALS['datadir'] . '/config.unittest.php');
|
if (file_exists($configFile)) {
|
||||||
|
unlink($configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->us = SemanticScuttle_Service_Factory::get('User');
|
$this->us = SemanticScuttle_Service_Factory::get('User');
|
||||||
|
@ -71,19 +72,36 @@ class TestBaseApi extends TestBase
|
||||||
* @param string $urlSuffix Suffix for the URL
|
* @param string $urlSuffix Suffix for the URL
|
||||||
*
|
*
|
||||||
* @return HTTP_Request2 HTTP request object
|
* @return HTTP_Request2 HTTP request object
|
||||||
*
|
|
||||||
* @uses $url
|
|
||||||
*/
|
*/
|
||||||
protected function getRequest($urlSuffix = null)
|
protected function getRequest($urlSuffix = null)
|
||||||
{
|
{
|
||||||
$req = new HTTP_Request2(
|
$url = $this->getTestUrl($urlSuffix);
|
||||||
$this->url . $urlSuffix,
|
$req = new HTTP_Request2($url, HTTP_Request2::METHOD_GET);
|
||||||
HTTP_Request2::METHOD_GET
|
|
||||||
);
|
|
||||||
|
|
||||||
return $req;
|
return $req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an URL from $this->url plus $urlSuffix and an appended
|
||||||
|
* unittestMode=1 parameter.
|
||||||
|
*
|
||||||
|
* @param string $urlSuffix Suffix for the URL
|
||||||
|
*
|
||||||
|
* @return string URL
|
||||||
|
*
|
||||||
|
* @uses $url
|
||||||
|
*/
|
||||||
|
protected function getTestUrl($urlSuffix = null)
|
||||||
|
{
|
||||||
|
$url = $this->url . $urlSuffix;
|
||||||
|
if (strpos($urlSuffix, '?') !== false) {
|
||||||
|
$url .= '&unittestMode=1';
|
||||||
|
} else {
|
||||||
|
$url .= '?unittestMode=1';
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completes an URL that's missing the protocol.
|
* Completes an URL that's missing the protocol.
|
||||||
|
@ -165,7 +183,7 @@ class TestBaseApi extends TestBase
|
||||||
$uid = $this->addUser($username, $password);
|
$uid = $this->addUser($username, $password);
|
||||||
|
|
||||||
$req = new HTTP_Request2(
|
$req = new HTTP_Request2(
|
||||||
$GLOBALS['unittestUrl'] . '/login.php',
|
$GLOBALS['unittestUrl'] . '/login.php?unittestMode=1',
|
||||||
HTTP_Request2::METHOD_POST
|
HTTP_Request2::METHOD_POST
|
||||||
);
|
);
|
||||||
$cookies = $req->setCookieJar()->getCookieJar();
|
$cookies = $req->setCookieJar()->getCookieJar();
|
||||||
|
@ -230,7 +248,7 @@ class TestBaseApi extends TestBase
|
||||||
|
|
||||||
$this->assertInternalType(
|
$this->assertInternalType(
|
||||||
'integer',
|
'integer',
|
||||||
file_put_contents($GLOBALS['datadir'] . '/config.unittest.php', $str),
|
file_put_contents($GLOBALS['datadir'] . '/config.testing-tmp.php', $str),
|
||||||
'Writing config.unittest.php failed'
|
'Writing config.unittest.php failed'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ $_SERVER['HTTP_HOST'] = 'http://localhost/';
|
||||||
define('UNIT_TEST_MODE', true);
|
define('UNIT_TEST_MODE', true);
|
||||||
|
|
||||||
if ('@data_dir@' == '@' . 'data_dir@') {
|
if ('@data_dir@' == '@' . 'data_dir@') {
|
||||||
//non pear-install
|
//non pear-installation (i.e. git checkout)
|
||||||
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
|
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
|
||||||
} else {
|
} else {
|
||||||
//pear installation; files are in include path
|
//pear installation; files are in include path
|
||||||
|
@ -35,7 +35,7 @@ if ($GLOBALS['debugMode'] == true
|
||||||
&& $GLOBALS['dbtype'] == 'mysql4'
|
&& $GLOBALS['dbtype'] == 'mysql4'
|
||||||
) {
|
) {
|
||||||
echo "\n"
|
echo "\n"
|
||||||
. '!!! The combination of debugMode and dbtype==mysql4'
|
. '!! The combination of debugMode and dbtype==mysql4'
|
||||||
. ' will wreck some tests' . "\n\n";
|
. ' will wreck some tests' . "\n\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -41,7 +41,7 @@ class www_SearchTest extends TestBaseApi
|
||||||
'No bookmark found', false
|
'No bookmark found', false
|
||||||
);
|
);
|
||||||
|
|
||||||
$res = $this->getRequest('/all/baz bat')->send();
|
$res = $this->getRequest('/all/baz%20bat')->send();
|
||||||
$this->assertSelectCount(
|
$this->assertSelectCount(
|
||||||
'.xfolkentry', false, $res->getBody(),
|
'.xfolkentry', false, $res->getBody(),
|
||||||
'Bookmarks found', false
|
'Bookmarks found', false
|
||||||
|
|
|
@ -1,16 +1,35 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Google custom search context information for SemanticScuttle.
|
||||||
|
* Tells Google meta data about the search.
|
||||||
|
*
|
||||||
|
* SemanticScuttle - your social bookmark manager.
|
||||||
|
*
|
||||||
|
* PHP version 5.
|
||||||
|
*
|
||||||
|
* @category Bookmarking
|
||||||
|
* @package SemanticScuttle
|
||||||
|
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
|
||||||
|
* @author Christian Weiske <cweiske@cweiske.de>
|
||||||
|
* @author Eric Dane <ericdane@users.sourceforge.net>
|
||||||
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||||
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
|
* @link http://www.google.com/cse/docs/cref.html
|
||||||
|
*/
|
||||||
require_once '../www-header.php';
|
require_once '../www-header.php';
|
||||||
|
|
||||||
if ($GLOBALS['enableGoogleCustomSearch'] == false) {
|
if ($GLOBALS['enableGoogleCustomSearch'] == false) {
|
||||||
echo "Google Custom Search disabled. You can enable it into the config.php file.";
|
header('HTTP/1.0 403 Forbidden');
|
||||||
die;
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
|
echo "Google Custom Search disabled."
|
||||||
|
. " You can enable it into the config.php file.\n";
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!--?xml version="1.0" encoding="UTF-8" ?-->
|
|
||||||
<GoogleCustomizations>
|
<GoogleCustomizations>
|
||||||
<CustomSearchEngine>
|
<CustomSearchEngine>
|
||||||
<Title><?php echo $GLOBALS['sitename'] ?></Title>
|
<Title><?php echo htmlspecialchars($GLOBALS['sitename']) ?></Title>
|
||||||
<Description><?php echo filter($GLOBALS['welcomeMessage']) ?></Description>
|
<Description><?php echo filter($GLOBALS['welcomeMessage']) ?></Description>
|
||||||
<Context>
|
<Context>
|
||||||
<BackgroundLabels>
|
<BackgroundLabels>
|
||||||
|
@ -20,8 +39,5 @@ if($GLOBALS['enableGoogleCustomSearch'] == false) {
|
||||||
<LookAndFeel nonprofit="false">
|
<LookAndFeel nonprofit="false">
|
||||||
</LookAndFeel>
|
</LookAndFeel>
|
||||||
</CustomSearchEngine>
|
</CustomSearchEngine>
|
||||||
|
|
||||||
<Include type="Annotations" href="<?php echo ROOT;?>api/export_gcs.php?xml=1" />
|
<Include type="Annotations" href="<?php echo ROOT;?>api/export_gcs.php?xml=1" />
|
||||||
|
|
||||||
|
|
||||||
</GoogleCustomizations>
|
</GoogleCustomizations>
|
||||||
|
|
|
@ -1,17 +1,41 @@
|
||||||
<?php require_once '../www-header.php';
|
<?php
|
||||||
|
/**
|
||||||
|
* Google custom search for SemanticScuttle.
|
||||||
|
* This is a "linked CSE", a linked custom search engine.
|
||||||
|
* See the linked docs for more info.
|
||||||
|
*
|
||||||
|
* SemanticScuttle - your social bookmark manager.
|
||||||
|
*
|
||||||
|
* PHP version 5.
|
||||||
|
*
|
||||||
|
* @category Bookmarking
|
||||||
|
* @package SemanticScuttle
|
||||||
|
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
|
||||||
|
* @author Christian Weiske <cweiske@cweiske.de>
|
||||||
|
* @author Eric Dane <ericdane@users.sourceforge.net>
|
||||||
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||||
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
|
* @link http://www.google.com/cse/docs/cref.html
|
||||||
|
*/
|
||||||
|
require_once '../www-header.php';
|
||||||
|
|
||||||
if ($GLOBALS['enableGoogleCustomSearch'] == false) {
|
if ($GLOBALS['enableGoogleCustomSearch'] == false) {
|
||||||
echo "Google Custom Search disabled. You can enable it into the config.php file.";
|
header('HTTP/1.0 403 Forbidden');
|
||||||
die;
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
|
echo "Google Custom Search disabled."
|
||||||
|
. " You can enable it into the config.php file.\n";
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
<title><?php echo $GLOBALS['sitename'] ?></title>
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<title><?php echo htmlspecialchars($GLOBALS['sitename']); ?></title>
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<center>
|
<div style="text-align: center; padding-top: 2em">
|
||||||
<br />
|
|
||||||
|
|
||||||
<!-- Google CSE Search Box Begins -->
|
<!-- Google CSE Search Box Begins -->
|
||||||
<form id="cref" action="http://www.google.com/cse">
|
<form id="cref" action="http://www.google.com/cse">
|
||||||
|
@ -40,7 +64,7 @@ if($GLOBALS['enableGoogleCustomSearch']==false) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</center>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue