We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b53391e5 authored by Evan Prodromou's avatar Evan Prodromou

Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x

parents 7dd532b6 7cfbe7c2

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -24,7 +24,7 @@
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @copyright 2008-2010 StatusNet, Inc.
* @copyright 2008-2011 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/
*/
......@@ -92,7 +92,6 @@ class PathsadminpanelAction extends AdminPanelAction
'site' => array('path', 'locale_path', 'ssl', 'sslserver'),
'theme' => array('server', 'dir', 'path', 'sslserver', 'sslpath'),
'avatar' => array('server', 'dir', 'path'),
'background' => array('server', 'dir', 'path', 'sslserver', 'sslpath'),
'attachments' => array('server', 'dir', 'path', 'sslserver', 'sslpath')
);
......@@ -163,14 +162,6 @@ class PathsadminpanelAction extends AdminPanelAction
$this->clientError(sprintf(_('Avatar directory not writable: %s.'), $values['avatar']['dir']));
}
// Validate background dir
if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) {
// TRANS: Client error in Paths admin panel.
// TRANS: %s is the background directory that could not be written to.
$this->clientError(sprintf(_('Background directory not writable: %s.'), $values['background']['dir']));
}
// Validate locales dir
// XXX: What else do we need to validate for lacales path here? --Z
......
......@@ -36,7 +36,7 @@ class Memcached_DataObject extends Safe_DataObject
$v = $k;
$keys = self::pkeyCols($cls);
if (count($keys) > 1) {
// FIXME: maybe call pkeyGet() ourselves?
// FIXME: maybe call pkeyGet() ourselves?
throw new Exception('Use pkeyGet() for compound primary keys');
}
$k = $keys[0];
......@@ -113,10 +113,10 @@ class Memcached_DataObject extends Safe_DataObject
} else {
$result = array_fill_keys($keyVals, null);
}
$toFetch = array();
foreach ($keyVals as $keyVal) {
$toFetch = array();
foreach ($keyVals as $keyVal) {
if (is_array($keyCol)) {
$kv = array_combine($keyCol, $keyVal);
......@@ -124,25 +124,26 @@ class Memcached_DataObject extends Safe_DataObject
$kv = array($keyCol => $keyVal);
}
$kv = array_merge($otherCols, $kv);
$i = self::multicache($cls, $kv);
if ($i !== false) {
$kv = array_merge($otherCols, $kv);
$i = self::multicache($cls, $kv);
if ($i !== false) {
if (is_array($keyCol)) {
$result[implode(',', $keyVal)] = $i;
} else {
$result[$keyVal] = $i;
}
} else if (!empty($keyVal)) {
$toFetch[] = $keyVal;
}
}
if (count($toFetch) > 0) {
} else if (!empty($keyVal)) {
$toFetch[] = $keyVal;
}
}
if (count($toFetch) > 0) {
$i = DB_DataObject::factory($cls);
if (empty($i)) {
throw new Exception(_('Cannot instantiate class ' . $cls));
// TRANS: Exception thrown when a program code class (%s) cannot be instantiated.
throw new Exception(sprintf(_('Cannot instantiate class %s.'),$cls));
}
foreach ($otherCols as $otherKeyCol => $otherKeyVal) {
$i->$otherKeyCol = $otherKeyVal;
......@@ -152,10 +153,10 @@ class Memcached_DataObject extends Safe_DataObject
} else {
$i->whereAddIn($keyCol, $toFetch, $i->columnType($keyCol));
}
if ($i->find()) {
while ($i->fetch()) {
$copy = clone($i);
$copy->encache();
if ($i->find()) {
while ($i->fetch()) {
$copy = clone($i);
$copy->encache();
if (is_array($keyCol)) {
$vals = array();
foreach ($keyCol as $k) {
......@@ -165,36 +166,36 @@ class Memcached_DataObject extends Safe_DataObject
} else {
$result[$i->$keyCol] = $copy;
}
}
}
// Save state of DB misses
foreach ($toFetch as $keyVal) {
}
}
// Save state of DB misses
foreach ($toFetch as $keyVal) {
$r = null;
if (is_array($keyCol)) {
$r = $result[implode(',', $keyVal)];
} else {
$r = $result[$keyVal];
}
if (empty($r)) {
if (empty($r)) {
if (is_array($keyCol)) {
$kv = array_combine($keyCol, $keyVal);
} else {
$kv = array($keyCol => $keyVal);
}
$kv = array_merge($otherCols, $kv);
// save the fact that no such row exists
$c = self::memcache();
if (!empty($c)) {
$ck = self::multicacheKey($cls, $kv);
$c->set($ck, null);
}
}
}
}
// save the fact that no such row exists
$c = self::memcache();
if (!empty($c)) {
$ck = self::multicacheKey($cls, $kv);
$c->set($ck, null);
}
}
}
}
return $result;
return $result;
}
static function _inMultiKey($i, $cols, $values)
......@@ -249,7 +250,8 @@ class Memcached_DataObject extends Safe_DataObject
{
$i = DB_DataObject::factory($cls);
if (empty($i)) {
throw new Exception(_('Cannot instantiate a ' . $cls));
// TRANS: Exception thrown when a program code class (%s) cannot be instantiated.
throw new Exception(sprintf(_('Cannot instantiate class %s.'),$cls));
}
$types = $i->keyTypes();
ksort($types);
......@@ -267,27 +269,27 @@ class Memcached_DataObject extends Safe_DataObject
function listGet($cls, $keyCol, $keyVals)
{
$pkeyMap = array_fill_keys($keyVals, array());
$pkeyMap = array_fill_keys($keyVals, array());
$result = array_fill_keys($keyVals, array());
$pkeyCols = self::pkeyCols($cls);
$toFetch = array();
$toFetch = array();
$allPkeys = array();
// We only cache keys -- not objects!
foreach ($keyVals as $keyVal) {
$l = self::cacheGet(sprintf("%s:list-ids:%s:%s", strtolower($cls), $keyCol, $keyVal));
if ($l !== false) {
$pkeyMap[$keyVal] = $l;
foreach ($keyVals as $keyVal) {
$l = self::cacheGet(sprintf("%s:list-ids:%s:%s", strtolower($cls), $keyCol, $keyVal));
if ($l !== false) {
$pkeyMap[$keyVal] = $l;
foreach ($l as $pkey) {
$allPkeys[] = $pkey;
}
} else {
$toFetch[] = $keyVal;
}
}
} else {
$toFetch[] = $keyVal;
}
}
if (count($allPkeys) > 0) {
$keyResults = self::pivotGet($cls, $pkeyCols, $allPkeys);
......@@ -303,10 +305,11 @@ class Memcached_DataObject extends Safe_DataObject
}
if (count($toFetch) > 0) {
$i = DB_DataObject::factory($cls);
if (empty($i)) {
throw new Exception(_('Cannot instantiate class ' . $cls));
}
$i = DB_DataObject::factory($cls);
if (empty($i)) {
// TRANS: Exception thrown when a program code class (%s) cannot be instantiated.
throw new Exception(sprintf(_('Cannot instantiate class %s.'),$cls));
}
$i->whereAddIn($keyCol, $toFetch, $i->columnType($keyCol));
if ($i->find()) {
sprintf("listGet() got {$i->N} results for class $cls key $keyCol");
......@@ -320,32 +323,32 @@ class Memcached_DataObject extends Safe_DataObject
}
$pkeyMap[$i->$keyCol][] = $pkeyVal;
}
}
foreach ($toFetch as $keyVal) {
}
foreach ($toFetch as $keyVal) {
self::cacheSet(sprintf("%s:list-ids:%s:%s", strtolower($cls), $keyCol, $keyVal),
$pkeyMap[$keyVal]);
}
}
return $result;
}
function columnType($columnName)
{
$keys = $this->table();
if (!array_key_exists($columnName, $keys)) {
throw new Exception('Unknown key column ' . $columnName . ' in ' . join(',', array_keys($keys)));
}
$def = $keys[$columnName];
if ($def & DB_DATAOBJECT_INT) {
return 'integer';
} else {
return 'string';
}
}
}
}
return $result;
}
function columnType($columnName)
{
$keys = $this->table();
if (!array_key_exists($columnName, $keys)) {
throw new Exception('Unknown key column ' . $columnName . ' in ' . join(',', array_keys($keys)));
}
$def = $keys[$columnName];
if ($def & DB_DATAOBJECT_INT) {
return 'integer';
} else {
return 'string';
}
}
/**
* @todo FIXME: Should this return false on lookup fail to match staticGet?
*/
......
......@@ -317,7 +317,6 @@ class ApiAction extends Action
$twitter_status['source'] = $source;
$twitter_status['id'] = intval($notice->id);
$twitter_status['statusnet_conversation_id'] = intval($notice->conversation);
$replier_profile = null;
......@@ -376,7 +375,7 @@ class ApiAction extends Action
// StatusNet-specific
$twitter_status['statusnet_html'] = $notice->rendered;
$twitter_status['statusnet_conversation_id'] = $notice->conversation;
$twitter_status['statusnet_conversation_id'] = intval($notice->conversation);
return $twitter_status;
}
......
......@@ -41,7 +41,6 @@ define('MEMBERS_PER_SECTION', 27);
* @author Zach Copley <zach@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 GroupAction extends Action
{
......@@ -93,7 +92,7 @@ class GroupAction extends Action
$this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed if no local group with a given name was found requesting group page.
// TRANS: Client error displayed if no local group with a given name was found requesting group page.
$this->clientError(_('No such group.'), 404);
return false;
}
......@@ -140,18 +139,17 @@ class GroupAction extends Action
'class' => 'section'));
if (Event::handle('StartShowGroupMembersMiniList', array($this))) {
// TRANS: Header for mini list of group members on a group page (h2).
$this->elementStart('h2');
$this->element('a', array('href' => common_local_url('groupmembers', array('nickname' =>
$this->group->nickname))),
// TRANS: Header for mini list of group members on a group page (h2).
_('Members'));
$this->text(' ');
$this->text($this->group->getMemberCount());
$this->elementEnd('h2');
$gmml = new GroupMembersMiniList($member, $this);
......@@ -176,7 +174,6 @@ class GroupAction extends Action
$this->elementEnd('div');
}
function showPending()
{
if ($this->group->join_policy != User_group::JOIN_POLICY_MODERATE) {
......@@ -199,17 +196,18 @@ class GroupAction extends Action
'class' => 'section'));
if (Event::handle('StartShowGroupPendingMiniList', array($this))) {
$this->elementStart('h2');
$this->element('a', array('href' => common_local_url('groupqueue', array('nickname' =>
$this->group->nickname))),
// TRANS: Header for mini list of users with a pending membership request on a group page (h2).
_('Pending'));
$this->text(' ');
$this->text($pending);
$this->elementEnd('h2');
$gmml = new ProfileMiniList($request, $this);
......@@ -233,17 +231,18 @@ class GroupAction extends Action
'class' => 'section'));
if (Event::handle('StartShowGroupBlockedMiniList', array($this))) {
$this->elementStart('h2');
$this->element('a', array('href' => common_local_url('blockedfromgroup', array('nickname' =>
$this->group->nickname))),
// TRANS: Header for mini list of users that are blocked in a group page (h2).
_('Blocked'));
$this->text(' ');
$this->text($this->group->getBlockedCount());
$this->elementEnd('h2');
$gmml = new GroupBlockedMiniList($blocked, $this);
......@@ -279,7 +278,6 @@ class GroupAction extends Action
$adminSection->show();
}
function noticeFormOptions()
{
$options = parent::noticeFormOptions();
......@@ -376,4 +374,3 @@ class ThreadingGroupNoticeStream extends ThreadingNoticeStream
parent::__construct(new GroupNoticeStream($group, $profile));
}
}
......@@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc.
*
* Profile block to show for a group
*
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
......@@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class GroupProfileBlock extends ProfileBlock
{
protected $group = null;
......
......@@ -413,9 +413,7 @@ abstract class Installer
'server' => $this->server,
'path' => $this->path,
'db_database' => $this->db['database'],
'db_type' => $this->db['type'],
'site_profile' => $this->siteProfile,
'nickname' => $this->adminNick
'db_type' => $this->db['type']
));
// assemble configuration file in a string
......@@ -435,10 +433,36 @@ abstract class Installer
// database
"\$config['db']['database'] = {$vals['db_database']};\n\n".
($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":'').
"\$config['db']['type'] = {$vals['db_type']};\n\n".
"\$config['db']['type'] = {$vals['db_type']};\n\n";
// Normalize line endings for Windows servers
$cfg = str_replace("\n", PHP_EOL, $cfg);
// site profile
"\$config['site']['profile'] = {$vals['site_profile']};\n";
// write configuration file out to install directory
$res = file_put_contents(INSTALLDIR.'/config.php', $cfg);
return $res;
}
/**
* Write the site profile. We do this after creating the initial user
* in case the site profile is set to single user. This gets around the
* 'chicken-and-egg' problem of the system requiring a valid user for
* single user mode, before the intial user is actually created. Yeah,
* we should probably do this in smarter way.
*
* @return int res number of bytes written
*/
function writeSiteProfile()
{
$vals = $this->phpVals(array(
'site_profile' => $this->siteProfile,
'nickname' => $this->adminNick
));
$cfg =
// site profile
"\$config['site']['profile'] = {$vals['site_profile']};\n";
if ($this->siteProfile == "singleuser") {
$cfg .= "\$config['singleuser']['nickname'] = {$vals['nickname']};\n\n";
......@@ -450,7 +474,7 @@ abstract class Installer
$cfg = str_replace("\n", PHP_EOL, $cfg);
// write configuration file out to install directory
$res = file_put_contents(INSTALLDIR.'/config.php', $cfg);
$res = file_put_contents(INSTALLDIR.'/config.php', $cfg, FILE_APPEND);
return $res;
}
......@@ -557,6 +581,9 @@ abstract class Installer
return false;
}
// Make sure we can write to the file twice
$oldUmask = umask(000);
if (!$this->skipConfig) {
$this->updateStatus("Writing config file...");
$res = $this->writeConf();
......@@ -582,6 +609,21 @@ abstract class Installer
}
}
if (!$this->skipConfig) {
$this->updateStatus("Setting site profile...");
$res = $this->writeSiteProfile();
if (!$res) {
$this->updateStatus("Can't write to config file.", true);
return false;
}
}
// Restore original umask
umask($oldUmask);
// Set permissions back to something decent
chmod(INSTALLDIR.'/config.php', 0644);
/*
TODO https needs to be considered
*/
......
......@@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc.
*
* Form for searching a StatusNet site
*
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
......@@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class SearchForm extends Form
{
/**
......@@ -55,7 +54,6 @@ class SearchForm extends Form
*
* @return void
*/
function formData()
{
$this->out->element('input', array('name' => 'q',
......@@ -71,11 +69,11 @@ class SearchForm extends Form
*
* @return void
*/
function formActions()
{
$this->out->element('input', array('type' => 'submit',
'value' => _('Search')));
// TRANS: Button text for search button on search form.
'value' => _m('BUTTON','Search')));
}
/**
......@@ -86,7 +84,6 @@ class SearchForm extends Form
*
* @return int ID of the form
*/
function id()
{
return 'header-search';
......@@ -100,7 +97,6 @@ class SearchForm extends Form
*
* @return string URL to post to
*/
function action()
{
return common_local_url('noticesearch');
......
......@@ -48,7 +48,7 @@ class SiteProfile
$sprofileClass = ucfirst($name) . "Site";
if (class_exists($sprofileClass)) {
return $sprofileClass::getSettings();
return call_user_func(array($sprofileClass, 'getSettings'));
} else {
common_log(
LOG_ERR,
......
This diff is collapsed.
This diff is collapsed.
......@@ -11,17 +11,17 @@ msgid ""
msgstr ""
"Project-Id-Version: StatusNet - Core\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-20 18:34+0000\n"
"PO-Revision-Date: 2011-08-20 18:36:19+0000\n"
"POT-Creation-Date: 2011-08-30 09:27+0000\n"
"PO-Revision-Date: 2011-08-30 09:30:01+0000\n"
"Language-Team: Bulgarian <//translatewiki.net/wiki/Portal:bg>\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: MediaWiki 1.19alpha (r95098); Translate extension (2011-07-09)\n"
"X-Generator: MediaWiki 1.19alpha (r95739); Translate extension (2011-08-26)\n"
"X-Translation-Project: translatewiki.net at //translatewiki.net\n"
"X-Language-Code: bg\n"
"X-Message-Group: #out-statusnet-core\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-POT-Import-Date: 2011-08-16 06:58:31+0000\n"
"X-POT-Import-Date: 2011-08-20 19:35:32+0000\n"
#. TRANS: Database error message.
#, php-format
......@@ -428,7 +428,7 @@ msgstr "Разговор"
msgid "No conversation with ID %d."
msgstr "Разговор"