Merge branch 'testing' into 0.9.x

This commit is contained in:
Brion Vibber 2010-05-14 12:14:02 -07:00
commit 065ecc5573
4 changed files with 59 additions and 15 deletions

View File

@ -491,6 +491,45 @@ class RegisterAction extends Action
$this->elementStart('li'); $this->elementStart('li');
$this->element('input', $attrs); $this->element('input', $attrs);
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
$this->raw($this->licenseCheckbox());
$this->elementEnd('label');
$this->elementEnd('li');
}
$this->elementEnd('ul');
$this->submit('submit', _('Register'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
function licenseCheckbox()
{
$out = '';
switch (common_config('license', 'type')) {
case 'private':
// TRANS: Copyright checkbox label in registration dialog, for private sites.
$out .= htmlspecialchars(sprintf(
_('I understand that content and data of %1$s are private and confidential.'),
common_config('site', 'name')));
// fall through
case 'allrightsreserved':
if ($out != '') {
$out .= ' ';
}
if (common_config('license', 'owner')) {
// TRANS: Copyright checkbox label in registration dialog, for all rights reserved with a specified copyright owner.
$out .= htmlspecialchars(sprintf(
_('My text and files are copyright by %1$s.'),
common_config('license', 'owner')));
} else {
// TRANS: Copyright checkbox label in registration dialog, for all rights reserved with ownership left to contributors.
$out .= htmlspecialchars(_('My text and files remain under my own copyright.'));
}
// TRANS: Copyright checkbox label in registration dialog, for all rights reserved.
$out .= ' ' . _('All rights reserved.');
break;
case 'cc': // fall through
default:
// TRANS: Copyright checkbox label in registration dialog, for Creative Commons-style licenses.
$message = _('My text and files are available under %s ' . $message = _('My text and files are available under %s ' .
'except this private data: password, ' . 'except this private data: password, ' .
'email address, IM address, and phone number.'); 'email address, IM address, and phone number.');
@ -499,14 +538,9 @@ class RegisterAction extends Action
'">' . '">' .
htmlspecialchars(common_config('license', 'title')) . htmlspecialchars(common_config('license', 'title')) .
'</a>'; '</a>';
$this->raw(sprintf(htmlspecialchars($message), $link)); $out .= sprintf(htmlspecialchars($message), $link);
$this->elementEnd('label');
$this->elementEnd('li');
} }
$this->elementEnd('ul'); return $out;
$this->submit('submit', _('Register'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
} }
/** /**

View File

@ -128,6 +128,7 @@ abstract class Installer
$pass = false; $pass = false;
} }
// @fixme this check seems to be insufficient with Windows ACLs
if (!is_writable(INSTALLDIR)) { if (!is_writable(INSTALLDIR)) {
$this->warning(sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR), $this->warning(sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR),
sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR)); sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR));
@ -409,6 +410,10 @@ abstract class Installer
"\$config['db']['database'] = '{$this->db['database']}';\n\n". "\$config['db']['database'] = '{$this->db['database']}';\n\n".
($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":''). ($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":'').
"\$config['db']['type'] = '{$this->db['type']}';\n\n"; "\$config['db']['type'] = '{$this->db['type']}';\n\n";
// Normalize line endings for Windows servers
$cfg = str_replace("\n", PHP_EOL, $cfg);
// write configuration file out to install directory // write configuration file out to install directory
$res = file_put_contents(INSTALLDIR.'/config.php', $cfg); $res = file_put_contents(INSTALLDIR.'/config.php', $cfg);

View File

@ -1379,7 +1379,7 @@ function common_log_line($priority, $msg)
{ {
static $syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR', static $syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR',
'LOG_WARNING', 'LOG_NOTICE', 'LOG_INFO', 'LOG_DEBUG'); 'LOG_WARNING', 'LOG_NOTICE', 'LOG_INFO', 'LOG_DEBUG');
return date('Y-m-d H:i:s') . ' ' . $syslog_priorities[$priority] . ': ' . $msg . "\n"; return date('Y-m-d H:i:s') . ' ' . $syslog_priorities[$priority] . ': ' . $msg . PHP_EOL;
} }
function common_request_id() function common_request_id()

View File

@ -94,29 +94,34 @@ class User_greeting_count extends Memcached_DataObject
/** /**
* return key definitions for DB_DataObject * return key definitions for DB_DataObject
* *
* DB_DataObject needs to know about keys that the table has; this function * DB_DataObject needs to know about keys that the table has, since it
* defines them. * won't appear in StatusNet's own keys list. In most cases, this will
* simply reference your keyTypes() function.
* *
* @return array key definitions * @return array list of key field names
*/ */
function keys() function keys()
{ {
return array('user_id' => 'K'); return array_keys($this->keyTypes());
} }
/** /**
* return key definitions for Memcached_DataObject * return key definitions for Memcached_DataObject
* *
* Our caching system uses the same key definitions, but uses a different * Our caching system uses the same key definitions, but uses a different
* method to get them. * method to get them. This key information is used to store and clear
* cached data, so be sure to list any key that will be used for static
* lookups.
* *
* @return array key definitions * @return array associative array of key definitions, field name to type:
* 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here.
*/ */
function keyTypes() function keyTypes()
{ {
return $this->keys(); return array('user_id' => 'K');
} }
/** /**