summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-07-21 12:50:45 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-07-21 12:50:45 -0700
commit0a602725b1c49d246e77b24c723a65cdb0119e8e (patch)
tree83a9b97c7ccc77e645f44df8aa405e2471aea5ff
parentde987a9e63f38a3752491032d7a21759f2cc7560 (diff)
parent3649b9ffbc40c3695344597330ad9c35b26a4976 (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
-rw-r--r--README11
-rw-r--r--classes/Fave.php2
-rw-r--r--classes/Notice.php10
-rw-r--r--classes/User_group.php7
-rw-r--r--db/laconica_pg.sql45
-rw-r--r--db/sms_carrier.sql3
-rw-r--r--install.php214
-rw-r--r--lib/groupsbymemberssection.php2
-rw-r--r--lib/groupsbypostssection.php2
-rw-r--r--lib/grouptagcloudsection.php2
-rw-r--r--lib/language.php2
-rw-r--r--lib/mail.php2
-rw-r--r--lib/popularnoticesection.php6
-rw-r--r--lib/util.php4
-rwxr-xr-xscripts/maildaemon.php43
-rwxr-xr-xscripts/xmppdaemon.php5
-rw-r--r--theme/base/css/ie6.css2
-rw-r--r--theme/pigeonthoughts/css/base.css44
-rw-r--r--theme/pigeonthoughts/css/display.css3
19 files changed, 282 insertions, 127 deletions
diff --git a/README b/README
index b65a08d42..0bf1319c6 100644
--- a/README
+++ b/README
@@ -262,13 +262,16 @@ especially if you've previously installed PHP/MySQL packages.
that user's default group instead. As a last resort, you can create
a new group like "mublog" and add the Web server's user to the group.
-4. You should also take this moment to make your avatar subdirectory
- writeable by the Web server. An insecure way to do this is:
+4. You should also take this moment to make your avatar, background, and
+ file subdirectories writeable by the Web server. An insecure way to do
+ this is:
chmod a+w /var/www/mublog/avatar
+ chmod a+w /var/www/mublog/background
+ chmod a+w /var/www/mublog/file
- You can also make the avatar directory writeable by the Web server
- group, as noted above.
+ You can also make the avatar, background, and file directories
+ writeable by the Web server group, as noted above.
5. Create a database to hold your microblog data. Something like this
should work:
diff --git a/classes/Fave.php b/classes/Fave.php
index c3ec62dcf..4b28d06b4 100644
--- a/classes/Fave.php
+++ b/classes/Fave.php
@@ -79,7 +79,7 @@ class Fave extends Memcached_DataObject
$qry .= 'ORDER BY modified DESC ';
if (!is_null($offset)) {
- $qry .= "LIMIT $offset, $limit";
+ $qry .= "LIMIT $limit OFFSET $offset";
}
$fav->query($qry);
diff --git a/classes/Notice.php b/classes/Notice.php
index 0359c310d..101fadb67 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -873,7 +873,7 @@ class Notice extends Memcached_DataObject
if ($cnt > 0) {
$qry .= ', ';
}
- $qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") ';
+ $qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') ";
$cnt++;
if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
Notice_inbox::gc($id);
@@ -899,10 +899,14 @@ class Notice extends Memcached_DataObject
{
$user = new User();
+ if(common_config('db','quote_identifiers'))
+ $user_table = '"user"';
+ else $user_table = 'user';
+
$qry =
'SELECT id ' .
- 'FROM user JOIN subscription '.
- 'ON user.id = subscription.subscriber ' .
+ 'FROM '. $user_table .' JOIN subscription '.
+ 'ON '. $user_table .'.id = subscription.subscriber ' .
'WHERE subscription.subscribed = %d ';
$user->query(sprintf($qry, $this->profile_id));
diff --git a/classes/User_group.php b/classes/User_group.php
index 27b444705..b1ab1c2d3 100644
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -275,11 +275,14 @@ class User_group extends Memcached_DataObject
// XXX: cache this
$user = new User();
+ if(common_config('db','quote_identifiers'))
+ $user_table = '"user"';
+ else $user_table = 'user';
$qry =
'SELECT id ' .
- 'FROM user JOIN group_member '.
- 'ON user.id = group_member.profile_id ' .
+ 'FROM '. $user_table .' JOIN group_member '.
+ 'ON '. $user_table .'.id = group_member.profile_id ' .
'WHERE group_member.group_id = %d ';
$user->query(sprintf($qry, $this->id));
diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql
index 2d8286c60..f5d35f985 100644
--- a/db/laconica_pg.sql
+++ b/db/laconica_pg.sql
@@ -376,6 +376,20 @@ create table profile_block (
);
+create sequence design_seq;
+create table design (
+ id bigint default nextval('design_seq') /* comment 'design ID'*/,
+ backgroundcolor integer /* comment 'main background color'*/ ,
+ contentcolor integer /*comment 'content area background color'*/ ,
+ sidebarcolor integer /*comment 'sidebar background color'*/ ,
+ textcolor integer /*comment 'text color'*/ ,
+ linkcolor integer /*comment 'link color'*/,
+ backgroundimage varchar(255) /*comment 'background image, if any'*/,
+ disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/,
+ primary key (id)
+);
+
+
create sequence user_group_seq;
create table user_group (
@@ -391,6 +405,8 @@ create table user_group (
homepage_logo varchar(255) /* comment 'homepage (profile) size logo' */,
stream_logo varchar(255) /* comment 'stream-sized logo' */,
mini_logo varchar(255) /* comment 'mini logo' */,
+ design_id integer /*comment 'id of a design' */ references design(id),
+
created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
modified timestamp /* comment 'date this record was modified' */
@@ -487,18 +503,25 @@ create table file_to_post (
unique(file_id, post_id)
);
-create sequence design_seq;
-create table design (
- id bigint default nextval('design_seq') /* comment 'design ID'*/,
- backgroundcolor integer /* comment 'main background color'*/ ,
- contentcolor integer /*comment 'content area background color'*/ ,
- sidebarcolor integer /*comment 'sidebar background color'*/ ,
- textcolor integer /*comment 'text color'*/ ,
- linkcolor integer /*comment 'link color'*/,
- backgroundimage varchar(255) /*comment 'background image, if any'*/,
- disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/,
- primary key (id)
+create table group_block (
+ group_id integer not null /* comment 'group profile is blocked from' */ references user_group (id),
+ blocked integer not null /* comment 'profile that is blocked' */references profile (id),
+ blocker integer not null /* comment 'user making the block'*/ references "user" (id),
+ modified timestamp /* comment 'date of blocking'*/ ,
+
+ primary key (group_id, blocked)
+);
+
+create table group_alias (
+
+ alias varchar(64) /* comment 'additional nickname for the group'*/ ,
+ group_id integer not null /* comment 'group profile is blocked from'*/ references user_group (id),
+ modified timestamp /* comment 'date alias was created'*/,
+ primary key (alias)
+
);
+create index group_alias_group_id_idx on group_alias (group_id);
+
/* Textsearch stuff */
diff --git a/db/sms_carrier.sql b/db/sms_carrier.sql
index 6879f2089..055606f58 100644
--- a/db/sms_carrier.sql
+++ b/db/sms_carrier.sql
@@ -60,4 +60,5 @@ VALUES
(100112, 'Cincinnati Bell Wireless', '%s@gocbw.com', now()),
(100113, 'T-Mobile Germany', '%s@t-mobile-sms.de', now()),
(100114, 'Vodafone Germany', '%s@vodafone-sms.de', now()),
- (100115, 'E-Plus', '%s@smsmail.eplus.de', now());
+ (100115, 'E-Plus', '%s@smsmail.eplus.de', now()),
+ (100116, 'Cellular South', '%s@csouth1.com', now());
diff --git a/install.php b/install.php
index 8f500259e..1d3a531c5 100644
--- a/install.php
+++ b/install.php
@@ -48,7 +48,7 @@ function checkPrereqs()
$pass = false;
}
- $reqs = array('gd', 'mysql', 'curl',
+ $reqs = array('gd', 'curl',
'xmlwriter', 'mbstring',
'gettext');
@@ -58,6 +58,10 @@ function checkPrereqs()
$pass = false;
}
}
+ if (!checkExtension('pgsql') && !checkExtension('mysql')) {
+ ?><p class="error">Cannot find mysql or pgsql extension. You need one or the other: <code><?php echo $req; ?></code></p><?php
+ $pass = false;
+ }
if (!is_writable(INSTALLDIR)) {
?><p class="error">Cannot write config file to: <code><?php echo INSTALLDIR; ?></code></p>
@@ -66,17 +70,16 @@ function checkPrereqs()
$pass = false;
}
- if (!is_writable(INSTALLDIR.'/avatar/')) {
- ?><p class="error">Cannot write avatar directory: <code><?php echo INSTALLDIR; ?>/avatar/</code></p>
- <p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?>/avatar/</code></p>
- <?
- $pass = false;
- }
- if (!is_writable(INSTALLDIR.'/background/')) {
- ?><p class="error">Cannot write background directory: <code><?php echo INSTALLDIR; ?>/background/</code></p>
- <p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?>/background/</code></p>
- <?
- $pass = false;
+ // Check the subdirs used for file uploads
+ $fileSubdirs = array('avatar', 'background', 'file');
+ foreach ($fileSubdirs as $fileSubdir) {
+ $fileFullPath = INSTALLDIR."/$fileSubdir/";
+ if (!is_writable($fileFullPath)) {
+ ?><p class="error">Cannot write <?php echo $fileSubdir; ?> directory: <code><?php echo $fileFullPath; ?></code></p>
+ <p>On your server, try this command: <code>chmod a+w <?php echo $fileFullPath; ?></code></p>
+ <?
+ $pass = false;
+ }
}
return $pass;
@@ -127,7 +130,15 @@ function showForm()
<p class="form_guide">Database hostname</p>
</li>
<li>
- <label for="host">Database</label>
+
+ <label for="dbtype">Type</label>
+ <input type="radio" name="dbtype" id="fancy-mysql" value="mysql" checked='checked' /> MySQL<br />
+ <input type="radio" name="dbtype" id="dbtype-pgsql" value="pgsql" /> PostgreSQL<br />
+ <p class="form_guide">Database type</p>
+ </li>
+
+ <li>
+ <label for="database">Name</label>
<input type="text" id="database" name="database" />
<p class="form_guide">Database name</p>
</li>
@@ -139,7 +150,7 @@ function showForm()
<li>
<label for="password">Password</label>
<input type="password" id="password" name="password" />
- <p class="form_guide">Database password</p>
+ <p class="form_guide">Database password (optional)</p>
</li>
</ul>
<input type="submit" name="submit" class="submit" value="Submit" />
@@ -163,6 +174,7 @@ function handlePost()
<?php
$host = $_POST['host'];
+ $dbtype = $_POST['dbtype'];
$database = $_POST['database'];
$username = $_POST['username'];
$password = $_POST['password'];
@@ -191,64 +203,28 @@ function handlePost()
$fail = true;
}
- if (empty($password)) {
- updateStatus("No password specified.", true);
- $fail = true;
- }
+// if (empty($password)) {
+// updateStatus("No password specified.", true);
+// $fail = true;
+// }
if (empty($sitename)) {
updateStatus("No sitename specified.", true);
$fail = true;
}
- if($fail){
- showForm();
- return;
- }
-
- updateStatus("Starting installation...");
- updateStatus("Checking database...");
- $conn = mysql_connect($host, $username, $password);
- if (!$conn) {
- updateStatus("Can't connect to server '$host' as '$username'.", true);
- showForm();
- return;
- }
- updateStatus("Changing to database...");
- $res = mysql_select_db($database, $conn);
- if (!$res) {
- updateStatus("Can't change to database.", true);
- showForm();
- return;
- }
- updateStatus("Running database script...");
- $res = runDbScript(INSTALLDIR.'/db/laconica.sql', $conn);
- if ($res === false) {
- updateStatus("Can't run database script.", true);
- showForm();
- return;
- }
- foreach (array('sms_carrier' => 'SMS carrier',
- 'notice_source' => 'notice source',
- 'foreign_services' => 'foreign service')
- as $scr => $name) {
- updateStatus(sprintf("Adding %s data to database...", $name));
- $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn);
- if ($res === false) {
- updateStatus(sprintf("Can't run %d script.", $name), true);
+ if($fail){
showForm();
- return;
- }
- }
- updateStatus("Writing config file...");
- $sqlUrl = "mysqli://$username:$password@$host/$database";
- $res = writeConf($sitename, $sqlUrl, $fancy);
- if (!$res) {
- updateStatus("Can't write config file.", true);
- showForm();
return;
}
- updateStatus("Done!");
+
+ switch($dbtype) {
+ case 'mysql': mysql_db_installer($host, $database, $username, $password, $sitename);
+ break;
+ case 'pgsql': pgsql_db_installer($host, $database, $username, $password, $sitename);
+ break;
+ default:
+ }
if ($path) $path .= '/';
updateStatus("You can visit your <a href='/$path'>new Laconica site</a>.");
?>
@@ -256,7 +232,106 @@ function handlePost()
<?php
}
-function writeConf($sitename, $sqlUrl, $fancy)
+function pgsql_db_installer($host, $database, $username, $password, $sitename) {
+ $connstring = "dbname=$database host=$host user=$username";
+
+ //No password would mean trust authentication used.
+ if (!empty($password)) {
+ $connstring .= " password=$password";
+ }
+ updateStatus("Starting installation...");
+ updateStatus("Checking database...");
+ $conn = pg_connect($connstring);
+
+ updateStatus("Running database script...");
+ //wrap in transaction;
+ pg_query($conn, 'BEGIN');
+ $res = runDbScript(INSTALLDIR.'/db/laconica_pg.sql', $conn, 'pgsql');
+
+ if ($res === false) {
+ updateStatus("Can't run database script.", true);
+ showForm();
+ return;
+ }
+ foreach (array('sms_carrier' => 'SMS carrier',
+ 'notice_source' => 'notice source',
+ 'foreign_services' => 'foreign service')
+ as $scr => $name) {
+ updateStatus(sprintf("Adding %s data to database...", $name));
+ $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn, 'pgsql');
+ if ($res === false) {
+ updateStatus(sprintf("Can't run %d script.", $name), true);
+ showForm();
+ return;
+ }
+ }
+ pg_query($conn, 'COMMIT');
+
+ updateStatus("Writing config file...");
+ if (empty($password)) {
+ $sqlUrl = "pgsql://$username@$host/$database";
+ }
+ else {
+ $sqlUrl = "pgsql://$username:$password@$host/$database";
+ }
+ $res = writeConf($sitename, $sqlUrl, $fancy, 'pgsql');
+ if (!$res) {
+ updateStatus("Can't write config file.", true);
+ showForm();
+ return;
+ }
+ updateStatus("Done!");
+
+}
+
+function mysql_db_installer($host, $database, $username, $password, $sitename) {
+ updateStatus("Starting installation...");
+ updateStatus("Checking database...");
+
+ $conn = mysql_connect($host, $username, $password);
+ if (!$conn) {
+ updateStatus("Can't connect to server '$host' as '$username'.", true);
+ showForm();
+ return;
+ }
+ updateStatus("Changing to database...");
+ $res = mysql_select_db($database, $conn);
+ if (!$res) {
+ updateStatus("Can't change to database.", true);
+ showForm();
+ return;
+ }
+ updateStatus("Running database script...");
+ $res = runDbScript(INSTALLDIR.'/db/laconica.sql', $conn);
+ if ($res === false) {
+ updateStatus("Can't run database script.", true);
+ showForm();
+ return;
+ }
+ foreach (array('sms_carrier' => 'SMS carrier',
+ 'notice_source' => 'notice source',
+ 'foreign_services' => 'foreign service')
+ as $scr => $name) {
+ updateStatus(sprintf("Adding %s data to database...", $name));
+ $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn);
+ if ($res === false) {
+ updateStatus(sprintf("Can't run %d script.", $name), true);
+ showForm();
+ return;
+ }
+ }
+
+ updateStatus("Writing config file...");
+ $sqlUrl = "mysqli://$username:$password@$host/$database";
+ $res = writeConf($sitename, $sqlUrl, $fancy);
+ if (!$res) {
+ updateStatus("Can't write config file.", true);
+ showForm();
+ return;
+ }
+ updateStatus("Done!");
+ }
+function writeConf($sitename, $sqlUrl, $fancy, $type='mysql')
{
$res = file_put_contents(INSTALLDIR.'/config.php',
"<?php\n".
@@ -264,11 +339,13 @@ function writeConf($sitename, $sqlUrl, $fancy)
"\$config['site']['name'] = \"$sitename\";\n\n".
($fancy ? "\$config['site']['fancy'] = true;\n\n":'').
"\$config['db']['database'] = \"$sqlUrl\";\n\n".
+ ($type == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n" .
+ "\$config['db']['type'] = \"$type\";\n\n" : '').
"?>");
return $res;
}
-function runDbScript($filename, $conn)
+function runDbScript($filename, $conn, $type='mysql')
{
$sql = trim(file_get_contents($filename));
$stmts = explode(';', $sql);
@@ -277,8 +354,13 @@ function runDbScript($filename, $conn)
if (!mb_strlen($stmt)) {
continue;
}
- $res = mysql_query($stmt, $conn);
+ if ($type == 'mysql') {
+ $res = mysql_query($stmt, $conn);
+ } elseif ($type=='pgsql') {
+ $res = pg_query($conn, $stmt);
+ }
if ($res === false) {
+ updateStatus("FAILED SQL: $stmt");
return $res;
}
}
diff --git a/lib/groupsbymemberssection.php b/lib/groupsbymemberssection.php
index 963e21f15..ad4884bf8 100644
--- a/lib/groupsbymemberssection.php
+++ b/lib/groupsbymemberssection.php
@@ -48,7 +48,7 @@ class GroupsByMembersSection extends GroupSection
$qry = 'SELECT user_group.*, count(*) as value ' .
'FROM user_group JOIN group_member '.
'ON user_group.id = group_member.group_id ' .
- 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
+ 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
'ORDER BY value DESC ';
$limit = GROUPS_PER_SECTION;
diff --git a/lib/groupsbypostssection.php b/lib/groupsbypostssection.php
index 325b4033f..dc7925d5e 100644
--- a/lib/groupsbypostssection.php
+++ b/lib/groupsbypostssection.php
@@ -48,7 +48,7 @@ class GroupsByPostsSection extends GroupSection
$qry = 'SELECT user_group.*, count(*) as value ' .
'FROM user_group JOIN group_inbox '.
'ON user_group.id = group_inbox.group_id ' .
- 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
+ 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
'ORDER BY value DESC ';
$limit = GROUPS_PER_SECTION;
diff --git a/lib/grouptagcloudsection.php b/lib/grouptagcloudsection.php
index 9b7a10f6b..0e0cbdd63 100644
--- a/lib/grouptagcloudsection.php
+++ b/lib/grouptagcloudsection.php
@@ -73,7 +73,7 @@ class GroupTagCloudSection extends TagCloudSection
$quoted = array();
foreach ($names as $name) {
- $quoted[] = "\"$name\"";
+ $quoted[] = "'$name'";
}
$namestring = implode(',', $quoted);
diff --git a/lib/language.php b/lib/language.php
index 3ea3dd2aa..9ad2d31bd 100644
--- a/lib/language.php
+++ b/lib/language.php
@@ -53,7 +53,7 @@ function client_prefered_language($httplang)
if (!empty($httplang[2][$i])) {
// if no q default to 1.0
$client_langs[$httplang[2][$i]] =
- ($httplang[6][$i]? (float) $httplang[6][$i] : 1.0);
+ ($httplang[6][$i]? (float) $httplang[6][$i] : 1.0 - ($i*0.01));
}
if (!empty($httplang[3][$i]) && empty($client_langs[$httplang[3][$i]])) {
// if a catchall default 0.01 lower
diff --git a/lib/mail.php b/lib/mail.php
index 90ee3c992..262f788ee 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -121,7 +121,7 @@ function mail_notify_from()
$domain = mail_domain();
- $notifyfrom = common_config('site', 'name') .' <noreply@'.$domain.'>';
+ $notifyfrom = '"'.common_config('site', 'name') .'" <noreply@'.$domain.'>';
}
return $notifyfrom;
diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php
index e47c9b385..167a6ff8d 100644
--- a/lib/popularnoticesection.php
+++ b/lib/popularnoticesection.php
@@ -74,11 +74,7 @@ class PopularNoticeSection extends NoticeSection
$offset = 0;
$limit = NOTICES_PER_SECTION + 1;
- if (common_config('db', 'type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
$notice = Memcached_DataObject::cachedQuery('Notice',
sprintf($qry, common_config('popular', 'dropoff')),
diff --git a/lib/util.php b/lib/util.php
index 9e8ec41d2..f23f10e2c 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -414,9 +414,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
$regex = '#'.
'(?:'.
'(?:'.
- '(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://'.
+ '(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|irc)://'.
'|'.
- '(?:mailto|aim|tel):'.
+ '(?:mailto|aim|tel|xmpp):'.
')'.
'[^.\s]+\.[^\s]+'.
'|'.
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 11ddf06b7..a4003b6b2 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -299,25 +299,40 @@ class MailerDaemon
$attachments = array();
+ $this->extract_part($parsed,$msg,$attachments);
+
+ return array($from, $to, $msg, $attachments);
+ }
+
+ function extract_part($parsed,&$msg,&$attachments){
if ($parsed->ctype_primary == 'multipart') {
- foreach ($parsed->parts as $part) {
- if ($part->ctype_primary == 'text' &&
- $part->ctype_secondary == 'plain') {
- $msg = $part->body;
- }else{
- if ($part->body) {
- $attachment = tmpfile();
- fwrite($attachment, $part->body);
- $attachments[] = $attachment;
- }
+ if($parsed->ctype_secondary == 'alternative'){
+ $altmsg = $this->extract_msg_from_multipart_alternative_part($parsed);
+ if(!empty($altmsg)) $msg = $altmsg;
+ }else{
+ foreach($parsed->parts as $part){
+ $this->extract_part($part,$msg,$attachments);
}
}
- } else if ($type == 'text/plain') {
+ } else if ($parsed->ctype_primary == 'text'
+ && $parsed->ctype_secondary=='plain') {
$msg = $parsed->body;
- } else {
- $this->unsupported_type($type);
+ }else if(!empty($parsed->body)){
+ if(common_config('attachments', 'uploads')){
+ //only save attachments if uploads are enabled
+ $attachment = tmpfile();
+ fwrite($attachment, $parsed->body);
+ $attachments[] = $attachment;
+ }
}
- return array($from, $to, $msg, $attachments);
+ }
+
+ function extract_msg_from_multipart_alternative_part($parsed){
+ foreach ($parsed->parts as $part) {
+ $this->extract_part($part,$msg,$attachments);
+ }
+ //we don't want any attachments that are a result of this parsing
+ return $msg;
}
function unsupported_type($type)
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index 488b4b514..69512f243 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -175,6 +175,10 @@ class XMPPDaemon extends Daemon
$user = $this->get_user($from);
+ // For common_current_user to work
+ global $_cur;
+ $_cur = $user;
+
if (!$user) {
$this->from_site($from, 'Unknown user; go to ' .
common_local_url('imsettings') .
@@ -211,6 +215,7 @@ class XMPPDaemon extends Daemon
$user->free();
unset($user);
+ unset($_cur);
unset($pl['xml']);
$pl['xml'] = null;
diff --git a/theme/base/css/ie6.css b/theme/base/css/ie6.css
index dde4d6fc7..eca240faa 100644
--- a/theme/base/css/ie6.css
+++ b/theme/base/css/ie6.css
@@ -12,7 +12,7 @@ margin:0 auto;
}
#content {
-width:70%;
+width:69%;
}
#aside_primary {
padding:5%;
diff --git a/theme/pigeonthoughts/css/base.css b/theme/pigeonthoughts/css/base.css
index 9866e2d2c..5d5eb9896 100644
--- a/theme/pigeonthoughts/css/base.css
+++ b/theme/pigeonthoughts/css/base.css
@@ -383,7 +383,7 @@ margin-bottom:1em;
}
#content {
-width:49.009%;
+width:50%;
min-height:259px;
float:left;
padding:0 18px;
@@ -402,7 +402,7 @@ float:left;
width:45.917%;
min-height:259px;
float:left;
-margin-left:1.385%;
+margin-left:0.25%;
padding-bottom:47px;
}
@@ -736,11 +736,10 @@ margin-right:11px;
.notice,
.profile {
position:relative;
-padding-top:11px;
-padding-bottom:11px;
+padding:11px 2%;
clear:both;
float:left;
-width:96.41%;
+width:95.7%;
border-width:1px;
border-style:solid;
margin-bottom:11px;
@@ -993,13 +992,36 @@ font-weight:bold;
padding:0;
}
#jOverlayContent h1 {
-max-width:475px;
+max-width:425px;
}
#jOverlayContent #content {
border-radius:7px;
-moz-border-radius:7px;
-webkit-border-radius:7px;
}
+#jOverlayLoading {
+top:5%;
+left:40%;
+}
+#attachment_view img {
+max-width:480px;
+max-height:480px;
+}
+#attachment_view #oembed_info {
+margin-top:11px;
+}
+#attachment_view #oembed_info dt,
+#attachment_view #oembed_info dd {
+float:left;
+}
+#attachment_view #oembed_info dt {
+clear:left;
+margin-right:11px;
+font-weight:bold;
+}
+#attachment_view #oembed_info dt:after {
+content: ":";
+}
#usergroups #new_group {
float: left;
@@ -1058,8 +1080,6 @@ top:3px;
left:3px;
}
-
-
.pagination {
float:left;
clear:both;
@@ -1105,7 +1125,6 @@ padding-right:30px;
}
/* END: NOTICE */
-
.hentry .entry-content p {
margin-bottom:18px;
}
@@ -1122,7 +1141,6 @@ margin-bottom:18px;
margin-left:18px;
}
-
/* TOP_POSTERS */
.section tbody td {
padding-right:11px;
@@ -1150,7 +1168,6 @@ margin-right:0;
display:none;
}
-
/* tagcloud */
.tag-cloud {
list-style-type:none;
@@ -1233,6 +1250,11 @@ clear:both;
margin-bottom:0;
}
+#form_settings_design #settings_design_background-image img {
+max-width:480px;
+max-height:480px;
+}
+
#form_settings_design #settings_design_color .form_data,
#form_settings_design #color-picker {
float:left;
diff --git a/theme/pigeonthoughts/css/display.css b/theme/pigeonthoughts/css/display.css
index 01af500bf..f113225fb 100644
--- a/theme/pigeonthoughts/css/display.css
+++ b/theme/pigeonthoughts/css/display.css
@@ -14,7 +14,8 @@ background:url(../images/illustrations/illu_pigeons-01.png) no-repeat 0 100%;
}
body,
-a:active {
+a:active,
+#content {
background-color:#AEA187;
}
body {