Exemplo n.º 1
0
 * See the enclosed file COPYING for license information (GPL). If you did not
 * receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author  Marko Djukic <*****@*****.**>
 * @version $Revision$
 * @since   Horde 3.0
 *
 * @todo  Would be good to expand this to fetch also ISO-3166-2 lists from
 *        somewhere for lists of countries' regions/states.
 */
define('HORDE_BASE', dirname(__FILE__) . '/..');
require_once HORDE_BASE . '/lib/core.php';
/* Location on ISO website where to fetch the updates from. */
$url = 'http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1-semic.txt';
define('HORDE_BASE', dirname(__FILE__) . '/..');
$countries =& Countries::singleton($url);
/* Update Horde's file. */
$updated = $countries->update();
if ($updated == false) {
    /* Nothing found to update. */
    $countries->cli->writeln(_("Nothing to update. Exiting."));
    exit;
}
/* Save the new file. */
$countries->save();
exit;
class Countries
{
    var $old_data = array();
    var $new_data = array();
    var $cli;