Changeset 15919
- Timestamp:
- 04/01/08 17:47:00 (7 months ago)
- Files:
-
- trunk/midcom/midcom.core/midcom/services/dbclassloader.php (modified) (1 diff)
- trunk/midcom/midcom.helper.datamanager2/static/tinymce/tiny_mce_gzip.php (modified) (1 diff)
- trunk/midcom/midgard.admin.asgard/handler/object/manage.php (modified) (1 diff)
- trunk/midcom/midgard.admin.asgard/handler/type.php (modified) (1 diff)
- trunk/midcom/midgard.admin.asgard/navigation.php (modified) (1 diff)
- trunk/midcom/midgard.admin.asgard/style/midgard_admin_asgard_object_copy.php (modified) (1 diff)
- trunk/midcom/midgard.admin.asgard/style/midgard_admin_asgard_object_copytree.php (modified) (1 diff)
- trunk/midcom/midgard.admin.wizards/bin/delete-sitegroup.php (modified) (1 diff)
- trunk/midcom/org.routamc.positioning/exec/test-fireeagle.php (modified) (2 diffs)
- trunk/midcom/org.routamc.positioning/lib/fireeagle.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/services/dbclassloader.php
r15908 r15919 620 620 { 621 621 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()); */ 624 624 } 625 625 trunk/midcom/midcom.helper.datamanager2/static/tinymce/tiny_mce_gzip.php
r15185 r15919 11 11 */ 12 12 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); 15 15 16 // Get input17 $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 stored26 $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache27 $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 = ""; 32 32 33 // Custom extra javascripts to pack34 $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 */); 38 38 39 // Headers40 header("Content-type: text/javascript");41 header("Vary: Accept-Encoding"); // Handle proxies42 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"); 43 43 44 // Is called directly then auto init with default settings45 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 } 50 50 51 // Setup cache info52 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.');"); 55 55 56 $cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix;56 $cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix; 57 57 58 foreach ($custom as $file)59 $cacheKey .= $file;58 foreach ($custom as $file) 59 $cacheKey .= $file; 60 60 61 $cacheKey = md5($cacheKey);61 $cacheKey = md5($cacheKey); 62 62 63 if ($compress)64 $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";65 else66 $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 } 68 68 69 // Check if it supports gzip70 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']))); 72 72 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 } 77 77 78 // Use cached file disk cache79 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); 82 82 83 echo getFileContents($cacheFile);84 die();85 }83 echo getFileContents($cacheFile); 84 die(); 85 } 86 86 87 // Add core88 if ($core == "true") {89 $content .= getFileContents("tiny_mce" . $suffix . ".js");87 // Add core 88 if ($core == "true") { 89 $content .= getFileContents("tiny_mce" . $suffix . ".js"); 90 90 91 // Patch loading functions92 $content .= "tinyMCE_GZ.start();";93 }91 // Patch loading functions 92 $content .= "tinyMCE_GZ.start();"; 93 } 94 94 95 // Add core languages96 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"); 98 98 99 // Add themes100 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"); 102 102 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 } 106 106 107 // Add plugins108 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"); 110 110 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 } 114 114 115 // Add custom files116 foreach ($custom as $file)117 $content .= getFileContents($file);115 // Add custom files 116 foreach ($custom as $file) 117 $content .= getFileContents($file); 118 118 119 // Restore loading functions120 if ($core == "true")121 $content .= "tinyMCE_GZ.end();";119 // Restore loading functions 120 if ($core == "true") 121 $content .= "tinyMCE_GZ.end();"; 122 122 123 // Generate GZIP'd content124 if ($supportsGzip) {125 if ($compress) {126 header("Content-Encoding: " . $enc);127 $cacheData = gzencode($content, 9, FORCE_GZIP);128 } else129 $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; 130 130 131 // Write gz file132 if ($diskCache && $cacheKey != "")133 putFileContents($cacheFile, $cacheData);131 // Write gz file 132 if ($diskCache && $cacheKey != "") 133 putFileContents($cacheFile, $cacheData); 134 134 135 // Stream to client136 echo $cacheData;137 } else {138 // Stream uncompressed content139 echo $content;140 }135 // Stream to client 136 echo $cacheData; 137 } else { 138 // Stream uncompressed content 139 echo $content; 140 } 141 141 142 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */142 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 143 143 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; 147 147 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 } 150 150 151 function getFileContents($path) {152 $path = realpath($path);151 function getFileContents($path) { 152 $path = realpath($path); 153 153 154 if (!$path || !@is_file($path))155 return "";154 if (!$path || !@is_file($path)) 155 return ""; 156 156 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); 159 159 160 $content = "";161 $fp = @fopen($path, "r");162 if (!$fp)163 return "";160 $content = ""; 161 $fp = @fopen($path, "r"); 162 if (!$fp) 163 return ""; 164 164 165 while (!feof($fp))166 $content .= fgets($fp);165 while (!feof($fp)) 166 $content .= fgets($fp); 167 167 168 fclose($fp);168 fclose($fp); 169 169 170 return $content;171 }170 return $content; 171 } 172 172 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); 176 176 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 } 183 183 ?> trunk/midcom/midgard.admin.asgard/handler/object/manage.php
r15909 r15919 779 779 $_MIDCOM->relocate("__mfa/asgard/object/{$this->_request_data['default_mode']}/{$this->_object->guid}/{$data['language_code']}"); 780 780 // This will exit. 781 case 'edit':781 case 'edit': 782 782 $qf =& $this->_controller->formmanager->form; 783 783 if(isset($_REQUEST['midcom_helper_datamanager2_save']) && isset($qf->_errors)) trunk/midcom/midgard.admin.asgard/handler/type.php
r15788 r15919 243 243 if (isset($_GET['search'])) 244 244 { 245 midgard_admin_asgard_plugin::get_default_mode(&$data);245 midgard_admin_asgard_plugin::get_default_mode(&$data); 246 246 $data['search_results'] = $this->_search($_GET['search']); 247 247 248 //If there is exactly one result, go there directly248 //If there is exactly one result, go there directly 249 249 if (sizeof($data['search_results']) == 1) 250 {250 { 251 251 $_MIDCOM->relocate('__mfa/asgard/object/' . $data['default_mode'] . '/' . $data['search_results'][0]->guid) . '/'; 252 252 //this will exit 253 }253 } 254 254 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/jQuery/jquery.tablesorter.js'); 255 255 $_MIDCOM->add_link_head trunk/midcom/midgard.admin.asgard/navigation.php
r15797 r15919 247 247 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"; 248 248 249 /* If there is exactly one root object, show its children, since250 * this is what the user most likely wants to reach251 */249 /* If there is exactly one root object, show its children, since 250 * this is what the user most likely wants to reach 251 */ 252 252 if ($selected || sizeof($root_objects) == 1) 253 253 { trunk/midcom/midgard.admin.asgard/style/midgard_admin_asgard_object_copy.php
r15498 r15919 4 4 $data['controller']->display_form(); 5 5 ?> 6 trunk/midcom/midgard.admin.asgard/style/midgard_admin_asgard_object_copytree.php
r15562 r15919 25 25 echo preg_replace('/(<form.*?>)/i', '\1' . $tree_select, $form); 26 26 ?> 27 trunk/midcom/midgard.admin.wizards/bin/delete-sitegroup.php
r15784 r15919 1 <?php1 <?php 2 2 if (count($argv) != 5) 3 3 { trunk/midcom/org.routamc.positioning/exec/test-fireeagle.php
r15428 r15919 17 17 { 18 18 $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 page19 if ( isset($_GET['f']) 20 && $_GET['f'] == 'start') 21 { 22 // get a request token + secret from FE and redirect to the authorization page 23 23 $fireeagle = new FireEagle($fireeagle_consumer_key, $fireeagle_consumer_secret); 24 24 $request_token = $fireeagle->getRequestToken(); … … 32 32 33 33 // 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 <?php34 $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 42 42 $_MIDCOM->finish(); 43 43 die(); 44 }45 elseif ( isset($_GET['f'])46 && $_GET['f'] == 'callback')44 } 45 elseif ( isset($_GET['f']) 46 && $_GET['f'] == 'callback') 47 47 { 48 // the user has authorized us at FE, so now we can pick up our access token + secret49 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 } 54 54 55 55 $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 74 74 75 75 function __construct($consumerKey, 76 $consumerSecret,77 $oAuthToken = null,78 $oAuthTokenSecret = null) {76 $consumerSecret, 77 $oAuthToken = null, 78 $oAuthTokenSecret = null) { 79 79 $this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); 80 80 $this->consumer = new OAuthConsumer($consumerKey, $consumerSecret, NULL); … … 152 152 $r->user->best_guess = NULL; 153 153 foreach ($r->user->location_hierarchy as &$loc) { 154 $c = $loc->geometry->coordinates;155 switch ($loc->geometry->type) {156 case 'Box': // DEPRECATED157 $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' loc174 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); 175 175 } 176 176 } … … 254 254 $url_bits = parse_url($url); 255 255 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"); 257 257 } 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"); 261 261 } 262 262 }
