function render(&$xmlElement, $value, $control_name = 'params') { JHTMLBehavior::modal(); $name = $xmlElement->attributes('name'); $label = $xmlElement->attributes('label'); $description = $xmlElement->attributes('description'); // load any custom fields $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin("jevents"); $id = intval(str_replace("extras", "", $name)); $res = $dispatcher->trigger('onEditMenuItem', array(&$this->data, &$value, $control_name, $name, $id, $this->_parent)); //make sure we have a valid label $label = $label ? $label : $name; $result[0] = $this->fetchTooltip($label, $description, $xmlElement, $control_name, $name); $result[1] = $this->fetchElement($name, $value, $xmlElement, $control_name); $result[2] = $description; $result[3] = $label; $result[4] = $value; $result[5] = $name; return $result; }
<?php /** * @package RedSHOP.Backend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ JHTMLBehavior::modal(); $option = JRequest::getVar('option', '', 'request', 'string'); $model = $this->getModel('product_container'); $lists = $this->lists; $filter_container = $this->filter_container; $filter_manufacturer = $this->filter_manufacturer; $container = JRequest::getVar('container', '', 'request', 0); $showbuttons = JRequest::getVar('showbuttons', '', 'request', 0); $print_display = JRequest::getVar('print_display', '', 'request', 0); $print_link = JRoute::_('index.php?tmpl=component&option=com_redshop&view=product_container&showbuttons=1&container=' . $container . '&filter_manufacturer=' . $filter_manufacturer . '&filter_container=' . $filter_container); if ($showbuttons == 1 && $print_display != 1) { echo '<div align="right"><br><br><input type="button" class="button" value="Print" onClick="window.print()"><br><br></div>'; } ?> <script language="javascript" type="text/javascript"> Joomla.submitbutton = function (pressbutton) { submitbutton(pressbutton); } submitbutton = function (pressbutton) { var form = document.adminForm;
<?php /** *1901 Contact form module @package 1901 Contact form for Joomla! 1.5 * @link http://www.a.1901webdesign.com/ * @copyright (C) 2011- Nikolaos Koliopoulos * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ defined('_JEXEC') or die('Restricted access'); JHTML::_('behavior.calendar'); JHTMLBehavior::formvalidation(); require_once dirname(__FILE__) . DS . 'helper.php'; $loDoc =& JFactory::getDocument(); $loDoc->addScript(JURI::root() . 'modules/mod_1901contact/mod_1901contact.js'); $loDoc->addStyleSheet(JURI::root() . 'modules/mod_1901contact/mod_1901contact.css'); $lsSubmitText = $params->get('submit_button', 'Contact'); $lsStyleSuffix = $params->get('moduleclass_sfx', null); $lsAction = JRequest::getVar('1901contactAction', null, 'POST'); if ($lsAction == 'send') { $lsMessage = mod1901contactHelper::sendEmail($params); } if (!isset($lsMessage)) { $lsMessage = $params->get('introtext'); } $credit = @$params->get('credit'); ?> <script language="javascript"> function my1901contactValidate(f) { if (document.formvalidator.isValid(f)) { f.check.value='<?php
/** * Internal method to get a JavaScript object notation string from an array * * @param array $array The array to convert to JavaScript object notation * @return string JavaScript object notation representation of the array * @since 1.5 */ function _getJSObject($array = array()) { // Initialize variables $object = '{'; // Iterate over array to build objects foreach ((array) $array as $k => $v) { if (is_null($v)) { continue; } if (!is_array($v) && !is_object($v)) { $object .= ' ' . $k . ': '; $object .= is_numeric($v) || strpos($v, '\\') === 0 ? is_numeric($v) ? $v : substr($v, 1) : "'" . $v . "'"; $object .= ','; } else { $object .= ' ' . $k . ': ' . JHTMLBehavior::_getJSObject($v) . ','; } } if (substr($object, -1) == ',') { $object = substr($object, 0, -1); } $object .= '}'; return $object; }
function sync_all() { $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); JHTMLBehavior::keepalive(); $listId = JRequest::getVar('listid', 0, '', 'string'); ///// $query = 'SELECT userid FROM #__joomailermailchimpintegration WHERE listid = "' . $listId . '"'; $db->setQuery($query); $exclude = $db->loadResultArray(); $exclude = implode('","', $exclude); $exclude = '"' . $exclude . '"'; $query = 'SELECT id FROM #__users WHERE id NOT IN (' . $exclude . ') and block = 0'; $db->setQuery($query); $data = $db->loadObjectList(); $elements = count($data); $params = JComponentHelper::getParams('com_joomailermailchimpintegration'); $MCapi = $params->get('params.MCapi'); $MC = new MCAPI($MCapi); $MCerrorHandler = new MCerrorHandler(); // gather custom fields data $db = JFactory::getDBO(); $query = "SELECT * FROM #__joomailermailchimpintegration_custom_fields WHERE listid = '" . $listId . "' "; $db->setQuery($query); $customFields = $db->loadObjectList(); if (!isset($customFields[0])) { $customFields = false; } $m = 0; $successCount = $errorcount = $msgErrorsCount = 0; $msg = $msgErrors = false; $step = 100; // foreach ($data as $dat){ for ($x = 0; $x < count($data); $x += $step) { $k = 0; $batch = array(); for ($y = $x; $y < $x + $step; $y++) { $dat = $data[$y]; if ($dat) { $user = $this->getModel('sync')->getUser($dat->id); $batch[$k]['EMAIL'] = $user[0]->email; // name $names = explode(' ', $user[0]->name); if ($names[0] && $names[1]) { $batch[$k]['FNAME'] = $names[0]; for ($i = 1; $i < count($names); $i++) { $batch[$k]['LNAME'] .= $names[$i] . ' '; } } else { $batch[$k]['FNAME'] = $user[0]->name; } $custom = array(); if ($customFields) { foreach ($customFields as $field) { if ($field->framework == 'CB') { $query = "SELECT " . $field->dbfield . " FROM #__comprofiler WHERE user_id = '" . $user[0]->id . "' "; } else { $query = "SELECT value FROM #__community_fields_values WHERE field_id = " . $field->dbfield . " AND user_id = '" . $user[0]->id . "' "; } $db->setQuery($query); $fieldValue = $db->loadResult(); if ($field->framework == 'CB') { $fieldValue = str_replace('|*|', ',', $fieldValue); } if ($field->framework == 'JS') { $fieldValue = substr($fieldValue, strlen($fieldValue) - 1) == ',' ? $fieldValue = substr($fieldValue, 0, -1) : $fieldValue; if ($fieldValue == NULL) { $fieldValue = ''; } } $batch[$k]['GROUPINGS'][] = array('id' => (int) $field->grouping_id, 'groups' => $fieldValue); } } $query = 'INSERT INTO #__joomailermailchimpintegration (userid,email,listid) VALUES ("' . $user[0]->id . '", "' . $user[0]->email . '", "' . $listId . '")'; $db->setQuery($query); $db->execute(); $k++; } else { break; } } if ($batch) { $optin = false; // do not send optin emails $updateExisting = true; // yes, update currently subscribed users $replaceInterests = true; // false = add interest, don't replace $result = $MC->listBatchSubscribe($listId, $batch, $optin, $updateExisting, $replaceInterests); $successCount = $successCount + $result['success_count']; if ($result['error_count']) { foreach ($result['errors'] as $e) { $tmp = new stdClass(); $tmp->errorCode = $e['code']; $tmp->errorMessage = $e['message']; $errorMsg .= '"' . $MCerrorHandler->getErrorMsg($tmp) . '", '; $query->getQuery(true); $query->delete($db->qn('#__joomailermailchimpintegration'))->where($db->qn('listid') . ' = ' . $db->q($listId))->where($db->qn('email') . ' = ' . $db->q($e['row']['EMAIL'])); $db->setQuery($query, 0, 1); $db->execute(); } $msgErrorsCount += $result['error_count']; } } } if ($errorMsg) { $msgErrors = substr($errorMsg, 0, -2); $msgErrors = ' (' . $msgErrorsCount . ' ' . JText::_('JM_ERRORS') . ': ' . $msgErrors . ')'; } $msg = $successCount . ' ' . JText::_('JM_RECIPIENTS_SAVED') . $msgErrors; $this->app->enqueueMessage($msg); $this->app->redirect('index.php?option=com_joomailermailchimpintegration&view=sync'); }
/** * Generate product search output */ public function onRSProductSearch() { if (count($this->search) > 0) { $app = JFactory::getApplication(); require_once JPATH_COMPONENT . '/helpers/product.php'; require_once JPATH_COMPONENT . '/helpers/pagination.php'; require_once JPATH_COMPONENT . '/helpers/extra_field.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/text_library.php'; $dispatcher = JDispatcher::getInstance(); $redTemplate = new Redtemplate(); $Redconfiguration = new Redconfiguration(); $producthelper = new producthelper(); $extraField = new extraField(); $texts = new text_library(); $stockroomhelper = new rsstockroomhelper(); $Itemid = JRequest::getInt('Itemid'); $search_type = JRequest::getCmd('search_type'); $cid = JRequest::getInt('category_id'); $manisrch = $this->search; $manufacture_id = $manisrch[0]->manufacturer_id; $templateid = JRequest::getInt('templateid'); // Cmd removes space between to words $keyword = JRequest::getWord('keyword'); $layout = JRequest::getCmd('layout', 'default'); $db = JFactory::getDbo(); $query = 'SELECT category_name' . ' FROM #__redshop_category ' . 'WHERE category_id=' . JRequest::getInt('cid'); $db->setQuery($query); $cat_name = null; if ($catname_array = $db->loadObjectList()) { $cat_name = $catname_array[0]->category_name; } $session = JFactory::getSession(); $model = $this->getModel('search'); $limit = $this->limit; $limitstart = JRequest::getInt('limitstart', 0); $total = $model->_total; JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); $url = JURI::base(); if ($this->params->get('page_title') != "") { $pagetitle = $this->params->get('page_title'); } else { $pagetitle = JText::_('COM_REDSHOP_SEARCH'); } if ($this->params->get('show_page_heading', 1)) { echo '<h1 class="componentheading' . $this->escape($this->params->get('pageclass_sfx')) . '">'; echo $pagetitle; echo '</h1>'; } echo '<div style="clear:both"></div>'; $category_tmpl = ""; if (count($this->templatedata) > 0 && $this->templatedata[0]->template_desc != "") { $template_desc = $this->templatedata[0]->template_desc; } else { $template_desc = "<div class=\"category_print\">{print}</div>\r\n<div style=\"clear: both;\"></div>\r\n<div class=\"category_main_description\">{category_main_description}</div>\r\n<p>{if subcats} {category_loop_start}</p>\r\n<div id=\"categories\">\r\n<div style=\"float: left; width: 200px;\">\r\n<div class=\"category_image\">{category_thumb_image}</div>\r\n<div class=\"category_description\">\r\n<h2 class=\"category_title\">{category_name}</h2>\r\n{category_description}</div>\r\n</div>\r\n</div>\r\n<p>{category_loop_end} {subcats end if}</p>\r\n<div style=\"clear: both;\"></div>\r\n<div id=\"category_header\">\r\n<div class=\"category_order_by\">{order_by}</div>\r\n</div>\r\n<div class=\"category_box_wrapper\">{product_loop_start}\r\n<div class=\"category_box_outside\">\r\n<div class=\"category_box_inside\">\r\n<div class=\"category_product_image\">{product_thumb_image}</div>\r\n<div class=\"category_product_title\">\r\n<h3>{product_name}</h3>\r\n</div>\r\n<div class=\"category_product_price\">{product_price}</div>\r\n<div class=\"category_product_readmore\">{read_more}</div>\r\n<div>{product_rating_summary}</div>\r\n<div class=\"category_product_addtocart\">{form_addtocart:add_to_cart1}</div>\r\n</div>\r\n</div>\r\n{product_loop_end}\r\n<div class=\"category_product_bottom\" style=\"clear: both;\"></div>\r\n</div>\r\n<div class=\"category_pagination\">{pagination}</div>"; } if (strstr($template_desc, "{product_display_limit}")) { $endlimit = $model->getProductPerPage(); $limit = JRequest::getInt('limit', $endlimit, '', 'int'); } $template_org = $template_desc; $template_d1 = explode("{category_loop_start}", $template_org); if (count($template_d1) > 1) { $template_d2 = explode("{category_loop_end}", $template_d1[1]); if (count($template_d2) > 0) { $category_tmpl = $template_d2[0]; } } $template_org = str_replace($category_tmpl, "", $template_org); $template_org = str_replace("{category_loop_start}", "", $template_org); $template_org = str_replace("{category_loop_end}", "", $template_org); $print = JRequest::getInt('print'); $p_url = @explode('?', $_SERVER['REQUEST_URI']); $print_tag = ''; if ($print) { $print_tag = "<a onclick='window.print();' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>"; } else { $print_url = $url . "index.php?option=com_redshop&view=search&print=1&tmpl=component"; $print_tag = "<a href='#' onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>"; } $template_org = str_replace("{total_product}", count($this->search), $template_org); $template_org = str_replace("{total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $template_org); if (strstr($template_org, "{compare_product_div}")) { $compare_product_div = ""; if (PRODUCT_COMPARISON_TYPE != "") { $comparediv = $producthelper->makeCompareProductDiv(); $compareUrl = JRoute::_('index.php?option=com_redshop&view=product&layout=compare&Itemid=' . $Itemid); $compare_product_div = "<form name='frmCompare' method='post' action='" . $compareUrl . "' >"; $compare_product_div .= "<a href='javascript:compare();' >" . JText::_('COM_REDSHOP_COMPARE') . "</a>"; $compare_product_div .= "<div id='divCompareProduct'>" . $comparediv . "</div>"; $compare_product_div .= "</form>"; } $template_org = str_replace("{compare_product_div}", $compare_product_div, $template_org); } // Skip html if nosubcategory if (strstr($template_org, "{if subcats}")) { $template_d1 = explode("{if subcats}", $template_org); $template_d2 = explode("{subcats end if}", $template_d1[1]); $template_org = $template_d1[0] . $template_d2[1]; } // End skip html if nosubcategory $template_org = str_replace("{print}", $print_tag, $template_org); $template_org = str_replace("{product_price_slider}", '', $template_org); $template_org = str_replace("{filter_by}", '', $template_org); $template_org = str_replace("{template_selector_category_lbl}", '', $template_org); $template_org = str_replace("{template_selector_category}", '', $template_org); $template_org = str_replace("{category_main_description}", '', $template_org); $template_org = str_replace("{category_main_name}", $cat_name, $template_org); $template_org = str_replace("{category_description}", '', $template_org); $template_org = str_replace("{category_short_desc}", '', $template_org); $template_org = str_replace("{category_name}", '', $template_org); $template_org = str_replace("{if subcats}", '', $template_org); $template_org = str_replace("{subcats end if}", '', $template_org); $template_org = str_replace("{category_main_thumb_image_3}", '', $template_org); $template_org = str_replace("{category_main_short_desc}", '', $template_org); $template_org = str_replace("{category_main_thumb_image_2}", '', $template_org); $template_org = str_replace("{category_main_thumb_image_1}", '', $template_org); $template_org = str_replace("{category_main_thumb_image}", '', $template_org); $template_org = str_replace("{attribute_price_without_vat}", '', $template_org); $template_org = str_replace("{redproductfinderfilter_formstart}", '', $template_org); $template_org = str_replace("{redproductfinderfilter:rp_myfilter}", '', $template_org); $template_org = str_replace("{redproductfinderfilter_formend}", '', $template_org); // Replace redproductfilder filter tag if (strstr($template_org, "{redproductfinderfilter:")) { $redProductFinerHelper = JPATH_SITE . "/components/com_redproductfinder/helpers/redproductfinder_helper.php"; if (file_exists($redProductFinerHelper)) { include_once $redProductFinerHelper; $redproductfinder_helper = new redproductfinder_helper(); $hdnFields = array('texpricemin' => '0', 'texpricemax' => '0', 'manufacturer_id' => $filter_by, 'category_template' => $templateid); $hide_filter_flag = false; if ($this->_id) { $prodctofcat = $producthelper->getProductCategory($this->_id); if (empty($prodctofcat)) { $hide_filter_flag = true; } } $template_org = $redproductfinder_helper->replaceProductfinder_tag($template_org, $hdnFields, $hide_filter_flag); } } // Replace redproductfilder filter tag end here $template_d1 = explode("{product_loop_start}", $template_org); $template_d2 = explode("{product_loop_end}", $template_d1[1]); $template_tmp_desc = $template_d2[0]; $template_desc = $template_d2[0]; // Order By $order_by = ""; $orderby_form = "<form name='orderby_form' action='' method='post' >"; $orderby_form .= $this->lists['order_select']; $orderby_form .= "<input type='hidden' name='view' value='search'>\n\t\t\t<input type='hidden' name='layout' value='{$layout}'>\n\t\t\t<input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'></form>"; if (strstr($template_desc, '{order_by}')) { $order_by = $orderby_form; } $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1); $attribute_template = $producthelper->getAttributeTemplate($template_desc); $total_product = $model->_total; $endlimit = $this->limit; $start = JRequest::getInt('limitstart', 0, '', 'int'); if (strstr($template_org, "{pagination}")) { if (strstr($template_org, "{product_display_limit}")) { $endlimit = JRequest::getInt('limit', $endlimit, '', 'int'); } } else { $endlimit = $model->getData(); } if ($endlimit == 0) { $final_endlimit = $total_product; } else { $final_endlimit = $endlimit; } $tagarray = $texts->getTextLibraryTagArray(); $data = ""; $count_no_user_field = 0; for ($i = 0; $i < count($this->search); $i++) { $data_add = ""; $thum_image = ""; $pname = $Redconfiguration->maxchar($this->search[$i]->product_name, CATEGORY_PRODUCT_TITLE_MAX_CHARS, CATEGORY_PRODUCT_TITLE_END_SUFFIX); if ($search_type == 'product_number') { $product_number = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $this->search[$i]->product_number); $pro_s_desc = $this->search[$i]->product_s_desc; $pro_desc = $this->search[$i]->product_desc; } else { $product_number = $this->search[$i]->product_number; $pro_s_desc = $this->search[$i]->product_s_desc; $pro_desc = $this->search[$i]->product_desc; if (!in_array($keyword, $tagarray)) { $pname = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pname); $pro_s_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_s_desc); $pro_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_desc); } } $pro_s_desc = $Redconfiguration->maxchar($pro_s_desc, CATEGORY_PRODUCT_DESC_MAX_CHARS, CATEGORY_PRODUCT_DESC_END_SUFFIX); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&Itemid=' . $Itemid); if (strstr($template_desc, '{product_name}')) { $pname = "<a href='" . $link . "'>" . $pname . "</a>"; $data_add = str_replace("{product_name}", $pname, $template_desc); } if (strstr($template_desc, '{product_name_nolink}')) { $data_add = str_replace("{product_name_nolink}", $pname, $template_desc); } $readmore = "<a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>"; $data_add = str_replace("{read_more}", $readmore, $data_add); $data_add = str_replace("{read_more_link}", $link, $data_add); // RedSHOP Product Plugin JPluginHelper::importPlugin('redshop_product'); $results = $dispatcher->trigger('onPrepareProduct', array(&$data_add, &$params, $this->search[$i])); // End if (strstr($data_add, "{product_delivery_time}")) { $product_delivery_time = $producthelper->getProductMinDeliveryTime($this->search[$i]->product_id); if ($product_delivery_time != "") { $data_add = str_replace("{delivery_time_lbl}", JText::_('DELIVERY_TIME'), $data_add); $data_add = str_replace("{product_delivery_time}", $product_delivery_time, $data_add); } else { $data_add = str_replace("{delivery_time_lbl}", "", $data_add); $data_add = str_replace("{product_delivery_time}", "", $data_add); } } // Product Review/Rating // Fetching reviews $final_avgreview_data = $producthelper->getProductRating($this->search[$i]->product_id); // Attribute ajax chage $data_add = str_replace("{product_rating_summary}", $final_avgreview_data, $data_add); $data_add = $producthelper->getJcommentEditor($this->search[$i], $data_add); $data_add = $producthelper->getExtraSectionTag($extraFieldName, $this->search[$i]->product_id, "1", $data_add, 1); $data_add = str_replace("{product_s_desc}", $pro_s_desc, $data_add); $data_add = str_replace("{product_desc}", $pro_desc, $data_add); $data_add = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $data_add); $data_add = str_replace("{product_id}", $this->search[$i]->product_id, $data_add); $data_add = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $data_add); $data_add = str_replace("{product_number}", $product_number, $data_add); /** * related Product List in Lightbox * Tag Format = {related_product_lightbox:<related_product_name>[:width][:height]} */ if (strstr($data_add, '{related_product_lightbox:')) { $related_product = $producthelper->getRelatedProduct($this->search[$i]->product_id); $rtlnone = explode("{related_product_lightbox:", $data_add); $rtlntwo = explode("}", $rtlnone[1]); $rtlnthree = explode(":", $rtlntwo[0]); $rtln = $rtlnthree[0]; $rtlnfwidth = isset($rtlnthree[1]) ? $rtlnthree[1] : "900"; $rtlnwidthtag = isset($rtlnthree[1]) ? ":" . $rtlnthree[1] : ""; $rtlnfheight = isset($rtlnthree[2]) ? $rtlnthree[2] : "600"; $rtlnheighttag = isset($rtlnthree[2]) ? ":" . $rtlnthree[2] : ""; $rtlntag = "{related_product_lightbox:{$rtln}{$rtlnwidthtag}{$rtlnheighttag}}"; if (count($related_product) > 0) { $linktortln = JUri::root() . "index.php?option=com_redshop&view=product&pid=" . $this->search[$i]->product_id . "&tmpl=component&template=" . $rtln . "&for=rtln"; $rtlna = '<a class="modal" href="' . $linktortln . '" rel="{handler:\'iframe\',size:{x:' . $rtlnfwidth . ',y:' . $rtlnfheight . '}}" >' . JText::_('COM_REDSHOP_RELATED_PRODUCT_LIST_IN_LIGHTBOX') . '</a>'; } else { $rtlna = ""; } $data_add = str_replace($rtlntag, $rtlna, $data_add); } $data_add = $producthelper->replaceVatinfo($data_add); /************************************ * Conditional tag * if product on discount : Yes * {if product_on_sale} This product is on sale {product_on_sale end if} // OUTPUT : This product is on sale * NO : // OUTPUT : Display blank ************************************/ $data_add = $producthelper->getProductOnSaleComment($this->search[$i], $data_add); $data_add = $stockroomhelper->replaceStockroomAmountDetail($data_add, $this->search[$i]->product_id); if (strstr($data_add, "{product_thumb_image_3}")) { $cimg_tag = '{product_thumb_image_3}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_3; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_3; } elseif (strstr($data_add, "{product_thumb_image_2}")) { $cimg_tag = '{product_thumb_image_2}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_2; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_2; } elseif (strstr($data_add, "{product_thumb_image_1}")) { $cimg_tag = '{product_thumb_image_1}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH; } else { $cimg_tag = '{product_thumb_image}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH; } $hidden_thumb_image = "<input type='hidden' name='prd_main_imgwidth' id='prd_main_imgwidth' value='" . $cw_thumb . "'><input type='hidden' name='prd_main_imgheight' id='prd_main_imgheight' value='" . $ch_thumb . "'>"; $thum_image = $producthelper->getProductImage($this->search[$i]->product_id, $link, $cw_thumb, $ch_thumb); $data_add = str_replace($cimg_tag, $thum_image . $hidden_thumb_image, $data_add); // More documents if (strstr($data_add, "{more_documents}")) { $media_documents = $producthelper->getAdditionMediaImage($this->search[$i]->product_id, "product", "document"); $more_doc = ''; for ($m = 0; $m < count($media_documents); $m++) { $alttext = $producthelper->getAltText("product", $media_documents[$m]->section_id, "", $media_documents[$m]->media_id, "document"); if (!$alttext) { $alttext = $media_documents[$m]->media_name; } if (is_file(REDSHOP_FRONT_DOCUMENT_RELPATH . "product/" . $media_documents[$m]->media_name)) { $downlink = JUri::root() . 'index.php?tmpl=component&option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&task=downloadDocument&fname=' . $media_documents[$m]->media_name . '&Itemid=' . $Itemid; $more_doc .= "<div><a href='" . $downlink . "' title='" . $alttext . "'>"; $more_doc .= $alttext; $more_doc .= "</a></div>"; } } $data_add = str_replace("{more_documents}", "<span id='additional_docs" . $this->search[$i]->product_id . "'>" . $more_doc . "</span>", $data_add); } // More documents end /************************************************ user fields*******************************************************/ $hidden_userfield = ""; $returnArr = $producthelper->getProductUserfieldFromTemplate($data_add); $template_userfield = $returnArr[0]; $userfieldArr = $returnArr[1]; $count_no_user_field = 0; if ($template_userfield != "") { $ufield = ""; for ($ui = 0; $ui < count($userfieldArr); $ui++) { $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id); $ufield .= $product_userfileds[1]; if ($product_userfileds[1] != "") { $count_no_user_field++; } $data_add = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $data_add); $data_add = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $data_add); } $product_userfileds_form = "<form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>"; if ($ufield != "") { $data_add = str_replace("{if product_userfield}", $product_userfileds_form, $data_add); $data_add = str_replace("{product_userfield end if}", "</form>", $data_add); } else { $data_add = str_replace("{if product_userfield}", "", $data_add); $data_add = str_replace("{product_userfield end if}", "", $data_add); } } elseif (AJAX_CART_BOX) { $ajax_detail_template_desc = ""; $ajax_detail_template = $producthelper->getAjaxDetailboxTemplate($this->search[$i]); if (count($ajax_detail_template) > 0) { $ajax_detail_template_desc = $ajax_detail_template->template_desc; } $returnArr = $producthelper->getProductUserfieldFromTemplate($ajax_detail_template_desc); $template_userfield = $returnArr[0]; $userfieldArr = $returnArr[1]; if ($template_userfield != "") { $ufield = ""; for ($ui = 0; $ui < count($userfieldArr); $ui++) { $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id); $ufield .= $product_userfileds[1]; if ($product_userfileds[1] != "") { $count_no_user_field++; } $template_userfield = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $template_userfield); $template_userfield = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $template_userfield); } if ($ufield != "") { $hidden_userfield = "<div style='display:none;'><form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>" . $template_userfield . "</form></div>"; } } } $data_add = $data_add . $hidden_userfield; /*************** end user fields ***************/ // ProductFinderDatepicker Extra Field Start $fieldArray = $extraField->getSectionFieldList(17, 0, 0); $data_add = $producthelper->getProductFinderDatepickerValue($data_add, $this->search[$i]->product_id, $fieldArray); // ProductFinderDatepicker Extra Field End /* * manufacturer data */ $manufacturer_id = $this->search[$i]->manufacturer_id; if ($manufacturer_id != 0) { $manufacturer_data = $producthelper->getSection("manufacturer", $manufacturer_id); $manufacturer_link_href = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $manufacturer_id . '&Itemid=' . $Itemid); $manufacturer_name = ""; if (count($manufacturer_data) > 0) { $manufacturer_name = $manufacturer_data->manufacturer_name; } $manufacturer_link = '<a href="' . $manufacturer_link_href . '" title="' . $manufacturer_name . '">' . $manufacturer_name . '</a>'; if (strstr($data_add, "{manufacturer_link}")) { $data_add = str_replace("{manufacturer_name}", "", $data_add); } else { $data_add = str_replace("{manufacturer_name}", $manufacturer_name, $data_add); } $data_add = str_replace("{manufacturer_link}", $manufacturer_link, $data_add); } else { $data_add = str_replace("{manufacturer_link}", "", $data_add); $data_add = str_replace("{manufacturer_name}", "", $data_add); } // End // Replace wishlistbutton $data_add = $producthelper->replaceWishlistButton($this->search[$i]->product_id, $data_add); // Replace compare product button $data_add = $producthelper->replaceCompareProductsButton($this->search[$i]->product_id, 0, $data_add); // Checking for child products $childproduct = $producthelper->getChildProduct($this->search[$i]->product_id); if (count($childproduct) > 0) { $isChilds = true; $attributes = array(); } else { $isChilds = false; // Get attributes $attributes_set = array(); if ($this->search[$i]->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $this->search[$i]->attribute_set_id, 0, 1); } $attributes = $producthelper->getProductAttribute($this->search[$i]->product_id); $attributes = array_merge($attributes, $attributes_set); } // Product attribute Start $totalatt = count($attributes); // Check product for not for sale $data_add = $producthelper->getProductNotForSaleComment($this->search[$i], $data_add, $attributes); $data_add = $producthelper->replaceProductInStock($this->search[$i]->product_id, $data_add, $attributes, $attribute_template); $data_add = $producthelper->replaceAttributeData($this->search[$i]->product_id, 0, 0, $attributes, $data_add, $attribute_template, $isChilds); // Cart Template $data_add = $producthelper->replaceCartTemplate($this->search[$i]->product_id, 0, 0, 0, $data_add, $isChilds, $userfieldArr, $totalatt, 0, $count_no_user_field, ""); $data .= $data_add; } $app = JFactory::getApplication(); $router = $app->getRouter(); $getorderby = JRequest::getVar('order_by', DEFAULT_PRODUCT_ORDERING_METHOD); $vars = array('option' => 'com_redshop', 'view' => 'search', 'layout' => $layout, 'keyword' => $keyword, 'manufacture_id' => $manufacture_id, 'order_by' => $getorderby, 'category_id' => $cid, 'Itemid' => $Itemid, 'limit' => $limit); $router->setVars($vars); unset($vars); if (strstr($template_org, "{pagination}")) { $pagination = new redPagination($total_product, $start, $endlimit); $slidertag = $pagination->getPagesLinks(); if (strstr($template_org, "{product_display_limit}")) { $slidertag = "<form action='' method='post'><input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'> " . $pagination->getListFooter() . "</form>"; $template_org = str_replace("{product_display_limit}", $slidertag, $template_org); $template_org = str_replace("{pagination}", '', $template_org); } $template_org = str_replace("{pagination}", $slidertag, $template_org); } $template_org = str_replace("{product_display_limit}", "", $template_org); if (strstr($template_org, "perpagelimit:")) { $perpage = explode('{perpagelimit:', $template_org); $perpage = explode('}', $perpage[1]); $template_org = str_replace("{perpagelimit:" . intval($perpage[0]) . "}", "", $template_org); } $template_org = str_replace("{order_by}", $orderby_form, $template_org); $template_org = str_replace("{order_by_lbl}", JText::_('COM_REDSHOP_SELECT_ORDER_BY'), $template_org); $template_org = str_replace("{filter_by_lbl}", JText::_('COM_REDSHOP_SELECT_FILTER_BY'), $template_org); $template_org = str_replace("{attribute_price_with_vat}", "", $template_org); $template_org = str_replace("{attribute_price_without_vat}", "", $template_org); $template_org = str_replace("{product_loop_start}", "", $template_org); $template_org = str_replace("{product_loop_end}", "", $template_org); $template_org = str_replace($template_tmp_desc, $data, $template_org); $template_org = str_replace("{with_vat}", "", $template_org); $template_org = str_replace("{without_vat}", "", $template_org); $template_org = $redTemplate->parseredSHOPplugin($template_org); $template_org = $texts->replace_texts($template_org); eval("?>" . $template_org . "<?php "); } else { echo "<br><h3>" . JText::_('COM_REDSHOP_MSG_SORRY_NO_RESULT_FOUND') . "</h3>"; } }
public static function tooltip($selector = '.hasTip', $params = array()) { static $tips; if (!isset($tips)) { $tips = array(); } // Include mootools framework JHtml::_('behavior.framework', true); $sig = md5(serialize(array($selector, $params))); if (isset($tips[$sig]) && $tips[$sig]) { return; } // Setup options object $opt['maxTitleChars'] = isset($params['maxTitleChars']) && $params['maxTitleChars'] ? (int) $params['maxTitleChars'] : 50; // offsets needs an array in the format: array('x'=>20, 'y'=>30) $opt['offsets'] = isset($params['offsets']) && is_array($params['offsets']) ? $params['offsets'] : null; $opt['showDelay'] = isset($params['showDelay']) ? (int) $params['showDelay'] : null; $opt['hideDelay'] = isset($params['hideDelay']) ? (int) $params['hideDelay'] : null; $opt['className'] = isset($params['className']) ? $params['className'] : null; $opt['fixed'] = isset($params['fixed']) && $params['fixed'] ? '\\true' : '\\false'; $opt['onShow'] = isset($params['onShow']) ? '\\' . $params['onShow'] : null; $opt['onHide'] = isset($params['onHide']) ? '\\' . $params['onHide'] : null; $options = JHTMLBehavior::_getJSObject($opt); // Attach tooltips to document $document =& JFactory::getDocument(); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\t\$\$('{$selector}').each(function(el) {\n\t\t\t\tvar title = el.get('title');\n\t\t\t\tif (title) {\n\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\tel.store('tip:title', parts[0]);\n\t\t\t\t\tel.store('tip:text', parts[1]);\n\t\t\t\t}\n\t\t\t});\n\t\t\tvar JTooltips = new Tips(\$\$('{$selector}'), {$options});\n\t\t});"); // Set static array $tips[$sig] = true; return; }
function setChildElement() { JHTMLBehavior::modal(); $xmlhelper = new xmlHelper(); $post = JRequest::get('post'); $session = JFactory::getSession(); $childelement = $session->get('childelement'); $model = $this->getModel('xmlexport_detail'); $resarray = array(); $uarray = array(); $columns = $xmlhelper->getSectionColumnList($post['section_type'], $post['parentsection']); for ($i = 0; $i < count($columns); $i++) { if (trim($post[$columns[$i]->Field]) != "") { $xmltag = str_replace(" ", "_", strtolower(trim($post[$columns[$i]->Field]))); $uarray[] = $xmltag; $resarray[] = $columns[$i]->Field . "=" . $xmltag; } } $firstlen = count($uarray); $uarray1 = array_unique($uarray); sort($uarray1); $seclen = count($uarray1); if ($seclen != $firstlen) { echo $msg = JText::_('COM_REDSHOP_DUPLICATE_FIELDNAME'); return; } $childelement[$post['parentsection']] = array($post['element_name'], implode(";", $resarray)); $session->set('childelement', $childelement); ?> <script language="javascript"> window.parent.SqueezeBox.close(); </script> <?php }
function uploader($id = 'file-upload', $params = array()) { $path = 'administrator/components/com_phocagallery/assets/upload/'; JHTML::script('swf.js', $path, false); // mootools are loaded yet JHTML::script('uploader.js', $path, false); // mootools are loaded yet static $uploaders; if (!isset($uploaders)) { $uploaders = array(); } if (isset($uploaders[$id]) && $uploaders[$id]) { return; } // Setup options object $opt['url'] = isset($params['targetURL']) ? $params['targetURL'] : null; $opt['swf'] = isset($params['swf']) ? $params['swf'] : JURI::root(true) . '/media/system/swf/uploader.swf'; $opt['multiple'] = isset($params['multiple']) && !$params['multiple'] ? '\\false' : '\\true'; $opt['queued'] = isset($params['queued']) && !$params['queued'] ? '\\false' : '\\true'; $opt['queueList'] = isset($params['queueList']) ? $params['queueList'] : 'upload-queue'; $opt['instantStart'] = isset($params['instantStart']) && $params['instantStart'] ? '\\true' : '\\false'; $opt['allowDuplicates'] = isset($params['allowDuplicates']) && !$params['allowDuplicates'] ? '\\false' : '\\true'; $opt['limitSize'] = isset($params['limitSize']) && $params['limitSize'] ? (int) $params['limitSize'] : null; $opt['limitFiles'] = isset($params['limitFiles']) && $params['limitFiles'] ? (int) $params['limitFiles'] : null; $opt['optionFxDuration'] = isset($params['optionFxDuration']) ? (int) $params['optionFxDuration'] : null; $opt['container'] = isset($params['container']) ? '\\$(' . $params['container'] . ')' : '\\$(\'' . $id . '\').getParent()'; $opt['types'] = isset($params['types']) ? '\\' . $params['types'] : '\\{\'All Files (*.*)\': \'*.*\'}'; // Optional functions $opt['createReplacement'] = isset($params['createReplacement']) ? '\\' . $params['createReplacement'] : null; $opt['onComplete'] = isset($params['onComplete']) ? '\\' . $params['onComplete'] : null; $opt['onAllComplete'] = isset($params['onAllComplete']) ? '\\' . $params['onAllComplete'] : null; /* types: Object with (description: extension) pairs, default: Images (*.jpg; *.jpeg; *.gif; *.png) */ $options = JHTMLBehavior::_getJSObject($opt); // Attach tooltips to document $document =& JFactory::getDocument(); $uploaderInit = 'sBrowseCaption=\'' . JText::_('Browse Files', true) . '\'; sRemoveToolTip=\'' . JText::_('Remove from queue', true) . '\'; window.addEvent(\'load\', function(){ var Uploader = new FancyUpload($(\'' . $id . '\'), ' . $options . '); $(\'upload-clear\').adopt(new Element(\'input\', { type: \'button\', events: { click: Uploader.clearList.bind(Uploader, [false])}, value: \'' . JText::_('Clear Completed') . '\' })); });'; $document->addScriptDeclaration($uploaderInit); // Set static array $uploaders[$id] = true; return; }
function com_install() { JHTML::_('behavior.mootools'); JHTMLBehavior::tooltip(); $lang =& JFactory::getLanguage(); $backward_lang = $lang->getBackwardLang(); $db =& JFactory::getDBO(); // Get the languages file if it exists if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $lang->getTag() . '.php')) { include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $lang->getTag() . '.php'; } if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $backward_lang . '.php')) { include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $backward_lang . '.php'; } if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . 'english.php')) { include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . 'english.php'; } @ini_set("max_execution_time", "60"); $db->setQuery("CREATE TABLE IF NOT EXISTS `#__blastchatc` (\r\n\t\t`id` int(11) NOT NULL auto_increment,\r\n\t\t`url` varchar(100) default NULL,\r\n\t\t`intra_id` varchar(100) default NULL,\r\n\t\t`priv_key` varchar(100) default NULL,\r\n\t\t`detached` binary(1) NOT NULL default 0,\r\n\t\t`adm_expand` binary(1) NOT NULL default 1,\r\n\t\t`width` varchar(6) NOT NULL default '100%',\r\n\t\t`height` varchar(6) NOT NULL default '480',\r\n\t\t`d_width` varchar(6) NOT NULL default '640',\r\n\t\t`d_height` varchar(6) NOT NULL default '480',\r\n\t\t`frame_border` binary(1) NOT NULL default 0,\r\n\t\t`m_width` varchar(6) NOT NULL default '0',\r\n\t\t`m_height` varchar(6) NOT NULL default '0',\r\n\t\tPRIMARY KEY ( `id` ),\r\n\t\tUNIQUE KEY (`url`)\r\n\t\t);\r\n\t\t"); if (!$db->query()) { $result = "Error 0013 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true); return $result; } $query = "SHOW COLUMNS FROM #__blastchatc_users "; $db->setQuery($query); $cols = false; $cols = $db->loadRowList(); if ($cols[0][0] == "userid") { $query = "DROP TABLE IF EXISTS `#__blastchatc_users`"; $db->setQuery($query); $db->query(); } $db->setQuery("CREATE TABLE IF NOT EXISTS `#__blastchatc_users` (\r\n\t\t`bc_userid` int(11) default 0,\r\n\t\t`bc_lastEntry` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t`bc_idle` varchar(5) default NULL,\r\n\t\t`bc_rid` INT(11) NOT NULL default 0,\r\n\t\t`bc_rsid` INT(11) NOT NULL default 0,\r\n\t\t`bc_rname` VARCHAR(100) default NULL,\r\n\t\tPRIMARY KEY (`bc_userid`)\r\n\t\t);\r\n\t\t"); if (!$db->query()) { $result = "Error 0014 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true); return $result; } require_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'api.blastchatc.php'; $mosConfig_live_site = bc_getLiveSite(); //strip http or https from this website URL, global variable //if you need this to be something else,assign another value to $mosConfig_live_site (do same for admin.blastchac.php file): $bc_site = $mosConfig_live_site; $bc_site = strtolower($bc_site); $bc_site = str_replace("http://", "", $bc_site); $bc_site = str_replace("https://", "", $bc_site); $bc_site_other = ""; if (strpos($bc_site, "www.") === false) { $bc_site_other = "www." . $bc_site; } else { $bc_site_other = str_replace("www.", "", $bc_site); } require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_blastchatc' . DS . 'class.blastchatc.php'; $website = null; $website = new josBC_website($db); $website->loadByURL($bc_site); if (!$website->url) { $website->loadByURL($bc_site_other); if (!$website->url) { $website->intra_id = md5($bc_site . uniqid(microtime(), 1)); $website->url = $bc_site; $website->store(); } } //Set up icons for admin area $result = null; $menu_config = _BC_MENU_CONFIG; $menu_config_alt = _BC_BLASTCHAT . " - " . _BC_MENU_CONFIG; $menu_reg = _BC_MENU_REG; $menu_reg_alt = _BC_BLASTCHAT . " - " . _BC_MENU_REG; $menu_credits = _BC_MENU_CREDITS; $menu_credits_alt = _BC_BLASTCHAT . " - " . _BC_MENU_CREDITS; //$db->setQuery("UPDATE #__components SET admin_menu_img='../components/com_blastchatc/images/config.png', name='$menu_config', admin_menu_alt='$menu_config_alt' WHERE admin_menu_link='option=com_blastchatc&task=config'"); $db->setQuery("UPDATE #__components SET name='{$menu_config}', admin_menu_alt='{$menu_config_alt}' WHERE admin_menu_link='option=com_blastchatc&task=config'"); if (!$db->query()) { $result = "Error 0010 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true); } else { //$db->setQuery("UPDATE #__components SET admin_menu_img='../components/com_blastchatc/images/credits.png', name='$menu_reg', admin_menu_alt='$menu_reg_alt' WHERE admin_menu_link='option=com_blastchatc&task=register'"); $db->setQuery("UPDATE #__components SET name='{$menu_reg}', admin_menu_alt='{$menu_reg_alt}' WHERE admin_menu_link='option=com_blastchatc&task=register'"); if (!$db->query()) { $result = "Error 0011 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true); } else { //$db->setQuery("UPDATE #__components SET admin_menu_img='../components/com_blastchatc/images/credits.png', name='$menu_credits', admin_menu_alt='$menu_credits_alt' WHERE admin_menu_link='option=com_blastchatc&task=credits'"); $db->setQuery("UPDATE #__components SET name='{$menu_credits}', admin_menu_alt='{$menu_credits_alt}' WHERE admin_menu_link='option=com_blastchatc&task=credits'"); if (!$db->query()) { $result = "Error 0012 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true); } else { //needed for module support, field marks which user is inside chat $db->setQuery("ALTER TABLE `#__session` , ADD `bc_lastUpdate` VARCHAR( 14 ) NULL "); if (!$db->query()) { $result = "Error 0015 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true); } else { ?> [ <a href="index2.php?option=com_blastchatc&task=register" style="font-size: 12px; font-weight: bold"><?php echo _BC_REGNOW; ?> ...</a> ] <br /> <div class="footer" align="center"> <table border="0" width="99%"> <tbody> <tr> <td align="center"> <div align="center"><a href="http://www.blastchat.com" target="_blank">BlastChat Client 3.0</a>, GNU/GPL License</div> <div class="smallgrey" align="center">Copyright (C) 2004-2009 <a href="http://www.blastchat.com" target="_blank">BlastChat</a>. All rights reserved.</div> </td> </tr> </tbody> </table> </div> <?php } } } } return $result; }
function jdGetDirectory($callback, $folder, $getFiles = false, $filter = '*') { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.file'); $folder = JPath::clean(JPATH_ROOT . DS . $folder); JPath::check($folder); $response = new XajaxResponse(); if (!is_dir($folder)) { return $response; } $result = array(); $dirs = JFolder::folders($folder, '', false, true); foreach ($dirs as $dir) { $dirData = array(); $dirData['permission'] = substr(sprintf("%o", fileperms($dir)), -3); if ($getFiles) { $fileData = array(); $files = glob($folder . DS . $filter); foreach ($files as $f) { $fileData[$f]['permission'] = substr(sprintf("%o", fileperms($f)), -3); } } $result[$dir]['info'] = $dirData; $result[$dir]['files'] = $fileData; } $response->script($callback . '(' . JHTMLBehavior::_getJSObject($result) . ')'); return $response; }