* Contributor(s): ______________________________________. ********************************************************************************/ require_once 'config.php'; require_once 'include/vCard.php'; require_once 'log4php/LoggerManager.php'; require_once 'include/utils.php'; require_once 'include/entryPoint.php'; //$locale = new Localization(); clean_special_arguments(); // cn: set php.ini settings at entry points setPhpIniSettings(); //$GLOBALS['log'] = LoggerManager::getLogger('vCard'); //$GLOBALS['db'] = DBManager::getInstance(); // check for old config format. if (empty($sugar_config) && isset($dbconfig['db_host_name'])) { make_sugar_config($sugar_config); } $current_user = new User(); if (!empty($sugar_config['session_dir'])) { session_save_path($sugar_config['session_dir']); } session_start(); $user_unique_key = isset($_SESSION['unique_key']) ? $_SESSION['unique_key'] : ''; $server_unique_key = isset($sugar_config['unique_key']) ? $sugar_config['unique_key'] : ''; if ($user_unique_key != $server_unique_key) { session_destroy(); header("Location: index.php?action=Login&module=Users"); exit; } if (isset($_SESSION['authenticated_user_id'])) { $result = $current_user->retrieve($_SESSION['authenticated_user_id']);
/** * Serve a webdav request * * @access public * @param string */ function ServeRequest($base = false) { global $sugar_config, $current_language; if (empty($sugar_config) && isset($dbconfig['db_host_name'])) { make_sugar_config($sugar_config); } if (!empty($sugar_config['session_dir'])) { session_save_path($sugar_config['session_dir']); } session_start(); // clean_incoming_data(); $current_language = $sugar_config['default_language']; // special treatment for litmus compliance test // reply on its identifier header // not needed for the test itself but eases debugging /* foreach(apache_request_headers() as $key => $value) { if(stristr($key,"litmus")) { error_log("Litmus test $value"); header("X-Litmus-reply: ".$value); } } */ // set root directory, defaults to webserver document root if not set if ($base) { $this->base = realpath($base); // TODO throw if not a directory } else { if (!$this->base) { $this->base = $_SERVER['DOCUMENT_ROOT']; } } $query_arr = array(); // set path if (empty($_SERVER["PATH_INFO"])) { $this->path = "/"; if (strtolower($_SERVER["REQUEST_METHOD"]) == 'get') { $query_arr = $_REQUEST; } else { parse_str($_REQUEST['parms'], $query_arr); } } else { $this->path = $this->_urldecode($_SERVER["PATH_INFO"]); if (ini_get("magic_quotes_gpc")) { $this->path = stripslashes($this->path); } $query_str = preg_replace('/^\\//', '', $this->path); $query_arr = array(); parse_str($query_str, $query_arr); } if (!empty($query_arr['type'])) { $this->vcal_type = $query_arr['type']; } else { $this->vcal_type = 'vfb'; } if (!empty($query_arr['source'])) { $this->source = $query_arr['source']; } else { $this->source = 'outlook'; } if (!empty($query_arr['key'])) { $this->publish_key = $query_arr['key']; } // select user by email if (!empty($query_arr['email'])) { // clean the string! $query_arr['email'] = clean_string($query_arr['email']); //get user info $this->user_focus->retrieve_by_email_address($query_arr['email']); } else { if (!empty($query_arr['user_name'])) { // clean the string! $query_arr['user_name'] = clean_string($query_arr['user_name']); //get user info $arr = array('user_name' => $query_arr['user_name']); $this->user_focus->retrieve_by_string_fields($arr); } else { if (!empty($query_arr['user_id'])) { $this->user_focus->retrieve($query_arr['user_id']); } } } // if we haven't found a user, then return 404 if (empty($this->user_focus->id) || $this->user_focus->id == -1) { $this->http_status("404 Not Found"); return; } // if(empty($this->user_focus->user_preferences)) // { $this->user_focus->loadPreferences(); // } // let the base class do all the work parent::ServeRequest(); }