function insert_update_listing($value) { global $useradmin, $rets, $current_YVR_time_string; if (!empty($value)) { $selectSQL = "SELECT * FROM listings WHERE sysid=" . $value['sysid']; $get_listing = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_listing = mysql_fetch_assoc($get_listing)) { echo "<span style=\"color:#336633\">Record found in database</span>\n"; $updateSQL = sprintf("UPDATE listings SET property_type=%s, address=%s, postal_code=%s, unit_number=%s, area_desc=%s, area=%s, sub_area_desc=%s, sub_area=%s, city=%s, province=%s, built_year=%s, house_number=%s, list_price=%s, gross_taxes=%s, for_tax_year=%s, list_date=%s, mls_number=%s, bedrooms=%s, bathrooms=%s, public_remarks=%s, public_remarks_2=%s, lot_size_sqt=%s, lot_size_sqm=%s, floor_area_total=%s, site_influences=%s, type_of_dwelling=%s, title_to_land=%s, publish_on_internet=%s, status=%s, last_trans_date=%s, date_updated_local=%s WHERE sysid=" . $value['sysid'], GetSQLValueString($value['1'], "text"), GetSQLValueString($value['14'], "text"), GetSQLValueString($value['11'], "text"), GetSQLValueString($value['2971'], "int"), GetSQLValueString($value['2233'], "text"), GetSQLValueString($value['2283'], "text"), GetSQLValueString($value['2570'], "text"), GetSQLValueString($value['2568'], "text"), GetSQLValueString($value['3794'], "text"), GetSQLValueString($value['88'], "text"), GetSQLValueString($value['16'], "int"), GetSQLValueString($value['181'], "int"), GetSQLValueString($value['226'], "double"), GetSQLValueString($value['2673'], "double"), GetSQLValueString($value['2651'], "int"), GetSQLValueString($value['224'], "date"), GetSQLValueString($value['248'], "text"), GetSQLValueString($value['378'], "int"), GetSQLValueString($value['3928'], "int"), GetSQLValueString($value['411'], "text"), GetSQLValueString($value['3985'], "text"), GetSQLValueString($value['2457'], "double"), GetSQLValueString($value['2460'], "double"), GetSQLValueString($value['3922'], "double"), GetSQLValueString($value['3926'], "text"), GetSQLValueString($value['2733'], "text"), GetSQLValueString($value['2737'], "text"), GetSQLValueString($value['3'] == 'Yes' ? 'Y' : 'N', "text"), GetSQLValueString($value['363'] == 'Active' ? 'A' : 'D', "text"), GetSQLValueString($value['217'], "date"), GetSQLValueString($current_YVR_time_string, "date"), GetSQLValueString($value['sysid'], "int")); $result = mysql_query_or_die($updateSQL, $useradmin); $album_id = get_album_id($value['sysid']); if (!$album_id) { $album_id = create_album($value['sysid']); } check_insert_firm($value['222'], $value['2679'], $value['2681'], $value['2675'], $value['2685']); check_insert_firm($value['2689'], $value['2325'], $value['2683'], $value['2677'], $value['2687']); } else { //$response=$rets->GetPhoto('Property',$value['sysid'].':*', 'images'); //$photo_array=$response['photo_array']; $address = $value['14'] . ' ' . $value['3794'] . ' ' . $value['88']; if (!get_geocode($address, $value['sysid'])) { echo '<br/><span style="color:#ff0000;">[Error] No geo code found! Address:' . urlencode($address) . ' sysid: ' . $value['sysid'] . '</span><br/>'; } echo "<span style=\"color:#336633;\">Creating new record</span>\n"; $insertSQL = sprintf("INSERT INTO listings (sysid, property_type, address, postal_code, unit_number, area_desc, area, sub_area_desc, sub_area, city, province, built_year, house_number, list_price, gross_taxes, for_tax_year, list_date, mls_number, bedrooms, bathrooms, public_remarks, public_remarks_2, lot_size_sqt, lot_size_sqm, floor_area_total, site_influences, type_of_dwelling, title_to_land, publish_on_internet,status, date_imported_local, date_updated_local, last_trans_date) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($value['sysid'], "int"), GetSQLValueString($value['1'], "text"), GetSQLValueString($value['14'], "text"), GetSQLValueString($value['11'], "text"), GetSQLValueString($value['2971'], "int"), GetSQLValueString($value['2233'], "text"), GetSQLValueString($value['2283'], "text"), GetSQLValueString($value['2570'], "text"), GetSQLValueString($value['2568'], "text"), GetSQLValueString($value['3794'], "text"), GetSQLValueString($value['88'], "text"), GetSQLValueString($value['16'], "int"), GetSQLValueString($value['181'], "int"), GetSQLValueString($value['226'], "double"), GetSQLValueString($value['2673'], "double"), GetSQLValueString($value['2651'], "int"), GetSQLValueString($value['224'], "date"), GetSQLValueString($value['248'], "text"), GetSQLValueString($value['378'], "int"), GetSQLValueString($value['3928'], "int"), GetSQLValueString($value['411'], "text"), GetSQLValueString($value['3985'], "text"), GetSQLValueString($value['2457'], "double"), GetSQLValueString($value['2460'], "double"), GetSQLValueString($value['3922'], "double"), GetSQLValueString($value['3926'], "text"), GetSQLValueString($value['2733'], "text"), GetSQLValueString($value['2737'], "text"), GetSQLValueString($value['3'] == 'Yes' ? 'Y' : 'N', "text"), GetSQLValueString($value['363'] == 'Active' ? 'A' : 'D', "text"), GetSQLValueString($current_YVR_time_string, "date"), GetSQLValueString($current_YVR_time_string, "date"), GetSQLValueString($value['217'], "date")); $result = mysql_query_or_die($insertSQL, $useradmin); //$album_id=create_album($value['sysid']); /*for($i=0;$i<count($photo_array);$i++){ $insertPhotoSQL = sprintf("INSERT INTO photo_profile(photo_path)VALUES(%s)", GetSQLValueString($photo_array[$i],"text")); $result=mysql_query_or_die($insertPhotoSQL,$useradmin); $photo_id=mysql_insert_id($useradmin); $insertAlbumSQL = sprintf("INSERT INTO album_profile(album_id, photo_id, cover)VALUES(%s,%s,%s)", GetSQLValueString($album_id,"int"), GetSQLValueString($photo_id,"int"), GetSQLValueString($i==0?'Y':'N',"text")); $result=mysql_query_or_die($insertAlbumSQL,$useradmin); }*/ //insert record to listing_realtors $insertSQL = sprintf("INSERT INTO listing_realtors(sysid, list_realtor_1_id, list_realtor_2_id, list_realtor_3_id) VALUES(%s,%s,%s,%s)", GetSQLValueString($value['sysid'], "int"), GetSQLValueString($value['342'], "text"), GetSQLValueString($value['2697'], "text"), GetSQLValueString($value['2699'], "text")); //list_realtor_3_id $result = mysql_query_or_die($insertSQL, $useradmin); check_insert_realtor($value['342'], $value['2703'], $value['2711'], $value['2685']); check_insert_realtor($value['2697'], $value['2327'], $value['2713'], $value['2707']); check_insert_realtor($value['2699'], $value['2329'], $value['2717'], $value['2701']); //insert record to listing_firms table $insertSQL = sprintf("INSERT INTO listing_firms (sysid, list_firm_1_code, list_firm_1_name, list_firm_1_phone, list_firm_1_fax, list_firm_1_url, list_firm_2_code, list_firm_2_name, list_firm_2_phone, list_firm_2_fax, list_firm_2_url) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($value['sysid'], "int"), GetSQLValueString($value['222'], "text"), GetSQLValueString($value['2679'], "text"), GetSQLValueString(str_replace('-', '', $value['2681']), "text"), GetSQLValueString(str_replace('-', '', $value['2675']), "text"), GetSQLValueString($value['2685'], "text"), GetSQLValueString($value['2689'], "text"), GetSQLValueString($value['2325'], "text"), GetSQLValueString(str_replace('-', '', $value['2683']), "text"), GetSQLValueString(str_replace('-', '', $value['2677']), "text"), GetSQLValueString($value['2687'], "text")); $result = mysql_query_or_die($insertSQL, $useradmin); check_insert_firm($value['222'], $value['2679'], $value['2681'], $value['2675'], $value['2685']); check_insert_firm($value['2689'], $value['2325'], $value['2683'], $value['2677'], $value['2687']); } return true; } else { return false; } }
public function create_album($album_name) { if (!is_dir($album_name)) { mkdir($album_name); return $album_name; } else { $album_name++; $album_name = create_album($album_name); return $album_name; } }
function album($id) { global $params; if (is_album(album_dir($id))) { $params['path'] = "albums/{$id}/"; foreach ($params['sizes'] as $size_name => $size_pixels) { // FIXME: refresh when new images are added or removed if (!is_dir(album_dir($id, $size_name))) { create_album($id, $params['sizes']); } $params[$size_name . '_path'] = $params['path'] . $size_name; } $params['album'] = $id; $params = array_merge($params, Spyc::YAMLLoad(album_dir($id) . "info.yml")); $params['title'] .= ": " . $params['album_title']; render('album'); } else { $params['flash'] = "Album not found."; render('error'); } }
switch ($cmd) { case 'login': output_header(); form_login(); output_footer(); break; case 'process_login': output_header(); process_login(); output_footer(); break; case 'publish': output_header(); form_publish(); output_footer(); break; case 'create_album': output_header(); create_album(); output_footer(); break; case 'add_picture': process_picture(); break; case 'send_reg': send_reg_file(); break; default: display_instructions(); } // switch
function do_add_album() { global $CRUD, $album_fields; foreach ($album_fields as $f) { $fieldname = 'A' . $f; if ($f == "released") { $album[$f] = get_album_released_date(); } elseif ($_REQUEST[$fieldname]) { $album[$f] = get_field($fieldname); } } if (!isset($album['title'])) { error_message("Album must have a Title"); } if (!isset($album['artist'])) { error_message("Album must have an Artist"); } if (error_message()) { foreach ($album_fields as $f) { $CRUD['A' . $f] = isset($album[$f]) ? $album[$f] : ''; if ($f == 'released' and isset($album[$f])) { fill_album_released_date($album[$f]); } } main_page(); } create_album($album); main_page(); }
echo "Record found in database\n"; $updateSQL = sprintf("UPDATE listings SET property_type=%s, address=%s, postal_code=%s, unit_number=%s, city=%s, province=%s, built_year=%s, house_number=%s, list_price=%s, list_date=%s, mls_number=%s, bedrooms=%s, bathrooms=%s, public_remarks=%s, public_remarks_2=%s, lot_size_sqt=%s, lot_size_sqm=%s, floor_area_total=%s, site_influences=%s, type_of_dwelling=%s,publish_on_internet=%s, status=%s WHERE sysid=" . $value['sysid'], GetSQLValueString($value['1'], "text"), GetSQLValueString($value['14'], "text"), GetSQLValueString($value['11'], "text"), GetSQLValueString($value['2971'], "int"), GetSQLValueString($value['3794'], "text"), GetSQLValueString($value['88'], "text"), GetSQLValueString($value['16'], "int"), GetSQLValueString($value['181'], "int"), GetSQLValueString($value['226'], "double"), GetSQLValueString($value['224'], "date"), GetSQLValueString($value['248'], "text"), GetSQLValueString($value['378'], "int"), GetSQLValueString($value['3928'], "int"), GetSQLValueString($value['411'], "text"), GetSQLValueString($value['3985'], "text"), GetSQLValueString($value['2457'], "double"), GetSQLValueString($value['2460'], "double"), GetSQLValueString($value['3922'], "double"), GetSQLValueString($value['3926'], "text"), GetSQLValueString($value['2733'], "text"), GetSQLValueString($value['3'] == 'Yes' ? 'Y' : 'N', "text"), GetSQLValueString($value['363'] == 'Active' ? 'A' : 'D', "text"), GetSQLValueString($value['sysid'], "int")); $result = mysql_query_or_die($updateSQL, $useradmin); $album_id = get_album_id($value['sysid']); if (!$album_id) { $album_id = create_album($value['sysid']); } } else { $response = $rets->GetPhoto('Property', $value['sysid'] . ':*', 'images'); $photo_array = $response['photo_array']; $address = $value['14'] . ' ' . $value['3794'] . ' ' . $value['88']; get_geocode($address, $value['sysid']); echo "Creating new record\n"; $insertSQL = sprintf("INSERT INTO listings (sysid, property_type, address, postal_code, unit_number, city, province, built_year, house_number, list_price, list_date, mls_number, bedrooms, bathrooms, public_remarks, public_remarks_2, lot_size_sqt, lot_size_sqm, floor_area_total, site_influences, type_of_dwelling,publish_on_internet,status) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($value['sysid'], "int"), GetSQLValueString($value['1'], "text"), GetSQLValueString($value['14'], "text"), GetSQLValueString($value['11'], "text"), GetSQLValueString($value['2971'], "int"), GetSQLValueString($value['3794'], "text"), GetSQLValueString($value['88'], "text"), GetSQLValueString($value['16'], "int"), GetSQLValueString($value['181'], "int"), GetSQLValueString($value['226'], "double"), GetSQLValueString($value['224'], "date"), GetSQLValueString($value['248'], "text"), GetSQLValueString($value['378'], "int"), GetSQLValueString($value['3928'], "int"), GetSQLValueString($value['411'], "text"), GetSQLValueString($value['3985'], "text"), GetSQLValueString($value['2457'], "double"), GetSQLValueString($value['2460'], "double"), GetSQLValueString($value['3922'], "double"), GetSQLValueString($value['3926'], "text"), GetSQLValueString($value['2733'], "text"), GetSQLValueString($value['3'] == 'Yes' ? 'Y' : 'N', "text"), GetSQLValueString($value['363'] == 'Active' ? 'A' : 'D', "text")); $result = mysql_query_or_die($insertSQL, $useradmin); $album_id = create_album($value['sysid']); for ($i = 0; $i < count($photo_array); $i++) { $insertPhotoSQL = sprintf("INSERT INTO photo_profile(photo_path)VALUES(%s)", GetSQLValueString($photo_array[$i], "text")); $result = mysql_query_or_die($insertPhotoSQL, $useradmin); $photo_id = mysql_insert_id($useradmin); $insertAlbumSQL = sprintf("INSERT INTO album_profile(album_id, photo_id, cover)VALUES(%s,%s,%s)", GetSQLValueString($album_id, "int"), GetSQLValueString($photo_id, "int"), GetSQLValueString($i == 0 ? 'Y' : 'N', "text")); $result = mysql_query_or_die($insertAlbumSQL, $useradmin); } //insert record to listing_realtors $insertSQL = sprintf("INSERT INTO listing_realtors(sysid, list_realtor_1_id, list_realtor_2_id, list_realtor_3_id) VALUES(%s,%s,%s,%s)", GetSQLValueString($value['sysid'], "int"), GetSQLValueString($value['342'], "text"), GetSQLValueString($value['2697'], "text"), GetSQLValueString($value['2699'], "text")); //list_realtor_3_id $result = mysql_query_or_die($insertSQL, $useradmin); check_insert_realtor($value['342'], $value['2703'], $value['2711'], $value['2685']); check_insert_realtor($value['2697'], $value['2327'], $value['2713'], $value['2707']); check_insert_realtor($value['2699'], $value['2329'], $value['2717'], $value['2701']); //insert record to listing_firms table