Changeset 11916

Show
Ignore:
Timestamp:
08/30/07 20:26:54 (1 year ago)
Author:
bergie
Message:

Remove more old stuff, refs #102

Files:

Legend:

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

    r11914 r11916  
    139139require('midcom/helper/toolbar.php'); 
    140140require('midcom/helper/toolbars.php'); 
    141 require('midcom/helper/list_helpers.php'); 
    142141 
    143142// Services 
  • trunk/midcom/midcom.core/midcom/helper/misc.php

    r11359 r11916  
    10941094} 
    10951095 
    1096 if (! function_exists('mgd_is_guid')) 
    1097 { 
    1098     /** 
    1099      * This function validates wether the argument passed is a syntactically valid GUID. 
    1100      * The check is currently very basic (in favor of speed), and does only validate the 
    1101      * lentgth and type of the argument. 
    1102      * 
    1103      * Will only be included if the function doesn't already exist. 
    1104      * 
    1105      * @param mixed $guid The argument to validate 
    1106      * @return bool True, if the argument is a valid guid, false otherwise. 
    1107      */ 
    1108     function mgd_is_guid($guid) 
    1109     { 
    1110         return (   is_string($guid) 
    1111                 && strlen($guid) >= 32); 
    1112     } 
    1113 } 
    1114  
    11151096if (! function_exists('mgd_show_element')) 
    11161097{ 
     
    11201101        eval('?>' . mgd_preparse(mgd_template($name))); 
    11211102    } 
    1122 } 
    1123  
    1124 if (! function_exists('mgd_set_errno')) 
    1125 { 
    1126     /** @ignore, empty fallback stub */ 
    1127     function mgd_set_errno($error) 
    1128     { 
    1129         debug_push('mgd_set_errno'); 
    1130         debug_add("Tried to set mgd error to {$error} but Midgard is too old to support this already. Ignoring silently.", 
    1131             MIDCOM_LOG_ERROR); 
    1132         debug_print_function_stack('We were called from here:'); 
    1133         debug_pop(); 
    1134     } 
    1135 } 
    1136  
    1137 // MGD_ERR Constants, only if not yet defined 
    1138 // TODO: Keep in sync with http://www.midgard-project.org/api-docs/midgard/core/1.8/group__midgard__error.html 
    1139 if (! defined('MGD_ERR_OK')) 
    1140 { 
    1141     define('MGD_ERR_OK', -0); 
    1142     define('MGD_ERR_ERROR', -1); 
    1143     define('MGD_ERR_ACCESS_DENIED', -2); 
    1144     define('MGD_ERR_SITEGROUP_VIOLATION', -3); 
    1145     define('MGD_ERR_NOT_OBJECT', -4); 
    1146     define('MGD_ERR_NOT_EXISTS', -5); 
    1147     define('MGD_ERR_NO_MEM', -6); 
    1148     define('MGD_ERR_INVALID_NAME', -7); 
    1149     define('MGD_ERR_DUPLICATE', -8); 
    1150     define('MGD_ERR_HAS_DEPENDANTS', -9); 
    1151     define('MGD_ERR_RANGE', -10); 
    1152     define('MGD_ERR_NOT_CONNECTED', -11); 
    1153     define('MGD_ERR_SG_NOTFOUND', -12); 
    1154     define('MGD_ERR_INVALID_OBJECT', -13); 
    1155     define('MGD_ERR_QUOTA', -14); 
    1156     define('MGD_ERR_INTERNAL', -15); 
    1157     define('MGD_ERR_OBJECT_NAME_EXISTS', -16); 
    1158     define('MGD_ERR_OBJECT_NO_STORAGE', -17); 
    1159     define('MGD_ERR_OBJECT_NO_PARENT', -18); 
    1160 } 
    1161  
    1162 if (   (version_compare(phpversion(), '5.0') < 0) 
    1163     && !function_exists('clone')) 
    1164 { 
    1165     eval(' 
    1166     function clone($object)  
    1167     { 
    1168         return $object; 
    1169     } 
    1170     '); 
    1171 } 
    1172  
    1173 /** 
    1174  * Helper function for encoding any data into JSON format 
    1175  * http://www.json.org/ 
    1176  * 
    1177  * If the PECL (or PHP 5.2) JSON extension is found it will be used. Otherwise 
    1178  * the helper attempts to use the PEAR Services_JSON package. 
    1179  * 
    1180  * It will also set the MIME type of the page correctly as discussed in: 
    1181  * http://jibbering.com/blog/?p=514 
    1182  * 
    1183  * @param mixed  
    1184  * @return string Data in JSON format 
    1185  */ 
    1186 function midcom_helper_json_encode($data) 
    1187 { 
    1188     // Set correct MIME type 
    1189     $_MIDCOM->cache->content->content_type('application/json'); 
    1190     $_MIDCOM->header('Content-type: application/json'); 
    1191      
    1192     if (function_exists('json_encode')) 
    1193     { 
    1194         // Use the json PHP extension 
    1195         return json_encode($data); 
    1196     } 
    1197  
    1198     // Use the PEAR Services_JSON package 
    1199     @include_once('JSON.php'); 
    1200     if (!class_exists('Services_JSON')) 
    1201     { 
    1202         $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 
    1203             'Services_JSON package not found in PEAR.'); 
    1204     } 
    1205  
    1206     $json = new Services_JSON(); 
    1207     return $json->encode($data); 
    1208 } 
    1209  
    1210 /** 
    1211  * Helper function for decoding any data from JSON format 
    1212  * http://www.json.org/ 
    1213  * 
    1214  * If the PECL (or PHP 5.2) JSON extension is found it will be used. Otherwise 
    1215  * the helper attempts to use the PEAR Services_JSON package. 
    1216  * 
    1217  * @param string Data in JSON format 
    1218  * @return mixed  
    1219  */ 
    1220 function midcom_helper_json_decode($data) 
    1221 {    
    1222     if (function_exists('json_decode')) 
    1223     { 
    1224         // Use the json PHP extension 
    1225         return json_decode($data); 
    1226     } 
    1227  
    1228     // Use the PEAR Services_JSON package 
    1229     @include_once('JSON.php'); 
    1230     if (!class_exists('Services_JSON')) 
    1231     { 
    1232         $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 
    1233             'Services_JSON package not found in PEAR.'); 
    1234     } 
    1235  
    1236     $json = new Services_JSON(); 
    1237     return $json->decode($data); 
    12381103} 
    12391104