summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/columndef.php169
-rw-r--r--lib/htmloutputter.php5
-rw-r--r--lib/noticelist.php42
-rw-r--r--lib/schema.php168
-rw-r--r--lib/searchaction.php4
-rw-r--r--lib/searchgroupnav.php4
-rw-r--r--lib/tabledef.php63
7 files changed, 270 insertions, 185 deletions
diff --git a/lib/columndef.php b/lib/columndef.php
new file mode 100644
index 000000000..1bae6b33b
--- /dev/null
+++ b/lib/columndef.php
@@ -0,0 +1,169 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Database schema utilities
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Database
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * A class encapsulating the structure of a column in a table.
+ *
+ * @category Database
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+class ColumnDef
+{
+ /** name of the column. */
+ public $name;
+ /** type of column, e.g. 'int', 'varchar' */
+ public $type;
+ /** size of the column. */
+ public $size;
+ /** boolean flag; can it be null? */
+ public $nullable;
+ /**
+ * type of key: null = no key; 'PRI' => primary;
+ * 'UNI' => unique key; 'MUL' => multiple values.
+ */
+ public $key;
+ /** default value if any. */
+ public $default;
+ /** 'extra' stuff. Returned by MySQL, largely
+ * unused. */
+ public $extra;
+ /** auto increment this field if no value is specific for it during an insert **/
+ public $auto_increment;
+
+ /**
+ * Constructor.
+ *
+ * @param string $name name of the column
+ * @param string $type type of the column
+ * @param int $size size of the column
+ * @param boolean $nullable can this be null?
+ * @param string $key type of key
+ * @param value $default default value
+ * @param value $extra unused
+ */
+
+ function __construct($name=null, $type=null, $size=null,
+ $nullable=true, $key=null, $default=null,
+ $extra=null, $auto_increment=false)
+ {
+ $this->name = strtolower($name);
+ $this->type = strtolower($type);
+ $this->size = $size+0;
+ $this->nullable = $nullable;
+ $this->key = $key;
+ $this->default = $default;
+ $this->extra = $extra;
+ $this->auto_increment = $auto_increment;
+ }
+
+ /**
+ * Compares this columndef with another to see
+ * if they're functionally equivalent.
+ *
+ * @param ColumnDef $other column to compare
+ *
+ * @return boolean true if equivalent, otherwise false.
+ */
+
+ function equals($other)
+ {
+ return ($this->name == $other->name &&
+ $this->_typeMatch($other) &&
+ $this->_defaultMatch($other) &&
+ $this->_nullMatch($other) &&
+ $this->key == $other->key &&
+ $this->auto_increment == $other->auto_increment);
+ }
+
+ /**
+ * Does the type of this column match the
+ * type of the other column?
+ *
+ * Checks the type and size of a column. Tries
+ * to ignore differences between synonymous
+ * data types, like 'integer' and 'int'.
+ *
+ * @param ColumnDef $other other column to check
+ *
+ * @return boolean true if they're about equivalent
+ */
+
+ private function _typeMatch($other)
+ {
+ switch ($this->type) {
+ case 'integer':
+ case 'int':
+ return ($other->type == 'integer' ||
+ $other->type == 'int');
+ break;
+ default:
+ return ($this->type == $other->type &&
+ $this->size == $other->size);
+ }
+ }
+
+ /**
+ * Does the default behaviour of this column match
+ * the other?
+ *
+ * @param ColumnDef $other other column to check
+ *
+ * @return boolean true if defaults are effectively the same.
+ */
+
+ private function _defaultMatch($other)
+ {
+ return ((is_null($this->default) && is_null($other->default)) ||
+ ($this->default == $other->default));
+ }
+
+ /**
+ * Does the null behaviour of this column match
+ * the other?
+ *
+ * @param ColumnDef $other other column to check
+ *
+ * @return boolean true if these columns 'null' the same.
+ */
+
+ private function _nullMatch($other)
+ {
+ return ((!is_null($this->default) && !is_null($other->default) &&
+ $this->default == $other->default) ||
+ ($this->nullable == $other->nullable));
+ }
+}
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index c2ec83c28..d267526c8 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -34,9 +34,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
require_once INSTALLDIR.'/lib/xmloutputter.php';
-define('PAGE_TYPE_PREFS',
- 'text/html,application/xhtml+xml,'.
- 'application/xml;q=0.3,text/xml;q=0.2');
+// Can include XHTML options but these are too fragile in practice.
+define('PAGE_TYPE_PREFS', 'text/html');
/**
* Low-level generator for HTML
diff --git a/lib/noticelist.php b/lib/noticelist.php
index dd97b85bd..21cec528f 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -396,22 +396,44 @@ class NoticeListItem extends Widget
$lon = $this->notice->lon;
$latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : '';
+ if (empty($name)) {
+ $latdms = $this->decimalDegreesToDMS(abs($lat));
+ $londms = $this->decimalDegreesToDMS(abs($lon));
+ $name = sprintf(
+ _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'),
+ $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')),
+ $londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W')));
+ }
+
$url = $location->getUrl();
$this->out->elementStart('span', array('class' => 'location'));
$this->out->text(_('at'));
+ if (empty($url)) {
+ $this->out->element('span', array('class' => 'geo',
+ 'title' => $latlon),
+ $name);
+ } else {
+ $this->out->element('a', array('class' => 'geo',
+ 'title' => $latlon,
+ 'href' => $url),
+ $name);
+ }
+ $this->out->elementEnd('span');
+ }
- $this->out->elementStart('a', array('class' => 'geo', 'href' => $url));
- $this->out->elementStart('abbr', array('class' => 'latitude', 'title' => $lat, 'style' => empty($name)?null:'display: none'));
- $this->out->text($lat); //TODO translate to a prettier format, like "S 37.2 deg" instead of "-37.2"
- $this->out->elementEnd('abbr');
- $this->out->elementStart('abbr', array('class' => 'longitude', 'title' => $lon, 'style' => empty($name)?null:'display: none'));
- $this->out->text($lon);
- $this->out->elementEnd('abbr');
- $this->out->text($name);
- $this->out->elementEnd('a');
+ function decimalDegreesToDMS($dec)
+ {
- $this->out->elementEnd('span');
+ $vars = explode(".",$dec);
+ $deg = $vars[0];
+ $tempma = "0.".$vars[1];
+
+ $tempma = $tempma * 3600;
+ $min = floor($tempma / 60);
+ $sec = $tempma - ($min*60);
+
+ return array("deg"=>$deg,"min"=>$min,"sec"=>$sec);
}
/**
diff --git a/lib/schema.php b/lib/schema.php
index 560884d9f..11e2b6f60 100644
--- a/lib/schema.php
+++ b/lib/schema.php
@@ -547,171 +547,3 @@ class Schema
return $sql;
}
}
-
-/**
- * A class encapsulating the structure of a table.
- *
- * @category Database
- * @package StatusNet
- * @author Evan Prodromou <evan@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-class TableDef
-{
- /** name of the table */
- public $name;
- /** array of ColumnDef objects for the columns. */
- public $columns;
-
- /**
- * Constructor.
- *
- * @param string $name name of the table
- * @param array $columns columns in the table
- */
-
- function __construct($name=null,$columns=null)
- {
- $this->name = $name;
- $this->columns = $columns;
- }
-}
-
-/**
- * A class encapsulating the structure of a column in a table.
- *
- * @category Database
- * @package StatusNet
- * @author Evan Prodromou <evan@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-class ColumnDef
-{
- /** name of the column. */
- public $name;
- /** type of column, e.g. 'int', 'varchar' */
- public $type;
- /** size of the column. */
- public $size;
- /** boolean flag; can it be null? */
- public $nullable;
- /**
- * type of key: null = no key; 'PRI' => primary;
- * 'UNI' => unique key; 'MUL' => multiple values.
- */
- public $key;
- /** default value if any. */
- public $default;
- /** 'extra' stuff. Returned by MySQL, largely
- * unused. */
- public $extra;
- /** auto increment this field if no value is specific for it during an insert **/
- public $auto_increment;
-
- /**
- * Constructor.
- *
- * @param string $name name of the column
- * @param string $type type of the column
- * @param int $size size of the column
- * @param boolean $nullable can this be null?
- * @param string $key type of key
- * @param value $default default value
- * @param value $extra unused
- */
-
- function __construct($name=null, $type=null, $size=null,
- $nullable=true, $key=null, $default=null,
- $extra=null, $auto_increment=false)
- {
- $this->name = strtolower($name);
- $this->type = strtolower($type);
- $this->size = $size+0;
- $this->nullable = $nullable;
- $this->key = $key;
- $this->default = $default;
- $this->extra = $extra;
- $this->auto_increment = $auto_increment;
- }
-
- /**
- * Compares this columndef with another to see
- * if they're functionally equivalent.
- *
- * @param ColumnDef $other column to compare
- *
- * @return boolean true if equivalent, otherwise false.
- */
-
- function equals($other)
- {
- return ($this->name == $other->name &&
- $this->_typeMatch($other) &&
- $this->_defaultMatch($other) &&
- $this->_nullMatch($other) &&
- $this->key == $other->key &&
- $this->auto_increment == $other->auto_increment);
- }
-
- /**
- * Does the type of this column match the
- * type of the other column?
- *
- * Checks the type and size of a column. Tries
- * to ignore differences between synonymous
- * data types, like 'integer' and 'int'.
- *
- * @param ColumnDef $other other column to check
- *
- * @return boolean true if they're about equivalent
- */
-
- private function _typeMatch($other)
- {
- switch ($this->type) {
- case 'integer':
- case 'int':
- return ($other->type == 'integer' ||
- $other->type == 'int');
- break;
- default:
- return ($this->type == $other->type &&
- $this->size == $other->size);
- }
- }
-
- /**
- * Does the default behaviour of this column match
- * the other?
- *
- * @param ColumnDef $other other column to check
- *
- * @return boolean true if defaults are effectively the same.
- */
-
- private function _defaultMatch($other)
- {
- return ((is_null($this->default) && is_null($other->default)) ||
- ($this->default == $other->default));
- }
-
- /**
- * Does the null behaviour of this column match
- * the other?
- *
- * @param ColumnDef $other other column to check
- *
- * @return boolean true if these columns 'null' the same.
- */
-
- private function _nullMatch($other)
- {
- return ((!is_null($this->default) && !is_null($other->default) &&
- $this->default == $other->default) ||
- ($this->nullable == $other->nullable));
- }
-}
diff --git a/lib/searchaction.php b/lib/searchaction.php
index 130b28ff5..bb71a2ba1 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -123,8 +123,8 @@ class SearchAction extends Action
if (!common_config('site', 'fancy')) {
$this->hidden('action', $this->trimmed('action'));
}
- $this->input('q', 'Keyword(s)', $q);
- $this->submit('search', 'Search');
+ $this->input('q', _('Keyword(s)'), $q);
+ $this->submit('search', _('Search'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
diff --git a/lib/searchgroupnav.php b/lib/searchgroupnav.php
index 677365ea9..e843dc096 100644
--- a/lib/searchgroupnav.php
+++ b/lib/searchgroupnav.php
@@ -79,9 +79,9 @@ class SearchGroupNav extends Widget
}
$this->out->menuItem(common_local_url('peoplesearch', $args), _('People'),
_('Find people on this site'), $action_name == 'peoplesearch', 'nav_search_people');
- $this->out->menuItem(common_local_url('noticesearch', $args), _('Notice'),
+ $this->out->menuItem(common_local_url('noticesearch', $args), _('Notices'),
_('Find content of notices'), $action_name == 'noticesearch', 'nav_search_notice');
- $this->out->menuItem(common_local_url('groupsearch', $args), _('Group'),
+ $this->out->menuItem(common_local_url('groupsearch', $args), _('Groups'),
_('Find groups on this site'), $action_name == 'groupsearch', 'nav_search_group');
$this->action->elementEnd('ul');
}
diff --git a/lib/tabledef.php b/lib/tabledef.php
new file mode 100644
index 000000000..3aace123b
--- /dev/null
+++ b/lib/tabledef.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Database schema utilities
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Database
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * A class encapsulating the structure of a table.
+ *
+ * @category Database
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+class TableDef
+{
+ /** name of the table */
+ public $name;
+ /** array of ColumnDef objects for the columns. */
+ public $columns;
+
+ /**
+ * Constructor.
+ *
+ * @param string $name name of the table
+ * @param array $columns columns in the table
+ */
+
+ function __construct($name=null,$columns=null)
+ {
+ $this->name = $name;
+ $this->columns = $columns;
+ }
+}