summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/register.php48
-rw-r--r--lib/installer.php5
-rw-r--r--lib/util.php2
-rw-r--r--plugins/Sample/User_greeting_count.php19
4 files changed, 59 insertions, 15 deletions
diff --git a/actions/register.php b/actions/register.php
index d1bc381fb..9b8161e08 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -491,6 +491,45 @@ class RegisterAction extends Action
$this->elementStart('li');
$this->element('input', $attrs);
$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 ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
@@ -499,14 +538,9 @@ class RegisterAction extends Action
'">' .
htmlspecialchars(common_config('license', 'title')) .
'</a>';
- $this->raw(sprintf(htmlspecialchars($message), $link));
- $this->elementEnd('label');
- $this->elementEnd('li');
+ $out .= sprintf(htmlspecialchars($message), $link);
}
- $this->elementEnd('ul');
- $this->submit('submit', _('Register'));
- $this->elementEnd('fieldset');
- $this->elementEnd('form');
+ return $out;
}
/**
diff --git a/lib/installer.php b/lib/installer.php
index 589a19a66..58ffbfef7 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -128,6 +128,7 @@ abstract class Installer
$pass = false;
}
+ // @fixme this check seems to be insufficient with Windows ACLs
if (!is_writable(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));
@@ -409,6 +410,10 @@ abstract class Installer
"\$config['db']['database'] = '{$this->db['database']}';\n\n".
($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\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
$res = file_put_contents(INSTALLDIR.'/config.php', $cfg);
diff --git a/lib/util.php b/lib/util.php
index e0669a1d5..3e3153094 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1379,7 +1379,7 @@ function common_log_line($priority, $msg)
{
static $syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR',
'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()
diff --git a/plugins/Sample/User_greeting_count.php b/plugins/Sample/User_greeting_count.php
index d9a59770d..fc0cbd28f 100644
--- a/plugins/Sample/User_greeting_count.php
+++ b/plugins/Sample/User_greeting_count.php
@@ -94,29 +94,34 @@ class User_greeting_count extends Memcached_DataObject
/**
* return key definitions for DB_DataObject
*
- * DB_DataObject needs to know about keys that the table has; this function
- * defines them.
+ * DB_DataObject needs to know about keys that the table has, since it
+ * 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()
{
- return array('user_id' => 'K');
+ return array_keys($this->keyTypes());
}
/**
* return key definitions for Memcached_DataObject
*
* 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()
{
- return $this->keys();
+ return array('user_id' => 'K');
}
/**