Permalink
Browse files

- Simple messaging updated to version 2.1. Fixes database issue when …

…trying to send a message. Added it back to the default Pligg CMS installation.
  • Loading branch information...
1 parent 4614a9a commit 1938c952b784cec3539935af7051cca03f060e90 @yankidank yankidank committed Jul 27, 2013
@@ -525,8 +525,8 @@ function pligg_createtables($conn) {
mysql_query( $sql, $conn );
$sql = "INSERT INTO `" . table_modules . "` (`id`, `name`, `version`, `latest_version`, `folder`, `enabled`) VALUES (NULL, 'Captcha', 2.0, '', 'captcha', 1);";
mysql_query( $sql, $conn );
-// $sql = "INSERT INTO `" . table_modules . "` (`id`, `name`, `version`, `latest_version`, `folder`, `enabled`) VALUES (NULL, 'Simple Private Messaging', 2.0, '', 'simple_messaging', 1);";
-// mysql_query( $sql, $conn );
+ $sql = "INSERT INTO `" . table_modules . "` (`id`, `name`, `version`, `latest_version`, `folder`, `enabled`) VALUES (NULL, 'Simple Private Messaging', 2.1, '', 'simple_messaging', 1);";
+ mysql_query( $sql, $conn );
$sql = "INSERT INTO `" . table_modules . "` (`id`, `name`, `version`, `latest_version`, `folder`, `enabled`) VALUES (NULL, 'Sidebar Stories', 2.0, '', 'sidebar_stories', 1);";
mysql_query( $sql, $conn );
$sql = "INSERT INTO `" . table_modules . "` (`id`, `name`, `version`, `latest_version`, `folder`, `enabled`) VALUES (NULL, 'Sidebar Comments', 2.0, '', 'sidebar_comments', 1);";
@@ -151,7 +151,7 @@ function SendMessage($title ,$body ,$sender ,$receiver ,$senderLevel)
return 4;
if( strlen($senderLevel) == 0)
return 5;
- $sql = "INSERT INTO ".$this->tblName." (title,body,sender,receiver,senderLevel,read) VALUES ('$title','$body',$sender,$receiver,$senderLevel,0)";
+ $sql = "INSERT INTO ".$this->tblName." (title,body,sender,receiver,senderLevel,readed) VALUES ('$title','$body',$sender,$receiver,$senderLevel,0)";
//echo $sql;
$result = mysql_query($sql);
if($result)
@@ -266,7 +266,7 @@ function GetMessage($msgId)
$message['title'] = $row->title;
$message['body'] = nl2br($row->body);
$message['senderLevel'] = $row->senderLevel;
- $message['read'] = $row->read & 1;
+ $message['readed'] = $row->readed & 1;
$message['date'] = $row->date;
return $message;
}
@@ -282,7 +282,7 @@ function MarkAsRead($msgId)
{
if(strlen($msgId) == 0)
return 1;
- $result = mysql_query("UPDATE ".$this->tblName." SET read=read|1 WHERE idMsg=$msgId");
+ $result = mysql_query("UPDATE ".$this->tblName." SET readed=readed|1 WHERE idMsg=$msgId");
if($result)
return 0;
else
@@ -320,10 +320,10 @@ function GetAllmessages($sort = 0, $receiver = '', $sender = '', $filter = 0)
$order = 'senderLevel DESC';
break;
case 2:
- $order = 'read ASC';
+ $order = 'readed ASC';
break;
case 3:
- $order = 'read DESC';
+ $order = 'readed DESC';
break;
case 4:
$order = '`date` ASC';
@@ -339,17 +339,17 @@ function GetAllmessages($sort = 0, $receiver = '', $sender = '', $filter = 0)
case 0:
break;
case 1:
- $where = ' AND read&1 = 0 ';
+ $where = ' AND readed&1 = 0 ';
break;
case 2:
- $where = ' AND read&1 = 1 ';
+ $where = ' AND readed&1 = 1 ';
break;
}
if(strlen($receiver) > 0 && strlen($sender) > 0)
$where = ' AND ';
- $where = ((strlen($receiver) > 0)?'read&4=0 AND receiver=' . $receiver:'') . $where . ((strlen($sender) > 0)?'read&2=0 AND sender=' . $sender:'');
+ $where = ((strlen($receiver) > 0)?'readed&4=0 AND receiver=' . $receiver:'') . $where . ((strlen($sender) > 0)?'readed&2=0 AND sender=' . $sender:'');
$sql = "SELECT * FROM ".$this->tblName." WHERE $where ORDER BY $order";
//echo $sql;
@@ -368,7 +368,7 @@ function GetAllmessages($sort = 0, $receiver = '', $sender = '', $filter = 0)
$message[$i]['title'] = $row->title;
$message[$i]['body'] = $row->body;
$message[$i]['senderLevel'] = $row->senderLevel;
- $message[$i]['read'] = $row->read&1;
+ $message[$i]['readed'] = $row->readed&1;
$message[$i]['date'] = $row->date;
}
if( !is_array($message) )
@@ -394,9 +394,9 @@ function DeleteMessage($msgId,$who=0)
if(strlen($msgId) == 0)
return 1;
if ($who==1)
- $result = mysql_query("UPDATE ".$this->tblName." SET read=read|2 WHERE idMsg=$msgId");
+ $result = mysql_query("UPDATE ".$this->tblName." SET readed=readed|2 WHERE idMsg=$msgId");
elseif ($who==2)
- $result = mysql_query("UPDATE ".$this->tblName." SET read=read|4 WHERE idMsg=$msgId");
+ $result = mysql_query("UPDATE ".$this->tblName." SET readed=readed|4 WHERE idMsg=$msgId");
elseif ($who==0)
$result = mysql_query("DELETE FROM ".$this->tblName." WHERE idMsg=$msgId");
if($result)
@@ -1,7 +1,7 @@
<?php
$module_info['name'] = 'Simple Private Messaging';
$module_info['desc'] = 'Let users send private messages to each other.';
- $module_info['version'] = 2.0;
+ $module_info['version'] = 2.1;
$module_info['homepage_url'] = 'http://pligg.com/downloads/module/simple-messaging/';
$module_info['update_url'] = 'http://pligg.com/downloads/module/simple-messaging/version/';
@@ -1,6 +1,5 @@
-<?php
+<?php
include_once(mnminclude.'../modules/simple_messaging/kmessaging/class.KMessaging.php');
-
function get_new_messages(){
global $main_smarty, $the_template, $current_user;
@@ -358,7 +357,7 @@ function messaging_get_message_details($msgID){
if (!is_numeric($msgID)) die("Wrong ID");
$message = new KMessaging(true);
- $array = $message->GetMessege($msgID);
+ $array = $message->GetMessage($msgID);
// check to make sure this is our message
if($array['receiver'] == $current_user->user_id){
@@ -7,6 +7,7 @@
<h3>Revision History</h3>
<ul>
+ <li>2.1 2013/07/27 Yankidank - Fixed database issue, updated the user navigation template file for Bootstrap.</li>
<li>2.0 2013/06/04 Yankidank - Pligg 2.0 Support</li>
<li>0.7 2010/07/29 BakedGoods - Edited image paths, images now work independent from template. New friends2.png icon.</li>
<li>0.6 2009/09/22 Yankidank - Improvements to style</li>
@@ -154,7 +154,7 @@
<table class="table table-bordered table-condensed table-striped">
<thead>
<th>{#PLIGG_Visual_User_Profile_Username#}</th>
- {if check_for_enabled_module('simple_messaging',0.6) && $is_friend}<th>{#PLIGG_Visual_User_Profile_Message#}</th>{/if}
+ {if check_for_enabled_module('simple_messaging',2.0) && $is_friend}<th>{#PLIGG_Visual_User_Profile_Message#}</th>{/if}
{if $user_authenticated eq true}
<th>{#PLIGG_Visual_User_Profile_Remove_Friend#}</th>
{/if}
@@ -167,7 +167,7 @@
{/php}
<tr>
<td><img src="{$friend_avatar}" align="absmiddle" /> <a href="{$profileURL}">{$myfriend.user_login}</a></td>
- {if check_for_enabled_module('simple_messaging',0.6) && $is_friend}<td align="center"><a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&return={$templatelite.server.REQUEST_URI|urlencode}&to={$myfriend.user_login}"><span class="btn"><i class="icon icon-envelope"></i></span></a></td>{/if}
+ {if check_for_enabled_module('simple_messaging',2.0) && $is_friend}<td align="center"><a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&return={$templatelite.server.REQUEST_URI|urlencode}&to={$myfriend.user_login}"><span class="btn"><i class="icon icon-envelope"></i></span></a></td>{/if}
{if $user_authenticated eq true}
<td align="center"><a href="{$user_url_remove}" class="btn btn-danger">Unfollow</a></td>
{/if}
@@ -188,7 +188,7 @@
<thead>
<tr>
<th>{#PLIGG_Visual_User_Profile_Username#}</th>
- {if check_for_enabled_module('simple_messaging',0.6) && $is_friend}
+ {if check_for_enabled_module('simple_messaging',2.0) && $is_friend}
<th>{#PLIGG_Visual_User_Profile_Message#}</th>
{/if}
{if $user_authenticated eq true}
@@ -206,7 +206,7 @@
<tr>
<td><img src="{$friend_avatar}" align="absmiddle" /> <a href="{$profileURL}">{$myfriend.user_login}</a></td>
- {if check_for_enabled_module('simple_messaging',0.6) && $is_friend}<td><a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&to={$myfriend.user_login}&return={$templatelite.server.REQUEST_URI|urlencode}"><span class="btn"><i class="icon icon-envelope"></i></span></a></td>{/if}
+ {if check_for_enabled_module('simple_messaging',2.0) && $is_friend}<td><a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&to={$myfriend.user_login}&return={$templatelite.server.REQUEST_URI|urlencode}"><span class="btn"><i class="icon icon-envelope"></i></span></a></td>{/if}
{if $user_authenticated eq true}
{if $myfriend.is_friend>0}
<td><a class="btn btn-danger" href="{$user_url_remove}">Unfollow</a></td>
@@ -158,12 +158,8 @@
<div class="btn-group">
<a class="btn btn-small" href="{$user_url_friends}"><i class="icon-user"></i> {$user_following} {#PLIGG_Visual_User_Profile_View_Friends#}</a>
<a class="btn btn-small" href="{$user_url_friends2}"><i class="icon-user"></i> {$user_followers} {#PLIGG_Visual_User_Profile_Your_Friends#}</a>
- </div>
- {if $user_login neq $user_logged_in}
- {if check_for_enabled_module('simple_messaging',0.6) && $is_friend}
- {if $friends}
- <img src="{$my_pligg_base}/modules/simple_messaging/img/reply.png" border="0" align="absmiddle" /> <a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&return={$templatelite.server.REQUEST_URI|urlencode}&to={$user_login}">{#PLIGG_Visual_User_Profile_Message#} {$user_login}</a>
- {/if}
+ {if check_for_enabled_module('simple_messaging',2.0) && $is_friend}
+ <a class="btn btn-small" href="{$my_base_url}{$my_pligg_base}/module.php?module=simple_messaging&view=compose&to={$username}&return={$my_pligg_base}%2Fuser.php%3Flogin%3D{$user_logged_in}%26view%3Dfollowers"><i class="icon-envelope"></i> Send Message</a>
{/if}
{if $is_friend gt 0}
<a href="{$user_url_remove}" class="btn btn-small btn-danger">{#PLIGG_Unfollow#}{* {$user_login|capitalize} *}</a>
@@ -172,10 +168,10 @@
{/if}
{else}
{if $user_authenticated eq true}
- <a class="btn btn-success" href="{$user_url_add}">{#PLIGG_Visual_User_Profile_Add_Friend#} {$user_login}</a>
+ <a class="btn btn-small btn-success" href="{$user_url_add}">{#PLIGG_Visual_User_Profile_Add_Friend#}{* {$user_login|capitalize} *}</a>
{/if}
{/if}
- {/if}
+ </div>
</div>
</div>
<div style="clear:both;"></div>

0 comments on commit 1938c95

Please sign in to comment.