function replace_admin_actions() { global $config, $lang; require_once $config['basepath'] . '/include/login.inc.php'; $login = new login(); $login_status = $login->loginCheck('Agent'); if ($login_status !== true) { // Run theese commands even if not logged in. $data = ''; switch ($_GET['action']) { case 'send_forgot': require_once $config['basepath'] . '/include/login.inc.php'; $data = login::forgot_password(); break; case 'forgot': require_once $config['basepath'] . '/include/login.inc.php'; $data = login::forgot_password_reset(); break; default: $data .= $login_status; break; } } else { switch ($_GET['action']) { case 'index': require_once $config['basepath'] . '/include/admin.inc.php'; $admin = new general_admin(); $data = $admin->index_page(); break; case 'edit_page': require_once $config['basepath'] . '/include/editor.inc.php'; $listing = new editor(); $data = $listing->page_edit(); break; case 'edit_user_images': require_once $config['basepath'] . '/include/images.inc.php'; $images = new image_handler(); $data = $images->edit_user_images(); break; case 'edit_listing_images': require_once $config['basepath'] . '/include/images.inc.php'; $images = new image_handler(); $data = $images->edit_listing_images(); break; case 'edit_vtour_images': require_once $config['basepath'] . '/include/images.inc.php'; $images = new image_handler(); $data = $images->edit_vtour_images(); break; case 'edit_listing_files': require_once $config['basepath'] . '/include/files.inc.php'; $files = new file_handler(); $data = $files->edit_listing_files(); break; case 'edit_user_files': require_once $config['basepath'] . '/include/files.inc.php'; $files = new file_handler(); $data = $files->edit_user_files(); break; case 'add_listing': require_once $config['basepath'] . '/include/listing_editor.inc.php'; $listing_editor = new listing_editor(); $data = $listing_editor->add_listing(); break; case 'edit_my_listings': require_once $config['basepath'] . '/include/listing_editor.inc.php'; $listing_editor = new listing_editor(); $data = $listing_editor->edit_listings(); break; case 'edit_listings': require_once $config['basepath'] . '/include/listing_editor.inc.php'; $listing_editor = new listing_editor(); $data = $listing_editor->edit_listings(false); break; case 'configure': require_once $config['basepath'] . '/include/controlpanel.inc.php'; $listing_editor = new configurator(); $data = $listing_editor->show_configurator(); break; case 'edit_listing_template': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_listing_template(); break; case 'edit_listings_template_field_order': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_listings_template_field_order(); break; case 'edit_agent_template_field_order': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_template_field_order($type = 'agent'); break; case 'edit_member_template_field_order': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_template_field_order($type = 'member'); break; case 'edit_agent_template_add_field': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->add_user_template_field($type = 'agent'); break; case 'edit_member_template_add_field': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $type = 'member'; $data = $listing->add_user_template_field($type); break; case 'edit_listing_template_search': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_listing_template_search(); break; case 'edit_listing_template_search_results': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_listing_template_search_results(); break; case 'user_manager': require_once $config['basepath'] . '/include/user_manager.inc.php'; $user_managment = new user_managment(); $data = $user_managment->show_user_manager(); break; case 'edit_user_template': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->edit_user_template(); break; case 'edit_listing_template_add_field': require_once $config['basepath'] . '/include/template_editor.inc.php'; $listing = new template_editor(); $data = $listing->add_listing_template_field(); break; case 'add_page': require_once $config['basepath'] . '/include/editor.inc.php'; $listing = new editor(); $data = $listing->add_page(); break; case 'view_log': require_once $config['basepath'] . '/include/log.inc.php'; $data = log::view(); break; case 'clear_log': require_once $config['basepath'] . '/include/log.inc.php'; $data = log::clear_log(); break; case 'show_property_classes': require_once $config['basepath'] . '/include/propertyclass.inc.php'; $data = propertyclass::show_classes(); break; case 'modify_property_class': require_once $config['basepath'] . '/include/propertyclass.inc.php'; $data = propertyclass::modify_property_class(); break; case 'delete_property_class': require_once $config['basepath'] . '/include/propertyclass.inc.php'; $data = propertyclass::delete_property_class(); break; case 'insert_property_class': require_once $config['basepath'] . '/include/propertyclass.inc.php'; $data = propertyclass::insert_property_class(); break; case 'add_listing_property_class': require_once $config['basepath'] . '/include/listing_editor.inc.php'; $listing_editor = new listing_editor(); $data = $listing_editor->add_listing_logic(); break; //Todo Finish Adding Blog Items //Todo Finish Adding Blog Items case 'edit_blog': require_once $config['basepath'] . '/include/blog_editor.inc.php'; $listing = new blog_editor(); $data = $listing->blog_edit_index(); break; case 'edit_blog_post': require_once $config['basepath'] . '/include/blog_editor.inc.php'; $listing = new blog_editor(); $data = $listing->blog_edit(); break; case 'add_blog': require_once $config['basepath'] . '/include/blog_editor.inc.php'; $listing = new blog_editor(); $data = $listing->add_post(); break; case 'edit_blog_post_comments': require_once $config['basepath'] . '/include/blog_editor.inc.php'; $listing = new blog_editor(); $data = $listing->edit_post_comments(); break; case 'addon_manager': require_once $config['basepath'] . '/include/addon_manager.inc.php'; $am = new addon_manager(); $data = $am->display_addon_manager(); break; case 'send_notifications': require_once $config['basepath'] . '/include/notification.inc.php'; $notify = new notification(); $data = $notify->NotifyUsersOfAllNewListings(); break; default: // Handle Addons $addon_name = array(); if (preg_match("/^addon_(.\\S*?)_.*/", $_GET['action'], $addon_name)) { include_once $config['basepath'] . '/addons/' . $addon_name[1] . '/addon.inc.php'; $function_name = $addon_name[1] . '_run_action_admin_template'; $data = $function_name(); } } } return $data; }
function view_user() { global $conn, $lang, $config, $user; require_once $config['basepath'] . '/include/misc.inc.php'; require_once $config['basepath'] . '/include/images.inc.php'; $display = ''; $user = intval($_GET['user']); if ($user != "") { $misc = new misc(); $sql = "SELECT userdb_is_agent, userdb_is_admin FROM " . $config['table_prefix'] . "userdb WHERE userdb_id = " . $user . ""; $recordSet = $conn->Execute($sql); if ($recordSet === false) { $misc->log_error($sql); } // get main listings data while (!$recordSet->EOF) { $is_agent = $misc->make_db_unsafe($recordSet->fields['userdb_is_agent']); $is_admin = $misc->make_db_unsafe($recordSet->fields['userdb_is_admin']); $recordSet->MoveNext(); } // end while if ($is_agent == 'yes' || $is_admin == true && $config["show_listedby_admin"] == 1) { require_once dirname(__FILE__) . '/class/template/core.inc.php'; $page = new page_user(); require_once dirname(__FILE__) . '/images.inc.php'; $image_handler = new image_handler(); require_once dirname(__FILE__) . '/files.inc.php'; $file_handler = new file_handler(); $page->load_page($config['template_path'] . '/' . $config['agent_template']); //Replace Tags $page->page = str_replace('{user_last_name}', $this->get_user_last_name($user), $page->page); $page->page = str_replace('{user_first_name}', $this->get_user_first_name($user), $page->page); $page->page = str_replace('{user_images_thumbnails}', $image_handler->renderUserImages($user), $page->page); $page->page = str_replace('{user_display_info}', $this->renderUserInfo($user), $page->page); $page->page = str_replace('{user_contact_link}', $this->contact_agent_link($user), $page->page); $page->page = str_replace('{user_vcard_link}', $this->vcard_agent_link($user), $page->page); $page->page = str_replace('{user_listings_list}', $this->userListings($user), $page->page); $page->page = str_replace('{user_hit_count}', $this->userHitcount($user), $page->page); $page->page = str_replace('{user_id}', $user, $page->page); $page->page = str_replace('{user_listings_link}', $this->userListingsLink($user), $page->page); $page->page = str_replace('{files_user_horizontal}', $file_handler->render_templated_files($user, 'user', 'horizontal'), $page->page); $page->page = str_replace('{files_user_vertical}', $file_handler->render_templated_files($user, 'user', 'vertical'), $page->page); $page->page = str_replace('{user_files_select}', $file_handler->render_files_select($user, 'user'), $page->page); // Handle Caption Only $page->page = preg_replace_callback('/{user_field_([^{}]*?)_caption}/', create_function('$matches', 'global $config,$user,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($user, $matches[1],\'caption\');'), $page->page); // Hanle VlaueOnly $page->page = preg_replace_callback('/{user_field_([^{}]*?)_value}/', create_function('$matches', 'global $config,$user,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($user, $matches[1],\'value\');'), $page->page); // Handle Raw Value $page->page = preg_replace_callback('/{user_field_([^{}]*?)_rawvalue}/', create_function('$matches', 'global $config,$user,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($user, $matches[1],\'rawvalue\');'), $page->page); // Handle Both Caption and Value $page->page = preg_replace_callback('/{user_field_([^{}]*?)}/', create_function('$matches', 'global $config,$user,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($user, $matches[1]);'), $page->page); // Insert Agent Image $sql2 = "SELECT userimages_thumb_file_name FROM " . $config['table_prefix'] . "userimages WHERE userdb_id = {$user} ORDER BY userimages_rank"; $recordSet2 = $conn->Execute($sql2); if ($recordSet2 === false) { $misc->log_error($sql2); } $num_images = $recordSet2->RecordCount(); if ($num_images == 0) { if ($config['show_no_photo'] == 1) { $agent_image = '<img src="images/nophoto.gif" alt="' . $lang['no_photo'] . '" />'; $raw_agent_image = 'images/nophoto.gif'; } else { $agent_image = ''; $raw_agent_image = ''; } $page->page = $page->parse_template_section($page->page, 'agent_image_thumb_1', $agent_image); $page->page = $page->parse_template_section($page->page, 'raw_agent_image_thumb_1', $raw_agent_image); } $x = 1; while (!$recordSet2->EOF) { $thumb_file_name = $misc->make_db_unsafe($recordSet2->fields['userimages_thumb_file_name']); if ($thumb_file_name != "") { // gotta grab the image size $imagedata = GetImageSize("{$config['user_upload_path']}/{$thumb_file_name}"); $imagewidth = $imagedata[0]; $imageheight = $imagedata[1]; $shrinkage = $config['thumbnail_width'] / $imagewidth; $displaywidth = $imagewidth * $shrinkage; $displayheight = $imageheight * $shrinkage; $agent_image = '<img src="' . $config['user_view_images_path'] . '/' . $thumb_file_name . '" height="' . $displayheight . '" width="' . $displaywidth . '" alt="' . $thumb_file_name . '" />'; $raw_agent_image = $config['user_view_images_path'] . '/' . $thumb_file_name; } // end if ($thumb_file_name != "") // We have the image so insert it into the section. $page->page = $page->parse_template_section($page->page, 'agent_image_thumb_' . $x, $agent_image); $page->page = $page->parse_template_section($page->page, 'raw_agent_image_thumb_' . $x, $raw_agent_image); $x++; $recordSet2->MoveNext(); } // end while $page->page = preg_replace('{agent_image_thumb_(.*?)}', '', $page->page); $page->page = preg_replace('{raw_agent_image_thumb_(.*?)}', '', $page->page); $display = $page->page; } else { $display = $lang['user_manager_invalid_user_id']; } } return $display; }