function getForm() { if ($this->_eventid) { $query = ' SELECT f.* ' . ' FROM #__redevent_events AS e ' . ' INNER JOIN #__rwf_forms AS f ON e.redform_id = f.id ' . ' WHERE e.id = ' . $this->_db->Quote($this->_eventid); } else { if ($this->_xref) { $query = ' SELECT f.* ' . ' FROM #__redevent_events AS e ' . ' INNER JOIN #__redevent_event_venue_xref AS x ON x.eventid = e.id ' . ' INNER JOIN #__rwf_forms AS f ON e.redform_id = f.id ' . ' WHERE x.id = ' . $this->_db->Quote($this->_xref); } else { JError::raisewarning(0, 'No event or session id !'); return false; } } $this->_db->setQuery($query, 0, 1); $res = $this->_db->loadObject(); // echo '<pre>';print_r($this->_db->getQuery()); echo '</pre>';exit; return $res; }
function copyAdapter() { $file = JPATH_COMPONENT_ADMINISTRATOR . '/lib/expackage.php'; $path = UPDATER_ADAPTER_PATH; @copy($file, $path); if (!file_exists($path)) { JError::raisewarning(2000, 'ERROR: could not install package adapter. Packages will not install properly. Please manually copy:' . "<br>\n{$file} to <br>\n" . $path); return false; } return true; }
/** * return full url to thumbnail * * @param string image path, relative to joomla images folder * @return url or false if it doesn't exists */ public static function getThumbUrl($path, $maxdim = null) { jimport('joomla.filesystem.file'); $app =& JFactory::getApplication(); $settings = redEVENTHelper::config(); if ($maxdim) { $width = $maxdim; $height = $maxdim; } else { $width = $settings->get('imagewidth', 100); $height = $settings->get('imageheight', 100); } $base = JURI::root(); $thumb_name = md5(basename($path)) . $width . '_' . $height . '.png'; if (dirname($path) != '.') { $thumb_path = JPATH_SITE . DS . dirname($path) . DS . 're_thumb' . DS . $thumb_name; $thumb_uri = $base . str_replace("\"", "/", dirname($path)) . '/re_thumb/' . $thumb_name; } else { JError::raisewarning(0, JText::sprintf('COM_REDEVENT_THUMBNAILS_WRONG_BASE_PATH', dirname($thumb_path))); } if (JFile::exists($thumb_path)) { return $thumb_uri; } else { if (JFile::exists(JPATH_SITE . DS . $path)) { //try to generate the thumb if (!JFolder::exists(dirname($thumb_path)) && !JFolder::create(dirname($thumb_path))) { RedeventHelperLog::simpleLog(sprintf('Can\'t create path for thumbnail: %s', dirname($thumb_path))); return false; } if (redEVENTImage::thumb(JPATH_SITE . DS . $path, $thumb_path, $width, $height)) { return $thumb_uri; } } } return false; }