function deleteContact($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk) { $padress_book = new paloAdressBook($pDB); foreach ($_POST as $key => $values) { if (substr($key, 0, 8) == "contact_") { $tmpBookID = substr($key, 8); $result = $padress_book->deleteContact($tmpBookID); } } $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk); return $content; }
function deleteContact($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk) { $padress_book = new paloAdressBook($pDB); $ruta_destino = "/var/www/address_book_images/"; $pACL = new paloACL($pDB_2); $id_user = $pACL->getIdUser($_SESSION["elastix_user"]); $result = ""; foreach ($_POST as $key => $values) { if (substr($key, 0, 8) == "contact_") { $tmpBookID = substr($key, 8); if ($padress_book->isEditablePublicContact($tmpBookID, $id_user)) { $contactTmp = $padress_book->contactData($tmpBookID, $id_user); $result = $padress_book->deleteContact($tmpBookID, $id_user); if ($contactTmp['picture'] != "" && isset($contactTmp['picture'])) { if (is_file($ruta_destino . "/" . $contactTmp['picture'])) { unlink($ruta_destino . "/" . $contactTmp['picture']); } } } } } $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk); return $content; }