forked from slabbi/uddeIM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dawid Pągowski
committed
Aug 22, 2022
1 parent
278ba4f
commit 98feb62
Showing
2 changed files
with
264 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
<?php | ||
// ******************************************************************************************** | ||
// Title Module to show mailbox status in udde Instant Messages (uddeIM) | ||
// Description Instant Messages System for Mambo 4.5 / Joomla 1.0 / Joomla 1.5 | ||
// Author © 2007-2008 Stephan Slabihoud | ||
// License This is free software and you may redistribute it under the GPL. | ||
// uddeIM comes with absolutely no warranty. | ||
// Use at your own risk. For details, see the license at | ||
// http://www.gnu.org/licenses/gpl.txt | ||
// Other licenses can be found in LICENSES folder. | ||
// Redistributing this file is only allowed when keeping the header unchanged. | ||
// ******************************************************************************************** | ||
|
||
if (!(defined('_JEXEC') || defined('_VALID_MOS'))) { die( 'Direct Access to this location is not allowed.' ); } | ||
|
||
$uddeim_isadmin = 0; | ||
if ( defined( 'JPATH_ADMINISTRATOR' ) ) { | ||
require_once(JPATH_SITE.'/components/com_uddeim/uddeimlib.php'); | ||
} else { | ||
global $mainframe; | ||
require_once($mainframe->getCfg('absolute_path').'/components/com_uddeim/uddeimlib.php'); | ||
} | ||
|
||
$uddpathtoadmin = uddeIMgetPath('admin'); | ||
$uddpathtouser = uddeIMgetPath('user'); | ||
$uddpathtosite = uddeIMgetPath('live_site'); | ||
$udddatabase = uddeIMgetDatabase(); | ||
$uddmosConfig_lang = uddeIMgetLang(); | ||
|
||
require_once($uddpathtoadmin."/admin.shared.php"); // before includes.php is included! | ||
require_once($uddpathtouser.'/includes.php'); | ||
require_once($uddpathtouser.'/includes.db.php'); | ||
require_once($uddpathtouser.'/crypt.class.php'); | ||
require_once($uddpathtoadmin."/config.class.php"); // get the configuration file | ||
$uddconfig = new uddeimconfigclass(); | ||
|
||
if(!defined('_UDDEIM_INBOX')) { | ||
uddeIMloadLanguage($uddpathtoadmin, $uddconfig); | ||
} | ||
|
||
$uddshownew = $params->get( 'uddshownew', 1 ); | ||
$uddshowinbox = $params->get( 'uddshowinbox', 1 ); | ||
$uddshowoutbox = $params->get( 'uddshowoutbox', 1 ); | ||
$uddshowtrashcan= $params->get( 'uddshowtrashcan', 1 ); | ||
$uddshowarchive = $params->get( 'uddshowarchive', 1 ); | ||
$uddshowcontacts= $params->get( 'uddshowcontacts', 1 ); | ||
$uddshowsettings= $params->get( 'uddshowsettings', 1 ); | ||
$uddshowcompose = $params->get( 'uddshowcompose', 1 ); | ||
$uddshowicons = $params->get( 'uddshowicons', 0 ); | ||
|
||
if ( defined( 'JPATH_ADMINISTRATOR' ) ) { // this works in Joomla 1.5+ | ||
if (file_exists($uddpathtouser.'/templates/'.$uddconfig->templatedir.'/css/uddemodule.css')) { | ||
$css = $uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/css/uddemodule.css"; | ||
uddeIMaddCSS($css); | ||
} elseif(file_exists($uddpathtouser.'/templates/default/css/uddemodule.css')) { | ||
$css = $uddpathtosite."/components/com_uddeim/templates/default/css/uddemodule.css"; | ||
uddeIMaddCSS($css); | ||
} | ||
} else { | ||
if (file_exists($uddpathtouser.'/templates/'.$uddconfig->templatedir.'/css/uddemodule.css')) { | ||
echo '<link rel="stylesheet" href="'.$uddpathtosite.'/components/com_uddeim/templates/'.$uddconfig->templatedir.'/css/uddemodule.css" type="text/css" />'; | ||
} elseif(file_exists($uddpathtouser.'/templates/default/css/uddemodule.css')) { | ||
echo '<link rel="stylesheet" href="'.$uddpathtosite.'/components/com_uddeim/templates/default/css/uddemodule.css" type="text/css" />'; | ||
} | ||
} | ||
|
||
$udduserid = uddeIMgetUserID(); | ||
$uddmygroupid = uddeIMgetGroupID(); | ||
|
||
if (!$udduserid) { | ||
echo "<div id='uddeim-module'>"; | ||
echo "<p class='uddeim-module-head'>"._UDDEIM_NOTLOGGEDIN."</p>"; | ||
echo "</div>"; | ||
return; | ||
} | ||
|
||
$uddmy_gid = uddeIMgetGID((int)$udduserid); // ARRAY(!)) | ||
|
||
// first try to find a published link | ||
$udditem_id = uddeIMgetItemid($uddconfig); | ||
|
||
$uddout = "<div id='uddeim-module'>"; | ||
|
||
if ( $uddshownew ) { | ||
$uddsql="SELECT count(a.id) FROM `#__uddeim` AS a WHERE `a`.`delayed`=0 AND a.totrash=0 AND a.toread=0 AND a.toid=".(int)$udduserid; | ||
// $uddsql="SELECT count(a.id) FROM `#__uddeim` AS a LEFT JOIN `#__users` AS b ON a.fromid=b.id WHERE a.totrash=0 AND a.toread=0 AND a.toid=".(int)$udduserid; | ||
$udddatabase->setQuery($uddsql); | ||
$uddresult=(int)$udddatabase->loadResult(); | ||
if ($uddresult>0) { | ||
$uddout .= "<p class='uddeim-module-head'>"; | ||
$uddout .= _UDDEMODULE_NEWMESSAGES." ".$uddresult; | ||
$uddout .= "</p>"; | ||
} | ||
} | ||
|
||
if ( $uddshowinbox ) { | ||
$uddsql="SELECT count(a.id) FROM `#__uddeim` AS a WHERE `a`.`delayed`=0 AND a.totrash=0 AND archived=0 AND a.toid=".(int)$udduserid; | ||
// $uddsql="SELECT count(a.id) FROM `#__uddeim` AS a LEFT JOIN `#__users` AS b ON a.fromid=b.id WHERE a.totrash=0 AND archived=0 AND a.toid=".(int)$udduserid; | ||
$udddatabase->setQuery($uddsql); | ||
$uddresult=(int)$udddatabase->loadResult(); | ||
|
||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_inbox.gif' alt='"._UDDEIM_INBOX."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=inbox".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_INBOX.'">'; | ||
$uddout .= _UDDEIM_INBOX.": ".$uddresult; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
|
||
if ( $uddshowoutbox ) { | ||
$uddsql="SELECT count(a.id) FROM `#__uddeim` AS a WHERE a.totrashoutbox=0 AND ((a.systemmessage IS NULL) OR (a.systemmessage='')) AND a.fromid=".(int)$udduserid; | ||
// $uddsql="SELECT count(a.id) FROM `#__uddeim` AS a LEFT JOIN `#__users` AS b ON a.toid=b.id WHERE a.totrashoutbox=0 AND ((a.systemmessage IS NULL) OR (a.systemmessage='')) AND a.fromid=".(int)$udduserid; | ||
$udddatabase->setQuery($uddsql); | ||
$uddresult=(int)$udddatabase->loadResult(); | ||
|
||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_outbox.gif' alt='"._UDDEIM_OUTBOX."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=outbox".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_OUTBOX.'">'; | ||
$uddout .= _UDDEIM_OUTBOX.": ".$uddresult; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
|
||
if ( $uddshowtrashcan ) { | ||
$uddrightnow=uddetime((int)$uddconfig->timezone); | ||
$uddoffset=((float)$uddconfig->TrashLifespan) * 86400; | ||
$uddtimeframe=$uddrightnow-$uddoffset; | ||
|
||
$uddsql="SELECT count(id) FROM `#__uddeim` WHERE (totrashdate>=".$uddtimeframe." AND toid=".(int)$udduserid." AND totrash=1) OR (totrashdateoutbox>=".$uddtimeframe." AND fromid=".(int)$udduserid." AND totrashoutbox=1 AND toid<>".(int)$udduserid." AND ((systemmessage IS NULL) OR (systemmessage='')))"; | ||
// $uddsql="SELECT count(id) FROM `#__uddeim` WHERE (totrashdate>=".$uddtimeframe." AND toid=".(int)$udduserid." AND totrash=1) OR (totrashdateoutbox>=".$uddtimeframe." AND fromid=".(int)$udduserid." AND totrashoutbox=1 AND toid<>fromid AND ((systemmessage IS NULL) OR (systemmessage='')))"; | ||
$udddatabase->setQuery($uddsql); | ||
$uddresult=(int)$udddatabase->loadResult(); | ||
|
||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_trashcan.gif' alt='"._UDDEIM_TRASHCAN."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=trashcan".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_TRASHCAN.'">'; | ||
$uddout .= _UDDEIM_TRASHCAN.": ".$uddresult; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
|
||
if ( $uddshowarchive && $uddconfig->allowarchive) { | ||
$uddsql="SELECT count(a.id) FROM `#__uddeim` AS a WHERE a.totrash=0 AND archived=1 AND a.toid=".(int)$udduserid; | ||
// $uddsql="SELECT count(a.id) FROM `#__uddeim` AS a LEFT JOIN `#__users` AS b ON a.fromid=b.id WHERE a.totrash=0 AND archived=1 AND a.toid=".(int)$udduserid; | ||
$udddatabase->setQuery($uddsql); | ||
$uddresult=(int)$udddatabase->loadResult(); | ||
|
||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_archive.gif' alt='"._UDDEIM_ARCHIVE."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=archive".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_ARCHIVE.'">'; | ||
$uddout .= _UDDEIM_ARCHIVE.": ".$uddresult; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
|
||
if( ($uddconfig->enablelists==1) || | ||
($uddconfig->enablelists==2 && (uddeIMisSpecial($uddmy_gid) || uddeIMisSpecial2($uddmy_gid, $config))) || | ||
($uddconfig->enablelists==3 && (uddeIMisAdmin($uddmy_gid) || uddeIMisAdmin2($uddmy_gid, $config))) ) { | ||
// ok contact lists are enabled | ||
if ( $uddshowcontacts ) { | ||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_book.gif' alt='"._UDDEIM_LISTS."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=showlists".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_LISTS.'">'; | ||
$uddout .= _UDDEIM_LISTS; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
} | ||
|
||
if ( $uddshowsettings ) { | ||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_settings.gif' alt='"._UDDEIM_SETTINGS."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=settings".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_SETTINGS.'">'; | ||
$uddout .= _UDDEIM_SETTINGS; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
|
||
if ( $uddshowcompose ) { | ||
$uddout .= "<p class='uddeim-module-body'>"; | ||
if($uddshowicons) | ||
$uddout .= "<img src='".$uddpathtosite."/components/com_uddeim/templates/".$uddconfig->templatedir."/images/menu_new.gif' alt='"._UDDEIM_COMPOSE."' /> "; | ||
$uddout .= '<a href="'.uddeIMsefRelToAbs( "index.php?option=com_uddeim&task=new".($udditem_id ? "&Itemid=".$udditem_id : "") ).'" title="'._UDDEIM_COMPOSE.'">'; | ||
$uddout .= _UDDEIM_COMPOSE; | ||
$uddout .= '</a>'; | ||
$uddout .= "</p>"; | ||
} | ||
|
||
$uddout .= "</div>"; | ||
|
||
echo $uddout; | ||
|
||
//function moduddemailboxtime($uddtimezone = 0) { | ||
// $uddmosConfig_offset = uddeIMgetOffset(); | ||
// $uddrightnow=time()+(($uddmosConfig_offset+$uddtimezone)*3600); | ||
// return $uddrightnow; | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extension type="module" version="1.6.0" client="site" method="upgrade"> | ||
<name>uddeIM Mailbox</name> | ||
<creationDate>2022-08-23</creationDate> | ||
<author>Stephan Slabihoud</author> | ||
<copyright>Stephan Slabihoud. This is free software and you may redistribute it under the GPL. uddeIM comes with absolutely no warranty. For details, see the license at http://www.gnu.org/licenses/gpl.txt.</copyright> | ||
<license>GNU/GPL</license> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>http://www.slabihoud.de/software/</authorUrl> | ||
<version>4.1</version> | ||
<description>uddeIM Mailbox module</description> | ||
<files> | ||
<filename module="mod_uddeim_mailbox">mod_uddeim_mailbox.php</filename> | ||
<filename>mod_uddeim_mailbox.xml</filename> | ||
</files> | ||
<config> | ||
<fields name="params"> | ||
<fieldset name="basic"> | ||
<field name="uddshownew" type="radio" default="1" label="Show Status" description="Show number of new mesages"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowinbox" type="radio" default="1" label="Show Inbox" description="Show Inbox Statusline"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowoutbox" type="radio" default="1" label="Show Outbox" description="Show Outbox Statusline"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowtrashcan" type="radio" default="1" label="Show Trashcan" description="Show Trashcan Statusline"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowarchive" type="radio" default="1" label="Show Archive" description="Show Archive Statusline"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowcontacts" type="radio" default="1" label="Show Contacts" description="Show link to contacts"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowsettings" type="radio" default="1" label="Show Settings" description="Show link to settings"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowcompose" type="radio" default="1" label="Show Compose link" description="Show link to compose a new message"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
<field name="uddshowicons" type="radio" default="0" label="Show Icons" description="Show menu icons before descriptions"> | ||
<option value="1">Yes</option> | ||
<option value="0">No</option> | ||
</field> | ||
</fieldset> | ||
<fieldset name="advanced"> | ||
<field name="moduleclass_sfx" type="text" default="" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" /> | ||
</fieldset> | ||
</fields> | ||
</config> | ||
</extension> |