コード例 #1
0
ファイル: image.php プロジェクト: annggeel/tienda
 /**
  * Resize Image
  * 
  * @param name	string	filename of the image
  * @param type	string	what kind of image: product, category
  * @param options	array	array of options: width, height, path, thumb_path
  * @return thumb full path
  */
 function resize($name, $type = 'product', $options = array())
 {
     // Check File presence
     if (!JFile::exists($name)) {
         return false;
     }
     JImport('com_tienda.library.image', JPATH_ADMINISTRATOR . 'components');
     $img = new TiendaImage($name);
     $types = array('product', 'category', 'manufacturer');
     if (!in_array($type, $types)) {
         $type = 'product';
     }
     return $this->resizeImage($img, $type, $options);
 }
コード例 #2
0
<?php

/**
* BreezingForms - A Joomla Forms Application
* @version 1.8
* @package BreezingForms
* @copyright (C) 2008-2012 by Markus Bopp
* @license Released under the terms of the GNU General Public License
**/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$active_language_code = JRequest::getVar('active_language_code', '');
if ($active_language_code != '') {
    $active_language_code = '_translation' . $active_language_code;
}
JImport('joomla.html.editor');
$editor = JFactory::getEditor();
echo '<input type="submit" class="btn btn-primary" value="' . JText::_('SAVE') . '" onclick="saveText();parent.SqueezeBox.close();"/><br/><br/>';
echo '<div style="width:700px;">' . $editor->display("bfEditor", '', 700, 300, 40, 20, 1) . '</div>';
echo '<br/><input type="submit" class="btn btn-primary" value="' . JText::_('SAVE') . '" onclick="saveText();parent.SqueezeBox.close();"/>';
echo '<script>
function bfLoadText(){
        var keyPageIntro   = "pageIntro' . $active_language_code . '";
        var keyDescription = "description' . $active_language_code . '";
            
	var item = parent.app.findDataObjectItem(parent.app.selectedTreeElement.id, parent.app.dataObject);

	// workaround for quote bug with jce
	var testEditor = ' . $editor->getContent('bfEditor') . '

	if(testEditor == "item.properties[keyPageIntro]" || testEditor == "item.properties[keyDescription]"){
		if(item && item.properties.type == "page"){
コード例 #3
0
    public function render()
    {
        if (isset($this->rootMdata['themebootstrapUseProgress']) && $this->rootMdata['themebootstrapUseProgress']) {
            echo '<div class="progress"><div id="bfProgressBar" class="bar"></div></div>
                        <script type="text/javascript">
                        <!--
                        function bfUpdateProgress(){
                            if(ff_currentpage > 1){
                                var pages = JQuery(".bfPage").size()' . ($this->rootMdata['lastPageThankYou'] ? '-1' : '') . ';
                                var result = Math.round(((ff_currentpage-1) / pages)*100);
                                JQuery("#bfProgressBar").css("width",result+"%");
                            }else{
                                JQuery("#bfProgressBar").css("width","0%");
                            }
                        }
                        JQuery(document).ready(function(){
                            setInterval("bfUpdateProgress()", 500);
                        });
                        -->
                        </script>';
        }
        $this->process($this->dataObject);
        echo '</div>' . "\n";
        // closing last page
        $this->headers();
        if ($this->hasResponsiveDatePicker) {
            JFactory::getDocument()->addScript(JURI::root(true) . '/components/com_breezingforms/libraries/jquery/pickadate/picker.js');
            JFactory::getDocument()->addScript(JURI::root(true) . '/components/com_breezingforms/libraries/jquery/pickadate/picker.date.js');
            $lang = JFactory::getLanguage()->getTag();
            $lang = explode('-', $lang);
            $lang = strtolower($lang[0]);
            if (JFile::exists(JPATH_SITE . '/components/com_breezingforms/libraries/jquery/pickadate/translations/' . $lang . '.js')) {
                JFactory::getDocument()->addScript(JURI::root(true) . '/components/com_breezingforms/libraries/jquery/pickadate/translations/' . $lang . '.js');
            }
            JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/components/com_breezingforms/libraries/jquery/pickadate/themes/default.css');
            JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/components/com_breezingforms/libraries/jquery/pickadate/themes/default.date.css');
        }
        // we must make sure that everything mootools related is included after moxie and plupload
        if (isset(JFactory::getDocument()->_scripts)) {
            foreach (JFactory::getDocument()->_scripts as $script_name => $script_value) {
                if (basename($script_name) != 'moxie.js' && basename($script_name) != 'plupload.js' && basename($script_name) != 'calendar.js' && basename($script_name) != 'calendar-setup.js') {
                    unset(JFactory::getDocument()->_scripts[$script_name]);
                    JFactory::getDocument()->_scripts[$script_name] = $script_value;
                }
            }
        }
        // we gonna add a blank to each textarea, since the value is transferred upon submit
        // requires a different mandatory validation than ff_valuenotempty
        if (count($this->htmltextareas)) {
            JImport('joomla.html.editor');
            $editor = JFactory::getEditor();
            $htmltextarea_out = '';
            foreach ($this->htmltextareas as $htmltextarea) {
                $htmltextarea_out .= 'JQuery("[name=\\"' . $htmltextarea . '\\"]").val(JQuery.trim(JQuery("[name=\\"' . $htmltextarea . '\\"]").val())+" ");' . "\n";
                $htmltextarea_out .= 'bf_htmltextareas.push("' . rtrim(trim($editor->getContent($htmltextarea)), ';') . '")' . "\n";
                $htmltextarea_out .= 'bf_htmltextareanames.push("' . $htmltextarea . '")' . "\n";
            }
            echo '<script type="text/javascript">
                          <!--
                          var bf_htmltextareas     = [];
                          var bf_htmltextareanames = [];
                          function bf_htmltextareainit(){
                            ' . $htmltextarea_out . '
                          }
                          //-->
                          </script>';
        }
        if ($this->hasFlashUpload) {
            $tickets = JFactory::getSession()->get('bfFlashUploadTickets', array());
            $tickets[$this->flashUploadTicket] = array();
            // stores file info for later processing
            JFactory::getSession()->set('bfFlashUploadTickets', $tickets);
            echo '<input type="hidden" name="bfFlashUploadTicket" value="' . $this->flashUploadTicket . '"/>' . "\n";
            JFactory::getDocument()->addScript(JURI::root(true) . '/components/com_breezingforms/libraries/jquery/center.js');
            JFactory::getDocument()->addScriptDeclaration('
                        var bfUploaders = [];
                        var bfUploaderErrorElements = [];
			var bfFlashUploadInterval = null;
			var bfFlashUploaders = new Array();
                        var bfFlashUploadersLength = 0;
                        function bfRefreshAll(){
                            for( var i = 0; i < bfUploaders.length; i++ ){
                                bfUploaders[i].refresh();
                            }
                        }
                        function bfInitAll(){
                            for( var i = 0; i < bfUploaders.length; i++ ){
                                bfUploaders[i].init();
                            }
                        }
			function bfDoFlashUpload(){
                                JQuery("#bfSubmitMessage").css("visibility","hidden");
				JQuery(".bfErrorMessage").html("");
                                JQuery(".bfErrorMessage").css("display","none");
                                for(var i = 0; i < bfUploaderErrorElements.length; i++){
                                    JQuery("#"+bfUploaderErrorElements[i]).html("");
                                }
                                bfUploaderErrorElements = [];
                                if(ff_validation(0) == ""){
					try{
                                            bfFlashUploadInterval = window.setInterval( bfCheckFlashUploadProgress, 1000 );
                                            if(bfFlashUploadersLength > 0){
                                                JQuery("#bfFileQueue").bfcenter(true);
                                                JQuery("#bfFileQueue").css("visibility","visible");
                                                for( var i = 0; i < bfUploaders.length; i++ ){
                                                    bfUploaders[i].start();
                                                }
                                            }
					} catch(e){alert(e)}
				} else {
					if(typeof bfUseErrorAlerts == "undefined"){
                                            alert(error);
                                        } else {
                                            bfShowErrors(error);
                                        }
                                        ff_validationFocus("");
                                        document.getElementById("bfSubmitButton").disabled = false;
				}
			}
			function bfCheckFlashUploadProgress(){
                                if( JQuery("#bfFileQueue").html() == "" ){ // empty indicates that all queues are uploaded or in any way cancelled
					JQuery("#bfFileQueue").css("visibility","hidden");
					window.clearInterval( bfFlashUploadInterval );
                                        if(typeof bfAjaxObject101 != \'undefined\' || typeof bfReCaptchaLoaded != \'undefined\'){
                                            ff_submitForm2();
                                        }else{
                                            ff_validate_submit(document.getElementById("bfSubmitButton"), "click");
                                        }
					JQuery(".bfFlashFileQueueClass").html("");
                                        if(bfFlashUploadersLength > 0){
                                            JQuery("#bfSubmitMessage").bfcenter(true);
                                            JQuery("#bfSubmitMessage").css("visibility","visible");
                                        }
                                        
				}
			}
			');
            echo "<div style=\"visibility:hidden;\" id=\"bfFileQueue\"></div>";
            echo "<div style=\"visibility:hidden;\" id=\"bfSubmitMessage\">" . BFText::_('COM_BREEZINGFORMS_SUBMIT_MESSAGE') . "</div>";
        }
        echo '<noscript>Please turn on javascript to submit your data. Thank you!</noscript>' . "\n";
        JFactory::getDocument()->addScriptDeclaration('//-->');
    }
コード例 #4
0
ファイル: cbodb.php プロジェクト: reeleis/ohiocitycycles
<?php

defined('_JEXEC') or defined('_VALID_MOS') or die('Restricted access');
JImport('joomla.application.helper');
require_once JApplicationHelper::getPath('html');
require_once JApplicationHelper::getPath('admin_functions');
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . $option . DS . 'tables');
switch ($task) {
    case 'listnames':
        listMemberNames($option);
        break;
    case 'memberoptions':
        listMemberOptions($option);
        break;
    case 'login':
        loginMember($option);
        break;
    case 'logout':
        logoutMember($option);
        break;
    case 'newmember':
        newMember($option);
        break;
    case 'newmemberpurchase':
        newMemberPurchase($option);
        break;
    case 'oldmemberpurchase':
        oldMemberPurchase($option);
        break;
    case 'savenewmember':
        saveNewMember($option);
コード例 #5
0
 public static function getEditableTemplate($contentbuilder_form_id, $record_id, array $record, array $elements_allowed, $execPrepare = true)
 {
     jimport('joomla.version');
     $version = new JVersion();
     if (version_compare($version->getShortVersion(), '1.6', '>=')) {
         JHtml::_('behavior.framework');
     }
     $failed_values = JFactory::getSession()->get('cb_failed_values', null, 'com_contentbuilder.' . $contentbuilder_form_id);
     if ($failed_values !== null) {
         JFactory::getSession()->clear('cb_failed_values', 'com_contentbuilder.' . $contentbuilder_form_id);
     }
     $db = JFactory::getDBO();
     $db->setQuery("Select `type`, reference_id, editable_template, editable_prepare, edit_by_type, act_as_registration, registration_name_field, registration_username_field, registration_email_field, registration_email_repeat_field, registration_password_field, registration_password_repeat_field From #__contentbuilder_forms Where id = " . intval($contentbuilder_form_id));
     $result = $db->loadAssoc();
     if (is_array($result) && $result['editable_template']) {
         $user = null;
         if ($result['act_as_registration']) {
             if ($record_id) {
                 $form = contentbuilder::getForm($result['type'], $result['reference_id']);
                 $meta = $form->getRecordMetadata($record_id);
                 $db->setQuery("Select * From #__users Where id = " . $meta->created_id);
                 $user = $db->loadObject();
             } else {
                 if (JFactory::getUser()->get('id', 0)) {
                     $db->setQuery("Select * From #__users Where id = " . JFactory::getUser()->get('id', 0));
                     $user = $db->loadObject();
                 }
             }
         }
         $labels = array();
         $validations = array();
         if (!$result['edit_by_type']) {
             $db->setQuery("Select `label`,`reference_id`,`validations` From #__contentbuilder_elements Where form_id = " . intval($contentbuilder_form_id));
             $labels_ = $db->loadAssocList();
             foreach ($labels_ as $label_) {
                 $labels[$label_['reference_id']] = $label_['label'];
                 $validations[$label_['reference_id']] = $label_['validations'];
             }
         }
         $hasLabels = count($labels);
         $form_type = $result['type'];
         $form_reference_id = $result['reference_id'];
         $form = self::getForm($form_type, $form_reference_id);
         $template = $result['editable_template'];
         $items = array();
         foreach ($record as $item) {
             if (in_array($item->recElementId, $elements_allowed)) {
                 $items[$item->recName] = array();
                 $items[$item->recName]['id'] = $item->recElementId;
                 $items[$item->recName]['label'] = $hasLabels ? $labels[$item->recElementId] : $item->recTitle;
                 if ($result['act_as_registration'] && $user !== null) {
                     if ($result['registration_name_field'] == $item->recElementId) {
                         $item->recValue = $user->name;
                     } else {
                         if ($result['registration_username_field'] == $item->recElementId) {
                             $item->recValue = $user->username;
                         } else {
                             if ($result['registration_email_field'] == $item->recElementId) {
                                 $item->recValue = $user->email;
                             } else {
                                 if ($result['registration_email_repeat_field'] == $item->recElementId) {
                                     $item->recValue = $user->email;
                                 }
                             }
                         }
                     }
                 }
                 $items[$item->recName]['value'] = $item->recValue ? $item->recValue : '';
             }
         }
         // in case if there is no record given, provide the element data but an empty value
         $hasRecords = true;
         if (!count($record)) {
             $hasRecords = false;
             $names = $form->getElementNames();
             if (!count($labels)) {
                 $labels = $form->getElementLabels();
             }
             foreach ($names as $elementId => $name) {
                 if (!isset($items[$name])) {
                     $items[$name] = array();
                 }
                 $items[$name]['id'] = $elementId;
                 $items[$name]['label'] = $labels[$elementId];
                 $items[$name]['value'] = '';
             }
         }
         $item = null;
         if ($execPrepare) {
             eval($result['editable_prepare']);
         }
         $the_init_scripts = "\n" . '<script type="text/javascript">' . "\n" . '<!--' . "\n";
         foreach ($items as $key => $item) {
             $db->setQuery("Select * From #__contentbuilder_elements Where published = 1 And editable = 1 And reference_id = " . $db->Quote($item['id']) . " And form_id = " . intval($contentbuilder_form_id) . " Order By ordering");
             $element = $db->loadAssoc();
             $autocomplete = '';
             if ($result['act_as_registration']) {
                 if ($result['registration_name_field'] == $element['reference_id']) {
                     $element['default_value'] = $user !== null ? $user->name : '';
                     $autocomplete = 'autocomplete="off" ';
                 } else {
                     if ($result['registration_username_field'] == $element['reference_id']) {
                         $element['default_value'] = $user !== null ? $user->username : '';
                         $autocomplete = 'autocomplete="off" ';
                     } else {
                         if ($result['registration_email_field'] == $element['reference_id']) {
                             $element['default_value'] = $user !== null ? $user->email : '';
                             $autocomplete = 'autocomplete="off" ';
                         } else {
                             if ($result['registration_email_repeat_field'] == $element['reference_id']) {
                                 $element['default_value'] = $user !== null ? $user->email : '';
                                 $autocomplete = 'autocomplete="off" ';
                             } else {
                                 if ($result['registration_password_field'] == $element['reference_id']) {
                                     $element['force_password'] = true;
                                     $autocomplete = 'autocomplete="off" ';
                                 } else {
                                     if ($result['registration_password_repeat_field'] == $element['reference_id']) {
                                         $element['force_password'] = true;
                                         $autocomplete = 'autocomplete="off" ';
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             if (!$element['default_value'] && !$hasRecords) {
                 $element['default_value'] = $item['value'];
             }
             $asterisk = '';
             if (is_array($element)) {
                 if ($element['type'] == 'captcha' || trim($element['validations']) != '' || trim($element['custom_validation_script']) != '') {
                     $asterisk = ' <span class="cbRequired" style="color:red;">*</span>';
                 }
                 $options = unserialize(base64_decode($element['options']));
                 $the_item = '';
                 switch ($element['type']) {
                     case in_array($element['type'], self::getFormElementsPlugins()):
                         $removables = array();
                         $plgs = CBPluginHelper::importPlugin('contentbuilder_form_elements', $element['type']);
                         $removables = array_merge($removables, $plgs);
                         $dispatcher = JDispatcher::getInstance();
                         $results = $dispatcher->trigger('onRenderElement', array($item, $element, $options, $failed_values, $result, $hasRecords));
                         if (count($results)) {
                             $results = $results[0];
                         }
                         foreach ($removables as $removable) {
                             $dispatcher->detach($removable);
                         }
                         $the_item = $results;
                         break;
                     case '':
                     case 'text':
                         if (!isset($options->length)) {
                             $options->length = '';
                         }
                         if (!isset($options->maxlength)) {
                             $options->maxlength = '';
                         }
                         if (!isset($options->password)) {
                             $options->password = '';
                         }
                         if (!isset($options->readonly)) {
                             $options->readonly = '';
                         }
                         $the_item = '<div class="cbFormField cbTextField"><input ' . $autocomplete . '' . ($options->readonly ? 'readonly="readonly" ' : '') . 'style="' . ($options->length ? 'width:' . $options->length . ';' : '') . '" ' . ($options->maxlength ? 'maxlength="' . intval($options->maxlength) . '" ' : '') . 'type="' . (isset($element['force_password']) || $options->password ? 'password' : 'text') . '" id="cb_' . $item['id'] . '" name="cb_' . $item['id'] . '" value="' . htmlentities($failed_values !== null && isset($failed_values[$element['reference_id']]) ? $failed_values[$element['reference_id']] : ($hasRecords ? $item['value'] : $element['default_value']), ENT_QUOTES, 'UTF-8') . '"/></div>';
                         break;
                     case 'textarea':
                         if (!isset($options->width)) {
                             $options->width = '';
                         }
                         if (!isset($options->height)) {
                             $options->height = '';
                         }
                         if (!isset($options->maxlength)) {
                             $options->maxlength = '';
                         }
                         if (!isset($options->readonly)) {
                             $options->readonly = '';
                         }
                         if (!isset($options->allow_html)) {
                             $options->allow_html = false;
                         }
                         if (!isset($options->allow_raw)) {
                             $options->allow_raw = false;
                         }
                         if ($options->allow_html || $options->allow_raw) {
                             JImport('joomla.html.editor');
                             $editor = JFactory::getEditor();
                             $the_item = '<div class="cbFormField cbTextArea">' . $editor->display('cb_' . $item['id'], htmlentities($failed_values !== null && isset($failed_values[$element['reference_id']]) ? $failed_values[$element['reference_id']] : ($hasRecords ? $item['value'] : $element['default_value']), ENT_QUOTES, 'UTF-8'), $options->width ? $options->width : '100%', $options->height ? $options->height : '550', '75', '20') . '</div>';
                         } else {
                             $the_item = '<div class="cbFormField cbTextArea"><textarea ' . ($options->readonly ? 'readonly="readonly" ' : '') . 'style="' . ($options->width || $options->height ? ($options->width ? 'width:' . $options->width . ';' : '') . ($options->height ? 'height:' . $options->height . ';' : '') : '') . '" id="cb_' . $item['id'] . '" name="cb_' . $item['id'] . '">' . htmlentities($failed_values !== null && isset($failed_values[$element['reference_id']]) ? $failed_values[$element['reference_id']] : ($hasRecords ? $item['value'] : $element['default_value']), ENT_QUOTES, 'UTF-8') . '</textarea></div>';
                         }
                         break;
                     case 'checkboxgroup':
                     case 'radiogroup':
                         //if(!isset($options->seperator)){
                         //    $options->seperator = ',';
                         //}
                         $options->seperator = ',';
                         if (!isset($options->horizontal)) {
                             $options->horizontal = false;
                         }
                         if (!isset($options->horizontal_length)) {
                             $options->horizontal_length = '';
                         }
                         if ($form->isGroup($item['id'])) {
                             $groupdef = $form->getGroupDefinition($item['id']);
                             $i = 0;
                             $sep = $options->seperator;
                             $group = explode($sep, $failed_values !== null && isset($failed_values[$element['reference_id']]) && is_array($failed_values[$element['reference_id']]) ? implode($sep, $failed_values[$element['reference_id']]) : ($hasRecords ? $item['value'] : $element['default_value']));
                             $groupSize = count($groupdef);
                             $groupSize = !$groupSize ? 1 : $groupSize;
                             $the_item = '<input name="cb_' . $item['id'] . '[]" type="hidden" value="cbGroupMark"/>';
                             foreach ($groupdef as $value => $label) {
                                 $checked = '';
                                 $for = '';
                                 if ($i != 0) {
                                     $for = '_' . $i;
                                 }
                                 foreach ($group as $selected_value) {
                                     if (trim($value) == trim($selected_value)) {
                                         $checked = ' checked="checked"';
                                         break;
                                     }
                                 }
                                 $the_item .= '<div style="' . ($options->horizontal ? 'float: left;' . ($options->horizontal_length ? 'width: ' . $options->horizontal_length . ';' : '') . 'display: inline; margin-right: 2px;' : '') . '" class="cbFormField cbGroupField"><input id="cb_' . $item['id'] . $for . '" name="cb_' . $item['id'] . '[]" type="' . ($element['type'] == 'checkboxgroup' ? 'checkbox' : 'radio') . '" value="' . htmlentities(trim($value), ENT_QUOTES, 'UTF-8') . '"' . $checked . '/> <label for="cb_' . $item['id'] . $for . '">' . htmlentities(trim($label), ENT_QUOTES, 'UTF-8') . '</label> </div>';
                                 $i++;
                             }
                             if ($options->horizontal) {
                                 $the_item .= '<div style="clear:both;"></div>';
                             }
                         } else {
                             $the_item .= '<span style="color:red">ELEMENT IS NOT A GROUP</span>';
                         }
                         break;
                     case 'select':
                         //if(!isset($options->seperator)){
                         //    $options->seperator = ',';
                         //}
                         $options->seperator = ',';
                         if (!isset($options->multiple)) {
                             $options->multiple = 0;
                         }
                         if (!isset($options->length)) {
                             $options->length = '';
                         }
                         if ($form->isGroup($item['id'])) {
                             $groupdef = $form->getGroupDefinition($item['id']);
                             $i = 0;
                             $sep = $options->seperator;
                             $multi = $options->multiple;
                             $group = explode($sep, $failed_values !== null && isset($failed_values[$element['reference_id']]) && is_array($failed_values[$element['reference_id']]) ? implode($sep, $failed_values[$element['reference_id']]) : ($hasRecords ? $item['value'] : $element['default_value']));
                             $the_item = '<input name="cb_' . $item['id'] . '[]" type="hidden" value="cbGroupMark"/>';
                             $the_item .= '<div class="cbFormField cbSelectField"><select class="chzn-done" id="cb_' . $item['id'] . '" ' . ($options->length ? 'style="width:' . $options->length . ';" ' : '') . 'name="cb_' . $item['id'] . '[]"' . ($multi ? ' multiple="multiple"' : '') . '>';
                             foreach ($groupdef as $value => $label) {
                                 $checked = '';
                                 foreach ($group as $selected_value) {
                                     if (trim($value) == trim($selected_value)) {
                                         $checked = ' selected="selected"';
                                         break;
                                     }
                                 }
                                 $the_item .= '<option value="' . htmlentities(trim($value), ENT_QUOTES, 'UTF-8') . '"' . $checked . '>' . htmlentities(trim($label), ENT_QUOTES, 'UTF-8') . '</option>';
                                 $i++;
                             }
                             $the_item .= '</select></div>';
                         } else {
                             $the_item .= '<span style="color:red">ELEMENT IS NOT A GROUP</span>';
                         }
                         break;
                     case 'upload':
                         $deletable = false;
                         if (isset($validations[$item['id']]) && $validations[$item['id']] == '') {
                             $deletable = true;
                         }
                         $the_item = '<div class="cbFormField cbUploadField">';
                         $the_item .= '<input type="file" id="cb_' . $item['id'] . '" name="cb_' . $item['id'] . '"/>';
                         if (trim($item['value']) != '') {
                             $the_item .= '<div>' . ($deletable ? '<label for="cb_delete_' . $item['id'] . '">' . JText::_('COM_CONTENTBUILDER_DELETE') . '</label> <input type="checkbox" id="cb_delete_' . $item['id'] . '" name="cb_delete_' . $item['id'] . '" value="1"/> ' : '') . htmlentities(basename($item['value']), ENT_QUOTES, 'UTF-8') . '</div><div style="clear:both;"></div>';
                         }
                         $the_item .= '</div>';
                         break;
                     case 'captcha':
                         $the_item = '<div class="cbFormField cbCaptchaField">';
                         if (JFactory::getApplication()->isSite()) {
                             $captcha_url = JURI::root(true) . '/components/com_contentbuilder/images/securimage/securimage_show.php';
                         } else {
                             $captcha_url = JURI::root(true) . '/administrator/components/com_contentbuilder/assets/images/securimage_show.php';
                         }
                         $the_item .= '<img width="250" height="80" id="cbCaptcha" alt="captcha" src="' . $captcha_url . '?rand=' . rand(0, getrandmax()) . '"/>';
                         $the_item .= '<div>';
                         $the_item .= '<input autocomplete="off" id="cb_' . $item['id'] . '" name="cb_' . $item['id'] . '" type="text" maxlength="12" />';
                         $the_item .= '<img style="cursor: pointer; padding-left: 7px;" onclick="document.getElementById(\'cbCaptcha\').src = \'' . $captcha_url . '?\' + Math.random(); blur(); return false" border="0" width="15" height="18" alt="refresh" src="' . JURI::root(true) . '/components/com_contentbuilder/images/securimage/images/refresh.png"/>';
                         $the_item .= '</div>';
                         $the_item .= '</div>';
                         break;
                     case 'calendar':
                         JHTML::_('behavior.calendar');
                         if (!isset($options->length)) {
                             $options->length = '';
                         }
                         if (!isset($options->maxlength)) {
                             $options->maxlength = '';
                         }
                         if (!isset($options->readonly)) {
                             $options->readonly = '';
                         }
                         if (!isset($options->format)) {
                             $options->format = '%Y-%m-%d';
                         }
                         if (!isset($options->transfer_format)) {
                             $options->transfer_format = 'YYYY-mm-dd';
                         }
                         $calval = htmlentities($failed_values !== null && isset($failed_values[$element['reference_id']]) ? $failed_values[$element['reference_id']] : ($hasRecords ? $item['value'] : $element['default_value']), ENT_QUOTES, 'UTF-8');
                         $calval = contentbuilder_convert_date($calval, $options->transfer_format, $options->format);
                         $the_item = '<div class="cbFormField cbCalendarField"><input ' . ($options->readonly ? 'readonly="readonly" ' : '') . 'style="' . ($options->length ? 'width:' . $options->length . ';' : '') . '" ' . ($options->maxlength ? 'maxlength="' . intval($options->maxlength) . '" ' : '') . 'type="text" id="cb_' . $item['id'] . '" name="cb_' . $item['id'] . '" value="' . $calval . '"/> <button class="button cbFormField cbCalendarButton" id="cb_' . $item['id'] . '_calendarButton">' . JText::_('COM_CONTENTBUILDER_CALENDAR_BUTTON_TEXT') . '</button></div>';
                         $the_item .= '<script type="text/javascript">
                                     <!--
                                     Calendar.setup({
                                             inputField     :    "cb_' . $item['id'] . '",
                                             ifFormat       :    "' . $options->format . '",
                                             button         :    "cb_' . $item['id'] . '_calendarButton",
                                             align          :    "Bl",
                                             singleClick    :    true
                                         });
                                     //-->
                                     </script>' . "\n";
                         break;
                     case 'hidden':
                         $the_item = '<input type="hidden" id="cb_' . $item['id'] . '" name="cb_' . $item['id'] . '" value="' . htmlentities($failed_values !== null && isset($failed_values[$element['reference_id']]) ? $failed_values[$element['reference_id']] : ($hasRecords ? $item['value'] : $element['default_value']), ENT_QUOTES, 'UTF-8') . '"/>';
                         break;
                 }
                 if ($element['custom_init_script']) {
                     $the_init_scripts .= $element['custom_init_script'] . "\n";
                 }
                 if ($the_item) {
                     $tip = 'hasTip';
                     $tip_prefix = htmlentities($item['label'], ENT_QUOTES, 'UTF-8') . '::';
                     /* new joomla 3 tooltip styles maybe at a later point
                        if (JFactory::getApplication()->isSite() && version_compare($version->getShortVersion(), '3.0', '>=')) {
                            $tip = 'hasTooltip';
                            $tip_prefix = '';
                        }*/
                     $template = str_replace('{' . $key . ':label}', '<label ' . ($element['hint'] ? 'class="editlinktip ' . $tip . '" title="' . $tip_prefix . $element['hint'] . '" ' : '') . 'for="cb_' . $item['id'] . '">' . $item['label'] . $asterisk . ($element['hint'] ? ' <img style="cursor: pointer;" src="' . JURI::root(true) . '/components/com_contentbuilder/images/icon_info.png" border="0"/>' : '') . '</label>', $template);
                     $template = str_replace('{' . $key . ':item}', $the_item, $template);
                 }
             }
         }
         return $template . $the_init_scripts . "\n" . '//-->' . '</script>' . "\n";
     } else {
         JError::raiseError(404, JText::_('COM_CONTENTBUILDER_TEMPLATE_NOT_FOUND'));
     }
     return '';
 }
コード例 #6
0
ファイル: contact.php プロジェクト: joebushi/joomla
 /**
  * Method to get the row form.
  *
  * @return	mixed	JForm object on success, false on failure.
  * @since	1.6
  */
 public function getForm()
 {
     // Initialise variables.
     $app =& JFactory::getApplication();
     JImport('joomla.form.form');
     JForm::addFieldPath('JPATH_ADMINISTRATOR/components/com_users/models/fields');
     // Get the form.
     $form = parent::getForm('contact', 'com_contact.contact', array('array' => 'jform', 'event' => 'onPrepareForm'));
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     // Check the session for previously entered form data.
     $data = $app->getUserState('com_contact.edit.contact.data', array());
     // Bind the form data if present.
     if (!empty($data)) {
         $form->bind($data);
     }
     return $form;
 }
コード例 #7
0
ファイル: helper.php プロジェクト: vstorm83/propertease
 /**
  * Get Images in Folder
  * @return array list images
  */
 function getImageFolder()
 {
     JImport('joomla.filesystem.folder');
     $show_title = $this->params->def('show_title', 1);
     $title_link = $this->params->get('title_link', 1);
     $limit_title = $this->params->get('limit_title', 30);
     $show_text = $this->params->def('show_text', 1);
     $limit_text = $this->params->get('limit_text', 120);
     $show_readmore = $this->params->get('show_readmore', 0);
     $read_more = $this->params->get('read_more', '');
     $target = $this->params->get('target', '_self');
     $intro_clean = $this->params->def('intro_clean', 1);
     $allowable_tags = str_replace(' ', '', $this->params->get('allowable_tags'));
     $allowable_tags = "<" . str_replace(',', '><', $allowable_tags) . ">";
     $video_support = $this->params->def('video_support', 1);
     $plugins_support = $this->params->def('plugins_support', 0);
     // IMAGES
     $image_width = $this->params->get('image_width', 160);
     $image_height = $this->params->get('image_height', 120);
     $image_link = $this->params->get('image_link', 1);
     $folder = $this->params->get('imagefolder', 'images/');
     $imageordering = $this->params->get('imageordering', 'ordering');
     $path = JPath::clean(JPATH_ROOT . DS . $folder);
     //Get image files that has allowed_ext
     $files = JFolder::files($path, "\\.(bmp|gif|png|jpg|jpeg|BMP|GIF|PNG|JPG|JPEG)\$");
     $images = array();
     $gallery = array();
     $i = 0;
     foreach ($files as $file) {
         if (is_file($path . $file)) {
             $images[$i] = $file;
             $gallery[$i] = new stdClass();
             $gallery[$i]->image = $file;
             $gallery[$i]->title = '';
             $gallery[$i]->link = '';
             $gallery[$i]->class = '';
             $gallery[$i]->animation = '';
             $gallery[$i]->description = '';
             $gallery[$i]->time = filemtime($path . $file);
             $gallery[$i]->published = 1;
             $i++;
         }
     }
     $saved_images_json = $this->params->get('jugallery', '[]');
     $saved_images_obj = json_decode($saved_images_json);
     //Re-sort image if has saved_images_json
     if ($saved_images_obj != NULL) {
         $order_img_arr = array();
         foreach ($saved_images_obj as $key => $saved_image_obj) {
             $index_img = array_search($saved_image_obj->image, $images);
             //If saved image does not exist in folder => ignore it
             if ($index_img === FALSE) {
                 continue;
                 //If saved image is unpublished remove from folder image list
             } elseif ($saved_image_obj->published == '0') {
                 unset($gallery[$index_img]);
                 //If saved image is published, add it to order_img_arr, and remove from folder image list
             } else {
                 $saved_image_obj->time = $gallery[$index_img]->time;
                 $order_img_arr[] = $saved_image_obj;
                 unset($gallery[$index_img]);
             }
         }
         $images = array_merge($order_img_arr, $gallery);
     }
     //Sort images
     switch ($imageordering) {
         case 'name_asc':
             function img_order_name_asc($a, $b)
             {
                 return strcmp($a->image, $b->image);
             }
             usort($images, "img_order_name_asc");
             break;
         case 'name_desc':
             function img_order_name_desc($a, $b)
             {
                 return strcmp($b->image, $a->image);
             }
             usort($images, "img_order_name_desc");
             break;
         case 'title_asc':
             function img_order_title_asc($a, $b)
             {
                 return strcmp($a->title, $b->title);
             }
             usort($images, "img_order_title_asc");
             break;
         case 'title_desc':
             function img_order_title_desc($a, $b)
             {
                 return strcmp($b->title, $a->title);
             }
             usort($images, "img_order_title_desc");
             break;
         case 'time_asc':
             function img_order_time_asc($a, $b)
             {
                 return strcmp($a->time, $b->time);
             }
             usort($images, "img_order_time_asc");
             break;
         case 'time_desc':
             function img_order_time_desc($a, $b)
             {
                 return strcmp($b->time, $a->time);
             }
             usort($images, "img_order_time_desc");
             break;
         case 'random':
             shuffle($images);
             break;
         case 'ordering':
         default:
             break;
     }
     $slideshowanimation = self::parseAnimation();
     $i = 0;
     foreach ($images as $image_item) {
         if ($i == $this->params->get('maxitems', 15)) {
             break;
         }
         $image = JURI::root() . JPath::clean($folder . '/' . $image_item->image, '/');
         $lists[$i] = new stdClass();
         $lists[$i]->id = '';
         $lists[$i]->title = '';
         $lists[$i]->link = '';
         $lists[$i]->date = '';
         $lists[$i]->image = $lists[$i]->image_src = $lists[$i]->image_alt = '';
         $lists[$i]->text = '';
         $lists[$i]->author = $lists[$i]->author_name = $lists[$i]->author_link = '';
         $lists[$i]->rating = $lists[$i]->rating_value = $lists[$i]->rating_count = '';
         $lists[$i]->hits = '';
         $lists[$i]->comments = $lists[$i]->comments_count = $lists[$i]->comments_link = '';
         $lists[$i]->readmore = '';
         $lists[$i]->class = $image_item->class;
         $lists[$i]->animation = $slideshowanimation[$i];
         $lists[$i]->link = $image_item->link ? JRoute::_($image_item->link) : '';
         // Show Title
         if ($show_title) {
             $lists[$i]->title = $image_item->title ? $image_item->title : $image_item->image;
             $lists[$i]->title = $limit_title ? self::truncateHTML($lists[$i]->title, $limit_title, '&hellip;', false, false) : $lists[$i]->title;
             $lists[$i]->title = $title_link && trim($lists[$i]->link) != '' ? '<a target="' . $target . '" href="' . $lists[$i]->link . '">' . $lists[$i]->title . '</a>' : $lists[$i]->title;
         }
         // Images
         $img['src'] = $image;
         // Image Parameters
         $img['ttl'] = $image_item->title;
         $img['alt'] = $img['ttl'] ? $img['ttl'] : $image_item->image;
         // Create Thumbnail
         $lists[$i]->mainimage = modJUSlideshowHelper::renderImage($img['src'], $this->params->get('width_main'), $this->params->get('height_main'));
         $lists[$i]->thumb = modJUSlideshowHelper::renderImage($img['src'], $this->params->get('width_thumb'), $this->params->get('height_thumb'));
         $lists[$i]->image_src = @$img['src'];
         $lists[$i]->image_alt = @$img['alt'];
         // Show Text
         if ($show_text) {
             $introtext = $image_item->description;
             //Parse video
             $introtext = $video_support ? self::parseVideo($introtext) : $introtext;
             // Plugins Support
             $introtext = $plugins_support ? JHtml::_('content.prepare', $introtext) : $introtext;
             //preg_replace('/(?<=[^"\']{1})\s*?(?:{[^{]+?{\/.+?}|{.+?})/', '', $introtext);
             // Clean XHTML
             if ($intro_clean) {
                 $introtext = strip_tags($introtext, $allowable_tags);
                 $introtext = str_replace('&nbsp;', ' ', $introtext);
                 $introtext = preg_replace('/\\s{2,}/u', ' ', trim($introtext));
             }
             // Limit Text
             $lists[$i]->text = $limit_text ? self::truncateHtml($introtext, $limit_text, '&hellip;', false, true) : $introtext;
         }
         // Show Readmore
         $lists[$i]->readmore = $show_readmore && trim($lists[$i]->link) != '' ? '<a class="readmore" target="' . $target . '" href="' . $lists[$i]->link . '">' . $read_more . '</a>' : '';
         $i++;
     }
     return $lists;
 }
コード例 #8
0
ファイル: jugallery.php プロジェクト: vstorm83/propertease
<?php

/**
 * ------------------------------------------------------------------------
 * JU Backend Toolkit for Joomla 2.5/3.x
 * ------------------------------------------------------------------------
 * Copyright (C) 2010-2013 JoomUltra. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: JoomUltra Co., Ltd
 * Websites: http://www.joomultra.com
 * ------------------------------------------------------------------------
 */
defined('_JEXEC') or die('Restricted access');
//Disable all error report that may break JSON result
error_reporting(0);
JImport('joomla.filesystem.folder');
class jugallery
{
    protected $params;
    protected $allowed_ext = 'bmp|gif|png|jpg|jpeg|BMP|GIF|PNG|JPG|JPEG';
    function __construct($params)
    {
        $this->params = $params;
    }
    /**
     * Get all image from image source and render them
     * @param object $params
     * @return array image list
     */
    public function loadImages()
    {