From cae2429d12321319d4a9ef1a22d73aaf76449a36 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 16 Jan 2010 19:44:37 +0000 Subject: JSLinting on JSON --- js/util.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/js/util.js b/js/util.js index 88016bd6d..ef28f31e8 100644 --- a/js/util.js +++ b/js/util.js @@ -525,13 +525,13 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeDataGeo).attr('checked', true); var cookieValue = { - 'NLat': data.lat, - 'NLon': data.lon, - 'NLNS': lns, - 'NLID': lid, - 'NLN': NLN_text, - 'NLNU': location.url, - 'NDG': true + NLat: data.lat, + NLon: data.lon, + NLNS: lns, + NLID: lid, + NLN: NLN_text, + NLNU: location.url, + NDG: true }; $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue)); }); @@ -566,9 +566,9 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeLon).val(position.coords.longitude); var data = { - 'lat': position.coords.latitude, - 'lon': position.coords.longitude, - 'token': $('#token').val() + lat: position.coords.latitude, + lon: position.coords.longitude, + token: $('#token').val() }; getJSONgeocodeURL(geocodeURL, data); -- cgit v1.2.3-54-g00ecf From f9cc3e6d942f4a1e3b9e000daa5ecca4df5e4ce5 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 16 Jan 2010 20:10:46 +0000 Subject: Added missing position paramater --- js/util.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/util.js b/js/util.js index ef28f31e8..373a4f3b0 100644 --- a/js/util.js +++ b/js/util.js @@ -494,7 +494,7 @@ var SN = { // StatusNet $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled'); } - function getJSONgeocodeURL(geocodeURL, data) { + function getJSONgeocodeURL(geocodeURL, data, position) { $.getJSON(geocodeURL, data, function(location) { var lns, lid; @@ -571,7 +571,7 @@ var SN = { // StatusNet token: $('#token').val() }; - getJSONgeocodeURL(geocodeURL, data); + getJSONgeocodeURL(geocodeURL, data, position); }, function(error) { @@ -598,7 +598,7 @@ var SN = { // StatusNet 'token': $('#token').val() }; - getJSONgeocodeURL(geocodeURL, data); + getJSONgeocodeURL(geocodeURL, data, position); } else { removeNoticeDataGeo(); -- cgit v1.2.3-54-g00ecf From 2e643071ff3d03bd05f453b8e144aee4695e952e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 17 Jan 2010 22:31:47 +0000 Subject: Took out focus out of textare when location share is enabled/disabled. Also avoids the conflict with the URL fragment on the conversation page. --- js/util.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/util.js b/js/util.js index 373a4f3b0..a10e9d15a 100644 --- a/js/util.js +++ b/js/util.js @@ -624,8 +624,6 @@ var SN = { // StatusNet else { removeNoticeDataGeo(); } - - $('#'+SN.C.S.NoticeDataText).focus(); }).change(); } }, -- cgit v1.2.3-54-g00ecf From a35c52b6bef775a47785922a25fad3d9199fce1c Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 18 Jan 2010 12:55:14 +0000 Subject: Some JS cleaning up for NoticeLocationAttach (which fixes also fixes a few bugs in WebKit) --- js/util.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js/util.js b/js/util.js index a10e9d15a..aeec8d89d 100644 --- a/js/util.js +++ b/js/util.js @@ -494,7 +494,7 @@ var SN = { // StatusNet $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled'); } - function getJSONgeocodeURL(geocodeURL, data, position) { + function getJSONgeocodeURL(geocodeURL, data) { $.getJSON(geocodeURL, data, function(location) { var lns, lid; @@ -509,7 +509,7 @@ var SN = { // StatusNet } if (typeof(location.name) == 'undefined') { - NLN_text = position.coords.latitude + ';' + position.coords.longitude; + NLN_text = data.lat + ';' + data.lon; } else { NLN_text = location.name; @@ -571,7 +571,7 @@ var SN = { // StatusNet token: $('#token').val() }; - getJSONgeocodeURL(geocodeURL, data, position); + getJSONgeocodeURL(geocodeURL, data); }, function(error) { @@ -593,12 +593,12 @@ var SN = { // StatusNet else { if (NLat.length > 0 && NLon.length > 0) { var data = { - 'lat': NLat, - 'lon': NLon, - 'token': $('#token').val() + lat: NLat, + lon: NLon, + token: $('#token').val() }; - getJSONgeocodeURL(geocodeURL, data, position); + getJSONgeocodeURL(geocodeURL, data); } else { removeNoticeDataGeo(); -- cgit v1.2.3-54-g00ecf From a7a0041a1157ad3ceec2ebd6af722a2529ad422f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 22 Jan 2010 00:27:08 +0000 Subject: Quick hack to avoid breaking with geonames off when there's some old cookie state. This code's a little rough and tumble; any breakage halts JS execution and leaves the spinner going and no message submitted. --- js/util.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/util.js b/js/util.js index aeec8d89d..a7339010a 100644 --- a/js/util.js +++ b/js/util.js @@ -205,8 +205,10 @@ var SN = { // StatusNet cookieValue = JSON.parse(cookieValue); NLat = $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat).val(); NLon = $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon).val(); - NLNS = $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS).val(); - NLID = $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID).val(); + if ($('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS)) { + NLNS = $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS).val(); + NLID = $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID).val(); + } } if (cookieValue == 'disabled') { NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked', false).attr('checked'); @@ -301,8 +303,10 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeLat).val(NLat); $('#'+SN.C.S.NoticeLon).val(NLon); - $('#'+SN.C.S.NoticeLocationNs).val(NLNS); - $('#'+SN.C.S.NoticeLocationId).val(NLID); + if ($('#'+SN.C.S.NoticeLocationNs)) { + $('#'+SN.C.S.NoticeLocationNs).val(NLNS); + $('#'+SN.C.S.NoticeLocationId).val(NLID); + } $('#'+SN.C.S.NoticeDataGeo).attr('checked', NDG); } }); -- cgit v1.2.3-54-g00ecf From 591c5037a745f1b620b213ddaa84c82c64201b71 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 25 Jan 2010 14:55:04 +0000 Subject: An update to geolocation cookie to use a single file and set the expiry date to 30 days from now. --- js/util.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/util.js b/js/util.js index a7339010a..8d52d859b 100644 --- a/js/util.js +++ b/js/util.js @@ -495,7 +495,7 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeLocationId).val(''); $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); - $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled'); + $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/', expires: SN.U.GetDateFromNow(30) }); } function getJSONgeocodeURL(geocodeURL, data) { @@ -537,7 +537,8 @@ var SN = { // StatusNet NLNU: location.url, NDG: true }; - $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue)); + + $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue), { path: '/', expires: SN.U.GetDateFromNow(30) }); }); } @@ -658,6 +659,13 @@ var SN = { // StatusNet } return false; }); + }, + + GetDateFromNow: function(days) { + var date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + + return date; } }, -- cgit v1.2.3-54-g00ecf From e9a155db733f5266816ae5904db1eace4af1e2df Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 16 Jan 2010 20:57:18 +0000 Subject: Using visibility:hidden instead of display:none for checkbox --- theme/base/css/display.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 2e4c88dfa..893cc60b5 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -73,7 +73,7 @@ input.checkbox, input.radio { position:relative; top:2px; -left:0; +left:auto; border:0; } @@ -567,7 +567,8 @@ float:right; font-size:0.8em; } -.form_notice #notice_data-geo_wrap label { +.form_notice #notice_data-geo_wrap label, +.form_notice #notice_data-geo_wrap input { position:absolute; top:25px; right:4px; @@ -578,7 +579,7 @@ height:16px; display:block; } .form_notice #notice_data-geo_wrap input { -display:none; +visibility:hidden; } .form_notice #notice_data-geo_wrap label { font-weight:normal; -- cgit v1.2.3-54-g00ecf From 83eef607f1f01256e7342b421bddbed1fc32d6a6 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 17 Jan 2010 14:04:47 +0000 Subject: Inline script for maxlength is deprecated --- plugins/MobileProfile/MobileProfilePlugin.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 14d2500e8..d426fc282 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -356,8 +356,6 @@ class MobileProfilePlugin extends WAP20Plugin $contentLimit = Notice::maxContent(); - $form->out->inlineScript('maxLength = ' . $contentLimit . ';'); - if ($contentLimit > 0) { $form->out->element('div', array('id' => 'notice_text-count'), $contentLimit); -- cgit v1.2.3-54-g00ecf From 14c3ec73b93ad59d5eb3947ac5a4b7ed6c26daad Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 17 Jan 2010 19:45:35 +0000 Subject: Updated UI for notice aside content and notice options in MobileProfile --- plugins/MobileProfile/mp-screen.css | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/plugins/MobileProfile/mp-screen.css b/plugins/MobileProfile/mp-screen.css index 3eefc0c8e..472fbb001 100644 --- a/plugins/MobileProfile/mp-screen.css +++ b/plugins/MobileProfile/mp-screen.css @@ -179,10 +179,12 @@ padding-bottom:4px; } .notice div.entry-content { margin-left:0; -width:62.5%; +width:75%; +max-width:100%; +min-width:0; } .notice-options { -width:34%; +width:50px; margin-right:1%; } @@ -190,12 +192,29 @@ margin-right:1%; width:16px; height:16px; } -.notice-options a, -.notice-options input { +.notice .notice-options a, +.notice .notice-options input { box-shadow:none; -moz-box-shadow:none; -webkit-box-shadow:none; } +.notice .notice-options a, +.notice .notice-options form { +margin:-4px 0 0 0; +} +.notice .notice-options .notice_repeat, +.notice .notice-options .notice_delete { +margin-top:18px; +} +.notice .notice-options .notice_reply, +.notice .notice-options .notice_repeat { +margin-left:18px; +} + + +.notice .notice-options .notice_delete { +float:left; +} .entity_profile { width:auto; -- cgit v1.2.3-54-g00ecf From a93a3cc2701a0a948fe06b1d2a156c5d6b28c006 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 18 Jan 2010 11:12:05 +0000 Subject: Moved farbtastic's stylesheet to use relative paths for its own images --- js/farbtastic/farbtastic.css | 32 ++++++++++++++++++++++++++++++++ theme/base/css/farbtastic.css | 32 -------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 js/farbtastic/farbtastic.css delete mode 100644 theme/base/css/farbtastic.css diff --git a/js/farbtastic/farbtastic.css b/js/farbtastic/farbtastic.css new file mode 100644 index 000000000..a88e7b868 --- /dev/null +++ b/js/farbtastic/farbtastic.css @@ -0,0 +1,32 @@ +.farbtastic { + position: relative; +} +.farbtastic * { + position: absolute; + cursor: crosshair; +} +.farbtastic, .farbtastic .wheel { + width: 195px; + height: 195px; +} +.farbtastic .color, .farbtastic .overlay { + top: 47px; + left: 47px; + width: 101px; + height: 101px; +} +.farbtastic .wheel { + background: url(wheel.png) no-repeat; + width: 195px; + height: 195px; +} +.farbtastic .overlay { + background: url(mask.png) no-repeat; +} +.farbtastic .marker { + width: 17px; + height: 17px; + margin: -8px 0 0 -8px; + overflow: hidden; + background: url(marker.png) no-repeat; +} diff --git a/theme/base/css/farbtastic.css b/theme/base/css/farbtastic.css deleted file mode 100644 index 7efcc73c3..000000000 --- a/theme/base/css/farbtastic.css +++ /dev/null @@ -1,32 +0,0 @@ -.farbtastic { - position: relative; -} -.farbtastic * { - position: absolute; - cursor: crosshair; -} -.farbtastic, .farbtastic .wheel { - width: 195px; - height: 195px; -} -.farbtastic .color, .farbtastic .overlay { - top: 47px; - left: 47px; - width: 101px; - height: 101px; -} -.farbtastic .wheel { - background: url(../../../js/farbtastic/wheel.png) no-repeat; - width: 195px; - height: 195px; -} -.farbtastic .overlay { - background: url(../../../js/farbtastic/mask.png) no-repeat; -} -.farbtastic .marker { - width: 17px; - height: 17px; - margin: -8px 0 0 -8px; - overflow: hidden; - background: url(../../../js/farbtastic/marker.png) no-repeat; -} -- cgit v1.2.3-54-g00ecf From b1a4ccb4dfb0e815f4955ef0c5cde27d85437eb7 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 18 Jan 2010 11:29:05 +0000 Subject: Updated path to farbtastic stylesheet --- actions/designadminpanel.php | 2 +- lib/designsettings.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php index f862aff0e..72ad6ade2 100644 --- a/actions/designadminpanel.php +++ b/actions/designadminpanel.php @@ -289,7 +289,7 @@ class DesignadminpanelAction extends AdminPanelAction function showStylesheets() { parent::showStylesheets(); - $this->cssLink('css/farbtastic.css','base','screen, projection, tv'); + $this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv'); } /** diff --git a/lib/designsettings.php b/lib/designsettings.php index b70ba0dfc..8e44c03a9 100644 --- a/lib/designsettings.php +++ b/lib/designsettings.php @@ -314,7 +314,7 @@ class DesignSettingsAction extends AccountSettingsAction function showStylesheets() { parent::showStylesheets(); - $this->cssLink('css/farbtastic.css','base','screen, projection, tv'); + $this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv'); } /** -- cgit v1.2.3-54-g00ecf From dbb44ca39a84181fa8ccfb66657075250507945c Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 18 Jan 2010 17:17:02 +0000 Subject: Missing null className for incoming email form legend --- actions/emailsettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/emailsettings.php b/actions/emailsettings.php index bfef2970d..08608348c 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -130,7 +130,7 @@ class EmailsettingsAction extends AccountSettingsAction if (common_config('emailpost', 'enabled') && $user->email) { $this->elementStart('fieldset', array('id' => 'settings_email_incoming')); - $this->element('legend',_('Incoming email')); + $this->element('legend', null, _('Incoming email')); if ($user->incomingemail) { $this->elementStart('p'); $this->element('span', 'address', $user->incomingemail); -- cgit v1.2.3-54-g00ecf From 1406cc452f212f629bdba8ac3e4422e907fbfb7f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 20 Jan 2010 18:32:24 +0100 Subject: Updated notice item view where a) notice text no longer wraps around (under author's photo) b) supplemental notice content and options will start right under notice text. --- plugins/MobileProfile/mp-screen.css | 12 +++++++++++- theme/base/css/display.css | 22 +++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/plugins/MobileProfile/mp-screen.css b/plugins/MobileProfile/mp-screen.css index 472fbb001..76071352d 100644 --- a/plugins/MobileProfile/mp-screen.css +++ b/plugins/MobileProfile/mp-screen.css @@ -176,8 +176,18 @@ margin-bottom:0; .profile { padding-top:4px; padding-bottom:4px; +min-height:65px; } -.notice div.entry-content { +#content .notice .entry-title { +float:left; +width:100%; +margin-left:0; +} +#content .notice .author .photo { +position:static; +float:left; +} +#content .notice div.entry-content { margin-left:0; width:75%; max-width:100%; diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 893cc60b5..7eff4709c 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -957,6 +957,16 @@ float:left; #shownotice .vcard .photo { margin-bottom:4px; } +#content .notice .author .photo { +position:absolute; +top:11px; +left:0; +float:none; +} +#content .notice .entry-title { +margin-left:59px; +} + .vcard .url { text-decoration:none; } @@ -965,13 +975,19 @@ text-decoration:underline; } .notice .entry-title { -float:left; -width:100%; overflow:hidden; } .notice .entry-title.ov { overflow:visible; } +#showstream .notice .entry-title, +#showstream .notice div.entry-content { +margin-left:0; +} +#shownotice .notice .entry-title, +#shownotice .notice div.entry-content { +margin-left:110px; +} #shownotice .notice .entry-title { font-size:2.2em; } @@ -1001,7 +1017,6 @@ max-width:70%; } #showstream .notice div.entry-content, #shownotice .notice div.entry-content { -margin-left:0; max-width:79%; } @@ -1065,6 +1080,7 @@ position:relative; font-size:0.95em; width:113px; float:right; +margin-top:3px; margin-right:4px; } -- cgit v1.2.3-54-g00ecf From 2f74a9bf148a22bb19524da290783cc0c10d38ba Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 20 Jan 2010 18:50:48 +0100 Subject: Better alignment for notice options in MobileProfile --- plugins/MobileProfile/mp-screen.css | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/MobileProfile/mp-screen.css b/plugins/MobileProfile/mp-screen.css index 76071352d..04fa5fb00 100644 --- a/plugins/MobileProfile/mp-screen.css +++ b/plugins/MobileProfile/mp-screen.css @@ -194,7 +194,7 @@ max-width:100%; min-width:0; } .notice-options { -width:50px; +width:43px; margin-right:1%; } @@ -202,6 +202,13 @@ margin-right:1%; width:16px; height:16px; } +.notice-options form.processing { +background-image:none; +} +#wrap .notice-options form.processing input.submit { +background-position:0 47%; +} + .notice .notice-options a, .notice .notice-options input { box-shadow:none; @@ -212,16 +219,16 @@ box-shadow:none; .notice .notice-options form { margin:-4px 0 0 0; } -.notice .notice-options .notice_repeat, +.notice .notice-options .form_repeat, .notice .notice-options .notice_delete { -margin-top:18px; +margin-top:11px; } -.notice .notice-options .notice_reply, -.notice .notice-options .notice_repeat { -margin-left:18px; +.notice .notice-options .form_favor, +.notice .notice-options .form_disfavor, +.notice .notice-options .form_repeat { +margin-right:11px; } - .notice .notice-options .notice_delete { float:left; } -- cgit v1.2.3-54-g00ecf From 72ae0ecc1c5e021b0f562fe5aa7ad0140d9c9ecf Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 21 Jan 2010 13:23:04 +0100 Subject: Removed mobile stylesheet from core output. If Mobile support is seeked, MobileProfile plugin should be used. --- lib/action.php | 4 -- theme/base/css/mobile.css | 150 ---------------------------------------------- 2 files changed, 154 deletions(-) delete mode 100644 theme/base/css/mobile.css diff --git a/lib/action.php b/lib/action.php index 171bea17c..e9207a66a 100644 --- a/lib/action.php +++ b/lib/action.php @@ -199,10 +199,6 @@ class Action extends HTMLOutputter // lawsuit if (Event::handle('StartShowStatusNetStyles', array($this)) && Event::handle('StartShowLaconicaStyles', array($this))) { $this->cssLink('css/display.css',null,'screen, projection, tv'); - if (common_config('site', 'mobile')) { - // TODO: "handheld" CSS for other mobile devices - $this->cssLink('css/mobile.css','base','only screen and (max-device-width: 480px)'); // Mobile WebKit - } $this->cssLink('css/print.css','base','print'); Event::handle('EndShowStatusNetStyles', array($this)); Event::handle('EndShowLaconicaStyles', array($this)); diff --git a/theme/base/css/mobile.css b/theme/base/css/mobile.css deleted file mode 100644 index f6c53ea8d..000000000 --- a/theme/base/css/mobile.css +++ /dev/null @@ -1,150 +0,0 @@ -/** theme: base - * - * @package StatusNet - * @author Meitar Moscovitz - * @author Sarven Capadisli - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -body { -font-size:2.5em; -} - -#wrap { -width:95%; -} - -#header, -#header address, -#anon_notice, -#site_nav_local_views .nav, -#form_notice, -#form_notice .form_data li, -#core, -#content_inner, -#notices_primary, -.notice, -.notice .entry-title, -.notice div.entry-content, -.notice-options, -.notice .notice-options a, -.pagination, -.pagination .nav, -.aside .section { -float:none; -} - -.notice-options .notice_reply, -.notice-options .notice_delete, -.notice-options .form_favor, -.notice-options .form_disfavor { -position:static; -} - -#form_notice, -#anon_notice, -#footer, -#form_notice .form_actions input.submit { -width:auto; -} - -.form_settings label { -width:25%; -} -.form_settings .form_data p.form_guide { -margin-left:26%; -} - -#site_nav_global_primary { -width:75%; -} - -.entity_profile { -width:65%; -} -.entity_actions { -margin-left:0; -} - -#form_notice, -#anon_notice { -clear:both; -} - -#content, -#aside_primary { -width:96%; -padding-left:2%; -padding-right:2%; -} - -#site_notice { -position:static; -float:right; -clear:right; -width:75%; -margin-right:0; -margin-bottom:11px; -} - -.notices { -font-size:1.5em; -} - -#form_notice textarea { -width:80%; -height:5em; -} -#form_notice .form_note { -right:20%; -top:6em; -} - - -.vcard .photo, -.section .vcard .photo { -margin-right:18px; -} -.notice, -.profile { -margin-bottom:18px; -} - -.notices .entry-title, -.notices div.entry-content { -width:90%; -} -.notice div.entry-content { -margin-left:0; -} - -.notice .author .photo { -height:4.5em; -width:4.5em; -} -.notice-options { -position:absolute; -top:0; -right:0; -padding-left:7%; -width:3%; -} - -.notice-options .notice_delete a { -float:left; -} -.pagination .nav { -overflow:auto; -} - -#export_data { -display:none; -} - -#site_nav_local_views li { -margin-right:4px; -} -#site_nav_local_views a { -padding:18px 11px; -} -- cgit v1.2.3-54-g00ecf From 6ae453bb7d7db232bead11c833d9447ee4e4ec0b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 22 Jan 2010 19:18:14 +0100 Subject: Fixed innerHTML problem in IE7 and 8 for badge script --- js/identica-badge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/identica-badge.js b/js/identica-badge.js index 8276f22a1..e43d1c43c 100644 --- a/js/identica-badge.js +++ b/js/identica-badge.js @@ -223,7 +223,7 @@ function markupPost(raw, server) { }, changeUserTo : function(el) { $.a.user = el.rel; - $.s.h.a.innerHTML = el.rev + $.a.headerText; + $.s.h.a.appendChild(document.createTextNode(el.rev + $.a.headerText)); $.s.h.a.href = 'http://' + $.a.server + '/' + el.id; $.f.runSearch(); }, -- cgit v1.2.3-54-g00ecf From 23e96dd4d1f2378a62dc24f2f11b3e8b645bac1c Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 24 Jan 2010 15:34:40 +0100 Subject: Added version info for MobileProfile plugin --- plugins/MobileProfile/MobileProfilePlugin.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index d426fc282..5c913836d 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -414,7 +414,15 @@ class MobileProfilePlugin extends WAP20Plugin return $proto.'://'.$serverpart.'/'.$pathpart.$relative; } -} - -?> + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'MobileProfile', + 'version' => STATUSNET_VERSION, + 'author' => 'Sarven Capadisli', + 'homepage' => 'http://status.net/wiki/Plugin:MobileProfile', + 'rawdescription' => + _m('XHTML MobileProfile output for supporting user agents.')); + return true; + } +} -- cgit v1.2.3-54-g00ecf From 9bacdb9134b39f97fd244bdc28d9e467ac05b61d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 25 Jan 2010 22:44:05 +0100 Subject: Updated howto create a theme --- theme/README | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/theme/README b/theme/README index 266a89fdf..e154a723c 100644 --- a/theme/README +++ b/theme/README @@ -2,37 +2,46 @@ * * @package StatusNet * @author Sarven Capadisli - * @copyright 2009 StatusNet, Inc. + * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -Location of key paths and files under theme/: +== Location of key paths and files == +

+base/css/
+base/css/display.css                #layout, typography rules
+base/images/                        #common icons, illustrations
+base/images/icons/icons-01.png      #main icons file (combined into a single file)
 
-./base/css/
-./base/css/display.css
-./base/images/
+default/css/
+default/css/display.css             #imports the base stylesheet for layout and adds background images and colour rules
+default/logo.png                    #default site logo for this theme
+default/mobilelogo.png              #default logo for the mobile output
+default/default-avatar-mini.png     #24x24 default avatar for minilists
+default/default-avatar-stream.png   #48x48 default avatar for notice timelines
+default/default-avatar-profile.png  #96x96 default avatar for the profile page
+
-./default/css/ -./default/css/display.css -./default/images/ -./base/display.css contains layout, typography rules: -Only alter this file if you want to change the layout of the site. Please note that, any updates to this in future statusnet releases may not be compatible with your version. +== How to create your own theme == -./default/css/display.css contains only the background images and colour rules: -This file is a good basis for creating your own theme. -Let's create a theme: +You probably want to do one of the following: -1. To start off, copy over the default theme: -cp -r default mytheme -2. Edit your mytheme stylesheet: -nano mytheme/css/display.css +* If you just want to change the text, link, background, content, sidebar colours, background image: +** Do this from the Admin->Design settings (recommended!). You could also create a directory and a file structure like the default theme, search and replace with your own values. This is more work, but, you can do this if you plan to make additional *minimal* changes. -a) Search and replace your colours and background images, or -b) Create your own layout either importing a separate stylesheet (e.g., change to @import url(base.css);) or simply place it before the rest of the rules. -4. Set /config.php to load 'mytheme': -$config['site']['theme'] = 'mytheme'; +* If you want to change the background images and colours: +# Create a directory and a file structure like the default theme. +# Have your stylesheet import base/css/display.css and add your own styles below. It is okay to add *minimal* changes here. + + +* If you want to create a different layout, typography, background images and colours: +** Create your own theme directory (base or default) with stylesheets and images like. + + +Finally, enable your theme by selecting it from the Admin->Design interface. You can set site's logo from here as well. + -- cgit v1.2.3-54-g00ecf From 817f01c3b18ec626701de2a1402562eeb87eee6d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 26 Jan 2010 01:58:10 +0100 Subject: Setting the geo location cookie expire date far into the future: 2029 ;) --- js/util.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/util.js b/js/util.js index 8d52d859b..b864867fd 100644 --- a/js/util.js +++ b/js/util.js @@ -495,7 +495,7 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeLocationId).val(''); $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); - $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/', expires: SN.U.GetDateFromNow(30) }); + $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/', expires: SN.U.GetFullYear(2029, 0, 1) }); } function getJSONgeocodeURL(geocodeURL, data) { @@ -538,7 +538,7 @@ var SN = { // StatusNet NDG: true }; - $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue), { path: '/', expires: SN.U.GetDateFromNow(30) }); + $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue), { path: '/', expires: SN.U.GetFullYear(2029, 0, 1) }); }); } @@ -661,9 +661,9 @@ var SN = { // StatusNet }); }, - GetDateFromNow: function(days) { + GetFullYear: function(year, month, day) { var date = new Date(); - date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + date.setFullYear(year, month, day); return date; } -- cgit v1.2.3-54-g00ecf From cebab436a16b392d3854d6abe652a063e055b8c7 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 26 Jan 2010 19:13:05 +0100 Subject: Updated geolocation sharing in notice form for Realtime pop --- plugins/Realtime/realtimeupdate.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/realtimeupdate.css index 56f869354..31e7c2ae6 100644 --- a/plugins/Realtime/realtimeupdate.css +++ b/plugins/Realtime/realtimeupdate.css @@ -18,7 +18,8 @@ display:none; } .realtime-popup #form_notice label[for=notice_data-attach], -.realtime-popup #form_notice #notice_data-attach { +.realtime-popup #form_notice #notice_data-attach, +.realtime-popup #form_notice label[for=notice_data-geo] { top:0; } -- cgit v1.2.3-54-g00ecf From 2e0297bb6ff0fd2d3a37d811bd3305ce5d6a77ee Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 27 Jan 2010 15:08:33 +0000 Subject: Better alignment for notice in shownotice page --- theme/base/css/display.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 7eff4709c..d4c471674 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -984,12 +984,13 @@ overflow:visible; #showstream .notice div.entry-content { margin-left:0; } -#shownotice .notice .entry-title, -#shownotice .notice div.entry-content { -margin-left:110px; -} #shownotice .notice .entry-title { +margin-left:110px; font-size:2.2em; +min-height:123px; +} +#shownotice .notice div.entry-content { +margin-left:0; } .notice p.entry-content { -- cgit v1.2.3-54-g00ecf From c51539804a7f6f63b3f47fd838b9527262440e3d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 09:24:59 -0800 Subject: Add persistent:true property to Stomp messages so ActiveMQ doesn't decide to discard them even though persistence is enabled on the broker. :) (Thanks Aric!) --- lib/stompqueuemanager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 89f3d74cc..19e8c49b5 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -178,7 +178,8 @@ class StompQueueManager extends QueueManager $result = $this->con->send($this->queueName($queue), $msg, // BODY of the message - array ('created' => common_sql_now())); + array ('created' => common_sql_now(), + 'persistent' => 'true')); if (!$result) { common_log(LOG_ERR, "Error sending $rep to $queue queue"); -- cgit v1.2.3-54-g00ecf From 61a7a7b36b4f4b504dde880695dff5113dbe2a48 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 21 Jan 2010 18:18:32 +0100 Subject: Plugin for Universal Ad Package. Outputs four most widely used ad types. --- plugins/UAP/UAPPlugin.php | 176 ++++++++++++++++++++++++++++++++++++++++++++++ plugins/UAP/uap.css | 50 +++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 plugins/UAP/UAPPlugin.php create mode 100644 plugins/UAP/uap.css diff --git a/plugins/UAP/UAPPlugin.php b/plugins/UAP/UAPPlugin.php new file mode 100644 index 000000000..13c101723 --- /dev/null +++ b/plugins/UAP/UAPPlugin.php @@ -0,0 +1,176 @@ +. + * + * @category Action + * @package StatusNet + * @author Sarven Capadisli + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * Outputs the following ad types (based on UAP): + * Medium Rectangle 300x250 + * Rectangle 180x150 + * Leaderboard 728x90 + * Wide Skyscraper 160x600 + * + * Any number of ad types can be used. Enable all using example: + * addPlugin('UAP', array( + * 'MediumRectangle' => '', + * 'Rectangle' => '', + * 'Leaderboard' => '', + * 'WideSkyscraper' => '' + * ) + * ); + * + * @category Plugin + * @package StatusNet + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class UAPPlugin extends Plugin +{ + public $MediumRectangle = null; + public $Rectangle = null; + public $Leaderboard = null; + public $WideSkyscraper = null; + + function __construct($uap = array()) + { + $this->uap = $uap; + + parent::__construct(); + } + + function onInitializePlugin() + { + foreach($this->uap as $key => $value) { + switch(strtolower($key)) { + case 'MediumRectangle': default: + $this->MediumRectangle = $value; + break; + case 'Rectangle': + $this->Rectangle = $value; + break; + case 'Leaderboard': + $this->Leaderboard = $value; + break; + case 'WideSkyscraper': + $this->WideSkyscraper = $value; + break; + } + } + } + + function onEndShowStatusNetStyles($action) + { + $action->cssLink(common_path('plugins/UAP/uap.css'), + null, 'screen, projection, tv'); + return true; + } + + //MediumRectangle ad + function onStartShowAside($action) + { + if (!$this->MediumRectangle) { + return true; + } + + $this->showAd($action, array('id' => 'ad_medium-rectangle'), + $this->MediumRectangle); + + return true; + } + +/* + //Rectangle ad + function onEndShowSiteNotice($action) + { + if (!$this->Rectangle) { + return true; + } + + $this->showAd($action, array('id' => 'ad_rectangle'), + $this->Rectangle); + + return true; + } +*/ + + //Leaderboard and Rectangle ad + function onStartShowHeader($action) + { + if ($this->Leaderboard) { + $this->showAd($action, array('id' => 'ad_leaderboard'), + $this->Leaderboard); + } + + if ($this->Rectangle) { + $this->showAd($action, array('id' => 'ad_rectangle'), + $this->Rectangle); + } + + return true; + } + + //WideSkyscraper ad + function onEndShowAside($action) + { + if (!$this->WideSkyscraper) { + return true; + } + + $this->showAd($action, array('id' => 'ad_wide-skyscraper'), + $this->WideSkyscraper); + + return true; + } + + //Output ad container + function showAd($action, $attr=array(), $value) + { + $classes = ($attr['class']) ? $attr['class'].' ' : ''; + + $action->elementStart('div', array('id' => $attr['id'], + 'class' => $classes.'ad')); + $action->raw($value); + $action->elementEnd('div'); + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'UAP', + 'version' => STATUSNET_VERSION, + 'author' => 'Sarven Capadisli', + 'homepage' => 'http://status.net/wiki/Plugin:UAP', + 'rawdescription' => + _m('Outputs ad placements based on Universal Ad Package')); + return true; + } +} diff --git a/plugins/UAP/uap.css b/plugins/UAP/uap.css new file mode 100644 index 000000000..90abe5180 --- /dev/null +++ b/plugins/UAP/uap.css @@ -0,0 +1,50 @@ +/** Universal Ad Package styles: + * Medium Rectangle 300x250 + * Rectangle 180x150 + * Leaderboard 728x90 + * Wide Skyscraper 160x600 + * + * @package StatusNet + * @author Sarven Capadisli + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + + +.ad { +border:1px solid #CCC; +float:left; +} + +#ad_medium-rectangle { +width:300px; +height:250px; + +margin-left:1.35%; +margin-bottom:18px; +} + +#ad_rectangle { +width:180px; +height:150px; + +float:right; +margin-right:18px; +} + +#ad_leaderboard { +width:728px; +height:90px; + +margin:29px 18px 0 0; +clear:both; +} + +#ad_wide-skyscraper { +width:160px; +height:600px; + +margin-top:18px; +margin-left:8.5%; +} -- cgit v1.2.3-54-g00ecf From 58fde0dcb5342cb3d3ff44c2e54a077eea0e063e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 21 Jan 2010 18:28:02 +0100 Subject: Lowercased switch cases in UAP Plugin --- plugins/UAP/UAPPlugin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UAP/UAPPlugin.php b/plugins/UAP/UAPPlugin.php index 13c101723..f3b16548d 100644 --- a/plugins/UAP/UAPPlugin.php +++ b/plugins/UAP/UAPPlugin.php @@ -72,16 +72,16 @@ class UAPPlugin extends Plugin { foreach($this->uap as $key => $value) { switch(strtolower($key)) { - case 'MediumRectangle': default: + case 'mediumrectangle': default: $this->MediumRectangle = $value; break; - case 'Rectangle': + case 'rectangle': $this->Rectangle = $value; break; - case 'Leaderboard': + case 'leaderboard': $this->Leaderboard = $value; break; - case 'WideSkyscraper': + case 'wideskyscraper': $this->WideSkyscraper = $value; break; } -- cgit v1.2.3-54-g00ecf From 1758ed453bcf2abd11bc2fde8768632099fe0de3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 06:25:22 -0500 Subject: move UAP plugin to core --- lib/uapplugin.php | 176 ++++++++++++++++++++++++++++++++++++++++++++++ plugins/UAP/UAPPlugin.php | 176 ---------------------------------------------- plugins/UAP/uap.css | 50 ------------- theme/base/css/uap.css | 50 +++++++++++++ 4 files changed, 226 insertions(+), 226 deletions(-) create mode 100644 lib/uapplugin.php delete mode 100644 plugins/UAP/UAPPlugin.php delete mode 100644 plugins/UAP/uap.css create mode 100644 theme/base/css/uap.css diff --git a/lib/uapplugin.php b/lib/uapplugin.php new file mode 100644 index 000000000..f3b16548d --- /dev/null +++ b/lib/uapplugin.php @@ -0,0 +1,176 @@ +. + * + * @category Action + * @package StatusNet + * @author Sarven Capadisli + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * Outputs the following ad types (based on UAP): + * Medium Rectangle 300x250 + * Rectangle 180x150 + * Leaderboard 728x90 + * Wide Skyscraper 160x600 + * + * Any number of ad types can be used. Enable all using example: + * addPlugin('UAP', array( + * 'MediumRectangle' => '', + * 'Rectangle' => '', + * 'Leaderboard' => '', + * 'WideSkyscraper' => '' + * ) + * ); + * + * @category Plugin + * @package StatusNet + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class UAPPlugin extends Plugin +{ + public $MediumRectangle = null; + public $Rectangle = null; + public $Leaderboard = null; + public $WideSkyscraper = null; + + function __construct($uap = array()) + { + $this->uap = $uap; + + parent::__construct(); + } + + function onInitializePlugin() + { + foreach($this->uap as $key => $value) { + switch(strtolower($key)) { + case 'mediumrectangle': default: + $this->MediumRectangle = $value; + break; + case 'rectangle': + $this->Rectangle = $value; + break; + case 'leaderboard': + $this->Leaderboard = $value; + break; + case 'wideskyscraper': + $this->WideSkyscraper = $value; + break; + } + } + } + + function onEndShowStatusNetStyles($action) + { + $action->cssLink(common_path('plugins/UAP/uap.css'), + null, 'screen, projection, tv'); + return true; + } + + //MediumRectangle ad + function onStartShowAside($action) + { + if (!$this->MediumRectangle) { + return true; + } + + $this->showAd($action, array('id' => 'ad_medium-rectangle'), + $this->MediumRectangle); + + return true; + } + +/* + //Rectangle ad + function onEndShowSiteNotice($action) + { + if (!$this->Rectangle) { + return true; + } + + $this->showAd($action, array('id' => 'ad_rectangle'), + $this->Rectangle); + + return true; + } +*/ + + //Leaderboard and Rectangle ad + function onStartShowHeader($action) + { + if ($this->Leaderboard) { + $this->showAd($action, array('id' => 'ad_leaderboard'), + $this->Leaderboard); + } + + if ($this->Rectangle) { + $this->showAd($action, array('id' => 'ad_rectangle'), + $this->Rectangle); + } + + return true; + } + + //WideSkyscraper ad + function onEndShowAside($action) + { + if (!$this->WideSkyscraper) { + return true; + } + + $this->showAd($action, array('id' => 'ad_wide-skyscraper'), + $this->WideSkyscraper); + + return true; + } + + //Output ad container + function showAd($action, $attr=array(), $value) + { + $classes = ($attr['class']) ? $attr['class'].' ' : ''; + + $action->elementStart('div', array('id' => $attr['id'], + 'class' => $classes.'ad')); + $action->raw($value); + $action->elementEnd('div'); + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'UAP', + 'version' => STATUSNET_VERSION, + 'author' => 'Sarven Capadisli', + 'homepage' => 'http://status.net/wiki/Plugin:UAP', + 'rawdescription' => + _m('Outputs ad placements based on Universal Ad Package')); + return true; + } +} diff --git a/plugins/UAP/UAPPlugin.php b/plugins/UAP/UAPPlugin.php deleted file mode 100644 index f3b16548d..000000000 --- a/plugins/UAP/UAPPlugin.php +++ /dev/null @@ -1,176 +0,0 @@ -. - * - * @category Action - * @package StatusNet - * @author Sarven Capadisli - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -/** - * Outputs the following ad types (based on UAP): - * Medium Rectangle 300x250 - * Rectangle 180x150 - * Leaderboard 728x90 - * Wide Skyscraper 160x600 - * - * Any number of ad types can be used. Enable all using example: - * addPlugin('UAP', array( - * 'MediumRectangle' => '', - * 'Rectangle' => '', - * 'Leaderboard' => '', - * 'WideSkyscraper' => '' - * ) - * ); - * - * @category Plugin - * @package StatusNet - * @author Sarven Capadisli - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class UAPPlugin extends Plugin -{ - public $MediumRectangle = null; - public $Rectangle = null; - public $Leaderboard = null; - public $WideSkyscraper = null; - - function __construct($uap = array()) - { - $this->uap = $uap; - - parent::__construct(); - } - - function onInitializePlugin() - { - foreach($this->uap as $key => $value) { - switch(strtolower($key)) { - case 'mediumrectangle': default: - $this->MediumRectangle = $value; - break; - case 'rectangle': - $this->Rectangle = $value; - break; - case 'leaderboard': - $this->Leaderboard = $value; - break; - case 'wideskyscraper': - $this->WideSkyscraper = $value; - break; - } - } - } - - function onEndShowStatusNetStyles($action) - { - $action->cssLink(common_path('plugins/UAP/uap.css'), - null, 'screen, projection, tv'); - return true; - } - - //MediumRectangle ad - function onStartShowAside($action) - { - if (!$this->MediumRectangle) { - return true; - } - - $this->showAd($action, array('id' => 'ad_medium-rectangle'), - $this->MediumRectangle); - - return true; - } - -/* - //Rectangle ad - function onEndShowSiteNotice($action) - { - if (!$this->Rectangle) { - return true; - } - - $this->showAd($action, array('id' => 'ad_rectangle'), - $this->Rectangle); - - return true; - } -*/ - - //Leaderboard and Rectangle ad - function onStartShowHeader($action) - { - if ($this->Leaderboard) { - $this->showAd($action, array('id' => 'ad_leaderboard'), - $this->Leaderboard); - } - - if ($this->Rectangle) { - $this->showAd($action, array('id' => 'ad_rectangle'), - $this->Rectangle); - } - - return true; - } - - //WideSkyscraper ad - function onEndShowAside($action) - { - if (!$this->WideSkyscraper) { - return true; - } - - $this->showAd($action, array('id' => 'ad_wide-skyscraper'), - $this->WideSkyscraper); - - return true; - } - - //Output ad container - function showAd($action, $attr=array(), $value) - { - $classes = ($attr['class']) ? $attr['class'].' ' : ''; - - $action->elementStart('div', array('id' => $attr['id'], - 'class' => $classes.'ad')); - $action->raw($value); - $action->elementEnd('div'); - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'UAP', - 'version' => STATUSNET_VERSION, - 'author' => 'Sarven Capadisli', - 'homepage' => 'http://status.net/wiki/Plugin:UAP', - 'rawdescription' => - _m('Outputs ad placements based on Universal Ad Package')); - return true; - } -} diff --git a/plugins/UAP/uap.css b/plugins/UAP/uap.css deleted file mode 100644 index 90abe5180..000000000 --- a/plugins/UAP/uap.css +++ /dev/null @@ -1,50 +0,0 @@ -/** Universal Ad Package styles: - * Medium Rectangle 300x250 - * Rectangle 180x150 - * Leaderboard 728x90 - * Wide Skyscraper 160x600 - * - * @package StatusNet - * @author Sarven Capadisli - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - - -.ad { -border:1px solid #CCC; -float:left; -} - -#ad_medium-rectangle { -width:300px; -height:250px; - -margin-left:1.35%; -margin-bottom:18px; -} - -#ad_rectangle { -width:180px; -height:150px; - -float:right; -margin-right:18px; -} - -#ad_leaderboard { -width:728px; -height:90px; - -margin:29px 18px 0 0; -clear:both; -} - -#ad_wide-skyscraper { -width:160px; -height:600px; - -margin-top:18px; -margin-left:8.5%; -} diff --git a/theme/base/css/uap.css b/theme/base/css/uap.css new file mode 100644 index 000000000..90abe5180 --- /dev/null +++ b/theme/base/css/uap.css @@ -0,0 +1,50 @@ +/** Universal Ad Package styles: + * Medium Rectangle 300x250 + * Rectangle 180x150 + * Leaderboard 728x90 + * Wide Skyscraper 160x600 + * + * @package StatusNet + * @author Sarven Capadisli + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + + +.ad { +border:1px solid #CCC; +float:left; +} + +#ad_medium-rectangle { +width:300px; +height:250px; + +margin-left:1.35%; +margin-bottom:18px; +} + +#ad_rectangle { +width:180px; +height:150px; + +float:right; +margin-right:18px; +} + +#ad_leaderboard { +width:728px; +height:90px; + +margin:29px 18px 0 0; +clear:both; +} + +#ad_wide-skyscraper { +width:160px; +height:600px; + +margin-top:18px; +margin-left:8.5%; +} -- cgit v1.2.3-54-g00ecf From 7c54591472b4ff997ea099792c95d40b98798381 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 07:19:36 -0500 Subject: make uapplugin an abstract class --- lib/uapplugin.php | 199 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 105 insertions(+), 94 deletions(-) diff --git a/lib/uapplugin.php b/lib/uapplugin.php index f3b16548d..5160d9662 100644 --- a/lib/uapplugin.php +++ b/lib/uapplugin.php @@ -22,6 +22,7 @@ * @category Action * @package StatusNet * @author Sarven Capadisli + * @author Evan Prodromou * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ @@ -32,145 +33,155 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { } /** + * Abstract superclass for advertising plugins + * + * Plugins for showing ads should derive from this plugin. + * * Outputs the following ad types (based on UAP): + * * Medium Rectangle 300x250 * Rectangle 180x150 * Leaderboard 728x90 * Wide Skyscraper 160x600 * - * Any number of ad types can be used. Enable all using example: - * addPlugin('UAP', array( - * 'MediumRectangle' => '', - * 'Rectangle' => '', - * 'Leaderboard' => '', - * 'WideSkyscraper' => '' - * ) - * ); - * * @category Plugin * @package StatusNet * @author Sarven Capadisli + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -class UAPPlugin extends Plugin +abstract class UAPPlugin extends Plugin { public $MediumRectangle = null; - public $Rectangle = null; - public $Leaderboard = null; - public $WideSkyscraper = null; - - function __construct($uap = array()) - { - $this->uap = $uap; - - parent::__construct(); - } - - function onInitializePlugin() - { - foreach($this->uap as $key => $value) { - switch(strtolower($key)) { - case 'mediumrectangle': default: - $this->MediumRectangle = $value; - break; - case 'rectangle': - $this->Rectangle = $value; - break; - case 'leaderboard': - $this->Leaderboard = $value; - break; - case 'wideskyscraper': - $this->WideSkyscraper = $value; - break; - } - } - } + public $Rectangle = null; + public $Leaderboard = null; + public $WideSkyscraper = null; + + /** + * Output our dedicated stylesheet + * + * @param Action $action Action being shown + * + * @return boolean hook flag + */ function onEndShowStatusNetStyles($action) { - $action->cssLink(common_path('plugins/UAP/uap.css'), - null, 'screen, projection, tv'); + // XXX: allow override by theme + $action->cssLink('css/uap.css', 'base', 'screen, projection, tv'); return true; } - //MediumRectangle ad + /** + * Add a medium rectangle ad at the beginning of sidebar + * + * @param Action $action Action being shown + * + * @return boolean hook flag + */ + function onStartShowAside($action) { - if (!$this->MediumRectangle) { - return true; - } + if (!is_null($this->mediumRectangle)) { - $this->showAd($action, array('id' => 'ad_medium-rectangle'), - $this->MediumRectangle); + $action->elementStart('div', + array('class' => 'ad_medium-rectangle ad')); - return true; - } + $this->showMediumRectangle($action); -/* - //Rectangle ad - function onEndShowSiteNotice($action) - { - if (!$this->Rectangle) { - return true; + $action->elementEnd('div'); } - $this->showAd($action, array('id' => 'ad_rectangle'), - $this->Rectangle); - return true; } -*/ - //Leaderboard and Rectangle ad + /** + * Add a leaderboard and/or rectangle in the header + * + * @param Action $action Action being shown + * + * @return boolean hook flag + */ + function onStartShowHeader($action) { - if ($this->Leaderboard) { - $this->showAd($action, array('id' => 'ad_leaderboard'), - $this->Leaderboard); + if (!is_null($this->leaderboard)) { + $action->elementStart('div', + array('class' => 'ad_leaderboard ad')); + $this->showLeaderboard($action); + $action->elementEnd('div'); } - if ($this->Rectangle) { - $this->showAd($action, array('id' => 'ad_rectangle'), - $this->Rectangle); + if (!is_null($this->rectangle)) { + $action->elementStart('div', + array('class' => 'ad_rectangle ad')); + $this->showRectangle($action); + $action->elementEnd('div'); } return true; } - //WideSkyscraper ad + /** + * Add a wide skyscraper after the aside + * + * @param Action $action Action being shown + * + * @return boolean hook flag + */ + function onEndShowAside($action) { - if (!$this->WideSkyscraper) { - return true; - } + if (!is_null($this->wideSkyscraper)) { + $action->elementStart('div', + array('class' => 'ad_wide-skyscraper ad')); - $this->showAd($action, array('id' => 'ad_wide-skyscraper'), - $this->WideSkyscraper); + $this->showWideSkyscraper($action); + $action->elementEnd('div'); + } return true; } - //Output ad container - function showAd($action, $attr=array(), $value) - { - $classes = ($attr['class']) ? $attr['class'].' ' : ''; - - $action->elementStart('div', array('id' => $attr['id'], - 'class' => $classes.'ad')); - $action->raw($value); - $action->elementEnd('div'); - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'UAP', - 'version' => STATUSNET_VERSION, - 'author' => 'Sarven Capadisli', - 'homepage' => 'http://status.net/wiki/Plugin:UAP', - 'rawdescription' => - _m('Outputs ad placements based on Universal Ad Package')); - return true; - } + /** + * Show a medium rectangle ad + * + * @param Action $action Action being shown + * + * @return void + */ + + abstract protected function showMediumRectangle($action); + + /** + * Show a rectangle ad + * + * @param Action $action Action being shown + * + * @return void + */ + + abstract protected function showRectangle($action); + + /** + * Show a wide skyscraper ad + * + * @param Action $action Action being shown + * + * @return void + */ + + abstract protected function showWideSkyscraper($action); + + /** + * Show a leaderboard ad + * + * @param Action $action Action being shown + * + * @return void + */ + + abstract protected function showLeaderboard($action); } -- cgit v1.2.3-54-g00ecf From 9decd9806c675ce820a1443507846ba9c57ec72b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 07:26:32 -0500 Subject: Add BlankAdPlugin to test ad layout in different themes --- plugins/BlankAdPlugin.php | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 plugins/BlankAdPlugin.php diff --git a/plugins/BlankAdPlugin.php b/plugins/BlankAdPlugin.php new file mode 100644 index 000000000..bf3a225c0 --- /dev/null +++ b/plugins/BlankAdPlugin.php @@ -0,0 +1,121 @@ +. + * + * @category Ads + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin for testing ad layout + * + * This plugin uses the UAPPlugin framework to output ad content. However, + * its ad content is just paragraphs with defined background colors. It's + * mostly useful for debugging theme layout. + * + * To use this plugin, set the parameter for the ad size you want to use + * to the background you want to use. For example, to make a leaderboard + * that's red: + * + * addPlugin('BlankAd', array('leaderboard' => 'red')); + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso Location + */ + +class BlankAdPlugin extends UAPPlugin +{ + /** + * Show a medium rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showMediumRectangle($action) + { + $style = 'width: 300px; height: 250px; background-color: ' . + $this->mediumRectangle; + + $action->element('p', array('style' => $style), ''); + } + + /** + * Show a rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showRectangle($action) + { + $style = 'width: 180px; height: 150px; background-color: ' . + $this->rectangle; + + $action->element('p', array('style' => $style), ''); + } + + /** + * Show a wide skyscraper ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showWideSkyscraper($action) + { + $style = 'width: 160px; height: 600px; background-color: ' . + $this->wideSkyscraper; + + $action->element('p', array('style' => $style), ''); + } + + /** + * Show a leaderboard ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showLeaderboard($action) + { + $style = 'width: 728px; height: 90px; background-color: ' . + $this->leaderboard; + + $action->element('p', array('style' => $style), ''); + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From b412ebab11e4ef55bc06b6ea5dfe11fd66614f50 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 07:34:31 -0500 Subject: move BlankAdPlugin to its own dir --- plugins/BlankAd/BlankAdPlugin.php | 121 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 plugins/BlankAd/BlankAdPlugin.php diff --git a/plugins/BlankAd/BlankAdPlugin.php b/plugins/BlankAd/BlankAdPlugin.php new file mode 100644 index 000000000..bf3a225c0 --- /dev/null +++ b/plugins/BlankAd/BlankAdPlugin.php @@ -0,0 +1,121 @@ +. + * + * @category Ads + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin for testing ad layout + * + * This plugin uses the UAPPlugin framework to output ad content. However, + * its ad content is just paragraphs with defined background colors. It's + * mostly useful for debugging theme layout. + * + * To use this plugin, set the parameter for the ad size you want to use + * to the background you want to use. For example, to make a leaderboard + * that's red: + * + * addPlugin('BlankAd', array('leaderboard' => 'red')); + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso Location + */ + +class BlankAdPlugin extends UAPPlugin +{ + /** + * Show a medium rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showMediumRectangle($action) + { + $style = 'width: 300px; height: 250px; background-color: ' . + $this->mediumRectangle; + + $action->element('p', array('style' => $style), ''); + } + + /** + * Show a rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showRectangle($action) + { + $style = 'width: 180px; height: 150px; background-color: ' . + $this->rectangle; + + $action->element('p', array('style' => $style), ''); + } + + /** + * Show a wide skyscraper ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showWideSkyscraper($action) + { + $style = 'width: 160px; height: 600px; background-color: ' . + $this->wideSkyscraper; + + $action->element('p', array('style' => $style), ''); + } + + /** + * Show a leaderboard ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showLeaderboard($action) + { + $style = 'width: 728px; height: 90px; background-color: ' . + $this->leaderboard; + + $action->element('p', array('style' => $style), ''); + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From b2b95bd21fa3995b77af5096da80d52bf6938c3b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 07:41:12 -0500 Subject: make BlankAd dir and change to use a 1x1 image --- plugins/BlankAd/redpixel.png | Bin 0 -> 159 bytes plugins/BlankAdPlugin.php | 121 ------------------------------------------- 2 files changed, 121 deletions(-) create mode 100644 plugins/BlankAd/redpixel.png delete mode 100644 plugins/BlankAdPlugin.php diff --git a/plugins/BlankAd/redpixel.png b/plugins/BlankAd/redpixel.png new file mode 100644 index 000000000..26299a552 Binary files /dev/null and b/plugins/BlankAd/redpixel.png differ diff --git a/plugins/BlankAdPlugin.php b/plugins/BlankAdPlugin.php deleted file mode 100644 index bf3a225c0..000000000 --- a/plugins/BlankAdPlugin.php +++ /dev/null @@ -1,121 +0,0 @@ -. - * - * @category Ads - * @package StatusNet - * @author Evan Prodromou - * @copyright 2010 StatusNet Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin for testing ad layout - * - * This plugin uses the UAPPlugin framework to output ad content. However, - * its ad content is just paragraphs with defined background colors. It's - * mostly useful for debugging theme layout. - * - * To use this plugin, set the parameter for the ad size you want to use - * to the background you want to use. For example, to make a leaderboard - * that's red: - * - * addPlugin('BlankAd', array('leaderboard' => 'red')); - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @seeAlso Location - */ - -class BlankAdPlugin extends UAPPlugin -{ - /** - * Show a medium rectangle 'ad' - * - * @param Action $action Action being shown - * - * @return void - */ - - protected function showMediumRectangle($action) - { - $style = 'width: 300px; height: 250px; background-color: ' . - $this->mediumRectangle; - - $action->element('p', array('style' => $style), ''); - } - - /** - * Show a rectangle 'ad' - * - * @param Action $action Action being shown - * - * @return void - */ - - protected function showRectangle($action) - { - $style = 'width: 180px; height: 150px; background-color: ' . - $this->rectangle; - - $action->element('p', array('style' => $style), ''); - } - - /** - * Show a wide skyscraper ad - * - * @param Action $action Action being shown - * - * @return void - */ - - protected function showWideSkyscraper($action) - { - $style = 'width: 160px; height: 600px; background-color: ' . - $this->wideSkyscraper; - - $action->element('p', array('style' => $style), ''); - } - - /** - * Show a leaderboard ad - * - * @param Action $action Action being shown - * - * @return void - */ - - protected function showLeaderboard($action) - { - $style = 'width: 728px; height: 90px; background-color: ' . - $this->leaderboard; - - $action->element('p', array('style' => $style), ''); - } -} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From e4393ee6dbcfbcf660d898dd1eb5fe91c4e3b80d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 07:51:25 -0500 Subject: Add the moved BlankAdPlugin --- plugins/BlankAd/BlankAdPlugin.php | 45 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/plugins/BlankAd/BlankAdPlugin.php b/plugins/BlankAd/BlankAdPlugin.php index bf3a225c0..5f46ddd48 100644 --- a/plugins/BlankAd/BlankAdPlugin.php +++ b/plugins/BlankAd/BlankAdPlugin.php @@ -35,14 +35,13 @@ if (!defined('STATUSNET')) { * Plugin for testing ad layout * * This plugin uses the UAPPlugin framework to output ad content. However, - * its ad content is just paragraphs with defined background colors. It's - * mostly useful for debugging theme layout. + * its ad content is just images with one red pixel stretched to the + * right size. It's mostly useful for debugging theme layout. * * To use this plugin, set the parameter for the ad size you want to use - * to the background you want to use. For example, to make a leaderboard - * that's red: + * to true (or anything non-null). For example, to make a leaderboard: * - * addPlugin('BlankAd', array('leaderboard' => 'red')); + * addPlugin('BlankAd', array('leaderboard' => true)); * * @category Plugin * @package StatusNet @@ -65,10 +64,11 @@ class BlankAdPlugin extends UAPPlugin protected function showMediumRectangle($action) { - $style = 'width: 300px; height: 250px; background-color: ' . - $this->mediumRectangle; - - $action->element('p', array('style' => $style), ''); + $action->element('img', + array('width' => 300, + 'height' => 250, + 'src' => common_path('plugins/BlankAd/redpixel.png')), + ''); } /** @@ -81,10 +81,11 @@ class BlankAdPlugin extends UAPPlugin protected function showRectangle($action) { - $style = 'width: 180px; height: 150px; background-color: ' . - $this->rectangle; - - $action->element('p', array('style' => $style), ''); + $action->element('img', + array('width' => 180, + 'height' => 50, + 'src' => common_path('plugins/BlankAd/redpixel.png')), + ''); } /** @@ -97,10 +98,11 @@ class BlankAdPlugin extends UAPPlugin protected function showWideSkyscraper($action) { - $style = 'width: 160px; height: 600px; background-color: ' . - $this->wideSkyscraper; - - $action->element('p', array('style' => $style), ''); + $action->element('img', + array('width' => 160, + 'height' => 600, + 'src' => common_path('plugins/BlankAd/redpixel.png')), + ''); } /** @@ -113,9 +115,10 @@ class BlankAdPlugin extends UAPPlugin protected function showLeaderboard($action) { - $style = 'width: 728px; height: 90px; background-color: ' . - $this->leaderboard; - - $action->element('p', array('style' => $style), ''); + $action->element('img', + array('width' => 728, + 'height' => 90, + 'src' => common_path('plugins/BlankAd/redpixel.png')), + ''); } } \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 4ad931ad38f1eba1f5b00a923854544dcb4aa0d6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 08:13:05 -0500 Subject: wrong height for rectangle in BlankAd --- plugins/BlankAd/BlankAdPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/BlankAd/BlankAdPlugin.php b/plugins/BlankAd/BlankAdPlugin.php index 5f46ddd48..0e2719aed 100644 --- a/plugins/BlankAd/BlankAdPlugin.php +++ b/plugins/BlankAd/BlankAdPlugin.php @@ -83,7 +83,7 @@ class BlankAdPlugin extends UAPPlugin { $action->element('img', array('width' => 180, - 'height' => 50, + 'height' => 150, 'src' => common_path('plugins/BlankAd/redpixel.png')), ''); } -- cgit v1.2.3-54-g00ecf From e9feafc3ca4641bf5c51bbced3454962ed89b8ef Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 08:13:24 -0500 Subject: CSS ids and classes fixed in UAPPlugin --- lib/uapplugin.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/uapplugin.php b/lib/uapplugin.php index 5160d9662..4364b1e19 100644 --- a/lib/uapplugin.php +++ b/lib/uapplugin.php @@ -87,7 +87,8 @@ abstract class UAPPlugin extends Plugin if (!is_null($this->mediumRectangle)) { $action->elementStart('div', - array('class' => 'ad_medium-rectangle ad')); + array('id' => 'ad_medium-rectangle', + 'class' => 'ad')); $this->showMediumRectangle($action); @@ -109,14 +110,16 @@ abstract class UAPPlugin extends Plugin { if (!is_null($this->leaderboard)) { $action->elementStart('div', - array('class' => 'ad_leaderboard ad')); + array('id' => 'ad_leaderboard', + 'class' => 'ad')); $this->showLeaderboard($action); $action->elementEnd('div'); } if (!is_null($this->rectangle)) { $action->elementStart('div', - array('class' => 'ad_rectangle ad')); + array('id' => 'ad_rectangle', + 'class' => 'ad')); $this->showRectangle($action); $action->elementEnd('div'); } @@ -136,7 +139,8 @@ abstract class UAPPlugin extends Plugin { if (!is_null($this->wideSkyscraper)) { $action->elementStart('div', - array('class' => 'ad_wide-skyscraper ad')); + array('id' => 'ad_wide-skyscraper', + 'class' => 'ad')); $this->showWideSkyscraper($action); -- cgit v1.2.3-54-g00ecf From e3bd97bfe46ee7d063a45eec282b28faee1ca83f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 27 Jan 2010 15:14:00 +0100 Subject: Aligning wide skyscraper to the right instead of left --- theme/base/css/uap.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/theme/base/css/uap.css b/theme/base/css/uap.css index 90abe5180..b95e9b2ce 100644 --- a/theme/base/css/uap.css +++ b/theme/base/css/uap.css @@ -45,6 +45,7 @@ clear:both; width:160px; height:600px; +float:right; margin-top:18px; -margin-left:8.5%; +margin-right:8.25%; } -- cgit v1.2.3-54-g00ecf From 1c875a53952506ca95716992511421d110a37d4d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 27 Jan 2010 15:32:59 +0100 Subject: Moved rectangle ad into aside and leaderboard to the right in header. Intention for this layout was to reduce whitespace in header area --- lib/uapplugin.php | 15 ++++++++++++++- theme/base/css/uap.css | 9 ++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/uapplugin.php b/lib/uapplugin.php index 4364b1e19..69b68f936 100644 --- a/lib/uapplugin.php +++ b/lib/uapplugin.php @@ -99,7 +99,7 @@ abstract class UAPPlugin extends Plugin } /** - * Add a leaderboard and/or rectangle in the header + * Add a leaderboard in the header * * @param Action $action Action being shown * @@ -116,6 +116,19 @@ abstract class UAPPlugin extends Plugin $action->elementEnd('div'); } + return true; + } + + /** + * Add a rectangle before aside sections + * + * @param Action $action Action being shown + * + * @return boolean hook flag + */ + + function onStartShowSections($action) + { if (!is_null($this->rectangle)) { $action->elementStart('div', array('id' => 'ad_rectangle', diff --git a/theme/base/css/uap.css b/theme/base/css/uap.css index b95e9b2ce..d7fa02c7f 100644 --- a/theme/base/css/uap.css +++ b/theme/base/css/uap.css @@ -29,15 +29,18 @@ margin-bottom:18px; width:180px; height:150px; -float:right; -margin-right:18px; +float:none; +clear:both; +margin:0 auto; +margin-bottom:29px; } #ad_leaderboard { width:728px; height:90px; -margin:29px 18px 0 0; +margin:11px 18px 0 0; +float:right; clear:both; } -- cgit v1.2.3-54-g00ecf From ea123800e991352d862c05a2f81e82ef53e72eeb Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 10:44:49 -0500 Subject: move leaderboard to after the header --- lib/uapplugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uapplugin.php b/lib/uapplugin.php index 69b68f936..e3801f08a 100644 --- a/lib/uapplugin.php +++ b/lib/uapplugin.php @@ -106,7 +106,7 @@ abstract class UAPPlugin extends Plugin * @return boolean hook flag */ - function onStartShowHeader($action) + function onEndShowHeader($action) { if (!is_null($this->leaderboard)) { $action->elementStart('div', -- cgit v1.2.3-54-g00ecf From 760be76fc000c546ac38e96fa1cc5f822b7e6993 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 10:45:44 -0500 Subject: camelcase the uap param names --- lib/uapplugin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/uapplugin.php b/lib/uapplugin.php index e3801f08a..ef35bafbf 100644 --- a/lib/uapplugin.php +++ b/lib/uapplugin.php @@ -54,10 +54,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { abstract class UAPPlugin extends Plugin { - public $MediumRectangle = null; - public $Rectangle = null; - public $Leaderboard = null; - public $WideSkyscraper = null; + public $mediumRectangle = null; + public $rectangle = null; + public $leaderboard = null; + public $wideSkyscraper = null; /** * Output our dedicated stylesheet -- cgit v1.2.3-54-g00ecf From 5e31ecd82aaf102382380b1352503303893cf9ba Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 27 Jan 2010 16:52:18 +0100 Subject: Centred leaderboard ad --- theme/base/css/uap.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/theme/base/css/uap.css b/theme/base/css/uap.css index d7fa02c7f..73be5f0c1 100644 --- a/theme/base/css/uap.css +++ b/theme/base/css/uap.css @@ -39,8 +39,8 @@ margin-bottom:29px; width:728px; height:90px; -margin:11px 18px 0 0; -float:right; +margin:0 auto 18px; +float:none; clear:both; } -- cgit v1.2.3-54-g00ecf From 47645228da4a9af8ffb0dc1f11c1da995f4791cb Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 13:58:55 -0800 Subject: Add new oauth tables and modifications to 'consumer' table for rc4 --- db/rc3to09.sql | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/db/rc3to09.sql b/db/rc3to09.sql index 02dc7a6e2..8342c4bc6 100644 --- a/db/rc3to09.sql +++ b/db/rc3to09.sql @@ -14,3 +14,35 @@ insert into queue_item_new (frame,transport,created,claimed) alter table queue_item rename to queue_item_old; alter table queue_item_new rename to queue_item; +alter table consumer + add consumer_secret varchar(255) not null comment 'secret value', + add verifier varchar(255) comment 'verifier string for OAuth 1.0a', + add verified_callback varchar(255) comment 'verified callback URL for OAuth 1.0a'; + +create table oauth_application ( + id integer auto_increment primary key comment 'unique identifier', + owner integer not null comment 'owner of the application' references profile (id), + consumer_key varchar(255) not null comment 'application consumer key' references consumer (consumer_key), + name varchar(255) not null comment 'name of the application', + description varchar(255) comment 'description of the application', + icon varchar(255) not null comment 'application icon', + source_url varchar(255) comment 'application homepage - used for source link', + organization varchar(255) comment 'name of the organization running the application', + homepage varchar(255) comment 'homepage for the organization', + callback_url varchar(255) comment 'url to redirect to after authentication', + type tinyint default 0 comment 'type of app, 1 = browser, 2 = desktop', + access_type tinyint default 0 comment 'default access type, bit 1 = read, bit 2 = write', + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified' +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table oauth_application_user ( + profile_id integer not null comment 'user of the application' references profile (id), + application_id integer not null comment 'id of the application' references oauth_application (id), + access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write, bit 3 = revoked', + token varchar(255) comment 'request or access token', + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified', + constraint primary key (profile_id, application_id) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + -- cgit v1.2.3-54-g00ecf From 9a54745fcd252e27cc664da7cee67b48d0f4f501 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 13:59:58 -0800 Subject: Rename rc3to09.sql to rc3torc4.sql to avoid confusion if we add a last-minute change after this! --- db/rc3to09.sql | 48 ------------------------------------------------ db/rc3torc4.sql | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 db/rc3to09.sql create mode 100644 db/rc3torc4.sql diff --git a/db/rc3to09.sql b/db/rc3to09.sql deleted file mode 100644 index 8342c4bc6..000000000 --- a/db/rc3to09.sql +++ /dev/null @@ -1,48 +0,0 @@ -create table queue_item_new ( - id integer auto_increment primary key comment 'unique identifier', - frame blob not null comment 'data: object reference or opaque string', - transport varchar(8) not null comment 'queue for what? "email", "jabber", "sms", "irc", ...', - created datetime not null comment 'date this record was created', - claimed datetime comment 'date this item was claimed', - - index queue_item_created_idx (created) - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - -insert into queue_item_new (frame,transport,created,claimed) - select notice_id,transport,created,claimed from queue_item; -alter table queue_item rename to queue_item_old; -alter table queue_item_new rename to queue_item; - -alter table consumer - add consumer_secret varchar(255) not null comment 'secret value', - add verifier varchar(255) comment 'verifier string for OAuth 1.0a', - add verified_callback varchar(255) comment 'verified callback URL for OAuth 1.0a'; - -create table oauth_application ( - id integer auto_increment primary key comment 'unique identifier', - owner integer not null comment 'owner of the application' references profile (id), - consumer_key varchar(255) not null comment 'application consumer key' references consumer (consumer_key), - name varchar(255) not null comment 'name of the application', - description varchar(255) comment 'description of the application', - icon varchar(255) not null comment 'application icon', - source_url varchar(255) comment 'application homepage - used for source link', - organization varchar(255) comment 'name of the organization running the application', - homepage varchar(255) comment 'homepage for the organization', - callback_url varchar(255) comment 'url to redirect to after authentication', - type tinyint default 0 comment 'type of app, 1 = browser, 2 = desktop', - access_type tinyint default 0 comment 'default access type, bit 1 = read, bit 2 = write', - created datetime not null comment 'date this record was created', - modified timestamp comment 'date this record was modified' -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - -create table oauth_application_user ( - profile_id integer not null comment 'user of the application' references profile (id), - application_id integer not null comment 'id of the application' references oauth_application (id), - access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write, bit 3 = revoked', - token varchar(255) comment 'request or access token', - created datetime not null comment 'date this record was created', - modified timestamp comment 'date this record was modified', - constraint primary key (profile_id, application_id) -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - diff --git a/db/rc3torc4.sql b/db/rc3torc4.sql new file mode 100644 index 000000000..8342c4bc6 --- /dev/null +++ b/db/rc3torc4.sql @@ -0,0 +1,48 @@ +create table queue_item_new ( + id integer auto_increment primary key comment 'unique identifier', + frame blob not null comment 'data: object reference or opaque string', + transport varchar(8) not null comment 'queue for what? "email", "jabber", "sms", "irc", ...', + created datetime not null comment 'date this record was created', + claimed datetime comment 'date this item was claimed', + + index queue_item_created_idx (created) + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +insert into queue_item_new (frame,transport,created,claimed) + select notice_id,transport,created,claimed from queue_item; +alter table queue_item rename to queue_item_old; +alter table queue_item_new rename to queue_item; + +alter table consumer + add consumer_secret varchar(255) not null comment 'secret value', + add verifier varchar(255) comment 'verifier string for OAuth 1.0a', + add verified_callback varchar(255) comment 'verified callback URL for OAuth 1.0a'; + +create table oauth_application ( + id integer auto_increment primary key comment 'unique identifier', + owner integer not null comment 'owner of the application' references profile (id), + consumer_key varchar(255) not null comment 'application consumer key' references consumer (consumer_key), + name varchar(255) not null comment 'name of the application', + description varchar(255) comment 'description of the application', + icon varchar(255) not null comment 'application icon', + source_url varchar(255) comment 'application homepage - used for source link', + organization varchar(255) comment 'name of the organization running the application', + homepage varchar(255) comment 'homepage for the organization', + callback_url varchar(255) comment 'url to redirect to after authentication', + type tinyint default 0 comment 'type of app, 1 = browser, 2 = desktop', + access_type tinyint default 0 comment 'default access type, bit 1 = read, bit 2 = write', + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified' +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table oauth_application_user ( + profile_id integer not null comment 'user of the application' references profile (id), + application_id integer not null comment 'id of the application' references oauth_application (id), + access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write, bit 3 = revoked', + token varchar(255) comment 'request or access token', + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified', + constraint primary key (profile_id, application_id) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + -- cgit v1.2.3-54-g00ecf From b0a325f7d0418575cdb46b7074c4cd2317f04980 Mon Sep 17 00:00:00 2001 From: Michele Date: Sun, 17 Jan 2010 11:21:07 +0100 Subject: HTTP auth provided is evaluated even if it's not required --- lib/apiauth.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/apiauth.php b/lib/apiauth.php index ad9651ff2..ac5e997c7 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -84,16 +84,22 @@ class ApiAuthAction extends ApiAction } else { $this->checkBasicAuthUser(); } + } else { - // Reject API calls with the wrong access level + // Check to see if a basic auth user is there even + // if one's not required - if ($this->isReadOnly($args) == false) { - if ($this->access != self::READ_WRITE) { - $msg = 'API resource requires read-write access, ' . - 'but you only have read access.'; - $this->clientError($msg, 401, $this->format); - exit(); - } + $this->checkBasicAuthUser(false); + } + + // Reject API calls with the wrong access level + + if ($this->isReadOnly($args) == false) { + if ($this->access != self::READ_WRITE) { + $msg = 'API resource requires read-write access, ' . + 'but you only have read access.'; + $this->clientError($msg, 401, $this->format); + exit; } } @@ -206,13 +212,13 @@ class ApiAuthAction extends ApiAction * @return boolean true or false */ - function checkBasicAuthUser() + function checkBasicAuthUser($required = true) { $this->basicAuthProcessHeader(); $realm = common_config('site', 'name') . ' API'; - if (!isset($this->auth_user_nickname)) { + if (!isset($this->auth_user_nickname) && $required) { header('WWW-Authenticate: Basic realm="' . $realm . '"'); // show error if the user clicks 'cancel' @@ -222,11 +228,10 @@ class ApiAuthAction extends ApiAction } else { - $user = common_check_user($this->auth_user_nickname, - $this->auth_user_password); - if (Event::handle('StartSetApiUser', array(&$user))) { - $this->auth_user = $user; + $this->auth_user = common_check_user($this->auth_user_nickname, + $this->auth_user_password); + Event::handle('EndSetApiUser', array($user)); } -- cgit v1.2.3-54-g00ecf From 00d9b215f4de97f94035880041179879fcf0d201 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 17:29:36 -0500 Subject: Plugin to support Google Adsense A plugin to easily add Google Adsense blocks to a StatusNet site. --- plugins/Adsense/AdsensePlugin.php | 160 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 plugins/Adsense/AdsensePlugin.php diff --git a/plugins/Adsense/AdsensePlugin.php b/plugins/Adsense/AdsensePlugin.php new file mode 100644 index 000000000..dc2b32bc8 --- /dev/null +++ b/plugins/Adsense/AdsensePlugin.php @@ -0,0 +1,160 @@ +. + * + * @category Ads + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to add Google Adsense to StatusNet sites + * + * This plugin lets you add Adsense ad units to your StatusNet site. + * + * We support the 4 ad sizes for the Universal Ad Platform (UAP): + * + * Medium Rectangle + * (Small) Rectangle + * Leaderboard + * Wide Skyscraper + * + * They fit in different places on the default theme. Some themes + * might interact quite poorly with this plugin. + * + * To enable advertising, you must sign up with Google Adsense and + * get a client ID. + * + * https://www.google.com/adsense/ + * + * You'll also need to create an Adsense for Content unit in one + * of the four sizes described above. At the end of the process, + * note the "google_ad_client" and "google_ad_slot" values in the + * resultant Javascript. + * + * Add the plugin to config.php like so: + * + * addPlugin('Adsense', array('client' => 'Your client ID', + * 'rectangle' => 'slot')); + * + * Here, your client ID is the value of google_ad_client and the + * slot is the value of google_ad_slot. Note that if you create + * a different size, you'll need to provide different arguments: + * 'mediumRectangle', 'leaderboard', or 'wideSkyscraper'. + * + * If for some reason your ad server is different from the default, + * use the 'adScript' parameter to set the full path to the ad script. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso UAPPlugin + */ + +class AdsensePlugin extends UAPPlugin +{ + public $adScript = 'http://pagead2.googlesyndication.com/pagead/show_ads.js'; + public $client = null; + + /** + * Show a medium rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showMediumRectangle($action) + { + $this->showAdsenseCode($action, 300, 250, $this->mediumRectangle); + } + + /** + * Show a rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showRectangle($action) + { + $this->showAdsenseCode($action, 180, 150, $this->rectangle); + } + + /** + * Show a wide skyscraper ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showWideSkyscraper($action) + { + $this->showAdsenseCode($action, 160, 600, $this->wideSkyscraper); + } + + /** + * Show a leaderboard ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showLeaderboard($action) + { + $this->showAdsenseCode($action, 728, 90, $this->leaderboard); + } + + /** + * Output the bits of JavaScript code to show Adsense + * + * @param Action $action Action being shown + * @param integer $width Width of the block + * @param integer $height Height of the block + * @param string $slot Slot identifier + * + * @return void + */ + + protected function showAdsenseCode($action, $width, $height, $slot) + { + $code = 'google_ad_client = "'.$this->client.'"; '; + $code .= 'google_ad_slot = "'.$slot.'"; '; + $code .= 'google_ad_width = "'.$width.'"; '; + $code .= 'google_ad_height = "'.$height.'"; '; + + $action->inlineScript($code); + + $action->script($this->adScript); + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 2aba2eeeaf78f4e407abe23643ff6027b0ea53dd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 17:55:33 -0500 Subject: width and height should be integers in AdsensePlugin --- plugins/Adsense/AdsensePlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Adsense/AdsensePlugin.php b/plugins/Adsense/AdsensePlugin.php index dc2b32bc8..ab2b9a6fb 100644 --- a/plugins/Adsense/AdsensePlugin.php +++ b/plugins/Adsense/AdsensePlugin.php @@ -150,8 +150,8 @@ class AdsensePlugin extends UAPPlugin { $code = 'google_ad_client = "'.$this->client.'"; '; $code .= 'google_ad_slot = "'.$slot.'"; '; - $code .= 'google_ad_width = "'.$width.'"; '; - $code .= 'google_ad_height = "'.$height.'"; '; + $code .= 'google_ad_width = '.$width.'; '; + $code .= 'google_ad_height = '.$height.'; '; $action->inlineScript($code); -- cgit v1.2.3-54-g00ecf From 06cd3358970bfc27ff027cd1d8dc6974950c3793 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 10:08:24 -0800 Subject: Add scripts/sendemail.php to send email to a user's address. Updated setup_status_network.sh to create a user with the site's nick, accept site tags, and send a mail to the user (if a template is set) Email and tag params added to the end: setup_status_net.sh mysite 'My Site' 'owner@example.com' '1user' (If multiple tags are needed, separate them with a pipe "|". Be sure to quote properly!) New parameters for setup.cfg need to be set: export PHPBASE=/var/www/statusnet export WILDCARD=example.net export MAILTEMPLATE=/etc/statusnet/newsite-mail.txt export MAILSUBJECT="Your new StatusNet site" $PHPBASE is the base dir for a callable StatusNet install, used to run command-line scripts for user setup. $WILDCARD is the wildcard domain, needed to build a full server name to pass into command-line scripts. $MAILTEMPLATE points to a file containing an e-mail message template. '$nickname', '$sitename', and '$userpass' can be used in the template for substitution. $MAILSUBJECT is the subject line for said email. To skip sending an email on creation, leave $MAILTEMPLATE blank or point to a non-existing file. --- scripts/sendemail.php | 82 +++++++++++++++++++++++++++++++++++++++++ scripts/setup.cfg.sample | 5 ++- scripts/setup_status_network.sh | 50 +++++++++++++++++++++++-- 3 files changed, 132 insertions(+), 5 deletions(-) create mode 100755 scripts/sendemail.php diff --git a/scripts/sendemail.php b/scripts/sendemail.php new file mode 100755 index 000000000..436e085be --- /dev/null +++ b/scripts/sendemail.php @@ -0,0 +1,82 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i:n:'; +$longoptions = array('id=', 'nickname=', 'subject='); + +$helptext = << +Sends given email text to user. + + -i --id id of the user to query + -n --nickname nickname of the user to query + --subject mail subject line (required) + +END_OF_USEREMAIL_HELP; + +require_once INSTALLDIR.'/scripts/commandline.inc'; + +if (have_option('i', 'id')) { + $id = get_option_value('i', 'id'); + $user = User::staticGet('id', $id); + if (empty($user)) { + print "Can't find user with ID $id\n"; + exit(1); + } +} else if (have_option('n', 'nickname')) { + $nickname = get_option_value('n', 'nickname'); + $user = User::staticGet('nickname', $nickname); + if (empty($user)) { + print "Can't find user with nickname '$nickname'\n"; + exit(1); + } +} else { + print "You must provide a user by --id or --nickname\n"; + exit(1); +} + +if (empty($user->email)) { + // @fixme unconfirmed address? + print "No email registered for user '$user->nickname'\n"; + exit(1); +} + +if (!have_option('subject')) { + echo "You must provide a subject line for the mail in --subject='...' param.\n"; + exit(1); +} +$subject = get_option_value('subject'); + +if (posix_isatty(STDIN)) { + print "You must provide message input on stdin!\n"; + exit(1); +} +$body = file_get_contents('php://stdin'); + +print "Sending to $user->email..."; +if (mail_to_user($user, $subject, $body)) { + print " done\n"; +} else { + print " failed.\n"; + exit(1); +} + diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample index 8d03b06f5..a0f10b352 100644 --- a/scripts/setup.cfg.sample +++ b/scripts/setup.cfg.sample @@ -11,4 +11,7 @@ export AVATARBASE=/var/www/avatar.example.net export BACKGROUNDBASE=/var/www/background.example.net export FILEBASE=/var/www/file.example.net export PWDGEN="pwgen 20" - +export PHPBASE=/var/www/statusnet +export WILDCARD=example.net +export MAILTEMPLATE=/etc/statusnet/newsite-mail.txt +export MAILSUBJECT="Your new StatusNet site" diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index 777711fb5..d468df3ae 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -2,9 +2,22 @@ source /etc/statusnet/setup.cfg -export nickname=$1 -export sitename=$2 +# setup_status_net.sh mysite 'My Site' 'owner@example.com' '1user' +export nickname="$1" +export sitename="$2" +export email="$3" +export tags="$4" + +# Fixme: if this is changed later we need to update profile URLs +# for the created user. +export server="$nickname.$WILDCARD" + +# End-user info +export userpass=`$PWDGEN` +export roles="administrator moderator owner" + +# DB info export password=`$PWDGEN` export database=$nickname$DBBASE export username=$nickname$USERBASE @@ -21,8 +34,8 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password'; GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password'; -INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created) -VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now()); +INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created, tags) +VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now(), '$tags'); ENDOFCOMMANDS @@ -30,3 +43,32 @@ for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do mkdir $top/$nickname chmod a+w $top/$nickname done + +php $PHPBASE/scripts/registeruser.php \ + -s"$server" \ + -n"$nickname" \ + -w"$userpass" \ + -e"$email" + +for role in $roles +do + php $PHPBASE/scripts/userrole.php \ + -s"$server" \ + -n"$nickname" \ + -r"$role" +done + +if [ -f "$MAILTEMPLATE" ] +then + # fixme how safe is this? are sitenames sanitized? + cat $MAILTEMPLATE | \ + sed "s/\$nickname/$nickname/" | \ + sed "s/\$sitename/$sitename/" | \ + sed "s/\$userpass/$userpass/" | \ + php $PHPBASE/scripts/sendemail.php \ + -s"$server" \ + -n"$nickname" \ + --subject="$MAILSUBJECT" +else + echo "No mail template, not sending email." +fi -- cgit v1.2.3-54-g00ecf From 0373ab6fa437309ab790d5de4d43e241ba510c93 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 18:35:02 -0500 Subject: Plugin to enable OpenX ads --- plugins/OpenX/OpenXPlugin.php | 166 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 plugins/OpenX/OpenXPlugin.php diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php new file mode 100644 index 000000000..a0d02ec11 --- /dev/null +++ b/plugins/OpenX/OpenXPlugin.php @@ -0,0 +1,166 @@ +. + * + * @category Ads + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +$_OpenXPlugin_Script = <<<\/scr"+"ipt>"); +ENDOFSCRIPT; + +/** + * Plugin for OpenX Ad Server + * + * This plugin supports the OpenX ad server, http://www.openx.org/ + * + * We support the 4 ad sizes for the Universal Ad Platform (UAP): + * + * Medium Rectangle + * (Small) Rectangle + * Leaderboard + * Wide Skyscraper + * + * They fit in different places on the default theme. Some themes + * might interact quite poorly with this plugin. + * + * To enable advertising, you will need an OpenX server. You'll need + * to set up a "zone" for your StatusNet site that identifies a + * kind of ad you want to place (of the above 4 sizes). + * + * Add the plugin to config.php like so: + * + * addPlugin('OpenX', array('adScript' => 'full path to script', + * 'rectangle' => 1)); + * + * Here, the 'adScript' parameter is the full path to the OpenX + * ad script, like 'http://example.com/www/delivery/ajs.php'. Note + * that we don't do any magic to swap between HTTP and HTTPS, so + * if you want HTTPS, say so. + * + * The 'rectangle' parameter is the zone ID for that ad space on + * your site. If you've configured another size, try 'mediumRectangle', + * 'leaderboard', or 'wideSkyscraper'. + * + * If for some reason your ad server is different from the default, + * use the 'adScript' parameter to set the full path to the ad script. + * + * @category Ads + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso UAPPlugin + */ + +class OpenXPlugin extends UAPPlugin +{ + public $adScript = null; + + /** + * Show a medium rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showMediumRectangle($action) + { + $this->showAd($action, $this->mediumRectangle); + } + + /** + * Show a rectangle 'ad' + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showRectangle($action) + { + $this->showAd($action, $this->rectangle); + } + + /** + * Show a wide skyscraper ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showWideSkyscraper($action) + { + $this->showAd($action, $this->wideSkyscraper); + } + + /** + * Show a leaderboard ad + * + * @param Action $action Action being shown + * + * @return void + */ + + protected function showLeaderboard($action) + { + $this->showAd($action, $this->leaderboard); + } + + /** + * Show an ad using OpenX + * + * @param integer $zone Zone to show + * + * @return void + */ + + protected function showAd($zone) + { + global $_OpenXPlugin_Script; + + $this->inlineScript(sprintf($_OpenXPlugin_Script, $this->adScript, $zone)); + return true; + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From e7a5471287598902d4fefbb93f1247d8c025e66b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 15:37:18 -0800 Subject: add additional post-install shell script option for setup_status_network.sh to do any other site-specific setup --- scripts/setup.cfg.sample | 1 + scripts/setup_status_network.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample index a0f10b352..f247a3bca 100644 --- a/scripts/setup.cfg.sample +++ b/scripts/setup.cfg.sample @@ -15,3 +15,4 @@ export PHPBASE=/var/www/statusnet export WILDCARD=example.net export MAILTEMPLATE=/etc/statusnet/newsite-mail.txt export MAILSUBJECT="Your new StatusNet site" +export POSTINSTALL=/etc/statusnet/morestuff.sh diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index d468df3ae..ae392191f 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -72,3 +72,9 @@ then else echo "No mail template, not sending email." fi + +if [ -f "$POSTINSTALL" ] +then + echo "Running $POSTINSTALL ..." + source "$POSTINSTALL" +fi -- cgit v1.2.3-54-g00ecf From 97a1ef14d2bfd32ec14db57b56d861e9cad7d02d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 18:39:55 -0500 Subject: using an action for output in OpenX plugin --- plugins/OpenX/OpenXPlugin.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php index a0d02ec11..96ed82b44 100644 --- a/plugins/OpenX/OpenXPlugin.php +++ b/plugins/OpenX/OpenXPlugin.php @@ -151,16 +151,17 @@ class OpenXPlugin extends UAPPlugin /** * Show an ad using OpenX * - * @param integer $zone Zone to show + * @param Action $action Action being shown + * @param integer $zone Zone to show * * @return void */ - protected function showAd($zone) + protected function showAd($action, $zone) { global $_OpenXPlugin_Script; - $this->inlineScript(sprintf($_OpenXPlugin_Script, $this->adScript, $zone)); + $action->inlineScript(sprintf($_OpenXPlugin_Script, $this->adScript, $zone)); return true; } } \ No newline at end of file -- cgit v1.2.3-54-g00ecf From dd413ff4faeada13571711a0e4cc51e5ab25f7cc Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 18:44:46 -0500 Subject: move script into OpenXPlugin::showAd() so it works --- plugins/OpenX/OpenXPlugin.php | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php index 96ed82b44..59485f25d 100644 --- a/plugins/OpenX/OpenXPlugin.php +++ b/plugins/OpenX/OpenXPlugin.php @@ -31,22 +31,6 @@ if (!defined('STATUSNET')) { exit(1); } -$_OpenXPlugin_Script = <<<\/scr"+"ipt>"); -ENDOFSCRIPT; - /** * Plugin for OpenX Ad Server * @@ -159,9 +143,23 @@ class OpenXPlugin extends UAPPlugin protected function showAd($action, $zone) { - global $_OpenXPlugin_Script; +$scr = <<<\/scr"+"ipt>"); +ENDOFSCRIPT; - $action->inlineScript(sprintf($_OpenXPlugin_Script, $this->adScript, $zone)); + $action->inlineScript(sprintf($scr, $this->adScript, $zone)); return true; } } \ No newline at end of file -- cgit v1.2.3-54-g00ecf From fe531dfc6c9c700b5566db634a9078d4b4b87d87 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 16:03:01 -0800 Subject: Shuffle params on setup_status_network; adding fullname and pushing tags up --- scripts/setup_status_network.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index ae392191f..f502a169a 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -2,12 +2,13 @@ source /etc/statusnet/setup.cfg -# setup_status_net.sh mysite 'My Site' 'owner@example.com' '1user' +# setup_status_net.sh mysite 'My Site' '1user' 'owner@example.com' 'Firsty McLastname' export nickname="$1" export sitename="$2" -export email="$3" -export tags="$4" +export tags="$3" +export email="$4" +export fullname="$5" # Fixme: if this is changed later we need to update profile URLs # for the created user. @@ -47,6 +48,7 @@ done php $PHPBASE/scripts/registeruser.php \ -s"$server" \ -n"$nickname" \ + -f"$fullname" \ -w"$userpass" \ -e"$email" -- cgit v1.2.3-54-g00ecf From 420ae06faf033b799c677845045b50b259801dbd Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 28 Jan 2010 00:39:40 +0000 Subject: These API methods should return true for ->isReadOnly($args)! --- actions/apiaccountratelimitstatus.php | 17 ++++++++++++++++- actions/apifriendshipsexists.php | 15 +++++++++++++++ actions/apifriendshipsshow.php | 16 +++++++++++++++- actions/apigroupismember.php | 15 +++++++++++++++ actions/apigroupshow.php | 15 +++++++++++++++ actions/apihelptest.php | 15 +++++++++++++++ actions/apistatusnetconfig.php | 15 +++++++++++++++ actions/apistatusnetversion.php | 15 +++++++++++++++ actions/apiusershow.php | 15 +++++++++++++++ 9 files changed, 136 insertions(+), 2 deletions(-) diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php index 1a5afd552..f19e315bf 100644 --- a/actions/apiaccountratelimitstatus.php +++ b/actions/apiaccountratelimitstatus.php @@ -105,7 +105,22 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction print json_encode($out); } - $this->endDocument($this->format); + $this->endDocument($this->format); + } + + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; } } diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index c040b9f6a..ca62b5f51 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -116,4 +116,19 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction } } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php index 73ecc9249..f29e63713 100644 --- a/actions/apifriendshipsshow.php +++ b/actions/apifriendshipsshow.php @@ -87,7 +87,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction return true; } - /** * Determines whether this API resource requires auth. Overloaded to look * return true in case source_id and source_screen_name are both empty @@ -165,4 +164,19 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php index 69ead0b53..97f843561 100644 --- a/actions/apigroupismember.php +++ b/actions/apigroupismember.php @@ -119,4 +119,19 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction } } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 7aa49b1bf..95d6f95af 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -149,4 +149,19 @@ class ApiGroupShowAction extends ApiPrivateAuthAction return null; } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apihelptest.php b/actions/apihelptest.php index 7b4017531..d0e9e4926 100644 --- a/actions/apihelptest.php +++ b/actions/apihelptest.php @@ -92,5 +92,20 @@ class ApiHelpTestAction extends ApiPrivateAuthAction } } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php index ab96f2e5f..dc1ab8685 100644 --- a/actions/apistatusnetconfig.php +++ b/actions/apistatusnetconfig.php @@ -138,5 +138,20 @@ class ApiStatusnetConfigAction extends ApiAction } } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apistatusnetversion.php b/actions/apistatusnetversion.php index 5109cd806..d09480759 100644 --- a/actions/apistatusnetversion.php +++ b/actions/apistatusnetversion.php @@ -98,5 +98,20 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction } } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } diff --git a/actions/apiusershow.php b/actions/apiusershow.php index a7fe0dcc1..6c8fad49b 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -123,4 +123,19 @@ class ApiUserShowAction extends ApiPrivateAuthAction } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + } -- cgit v1.2.3-54-g00ecf From 324590c46eba2900164d0487a2d525ea4e9f93b8 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 28 Jan 2010 00:41:44 +0000 Subject: Some adjustments to the way API auth works after merging testing and 0.9.x --- lib/apiauth.php | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/apiauth.php b/lib/apiauth.php index ac5e997c7..d441014ad 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -57,7 +57,6 @@ class ApiAuthAction extends ApiAction var $auth_user_password = null; var $access_token = null; var $oauth_source = null; - var $auth_user = null; /** * Take arguments for running, and output basic auth header if needed @@ -82,22 +81,27 @@ class ApiAuthAction extends ApiAction if (!empty($this->access_token)) { $this->checkOAuthRequest(); } else { - $this->checkBasicAuthUser(); + $this->checkBasicAuthUser(true); } } else { // Check to see if a basic auth user is there even // if one's not required - $this->checkBasicAuthUser(false); + if (empty($this->access_token)) { + $this->checkBasicAuthUser(false); + } } // Reject API calls with the wrong access level if ($this->isReadOnly($args) == false) { + + common_debug(get_class($this) . ' is not read-only!'); + if ($this->access != self::READ_WRITE) { - $msg = 'API resource requires read-write access, ' . - 'but you only have read access.'; + $msg = _('API resource requires read-write access, ' . + 'but you only have read access.'); $this->clientError($msg, 401, $this->format); exit; } @@ -176,7 +180,7 @@ class ApiAuthAction extends ApiAction ($this->access = self::READ_WRITE) ? 'read-write' : 'read-only' )); - return true; + return; } else { throw new OAuthException('Bad access token.'); } @@ -228,9 +232,14 @@ class ApiAuthAction extends ApiAction } else { + $user = common_check_user($this->auth_user_nickname, + $this->auth_user_password); + if (Event::handle('StartSetApiUser', array(&$user))) { - $this->auth_user = common_check_user($this->auth_user_nickname, - $this->auth_user_password); + + if (!empty($user)) { + $this->auth_user = $user; + } Event::handle('EndSetApiUser', array($user)); } @@ -239,18 +248,18 @@ class ApiAuthAction extends ApiAction $this->access = self::READ_WRITE; - if (empty($this->auth_user)) { + if (empty($this->auth_user) && $required) { // basic authentication failed list($proxy, $ip) = common_client_ip(); - common_log( - LOG_WARNING, - 'Failed API auth attempt, nickname = ' . - "$nickname, proxy = $proxy, ip = $ip." - ); - + $msg = sprintf(_('Failed API auth attempt, nickname = %1$s, ' . + 'proxy = %2$s, ip = %3$s'), + $this->auth_user_nickname, + $proxy, + $ip); + common_log(LOG_WARNING, $msg); $this->showAuthError(); exit; } -- cgit v1.2.3-54-g00ecf From f296f04abdc545f03daf55676282a2ae7108f79e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 28 Jan 2010 01:24:40 +0000 Subject: Remove debugging statement --- lib/apiauth.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/apiauth.php b/lib/apiauth.php index d441014ad..c684a6cae 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -96,9 +96,6 @@ class ApiAuthAction extends ApiAction // Reject API calls with the wrong access level if ($this->isReadOnly($args) == false) { - - common_debug(get_class($this) . ' is not read-only!'); - if ($this->access != self::READ_WRITE) { $msg = _('API resource requires read-write access, ' . 'but you only have read access.'); -- cgit v1.2.3-54-g00ecf From 07d50a012af70d9bd35a26f645d791ae7ba29986 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 17:34:13 -0800 Subject: fix update script -- read the diff wrong and put a couple fields on wrong table (whoops) --- db/rc3torc4.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/rc3torc4.sql b/db/rc3torc4.sql index 8342c4bc6..917c1f1c4 100644 --- a/db/rc3torc4.sql +++ b/db/rc3torc4.sql @@ -15,7 +15,9 @@ alter table queue_item rename to queue_item_old; alter table queue_item_new rename to queue_item; alter table consumer - add consumer_secret varchar(255) not null comment 'secret value', + add consumer_secret varchar(255) not null comment 'secret value'; + +alter table token add verifier varchar(255) comment 'verifier string for OAuth 1.0a', add verified_callback varchar(255) comment 'verified callback URL for OAuth 1.0a'; -- cgit v1.2.3-54-g00ecf From 5182cc686dacfcf64130b591a3b7ded8d4a0c9dc Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 28 Jan 2010 01:39:18 +0000 Subject: Numbered format specifiers --- actions/apioauthauthorize.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index fa074c4e7..15c3a9dad 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -303,8 +303,9 @@ class ApiOauthAuthorizeAction extends ApiOauthAction $access = ($this->app->access_type & Oauth_application::$writeAccess) ? 'access and update' : 'access'; - $msg = _("The application %s by %s would like " . - "the ability to %s your account data."); + $msg = _('The application %1$s by ' . + '%2$s would like the ability ' . + 'to %3$s your account data.'); $this->raw(sprintf($msg, $this->app->name, -- cgit v1.2.3-54-g00ecf From 3abfb454a381806a0f237e1463d2ba9a8612c22a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 18:39:17 -0800 Subject: Adds an emergency switch so we can run inbox distribution at save time (bypassing 'distrib' queue) Set $config['queue']['inboxes'] = false to do so --- classes/Notice.php | 10 +++++++--- lib/default.php | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 0966697e2..6b364fb5c 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -326,9 +326,13 @@ class Notice extends Memcached_DataObject # XXX: someone clever could prepend instead of clearing the cache $notice->blowOnInsert(); - $qm = QueueManager::get(); - - $qm->enqueue($notice, 'distrib'); + if (common_config('queue', 'inboxes')) { + $qm = QueueManager::get(); + $qm->enqueue($notice, 'distrib'); + } else { + $handler = new DistribQueueHandler(); + $handler->handle($notice); + } return $notice; } diff --git a/lib/default.php b/lib/default.php index 10ea34864..c729193b5 100644 --- a/lib/default.php +++ b/lib/default.php @@ -87,6 +87,7 @@ $default = 'monitor' => null, // URL to monitor ping endpoint (work in progress) 'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully 'debug_memory' => false, // true to spit memory usage to log + 'inboxes' => true, // true to do inbox distribution & output queueing from in background via 'distrib' queue ), 'license' => array('type' => 'cc', # can be 'cc', 'allrightsreserved', 'private' -- cgit v1.2.3-54-g00ecf From c805a5e51874aa231c728c14402542648edb24bf Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jan 2010 18:55:22 -0800 Subject: Update queue, translation notes in readme --- README | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/README b/README index f83873ca8..da278f741 100644 --- a/README +++ b/README @@ -2,8 +2,8 @@ README ------ -StatusNet 0.9.0 ("Stand") Beta 3 -20 Jan 2010 +StatusNet 0.9.0 ("Stand") Beta 4 +27 Jan 2010 This is the README file for StatusNet (formerly Laconica), the Open Source microblogging platform. It includes installation instructions, @@ -597,26 +597,19 @@ server is probably a good idea for high-volume sites. needs as a parameter the install path; if you run it from the StatusNet dir, "." should suffice. -This will run eight (for now) queue handlers: +This will run the queue handlers: +* queuedaemon.php - polls for queued items for inbox processing and + pushing out to OMB, SMS, XMPP, etc. * xmppdaemon.php - listens for new XMPP messages from users and stores - them as notices in the database. -* jabberqueuehandler.php - sends queued notices in the database to - registered users who should receive them. -* publicqueuehandler.php - sends queued notices in the database to - public feed listeners. -* ombqueuehandler.php - sends queued notices to OpenMicroBlogging - recipients on foreign servers. -* smsqueuehandler.php - sends queued notices to SMS-over-email addresses - of registered users. -* xmppconfirmhandler.php - sends confirmation messages to registered - users. - -Note that these queue daemons are pretty raw, and need your care. In -particular, they leak memory, and you may want to restart them on a -regular (daily or so) basis with a cron job. Also, if they lose -the connection to the XMPP server for too long, they'll simply die. It -may be a good idea to use a daemon-monitoring service, like 'monit', + them as notices in the database; also pulls queued XMPP output from + queuedaemon.php to push out to clients. + +These two daemons will automatically restart in most cases of failure +including memory leaks (if a memory_limit is set), but may still die +or behave oddly if they lose connections to the XMPP or queue servers. + +It may be a good idea to use a daemon-monitoring service, like 'monit', to check their status and keep them running. All the daemons write their process IDs (pids) to /var/run/ by @@ -626,7 +619,7 @@ daemons. Since version 0.8.0, it's now possible to use a STOMP server instead of our kind of hacky home-grown DB-based queue solution. See the "queues" config section below for how to configure to use STOMP. As of this -writing, the software has been tested with ActiveMQ ( +writing, the software has been tested with ActiveMQ. Sitemaps -------- @@ -712,10 +705,12 @@ subdirectory to add a new language to your system. You'll need to compile the ".po" files into ".mo" files, however. Contributions of translation information to StatusNet are very easy: -you can use the Web interface at http://status.net/pootle/ to add one +you can use the Web interface at TranslateWiki.net to add one or a few or lots of new translations -- or even new languages. You can also download more up-to-date .po files there, if you so desire. +For info on helping with translations, see http://status.net/wiki/Translations + Backups ------- -- cgit v1.2.3-54-g00ecf From ee4ea3f3e1eb64df2dd3ba677f5201f8787482a8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 27 Jan 2010 21:59:38 -0500 Subject: increment software beta version --- lib/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common.php b/lib/common.php index ada48b339..b4e4a653c 100644 --- a/lib/common.php +++ b/lib/common.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } //exit with 200 response, if this is checking fancy from the installer if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; } -define('STATUSNET_VERSION', '0.9.0beta3'); +define('STATUSNET_VERSION', '0.9.0beta4'); define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility define('STATUSNET_CODENAME', 'Stand'); -- cgit v1.2.3-54-g00ecf