Changeset 15919

Show
Ignore:
Timestamp:
04/01/08 17:47:00 (7 months ago)
Author:
rambo
Message:

scripted whitespace normalization

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom/services/dbclassloader.php

    r15908 r15919  
    620620        { 
    621621            midcom_baseclasses_core_dbobject::_clear_object(\$this); 
    622            /* FIXME: exception should be thrown to avoid kind of "ghost" objects on PHP level */ 
    623            /* throw new midgard_error_exception(\$e->getMessage()); */ 
     622        /* FIXME: exception should be thrown to avoid kind of "ghost" objects on PHP level */ 
     623        /* throw new midgard_error_exception(\$e->getMessage()); */ 
    624624        } 
    625625         
  • trunk/midcom/midcom.helper.datamanager2/static/tinymce/tiny_mce_gzip.php

    r15185 r15919  
    1111 */ 
    1212 
    13        // Set the error reporting to minimal. 
    14        @error_reporting(E_ERROR | E_WARNING | E_PARSE); 
     13    // Set the error reporting to minimal. 
     14    @error_reporting(E_ERROR | E_WARNING | E_PARSE); 
    1515 
    16        // Get input 
    17        $plugins = explode(',', getParam("plugins", "")); 
    18        $languages = explode(',', getParam("languages", "")); 
    19        $themes = explode(',', getParam("themes", "")); 
    20        $diskCache = getParam("diskcache", "") == "true"; 
    21        $isJS = getParam("js", "") == "true"; 
    22        $compress = getParam("compress", "true") == "true"; 
    23        $core = getParam("core", "true") == "true"; 
    24        $suffix = getParam("suffix", "_src") == "_src" ? "_src" : ""; 
    25        $cachePath = realpath("."); // Cache path, this is where the .gz files will be stored 
    26        $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache 
    27        $content = ""; 
    28        $encodings = array(); 
    29        $supportsGzip = false; 
    30        $enc = ""; 
    31        $cacheKey = ""; 
     16    // Get input 
     17    $plugins = explode(',', getParam("plugins", "")); 
     18    $languages = explode(',', getParam("languages", "")); 
     19    $themes = explode(',', getParam("themes", "")); 
     20    $diskCache = getParam("diskcache", "") == "true"; 
     21    $isJS = getParam("js", "") == "true"; 
     22    $compress = getParam("compress", "true") == "true"; 
     23    $core = getParam("core", "true") == "true"; 
     24    $suffix = getParam("suffix", "_src") == "_src" ? "_src" : ""; 
     25    $cachePath = realpath("."); // Cache path, this is where the .gz files will be stored 
     26    $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache 
     27    $content = ""; 
     28    $encodings = array(); 
     29    $supportsGzip = false; 
     30    $enc = ""; 
     31    $cacheKey = ""; 
    3232 
    33        // Custom extra javascripts to pack 
    34        $custom = array(/* 
    35                "some custom .js file", 
    36                "some custom .js file" 
    37        */); 
     33    // Custom extra javascripts to pack 
     34    $custom = array(/* 
     35        "some custom .js file", 
     36        "some custom .js file" 
     37    */); 
    3838 
    39        // Headers 
    40        header("Content-type: text/javascript"); 
    41        header("Vary: Accept-Encoding");  // Handle proxies 
    42        header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); 
     39    // Headers 
     40    header("Content-type: text/javascript"); 
     41    header("Vary: Accept-Encoding");  // Handle proxies 
     42    header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); 
    4343 
    44        // Is called directly then auto init with default settings 
    45        if (!$isJS) { 
    46                echo getFileContents("tiny_mce_gzip.js"); 
    47                echo "tinyMCE_GZ.init({});"; 
    48                die(); 
    49        
     44    // Is called directly then auto init with default settings 
     45    if (!$isJS) { 
     46        echo getFileContents("tiny_mce_gzip.js"); 
     47        echo "tinyMCE_GZ.init({});"; 
     48        die(); 
     49   
    5050 
    51        // Setup cache info 
    52        if ($diskCache) { 
    53                if (!$cachePath) 
    54                        die("alert('Real path failed.');"); 
     51    // Setup cache info 
     52    if ($diskCache) { 
     53        if (!$cachePath) 
     54            die("alert('Real path failed.');"); 
    5555 
    56                $cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix; 
     56        $cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix; 
    5757 
    58                foreach ($custom as $file) 
    59                        $cacheKey .= $file; 
     58        foreach ($custom as $file) 
     59            $cacheKey .= $file; 
    6060 
    61                $cacheKey = md5($cacheKey); 
     61        $cacheKey = md5($cacheKey); 
    6262 
    63                if ($compress) 
    64                        $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz"; 
    65                else 
    66                        $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js"; 
    67        
     63        if ($compress) 
     64            $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz"; 
     65        else 
     66            $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js"; 
     67   
    6868 
    69        // Check if it supports gzip 
    70        if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) 
    71                $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); 
     69    // Check if it supports gzip 
     70    if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) 
     71        $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); 
    7272 
    73        if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) { 
    74                $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; 
    75                $supportsGzip = true; 
    76        
     73    if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) { 
     74        $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; 
     75        $supportsGzip = true; 
     76   
    7777 
    78        // Use cached file disk cache 
    79        if ($diskCache && $supportsGzip && file_exists($cacheFile)) { 
    80                if ($compress) 
    81                        header("Content-Encoding: " . $enc); 
     78    // Use cached file disk cache 
     79    if ($diskCache && $supportsGzip && file_exists($cacheFile)) { 
     80        if ($compress) 
     81            header("Content-Encoding: " . $enc); 
    8282 
    83                echo getFileContents($cacheFile); 
    84                die(); 
    85        
     83        echo getFileContents($cacheFile); 
     84        die(); 
     85   
    8686 
    87        // Add core 
    88        if ($core == "true") { 
    89                $content .= getFileContents("tiny_mce" . $suffix . ".js"); 
     87    // Add core 
     88    if ($core == "true") { 
     89        $content .= getFileContents("tiny_mce" . $suffix . ".js"); 
    9090 
    91                // Patch loading functions 
    92                $content .= "tinyMCE_GZ.start();"; 
    93        
     91        // Patch loading functions 
     92        $content .= "tinyMCE_GZ.start();"; 
     93   
    9494 
    95        // Add core languages 
    96        foreach ($languages as $lang) 
    97                $content .= getFileContents("langs/" . $lang . ".js"); 
     95    // Add core languages 
     96    foreach ($languages as $lang) 
     97        $content .= getFileContents("langs/" . $lang . ".js"); 
    9898 
    99        // Add themes 
    100        foreach ($themes as $theme) { 
    101                $content .= getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js"); 
     99    // Add themes 
     100    foreach ($themes as $theme) { 
     101        $content .= getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js"); 
    102102 
    103                foreach ($languages as $lang) 
    104                        $content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js"); 
    105        
     103        foreach ($languages as $lang) 
     104            $content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js"); 
     105   
    106106 
    107        // Add plugins 
    108        foreach ($plugins as $plugin) { 
    109                $content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); 
     107    // Add plugins 
     108    foreach ($plugins as $plugin) { 
     109        $content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); 
    110110 
    111                foreach ($languages as $lang) 
    112                        $content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js"); 
    113        
     111        foreach ($languages as $lang) 
     112            $content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js"); 
     113   
    114114 
    115        // Add custom files 
    116        foreach ($custom as $file) 
    117                $content .= getFileContents($file); 
     115    // Add custom files 
     116    foreach ($custom as $file) 
     117        $content .= getFileContents($file); 
    118118 
    119        // Restore loading functions 
    120        if ($core == "true") 
    121                $content .= "tinyMCE_GZ.end();"; 
     119    // Restore loading functions 
     120    if ($core == "true") 
     121        $content .= "tinyMCE_GZ.end();"; 
    122122 
    123        // Generate GZIP'd content 
    124        if ($supportsGzip) { 
    125                if ($compress) { 
    126                        header("Content-Encoding: " . $enc); 
    127                        $cacheData = gzencode($content, 9, FORCE_GZIP); 
    128                } else 
    129                        $cacheData = $content; 
     123    // Generate GZIP'd content 
     124    if ($supportsGzip) { 
     125        if ($compress) { 
     126            header("Content-Encoding: " . $enc); 
     127            $cacheData = gzencode($content, 9, FORCE_GZIP); 
     128        } else 
     129            $cacheData = $content; 
    130130 
    131                // Write gz file 
    132                if ($diskCache && $cacheKey != "") 
    133                        putFileContents($cacheFile, $cacheData); 
     131        // Write gz file 
     132        if ($diskCache && $cacheKey != "") 
     133            putFileContents($cacheFile, $cacheData); 
    134134 
    135                // Stream to client 
    136                echo $cacheData; 
    137        } else { 
    138                // Stream uncompressed content 
    139                echo $content; 
    140        
     135        // Stream to client 
     136        echo $cacheData; 
     137    } else { 
     138        // Stream uncompressed content 
     139        echo $content; 
     140   
    141141 
    142        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
     142    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
    143143 
    144        function getParam($name, $def = false) { 
    145                if (!isset($_GET[$name])) 
    146                        return $def; 
     144    function getParam($name, $def = false) { 
     145        if (!isset($_GET[$name])) 
     146            return $def; 
    147147 
    148                return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_ 
    149        
     148        return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_ 
     149   
    150150 
    151        function getFileContents($path) { 
    152                $path = realpath($path); 
     151    function getFileContents($path) { 
     152        $path = realpath($path); 
    153153 
    154                if (!$path || !@is_file($path)) 
    155                        return ""; 
     154        if (!$path || !@is_file($path)) 
     155            return ""; 
    156156 
    157                if (function_exists("file_get_contents")) 
    158                        return @file_get_contents($path); 
     157        if (function_exists("file_get_contents")) 
     158            return @file_get_contents($path); 
    159159 
    160                $content = ""; 
    161                $fp = @fopen($path, "r"); 
    162                if (!$fp) 
    163                        return ""; 
     160        $content = ""; 
     161        $fp = @fopen($path, "r"); 
     162        if (!$fp) 
     163            return ""; 
    164164 
    165                while (!feof($fp)) 
    166                        $content .= fgets($fp); 
     165        while (!feof($fp)) 
     166            $content .= fgets($fp); 
    167167 
    168                fclose($fp); 
     168        fclose($fp); 
    169169 
    170                return $content; 
    171        
     170        return $content; 
     171   
    172172 
    173        function putFileContents($path, $content) { 
    174                if (function_exists("file_put_contents")) 
    175                        return @file_put_contents($path, $content); 
     173    function putFileContents($path, $content) { 
     174        if (function_exists("file_put_contents")) 
     175            return @file_put_contents($path, $content); 
    176176 
    177                $fp = @fopen($path, "wb"); 
    178                if ($fp) { 
    179                        fwrite($fp, $content); 
    180                        fclose($fp); 
    181                
    182        
     177        $fp = @fopen($path, "wb"); 
     178        if ($fp) { 
     179            fwrite($fp, $content); 
     180            fclose($fp); 
     181       
     182   
    183183?> 
  • trunk/midcom/midgard.admin.asgard/handler/object/manage.php

    r15909 r15919  
    779779                $_MIDCOM->relocate("__mfa/asgard/object/{$this->_request_data['default_mode']}/{$this->_object->guid}/{$data['language_code']}"); 
    780780                // This will exit. 
    781                case 'edit': 
     781            case 'edit': 
    782782                $qf =& $this->_controller->formmanager->form; 
    783783                if(isset($_REQUEST['midcom_helper_datamanager2_save']) && isset($qf->_errors)) 
  • trunk/midcom/midgard.admin.asgard/handler/type.php

    r15788 r15919  
    243243        if (isset($_GET['search'])) 
    244244        { 
    245            midgard_admin_asgard_plugin::get_default_mode(&$data); 
     245            midgard_admin_asgard_plugin::get_default_mode(&$data); 
    246246            $data['search_results'] = $this->_search($_GET['search']); 
    247247 
    248            //If there is exactly one result, go there directly 
     248            //If there is exactly one result, go there directly 
    249249            if (sizeof($data['search_results']) == 1) 
    250            { 
     250            { 
    251251                  $_MIDCOM->relocate('__mfa/asgard/object/' . $data['default_mode'] . '/' . $data['search_results'][0]->guid) . '/'; 
    252252                  //this will exit 
    253            } 
     253            } 
    254254            $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/jQuery/jquery.tablesorter.js'); 
    255255            $_MIDCOM->add_link_head 
  • trunk/midcom/midgard.admin.asgard/navigation.php

    r15797 r15919  
    247247            echo "<a href=\"{$_MIDGARD['self']}__mfa/asgard/object/{$this->_request_data['default_mode']}/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; 
    248248 
    249            /* If there is exactly one root object, show its children, since  
    250             * this is what the user most likely wants to reach 
    251             */ 
     249        /* If there is exactly one root object, show its children, since  
     250         * this is what the user most likely wants to reach 
     251         */ 
    252252            if ($selected || sizeof($root_objects) == 1) 
    253253            { 
  • trunk/midcom/midgard.admin.asgard/style/midgard_admin_asgard_object_copy.php

    r15498 r15919  
    44$data['controller']->display_form(); 
    55?> 
    6  
  • trunk/midcom/midgard.admin.asgard/style/midgard_admin_asgard_object_copytree.php

    r15562 r15919  
    2525echo preg_replace('/(<form.*?>)/i', '\1' . $tree_select, $form); 
    2626?> 
    27  
  • trunk/midcom/midgard.admin.wizards/bin/delete-sitegroup.php

    r15784 r15919  
    1 <?php 
     1<?php 
    22if (count($argv) != 5) 
    33{ 
  • trunk/midcom/org.routamc.positioning/exec/test-fireeagle.php

    r15428 r15919  
    1717{ 
    1818    $session = new midcom_service_session('org_routamc_positioning_fireeagle'); 
    19        if (   isset($_GET['f']) 
    20            && $_GET['f'] == 'start')  
    21        
    22                // get a request token + secret from FE and redirect to the authorization page 
     19    if (   isset($_GET['f']) 
     20        && $_GET['f'] == 'start')  
     21   
     22        // get a request token + secret from FE and redirect to the authorization page 
    2323        $fireeagle = new FireEagle($fireeagle_consumer_key, $fireeagle_consumer_secret); 
    2424        $request_token = $fireeagle->getRequestToken(); 
     
    3232         
    3333        // Save request token to session and redirect user 
    34                $session->set('auth_state', 'start'); 
    35                $session->set('request_token', $request_token['oauth_token']); 
    36                $session->set('request_secret', $request_token['oauth_token_secret']); 
    37                  
    38                ?> 
    39                <p><a href="<?php echo $fireeagle->getAuthorizeURL($request_token['oauth_token']); ?>" target="_blank">Authorize this application</a></p> 
    40                <p><a href="?f=callback">And then click here</a></p> 
    41                <?php 
     34        $session->set('auth_state', 'start'); 
     35        $session->set('request_token', $request_token['oauth_token']); 
     36        $session->set('request_secret', $request_token['oauth_token_secret']); 
     37         
     38        ?> 
     39        <p><a href="<?php echo $fireeagle->getAuthorizeURL($request_token['oauth_token']); ?>" target="_blank">Authorize this application</a></p> 
     40        <p><a href="?f=callback">And then click here</a></p> 
     41        <?php 
    4242        $_MIDCOM->finish(); 
    4343        die(); 
    44        }  
    45        elseif (   isset($_GET['f']) 
    46                && $_GET['f'] == 'callback') 
     44    }  
     45    elseif (   isset($_GET['f']) 
     46            && $_GET['f'] == 'callback') 
    4747    { 
    48                // the user has authorized us at FE, so now we can pick up our access token + secret 
    49                if (   !$session->exists('auth_state') 
    50                    || $session->get('auth_state') != 'start')  
    51                
    52                        die("Out of sequence."); 
    53                
     48        // the user has authorized us at FE, so now we can pick up our access token + secret 
     49        if (   !$session->exists('auth_state') 
     50            || $session->get('auth_state') != 'start')  
     51       
     52            die("Out of sequence."); 
     53       
    5454 
    5555        $fireeagle = new FireEagle($fireeagle_consumer_key, $fireeagle_consumer_secret, $session->get('request_token'), $session->get('request_secret')); 
  • trunk/midcom/org.routamc.positioning/lib/fireeagle.php

    r15586 r15919  
    7474 
    7575  function __construct($consumerKey, 
    76                       $consumerSecret,  
    77                       $oAuthToken = null,  
    78                       $oAuthTokenSecret = null)  { 
     76               $consumerSecret,  
     77               $oAuthToken = null,  
     78               $oAuthTokenSecret = null)  { 
    7979    $this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); 
    8080    $this->consumer = new OAuthConsumer($consumerKey, $consumerSecret, NULL); 
     
    152152      $r->user->best_guess = NULL; 
    153153      foreach ($r->user->location_hierarchy as &$loc) { 
    154        $c = $loc->geometry->coordinates; 
    155        switch ($loc->geometry->type) { 
    156        case 'Box': // DEPRECATED 
    157          $loc->bbox = $c; 
    158          $loc->latitude = ($c[0][0] + $c[1][0]) / 2; 
    159          $loc->longitude = ($c[0][1] + $c[1][1]) / 2; 
    160          $loc->geotype = 'box'; 
    161          break; 
    162        case 'Polygon': 
    163          $loc->bbox = $bbox = $loc->geometry->bbox; 
    164          $loc->latitude = ($bbox[0][0] + $bbox[1][0]) / 2; 
    165          $loc->longitude = ($bbox[0][1] + $bbox[1][1]) / 2; 
    166          $loc->geotype = 'box'; 
    167          break; 
    168        case 'Point': 
    169          list($loc->longitude, $loc->latitude) = $c; 
    170          $loc->geotype = 'point'; 
    171          break; 
    172        
    173        if ($loc->best_guess) $r->user->best_guess = $loc; // add shortcut to get 'best guess' loc 
    174        unset($loc); 
     154    $c = $loc->geometry->coordinates; 
     155    switch ($loc->geometry->type) { 
     156    case 'Box': // DEPRECATED 
     157      $loc->bbox = $c; 
     158      $loc->latitude = ($c[0][0] + $c[1][0]) / 2; 
     159      $loc->longitude = ($c[0][1] + $c[1][1]) / 2; 
     160      $loc->geotype = 'box'; 
     161      break; 
     162    case 'Polygon': 
     163      $loc->bbox = $bbox = $loc->geometry->bbox; 
     164      $loc->latitude = ($bbox[0][0] + $bbox[1][0]) / 2; 
     165      $loc->longitude = ($bbox[0][1] + $bbox[1][1]) / 2; 
     166      $loc->geotype = 'box'; 
     167      break; 
     168    case 'Point': 
     169      list($loc->longitude, $loc->latitude) = $c; 
     170      $loc->geotype = 'point'; 
     171      break; 
     172   
     173    if ($loc->best_guess) $r->user->best_guess = $loc; // add shortcut to get 'best guess' loc 
     174    unset($loc); 
    175175      } 
    176176    } 
     
    254254      $url_bits = parse_url($url); 
    255255      if (isset($postData)) { 
    256        self::dump("POST ".$url_bits['path']." HTTP/1.0\nHost: ".$url_bits['host']."\nContent-Type: application/x-www-urlencoded\nContent-Length: ".strlen($postData)."\n\n$postData\n"); 
     256    self::dump("POST ".$url_bits['path']." HTTP/1.0\nHost: ".$url_bits['host']."\nContent-Type: application/x-www-urlencoded\nContent-Length: ".strlen($postData)."\n\n$postData\n"); 
    257257      } else { 
    258        $get_url = $url_bits['path']; 
    259        if ($url_bits['query']) $get_url .= '?' . $url_bits['query']; 
    260        self::dump("GET $get_url HTTP/1.0\nHost: ".$url_bits['host']."\n\n"); 
     258    $get_url = $url_bits['path']; 
     259    if ($url_bits['query']) $get_url .= '?' . $url_bits['query']; 
     260    self::dump("GET $get_url HTTP/1.0\nHost: ".$url_bits['host']."\n\n"); 
    261261      } 
    262262    }