private function _setJs() { $doc = JFactory::getDocument(); $config =& acymailing_config(); $websiteurl = rtrim(JURI::root(), '/') . '/'; $doc->addScript($websiteurl . 'media/com_acymailing/js/jquery/jquery-1.9.1.min.js?v=' . @filemtime(ACYMAILING_ROOT . 'media' . DS . 'com_acymailing' . DS . 'js' . DS . 'jquery' . DS . 'jquery-1.9.1.min.js')); $imageZone = JRequest::getVar('image_zone', array(), '', 'array'); if (empty($imageZone)) { $getAdditionalTags = "\n\t\t\t\t\tvar selectedImageWidth = document.getElementById('acy_media_browser_image_width').value;\n\t\t\t\t\tvar selectedImageHeight = document.getElementById('acy_media_browser_image_height').value;\n\t\t\t\t\tvar selectedImageAlign = document.getElementById('acy_media_browser_image_align').value;\n\t\t\t\t\tvar selectedImageBorder = document.getElementById('acy_media_browser_image_border').value;\n\t\t\t\t\tvar selectedImageMargin = document.getElementById('acy_media_browser_image_margin').value;\n\n\t\t\t\t\tvar width = ''; var height =''; var align=''; var border = ''; var margin = '';\n\t\t\t\t\tif(selectedImageWidth>0) width = ' width:' + selectedImageWidth + 'px; ';\n\t\t\t\t\tif(selectedImageHeight>0) height = ' height:' + selectedImageHeight + 'px; ';\n\t\t\t\t\tif(selectedImageAlign) align = 'float:' + selectedImageAlign + ';';\n\t\t\t\t\tif(selectedImageWidth>0 && selectedImageAlign.trim()=='center') align = 'margin:auto;';\n\t\t\t\t\tif(selectedImageBorder) border = ' border:' + selectedImageBorder + '; ';\n\t\t\t\t\tif(selectedImageBorder>0 ) border = ' border: solid ' + selectedImageBorder + 'px; ';\n\t\t\t\t\tif(selectedImageMargin>0) margin = ' margin:' + selectedImageMargin + 'px; ';\n\t\t\t\t\telse if(selectedImageMargin) margin = ' margin:' + selectedImageMargin + '; ';\n\t\t\t\t\tvar imgSize = ' height =\"' + selectedImageHeight + '\" width = \"' + selectedImageWidth + '\"';\n\t\t\t\t\t\t\t"; $sizeAndAlignTags = " style=\"' + height + width + align + border + margin +'\" "; $insertImage = "window.parent.insertImageTag(tag, previousSelection);"; } else { $getAdditionalTags = "var selectedImageRef = document.getElementById('acy_media_browser_image_target').value; "; $sizeAndAlignTags = ""; $insertImage = "window.parent.jInsertEditorText(tag, this.editor);"; } if (JRequest::getVar('inpopup', '') == 'true') { $imgMaxHeight = 150; $slideValue = -395; } else { $imgMaxHeight = 190; $slideValue = -522; } $js = "\n\t\t\t\tvar previousSelection = window.parent.getPreviousSelection();\n\n\t\t\t\tfunction checkSelected(imageZone) {\n\n\t\t\t\t\tif(imageZone){\n\t\t\t\t\t\tvar editor = window.parent.CKEDITOR.editor;\n\n\t\t\t\t\t\to = this._getUriObject(window.self.location.href);\n\t\t\t\t\t\tq = new Hash(this._getQueryObject(o.query));\n\t\t\t\t\t\tzone = decodeURIComponent(q.get('e_name'));\n\n\t\t\t\t\t\tvar html = window.parent.getSelectedHTML(zone);\n\t\t\t\t\t\tvar parsedSelection = jQuery.parseHTML(html);\n\n\t\t\t\t\t\tif(!parsedSelection)\n\t\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t\tif(parsedSelection[0].tagName == 'A'){\n\t\t\t\t\t\t\tvar parsedImage = jQuery.parseHTML(parsedSelection[0].innerHTML);\n\t\t\t\t\t\t\tparsedImage = parsedImage[0];\n\n\t\t\t\t\t\t\tif(parsedSelection[0].href)\n\t\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_target').value = parsedSelection[0].href;\n\t\t\t\t\t\t}else if(parsedSelection[0].tagName == 'IMG'){\n\t\t\t\t\t\t\tvar parsedImage = parsedSelection[0];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(!parsedImage) return false;\n\n\t\t\t\t\t\tvar name = parsedImage.src.substr(parsedImage.src.lastIndexOf('/') + 1);\n\t\t\t\t\t\tif(parsedImage.src.substring(0,4)=='http'){\n\t\t\t\t\t\t\tvar imageUrl = parsedImage.src;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar imageUrl = '" . ACYMAILING_LIVE . "' + parsedImage.src;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar width = parsedImage.width;\n\t\t\t\t\t\tvar height = parsedImage.height;\n\t\t\t\t\t\tdisplayImageFromUrl(imageUrl, 'success', name, width, height);\n\t\t\t\t\t\tif(parsedImage.alt)\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_title').value = parsedImage.alt;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar editor = window.parent.editor;\n\t\t\t\t\t\tvar sel = editor.getSelection();\n\t\t\t\t\t\tvar ranges = sel.getRanges();\n\t\t\t\t\t\tvar el = new window.parent.CKEDITOR.dom.element('div');\n\t\t\t\t\t\tfor (var i = 0, len = ranges.length; i < len; ++i) {\n\t\t\t\t\t\t\t\tel.append(ranges[i].cloneContents());\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(el.getFirst() && el.getFirst().getName() == 'a'){\n\t\t\t\t\t\t\tvar selection = el.getFirst().getHtml();\n\t\t\t\t\t\t\tvar selectedImageRef = el.getFirst().getAttribute('href');\n\t\t\t\t\t\t} else{\n\t\t\t\t\t\t\tvar selection = el.getHtml();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar parsedSelection = jQuery.parseHTML(selection);\n\n\t\t\t\t\t\tif(!parsedSelection)\n\t\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t\tif(parsedSelection[0].tagName == 'IMG'){\n\t\t\t\t\t\t\tvar name = parsedSelection[0].src.substr(parsedSelection[0].src.lastIndexOf('/') + 1);\n\t\t\t\t\t\t\tvar width = parsedSelection[0].width;\n\t\t\t\t\t\t\tvar height = parsedSelection[0].height;\n\t\t\t\t\t\t\tif(\$(selection).attr('src').substring(0,4)=='http'){\n\t\t\t\t\t\t\t\tvar imageUrl = \$(selection).attr('src');\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tvar imageUrl = '" . ACYMAILING_LIVE . "' + \$(selection).attr('src');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisplayImageFromUrl(imageUrl, 'success', name, width, height);\n\n\t\t\t\t\t\t\tif(parsedSelection[0].alt)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_title').value = parsedSelection[0].alt;\n\t\t\t\t\t\t\tif(parsedSelection[0].style.width)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_width').value = parsedSelection[0].style.width.slice(0,-2);\n\t\t\t\t\t\t\tif(parsedSelection[0].style.height)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_height').value = parsedSelection[0].style.height.slice(0,-2);\n\t\t\t\t\t\t\tif(parsedSelection[0].style.cssFloat)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_align').value = parsedSelection[0].style.cssFloat;\n\t\t\t\t\t\t\tif(parsedSelection[0].style.margin)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_margin').value = parsedSelection[0].style.margin;\n\t\t\t\t\t\t\tif(parsedSelection[0].style.border)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_border').value = parsedSelection[0].style.border;\n\t\t\t\t\t\t\tif(parsedSelection[0].className)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_class').value = parsedSelection[0].className;\n\t\t\t\t\t\t\tif(selectedImageRef)\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_linkhref').value = selectedImageRef;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction displayImageFromUrl(url, result, name, width, height, fromUrl){\n\t\t\t\t\tif(result=='success'){\n\t\t\t\t\t\t\tvar infos = '<div style=\"width:100%; display:block: height:1px; float:left; margin-top:10px;\"></div>';\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected').innerHTML='<img id=\"acy_media_browser_selected_image\" src=\"' + url + '\" style=\"border: 1px solid rgb(233, 233, 233); float:left; margin-right:15px; max-width: 230px; max-height:" . $imgMaxHeight . "px;\"></img>'+infos;\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected').style.display=\"\";\n\t\t\t\t\t\t\tif(!name){ var name = url.substr(url.lastIndexOf('/') + 1); }\n\t\t\t\t\t\t\tif(width){\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected_info').innerHTML='<div><span id=\"acy_media_browser_image_selected_name\" style=\"font-weight:bold;\"> '+name+'</span><br />'+width+'x'+height+'<br />';\n\t\t\t\t\t\t\t\tvar widthField = document.getElementById('acy_media_browser_image_width');\n\t\t\t\t\t\t\t\tvar heightField = document.getElementById('acy_media_browser_image_height');\n\t\t\t\t\t\t\t\tif(widthField) widthField.value = width;\n\t\t\t\t\t\t\t\tif(heightField) heightField.value = height;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected_info').style.display=\"\";\n\t\t\t\t\t\t\tif(fromUrl){\n\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_insert_message').innerHTML='<span style=\"color:green;\">" . str_replace("'", "\\'", JText::_('IMAGE_FOUND')) . "</span>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected').innerHTML=\"\";\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected').style.display=\"none\";\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_selected_info').innerHTML=\"\";\n\t\t\t\t\t\t\tif(fromUrl){\n\t\t\t\t\t\t\t\tif(result='error'){\n\t\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_insert_message').innerHTML='<span style=\"color:red;\">" . str_replace("'", "\\'", JText::_('IMAGE_NOT_FOUND')) . "</span>';\n\t\t\t\t\t\t\t\t}else if(result='timeout'){\n\t\t\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_insert_message').innerHTML='<span style=\"color:red;\">" . str_replace("'", "\\'", JText::_('IMAGE_TIMEOUT')) . "</span>';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tfunction calculateSize(newHeight, newWidth){\n\t\t\t\t\tif((newHeight == '' && newWidth == '') || (newHeight == '' && newWidth == 0) || (newHeight == 0 && newWidth == '')) return;\n\t\t\t\t\tvar img = document.getElementById('acy_media_browser_selected_image');\n\t\t\t\t\tif(!img) return;\n\n\t\t\t\t\tif(newHeight == 0)\n\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_height').value = parseInt(img.naturalHeight * (newWidth / img.naturalWidth));\n\n\t\t\t\t\tif(newWidth == 0)\n\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_width').value = parseInt(img.naturalWidth * (newHeight / img.naturalHeight));\n\t\t\t\t}\n\n\n\t\t\t\tfunction testImage(url, callback, timeout) {\n\t\t\t\t\ttimeout = timeout || 5000;\n\t\t\t\t\t\tvar timedOut = false, timer;\n\t\t\t\t\t\tvar img = new Image();\n\t\t\t\t\t\timg.onerror = img.onabort = function() {\n\t\t\t\t\t\t\t\tif (!timedOut) {\n\t\t\t\t\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\t\t\t\t\tcallback(url, \"error\", '', '', '',true);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\timg.onload = function() {\n\t\t\t\t\t\t\t\tif (!timedOut) {\n\t\t\t\t\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\t\t\t\t\tcallback(url, \"success\",'','', '',true);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\timg.src = url;\n\t\t\t\t\t\ttimer = setTimeout(function() {\n\t\t\t\t\t\t\t\ttimedOut = true;\n\t\t\t\t\t\t\t\tcallback(url, \"timeout\", '', '', '', true);\n\t\t\t\t\t\t}, timeout);\n\t\t\t\t}\n\n\t\t\t\tfunction displayAppropriateField(id){\n\t\t\t\t\tif(id==\"import_from_url_btn\"){\n\t\t\t\t\t\t\tdocument.getElementById('upload_image').style.display=\"none\";\n\t\t\t\t\t\t\tdocument.getElementById('import_from_url').style.display=\"block\";\n\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_buttons_block').css('width', '0');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_buttons_block').css('opacity', '0');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_hidden_elements').css('width', '522px');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_hidden_elements').css('opacity', '1');\n\n\t\t\t\t\t}else if(id==\"upload_image_btn\"){\n\t\t\t\t\t\t\tdocument.getElementById('upload_image').style.display=\"block\";\n\t\t\t\t\t\t\tdocument.getElementById('import_from_url').style.display=\"none\";\n\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_buttons_block').css('width', '0');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_buttons_block').css('opacity', '0');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_hidden_elements').css('width', '522px');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_hidden_elements').css('opacity', '1');\n\n\t\t\t\t\t}else if(id == \"create_folder_btn\"){\n\t\t\t\t\t\tif(document.getElementById('acy_media_browser_area_create_folder').style.display == \"none\"){\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_area_create_folder').style.display = \"\";\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_area_create_folder').stop().animate({height: '85px'},400);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_area_create_folder').style.display = \"none\";\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_area_create_folder').stop().animate({height: '0px'},400);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_hidden_elements').css('width', '0');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_hidden_elements').css('opacity', '0');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_buttons_block').css('width', '522px');\n\t\t\t\t\t\t\tjQuery('#acy_media_browser_buttons_block').css('opacity', '1');\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction toggleImageInfo(id, action){\n\t\t\t\t\tif(action==\"display\"){\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_info_'+id+'').style.display = \"\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\t\tdocument.getElementById('acy_media_browser_image_info_'+id+'').style.display = \"none\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction _getQueryObject(q) {\n\t\t\t\t\tvar vars = q.split(/[&;]/);\n\t\t\t\t\tvar rs = {};\n\t\t\t\t\tif (vars.length) vars.each(function(val) {\n\t\t\t\t\t\t\tvar keys = val.split('=');\n\t\t\t\t\t\t\tif (keys.length && keys.length == 2) rs[encodeURIComponent(keys[0])] = encodeURIComponent(keys[1]);\n\t\t\t\t\t});\n\t\t\t\t\treturn rs;\n\t\t\t\t}\n\n\t\t\t\tfunction _getUriObject(u){\n\t\t\t\t\tvar bits = u.match(/^(?:([^:\\/?#.]+):)?(?:\\/\\/)?(([^:\\/?#]*)(?::(\\d*))?)((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[\\?#]|\$)))*\\/?)?([^?#\\/]*))?(?:\\?([^#]*))?(?:#(.*))?/);\n\t\t\t\t\treturn (bits)\n\t\t\t\t\t\t? bits.associate(['uri', 'scheme', 'authority', 'domain', 'port', 'path', 'directory', 'file', 'query', 'fragment'])\n\t\t\t\t\t\t: null;\n\t\t\t\t}\n\n\t\t\t\tfunction validateImage(){\n\t\t\t\t\tvar urlInput = document.getElementById('acy_media_browser_url_input').value;\n\t\t\t\t\tvar urlImageName = urlInput.substr(urlInput.lastIndexOf('/') + 1);\n\t\t\t\t\tvar selectedImageName = '';\n\t\t\t\t\tif(document.getElementById('acy_media_browser_image_selected_name'))\n\t\t\t\t\tvar selectedImageName = document.getElementById('acy_media_browser_image_selected_name').innerHTML;\n\n\t\t\t\t\tvar selectedImageAlt = document.getElementById('acy_media_browser_image_title').value;\n\t\t\t\t\tvar selectedImageRef = '';\n\t\t\t\t\tif(document.getElementById('acy_media_browser_image_linkhref'))\n\t\t\t\t\t\tvar selectedImageRef = document.getElementById('acy_media_browser_image_linkhref').value;\n\t\t\t\t\tvar selectedImageUrl = document.getElementById('acy_media_browser_selected_image').src;\n\t\t\t\t\tvar imgSize = '';\n\t\t\t\t\tvar selectedImageClass = '';\n\t\t\t\t\tif(document.getElementById('acy_media_browser_image_class'))\n\t\t\t\t\t\tvar selectedImageClass = document.getElementById('acy_media_browser_image_class').value;\n\n\t\t\t\t\t" . $getAdditionalTags . "\n\n\t\t\t\t\to = this._getUriObject(window.self.location.href);\n\t\t\t\t\tq = new Hash(this._getQueryObject(o.query));\n\t\t\t\t\tthis.editor = decodeURIComponent(q.get('e_name'));\n\n\t\t\t\t\tvar dropdown = document.getElementById('acy_media_browser_files_path');\n\t\t\t\t\tvar path = dropdown.options[dropdown.selectedIndex].text;\n\t\t\t\t\tvar base = ' " . ACYMAILING_LIVE . " ';\n\n\t\t\t\t\tif(urlInput!='http://' && selectedImageName.trim()==urlImageName.trim()){\n\t\t\t\t\t\t\tvar tag = '<img ' + imgSize + ' src=\"' + urlInput + '\" alt=\"' + selectedImageAlt + '\" " . $sizeAndAlignTags . " class=\"' + selectedImageClass + '\" />';\n\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar tag = '<img ' + imgSize + ' src=\"' + selectedImageUrl + '\" alt=\"' + selectedImageAlt + '\" " . $sizeAndAlignTags . " class=\"' + selectedImageClass + '\" />';\n\t\t\t\t\t}\n\n\t\t\t\t\tif(selectedImageRef){\n\t\t\t\t\t\t\ttag = '<a href=\"' + selectedImageRef + '\">' + tag + '</a>';\n\t\t\t\t\t}\n\n\t\t\t\t\t" . $insertImage . "\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tfunction changeFolder(folderName){\n\t\t\t\t\tvar url = window.location.href;\n\t\t\t\t\tif (url.indexOf('?') > -1){\n\t\t\t\t\t\t\tvar lastParam = url.substring(url.lastIndexOf('&') + 1);\n\t\t\t\t\t\t\tif(url.indexOf('pictName') > -1){\n\t\t\t\t\t\t\t\tvar temp = url.split('&');\n\t\t\t\t\t\t\t\tfor(var i=0;i<temp.length;i++){\n\t\t\t\t\t\t\t\t\tif(temp[i].indexOf('pictName') > -1){\n\t\t\t\t\t\t\t\t\t\ttemp.splice(i, 1);\n\t\t\t\t\t\t\t\t\t\ti--;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\turl = temp.join('&');\n\t\t\t\t\t\t\t\tlastParam = url.substring(url.lastIndexOf('&') + 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(lastParam == 'task=createFolder')url = url.replace(lastParam,'task=browse&e_name=ACY_NAME_AREA');\n\t\t\t\t\t\t\tlastParam = lastParam.split('=');\n\t\t\t\t\t\t\tif(lastParam=='selected_folder')\n\t\t\t\t\t\t\t\turl = url.replace(lastParam, 'selected_folder='+folderName);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\turl += '&selected_folder='+folderName;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t\t url += '?selected_folder='+folderName;\n\t\t\t\t\t}\n\t\t\t\t\twindow.location.href = url;\n\t\t\t\t}\n\n\t\t\t\tfunction confirmDeletePicture(pictName){\n\t\t\t\t\tvar divText = document.getElementById('confirmTxtMM');\n\t\t\t\t\tdivText.innerHTML = '" . JText::_('ACY_VALIDDELETEITEMS') . "<br /><span class=\"acy_folder_name\">('+pictName+')</span><br />';\n\t\t\t\t\tvar divDelete = document.getElementById('confirmOkMM');\n\t\t\t\t\tdivDelete.onclick = function(){\n\t\t\t\t\t\tdeletePicture(pictName);\n\t\t\t\t\t}\n\t\t\t\t\tvar divConfirm = document.getElementById('confirmBoxMM');\n\t\t\t\t\tdivConfirm.style.display = 'inline';\n\t\t\t\t}\n\n\t\t\t\tfunction deletePicture(pictName){\n\t\t\t\t\tvar urlPict = window.location.href;\n\t\t\t\t\tvar lastParam = urlPict.substring(urlPict.lastIndexOf('&') + 1);\n\t\t\t\t\tif(lastParam.indexOf('pictName=') > -1){\n\t\t\t\t\t\turlPict = urlPict.substring(0, urlPict.indexOf('pictName=')-1);\n\t\t\t\t\t}\n\t\t\t\t\tif (urlPict.indexOf('?') > -1){\n\t\t\t\t\t\twindow.location.href = window.location.href + '&pictName=' + pictName;\n\t\t\t\t\t} else{\n\t\t\t\t\t\twindow.location.href = window.location.href + '?pictName=' + pictName;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t"; $doc->addScriptDeclaration($js); }
function send() { if (!$this->isAllowed('configuration', 'manage')) { return; } JRequest::checkToken() or die('Invalid Token'); $bodyEmail = JRequest::getString('mailbody'); $code = JRequest::getString('code'); JRequest::setVar('code', $code); if (empty($code)) { return; } $config = acymailing_config(); $mailer = acymailing_get('helper.mailer'); $mailer->Subject = '[ACYMAILING LANGUAGE FILE] ' . $code; $mailer->Body = 'The website ' . ACYMAILING_LIVE . ' using AcyMailing ' . $config->get('level') . $config->get('version') . ' sent a language file : ' . $code; $mailer->Body .= "\n" . "\n" . "\n" . $bodyEmail; $user = JFactory::getUser(); $mailer->AddAddress($user->email, $user->name); $mailer->AddAddress('*****@*****.**', 'Acyba Translation Team'); $mailer->report = false; jimport('joomla.filesystem.file'); $path = JPath::clean(JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini'); $mailer->AddAttachment($path); $result = $mailer->Send(); if ($result) { acymailing_display(JText::_('THANK_YOU_SHARING'), 'success'); acymailing_display($mailer->reportMessage, 'success'); } else { acymailing_display($mailer->reportMessage, 'error'); } }
function listing() { $app = JFactory::getApplication(); global $Itemid; $config = acymailing_config(); $jsite = JFactory::getApplication('site'); $menus = $jsite->getMenu(); $menu = $menus->getActive(); if (empty($menu) and !empty($Itemid)) { $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } if (empty($menu)) { acymailing_enqueueMessage(JText::_('ACY_NOTALLOWED')); $app->redirect('index.php'); } $selectedLists = 'all'; if (is_object($menu)) { jimport('joomla.html.parameter'); $menuparams = new acyParameter($menu->params); $this->assign('listsintrotext', $menuparams->get('listsintrotext')); $this->assign('listsfinaltext', $menuparams->get('listsfinaltext')); $selectedLists = $menuparams->get('lists', 'all'); $document = JFactory::getDocument(); if ($menuparams->get('menu-meta_description')) { $document->setDescription($menuparams->get('menu-meta_description')); } if ($menuparams->get('menu-meta_keywords')) { $document->setMetadata('keywords', $menuparams->get('menu-meta_keywords')); } if ($menuparams->get('robots')) { $document->setMetadata('robots', $menuparams->get('robots')); } if ($menuparams->get('page_title')) { acymailing_setPageTitle($menuparams->get('page_title')); } } if (empty($menuparams)) { $pathway = $app->getPathway(); $pathway->addItem(JText::_('MAILING_LISTS')); } $document = JFactory::getDocument(); $link = '&format=feed&limitstart='; if ($config->get('acyrss_format') == 'rss' || $config->get('acyrss_format') == 'both') { $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs); } if ($config->get('acyrss_format') == 'atom' || $config->get('acyrss_format') == 'both') { $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs); } $listsClass = acymailing_get('class.list'); $allLists = $listsClass->getLists('', $selectedLists); if (acymailing_level(1)) { $allLists = $listsClass->onlyCurrentLanguage($allLists); } $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid; $this->assignRef('rows', $allLists); $this->assignRef('item', $myItem); }
function remove() { JRequest::checkToken() or die('Invalid Token'); $app = JFactory::getApplication(); $config = acymailing_config(); $deleteBehaviour = $config->get('frontend_delete_button', 'delete'); $subscriberIds = JRequest::getVar('cid', array(), '', 'array'); if ($app->isAdmin() || $deleteBehaviour == 'delete') { if (!$this->isAllowed('subscriber', 'delete')) { return; } $subscriberObject = acymailing_get('class.subscriber'); $num = $subscriberObject->delete($subscriberIds); $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message'); } else { if (!$this->isAllowed('subscriber', 'manage')) { return; } $listId = JRequest::getInt('filter_lists', 0); if (empty($listId)) { $app->enqueueMessage('List not found', 'error'); } else { $listsubClass = acymailing_get('class.listsub'); foreach ($subscriberIds as $subid) { $listsubClass->removeSubscription($subid, array($listId)); } $listClass = acymailing_get('class.list'); $list = $listClass->get($listId); $app->enqueueMessage(JText::sprintf('IMPORT_REMOVE', count($subscriberIds), $list->name), 'message'); } } JRequest::setVar('layout', 'listing'); return parent::display(); }
public function acyqueueHelper() { $this->config = acymailing_config(); $this->subClass = acymailing_get('class.subscriber'); $this->listsubClass = acymailing_get('class.listsub'); $this->listsubClass->checkAccess = false; $this->listsubClass->sendNotif = false; $this->listsubClass->sendConf = false; $this->send_limit = (int) $this->config->get('queue_nbmail', 40); acymailing_increasePerf(); @ini_set('default_socket_timeout', 10); @ignore_user_abort(true); $timelimit = intval(ini_get('max_execution_time')); if (empty($timelimit)) { $timelimit = 600; } $calculatedTimeout = $this->config->get('max_execution_time'); if (!empty($calculatedTimeout) && $calculatedTimeout < $timelimit) { $timelimit = $calculatedTimeout; } if (!empty($timelimit)) { $this->stoptime = time() + $timelimit - 4; } $this->db = JFactory::getDBO(); }
function getInput() { $config =& acymailing_config(); $level = $config->get('level'); $link = ACYMAILING_HELPURL.$this->value.'&level='.$level; $text = '<a class="modal" title="'.JText::_('ACY_HELP',true).'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button class="btn" onclick="return false">'.JText::_('ACY_HELP').'</button></a>'; return $text; }
function validEmail($email, $extended = false) { if (empty($email) or !is_string($email)) { return false; } if (!preg_match('/^([a-z0-9_\'&\\.\\-\\+])+\\@(([a-z0-9\\-])+\\.)+([a-z0-9]{2,10})+$/i', $email)) { return false; } if (!$extended) { return true; } $config = acymailing_config(); if ($config->get('email_checkpopmailclient', false)) { if (preg_match('#^.{1,5}@(gmail|yahoo|aol|hotmail|msn|ymail)#i', $email)) { return false; } } if ($config->get('email_checkdomain', false) and function_exists('getmxrr')) { $domain = substr($email, strrpos($email, '@') + 1); $mxhosts = array(); $checkDomain = getmxrr($domain, $mxhosts); if (!empty($mxhosts) && strpos($mxhosts[0], 'hostnamedoesnotexist')) { array_shift($mxhosts); } if (!$checkDomain || empty($mxhosts)) { $dns = @dns_get_record($domain, DNS_A); if (empty($dns)) { return false; } } } return true; }
function acymailing_replaceusertags(&$email, &$user, $send = true) { if (!empty($email->altbody)) { $email->altbody = str_replace(array('{statpicture}', '{nostatpicture}'), '', $email->altbody); } if (!$email->sendHTML or empty($email->type) or !in_array($email->type, array('news', 'autonews', 'followup', 'welcome', 'unsub', 'joomlanotification')) or strpos($email->body, '{nostatpicture}')) { $email->body = str_replace(array('{statpicture}', '{nostatpicture}'), '', $email->body); return; } if (empty($user->subid) || !$send) { $pictureLink = ACYMAILING_LIVE . $this->params->get('picture', 'media/com_acymailing/images/statpicture.png'); } else { $config = acymailing_config(); $itemId = $config->get('itemid', 0); $item = empty($itemId) ? '' : '&Itemid=' . $itemId; $pictureLink = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=stats&mailid=' . $email->mailid . '&subid=' . $user->subid . $item); } $widthsize = $this->params->get('width', 50); $heightsize = $this->params->get('height', 1); $width = empty($widthsize) ? '' : ' width="' . $widthsize . '" '; $height = empty($heightsize) ? '' : ' height="' . $heightsize . '" '; $statPicture = '<img class="spict" alt="' . $this->params->get('alttext', '') . '" src="' . $pictureLink . '" border="0" ' . $height . $width . '/>'; if (strpos($email->body, '{statpicture}')) { $email->body = str_replace('{statpicture}', $statPicture, $email->body); } elseif (strpos($email->body, '</body>')) { $email->body = str_replace('</body>', $statPicture . '</body>', $email->body); } else { $email->body .= $statPicture; } }
function continuesend() { $config = acymailing_config(); if (acymailing_level(1) && $config->get('queue_type') == 'onlyauto') { JRequest::setVar('tmpl', 'component'); acymailing_display(JText::_('ACY_ONLYAUTOPROCESS'), 'warning'); return; } $newcrontime = time() + 120; if ($config->get('cron_next') < $newcrontime) { $newValue = new stdClass(); $newValue->cron_next = $newcrontime; $config->save($newValue); } $mailid = acymailing_getCID('mailid'); $totalSend = JRequest::getVar('totalsend', 0, '', 'int'); $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int'); $helperQueue = acymailing_get('helper.queue'); $helperQueue->mailid = $mailid; $helperQueue->report = true; $helperQueue->total = $totalSend; $helperQueue->start = $alreadySent; $helperQueue->pause = $config->get('queue_pause'); $helperQueue->process(); JRequest::setVar('tmpl', 'component'); }
public function Process() { // Newsletter component disabled or not found. Aborting. if (!$this->enabled) { return true; } $config = acymailing_config(); // Build subscriber object $subscriber = new stdClass(); // Name field may be absent. AcyMailing will guess the user's name from his email address $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : ""; // AcyMailing refuses to save the user (return false) if the email address is empty, so we don't care to check it $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']); // It seems that $subscriber->confirmed defaults to unconfirmed if unset, so we need to read and pass the actual value from the configuration //ADRIEN : not necessary, you should keep the user as unconfirmed, Acy will take care of that //$subscriber->confirmed = !(bool)$config->get('require_confirmation'); $userClass = acymailing_get('class.subscriber'); $userClass->checkVisitor = false; // Add or update the user $sub_id = $userClass->save($subscriber); if (empty($sub_id)) { // User save failed. Probably email address is empty or invalid $this->logger->Write(get_class($this) . " Process(): User save failed"); return true; } // Lists $cumulative = JRequest::getVar("acymailing_subscribe_cumulative", NULL, "POST"); $checkboxes = array(FAcyMailing::subscribe => JRequest::getVar("acymailing_subscribe", array(), "POST")); $lists = $cumulative ? $checkboxes : array(); // Subscription //$listsubClass = acymailing_get('class.listsub'); //$listsubClass->addSubscription($sub_id, $lists); // ADRIEN : we use an other function so Acy will check the subscription and only subscribe the user if he was not already subscribed to that list. /* $newSubscription = array(); if(!empty($lists)){ foreach($lists[FAcyMailing::subscribe] as $listId){ $newList = array(); $newList['status'] = FAcyMailing::subscribe; $newSubscription[$listId] = $newList; } $userClass->saveSubscription($sub_id, $newSubscription); } */ // When in mode "one checkbox for each list" and no lists selected the code above produce an SQL error because passes an empty array to saveSubscription() $newSubscription = array(); foreach ($lists[FAcyMailing::subscribe] as $listId) { $newList = array(); $newList['status'] = FAcyMailing::subscribe; $newSubscription[$listId] = $newList; } if (!empty($newSubscription)) { $userClass->saveSubscription($sub_id, $newSubscription); } // implode() doesn't accept NULL values :( @$lists[FAcyMailing::subscribe] or $lists[FAcyMailing::subscribe] = array(); // Log $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $lists[FAcyMailing::subscribe])); return true; }
function listing() { $app = JFactory::getApplication(); $config = acymailing_config(); if (!class_exists('plgSystemAcymailingClassMail')) { $app->enqueueMessage('AcyMailing can customize some Joomla messages. If you want to do this, please first <a href="index.php?option=com_acymailing&ctrl=cpanel">enable the plugin acymailingclassmail</a>', 'notice'); } $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'mailid', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $db = JFactory::getDBO(); $query = 'SELECT mailid, subject, alias, fromname, published, fromname, fromemail, replyname, replyemail FROM #__acymailing_mail WHERE `type` = ' . $db->Quote($this->type); if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } $db->setQuery($query); $rows = $db->loadObjectList(); acymailing_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('preview', 'acypreview', '', JText::_('ACY_PREVIEW'), true); JToolBarHelper::editList(); JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', $this->doc); $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('pageInfo', $pageInfo); $this->assign('config', $config); $this->assign('rows', $rows); }
function validEmail($email, $extended = false) { if (empty($email) or !is_string($email)) { return false; } if (!preg_match('/^([a-z0-9_\'&\\.\\-\\+=])+\\@(([a-z0-9\\-])+\\.)+([a-z0-9]{2,10})+$/i', $email)) { return false; } if (!$extended) { return true; } $config = acymailing_config(); if ($config->get('email_checkpopmailclient', false)) { if (preg_match('#^.{1,5}@(gmail|yahoo|aol|hotmail|msn|ymail)#i', $email)) { return false; } } if ($config->get('email_checkdomain', false) and function_exists('getmxrr')) { $domain = substr($email, strrpos($email, '@') + 1); $mxhosts = array(); $checkDomain = getmxrr($domain, $mxhosts); if (!empty($mxhosts) && strpos($mxhosts[0], 'hostnamedoesnotexist')) { array_shift($mxhosts); } if (!$checkDomain || empty($mxhosts)) { $dns = @dns_get_record($domain, DNS_A); if (empty($dns)) { return false; } } } $object = new stdClass(); $object->IP = $this->getIP(); $object->emailAddress = $email; if ($config->get('email_botscout', false)) { $botscoutClass = new acybotscout(); $botscoutClass->apiKey = $config->get('email_botscout_key'); if (!$botscoutClass->getInfo($object)) { return false; } } if ($config->get('email_stopforumspam', false)) { $email_stopforumspam = new acystopforumspam(); if (!$email_stopforumspam->getInfo($object)) { return false; } } if ($config->get('email_iptimecheck', 0)) { $lapseTime = time() - 7200; $db = JFactory::getDBO(); $db->setQuery('SELECT COUNT(*) FROM #__acymailing_subscriber WHERE created > ' . intval($lapseTime) . ' AND ip = ' . $db->Quote($object->IP)); $nbUsers = $db->loadResult(); if ($nbUsers >= 3) { return false; } } return true; }
function editorHelper() { $config =& acymailing_config(); $this->editor = $config->get('editor', null); if (empty($this->editor)) { $this->editor = null; } $this->myEditor =& JFactory::getEditor($this->editor); $this->myEditor->initialise(); }
function unsubscribe($subid, $listids) { $app = JFactory::getApplication(); if (acymailing_level(3)) { $campaignClass = acymailing_get('helper.campaign'); $campaignClass->stop($subid, $listids); } $config = acymailing_config(); static $alreadySent = false; if ($this->sendNotif and !$alreadySent and $config->get('notification_unsub') and !$app->isAdmin()) { $alreadySent = true; $mailer = acymailing_get('helper.mailer'); $mailer->report = false; $mailer->autoAddUser = true; $mailer->checkConfirmField = false; $userClass = acymailing_get('class.subscriber'); $subscriber = $userClass->get($subid); $ipClass = acymailing_get('helper.user'); $mailer->addParam('survey', $this->survey); $listSubClass = acymailing_get('class.listsub'); $mailer->addParam('user:subscription', $listSubClass->getSubscriptionString($subscriber->subid)); $mailer->addParam('user:subscriptiondates', $listSubClass->getSubscriptionString($subscriber->subid, true)); $mailer->addParamInfo(); $subscriber->ip = $ipClass->getIP(); foreach ($subscriber as $fieldname => $value) { $mailer->addParam('user:'******',', $config->get('notification_unsub')); foreach ($allUsers as $oneUser) { $mailer->sendOne('notification_unsub', $oneUser); } } $db = JFactory::getDBO(); if ($this->forceConf || ($this->sendConf and !$app->isAdmin())) { $db->setQuery('SELECT DISTINCT `unsubmailid` FROM ' . acymailing_table('list') . ' WHERE `listid` IN (' . implode(',', $listids) . ') AND `published` = 1 AND `unsubmailid` > 0'); $messages = acymailing_loadResultArray($db); if (!empty($messages)) { $config = acymailing_config(); $mailHelper = acymailing_get('helper.mailer'); $mailHelper->report = $config->get('unsub_message', true); $mailHelper->checkAccept = false; foreach ($messages as $mailid) { $mailHelper->trackEmail = true; $mailHelper->sendOne($mailid, $subid); } } } //end only frontend $db->setQuery('DELETE FROM ' . acymailing_table('queue') . ' WHERE `subid` = ' . (int) $subid . ' AND `mailid` IN (SELECT `mailid` FROM ' . acymailing_table('listmail') . ' WHERE `listid` IN (' . implode(',', $listids) . '))'); $db->query(); JPluginHelper::importPlugin('acymailing'); $dispatcher = JDispatcher::getInstance(); $resultsTrigger = $dispatcher->trigger('onAcyUnsubscribe', array($subid, $listids)); }
function plgAcymailingTemplate(&$subject, $config) { parent::__construct($subject, $config); if (!isset($this->params)) { $plugin = JPluginHelper::getPlugin('acymailing', 'template'); $this->params = new acyParameter($plugin->params); } $this->config = acymailing_config(); if (version_compare(PHP_VERSION, '5.0.0', '>=') && class_exists('DOMDocument') && function_exists('mb_convert_encoding')) { require_once ACYMAILING_FRONT . 'inc' . DS . 'emogrifier' . DS . 'emogrifier.php'; } }
function fetchButton($type = 'Pophelp', $namekey = '', $id = 'pophelp') { JHTML::_('behavior.mootools'); $doc =& JFactory::getDocument(); $config =& acymailing_config(); $level = $config->get('level'); $url = ACYMAILING_HELPURL . $namekey . '&level=' . $level; $iFrame = "'<iframe src=\\'{$url}\\' width=\\'100%\\' height=\\'100%\\' scrolling=\\'auto\\'></iframe>'"; $js = "var openHelp = true; function displayDoc(){var box=\$('iframedoc'); if(openHelp){box.innerHTML = " . $iFrame . ";box.style.display = 'block';box.style.height = '0';}"; $js .= "try{\r\r\n\t\t\t\t\tvar fx = box.effects({duration: 1500, transition:\r\r\n\t\t\t\t\tFx.Transitions.Quart.easeOut});\r\r\n\t\t\t\t\tif(openHelp){\r\r\n\t\t\t\t\t\tfx.start({'height': 300});\r\r\n\t\t\t\t\t}else{\r\r\n\t\t\t\t\t\tfx.start({'height': 0}).chain(function() {\r\r\n\t\t\t\t\t\t\tbox.innerHTML='';\r\r\n\t\t\t\t\t\t\tbox.setStyle('display','none');\r\r\n\t\t\t\t\t\t});\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}catch(err){\r\r\n\t\t\t\t\tbox.style.height = '300px';\r\r\n\t\t\t\t\tvar myVerticalSlide = new Fx.Slide('iframedoc');\r\r\n \t\t\t\t\tif(openHelp){\r\r\n \t\t\t\t\t\tmyVerticalSlide.hide().slideIn();\r\r\n\t\t\t\t\t}else{\r\r\n\t\t\t\t\t\tmyVerticalSlide.slideOut().chain(function() {\r\r\n\t\t\t\t\t\tbox.innerHTML='';\r\r\n\t\t\t\t\t\tbox.setStyle('display','none');\r\r\n\t\t\t\t\t});\r\r\n\t\t\t\t}\r\r\n\t\t\t} openHelp = !openHelp;}"; $doc->addScriptDeclaration($js); return '<a href="' . $url . '" target="_blank" onclick="displayDoc();return false;" class="toolbar"><span class="icon-32-help" title="' . JText::_('ACY_HELP', true) . '"></span>' . JText::_('ACY_HELP') . '</a>'; }
function getInput() { JHTML::_('behavior.modal', 'a.modal'); if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php')) { return 'This module can not work without the AcyMailing Component'; } $lang =& JFactory::getLanguage(); $lang->load(ACYMAILING_COMPONENT, JPATH_SITE); $config =& acymailing_config(); $level = $config->get('level'); $link = ACYMAILING_HELPURL . $this->value . '&level=' . $level; $text = '<a class="modal" title="' . JText::_('ACY_HELP', true) . '" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('ACY_HELP') . '</button></a>'; return $text; }
function _iframe($url) { $config = acymailing_config(); $url .= '&version=' . $config->get('version') . '&level=' . $config->get('level') . '&component=acymailing'; ?> <div id="acymailing_div"> <iframe allowtransparency="true" scrolling="auto" height="650px" frameborder="0" width="100%" name="acymailing_frame" id="acymailing_frame" src="<?php echo $url; ?> "> </iframe> </div> <?php }
function validEmail($email, $extended = false) { if (empty($email) or !is_string($email)) { return false; } if (!preg_match('/^([a-z0-9_\'&\\.\\-\\+=])+\\@(([a-z0-9\\-])+\\.)+([a-z0-9]{2,10})+$/i', $email)) { return false; } if (!$extended) { return true; } $config = acymailing_config(); if ($config->get('email_checkpopmailclient', false)) { if (preg_match('#^.{1,5}@(gmail|yahoo|aol|hotmail|msn|ymail)#i', $email)) { return false; } } if ($config->get('email_checkdomain', false) and function_exists('getmxrr')) { $domain = substr($email, strrpos($email, '@') + 1); $mxhosts = array(); $checkDomain = getmxrr($domain, $mxhosts); if (!empty($mxhosts) && strpos($mxhosts[0], 'hostnamedoesnotexist')) { array_shift($mxhosts); } if (!$checkDomain || empty($mxhosts)) { $dns = @dns_get_record($domain, DNS_A); if (empty($dns)) { return false; } } } $object = new stdClass(); $object->IP = $this->getIP(); $object->emailAddress = $email; if ($config->get('email_botscout', false)) { $botscoutClass = new acybotscout(); $botscoutClass->apiKey = $config->get('email_botscout_key'); if (!$botscoutClass->getInfo($object)) { return false; } } if ($config->get('email_stopforumspam', false)) { $email_stopforumspam = new acystopforumspam(); if (!$email_stopforumspam->getInfo($object)) { return false; } } return true; }
function exportOneData(&$exportdata, $fileName = 'export') { $config = acymailing_config(); $encodingClass = acymailing_get('helper.encoding'); $this->addHeaders($fileName); $eol = "\r\n"; $before = '"'; $separator = '"' . str_replace(array('semicolon', 'comma'), array(';', ','), $config->get('export_separator', ';')) . '"'; $exportFormat = $config->get('export_format', 'UTF-8'); $after = '"'; foreach ($exportdata as $name => $total) { echo $before . $encodingClass->change($name . $separator . $total, 'UTF-8', $exportFormat) . $after . $eol; } exit; }
function acyeditorHelper() { $config =& acymailing_config(); $this->editor = $config->get('editor', null); if (empty($this->editor)) { $this->editor = null; } $this->myEditor = JFactory::getEditor($this->editor); $this->myEditor->initialise(); $name = $this->myEditor->get('_name'); if (ACYMAILING_J16) { if ($name == 'tinymce') { $this->editorConfig['extended_elements'] = 'table[background|cellspacing|cellpadding|width|align|bgcolor|border|style|class|id],tr[background|width|bgcolor|style|class|id|valign],td[background|width|align|bgcolor|valign|colspan|rowspan|height|style|class|id|nowrap]'; } } }
function export() { $listClass = acymailing_get('class.list'); $db =& JFactory::getDBO(); $fields = reset($db->getTableFields(acymailing_table('subscriber'))); $config = acymailing_config(); $selectedFields = explode(',', $config->get('export_fields', 'email,name')); acymailing_setTitle(JText::_('ACY_EXPORT'), 'acyexport', 'data&task=export'); $bar =& JToolBar::getInstance('toolbar'); JToolBarHelper::custom('doexport', 'acyexport', '', JText::_('ACY_EXPORT'), false); $bar->appendButton('Link', 'cancel', JText::_('ACY_CANCEL'), acymailing_completeLink('subscriber')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'data-export'); $charsetType = acymailing_get('type.charset'); $this->assignRef('charset', $charsetType); $lists = $listClass->getLists(); $this->assignRef('lists', $lists); $this->assignRef('fields', $fields); $this->assignRef('selectedfields', $selectedFields); $this->assignRef('config', $config); $whereSubscribers = ''; if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) { $i = 1; $subids = array(); foreach ($_SESSION['acymailing']['exportusers'] as $subid) { $subids[] = (int) $subid; $i++; if ($i > 10) { break; } } $whereSubscribers = implode(',', $subids); } if (JRequest::getInt('sessionquery')) { $currentSession =& JFactory::getSession(); $exportQuery = $currentSession->get('acyexportquery'); if (!empty($exportQuery)) { $whereSubscribers = $exportQuery; } } if (!empty($whereSubscribers)) { $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . $whereSubscribers . ') LIMIT 10'); $users = $db->loadObjectList(); $this->assignRef('users', $users); } }
function getUrl($url, $mailid, $subid) { static $allurls; $url = str_replace('&', '&', $url); if (empty($allurls[$url])) { $currentURL = $this->getAdd($url); $allurls[$url] = $currentURL; } else { $currentURL = $allurls[$url]; } $config = acymailing_config(); $itemId = $config->get('itemid', 0); $item = empty($itemId) ? '' : '&Itemid=' . $itemId; if (empty($currentURL->urlid)) { return; } return str_replace('&', '&', acymailing_frontendLink('index.php?subid=' . $subid . '&option=com_acymailing&ctrl=url&urlid=' . $currentURL->urlid . '&mailid=' . $mailid . $item)); }
function statusfilterType() { $this->values = array(); $this->values[] = JHTML::_('select.option', '0', JText::_('ALL_STATUS')); $this->values[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('ACCEPT_REFUSE')); $this->values[] = JHTML::_('select.option', '1', JText::_('ACCEPT_EMAIL')); $this->values[] = JHTML::_('select.option', '-1', JText::_('REFUSE_EMAIL')); $this->values[] = JHTML::_('select.option', '</OPTGROUP>'); $config = acymailing_config(); if ($config->get('require_confirmation', 0)) { $this->values[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('SUBSCRIPTION')); $this->values[] = JHTML::_('select.option', '2', JText::_('PENDING_SUBSCRIPTION')); $this->values[] = JHTML::_('select.option', '</OPTGROUP>'); } $this->values[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('ENABLED_DISABLED')); $this->values[] = JHTML::_('select.option', '3', JText::_('ENABLED')); $this->values[] = JHTML::_('select.option', '-3', JText::_('DISABLED')); $this->values[] = JHTML::_('select.option', '</OPTGROUP>'); }
function bounceactionType() { $this->values = array(); $this->values[] = JHTML::_('select.option', 'noaction', JText::_('DO_NOTHING')); $this->values[] = JHTML::_('select.option', 'remove', JText::_('REMOVE_SUB')); $this->values[] = JHTML::_('select.option', 'unsub', JText::_('UNSUB_USER')); $this->values[] = JHTML::_('select.option', 'sub', JText::_('SUBSCRIBE_USER')); $this->values[] = JHTML::_('select.option', 'block', JText::_('BLOCK_USER')); $this->values[] = JHTML::_('select.option', 'delete', JText::_('DELETE_USER')); $this->config = acymailing_config(); $this->lists = acymailing_get('type.lists'); array_shift($this->lists->values); $js = "function updateSubAction(num){"; $js .= "myAction = window.document.getElementById('bounce_action_'+num).value;"; $js .= "if(myAction == 'sub') {window.document.getElementById('bounce_action_lists_'+num).style.display = '';}else{window.document.getElementById('bounce_action_lists_'+num).style.display = 'none';}"; $js .= '}'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); }
function continuesend() { $config = acymailing_config(); $newcrontime = time() + 120; if ($config->get('cron_next') < $newcrontime) { $newValue = new stdClass(); $newValue->cron_next = $newcrontime; $config->save($newValue); } $mailid = acymailing_getCID('mailid'); $totalSend = JRequest::getVar('totalsend', 0, '', 'int'); $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int'); $helperQueue = acymailing_get('helper.queue'); $helperQueue->mailid = $mailid; $helperQueue->report = true; $helperQueue->total = $totalSend; $helperQueue->start = $alreadySent; $helperQueue->pause = $config->get('queue_pause'); $helperQueue->process(); }
function getReceivers($mailid, $total = true, $onlypublished = true) { $query = 'SELECT a.name,a.description,a.published,a.color,b.listid,b.mailid FROM ' . acymailing_table('listmail') . ' as b JOIN ' . acymailing_table('list') . ' as a on a.listid = b.listid WHERE b.mailid = ' . intval($mailid); if ($onlypublished) { $query .= ' AND a.published = 1'; } $this->database->setQuery($query); $lists = $this->database->loadObjectList('listid'); if (empty($lists) or !$total) { return $lists; } $config = acymailing_config(); $confirmed = $config->get('require_confirmation') ? 'b.confirmed = 1 AND' : ''; $countQuery = 'SELECT a.listid, count(b.subid) as nbsub FROM `#__acymailing_listsub` as a JOIN `#__acymailing_subscriber` as b ON a.subid = b.subid WHERE ' . $confirmed . ' b.`enabled` = 1 AND b.`accept` = 1 AND a.`status` = 1 AND a.`listid` IN (' . implode(',', array_keys($lists)) . ') GROUP BY a.`listid`'; $this->database->setQuery($countQuery); $countResult = $this->database->loadObjectList('listid'); foreach ($lists as $listid => $count) { $lists[$listid]->nbsub = empty($countResult[$listid]->nbsub) ? 0 : $countResult[$listid]->nbsub; } return $lists; }
function getIpLocation($element) { $oldElement = $this->getMostRecentDataByIp($element->geolocation_ip); if (!empty($oldElement) && time() - $oldElement->geolocation_created < 2592000) { $element->geolocation_latitude = $oldElement->geolocation_latitude; $element->geolocation_longitude = $oldElement->geolocation_longitude; $element->geolocation_postal_code = $oldElement->geolocation_postal_code; $element->geolocation_country = $oldElement->geolocation_country; $element->geolocation_country_code = $oldElement->geolocation_country_code; $element->geolocation_state = $oldElement->geolocation_state; $element->geolocation_state_code = $oldElement->geolocation_state_code; $element->geolocation_city = $oldElement->geolocation_city; $element->geolocation_created = time(); return $element; } $geoClass = acymailing_get('inc.ipinfodb'); $config = acymailing_config(); $api_key = trim($config->get('geoloc_api_key', '')); if ($api_key == '') { return false; } $geoClass->setKey($api_key); $location = $geoClass->getCity($element->geolocation_ip); $errorLoc = $geoClass->getError(); if (empty($errorLoc) && !empty($location) && !empty($location->countryCode) && $location->countryCode != '-') { $element->geolocation_latitude = !empty($location->latitude) ? $location->latitude : 0; $element->geolocation_longitude = !empty($location->longitude) ? $location->longitude : 0; $element->geolocation_postal_code = !empty($location->zipCode) ? $location->zipCode : ''; $element->geolocation_country = !empty($location->countryName) ? ucwords(strtolower($location->countryName)) : ''; $element->geolocation_country_code = !empty($location->countryCode) ? $location->countryCode : ''; $element->geolocation_state = !empty($location->regionName) ? $location->regionName : ''; $element->geolocation_state_code = !empty($location->regioncode) ? $location->regioncode : ''; $element->geolocation_city = !empty($location->cityName) ? ucwords(strtolower($location->cityName)) : ''; $element->geolocation_created = time(); return $element; } else { return false; } }
function listing() { $app = JFactory::getApplication(); $config = acymailing_config(); if (!class_exists('plgSystemAcymailingClassMail')) { $warning_msg = JText::_('ACY_WARNINGOVERRIDE_DISABLED_1') . ' <a href="index.php?option=com_acymailing&ctrl=cpanel">' . JText::sprintf('ACY_WARNINGOVERRIDE_DISABLED_2', ' acymailingclassmail (Override Joomla mailing system plugin)') . '</a>'; acymailing_enqueueMessage($warning_msg, 'notice'); } $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'mailid', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); if (strtolower($pageInfo->filter->order->dir) !== 'desc') { $pageInfo->filter->order->dir = 'asc'; } $db = JFactory::getDBO(); $query = 'SELECT mailid, subject, alias, fromname, published, fromname, fromemail, replyname, replyemail FROM #__acymailing_mail WHERE `type` = ' . $db->Quote($this->type); if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } $db->setQuery($query); $rows = $db->loadObjectList(); $acyToolbar = acymailing::get('helper.toolbar'); $acyToolbar->custom('preview', JText::_('ACY_PREVIEW'), 'search', true); $acyToolbar->edit(); $acyToolbar->delete(); $acyToolbar->divider(); $acyToolbar->help($this->doc); $acyToolbar->setTitle(JText::_($this->nameListing), $this->ctrl); $acyToolbar->display(); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('pageInfo', $pageInfo); $this->assign('config', $config); $this->assign('rows', $rows); }
function detecttimeout() { $config = acymailing_config(); if ($config->get('security_key') != JRequest::getString('seckey')) { die('wrong key'); } $db = JFactory::getDBO(); $db->setQuery("REPLACE INTO `#__acymailing_config` (`namekey`,`value`) VALUES ('max_execution_time','5'), ('last_maxexec_check','" . time() . "')"); $db->query(); @ini_set('max_execution_time', 600); @ignore_user_abort(true); $i = 0; while ($i < 480) { sleep(8); $i += 10; $db->setQuery("UPDATE `#__acymailing_config` SET `value` = '" . intval($i) . "' WHERE `namekey` = 'max_execution_time'"); $db->query(); $db->setQuery("UPDATE `#__acymailing_config` SET `value` = '" . time() . "' WHERE `namekey` = 'last_maxexec_check'"); $db->query(); sleep(2); } exit; }