Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • putFileContents
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file renders the main mail log view.
  5:  *
  6:  * @package Core
  7:  * @subpackage Backend
  8:  * @author Simon Sprankel
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: global $area, $action, $perm;
 18: 
 19: $page = new cGuiPage('mail_log_overview');
 20: 
 21: if (!$perm->have_perm_area_action($area)) {
 22:     $page->displayError(i18n('Permission denied'));
 23:     $page->abortRendering();
 24:     $page->render();
 25:     exit();
 26: }
 27: 
 28: // show notification if mail logging is disabled
 29: if (getSystemProperty('system', 'mail_log') === 'false') {
 30:     $page->displayWarning(i18n('Mail logging is disabled!'));
 31: }
 32: 
 33: $mailLogCollection = new cApiMailLogCollection();
 34: 
 35: // execute the actions
 36: if ($action == 'mail_log_delete') {
 37:     // delete all mails and the corresponding success entries with the given
 38:     // idmails
 39:     if (!empty($_REQUEST['idmails'])) {
 40:         $mailLogSuccessCollection = new cApiMailLogSuccessCollection();
 41:         $idmails = json_decode($_REQUEST['idmails'], true);
 42:         foreach ($idmails as $idmail) {
 43:             $mailLogCollection->delete($idmail);
 44:             // also delete the entries in mail_log_success
 45:             $mailLogSuccessCollection->deleteBy('idmail', $idmail);
 46:         }
 47:     }
 48: } else if ($action == 'mail_log_resend') {
 49:     $mailer = new cMailer();
 50:     $mailer->resendMail($_REQUEST['idmailsuccess']);
 51: }
 52: 
 53: $mailLogCollection->query();
 54: 
 55: // show notification if there no mails have been logged yet
 56: if ($mailLogCollection->count() === 0) {
 57:     $page->displayInfo(i18n('No mails have been logged yet.'));
 58:     $page->abortRendering();
 59:     $page->render();
 60:     exit();
 61: }
 62: 
 63: if ($area === 'mail_log' || $area === 'mail_log_overview') {
 64:     // construct the hidden form
 65:     $form = new cHTMLForm('bulk_editing', '', 'post', 'action-form');
 66:     $form->setVar('area', '');
 67:     $form->setVar('frame', '4');
 68:     $form->setVar('action', '');
 69:     $form->setVar('contenido', cRegistry::getSession()->id);
 70:     $form->setVar('idmail', '');
 71:     $form->setVar('idmails', '');
 72:     $page->appendContent($form);
 73: 
 74:     // add the top bulk editing functions
 75:     $page->appendContent(mailLogBulkEditingFunctions());
 76: 
 77:     // construct the overview table
 78:     $table = new cHTMLTable();
 79:     $table->setClass('generic');
 80:     $table->setWidth('100%');
 81: 
 82:     // construct the header
 83:     $headers = array(
 84:         'checkbox' => i18n('Mark'),
 85:         'subject' => i18n('Subject'),
 86:         'to' => i18n('To'),
 87:         'created' => i18n('Date'),
 88:         'client' => i18n('Client'),
 89:         'action' => i18n('Action')
 90:     );
 91:     $thead = new cHTMLTableHeader();
 92:     $tr = new cHTMLTableRow();
 93:     foreach ($headers as $header) {
 94:         $th = new cHTMLTableHead();
 95:         $th->setContent($header);
 96:         $tr->appendContent($th);
 97:     }
 98:     $thead->setContent($tr);
 99:     $table->appendContent($thead);
100: 
101:     // construct the content rows containing the mails
102:     $tbody = new cHTMLTableBody();
103:     // iterate over all logged mails
104:     while (($item = $mailLogCollection->next()) !== false) {
105:         $tr = new cHTMLTableRow();
106:         foreach ($headers as $key => $value) {
107:             $td = new cHTMLTableData();
108:             switch ($key) {
109:                 case 'checkbox':
110:                     $checkbox = new cHTMLCheckbox('', $item->get('idmail'), '', false, '', '', '', 'mark_emails');
111:                     $td->setContent($checkbox->toHtml(false));
112:                     break;
113:                 case 'client':
114:                     $idclient = $item->get('idclient');
115:                     $clientItem = new cApiClient($idclient);
116:                     $td->setContent($clientItem->get('name') . '&nbsp;');
117:                     break;
118:                 case 'from':
119:                 case 'to':
120:                     $addresses = $item->get($key);
121:                     $addresses = mailLogDecodeAddresses($addresses);
122:                     $td->setContent($addresses . '&nbsp;');
123:                     break;
124:                 case 'action':
125:                     // construct the info link
126:                     $img = new cHTMLImage('images/info.gif');
127:                     $link = new cHTMLLink('javascript:void(0)');
128:                     $link->setEvent('click', 'showInfo(' . $item->get('idmail') . ');');
129:                     $link->setContent($img);
130:                     $link->appendStyleDefinition('margin-right', '5px');
131:                     $td->appendContent($link);
132:                     // construct the delete link
133:                     $img = new cHTMLImage('images/delete.gif');
134:                     $link = new cHTMLLink('javascript:void(0)');
135:                     $link->setEvent('click', 'Con.showConfirmation("' . i18n('Do you really want to delete this email?') . '", function() { deleteEmails(' . $item->get('idmail') . '); });return false;');
136:                     $link->setContent($img);
137:                     $td->appendContent($link);
138:                     break;
139:                 default:
140:                     $td->setContent($item->get($key) . '&nbsp;');
141:             }
142:             $tr->appendContent($td);
143:         }
144:         $tbody->appendContent($tr);
145:     }
146:     $table->appendContent($tbody);
147:     $page->appendContent($table);
148: 
149:     // add the bottom bulk editing functions
150:     $page->appendContent(mailLogBulkEditingFunctions());
151: } else if ($area === 'mail_log_detail') {
152:     if (isset($_REQUEST['idmail']) && is_numeric($_REQUEST['idmail'])) {
153:         // construct the back button
154:         $link = new cHTMLLink(cRegistry::getBackendUrl() . 'main.php?area=mail_log&frame=4&contenido=' . cRegistry::getSession()->id);
155:         $image = new cHTMLImage('images/but_back.gif');
156:         $image->appendStyleDefinition('cursor', 'pointer');
157:         $image->appendStyleDefinition('margin-bottom', '10px');
158:         $link->setContent($image);
159:         $page->appendContent($link);
160: 
161:         $idmail = $_REQUEST['idmail'];
162:         // construct the hidden form
163:         $form = new cHTMLForm('', '', 'post', 'action-form');
164:         $form->setVar('area', '');
165:         $form->setVar('frame', '4');
166:         $form->setVar('action', 'mail_log_overview');
167:         $form->setVar('contenido', cRegistry::getSession()->id);
168:         $form->setVar('idmail', $idmail);
169:         $form->setVar('idmails', '[' . $idmail . ']');
170:         $form->setVar('idmailsuccess', '');
171:         $page->appendContent($form);
172: 
173:         // construct the email details table
174:         $tableHeaderDetail = array(
175:             'from' => i18n('From'),
176:             'to' => i18n('To'),
177:             'reply_to' => i18n('Reply to'),
178:             'cc' => i18n('CC'),
179:             'bcc' => i18n('BCC'),
180:             'subject' => i18n('Subject'),
181:             'body' => i18n('Body'),
182:             'created' => i18n('Date')
183:         );
184:         $table = new cHTMLTable();
185:         $table->setClass('generic');
186:         $table->appendStyleDefinition('border-top', '1px solid #B3B3B3');
187:         $mailItem = new cApiMailLog($idmail);
188:         foreach ($tableHeaderDetail as $key => $value) {
189:             $tr = new cHTMLTableRow();
190:             $td = new cHTMLTableData();
191:             $td->setContent($value . '&nbsp;');
192:             $tr->appendContent($td);
193:             switch ($key) {
194:                 // addresses are saved JSON-encoded, so decode them accordingly
195:                 case 'from':
196:                 case 'to':
197:                 case 'reply_to':
198:                 case 'cc':
199:                 case 'bcc':
200:                     $td = new cHTMLTableData();
201:                     $addresses = mailLogDecodeAddresses($mailItem->get($key));
202:                     $td->setContent($addresses . '&nbsp;');
203:                     $tr->appendContent($td);
204:                     break;
205:                 default:
206:                     $td = new cHTMLTableData();
207:                     $data = $mailItem->get($key);
208:                     if ($mailItem->get('content_type') === 'text/plain') {
209:                         $data = nl2br($data);
210:                     }
211:                     $td->setContent($data . '&nbsp;');
212:                     $tr->appendContent($td);
213:             }
214:             $table->appendContent($tr);
215:         }
216:         // construct the action row
217:         $tr = new cHTMLTableRow();
218:         $td = new cHTMLTableData();
219:         $td->setContent(i18n('Action'));
220:         $tr->appendContent($td);
221:         $td = new cHTMLTableData();
222:         $link = new cHTMLLink('javascript:void(0)');
223:         $link->setClass('con_deletemails');
224:         $link->setEvent('click', 'Con.showConfirmation("' . i18n('Do you really want to delete this email?') . '", function() { deleteEmails(' . $idmail . '); });return false;');
225:         $image = new cHTMLImage('images/delete.gif');
226:         $image->setAlt(i18n('Delete emails'));
227:         $link->setContent($image);
228:         $td->setContent($link);
229:         $tr->appendContent($td);
230:         $table->appendContent($tr);
231:         $page->appendContent($table);
232: 
233:         // generate the success table
234:         $successTable = new cHTMLTable();
235:         $successTable->setClass('generic');
236:         $successTable->appendStyleDefinition('margin-top', '20px');
237:         // get all status entries for the given idmail
238:         $mailLogSuccessCollection = new cApiMailLogSuccessCollection();
239:         $mailLogSuccessCollection->select('`idmail`=' . $idmail);
240:         $tr = new cHTMLTableRow();
241:         $th = new cHTMLTableHead();
242:         $th->setContent(i18n('Recipient'));
243:         $tr->appendContent($th);
244:         $th = new cHTMLTableHead();
245:         $th->setContent(i18n('Status'));
246:         $tr->appendContent($th);
247:         $successTable->appendContent($tr);
248: 
249:         // construct a table row for each recipient
250:         while (($mailSuccessItem = $mailLogSuccessCollection->next()) !== false) {
251:             $tr = new cHTMLTableRow();
252:             $td = new cHTMLTableData();
253:             $td->setContent(mailLogDecodeAddresses($mailSuccessItem->get('recipient')));
254:             $tr->appendContent($td);
255:             $td = new cHTMLTableData();
256:             if ($mailSuccessItem->get('success')) {
257:                 // mail has been sent successfully, show OK image
258:                 $image = new cHTMLImage('images/but_ok.gif');
259:                 $image->appendStyleDefinition('display', 'block');
260:                 $image->appendStyleDefinition('margin', '0 auto');
261:                 $image->appendStyleDefinition('padding', '3px');
262:                 $image->setAlt(i18n('Mail sent successfully!'));
263:                 $td->setContent($image);
264:             } else {
265:                 // mail could not be sent yet, show resend button
266:                 $link = new cHTMLLink('javascript:void(0)');
267:                 $link->setEvent('click', 'resendEmail(' . $mailSuccessItem->get('idmailsuccess') . ')');
268:                 $link->setAlt(i18n('Resend email'));
269:                 $image = new cHTMLImage('images/but_refresh.gif');
270:                 $image->appendStyleDefinition('display', 'block');
271:                 $image->appendStyleDefinition('margin', '0 auto');
272:                 $image->appendStyleDefinition('padding', '3px');
273:                 $link->setContent($image);
274:                 $td->setContent($link);
275:             }
276:             $tr->appendContent($td);
277:             $successTable->appendContent($tr);
278:         }
279:         $page->appendContent($successTable);
280:     } else {
281:         // no mail has been selected, show error
282:         $contenidoNotification = new cGuiNotification();
283:         $contenidoNotification->displayNotification('error', i18n('No item selected!'));
284:     }
285: }
286: 
287: $page->render();
288: 
289: /**
290:  * Takes an associative array where the keys represent the mail addresses
291:  * and the values optionally represent the mailer name and returns an HTML
292:  * representation in the following form:
293:  * Vorname Nachname <vorname.nachname@domain.tld>
294:  * Vorname2 Nachname2 <vorname2.nachname2@domain2.tld>
295:  *
296:  * @param array $addresses
297:  *         associative array containing the mail addresses as keys
298:  *         and the mailer names as values
299:  * @return string
300:  *         HTML code showing the given mail addresses and names
301:  */
302: function mailLogDecodeAddresses($addresses) {
303:     $result = '';
304:     $addresses = json_decode($addresses, true);
305:     if (!is_array($addresses)) {
306:         return "";
307:     }
308:     foreach ($addresses as $mail => $name) {
309:         $result .= $name . ' &lt;' . $mail . '&gt;<br>';
310:     }
311:     $result = substr($result, 0, strlen($result) - 4);
312: 
313:     return $result;
314: }
315: 
316: /**
317:  *
318:  * @return cHTMLTable
319:  */
320: function mailLogBulkEditingFunctions() {
321: 
322:     $table = new cHTMLTable();
323:     $table->setClass('generic');
324:     $table->setWidth('100%');
325:     $table->appendStyleDefinition('margin', '10px 0');
326: 
327:     $tr = new cHTMLTableRow();
328: 
329:     $th = new cHTMLTableHead();
330:     $th->appendStyleDefinition('border-bottom', '1px solid #B3B3B3');
331: 
332:     // construct the invert selection function
333:     $link = new cHTMLLink();
334:     $link->setClass('flip_mark');
335:     $image = new cHTMLImage('images/but_invert_selection.gif');
336:     $image->setAlt(i18n('Flip Selection'));
337:     $link->appendContent($image);
338:     $link->appendContent(' ' . i18n('Flip Selection'));
339:     $th->appendContent($link);
340: 
341:     // construct the bulk editing functions
342:     $link = new cHTMLLink('javascript:void(0)');
343:     $link->setClass('con_deletemails');
344:     $link->setEvent('click', 'Con.showConfirmation("' . i18n('Do you really want to delete the selected emails?') . '", deleteEmails);return false;');
345:     $image = new cHTMLImage('images/delete.gif');
346:     $image->setAlt(i18n('Delete emails'));
347:     $link->setContent($image);
348:     $div = new cHTMLDiv(i18n('Apply to all selected emails:'), 'bulk_editing_functions');
349:     $div->appendContent($link);
350:     $th->appendContent($div);
351: 
352:     $tr->setContent($th);
353:     $table->setContent($tr);
354: 
355:     return $table;
356: 
357: }
358: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0