Skip to content

Commit

Permalink
Finish v0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pinhead84 committed Nov 28, 2014
2 parents bb5445d + 5999363 commit 77111bf
Show file tree
Hide file tree
Showing 54 changed files with 2,173 additions and 1,625 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OpenEstate-PHP-Wrapper for Joomla 0.1.8 / 0.2.8 / 0.3.8
=======================================================
OpenEstate-PHP-Wrapper for Joomla 0.4
=====================================

This extension integrates [OpenEstate-PHP-Export](https://github.com/OpenEstate/OpenEstate-PHP-Export)
This component integrates [OpenEstate-PHP-Export](https://github.com/OpenEstate/OpenEstate-PHP-Export)
into a *Joomla* based website.


Expand All @@ -14,7 +14,7 @@ OpenEstate.org provides a freeware software - called *OpenEstate-ImmoTool* -
for small and medium sized real-estate-agencies all over the world.

As one certain feature of this software, the managed properties can be exported
to any website that supports PHP. Together with this module, the exported
to any website that supports PHP. Together with this component, the exported
properties can be easily integrated into a *Joomla* based website without
any frames.

Expand All @@ -26,14 +26,22 @@ mit den Anwendern soll eine Softwarelösung für kleine bis mittelgroße
Immobilienunternehmen entwickelt werden.

Unter Anderem können die im *OpenEstate-ImmoTool* verwalteten Immobilien als
PHP-Skripte auf die eigene Webseite exportiert werden. Mit Hilfe dieses Moduls
kann dieser PHP-Export unkompliziert in eine auf *Joomla* basierende
PHP-Skripte auf die eigene Webseite exportiert werden. Mit Hilfe dieser
Komponente kann dieser PHP-Export unkompliziert in eine auf *Joomla* basierende
Webseite integriert werden.


Changelog
---------

### 0.4

- use the same version numbering for the different Joomla packages
- less strict validation of the script URL in the component configuration
- translated any source code comments into English
- made some syntax fixes
- tested against *Joomla* 1.5.26 / 2.5.27 / 3.3.6

### 0.1.8 / 0.2.8 / 0.3.8

- Version 0.3.8 is the first public release for Joomla 3.0 / Platform 12.1.
Expand Down
2 changes: 1 addition & 1 deletion licenseheader.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}A WebsiteBaker module for the OpenEstate-PHP-Export
${licensePrefix}A Joomla module for the OpenEstate-PHP-Export
${licensePrefix}Copyright (C) 2010-${date?date?string("yyyy")} OpenEstate.org
${licensePrefix}
${licensePrefix}This program is free software: you can redistribute it and/or modify
Expand Down
10 changes: 4 additions & 6 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#!/bin/bash

NAME="com_openestate"
VERSION15="0.1.8"
VERSION25="0.2.8"
VERSION30="0.3.8"
VERSION="0.4"
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

rm -Rf $PROJECT_DIR/release
mkdir $PROJECT_DIR/release

cd $PROJECT_DIR/src/joomla-1.5
zip -r $PROJECT_DIR/release/$NAME-$VERSION15.zip .
zip -r $PROJECT_DIR/release/$NAME-joomla15-$VERSION.zip .

cd $PROJECT_DIR/src/joomla-2.5
zip -r $PROJECT_DIR/release/$NAME-$VERSION25.zip .
zip -r $PROJECT_DIR/release/$NAME-joomla25-$VERSION.zip .

cd $PROJECT_DIR/src/joomla-3.0
zip -r $PROJECT_DIR/release/$NAME-$VERSION30.zip .
zip -r $PROJECT_DIR/release/$NAME-joomla30-$VERSION.zip .
170 changes: 97 additions & 73 deletions src/joomla-1.5/admin/admin.openestate.html.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
<?php
/**
* OpenEstate-PHP-Wrapper für Joomla.
* $Id: admin.openestate.html.php 2053 2013-02-12 07:55:22Z andy $
/*
* A Joomla module for the OpenEstate-PHP-Export
* Copyright (C) 2010-2014 OpenEstate.org
*
* @package OpenEstate
* @author Andreas Rudolph & Walter Wagner
* @copyright 2010-2013, OpenEstate.org
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
include_once( JPATH_ROOT.DS.'components'.DS.'com_openestate'.DS.'openestate.wrapper.php' );
defined('_JEXEC') or die('Restricted access');
include_once( JPATH_ROOT . DS . 'components' . DS . 'com_openestate' . DS . 'openestate.wrapper.php' );

class OpenEstateViews {

Expand All @@ -22,15 +29,17 @@ function bar() {
echo '<a href="http://openestate.org" target="_blank"><img src="./components/com_openestate/images/openestate_logo.png" alt="OpenEstate.org" title="OpenEstate.org" border="0" /></a>';

echo '<div style="margin-top:2em; text-align:right;">';

// PayPal (german)
if (strtolower($lang[0])=='de') {
if (strtolower($lang[0]) == 'de') {
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">';
echo '<input type="hidden" name="cmd" value="_s-xclick">';
echo '<input type="hidden" name="hosted_button_id" value="11005790">';
echo '<input type="image" src="https://www.paypal.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal." style="border:none;">';
echo '<img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1">';
echo '</form>';
}

// PayPal (english)
else {
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">';
Expand All @@ -45,147 +54,162 @@ function bar() {
}

function home() {
JToolBarHelper::title( 'OpenEstate.org', 'openestate' );
JToolBarHelper::title('OpenEstate.org', 'openestate');
OpenEstateViews::bar();
echo '<h2>'.JText::_( 'HOME_TITLE' ).'</h2>';
echo '<h2>' . JText::_('HOME_TITLE') . '</h2>';
echo '<ul>';
echo '<li><a href="?option=com_openestate&task=wrapper" style="font-size:1.2em;">'.JText::_( 'HOME_GOTO_WRAPPER' ).'</a></li>';
echo '<li><a href="?option=com_openestate&task=about" style="font-size:1.2em;">'.JText::_( 'HOME_GOTO_ABOUT' ).'</a></li>';
echo '<li><a href="?option=com_openestate&task=wrapper" style="font-size:1.2em;">' . JText::_('HOME_GOTO_WRAPPER') . '</a></li>';
echo '<li><a href="?option=com_openestate&task=about" style="font-size:1.2em;">' . JText::_('HOME_GOTO_ABOUT') . '</a></li>';
echo '</ul>';
}

function about() {
JToolBarHelper::title( 'OpenEstate.org', 'openestate' );
JToolBarHelper::title('OpenEstate.org', 'openestate');
OpenEstateViews::bar();
echo '<h2>'.JText::_( 'ABOUT_TITLE' ).'</h2>';
echo '<p>'.JText::sprintf( 'ABOUT_INFO', 'http://openestate.org' ).'</p>';
echo '<h2>' . JText::_('ABOUT_TITLE') . '</h2>';
echo '<p>' . JText::sprintf('ABOUT_INFO', 'http://openestate.org') . '</p>';
echo '<ul>';
echo '<li>'.JText::_( 'ABOUT_LICENSE' ).': <a href="./components/com_openestate/gpl-3.0-standalone.html" target="_blank">GPL3</a></li>';
echo '<li>'.JText::_( 'ABOUT_AUTHORS' ).': Andreas Rudolph &amp; Walter Wagner</li>';
echo '<li>' . JText::_('ABOUT_LICENSE') . ': <a href="./components/com_openestate/gpl-3.0-standalone.html" target="_blank">GPL3</a></li>';
echo '<li>' . JText::_('ABOUT_AUTHORS') . ': Andreas Rudolph &amp; Walter Wagner</li>';
echo '</ul>';
echo '<h3>'.JText::_( 'ABOUT_SUPPORTUS' ).'</h3>';
echo '<p>'.JText::_( 'ABOUT_SUPPORTUS_TEXT' ).'</p>';
echo '<h3>' . JText::_('ABOUT_SUPPORTUS') . '</h3>';
echo '<p>' . JText::_('ABOUT_SUPPORTUS_TEXT') . '</p>';
echo '<ul>';
echo '<li>'.JText::_( 'ABOUT_SUPPORTUS_BY_RECOMMENDATION' ).'</li>';
echo '<li>'.JText::_( 'ABOUT_SUPPORTUS_BY_TRANSLATION' ).'</li>';
echo '<li>'.JText::_( 'ABOUT_SUPPORTUS_BY_SPONSORING' ).'</li>';
echo '<li>' . JText::_('ABOUT_SUPPORTUS_BY_RECOMMENDATION') . '</li>';
echo '<li>' . JText::_('ABOUT_SUPPORTUS_BY_TRANSLATION') . '</li>';
echo '<li>' . JText::_('ABOUT_SUPPORTUS_BY_SPONSORING') . '</li>';
echo '</ul>';
}

function wrapper() {
JToolBarHelper::title( 'OpenEstate.org', 'openestate' );
JToolBarHelper::title('OpenEstate.org', 'openestate');
OpenEstateViews::bar();
echo '<h2>'.JText::_( 'WRAPPER_TITLE' ).'</h2>';
echo '<p>'.JText::sprintf( 'WRAPPER_INFO', 'http://wiki.openestate.org/Kategorie:ImmoTool_PHP-Export' ).'</p>';
echo '<h3>'.JText::_( 'WRAPPER_SETUP' ).'</h3>';
echo '<h2>' . JText::_('WRAPPER_TITLE') . '</h2>';
echo '<p>' . JText::sprintf('WRAPPER_INFO', 'http://wiki.openestate.org/Kategorie:ImmoTool_PHP-Export') . '</p>';
echo '<h3>' . JText::_('WRAPPER_SETUP') . '</h3>';

// get entry in component table
$table = JTable::getInstance('component');
if( !$table->loadByOption('com_openestate') ) {
if (!$table->loadByOption('com_openestate')) {
JError::raiseWarning(500, 'Not a valid component');
return false;
}
//echo '<pre>'; print_r( $table ); echo '</pre>';

// Formular zur Einbindung der Skript-Umgebung verarbeiten
if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') {
// process form for script configuration
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
$post = JRequest::get('post');
//echo '<pre>'; print_r( $post ); echo '</pre>';

// Pfad muss ein '/' am Ende haben
// script path must end with a /
$value = $post['params']['script_path'];
$len = strlen($value);
if ($len>0 && $value[$len-1]!='/') $post['params']['script_path'] .= '/';
if ($len > 0 && $value[$len - 1] != '/') {
$post['params']['script_path'] .= '/';
}

// URL muss ein '/' am Ende haben
// script URL must end with a /
$value = $post['params']['script_url'];
$len = strlen($value);
if ($len>0 && $value[$len-1]!='/') $post['params']['script_url'] .= '/';
if ($len > 0 && $value[$len - 1] != '/') {
$post['params']['script_url'] .= '/';
}

// bind parameters to table
$table->bind($post);
//-- Pre-save checks
if ( ! $table->check()) {

// pre-save checks
if (!$table->check()) {
//die('CHECK FAILED!!!');
JError::raiseWarning(500, $table->getError());
return false;
}
//-- Save the changes
if ( ! $table->store()) {

// save the changes
if (!$table->store()) {
//die('STORE FAILED!!!');
JError::raiseWarning(500, $table->getError());
return false;
}
}

// Formular zur Einbindung der Skript-Umgebung erzeugen
// build form for script configuration
echo '<form action="index.php" method="post">';
$parameters = new JParameter($table->params, JPATH_COMPONENT_ADMINISTRATOR.DS.'config.wrapper.xml');
$parameters = new JParameter($table->params, JPATH_COMPONENT_ADMINISTRATOR . DS . 'config.wrapper.xml');
$groups = $parameters->getGroups();
foreach (array_keys($groups) as $group) {
//echo '<p>'.$group.'</p>';
echo $parameters->render('params', $group);
}
echo '<input type="hidden" name="option" value="com_openestate" />';
echo '<input type="hidden" name="task" value="wrapper" />';
echo '<input type="submit" value="'.JText::_( 'WRAPPER_SUBMIT' ).'" style="margin-left:15em; margin-top:1em;" />';
echo '<input type="submit" value="' . JText::_('WRAPPER_SUBMIT') . '" style="margin-left:15em; margin-top:1em;" />';
echo '</form>';

// Prüfung der Eingaben
// check configuration
$errors = array();

// Prüfung der Eingaben, Pfad
// check configuration of script path
$translations = null;
$scriptPath = OpenEstateWrapper::getScriptPath( $parameters );
if (!is_string($scriptPath) || strlen(trim($scriptPath))==0) {
$errors[] = JText::_( 'WRAPPER_ERROR_PATH_EMPTY' );
$scriptPath = OpenEstateWrapper::getScriptPath($parameters);
if (!is_string($scriptPath) || strlen(trim($scriptPath)) == 0) {
$errors[] = JText::_('WRAPPER_ERROR_PATH_EMPTY');
}
else if (!is_dir($scriptPath)) {
$errors[] = JText::_( 'WRAPPER_ERROR_PATH_INVALID' );
$errors[] = JText::_('WRAPPER_ERROR_PATH_INVALID');
}
else {
// ImmoTool-Umgebung einbinden
$environmentFiles = array( 'config.php', 'include/functions.php', 'data/language.php' );
// load script environment
$environmentFiles = array('config.php', 'private.php', 'include/functions.php', 'data/language.php');
define('IMMOTOOL_BASE_PATH', $scriptPath);
foreach ($environmentFiles as $file) {
if (!is_file(IMMOTOOL_BASE_PATH.$file))
$errors[] = JText::sprintf( 'WRAPPER_ERROR_CANT_LOAD_FILE', $file );
if (!is_file(IMMOTOOL_BASE_PATH . $file)) {
$errors[] = JText::sprintf('WRAPPER_ERROR_CANT_LOAD_FILE', $file);
}
}
if (count($errors)==0) {
if (count($errors) == 0) {
define('IN_WEBSITE', 1);
foreach ($environmentFiles as $file) {
//echo IMMOTOOL_BASE_PATH . $file . '<hr/>';
include(IMMOTOOL_BASE_PATH.$file);
include(IMMOTOOL_BASE_PATH . $file);
}
if (!defined('IMMOTOOL_SCRIPT_VERSION')) {
$errors[] = JText::_( 'WRAPPER_ERROR_CANT_LOAD_VERSION' );
$errors[] = JText::_('WRAPPER_ERROR_CANT_LOAD_VERSION');
}

// Übersetzungen ermitteln
// load translations
$translations = array();
$jLang = &JFactory::getLanguage();
$lang = OpenEstateWrapper::loadTranslations( $jLang->getTag(), $translations );
if ($translations==null || count($translations)==0) {
$errors[] = JText::_( 'WRAPPER_ERROR_CANT_LOAD_TRANSLATION' );
$lang = OpenEstateWrapper::loadTranslations($jLang->getTag(), $translations);
if ($translations == null || count($translations) == 0) {
$errors[] = JText::_('WRAPPER_ERROR_CANT_LOAD_TRANSLATION');
}
}
}

// Prüfung der Eingaben, URL
$scriptUrl = OpenEstateWrapper::getScriptUrl( $parameters );
if (!is_string($scriptUrl) || strlen(trim($scriptUrl))==0)
$errors[] = JText::_( 'WRAPPER_ERROR_URL_EMPTY' );
else if (strpos(strtolower($scriptUrl),'http://')!==0 && strpos(strtolower($scriptUrl),'https://')!==0)
$errors[] = JText::_( 'WRAPPER_ERROR_URL_INVALID' );
// check configuration of script URL
$scriptUrl = OpenEstateWrapper::getScriptUrl($parameters);
if (!is_string($scriptUrl) || strlen(trim($scriptUrl)) == 0) {
$errors[] = JText::_('WRAPPER_ERROR_URL_EMPTY');
}

if (count($errors)>0) {
echo '<h3 style="color:red;">'.JText::_( 'WRAPPER_ERROR' ).'</h3>';
// show validation messages
if (count($errors) > 0) {
echo '<h3 style="color:red;">' . JText::_('WRAPPER_ERROR') . '</h3>';
echo '<ul>';
foreach ($errors as $error) echo '<li>'.$error.'</li>';
echo '<li>'.JText::_( 'WRAPPER_INFO_JOOMLA' ).'<br/><b style="font-size:1.2em; font-family:monospace;">'.JPATH_ROOT.'</b></li>';
foreach ($errors as $error) {
echo '<li>' . $error . '</li>';
}
echo '<li>' . JText::_('WRAPPER_INFO_JOOMLA') . '<br/><b style="font-size:1.2em; font-family:monospace;">' . JPATH_ROOT . '</b></li>';
echo '</ul>';
return true;
}
echo '<h3 style="color:green;">'.JText::_( 'WRAPPER_SUCCESS' ).'</h3>';
echo '<h3 style="color:green;">' . JText::_('WRAPPER_SUCCESS') . '</h3>';
echo '<ul>';
echo '<li>'.JText::_( 'WRAPPER_INFO_VERSION' ).' <b>'.IMMOTOOL_SCRIPT_VERSION.'</b></li>';
echo '<li>'.JText::sprintf( 'WRAPPER_SUCCESS_MESSAGE', 'index.php?option=com_menus' ).'</li>';
echo '<li>' . JText::_('WRAPPER_INFO_VERSION') . ' <b>' . IMMOTOOL_SCRIPT_VERSION . '</b></li>';
echo '<li>' . JText::sprintf('WRAPPER_SUCCESS_MESSAGE', 'index.php?option=com_menus') . '</li>';
echo '</ul>';
return true;
}

}
?>
Loading

0 comments on commit 77111bf

Please sign in to comment.