trim whitespace
darcs-hash:20080520191412-84dde-a607dbe848279639630edd1ab4616d05cc2318d1.gz
This commit is contained in:
parent
3f5ededc01
commit
52600ce0b0
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -24,31 +24,31 @@ require_once(INSTALLDIR.'/actions/showstream.php');
|
|||||||
class AllAction extends ShowstreamAction {
|
class AllAction extends ShowstreamAction {
|
||||||
|
|
||||||
// XXX: push this up to a common function.
|
// XXX: push this up to a common function.
|
||||||
|
|
||||||
function show_notices($profile) {
|
function show_notices($profile) {
|
||||||
|
|
||||||
$notice = DB_DataObject::factory('notice');
|
$notice = DB_DataObject::factory('notice');
|
||||||
|
|
||||||
# XXX: chokety and bad
|
# XXX: chokety and bad
|
||||||
|
|
||||||
$notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$profile->id.' and subscribed = notice.profile_id)', 'OR');
|
$notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$profile->id.' and subscribed = notice.profile_id)', 'OR');
|
||||||
$notice->whereAdd('profile_id = ' . $profile->id, 'OR');
|
$notice->whereAdd('profile_id = ' . $profile->id, 'OR');
|
||||||
|
|
||||||
$notice->orderBy('created DESC');
|
$notice->orderBy('created DESC');
|
||||||
|
|
||||||
$page = $this->arg('page') || 1;
|
$page = $this->arg('page') || 1;
|
||||||
|
|
||||||
$notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
|
$notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
|
||||||
|
|
||||||
$notice->find();
|
$notice->find();
|
||||||
|
|
||||||
common_element_start('div', 'notices');
|
common_element_start('div', 'notices');
|
||||||
common_element('h2', 'notices', _t('Notices'));
|
common_element('h2', 'notices', _t('Notices'));
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
$this->show_notice($notice);
|
$this->show_notice($notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
# XXX: show a link for the next page
|
# XXX: show a link for the next page
|
||||||
common_element_end('div');
|
common_element_end('div');
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ class AvatarAction extends SettingsAction {
|
|||||||
$avatar->created = DB_DataObject_Cast::dateTime(); # current time
|
$avatar->created = DB_DataObject_Cast::dateTime(); # current time
|
||||||
|
|
||||||
$val = $avatar->validate();
|
$val = $avatar->validate();
|
||||||
|
|
||||||
if ($val !== TRUE) {
|
if ($val !== TRUE) {
|
||||||
$err = '';
|
$err = '';
|
||||||
foreach ($val as $k=>$v) {
|
foreach ($val as $k=>$v) {
|
||||||
@ -138,7 +138,7 @@ class AvatarAction extends SettingsAction {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
|
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
|
||||||
$scaled[] = $this->scale_avatar($user, $avatar, $size);
|
$scaled[] = $this->scale_avatar($user, $avatar, $size);
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@
|
|||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
class LoginAction extends Action {
|
class LoginAction extends Action {
|
||||||
|
|
||||||
function handle($args) {
|
function handle($args) {
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
if (common_logged_in()) {
|
if (common_logged_in()) {
|
||||||
@ -43,7 +43,7 @@ class LoginAction extends Action {
|
|||||||
common_server_error(_t('Error setting user.'));
|
common_server_error(_t('Error setting user.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# success!
|
# success!
|
||||||
common_redirect(common_local_url('all',
|
common_redirect(common_local_url('all',
|
||||||
array('nickname' =>
|
array('nickname' =>
|
||||||
$nickname)));
|
$nickname)));
|
||||||
@ -51,9 +51,9 @@ class LoginAction extends Action {
|
|||||||
$this->show_form(_t('Incorrect username or password.'));
|
$this->show_form(_t('Incorrect username or password.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_form($error=NULL) {
|
function show_form($error=NULL) {
|
||||||
|
|
||||||
common_show_header(_t('Login'));
|
common_show_header(_t('Login'));
|
||||||
if (!is_null($error)) {
|
if (!is_null($error)) {
|
||||||
common_element('div', array('class' => 'error'), $msg);
|
common_element('div', array('class' => 'error'), $msg);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@
|
|||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
class NewnoticeAction extends Action {
|
class NewnoticeAction extends Action {
|
||||||
|
|
||||||
function handle($args) {
|
function handle($args) {
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
# XXX: Ajax!
|
# XXX: Ajax!
|
||||||
@ -40,7 +40,7 @@ class NewnoticeAction extends Action {
|
|||||||
$this->show_form();
|
$this->show_form();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_new_notice() {
|
function save_new_notice() {
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
assert($user); # XXX: maybe an error instead...
|
assert($user); # XXX: maybe an error instead...
|
||||||
@ -49,7 +49,7 @@ class NewnoticeAction extends Action {
|
|||||||
$notice->profile_id = $user->id; # user id *is* profile id
|
$notice->profile_id = $user->id; # user id *is* profile id
|
||||||
$notice->created = DB_DataObject_Cast::dateTime();
|
$notice->created = DB_DataObject_Cast::dateTime();
|
||||||
$notice->content = trim($this->arg('content'));
|
$notice->content = trim($this->arg('content'));
|
||||||
|
|
||||||
$val = $notice->validate();
|
$val = $notice->validate();
|
||||||
if ($val === TRUE) {
|
if ($val === TRUE) {
|
||||||
return $notice->insert();
|
return $notice->insert();
|
||||||
@ -58,7 +58,7 @@ class NewnoticeAction extends Action {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_form() {
|
function show_form() {
|
||||||
common_show_header(_t('New notice'));
|
common_show_header(_t('New notice'));
|
||||||
common_element_start('form', array('id' => 'newnotice', 'method' => 'POST',
|
common_element_start('form', array('id' => 'newnotice', 'method' => 'POST',
|
||||||
|
@ -69,7 +69,7 @@ class PasswordAction extends SettingsAction {
|
|||||||
$this->show_form(_t('Error saving user; invalid.'));
|
$this->show_form(_t('Error saving user; invalid.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->update($original)) {
|
if (!$user->update($original)) {
|
||||||
common_server_error(_t('Can\'t save new password.'));
|
common_server_error(_t('Can\'t save new password.'));
|
||||||
return;
|
return;
|
||||||
|
@ -76,7 +76,7 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
$this->show_form(_t('Error saving user; invalid.'));
|
$this->show_form(_t('Error saving user; invalid.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->update($original)) {
|
if (!$user->update($original)) {
|
||||||
common_server_error(_t('Couldnt update user.'));
|
common_server_error(_t('Couldnt update user.'));
|
||||||
return;
|
return;
|
||||||
@ -99,7 +99,7 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
$this->show_form(_t('Error saving profile; invalid.'));
|
$this->show_form(_t('Error saving profile; invalid.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$profile->update($orig_profile)) {
|
if (!$profile->update($orig_profile)) {
|
||||||
common_server_error(_t('Couldnt save profile.'));
|
common_server_error(_t('Couldnt save profile.'));
|
||||||
return;
|
return;
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -20,10 +20,10 @@
|
|||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
class RegisterAction extends Action {
|
class RegisterAction extends Action {
|
||||||
|
|
||||||
function handle($args) {
|
function handle($args) {
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (common_logged_in()) {
|
if (common_logged_in()) {
|
||||||
common_user_error(_t('Already logged in.'));
|
common_user_error(_t('Already logged in.'));
|
||||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
@ -40,10 +40,10 @@ class RegisterAction extends Action {
|
|||||||
$email = $this->arg('email');
|
$email = $this->arg('email');
|
||||||
|
|
||||||
# Input scrubbing
|
# Input scrubbing
|
||||||
|
|
||||||
$nickname = common_canonical_nickname($nickname);
|
$nickname = common_canonical_nickname($nickname);
|
||||||
$email = common_canonical_email($email);
|
$email = common_canonical_email($email);
|
||||||
|
|
||||||
if ($this->nickname_exists($nickname)) {
|
if ($this->nickname_exists($nickname)) {
|
||||||
$this->show_form(_t('Username already exists.'));
|
$this->show_form(_t('Username already exists.'));
|
||||||
} else if ($this->email_exists($email)) {
|
} else if ($this->email_exists($email)) {
|
||||||
@ -63,14 +63,14 @@ class RegisterAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# checks if *CANONICAL* nickname exists
|
# checks if *CANONICAL* nickname exists
|
||||||
|
|
||||||
function nickname_exists($nickname) {
|
function nickname_exists($nickname) {
|
||||||
$user = User::staticGet('nickname', $nickname);
|
$user = User::staticGet('nickname', $nickname);
|
||||||
return ($user !== false);
|
return ($user !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
# checks if *CANONICAL* email exists
|
# checks if *CANONICAL* email exists
|
||||||
|
|
||||||
function email_exists($email) {
|
function email_exists($email) {
|
||||||
$email = common_canonical_email($email);
|
$email = common_canonical_email($email);
|
||||||
$user = User::staticGet('email', $email);
|
$user = User::staticGet('email', $email);
|
||||||
@ -83,7 +83,7 @@ class RegisterAction extends Action {
|
|||||||
$profile->nickname = $nickname;
|
$profile->nickname = $nickname;
|
||||||
$profile->profileurl = common_profile_url($nickname);
|
$profile->profileurl = common_profile_url($nickname);
|
||||||
$profile->created = DB_DataObject_Cast::dateTime(); # current time
|
$profile->created = DB_DataObject_Cast::dateTime(); # current time
|
||||||
|
|
||||||
$val = $profile->validate();
|
$val = $profile->validate();
|
||||||
if ($val !== TRUE) {
|
if ($val !== TRUE) {
|
||||||
# XXX: some feedback here, please!
|
# XXX: some feedback here, please!
|
||||||
@ -99,7 +99,7 @@ class RegisterAction extends Action {
|
|||||||
$user->password = common_munge_password($password, $id);
|
$user->password = common_munge_password($password, $id);
|
||||||
$user->email = $email;
|
$user->email = $email;
|
||||||
$user->created = DB_DataObject_Cast::dateTime(); # current time
|
$user->created = DB_DataObject_Cast::dateTime(); # current time
|
||||||
|
|
||||||
$val = $user->validate();
|
$val = $user->validate();
|
||||||
if ($val !== TRUE) {
|
if ($val !== TRUE) {
|
||||||
# XXX: some feedback here, please!
|
# XXX: some feedback here, please!
|
||||||
@ -107,7 +107,7 @@ class RegisterAction extends Action {
|
|||||||
$profile->delete();
|
$profile->delete();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $user->insert();
|
$result = $user->insert();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
# Try to clean up...
|
# Try to clean up...
|
||||||
@ -115,9 +115,9 @@ class RegisterAction extends Action {
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_form($error=NULL) {
|
function show_form($error=NULL) {
|
||||||
|
|
||||||
common_show_header(_t('Register'));
|
common_show_header(_t('Register'));
|
||||||
common_element_start('form', array('method' => 'POST',
|
common_element_start('form', array('method' => 'POST',
|
||||||
'id' => 'login',
|
'id' => 'login',
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -33,20 +33,20 @@ class ShownoticeAction extends Action {
|
|||||||
if (!$notice->getProfile()) {
|
if (!$notice->getProfile()) {
|
||||||
$this->no_such_notice();
|
$this->no_such_notice();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Looks like we're good; show the header
|
# Looks like we're good; show the header
|
||||||
|
|
||||||
common_show_header($profile->nickname." status on ".$notice->created);
|
common_show_header($profile->nickname." status on ".$notice->created);
|
||||||
|
|
||||||
$this->show_notice($notice);
|
$this->show_notice($notice);
|
||||||
|
|
||||||
common_show_footer();
|
common_show_footer();
|
||||||
}
|
}
|
||||||
|
|
||||||
function no_such_notice() {
|
function no_such_notice() {
|
||||||
common_user_error('No such notice.');
|
common_user_error('No such notice.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_notice($notice) {
|
function show_notice($notice) {
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
# XXX: RDFa
|
# XXX: RDFa
|
||||||
@ -57,13 +57,13 @@ class ShownoticeAction extends Action {
|
|||||||
'class' => 'avatar profile',
|
'class' => 'avatar profile',
|
||||||
'width' => AVATAR_PROFILE_SIZE,
|
'width' => AVATAR_PROFILE_SIZE,
|
||||||
'height' => AVATAR_PROFILE_SIZE,
|
'height' => AVATAR_PROFILE_SIZE,
|
||||||
'alt' =>
|
'alt' =>
|
||||||
($profile->fullname) ? $profile->fullname :
|
($profile->fullname) ? $profile->fullname :
|
||||||
$profile->nickname));
|
$profile->nickname));
|
||||||
}
|
}
|
||||||
common_element('a', array('href' => $profile->profileurl,
|
common_element('a', array('href' => $profile->profileurl,
|
||||||
'class' => 'nickname',
|
'class' => 'nickname',
|
||||||
'title' =>
|
'title' =>
|
||||||
($profile->fullname) ? $profile->fullname :
|
($profile->fullname) ? $profile->fullname :
|
||||||
$profile->nickname),
|
$profile->nickname),
|
||||||
$profile->nickname);
|
$profile->nickname);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -22,47 +22,47 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
class SubscribeAction extends Action {
|
class SubscribeAction extends Action {
|
||||||
function handle($args) {
|
function handle($args) {
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
common_user_error(_t('Not logged in.'));
|
common_user_error(_t('Not logged in.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$other_nickname = $this->arg('subscribeto');
|
$other_nickname = $this->arg('subscribeto');
|
||||||
|
|
||||||
$other = User::staticGet('nickname', $other_nickname);
|
$other = User::staticGet('nickname', $other_nickname);
|
||||||
|
|
||||||
if (!$other) {
|
if (!$other) {
|
||||||
common_user_error(_t('No such user.'));
|
common_user_error(_t('No such user.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
|
||||||
if ($user->isSubscribed($other)) {
|
if ($user->isSubscribed($other)) {
|
||||||
common_user_error(_t('Already subscribed!.'));
|
common_user_error(_t('Already subscribed!.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub = new Subscription();
|
$sub = new Subscription();
|
||||||
$sub->subscriber = $user->id;
|
$sub->subscriber = $user->id;
|
||||||
$sub->subscribed = $other->id;
|
$sub->subscribed = $other->id;
|
||||||
|
|
||||||
$sub->created = DB_DataObject_Cast::dateTime(); # current time
|
$sub->created = DB_DataObject_Cast::dateTime(); # current time
|
||||||
|
|
||||||
$val = $sub->validate();
|
$val = $sub->validate();
|
||||||
|
|
||||||
if ($val !== TRUE) {
|
if ($val !== TRUE) {
|
||||||
# XXX: give some error notice
|
# XXX: give some error notice
|
||||||
common_server_error(_t('Subscription did not validate.'));
|
common_server_error(_t('Subscription did not validate.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$sub->insert()) {
|
if (!$sub->insert()) {
|
||||||
common_server_error(_t('Couldn\'t create subscription.'));
|
common_server_error(_t('Couldn\'t create subscription.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
common_redirect(common_local_url('all', array('nickname' =>
|
common_redirect(common_local_url('all', array('nickname' =>
|
||||||
$user->nickname)));
|
$user->nickname)));
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
class SubscribedAction extends Action {
|
class SubscribedAction extends Action {
|
||||||
|
|
||||||
# Who is subscribed to a given user?
|
# Who is subscribed to a given user?
|
||||||
|
|
||||||
function handle($args) {
|
function handle($args) {
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
$nickname = $this->arg('nickname');
|
$nickname = $this->arg('nickname');
|
||||||
@ -34,7 +34,7 @@ class SubscribedAction extends Action {
|
|||||||
if (!$user) {
|
if (!$user) {
|
||||||
$this->no_such_user();
|
$this->no_such_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = $this->arg('page') || 1;
|
$page = $this->arg('page') || 1;
|
||||||
common_show_header($profile->nickname . ": " . _t('Subscribers'));
|
common_show_header($profile->nickname . ": " . _t('Subscribers'));
|
||||||
$this->show_subscribed($profile, $page);
|
$this->show_subscribed($profile, $page);
|
||||||
@ -45,17 +45,17 @@ class SubscribedAction extends Action {
|
|||||||
|
|
||||||
$subs = DB_DataObject::factory('subscription');
|
$subs = DB_DataObject::factory('subscription');
|
||||||
$subs->subscribed = $profile->id;
|
$subs->subscribed = $profile->id;
|
||||||
|
|
||||||
# We ask for an extra one to know if we need to do another page
|
# We ask for an extra one to know if we need to do another page
|
||||||
|
|
||||||
$subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1);
|
$subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1);
|
||||||
|
|
||||||
$subs_count = $subs->find();
|
$subs_count = $subs->find();
|
||||||
|
|
||||||
common_element_start('div', 'subscriptions');
|
common_element_start('div', 'subscriptions');
|
||||||
|
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
|
|
||||||
while ($subs->fetch()) {
|
while ($subs->fetch()) {
|
||||||
$idx++;
|
$idx++;
|
||||||
if ($idx % SUBSCRIPTIONS_PER_ROW == 1) {
|
if ($idx % SUBSCRIPTIONS_PER_ROW == 1) {
|
||||||
@ -78,27 +78,27 @@ class SubscribedAction extends Action {
|
|||||||
common_element_end('a');
|
common_element_end('a');
|
||||||
|
|
||||||
# XXX: subscribe form here
|
# XXX: subscribe form here
|
||||||
|
|
||||||
if ($idx % SUBSCRIPTIONS_PER_ROW == 0) {
|
if ($idx % SUBSCRIPTIONS_PER_ROW == 0) {
|
||||||
common_element_end('div');
|
common_element_end('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($idx == SUBSCRIPTIONS_PER_PAGE) {
|
if ($idx == SUBSCRIPTIONS_PER_PAGE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page > 1) {
|
if ($page > 1) {
|
||||||
common_element('a', array('href' =>
|
common_element('a', array('href' =>
|
||||||
common_local_url('subscriptions',
|
common_local_url('subscriptions',
|
||||||
array('nickname' => $profile->nickname,
|
array('nickname' => $profile->nickname,
|
||||||
'page' => $page - 1)),
|
'page' => $page - 1)),
|
||||||
'class' => 'prev'),
|
'class' => 'prev'),
|
||||||
_t('Previous'));
|
_t('Previous'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subs_count > SUBSCRIPTIONS_PER_PAGE) {
|
if ($subs_count > SUBSCRIPTIONS_PER_PAGE) {
|
||||||
common_element('a', array('href' =>
|
common_element('a', array('href' =>
|
||||||
common_local_url('subscriptions',
|
common_local_url('subscriptions',
|
||||||
array('nickname' => $profile->nickname,
|
array('nickname' => $profile->nickname,
|
||||||
'page' => $page + 1)),
|
'page' => $page + 1)),
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@
|
|||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
class SubscriptionsAction extends Action {
|
class SubscriptionsAction extends Action {
|
||||||
|
|
||||||
function handle($args) {
|
function handle($args) {
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
$nickname = $this->arg('nickname');
|
$nickname = $this->arg('nickname');
|
||||||
@ -42,17 +42,17 @@ class SubscriptionsAction extends Action {
|
|||||||
|
|
||||||
$subs = DB_DataObject::factory('subscription');
|
$subs = DB_DataObject::factory('subscription');
|
||||||
$subs->subscriber = $profile->id;
|
$subs->subscriber = $profile->id;
|
||||||
|
|
||||||
# We ask for an extra one to know if we need to do another page
|
# We ask for an extra one to know if we need to do another page
|
||||||
|
|
||||||
$subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1);
|
$subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1);
|
||||||
|
|
||||||
$subs_count = $subs->find();
|
$subs_count = $subs->find();
|
||||||
|
|
||||||
common_element_start('div', 'subscriptions');
|
common_element_start('div', 'subscriptions');
|
||||||
|
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
|
|
||||||
while ($subs->fetch()) {
|
while ($subs->fetch()) {
|
||||||
$idx++;
|
$idx++;
|
||||||
if ($idx % SUBSCRIPTIONS_PER_ROW == 1) {
|
if ($idx % SUBSCRIPTIONS_PER_ROW == 1) {
|
||||||
@ -75,27 +75,27 @@ class SubscriptionsAction extends Action {
|
|||||||
common_element_end('a');
|
common_element_end('a');
|
||||||
|
|
||||||
# XXX: subscribe form here
|
# XXX: subscribe form here
|
||||||
|
|
||||||
if ($idx % SUBSCRIPTIONS_PER_ROW == 0) {
|
if ($idx % SUBSCRIPTIONS_PER_ROW == 0) {
|
||||||
common_element_end('div');
|
common_element_end('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($idx == SUBSCRIPTIONS_PER_PAGE) {
|
if ($idx == SUBSCRIPTIONS_PER_PAGE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page > 1) {
|
if ($page > 1) {
|
||||||
common_element('a', array('href' =>
|
common_element('a', array('href' =>
|
||||||
common_local_url('subscriptions',
|
common_local_url('subscriptions',
|
||||||
array('nickname' => $profile->nickname,
|
array('nickname' => $profile->nickname,
|
||||||
'page' => $page - 1)),
|
'page' => $page - 1)),
|
||||||
'class' => 'prev'),
|
'class' => 'prev'),
|
||||||
_t('Previous'));
|
_t('Previous'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subs_count > SUBSCRIPTIONS_PER_PAGE) {
|
if ($subs_count > SUBSCRIPTIONS_PER_PAGE) {
|
||||||
common_element('a', array('href' =>
|
common_element('a', array('href' =>
|
||||||
common_local_url('subscriptions',
|
common_local_url('subscriptions',
|
||||||
array('nickname' => $profile->nickname,
|
array('nickname' => $profile->nickname,
|
||||||
'page' => $page + 1)),
|
'page' => $page + 1)),
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -30,22 +30,22 @@ class UnsubscribeAction extends Action {
|
|||||||
common_user_error(_t('No such user.'));
|
common_user_error(_t('No such user.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
|
||||||
if (!$user->isSubscribed($other)) {
|
if (!$user->isSubscribed($other)) {
|
||||||
common_server_error(_t('Not subscribed!.'));
|
common_server_error(_t('Not subscribed!.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub = new Subscription();
|
$sub = new Subscription();
|
||||||
$sub->subscriber = $user->id;
|
$sub->subscriber = $user->id;
|
||||||
$sub->subscribed = $other->id;
|
$sub->subscribed = $other->id;
|
||||||
|
|
||||||
if (!$sub->delete()) {
|
if (!$sub->delete()) {
|
||||||
common_server_error(_t('Couldn\'t delete subscription.'));
|
common_server_error(_t('Couldn\'t delete subscription.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
common_redirect(common_local_url('all', array('nickname' =>
|
common_redirect(common_local_url('all', array('nickname' =>
|
||||||
$user->nickname)));
|
$user->nickname)));
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
*/
|
*/
|
||||||
require_once 'DB/DataObject.php';
|
require_once 'DB/DataObject.php';
|
||||||
|
|
||||||
class Avatar extends DB_DataObject
|
class Avatar extends DB_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
/* the code below is auto generated do not remove the above tag */
|
/* the code below is auto generated do not remove the above tag */
|
||||||
|
|
||||||
public $__table = 'avatar'; // table name
|
public $__table = 'avatar'; // table name
|
||||||
public $profile_id; // int(4) primary_key not_null
|
public $profile_id; // int(4) primary_key not_null
|
||||||
public $original; // tinyint(1)
|
public $original; // tinyint(1)
|
||||||
public $width; // int(4) primary_key not_null
|
public $width; // int(4) primary_key not_null
|
||||||
public $height; // int(4) primary_key not_null
|
public $height; // int(4) primary_key not_null
|
||||||
public $mediatype; // varchar(32) not_null
|
public $mediatype; // varchar(32) not_null
|
||||||
public $filename; // varchar(255)
|
public $filename; // varchar(255)
|
||||||
public $url; // varchar(255) unique_key
|
public $url; // varchar(255) unique_key
|
||||||
public $created; // datetime() not_null
|
public $created; // datetime() not_null
|
||||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||||
@ -25,15 +25,15 @@ class Avatar extends DB_DataObject
|
|||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function validateMediatype() {
|
function validateMediatype() {
|
||||||
return Validate::string($this->mediatype, array('min_length' => 1, 'max_length' => 32));
|
return Validate::string($this->mediatype, array('min_length' => 1, 'max_length' => 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateFilename() {
|
function validateFilename() {
|
||||||
return Validate::string($this->filename, array('min_length' => 1, 'max_length' => 255));
|
return Validate::string($this->filename, array('min_length' => 1, 'max_length' => 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateUrl() {
|
function validateUrl() {
|
||||||
return Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
|
return Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,7 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
*/
|
*/
|
||||||
require_once 'DB/DataObject.php';
|
require_once 'DB/DataObject.php';
|
||||||
|
|
||||||
class Notice extends DB_DataObject
|
class Notice extends DB_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
/* the code below is auto generated do not remove the above tag */
|
/* the code below is auto generated do not remove the above tag */
|
||||||
@ -32,8 +32,8 @@ class Notice extends DB_DataObject
|
|||||||
public $__table = 'notice'; // table name
|
public $__table = 'notice'; // table name
|
||||||
public $id; // int(4) primary_key not_null
|
public $id; // int(4) primary_key not_null
|
||||||
public $profile_id; // int(4) not_null
|
public $profile_id; // int(4) not_null
|
||||||
public $content; // varchar(140)
|
public $content; // varchar(140)
|
||||||
public $url; // varchar(255)
|
public $url; // varchar(255)
|
||||||
public $created; // datetime() not_null
|
public $created; // datetime() not_null
|
||||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||||
|
|
||||||
@ -45,18 +45,18 @@ class Notice extends DB_DataObject
|
|||||||
|
|
||||||
// XXX: if profile_id changes, this goes invalid. To be fair, that's a very edge case
|
// XXX: if profile_id changes, this goes invalid. To be fair, that's a very edge case
|
||||||
static $profile;
|
static $profile;
|
||||||
|
|
||||||
function getProfile() {
|
function getProfile() {
|
||||||
if (!$this->profile) {
|
if (!$this->profile) {
|
||||||
$this->profile = Profile::staticGet($this->profile_id);
|
$this->profile = Profile::staticGet($this->profile_id);
|
||||||
}
|
}
|
||||||
return $this->profile;
|
return $this->profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateContent() {
|
function validateContent() {
|
||||||
return Validate::string($this->content, array('min_length' => 1, 'max_length' => 140));
|
return Validate::string($this->content, array('min_length' => 1, 'max_length' => 140));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateUrl() {
|
function validateUrl() {
|
||||||
return is_null($this->url) ||
|
return is_null($this->url) ||
|
||||||
Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
|
Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,7 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
*/
|
*/
|
||||||
require_once 'DB/DataObject.php';
|
require_once 'DB/DataObject.php';
|
||||||
|
|
||||||
class Profile extends DB_DataObject
|
class Profile extends DB_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
/* the code below is auto generated do not remove the above tag */
|
/* the code below is auto generated do not remove the above tag */
|
||||||
@ -32,11 +32,11 @@ class Profile extends DB_DataObject
|
|||||||
public $__table = 'profile'; // table name
|
public $__table = 'profile'; // table name
|
||||||
public $id; // int(4) primary_key not_null
|
public $id; // int(4) primary_key not_null
|
||||||
public $nickname; // varchar(64) not_null
|
public $nickname; // varchar(64) not_null
|
||||||
public $fullname; // varchar(255)
|
public $fullname; // varchar(255)
|
||||||
public $profileurl; // varchar(255)
|
public $profileurl; // varchar(255)
|
||||||
public $homepage; // varchar(255)
|
public $homepage; // varchar(255)
|
||||||
public $bio; // varchar(140)
|
public $bio; // varchar(140)
|
||||||
public $location; // varchar(255)
|
public $location; // varchar(255)
|
||||||
public $created; // datetime() not_null
|
public $created; // datetime() not_null
|
||||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class Profile extends DB_DataObject
|
|||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function getAvatar($width, $height=NULL) {
|
function getAvatar($width, $height=NULL) {
|
||||||
$avatar = DB_DataObject::factory('avatar');
|
$avatar = DB_DataObject::factory('avatar');
|
||||||
$avatar->profile_id = $this->id;
|
$avatar->profile_id = $this->id;
|
||||||
@ -61,7 +61,7 @@ class Profile extends DB_DataObject
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOriginalAvatar() {
|
function getOriginalAvatar() {
|
||||||
$avatar = DB_DataObject::factory('avatar');
|
$avatar = DB_DataObject::factory('avatar');
|
||||||
$avatar->profile_id = $this->id;
|
$avatar->profile_id = $this->id;
|
||||||
@ -72,31 +72,31 @@ class Profile extends DB_DataObject
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateNickname() {
|
function validateNickname() {
|
||||||
return Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64,
|
return Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64,
|
||||||
'format' => VALIDATE_ALPHA_LOWER . VALIDATE_NUM));
|
'format' => VALIDATE_ALPHA_LOWER . VALIDATE_NUM));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateProfileurl() {
|
function validateProfileurl() {
|
||||||
return Validate::uri($this->profileurl, array('allowed_schemes' => array('http', 'https')));
|
return Validate::uri($this->profileurl, array('allowed_schemes' => array('http', 'https')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateHomepage() {
|
function validateHomepage() {
|
||||||
return (is_null($this->homepage) ||
|
return (is_null($this->homepage) ||
|
||||||
Validate::uri($this->homepage, array('allowed_schemes' => array('http', 'https'))));
|
Validate::uri($this->homepage, array('allowed_schemes' => array('http', 'https'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateBio() {
|
function validateBio() {
|
||||||
return is_null($this->bio) ||
|
return is_null($this->bio) ||
|
||||||
Validate::string($this->bio, array('min_length' => 1, 'max_length' => 140));
|
Validate::string($this->bio, array('min_length' => 1, 'max_length' => 140));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateLocation() {
|
function validateLocation() {
|
||||||
return is_null($this->location) ||
|
return is_null($this->location) ||
|
||||||
Validate::string($this->location, array('min_length' => 1, 'max_length' => 255));
|
Validate::string($this->location, array('min_length' => 1, 'max_length' => 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateFullname() {
|
function validateFullname() {
|
||||||
return is_null($this->fullname) ||
|
return is_null($this->fullname) ||
|
||||||
Validate::string($this->fullname, array('min_length' => 1, 'max_length' => 255));
|
Validate::string($this->fullname, array('min_length' => 1, 'max_length' => 255));
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,7 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
*/
|
*/
|
||||||
require_once 'DB/DataObject.php';
|
require_once 'DB/DataObject.php';
|
||||||
|
|
||||||
class Remote_profile extends DB_DataObject
|
class Remote_profile extends DB_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
/* the code below is auto generated do not remove the above tag */
|
/* the code below is auto generated do not remove the above tag */
|
||||||
@ -40,7 +40,7 @@ class Remote_profile extends DB_DataObject
|
|||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function validateUrl() {
|
function validateUrl() {
|
||||||
return is_null($this->url) ||
|
return is_null($this->url) ||
|
||||||
Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
|
Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,7 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
*/
|
*/
|
||||||
require_once 'DB/DataObject.php';
|
require_once 'DB/DataObject.php';
|
||||||
|
|
||||||
class Subscription extends DB_DataObject
|
class Subscription extends DB_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
/* the code below is auto generated do not remove the above tag */
|
/* the code below is auto generated do not remove the above tag */
|
||||||
@ -32,7 +32,7 @@ class Subscription extends DB_DataObject
|
|||||||
public $__table = 'subscription'; // table name
|
public $__table = 'subscription'; // table name
|
||||||
public $subscriber; // int(4) primary_key not_null
|
public $subscriber; // int(4) primary_key not_null
|
||||||
public $subscribed; // int(4) primary_key not_null
|
public $subscribed; // int(4) primary_key not_null
|
||||||
public $token; // varchar(255)
|
public $token; // varchar(255)
|
||||||
public $created; // datetime() not_null
|
public $created; // datetime() not_null
|
||||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,7 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
require_once 'DB/DataObject.php';
|
require_once 'DB/DataObject.php';
|
||||||
require_once 'Validate.php';
|
require_once 'Validate.php';
|
||||||
|
|
||||||
class User extends DB_DataObject
|
class User extends DB_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
/* the code below is auto generated do not remove the above tag */
|
/* the code below is auto generated do not remove the above tag */
|
||||||
@ -32,7 +32,7 @@ class User extends DB_DataObject
|
|||||||
public $__table = 'user'; // table name
|
public $__table = 'user'; // table name
|
||||||
public $id; // int(4) primary_key not_null
|
public $id; // int(4) primary_key not_null
|
||||||
public $nickname; // varchar(64) unique_key
|
public $nickname; // varchar(64) unique_key
|
||||||
public $password; // varchar(255)
|
public $password; // varchar(255)
|
||||||
public $email; // varchar(255) unique_key
|
public $email; // varchar(255) unique_key
|
||||||
public $created; // datetime() not_null
|
public $created; // datetime() not_null
|
||||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||||
@ -42,7 +42,7 @@ class User extends DB_DataObject
|
|||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function getProfile() {
|
function getProfile() {
|
||||||
$profile = DB_DataObject::factory('profile');
|
$profile = DB_DataObject::factory('profile');
|
||||||
$profile->id = $this->id;
|
$profile->id = $this->id;
|
||||||
@ -52,7 +52,7 @@ class User extends DB_DataObject
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSubscribed($other) {
|
function isSubscribed($other) {
|
||||||
assert(!is_null($other));
|
assert(!is_null($other));
|
||||||
$sub = DB_DataObject::factory('subscription');
|
$sub = DB_DataObject::factory('subscription');
|
||||||
@ -60,11 +60,11 @@ class User extends DB_DataObject
|
|||||||
$sub->subscribed = $other->id;
|
$sub->subscribed = $other->id;
|
||||||
return $sub->find();
|
return $sub->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateEmail() {
|
function validateEmail() {
|
||||||
return Validate::email($this->email, true);
|
return Validate::email($this->email, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateNickname() {
|
function validateNickname() {
|
||||||
return Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64,
|
return Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64,
|
||||||
'format' => VALIDATE_ALPHA_LOWER . VALIDATE_NUM));
|
'format' => VALIDATE_ALPHA_LOWER . VALIDATE_NUM));
|
||||||
|
@ -16,4 +16,3 @@ $config['site']['path'] = 'laconica';
|
|||||||
|
|
||||||
$config['db']['database'] = 'mysql://laconica:microblog@localhost/laconica';
|
$config['db']['database'] = 'mysql://laconica:microblog@localhost/laconica';
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -22,10 +22,10 @@ if (!defined('LACONICA')) { exit(1); }
|
|||||||
class Action { // lawsuit
|
class Action { // lawsuit
|
||||||
|
|
||||||
var $args;
|
var $args;
|
||||||
|
|
||||||
function Action() {
|
function Action() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function arg($key) {
|
function arg($key) {
|
||||||
if (array_key_exists($key, $this->args)) {
|
if (array_key_exists($key, $this->args)) {
|
||||||
return $this->args[$key];
|
return $this->args[$key];
|
||||||
@ -33,7 +33,7 @@ class Action { // lawsuit
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle($argarray) {
|
function handle($argarray) {
|
||||||
$this->args = array();
|
$this->args = array();
|
||||||
foreach ($argarray as $k => $v) {
|
foreach ($argarray as $k => $v) {
|
||||||
|
@ -1,25 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* XXX: break up into separate modules (HTTP, HTML, user, files) */
|
/* XXX: break up into separate modules (HTTP, HTML, user, files) */
|
||||||
|
|
||||||
|
|
||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
define('AVATAR_PROFILE_SIZE', 96);
|
define('AVATAR_PROFILE_SIZE', 96);
|
||||||
@ -51,7 +50,7 @@ $config =
|
|||||||
|
|
||||||
$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
|
$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
|
||||||
|
|
||||||
$config['db'] =
|
$config['db'] =
|
||||||
array('database' => 'YOU HAVE TO SET THIS IN config.php',
|
array('database' => 'YOU HAVE TO SET THIS IN config.php',
|
||||||
'schema_location' => INSTALLDIR . '/classes',
|
'schema_location' => INSTALLDIR . '/classes',
|
||||||
'class_location' => INSTALLDIR . '/classes',
|
'class_location' => INSTALLDIR . '/classes',
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
class SettingsAction extends Action {
|
class SettingsAction extends Action {
|
||||||
@ -37,7 +37,7 @@ class SettingsAction extends Action {
|
|||||||
function handle_post() {
|
function handle_post() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_form($msg=NULL, $success=false) {
|
function show_form($msg=NULL, $success=false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ class SettingsAction extends Action {
|
|||||||
$msg);
|
$msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function settings_menu() {
|
function settings_menu() {
|
||||||
common_element_start('ul', 'headmenu');
|
common_element_start('ul', 'headmenu');
|
||||||
common_menu_item(common_local_url('profilesettings'),
|
common_menu_item(common_local_url('profilesettings'),
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('LACONICA')) { exit(1); }
|
if (!defined('LACONICA')) { exit(1); }
|
||||||
|
|
||||||
define('NOTICES_PER_PAGE', 20);
|
define('NOTICES_PER_PAGE', 20);
|
||||||
@ -39,8 +39,8 @@ class StreamAction extends Action {
|
|||||||
'class' => 'avatar stream',
|
'class' => 'avatar stream',
|
||||||
'width' => AVATAR_STREAM_SIZE,
|
'width' => AVATAR_STREAM_SIZE,
|
||||||
'height' => AVATAR_STREAM_SIZE,
|
'height' => AVATAR_STREAM_SIZE,
|
||||||
'alt' =>
|
'alt' =>
|
||||||
($profile->fullname) ? $profile->fullname :
|
($profile->fullname) ? $profile->fullname :
|
||||||
$profile->nickname));
|
$profile->nickname));
|
||||||
common_element_end('a');
|
common_element_end('a');
|
||||||
common_element('a', array('href' => $profile->profileurl,
|
common_element('a', array('href' => $profile->profileurl,
|
||||||
|
24
lib/util.php
24
lib/util.php
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Laconica - a distributed open-source microblogging tool
|
* Laconica - a distributed open-source microblogging tool
|
||||||
* Copyright (C) 2008, Controlez-Vous, Inc.
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -69,7 +69,7 @@ function common_show_header($pagetitle) {
|
|||||||
global $config, $xw;
|
global $config, $xw;
|
||||||
|
|
||||||
header('Content-Type: application/xhtml+xml');
|
header('Content-Type: application/xhtml+xml');
|
||||||
|
|
||||||
$xw = new XMLWriter();
|
$xw = new XMLWriter();
|
||||||
$xw->openURI('php://output');
|
$xw->openURI('php://output');
|
||||||
$xw->setIndent(true);
|
$xw->setIndent(true);
|
||||||
@ -78,13 +78,13 @@ function common_show_header($pagetitle) {
|
|||||||
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
|
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
|
||||||
|
|
||||||
# FIXME: correct language for interface
|
# FIXME: correct language for interface
|
||||||
|
|
||||||
common_element_start('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
|
common_element_start('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
|
||||||
'xml:lang' => 'en',
|
'xml:lang' => 'en',
|
||||||
'lang' => 'en'));
|
'lang' => 'en'));
|
||||||
|
|
||||||
common_element_start('head');
|
common_element_start('head');
|
||||||
common_element('title', NULL,
|
common_element('title', NULL,
|
||||||
$pagetitle . " - " . $config['site']['name']);
|
$pagetitle . " - " . $config['site']['name']);
|
||||||
common_element('link', array('rel' => 'stylesheet',
|
common_element('link', array('rel' => 'stylesheet',
|
||||||
'type' => 'text/css',
|
'type' => 'text/css',
|
||||||
@ -102,7 +102,7 @@ function common_show_header($pagetitle) {
|
|||||||
common_element_start('body');
|
common_element_start('body');
|
||||||
common_element_start('div', array('id' => 'wrapper'));
|
common_element_start('div', array('id' => 'wrapper'));
|
||||||
common_element_start('div', array('id' => 'content'));
|
common_element_start('div', array('id' => 'content'));
|
||||||
common_element_start('div', array('id' => 'header'));
|
common_element_start('div', array('id' => 'header'));
|
||||||
common_element('h1', 'title', $pagetitle);
|
common_element('h1', 'title', $pagetitle);
|
||||||
common_element('h2', 'subtitle', $config['site']['name']);
|
common_element('h2', 'subtitle', $config['site']['name']);
|
||||||
common_element_end('div');
|
common_element_end('div');
|
||||||
@ -155,7 +155,7 @@ function common_head_menu() {
|
|||||||
common_menu_item(common_local_url('doc', array('title' => 'help')),
|
common_menu_item(common_local_url('doc', array('title' => 'help')),
|
||||||
_t('Help'));
|
_t('Help'));
|
||||||
if ($user) {
|
if ($user) {
|
||||||
common_menu_item(common_local_url('all', array('nickname' =>
|
common_menu_item(common_local_url('all', array('nickname' =>
|
||||||
$user->nickname)),
|
$user->nickname)),
|
||||||
_t('Home'));
|
_t('Home'));
|
||||||
common_menu_item(common_local_url('showstream', array('nickname' =>
|
common_menu_item(common_local_url('showstream', array('nickname' =>
|
||||||
@ -243,7 +243,7 @@ function common_check_user($nickname, $password) {
|
|||||||
if (is_null($user)) {
|
if (is_null($user)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return (0 == strcmp(common_munge_password($password, $user->id),
|
return (0 == strcmp(common_munge_password($password, $user->id),
|
||||||
$user->password));
|
$user->password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,6 +379,6 @@ function common_profile_url($nickname) {
|
|||||||
|
|
||||||
// XXX: set up gettext
|
// XXX: set up gettext
|
||||||
|
|
||||||
function _t($str) {
|
function _t($str) {
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user