Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Installer Update

  • Loading branch information...
commit 33fca42a920754296cb97d3e43559e4a9b856704 1 parent b33aa68
@ctaulborg ctaulborg authored
View
38 represent-map/include/db_example.php
@@ -1,48 +1,47 @@
<?php
-
// mysql hostname
-$db_host = "";
+$db_host = "[db_host]";
// database name
-$db_name = "";
+$db_name = "[db_name]";
// database user name
-$db_user = "";
+$db_user = "[db_user]";
// database password
-$db_pass = "";
+$db_pass = "[db_pass]";
// admin username
-$admin_user = "admin";
+$admin_user = "[admin_user]";
// admin password
-$admin_pass = "letsgetmappy";
+$admin_pass = "[admin_pass]";
// StartupGenome.com integration (optional)
//
-// We recommend integrating your map with the StartupGenome project.
-// It's easy to setup, it will allow people to keep their profiles update
-// over time, and it can help you show the world how your startup community
-// is growing. StartupGenome also has a great interface for curating your
+// We recommend integrating your map with the StartupGenome project.
+// It's easy to setup, it will allow people to keep their profiles update
+// over time, and it can help you show the world how your startup community
+// is growing. StartupGenome also has a great interface for curating your
// map data.
//
// To use this feature, you need to be a curator for your city.
-// If you're not yet a curator, learn more here:
+// If you're not yet a curator, learn more here:
// http://www.startupgenome.com/curators/
-//
+//
// If you are already a curator, find your API key on your
// Startup Genome profile and enter it below. You can manage the markers
// on your map from the Startup Genome website, rather than using the
// built-in admin panel.
-//
+//
// You can turn on Startup Genome integration by changing
// $sg_enabled to "true".
$sg_enabled = false;
// Put your SG API code here
$sg_auth_code = '';
-
+
// Choose your map's location here. If you're not sure
// about this, check the URL on the Startup Genome website.
$sg_location = '';
@@ -50,7 +49,7 @@
// $sg_location = '/city/los-angeles-ca';
// $sg_location = '/state/ca-us';
// $sg_location = '/country/chile';
-
+
// We only check for new data from SG when people visit your map,
// or when you run "startupgenome_get.php?override=true" manually.
// You can limit how often this happens to avoid slow page loads.
@@ -60,7 +59,7 @@
// EventBrite.com integration (optional)
-//
+//
// Show events on the map? If set to "true", an event
// category will appear in the marker list, and you can
// run events_get.php in your browser (or a chron) to populate
@@ -73,7 +72,7 @@
// search eventbrite for these keywords
// use "+" for spaces
// e.g. 'startup', 'startups', 'demo+day'
- $eb_keywords = join("%20OR%20", array('startup', 'startups'));
+ $eb_keywords = join("%20OR%20", array('startup', 'startups'));
// specify city to search in and around
// example: Santa+Monica
@@ -121,7 +120,4 @@
Data from <a target='_blank' href='http://www.startupgenome.com'>StartupGenome</a>
";
}
-
-
-
?>
View
97 represent-map/index.php
@@ -1,4 +1,5 @@
<?php
+if(!file_exists('include/db.php')) require_once('installer.php');
include_once "header.php";
?>
@@ -10,7 +11,7 @@
- Alex Benzer (@abenzer)
- Tara Tiger Brown (@tara)
- Sean Bonner (@seanbonner)
-
+
Create a map for your startup community!
https://github.com/abenzer/represent-map
-->
@@ -27,13 +28,13 @@
<script src="./bootstrap/js/bootstrap-typeahead.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="./scripts/label.js"></script>
-
+
<script type="text/javascript">
var map;
var infowindow = null;
var gmarkers = [];
var markerTitles =[];
- var highestZIndex = 0;
+ var highestZIndex = 0;
var agent = "default";
var zoomControl = true;
@@ -48,22 +49,22 @@
agent = "ipad";
zoomControl = false;
}
- });
-
+ });
+
// resize marker list onload/resize
$(document).ready(function(){
- resizeList()
+ resizeList()
});
$(window).resize(function() {
resizeList();
});
-
+
// resize marker list to fit window
function resizeList() {
newHeight = $('html').height() - $('#topbar').height();
- $('#list').css('height', newHeight + "px");
- $('#menu').css('margin-top', $('#topbar').height());
+ $('#list').css('height', newHeight + "px");
+ $('#menu').css('margin-top', $('#topbar').height());
}
@@ -168,8 +169,8 @@ function initialize() {
$types = Array(
Array('startup', 'Startups'),
Array('accelerator','Accelerators'),
- Array('incubator', 'Incubators'),
- Array('coworking', 'Coworking'),
+ Array('incubator', 'Incubators'),
+ Array('coworking', 'Coworking'),
Array('investor', 'Investors'),
Array('service', 'Consulting'),
Array('hackerspace', 'Hackerspaces'),
@@ -185,13 +186,13 @@ function initialize() {
$place[uri] = addslashes(htmlspecialchars($place[uri]));
$place[address] = htmlspecialchars_decode(addslashes(htmlspecialchars($place[address])));
echo "
- markers.push(['".$place[title]."', '".$place[type]."', '".$place[lat]."', '".$place[lng]."', '".$place[description]."', '".$place[uri]."', '".$place[address]."']);
+ markers.push(['".$place[title]."', '".$place[type]."', '".$place[lat]."', '".$place[lng]."', '".$place[description]."', '".$place[uri]."', '".$place[address]."']);
markerTitles[".$marker_id."] = '".$place[title]."';
- ";
+ ";
$count[$place[type]]++;
$marker_id++;
}
- }
+ }
if($show_events == true) {
$place[type] = "event";
$events = mysql_query("SELECT * FROM events WHERE start_date > ".time()." AND start_date < ".(time()+9676800)." ORDER BY id DESC");
@@ -203,9 +204,9 @@ function initialize() {
$event[address] = htmlspecialchars_decode(addslashes(htmlspecialchars($event[address])));
$event[start_date] = date("D, M j @ g:ia", $event[start_date]);
echo "
- markers.push(['".$event[title]."', 'event', '".$event[lat]."', '".$event[lng]."', '".$event[start_date]."', '".$event[uri]."', '".$event[address]."']);
+ markers.push(['".$event[title]."', 'event', '".$event[lat]."', '".$event[lng]."', '".$event[start_date]."', '".$event[uri]."', '".$event[address]."']);
markerTitles[".$marker_id."] = '".$event[title]."';
- ";
+ ";
$count[$place[type]]++;
$marker_id++;
}
@@ -248,23 +249,23 @@ function initialize() {
// add marker hover events (if not viewing on mobile)
if(agent == "default") {
google.maps.event.addListener(marker, "mouseover", function() {
- this.old_ZIndex = this.getZIndex();
- this.setZIndex(9999);
+ this.old_ZIndex = this.getZIndex();
+ this.setZIndex(9999);
$("#marker"+i).css("display", "inline");
$("#marker"+i).css("z-index", "99999");
});
- google.maps.event.addListener(marker, "mouseout", function() {
+ google.maps.event.addListener(marker, "mouseout", function() {
if (this.old_ZIndex && zoomLevel <= 15) {
- this.setZIndex(this.old_ZIndex);
+ this.setZIndex(this.old_ZIndex);
$("#marker"+i).css("display", "none");
}
- });
+ });
}
// format marker URI for display and linking
var markerURI = val[5];
if(markerURI.substr(0,7) != "http://") {
- markerURI = "http://" + markerURI;
+ markerURI = "http://" + markerURI;
}
var markerURI_short = markerURI.replace("http://", "");
var markerURI_short = markerURI_short.replace("www.", "");
@@ -296,7 +297,7 @@ function initialize() {
// zoom to marker if selected in search typeahead list
$('#search').typeahead({
- source: markerTitles,
+ source: markerTitles,
onselect: function(obj) {
marker_id = jQuery.inArray(obj, markerTitles);
if(marker_id > -1) {
@@ -307,7 +308,7 @@ function initialize() {
$("#search").val("");
}
});
- }
+ }
// zoom to specific marker
@@ -322,9 +323,9 @@ function goToMarker(marker_id) {
// toggle (hide/show) markers of a given type (on the map)
function toggle(type) {
if($('#filter_'+type).is('.inactive')) {
- show(type);
+ show(type);
} else {
- hide(type);
+ hide(type);
}
}
@@ -347,7 +348,7 @@ function show(type) {
}
$("#filter_"+type).removeClass("inactive");
}
-
+
// toggle (hide/show) marker list of a given type
function toggleList(type) {
$("#list .list-"+type).toggle();
@@ -364,14 +365,14 @@ function markerListMouseOut(marker_id) {
google.maps.event.addDomListener(window, 'load', initialize);
</script>
-
+
<? echo $head_html; ?>
</head>
<body>
-
+
<!-- display error overlay if something went wrong -->
<?php echo $error; ?>
-
+
<!-- facebook like button code -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
@@ -381,10 +382,10 @@ function markerListMouseOut(marker_id) {
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=421651897866629";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
-
+
<!-- google map -->
<div id="map_canvas"></div>
-
+
<!-- topbar -->
<div class="topbar" id="topbar">
<div class="wrapper">
@@ -415,7 +416,7 @@ function markerListMouseOut(marker_id) {
</div>
</div>
</div>
-
+
<!-- right-side gutter -->
<div class="menu" id="menu">
<ul class="list" id="list">
@@ -423,14 +424,14 @@ function markerListMouseOut(marker_id) {
$types = Array(
Array('startup', 'Startups'),
Array('accelerator','Accelerators'),
- Array('incubator', 'Incubators'),
- Array('coworking', 'Coworking'),
+ Array('incubator', 'Incubators'),
+ Array('coworking', 'Coworking'),
Array('investor', 'Investors'),
Array('service', 'Consulting'),
Array('hackerspace', 'Hackerspaces')
);
if($show_events == true) {
- $types[] = Array('event', 'Events');
+ $types[] = Array('event', 'Events');
}
$marker_id = 0;
foreach($types as $type) {
@@ -469,7 +470,7 @@ function markerListMouseOut(marker_id) {
</li>
</ul>
</div>
-
+
<!-- more info modal -->
<div class="modal hide" id="modal_info">
<div class="modal-header">
@@ -480,7 +481,7 @@ function markerListMouseOut(marker_id) {
<p>
We built this map to connect and promote the tech startup community
in our beloved Los Angeles. We've seeded the map but we need
- your help to keep it fresh. If you don't see your company, please
+ your help to keep it fresh. If you don't see your company, please
<?php if($sg_enabled) { ?>
<a href="#modal_add_choose" data-toggle="modal" data-dismiss="modal">submit it here</a>.
<?php } else { ?>
@@ -511,7 +512,7 @@ function markerListMouseOut(marker_id) {
</ul>
<p>
This map was built with <a href="https://github.com/abenzer/represent-map">RepresentMap</a> - an open source project we started
- to help startup communities around the world create their own maps.
+ to help startup communities around the world create their own maps.
Check out some <a target="_blank" href="http://www.representmap.com">startup maps</a> built by other communities!
</p>
</div>
@@ -519,8 +520,8 @@ function markerListMouseOut(marker_id) {
<a href="#" class="btn" data-dismiss="modal" style="float: right;">Close</a>
</div>
</div>
-
-
+
+
<!-- add something modal -->
<div class="modal hide" id="modal_add">
<form action="add.php" id="modal_addform" class="form-horizontal">
@@ -602,7 +603,7 @@ function markerListMouseOut(marker_id) {
<script>
// add modal form submit
$("#modal_addform").submit(function(event) {
- event.preventDefault();
+ event.preventDefault();
// get values
var $form = $( this ),
owner_name = $form.find( '#add_owner_name' ).val(),
@@ -618,25 +619,25 @@ function markerListMouseOut(marker_id) {
$.post( url, { owner_name: owner_name, owner_email: owner_email, title: title, type: type, address: address, uri: uri, description: description },
function( data ) {
var content = $( data ).find( '#content' );
-
+
// if submission was successful, show info alert
if(data == "success") {
- $("#modal_addform #result").html("We've received your submission and will review it shortly. Thanks!");
+ $("#modal_addform #result").html("We've received your submission and will review it shortly. Thanks!");
$("#modal_addform #result").addClass("alert alert-info");
$("#modal_addform p").css("display", "none");
$("#modal_addform fieldset").css("display", "none");
$("#modal_addform .btn-primary").css("display", "none");
-
+
// if submission failed, show error
} else {
- $("#modal_addform #result").html(data);
+ $("#modal_addform #result").html(data);
$("#modal_addform #result").addClass("alert alert-danger");
}
}
);
});
</script>
-
+
<!-- startup genome modal -->
<div class="modal hide" id="modal_add_choose">
<form action="add.php" id="modal_addform_choose" class="form-horizontal">
@@ -672,6 +673,6 @@ function( data ) {
</div>
</form>
</div>
-
+
</body>
</html>
View
191 represent-map/installer.php
@@ -0,0 +1,191 @@
+<?
+if(isset($_POST['installer_submitted'])) {
+ // validate fields
+ $error = '';
+ if(!$_POST['db_hostname']) $error .= 'Please enter a database hostname.<br />';
+ if(!$_POST['db_name']) $error .= 'Please enter a database name.<br />';
+ if(!$_POST['db_username']) $error .= 'Please enter a database username.<br />';
+ if(!$_POST['db_password']) $error .= 'Please enter a database password.<br />';
+ if(!$_POST['admin_username']) $error .= 'Please enter an administrative username.<br />';
+ if(!$_POST['admin_pass']) $error .= 'Please enter an administrative password.<br />';
+
+ // if no basic validation errors, check to make sure database info actually works
+ if(!$error) {
+ if(!@mysql_connect($_POST['db_hostname'], $_POST['db_username'], $_POST['db_password'])) $error .= 'Your database host, username, or password information were not correct.<br />';
+ if(!$error) {
+ if(!@mysql_select_db($_POST['db_name'])) $error .= 'Your database name is not valid/could not be found.<br />';
+ }
+ }
+
+ // if not errors, proceed with installer by first creating db file
+ if(!$error) {
+ $file = 'include/db.php';
+ if(!$file_handle = fopen($file, 'w')) {
+ $error .= '
+ <p style="color:red;"><strong>We were unable to update the "/install" directory\'s permissions, which is required for this installer to run. Please do so manually using the below instructions:</p>
+ <p><a href="http://www.cubecartforums.org/docs/appendix/how-to-chmod-directories.html" target="_blank">http://www.cubecartforums.org/docs/appendix/how-to-chmod-directories.html</a></p>
+ ';
+ }
+ fclose($file_handle);
+ }
+
+ // if file was created succesfully, write to it:
+ if(!$error) {
+ $config_file_contents = file_get_contents('include/db_example.php');
+ $config_file_contents = str_replace('[db_host]',$_POST['db_hostname'],$config_file_contents);
+ $config_file_contents = str_replace('[db_name]',$_POST['db_name'],$config_file_contents);
+ $config_file_contents = str_replace('[db_user]',$_POST['db_username'],$config_file_contents);
+ $config_file_contents = str_replace('[db_pass]',$_POST['db_password'],$config_file_contents);
+ $config_file_contents = str_replace('[admin_user]',$_POST['admin_username'],$config_file_contents);
+ $config_file_contents = str_replace('[admin_pass]',$_POST['admin_pass'],$config_file_contents);
+
+ $file = 'include/db.php';
+ $file_handle = fopen($file, 'w');
+ if(!fwrite($file_handle, $config_file_contents)) {
+ $error .= '
+ <p style="color:red;"><strong>We were unable to update the "/install" directory\'s permissions, which is required for this installer to run. Please do so manually using the below instructions:</p>
+ <p><a href="http://www.cubecartforums.org/docs/appendix/how-to-chmod-directories.html" target="_blank">http://www.cubecartforums.org/docs/appendix/how-to-chmod-directories.html</a></p>
+ ';
+ }
+ fclose($file_handle);
+ }
+
+ // if config file is created, lets connect to the database and install our tables
+ if(!$error) {
+ mysql_connect($_POST['db_hostname'], $_POST['db_username'], $_POST['db_password']) or die(mysql_error());
+ mysql_select_db($_POST['db_name']) or die(mysql_error());
+
+ if(!mysql_num_rows( mysql_query("SHOW TABLES LIKE 'events'"))) {
+ if(!mysql_query("CREATE TABLE IF NOT EXISTS `events` (
+ `id` int(9) NOT NULL AUTO_INCREMENT,
+ `id_eventbrite` varchar(15) NOT NULL,
+ `title` varchar(200) NOT NULL,
+ `created` int(14) NOT NULL,
+ `organizer_name` varchar(100) NOT NULL,
+ `uri` varchar(200) NOT NULL,
+ `start_date` int(14) NOT NULL,
+ `end_date` int(14) NOT NULL,
+ `lat` float NOT NULL,
+ `lng` float NOT NULL,
+ `address` varchar(200) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;")) {
+ die(mysql_error());
+ }
+ }
+
+ if(!mysql_num_rows( mysql_query("SHOW TABLES LIKE 'places'"))) {
+ if(!mysql_query("CREATE TABLE IF NOT EXISTS `places` (
+ `id` int(9) NOT NULL AUTO_INCREMENT,
+ `approved` int(1) DEFAULT NULL,
+ `title` varchar(100) NOT NULL,
+ `type` varchar(20) NOT NULL,
+ `lat` float NOT NULL,
+ `lng` float NOT NULL,
+ `address` varchar(200) NOT NULL,
+ `uri` varchar(200) NOT NULL,
+ `description` varchar(255) NOT NULL,
+ `sector` varchar(50) NOT NULL,
+ `owner_name` varchar(100) NOT NULL,
+ `owner_email` varchar(100) NOT NULL,
+ `sg_organization_id` int(9) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;")) {
+ die(mysql_error());
+ }
+ }
+
+ if(!mysql_num_rows( mysql_query("SHOW TABLES LIKE 'settings'"))) {
+ if(!mysql_query("CREATE TABLE IF NOT EXISTS `settings` (
+ `sg_lastupdate` int(14) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1;")) {
+ die(mysql_error());
+ }
+
+ if(!mysql_query("INSERT INTO `settings` (`sg_lastupdate`) VALUES (0)")) {
+ die(mysql_error());
+ }
+ }
+ }
+
+ // if no errors, then setup completed message
+ if(!$error) {
+ $complete = 1;
+ }
+}
+?>
+<html>
+ <head>
+ <title>RepresentMap Installer</title>
+ <link href='/bootstrap/css/bootstrap.css' rel='stylesheet' type='text/css' />
+ <link href='/bootstrap/css/bootstrap-responsive.css' rel='stylesheet' type='text/css' />
+ <link rel='stylesheet' href='admin/admin.css' type='text/css' />
+ <script src='/bootstrap/js/bootstrap.js' type='text/javascript' charset='utf-8'></script>
+ <script src='/scripts/jquery-1.7.1.js' type='text/javascript' charset='utf-8'></script>
+ </head>
+ <body>
+ <div id="content">
+ <form class="well form-inline" action="" id="login" method="post">
+ <h1>RepresentMap Installer</h1>
+
+ <? if(isset($complete)) : ?>
+ <div class="alert alert-success">
+ <p><strong>Congratulations! The installation has been completed. Please click the following link to access your site:</strong></p>
+ <p>
+ <a class="btn" href="/">Launch Site</a> &nbsp;&nbsp;&nbsp; <a class="btn" href="/admin">Launch Admin Area</a>
+ </p>
+ </div>
+
+ <? else : ?>
+ <p><strong>We have detected that you have not installed the represent.ia system. This installer will help you with that process.</strong></p>
+
+ <?= (isset($error) && $error?'<div class="alert alert-danger">'.$error.'</div>':''); ?>
+
+ <hr />
+
+ <? $dirperms = substr(sprintf('%o', fileperms('include')), -4); ?>
+ <? if($dirperms != '0777' && $dirperms != '0755' && !chmod("include", 0755)) : ?>
+ <div class="alert alert-danger">
+ <p style="color:red;"><strong>We were unable to update the "/install" directory's permissions, which is required for this installer to run. Please do so manually using the below instructions:</p>
+ <p><a href="http://www.cubecartforums.org/docs/appendix/how-to-chmod-directories.html" target="_blank">http://www.cubecartforums.org/docs/appendix/how-to-chmod-directories.html</a></p>
+ </div>
+
+ <? else : ?>
+ <div class="control-group"><h4>Database Settings</h4></div>
+ <p>This installer requires that you have a database setup on your server and can provide the following information:</p>
+ <div class="control-group">
+ <input type="text" name="db_hostname" class="input-large" value="<?= (isset($_POST['db_hostname'])?$_POST['db_hostname']:''); ?>" placeholder="Hostname (e.g. localhost)" />
+ </div>
+ <div class="control-group">
+ <input type="text" name="db_name" class="input-large" value="<?= (isset($_POST['db_name'])?$_POST['db_name']:''); ?>" placeholder="Database Name" />
+ </div>
+ <div class="control-group">
+ <input type="text" name="db_username" class="input-large" value="<?= (isset($_POST['db_username'])?$_POST['db_username']:''); ?>" placeholder="Username" />
+ </div>
+ <div class="control-group">
+ <input type="password" name="db_password" class="input-large" value="<?= (isset($_POST['db_password'])?$_POST['db_password']:''); ?>" placeholder="Password" />
+ </div>
+
+ <hr />
+
+ <div class="control-group"><h4>Administrative Settings</h4></div>
+ <p>The following is the admin username and password you will use to access the adminstrative control panel of this system:</p>
+ <div class="control-group">
+ <input type="text" name="admin_username" class="input-large" value="<?= (isset($_POST['admin_username'])?$_POST['admin_username']:''); ?>" placeholder="Admin Username" />
+ </div>
+ <div class="control-group">
+ <input type="password" name="admin_pass" class="input-large" value="<?= (isset($_POST['admin_pass'])?$_POST['admin_pass']:''); ?>" placeholder="Admin Password" />
+ </div>
+
+ <hr />
+
+ <input type="submit" class="btn btn-info" name="installer_submitted" value="Install System" />
+ <? endif; ?>
+ <? endif; ?>
+ </form>
+ </div> <!-- /#content -->
+ </body>
+</html>
+
+<? exit(); ?>
View
36 represent-map/startupgenome_get.php
@@ -6,7 +6,7 @@
// organizations that have been added to your Startup Genome map.
// If it finds any, it will add them to your local database.
-// This script will only run if we haven't checked for new only
+// This script will only run if we haven't checked for new only
// if the frequency interval specified in db.php has already passed.
$interval_query = mysql_query("SELECT sg_lastupdate FROM settings LIMIT 1");
@@ -18,15 +18,17 @@
if(strpos($_SERVER['SERVER_NAME'],'.local') !== false) {
$config = array('api_url' => 'startupgenome.com.local/api/');
} else {
- $config = array('api_url' => 'www.startupgenome.com/api');
+ $config = array('api_url' => 'startupgenome.co/api');
}
$config['search_location'] = $sg_location;
$http = Http::connect($config['api_url'],false,'http');
+
try {
$r = $http->doGet("login/{$sg_auth_code}");
$j = json_decode($r,1);
- $http->setHeaders(array("AUTH_CODE: {$sg_auth_code}"));
+ $http->setHeaders(array("AUTH-CODE: {$sg_auth_code}"));
$user = $j['response'];
+
} catch(Exception $e) {
$error = "<div class='error'>".print_r($e)."</div>";
exit();
@@ -50,7 +52,7 @@
case '5': $place[type] = 'incubator'; break;
case '6': $place[type] = 'coworking'; break;
}
-
+
// format the address for display
$place[address] = $place['address1'];
$place[address] .= ($place['address2']?($place[address]?', ':'').$place['address2']:'');
@@ -64,11 +66,11 @@
$marker_id++;
$place_query = mysql_query("SELECT id FROM places WHERE sg_organization_id='".$place['organization_id']."' LIMIT 1") or die(mysql_error());
-
+
// organization doesn't exist, add it to the db
if(mysql_num_rows($place_query) == 0) {
mysql_query("INSERT INTO places (approved,
- title,
+ title,
type,
lat,
lng,
@@ -77,17 +79,17 @@
description,
sg_organization_id
) VALUES (
- '1',
- '".parseInput($place['name'])."',
- '".parseInput($place['type'])."',
- '".parseInput($place['latitude'])."',
- '".parseInput($place['longitude'])."',
+ '1',
+ '".parseInput($place['name'])."',
+ '".parseInput($place['type'])."',
+ '".parseInput($place['latitude'])."',
+ '".parseInput($place['longitude'])."',
'".parseInput($place['address'])."',
'".parseInput($place['url'])."',
'".parseInput($place['description'])."',
'".parseInput($place['organization_id'])."'
)") or die(mysql_error());
-
+
// organization already exists, update it with new info if necessary
} else if(mysql_num_rows($place_query) == 1) {
$place_info = mysql_fetch_assoc($place_query);
@@ -101,10 +103,10 @@
description='".parseInput($place['description'])."'
WHERE sg_organization_id='".parseInput($place['organization_id'])."' LIMIT 1");
}
-
+
}
}
-
+
// delete any old markers that have already been deleted on SG
$org_array = implode(",", $org_array);
$deleted = mysql_query("DELETE FROM places WHERE sg_organization_id NOT IN ({$org_array})") or die(mysql_error());
@@ -119,9 +121,9 @@
echo "</div>";
exit();
}
-
-
-
+
+
+
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.