<?php // Copyright (C) 2005-2008 SpheraIT $filename = "speeddial_" . date("d-m-Y"); header('Content-Disposition: attachment; filename="' . $filename . '.csv"'); header('content-type: text/csv'); require_once 'functions.php'; require_once './classes/speeddial/Datasource.php'; require_once './classes/speeddial/SpeedEntry.php'; require_once './classes/speeddial/SpeedEntryDAO.php'; $amp_conf = parse_amportal_conf("/etc/amportal.conf"); $ds = new DatasourceSpeeddial($amp_conf['AMPDBHOST'], $amp_conf['AMPDBNAME'], $amp_conf['AMPDBUSER'], $amp_conf['AMPDBPASS']); $dao = new SpeedEntryDAO(); //echo "<pre>"; print_r($amp_conf); $results = $dao->readAll($ds); $stdout = fopen('php://output', 'w'); if (count($results) > 0) { fwrite($stdout, '"Number";"Callerid";"Forward";"Permission"' . "\n"); foreach ($results as $r) { $permission = $r->getPermission(); if ($permission == "") { $permission = "NO"; } if ($permission == "CHECKED") { $permission = "YES"; } fwrite($stdout, '"' . $r->getNumber() . '";"' . $r->getDescription() . '";"' . $r->getTelnr() . '";"' . $permission . '"' . "\n"); } //foreach } //if $results>0
<?php // Copyright (C) 2005-2008 SpheraIT require_once './classes/phonebook/Datasource.php'; require_once './classes/phonebook/PhoneEntry.php'; require_once './classes/phonebook/PhoneEntryDAO.php'; require_once './classes/speeddial/Datasource.php'; require_once './classes/speeddial/SpeedEntry.php'; require_once './classes/speeddial/SpeedEntryDAO.php'; $ds = new Datasource($amp_conf['PHONEBOOKDBHOST'], $amp_conf['PHONEBOOKDBNAME'], $amp_conf['PHONEBOOKDBUSER'], $amp_conf['PHONEBOOKDBPASS']); $dao = new PhoneEntryDAO(); $dsspeed = new DatasourceSpeeddial($amp_conf['AMPDBHOST'], $amp_conf['AMPDBNAME'], $amp_conf['AMPDBUSER'], $amp_conf['AMPDBPASS']); $daospeed = new SpeedEntryDAO(); //echo "<pre>"; print_r($amp_conf); ?> <?php $delimiter = isset($_REQUEST['delimiter']) ? $_REQUEST['delimiter'] : ''; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; $wScript = rtrim($_SERVER['SCRIPT_FILENAME'], $currentFile) . 'retrieve_speeddial_from_mysql.pl'; $display = 3; ?> </div> <div class="rnav"> <li><a onFocus="this.blur()" href="config.php?mode=tools&display=<?php echo $display; ?> &action=import_phonebook" onclick="return confirm('Warning: The phonebook will be overwritten! please do an export now.')"><?php echo _("Import Phonebook");