function user_delete_ext($userid, $pmsUserDeleteOption) { $database = uddeIMgetDatabase(); $config = new uddeimconfigclass(); $rightnow = uddetime($config->timezone); // $query_pms_delete = "DELETE FROM #__uddeim WHERE fromid='" . (int) $userid ."' OR toid='" . (int) $userid . "'"; // delete all messages send from this user and trashed from the outbox $query_pms_delete1 = "UPDATE #__uddeim SET totrashoutbox=1, totrashdateoutbox=".$rightnow." WHERE fromid='" . (int) $userid . "'"; // delete all messages recived by this user and trashed from the inbox $query_pms_delete2 = "UPDATE #__uddeim SET totrash=1, totrashdate=".$rightnow." WHERE toid='".(int) $userid . "'"; $query_pms_delete_extra1 = "DELETE FROM #__uddeim_emn WHERE userid='" . (int) $userid . "'"; $query_pms_delete_extra2 = "DELETE FROM #__uddeim_blocks WHERE blocker='" . (int) $userid . "' OR blocked='" . (int) $userid . "'"; $query_pms_delete_extra3 = "DELETE FROM #__uddeim_userlists WHERE userid='" . (int) $userid ."'"; print "Deleting pms data for user ".$userid; if ($pmsUserDeleteOption==2 || $pmsUserDeleteOption==4) { $database->setQuery( $query_pms_delete1 ); if (!$database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete1 . $database->stderr(true)); return false; } } if ($pmsUserDeleteOption==2 || $pmsUserDeleteOption==3) { $database->setQuery( $query_pms_delete2 ); if (!$database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete2 . $database->stderr(true)); return false; } } if ($pmsUserDeleteOption>=2) { $database->setQuery( $query_pms_delete_extra1 ); if (!$database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete_extra1 . $database->stderr(true)); return false; } $database->setQuery( $query_pms_delete_extra2 ); if (!$database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete_extra2 . $database->stderr(true)); return false; } $database->setQuery( $query_pms_delete_extra3 ); if (!$database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete_extra3 . $database->stderr(true)); return false; } } return true; }
function uddeIM_com_install() { $ver = new JVersion(); if ( defined( 'JPATH_ADMINISTRATOR' ) ) { require_once(JPATH_SITE.'/components/com_uddeim/uddeimlib.php'); require_once(JPATH_SITE.'/administrator/components/com_uddeim/admin.uddeimlib.php'); } else { global $mainframe; require_once($mainframe->getCfg('absolute_path').'/components/com_uddeim/uddeimlib.php'); require_once($mainframe->getCfg('absolute_path').'/administrator/components/com_uddeim/admin.uddeimlib.php'); } require_once(uddeIMgetPath('absolute_path')."/administrator/components/com_uddeim/config.class.php"); require_once(uddeIMgetPath('absolute_path')."/administrator/components/com_uddeim/admin.shared.php"); require_once(uddeIMgetPath('absolute_path')."/administrator/components/com_uddeim/admin.includes.php"); $mosConfig_locale = uddeIMgetLocale(); $mosConfig_sitename = uddeIMgetSitename(); $mosConfig_lang = uddeIMgetLang(); $database = uddeIMgetDatabase(); $version = uddeIMgetVersion(); $pathtoadmin = uddeIMgetPath('admin'); $pathtouser = uddeIMgetPath('user'); $config = new uddeimconfigclass(); // set initial values $config->cryptkey = 'uddeIMcryptkey'; $config->version = '2.4'; $config->datumsformat = 'j M, H:i'; $config->ldatumsformat = 'j F Y, H:i'; $config->emn_sendermail = 'webmaster'; $config->emn_sendername = 'Messaging'; $config->sysm_username = '******'; $config->charset = 'ISO-8859-1'; $config->mailcharset = 'ISO-8859-1'; $config->emn_body_nomessage = ''; $config->emn_body_withmessage = ''; $config->emn_forgetmenot = ''; $config->export_format = ''; $config->showtitle = ''; $config->templatedir = 'default'; $config->quotedivider= '__________'; $config->blockgroups = ''; $config->pubblockgroups = ''; $config->hideusers = '62'; $config->pubhideusers = '62'; $config->attachmentgroups = ''; $config->recaptchaprv = ''; $config->recaptchapub = ''; $config->allowedextensions = ''; $config->badwords = ''; $config->gravatard = ''; $config->gravatarr = ''; $config->ReadMessagesLifespan = 36524; $config->UnreadMessagesLifespan = 36524; $config->SentMessagesLifespan = 36524; $config->TrashLifespan = 2; $config->ReadMessagesLifespanNote = 0; $config->UnreadMessagesLifespanNote = 0; $config->SentMessagesLifespanNote = 0; $config->TrashLifespanNote = 1; $config->adminignitiononly = 1; $config->pmsimportdone = 0; $config->blockalert = 0; $config->blocksystem = 0; $config->allowemailnotify = 0; $config->notifydefault = 0; $config->popupdefault = 0; $config->allowsysgm = 0; $config->emailwithmessage = 0; $config->firstwordsinbox = 40; $config->longwaitingdays = 75; $config->longwaitingemail = 0; $config->maxlength = 2500; $config->showcblink = 1; $config->showcbpic = 1; $config->showonline = 1; $config->allowarchive = 0; $config->maxarchive = 100; $config->allowcopytome = 1; $config->trashoriginal = 1; $config->perpage = 8; $config->enabledownload = 0; $config->inboxlimit = 0; $config->showinboxlimit = 0; $config->allowpopup = 0; $config->allowbb = 1; $config->allowsmile = 1; $config->animated = 0; $config->animatedex = 0; $config->showmenuicons = 1; $config->bottomlineicons = 1; $config->actionicons = 1; $config->showconnex = 0; $config->showsettingslink = 2; $config->connex_listbox = 1; $config->forgetmenotstart = 0; $config->showabout = 0; $config->emailtrafficenabled = 0; $config->getpiclink = 0; $config->realnames = 0; $config->cryptmode = 0; $config->modeshowallusers = 1; $config->useautocomplete = 0; $config->allowmultipleuser = 1; $config->connexallowmultipleuser = 1; $config->allowmultiplerecipients = 1; $config->showtextcounter = 1; $config->allowforwards = 1; $config->showgroups = 0; $config->mailsystem = 0; $config->searchinstring = 1; $config->maxrecipients = 0; $config->languagecharset = 0; $config->usecaptcha = 0; $config->captchalen = 4; $config->pubfrontend = 0; $config->pubfrontenddefault = 0; $config->pubmodeshowallusers = 1; $config->hideallusers = 0; $config->pubhideallusers = 0; $config->unblockCBconnections = 1; $config->CBgallery = 0; $config->enablelists = 0; $config->maxonlists = 100; $config->timedelay = 0; $config->pubrealnames = 0; $config->pubreplies = 0; $config->pubemail = 0; $config->csrfprotection = 0; $config->trashrestriction = 0; $config->replytruncate = 0; $config->allowflagged = 0; $config->overwriteitemid = 0; $config->useitemid = 0; $config->timezone = 0; $config->pubsearchinstring = 1; $config->pubuseautocomplete = 0; $config->mootools = 1; $config->autoresponder = 0; $config->autoforward = 0; $config->rows = 10; $config->cols = 60; $config->width = 0; $config->enablefilter = 0; $config->enablereply = 0; $config->enablerss = 0; $config->showigoogle = 1; $config->showhelp = 0; $config->separator = 0; $config->rsslimit = 20; $config->restrictallusers = 0; $config->trashoriginalsent = 0; $config->checkbanned = 0; $config->enableattachment = 0; $config->maxsizeattachment = 16384; $config->maxattachments = 1; $config->fileadminignitiononly = 1; $config->showlistattachment = 1; $config->showmenucount = 0; $config->encodeheader = 0; $config->enablesort = 0; $config->captchatype = 0; $config->unprotectdownloads = 0; $config->waitdays = 0; $config->avatarw = 0; $config->avatarh = 0; $config->gravatar = 0; $config->addccline = 0; $config->modnewusers = 0; $config->modpubusers = 0; $config->restrictcon = 0; $config->restrictrem = 0; $config->stime = 0; $config->dontsefmsglink = 0; $config->enablepostbox = 0; $config->postboxfull = 0; $config->postboxavatars = 0; $config->replytext = 1; // temporary variables $config->flags = 0; $config->userid = 0; $config->usergid = 0; $config->cbitemid = 0; $config->languagecharset = 1; // use UTF-8 on Joomla != 1.0 // try to determine the best settings for uddeIM on this installation // is uddeIM already installed and are messages in the archive? $sql="SELECT count(id) FROM #__uddeim WHERE archived=1"; $database->setQuery($sql); $archivedmessages=$database->loadResult(); $config->allowarchive = 0; $config->enabledownload = 0; if ($archivedmessages) { $config->allowarchive = 1; $config->enabledownload = 1; } switch ($mosConfig_lang) { case "germani": case "germanf": case "german": $config->datumsformat = 'j M, H:i'; $config->ldatumsformat = 'j. F Y, H:i'; break; default: $config->datumsformat = 'j M, H:i'; $config->ldatumsformat = 'j F Y, H:i'; break; } // is CB installed? CB only, NOT CBE! $config->showcblink = 0; $config->showcbpic = 0; $config->showconnex = 0; $config->checkbanned = 0; $config->realnames = 0; if (uddeIMfileExists("/components/com_comprofiler/comprofiler.php")) { $config->showcblink = 1; $config->showcbpic = 1; $config->showconnex = 1; $config->checkbanned = 1; // now look for the CB config file // if realnames are used in CB, use realnames in uddeIM as well if (uddeIMfileExists("/administrator/components/com_comprofiler/ue_config.php")) { global $ueConfig; include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_comprofiler/ue_config.php"); if (isset($ueConfig['name_format'])) { if ($ueConfig['name_format']=='1') { $config->realnames=1; $config->pubrealnames=1; } } } } if (uddeIMfileExists("/components/com_cbe/cbe.php")) { $config->showcblink = 4; $config->showcbpic = 4; $config->showconnex = 1; $config->checkbanned = 1; // now look for the CBE config file // if realnames are used in CBE, use realnames in uddeIM as well if (uddeIMfileExists("/administrator/components/com_cbe/ue_config.php")) { global $ueConfig; include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_cbe/ue_config.php"); if (isset($ueConfig['name_format'])) { if ($ueConfig['name_format']=='1') { $config->realnames=1; $config->pubrealnames=1; } } } } if (uddeIMfileExists("/administrator/components/com_comprofiler/ue_config.php")) { global $ueConfig; include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_comprofiler/ue_config.php"); if (isset($ueConfig['thumbWidth'])) { if ($ueConfig['thumbWidth']) $config->avatarw = (int)$ueConfig['thumbWidth']; } if (isset($ueConfig['thumbHeight'])) { if ($ueConfig['thumbHeight']) $config->avatarh = (int)$ueConfig['thumbHeight']; } } elseif (uddeIMfileExists("/administrator/components/com_cbe/ue_config.php")) { global $ueConfig; include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_cbe/ue_config.php"); if (isset($ueConfig['thumbWidth'])) { if ($ueConfig['thumbWidth']) $config->avatarw = (int)$ueConfig['thumbWidth']; } if (isset($ueConfig['thumbHeight'])) { if ($ueConfig['thumbHeight']) $config->avatarh = (int)$ueConfig['thumbHeight']; } } $postfix = ""; if ($config->languagecharset) $postfix = ".utf8"; // is the correct lang file installed? if (file_exists($pathtoadmin.'/language'.$postfix.'/'.$mosConfig_lang.'.php')) { include_once($pathtoadmin.'/language'.$postfix.'/'.$mosConfig_lang.'.php'); $langinfo=""; } elseif (file_exists($pathtoadmin.'/language'.$postfix.'/english.php')) { include_once($pathtoadmin.'/language'.$postfix.'/english.php'); $langinfo="<p>There is no <b>".ucfirst($mosConfig_lang)." (UTF-8)</b> language file installed. uddeIM will use English (UTF-8).</p>"; } elseif (file_exists($pathtoadmin.'/language/english.php')) { include_once($pathtoadmin.'/language/english.php'); $langinfo="<p>There is no <b>".ucfirst($mosConfig_lang)."</b> language file installed. uddeIM will use English.</p>"; $config->languagecharset=0; } // see http://www.iana.org/assignments/character-sets // http://www.w3.org/WAI/ER/IG/ert/iso639.htm // http://www.loc.gov/standards/iso639-2/php/code_list.php // en, fr_FR, es_ES, it_IT, pt_PT // http://code.elxis.org/20080/nav.html?includes/Core/locale.php.source.html $tag = strtolower(substr($mosConfig_locale,0,2)); switch ($tag) { case "bg": case "ru": $config->charset = 'cp1251'; $config->mailcharset = 'Windows-1251'; break; case "sr": case "vi": case "ar": // and others case "el": // and others case "sr": case "zh": // and others case "ja": $config->charset = 'UTF-8'; $config->mailcharset = 'UTF-8'; break; default: $config->charset = 'ISO-8859-1'; $config->mailcharset = 'ISO-8859-1'; break; } if ($config->languagecharset==1) { $config->charset = 'UTF-8'; $config->mailcharset = 'UTF-8'; } // Now save these settings uddeIMsaveConfig($pathtoadmin, $config); // Now write a welcome message to the Admin $userid = uddeIMgetUserID(); if ($userid) { if ($config->languagecharset) { // UTF-8 fix, not tested so far $sql = "SET NAMES utf8;"; $database->setQuery($sql); $isok = $database->query(); } $rightnow = uddetime($config->timezone); $welcome_time = $rightnow; $welcome_user = "******"; $welcome_msg = _UDDEADM_WELCOMEMSG; // its not a reply, so replyid=0 $sql="INSERT INTO #__uddeim (fromid, toid, toread, message, datum, systemflag, disablereply, systemmessage, totrashoutbox, totrashdateoutbox) VALUES (".$userid.", ".$userid.", 0, '".$welcome_msg."', ".$welcome_time.", 1, 1, '".$welcome_user."', 1, ".$welcome_time.")"; $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } } // create folder for attachments $folder = "/images/uddeimfiles"; if (!uddeIMfolderExists($folder)) { if (!uddeIMmkdir($folder)) { echo "<b><span style='color: red;'>"._UDDEADM_FOLDERCREATE_ERROR.$folder."</span></b>"; } else { // uddeIMchmod($folder, "766"); // BUGBUG: Joomla send CHMOD instead of SITE CHMOD $file = $folder."/index.html"; if (!uddeIMfileExists($file)) { $cf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; $cf .= "<html><head></head><body></body></html>"; uddeIMwriteFile($file, $cf); } $file = $folder."/.htaccess"; if (!uddeIMfileExists($file)) { $cf = "# Having a .htaccess prevents users from directly\n"; $cf .= "# accessing the files in your /images/uddeimfiles folder\n"; $cf .= "#\n"; $cf .= "deny from all\n"; uddeIMwriteFile($file, $cf); } } } echo "<div style='width: 600px; text-align: left;'>"; echo "<p><b>"._UDDEADM_UDDEINSTCOMPLETE."</b></p>"; echo $langinfo; echo "<p>"._UDDEADM_REVIEWSETTINGS."</p>"; echo "<ul>"; echo "<li>"._UDDEADM_REVIEWLANG."</li>"; echo "<li>"._UDDEADM_REVIEWEMAILSTOP."</li>"; echo "<li>"._UDDEADM_REVIEWUPDATE."</li>"; $folder = "/uddeimfiles"; if (uddeIMfolderExists($folder)) { echo "<li>"._UDDEADM_CHECKFILESFOLDER."</li>"; } echo "</ul>"; // redirect to settings echo "<p><a href='".uddeIMredirectIndex()."?option=com_uddeim'>".ucfirst(_UDDEADM_CONTINUE)."</a></p>"; echo "</div>"; }
/** * Sends a PMS message * * @param int $toUserId UserId of receiver * @param int $fromUserId UserId of sender * @param string $subject Subject of PMS message * @param string $message Body of PMS message * @param boolean $systemGenerated False: real user-to-user message; True: system-Generated by an action from user $fromid (if non-null) * @return boolean True: PM sent successfully; False: PM failed to send */ public function sendUserPMS($toUserId, $fromUserId, $subject, $message, $systemGenerated = false) { global $_PLUGINS; if (!$this->isInstalled()) { return false; } $toUserId = (int) $toUserId; $fromUserId = (int) $fromUserId; if (!$toUserId) { $_PLUGINS->_setErrorMSG(CBTxt::T('SEND_PMS_MISSING_TO_USER', 'Private message failed to send! Error: Missing to user')); return false; } if ($subject) { $message = "[b]" . $subject . "[/b]\n\n" . $message; } $message = $this->htmlToBBCode($message); if (!$message) { $_PLUGINS->_setErrorMSG(CBTxt::T('SEND_PMS_MISSING_MESSAGE', 'Private message failed to send! Error: Missing message')); return false; } $cryptMode = $this->uddeIMConfig->get('cryptmode', 0, GetterInterface::INT); $cryptKey = $this->uddeIMConfig->get('cryptkey', 'uddeIMcryptkey', GetterInterface::STRING); $pm = new cbmypmsproTable(); if ($systemGenerated || !$fromUserId) { $fromSystem = $this->uddeIMConfig->get('sysm_username', 'System', GetterInterface::STRING); if ($fromUserId) { $fromSystem = uddeIMgetNameFromID($fromUserId, $this->uddeIMConfigRAW); } $pm->set('disablereply', 1); $pm->set('systemflag', 1); $pm->set('systemmessage', $fromSystem); } $pm->set('fromid', (int) $fromUserId); $pm->set('toid', (int) $toUserId); $pm->set('datum', uddetime($this->uddeIMConfig->get('timezone', 0, GetterInterface::INT))); if (in_array($cryptMode, array(1, 2, 4))) { $pm->set('message', uddeIMencrypt($message, $cryptKey, CRYPT_MODE_BASE64)); $pm->set('cryptmode', 1); $pm->set('crypthash', md5($cryptKey)); } elseif ($cryptMode == 3) { $pm->set('message', uddeIMencrypt($message, '', CRYPT_MODE_STOREBASE64)); $pm->set('cryptmode', 1); $pm->set('crypthash', md5($cryptKey)); } else { $pm->set('message', $message); } if (uddeIMgetEMNmoderated($pm->get('fromid'))) { $pm->set('delayed', 1); } if (!$pm->store()) { $_PLUGINS->_setErrorMSG(CBTxt::T('SEND_PMS_FAILED_ERROR', 'Private message failed to send! Error: [error]', array('[error]' => $pm->getError()))); return false; } $this->sendNotification($pm, $message); return true; }
function sendNewSysMessage($fromid, $recipients, $message, $systemmsg=0, $validfor=0, $sendnotification=0, $forceembedded=0) { $database = uddeIMgetDatabase(); if ($systemmsg) { // system message $sendername = $this->config->sysm_username; $savesysflag = addslashes($sendername); // system message $savedisablereply = 1; // and users can't reply to them $emn_fromid = 0; // for email notifications set userid 0 } else { $sendername = uddeIMgetNameFromID($fromid, $this->config); $savesysflag = addslashes($sendername); $savedisablereply = 0; $emn_fromid = $fromid; } $savedatum = uddetime($this->config->timezone); if ($validfor>0) { $now = uddetime($this->config->timezone); $validuntil = $now+($validfor*3600); } else { $validuntil = 0; } if ($this->config->cryptmode>=1) { // because of encoding do not use slashes $savemessage = strip_tags($message); } else { $savemessage = addslashes(strip_tags($message)); // original 0.6+ } getAdditonalGroups($add_special, $add_admin, $config); if (uddeIMcheckJversion()>=2) { // J1.6 if ($recipients=="all") { $sql="SELECT id FROM #__users WHERE block=0"; } elseif($recipients=="online") { $sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid"; } elseif($recipients=="special") { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (3,4,5,6,7,8".$add_admin.$add_special.")"; } elseif($recipients=="admins") { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (7,8".$add_admin.")"; } else { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id=".(int)$recipients; } } else { if ($recipients=="all") { $sql="SELECT id FROM #__users WHERE block=0"; } elseif($recipients=="online") { $sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid"; } elseif($recipients=="special") { $sql="SELECT id FROM #__users WHERE block=0 AND gid IN (19,20,21,23,24,25".$add_admin.")"; } elseif($recipients=="admins") { $sql="SELECT id FROM #__users WHERE block=0 AND gid IN (24,25".$add_admin.")"; } else { $sql="SELECT id FROM #__users WHERE block=0 AND gid=".(int)$recipients; } } $database->setQuery($sql); $receivers=$database->loadObjectList(); if (!count($receivers)) { return 1; } foreach($receivers as $receiver) { $toid = $receiver->id; $themode = 0; if ($this->config->cryptmode==1 || $this->config->cryptmode==2 || $this->config->cryptmode==4) { $themode = 1; $cm = uddeIMencrypt($savemessage,$this->config->cryptkey,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$fromid.", ".(int)$toid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",1,'".md5($this->config->cryptkey)."')"; } elseif ($this->config->cryptmode==3) { $themode = 3; $cm = uddeIMencrypt($savemessage,"",CRYPT_MODE_STOREBASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode) VALUES (".(int)$fromid.", ".(int)$toid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",3)"; } else { $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox) VALUES (".(int)$fromid.", ".(int)$toid.", '".$savemessage."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1,".$savedatum.")"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } $insID = $database->insertid(); if ($sendnotification) { // Check if E-Mail notification or popups are enabled by default, if so create a record for the receiver. if ($this->config->notifydefault>0 || $this->config->popupdefault>0 || $this->config->pubfrontenddefault>0 || $this->config->autoresponder>0 || $this->config->autoforward>0) { if (!uddeIMexistsEMN($toid)) uddeIMinsertEMNdefaults($toid, $this->config); } } // ################################################################################################## // email notification // ################################################################################################## if ($sendnotification) { $currentlyonline = uddeIMisOnline($toid); if ($this->config->cryptmode>=1) { $email = stripslashes($savemessage); } else { $email = stripslashes(stripslashes($savemessage)); } $type = 0; if ($forceembedded) $type = 2; if ($this->config->allowemailnotify==1) { $ison = uddeIMgetEMNstatus($toid); if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) { uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $toid, $email, $type, $this->config); } } elseif($this->config->allowemailnotify==2) { $gid = uddeIMgetGID((int)$toid); if (uddeIMisAdmin($gid) || uddeIMisAdmin2($gid, $this->config)) { $ison = uddeIMgetEMNstatus($toid); if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) { uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $toid, $email, $type, $this->config); } } } } } return 0; }
function uddeIMshowTrashCan($myself, $item_id, $limit, $limitstart, $cryptpass, $config) { global $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; $pathtosite = uddeIMgetPath('live_site'); $pathtouser = uddeIMgetPath('user'); $my_gid = $config->usergid; if( ($config->trashrestriction==0) || ($config->trashrestriction==1 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || ($config->trashrestriction==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) ) { // ok trashcan enabled } else { uddeIMprintMenu($myself, 'trashcan', $item_id, $config); echo "<div id='uddeim-m'>\n"; echo "<div id='uddeim-overview'><p><b>"._UDDEADM_NOTRASHACCESS_NOT."</b></p></div>\n"; echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } $rightnow=uddetime($config->timezone); $offset=((float)$config->TrashLifespan) * 86400; $timeframe=$rightnow-$offset; $total = uddeIMgetTrashcanCount($myself, $timeframe); // now load messages as required if(!$limitstart) { $limitstart=0; } if(!$limit) { $limit=$config->perpage; } if ($limitstart>=$total) $limitstart=max(0,$limitstart - $limit); $allmessages = Array(); if ($total>0) $allmessages = uddeIMselectTrashcan($myself, $timeframe, $limitstart, $limit, $config); // write the uddeim menu uddeIMprintMenu($myself, 'trashcan', $item_id, $config); echo "<div id='uddeim-m'>\n"; // if no messages: if(count($allmessages)<1) { // no messages to list echo "<div id='uddeim-overview'><p><b>"._UDDEIM_NOMESSAGES_TRASHCAN."</b></p>\n</div>\n"; // and close the HTML output and return echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } // now open the inbox container and table; write table headings echo "<div id='uddeim-overview'>"; echo "<table cellpadding='7' width='100%'>"; // echo "\n\n\t<tr><th class='sectiontableheader'> </th><th class='sectiontableheader'>"._UDDEIM_FROM." / "._UDDEIM_TO."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DATE."</th><th class='sectiontableheader'> </th></tr>"; echo "\n\n\t<tr><th class='sectiontableheader'> </th><th class='sectiontableheader'>"._UDDEIM_FROM." / "._UDDEIM_TO."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DELETED."</th><th class='sectiontableheader'> </th></tr>"; $i=1; // now write the list foreach($allmessages as $themessage) { if($themessage->toread) { $readcell=$uddeicons_readpic; } else { $readcell=$uddeicons_unreadpic; } if ($config->showlistattachment) { $cnt = uddeIMgetAttachmentCount($themessage->id); if ($cnt) $readcell .= "<br /><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/attachment.gif' alt='"._UDDEIM_ATTACHMENT."' title='"._UDDEIM_ATTACHMENT."' border='0' />"; } $themarker = ""; $theuser = 0; $datumcell = ""; // $createdcell=uddeDate($themessage->datum, $config, uddeIMgetUserTZ()); if ($myself==$themessage->toid && $myself!=$themessage->fromid) { // Msg sent to me, sender is someone else, so user is in "fromid" $themarker = "<"; $theuser = $themessage->fromid; $datumcell=uddeDate($themessage->totrashdate, $config, uddeIMgetUserTZ()); // $displayname = $themessage->fromname; $displayname = uddeIMevaluateUsername($themessage->fromname, $themessage->fromid, $themessage->publicname); } elseif ($myself==$themessage->fromid && $myself!=$themessage->toid) { // Msg sent by me, receiver is someone else, so user is in "toid" $themarker = ">"; $theuser = $themessage->toid; $datumcell=uddeDate($themessage->totrashdateoutbox, $config, uddeIMgetUserTZ()); // $displayname = $themessage->toname; $displayname = uddeIMevaluateUsername($themessage->toname, $themessage->toid, $themessage->publicname); } else { // this case appears when a copy to me message has been trashed my myself // totrashoutbox=1 messages (sender has trashed are not selected in the SQL statement, so they do not appear here // totrash=1 messages has been trashed by myself, so I show them in the trashcan $themarker = "<"; // the message has been send to me (we could also reorder the if-clause and catch this case with "$myself==$themessage->toid" but maybe I change the marker sometime) $theuser = $themessage->fromid; $datumcell=uddeDate($themessage->totrashdate, $config, uddeIMgetUserTZ()); // $displayname = $themessage->fromname; $displayname = uddeIMevaluateUsername($themessage->fromname, $themessage->fromid, $themessage->publicname); } // systemmsg = "an XXX XXXX" $personalsys=0; if($themessage->systemflag && $myself==$themessage->toid && $themessage->systemmessage==$displayname) { $personalsys=1; } if($themessage->systemflag && $myself==$themessage->toid) { $displayname=$themessage->systemmessage; // its for me, so show systemname "to username" (copy2me message) } $fromcell = $themarker." ".$displayname; if ($theuser) { if(($config->showcblink && !$themessage->systemflag) || ($config->showcblink && $personalsys)) { $fromcell = uddeIMshowThumbOrLink($theuser, $themarker." ".$displayname, $config); } // Is this user currently online? Don't check, if it is a system message if (($config->showonline && !$themessage->systemflag) || ($config->showonline && $personalsys)) { $isonline = uddeIMisOnline($theuser); if($isonline) { $fromcell.=" ".$uddeicons_onlinepic; } else { $fromcell.=" ".$uddeicons_offlinepic; } } } // CRYPT $cm = uddeIMgetMessage($themessage->message, $cryptpass, $themessage->cryptmode, $themessage->crypthash, $config->cryptkey); $teasermessage=$cm; // if it is a system message or bb codes allowed, parse BB codes if ($themessage->systemflag || $config->allowbb) $teasermessage=uddeIMbbcode_strip($teasermessage); $teasermessage=uddeIMteaser(stripslashes($teasermessage), $config->firstwordsinbox, $config->quotedivider, $config->languagecharset); $teasermessage=htmlspecialchars($teasermessage, ENT_QUOTES, $config->charset); $teasermessage=str_replace("&#", "&#", $teasermessage); $teasermessage=str_replace("&</br>", " ", $teasermessage); $safemessage=htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset); $safemessage=str_replace("&</br>", "</br>", $safemessage); $messagecell=$teasermessage; if($config->actionicons) { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=restore&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/recycle.gif' alt='"._UDDEIM_RESTORE."' title='"._UDDEIM_RESTORE."' /></a>"; } else { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=restore&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'>"._UDDEIM_RESTORE."</a>"; } echo "\n\t<tr class='sectiontableentry".$i."'>"; echo "\n\t\t<td style='width:32px; text-align:center; vertical-align:middle'>".$readcell."</td>"; $st=uddeIMgetStyleForThumb($config); echo "\n\t\t<td ".$st.">".$fromcell."</td>"; echo "\n\t\t<td>".$messagecell."</td>"; // echo "\n\t\t<td>".$createdcell."</td>"; echo "\n\t\t<td>".$datumcell."</td>"; if($config->actionicons) { echo "\n\t\t<td style='width:32px; text-align:center; vertical-align:middle'>".$deletecell."</td>"; } else { echo "\n\t\t<td class='pathway'>".$deletecell."</td>"; } echo "</tr>"; $i++; if ($i>2) { $i=1; } } // now close inbox table and container echo "\n</table></div>\n"; // write the inbox navigation links $pageNav = new uddeIMmosPageNav($total, $limitstart, $limit); $referlink = "index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id; if($total>$limit) { $shownav = $pageNav->writePagesLinks($referlink); $shownav = uddeIMarrowReplace($shownav, $config->templatedir, $pathtouser); echo "<div id='uddeim-pagenav'>".$shownav."<br />"; echo "[<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id."&limitstart=0&limit=".$total)."'>"._UDDEIM_SHOWALL."</a>]"; echo "</div>\n"; } $keephours=((float)$config->TrashLifespan) * 24; echo "<div id='uddeim-bottomlines'>"; if ($config->TrashLifespanNote) echo "<p>"._UDDEIM_TRASHCAN_INFO_1.$keephours._UDDEIM_TRASHCAN_INFO_2."</p>"; echo "</div>\n"; echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; }
function uddeIMdrawWriteform($myself, $my_gid, $item_id, $backto, $recipname, $pmessage, $messageid, $dwf_isreply, $dwf_errorcode, $dwf_sysgm, $config) { $pathtouser = uddeIMgetPath('user'); $pathtosite = uddeIMgetPath('live_site'); // possible values for dwf_errorcode: // 0 = no error // 1 = no error, show complete userlist // 2 = don't send to yourself // 3 = username not found // 4 = no message // 5 = no username // 6 = too many recipients // 7 = wrong captcha code // 8 = does not allow public messages // 9 = one user has blocked you // 10 = sending to this group not allowed // 11 = contact list not found // 12 = error in from name (n/a, public frontend only) // 13 = error in from email (n/a, public frontend only) // 14 = time delay for spam protection // 15 = csrf protection // 16 = administrative blocking // 17 = user is banned // 18 = file upload failed // 19 = file size exceeded // 20 - file type not allowed // 21 - bad words // This functions expects values stripslashed // allowed to send messages? if ($config->waitdays && uddeIMisReggedOnly($my_gid)) { $rightnow=uddetime($config->timezone); $offset=((float)$config->waitdays) * 86400; $timeframe=$rightnow-$offset; $registerDate=uddeIMgetRegisterDate($myself, $config); // $registerDate=mktime(0, 0, 0, 3, 28, 2010); if ($timeframe<$registerDate) { $temp = ($registerDate-$timeframe)/86400; $showinboxlimit_borderbottom = "<span class='uddeim-warning'>"; if ($temp>=1) $showinboxlimit_borderbottom.= _UDDEIM_WAITDAYS1.sprintf("%0.1f", $temp)._UDDEIM_WAITDAYS2; else $showinboxlimit_borderbottom.= _UDDEIM_WAITDAYS1.sprintf("%0.1f", $temp*24)._UDDEIM_WAITDAYS2H; $showinboxlimit_borderbottom.= "</span>"; echo "<div id='uddeim-bottomlines'>".$showinboxlimit_borderbottom."</div>"; return; } } echo "<div id='uddeim-writeform'>\n"; if ($dwf_sysgm) { echo "<br />"; echo "<form enctype='multipart/form-data' name='sendeform' method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=savesysgm&Itemid=".$item_id)."'>\n"; uddeIMwriteCSRF($config); echo "<p><input type='checkbox' checked='checked' name='sysgm_sys' value='1' />"._UDDEIM_SEND_ASSYSM."</p>\n"; if ($config->showgroups) { echo "<p><select name='sysgm_universe' size='1'>"; echo "<option value='sysgm_toall'>"._UDDEIM_SEND_TOALL."</option>"; echo "<option value='sysgm_toallspecial'>"._UDDEIM_SEND_TOALLSPECIAL."</option>"; echo "<option value='sysgm_toalladmins'>"._UDDEIM_SEND_TOALLADMINS."</option>"; echo "<option value='sysgm_toalllogged'>"._UDDEIM_SEND_TOALLLOGGED."</option>"; $groups = uddeIMselectAROgroups(); foreach ($groups as $group) { $groupid = $group->id; $groupname = $group->name; echo "<option value='".$groupid."'>".$groupname."</option>"; } echo "</select></p>"; } else { echo "<p><input type='radio' name='sysgm_universe' value='sysgm_toall' />"._UDDEIM_SEND_TOALL."<br />\n"; echo "<input type='radio' name='sysgm_universe' checked='checked' value='sysgm_toallspecial' />"._UDDEIM_SEND_TOALLSPECIAL."<br />\n"; echo "<input type='radio' name='sysgm_universe' checked='checked' value='sysgm_toalladmins' />"._UDDEIM_SEND_TOALLADMINS."<br />\n"; echo "<input type='radio' name='sysgm_universe' value='sysgm_toalllogged' />"._UDDEIM_SEND_TOALLLOGGED."</p>\n"; } echo "<p>"._UDDEIM_VALIDFOR_1; echo "<input name='sysgm_validfor' type='text' size='4' />"._UDDEIM_VALIDFOR_2."</p>\n"; echo "<p>"._UDDEIM_SYSGM_SHORTHELP."</p>\n"; } else { echo "<br />"; echo "<form enctype='multipart/form-data' name='sendeform' method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=save&Itemid=".$item_id)."'>"; echo "<input type='hidden' name='sendeform_showallusers' value='' />\n"; uddeIMwriteCSRF($config); if (uddeIMgetEMNmoderated($myself) ) { //&& uddeIMisReggedOnly($my_gid)) { echo "<p>"._UDDEIM_MCP_MODERATED."</p>"; } } echo "\n"; if($dwf_errorcode==0 && $backto) { echo "<input type='hidden' name='backto' value='".htmlspecialchars($backto)."' />"; } if(!$dwf_sysgm) { if($dwf_isreply!=1) { // if this is NOT a reply echo "<table width='100%' cellspacing='0' cellpadding='0' width='100%'>"; if(0 && $dwf_errorcode==0 && $recipname) { // BUGBUG "0 &&". don't need this case echo "<tr><td valign='top'>"; echo "<b>".$recipname."</b>"; echo "<input type='hidden' name='to_name' id='input_to_name' value='".htmlentities($recipname, ENT_QUOTES, $config->charset)."' /> "; echo "</td></tr>"; } else { // START FIRST LINE IN TABLE (contains two fields: TO USER and select from ALL USER list) echo "<tr><td valign='top'>"; // if ($dwf_errorcode==0 && $recipname) { // does not really make sense // echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=new&Itemid=".$item_id)."'>"._UDDEIM_TODP."</a>"; // } else { echo "<span title='".($config->allowmultipleuser ? _UDDEIM_TODP_TITLE_CC : _UDDEIM_TODP_TITLE)."'>"; echo _UDDEIM_TODP; // } echo "<br />"; if($dwf_errorcode==2 || $dwf_errorcode==3 || $dwf_errorcode==5 || $dwf_errorcode==6 || $dwf_errorcode==8 || $dwf_errorcode==9 || $dwf_errorcode==10 || $dwf_errorcode==11 || $dwf_errorcode==16 || $dwf_errorcode==17 || $dwf_errorcode==18 || $dwf_errorcode==19 || $dwf_errorcode==20) { $errorstyle='style="background-color: #ff0000;" '; } else { $errorstyle=''; } echo "<input type='hidden' name='to_id' value='' />"; echo "<input type='hidden' name='messageid' value='".$messageid."' />"; if (!($config->flags & 0x04)) { echo "<input type='text' ".$errorstyle."name='to_name' id='input_to_name' value='".htmlentities($recipname, ENT_QUOTES, $config->charset)."' /> "; } else { echo "<span ".$errorstyle.">".htmlentities($recipname, ENT_QUOTES, $config->charset)."</span>"; echo "<input type='hidden' name='to_name' id='input_to_name' value='".htmlentities($recipname, ENT_QUOTES, $config->charset)."' /> "; } echo "</span>"; if ($config->useautocomplete) { uddeIMdoAutocomplete($config); } // SECOND FIELD IN FIRST LINE IN TABLE echo "</td><td valign='top' align='right'>\n"; $allusersallowed = 0; if( ($config->restrictallusers==0) || ($config->restrictallusers==1 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || ($config->restrictallusers==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) ) $allusersallowed=1; if (!($config->flags & 0x01) && $allusersallowed) { if ($config->modeshowallusers==1 || $config->modeshowallusers==2) { if ($dwf_errorcode==0 && $config->modeshowallusers==1) { // link to drop down box with names of connected users, value is 2 since it is shown the first time (so selecting the link does not show an error message because of an empty recipient field) echo "<br />"; echo "<a href=\"#\" onclick=\"document.sendeform.sendeform_showallusers.value='2'; document.sendeform.submit(); return false;\">"._UDDEIM_SHOWUSERS."</a>"; } else { // now show all users uddeIMdoShowAllUsers($myself, $my_gid, $config, 1); } } } echo "</td></tr>"; // START SECOND LINE IN TABLE (colspan=2) if ($dwf_errorcode==3) { echo "<tr><td valign=left colspan=2>"._UDDEIM_NOSUCHUSER."</td></tr>"; } elseif ($dwf_errorcode==2) { echo "<tr><td valign=left colspan=2>"._UDDEIM_NOTTOYOURSELF."</td></tr>"; } elseif ($dwf_errorcode==5) { echo "<tr><td valign=left colspan=2>"._UDDEIM_ENTERNAME."</td></tr>"; } elseif ($dwf_errorcode==6) { echo "<tr><td valign=left colspan=2>"._UDDEIM_TOOMANYRECIPIENTS."</td></tr>"; } elseif ($dwf_errorcode==7) { if ($config->captchatype==0) { echo "<tr><td valign=left colspan=2>"._UDDEIM_WRONGCAPTCHA."</td></tr>"; } else { echo "<tr><td valign=left colspan=2><span style='background-color: #ff0000;'>"._UDDEIM_WRONGCAPTCHA."</span></td></tr>"; } } elseif ($dwf_errorcode==8) { echo "<tr><td valign=left colspan=2>"._UDDEIM_NOPUBLICMSG."</td></tr>"; } elseif ($dwf_errorcode==9) { echo "<tr><td valign=left colspan=2>"._UDDEIM_ONEUSERBLOCKS."</td></tr>"; } elseif ($dwf_errorcode==10) { echo "<tr><td valign=left colspan=2>"._UDDEIM_GROUPBLOCKED."</td></tr>"; } elseif ($dwf_errorcode==11) { echo "<tr><td valign=left colspan=2>"._UDDEIM_NOSUCHLIST."</td></tr>"; } elseif ($dwf_errorcode==12) { echo "<tr><td valign=left colspan=2>"._UDDEIM_ERRORINFROMNAME."</td></tr>"; } elseif ($dwf_errorcode==13) { echo "<tr><td valign=left colspan=2>"._UDDEIM_ERRORINEMAIL."</td></tr>"; } elseif ($dwf_errorcode==14) { echo "<tr><td valign=left colspan=2>"._UDDEIM_YOUHAVETOWAIT."</td></tr>"; } elseif ($dwf_errorcode==15) { echo "<tr><td valign=left colspan=2>"._UDDEIM_ERRORCSRF."</td></tr>"; } elseif ($dwf_errorcode==16) { echo "<tr><td valign=left colspan=2>"._UDDEIM_USERBLOCKED."</td></tr>"; } elseif ($dwf_errorcode==17) { echo "<tr><td valign=left colspan=2>"._UDDEIM_USERBANNED."</td></tr>"; } elseif ($dwf_errorcode==18) { echo "<tr><td valign=left colspan=2>"._UDDEIM_FILEUPLOAD_FAILED."</td></tr>"; } elseif ($dwf_errorcode==19) { echo "<tr><td valign=left colspan=2>"._UDDEIM_FILESIZE_EXCEEDED."</td></tr>"; } elseif ($dwf_errorcode==20) { echo "<tr><td valign=left colspan=2>"._UDDEIM_FILETYPE_NOTALLOWED."</td></tr>"; } elseif ($dwf_errorcode==21) { echo "<tr><td valign=left colspan=2>"._UDDEIM_BADWORD."</td></tr>"; } // START THIRD LINE IN TABLE WHEN CONNECTIONS AVAILABLE $have_lists=0; if( ($config->enablelists==1) || ($config->enablelists==2 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || ($config->enablelists==3 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) ) $have_lists=1; if (!($config->flags & 0x02)) { if ($config->showconnex || $have_lists) { // if (uddeIMcheckCB() && $showconnex && !($recipname && $dwf_errorcode==0)) { uddeIMdoShowConnections($myself, $my_gid, $config); // this creates a third row in table } } } echo "</table>"; echo "<br />"; } else { // it IS a reply if ($dwf_errorcode) { echo "<table width='100%' cellspacing='0' cellpadding='0'>"; if ($dwf_errorcode==7) { echo "<tr><td valign=left colspan=2>"._UDDEIM_WRONGCAPTCHA."</td></tr>"; } elseif ($dwf_errorcode==13) { echo "<tr><td valign=left colspan=2>"._UDDEIM_ERRORINEMAIL."</td></tr>"; } elseif ($dwf_errorcode==14) { echo "<tr><td valign=left colspan=2>"._UDDEIM_YOUHAVETOWAIT."</td></tr>"; } echo "</table>"; echo "<br />"; } echo "<input type='hidden' name='to_id' value='".htmlentities($recipname, ENT_QUOTES, $config->charset)."' /> "; echo "<input type='hidden' name='messageid' value='".$messageid."' />"; echo "<input type='hidden' name='to_name' value='' />"; } } if(($config->showtextcounter && $config->maxlength) || $config->cryptmode==2 || $config->cryptmode==4) { uddeIMaddScript($pathtosite."/components/com_uddeim/js/uddeimtools.js"); } if($config->allowbb || $config->allowsmile) { uddeIMaddScript($pathtosite."/components/com_uddeim/js/bbsmile.js"); $num = uddeIMdoSmileysEx($config); uddeIMdoBB($config); uddeIMdoSmileys($config, $num); } // well, I think the complete textarea should be red (or only the label? or both?) // if($dwf_errorcode==4) { // $errorstyle=' style="background-color: #ff0000;"'; // } else { $errorstyle=''; // } if($dwf_isreply==1) { echo "<span".$errorstyle.">"._UDDEIM_REPLY."</span>"; } else { echo "<span".$errorstyle.">"._UDDEIM_MESSAGE."</span>"; } echo "<br />"; $thestyle = ""; if ($config->width) $thestyle .= "width: ".(int)$config->width."px; "; if ($dwf_errorcode==4 || $dwf_errorcode==21) $thestyle .= "background-color: #ff0000; "; $errorstyle=""; if ($thestyle!="") $errorstyle="style='".$thestyle."' "; // ================================== TEXTBOX/TEXTCOUNTER ============================== if($config->showtextcounter && $config->maxlength) { $uc = ($config->showtextcounter) ? "textCount(document.sendeform.pmessage,document.sendeform.characterstyped,".$config->maxlength.");" : ""; echo "<textarea name='pmessage' ".$errorstyle."class='inputbox' rows='".(int)$config->rows."' cols='".(int)$config->cols."' onkeydown='".$uc."' onkeyup='".$uc."'>".$pmessage."</textarea>"; echo "<div class='uddeim-textcounter'>"; echo "<input style='background-color: lightgray;' readonly='readonly' type='text' name='characterstyped' size='4' maxlength='4' value='".$config->maxlength."' /> "._UDDEIM_CHARSLEFT; echo "</div>"; } else { echo "<textarea name='pmessage' ".$errorstyle."class='inputbox' rows='".(int)$config->rows."' cols='".(int)$config->cols."'>".$pmessage."</textarea>"; } // ================================== FILE UPLOAD ============================== if( $config->enableattachment && uddeIMisAttachmentAllowed($my_gid, $config)) uddeIMshowUploadButtons($config); // ================================== PASSWORD ============================== // CRYPT if($config->cryptmode==2 || $config->cryptmode==4) { echo "<div class='uddeim-password'>"; echo "<a href='javascript:uddeidswap(\"divpass\");'>"._UDDEIM_PASSWORDBOX."</a>"; echo "<span id='divpass' style='visibility:hidden;'>: <input name='cryptpass' value='' />"._UDDEIM_ENCRYPTIONTEXT."</span>"; echo "</div>"; } // ================================== CAPTCHA ============================== if ( $config->usecaptcha>=4 || // all users (incl. admins) ($config->usecaptcha==3 && !uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config)) || // CAPTCHA enabled for public frontend, registered and special users ($config->usecaptcha==2 && !uddeIMisSpecial($my_gid) && !uddeIMisSpecial2($my_gid, $config)) ) { // CAPTCHA enabled for public frontend and registered users (note: 0 is not required since this is done in public.php) // CAPTCHA if ($config->captchatype==0) { if($dwf_errorcode==7) { $errorstyle='style="background-color: #ff0000;" '; } else { $errorstyle=''; } echo "<div class='uddeim-captcha'>"; echo "<label for='security_code'>"._UDDEIM_SECURITYCODE." </label><input id='security_code' name='security_code' type='text' ".$errorstyle." /> "; if (class_exists('JFactory')) { // CAPTCHA15 echo "<img style='vertical-align:middle;' src='".$pathtosite."/components/com_uddeim/captcha15.php' alt='' /><br />"; } else { // CAPTCHA10 echo "<img style='vertical-align:middle;' src='".$pathtosite."/components/com_uddeim/captcha.php' alt='' /><br />"; } echo "</div>"; } else { $pathtouser = uddeIMgetPath('user'); require_once($pathtouser."/recaptchalib.php"); echo "<div class='uddeim-captcha'>"; echo recaptcha_get_html($config->recaptchapub); echo "</div>"; } } // ================================== Show the SEND OPTIONS ============================== $showoptions = ($config->trashoriginal && $dwf_isreply==1) || ($config->trashoriginalsent && !$dwf_sysgm) || ($config->allowcopytome && !$dwf_sysgm) || ($config->addccline && $config->allowmultipleuser && !$dwf_sysgm) || ($config->allowemailnotify && $config->emailwithmessage==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) || ($config->allowemailnotify && $dwf_sysgm); if ($showoptions) { echo "<div class='uddeim-sendoption'>"; } if($config->trashoriginal && $dwf_isreply==1) { echo "<input type='checkbox' value='1' checked='checked' name='tobedeleted' />"._UDDEIM_TRASHORIGINAL." "; } if($config->trashoriginalsent && !$dwf_sysgm) { echo "<input type='checkbox' value='1' name='tobedeletedsent' />"._UDDEIM_TRASHORIGINALSENT." "; } if($config->allowcopytome && !$dwf_sysgm) { echo "<input type='checkbox' value='1' name='copytome' />"._UDDEIM_SENDCOPYTOME." "; } if($config->addccline && $config->allowmultipleuser && !$dwf_sysgm) { echo "<span title='"._UDDEIM_ADDCCINFO_TITLE."'>"; echo "<input type='checkbox' value='1' checked='checked' name='addccinfo' />"._UDDEIM_ADDCCINFO; echo "</span>"; } // Email notifications must be on AND emailwithmessage for admins AND its an admin if($config->allowemailnotify && $config->emailwithmessage==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) { echo "<span title='"._UDDEAIM_ADDEMAIL_TITLE."'>"; echo "<input type='checkbox' value='1' name='forceembedded' />"._UDDEAIM_ADDEMAIL_SELECT; echo "</span>"; } if($config->allowemailnotify && $dwf_sysgm) { echo "<span><input type='checkbox' value='1' name='sysgm_nonotify' />"._UDDEIM_SEND_NONOTIFY."</span>\n"; } if ($showoptions) { echo "</div>"; } // ================================== SEND BUTTON ============================== echo "<div class='uddeim-sendbutton'>"; // when going back one page (history(-1)) the button stays disabled // echo "<input type='submit' name='reply' class='button' onclick=\"this.disabled=true;this.value='"._UDDEIM_PROCESSING."';this.form.submit();\" value='"._UDDEIM_SUBMIT."' /> "; echo "<input type='submit' name='reply' class='button' value='"._UDDEIM_SUBMIT."' /> "; echo "</div>"; echo "</form>\n"; echo "</div>\n"; // end of uddeim-writeform }
function uddeIMusermessagesremove($option, $task, $uddeid, $config) { $database = uddeIMgetDatabase(); $rightnow=uddetime($config->timezone); echo "<div style='text-align:left'>"; echo "<p><b>"._UDDEADM_DELETEM_DELETING."</b></p>"; if (count($uddeid)) { foreach($uddeid AS $id) { echo _UDDEADM_DELETEM_FROMUSER.(int)$id.":<br />"; $sql="SELECT count(id) FROM #__uddeim WHERE totrashoutbox=0 AND fromid=".(int)$id; $database->setQuery($sql); $entryexists=$database->loadResult(); echo _UDDEADM_DELETEM_MSGSSENT.(int)$entryexists."<br />"; if ($entryexists) { $sql="UPDATE #__uddeim SET totrashoutbox=1, totrashdateoutbox=".(int)$rightnow." WHERE totrashoutbox=0 AND fromid=".(int)$id; $database->setQuery($sql); if (!$database->query()) { die("SQL error" . $database->stderr(true)); } } $sql="SELECT count(id) FROM #__uddeim WHERE totrash=0 AND toid=".(int)$id; $database->setQuery($sql); $entryexists=$database->loadResult(); echo _UDDEADM_DELETEM_MSGSRECV.(int)$entryexists."<br />"; if ($entryexists) { $sql="UPDATE #__uddeim SET totrash=1, toread=1, totrashdate=".(int)$rightnow." WHERE totrash=0 AND toid=".(int)$id; $database->setQuery($sql); if (!$database->query()) { die("SQL error" . $database->stderr(true)); } } } } echo "<p><b><a href=".uddeIMredirectIndex()."?option=$option&task=usersettings>"._UDDEADM_CONTINUE."</a></b></p>"; echo "</div>"; }
function uddeIMpublicDispatchEMN($var_msgid, $var_fromname, $var_toid, $var_message, $emn_option, $config) { $mosConfig_sitename = uddeIMgetSitename(); $pathtosite = uddeIMgetPath('live_site'); // if e-mail traffic stopped, don't send. if(!$config->emailtrafficenabled) { return; } $fromname = $var_fromname; if (!$fromname) $fromname = _UDDEIM_PUBLICUSER; // $ret = uddeIMgetNameEmailFromID($var_toid, $var_toname, $var_tomail, $config); $var_toname = uddeIMgetNameFromID($var_toid, $config); $var_tomail = uddeIMgetEMailFromID($var_toid, $config); if(!$var_tomail) return; if (!$var_toname) $var_toname = "Anonymous"; $msglink = ""; if ($cryptmode==2) { // Message is encrypted, so go to enter password page $msglink = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$var_msgid); } else { // normal message $msglink = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$var_msgid); } if($emn_option==1) { $var_body = _UDDEIM_EMN_FORGETMENOT; $var_body = str_replace("%livesite%", $pathtosite, $var_body); $var_body = str_replace("%you%", $var_toname, $var_body); $var_body = str_replace("%site%", $mosConfig_sitename, $var_body); $var_body = str_replace("%msglink%", $msglink, $var_body); } else { if($config->emailwithmessage==1 || $emn_option==2) { $var_body = _UDDEIM_EMN_BODY_WITHMESSAGE; $var_body = str_replace("%livesite%", $pathtosite, $var_body); $var_body = str_replace("%you%", $var_toname, $var_body); $var_body = str_replace("%site%", $mosConfig_sitename, $var_body); $var_body = str_replace("%msglink%", $msglink, $var_body); $var_body = str_replace("%user%", $var_fromname, $var_body); $var_body = str_replace("%pmessage%", $var_message, $var_body); } else { $var_body = _UDDEIM_EMN_BODY_NOMESSAGE; $var_body = str_replace("%livesite%", $pathtosite, $var_body); $var_body = str_replace("%you%", $var_toname, $var_body); $var_body = str_replace("%site%", $mosConfig_sitename, $var_body); $var_body = str_replace("%msglink%", $msglink, $var_body); $var_body = str_replace("%user%", $var_fromname, $var_body); } } $subject = _UDDEIM_EMN_SUBJECT; $subject = str_replace("%livesite%", $pathtosite, $subject); $subject = str_replace("%site%", $mosConfig_sitename, $subject); $subject = str_replace("%you%", $var_toname, $subject); $subject = str_replace("%user%", $var_fromname, $subject); $replyto = $var_tomail; $replytoname = ""; if(uddeIMsendmail($config->emn_sendername, $config->emn_sendermail, $var_toname, $var_tomail, $subject, $var_body, $replyto, $replytoname, "", $config)) { // set the remindersent status of this user to true if(!uddeIMexistsEMN($var_toid)) uddeIMinsertEMNdefaults($var_toid, $config); uddeIMupdateEMNreminder($var_toid, uddetime($config->timezone)); } }
function uddeIMarchiveDownload($myself, $item_id, $arcmes, $limit, $limitstart, $cryptpass, $config) { $mosConfig_sitename = uddeIMgetSitename(); // if e-mail traffic stopped, don't send. if (!$config->emailtrafficenabled) { $mosmsg = _UDDEIM_STOPPEDEMAIL; uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg); } if (!$config->allowarchive || !$config->enabledownload) { $mosmsg = _UDDEIM_ARCHIVENOTENABLED; uddeJSEFredirect("HTTP_REFERER", $mosmsg, "archive"); } $n = count($arcmes); if(!$n) { echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>"; return; } $clrf=chr(10); $rightnow=uddetime($config->timezone); $htmlstring="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>"; $htmlstring.=$mosConfig_sitename." "._UDDEIM_MESSAGEDOWNLOAD; $htmlstring.="</title></head><body><h2>"; $htmlstring.=_UDDEIM_MESSAGEDOWNLOAD." - ".$mosConfig_sitename; $htmlstring.="</h2><h4>".uddeLdate($rightnow, $config, uddeIMgetUserTZ())."</h4><!-- generated by uddeIM messaging component --><table cellspacing=0 cellpadding=4 border=0>"; $exportstring=_UDDEIM_MESSAGEDOWNLOAD." - ".$mosConfig_sitename.$clrf; $exportstring.=uddeLdate($rightnow, $config, uddeIMgetUserTZ()); $exportstring.=$clrf.$clrf.$clrf; $maindivider="================================================================================".$clrf; $exportstring.=$maindivider; for($i = 0; $i <= ($n-1); $i++) { $trashs = uddeIMselectArchiveMessage($myself, $arcmes[$i], $config); foreach($trashs as $trash) { $fromname = uddeIMevaluateUsername($trash->fromname, $trash->fromid, $trash->publicname); if($trash->systemflag) $fromname = $trash->systemmessage; // $headstring.=" (".uddeLdate($trash->datum, $config, uddeIMgetUserTZ()).")"; // $headdivider=str_repeat("=", strlen($headstring)); // $exportstring.=" ".$headstring.$clrf." ".$headdivider.$clrf.$clrf; $cm = uddeIMgetMessage($trash->message, $cryptpass, $trash->cryptmode, $trash->crypthash, $config->cryptkey); $dlmsg = stripslashes($cm); $dlmsg = uddeIMbbcode_strip($dlmsg); // $exportstring.=stripslashes($dlmsg); // $exportstring.=$clrf.$clrf.$clrf.$clrf; // $exportstring.=$maindivider; $exportstring.=_UDDEIM_EXPORT_FORMAT; $exportstring=str_replace("%user%", $fromname, $exportstring); $exportstring=str_replace("%msgdate%", uddeLdate($trash->datum, $config, uddeIMgetUserTZ()), $exportstring); $exportstring=str_replace("%msgbody%", $dlmsg, $exportstring); $htmlstring.="\n\t<tr bgcolor=#cccccc><td><strong>".$fromname."</strong></td><td align=right>".uddeLdate($trash->datum, $config, uddeIMgetUserTZ())."</td></tr><tr><td> </td><td>"; $htmlstring.=nl2br(stripslashes($dlmsg)); $htmlstring.="</td></tr>"; } } $htmlstring.="\n</table>\n</body>\n</html>\n"; // we now have $exportstring and $htmlstring (text and html respecitvely) as files with all checked messages (in arcmes[]) // $ret = uddeIMgetNameEmailFromID($myself, $var_toname, $var_tomail, $config); $var_toname = uddeIMgetNameFromID($myself, $config); $var_tomail = uddeIMgetEMailFromID($myself, $config); if (!$var_tomail) { $mosmsg = _UDDEIM_EXPORT_COULDNOTSEND; uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg); } if (!$var_toname) $var_toname = "Anonymous"; $subject = $mosConfig_sitename." "._UDDEIM_MESSAGEDOWNLOAD; $var_fromname = $config->emn_sendername; $var_frommail = $config->emn_sendermail; if(uddeIMsendmail($var_fromname, $var_frommail, $var_toname, $var_tomail, $subject, $exportstring, "", "", "", $config)) { $mosmsg = _UDDEIM_EXPORT_MAILED; } else { $mosmsg = _UDDEIM_EXPORT_COULDNOTSEND; } uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg); }
function uddeIMdeleteMessagePostboxMultiple($myself, $userid, $arcmes, $limit, $limitstart, $item_id, $config) { $n = count($arcmes); if (!$n) { echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>"; return; } for ($i = 0; $i <= ($n-1); $i++) { $deletetime=uddetime($config->timezone); if ($arcmes[$i]>0) { $allmessages = uddeIMselectMessage($myself, $arcmes[$i], $config, $trashed=-1); foreach($allmessages as $themessage) { if ($myself==$themessage->toid && $myself!=$themessage->fromid) { uddeIMupdateToread($myself, $themessage->id, 1); uddeIMdeleteMessageFromInbox($myself, $themessage->id, $deletetime); } elseif ($myself==$themessage->fromid && $myself!=$themessage->toid) { uddeIMdeleteMessageFromOutbox($myself, $themessage->id, $deletetime); } else { // this case appears when a copy to me message has been trashed my myself uddeIMupdateToread($myself, $themessage->id, 1); uddeIMdeleteMessageFromInbox($myself, $themessage->id, $deletetime); } } } } uddeJSEFredirect("index.php?option=com_uddeim&task=postboxuser&Itemid=".$item_id."&recip=".$userid."&limit=".$limit."&limitstart=".$limitstart); }
function uddeIMdeleteInbox($myself, $item_id, $arcmes, $limit, $limitstart, $config) { $n = count($arcmes); if (!$n) { echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>"; return; } for ($i = 0; $i <= ($n-1); $i++) { $rightnow=uddetime($config->timezone); if ($arcmes[$i]>0) { // uddeIMupdateToread($myself, $arcmes[$i], 1); uddeIMdeleteMessageFromInbox($myself, $arcmes[$i], $rightnow); // when it is a message from me to me and I trash the message then also trash the message from the outbox // $sql="UPDATE #__uddeim SET totrashoutbox=1, totrashdateoutbox=".$rightnow." WHERE toid=fromid AND toid=".(int)$myself." AND id=".(int)$arcmes[$i]; // $___atabase->setQuery($sql); // if (!$___atabase->query()) { // die("SQL error when attempting to trash a message" . $___atabase->stderr(true)); // } } } uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart); }
function uddeIMdoFilePrune($config) { $database = uddeIMgetDatabase(); $uploaddir = uddeIMgetPath('absolute_path')."/images/uddeimfiles"; $rightnow=uddetime($config->timezone); $sql = "SELECT count(b.id) AS count,a.id,a.filename,a.tempname,a.fileid FROM #__uddeim_attachments AS a LEFT JOIN #__uddeim AS b ON a.mid=b.id GROUP BY a.fileid HAVING count=0"; $database->setQuery( $sql ); $value = $database->loadObjectList(); if (!$value) $value = Array(); while (list($key, $row) = each($value)) { if (file_exists($uploaddir."/".$row->tempname)) unlink($uploaddir."/".$row->tempname); $sql="DELETE FROM #__uddeim_attachments WHERE fileid=".$database->Quote($row->fileid); $database->setQuery($sql); if (!$database->query()) die("SQL error when attempting to delete an attachment" . $database->stderr(true)); } }
function uddeIMreportSpam($myself, $item_id, $messageid, $recip, $ret, $limit, $limitstart, $config) { $db = uddeIMgetDatabase(); // read message $messageid $displaymessages = uddeIMselectInboxMessage($myself, $messageid, $config); if (count($displaymessages)<1) { echo _UDDEIM_MESSAGENOACCESS; return; } if (!uddeIMgetSpamStatus($messageid)) { // and append to #__uddeim_spam foreach($displaymessages as $displaymessage) { if ($displaymessage->cryptmode==2 || $displaymessage->cryptmode==4) $cm = "Cannot display - Message is encrypted."; else $cm = uddeIMgetMessage($displaymessage->message, "", $displaymessage->cryptmode, $displaymessage->crypthash, $config->cryptkey); $dm = nl2br(htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset)); $dm = str_replace("&#", "&#", $dm); $dm = str_replace("&</br>", "</br>", $dm); $dm = uddeIMencrypt($dm,"",CRYPT_MODE_STOREBASE64); $sql = "INSERT INTO #__uddeim_spam (mid, datum, reported, fromid, toid, message) VALUES (". (int)$displaymessage->id.", ". (int)$displaymessage->datum.", ". (int)uddetime($config->timezone).", ". (int)$displaymessage->fromid.", ". (int)$displaymessage->toid.", ". $db->Quote($dm).")"; $db->setQuery($sql); if (!$db->query()) die("SQL error when attempting to save a report" . $db->stderr(true)); } uddeIMnotifySpam($myself, $item_id, $displaymessage->fromid, $displaymessage->toid, $config); } $addlink = ""; if ($recip) $addlink = "&recip=".(int)$recip; $task = "inbox"; if ($ret=="postboxuser") $task = "postboxuser"; if(!$limit && !$limitstart) { $redirecturl="index.php?option=com_uddeim&task=".$task."&Itemid=".$item_id.$addlink; } else { $redirecturl="index.php?option=com_uddeim&task=".$task."&Itemid=".$item_id.$addlink."&limit=".$limit."&limitstart=".$limitstart; } uddeJSEFredirect($redirecturl); }
function uddeIMdeleteOutbox($myself, $item_id, $arcmes, $limit, $limitstart, $config) { $n = count($arcmes); if (!$n) { echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>"; return; } for ($i = 0; $i <= ($n-1); $i++) { $rightnow=uddetime($config->timezone); if($arcmes[$i]>0) { uddeIMdeleteMessageFromOutbox($myself, $arcmes[$i], $rightnow); } } uddeJSEFredirect("index.php?option=com_uddeim&task=outbox&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart); }
function _pmsUddeGetTime($currentTime) { global $_CB_framework; static $notLoaded = true; if ($notLoaded) { if (defined('JPATH_ADMINISTRATOR')) { if (file_exists(JPATH_SITE . '/components/com_uddeim/uddeimlib17.php')) { $ver = checkJversion('release'); if (!strncasecmp($ver, "2.5", 3)) { require_once JPATH_SITE . '/components/com_uddeim/uddeimlib25.php'; } elseif (!strncasecmp($ver, "1.7", 3)) { require_once JPATH_SITE . '/components/com_uddeim/uddeimlib17.php'; } elseif (!strncasecmp($ver, "1.6", 3)) { require_once JPATH_SITE . '/components/com_uddeim/uddeimlib16.php'; } else { require_once JPATH_SITE . '/components/com_uddeim/uddeimlib15.php'; } } } else { global $mainframe; if (file_exists($mainframe->getCfg('absolute_path') . '/components/com_uddeim/uddeimlib17.php')) { require_once $mainframe->getCfg('absolute_path') . '/components/com_uddeim/uddeimlib10.php'; } } $notLoaded = false; } if (is_callable('uddetime') && isset($this->uddeconfig)) { return uddetime($this->uddeconfig->timezone); } else { global $_CB_framework; return $currentTime + $_CB_framework->getCfg('offset') * 3600; } }
function uddeIMshowstatistics($option, $task, $config) { $database = uddeIMgetDatabase(); echo "<div style='text-align:left'>"; echo "<p><b>"._UDDEADM_STATISTICS."</b></p>"; echo "<table border='0'>"; $query="SELECT count(id) FROM #__uddeim"; $database->setQuery($query); $result=(int)$database->loadResult(); echo "<tr><td>"._UDDEADM_MAINTENANCE_COUNT."</td><td>".$result."</td></tr>"; $query="SELECT count(id) FROM #__uddeim WHERE totrash=1"; $database->setQuery($query); $result=(int)$database->loadResult(); echo "<tr><td>"._UDDEADM_MAINTENANCE_COUNT_RECIPIENT."</td><td>".$result."</td></tr>"; $query="SELECT count(id) FROM #__uddeim WHERE totrashoutbox=1"; $database->setQuery($query); $result=(int)$database->loadResult(); echo "<tr><td>"._UDDEADM_MAINTENANCE_COUNT_SENDER."</td><td>".$result."</td></tr>"; $query="SELECT count(id) FROM #__uddeim WHERE totrash=1 AND totrashoutbox=1"; $database->setQuery($query); $result=(int)$database->loadResult(); echo "<tr><td>"._UDDEADM_MAINTENANCE_COUNT_TRASH."</td><td>".$result."</td></tr>"; $query="SELECT max(id) FROM #__uddeim"; $database->setQuery($query); $result=(int)$database->loadResult(); $max = $result; echo "<tr><td>"._UDDEADM_MAINTENANCE_ALLDAYS."</td><td>".$result."</td></tr>"; $rightnow=uddetime((int)$config->timezone); $timeframe=$rightnow-(86400*7); $query="SELECT min(datum) FROM #__uddeim WHERE datum>=".(int)$timeframe; $database->setQuery($query); $result=(int)$database->loadResult(); if (!$result) { $result = 0; } else { $query="SELECT min(id) FROM #__uddeim WHERE datum=".(int)$result." LIMIT 1"; $database->setQuery($query); $result=(int)$database->loadResult(); $result = $max - $result + 1; } echo "<tr><td>"._UDDEADM_MAINTENANCE_7DAYS."</td><td>".$result."</td></tr>"; $rightnow=uddetime((int)$config->timezone); $timeframe=$rightnow-(86400*30); $query="SELECT min(datum) FROM #__uddeim WHERE datum>=".(int)$timeframe; $database->setQuery($query); $result=(int)$database->loadResult(); if (!$result) { $result = 0; } else { $query="SELECT min(id) FROM #__uddeim WHERE datum=".(int)$result." LIMIT 1"; $database->setQuery($query); $result=(int)$database->loadResult(); $result = $max - $result + 1; } echo "<tr><td>"._UDDEADM_MAINTENANCE_30DAYS."</td><td>".$result."</td></tr>"; $rightnow=uddetime((int)$config->timezone); $timeframe=$rightnow-(86400*365); $query="SELECT min(datum) FROM #__uddeim WHERE datum>=".(int)$timeframe; $database->setQuery($query); $result=(int)$database->loadResult(); if (!$result) { $result = 0; } else { $query="SELECT min(id) FROM #__uddeim WHERE datum=".(int)$result." LIMIT 1"; $database->setQuery($query); $result=(int)$database->loadResult(); $result = $max - $result + 1; } echo "<tr><td>"._UDDEADM_MAINTENANCE_365DAYS."</td><td>".$result."</td></tr>"; if ($config->enableattachment) { $query="SELECT COUNT(id) FROM #__uddeim_attachments"; $database->setQuery($query); $result=(int)$database->loadResult(); echo "<tr><td>"._UDDEADM_MAINTENANCE_COUNTFILES."</td><td>".$result."</td></tr>"; $query="SELECT COUNT(DISTINCT fileid) FROM #__uddeim_attachments"; $database->setQuery($query); $result=(int)$database->loadResult(); echo "<tr><td>"._UDDEADM_MAINTENANCE_COUNTFILESDISTINCT."</td><td>".$result."</td></tr>"; } echo "</table>"; echo "<br />"; $rightnow=uddetime($config->timezone); $sincewhen=$rightnow-($config->longwaitingdays*86400); $next = (int)$config->longwaitingdays*86400; $sql = "SELECT min(a.id) AS mid, a.toid, b.name, a.datum, c.remindersent FROM #__uddeim AS a, #__users AS b, #__uddeim_emn AS c " . "WHERE a.toid=b.id AND a.toid=c.userid AND " . "a.toread=0 AND a.totrash=0 AND b.block=0 AND " . "a.datum<".$sincewhen." AND a.datum>".$config->forgetmenotstart." AND " . "c.remindersent+".$next."<".$rightnow." " . "GROUP BY a.toid"; $database->setQuery($sql); $castaways=$database->loadObjectList(); $text = sprintf(_UDDEADM_MAINTENANCE_HEAD1, $config->longwaitingdays); echo $text."<br />"; echo "<table border='1' cellpadding='1' cellspacing='0'>"; echo "<tr><th>"._UDDEADM_MAINTENANCE_NO."</th><th>"._UDDEADM_MAINTENANCE_USERID."</th><th>"._UDDEADM_MAINTENANCE_TONAME."</th><th>"._UDDEADM_MAINTENANCE_MID."</th><th>"._UDDEADM_MAINTENANCE_WRITTEN."</th><th>"._UDDEADM_MAINTENANCE_TIMER."</th></tr>"; $loopcounter=1; foreach($castaways as $castaway) { echo "<tr><td>".$loopcounter."</td><td>".$castaway->toid."</td><td>".$castaway->name."</td><td>".$castaway->mid."</td><td>".uddeDate($castaway->datum, $config, uddeIMgetUserTZ())."</td><td>".uddeDate($castaway->remindersent, $config, uddeIMgetUserTZ())." / ".uddeDate($castaway->remindersent+$next, $config, uddeIMgetUserTZ())."</td></tr>"; $loopcounter++; } echo "</table>"; echo "<br />"; $rightnow=uddetime($config->timezone)+7*86400; $sincewhen=$rightnow-($config->longwaitingdays*86400); $next = (int)$config->longwaitingdays*86400; $sql = "SELECT min(a.id) AS mid, a.toid, b.name, a.datum, c.remindersent FROM #__uddeim AS a, #__users AS b, #__uddeim_emn AS c " . "WHERE a.toid=b.id AND a.toid=c.userid AND " . "a.toread=0 AND a.totrash=0 AND b.block=0 AND " . "a.datum<".$sincewhen." AND a.datum>".$config->forgetmenotstart." AND " . "c.remindersent+".$next."<".$rightnow." " . "GROUP BY a.toid"; $database->setQuery($sql); $castaways=$database->loadObjectList(); $text = sprintf(_UDDEADM_MAINTENANCE_HEAD2, 7); echo $text."<br />"; echo "<table border='1' cellpadding='1' cellspacing='0'>"; echo "<tr><th>"._UDDEADM_MAINTENANCE_NO."</th><th>"._UDDEADM_MAINTENANCE_USERID."</th><th>"._UDDEADM_MAINTENANCE_TONAME."</th><th>"._UDDEADM_MAINTENANCE_MID."</th><th>"._UDDEADM_MAINTENANCE_WRITTEN."</th><th>"._UDDEADM_MAINTENANCE_TIMER."</th></tr>"; $loopcounter=1; foreach($castaways as $castaway) { echo "<tr><td>".$loopcounter."</td><td>".$castaway->toid."</td><td>".$castaway->name."</td><td>".$castaway->mid."</td><td>".uddeDate($castaway->datum, $config, uddeIMgetUserTZ())."</td><td>".uddeDate($castaway->remindersent, $config, uddeIMgetUserTZ())." / ".uddeDate($castaway->remindersent+$next, $config, uddeIMgetUserTZ())."</td></tr>"; $loopcounter++; } echo "</table>"; echo "<p><b><a href=".uddeIMredirectIndex()."?option=com_uddeim>"._UDDEADM_CONTINUE."</a></b></p>"; echo "</div>"; }