Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Misc. thingys

  • Loading branch information...
commit 6db4bac31faec5c68a58bf81d80a8b997f868e1b 1 parent dd7069f
@pudge pudge authored
View
6 plugins/Bookmark/Bookmark.pm
@@ -37,21 +37,21 @@ use vars qw($VERSION);
($VERSION) = ' $Revision$ ' =~ /\$Revision:\s+([^\s]+)/;
sub createBookmark {
- my ($self, $data) = @_;
+ my($self, $data) = @_;
$self->sqlInsert("bookmarks", $data);
my $id = $self->getLastInsertId();
return $id;
}
sub getUserBookmarkByUrlId {
- my ($self, $uid, $url_id) = @_;
+ my($self, $uid, $url_id) = @_;
my $uid_q = $self->sqlQuote($uid);
my $url_id_q = $self->sqlQuote($url_id);
return $self->sqlSelectHashref("*", "bookmarks", "uid=$uid_q AND url_id=$url_id_q");
}
sub updateBookmark {
- my ($self, $bookmark) = @_;
+ my($self, $bookmark) = @_;
$self->sqlUpdate("bookmarks", $bookmark, "bookmark_id = $bookmark->{bookmark_id}");
}
View
55 plugins/Bookmark/bookmark.pl
@@ -13,25 +13,25 @@
#################################################################
sub main {
- my $form = getCurrentForm();
- my $user = getCurrentUser();
- my $slashdb = getCurrentDB();
- my $constants = getCurrentStatic();
+ my $form = getCurrentForm();
+ my $user = getCurrentUser();
+ my $slashdb = getCurrentDB();
+ my $constants = getCurrentStatic();
my $postflag = $user->{state}{post};
my %ops = (
- bookmark => [!$user->{is_anon}, \&bookmark, 0 ],
+ bookmark => [!$user->{is_anon}, \&bookmark, 0 ],
save => [!$user->{is_anon}, \&saveBookmark, 1 ]
);
redirect("/login.pl") if $user->{is_anon};
-
+
$ops{default} = $ops{bookmark};
my $op = lc($form->{op} || 'default');
$op = 'default' if !$ops{$op} || !$ops{$op}[ALLOWED];
$op = 'default' if $ops{$op}[2] && !$postflag;
-
+
header() if $op ne "save";
$ops{$op}[FUNCTION]->($constants, $slashdb, $user, $form);
footer() if $op ne "save";
@@ -48,7 +48,7 @@ sub bookmark {
my $tags_str = $form->{tags};
if ($url_id && !$form->{op}) {
my $tags = getObject('Slash::Tags');
- my $tag_ar = my $now_tags_ar = $tags->getTagsByNameAndIdArrayref("urls", $url_id, { uid => $user->{uid} });
+ my $tag_ar = $tags->getTagsByNameAndIdArrayref("urls", $url_id, { uid => $user->{uid} });
$tags_str = join ' ', sort map { $_->{tagname}} @$tag_ar;
}
@@ -59,55 +59,53 @@ sub bookmark {
$options->{errors}{reskey} = $rkey->errstr;
}
if ($form->{state}) {
- unless($rkey->touch) {
+ unless ($rkey->touch) {
$options->{errors}{reskey} = $rkey->errstr;
}
- };
+ }
print slashDisplay("bookmark", {
- fudgedurl => $fudgedurl,
- errors => $options->{errors},
- tags_string => $tags_str
- },
- { Return => 1 });
+ fudgedurl => $fudgedurl,
+ errors => $options->{errors},
+ tags_string => $tags_str
+ }, { Return => 1 });
}
sub saveBookmark {
- my ($constants, $slashdb, $user, $form) = @_;
+ my($constants, $slashdb, $user, $form) = @_;
my $reskey = getObject('Slash::ResKey');
my $rkey = $reskey->key('bookmark');
-
+
my $fudgedurl = fudgeurl($form->{url});
my $bookmarkoptions;
- my $scheme = undef;
+ my $scheme;
if ($fudgedurl) {
my $uri = new URI $fudgedurl;
$scheme = $uri->scheme if $uri && $uri->can("scheme");
}
-
- $bookmarkoptions->{errors}{invalidurl} = 1 if (!$fudgedurl && $form->{url}) || ($form->{url} && !$scheme);
+ $bookmarkoptions->{errors}{invalidurl} = 1 if (!$fudgedurl && $form->{url}) || ($form->{url} && !$scheme);
$bookmarkoptions->{errors}{missingfields} = 1 if !$form->{url} || !$form->{title} || !$form->{tags};
- $bookmarkoptions->{errors}{noscheme} = 1 if ($form->{url} && !$scheme);
+ $bookmarkoptions->{errors}{noscheme} = 1 if ($form->{url} && !$scheme);
unless ($rkey->use) {
$bookmarkoptions->{errors}{reskey} = $rkey->errstr
}
-
+
if ($bookmarkoptions->{errors}) {
header();
bookmark($constants, $slashdb, $user, $form, $bookmarkoptions);
footer();
return;
}
-
+
my $data = {
url => $fudgedurl,
initialtitle => $form->{title}
};
-
+
my $url_id = $slashdb->getUrlCreate($data);
-
+
my $bookmark = getObject("Slash::Bookmark");
my $bookmark_data = {
url_id => $url_id,
@@ -117,7 +115,7 @@ sub saveBookmark {
my $bookmark_id;
my $user_bookmark = $bookmark->getUserBookmarkByUrlId($user->{uid}, $url_id);
- use Data::Dumper;
+
if ($user_bookmark) {
$bookmark_data->{bookmark_id} = $user_bookmark->{bookmark_id};
$bookmark->updateBookmark($bookmark_data);
@@ -125,14 +123,14 @@ sub saveBookmark {
$bookmark_data->{"-createdtime"} = 'NOW()';
$bookmark_id= $bookmark->createBookmark($bookmark_data);
}
-
+
my $tags = getObject('Slash::Tags');
$tags->setTagsForGlobj($url_id, "urls", $form->{tags});
my $strip_title = strip_attribute($form->{title});
my $strip_url = strip_attribute($form->{url});
-
+
if ($form->{redirect} eq "journal") {
redirect("/journal.pl?op=edit&description=$strip_title&article=$strip_url");
} elsif ($form->{redirect} eq "submit") {
@@ -140,7 +138,6 @@ sub saveBookmark {
} else {
redirect($form->{url});
}
-
}
createEnvironment();
View
4 plugins/Bookmark/templates/bookmarklink;misc;default
@@ -14,9 +14,9 @@ __seclev__
10000
__template__
[% IF user.state.ssl %]
- <a href="javascript:location.href='[% constants.absolutedir_secure %]/bookmark.pl?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)">[% title || "Post to $constants.sitename" %]</a>
+ <a href="javascript:location.href='[% constants.absolutedir_secure %]/bookmark.pl?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)">[% title || "Post to $constants.sitename" %]</a>
[% ELSE %]
- <a href="javascript:location.href='[% constants.absolutedir %]/bookmark.pl?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)">[% title || "Post to $constants.sitename" %]</a>
+ <a href="javascript:location.href='[% constants.absolutedir %]/bookmark.pl?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)">[% title || "Post to $constants.sitename" %]</a>
[% END %]
__version__
$Id$
View
4 plugins/FAQSlashdot/faq/index.shtml
@@ -253,8 +253,8 @@ $VERSION = sprintf "%d.%03d", q$Id$ =~ /(\d+)/g
<li><strong><a href="/faq/tags.shtml#tags100">What is this crazy tags thing?</a></strong></li>
<li><strong><a href="/faq/tags.shtml#tags110">Are tags objective or subjective? Can I use any tag I want?</a></strong></li>
<li><strong><a href="/faq/tags.shtml#tags300">What are Slashdot Bookmarks?</a></strong></li>
- <li><strong><a href="/faq/tags.shtml#tags310">How Do I save a Slashdot Bookmark?</a></strong></li>
- <li><strong><a href="/faq/tags.shtml#tags320">How Do I share my Bookmarks?</a></strong></li>
+ <li><strong><a href="/faq/tags.shtml#tags310">How do I save a Slashdot Bookmark?</a></strong></li>
+ <li><strong><a href="/faq/tags.shtml#tags320">How do I share my Bookmarks?</a></strong></li>
</ul>
<!--#include virtual="/slashfoot.inc"-->
View
2  plugins/FAQSlashdot/faq/tags.shtml
@@ -117,7 +117,7 @@ submit stories.
<br><a name="tags310" id="tags310"></a>
-<h2>How Do I Save a Slashdot Bookmark?</h2>
+<h2>How do I save a Slashdot Bookmark?</h2>
<p>You can bookmark a site by directly going to <a
href="/bookmark.pl">the bookmarks page</a>,
View
8 sql/mysql/upgrades
@@ -3741,10 +3741,6 @@ CREATE TABLE tagcommand_adminlog (
# 2006-03-14
UPDATE vars SET value = 'T_2_5_0_103' WHERE name = 'cvs_tag_currentcode';
-# SLASHCODE/USEPERL LAST UPDATED HERE
-
-# PUDGE LAST UPDATED HERE
-
# SLASHDOT LAST UPDATED HERE
DROP TABLE IF EXISTS urls;
@@ -3772,3 +3768,7 @@ INSERT IGNORE INTO reskey_resources VALUES (8, 'bookmark');
# 2006-03-21
UPDATE vars SET value = 'T_2_5_0_104' WHERE name = 'cvs_tag_currentcode';
+
+# SLASHCODE/USEPERL LAST UPDATED HERE
+
+# PUDGE LAST UPDATED HERE
View
4 themes/slashcode/templates/dispComment;misc;default
@@ -25,9 +25,7 @@ __template__
<li class="comment">
<div class="commentTop">
<div class="title">
- <h4><a name="[% cid %]"[%
- IF user.discussion2 && (user.discussion2 == "slashdot" || user.discussion2 == "uofm")
- %] onclick="flipLink([% cid %], 'full')"[% END %]>[% subject %]</a></h4>
+ <h4><a name="[% cid %]">[% subject %]</a></h4>
[% UNLESS user.noscores %] (Score:[% IF points.length; points; ELSE; "?"; END %][% IF reason %], [% reasons.$reason.name %][% END %])[% END %]
</div>
<div class="details">
View
2  themes/slashcode/templates/printCommComments;misc;default
@@ -36,7 +36,7 @@ __template__
[% IF user.discussion2 == "slashdot" %]
<script src="[% constants.imagedir %]/comments2.js" type="text/javascript"></script>
[% ELSIF user.discussion2 == "uofm" %]
- <script src="[% constants.imagedir %]/comments.js" type="text/javascript"></script>
+ <script src="http://www-personal.umich.edu/~oostendo/comments.js" type="text/javascript"></script>
[% END %]
<script src="[% constants.rootdir %]/comments.pl?sid=[% sid %]&op=dynamic_display" type="text/javascript"></script>
<div><ul id="commentlisting"></ul></div>
Please sign in to comment.
Something went wrong with that request. Please try again.