get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE ".$table_name." ( id mediumint(255) NOT NULL KEY AUTO_INCREMENT, stat ENUM('P','X') NOT NULL, type VARCHAR(255) NOT NULL, company VARCHAR(255) NOT NULL, fname VARCHAR(255) NOT NULL, lname VARCHAR(255) NOT NULL, address1 VARCHAR(255) NOT NULL, address2 VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, state VARCHAR(255) NOT NULL, zip VARCHAR(255) NOT NULL, country VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, rating VARCHAR(255) NOT NULL, num_ratings MEDIUMINT(255) NOT NULL );"; require_once(ABSPATH . './wp-admin/upgrade-functions.php'); dbDelta($sql); } // create "ibot_rating" table $table_name = $table_prefix ."ibot_rating"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE ".$table_name." ( id mediumint(255) NOT NULL KEY AUTO_INCREMENT, co_id MEDIUMINT(255) NOT NULL, stat ENUM('P','X') NOT NULL, name VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, state VARCHAR(255) NOT NULL, country VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, rating MEDIUMINT(255) NOT NULL, comments TEXT NOT NULL );"; require_once(ABSPATH . './wp-admin/upgrade-functions.php'); dbDelta($sql); } } // insert admin ui // =-=-=-=-=-=-=-= function ibot_review_admin_ui() { if (function_exists('add_management_page')) { add_management_page('Reviews', 'Reviews', 8, basename(__FILE__), 'ibot_review_subpanel'); } } // update ratings and comments // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function ibot_check_ratings($rid) { global $wpdb, $table_prefix; // grab company id $co_id = $wpdb->get_var("SELECT `co_id` FROM `".$table_prefix."ibot_rating` WHERE id='$rid' LIMIT 1"); // sum totals $total = $wpdb->get_var("SELECT SUM(`rating`) FROM `".$table_prefix."ibot_rating` WHERE stat='X' AND co_id='$co_id'"); $wpdb->get_results("SELECT `id` FROM `".$table_prefix."ibot_rating` WHERE stat='X' AND co_id='$co_id'"); $num = $wpdb->num_rows; // average $avg = round(($total/$num),2); // update $wpdb->query("UPDATE `".$table_prefix."ibot_company` SET rating='$avg', num_ratings='$num' WHERE id='$co_id' LIMIT 1"); } // generate admin ui // =-=-=-=-=-=-=-=-= function ibot_review_subpanel() { global $table_prefix, $wpdb; // check for installation ibot_install(); // save changes If($_GET["save"]=="YES") { // new company If(!empty($_POST["new"])) {foreach($_POST["new"] as $key=>$val) { // approve If($val=="approve") {$wpdb->query("UPDATE `".$table_prefix."ibot_company` SET stat='X' WHERE id='".$key."' LIMIT 1");} // delete If($val=="delete") {$wpdb->query("DELETE FROM `".$table_prefix."ibot_company` WHERE id='".$key."' LIMIT 1");} }} // new reviews If(!empty($_POST["rev"])) {foreach($_POST["rev"] as $key=>$array) { // save changes $wpdb->query("UPDATE `".$table_prefix."ibot_rating` SET name='".db_safe($array[name])."', city='".db_safe($array[city])."', state='".db_safe($array[state])."', country='".db_safe($array[country])."', email='".db_safe($array[email])."', comments='".db_safe($array[comments])."', rating='".db_safe($array[rating])."' WHERE id='".$key."' LIMIT 1"); // approve If($array[act]=="approve") {$wpdb->query("UPDATE `".$table_prefix."ibot_rating` SET stat='X' WHERE id='".$key."' LIMIT 1"); ibot_check_ratings($key);} // delete If($array[act]=="delete") {$wpdb->query("DELETE FROM `".$table_prefix."ibot_rating` WHERE id='".$key."' LIMIT 1");} }} print "
These changes have been saved!
Search:
Add your own: [">Adjuster] [">Attorney] [">Body Shop] [">Contractor] [">Insurer]
=ibot_search_results($rows, $rows_limit, $row_text);?> }} // show search results // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function ibot_search_results($rows, $rows_limit) { global $userdata; get_currentuserinfo(); If(empty($rows)) {print 'No results found...
'; return;} print 'Showing '.$rows_limit.' items:
'; ?>| Company or Individual: | Name: | Service Area: | Average Rating & Comments: | ||
| =$row->company?> if($userdata->user_level>9) {?> id);?>">edit } ?> |
=$row->fname?> =$row->lname?> | =$row->city?>, =$row->state?>, =$row->country?> | id);?>">=$row->num_ratings?> comments |
id);?>">rate it! | |
| Name | =$co->fname?> =$co->lname?> |
| Address | =$co->address1?> =$co->address1?> |
| City | =$co->city?> |
| Phone | =$co->phone?> |
| =$rev->name?> from =$rev->city?> =$rev->state?> =$rev->country?> wrote: | |
| =$rev->comments?> | |
Thank you for reviewing this company!
'; print ''; return; } } ?>Specific rating for: =$co_name->fname?> =$co_name->lname?>
(required fields)
} // public plugin, add new entry // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function ibot_public_display_add($name) { If($_GET["submit"]=="YES") { // error checking $error = ibot_error_check_add(); $error .= ibot_error_check_rate(); // no errors If(empty($error)) { $co_id = ibot_new_company($_GET["add"]); ibot_new_rating($co_id); print 'Thank you for reviewing this company!
'; print ''; return; } } ?>(required fields)
} // public plugin, add new entry // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function ibot_public_display_rate() { ?>| Your Name: | |
| (Does not have to be your real or full name.) | |
| Loss Location City: | |
| (Suggestion - If the loss was in a smaller city, list both smaller city and the largest city within 60 miles. For example: "Hollywood, LA") | |
| State/Province: | |
| Country: | |
| Your Email: | (Your email address will not be posted) |
| Rating: | |
* "I declare that I or the person I speak for has actually conducted business in connection with the person or business being rated." | |
| I Agree: | |
| Comments: (limit 1,000 characters) | |
* Postings may be delayed for review or subject to removal for inappropriate language such as profanity and inflammatory comments. The goal of this rating section is to help visitors avoid bad adjusters and their vendors and find the good ones. It is not necessary to use four letter swear words to achieve these results. Your comments are not "libel" or "slander" if what you say is the truth. If you do not know if what you say is true or false, then you should add the words "it is my opinion that ..." or "I have heard that ...". It is not against the law to gossip or to have an opinion. | |