Skip to content

Commit c20b442

Browse files
committed
Restructure repository
0 parents  commit c20b442

File tree

150 files changed

+24407
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+24407
-0
lines changed

.cvsignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.~*~
2+
#*#
3+
*.project
4+
config.inc.php

.htaccess

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Options +FollowSymlinks
2+
AcceptPathInfo On
3+
RewriteEngine On
4+
RewriteBase /
5+
RewriteCond %{REQUEST_FILENAME} !-f
6+
RewriteCond %{REQUEST_FILENAME} !-d
7+
RewriteRule ^([^/]+)/?(.*) $1.php/$2 [L]

AUTHORS

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Scuttle contains code from the following applications:
2+
3+
------------
4+
GPL Licenced
5+
------------
6+
7+
phpBB2 (database abstraction layer)
8+
http://www.phpbb.com/
9+
10+
php-gettext
11+
Danilo Segan <danilo@kvota.net>
12+
http://savannah.nongnu.org/projects/php-gettext/
13+
14+
UTF8 Helper Functions
15+
Andreas Gohr <andi@splitbrain.org>
16+
17+
XSPF Web Music Player (Flash)
18+
http://musicplayer.sourceforge.net/

about.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/***************************************************************************
3+
Copyright (C) 2004, 2005 Scuttle project
4+
http://sourceforge.net/projects/scuttle/
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation; either version 2 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software
18+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+
***************************************************************************/
20+
21+
require_once('header.inc.php');
22+
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
23+
24+
$tplVars = array();
25+
$tplVars['subtitle'] = T_('About');
26+
$templateservice->loadTemplate('about.tpl', $tplVars);
27+
?>

ajaxDelete.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/***************************************************************************
3+
Copyright (C) 2005 - 2006 Scuttle project
4+
http://sourceforge.net/projects/scuttle/
5+
http://scuttle.org/
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
***************************************************************************/
21+
22+
header('Content-Type: text/xml; charset=UTF-8');
23+
header('Last-Modified: '. gmdate("D, d M Y H:i:s") .' GMT');
24+
header('Cache-Control: no-cache, must-revalidate');
25+
require_once('header.inc.php');
26+
27+
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
28+
$bookmark = intval($_GET['id']);
29+
if (!$bookmarkservice->editAllowed($bookmark)) {
30+
$result = T_('You are not allowed to delete this bookmark');
31+
} elseif ($bookmarkservice->deleteBookmark($bookmark)) {
32+
$result = 'true';
33+
} else {
34+
$result = T_('Failed to delete bookmark');
35+
}
36+
?>
37+
<response>
38+
<method>deleteConfirmed</method>
39+
<result><?php echo $result; ?></result>
40+
</response>

ajaxGetTitle.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/***************************************************************************
3+
Copyright (C) 2005 - 2006 Scuttle project
4+
http://sourceforge.net/projects/scuttle/
5+
http://scuttle.org/
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
***************************************************************************/
21+
22+
header('Content-Type: text/xml; charset=UTF-8');
23+
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
24+
header("Cache-Control: no-cache, must-revalidate");
25+
26+
require_once('header.inc.php');
27+
28+
function getTitle($url) {
29+
$fd = @fopen($url, 'r');
30+
if ($fd) {
31+
$html = fread($fd, 1750);
32+
fclose($fd);
33+
34+
// Get title from title tag
35+
preg_match_all('/<title>(.*)<\/title>/si', $html, $matches);
36+
$title = $matches[1][0];
37+
38+
// Get encoding from charset attribute
39+
preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches);
40+
$encoding = strtoupper($matches[1][0]);
41+
42+
// Convert to UTF-8 from the original encoding
43+
if (function_exists('mb_convert_encoding') {
44+
$title = @mb_convert_encoding($title, 'UTF-8', $encoding);
45+
}
46+
47+
if (utf8_strlen($title) > 0) {
48+
return $title;
49+
} else {
50+
// No title, so return filename
51+
$uriparts = explode('/', $url);
52+
$filename = end($uriparts);
53+
unset($uriparts);
54+
55+
return $filename;
56+
}
57+
} else {
58+
return false;
59+
}
60+
}
61+
echo '<?xml version="1.0" encoding="utf-8"?>';
62+
?>
63+
<response>
64+
<method>getTitle</method>
65+
<result><?php echo getTitle($_GET['url']); ?></result>
66+
</response>

ajaxIsAvailable.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/***************************************************************************
3+
Copyright (C) 2006 Scuttle project
4+
http://sourceforge.net/projects/scuttle/
5+
http://scuttle.org/
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
***************************************************************************/
21+
22+
header('Content-Type: text/xml; charset=UTF-8');
23+
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
24+
header("Cache-Control: no-cache, must-revalidate");
25+
26+
require_once('header.inc.php');
27+
$userservice = & ServiceFactory :: getServiceInstance('UserService');
28+
if ($userservice->isReserved($_GET['username'])) {
29+
$result = 'false';
30+
} else {
31+
$result = $userservice->getUserByUsername($_GET['username']) ? 'false' : 'true';
32+
}
33+
?>
34+
<response>
35+
<method>isAvailable</method>
36+
<result><?php echo $result; ?></result>
37+
</response>

alltags.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
/***************************************************************************
3+
Copyright (C) 2004 - 2006 Scuttle project
4+
http://sourceforge.net/projects/scuttle/
5+
http://scuttle.org/
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
***************************************************************************/
21+
22+
require_once('header.inc.php');
23+
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
24+
$tagservice =& ServiceFactory::getServiceInstance('TagService');
25+
$userservice =& ServiceFactory::getServiceInstance('UserService');
26+
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
27+
28+
list($url, $user) = explode('/', $_SERVER['PATH_INFO']);
29+
if (!$user) {
30+
header('Location: '. createURL('populartags'));
31+
exit;
32+
}
33+
34+
if ($usecache) {
35+
// Generate hash for caching on
36+
$hashtext = $_SERVER['REQUEST_URI'];
37+
if ($userservice->isLoggedOn()) {
38+
$hashtext .= $userservice->getCurrentUserID();
39+
}
40+
$hash = md5($hashtext);
41+
42+
// Cache for an hour
43+
$cacheservice->Start($hash, 3600);
44+
}
45+
46+
// Header variables
47+
$tplvars = array();
48+
$pagetitle = T_('All Tags');
49+
50+
if (isset($user) && $user != '') {
51+
if (is_int($user)) {
52+
$userid = intval($user);
53+
} else {
54+
if ($userinfo = $userservice->getUserByUsername($user)) {
55+
$userid =& $userinfo[$userservice->getFieldName('primary')];
56+
} else {
57+
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
58+
$templateservice->loadTemplate('error.404.tpl', $tplVars);
59+
//throw a 404 error
60+
exit();
61+
}
62+
}
63+
$pagetitle .= ': '. ucfirst($user);
64+
} else {
65+
$userid = NULL;
66+
}
67+
68+
$tags =& $tagservice->getTags($userid);
69+
$tplVars['tags'] =& $tagservice->tagCloud($tags, 5, 90, 225, getSortOrder());
70+
$tplVars['user'] = $user;
71+
72+
if (isset($userid)) {
73+
$tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
74+
} else {
75+
$tplVars['cat_url'] = createURL('tags', '%2$s');
76+
}
77+
78+
$tplVars['subtitle'] = $pagetitle;
79+
$templateservice->loadTemplate('tags.tpl', $tplVars);
80+
81+
if ($usecache) {
82+
// Cache output if existing copy has expired
83+
$cacheservice->End($hash);
84+
}
85+
?>

api/.htaccess

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
RewriteEngine On
2+
RewriteRule ^tags/get tags_get.php
3+
RewriteRule ^posts/dates posts_dates.php
4+
RewriteRule ^posts/get posts_get.php
5+
RewriteRule ^posts/recent posts_recent.php
6+
RewriteRule ^posts/all posts_all.php
7+
RewriteRule ^posts/update posts_update.php
8+
RewriteRule ^posts/add posts_add.php
9+
RewriteRule ^posts/delete posts_delete.php
10+
RewriteRule ^tags/rename tags_rename.php

api/httpauth.inc.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
// Provides HTTP Basic authentication of a user, and sets two variables, sId and username,
3+
// with the user's info.
4+
5+
function authenticate() {
6+
header('WWW-Authenticate: Basic realm="del.icio.us API"');
7+
header('HTTP/1.0 401 Unauthorized');
8+
die("Use of the API calls requires authentication.");
9+
}
10+
11+
if (!isset($_SERVER['PHP_AUTH_USER'])) {
12+
authenticate();
13+
} else {
14+
require_once('../header.inc.php');
15+
$userservice =& ServiceFactory::getServiceInstance('UserService');
16+
17+
$login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
18+
if (!$login) {
19+
authenticate();
20+
}
21+
}
22+
?>

0 commit comments

Comments
 (0)