diff options
-rw-r--r--[-rwxr-xr-x] | actions/recoverpassword.php | 0 | ||||
-rw-r--r-- | classes/File.php | 4 | ||||
-rw-r--r-- | classes/Notice.php | 14 | ||||
-rw-r--r-- | classes/Profile.php | 2 | ||||
-rw-r--r-- | db/laconica_pg.sql | 47 | ||||
-rw-r--r-- | index.php | 3 | ||||
-rw-r--r-- | lib/common.php | 2 | ||||
-rw-r--r-- | lib/dbqueuemanager.php | 4 | ||||
-rw-r--r-- | lib/router.php | 2 | ||||
-rw-r--r-- | lib/rssaction.php | 37 | ||||
-rw-r--r-- | lib/util.php | 2 | ||||
-rwxr-xr-x | scripts/getvaliddaemons.php | 3 | ||||
-rw-r--r-- | theme/cloudy/css/display.css | 222 | ||||
-rw-r--r-- | theme/cloudy/css/ie.css | 20 |
14 files changed, 294 insertions, 68 deletions
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index 721edea7f..721edea7f 100755..100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php diff --git a/classes/File.php b/classes/File.php index 68d385d1e..0c4fbf7e6 100644 --- a/classes/File.php +++ b/classes/File.php @@ -122,6 +122,7 @@ class File extends Memcached_DataObject } function isRespectsQuota($user,$fileSize) { + if ($fileSize > common_config('attachments', 'file_quota')) { return sprintf(_('No file may be larger than %d bytes ' . 'and the file you sent was %d bytes. Try to upload a smaller version.'), @@ -135,8 +136,7 @@ class File extends Memcached_DataObject if ($total > common_config('attachments', 'user_quota')) { return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } - - $query .= ' month(modified) = month(now()) and year(modified) = year(now())'; + $query .= ' AND EXTRACT(month FROM file.modified) = EXTRACT(month FROM now()) and EXTRACT(year FROM file.modified) = EXTRACT(year FROM now())'; $this->query($query); $this->fetch(); $total = $this->total + $fileSize; diff --git a/classes/Notice.php b/classes/Notice.php index 101fadb67..7f002d838 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -97,13 +97,21 @@ class Notice extends Memcached_DataObject function saveTags() { /* extract all #hastags */ - $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match); + $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match); if (!$count) { return true; } + + //turn each into their canonical tag + //this is needed to remove dupes before saving e.g. #hash.tag = #hashtag + $hashtags = array(); + for($i=0; $i<count($match[1]); $i++) { + $hashtags[] = common_canonical_tag($match[1][$i]); + } + /* Add them to the database */ - foreach(array_unique($match[1]) as $hashtag) { + foreach(array_unique($hashtags) as $hashtag) { /* elide characters we don't want in the tag */ $this->saveTag($hashtag); } @@ -112,8 +120,6 @@ class Notice extends Memcached_DataObject function saveTag($hashtag) { - $hashtag = common_canonical_tag($hashtag); - $tag = new Notice_tag(); $tag->notice_id = $this->id; $tag->tag = $hashtag; diff --git a/classes/Profile.php b/classes/Profile.php index 372005cdd..f926b2cef 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -199,7 +199,7 @@ class Profile extends Memcached_DataObject $query .= ' order by id DESC'; if (!is_null($offset)) { - $query .= " limit $offset, $limit"; + $query .= " LIMIT $limit OFFSET $offset"; } $notice->query($query); diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index f5d35f985..31210fd1e 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -1,4 +1,3 @@ -
/* local and remote users have profiles */
create sequence profile_seq;
@@ -41,6 +40,19 @@ create table sms_carrier ( modified timestamp /* comment 'date this record was modified ' */
);
+create sequence design_seq;
+create table design (
+ id bigint default nextval('design_seq') /* comment 'design ID'*/,
+ backgroundcolor integer /* comment 'main background color'*/ ,
+ contentcolor integer /*comment 'content area background color'*/ ,
+ sidebarcolor integer /*comment 'sidebar background color'*/ ,
+ textcolor integer /*comment 'text color'*/ ,
+ linkcolor integer /*comment 'link color'*/,
+ backgroundimage varchar(255) /*comment 'background image, if any'*/,
+ disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/,
+ primary key (id)
+);
+
/* local users */
create table "user" (
@@ -72,6 +84,8 @@ create table "user" ( autosubscribe integer default 0 /* comment 'automatically subscribe to users who subscribe to us' */,
urlshorteningservice varchar(50) default 'ur1.ca' /* comment 'service to use for auto-shortening URLs' */,
inboxed integer default 0 /* comment 'has an inbox been created for this user?' */,
+ design_id integer /* comment 'id of a design' */references design(id),
+ viewdesigns integer default 1 /* comment 'whether to view user-provided designs'*/,
created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
modified timestamp /* comment 'date this record was modified' */
@@ -376,20 +390,6 @@ create table profile_block ( );
-create sequence design_seq;
-create table design (
- id bigint default nextval('design_seq') /* comment 'design ID'*/,
- backgroundcolor integer /* comment 'main background color'*/ ,
- contentcolor integer /*comment 'content area background color'*/ ,
- sidebarcolor integer /*comment 'sidebar background color'*/ ,
- textcolor integer /*comment 'text color'*/ ,
- linkcolor integer /*comment 'link color'*/,
- backgroundimage varchar(255) /*comment 'background image, if any'*/,
- disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/,
- primary key (id)
-);
-
-
create sequence user_group_seq;
create table user_group (
@@ -441,7 +441,6 @@ create table group_inbox ( group_id integer not null /* comment 'group receiving the message' references user_group (id) */,
notice_id integer not null /* comment 'notice received' references notice (id) */,
created timestamp not null default CURRENT_TIMESTAMP /* comment 'date the notice was created' */,
-
primary key (group_id, notice_id)
);
create index group_inbox_created_idx on group_inbox using btree(created);
@@ -456,13 +455,14 @@ create table file ( size integer,
title varchar(255),
date integer,
- protected integer
+ protected integer,
+ filename text /* comment 'if a local file, name of the file' */,
+ modified timestamp default CURRENT_TIMESTAMP /* comment 'date this record was modified'*/
);
create sequence file_oembed_seq;
create table file_oembed (
- id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */,
- file_id bigint unique,
+ file_id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */,
version varchar(20),
type varchar(20),
provider varchar(50),
@@ -478,8 +478,7 @@ create table file_oembed ( create sequence file_redirection_seq;
create table file_redirection (
- id bigint default nextval('file_redirection_seq') primary key /* comment 'unique identifier' */,
- url varchar(255) unique,
+ url varchar(255) primary key,
file_id bigint,
redirections integer,
httpcode integer
@@ -487,8 +486,7 @@ create table file_redirection ( create sequence file_thumbnail_seq;
create table file_thumbnail (
- id bigint default nextval('file_thumbnail_seq') primary key /* comment 'unique identifier' */,
- file_id bigint unique,
+ file_id bigint primary key,
url varchar(255) unique,
width integer,
height integer
@@ -496,11 +494,10 @@ create table file_thumbnail ( create sequence file_to_post_seq;
create table file_to_post (
- id bigint default nextval('file_to_post_seq') primary key /* comment 'unique identifier' */,
file_id bigint,
post_id bigint,
- unique(file_id, post_id)
+ primary key (file_id, post_id)
);
create table group_block (
@@ -165,7 +165,8 @@ function main() if (!$user && common_config('site', 'private') && !in_array($action, array('login', 'openidlogin', 'finishopenidlogin', - 'recoverpassword', 'api', 'doc', 'register'))) { + 'recoverpassword', 'api', 'doc', 'register')) && + !preg_match('/rss$/', $action)) { common_redirect(common_local_url('login')); return; } diff --git a/lib/common.php b/lib/common.php index 9d7954fa9..764c5a077 100644 --- a/lib/common.php +++ b/lib/common.php @@ -19,7 +19,7 @@ if (!defined('LACONICA')) { exit(1); } -define('LACONICA_VERSION', '0.8.1dev'); +define('LACONICA_VERSION', '0.9.0dev'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index a37a8ffdf..1df5af6c1 100644 --- a/lib/dbqueuemanager.php +++ b/lib/dbqueuemanager.php @@ -88,7 +88,9 @@ class DBQueueManager extends QueueManager do { $qi = Queue_item::top($queue); - if (!empty($qi)) { + if (empty($qi)) { + sleep(1); + } else { $notice = Notice::staticGet('id', $qi->notice_id); if (!empty($notice)) { $result = $notice; diff --git a/lib/router.php b/lib/router.php index 5e0fcfc94..8e4836497 100644 --- a/lib/router.php +++ b/lib/router.php @@ -211,7 +211,7 @@ class Router array('tag' => '[a-zA-Z0-9]+')); $m->connect('tag/:tag', array('action' => 'tag'), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect('peopletag/:tag', array('action' => 'peopletag'), diff --git a/lib/rssaction.php b/lib/rssaction.php index 23653e406..0aca96566 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -97,11 +97,48 @@ class Rss10Action extends Action { // Parent handling, including cache check parent::handle($args); + + if (common_config('site', 'private')) { + if (!isset($_SERVER['PHP_AUTH_USER'])) { + + # This header makes basic auth go + header('WWW-Authenticate: Basic realm="Laconica RSS"'); + + # If the user hits cancel -- bam! + $this->show_basic_auth_error(); + return; + } else { + $nickname = $_SERVER['PHP_AUTH_USER']; + $password = $_SERVER['PHP_AUTH_PW']; + + if (!common_check_user($nickname, $password)) { + # basic authentication failed + list($proxy, $ip) = common_client_ip(); + + common_log(LOG_WARNING, "Failed RSS auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip."); + $this->show_basic_auth_error(); + return; + } + } + } + // Get the list of notices $this->notices = $this->getNotices($this->limit); $this->showRss(); } + function show_basic_auth_error() + { + header('HTTP/1.1 401 Unauthorized'); + header('Content-Type: application/xml; charset=utf-8'); + $this->startXML(); + $this->elementStart('hash'); + $this->element('error', null, 'Could not authenticate you.'); + $this->element('request', null, $_SERVER['REQUEST_URI']); + $this->elementEnd('hash'); + $this->endXML(); + } + /** * Get the notices to output in this stream * diff --git a/lib/util.php b/lib/util.php index f23f10e2c..c7c82dba2 100644 --- a/lib/util.php +++ b/lib/util.php @@ -404,7 +404,7 @@ function common_render_text($text) $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r); $r = common_replace_urls_callback($r, 'common_linkify'); - $r = preg_replace('/(^|\(|\[|\s+)#([A-Za-z0-9_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r); + $r = preg_replace('/(^|\(|\[|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r); // XXX: machine tags return $r; } diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php index 97c230784..1e4546dff 100755 --- a/scripts/getvaliddaemons.php +++ b/scripts/getvaliddaemons.php @@ -28,7 +28,8 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $helptext = <<<ENDOFHELP -getvaliddaemons.php - print out the currently configured PID directory +getvaliddaemons.php - print out a list of valid daemons that should be started +by the startdaemons script ENDOFHELP; diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css index 12f186a56..82a1a1e4e 100644 --- a/theme/cloudy/css/display.css +++ b/theme/cloudy/css/display.css @@ -12,12 +12,12 @@ img { display:block; border:0; } a abbr { cursor: pointer; border-bottom:0; } table { border-collapse:collapse; } ol { list-style-position:inside; } -html { font-size: 100%; background-color:#fff; } +html { font-size: 87.5%; } body { background-color:#fff; color:#000; font-family:sans-serif; -font-size:0.75em; +font-size:1em; line-height:normal; position:relative; height:100%; @@ -471,6 +471,24 @@ margin-bottom:7px; #form_notice #notice_submit label { display:none; } +#form_notice label[for=notice_data-attach], +#form_notice #notice_data-attach { +position:absolute; +top:87px; +cursor:pointer; +} +#form_notice label[for=notice_data-attach] { +text-indent:-9999px; +left:82%; +width:16px; +height:16px; +} +#form_notice #notice_data-attach { +left:34.6%; +padding:0; +height:16px; +} + #form_notice .form_note { position:absolute; top:-10px; @@ -488,6 +506,7 @@ font-weight:bold; line-height:1.15; padding:1px 2px; } + #form_notice #notice_action-submit { width:14%; height:35px; @@ -505,6 +524,26 @@ margin-bottom:7px; margin-left:18px; float:left; } +#form_notice .error, +#form_notice .success { +float:left; +clear:both; +width:81.5%; +margin-bottom:0; +line-height:1.618; +} +#form_notice #notice_data-attach_selected code { +float:left; +width:90%; +display:block; +font-size:1.1em; +line-height:1.8; +overflow:auto; +} +#form_notice #notice_data-attach_selected button { +float:right; +font-size:0.8em; +} /* entity_profile */ @@ -746,17 +785,18 @@ float:left; width:100%; border-top-width:1px; border-top-style:dotted; -font-size:1.2em; } .notices li { list-style-type:none; line-height:1.1; -width:94%; -padding-right:5%; -padding-left:1%; min-height:47px; } - +.notices .notices { +margin-top:7px; +margin-left:2%; +width:98%; +float:left; +} /* NOTICES */ #notices_primary { @@ -805,13 +845,17 @@ text-decoration:underline; .notice .entry-title { float:none; -display:inline; -width:100%; overflow:hidden; +display:inline; } #shownotice .notice .entry-title { font-size:2.2em; } +#conversation .notice .entry-title { +display:block; +width:90%; +} + .notice p.entry-content { display:inline; @@ -887,13 +931,12 @@ outline:none; .notice-options { padding-left:2%; float:left; -width:50%; font-size:0.95em; -width:12.5%; +width:16px; float:right; display:none; } -.notices li.hover div.notice-options { +.notices li:hover div.notice-options { display:block; } @@ -917,7 +960,7 @@ top:30px; right:7px; } .notice-options .notice_delete { -bottom:7px; +top:47px; right:7px; } .notice-options .notice_reply dt { @@ -958,6 +1001,97 @@ border:0; padding:0; } +.notice .attachment { +position:relative; +padding-left:16px; +} +#attachments .attachment { +padding-left:0; +} +.notice .attachment img { +position:absolute; +top:18px; +left:0; +z-index:99; +} +#shownotice .notice .attachment img { +position:static; +} + +#attachments { +clear:both; +float:left; +width:100%; +margin-top:18px; +} +#attachments dt { +font-weight:bold; +font-size:1.3em; +margin-bottom:4px; +} + +#attachments ol li { +margin-bottom:18px; +list-style-type:decimal; +float:left; +clear:both; +} + +#jOverlayContent, +#jOverlayContent #content, +#jOverlayContent #content_inner { +width: auto !important; +margin-bottom:0; +} +#jOverlayContent #content { +padding:11px; +min-height:auto; +} +#jOverlayContent .external span { +display:block; +margin-bottom:11px; +} +#jOverlayContent button { +position:absolute; +top:0; +right:0; +width:29px; +height:29px; +text-align:center; +font-weight:bold; +padding:0; +} +#jOverlayContent h1 { +max-width:425px; +} +#jOverlayContent #content { +border-radius:7px; +-moz-border-radius:7px; +-webkit-border-radius:7px; +} +#jOverlayLoading { +top:5%; +left:40%; +} +#attachment_view img { +max-width:480px; +max-height:480px; +} +#attachment_view #oembed_info { +margin-top:11px; +} +#attachment_view #oembed_info dt, +#attachment_view #oembed_info dd { +float:left; +} +#attachment_view #oembed_info dt { +clear:left; +margin-right:11px; +font-weight:bold; +} +#attachment_view #oembed_info dt:after { +content: ":"; +} #usergroups #new_group { float: left; @@ -1218,7 +1352,8 @@ clear:both; #outbox.user_in #content, #subscriptions.user_in #content, #subscribers.user_in #content, -#showgroup.user_in #content { +#showgroup.user_in #content, +#conversation.user_in #content { padding-top:160px; } @@ -1243,6 +1378,14 @@ padding-top:160px; display:none; } +#jOverlayContent #core #content { +padding-top:11px; +} +#jOverlayContent #core { +background:none; +padding-top:0; +} + html, body, @@ -1311,24 +1454,23 @@ border-top-color:#87B4C8; } -#content .notice p.entry-content a:visited { -background-color:#fcfcfc; -} -#content .notice p.entry-content .vcard a { -background-color:#fcfffc; -} - #aside_primary { background-color:#DDFFCC; } - #notice_text-count { -color:#333; +color:#000000; } #form_notice.warning #notice_text-count { -color:#000; +color:#000000; } +#form_notice label[for=notice_data-attach] { +background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%; +} +#form_notice #notice_data-attach { +opacity:0; +} + #form_notice.processing #notice_action-submit { background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%; cursor:wait; @@ -1426,8 +1568,11 @@ background-image:url(../images/icons/twotone/green/shield.gif); /* NOTICES */ -.notices li.over { -background-color:#fcfcfc; +.notice .attachment { +background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no-repeat 0 45%; +} +#attachments .attachment { +background:none; } .notice-options .notice_reply a, @@ -1451,10 +1596,24 @@ background:transparent url(../images/icons/icon_trash.gif) no-repeat 0 45%; .notices div.notice-options { opacity:0.4; } -.notices li.hover div.entry-content, -.notices li.hover div.notice-options { +.notices li:hover div.entry-content, +.notices li:hover div.notice-options { opacity:1; } +.notices .notices { +background-color:rgba(200, 200, 200, 0.01); +} +.notices .notices .notices { +background-color:rgba(200, 200, 200, 0.02); +} +.notices .notices .notices .notices { +background-color:rgba(200, 200, 200, 0.03); +} +.notices .notices .notices .notices .notices { +background-color:rgba(200, 200, 200, 0.04); +} + + div.entry-content { color:#333; } @@ -1462,8 +1621,11 @@ div.notice-options a, div.notice-options input { font-family:sans-serif; } -.notices li.hover { -background-color:#fcfcfc; +#content .notices li:hover { +background-color:rgba(240, 240, 240, 0.2); +} +#conversation .notices li:hover { +background-color:transparent; } /*END: NOTICES */ diff --git a/theme/cloudy/css/ie.css b/theme/cloudy/css/ie.css index 095122100..94c2093b1 100644 --- a/theme/cloudy/css/ie.css +++ b/theme/cloudy/css/ie.css @@ -8,6 +8,16 @@ color:#fff; background-color:#ddffcc; } +#form_notice .form_note + label { +position:absolute; +top:25px; +left:83%; +text-indent:-9999px; +height:16px; +width:16px; +display:block; +} + #aside_primary { width:181px; } @@ -32,3 +42,13 @@ top:158px; #subscribers #content { padding-top:138px; } + +.notice { +z-index:1; +} +.notice:hover { +z-index:9999; +} +.notice .thumbnail img { +z-index:9999; +} |