Annotation of /mambo/branches/4.6/administrator/components/com_languages/actions/save.action.php
Parent Directory
|
Revision Log
Revision 298 - (view) (download)
| 1 : | csouza | 298 | <?php |
| 2 : | class saveAction extends Action | ||
| 3 : | { | ||
| 4 : | function execute(&$controller, &$request) | ||
| 5 : | { | ||
| 6 : | $root = mamboCore::get('rootPath'); | ||
| 7 : | $lang = mosGetParam($_POST, 'id', 'english'); | ||
| 8 : | $langfile = $root.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR.$lang.'.xml'; | ||
| 9 : | $p = xml_parser_create(); | ||
| 10 : | xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); | ||
| 11 : | xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1); | ||
| 12 : | xml_parse_into_struct($p, file_get_contents($langfile), $arr); | ||
| 13 : | xml_parser_free($p); | ||
| 14 : | foreach($arr as $key => $value) | ||
| 15 : | { | ||
| 16 : | if ($value['tag'] == 'name') { | ||
| 17 : | $arr[$key]['value'] = $_POST['name']; | ||
| 18 : | } | ||
| 19 : | if ($value['tag'] == 'param') { | ||
| 20 : | foreach ($_POST as $k => $v) { | ||
| 21 : | if ($k == $value['attributes']['name']) | ||
| 22 : | echo $arr[$key]['attributes']['default'] = $v; | ||
| 23 : | } | ||
| 24 : | } | ||
| 25 : | } | ||
| 26 : | $xml = XMLUtils::array_to_xml($arr); | ||
| 27 : | $fp = fopen($langfile, 'w+'); | ||
| 28 : | fwrite($fp, $xml); | ||
| 29 : | fclose($fp); | ||
| 30 : | return $controller->redirect(); | ||
| 31 : | } | ||
| 32 : | } | ||
| 33 : | |||
| 34 : | |||
| 35 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

