OpenRealty Project Snippets
Posted on September 30, 2009
Filed Under Code Snippets, Open Realty, Open Realty Tips | 2 Comments
Have you heard the saying “you are so ugly, you have to hang a pork chop around your neck to get the dog to play with you”. Well, I don’t know that I’m ugly and I’m pretty sure I don’t want the dog to play with me but I do have the pork chop necklace and in this case it represents all the years of code snippets development for WordPress and OpenRealty. Hanging the pork chop around the neck in my case is motivated by link bait, plain and simple. I spent hours upon hours cleaning up the development of dozens of code elements in my OpenRealty demo in the past week as a result of our efforts for WP Realty 2.0 and I’ve decided to publish this inventory of code snippets as a contribution to OpenRealty users.
As you may have noticed I’ve published a handful that have had recent uses in projects but I’ll extend this a great deal by publishing all of my code snippets. Also, for those that follow the blog, before someone concludes that I’m no longer pursuing OpenRealty in lieu of WP Realty, know this. I’ve always wanted to contribute and take part in advancing OpenRealty but I’m not cool enough to be a member of the “OpenRealty Good ole boys club” So, I’ll simply say that my motive isn’t abandonment, its contribution to OpenRealty users. Oh yeah, and link bait is a second motive. So if you blog, link back to the posts, I’ll extend the favor of doing the same and I’ve added the DO FOLLOW snippet to my existing theme for comments. Link bait is important and so is contribution to the OpenRealty users abroad.
My blog sucks, the design stinks, the typography is retarded and no one can find any of the files I distribute or share including the 32 (+1 potential) Plugins and Addons we publish. So after this work week is done I’ll be applying my theme in its raw format which will be a design in process. It will change as I add features and design changes. This could be dangerous some say in search engine rankings because the changes could overtly affect the way data is navigated to. This is true to some point. The URL’s wont change but the structure most certainly will. After applying the new design, the publishing of all those code snippets begins. Enjoy!
Recovering or Creating Joomla Administrator Account Password
Posted on September 29, 2009
Filed Under Code Snippets, Joomla CMS | Leave a Comment
I wrote a post about recovering your OpenRealty admin access permissions after having encountered a unique situation in trying to recover admin access to a project demo site. With a little foresight after scripting the version for OpenRealty, I thought that maybe a similar script to help people in the event of a Joomla password mishap would be worthy of creating to. So, I figured I’d put together this little snippet you can add to your snippet inventory just in case. Why would you need something like this? I’ll explain.
If you didn’t read the post regarding the similar OpenRealty script then this will help explain why something like this may be necessary. There are times people may install Joomla and then not use it for a period of time. Over time memory can fade and recovering your password using the normal process isn’t really an option because the email assigned to the account is no longer accessible. To make matters worse, there are actually hosting accounts that specialize in bulk hosting of Joomla or WordPress type sites that really don’t grant access to things like phpMyAdmin. What do you do? You use the script below to generate a temporary Super Administrators Account in order for you to reset or change your former account then you delete the file along with the temporary Super Administrators Account. Simply upload the script to your Joomla directory, navigate to it, and your done. It will create a super admin account called THEADMIN with the password of “password”. Its important to note that I set the number in the 9000 range because if you are not sure how many members you have this number is big enough to ensure you wont likely encounter an error. However, this number is so high that each and every new account created will follow this number so its something to consider changing if you want to keep the user ID lower.
But you might ask, why bother with creating a new account when we could simply reset the account to password? Well the very small script at the very bottom of this post will do just that providing the admin account hasn’t been renamed. Upload and access it the same way you would if you were creating the new account. Enjoy!
This one resets the existing super administrators account password to “password”
[snippet missing]
This one creates a new account and password.
<?php
/*
@ Copyright: (c)2007 - 2009 Jared Ritchey Design, All Rights Reserved.
@ Author URL: http://www.jaredritchey.com
@ Author Email: jared@jaredritchey.com
@ License: GNU/GPL Extended.
@ Config Notes: not knowing how many members are in your DB this has been set to create the account in the 9000 range.
*/
//////////////////////////////////////////////////////////////////////////////////////
// THIS SCRIPT IS USED TO CREATE AN ACCOUNT FOR THEADMIN WITH THE PASSWORD OF password
//////////////////////////////////////////////////////////////////////////////////////
require_once('configuration.php');
$link = mysql_connect($mosConfig_host, $mosConfig_user, $mosConfig_password) or die("Could not connect : " . mysql_error());
mysql_select_db($mosConfig_db) or die("Could not select database");
echo "Database Host: " .$mosConfig_host."<br />";
echo "Database User: " .$mosConfig_user."<br />";
echo "Database Password: " .$mosConfig_password."<br />";
echo "Database: " .$mosConfig_db."<br />";
$sql= "INSERT INTO jos_core_acl_aro VALUES(9001, 'users', '9491', 0, 'THEADMIN', 0)";
mysql_query($sql);
$sql= "INSERT INTO jos_core_acl_groups_aro_map VALUES(25, '', 9001)";
mysql_query($sql);
$sql= "INSERT INTO jos_users VALUES(9491, 'THEADMIN', 'THEADMIN', 'someone@somewhere.com', '7d83778ac1e89412de7bad3e3470dc21', 'Super Administrator', 0, 0, 25, '2007-03-06 11:55:23', '2009-08-11 15:32:15', '', 'editor=fckeditor\nexpired=\nexpired_time=')";
mysql_query($sql);
//echo "<br /><br />";
die("Your SUPER ADMINISTRATOR Account was added - be sure to make modifications prior to continuing and delete this file.");
?>
Recovering OpenRealty Admin Access
Posted on September 29, 2009
Filed Under Code Snippets, Open Realty, Open Realty Tips | 6 Comments
Recovering or Creating The OpenRealty Password When All Else Fails.
OpenRealty like many applications has a built in feature for recovering your password in the event that you forget it. Recovering your OpenRealty password is little more than just typing in your email address and clicking submit. Naturally this all works fine and dandy if you still have access to the required email account you used in the OpenRealty configuration for your admin account. But what happens when you don’t have access to the email account and you simply can’t log into OpenRealty? Here is a case in point.
Many months ago, I built a 5 pack theme set for an OpenRealty client of mine and after he had spent a great deal of time on his demonstration install he had no real reason to log in now that it was completed so after months passed by, the password slipped his mind. Making matters worse the email account used during the configuration wasn’t accessible either. My initial thought was to use phpMyAdmin and simply paste in the encrypted password for “password” and be done with it. Go figure there was no such thing as phpMyAdmin on his hosting account. It happens, not often but it happens. This guy really didn’t want to lose the sample data and other things necessary for his demos. Here is what I did.
I created the php file, uploaded to the root of his OpenRealty install via FTP and navigated to the script to generate the account. That was it. Here is the script! It will create an account “ADMINISTRATOR” with the password of “password” each of which is case sensitive. Once created, be sure to make modifications to your account prior to continuing and then DELETE the file to save yourself from headaches down the road later.
But you might ask, why bother with creating a new account when we could simply reset the account to password? Well the very small script at the very bottom of this post will do just that. Upload and access it the same way you would if you were creating the new account.
This one resets the existing admin account password to “password”.
[snippet missing]
This one generates a new account.
<?php
/*
@ Copyright: (c)2008 - 2009 Jared Ritchey Design, All Rights Reserved.
@ Author URL: http://www.jaredritchey.com
@ Author Email: jared@jaredritchey.com
@ Usage: Used to create an admin account in OpenRealty
@ License: GNU/GPL
*/
//////////////////////////////////////////////////////////////////////////////////////////
// THIS SCRIPT WILL CREATE the account with ADMINISTRATOR / password
//////////////////////////////////////////////////////////////////////////////////////////
require_once('include/common.php');
require_once('include/misc.inc.php');
global $config;
$tablepref=$config["lang_table_prefix"];
$link = mysql_connect($db_server, $db_user, $db_password) or die("Could not connect : " . mysql_error());
mysql_select_db($db_database) or die("Could not select database");
// This password is "password"
//5f4dcc3b5aa765d61d8327deb882cf99
$sql= "INSERT INTO " . $config['table_prefix'] . "userdb VALUES
('1000',
'ADMINISTRATOR',
'admin@yourdomain.com',
'Jared',
'Ritchey',
'',
'5f4dcc3b5aa765d61d8327deb882cf99',
'yes',
'yes',
'yes',
'yes',
'yes',
'2009-09-26',
'yes',
'yes',
'2009-09-26 8:20:49',
1,
'yes',
'yes',
'yes',
'no',
'yes',
-1,
'yes',
'yes',
'yes',
'yes',
'yes',
'yes',
'yes'
)";
mysql_query($sql);
die("Your admin account was added - be sure to make modifications to your account prior to continuing and DELETE this file.");
?>
Hide Null or Empty Value Fields
Posted on September 29, 2009
Filed Under Code Snippets | 1 Comment
Hiding Search Forms Fields with Null Values from the Search String.
Have you ever wanted to reduce that long confusing looking and un-necessary search string in your “GET” type forms? In our line of work we may opt to use one of three primary tools in our projects; OpenRealty, UltimateIDX, or our home grown product we use on high end projects. Regardless of product, in each instance the search forms for the MLS Quick Search uses the form action type of “GET” and in doing so it passes the form value to the URL string for the query. But what happens when you have a null value or a field with NO value? Why bother to pass fields to your search string that have no value? Over time we noted that lengthy search strings regardless of empty values or not would reduce the response time for the results substantially when compared to shorter search strings.
This script was written to help in the reduction of processing burdens placed on servers for large search forms that use the GET method for form processing. It was designed in part to reduce the SQL search timeout issue common in Real Estate MLS Search forms that rely on the “GET” method to reduce the number of fields passed in the query string. If a search form field contains a NULL or no value it will not be passed on to the GET string.
With help from coder / blogger Greg Burghardt of Fundamental Disaster we hashed out this little snippet to achieve what we were after. The code has since been modified and has about 4 different variants in use but this one is the most true to the original.
You can download the snippet in a zip file from right here; SearchForms.zip
To use this script you should add a little php to display a variable in the body tag or you can simply permanently alter the body tag as follows;
EXAMPLE:
<body onload=”enableEmptyFields(document.something);”>
You must also add an onSubmit event handler (property) belonging to a Form object as follows:
EXAMPLE:
<form action=”the-name-of-your-script.php” method=”get” onsubmit=”disableEmptyFields(this);” name=”something”>
/* ############################### COPYRIGHT NOTICE BEGINS #############################
@ Copyright 2008 - 2009: WP Realty Team - Chad Broussard and Jared Ritchey
@ Copyright 2008: Greg Burghardt
@ Copyright URL: http://www.wprealty.org and http://fundamentaldisaster.blogspot.com/
@ Published by: Chad Broussard and Jared Ritchey
@ Scripting: In part by http://fundamentaldisaster.blogspot.com/ and Jared Ritchey Design
@ License: GNU / GPL
@ File Name: searchforms.js
############################### COPYRIGHT NOTICE ENDS ############################# */
/*
@ DISCLAIMER AND USAGE AND LICENSE:
You are free to use this script for whatever reason you so desire providing you leave the copyright details above in
tact as required and you do not redistribute this code rebranded as your own work. You are free to include this
code in any commercial or non-commercial application without further permission or obligation from WPRealty or
Chad Broussard. You may NOT republish this code absent of this copyright notice. LICENSED AS GNU/GPL Open Source
with provisions.
*/
function enableEmptyFields(form) {
var i = 0;
var field;
var j = 0;
var opt;
while (field = form.elements[i++]) {
switch (field.nodeName) {
case "input":
switch (field.type) {
case "checkbox":
case "radio":
field.disabled = !field.checked;
break;
default:
field.disabled = false;
break;
}
break;
case "select":
if (field.multiple) {
j = 0;
while (opt = field.options[j++]) {
opt.disabled = !opt.selected;
}
} else {
field.disabled = false;
}
break;
default:
field.disabled = false;
break;
}
}
}
function disableEmptyFields(form) {
var i = 0;
var field;
var j = 0;
var opt;
while (field = form.elements[i++]) {
switch (field.nodeName) {
case "input":
switch (field.type) {
case "checkbox":
case "radio":
field.disabled = !field.checked;
break;
default:
field.disabled = (field.value.length > 0) ? false : true;
break;
}
break;
case "select":
if (field.multiple) {
j = 0;
while (opt = field.options[j++]) {
opt.disabled = !opt.selected;
}
} else {
field.disabled = (field.value.length > 0) ? false : true;
}
break;
default:
field.disabled = (field.value.length > 0) ? false : true;
break;
}
}
}
OpenRealty Database Code Snippet
Posted on September 29, 2009
Filed Under Code Snippets | Leave a Comment
Cleaning up empty rows in OpenRealty databases.
Having added many dozens of MLS solutions to OpenRealty over the past 3 years we have long since discovered that many times the database would become so bloated that the database would barely function efficiently. Even though server configuration and resources do play a significant role, a good majority of the problem was the actual saving of empty rows in the data itself.
Over time we have employed many different steps and tools to increase performance in addition to reducing the size of the DB by as much as 15% in some instances. One such trick in the mix was to setup a CRON to run a few times after each MLS update to clear out and remove all empty rows in the database.
Until recently I hadn’t really considered making it available for general use because its not often that a casual user of OpenRealty would need such a thing. Today however I had a person send me a tech support request from a hosting company that outsources their DB work to me and discovered that even though their OpenRealty hosting client didn’t have MLS listings plugged in they still had a ton of empty rows. So this was the solution.
<?php
/*
@ Copyright: (c)2007 - 2009 Jared Ritchey Design, All Rights Reserved.
@ Author URL: http://www.jaredritchey.com
@ Author Email: jared@jaredritchey.com
@ Usage: Simply drop this into a folder relative to your includes directory, change the path accordingly and point a cron to it.
@ Note: sleep(); is used in this instance to pause the script processing long enough to let other processing complete.
@ License: GNU/GPL Extended.
*/
// I usually put this in my admin folder or some other sub folder for instance.
require_once('../include/common.php');
require_once('../include/misc.inc.php');
////////////////////////////////////////////////////////////////
// USE THIS TO DELETE NULL VALUE FIELDS
////////////////////////////////////////////////////////////////
// MLS script above this line
// sleep(8);
global $config;
$tablepref=$config["lang_table_prefix"];
$tablepref2=$config["table_prefix_no_lang"];
$link = mysql_connect($db_server, $db_user, $db_password) or die("Could not connect : " . mysql_error());
mysql_select_db($db_database) or die("Could not select database");
$sql="DELETE FROM " .$tablepref. "listingsdbelements" . " WHERE listingsdbelements_field_value=''";
mysql_query($sql);
//sleep(3);
?>
A few more OpenRealty Optimization Tips.
Here are a few more little tips that can substantially improve performance of your database when dealing with large data sets in your OpenRealty installation. Even though this list isn’t really that extensive or detailed, the ideas are simple enough to follow and understand. Naturally if you have questions or need clarification you can submit a comment with your question and I’ll gladly reply with more information.
- Concatenate your fields: By joining field data from several different yet related fields into a single field in OpenRealty you can substantially reduce the number of rows generated with your MLS Import. This means if you have Unit1 Beds, Unit1 Baths, Unit1 Laundry they could go into one field for Unit Features.
- Flush empty rows: The above script does just that. Put it on a CRON job or add it to your MLS import script and it should always do the job. You can.
- Field to Class Assignment: You should take time and correctly assign your fields to the appropriate property classes because it does matter.
- Field Sharing: Almost every MLS I’ve ever imported into OpenRealty had duplicate field names. comm_beds, resi_beds, multifam_beds are all bed fields in different classes from the MLS, so each can be put into the same OpenRealty field “Beds” for instance rather than creating three separate fields. Depending on how you script your MLS tools, most of the time its a simple change in your field array for the MLS data.
- Images Are BIG, HOTLINK Em: One of the nicest thing about seeing MLS providers update and modernize is that they are finally catching on to the idea of providing a media server for images and other files. By doing so they substantially reduce the download time it takes to get images and therefore updates are much faster. By hot-linking the images you use a script methods to link the photos for better performance and results. This requires some more explanation on so I’ll do that below.
- Disable thumbnails in your admin config panel: Thumbnails are a waste of space for the most part and if you really don’t need them don’t generate them. OpenRealty has enough features built in to allow you to size images within your HTML. Providing you are not uploading images above and beyond the common ratio size of 640×480 or 480×360 you should be just fine in resizing them via your markup as opposed to using the GD Lib or ImageMagic.
- Remove the search all listings: Studies show that people who search “all” listings almost always go back and refine their search for specific property classes. Its not even science either, its common sense, why would a person search all properties only to be given results that may include commercial, land, rentals, multi-family, residential and so on. It should not be assumed that your visitors are that indecisive about what they are seeking.
- Pass only actual values to your search string: If you have a search form that has for instance 15 or maybe 30 fields. In OpenRealty a null value fields still ends up in the query string and still gets processed, by eliminating this you increase search results speed. I have a script we developed that can be easily included to help with this. You can see it in action this persons site located at Connestee Falls Homes, Try and make a “Quick Search” and watch what happens to the search form, the fields that don’t pass values are grayed out and they do not end up as part of the search string. You can use this script free of charge in your own projects. You can read about it here in my post about Hiding Search Form Fields with Null Values.
Expanding on the image hot linking a bit I’ll simply articulate it like this; If you have 100 visitors to your site per day and each views 3 listings and each listing has an average of 7 photos you end up with 2100 image impressions. (excluding search engines) If you download IDX or RETS MLS listings to your server for processing daily updates, you could end up downloading hundreds of megabytes even gigabytes of images with each update. MLS providers have caught onto this and most now provide media servers or at least URL encoding to the image locations with the data. Handling this in OpenRealty while
Viewing your site before it goes live – Flush DNS
Posted on February 27, 2008
Filed Under Code Snippets, Technical Resources | 9 Comments
How to Flush DNS – See New Site Before It Resolves Live!
One of the greatest techniques ever used by responsible web designers.
I was chatting with Mack McMillan of UltimateIDX the other day when we got onto discussing the subject we frequently encounter with clients. Many times clients want to see their blogs and websites prior to them going live and many times that isn’t easily done without some clever techniques I’ll reveal herein. After having encountered this many times I realized that I should come up with a small guide on "how to build and view a site development prior to it going live" when I came up with a little tool to distribute in order to help. So this post is generically in response to a common question being asked in forums. Read more
Open Realty Products Announced
Posted on February 17, 2008
Filed Under Code Snippets, Products | 3 Comments
FREE Plug-ins – Add-ons for Open Realty
Google Maps, CSV loader and Flash Slide-Show for Open Realty are going to be included in the upcoming release of the new templates. After the release of version 2.5 of Open Realty, all the designs I have harbored will be released free of charge. On the horizon is also the Open Realty Add-On for custom forms which will feature an authentication method called "Session Token". This FREE Add-On will work on any page published in Open Realty and will be fully customizable in similar fashion to the custom fields feature in Open Realty.
Available now commercially is the Dynamic FLASH Slide Show for listing details pages that replaces the java-script method. The price is $24.95 and can display listings photos by a multitude of different transition effects. Fades, wipes, scrolls, and more.
Also currently available is the google maps feature for listings details pages. This is currently a commercial item for $19.95 and will eventually be included in any commercial template being offered. A scaled down drop in version as mentioned above will be made available for free.
Now Hiring PHP Coders
Posted on February 17, 2008
Filed Under Code Snippets, Design | Leave a Comment
Seeking PHP / MySQL Coder
Are you a good PHP coder who can code snippets quickly? I’m looking to hire another PHP coder to help with some small customization and snippets for projects we are working on. I’m taking all my years of code that we have held for commercial projects and converting them for FREE resources in my new resource directory. I’d like a person to be well versed in PHP 4+ and although 5+ is the current thing its not the supported thing universally so I need someone who is conscious of that. I’d like the coder to also be well versed in code sanitation to prevent potential security issues in these old snippets once updated.
The criteria for the coder is as follows;
- Commit to a 25 projects minimum and charge accordingly.
- Have a valid phone number in either the US, UK, or Canada preferably but not required.
- Can be paid by certified funds or a verified PayPal account.
- Must use my RTDS (Rapid Template Design Series) coding guideline.
- Should understand AJAX and certainly databases.
- Should understand XML at least from a dynamic generation perspective.
- Must code cleanly with well commented code.
- Dont Steal other peoples code.
- Must be at least casually familiar with a few open source applications and have a good understanding of string replace type template engines.
Please contact me using this sites contact form and in your contact please include a phone number and the times of day or week you can work. Please be fair and competitive in pricing.
Real Estate Webmasters – New Resource Index
Posted on January 30, 2008
Filed Under Code Snippets | 2 Comments
Real Estate Webmaster Resources
After doing a substantial amount of changes to my 4 main blogs over the weekend I came to discover in my directories that I had about 40 important and very usable code snippets that would be truly beneficial for those who are in the development of Real Estate Websites.
I’ve setup a nice little snippet section on one of my sites and then proceeded to take my licensed copy of Code Warehouse 2007 code snippet application and basically create a web based interface that features many of its features in an attempt to make the new section truly easy to manage code snippets and to provide them in a way that is familiar to those that use code manager applications.
I first started out with Open Realty being the base platform for the design of the online snippet DB only to switch to an old modified version of Joomla where I core hacked the menu section to emulate a desktop application familiar to many Windows applications especially to such snippet managers.
Code Resources for Webmasters IDX / RETS and vieleRETS
Over the years I’ve accumulated literally gigabytes of code that have been either modified, abandoned, semi-discarded and half organized only to just take up and waste space. A great deal of it is salvageable and over the course of several months I was able to scape enough bits and pieces of time to assemble all of these code elements into my code snippet database. That’s the good part. The frustrating part is that I can’t share it easily with coders I work with frequently aside from cut-n-past methods.
So, all that IDX / CRON / MLS / RETS and other code snippets will also be going into the new online snippet DB. I’ll post a link this weekend for those to cruise the code but keep in mind that although the design is done for the snippet DB its very sparse on content as of yet.
Recently
- WPRealty Features Short Code
- WordPress Approves ORPRESS
- I am taking a break from freelance
- OpenRealty Paid Support
- XML Feed Templates Download
- OpenRealty Data Icon Tutorial
- OpenRealty 2.5.8 Is Serious Competition
- OpenRealty Theme Options Addon
- WPRealty Sites Out Rank Competition
- Download WP Realty
Categories
- Adobe Dreamweaver
- Announcements
- Code Snippets
- Design
- General
- Joomla CMS
- Open Realty
- Open Realty Tips
- Portfolio
- Products
- Products in Review
- Professionals In Review
- Real Estate News
- Real Estate Websites
- Technical Resources
- Template Design Kit
- Week in Review
- WordPress Wisdom
Archives
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007