4 * Copyright (C) 2010, Free Software Foundation, Inc.
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Ian Denhardt <ian@zenhack.net>
25 * @copyright 2010 Free Software Foundation, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
29 /* Photo sharing plugin */
31 if (!defined('STATUSNET')) {
35 class GNUsocialPhotosPlugin extends Plugin
38 function onAutoload($cls)
40 $dir = dirname(__FILE__);
45 include_once $dir . '/lib/photolib.php';
46 include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
48 case 'PhotouploadAction':
49 include_once $dir . '/lib/photolib.php';
50 include_once $dir . '/classes/gnusocialphoto.php';
51 include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
60 function onCheckSchema()
62 $schema = Schema::get();
63 $schema->ensureTable('GNUsocialPhoto',
64 array(new ColumnDef('object_id', 'integer', null, false, 'PRI', true, null, null, true),
65 new ColumnDef('path', 'varchar(150)', null, false),
66 new ColumnDef('thumb_path', 'varchar(156)', null, false), // 156 = 150 + strlen('thumb.')
67 new ColumnDef('owner_id', 'int(11)', null, false)));
70 function onRouterInitialized($m)
72 $m->connect(':nickname/photos', array('action' => 'photos'));
73 $m->connect('main/uploadphoto', array('action' => 'photoupload'));
74 common_log(LOG_INFO, "init'd!");