summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/GNUsocialDukiDukiSnail/GNUsocialDukiDukiSnail.php0
-rw-r--r--plugins/GNUsocialDukiDukiSnail/README151
-rw-r--r--plugins/GNUsocialEvents/GNUsocialEvents.php0
-rw-r--r--plugins/GNUsocialLayout/GNUsocialLayout.php0
-rw-r--r--plugins/GNUsocialOffTheRecordMessaging/GNUsocialOffTheRecordMessaging.php0
-rw-r--r--plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php77
-rw-r--r--plugins/GNUsocialPhotos/actions/photos.php110
-rw-r--r--plugins/GNUsocialPhotos/actions/photoupload.php137
-rw-r--r--plugins/GNUsocialPhotos/classes/gnusocialphoto.php66
-rw-r--r--plugins/GNUsocialPhotos/lib/photolib.php87
-rw-r--r--plugins/GNUsocialRelationshipsManager/GNUsocialRelationshipsManager.php0
-rw-r--r--plugins/GNUsocialTemplatePlugin.php359
-rw-r--r--plugins/GNUsocialVideo/GNUsocialVideo.php0
-rw-r--r--plugins/OpenID/doc-src/openid2
14 files changed, 989 insertions, 0 deletions
diff --git a/plugins/GNUsocialDukiDukiSnail/GNUsocialDukiDukiSnail.php b/plugins/GNUsocialDukiDukiSnail/GNUsocialDukiDukiSnail.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/GNUsocialDukiDukiSnail/GNUsocialDukiDukiSnail.php
diff --git a/plugins/GNUsocialDukiDukiSnail/README b/plugins/GNUsocialDukiDukiSnail/README
new file mode 100644
index 000000000..98ae6526e
--- /dev/null
+++ b/plugins/GNUsocialDukiDukiSnail/README
@@ -0,0 +1,151 @@
+GNU Social -- DukiDuki Snail
+============================
+
+Duki Duki Snail is a classic PC game, released in Czechoslovakia in
+the 1980s, and later reborn in free software in the mid 1990s.
+
+It is our intention to create a free software version of DukiDuki
+Snail for GNU social in which players can share their high scores.
+
+The game is built like such:
+
+A maze is drawn:
+
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXX XXX XXXX
+XXXX XXX XXXX
+XXXX XXX XXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXX
+XXXX XXXX XXXX
+XXXX XXXX XXXX
+XXXX XXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXX XXX XXX XXXX XXXX
+XXXX XXX XXX XXX XXX XXXX XXXX
+XXXX XXX XXX XXX XXX XXXX XXXX
+XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXX XXXX XXXXXXXXXX
+XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXX XXXX XXXXXXXXXX
+XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXX XXXX XXXXXXXXXX
+XXXX XXX XXXX XXXX XXXX XXXX XXXX
+XXXX XXX XXXX XXXX XXXX XXXX XXXX
+XXXX XXX XXXX XXXX XXXX XXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXX XXXX XXXX XXXX
+XXXX XXX XXXX XXX XXX XXXX XXXX XXXX
+XXXX XXX XXXX XXX XXX XXXX XXXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXXXXXXXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXXXXXXXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXXXXXXXXX
+XXXX XXX XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXXXXXXXXX
+XXXX XXX XXXX XXX XXXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXX
+XXXX XXX XXXX XXX XXXX XXXX
+XXXX XXX XXXX XXX XXXX XXXX
+XXXX XXX XXXX XXX XXXX XXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXX XXXXXXXXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXX XXXXXXXXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXX XXXXXXXXXX
+XXXX XXX XXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXX XXXXXXXXXX
+XXXX XXX XXX XXX XXXX XXX XXXX
+XXXX XXX XXX XXX XXXX XXX XXXX
+XXXX XXX XXX XXX XXXX XXX XXXX
+XXXX XXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXX XXXX XXXX XXXX XXXX
+XXXX XXX XXXX XXXX XXXX XXXX
+XXXX XXX XXXX XXXX XXXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXX XXXX
+XXXX XXX XXXX XXX XXX XXX XXXX
+XXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXX XXXXXXXXXX XXXX
+XXXX XXX XXX XXXX XXXX XXX XXXX
+XXXX XXX XXX XXXX XXXX XXX XXXX
+XXXX XXX XXX XXXX XXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXX XXXX XXX XXXX
+XXXX XXX XXX XXXX XXX XXXX
+XXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXX XXXX XXX XXXX
+XXXX XXXX XXXX XXX XXXX
+XXXX XXXX XXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXX
+XXXX XXX XXX XXXX XXXX XXXX XXX XXXX
+XXXX XXX XXX XXXX XXXX XXXX XXX XXXX
+XXXX XXX XXX XXXX XXXX XXXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXX XXXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXX XXXX XXX XXXX
+XXXX XXX XXXX XXX XXXX XXXXXXXXXX XXX XXXX XXX XXXX
+XXXX XXX XXXX XXXX XXX XXX XXX XXXX
+XXXX XXX XXXX XXXX XXX XXX XXX XXXX
+XXXX XXX XXXX XXXX XXX XXX XXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+XXXX XXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXX
+ XXXX XXX
+@_K XXXX XXX [ exit ]
+ XXXX XXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX
+
+and you must guide your snail @_K through the maze in record time.
+
+This seems like an ideal thing to build using something like <canvas> too. \ No newline at end of file
diff --git a/plugins/GNUsocialEvents/GNUsocialEvents.php b/plugins/GNUsocialEvents/GNUsocialEvents.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/GNUsocialEvents/GNUsocialEvents.php
diff --git a/plugins/GNUsocialLayout/GNUsocialLayout.php b/plugins/GNUsocialLayout/GNUsocialLayout.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/GNUsocialLayout/GNUsocialLayout.php
diff --git a/plugins/GNUsocialOffTheRecordMessaging/GNUsocialOffTheRecordMessaging.php b/plugins/GNUsocialOffTheRecordMessaging/GNUsocialOffTheRecordMessaging.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/GNUsocialOffTheRecordMessaging/GNUsocialOffTheRecordMessaging.php
diff --git a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
new file mode 100644
index 000000000..f7cb6f398
--- /dev/null
+++ b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * GNU Social
+ * Copyright (C) 2010, Free Software Foundation, Inc.
+ *
+ * PHP version 5
+ *
+ * LICENCE:
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package GNU Social
+ * @author Ian Denhardt <ian@zenhack.net>
+ * @copyright 2010 Free Software Foundation, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ */
+
+/* Photo sharing plugin */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+class GNUsocialPhotosPlugin extends Plugin
+{
+
+ function onAutoload($cls)
+ {
+ $dir = dirname(__FILE__);
+
+ switch ($cls)
+ {
+ case 'PhotosAction':
+ include_once $dir . '/lib/photolib.php';
+ include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
+ return false;
+ case 'PhotouploadAction':
+ include_once $dir . '/lib/photolib.php';
+ include_once $dir . '/classes/gnusocialphoto.php';
+ include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
+ return false;
+ default:
+ return true;
+ }
+
+ return true;
+ }
+
+ function onCheckSchema()
+ {
+ $schema = Schema::get();
+ $schema->ensureTable('GNUsocialPhoto',
+ array(new ColumnDef('object_id', 'integer', null, false, 'PRI', true, null, null, true),
+ new ColumnDef('path', 'varchar(150)', null, false),
+ new ColumnDef('thumb_path', 'varchar(156)', null, false), // 156 = 150 + strlen('thumb.')
+ new ColumnDef('owner_id', 'int(11)', null, false)));
+ }
+
+ function onRouterInitialized($m)
+ {
+ $m->connect(':nickname/photos', array('action' => 'photos'));
+ $m->connect('main/uploadphoto', array('action' => 'photoupload'));
+ common_log(LOG_INFO, "init'd!");
+ return true;
+ }
+}
diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php
new file mode 100644
index 000000000..29a70e458
--- /dev/null
+++ b/plugins/GNUsocialPhotos/actions/photos.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * GNU Social
+ * Copyright (C) 2010, Free Software Foundation, Inc.
+ *
+ * PHP version 5
+ *
+ * LICENCE:
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package GNU Social
+ * @author Ian Denhardt <ian@zenhack.net>
+ * @copyright 2010 Free Software Foundation, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+class PhotosAction extends Action
+{
+ var $user = null;
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ $this->user = common_current_user();
+ common_log(LOG_INFO, "finishing prepare. user : ");
+ common_log(LOG_INFO, $this->user->nickname);
+ return true;
+ }
+
+ function handle($args)
+ {
+ parent::handle($args);
+ $this->showPage();
+ }
+
+ function title()
+ {
+ if (empty($this->user)) {
+ return _m('Hello');
+ } else {
+ return sprintf(_m('Hello, %s'), $this->user->nickname);
+ }
+ }
+
+
+ function showContent()
+ {
+ common_log(LOG_INFO, "getting to show content.\n");
+ if (empty($this->user)) {
+ // TODO: should just redirect to the login page.
+ $this->element('p', array(), 'You are not logged in');
+ } else {
+ common_log(LOG_INFO, 'fileroot : ' . $_SERVER['DOCUMENT_ROOT'] . '/file/');
+ $dir = opendir($_SERVER['DOCUMENT_ROOT'] . '/file/');
+ if ($dir === false) {
+ $err = error_get_last();
+ common_log(LOG_INFO, 'Error opening dir : ' . $err['message']);
+ return;
+ }
+ $args = $this->returnToArgs();
+ foreach (array_keys($args) as $key) {
+ common_log(LOG_INFO, $key . ' => ' . $args[$key]);
+ if (is_array($args[$key])) {
+ foreach (array_keys($args[$key]) as $skey) {
+ common_log(LOG_INFO, ' ' . $skey . ' => ' . $args[$key][$skey]);
+ }
+ }
+ }
+ $pathparts = explode('/', $args[1]['nickname']);
+ $username = $pathparts[0];
+ $this->elementStart('ul', array('class' => 'photothumbs'));
+ while (false !== ($file = readdir($dir))) {
+ $fparts = explode('-', $file);
+ if ($fparts[0] == $username // uploaded by this user
+ && ((substr($file, -4) == '.png')
+ || (substr($file, -4) == '.jpg') // XXX: is this needed? status.net seems to save jpgs as .jpeg
+ || (substr($file, -5) == '.jpeg')
+ || (substr($file, -4) == '.gif'))) { // and it's an image
+ common_log(LOG_INFO, 'file : ' . $file);
+ $this->elementStart('li');
+ $this->elementStart('a', array('href' => 'http://' . common_config('site', 'server') . '/file/' . $file));
+ if (!file_exists(INSTALLDIR . '/file/thumb.' . $file)) {
+ photo_make_thumbnail($file);
+ }
+ $this->element('img', array('src' => 'http://' . common_config('site', 'server') . '/file/' . 'thumb.' . $file));
+ $this->elementEnd('a');
+ $this->elementEnd('li');
+ }
+ }
+ $this->elementEnd('ul');
+ }
+ }
+}
diff --git a/plugins/GNUsocialPhotos/actions/photoupload.php b/plugins/GNUsocialPhotos/actions/photoupload.php
new file mode 100644
index 000000000..9a643dbe6
--- /dev/null
+++ b/plugins/GNUsocialPhotos/actions/photoupload.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * GNU Social
+ * Copyright (C) 2010, Free Software Foundation, Inc.
+ *
+ * PHP version 5
+ *
+ * LICENCE:
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package GNU Social
+ * @author Ian Denhardt <ian@zenhack.net>
+ * @copyright 2010 Free Software Foundation, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+class PhotouploadAction extends Action
+{
+ var $user = null;
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+ $this->user = common_current_user();
+ return true;
+ }
+
+ function handle($args)
+ {
+ parent::handle($args);
+ if($_SERVER['REQUEST_METHOD'] == 'POST') {
+ $this->handlePost();
+ }
+ $this->showPage();
+ }
+
+ function title()
+ {
+ return _m('Upload Photos');
+ }
+
+ function showContent()
+ {
+ if(empty($this->user)) {
+ $this->element('p', array(), 'You are not logged in.');
+ } else {
+ $this->elementStart('form', array('enctype' => 'mutlipart/form-data',
+ 'method' => 'post',
+ 'action' => common_local_url('photoupload')));
+ $this->element('input', array('name' => 'photofile',
+ 'type' => 'file',
+ 'id' => 'photofile'));
+ $this->submit('upload', _('Upload'));
+ $this->elementEnd('form');
+ }
+ }
+
+ function handlePost()
+ {
+
+ common_log(LOG_INFO, 'handlPost()!');
+ // Workaround for PHP returning empty $_POST and $_FILES when POST
+ // length > post_max_size in php.ini
+
+ if (empty($_FILES)
+ && empty($_POST)
+ && ($_SERVER['CONTENT_LENGTH'] > 0)
+ ) {
+ $msg = _('The server was unable to handle that much POST ' .
+ 'data (%s bytes) due to its current configuration.');
+
+ $this->showForm(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
+ return;
+ }
+
+ // CSRF protection
+
+/* $token = $this->trimmed('token');
+ if (!$token || $token != common_session_token()) {
+ $this->showForm(_('There was a problem with your session token. '.
+ 'Try again, please.'));
+ return;
+ } */
+
+ if($this->arg('upload')) {
+ $this->uploadPhoto();
+ }
+ }
+
+ function uploadPhoto()
+ {
+ common_log(LOG_INFO, 'Is this function even getting called?');
+ $cur = common_current_user();
+ if(empty($cur)) {
+ return;
+ }
+ try {
+ $imagefile = ImageFile::fromUpload('photofile');
+ } catch (Exception $e) {
+ $this->showForm($e->getMessage());
+ return;
+ }
+ if ($imagefile === null) {
+ $this->showForm(_('No file uploaded.'));
+ return;
+ }
+
+ common_log(LOG_INFO, 'upload path : ' . $imagefile->filepath);
+
+ $filename = $cur->nickname . '-' . common_timestamp() . sha1_file($imagefile->filepath) . '.' . image_type_to_extension($imagefile->type);
+ move_uploaded_file($imagefile->filepath, INSTALLDIR . '/file/' . $filename);
+ photo_make_thumbnail($filename);
+ $photo = new GNUsocialPhoto();
+ $photo->path = '/file/' . $filename;
+ $photo->thumb_path = '/file/thumb.' . $filename;
+ $photo->owner_id = $cur->id;
+ $photo->object_id = 'DEFAULT';
+ $photo->insert();
+ }
+
+}
diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php
new file mode 100644
index 000000000..882d1026e
--- /dev/null
+++ b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * GNU Social
+ * Copyright (C) 2010, Free Software Foundation, Inc.
+ *
+ * PHP version 5
+ *
+ * LICENCE:
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package GNU Social
+ * @author Ian Denhardt <ian@zenhack.net>
+ * @copyright 2010 Free Software Foundation, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
+
+class GNUsocialPhoto extends Memcached_DataObject
+{
+ public $__table = 'GNUsocialPhoto';
+ public $object_id; // integer
+ public $path; // varchar(150)
+ public $thumb_path; // varchar(156)
+ public $owner_id; // int(11) (user who posted the photo)
+
+ function staticGet($k,$v=NULL)
+ {
+ return Memcached_DataObject::staticGet('GNUsocialPhoto',$k,$v);
+ }
+
+ function delete()
+ {
+ if(!unlink(INSTALLDIR . $this->thumb_path)) {
+ return false;
+ }
+ if(!unlink(INSTALLDIR . $this->path)) {
+ return false;
+ }
+ return parent::delete();
+ }
+
+ function table()
+ {
+ return array('object_id' => DB_DATAOBJECT_INT,
+ 'path' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
+ 'thumb_path' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
+ 'owner_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL);
+ }
+}
diff --git a/plugins/GNUsocialPhotos/lib/photolib.php b/plugins/GNUsocialPhotos/lib/photolib.php
new file mode 100644
index 000000000..9e5ff61fa
--- /dev/null
+++ b/plugins/GNUsocialPhotos/lib/photolib.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * GNU Social
+ * Copyright (C) 2010, Free Software Foundation, Inc.
+ *
+ * PHP version 5
+ *
+ * LICENCE:
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package GNU Social
+ * @author Ian Denhardt <ian@zenhack.net>
+ * @copyright 2010 Free Software Foundation, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ */
+
+
+function photo_make_thumbnail($filename)
+{
+ $height_dest = 192;
+ $width_dest = 256;
+
+ $size_src = getimagesize(INSTALLDIR . '/file/' . $filename);
+ $image_type = $size_src[2];
+
+ switch($image_type) {
+ case IMAGETYPE_JPEG:
+ $image_src = imagecreatefromjpeg(INSTALLDIR . '/file/' . $filename);
+ break;
+ case IMAGETYPE_PNG:
+ $image_src = imagecreatefrompng(INSTALLDIR . '/file/' . $filename);
+ break;
+ case IMAGETYPE_GIF:
+ $image_src = imagecreatefromgif(INSTALLDIR . '/file/' . $filename);
+ break;
+ default:
+ return false;
+ }
+
+ $width_src = $size_src[0];
+ $height_src = $size_src[1];
+
+ $ratio_src = (float) $width_src / (float) $height_src;
+ $ratio_dest = (float) $width_dest / (float) $height_dest;
+
+ if ($ratio_src > $ratio_dest) {
+ $height_crop = $height_src;
+ $width_crop = (int)($height_crop * $ratio_dest);
+ $x_crop = ($width_src - $width_crop) / 2;
+ } else {
+ $width_crop = $width_src;
+ $height_crop = (int)($width_crop / $ratio_dest);
+ $x_crop = 0;
+ }
+
+ $image_dest = imagecreatetruecolor($width_dest, $height_dest);
+
+ imagecopyresampled($image_dest, $image_src, 0, 0, $x_crop, 0, $width_dest, $height_dest, $width_crop, $height_crop);
+ switch ($image_type) {
+ case IMAGETYPE_JPEG:
+ imagejpeg($image_dest, INSTALLDIR . '/file/' . 'thumb.' . $filename, 100);
+ break;
+ case IMAGETYPE_PNG:
+ imagepng($image_dest, INSTALLDIR . '/file/thumb.' . $filename);
+ break;
+ case IMAGETYPE_GIF:
+ imagegif($image_dest, INSTALLDIR . '/file/thumb.' . $filename);
+ break;
+ }
+
+ imagedestroy($image_src);
+ imagedestroy($image_dest);
+
+ return true;
+}
diff --git a/plugins/GNUsocialRelationshipsManager/GNUsocialRelationshipsManager.php b/plugins/GNUsocialRelationshipsManager/GNUsocialRelationshipsManager.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/GNUsocialRelationshipsManager/GNUsocialRelationshipsManager.php
diff --git a/plugins/GNUsocialTemplatePlugin.php b/plugins/GNUsocialTemplatePlugin.php
new file mode 100644
index 000000000..7db2f73a8
--- /dev/null
+++ b/plugins/GNUsocialTemplatePlugin.php
@@ -0,0 +1,359 @@
+<?php
+/**
+ * Plugin to render GNU social
+ *
+ * Captures rendered parts from the output buffer, passes them through a template file: tpl/social.php
+ * Adds an API method at index.php/template/update which lets you overwrite the template file
+ * Requires username/password and a single POST parameter called "template"
+ * The method is disabled unless the user is #1, the first user of the system
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Brian Hendrickson <brian@megapump.com>
+ * @author Matt Lee <mattl@cnuk.org>
+ * @copyright 2009 Megapump, Inc.
+ * @copyright 2010 Free Software Foundation, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://megapump.com/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+define('TEMPLATEPLUGIN_VERSION', '0.1');
+
+class TemplatePlugin extends Plugin {
+
+ var $blocks = array();
+
+ function __construct() {
+ parent::__construct();
+ }
+
+ // capture the RouterInitialized event
+ // and connect a new API method
+ // for updating the template
+ function onRouterInitialized( $m ) {
+ $m->connect( 'template/update', array(
+ 'action' => 'template',
+ ));
+ }
+
+ // <%styles%>
+ // <%scripts%>
+ // <%search%>
+ // <%feeds%>
+ // <%description%>
+ // <%head%>
+ function onStartShowHead( $act ) {
+ $this->clear_xmlWriter($act);
+ $act->extraHead();
+ $this->blocks['head'] = $act->xw->flush();
+ $act->showStylesheets();
+ $this->blocks['styles'] = $act->xw->flush();
+ $act->showScripts();
+ $this->blocks['scripts'] = $act->xw->flush();
+ $act->showFeeds();
+ $this->blocks['feeds'] = $act->xw->flush();
+ $act->showOpenSearch();
+ $this->blocks['search'] = $act->xw->flush();
+ $act->showDescription();
+ $this->blocks['description'] = $act->xw->flush();
+ return false;
+ }
+
+ // <%bodytext%>
+ function onStartShowContentBlock( $act ) {
+ $this->clear_xmlWriter($act);
+ return true;
+ }
+ function onEndShowContentBlock( $act ) {
+ $this->blocks['bodytext'] = $act->xw->flush();
+ }
+
+ // <%localnav%>
+ function onStartShowLocalNavBlock( $act ) {
+ $this->clear_xmlWriter($act);
+ return true;
+ }
+ function onEndShowLocalNavBlock( $act ) {
+ $this->blocks['localnav'] = $act->xw->flush();
+ }
+
+ // <%export%>
+ function onStartShowExportData( $act ) {
+ $this->clear_xmlWriter($act);
+ return true;
+ }
+ function onEndShowExportData( $act ) {
+ $this->blocks['export'] = $act->xw->flush();
+ }
+
+ // <%subscriptions%>
+ // <%subscribers%>
+ // <%groups%>
+ // <%statistics%>
+ // <%cloud%>
+ // <%groupmembers%>
+ // <%groupstatistics%>
+ // <%groupcloud%>
+ // <%popular%>
+ // <%groupsbyposts%>
+ // <%featuredusers%>
+ // <%groupsbymembers%>
+ function onStartShowSections( $act ) {
+ global $action;
+ $this->clear_xmlWriter($act);
+ switch ($action) {
+ case "showstream":
+ $act->showSubscriptions();
+ $this->blocks['subscriptions'] = $act->xw->flush();
+ $act->showSubscribers();
+ $this->blocks['subscribers'] = $act->xw->flush();
+ $act->showGroups();
+ $this->blocks['groups'] = $act->xw->flush();
+ $act->showStatistics();
+ $this->blocks['statistics'] = $act->xw->flush();
+ $cloud = new PersonalTagCloudSection($act, $act->user);
+ $cloud->show();
+ $this->blocks['cloud'] = $act->xw->flush();
+ break;
+ case "showgroup":
+ $act->showMembers();
+ $this->blocks['groupmembers'] = $act->xw->flush();
+ $act->showStatistics();
+ $this->blocks['groupstatistics'] = $act->xw->flush();
+ $cloud = new GroupTagCloudSection($act, $act->group);
+ $cloud->show();
+ $this->blocks['groupcloud'] = $act->xw->flush();
+ break;
+ case "public":
+ $pop = new PopularNoticeSection($act);
+ $pop->show();
+ $this->blocks['popular'] = $act->xw->flush();
+ $gbp = new GroupsByPostsSection($act);
+ $gbp->show();
+ $this->blocks['groupsbyposts'] = $act->xw->flush();
+ $feat = new FeaturedUsersSection($act);
+ $feat->show();
+ $this->blocks['featuredusers'] = $act->xw->flush();
+ break;
+ case "groups":
+ $gbp = new GroupsByPostsSection($act);
+ $gbp->show();
+ $this->blocks['groupsbyposts'] = $act->xw->flush();
+ $gbm = new GroupsByMembersSection($act);
+ $gbm->show();
+ $this->blocks['groupsbymembers'] = $act->xw->flush();
+ break;
+ }
+ return false;
+ }
+
+ // <%logo%>
+ // <%nav%>
+ // <%notice%>
+ // <%noticeform%>
+ function onStartShowHeader( $act ) {
+ $this->clear_xmlWriter($act);
+ $act->showLogo();
+ $this->blocks['logo'] = $act->xw->flush();
+ $act->showPrimaryNav();
+ $this->blocks['nav'] = $act->xw->flush();
+ $act->showSiteNotice();
+ $this->blocks['notice'] = $act->xw->flush();
+ if (common_logged_in()) {
+ $act->showNoticeForm();
+ } else {
+ $act->showAnonymousMessage();
+ }
+ $this->blocks['noticeform'] = $act->xw->flush();
+ return false;
+ }
+
+ // <%secondarynav%>
+ // <%licenses%>
+ function onStartShowFooter( $act ) {
+ $this->clear_xmlWriter($act);
+ $act->showSecondaryNav();
+ $this->blocks['secondarynav'] = $act->xw->flush();
+ $act->showLicenses();
+ $this->blocks['licenses'] = $act->xw->flush();
+ return false;
+ }
+
+ // capture the EndHTML event
+ // and include the template
+ function onEndEndHTML($act) {
+
+ global $action, $tags;
+
+ // set the action and title values
+ $vars = array(
+ 'action'=>$action,
+ 'title'=>$act->title(). " - ". common_config('site', 'name')
+ );
+
+ // use the PHP template
+ // unless statusnet config:
+ // $config['template']['mode'] = 'html';
+ if (!(common_config('template', 'mode') == 'html')) {
+ $tpl_file = $this->templateFolder() . '/social.php';
+ $tags = array_merge($vars,$this->blocks);
+ include $tpl_file;
+ return;
+ }
+
+ $tpl_file = $this->templateFolder() . '/index.html';
+
+ // read the static template
+ $output = file_get_contents( $tpl_file );
+
+ $tags = array();
+
+ // get a list of the <%tags%> in the template
+ $pattern='/<%([a-z]+)%>/';
+
+ if ( 1 <= preg_match_all( $pattern, $output, $found ))
+ $tags[] = $found;
+
+ // for each found tag, set its value from the rendered blocks
+ foreach( $tags[0][1] as $pos=>$tag ) {
+ if (isset($this->blocks[$tag]))
+ $vars[$tag] = $this->blocks[$tag];
+
+ // didn't find a block for the tag
+ elseif (!isset($vars[$tag]))
+ $vars[$tag] = '';
+ }
+
+ // replace the tags in the template
+ foreach( $vars as $key=>$val )
+ $output = str_replace( '<%'.$key.'%>', $val, $output );
+
+ echo $output;
+
+ return true;
+
+ }
+ function templateFolder() {
+ return 'tpl';
+ }
+
+ // catching the StartShowHTML event to halt the rendering
+ function onStartShowHTML( $act ) {
+ $this->clear_xmlWriter($act);
+ return true;
+ }
+
+ // clear the xmlWriter
+ function clear_xmlWriter( $act ) {
+ $act->xw->openMemory();
+ $act->xw->setIndent(true);
+ }
+
+}
+
+/**
+ * Action for updating the template remotely
+ *
+ * "template/update" -- a POST method that requires a single
+ * parameter "template", containing the new template code
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Brian Hendrickson <brian@megapump.com>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://megapump.com/
+ *
+ */
+
+class TemplateAction extends Action
+{
+
+ function prepare($args) {
+ parent::prepare($args);
+ return true;
+ }
+
+ function handle($args) {
+
+ parent::handle($args);
+
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+
+ // not authenticated, show login form
+ header('WWW-Authenticate: Basic realm="StatusNet API"');
+
+ // cancelled the browser login form
+ $this->clientError(_('Authentication error!'), $code = 401);
+
+ } else {
+
+ $nick = $_SERVER['PHP_AUTH_USER'];
+ $pass = $_SERVER['PHP_AUTH_PW'];
+
+ // check username and password
+ $user = common_check_user($nick,$pass);
+
+ if ($user) {
+
+ // verify that user is admin
+ if (!($user->id == 1))
+ $this->clientError(_('Only User #1 can update the template.'), $code = 401);
+
+ // open the old template
+ $tpl_file = $this->templateFolder() . '/index.html';
+ $fp = fopen( $tpl_file, 'w+' );
+
+ // overwrite with the new template
+ fwrite($fp, $this->arg('template'));
+ fclose($fp);
+
+ header('HTTP/1.1 200 OK');
+ header('Content-type: text/plain');
+ print "Template Updated!";
+
+ } else {
+
+ // bad username and password
+ $this->clientError(_('Authentication error!'), $code = 401);
+
+ }
+
+ }
+ }
+ function onPluginVersion(&$versions)
+ {
+ $versions[] = array('name' => 'Template',
+ 'version' => TEMPLATEPLUGIN_VERSION,
+ 'author' => 'Brian Hendrickson',
+ 'homepage' => 'http://status.net/wiki/Plugin:Template',
+ 'rawdescription' =>
+ _m('Use an HTML template for Web output.'));
+ return true;
+ }
+
+}
+
+/**
+ * Function for retrieving a statusnet display section
+ *
+ * requires one parameter, the name of the section
+ * section names are listed in the comments of the TemplatePlugin class
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Brian Hendrickson <brian@megapump.com>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://megapump.com/
+ *
+ */
+
+function section($tagname) {
+ global $tags;
+ if (isset($tags[$tagname]))
+ return $tags[$tagname];
+}
+
diff --git a/plugins/GNUsocialVideo/GNUsocialVideo.php b/plugins/GNUsocialVideo/GNUsocialVideo.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/GNUsocialVideo/GNUsocialVideo.php
diff --git a/plugins/OpenID/doc-src/openid b/plugins/OpenID/doc-src/openid
index f2dc610a5..0f0812850 100644
--- a/plugins/OpenID/doc-src/openid
+++ b/plugins/OpenID/doc-src/openid
@@ -9,3 +9,5 @@ There are many [Public OpenID providers](http://wiki.openid.net/OpenID-Providers
* [Yahoo!](http://openid.yahoo.com/) : If you have an account with Yahoo!, you can log in to this site by entering your Yahoo!-provided OpenID in the box above. Yahoo! OpenID URLs have the form *https://me.yahoo.com/yourusername*.
* [AOL](http://dev.aol.com/aol-and-63-million-openids) : If you have an account with [AOL](http://www.aol.com/), like an [AIM](http://www.aim.com/) account, you can log in to %%site.name%% by entering your AOL-provided OpenID in the box above. AOL OpenID URLs have the form *http://openid.aol.com/yourusername*. Your username should be all lowercase, no spaces.
* [Blogger](http://bloggerindraft.blogspot.com/2008/01/new-feature-blogger-as-openid-provider.html), [Wordpress.com](http://faq.wordpress.com/2007/03/06/what-is-openid/), [LiveJournal](http://www.livejournal.com/openid/about.bml), [Vox](http://bradfitz.vox.com/library/post/openid-for-vox.html) : If you have a blog on any of these services, enter your blog URL in the box above. For example, *http://yourusername.blogspot.com/*, *http://yourusername.wordpress.com/*, *http://yourusername.livejournal.com/*, or *http://yourusername.vox.com/*.
+
+Additionally, once you have an account on %%site.name%%, you can use your profile's URL (https://%%site.server%%/yourusername) as an OpenID elsewhere as well.