Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
manolis committed Dec 14, 2007
1 parent c933ea6 commit 88551f7
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 5 deletions.
16 changes: 12 additions & 4 deletions CL_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ function guessPilots($chunkSize=5) { // we pull data from this server
}

// print_r($samePilots);
echo "<hr><pre>";
echo "# ------------------------------------\n";
echo "DELETE FROM leonardo_remote_pilots WHERE remoteServerID=".$this->ID."; \n";

foreach($samePilots as $remoteUserID=>$arr1)
foreach($arr1 as $remoteUserServerID=>$arr2)
foreach($arr2 as $localUserID=>$arr3)
Expand All @@ -457,13 +461,17 @@ function guessPilots($chunkSize=5) { // we pull data from this server
$pilotInfo=getPilotInfo($localUserID,$localUserServerID );

$remotePilotInfo=$remotePilotNames[$remoteUserID][$remoteUserServerID];
echo "$remoteUserServerID _$remoteUserID $localUserServerID _$localUserID = $counts <BR>";
echo " [ ".$remotePilotInfo['lName']." ".$remotePilotInfo['fName']." country: ".$remotePilotInfo['country']." sex: ".$remotePilotInfo['sex']." birthdate: ".$remotePilotInfo['birthdate']." CIVL ID: ".$remotePilotInfo['CIVL_ID']." ] <BR>";

echo " [ ".$pilotInfo['0']." ".$pilotInfo['1']." country: ".$pilotInfo['2']." sex: ".$pilotInfo['3']." birthdate: ".$pilotInfo['4']." CIVL ID: ".$pilotInfo['5']." ] <BR>";
if ($remoteUserServerID==0) $remoteUserServerID=$this->ID;
echo "# ------------------------------------\n";
echo "# REMOTE [ ".$remotePilotInfo['lName']." ".$remotePilotInfo['fName']." country: ".$remotePilotInfo['country']." sex: ".$remotePilotInfo['sex']." birthdate: ".$remotePilotInfo['birthdate']." CIVL ID: ".$remotePilotInfo['CIVL_ID']." ] \n";
echo "# LOCAL [ ".$pilotInfo['0']." ".$pilotInfo['1']." country: ".$pilotInfo['2']." sex: ".$pilotInfo['3']." birthdate: ".$pilotInfo['4']." CIVL ID: ".$pilotInfo['5']." ] \n";
echo "# $remoteUserServerID"."_$remoteUserID $localUserServerID"."_$localUserID = $counts \n";
echo "INSERT INTO leonardo_remote_pilots VALUES ( $remoteUserServerID,$remoteUserID,$localUserServerID,$localUserID);\n";

}
echo "<div class='ok'>Sync-log replication finished</div><br>";
echo "</pre>";
echo "<div class='ok'>Finished guessing pilots</div><br>";
echo "Proccessed $entriesNum flight's hashes out of $item_num<br>";

}
Expand Down
5 changes: 5 additions & 0 deletions FN_waypoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ function selectWaypointLocation($name,$intName,$countryCode,$forceIntl=-1) {
return $tname;
}

function countryCodeToLanguage($countryCode) {
global $lang2iso;
if ( ($lang=array_search(strtolower($countryCode),$lang2iso)) === NULL ) $lang='';
return $lang;
}
function countryHasLang($countryCode,$language) {
global $CONFIG_langsSpoken;

Expand Down
60 changes: 60 additions & 0 deletions GUI_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ function chmodDir($dir){
echo "<li><a href='".CONF_MODULE_ARG."&op=admin&admin_op=convertWaypoints'>Convert waypoints from iso -> UTF8 </a> ";
echo "<li><a href='".CONF_MODULE_ARG."&op=admin&admin_op=cleanPhotosTable'>Clean Photos Table (NOT USED !!!)</a> ";
echo "<li><a href='".CONF_MODULE_ARG."&op=admin&admin_op=makePhotosNew'>Migrate to new Photos table (NOT USED !!!)</a> ";
echo "<hr>";
echo "<li><a href='".CONF_MODULE_ARG."&op=admin&admin_op=convertTakeoffs'>Convert takeoffs from iso to utf8</a> ";
echo "</ul>";

echo "<h3>Sync Log oparations</h3>";
Expand Down Expand Up @@ -131,6 +133,64 @@ function chmodDir($dir){
deleteFiles(dirname(__FILE__)."/flights",0,".json.js");
} else if ($admin_op=="cleanOldJSfiles") {
deleteFiles(dirname(__FILE__)."/flights",0,".1.js");
} else if ($admin_op=="convertTakeoffs") {
$res= $db->sql_query('SET NAMES latin1');
// $query="SELECT * from $waypointsTable WHERE countryCode='RU'";
$query="SELECT * from $waypointsTable order By countryCode ";

//$query=" UPDATE leonardo_waypoints SET name='Schwand', intName='Schwand', lat='47.0142', lon='-8.58312', type='1000', countryCode='CH', location='Brunnen', intLocation='Brunnen', link='http://paragliding.ch/index.php?id=129', description='Startplatz Schwand: 47° 00' 50'' N,8° 35' 05'' O 1250m Bisenstartplatz. In 15 minutigem Fussmarsch zu erreichen ab Bergstation. Gute Soaring Moglichkeiten bei Bise und Nordwind. Flug nach Seewen oder zuruck zur Talstation. Um zur Talstation zu fliegen nach dem Start rechts dem Hang entlang fliegen und vor der Hochspannungsleitung rechts ins Lee fliegen. Das zuruckfliegen im Lee ist bei nicht allzu starkem Wind kein Problem. ', modifyDate='2007-01-24' WHERE ID=9265";
$res= $db->sql_query($query);
//echo "#$res#";
//return;
echo "<pre>";
while ($row = mysql_fetch_assoc($res)) {
$convertInAction=0;
$sqlStr=" UPDATE $waypointsTable SET ";
$orgValues="# UPDATE $waypointsTable SET ";

$enc=$langEncodings[ countryCodeToLanguage($row['countryCode']) ];
if (!$enc) $enc='iso-8859-1';

// $orgValues.=" [$enc] ";
// echo "ecn: $enc <BR>";
foreach($row as $varName=>$varVal ) {

$varVal=str_replace("\r\n",'',trim($varVal));
$varVal=str_replace("\n",'',trim($varVal));
// $varVal=htmlspecialchars($varVal,ENT_QUOTES,"UTF-8");
//$varVal=str_replace('&amp;','&',$varVal);
// $varVal=str_replace('&quot;','"',$varVal);
//$varVal=str_replace('&lt;','<',$varVal);
//$varVal=str_replace('&gt;','>',$varVal);
// $varVal=prep_for_DB($varVal);


$varValUtf8=iconv($enc,'utf8',$varVal);
if ($varValUtf8!=$varVal) $convertInAction=1;

// $varValUtf8=str_replace("\r\n",'<br>',trim($varValUtf8));
// $varValUtf8=str_replace("\n",'<br>',trim($varValUtf8));

$varValUtf8=htmlspecialchars($varValUtf8,ENT_QUOTES,"UTF-8");
// $varValUtf8=str_replace('&amp;','&',$varValUtf8);
$varValUtf8=str_replace('&quot;','"',$varValUtf8);
$varValUtf8=str_replace('&lt;','<',$varValUtf8);
$varValUtf8=str_replace('&gt;','>',$varValUtf8);

if ($varName!='ID') {
$sqlStr.=" $varName='".$varValUtf8."',";
$orgValues.=" $varName='$varVal',";
}
}
$sqlStr=substr($sqlStr,0,-1);
$orgValues=substr($orgValues,0,-1);
$sqlStr.=" WHERE ID=".$row['ID'];
$orgValues.=" WHERE ID=".$row['ID'];
//if ($convertInAction || $row['ID']==9265) echo "$orgValues\n$sqlStr;\n#\n";
if ($convertInAction ) echo "$orgValues\n$sqlStr;\n#\n";
}
echo "</pre>";

} else if ($admin_op=="fixTakeoffNames") {
$ar1=array('name'=>'intName','intName'=>'name','location'=>'intLocation','intLocation'=>'location');
foreach ($ar1 as $n1=>$n2){
Expand Down
100 changes: 100 additions & 0 deletions doc/install/sql/convert_flights_to_utf8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
CREATE TABLE leonardo_flights_new (
ID bigint(20) unsigned NOT NULL auto_increment,
serverID smallint(5) unsigned NOT NULL default '0',
originalURL varchar(255) NOT NULL default '',
originalKML varchar(255) NOT NULL,
original_ID mediumint(8) unsigned NOT NULL default '0',
cat smallint(5) unsigned NOT NULL default '1',
subcat smallint(5) unsigned NOT NULL default '1',
category smallint(5) unsigned NOT NULL default '2',
active smallint(6) NOT NULL default '0',
dateAdded datetime NOT NULL default '0000-00-00 00:00:00',
timesViewed mediumint(9) NOT NULL default '0',
userID mediumint(8) unsigned NOT NULL default '0',
originalUserID mediumint(8) unsigned NOT NULL default '0',
userServerID mediumint(8) unsigned NOT NULL default '0',
filename varchar(200) NOT NULL default '',
place varchar(100) NOT NULL default '',
glider varchar(50) NOT NULL default '',
gliderBrandID smallint(5) unsigned NOT NULL default '0',
comments text NOT NULL,
linkURL varchar(200) NOT NULL default '',
hasPhotos tinyint(3) unsigned NOT NULL default '0',
photo1Filename varchar(150) NOT NULL default '',
photo2Filename varchar(150) NOT NULL default '',
photo3Filename varchar(150) NOT NULL default '',
photo4Filename varchar(150) NOT NULL default '',
photo5Filename varchar(150) NOT NULL default '',
photo6Filename varchar(150) NOT NULL default '',
takeoffID mediumint(9) NOT NULL default '0',
takeoffVinicity float NOT NULL default '0',
landingID mediumint(9) NOT NULL default '0',
landingVinicity float NOT NULL default '0',
`DATE` date NOT NULL default '0000-00-00',
timezone float NOT NULL default '0',
MAX_SPEED float NOT NULL default '0',
MEAN_SPEED float NOT NULL default '0',
MAX_ALT int(11) NOT NULL default '0',
MIN_ALT int(11) NOT NULL default '0',
TAKEOFF_ALT int(11) NOT NULL default '0',
MAX_VARIO float NOT NULL default '0',
MIN_VARIO float NOT NULL default '0',
LINEAR_DISTANCE bigint(20) NOT NULL default '0',
MAX_LINEAR_DISTANCE bigint(20) NOT NULL default '0',
START_TIME mediumint(9) NOT NULL default '0',
END_TIME mediumint(9) NOT NULL default '0',
DURATION mediumint(9) NOT NULL default '0',
BEST_FLIGHT_TYPE varchar(30) NOT NULL default '',
FLIGHT_KM float NOT NULL default '0',
FLIGHT_POINTS float NOT NULL default '0',
autoScore float NOT NULL default '0',
isLive tinyint(3) unsigned NOT NULL default '0',
externalFlightType tinyint(3) unsigned NOT NULL default '0',
forceBounds tinyint(3) unsigned NOT NULL default '0',
firstPointTM int(10) unsigned NOT NULL default '0',
firstLat float NOT NULL,
firstLon float NOT NULL,
lastPointTM int(10) unsigned NOT NULL default '0',
lastLat float NOT NULL,
lastLon float NOT NULL,
FIRST_POINT varchar(50) NOT NULL default '',
LAST_POINT varchar(50) NOT NULL default '',
turnpoint1 varchar(100) NOT NULL default '',
turnpoint2 varchar(100) NOT NULL default '',
turnpoint3 varchar(100) NOT NULL default '',
turnpoint4 varchar(100) NOT NULL default '',
turnpoint5 varchar(100) NOT NULL default '',
olcRefNum varchar(30) NOT NULL default '',
olcFilename varchar(12) NOT NULL default '',
olcDateSubmited datetime NOT NULL default '0000-00-00 00:00:00',
private tinyint(3) unsigned NOT NULL default '0',
gpsTrack tinyint(3) unsigned NOT NULL default '1',
grecord smallint(6) NOT NULL default '0',
validated smallint(6) NOT NULL default '0',
validationMessage text NOT NULL,
airspaceCheck tinyint(4) NOT NULL default '0',
airspaceCheckFinal tinyint(4) NOT NULL default '0',
airspaceCheckMsg text NOT NULL,
checkedBy varchar(100) NOT NULL default '',
NACid int(10) unsigned NOT NULL default '0',
NACclubID bigint(20) NOT NULL default '0',
`hash` varchar(100) NOT NULL default '',
batchOpProcessed tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (ID),
KEY userID (userID),
KEY takeoffID (takeoffID),
KEY takeoffID_2 (takeoffID),
KEY NACClubIndex (NACclubID,NACid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

INSERT INTO `leonardo_flights_new`
SELECT *
FROM `leonardo_flights` ;


ALTER TABLE `leonardo_flights` RENAME `leonardo_flights_iso` ;

ALTER TABLE `leonardo_flights_new` RENAME `leonardo_flights` ;



68 changes: 68 additions & 0 deletions doc/install/sql/convert_pilots_to_utf8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
CREATE TABLE leonardo_pilots_new (
`pilotID` bigint( 20 ) NOT NULL default '0',
`serverID` smallint( 5 ) unsigned NOT NULL default '0',
`countryCode` char( 2 ) NOT NULL default '',
`CIVL_ID` mediumint( 8 ) unsigned NOT NULL default '0',
`NACid` int( 10 ) unsigned NOT NULL default '0',
`NACmemberID` bigint( 20 ) unsigned NOT NULL default '0',
`NACclubID` bigint( 20 ) NOT NULL default '0',
`olcBirthDate` varchar( 8 ) NOT NULL default '',
`olcFirstName` varchar( 100 ) NOT NULL default '',
`olcLastName` varchar( 100 ) NOT NULL default '',
`olcCallSign` varchar( 50 ) NOT NULL default '',
`olcFilenameSuffix` varchar( 4 ) NOT NULL default '',
`olcAutoSubmit` tinyint( 4 ) NOT NULL default '0',
`FirstName` varchar( 40 ) NOT NULL default '',
`LastName` varchar( 50 ) NOT NULL default '',
`clubID` mediumint( 8 ) unsigned NOT NULL default '0',
`sponsor` varchar( 255 ) default NULL ,
`Sex` varchar( 6 ) NOT NULL default '',
`Birthdate` varchar( 15 ) NOT NULL default '',
`BirthdateHideMask` varchar( 10 ) NOT NULL default 'xx.xx.xxxx',
`Occupation` varchar( 100 ) NOT NULL default '',
`MartialStatus` varchar( 20 ) NOT NULL default '',
`OtherInterests` longtext NOT NULL ,
`PersonalWebPage` varchar( 150 ) NOT NULL default '',
`PilotLicence` varchar( 100 ) NOT NULL default '',
`BestMemory` longtext NOT NULL ,
`WorstMemory` longtext NOT NULL ,
`Training` varchar( 200 ) NOT NULL default '',
`personalDistance` varchar( 150 ) NOT NULL default '',
`personalHeight` varchar( 150 ) NOT NULL default '',
`glider` varchar( 200 ) NOT NULL default '',
`FlyingSince` varchar( 100 ) NOT NULL default '',
`HoursFlown` varchar( 50 ) NOT NULL default '',
`HoursPerYear` varchar( 50 ) NOT NULL default '',
`FavoriteLocation` varchar( 250 ) NOT NULL default '',
`UsualLocation` varchar( 150 ) NOT NULL default '',
`FavoriteBooks` varchar( 150 ) NOT NULL default '',
`FavoriteActors` varchar( 150 ) NOT NULL default '',
`FavoriteSingers` varchar( 150 ) NOT NULL default '',
`FavoriteMovies` varchar( 150 ) NOT NULL default '',
`FavoriteSite` varchar( 150 ) NOT NULL default '',
`Sign` varchar( 40 ) NOT NULL default '',
`Spiral` varchar( 60 ) NOT NULL default '',
`Bline` varchar( 100 ) NOT NULL default '',
`FullStall` varchar( 100 ) NOT NULL default '',
`Sat` varchar( 100 ) NOT NULL default '',
`AsymmetricSpiral` varchar( 100 ) NOT NULL default '',
`Spin` varchar( 100 ) NOT NULL default '',
`OtherAcro` varchar( 150 ) NOT NULL default '',
`camera` varchar( 150 ) NOT NULL default '',
`camcorder` varchar( 150 ) NOT NULL default '',
`Vario` varchar( 60 ) NOT NULL default '',
`GPS` varchar( 60 ) NOT NULL default '',
`Harness` varchar( 60 ) NOT NULL default '',
`Reserve` varchar( 60 ) NOT NULL default '',
`Helmet` varchar( 60 ) NOT NULL default '',
`PilotPhoto` varchar( 30 ) NOT NULL default '',
`FirstOlcYear` int( 10 ) NOT NULL default '0',
PRIMARY KEY ( `pilotID` , `serverID` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 ;

INSERT INTO `leonardo_pilots_new` SELECT * FROM `leonardo_pilots` ;


ALTER TABLE `leonardo_pilots` RENAME `leonardo_pilots_iso` ;

ALTER TABLE `leonardo_pilots_new` RENAME `leonardo_pilots` ;
22 changes: 22 additions & 0 deletions doc/install/sql/convert_waypoints_to_utf8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE `leonardo_waypoints_new` (
`ID` mediumint( 9 ) NOT NULL AUTO_INCREMENT ,
`name` varchar( 100 ) NOT NULL default '',
`intName` varchar( 100 ) NOT NULL default '',
`lat` float NOT NULL default '0',
`lon` float NOT NULL default '0',
`type` int( 11 ) NOT NULL default '0',
`countryCode` varchar( 10 ) NOT NULL default 'GR',
`location` varchar( 100 ) NOT NULL default '',
`intLocation` varchar( 100 ) NOT NULL default '',
`link` varchar( 255 ) NOT NULL default '',
`description` text NOT NULL ,
`modifyDate` date NOT NULL default '2005-09-01',
PRIMARY KEY ( `ID` ) ,
KEY `lat` ( `lat` , `lon` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 ;

INSERT INTO `leonardo_waypoints_new` SELECT * FROM `leonardo_waypoints` ;

ALTER TABLE `leonardo_waypoints` RENAME `leonardo_waypoints_iso` ;

ALTER TABLE `leonardo_waypoints_new` RENAME `leonardo_waypoints` ;
4 changes: 3 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ function leo_getmicrotime() {
require_once dirname(__FILE__)."/templates/".$PREFS->themeName."/theme.php";

// if we use utf
if ($CONF_use_utf) $db->sql_query("SET NAMES utf8");
if ($CONF_use_utf) {
$db->sql_query("SET NAMES utf8");
}

$pagetitle = _PAGE_TITLE;

Expand Down

0 comments on commit 88551f7

Please sign in to comment.