Commit 5f65337f by Maiyannah Bishop

NaturalDocs formatting per #62

1 parent 27837f52
<?php
/* ============================================================================
* postActiv - a fork of the GNU Social microblogging software
* Title: Location Preferences
* Class to hold a user's instant messaging preferences
*
* postActiv:
* the micro-blogging software
*
* Copyright:
* Copyright (C) 2016, Maiyannah Bishop
*
* Derived from code copyright various sources:
* GNU Social (C) 2013-2016, Free Software Foundation, Inc
* StatusNet (C) 2008-2012, StatusNet, Inc
* o GNU Social (C) 2013-2016, Free Software Foundation, Inc
* o StatusNet (C) 2008-2012, StatusNet, Inc
* ----------------------------------------------------------------------------
* License:
* 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
......@@ -18,27 +26,47 @@
*
* 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/>.
*
* <https://www.gnu.org/licenses/agpl.html>
* ----------------------------------------------------------------------------
* About:
* Data class for user IM preferences
*
* PHP version 5
* PHP version:
* Tested with PHP 5.6
* ----------------------------------------------------------------------------
* File Authors:
* o Craig Andrews <candrews@integralblue.com>
* o Brion Vibber <brion@pobox.com>
* o Evan Prodromou
* o Mikael Nordfeldth <mmn@hethane.se>
* o Maiyannah Bishop <maiyannah.bishop@postactiv.com>
*
* @category Accounts
* @package postActiv
* @author Craig Andrews <candrews@integralblue.com>
* @author Brion Vibber <brion@pobox.com>
* @author Evan Prodromou <evan@prodromou.name>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @author Maiyannah Bishop <maiyannah.bishop@postactiv.com>
* @copyright 2010-2011 StatusNet, Inc.
* @copyright 2013-2016 Free Software Foundation, Inc.
* @copyright 2016 Maiyannah Bishop
* @license https://www.gnu.org/licenses/agpl.html
* @link http://www.postactiv.com/
* Web:
* o postActiv <http://www.postactiv.com>
* o GNU social <https://www.gnu.org/s/social/>
* ============================================================================
*/
// This file is formatted so that it provides useful documentation output in
// NaturalDocs. Please be considerate of this before changing formatting.
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
// -----------------------------------------------------------------------------
// Class: User_im_prefs
// Class to hold user IM preferences
//
// Variables:
// o __table
// o user_id
// o screenname
// o transport
// o notify
// o replies
// o updatefrompresence
// o created
// o modified
class User_im_prefs extends Managed_DataObject
{
###START_AUTOCODE
......@@ -57,28 +85,35 @@ class User_im_prefs extends Managed_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'),
'screenname' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'screenname on this service'),
'transport' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'),
'notify' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Notify when a new notice is sent'),
'replies' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to'),
'updatefrompresence' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to.'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id', 'transport'),
'unique keys' => array(
'transport_screenname_key' => array('transport', 'screenname'),
),
'foreign keys' => array(
'user_im_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
// -------------------------------------------------------------------------
// Function: schemaDef
// Returns the schema definition for this class
//
// Returns:
// o array
public static function schemaDef()
{
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'),
'screenname' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'screenname on this service'),
'transport' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'),
'notify' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Notify when a new notice is sent'),
'replies' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to'),
'updatefrompresence' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to.'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id', 'transport'),
'unique keys' => array(
'transport_screenname_key' => array('transport', 'screenname'),
),
'foreign keys' => array(
'user_im_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
}
// END OF FILE
// ============================================================================
?>
\ No newline at end of file
<?php
/* ============================================================================
* postActiv - a fork of the GNU Social microblogging software
* Title: Location Preferences
* Class to hold a user's location preferences
*
* postActiv:
* the micro-blogging software
*
* Copyright:
* Copyright (C) 2016, Maiyannah Bishop
*
* Derived from code copyright various sources:
* GNU Social (C) 2013-2016, Free Software Foundation, Inc
* StatusNet (C) 2008-2012, StatusNet, Inc
* o GNU Social (C) 2013-2016, Free Software Foundation, Inc
* o StatusNet (C) 2008-2012, StatusNet, Inc
* ----------------------------------------------------------------------------
* License:
* 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
......@@ -18,25 +26,41 @@
*
* 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/>.
*
* <https://www.gnu.org/licenses/agpl.html>
* ----------------------------------------------------------------------------
* About:
* Data class for user location preferences
*
* PHP version 5
* PHP version:
* Tested with PHP 5.6
* ----------------------------------------------------------------------------
* File Authors:
* o Evan Prodromou
* o Mikael Nordfeldth <mmn@hethane.se>
* o Maiyannah Bishop <maiyannah.bishop@postactiv.com>
*
* @category Geolocation
* @package postActiv
* @author Evan Prodromou <evan@status.net>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @author Maiyannah Bishop <maiyannah.bishop@postactiv.com>
* @copyright 2009-2011 StatusNet, Inc.
* @copyright 2013-2016 Free Software Foundation, Inc.
* @copyright 2016 Maiyannah Bishop
* @license https://www.gnu.org/licenses/agpl.html
* @link http://www.postactiv.com/
* Web:
* o postActiv <http://www.postactiv.com>
* o GNU social <https://www.gnu.org/s/social/>
* ============================================================================
*/
// This file is formatted so that it provides useful documentation output in
// NaturalDocs. Please be considerate of this before changing formatting.
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
// ============================================================================
// Class: User_location_prefs
// Class to hold user location data preferences
//
// Variables:
// o __table
// o user_id
// o share_location
// o created
// o modified
class User_location_prefs extends Managed_DataObject
{
###START_AUTOCODE
......@@ -51,20 +75,28 @@ class User_location_prefs extends Managed_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who has the preference'),
'share_location' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Whether to share location data'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id'),
'foreign keys' => array(
'user_location_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
// -------------------------------------------------------------------------
// Function: schemaDef
// Returns the schema definition of this class
//
// Returns:
// o array
public static function schemaDef() {
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who has the preference'),
'share_location' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Whether to share location data'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id'),
'foreign keys' => array(
'user_location_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
}
// END OF FILE
// ============================================================================
?>
\ No newline at end of file
<?php
/* ============================================================================
* postActiv - a fork of the GNU Social microblogging software
* Title: URL Shortener Preferences
* Class to hold a user's URL shortener preferences
*
* postActiv:
* the micro-blogging software
*
* Copyright:
* Copyright (C) 2016, Maiyannah Bishop
*
* Derived from code copyright various sources:
* GNU Social (C) 2013-2016, Free Software Foundation, Inc
* StatusNet (C) 2008-2012, StatusNet, Inc
* o GNU Social (C) 2013-2016, Free Software Foundation, Inc
* o StatusNet (C) 2008-2012, StatusNet, Inc
* ----------------------------------------------------------------------------
* License:
* 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
......@@ -18,26 +26,42 @@
*
* 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/>.
*
* <https://www.gnu.org/licenses/agpl.html>
* ----------------------------------------------------------------------------
* Data class for user location preferences
* About:
* Data class for user URL shortener preferences
*
* PHP version 5
* PHP version:
* Tested with PHP 5.6
* ----------------------------------------------------------------------------
* File Authors:
* o Evan Prodromou
* o Mikael Nordfeldth <mmn@hethane.se>
* o Roland Haeder <roland@mxchange.org>
* o Maiyannah Bishop <maiyannah.bishop@postactiv.com>
*
* @category Accounts
* @package PostActiv
* @author Evan Prodromou <evan@status.net>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @author Roland Haeder <roland@mxchange.org>
* @author Maiyannah Bishop <maiyannah.bishop@postactiv.com>
* @copyright 2010-2011 StatusNet, Inc.
* @copyright 2013-2016 Free Software Foundation, Inc.
* @copyright 2016 Maiyannah Bishop
* @license https://www.gnu.org/licenses/agpl.html
* @link http://www.postactiv.com/
* Web:
* o postActiv <http://www.postactiv.com>
* o GNU social <https://www.gnu.org/s/social/>
* ============================================================================
*/
// This file is formatted so that it provides useful documentation output in
// NaturalDocs. Please be considerate of this before changing formatting.
if (!defined('POSTACTIV')) { exit(1); }
// ============================================================================
// Class: User_urlshortener_prefs
//
// Variables:
// o __table
// o user_id
// o urlshorteningservice
// o maxurllength
// o created
// o modified
class User_urlshortener_prefs extends Managed_DataObject
{
###START_AUTOCODE
......@@ -54,86 +78,118 @@ class User_urlshortener_prefs extends Managed_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'),
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
'maxurllength' => array('type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, null = never'),
'maxnoticelength' => array('type' => 'int', 'not null' => true, 'description' => 'notices with content greater than this value will have all urls shortened, 0 = always, -1 = only if notice text is longer than max allowed'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id'),
'foreign keys' => array(
'user_urlshortener_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
static function maxUrlLength($user)
{
$def = common_config('url', 'maxurllength');
$prefs = self::getPrefs($user);
if (empty($prefs)) {
// -------------------------------------------------------------------------
// Function: schemaDef
// Returns the table schema for this class
//
// Returns:
// o array
public static function schemaDef() {
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'),
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
'maxurllength' => array('type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, null = never'),
'maxnoticelength' => array('type' => 'int', 'not null' => true, 'description' => 'notices with content greater than this value will have all urls shortened, 0 = always, -1 = only if notice text is longer than max allowed'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id'),
'foreign keys' => array(
'user_urlshortener_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
// -------------------------------------------------------------------------
// Function: maxUrlLength
//
// Parameters:
// o user - user we're checking limits for
//
// Returns:
// o integer
static function maxUrlLength($user) {
$def = common_config('url', 'maxurllength');
$prefs = self::getPrefs($user);
if (empty($prefs)) {
return $def;
} else {
return $prefs->maxurllength;
}
}
// -------------------------------------------------------------------------
// Function: maxNoticeLength
// Returns the maximum notice length this user can post
//
// Paramters:
// o user - user we're checking limits for
//
// Returns:
// o integer
static function maxNoticeLength($user) {
$def = common_config('url', 'maxnoticelength');
if ($def == -1) {
// maxContent==0 means infinite length,
// but maxNoticeLength==0 means "always shorten"
// so if maxContent==0 we must set this to -1
$def = Notice::maxContent() ?: -1;
}
$prefs = self::getPrefs($user);
if (empty($prefs)) {
return $def;
} else {
return $prefs->maxnoticelength;
}
}
// -------------------------------------------------------------------------
// Function: urlShorteningService
// Returns the currently-specified urlShorteningService for the user
//
// Parameters:
// user - user to retrieve the service for
//
// Returns:
// o string
static function urlShorteningService($user) {
$def = common_config('url', 'shortener');
$prefs = self::getPrefs($user);
if (empty($prefs)) {
if (!empty($user)) {
return $user->urlshorteningservice;
} else {
return $def;
} else {
return $prefs->maxurllength;
}
}
static function maxNoticeLength($user)
{
$def = common_config('url', 'maxnoticelength');
if ($def == -1) {
/*
* maxContent==0 means infinite length,
* but maxNoticeLength==0 means "always shorten"
* so if maxContent==0 we must set this to -1
*/
$def = Notice::maxContent() ?: -1;
}
$prefs = self::getPrefs($user);
if (empty($prefs)) {
return $def;
} else {
return $prefs->maxnoticelength;
}
}
static function urlShorteningService($user)
{
$def = common_config('url', 'shortener');
$prefs = self::getPrefs($user);
if (empty($prefs)) {
if (!empty($user)) {
return $user->urlshorteningservice;
} else {
return $def;
}
} else {
return $prefs->urlshorteningservice;
}
}
static function getPrefs($user)
{
if (empty($user)) {
return null;
}
$prefs = User_urlshortener_prefs::getKV('user_id', $user->id);
return $prefs;
}
}
} else {
return $prefs->urlshorteningservice;
}
}
// -------------------------------------------------------------------------
// Function: getPrefs
// Returns the preferences for the provided users
//
// Parameters:
// o user - user to get preferences for
//
// Returns:
// o User_urlshortener_prefs object for that user or null if not found
static function getPrefs($user) {
if (empty($user)) {
return null;
}
$prefs = User_urlshortener_prefs::getKV('user_id', $user->id);
return $prefs;
}
}
// END OF FILE
// ============================================================================
?>
\ No newline at end of file
<?php
/* ============================================================================
* postActiv - a fork of the GNU Social microblogging software
* Title: Username
* Class to hold information about a username
*
* postActiv:
* the micro-blogging software
*
* Copyright:
* Copyright (C) 2016, Maiyannah Bishop
*
* Derived from code copyright various sources:
* GNU Social (C) 2013-2016, Free Software Foundation, Inc
* StatusNet (C) 2008-2012, StatusNet, Inc
* o GNU Social (C) 2013-2016, Free Software Foundation, Inc
* o StatusNet (C) 2008-2012, StatusNet, Inc
* ----------------------------------------------------------------------------
* License:
* 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
......@@ -18,26 +26,44 @@
*
* 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/>.
*
* <https://www.gnu.org/licenses/agpl.html>
* ----------------------------------------------------------------------------
* About:
* Table Definition for user_username
*
* PHP version 5
* PHP version:
* Tested with PHP 5.6
* ----------------------------------------------------------------------------
* File Authors:
* o Craig Androws <candrews@integralblue.com>
* o Jeffery To <jeffery.to@gmail.com>
* o Mikael Nordfeldth <mmn@hethane.se>
* o Evan Prodromou
* o Maiyannah Bishop <maiyannah.bishop@postactiv.com>
*
* @category Accounts
* @package postActiv
* @author Craig Androws <candrews@integralblue.com>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @author Evan Prodromou <evan@prodromou.name>
* @author Maiyannah Bishop <maiyannah.bishop@postactiv.com>
* @copyright 2008-2011 StatusNet, Inc.
* @copyright 2013-2016 Free Software Foundation, Inc.
* @copyright 2016 Maiyannah Bishop
* @license https://www.gnu.org/licenses/agpl.html
* @link http://www.postactiv.com/
* Web:
* o postActiv <http://www.postactiv.com>
* o GNU social <https://www.gnu.org/s/social/>
* ============================================================================
*/
// This file is formatted so that it provides useful documentation output in
// NaturalDocs. Please be considerate of this before changing formatting.
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
// ============================================================================
// Class: User_username
// Table Definition for user_username
//
// Variables:
// o __table
// o user_id
// o provider_name
// o username
// o created
// o modified
class User_username extends Managed_DataObject
{
###START_AUTOCODE
......@@ -53,46 +79,54 @@ class User_username extends Managed_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'provider_name' => array('type' => 'varchar', 'length' => 191, 'description' => 'provider name'),
'username' => array('type' => 'varchar', 'length' => 191, 'description' => 'username'),
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('provider_name', 'username'),
'indexes' => array(
'user_id_idx' => array('user_id')
),
'foreign keys' => array(
'user_username_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
// -------------------------------------------------------------------------
// Function: schemaDef
// Returns the schema definition for this class in the database
//
// Returns:
// o array
public static function schemaDef() {
return array(
'fields' => array(
'provider_name' => array('type' => 'varchar', 'length' => 191, 'description' => 'provider name'),
'username' => array('type' => 'varchar', 'length' => 191, 'description' => 'username'),
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('provider_name', 'username'),
'indexes' => array(
'user_id_idx' => array('user_id')
),
'foreign keys' => array(
'user_username_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
/**
* Register a user with a username on a given provider
* @param User User object
* @param string username on the given provider
* @param provider_name string name of the provider
* @return mixed User_username instance if the registration succeeded, false if it did not
*/
static function register($user, $username, $provider_name)
{
$user_username = new User_username();
$user_username->user_id = $user->id;
$user_username->provider_name = $provider_name;
$user_username->username = $username;
$user_username->created = common_sql_now();
// -------------------------------------------------------------------------
// Function: register
// Register a user with a username on a given provider
//
// @param User User object
// @param string username on the given provider
// @param provider_name string name of the provider
// @return mixed User_username instance if the registration succeeded, false if it did not
static function register($user, $username, $provider_name) {
$user_username = new User_username();
$user_username->user_id = $user->id;
$user_username->provider_name = $provider_name;
$user_username->username = $username;
$user_username->created = common_sql_now();
if($user_username->insert()){
return $user_username;
}else{
return false;
}
}
if($user_username->insert()){
return $user_username;
}else{
return false;
}
}
}
// END OF FILE
// ============================================================================
?>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!