. */ /** * @brief Delete contact * * * @file * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup admin */ $core_tools = new core_tools(); $core_tools->load_lang(); $core_tools->test_admin('admin_contacts', 'apps'); require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_contacts.php"); /****************Management of the location bar ************/ $init = false; if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") { $init = true; } $level = ""; if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) { $level = $_REQUEST['level']; } $page_path = $_SESSION['config']['businessappurl'].'index.php?page=contact_del&admin=contacts'; $page_label = _DELETION; $page_id = "contact_del"; $core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); $func = new functions(); $db = new dbquery(); $db->connect(); $contact = new contacts(); if(isset($_GET['id'])) { $s_id = addslashes($func->wash($_GET['id'], "alphanum", _CONTACT)); } else { $s_id = ""; } if(isset($_REQUEST['valid'])) { if(!empty($_REQUEST['contact'])) { if (preg_match('/:/', $_REQUEST['contact']) == 0) { $_SESSION['error'] = _CONTACT. ' ' . _WRONG_FORMAT . '.
' . _USE_AUTOCOMPLETION; $contact->delcontact($s_id); exit; } else { $contactTmp = str_replace(')', '', substr($_REQUEST['contact'], strrpos($_REQUEST['contact'],'(')+1)); $find1 = strpos($contactTmp, ':'); $find2 = $find1 + 1; $contact_type = substr($contactTmp, 0, $find1); $new_contact = substr($contactTmp, $find2, strlen($contactTmp)); /* for($i=0;$iquery("update ".$_SESSION['collections'][$i]['extensions'][$i] . " set exp_contact_id = '".$db->protect_string_db($new_contact) . "' where exp_contact_id = '".$db->protect_string_db($s_id) . "'"); $db->query("update ".$_SESSION['collections'][$i]['extensions'][$i] . " set dest_contact_id = '".$db->protect_string_db($new_contact) . "' where dest_contact_id = '".$db->protect_string_db($s_id) . "'"); $db->query("delete from " . $_SESSION['tablename']['contacts'] . " where contact_id = ".$db->protect_string_db($s_id)); if($_SESSION['history']['contactdel']) { require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); $hist = new history(); $hist->add($_SESSION['tablename']['contacts'], $s_id,"DEL","contactdel",_CONTACT_DELETED.' : '.$s_id, $_SESSION['config']['databasetype']); } ?> "; //$documents = false; } } else { //$contact = new contacts(); $contact->delcontact($s_id); } ?>