WordPress.org

Plugin Directory

Changeset 576472


Ignore:
Timestamp:
07/24/12 06:34:01 (21 months ago)
Author:
SteveAtty
Message:

Version 2.7 fixes non home directory installs

Location:
canalplan-ac
Files:
19 edited
16 copied

Legend:

Unmodified
Added
Removed
  • canalplan-ac/tags/2.7/admin-pages/cp-admin-diagnostics.php

    r537712 r576472  
    2828    $fopenstat="file_get_contents is available "; 
    2929$x=CANALPLAN_URL.'api.cgi?mode=version ';  
     30$mtime = microtime();  
     31$mtime = explode(' ', $mtime);  
     32$mtime = $mtime[1] + $mtime[0];  
     33$starttime = $mtime;  
    3034$fcheck=file_get_contents($x); 
     35$mtime = microtime();  
     36$mtime = explode(" ", $mtime);  
     37$mtime = $mtime[1] + $mtime[0];  
     38$endtime = $mtime;  
     39$totaltime = ($endtime - $starttime); 
    3140$cp_version=json_decode($fcheck,true); 
    3241$fopenstat2=' but cannot access Canalplan - This is a problem '; 
    33 if (strlen($cp_version['version'])>3) {$fopenstat2='and can acccess the Canalplan Website - All is OK';} 
     42if (strlen($cp_version['version'])>3) {$fopenstat2='and can acccess the Canalplan Website - All is OK ( <i> Response Time was : '.$totaltime.' seconds </i> )';} 
    3443} 
    3544 
     
    6978    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$plug_info[$name]['Title']." ( ".$plug_info[$name]['Version']." ) <br />";} 
    7079    } 
     80    echo "</b></p>"; 
     81        echo "</b><br /><li> Canalplan Table Status :</li><b>"; 
     82    $table_array= array (CANALPLAN_OPTIONS,CANALPLAN_ALIASES,CANALPLAN_CODES,CANALPLAN_FAVOURITES,CANALPLAN_LINK,CANALPLAN_CANALS,CANALPLAN_ROUTES,CANALPLAN_POLYLINES,CANALPLAN_ROUTE_DAY); 
     83    foreach ($table_array as $table) { 
     84        $sql="select count(*) from ".$table; 
     85        $result=@mysql_query($sql); 
     86        if (!$result) 
     87    { 
     88    $tstat_string= sprintf("ERROR : table </b>'%s'<b> is missing ! - Please Deactivate and Re-activate the plugin from the Plugin Options Page", $table); 
     89    } 
     90    else {   
     91    $row=mysql_fetch_row($result); 
     92    $tstat_string= sprintf("&nbsp;&nbsp;&nbsp;Table </b>'%s'<b> is present and contains %s rows", $table,$row[0]); 
     93     } 
     94    echo "&nbsp;&nbsp;&nbsp;".$tstat_string."<br />"; 
     95    } 
    7196    echo "</b></p><br /><br />"; 
     97     
     98     
    7299    _e('For feature requests, bug reports, and general support :'); ?> 
    73     <ul>     
     100    <p><ul>  
    74101    <li><?php _e('Check the '); ?><a href="../wp-content/plugins/canalplan/canalplan_ac_user_guide.pdf" target="wordpress"><?php _e('User Guide'); ?></a>.</li> 
    75102    <li><?php _e('Check the '); ?><a href="http://wordpress.org/extend/plugins/canalplan-ac/other_notes/" target="wordpress"><?php _e('WordPress.org Notes'); ?></a>.</li> 
    76103    <li><?php _e('Consider upgrading to the '); ?><a href="http://wordpress.org/download/"><?php _e('latest stable release'); ?></a> <?php _e(' of WordPress. '); ?></li> 
    77  
    78     </ul> 
     104    </ul></p> 
    79105    <br /> 
    80106     </b><br /><hr><h3>Donate</h3> 
     
    84110        <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
    85111        <input type="hidden" name="cmd" value="_s-xclick"> 
    86         <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBS1CS6j8gSPzUcHkKZ5UYKF2n97UX8EhSB+QgoExXlfJWLo6S7MJFvuzay0RhJNefA9Y1Jkz8UQahqaR7SuIDBkz0Ys4Mfx6opshuXQqxp17YbZ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BhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA5MTAyODE0MzM1OVowIwYJKoZIhvcNAQkEMRYEFIf+6qkVI7LG/jPumIrQXIOhI4hJMA0GCSqGSIb3DQEBAQUABIGAdpAB4Mj4JkQ6K44Xxp4Da3GsRCeiLr2LMqrAgzF8jYGgV9zjf7PXxpC8XJTVC7L7oKDtoW442T9ntYj6RM/hSjmRO2iaJq0CAZkz2sPZWvGlnhYrpEB/XB3dhmd2nGhUMSXbtQzZvR7JMVoPR0zxL/X/Hfj6c+uF7BxW8xTSBqw=-----END PKCS7-----"> 
    87115        <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> 
    88116        <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> 
  • canalplan-ac/tags/2.7/admin-pages/cp-admin-fav.php

    r556895 r576472  
    2323} 
    2424?> 
    25 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
    26 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
    27 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js"></script> 
     25<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
     26<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
     27<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js"></script> 
    2828<script language="JavaScript" type="text/javascript"> 
    2929 
  • canalplan-ac/tags/2.7/admin-pages/cp-admin-general.php

    r572306 r576472  
    1313global $blog_id; 
    1414echo '<script type="text/javascript"> var linktype=1; cplogid='.$blog_id.'</script>'; 
    15 echo '<script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
     15echo '<script type="text/javascript" src="'.site_url().'/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
    1616nocache_headers();  
    1717 
     
    9595    $res = mysql_query($sql); 
    9696    $res2=mysql_fetch_array($res); 
    97     $handle=fopen("http://www.canalplan.org.uk/data/stable_canal.sqlite","rb"); 
     97        $params = array( 
     98            'redirection' => 0, 
     99            'httpversion' => '1.1', 
     100            'timeout' => 60, 
     101            'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) . ';canalplan-' . CANALPLAN_CODE_RELEASE ), 
     102            'headers' => array( 'Expect:' ), 
     103            'sslverify' => false 
     104    ); 
     105    //$response = wp_remote_get(CANALPLAN_BASE."/data/canalplan_wp.sqlite" ,$params); 
     106    //var_dump($response['body']); 
     107    $handle=fopen("http://www.canalplan.org.uk/data/canalplan_wp.sqlite","rb"); 
    98108    $handle2=fopen("../wp-content/uploads/canalplan_data.sqlite","w"); 
    99109    $contents = ''; 
     
    125135    foreach ($result as $entry) { 
    126136       $sql= "INSERT INTO ".CANALPLAN_CODES." (canalplan_id,place_name,size,lat,`long`,attributes,lat_lng_point) VALUES ('".$entry['id']."','".mysql_real_escape_string($entry['name'])."','".$entry['type']."','".$entry['latitude']."','".$entry['longitude']."','".$entry['attributes']."', GeomFromText('Point(".$entry['latitude']." ".$entry['longitude'].")')) ON DUPLICATE KEY UPDATE place_name='".mysql_real_escape_string($entry['name'])."', size='".$entry['type']."', lat='".$entry['latitude']."', `long`='".$entry['longitude']."', attributes='".$entry['attributes']."', lat_lng_point=GeomFromText('Point(".$entry['latitude']." ".$entry['longitude'].")'); "; 
    127     #var_dump($sql); 
    128 #   echo "<br />"; 
    129137       $res = mysql_query($sql); 
    130138    } 
     
    199207      $updated=$rw['age']/(3600*24); 
    200208} 
    201  
     209// Un comment the following line to force Canalplan to think it's data is rather old 
     210//$updated=22; 
    202211if ($updated> 14 && $do_update==0) { 
    203212    echo "CanalPlan data was last updated over two weeks ago so its probably very out of date. Click on the button to refresh it"; 
     
    216225if ($do_update!="no button"){ 
    217226?> 
     227<p> This may take several minutes to complete... please be patient</p> 
    218228<form action="" name="data_update" id="data_update" method="post"> 
    219229<p class="submit"> <input type="submit"  value="<?php echo $do_update;?>" /></p> 
     
    278288}  
    279289 
    280 $url=get_bloginfo('url'); 
     290$url=get_home_url(); 
    281291$sname=get_bloginfo('name'); 
    282292if (strlen($api)<4) { 
     
    286296    $api=$cp_register['key']; 
    287297    $uid=$cp_register['id']; 
    288     echo "<br/>API Key has been set to : <i> ".$api." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br/>'; 
     298    echo "<br/>API Key has been set to : <i> ".$api." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br />'; 
    289299    echo '<p class="submit"> <input type="submit" name="SCK"  value="Save Canalplan Key" /></p>'; 
    290300} 
     
    292302else { 
    293303$api=explode("|",$api); 
    294 echo "<br/>API Key currently set to : <i> ".$api[0]." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br/>'; 
     304echo "<br/>API Key currently set to : <i> ".$api[0]." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br />'; 
    295305echo '<p class="submit"><input type="submit" name="RCK" value="Reset Canalplan Key" /></p>'; 
    296306} 
     
    327337if ($routeslug=="UNDEFINED!") { echo " <b> currently not defined </b> so please set one";} else { 
    328338 
    329 echo "'". $routeslug."' so you need to make sure that <a href='".get_option("siteurl")."/".$routeslug."'>".get_option("siteurl")."/".$routeslug."</a> exists"; 
     339echo "'". $routeslug."' so you need to make sure that <a href='".get_home_url()."/".$routeslug."'>".get_home_url()."/".$routeslug."</a> exists"; 
    330340}} 
    331341else {  
     
    333343The Site Administrator has set the page slug for blogged routes to be  ' 
    334344<?php 
    335 echo CANALPLAN_ROUTE_SLUG."' so you need to make sure that <a href='".get_option("siteurl")."/".CANALPLAN_ROUTE_SLUG."'>".get_option("siteurl")."/".CANALPLAN_ROUTE_SLUG."</a> exists "; 
     345echo CANALPLAN_ROUTE_SLUG."' so you need to make sure that <a href='".get_home_url()."/".CANALPLAN_ROUTE_SLUG."'>".get_home_url()."/".CANALPLAN_ROUTE_SLUG."</a> exists "; 
    336346} 
    337347 
  • canalplan-ac/tags/2.7/admin-pages/cp-admin-google.php

    r537712 r576472  
    2020settings_fields('canalplan_options'); 
    2121$canalplan_options = get_option('canalplan_options'); 
     22$checked_flag=array('on'=>'checked','off'=>''); 
    2223if (!isset($canalplan_options['canalplan_pm_type'])) { 
    2324    $canalplan_options["canalplan_pm_type"]='H'; 
     
    102103echo "</select> pixels <br />"; 
    103104 
     105echo "<h3>Other Map Options</h3>"; 
    104106 
    105 echo '<br /><input type="submit" name="SBLO" value="'.__("Save Google Map Options", 'canalplan').'" class="button-primary"  />&nbsp;&nbsp;&nbsp;<input type="submit" name="RSD" value="'.__("Reset to System Defaults", 'wordbooker').'" class="button-primary" action="poo" /</p></form><br /></div><hr>'; 
     107echo '<label for="cp_gmap_disable">'.__('Disable Google Map API load', 'canalplan').' :</label>'; 
     108echo '<INPUT TYPE=CHECKBOX NAME="canalplan_options[supress_google]" '.$checked_flag[$canalplan_options["supress_google"]].' ><br />'; 
     109 
     110 
     111echo '<br /><input type="submit" name="SBLO" value="'.__("Save Google Map Options", 'canalplan').'" class="button-primary"  />&nbsp;&nbsp;&nbsp;<input type="submit" name="RSD" value="'.__("Reset to System Defaults", 'wordbooker').'" class="button-primary" action="poo" /</p></form>'; 
    106112?> 
  • canalplan-ac/tags/2.7/admin-pages/cp-admin-home.php

    r556895 r576472  
    2525} 
    2626?> 
    27 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
    28 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
    29 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script> 
     27<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
     28<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
     29<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script> 
    3030<script language="JavaScript" type="text/javascript"><!-- 
    3131 
  • canalplan-ac/tags/2.7/admin-pages/cp-admin-menu.php

    r572306 r576472  
    1616 
    1717<h2><?php _e('CanalPlan AC Integration Overview') ?> </h2> 
    18 This plugin allows you to integrate your blog with <a href="http://www.canalplan.eu">Canalplan AC</a> 
     18This plugin allows you to integrate your blog with <a href="<?php echo CANALPLAN_BASE; ?>">Canalplan AC</a> 
    1919 
    2020<p><a href="?page=canalplan-ac/admin-pages/cp-admin-general.php"> General Options </a> <br /> 
    21 This sets up various general options for the Canalplan plugin such as the Canalplan API Key and GoogleMaps API Key</p> 
     21This sets up various general options for the Canalplan plugin such as the Distance Format and your Canalplan AC link code</p> 
    2222<p><a href="?page=canalplan-ac/admin-pages/cp-admin-home.php"> Home Mooring </a><br /> 
    2323This allows you to set your home mooring location and give it a customised name </p> 
  • canalplan-ac/tags/2.7/admin-pages/cp-import_route.php

    r572306 r576472  
    1414nocache_headers(); 
    1515?> 
    16 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/calendar.js"></script> 
     16 
     17<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/calendar.js"></script> 
    1718<?php 
    1819if(isset($_POST['_submit_check'])) 
     
    5152$cptable='places'; 
    5253$geturl=CANALPLAN_URL."api.cgi?session=".$cpsessionid."&mode=table&table=".$cptable; 
    53 #print $geturl; 
    5454$handle = fopen (CANALPLAN_URL."api.cgi?session=".$cpsessionid."&mode=table&table=".$cptable , 'r'); 
    5555        while (($data = fgets($handle)) !== FALSE) 
     
    105105 
    106106# for Durations we need to load the value of jdata['value'] into jdata['name'] 
    107 $handle = fopen (CANALPLAN_URL."api.cgi?session=".$cpsession."&mode=table&table=".$cptable , 'r'); 
     107$url=CANALPLAN_URL."api.cgi?session=".$cpsession."&mode=table&table=".$cptable; 
     108$handle = fopen ($url , 'r'); 
    108109        while (($data = fgets($handle)) !== FALSE) 
    109110        { 
     
    284285} 
    285286 
    286 print "<br><br>Draft Posts created. You can now go and <a href='/wp-admin/edit.php'>edit</a> the posts or <a href='admin.php?page=canalplan/admin-pages/cp-manage_route.php'>change the daily subtotals</a>"; 
     287print "<br><br>Draft Posts created. You can now go and <a href='/wp-admin/edit.php'>edit</a> the posts or <a href='?page=canalplan-ac/admin-pages/cp-manage_route.php'>change the daily subtotals</a>"; 
    287288break; 
    288289} 
  • canalplan-ac/tags/2.7/admin-pages/cp-manage_route.php

    r409641 r576472  
    268268 
    269269} else { 
    270 print "You don't seem to have any routes to manage. Please <a href='admin.php?page=canalplan/admin-pages/cp-import_route.php'>import</a> a route first"; 
    271 } 
    272 } 
    273 ?> 
     270print "You don't seem to have any routes to manage. Please <a href='?page=canalplan-ac/admin-pages/cp-import_route.php'>import</a> a route first"; 
     271} 
     272} 
     273?> 
  • canalplan-ac/tags/2.7/canalplan.php

    r572306 r576472  
    44Plugin URI: http://blogs.canalplan.org.uk/canalplanac/canalplan-plug-in/ 
    55Description: Provides features to integrate your blog with <a href="http://www.canalplan.eu">Canalplan AC</a> - the Canal Route Planner. 
    6 Version: 2.6 
     6Version: 2.7 
    77Author: Steve Atty 
    88Author URI: http://blogs.canalplan.org.uk/steve/ 
     
    2626*/ 
    2727@include("multisite.php"); 
    28 define ('CANALPLAN_URL','http://www.canalplan.eu/cgi-bin/'); 
    29 define ('CANALPLAN_GAZ_URL','http://www.canalplan.eu/gazetteer/'); 
     28define ('CANALPLAN_BASE','http://www.canalplan.org.uk'); 
     29define ('CANALPLAN_URL',CANALPLAN_BASE.'/cgi-bin/'); 
     30define ('CANALPLAN_GAZ_URL',CANALPLAN_BASE.'/gazetteer/'); 
    3031define ('CANALPLAN_MAX_POST_PROCESS',20); 
    31 define('CANALPLAN_CODE_RELEASE','2.6.0 r00'); 
     32define('CANALPLAN_CODE_RELEASE','2.7 r00'); 
    3233 
    3334global $table_prefix, $wp_version,$wpdb,$db_prefix; 
     
    144145    global $wpdb,$blog_id; 
    145146    echo '<script type="text/javascript"> var linktype=1; cplogid='.$blog_id.'</script>'; 
    146     echo '<script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
    147     echo '<script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script>'; 
     147    echo '<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
     148    echo '<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script>'; 
    148149    echo "Insert : "; 
    149150    $blog_favourites = $wpdb->get_results("SELECT place_name FROM ".CANALPLAN_FAVOURITES." where blog_id=$blog_id order by place_order asc" ); 
     
    169170    add_filter('the_content',  'canal_link_maps'); 
    170171    add_filter('the_content',  'canal_linkify'); 
     172    add_filter('the_excerpt',  'canal_stats'); 
     173    add_filter('the_excerpt',  'canal_route_maps'); 
     174    add_filter('the_excerpt',  'canal_place_maps'); 
     175    add_filter('the_excerpt',  'canal_link_maps'); 
     176    add_filter('the_excerpt',  'canal_linkify'); 
    171177    global $dogooglemap; 
    172178    $dogooglemap=0; 
     
    182188        if (isset($post_id)) {} else {$post_id=$post->ID; 
    183189        if (isset($post->blog_id)) {$mapblog_id=$post->blog_id;}} 
    184     if ( get_query_var('feed') || $search=='Y' )  { 
     190    if ( get_query_var('feed') || $search=='Y' || is_feed() )  { 
    185191        $names = array(); 
    186192        $links = array(); 
     
    196202    $canalplan_options = get_option('canalplan_options'); 
    197203    $post_id=$post->ID; 
     204    // if (!isset($post_id)) {return;} 
    198205    $sql="select distance,`locks`,start_id,end_id from ".CANALPLAN_ROUTE_DAY." where blog_id=".$mapblog_id." and  post_id=".$post_id; 
    199206    $res = mysql_query($sql); 
    200207    $row = mysql_fetch_array($res); 
    201208    $sql="select totalroute from ".CANALPLAN_ROUTES." cpr, ".CANALPLAN_ROUTE_DAY." crd where cpr.route_id= crd.route_id and cpr.blog_id=crd.blog_id and crd.blog_id=".$mapblog_id." and  crd.post_id=".$post_id; 
    202     $res3 = mysql_query($sql); 
     209    $res3 = mysql_query($sql) or trigger_error('Query failed: ' . $sql, E_USER_ERROR); 
    203210    $mid_point=round(mysql_num_rows($res3)/2,PHP_ROUND_HALF_UP); 
    204211    $place_count=0; 
     
    322329    if (count($places_array)==0) {return $content;} 
    323330    $canalplan_options = get_option('canalplan_options'); 
    324     if ( get_query_var('feed') || $search=='Y' )  { 
     331    if ( get_query_var('feed') || $search=='Y' || is_feed() )  { 
    325332        $names = array(); 
    326333        $links = array(); 
     
    422429        $links = array(); 
    423430        global $dogooglemap,$wpdb,$post,$google_map_code; 
    424         if ( get_query_var('feed')) { 
     431        if ( get_query_var('feed') || is_feed()) { 
    425432            foreach ($places_array as $place_code) { 
    426433            $words=split("\|",$place_code); 
     
    471478    if (isset($post_id)) {} else {$post_id=$post->ID; 
    472479    if (isset($post->blog_id)) {$mapblog_id=$post->blog_id;}} 
     480    if (!isset($post_id)) {return;} 
    473481    $sql="select distance,`locks`,start_id,end_id from ".CANALPLAN_ROUTE_DAY." where blog_id=".$mapblog_id." and  post_id=".$post_id; 
    474     $res = mysql_query($sql); 
     482    $res = mysql_query($sql) ; 
    475483    $row = mysql_fetch_array($res); 
    476484    $sql="select totalroute,uom from ".CANALPLAN_ROUTES." cpr, ".CANALPLAN_ROUTE_DAY." crd where cpr.route_id= crd.route_id and cpr.blog_id=crd.blog_id and crd.blog_id=".$mapblog_id." and  crd.post_id=".$post_id; 
     
    496504        $links[] = "From [[CP:".$start_name."|".$places[$row[start_id]]."]] to [[CP:".$end_name."|".$places[$row[end_id]]."]], ".format_distance($row[distance],$row[locks],$dformat,2); 
    497505    } 
     506     
    498507    return str_ireplace($names, $links, $content); 
    499508} 
     
    601610        $blroute .="<ol>"; 
    602611        while ($row = mysql_fetch_array($res)) { 
    603             if ($wpdb->blogid==1) {$blroute .='<li><a href='.get_blog_option($row[blog_id],"siteurl").'/'.$routeslug.'/'.$row[route_id].' target=\"_new\">'.$row[title].'</a> ( from '. get_blog_option($row[blog_id],'blogname').' )  </li>'; 
     612            if ($wpdb->blogid==1) {$blroute .='<li><a href='.get_blog_option($row[blog_id],"siteurl").'/'.$routeslug.'/?routeid='.$row[route_id].' target=\"_new\">'.$row[title].'</a> ( from '. get_blog_option($row[blog_id],'blogname').' )  </li>'; 
    604613            } 
    605614            else 
     
    743752function canalplan_header($blah){ 
    744753    global $blog_id,$wpdb,$google_map_code; 
     754    $canalplan_options = get_option('canalplan_options'); 
     755    if (isset($canalplan_options['supress_google'])) {return;} 
    745756    $header = '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="//maps.google.com/maps/api/js?libraries=geometry&amp;sensor=false"> </script> ';  
    746757    echo $header; 
     
    754765    echo $google_map_code; 
    755766    echo "\n<!-- Canalplan AC code revision : ".CANALPLAN_CODE_RELEASE." -->\n"; 
     767    $canalplan_options = get_option('canalplan_options'); 
     768    if (isset($canalplan_options['supress_google'])) {return;} 
    756769    #echo "<p style='font-size:0%'>Canalplan Interlinking provided by <a href='http://wordpress.org/extend/plugins/canalplan-ac/'> Canalplan AC Plugin </a></p>"; 
    757770    echo "<script type='text/javascript'> google.maps.event.addDomListener(window, 'load', initialize); </script> "; 
     
    918931add_action('activated_plugin','save_error'); 
    919932add_filter('the_content','blogroute_insert'); 
     933add_filter('the_excerpt','blogroute_insert'); 
    920934add_action('wp_head', 'canalplan_header'); 
    921935add_action('wp_footer', 'canalplan_footer'); 
  • canalplan-ac/tags/2.7/canalplan/PolylineEncoder.js

    r408484 r576472  
    55// auxiliary functions. Documentation at 
    66// http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.html 
    7 // 
    8 // Google map reference including encoded polylines: 
    9 //   http://www.google.com/apis/maps/documentation/ 
    10 // 
    11 // Details on the algorithm used here: 
    12 //   http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/ 
    13 // 
    14 // Constructor: 
    15 //   polylineEncoder = new PolylineEncoder(numLevels,  
    16 //     zoomFactor, verySmall, forceEndpoints?); 
    17 // where numLevels and zoomFactor indicate how many  
    18 // different levels of magnification the polyline has 
    19 // and the change in magnification between those levels, 
    20 // verySmall indicates the length of a barely visible  
    21 // object at the highest zoom level, forceEndpoints  
    22 // indicates whether or not the  endpoints should be  
    23 // visible at all zoom levels.  forceEndpoints is  
    24 // optional with a default value of true.  Probably  
    25 // should stay true regardless. 
    26 //  
    27 // Main methods: 
    28 // * PolylineEncoder.dpEncodeToPolyline(points,  
    29 //     color?, weight?, opacity?) 
    30 // Accepts an array of latLng objects (see below) and 
    31 // optional style specifications.  Returns an encoded  
    32 // polyline that may be directly overlayed on a Google  
    33 // Map.  Requires that the Google Maps API be loaded. 
    34 // 
    35 // * PolylineEncoder.dpEncodeToPolygon(pointsArray,  
    36 //     boundaryColor?, boundaryWeight?, boundaryOpacity?, 
    37 //     fillColor?, fillOpacity?, fill?, outline?) 
    38 // Accepts an array of arrays latLng objects and 
    39 // optional style specifications.  Returns an encoded  
    40 // polylgon that may be directly overlayed on a Google  
    41 // Map.  Requires that the Google Maps API be loaded. 
    42 // 
    43 // 
    44 // Convenience classes and methods: 
    45 // * PolylineEncoder.latLng 
    46 // Constructor: 
    47 //   myLatLng = new PolylineEncoder.latLng(y,x); 
    48 // The dpEncode* functions expect points in the 
    49 // form of an object with lat and lng methods.  A 
    50 // GLatLng as defined by the Google Maps API does  
    51 // quite nicely.  If you're developing a javascript 
    52 // without loading the API, however, you can use 
    53 // a PolylineEncoder.latLng for this purpose. 
    54 // // 
    55 // PolylineEncoder.pointsToLatLngs 
    56 // Sometimes your points are defined in terms of an 
    57 // array of arrays, rather than an array of latLngs. 
    58 // PolylineEncoder.pointsToLatLngs converts to an array 
    59 // of arrays to an array of latLngs for use by the 
    60 // dpEncode functions. 
    61 // // 
    62 // PolylineEncoder.pointsToGLatLngs 
    63 // PolylineEncoder.pointsToGLatLngs is analagous to the  
    64 // previous function, but it returns GLatLngs rather 
    65 // than PolylineEncoder.latLngs.  The first function may 
    66 // be used independently of Google Maps.  Use the second, 
    67 // if you need to use the result in a Goole Map function. 
    68 // 
    69 // 
    70 // Lower level methods 
    71 // PolylineEncoder.dpEncodeToJSON(points,  
    72 //     color?, weight?, opacity?) 
    73 // Returns a legal argument to GPolyline.fromEncoded. 
    74 // // 
    75 // PolylineEncoder.dpEncode(points); 
    76 // This is where the real work is done.  The return value 
    77 // is a JSON object with properties named  encodedLevels, 
    78 // encdodedPoints and encodedPointsLiteral. These are 
    79 // strings which are acceptable input to the points and 
    80 // levels properties of the GPolyline.fromEncoded 
    81 // function. The encodedPoints string should be used for 
    82 // maps generated dynamically, while the 
    83 // encodedPointsLiteral string should be copied into a 
    84 // static document. 
    85 //  
    86 // The standard disclaimers, such as "use at your own risk,  
    87 // since I really don't have any idea what I'm doing," apply.  
    88  
    89 // The constructor 
     7 
    908PolylineEncoder = function(numLevels, zoomFactor, verySmall, forceEndpoints) { 
    919  var i; 
     
    11230} 
    11331 
    114 // The main function.  Essentially the Douglas-Peucker 
    115 // algorithm, adapted for encoding. Rather than simply 
    116 // eliminating points, we record their distance from the 
    117 // segment which occurs at that recursive step.  These 
    118 // distances are then easily converted to zoom levels. 
     32 
    11933PolylineEncoder.prototype.dpEncode = function(points) { 
    12034  var absMaxDist = 0; 
     
    237151} 
    238152 
    239 // distance(p0, p1, p2) computes the distance between the point p0 
    240 // and the segment [p1,p2].  This could probably be replaced with 
    241 // something that is a bit more numerically stable. 
    242153PolylineEncoder.prototype.distance = function(p0, p1, p2) { 
    243154  var u, out; 
     
    264175} 
    265176 
    266 // The createEncodings function is very similar to Google's 
    267 // http://www.google.com/apis/maps/documentation/polyline.js 
    268 // The key difference is that not all points are encoded,  
    269 // since some were eliminated by Douglas-Peucker. 
    270177PolylineEncoder.prototype.createEncodings = function(points, dists) { 
    271178  var i, dlat, dlng; 
     
    292199} 
    293200 
    294 // This computes the appropriate zoom level of a point in terms of it's  
    295 // distance from the relevant segment in the DP algorithm.  Could be done 
    296 // in terms of a logarithm, but this approach makes it a bit easier to 
    297 // ensure that the level is not too large. 
    298201PolylineEncoder.prototype.computeLevel = function(dd) { 
    299202  var lev; 
     
    307210} 
    308211 
    309 // Now we can use the previous function to march down the list 
    310 // of points and encode the levels.  Like createEncodings, we 
    311 // ignore points whose distance (in dists) is undefined. 
    312212PolylineEncoder.prototype.encodeLevels = function(points, dists, absMaxDist) { 
    313213  var i; 
     
    334234} 
    335235 
    336 // This function is very similar to Google's, but I added 
    337 // some stuff to deal with the double slash issue. 
     236 
    338237PolylineEncoder.prototype.encodeNumber = function(num) { 
    339238  var encodeString = ""; 
     
    341240  while (num >= 0x20) { 
    342241    nextValue = (0x20 | (num & 0x1f)) + 63; 
    343 //     if (nextValue == 92) { 
    344 //       encodeString += (String.fromCharCode(nextValue)); 
    345 //     } 
     242 
    346243    encodeString += (String.fromCharCode(nextValue)); 
    347244    num >>= 5; 
    348245  } 
    349246  finalValue = num + 63; 
    350 //   if (finalValue == 92) { 
    351 //     encodeString += (String.fromCharCode(finalValue)); 
    352 //   } 
     247 
    353248  encodeString += (String.fromCharCode(finalValue)); 
    354249  return encodeString; 
     
    365260 
    366261 
    367 // The remaining code defines a few convenience utilities. 
    368 // PolylineEncoder.latLng 
    369262PolylineEncoder.latLng = function(y, x) { 
    370263    this.y = y; 
     
    378271} 
    379272 
    380 // PolylineEncoder.pointsToLatLngs 
     273 
    381274PolylineEncoder.pointsToLatLngs = function(points) { 
    382275    var i, latLngs; 
     
    388281} 
    389282 
    390 // PolylineEncoder.pointsToGLatLngs 
     283 
    391284PolylineEncoder.pointsToGLatLngs = function(points) { 
    392285    var i, gLatLngs; 
  • canalplan-ac/tags/2.7/canalplan/canalplan.php

    r566813 r576472  
    11<?php 
     2require_once( '../../../../wp-config.php'); 
     3global $wpdb,$user_ID; 
    24 
     5if (strlen($_GET['match'])>0){ 
     6$match=mysql_real_escape_string($_GET['match']); 
    37 
    4 require("../../../../wp-config.php"); 
    5 if ($cp_blog_id=="undefined") {unset($cp_blog_id);} 
    6 if (strlen($match)>0){ 
    7 $match=mysql_real_escape_string($_GET['match']); 
    8 $place=mysql_real_escape_string(_GET['place']); 
    98$cp_blog_id=mysql_real_escape_string($_GET['blogid']); 
    10  
    119$sql="set names 'utf8';"; 
    1210$zed = mysql_query($sql); 
     
    2422 
    2523} 
     24$place=mysql_real_escape_string($_GET['place']); 
    2625if (strlen($place)>0){ 
    2726$place=trim(urldecode($place)); 
     27$cp_blog_id=mysql_real_escape_string($_GET['blogid']); 
     28if ($cp_blog_id=="undefined") {unset($cp_blog_id);} 
    2829// If we have a blog_id passed in then we need to get back the favourites and then the main rows but remove any common names 
    2930  if (isset($cp_blog_id)) { 
  • canalplan-ac/tags/2.7/canalplan/canalplan_actb.js

    r556895 r576472  
    1 /* 20 Aug 2006: This started off as canalplan_actb.js from 
    2 http://www.codeproject.com/jscript/jscanalplan_actb.asp. 
    3  
    4 But it didn't work without the addEvent stuff that was in the demo page.  Web 
    5 browsing suggests that this widely distributed stuff is from another source. 
    6 There is a warning about it at quirksmode, but I think I should be immune from 
    7 it.  So that was added at the top. 
    8  
    9 Then I hacked in a hook to do server lookups.  This is the code that uses my 
    10 new canalplan_actb_lastdownload variable. 
    11  
    12 Then I wrote the download code.  This is a combination of the demo at 
    13 http://www.w3schools.com/xml/tryit.asp?filename=try_xmlhttprequest_js1 
    14 (although modified to move the state change function into a closure) and the 
    15 "explode" function from http://textsnippets.com/ 
    16  
    17 This makes it a huge bag of code with mixed copyrights.  I'm comfortable 
    18 saying that the creative commons license that applies to the original canalplan_actb 
    19 code can be taken as applying to this derivative work, but if you wanted to 
    20 use this in something that costs real money, you'd better check with your 
    21 lawyers 
    22  
    23 1 Sept 2006 - I noticed a mountain of errors from the Firefox CSS Parser. 
    24 Changing the "=" to ":" in canalplan_actb_hStyle prevented this, and made the 
    25 highlighted part bold as well! 
    26  
    27 1 Sept 2006 - added a default of "sans-serif" to the "arial narrow" font 
    28 family, for those of us who don't have arial. 
    29  
    30 4 Nov 2006 - made "tab" leave the box without selection: much more how I'd 
    31 like it to work 
    32  
    33 August 2008 - changed the format to work better with names coming from SQL 
    34  
    35 April 2009 - fixed (in a messy way) a bug where the top element didn't 
    36 show in some browsers 
    37  
    38 June 2009 - Added UTF8 accented character folding - so each entry has 
    39 a "disp"lay and a "match" version 
    40 */ 
    411 
    422function addEvent(obj,event_name,func_name){ 
     
    745705      }; 
    746706 
    747       xmlhttp.open("GET","/wp-content/plugins/canalplan-ac/canalplan/canalplan.php?match="+t,true) 
     707      xmlhttp.open("GET","../wp-content/plugins/canalplan-ac/canalplan/canalplan.php?match="+t,true) 
    748708      xmlhttp.send(null) 
    749709    } 
  • canalplan-ac/tags/2.7/canalplan/canalplanfunctions.js

    r556895 r576472  
    1313if (xmlhttp!=null) 
    1414  { 
    15   xmlhttp.open("GET","/wp-content/plugins/canalplan-ac/canalplan/canalplan.php?place="+t+"&blogid="+bid,false) 
     15  xmlhttp.open("GET","../wp-content/plugins/canalplan-ac/canalplan/canalplan.php?place="+t+"&blogid="+bid,false) 
    1616  xmlhttp.send(false) 
    1717  xxx=xmlhttp.responseText.replace("\n",""); 
  • canalplan-ac/tags/2.7/canalplan/epoly.js

    r408484 r576472  
    1 /*********************************************************************\ 
    2 *                                                                     * 
    3 * epolys.js                                          by Mike Williams * 
    4 *                                                                     * 
    5 * A Google Maps API Extension                                         * 
    6 *                                                                     * 
    7 * Adds various Methods to GPolygon and GPolyline                      * 
    8 *                                                                     * 
    9 * .Contains(latlng) returns true is the poly contains the specified   * 
    10 *                   GLatLng                                           * 
    11 *                                                                     * 
    12 * .Area()           returns the approximate area of a poly that is    * 
    13 *                   not self-intersecting                             * 
    14 *                                                                     * 
    15 * .Distance()       returns the length of the poly path               * 
    16 *                                                                     * 
    17 * .Bounds()         returns a GLatLngBounds that bounds the poly      * 
    18 *                                                                     * 
    19 *********************************************************************** 
    20 *                                                                     * 
    21 * Version 1.0       8-May-2007                                        * 
    22 *                                                                     * 
    23 \*********************************************************************/ 
    24  
    25  
    26 // === A method for testing if a point is inside a polygon 
    27 // === Returns true if poly contains point 
    28 // === Algorithm shamelessly stolen from http://alienryderflex.com/polygon/  
    291GPolygon.prototype.Contains = function(point) { 
    302  var j=0; 
  • canalplan-ac/tags/2.7/canalplan_widget.php

    r537853 r576472  
    2727        $userid=$instance['snorl']; 
    2828        // Display the widget! 
     29        echo $before_widget; 
    2930        echo "<!--Canalplan Latitude Start -->\n"; 
    3031        echo $before_title; 
     
    3233        echo $after_title; 
    3334        echo "<div align='center'>"; 
    34         $params = '?user=-'.$instance['google'].'&type=iframe&maptype='.$instance['mf'].'&z='.$instance['zl']; 
     35        $params = '?user='.$instance['google'].'&type=iframe&maptype='.$instance['mf'].'&z='.$instance['zl']; 
    3536        echo "<!-- Google Public Location Badge -->\n"; 
    36         echo "<iframe src=\"http://www.google.com/latitude/apps/badge/api".$params."\" width=\"".$instance['width']."\" height=\"".$instance['height']."\" frameborder=\"0\" >\n"; 
    37         echo "</iframe>\n"; 
    38         $latfile='https://www.google.com/latitude/apps/badge/api?user=-'.$instance['google'].'&type=json'; 
     37        echo "<iframe src=\"http://www.google.com/latitude/apps/badge/api".$params."\" width=\"".$instance['width']."\" height=\"".$instance['height']."\" frameborder=\"0\" ALLOWTRANSPARENCY=\"true\" >\n"; 
     38        echo "</iframe>"; 
     39        $latfile='https://www.google.com/latitude/apps/badge/api?user='.$instance['google'].'&type=json'; 
    3940        $llines = file_get_contents($latfile); 
    4041        $lcontents=utf8_encode($llines); 
     
    4849        $gazstring='http://www.canalplan.org.uk/cgi-bin/gazetteer.cgi?where=$'; 
    4950        while($row=mysql_fetch_array($res)) { 
    50         print "<p>Nearest Canalplan location is : <br /> <a href='".$gazstring.$row['canalplan_id']."' target='_new' > ".$row['place_name']."</a> <br /></p></div>"; 
     51        print "Nearest Canalplan location is : <br /> <a href='".CANALPLAN_GAZ_URL.$row['canalplan_id']."' target='_new' > ".$row['place_name']."</a> <br /></div>"; 
    5152        } 
     53        echo "</p>".$after_widget; 
    5254    } 
    5355     
  • canalplan-ac/tags/2.7/readme.txt

    r572306 r576472  
    55Requires at least: 3.0 
    66Tested up to: 3.4.1 
    7 Stable tag: 2.6 
     7Stable tag: 2.7 
    88 
    99== Description == 
     
    5252 
    5353== Changelog == 
     54 
     55= Version 2.7 24/07/2012 = 
     56- Server work to reduce DB download size.  
     57- Recode data loader to use smaller fetch requests 
     58- Fixed a rogue 500 error in the place matching routine. 
     59- Changed all javascript urls to be relative rather than absolute to fix issue with running blog in a subdirectory 
     60- Changed Where Am I widget to need full Google ID (i.e including the -) rather than just assuming it. 
     61- Added before and after widget calls to the Widget so that it picks up theme formatting for widgets. 
     62- Changed more hard coded Canalplan URLs to use the constants defined in the main file. 
    5463 
    5564= Version 2.6 14/07/2012 = 
  • canalplan-ac/trunk/admin-pages/cp-admin-diagnostics.php

    r537712 r576472  
    2828    $fopenstat="file_get_contents is available "; 
    2929$x=CANALPLAN_URL.'api.cgi?mode=version ';  
     30$mtime = microtime();  
     31$mtime = explode(' ', $mtime);  
     32$mtime = $mtime[1] + $mtime[0];  
     33$starttime = $mtime;  
    3034$fcheck=file_get_contents($x); 
     35$mtime = microtime();  
     36$mtime = explode(" ", $mtime);  
     37$mtime = $mtime[1] + $mtime[0];  
     38$endtime = $mtime;  
     39$totaltime = ($endtime - $starttime); 
    3140$cp_version=json_decode($fcheck,true); 
    3241$fopenstat2=' but cannot access Canalplan - This is a problem '; 
    33 if (strlen($cp_version['version'])>3) {$fopenstat2='and can acccess the Canalplan Website - All is OK';} 
     42if (strlen($cp_version['version'])>3) {$fopenstat2='and can acccess the Canalplan Website - All is OK ( <i> Response Time was : '.$totaltime.' seconds </i> )';} 
    3443} 
    3544 
     
    6978    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$plug_info[$name]['Title']." ( ".$plug_info[$name]['Version']." ) <br />";} 
    7079    } 
     80    echo "</b></p>"; 
     81        echo "</b><br /><li> Canalplan Table Status :</li><b>"; 
     82    $table_array= array (CANALPLAN_OPTIONS,CANALPLAN_ALIASES,CANALPLAN_CODES,CANALPLAN_FAVOURITES,CANALPLAN_LINK,CANALPLAN_CANALS,CANALPLAN_ROUTES,CANALPLAN_POLYLINES,CANALPLAN_ROUTE_DAY); 
     83    foreach ($table_array as $table) { 
     84        $sql="select count(*) from ".$table; 
     85        $result=@mysql_query($sql); 
     86        if (!$result) 
     87    { 
     88    $tstat_string= sprintf("ERROR : table </b>'%s'<b> is missing ! - Please Deactivate and Re-activate the plugin from the Plugin Options Page", $table); 
     89    } 
     90    else {   
     91    $row=mysql_fetch_row($result); 
     92    $tstat_string= sprintf("&nbsp;&nbsp;&nbsp;Table </b>'%s'<b> is present and contains %s rows", $table,$row[0]); 
     93     } 
     94    echo "&nbsp;&nbsp;&nbsp;".$tstat_string."<br />"; 
     95    } 
    7196    echo "</b></p><br /><br />"; 
     97     
     98     
    7299    _e('For feature requests, bug reports, and general support :'); ?> 
    73     <ul>     
     100    <p><ul>  
    74101    <li><?php _e('Check the '); ?><a href="../wp-content/plugins/canalplan/canalplan_ac_user_guide.pdf" target="wordpress"><?php _e('User Guide'); ?></a>.</li> 
    75102    <li><?php _e('Check the '); ?><a href="http://wordpress.org/extend/plugins/canalplan-ac/other_notes/" target="wordpress"><?php _e('WordPress.org Notes'); ?></a>.</li> 
    76103    <li><?php _e('Consider upgrading to the '); ?><a href="http://wordpress.org/download/"><?php _e('latest stable release'); ?></a> <?php _e(' of WordPress. '); ?></li> 
    77  
    78     </ul> 
     104    </ul></p> 
    79105    <br /> 
    80106     </b><br /><hr><h3>Donate</h3> 
     
    84110        <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
    85111        <input type="hidden" name="cmd" value="_s-xclick"> 
    86         <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBS1CS6j8gSPzUcHkKZ5UYKF2n97UX8EhSB+QgoExXlfJWLo6S7MJFvuzay0RhJNefA9Y1Jkz8UQahqaR7SuIDBkz0Ys4Mfx6opshuXQqxp17YbZSUlO6zuzdJT4qBny2fNWqutEpXe6GkCopRuOHCvI/Ogxc0QHtIlHT5TKRfpejELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIitf6nEQBOsSAgZgWnlCfjf2E3Yekw5n9DQrNMDoUZTckFlqkQaLYLwnSYbtKanICptkU2fkRQ3T9tYFMhe1LhAuHVQmbVmZWtPb/djud5uZW6Lp5kREe7c01YtI5GRlK63cAF6kpxDL9JT2GH10Cojt9UF15OH46Q+2V3gu98d0Lad77PXz3V1XY0cto29buKZZRfGG8u9NfpXZjv1utEG2CP6CCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQ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IhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgT 
     114AkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA5MTAyODE0MzM1OVowIwYJKoZIhvcNAQkEMRYEFIf+6qkVI7LG/jPumIrQXIOhI4hJMA0GCSqGSIb3DQEBAQUABIGAdpAB4Mj4JkQ6K44Xxp4Da3GsRCeiLr2LMqrAgzF8jYGgV9zjf7PXxpC8XJTVC7L7oKDtoW442T9ntYj6RM/hSjmRO2iaJq0CAZkz2sPZWvGlnhYrpEB/XB3dhmd2nGhUMSXbtQzZvR7JMVoPR0zxL/X/Hfj6c+uF7BxW8xTSBqw=-----END PKCS7-----"> 
    87115        <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> 
    88116        <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> 
  • canalplan-ac/trunk/admin-pages/cp-admin-fav.php

    r556895 r576472  
    2323} 
    2424?> 
    25 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
    26 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
    27 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js"></script> 
     25<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
     26<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
     27<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js"></script> 
    2828<script language="JavaScript" type="text/javascript"> 
    2929 
  • canalplan-ac/trunk/admin-pages/cp-admin-general.php

    r572306 r576472  
    1313global $blog_id; 
    1414echo '<script type="text/javascript"> var linktype=1; cplogid='.$blog_id.'</script>'; 
    15 echo '<script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
     15echo '<script type="text/javascript" src="'.site_url().'/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
    1616nocache_headers();  
    1717 
     
    9595    $res = mysql_query($sql); 
    9696    $res2=mysql_fetch_array($res); 
    97     $handle=fopen("http://www.canalplan.org.uk/data/stable_canal.sqlite","rb"); 
     97        $params = array( 
     98            'redirection' => 0, 
     99            'httpversion' => '1.1', 
     100            'timeout' => 60, 
     101            'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) . ';canalplan-' . CANALPLAN_CODE_RELEASE ), 
     102            'headers' => array( 'Expect:' ), 
     103            'sslverify' => false 
     104    ); 
     105    //$response = wp_remote_get(CANALPLAN_BASE."/data/canalplan_wp.sqlite" ,$params); 
     106    //var_dump($response['body']); 
     107    $handle=fopen("http://www.canalplan.org.uk/data/canalplan_wp.sqlite","rb"); 
    98108    $handle2=fopen("../wp-content/uploads/canalplan_data.sqlite","w"); 
    99109    $contents = ''; 
     
    125135    foreach ($result as $entry) { 
    126136       $sql= "INSERT INTO ".CANALPLAN_CODES." (canalplan_id,place_name,size,lat,`long`,attributes,lat_lng_point) VALUES ('".$entry['id']."','".mysql_real_escape_string($entry['name'])."','".$entry['type']."','".$entry['latitude']."','".$entry['longitude']."','".$entry['attributes']."', GeomFromText('Point(".$entry['latitude']." ".$entry['longitude'].")')) ON DUPLICATE KEY UPDATE place_name='".mysql_real_escape_string($entry['name'])."', size='".$entry['type']."', lat='".$entry['latitude']."', `long`='".$entry['longitude']."', attributes='".$entry['attributes']."', lat_lng_point=GeomFromText('Point(".$entry['latitude']." ".$entry['longitude'].")'); "; 
    127     #var_dump($sql); 
    128 #   echo "<br />"; 
    129137       $res = mysql_query($sql); 
    130138    } 
     
    199207      $updated=$rw['age']/(3600*24); 
    200208} 
    201  
     209// Un comment the following line to force Canalplan to think it's data is rather old 
     210//$updated=22; 
    202211if ($updated> 14 && $do_update==0) { 
    203212    echo "CanalPlan data was last updated over two weeks ago so its probably very out of date. Click on the button to refresh it"; 
     
    216225if ($do_update!="no button"){ 
    217226?> 
     227<p> This may take several minutes to complete... please be patient</p> 
    218228<form action="" name="data_update" id="data_update" method="post"> 
    219229<p class="submit"> <input type="submit"  value="<?php echo $do_update;?>" /></p> 
     
    278288}  
    279289 
    280 $url=get_bloginfo('url'); 
     290$url=get_home_url(); 
    281291$sname=get_bloginfo('name'); 
    282292if (strlen($api)<4) { 
     
    286296    $api=$cp_register['key']; 
    287297    $uid=$cp_register['id']; 
    288     echo "<br/>API Key has been set to : <i> ".$api." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br/>'; 
     298    echo "<br/>API Key has been set to : <i> ".$api." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br />'; 
    289299    echo '<p class="submit"> <input type="submit" name="SCK"  value="Save Canalplan Key" /></p>'; 
    290300} 
     
    292302else { 
    293303$api=explode("|",$api); 
    294 echo "<br/>API Key currently set to : <i> ".$api[0]." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br/>'; 
     304echo "<br/>API Key currently set to : <i> ".$api[0]." </i> and is valid for the blog titled:<b> '".$sname."' </b> on the following url : <b> ".$url.'</b><br />'; 
    295305echo '<p class="submit"><input type="submit" name="RCK" value="Reset Canalplan Key" /></p>'; 
    296306} 
     
    327337if ($routeslug=="UNDEFINED!") { echo " <b> currently not defined </b> so please set one";} else { 
    328338 
    329 echo "'". $routeslug."' so you need to make sure that <a href='".get_option("siteurl")."/".$routeslug."'>".get_option("siteurl")."/".$routeslug."</a> exists"; 
     339echo "'". $routeslug."' so you need to make sure that <a href='".get_home_url()."/".$routeslug."'>".get_home_url()."/".$routeslug."</a> exists"; 
    330340}} 
    331341else {  
     
    333343The Site Administrator has set the page slug for blogged routes to be  ' 
    334344<?php 
    335 echo CANALPLAN_ROUTE_SLUG."' so you need to make sure that <a href='".get_option("siteurl")."/".CANALPLAN_ROUTE_SLUG."'>".get_option("siteurl")."/".CANALPLAN_ROUTE_SLUG."</a> exists "; 
     345echo CANALPLAN_ROUTE_SLUG."' so you need to make sure that <a href='".get_home_url()."/".CANALPLAN_ROUTE_SLUG."'>".get_home_url()."/".CANALPLAN_ROUTE_SLUG."</a> exists "; 
    336346} 
    337347 
  • canalplan-ac/trunk/admin-pages/cp-admin-google.php

    r537712 r576472  
    2020settings_fields('canalplan_options'); 
    2121$canalplan_options = get_option('canalplan_options'); 
     22$checked_flag=array('on'=>'checked','off'=>''); 
    2223if (!isset($canalplan_options['canalplan_pm_type'])) { 
    2324    $canalplan_options["canalplan_pm_type"]='H'; 
     
    102103echo "</select> pixels <br />"; 
    103104 
     105echo "<h3>Other Map Options</h3>"; 
    104106 
    105 echo '<br /><input type="submit" name="SBLO" value="'.__("Save Google Map Options", 'canalplan').'" class="button-primary"  />&nbsp;&nbsp;&nbsp;<input type="submit" name="RSD" value="'.__("Reset to System Defaults", 'wordbooker').'" class="button-primary" action="poo" /</p></form><br /></div><hr>'; 
     107echo '<label for="cp_gmap_disable">'.__('Disable Google Map API load', 'canalplan').' :</label>'; 
     108echo '<INPUT TYPE=CHECKBOX NAME="canalplan_options[supress_google]" '.$checked_flag[$canalplan_options["supress_google"]].' ><br />'; 
     109 
     110 
     111echo '<br /><input type="submit" name="SBLO" value="'.__("Save Google Map Options", 'canalplan').'" class="button-primary"  />&nbsp;&nbsp;&nbsp;<input type="submit" name="RSD" value="'.__("Reset to System Defaults", 'wordbooker').'" class="button-primary" action="poo" /</p></form>'; 
    106112?> 
  • canalplan-ac/trunk/admin-pages/cp-admin-home.php

    r556895 r576472  
    2525} 
    2626?> 
    27 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
    28 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
    29 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script> 
     27<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/plan.js"></script> 
     28<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script> 
     29<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script> 
    3030<script language="JavaScript" type="text/javascript"><!-- 
    3131 
  • canalplan-ac/trunk/admin-pages/cp-admin-menu.php

    r572306 r576472  
    1616 
    1717<h2><?php _e('CanalPlan AC Integration Overview') ?> </h2> 
    18 This plugin allows you to integrate your blog with <a href="http://www.canalplan.eu">Canalplan AC</a> 
     18This plugin allows you to integrate your blog with <a href="<?php echo CANALPLAN_BASE; ?>">Canalplan AC</a> 
    1919 
    2020<p><a href="?page=canalplan-ac/admin-pages/cp-admin-general.php"> General Options </a> <br /> 
    21 This sets up various general options for the Canalplan plugin such as the Canalplan API Key and GoogleMaps API Key</p> 
     21This sets up various general options for the Canalplan plugin such as the Distance Format and your Canalplan AC link code</p> 
    2222<p><a href="?page=canalplan-ac/admin-pages/cp-admin-home.php"> Home Mooring </a><br /> 
    2323This allows you to set your home mooring location and give it a customised name </p> 
  • canalplan-ac/trunk/admin-pages/cp-import_route.php

    r572306 r576472  
    1414nocache_headers(); 
    1515?> 
    16 <script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/calendar.js"></script> 
     16 
     17<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/calendar.js"></script> 
    1718<?php 
    1819if(isset($_POST['_submit_check'])) 
     
    5152$cptable='places'; 
    5253$geturl=CANALPLAN_URL."api.cgi?session=".$cpsessionid."&mode=table&table=".$cptable; 
    53 #print $geturl; 
    5454$handle = fopen (CANALPLAN_URL."api.cgi?session=".$cpsessionid."&mode=table&table=".$cptable , 'r'); 
    5555        while (($data = fgets($handle)) !== FALSE) 
     
    105105 
    106106# for Durations we need to load the value of jdata['value'] into jdata['name'] 
    107 $handle = fopen (CANALPLAN_URL."api.cgi?session=".$cpsession."&mode=table&table=".$cptable , 'r'); 
     107$url=CANALPLAN_URL."api.cgi?session=".$cpsession."&mode=table&table=".$cptable; 
     108$handle = fopen ($url , 'r'); 
    108109        while (($data = fgets($handle)) !== FALSE) 
    109110        { 
     
    284285} 
    285286 
    286 print "<br><br>Draft Posts created. You can now go and <a href='/wp-admin/edit.php'>edit</a> the posts or <a href='admin.php?page=canalplan/admin-pages/cp-manage_route.php'>change the daily subtotals</a>"; 
     287print "<br><br>Draft Posts created. You can now go and <a href='/wp-admin/edit.php'>edit</a> the posts or <a href='?page=canalplan-ac/admin-pages/cp-manage_route.php'>change the daily subtotals</a>"; 
    287288break; 
    288289} 
  • canalplan-ac/trunk/admin-pages/cp-manage_route.php

    r409641 r576472  
    268268 
    269269} else { 
    270 print "You don't seem to have any routes to manage. Please <a href='admin.php?page=canalplan/admin-pages/cp-import_route.php'>import</a> a route first"; 
    271 } 
    272 } 
    273 ?> 
     270print "You don't seem to have any routes to manage. Please <a href='?page=canalplan-ac/admin-pages/cp-import_route.php'>import</a> a route first"; 
     271} 
     272} 
     273?> 
  • canalplan-ac/trunk/canalplan.php

    r572306 r576472  
    44Plugin URI: http://blogs.canalplan.org.uk/canalplanac/canalplan-plug-in/ 
    55Description: Provides features to integrate your blog with <a href="http://www.canalplan.eu">Canalplan AC</a> - the Canal Route Planner. 
    6 Version: 2.6 
     6Version: 2.7 
    77Author: Steve Atty 
    88Author URI: http://blogs.canalplan.org.uk/steve/ 
     
    2626*/ 
    2727@include("multisite.php"); 
    28 define ('CANALPLAN_URL','http://www.canalplan.eu/cgi-bin/'); 
    29 define ('CANALPLAN_GAZ_URL','http://www.canalplan.eu/gazetteer/'); 
     28define ('CANALPLAN_BASE','http://www.canalplan.org.uk'); 
     29define ('CANALPLAN_URL',CANALPLAN_BASE.'/cgi-bin/'); 
     30define ('CANALPLAN_GAZ_URL',CANALPLAN_BASE.'/gazetteer/'); 
    3031define ('CANALPLAN_MAX_POST_PROCESS',20); 
    31 define('CANALPLAN_CODE_RELEASE','2.6.0 r00'); 
     32define('CANALPLAN_CODE_RELEASE','2.7 r00'); 
    3233 
    3334global $table_prefix, $wp_version,$wpdb,$db_prefix; 
     
    144145    global $wpdb,$blog_id; 
    145146    echo '<script type="text/javascript"> var linktype=1; cplogid='.$blog_id.'</script>'; 
    146     echo '<script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
    147     echo '<script type="text/javascript" src="/wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script>'; 
     147    echo '<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplanfunctions.js" DEFER></script>'; 
     148    echo '<script type="text/javascript" src="../wp-content/plugins/canalplan-ac/canalplan/canalplan_actb.js"></script>'; 
    148149    echo "Insert : "; 
    149150    $blog_favourites = $wpdb->get_results("SELECT place_name FROM ".CANALPLAN_FAVOURITES." where blog_id=$blog_id order by place_order asc" ); 
     
    169170    add_filter('the_content',  'canal_link_maps'); 
    170171    add_filter('the_content',  'canal_linkify'); 
     172    add_filter('the_excerpt',  'canal_stats'); 
     173    add_filter('the_excerpt',  'canal_route_maps'); 
     174    add_filter('the_excerpt',  'canal_place_maps'); 
     175    add_filter('the_excerpt',  'canal_link_maps'); 
     176    add_filter('the_excerpt',  'canal_linkify'); 
    171177    global $dogooglemap; 
    172178    $dogooglemap=0; 
     
    182188        if (isset($post_id)) {} else {$post_id=$post->ID; 
    183189        if (isset($post->blog_id)) {$mapblog_id=$post->blog_id;}} 
    184     if ( get_query_var('feed') || $search=='Y' )  { 
     190    if ( get_query_var('feed') || $search=='Y' || is_feed() )  { 
    185191        $names = array(); 
    186192        $links = array(); 
     
    196202    $canalplan_options = get_option('canalplan_options'); 
    197203    $post_id=$post->ID; 
     204    // if (!isset($post_id)) {return;} 
    198205    $sql="select distance,`locks`,start_id,end_id from ".CANALPLAN_ROUTE_DAY." where blog_id=".$mapblog_id." and  post_id=".$post_id; 
    199206    $res = mysql_query($sql); 
    200207    $row = mysql_fetch_array($res); 
    201208    $sql="select totalroute from ".CANALPLAN_ROUTES." cpr, ".CANALPLAN_ROUTE_DAY." crd where cpr.route_id= crd.route_id and cpr.blog_id=crd.blog_id and crd.blog_id=".$mapblog_id." and  crd.post_id=".$post_id; 
    202     $res3 = mysql_query($sql); 
     209    $res3 = mysql_query($sql) or trigger_error('Query failed: ' . $sql, E_USER_ERROR); 
    203210    $mid_point=round(mysql_num_rows($res3)/2,PHP_ROUND_HALF_UP); 
    204211    $place_count=0; 
     
    322329    if (count($places_array)==0) {return $content;} 
    323330    $canalplan_options = get_option('canalplan_options'); 
    324     if ( get_query_var('feed') || $search=='Y' )  { 
     331    if ( get_query_var('feed') || $search=='Y' || is_feed() )  { 
    325332        $names = array(); 
    326333        $links = array(); 
     
    422429        $links = array(); 
    423430        global $dogooglemap,$wpdb,$post,$google_map_code; 
    424         if ( get_query_var('feed')) { 
     431        if ( get_query_var('feed') || is_feed()) { 
    425432            foreach ($places_array as $place_code) { 
    426433            $words=split("\|",$place_code); 
     
    471478    if (isset($post_id)) {} else {$post_id=$post->ID; 
    472479    if (isset($post->blog_id)) {$mapblog_id=$post->blog_id;}} 
     480    if (!isset($post_id)) {return;} 
    473481    $sql="select distance,`locks`,start_id,end_id from ".CANALPLAN_ROUTE_DAY." where blog_id=".$mapblog_id." and  post_id=".$post_id; 
    474     $res = mysql_query($sql); 
     482    $res = mysql_query($sql) ; 
    475483    $row = mysql_fetch_array($res); 
    476484    $sql="select totalroute,uom from ".CANALPLAN_ROUTES." cpr, ".CANALPLAN_ROUTE_DAY." crd where cpr.route_id= crd.route_id and cpr.blog_id=crd.blog_id and crd.blog_id=".$mapblog_id." and  crd.post_id=".$post_id; 
     
    496504        $links[] = "From [[CP:".$start_name."|".$places[$row[start_id]]."]] to [[CP:".$end_name."|".$places[$row[end_id]]."]], ".format_distance($row[distance],$row[locks],$dformat,2); 
    497505    } 
     506     
    498507    return str_ireplace($names, $links, $content); 
    499508} 
     
    601610        $blroute .="<ol>"; 
    602611        while ($row = mysql_fetch_array($res)) { 
    603             if ($wpdb->blogid==1) {$blroute .='<li><a href='.get_blog_option($row[blog_id],"siteurl").'/'.$routeslug.'/'.$row[route_id].' target=\"_new\">'.$row[title].'</a> ( from '. get_blog_option($row[blog_id],'blogname').' )  </li>'; 
     612            if ($wpdb->blogid==1) {$blroute .='<li><a href='.get_blog_option($row[blog_id],"siteurl").'/'.$routeslug.'/?routeid='.$row[route_id].' target=\"_new\">'.$row[title].'</a> ( from '. get_blog_option($row[blog_id],'blogname').' )  </li>'; 
    604613            } 
    605614            else 
     
    743752function canalplan_header($blah){ 
    744753    global $blog_id,$wpdb,$google_map_code; 
     754    $canalplan_options = get_option('canalplan_options'); 
     755    if (isset($canalplan_options['supress_google'])) {return;} 
    745756    $header = '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="//maps.google.com/maps/api/js?libraries=geometry&amp;sensor=false"> </script> ';  
    746757    echo $header; 
     
    754765    echo $google_map_code; 
    755766    echo "\n<!-- Canalplan AC code revision : ".CANALPLAN_CODE_RELEASE." -->\n"; 
     767    $canalplan_options = get_option('canalplan_options'); 
     768    if (isset($canalplan_options['supress_google'])) {return;} 
    756769    #echo "<p style='font-size:0%'>Canalplan Interlinking provided by <a href='http://wordpress.org/extend/plugins/canalplan-ac/'> Canalplan AC Plugin </a></p>"; 
    757770    echo "<script type='text/javascript'> google.maps.event.addDomListener(window, 'load', initialize); </script> "; 
     
    918931add_action('activated_plugin','save_error'); 
    919932add_filter('the_content','blogroute_insert'); 
     933add_filter('the_excerpt','blogroute_insert'); 
    920934add_action('wp_head', 'canalplan_header'); 
    921935add_action('wp_footer', 'canalplan_footer'); 
  • canalplan-ac/trunk/canalplan/PolylineEncoder.js

    r408484 r576472  
    55// auxiliary functions. Documentation at 
    66// http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.html 
    7 // 
    8 // Google map reference including encoded polylines: 
    9 //   http://www.google.com/apis/maps/documentation/ 
    10 // 
    11 // Details on the algorithm used here: 
    12 //   http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/ 
    13 // 
    14 // Constructor: 
    15 //   polylineEncoder = new PolylineEncoder(numLevels,  
    16 //     zoomFactor, verySmall, forceEndpoints?); 
    17 // where numLevels and zoomFactor indicate how many  
    18 // different levels of magnification the polyline has 
    19 // and the change in magnification between those levels, 
    20 // verySmall indicates the length of a barely visible  
    21 // object at the highest zoom level, forceEndpoints  
    22 // indicates whether or not the  endpoints should be  
    23 // visible at all zoom levels.  forceEndpoints is  
    24 // optional with a default value of true.  Probably  
    25 // should stay true regardless. 
    26 //  
    27 // Main methods: 
    28 // * PolylineEncoder.dpEncodeToPolyline(points,  
    29 //     color?, weight?, opacity?) 
    30 // Accepts an array of latLng objects (see below) and 
    31 // optional style specifications.  Returns an encoded  
    32 // polyline that may be directly overlayed on a Google  
    33 // Map.  Requires that the Google Maps API be loaded. 
    34 // 
    35 // * PolylineEncoder.dpEncodeToPolygon(pointsArray,  
    36 //     boundaryColor?, boundaryWeight?, boundaryOpacity?, 
    37 //     fillColor?, fillOpacity?, fill?, outline?) 
    38 // Accepts an array of arrays latLng objects and 
    39 // optional style specifications.  Returns an encoded  
    40 // polylgon that may be directly overlayed on a Google  
    41 // Map.  Requires that the Google Maps API be loaded. 
    42 // 
    43 // 
    44 // Convenience classes and methods: 
    45 // * PolylineEncoder.latLng 
    46 // Constructor: 
    47 //   myLatLng = new PolylineEncoder.latLng(y,x); 
    48 // The dpEncode* functions expect points in the 
    49 // form of an object with lat and lng methods.  A 
    50 // GLatLng as defined by the Google Maps API does  
    51 // quite nicely.  If you're developing a javascript 
    52 // without loading the API, however, you can use 
    53 // a PolylineEncoder.latLng for this purpose. 
    54 // // 
    55 // PolylineEncoder.pointsToLatLngs 
    56 // Sometimes your points are defined in terms of an 
    57 // array of arrays, rather than an array of latLngs. 
    58 // PolylineEncoder.pointsToLatLngs converts to an array 
    59 // of arrays to an array of latLngs for use by the 
    60 // dpEncode functions. 
    61 // // 
    62 // PolylineEncoder.pointsToGLatLngs 
    63 // PolylineEncoder.pointsToGLatLngs is analagous to the  
    64 // previous function, but it returns GLatLngs rather 
    65 // than PolylineEncoder.latLngs.  The first function may 
    66 // be used independently of Google Maps.  Use the second, 
    67 // if you need to use the result in a Goole Map function. 
    68 // 
    69 // 
    70 // Lower level methods 
    71 // PolylineEncoder.dpEncodeToJSON(points,  
    72 //     color?, weight?, opacity?) 
    73 // Returns a legal argument to GPolyline.fromEncoded. 
    74 // // 
    75 // PolylineEncoder.dpEncode(points); 
    76 // This is where the real work is done.  The return value 
    77 // is a JSON object with properties named  encodedLevels, 
    78 // encdodedPoints and encodedPointsLiteral. These are 
    79 // strings which are acceptable input to the points and 
    80 // levels properties of the GPolyline.fromEncoded 
    81 // function. The encodedPoints string should be used for 
    82 // maps generated dynamically, while the 
    83 // encodedPointsLiteral string should be copied into a 
    84 // static document. 
    85 //  
    86 // The standard disclaimers, such as "use at your own risk,  
    87 // since I really don't have any idea what I'm doing," apply.  
    88  
    89 // The constructor 
     7 
    908PolylineEncoder = function(numLevels, zoomFactor, verySmall, forceEndpoints) { 
    919  var i; 
     
    11230} 
    11331 
    114 // The main function.  Essentially the Douglas-Peucker 
    115 // algorithm, adapted for encoding. Rather than simply 
    116 // eliminating points, we record their distance from the 
    117 // segment which occurs at that recursive step.  These 
    118 // distances are then easily converted to zoom levels. 
     32 
    11933PolylineEncoder.prototype.dpEncode = function(points) { 
    12034  var absMaxDist = 0; 
     
    237151} 
    238152 
    239 // distance(p0, p1, p2) computes the distance between the point p0 
    240 // and the segment [p1,p2].  This could probably be replaced with 
    241 // something that is a bit more numerically stable. 
    242153PolylineEncoder.prototype.distance = function(p0, p1, p2) { 
    243154  var u, out; 
     
    264175} 
    265176 
    266 // The createEncodings function is very similar to Google's 
    267 // http://www.google.com/apis/maps/documentation/polyline.js 
    268 // The key difference is that not all points are encoded,  
    269 // since some were eliminated by Douglas-Peucker. 
    270177PolylineEncoder.prototype.createEncodings = function(points, dists) { 
    271178  var i, dlat, dlng; 
     
    292199} 
    293200 
    294 // This computes the appropriate zoom level of a point in terms of it's  
    295 // distance from the relevant segment in the DP algorithm.  Could be done 
    296 // in terms of a logarithm, but this approach makes it a bit easier to 
    297 // ensure that the level is not too large. 
    298201PolylineEncoder.prototype.computeLevel = function(dd) { 
    299202  var lev; 
     
    307210} 
    308211 
    309 // Now we can use the previous function to march down the list 
    310 // of points and encode the levels.  Like createEncodings, we 
    311 // ignore points whose distance (in dists) is undefined. 
    312212PolylineEncoder.prototype.encodeLevels = function(points, dists, absMaxDist) { 
    313213  var i; 
     
    334234} 
    335235 
    336 // This function is very similar to Google's, but I added 
    337 // some stuff to deal with the double slash issue. 
     236 
    338237PolylineEncoder.prototype.encodeNumber = function(num) { 
    339238  var encodeString = ""; 
     
    341240  while (num >= 0x20) { 
    342241    nextValue = (0x20 | (num & 0x1f)) + 63; 
    343 //     if (nextValue == 92) { 
    344 //       encodeString += (String.fromCharCode(nextValue)); 
    345 //     } 
     242 
    346243    encodeString += (String.fromCharCode(nextValue)); 
    347244    num >>= 5; 
    348245  } 
    349246  finalValue = num + 63; 
    350 //   if (finalValue == 92) { 
    351 //     encodeString += (String.fromCharCode(finalValue)); 
    352 //   } 
     247 
    353248  encodeString += (String.fromCharCode(finalValue)); 
    354249  return encodeString; 
     
    365260 
    366261 
    367 // The remaining code defines a few convenience utilities. 
    368 // PolylineEncoder.latLng 
    369262PolylineEncoder.latLng = function(y, x) { 
    370263    this.y = y; 
     
    378271} 
    379272 
    380 // PolylineEncoder.pointsToLatLngs 
     273 
    381274PolylineEncoder.pointsToLatLngs = function(points) { 
    382275    var i, latLngs; 
     
    388281} 
    389282 
    390 // PolylineEncoder.pointsToGLatLngs 
     283 
    391284PolylineEncoder.pointsToGLatLngs = function(points) { 
    392285    var i, gLatLngs; 
  • canalplan-ac/trunk/canalplan/canalplan.php

    r566813 r576472  
    11<?php 
     2require_once( '../../../../wp-config.php'); 
     3global $wpdb,$user_ID; 
    24 
     5if (strlen($_GET['match'])>0){ 
     6$match=mysql_real_escape_string($_GET['match']); 
    37 
    4 require("../../../../wp-config.php"); 
    5 if ($cp_blog_id=="undefined") {unset($cp_blog_id);} 
    6 if (strlen($match)>0){ 
    7 $match=mysql_real_escape_string($_GET['match']); 
    8 $place=mysql_real_escape_string(_GET['place']); 
    98$cp_blog_id=mysql_real_escape_string($_GET['blogid']); 
    10  
    119$sql="set names 'utf8';"; 
    1210$zed = mysql_query($sql); 
     
    2422 
    2523} 
     24$place=mysql_real_escape_string($_GET['place']); 
    2625if (strlen($place)>0){ 
    2726$place=trim(urldecode($place)); 
     27$cp_blog_id=mysql_real_escape_string($_GET['blogid']); 
     28if ($cp_blog_id=="undefined") {unset($cp_blog_id);} 
    2829// If we have a blog_id passed in then we need to get back the favourites and then the main rows but remove any common names 
    2930  if (isset($cp_blog_id)) { 
  • canalplan-ac/trunk/canalplan/canalplan_actb.js

    r556895 r576472  
    1 /* 20 Aug 2006: This started off as canalplan_actb.js from 
    2 http://www.codeproject.com/jscript/jscanalplan_actb.asp. 
    3  
    4 But it didn't work without the addEvent stuff that was in the demo page.  Web 
    5 browsing suggests that this widely distributed stuff is from another source. 
    6 There is a warning about it at quirksmode, but I think I should be immune from 
    7 it.  So that was added at the top. 
    8  
    9 Then I hacked in a hook to do server lookups.  This is the code that uses my 
    10 new canalplan_actb_lastdownload variable. 
    11  
    12 Then I wrote the download code.  This is a combination of the demo at 
    13 http://www.w3schools.com/xml/tryit.asp?filename=try_xmlhttprequest_js1 
    14 (although modified to move the state change function into a closure) and the 
    15 "explode" function from http://textsnippets.com/ 
    16  
    17 This makes it a huge bag of code with mixed copyrights.  I'm comfortable 
    18 saying that the creative commons license that applies to the original canalplan_actb 
    19 code can be taken as applying to this derivative work, but if you wanted to 
    20 use this in something that costs real money, you'd better check with your 
    21 lawyers 
    22  
    23 1 Sept 2006 - I noticed a mountain of errors from the Firefox CSS Parser. 
    24 Changing the "=" to ":" in canalplan_actb_hStyle prevented this, and made the 
    25 highlighted part bold as well! 
    26  
    27 1 Sept 2006 - added a default of "sans-serif" to the "arial narrow" font 
    28 family, for those of us who don't have arial. 
    29  
    30 4 Nov 2006 - made "tab" leave the box without selection: much more how I'd 
    31 like it to work 
    32  
    33 August 2008 - changed the format to work better with names coming from SQL 
    34  
    35 April 2009 - fixed (in a messy way) a bug where the top element didn't 
    36 show in some browsers 
    37  
    38 June 2009 - Added UTF8 accented character folding - so each entry has 
    39 a "disp"lay and a "match" version 
    40 */ 
    411 
    422function addEvent(obj,event_name,func_name){ 
     
    745705      }; 
    746706 
    747       xmlhttp.open("GET","/wp-content/plugins/canalplan-ac/canalplan/canalplan.php?match="+t,true) 
     707      xmlhttp.open("GET","../wp-content/plugins/canalplan-ac/canalplan/canalplan.php?match="+t,true) 
    748708      xmlhttp.send(null) 
    749709    } 
  • canalplan-ac/trunk/canalplan/canalplanfunctions.js

    r556895 r576472  
    1313if (xmlhttp!=null) 
    1414  { 
    15   xmlhttp.open("GET","/wp-content/plugins/canalplan-ac/canalplan/canalplan.php?place="+t+"&blogid="+bid,false) 
     15  xmlhttp.open("GET","../wp-content/plugins/canalplan-ac/canalplan/canalplan.php?place="+t+"&blogid="+bid,false) 
    1616  xmlhttp.send(false) 
    1717  xxx=xmlhttp.responseText.replace("\n",""); 
  • canalplan-ac/trunk/canalplan/epoly.js

    r408484 r576472  
    1 /*********************************************************************\ 
    2 *                                                                     * 
    3 * epolys.js                                          by Mike Williams * 
    4 *                                                                     * 
    5 * A Google Maps API Extension                                         * 
    6 *                                                                     * 
    7 * Adds various Methods to GPolygon and GPolyline                      * 
    8 *                                                                     * 
    9 * .Contains(latlng) returns true is the poly contains the specified   * 
    10 *                   GLatLng                                           * 
    11 *                                                                     * 
    12 * .Area()           returns the approximate area of a poly that is    * 
    13 *                   not self-intersecting                             * 
    14 *                                                                     * 
    15 * .Distance()       returns the length of the poly path               * 
    16 *                                                                     * 
    17 * .Bounds()         returns a GLatLngBounds that bounds the poly      * 
    18 *                                                                     * 
    19 *********************************************************************** 
    20 *                                                                     * 
    21 * Version 1.0       8-May-2007                                        * 
    22 *                                                                     * 
    23 \*********************************************************************/ 
    24  
    25  
    26 // === A method for testing if a point is inside a polygon 
    27 // === Returns true if poly contains point 
    28 // === Algorithm shamelessly stolen from http://alienryderflex.com/polygon/  
    291GPolygon.prototype.Contains = function(point) { 
    302  var j=0; 
  • canalplan-ac/trunk/canalplan_widget.php

    r537853 r576472  
    2727        $userid=$instance['snorl']; 
    2828        // Display the widget! 
     29        echo $before_widget; 
    2930        echo "<!--Canalplan Latitude Start -->\n"; 
    3031        echo $before_title; 
     
    3233        echo $after_title; 
    3334        echo "<div align='center'>"; 
    34         $params = '?user=-'.$instance['google'].'&type=iframe&maptype='.$instance['mf'].'&z='.$instance['zl']; 
     35        $params = '?user='.$instance['google'].'&type=iframe&maptype='.$instance['mf'].'&z='.$instance['zl']; 
    3536        echo "<!-- Google Public Location Badge -->\n"; 
    36         echo "<iframe src=\"http://www.google.com/latitude/apps/badge/api".$params."\" width=\"".$instance['width']."\" height=\"".$instance['height']."\" frameborder=\"0\" >\n"; 
    37         echo "</iframe>\n"; 
    38         $latfile='https://www.google.com/latitude/apps/badge/api?user=-'.$instance['google'].'&type=json'; 
     37        echo "<iframe src=\"http://www.google.com/latitude/apps/badge/api".$params."\" width=\"".$instance['width']."\" height=\"".$instance['height']."\" frameborder=\"0\" ALLOWTRANSPARENCY=\"true\" >\n"; 
     38        echo "</iframe>"; 
     39        $latfile='https://www.google.com/latitude/apps/badge/api?user='.$instance['google'].'&type=json'; 
    3940        $llines = file_get_contents($latfile); 
    4041        $lcontents=utf8_encode($llines); 
     
    4849        $gazstring='http://www.canalplan.org.uk/cgi-bin/gazetteer.cgi?where=$'; 
    4950        while($row=mysql_fetch_array($res)) { 
    50         print "<p>Nearest Canalplan location is : <br /> <a href='".$gazstring.$row['canalplan_id']."' target='_new' > ".$row['place_name']."</a> <br /></p></div>"; 
     51        print "Nearest Canalplan location is : <br /> <a href='".CANALPLAN_GAZ_URL.$row['canalplan_id']."' target='_new' > ".$row['place_name']."</a> <br /></div>"; 
    5152        } 
     53        echo "</p>".$after_widget; 
    5254    } 
    5355     
  • canalplan-ac/trunk/readme.txt

    r572306 r576472  
    55Requires at least: 3.0 
    66Tested up to: 3.4.1 
    7 Stable tag: 2.6 
     7Stable tag: 2.7 
    88 
    99== Description == 
     
    5252 
    5353== Changelog == 
     54 
     55= Version 2.7 24/07/2012 = 
     56- Server work to reduce DB download size.  
     57- Recode data loader to use smaller fetch requests 
     58- Fixed a rogue 500 error in the place matching routine. 
     59- Changed all javascript urls to be relative rather than absolute to fix issue with running blog in a subdirectory 
     60- Changed Where Am I widget to need full Google ID (i.e including the -) rather than just assuming it. 
     61- Added before and after widget calls to the Widget so that it picks up theme formatting for widgets. 
     62- Changed more hard coded Canalplan URLs to use the constants defined in the main file. 
    5463 
    5564= Version 2.6 14/07/2012 = 
Note: See TracChangeset for help on using the changeset viewer.