Skip to content

Commit

Permalink
Restructure repository
Browse files Browse the repository at this point in the history
  • Loading branch information
scronide committed Dec 5, 2006
0 parents commit c20b442
Show file tree
Hide file tree
Showing 150 changed files with 24,407 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .cvsignore
@@ -0,0 +1,4 @@
*.~*~
#*#
*.project
config.inc.php
7 changes: 7 additions & 0 deletions .htaccess
@@ -0,0 +1,7 @@
Options +FollowSymlinks
AcceptPathInfo On
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?(.*) $1.php/$2 [L]
18 changes: 18 additions & 0 deletions AUTHORS
@@ -0,0 +1,18 @@
Scuttle contains code from the following applications:

------------
GPL Licenced
------------

phpBB2 (database abstraction layer)
http://www.phpbb.com/

php-gettext
Danilo Segan <danilo@kvota.net>
http://savannah.nongnu.org/projects/php-gettext/

UTF8 Helper Functions
Andreas Gohr <andi@splitbrain.org>

XSPF Web Music Player (Flash)
http://musicplayer.sourceforge.net/
27 changes: 27 additions & 0 deletions about.php
@@ -0,0 +1,27 @@
<?php
/***************************************************************************
Copyright (C) 2004, 2005 Scuttle project
http://sourceforge.net/projects/scuttle/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

require_once('header.inc.php');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');

$tplVars = array();
$tplVars['subtitle'] = T_('About');
$templateservice->loadTemplate('about.tpl', $tplVars);
?>
40 changes: 40 additions & 0 deletions ajaxDelete.php
@@ -0,0 +1,40 @@
<?php
/***************************************************************************
Copyright (C) 2005 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

header('Content-Type: text/xml; charset=UTF-8');
header('Last-Modified: '. gmdate("D, d M Y H:i:s") .' GMT');
header('Cache-Control: no-cache, must-revalidate');
require_once('header.inc.php');

$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
$bookmark = intval($_GET['id']);
if (!$bookmarkservice->editAllowed($bookmark)) {
$result = T_('You are not allowed to delete this bookmark');
} elseif ($bookmarkservice->deleteBookmark($bookmark)) {
$result = 'true';
} else {
$result = T_('Failed to delete bookmark');
}
?>
<response>
<method>deleteConfirmed</method>
<result><?php echo $result; ?></result>
</response>
66 changes: 66 additions & 0 deletions ajaxGetTitle.php
@@ -0,0 +1,66 @@
<?php
/***************************************************************************
Copyright (C) 2005 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

header('Content-Type: text/xml; charset=UTF-8');
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: no-cache, must-revalidate");

require_once('header.inc.php');

function getTitle($url) {
$fd = @fopen($url, 'r');
if ($fd) {
$html = fread($fd, 1750);
fclose($fd);

// Get title from title tag
preg_match_all('/<title>(.*)<\/title>/si', $html, $matches);
$title = $matches[1][0];

// Get encoding from charset attribute
preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches);
$encoding = strtoupper($matches[1][0]);

// Convert to UTF-8 from the original encoding
if (function_exists('mb_convert_encoding') {
$title = @mb_convert_encoding($title, 'UTF-8', $encoding);
}

if (utf8_strlen($title) > 0) {
return $title;
} else {
// No title, so return filename
$uriparts = explode('/', $url);
$filename = end($uriparts);
unset($uriparts);

return $filename;
}
} else {
return false;
}
}
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<response>
<method>getTitle</method>
<result><?php echo getTitle($_GET['url']); ?></result>
</response>
37 changes: 37 additions & 0 deletions ajaxIsAvailable.php
@@ -0,0 +1,37 @@
<?php
/***************************************************************************
Copyright (C) 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

header('Content-Type: text/xml; charset=UTF-8');
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: no-cache, must-revalidate");

require_once('header.inc.php');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
if ($userservice->isReserved($_GET['username'])) {
$result = 'false';
} else {
$result = $userservice->getUserByUsername($_GET['username']) ? 'false' : 'true';
}
?>
<response>
<method>isAvailable</method>
<result><?php echo $result; ?></result>
</response>
85 changes: 85 additions & 0 deletions alltags.php
@@ -0,0 +1,85 @@
<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

require_once('header.inc.php');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tagservice =& ServiceFactory::getServiceInstance('TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');

list($url, $user) = explode('/', $_SERVER['PATH_INFO']);
if (!$user) {
header('Location: '. createURL('populartags'));
exit;
}

if ($usecache) {
// Generate hash for caching on
$hashtext = $_SERVER['REQUEST_URI'];
if ($userservice->isLoggedOn()) {
$hashtext .= $userservice->getCurrentUserID();
}
$hash = md5($hashtext);

// Cache for an hour
$cacheservice->Start($hash, 3600);
}

// Header variables
$tplvars = array();
$pagetitle = T_('All Tags');

if (isset($user) && $user != '') {
if (is_int($user)) {
$userid = intval($user);
} else {
if ($userinfo = $userservice->getUserByUsername($user)) {
$userid =& $userinfo[$userservice->getFieldName('primary')];
} else {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
$templateservice->loadTemplate('error.404.tpl', $tplVars);
//throw a 404 error
exit();
}
}
$pagetitle .= ': '. ucfirst($user);
} else {
$userid = NULL;
}

$tags =& $tagservice->getTags($userid);
$tplVars['tags'] =& $tagservice->tagCloud($tags, 5, 90, 225, getSortOrder());
$tplVars['user'] = $user;

if (isset($userid)) {
$tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
} else {
$tplVars['cat_url'] = createURL('tags', '%2$s');
}

$tplVars['subtitle'] = $pagetitle;
$templateservice->loadTemplate('tags.tpl', $tplVars);

if ($usecache) {
// Cache output if existing copy has expired
$cacheservice->End($hash);
}
?>
10 changes: 10 additions & 0 deletions api/.htaccess
@@ -0,0 +1,10 @@
RewriteEngine On
RewriteRule ^tags/get tags_get.php
RewriteRule ^posts/dates posts_dates.php
RewriteRule ^posts/get posts_get.php
RewriteRule ^posts/recent posts_recent.php
RewriteRule ^posts/all posts_all.php
RewriteRule ^posts/update posts_update.php
RewriteRule ^posts/add posts_add.php
RewriteRule ^posts/delete posts_delete.php
RewriteRule ^tags/rename tags_rename.php
22 changes: 22 additions & 0 deletions api/httpauth.inc.php
@@ -0,0 +1,22 @@
<?php
// Provides HTTP Basic authentication of a user, and sets two variables, sId and username,
// with the user's info.

function authenticate() {
header('WWW-Authenticate: Basic realm="del.icio.us API"');
header('HTTP/1.0 401 Unauthorized');
die("Use of the API calls requires authentication.");
}

if (!isset($_SERVER['PHP_AUTH_USER'])) {
authenticate();
} else {
require_once('../header.inc.php');
$userservice =& ServiceFactory::getServiceInstance('UserService');

$login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if (!$login) {
authenticate();
}
}
?>

0 comments on commit c20b442

Please sign in to comment.