always.php.in:$c->script_start_time = microtime(true); always.php.in:// An ultra-simple exception handler to catch errors that occur always.php.in: echo "Uncaught early exception: ", $e->getMessage(), "\nAt line ", $e->getLine(), " of ", $e->getFile(), "\n"; always.php.in: $trace = array_reverse($e->getTrace()); always.php.in:$c->sysabbr = 'davical'; always.php.in:$c->admin_email = 'admin@davical.example.com'; always.php.in:$c->system_name = 'DAViCal CalDAV Server'; always.php.in:$c->domain_name = (isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:$_SERVER['SERVER_ADDR']); always.php.in:$c->save_time_zone_defs = true; always.php.in:$c->collections_always_exist = false; always.php.in:$c->allow_get_email_visibility = false; always.php.in:$c->permission_scan_depth = 2; always.php.in:$c->expand_pdo_parameters = true; always.php.in:$c->home_calendar_name = 'home'; always.php.in:$c->enable_row_linking = true; always.php.in:$c->enable_scheduling = false; always.php.in:$c->http_auth_mode = 'Basic'; always.php.in:// $c->default_locale = array('es_MX', 'es_AR', 'es', 'pt'); // An array of locales to try, or just a single locale always.php.in:// $c->local_tzid = 'Pacific/Auckland'; // Perhaps we should read from /etc/timezone - I wonder how standard that is? always.php.in:$c->default_locale = 'en'; always.php.in:$c->locale_path = '../locale'; always.php.in:$c->base_url = preg_replace('#/[^/]+\.php.*$#', '', $_SERVER['SCRIPT_NAME']); always.php.in:$c->base_directory = preg_replace('#/[^/]*$#', '', $_SERVER['DOCUMENT_ROOT']); always.php.in:$c->default_privileges = array('read-free-busy', 'schedule-deliver'); always.php.in:$c->stylesheets = array( $c->base_url.'/davical.css' ); always.php.in:$c->images = $c->base_url . '/images'; always.php.in:$c->template_usr = array( 'active' => true, always.php.in: 'email_ok' => date('Y-m-d') always.php.in:$c->hide_TODO = true; // VTODO only visible to collection owner always.php.in:$c->readonly_webdav_collections = true; // WebDAV access is readonly always.php.in:$c->total_query_time = 0; always.php.in:$c->dbg = array(); always.php.in: @dbg_error_log( 'WARN', "Your webserver is not setting the SERVER_NAME parameter. You may need to set \$c->domain_name in your configuration. Using IP address meanhwhile..." ); always.php.in:$c->protocol_server_port = sprintf( '%s://%s%s', always.php.in:$c->protocol_server_port_script = $c->protocol_server_port . ($_SERVER['SCRIPT_NAME'] == '/index.php' ? '' : $_SERVER['SCRIPT_NAME']); always.php.in:if ( @file_exists('/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php') ) { always.php.in: include('/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php'); always.php.in:else if ( @file_exists('/usr/local/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php') ) { always.php.in: include('/usr/local/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php'); always.php.in:if ( !isset($c->page_title) ) $c->page_title = $c->system_name; always.php.in:else if ( isset($c->dbg['script_start']) && $c->dbg['script_start'] ) { always.php.in: $_SERVER['REQUEST_METHOD'], $c->protocol_server_port_script, $_SERVER['PATH_INFO'], $c->base_url, $c->base_directory ); always.php.in:putenv("LANG=". $c->default_locale); always.php.in:awl_set_locale($c->default_locale); always.php.in:init_gettext( 'davical', $c->locale_path ); always.php.in:$c->code_version = 0; always.php.in:$c->version_string = '0.9.8.3'; // The actual version # is replaced into that during the build /release process always.php.in:if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->version_string, $matches) ) { always.php.in: $c->code_major = $matches[1]; always.php.in: $c->code_minor = $matches[2]; always.php.in: $c->code_patch = $matches[3]; always.php.in: $c->code_version = (($c->code_major * 1000) + $c->code_minor).'.'.$c->code_patch; always.php.in: dbg_error_log('caldav', 'Version (%d.%d.%d) == %s', $c->code_major, $c->code_minor, $c->code_patch, $c->code_version); always.php.in: header( sprintf('Server: %d.%d', $c->code_major, $c->code_minor) ); always.php.in:$_SERVER['SERVER_NAME'] = $c->domain_name; always.php.in:$c->want_dbversion = array(1,2,8); always.php.in:$c->schema_version = 0; always.php.in:if ( $qry->Exec('always',__LINE__,__FILE__) && $row = $qry->Fetch() ) { always.php.in: $c->schema_version = doubleval( sprintf( '%d%03d.%03d', $row->schema_major, $row->schema_minor, $row->schema_patch) ); always.php.in: $c->wanted_version = doubleval( sprintf( '%d%03d.%03d', $c->want_dbversion[0], $c->want_dbversion[1], $c->want_dbversion[2]) ); always.php.in: $c->schema_major = $row->schema_major; always.php.in: $c->schema_minor = $row->schema_minor; always.php.in: $c->schema_patch = $row->schema_patch; always.php.in: if ( $c->schema_version < $c->wanted_version ) { always.php.in: $c->messages[] = sprintf( 'Database schema needs upgrading. Current: %d.%d.%d, Desired: %d.%d.%d', always.php.in: $row->schema_major, $row->schema_minor, $row->schema_patch, $c->want_dbversion[0], $c->want_dbversion[1], $c->want_dbversion[2]); always.php.in: if ( isset($_SERVER['HTTP_X_DAVICAL_TESTCASE']) ) $qry->QDo('SET TIMEZONE TO \'Pacific/Auckland\''); always.php.in: if ( isset($session->principal_id) ) { always.php.in: $params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); always.php.in: if ( $qry->Exec('always',__LINE__,__FILE__) && $qry->rows() == 1 && $row = $qry->Fetch() ) { always.php.in: if ( isset($session->principal_id) ) { always.php.in: $_known_users_name[$row->username] = $row; always.php.in: $_known_users_id[$row->user_no] = $row; always.php.in: $_known_users_pid[$row->principal_id] = $row; always.php.in:* Return a user record identified by e-mail address, caching it for any subsequent lookup always.php.in: /** We don't actually maintain a cache-access by e-mail, since it's rare */ always.php.in: if ( strtolower($email) == strtolower($v->email) ) return $v; always.php.in: case 203: $ans = 'Non-Authoritative Information'; break; always.php.in: case 207: $ans = 'Multi-Status'; break; always.php.in: case 414: $ans = 'Request-URI Too Long'; break; always.php.in: if ( ! isset($c->_url_script_path) ) { always.php.in: $c->_url_script_path = (preg_match('#/$#', $c->protocol_server_port_script) ? 'caldav.php' : ''); always.php.in: $c->_url_script_path = $c->protocol_server_port_script . $c->_url_script_path; always.php.in: $url = $c->_url_script_path; always.php.in: if ( !isset($c->deconstruction_base_path) ) $c->deconstruction_base_path = ConstructURL('/'); always.php.in: if ( preg_match( '%^(.*?)'.str_replace('%', '\\%',$c->deconstruction_base_path).'(.*)$%', $dav_name, $matches ) ) { always.php.in: if ( $matches[1] == '' || $matches[1] == $c->protocol_server_port ) { always.php.in: case 'write-properties' : $out_priv |= 2; break; always.php.in: case 'write-content' : $out_priv |= 4; break; always.php.in: case 'read-acl' : $out_priv |= 16; break; always.php.in: case 'read-current-user-privilege-set' : $out_priv |= 32; break; always.php.in: case 'write-acl' : $out_priv |= 256; break; always.php.in: case 'read-free-busy' : $out_priv |= 512; break; always.php.in: case 'schedule-deliver-invite' : $out_priv |= 1024; break; always.php.in: case 'schedule-deliver-reply' : $out_priv |= 2048; break; always.php.in: case 'schedule-query-freebusy' : $out_priv |= 4096; break; always.php.in: case 'schedule-send-invite' : $out_priv |= 8192; break; always.php.in: case 'schedule-send-reply' : $out_priv |= 16384; break; always.php.in: case 'schedule-send-freebusy' : $out_priv |= 32768; break; always.php.in: case 'schedule-deliver' : $out_priv |= 7168; break; // 1024 + 2048 + 4096 always.php.in: case 'schedule-send' : $out_priv |= 57344; break; // 8192 + 16384 + 32768 always.php.in: if ( ($out_priv & DAVICAL_MAXPRIV) >= DAVICAL_MAXPRIV ) $out_priv = pow(2,24) - 1; always.php.in: if ( ($raw_bits & 16) != 0 ) $out_priv[] = 'DAV::read-acl'; always.php.in: if ( ($raw_bits & 32) != 0 ) $out_priv[] = 'DAV::read-current-user-privilege-set'; always.php.in: if ( ($raw_bits & 256) != 0 ) $out_priv[] = 'DAV::write-acl'; always.php.in: if ( ($resourcetype == 'calendar' || $resourcetype == 'proxy') && ($raw_bits & 512) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:read-free-busy'; always.php.in: if ( ($raw_bits & 2) != 0 ) $out_priv[] = 'DAV::write-properties'; always.php.in: if ( ($raw_bits & 4) != 0 ) $out_priv[] = 'DAV::write-content'; always.php.in: if ( $resourcetype == 'schedule-inbox' && ($raw_bits & 7168) != 0 ) { always.php.in: if ( ($raw_bits & 7168) == 7168 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-deliver'; always.php.in: if ( ($raw_bits & 1024) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-deliver-invite'; always.php.in: if ( ($raw_bits & 2048) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-deliver-reply'; always.php.in: if ( ($raw_bits & 4096) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-query-freebusy'; always.php.in: if ( $resourcetype == 'schedule-outbox' && ($raw_bits & 57344) != 0 ) { always.php.in: if ( ($raw_bits & 57344) == 57344 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send'; always.php.in: if ( ($raw_bits & 8192) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send-invite'; always.php.in: if ( ($raw_bits & 16384) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send-reply'; always.php.in: if ( ($raw_bits & 32768) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send-freebusy'; always.php.in: $xmldoc->NSElement($privilege,$k); always.php.in: $privilege->NewElement($k); auth-functions.php:* - Accept a username / password auth-functions.php:* - Confirm the username / password are correct auth-functions.php:* - Create (or update) a 'usr' record in our database auth-functions.php:* - Return the 'usr' record as an object auth-functions.php:* - Return === false when authentication fails auth-functions.php:* - Configuration data will be in $c->authenticate_hook['config'], which might be an array, or whatever is needed. auth-functions.php:* - This file should be included auth-functions.php:* - $c->authenticate_hook['call'] should be set to the name of the plugin auth-functions.php:* - $c->authenticate_hook['config'] should be set up with any configuration data for the plugin auth-functions.php: if ( ! isset($c->home_calendar_name) || strlen($c->home_calendar_name) == 0 ) return true; auth-functions.php: //$calendar_path = $parent_path . $c->home_calendar_name."/"; auth-functions.php: $dav_etag = md5($usr->user_no . $calendar_path); auth-functions.php: ':user_no' => $usr->user_no, auth-functions.php: ':displayname' => $usr->fullname, auth-functions.php: if ( $qry->Exec() ) { auth-functions.php: $c->messages[] = i18n("Home calendar added."); auth-functions.php: $c->messages[] = i18n("There was an error writing to the database."); auth-functions.php: if ( !isset($usr->user_no) || intval($usr->user_no) == 0 ) { auth-functions.php: $qry->Exec('Login',__LINE__,__FILE__); auth-functions.php: $sequence_value = $qry->Fetch(true); // Fetch as an array auth-functions.php: $usr->user_no = $sequence_value[0]; auth-functions.php: $qry = new AwlQuery('SELECT * FROM usr WHERE user_no = :user_no', array(':user_no' => $usr->user_no) ); auth-functions.php: if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) { auth-functions.php: if ( $old = $qry->Fetch() ) { auth-functions.php: if ( $old->{$k} != $v ) { auth-functions.php: dbg_error_log("Login","User '%s' field '%s' changed from '%s' to '%s'", $usr->username, $k, $old->{$k}, $v ); auth-functions.php: dbg_error_log("Login","No changes to user record for '%s' - leaving as-is.", $usr->username ); auth-functions.php: if ( isset($usr->active) && $usr->active == 'f' ) return false; auth-functions.php: dbg_error_log("Login","Changes to user record for '%s' - updating.", $usr->username ); auth-functions.php: if ( $type != 'INSERT' ) $params[':user_no'] = $usr->user_no; auth-functions.php: $qry->Exec('Login',__LINE__,__FILE__); auth-functions.php: if ( isset($usr->active) && ($usr->active === 'f' || $usr->active === false) ) return false; auth-functions.php: array( ':privs' => privilege_to_bits($c->default_privileges), ':username' => $usr->username) ); auth-functions.php: $qry->Exec('Login',__LINE__,__FILE__); auth-functions.php: CreateHomeCalendar($usr->username); auth-functions.php:* require_once('auth-functions.php'); auth-functions.php:* $c->authenticate_hook = array( auth-functions.php: $persistent = isset($c->authenticate_hook['config']['use_persistent']) && $c->authenticate_hook['config']['use_persistent']; auth-functions.php: if ( isset($c->authenticate_hook['config']['columns']) ) auth-functions.php: $cols = $c->authenticate_hook['config']['columns']; auth-functions.php: if ( isset($c->authenticate_hook['config']['where']) ) auth-functions.php: $andwhere = ' AND '.$c->authenticate_hook['config']['where']; auth-functions.php: $authconn = $qry->SetConnection($c->authenticate_hook['config']['connection'], ($persistent ? array(PDO::ATTR_PERSISTENT => true) : null)); auth-functions.php: if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) { auth-functions.php: $usr = $qry->Fetch(); auth-functions.php: if ( session_validate_password( $password, $usr->password ) ) { auth-functions.php: if ( isset($usr->active) && $usr->active == 'f' ) return false; auth-functions.php: $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $usr->username) ); auth-functions.php: if ( $qry->Exec() && $qry->rows() == 1 ) { auth-functions.php: $principal = $qry->Fetch(); caldav-ACL.php:* CalDAV Server - handle ACL method caldav-ACL.php:$request->NeedPrivilege('DAV::write-acl'); caldav-ACL.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { caldav-ACL.php: fwrite($fh,$request->raw_post); caldav-ACL.php:$resource = new DAVResource( $request->path ); caldav-ACL.php: (DAV:no-ace-conflict): The ACEs submitted in the ACL request MUST NOT caldav-ACL.php: that an implementation-specific ACL restriction has been violated. caldav-ACL.php: (DAV:no-protected-ace-conflict): The ACEs submitted in the ACL caldav-ACL.php: (DAV:no-inherited-ace-conflict): The ACEs submitted in the ACL caldav-ACL.php: implementation-dependent. Implementations MUST either report this caldav-ACL.php: (DAV:limited-number-of-aces): The number of ACEs submitted in the ACL caldav-ACL.php: However, ACL-compliant servers MUST support at least one ACE granting caldav-ACL.php: (DAV:deny-before-grant): All non-inherited deny ACEs MUST precede all caldav-ACL.php: non-inherited grant ACEs. caldav-ACL.php: (DAV:grant-only): The ACEs submitted in the ACL request MUST NOT caldav-ACL.php: restrictions of the resource include the DAV:grant-only constraint caldav-ACL.php: (DAV:no-invert): The ACL request MUST NOT include a DAV:invert caldav-ACL.php: the resource includes the DAV:no-invert constraint (defined in caldav-ACL.php: (DAV:no-abstract): The ACL request MUST NOT attempt to grant or deny caldav-ACL.php: (DAV:not-supported-privilege): The ACEs submitted in the ACL request caldav-ACL.php: (DAV:missing-required-principal): The result of the ACL request MUST caldav-ACL.php: DAV:required-principal XML element in the ACL semantics of that caldav-ACL.php: (DAV:recognized-principal): Every principal URL in the ACL request caldav-ACL.php: (DAV:allowed-principal): The principals specified in the ACEs caldav-ACL.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-ACL.php:$aces = $xmltree->GetPath("/DAV::acl/*"); caldav-ACL.php:$grantor = new DAVResource($request->path); caldav-ACL.php:if ( ! $grantor->Exists() ) $request->DoResponse( 404 ); caldav-ACL.php:if ( $grantor->IsPrincipal() ) $by_principal = $grantor->GetProperty('principal_id'); caldav-ACL.php:else if ( $grantor->IsCollection() ) $by_collection = $grantor->GetProperty('collection_id'); caldav-ACL.php:else $request->PreconditionFailed(403,'not-supported-privilege','ACLs may only be applied to Principals or Collections'); caldav-ACL.php:$qry->Exec('ACL',__LINE__,__FILE__); caldav-ACL.php: $elements = $ace->GetContent(); caldav-ACL.php: if ( $principal->GetTag() != 'DAV::principal' ) $request->MalformedRequest('ACL request must contain a principal, not '.$principal->GetTag()); caldav-ACL.php: $grant_tag = $grant->GetTag(); caldav-ACL.php: if ( $grant_tag == 'DAV::deny' ) $request->PreconditionFailed(403,'grant-only'); caldav-ACL.php: if ( $grant_tag == 'DAV::invert' ) $request->PreconditionFailed(403,'no-invert'); caldav-ACL.php: if ( $grant->GetTag() != 'DAV::grant' ) $request->MalformedRequest('ACL request must contain a principal for each ACE'); caldav-ACL.php: $xml_privs = $grant->GetPath("/DAV::grant/DAV::privilege/*"); caldav-ACL.php: $privilege_names[] = $priv->GetTag(); caldav-ACL.php: $principal_content = $principal->GetContent(); caldav-ACL.php: if ( count($principal_content) != 1 ) $request->MalformedRequest('ACL request must contain exactly one principal per ACE'); caldav-ACL.php: switch( $principal_content->GetTag() ) { caldav-ACL.php: $principal_property = $principal_content->GetContent(); caldav-ACL.php: if ( $principal_property[0]->GetTag() != 'DAV::owner' ) $request->PreconditionFailed(403, 'recognized-principal' ); caldav-ACL.php: $request->PreconditionFailed(403, 'no-protected-ace-conflict', 'Owner must always have all permissions' ); caldav-ACL.php: $request->PreconditionFailed(403, 'allowed-principal', 'May not set privileges for unauthenticated users' ); caldav-ACL.php: $principal = new DAVResource( DeconstructURL($principal_content->GetContent()) ); caldav-ACL.php: if ( ! $principal->Exists() || !$principal->IsPrincipal() ) caldav-ACL.php: $request->PreconditionFailed(403,'recognized-principal', 'Principal "' + $principal_content->GetContent() + '" not found.'); caldav-ACL.php: $sqlparms = array( ':to_principal' => $principal->GetProperty('principal_id') ); caldav-ACL.php: if ( $qry->Exec('ACL',__LINE__,__FILE__) && $qry->rows() == 1 && $current = $qry->Fetch() ) { caldav-ACL.php: $qry->Exec('ACL',__LINE__,__FILE__); caldav-ACL.php: if ( bindec($grantor->GetProperty('default_privileges')) == $privileges ) continue; // There is no change, so skip it caldav-ACL.php: $qry->Exec('ACL',__LINE__,__FILE__); caldav-ACL.php: $request->PreconditionFailed(403, 'allowed-principal', 'May not set privileges for unauthenticated users' ); caldav-ACL.php: $request->PreconditionFailed(403, 'recognized-principal' ); caldav-ACL.php:$qry->Exec('ACL',__LINE__,__FILE__); caldav-ACL.php:$request->DoResponse( 200 ); caldav-BIND.php:* CalDAV Server - handle BIND method caldav-BIND.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-BIND.php:$request->NeedPrivilege('DAV::bind'); caldav-BIND.php:if ( ! $request->IsCollection() ) { caldav-BIND.php: $request->PreconditionFailed(403,'DAV::bind-into-collection',translate('The BIND Request-URI MUST identify a collection.')); caldav-BIND.php:$parent_container = $request->path; caldav-BIND.php:if ( ! $parent->Exists() || $parent->IsSchedulingCollection() ) { caldav-BIND.php: $request->PreconditionFailed(403, 'DAV::method-not-allowed',translate('The BIND method is not allowed at that location.') ); caldav-BIND.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-BIND.php:$segment = $xmltree->GetElements('DAV::segment'); caldav-BIND.php:$segment = $segment[0]->GetContent(); caldav-BIND.php: $request->PreconditionFailed(403, 'DAV::name-allowed',translate('That destination name contains invalid characters.') ); caldav-BIND.php:$href = $xmltree->GetElements('DAV::href'); caldav-BIND.php:$href = $href[0]->GetContent(); caldav-BIND.php:if ( $destination->Exists() ) { caldav-BIND.php: $request->PreconditionFailed(403,'DAV::can-overwrite',translate('A resource already exists at the destination.')); caldav-BIND.php:if ( !$source->Exists() ) { caldav-BIND.php: $request->PreconditionFailed(403,'DAV::bind-source-exists',translate('The BIND Request MUST identify an existing resource.')); caldav-BIND.php:if ( $source->IsPrincipal() || !$source->IsCollection() ) { caldav-BIND.php: $request->PreconditionFailed(403,'DAV::binding-allowed',translate('DAViCal only allows BIND requests for collections at present.')); caldav-BIND.php: ':target_id' => $source->GetProperty('collection_id'), caldav-BIND.php: ':ticket_id' => (isset($request->ticket) ? $request->ticket->id() : null), caldav-BIND.php: ':parent_container' => $parent->dav_name(), caldav-BIND.php: ':session_principal' => $session->principal_id, caldav-BIND.php: ':displayname' => $source->GetProperty('displayname') caldav-BIND.php:if ( $qry->Exec('BIND',__LINE__,__FILE__) ) { caldav-BIND.php: $request->DoResponse(201); caldav-BIND.php: $request->DoResponse(500,translate('Database Error')); caldav-client.php:* removed curl - now using fsockopen caldav-client.php:* changed 2009 by Andres Obrero - Switzerland andres@obrero.ch caldav-client.php: $this->user = $user; caldav-client.php: $this->pass = $pass; caldav-client.php: $this->calendar = $calendar; caldav-client.php: $this->headers = array(); caldav-client.php: if ( preg_match( '#^(https?)://([a-z0-9.-]+)(:([0-9]+))?(/.*)$#', $base_url, $matches ) ) { caldav-client.php: $this->server = $matches[2]; caldav-client.php: $this->base_url = $matches[5]; caldav-client.php: $this->protocol = 'ssl'; caldav-client.php: $this->port = 443; caldav-client.php: $this->protocol = 'tcp'; caldav-client.php: $this->port = 80; caldav-client.php: $this->port = intval($matches[4]); caldav-client.php: * Adds an If-Match or If-None-Match header caldav-client.php: $this->headers[] = sprintf( "%s-Match: %s", ($match ? "If" : "If-None"), $etag); caldav-client.php: $this->headers[] = 'Depth: '. ($depth == '1' ? "1" : ($depth == 'infinity' ? $depth : "0") ); caldav-client.php: if ( !isset($user_agent) ) $user_agent = $this->user_agent; caldav-client.php: $this->user_agent = $user_agent; caldav-client.php: * Add a Content-type: header. caldav-client.php: $this->headers[] = "Content-type: $type"; caldav-client.php: $this->httpResponse = trim($response); caldav-client.php: $this->httpResponse = trim(substr($response, 0, $pos)); caldav-client.php: $this->xmlResponse = trim(substr($response, $pos)); caldav-client.php: return $this->httpRequest; caldav-client.php: return $this->httpResponse; caldav-client.php: return $this->xmlRequest; caldav-client.php: return $this->xmlResponse; caldav-client.php: $headers[] = $this->requestMethod." ". $this->base_url . $relative_url . " HTTP/1.1"; caldav-client.php: $headers[] = "Authorization: Basic ".base64_encode($this->user .":". $this->pass ); caldav-client.php: $headers[] = "Host: ".$this->server .":".$this->port; caldav-client.php: foreach( $this->headers as $ii => $head ) { caldav-client.php: $headers[] = "Content-Length: " . strlen($this->body); caldav-client.php: $headers[] = "User-Agent: " . $this->user_agent; caldav-client.php: $this->httpRequest = join("\r\n",$headers); caldav-client.php: $this->xmlRequest = $this->body; caldav-client.php: $fip = fsockopen( $this->protocol . '://' . $this->server, $this->port, $errno, $errstr, _FSOCK_TIMEOUT); //error handling? caldav-client.php: if ( !fwrite($fip, $this->httpRequest."\r\n\r\n".$this->body) ) { fclose($fip); return false; } caldav-client.php: $this->headers = array(); // reset the headers array for our next request caldav-client.php: $this->ParseResponse($rsp); caldav-client.php: $this->requestMethod = "OPTIONS"; caldav-client.php: $this->body = ""; caldav-client.php: $headers = $this->DoRequest($relative_url); caldav-client.php: $options_header = preg_replace( '/^.*Allow: ([a-z, ]+)\r?\n.*/is', '$1', $headers ); caldav-client.php: $this->body = $xml; caldav-client.php: $this->requestMethod = $request_method; caldav-client.php: $this->SetContentType("text/xml"); caldav-client.php: return $this->DoRequest($relative_url); caldav-client.php: $this->body = ""; caldav-client.php: $this->requestMethod = "GET"; caldav-client.php: return $this->DoRequest( $relative_url ); caldav-client.php: $this->body = $icalendar; caldav-client.php: $this->requestMethod = "PUT"; caldav-client.php: $this->SetMatch( ($etag != '*'), $etag ); caldav-client.php: $this->SetContentType("text/icalendar"); caldav-client.php: $headers = $this->DoRequest($relative_url); caldav-client.php: $this->body = ""; caldav-client.php: $this->requestMethod = "DELETE"; caldav-client.php: $this->SetMatch( true, $etag ); caldav-client.php: $this->DoRequest($relative_url); caldav-client.php: return $this->resultcode; caldav-client.php: * @param string $filter XML fragment which is the element of a calendar-query caldav-client.php: * be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: $this->DoXMLRequest( 'REPORT', $xml, $relative_url ); caldav-client.php: $xml_parser = xml_parser_create_ns('UTF-8'); caldav-client.php: $this->xml_tags = array(); caldav-client.php: xml_parse_into_struct( $xml_parser, $this->xmlResponse, $this->xml_tags ); caldav-client.php: foreach( $this->xml_tags as $k => $v ) { caldav-client.php: case 'URN:IETF:PARAMS:XML:NS:CALDAV:CALENDAR-DATA': caldav-client.php: $range = ""; caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: return $this->DoCalendarQuery($filter, $relative_url); caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: COMPLETED caldav-client.php: caldav-client.php: caldav-client.php: CANCELLED caldav-client.php: $time_range caldav-client.php: caldav-client.php: caldav-client.php: return $this->DoCalendarQuery($filter, $relative_url); caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: $uid caldav-client.php: caldav-client.php: caldav-client.php: caldav-client.php: return $this->DoCalendarQuery($filter, $relative_url); caldav-client.php: return $this->DoGETRequest( $relative_url . $href ); caldav-client.php:* $options = $cal->DoOptionsRequest(); caldav-client.php:* $cal->SetDepth(1); caldav-client.php:* $folder_xml = $cal->DoXMLRequest("PROPFIND", '' ); caldav-client.php:* $events = $cal->GetEvents("20070101T000000Z","20070201T000000Z"); caldav-client.php:* $options = $cal->DoOptionsRequest(); caldav-client.php:* caldav-client.php:* // $cal->SetDepth(1); caldav-client.php:* // $folder_xml = $cal->DoXMLRequest("PROPFIND", $xmlC); caldav-client.php:* $events = $cal->GetEvents("20090201T000000Z","20090301T000000Z"); caldav-client.php:* print "\n---------------------------------------------\n"; caldav-client-v2.php:* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LGPL version 3 or later caldav-client-v2.php: $this->url = $url; caldav-client-v2.php: $this->displayname = $displayname; caldav-client-v2.php: $this->getctag = $getctag; caldav-client-v2.php: return( '(URL: '.$this->url.' Ctag: '.$this->getctag.' Displayname: '.$this->displayname .')'. "\n" ); caldav-client-v2.php: * The principal-URL we're using caldav-client-v2.php: * The calendar-URL we're using caldav-client-v2.php: * The calendar-home-set we're using caldav-client-v2.php: $this->user = $user; caldav-client-v2.php: $this->pass = $pass; caldav-client-v2.php: $this->headers = array(); caldav-client-v2.php: if ( preg_match( '#^(https?)://([a-z0-9.-]+)(:([0-9]+))?(/.*)$#', $base_url, $matches ) ) { caldav-client-v2.php: $this->server = $matches[2]; caldav-client-v2.php: $this->base_url = $matches[5]; caldav-client-v2.php: $this->protocol = 'ssl'; caldav-client-v2.php: $this->port = 443; caldav-client-v2.php: $this->protocol = 'tcp'; caldav-client-v2.php: $this->port = 80; caldav-client-v2.php: $this->port = intval($matches[4]); caldav-client-v2.php: * Adds an If-Match or If-None-Match header caldav-client-v2.php: $this->headers['match'] = sprintf( "%s-Match: %s", ($match ? "If" : "If-None"), $etag); caldav-client-v2.php: $this->headers['depth'] = 'Depth: '. ($depth == '1' ? "1" : ($depth == 'infinity' ? $depth : "0") ); caldav-client-v2.php: if ( !isset($user_agent) ) $user_agent = $this->user_agent; caldav-client-v2.php: $this->user_agent = $user_agent; caldav-client-v2.php: * Add a Content-type: header. caldav-client-v2.php: $this->headers['content-type'] = "Content-type: $type"; caldav-client-v2.php: $this->calendar_url = $url; caldav-client-v2.php: $this->httpResponse = trim($response); caldav-client-v2.php: $this->httpResponse = trim(substr($response, 0, $pos)); caldav-client-v2.php: $this->xmlResponse = trim(substr($response, $pos)); caldav-client-v2.php: $this->xmlResponse = preg_replace('{>[^>]*$}s', '>',$this->xmlResponse ); caldav-client-v2.php: $parser = xml_parser_create_ns('UTF-8'); caldav-client-v2.php: if ( xml_parse_into_struct( $parser, $this->xmlResponse, $this->xmlnodes, $this->xmltags ) === 0 ) { caldav-client-v2.php: printf( "XML parsing error: %s - %s\n", xml_get_error_code($parser), xml_error_string(xml_get_error_code($parser)) ); caldav-client-v2.php:// echo "\nNodes array............................................................\n"; print_r( $this->xmlnodes ); caldav-client-v2.php:// echo "\nTags array............................................................\n"; print_r( $this->xmltags ); caldav-client-v2.php: printf( "\nXML Reponse:\n%s\n", $this->xmlResponse ); caldav-client-v2.php: return $this->httpRequest; caldav-client-v2.php: return $this->httpResponseHeaders; caldav-client-v2.php: return $this->httpResponseBody; caldav-client-v2.php: return $this->xmlRequest; caldav-client-v2.php: return $this->xmlResponse; caldav-client-v2.php: if ( !isset($url) ) $url = $this->base_url; caldav-client-v2.php: $this->request_url = $url; caldav-client-v2.php: if ( preg_match( '{[^%?&=+,.-_/a-z0-9]}', $url ) ) { caldav-client-v2.php: $headers[] = $this->requestMethod." ". $url . " HTTP/1.1"; caldav-client-v2.php: $headers[] = "Authorization: Basic ".base64_encode($this->user .":". $this->pass ); caldav-client-v2.php: $headers[] = "Host: ".$this->server .":".$this->port; caldav-client-v2.php: if ( !isset($this->headers['content-type']) ) $this->headers['content-type'] = "Content-type: text/plain"; caldav-client-v2.php: foreach( $this->headers as $ii => $head ) { caldav-client-v2.php: $headers[] = "Content-Length: " . strlen($this->body); caldav-client-v2.php: $headers[] = "User-Agent: " . $this->user_agent; caldav-client-v2.php: $this->httpRequest = join("\r\n",$headers); caldav-client-v2.php: $this->xmlRequest = $this->body; caldav-client-v2.php: $this->httpResponse = ''; caldav-client-v2.php: $this->xmlResponse = ''; caldav-client-v2.php: $fip = fsockopen( $this->protocol . '://' . $this->server, $this->port, $errno, $errstr, _FSOCK_TIMEOUT); //error handling? caldav-client-v2.php: if ( !fwrite($fip, $this->httpRequest."\r\n\r\n".$this->body) ) { fclose($fip); return false; } caldav-client-v2.php: list( $this->httpResponseHeaders, $this->httpResponseBody ) = preg_split( '{\r?\n\r?\n}s', $response, 2 ); caldav-client-v2.php: if ( preg_match( '{Transfer-Encoding: chunked}i', $this->httpResponseHeaders ) ) $this->Unchunk(); caldav-client-v2.php: $this->headers = array(); // reset the headers array for our next request caldav-client-v2.php: $this->ParseResponse($this->httpResponseBody); caldav-client-v2.php: $chunks = $this->httpResponseBody; caldav-client-v2.php: if ( preg_match('{^((\r\n)?\s*([ 0-9a-fA-F]+)(;[^\n]*)?\r?\n)}', $chunks, $matches ) ) { caldav-client-v2.php: // printf( "---------------------------------\n%s\n---------------------------------\n", substr($chunks,$pos,$bytes) ); caldav-client-v2.php: $this->httpResponseBody = $content; caldav-client-v2.php: $this->requestMethod = "OPTIONS"; caldav-client-v2.php: $this->body = ""; caldav-client-v2.php: $headers = $this->DoRequest($url); caldav-client-v2.php: $options_header = preg_replace( '/^.*Allow: ([a-z, ]+)\r?\n.*/is', '$1', $headers ); caldav-client-v2.php: $this->body = $xml; caldav-client-v2.php: $this->requestMethod = $request_method; caldav-client-v2.php: $this->SetContentType("text/xml"); caldav-client-v2.php: return $this->DoRequest($url); caldav-client-v2.php: $this->body = ""; caldav-client-v2.php: $this->requestMethod = "GET"; caldav-client-v2.php: return $this->DoRequest( $url ); caldav-client-v2.php: $this->body = ""; caldav-client-v2.php: $this->requestMethod = "HEAD"; caldav-client-v2.php: return $this->DoRequest( $url ); caldav-client-v2.php: $this->body = $icalendar; caldav-client-v2.php: $this->requestMethod = "PUT"; caldav-client-v2.php: $this->SetMatch( ($etag != '*'), $etag ); caldav-client-v2.php: $this->SetContentType('text/calendar; encoding="utf-8"'); caldav-client-v2.php: $this->DoRequest($url); caldav-client-v2.php: if ( preg_match( '{^ETag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1]; caldav-client-v2.php: printf( "No etag in:\n%s\n", $this->httpResponseHeaders ); caldav-client-v2.php: $save_request = $this->httpRequest; caldav-client-v2.php: $save_response_headers = $this->httpResponseHeaders; caldav-client-v2.php: $this->DoHEADRequest( $url ); caldav-client-v2.php: if ( preg_match( '{^Etag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1]; caldav-client-v2.php: printf( "Still No etag in:\n%s\n", $this->httpResponseHeaders ); caldav-client-v2.php: $this->httpRequest = $save_request; caldav-client-v2.php: $this->httpResponseHeaders = $save_response_headers; caldav-client-v2.php: $this->body = ""; caldav-client-v2.php: $this->requestMethod = "DELETE"; caldav-client-v2.php: $this->SetMatch( true, $etag ); caldav-client-v2.php: $this->DoRequest($url); caldav-client-v2.php: return $this->resultcode; caldav-client-v2.php: $this->SetDepth($depth); caldav-client-v2.php: $xml->NSElement($prop,$v); caldav-client-v2.php: $this->body = $xml->Render('propfind',$prop ); caldav-client-v2.php: $this->requestMethod = "PROPFIND"; caldav-client-v2.php: $this->SetContentType("text/xml"); caldav-client-v2.php: $this->DoRequest($url); caldav-client-v2.php: return $this->GetXmlResponse(); caldav-client-v2.php: $this->principal_url = $url; caldav-client-v2.php: return $this->principal_url; caldav-client-v2.php: * Get/Set the calendar-home-set URL caldav-client-v2.php: * @param $url array of string The calendar-home-set URLs to set caldav-client-v2.php: $this->calendar_home_set = $urls; caldav-client-v2.php: return $this->calendar_home_set; caldav-client-v2.php: * Get/Set the calendar-home-set URL caldav-client-v2.php: $this->calendar_urls = $urls; caldav-client-v2.php: return $this->calendar_urls; caldav-client-v2.php: foreach( $this->xmltags[$tagname] AS $k => $v ) { caldav-client-v2.php: if ( $this->xmlnodes[$j]['tag'] == 'DAV::href' ) { caldav-client-v2.php: return rawurldecode($this->xmlnodes[$j]['value']); caldav-client-v2.php: if ( isset($this->xmltags[$tagname]) && isset($this->xmltags[$tagname][$i]) ) { caldav-client-v2.php: $j = $this->xmltags[$tagname][$i]; caldav-client-v2.php: while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::href' ) { caldav-client-v2.php:// printf( "Node[$j]: %s\n", $this->xmlnodes[$j]['tag']); caldav-client-v2.php: if ( $this->xmlnodes[$j]['tag'] == 'DAV::status' && $this->xmlnodes[$j]['value'] != 'HTTP/1.1 200 OK' ) return null; caldav-client-v2.php:// printf( "Node[$j]: %s\n", $this->xmlnodes[$j]['tag']); caldav-client-v2.php: if ( $j > 0 && isset($this->xmlnodes[$j]['value']) ) { caldav-client-v2.php:// printf( "Value[$j]: %s\n", $this->xmlnodes[$j]['value']); caldav-client-v2.php: return rawurldecode($this->xmlnodes[$j]['value']); caldav-client-v2.php: if ( isset($this->xmltags[$tagname]) && isset($this->xmltags[$tagname][$i]) ) { caldav-client-v2.php: $j = $this->xmltags[$tagname][$i]; caldav-client-v2.php: while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::resourcetype' ); caldav-client-v2.php: while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::href' ); caldav-client-v2.php: if ( $j > 0 && isset($this->xmlnodes[$j]['value']) ) { caldav-client-v2.php: return rawurldecode($this->xmlnodes[$j]['value']); caldav-client-v2.php: $level = $this->xmlnodes[$nodenum]['level']; caldav-client-v2.php: while ( $this->xmlnodes[++$nodenum]['level'] >= $level ) { caldav-client-v2.php: if ( $this->xmlnodes[$nodenum]['tag'] == 'DAV::propstat' ) { caldav-client-v2.php: if ( $this->xmlnodes[$nodenum]['type'] == 'open' ) { caldav-client-v2.php: elseif ( !isset($this->xmlnodes[$nodenum]) || !is_array($this->xmlnodes[$nodenum]) ) { caldav-client-v2.php: elseif ( $this->xmlnodes[$nodenum]['tag'] == 'DAV::status' ) { caldav-client-v2.php: $status = $this->xmlnodes[$nodenum]['value']; caldav-client-v2.php: $props[] = $this->xmlnodes[$nodenum]; caldav-client-v2.php: * @param string $url The URL to find the principal-URL from caldav-client-v2.php: $xml = $this->DoPROPFINDRequest( $url, array('resourcetype', 'current-user-principal', 'owner', 'principal-URL', caldav-client-v2.php: 'urn:ietf:params:xml:ns:caldav:calendar-home-set'), 1); caldav-client-v2.php: $principal_url = $this->HrefForProp('DAV::principal'); caldav-client-v2.php: foreach( array('DAV::current-user-principal', 'DAV::principal-URL', 'DAV::owner') AS $href ) { caldav-client-v2.php: $principal_url = $this->HrefValueInside($href); caldav-client-v2.php: return $this->PrincipalURL($principal_url); caldav-client-v2.php: * @param string $url The URL to find the calendar-home-set from caldav-client-v2.php: if ( !isset($this->principal_url) ) { caldav-client-v2.php: $this->FindPrincipal(); caldav-client-v2.php: $this->DoPROPFINDRequest( $this->principal_url, array('urn:ietf:params:xml:ns:caldav:calendar-home-set'), 0); caldav-client-v2.php: foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-home-set'] AS $k => $v ) { caldav-client-v2.php: if ( $this->xmlnodes[$v]['type'] != 'open' ) continue; caldav-client-v2.php: while( $this->xmlnodes[++$v]['type'] != 'close' && $this->xmlnodes[$v]['tag'] != 'urn:ietf:params:xml:ns:caldav:calendar-home-set' ) { caldav-client-v2.php:// printf( "Tag: '%s' = '%s'\n", $this->xmlnodes[$v]['tag'], $this->xmlnodes[$v]['value']); caldav-client-v2.php: if ( $this->xmlnodes[$v]['tag'] == 'DAV::href' && isset($this->xmlnodes[$v]['value']) ) caldav-client-v2.php: $calendar_home[] = rawurldecode($this->xmlnodes[$v]['value']); caldav-client-v2.php: $calendar_home = $this->FindCalendarHome(true); caldav-client-v2.php: return $this->CalendarHomeSet($calendar_home); caldav-client-v2.php: if ( !isset($this->calendar_home_set[0]) ) { caldav-client-v2.php: $this->FindCalendarHome(); caldav-client-v2.php: $this->DoPROPFINDRequest( $this->calendar_home_set[0], array('resourcetype','displayname','http://calendarserver.org/ns/:getctag'), 1); caldav-client-v2.php: if ( isset($this->xmltags['urn:ietf:params:xml:ns:caldav:calendar']) ) { caldav-client-v2.php: foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar'] AS $k => $v ) { caldav-client-v2.php: $calendar_urls[$this->HrefForProp('urn:ietf:params:xml:ns:caldav:calendar', $k)] = 1; caldav-client-v2.php: foreach( $this->xmltags['DAV::href'] AS $i => $hnode ) { caldav-client-v2.php: $href = rawurldecode($this->xmlnodes[$hnode]['value']); caldav-client-v2.php: $ok_props = $this->GetOKProps($hnode); caldav-client-v2.php: $calendar->getctag = $v['value']; caldav-client-v2.php: $calendar->displayname = $v['value']; caldav-client-v2.php: return $this->CalendarUrls($calendars); caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); caldav-client-v2.php: $calendar_properties = array( 'resourcetype', 'displayname', 'http://calendarserver.org/ns/:getctag', 'urn:ietf:params:xml:ns:caldav:calendar-timezone', 'supported-report-set' ); caldav-client-v2.php: $this->DoPROPFINDRequest( $this->calendar_url, $calendar_properties, 0); caldav-client-v2.php: $hnode = $this->xmltags['DAV::href'][0]; caldav-client-v2.php: $href = rawurldecode($this->xmlnodes[$hnode]['value']); caldav-client-v2.php: $ok_props = $this->GetOKProps($hnode); caldav-client-v2.php: $calendar->{$name} = $v['value']; caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); caldav-client-v2.php: $this->DoPROPFINDRequest( $this->calendar_url, array('getetag'), 1); caldav-client-v2.php: if ( isset($this->xmltags['DAV::getetag']) ) { caldav-client-v2.php: foreach( $this->xmltags['DAV::getetag'] AS $k => $v ) { caldav-client-v2.php: $href = $this->HrefForProp('DAV::getetag', $k); caldav-client-v2.php: if ( isset($href) && isset($this->xmlnodes[$v]['value']) ) $etags[$href] = $this->xmlnodes[$v]['value']; caldav-client-v2.php: * Get a bunch of events for a calendar with a calendar-multiget report caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); caldav-client-v2.php: $this->body = << caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: $this->requestMethod = "REPORT"; caldav-client-v2.php: $this->SetContentType("text/xml"); caldav-client-v2.php: $this->DoRequest( $this->calendar_url ); caldav-client-v2.php: if ( isset($this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-data']) ) { caldav-client-v2.php: foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-data'] AS $k => $v ) { caldav-client-v2.php: $href = $this->HrefForProp('urn:ietf:params:xml:ns:caldav:calendar-data', $k); caldav-client-v2.php:// echo "Calendar-data:\n"; print_r($this->xmlnodes[$v]); caldav-client-v2.php: $events[$href] = $this->xmlnodes[$v]['value']; caldav-client-v2.php: $this->DoGETRequest($href); caldav-client-v2.php: $events[$href] = $this->httpResponseBody; caldav-client-v2.php: * @param string $filter XML fragment which is the element of a calendar-query caldav-client-v2.php: * be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); caldav-client-v2.php: $this->body = << caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: $this->requestMethod = "REPORT"; caldav-client-v2.php: $this->SetContentType("text/xml"); caldav-client-v2.php: $this->DoRequest( $this->calendar_url ); caldav-client-v2.php: foreach( $this->xmltags as $k => $v ) { caldav-client-v2.php: case 'urn:ietf:params:xml:ns:caldav:calendar-data': caldav-client-v2.php: $range = ""; caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: return $this->DoCalendarQuery($filter, $relative_url); caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: COMPLETED caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: CANCELLED caldav-client-v2.php: $time_range caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: return $this->DoCalendarQuery($filter, $relative_url); caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: $uid caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: caldav-client-v2.php: return $this->DoCalendarQuery($filter, $relative_url); caldav-client-v2.php: return $this->DoGETRequest( $href ); caldav-client-v2.php:* $options = $cal->DoOptionsRequest(); caldav-client-v2.php:* $cal->SetDepth(1); caldav-client-v2.php:* $folder_xml = $cal->DoXMLRequest("PROPFIND", '' ); caldav-client-v2.php:* $events = $cal->GetEvents("20070101T000000Z","20070201T000000Z"); caldav-client-v2.php:* $options = $cal->DoOptionsRequest(); caldav-client-v2.php:* caldav-client-v2.php:* // $cal->SetDepth(1); caldav-client-v2.php:* // $folder_xml = $cal->DoXMLRequest("PROPFIND", $xmlC); caldav-client-v2.php:* $events = $cal->GetEvents("20090201T000000Z","20090301T000000Z"); caldav-client-v2.php:* print "\n---------------------------------------------\n"; caldav-DELETE.php:* CalDAV Server - handle DELETE method caldav-DELETE.php:$dav_resource = new DAVResource($request->path); caldav-DELETE.php:$container = $dav_resource->FetchParentContainer(); caldav-DELETE.php:$container->NeedPrivilege('DAV::unbind'); caldav-DELETE.php:$lock_opener = $request->FailIfLocked(); caldav-DELETE.php:$etag = md5($request->raw_post); caldav-DELETE.php:$nome = substr($request->username, 0, 9); caldav-DELETE.php: if ( $qry->Exec("DELETE") && $qry->rows() == 1 ){ caldav-DELETE.php: $delete_row = $qry->Fetch(); caldav-DELETE.php: if ($qry->QDo("DELETE FROM phpgw_cal WHERE cal_id = :cal_id AND owner = :nome",array( ':cal_id' => $CALID, ':nome' => $nome))){ caldav-DELETE.php: if($qry->QDO("DELETE FROM phpgw_cal_user WHERE cal_login = :nome AND cal_id = :cal_id",array( ':nome' => $nome , ':cal_id' => $CALID))){ caldav-DELETE.php: if ( $delete_row->cal_type == 'M' ) caldav-DELETE.php: if($qry->QDO("DELETE FROM phpgw_cal_repeats WHERE cal_id = :cal_id",array( ':cal_id' => $CALID))) caldav-DELETE.php: @dbg_error_log( "DELETE", "DELETE (collection): User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); caldav-DELETE.php: @dbg_error_log( "DELETE", "DELETE (collection): User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); caldav-DELETE.php: //$request->DoResponse( 500, translate("Error querying database.") ); caldav-DELETE.php: //if ( $qry->Exec('DELETE',__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-DELETE.php: // while( $row = $qry->Fetch() ) { caldav-DELETE.php: // delete_collection($row->child_id); caldav-DELETE.php: //if ( $qry->QDo("SELECT write_sync_change(collection_id, 404, caldav_data.dav_name) FROM caldav_data WHERE collection_id = :collection_id", $params ) caldav-DELETE.php: // && $qry->QDo("DELETE FROM property WHERE dav_name LIKE (SELECT dav_name FROM collection WHERE collection_id = :collection_id) || '%'", $params ) caldav-DELETE.php: // && $qry->QDo("DELETE FROM locks WHERE dav_name LIKE (SELECT dav_name FROM collection WHERE collection_id = :collection_id) || '%'", $params ) caldav-DELETE.php: // && $qry->QDo("DELETE FROM caldav_data WHERE collection_id = :collection_id", $params ) caldav-DELETE.php: // && $qry->QDo("DELETE FROM collection WHERE collection_id = :collection_id", $params ) ) { caldav-DELETE.php: // @dbg_error_log( "DELETE", "DELETE (collection): User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); caldav-DELETE.php:if ( !$dav_resource->Exists() )$request->DoResponse( 404 ); caldav-DELETE.php:if ( ! ( $dav_resource->resource_id() > 0 ) ) { caldav-DELETE.php: $request->DoResponse( 403 ); caldav-DELETE.php:$qry->Begin(); caldav-DELETE.php:if ( $dav_resource->IsBinding() ) { caldav-DELETE.php: $params = array( ':dav_name' => $dav_resource->dav_name() ); caldav-DELETE.php: if ( $qry->QDo("DELETE FROM dav_binding WHERE dav_name = :dav_name", $params ) caldav-DELETE.php: && $qry->Commit() ) { caldav-DELETE.php: @dbg_error_log( "DELETE", "DELETE: Binding: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); caldav-DELETE.php: $request->DoResponse( 204 ); caldav-DELETE.php:else if ( $dav_resource->IsCollection() ) { caldav-DELETE.php: if ( delete_collection( $nome,$CALID ) && $qry->Commit() ) { caldav-DELETE.php: $request->DoResponse( 204 ); caldav-DELETE.php: if ( (isset($request->etag_if_match) && $request->etag_if_match != $dav_resource->unique_tag() ) ) { caldav-DELETE.php: $request->DoResponse( 412, translate("Resource has changed on server - not deleted") ); caldav-DELETE.php:$request->DoResponse( 500 ); caldav-DELTICKET.php:* CalDAV Server - handle DELTICKET method in line with defunct proposed RFC caldav-DELTICKET.php:* from: http://tools.ietf.org/html/draft-ito-dav-ticket-00 caldav-DELTICKET.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-DELTICKET.php:if ( ! $request->HavePrivilegeTo('DAV::unbind') && $request->ticket->owner() != $session->principal_id ) { caldav-DELTICKET.php: $request->NeedPrivilege('DAV::unbind'); caldav-DELTICKET.php:if ( ! isset($request->ticket) ) { caldav-DELTICKET.php: $r = new DAVResource($request->path); caldav-DELTICKET.php: if ( ! $r->Exists() ) { caldav-DELTICKET.php: $request->PreconditionFailed(404,'not-found'); caldav-DELTICKET.php: $request->PreconditionFailed(412,'ticket-does-not-exist','The specified ticket does not exist'); caldav-DELTICKET.php: $request->MalformedRequest('No ticket specified'); caldav-DELTICKET.php:$qry = new AwlQuery('DELETE FROM access_ticket WHERE ticket_id=:ticket_id', array( ':ticket_id' => $request->ticket->id() ) ); caldav-DELTICKET.php:if ( $qry->Exec('DELTICKET', __LINE__, __FILE__) ) { caldav-DELTICKET.php: $request->DoResponse( 204 ); caldav-DELTICKET.php:$request->DoResponse( 500 ); caldav-GET.php:* CalDAV Server - handle GET method caldav-GET.php:$dav_resource = new DAVResource($request->path); caldav-GET.php:$dav_resource->NeedPrivilege( array('urn:ietf:params:xml:ns:caldav:read-free-busy','DAV::read') ); caldav-GET.php:if ( ! $dav_resource->Exists() ) { caldav-GET.php: $request->DoResponse( 404, translate("Resource Not Found.") ); caldav-GET.php: // so we will present an obfuscated version of the event that just says "Busy" (translated :-) caldav-GET.php: $confidential->SetType($icalendar->GetType()); caldav-GET.php: $confidential->AddProperty( 'SUMMARY', translate('Busy') ); caldav-GET.php: $confidential->AddProperty( 'CLASS', 'CONFIDENTIAL' ); caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('DTSTART'), 'DTSTART' ); caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('RRULE'), 'RRULE' ); caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('DURATION'), 'DURATION' ); caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('DTEND'), 'DTEND' ); caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('UID'), 'UID' ); caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('CREATED'), 'CREATED' ); caldav-GET.php:if ( $dav_resource->IsCollection() ) { caldav-GET.php: if ( ! $dav_resource->IsCalendar() && !(isset($c->get_includes_subcollections) && $c->get_includes_subcollections) ) { caldav-GET.php: $request->DoResponse( 405, translate("GET requests on collections are only supported for calendars.") ); caldav-GET.php: if ( isset($c->get_includes_subcollections) && $c->get_includes_subcollections ) { caldav-GET.php: $params = array( ':path_match' => '^'.$request->path ); caldav-GET.php: $params = array( ':collection_id' => $dav_resource->resource_id() ); caldav-GET.php: if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= ' ORDER BY dav_id'; caldav-GET.php: if ( !$qry->Exec("GET",__LINE__,__FILE__) ) { caldav-GET.php: $request->DoResponse( 500, translate("Database Error") ); caldav-GET.php: $vcal->VCalendar(); caldav-GET.php: $displayname = $dav_resource->GetProperty('displayname'); caldav-GET.php: $vcal->AddProperty("X-WR-CALNAME", $displayname); caldav-GET.php: while( $event = $qry->Fetch() ) { caldav-GET.php: $ical = new iCalComponent( $event->caldav_data ); caldav-GET.php: $event_zones = $ical->GetComponents('VTIMEZONE',true); caldav-GET.php: $tzid = $tz->GetPValue('TZID'); caldav-GET.php: $comps = $ical->GetComponents('VTIMEZONE',false); caldav-GET.php: $tzid = $comp->GetPParamValue('DTSTART', 'TZID'); if ( isset($tzid) && !isset($need_zones[$tzid]) ) $need_zones[$tzid] = 1; caldav-GET.php: $tzid = $comp->GetPParamValue('DUE', 'TZID'); if ( isset($tzid) && !isset($need_zones[$tzid]) ) $need_zones[$tzid] = 1; caldav-GET.php: $tzid = $comp->GetPParamValue('DTEND', 'TZID'); if ( isset($tzid) && !isset($need_zones[$tzid]) ) $need_zones[$tzid] = 1; caldav-GET.php: if ( $dav_resource->HavePrivilegeTo('all',false) || $session->user_no == $event->user_no || $session->user_no == $event->logged_user caldav-GET.php: || ( $c->allow_get_email_visibility && $comp->IsAttendee($session->email) ) ) { caldav-GET.php: $vcal->AddComponent($comp); caldav-GET.php: if ( $event->class == 'PRIVATE' ) continue; caldav-GET.php: if ( ! $dav_resource->HavePrivilegeTo('DAV::read') || $event->class == 'CONFIDENTIAL' ) { caldav-GET.php: $vcal->AddComponent(obfuscated_event($comp)); caldav-GET.php: elseif ( isset($c->hide_alarm) && $c->hide_alarm ) { caldav-GET.php: $comp->ClearComponents('VALARM'); caldav-GET.php: $vcal->AddComponent($comp); caldav-GET.php: $vcal->AddComponent($comp); caldav-GET.php: if ( isset($timezones[$tzid]) ) $vcal->AddComponent($timezones[$tzid]); caldav-GET.php: $response = $vcal->Render(); caldav-GET.php: header( 'Content-Length: '.strlen($response) ); caldav-GET.php: header( 'Etag: '.$dav_resource->unique_tag() ); caldav-GET.php: $request->DoResponse( 200, ($request->method == 'HEAD' ? '' : $response), 'text/calendar; charset="utf-8"' ); caldav-GET.php:$resource = $dav_resource->resource(); caldav-GET.php:$ic = new iCalComponent( $resource->caldav_data ); caldav-GET.php:if ( $dav_resource->HavePrivilegeTo('all', false) || $session->user_no == $resource->user_no || $session->user_no == $resource->logged_user caldav-GET.php: || ( $c->allow_get_email_visibility && $ic->IsAttendee($session->email) ) ) { caldav-GET.php:else if ( $resource->class != 'PRIVATE' ) { caldav-GET.php: if ( ! $dav_resource->HavePrivilegeTo('DAV::read') || ( $resource->class == 'CONFIDENTIAL' && ! $request->HavePrivilegeTo('DAV::write-content') ) ) { caldav-GET.php: $ical = new iCalComponent( $resource->caldav_data ); caldav-GET.php: $comps = $ical->GetComponents('VTIMEZONE',false); caldav-GET.php: $ical->SetComponents( array($confidential), $resource->caldav_type ); caldav-GET.php: $resource->caldav_data = $ical->Render(); caldav-GET.php:// else $resource->class == 'PRIVATE' and this person may not see it. caldav-GET.php: $request->DoResponse( 403, translate("Forbidden") ); caldav-GET.php:header( 'Etag: "'.$resource->dav_etag.'"' ); caldav-GET.php:header( 'Content-Length: '.strlen($resource->caldav_data) ); caldav-GET.php:switch( $resource->caldav_type ) { caldav-GET.php: $contenttype = 'text/x-vcard'; caldav-GET.php:$request->DoResponse( 200, ($request->method == 'HEAD' ? '' : $resource->caldav_data), $contenttype.'; charset="utf-8"' ); caldav-LOCK.php:if ( ! $request->AllowedTo('write') ) { caldav-LOCK.php: $request->NeedPrivilege( 'write', $request->path ); caldav-LOCK.php:if ( ! isset($request->xml_tags) ) { caldav-LOCK.php: if ( isset($request->lock_token) ) { caldav-LOCK.php: $request->xml_tags = array(); caldav-LOCK.php: $request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('missing-xml-for-request'), $reply->GetXmlNsArray() ) ); caldav-LOCK.php:foreach( $request->xml_tags AS $k => $v ) { caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); caldav-LOCK.php:$request->UnsupportedRequest($unsupported); // Won't return if there was unsupported stuff. caldav-LOCK.php:$lock_opener = $request->FailIfLocked(); caldav-LOCK.php:if ( $request->method == "LOCK" ) { caldav-LOCK.php: dbg_error_log( "LOCK", "Attempting to lock resource '%s'", $request->path); caldav-LOCK.php: if ( ($lock_token = $request->IsLocked()) ) { // NOTE Assignment in if() is expected here. caldav-LOCK.php: ':dav_name' => $request->path, caldav-LOCK.php: ':request_depth' => $request->depth, caldav-LOCK.php: ':timeout' => $request->timeout.' seconds' caldav-LOCK.php: header( "Lock-Token: " ); caldav-LOCK.php: $qry->Exec("LOCK",__LINE__,__FILE__); caldav-LOCK.php: $lock_row = $request->GetLockRow($lock_token); caldav-LOCK.php: new XMLElement( 'locktype', new XMLElement( $lock_row->type )), caldav-LOCK.php: new XMLElement( 'lockscope', new XMLElement( $lock_row->scope )), caldav-LOCK.php: new XMLElement( 'depth', $request->GetDepthName() ), caldav-LOCK.php: new XMLElement( 'owner', new XMLElement( 'href', $lock_row->owner )), caldav-LOCK.php: new XMLElement( 'timeout', 'Second-'.$request->timeout), caldav-LOCK.php:elseif ( $request->method == "UNLOCK" ) { caldav-LOCK.php: * @TODO: respond with preconditionfailed(409,'lock-token-matches-request-uri') if caldav-LOCK.php: dbg_error_log( "LOCK", "Attempting to unlock resource '%s'", $request->path); caldav-LOCK.php: if ( ($lock_token = $request->IsLocked()) ) { // NOTE Assignment in if() is expected here. caldav-LOCK.php: $qry->Exec("LOCK",__LINE__,__FILE__); caldav-LOCK.php: $request->DoResponse( 204 ); caldav-LOCK.php:$xmldoc = $prop->Render(0,''); caldav-LOCK.php:$request->DoResponse( 200, $xmldoc, 'text/xml; charset="utf-8"' ); caldav-MKCOL.php:* CalDAV Server - handle MKCOL and MKCALENDAR method caldav-MKCOL.php:* @copyright Catalyst IT Ltd, Morphoss Ltd - http://www.morphoss.com/ caldav-MKCOL.php:$request->NeedPrivilege('DAV::bind'); caldav-MKCOL.php:$displayname = $request->path; caldav-MKCOL.php:if ( ! preg_match( '#/$#', $request->path ) ) { caldav-MKCOL.php: dbg_error_log( 'MKCOL', 'Add trailling "/" to "%s"', $request->path); caldav-MKCOL.php: $request->path .= '/'; caldav-MKCOL.php:if ( preg_match( '#^(.*/)([^/]+)(/)?$#', $request->path, $matches ) ) { caldav-MKCOL.php:if ( $parent->IsSchedulingCollection( 'inbox' ) ) { caldav-MKCOL.php: $request->PreconditionFailed(403, 'urn:ietf:params:xml:ns:caldav:no-mkcol-in-inbox' ); caldav-MKCOL.php:$request_type = $request->method; caldav-MKCOL.php:if ( isset($request->xml_tags) ) { caldav-MKCOL.php: $xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-MKCOL.php: if ( $xmltree->GetTag() == 'DAV::mkcol' ) $request_type = 'extended-mkcol'; caldav-MKCOL.php: if ( $xmltree->GetTag() != 'urn:ietf:params:xml:ns:caldav:mkcalendar' && $request_type != 'extended-mkcol' ) { caldav-MKCOL.php: $request->DoResponse( 406, sprintf('The XML is not a "DAV::mkcol" or "urn:ietf:params:xml:ns:caldav:mkcalendar" document (%s)', $xmltree->GetTag()) ); caldav-MKCOL.php: $setprops = $xmltree->GetContent(); // caldav-MKCOL.php: $setprops = $setprops[0]->GetContent(); // caldav-MKCOL.php: $setprops = $setprops[0]->GetContent(); // the array of properties. caldav-MKCOL.php: $tag = $setting->GetTag(); caldav-MKCOL.php: $content = $setting->RenderContent(); caldav-MKCOL.php: $is_addressbook = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:carddav:addressbook')); caldav-MKCOL.php: $is_calendar = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:caldav:calendar')); caldav-MKCOL.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-MKCOL.php: new XMLElement( 'prop', new XMLElement($reply->Tag($tag))), caldav-MKCOL.php: $resourcetypes = $setting->GetPath('DAV::resourcetype/*'); caldav-MKCOL.php: dbg_error_log( 'MKCOL', 'Displayname is "/" to "%s"', $request->path); caldav-MKCOL.php: $parent_container = $request->path; caldav-MKCOL.php: $request->path .= $content . '/'; caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set': /** Ignored, since we will support all component types */ caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-data': /** Ignored, since we will support iCalendar 2.0 */ caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:calendar-data': /** Ignored, since we will support iCalendar 2.0 */ caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:max-resource-size': /** Ignored, since we will support arbitrary size */ caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:min-date-time': /** Ignored, since we will support arbitrary time */ caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:max-date-time': /** Ignored, since we will support arbitrary time */ caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:max-instances': /** Ignored, since we will support arbitrary instances */ caldav-MKCOL.php: * The following properties are read-only, so they will cause the request to fail caldav-MKCOL.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-MKCOL.php: new XMLElement( 'prop', new XMLElement($reply->Tag($tag))), caldav-MKCOL.php: new XMLElement('responsedescription', translate('Property is read-only') ) caldav-MKCOL.php: $props[] = new XMLElement($reply->Tag($tag)); caldav-MKCOL.php: if ( $request_type == 'extended-mkcol' ) { caldav-MKCOL.php: $request->DoResponse( $failure_code, $reply->Render('mkcol-response', array_merge( $status, $failure ), 'text/xml; charset="utf-8"' ) ); caldav-MKCOL.php: array_unshift( $failure, $reply->href( ConstructURL($request->path) ) ); caldav-MKCOL.php: $request->DoResponse( 207, $reply->Render('multistatus', new XMLElement( 'response', $failure )), 'text/xml; charset="utf-8"' ); caldav-MKCOL.php:$qry = new AwlQuery( $sql, array( ':dav_name' => $request->path) ); caldav-MKCOL.php:if ( ! $qry->Exec('MKCOL',__LINE__,__FILE__) ) { caldav-MKCOL.php: $request->DoResponse( 500, translate('Error querying database.') ); caldav-MKCOL.php:if ( $qry->rows() != 0 ) { caldav-MKCOL.php: $request->DoResponse( 405, translate('A collection already exists at that location.') ); caldav-MKCOL.php:$qry->Begin(); caldav-MKCOL.php:if ( ! $qry->QDo( 'INSERT INTO collection ( user_no, parent_container, dav_name, dav_etag, dav_displayname, caldav-MKCOL.php: ':user_no' => $request->user_no, caldav-MKCOL.php: ':dav_name' => $request->path, caldav-MKCOL.php: ':dav_etag' => md5($request->user_no. $request->path), caldav-MKCOL.php: $request->DoResponse( 500, translate('Error writing calendar details to database.') ); caldav-MKCOL.php: if ( ! $qry->QDo('SELECT set_dav_property( :dav_name, :user_no, :tag::text, :value::text )', caldav-MKCOL.php: array( ':dav_name' => $request->path, ':user_no' => $request->user_no, ':tag' => $k, ':value' => $v) ) ) { caldav-MKCOL.php: $request->DoResponse( 500, translate('Error writing calendar properties to database.') ); caldav-MKCOL.php:if ( !$qry->Commit() ) { caldav-MKCOL.php: $request->DoResponse( 500, translate('Error writing calendar details to database.') ); caldav-MKCOL.php:dbg_error_log( 'MKCOL', 'New calendar "%s" created named "%s" for user "%d" in parent "%s"', $request->path, $displayname, $session->user_no, $parent_container); caldav-MKCOL.php:header('Cache-Control: no-cache'); /** RFC4791 mandates this at 5.3.1 */ caldav-MKCOL.php:$request->DoResponse( 201, '' ); caldav-MKCOL.php:* caldav-MKCOL.php:* Calendar restricted to events. caldav-MKCOL.php:* caldav-MKCOL.php:* caldav-MKCOL.php:* caldav-MKTICKET.php:* CalDAV Server - handle MKTICKET method in line with defunct proposed RFC caldav-MKTICKET.php:* from: http://tools.ietf.org/html/draft-ito-dav-ticket-00 caldav-MKTICKET.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-MKTICKET.php:$request->NeedPrivilege('DAV::bind'); caldav-MKTICKET.php:$target = new DAVResource( $request->path ); caldav-MKTICKET.php:if ( ! $target->Exists() ) { caldav-MKTICKET.php: $request->XMLResponse( 404, new XMLElement( 'error', new XMLElement('resource-must-not-be-null'), $reply->GetXmlNsArray() ) ); caldav-MKTICKET.php:if ( ! isset($request->xml_tags) ) { caldav-MKTICKET.php: $request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('missing-xml-for-request'), $reply->GetXmlNsArray() ) ); caldav-MKTICKET.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-MKTICKET.php:if ( $xmltree->GetTag() != 'http://www.xythos.com/namespaces/StorageServer:ticketinfo' && caldav-MKTICKET.php: $xmltree->GetTag() != 'DAV::ticketinfo' ) { caldav-MKTICKET.php: $request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('invalid-xml-for-request'), $reply->GetXmlNsArray() ) ); caldav-MKTICKET.php:$ticket_timeout = 'Seconds-3600'; caldav-MKTICKET.php:$ticket_privs_array = array('read-free-busy'); caldav-MKTICKET.php:foreach( $xmltree->GetContent() AS $k => $v ) { caldav-MKTICKET.php: switch( $v->GetTag() ) { caldav-MKTICKET.php: $ticket_timeout = $v->GetContent(); caldav-MKTICKET.php: $ticket_privs_array = $v->GetElements(); // Ensure we always get an array back caldav-MKTICKET.php: $ticket_privileges |= privilege_to_bits( $v1->GetTag() ); caldav-MKTICKET.php: if ( $ticket_privileges & privilege_to_bits('read') ) $ticket_privileges |= privilege_to_bits( array('read-free-busy', 'read-current-user-privilege-set') ); caldav-MKTICKET.php: if ( $ticket_privileges & privilege_to_bits('read-free-busy') ) $ticket_privileges |= privilege_to_bits( 'schedule-query-freebusy'); caldav-MKTICKET.php:else if ( preg_match( '{^([a-z]+)-(\d+)$}i', $ticket_timeout, $matches ) ) { caldav-MKTICKET.php: /** It isn't specified, but timeout seems to be 'unit-number' like 'Seconds-3600', so we make it '3600 Seconds' which PostgreSQL understands */ caldav-MKTICKET.php:$collection_id = $target->GetProperty('collection_id'); caldav-MKTICKET.php:$resource_id = $target->GetProperty('dav_id'); caldav-MKTICKET.php: ':owner' => $session->principal_id, caldav-MKTICKET.php: $result = $qry->Exec('MKTICKET', __LINE__, __FILE__); caldav-MKTICKET.php: $reply->NSElement($privs, $v); caldav-MKTICKET.php: new XMLElement( 'owner', $reply->href( ConstructURL('/'.$session->username.'/') ) ), caldav-MKTICKET.php:$prop = new XMLElement( "prop", new XMLElement('T:ticketdiscovery', $ticketinfo), $reply->GetXmlNsArray() ); caldav-MKTICKET.php:$request->XMLResponse( 200, $prop ); caldav-MOVE.php:* CalDAV Server - handle MOVE method caldav-MOVE.php:$request->NeedPrivilege('DAV::unbind'); caldav-MOVE.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['move']) && $c->dbg['move'])) ) { caldav-MOVE.php: fwrite($fh,$request->raw_post); caldav-MOVE.php:$lock_opener = $request->FailIfLocked(); caldav-MOVE.php:$dest = new DAVResource($request->destination); caldav-MOVE.php:if ( $dest->dav_name() == '/' || $dest->IsPrincipal() ) { caldav-MOVE.php: $dest->NeedPrivilege('DAV::bind'); caldav-MOVE.php:if ( ! $dest->ContainerExists() ) { caldav-MOVE.php: $request->DoResponse( 409, translate('Destination collection does not exist') ); caldav-MOVE.php:if ( ! $request->overwrite && $dest->Exists() ) { caldav-MOVE.php: $request->DoResponse( 412, translate('Not overwriting existing destination resource') ); caldav-MOVE.php:if ( isset($request->etag_none_match) && $request->etag_none_match != '*' ) { caldav-MOVE.php: $request->DoResponse( 412 ); /** request to move, but only if there is no source? WTF! */ caldav-MOVE.php:$src = new DAVResource($request->path); caldav-MOVE.php:if ( ! $src->Exists() ) { caldav-MOVE.php: $request->DoResponse( 412, translate('Source resource does not exist.') ); caldav-MOVE.php:if ( $src->IsCollection() ) { caldav-MOVE.php: switch( $dest->ContainerType() ) { caldav-MOVE.php: case 'schedule-inbox': caldav-MOVE.php: case 'schedule-outbox': caldav-MOVE.php: $request->DoResponse( 412, translate('Special collections may not contain a calendar or other special collection.') ); caldav-MOVE.php: if ( (isset($request->etag_if_match) && $request->etag_if_match != '' ) caldav-MOVE.php: || ( isset($request->etag_none_match) && $request->etag_none_match != '') ) { caldav-MOVE.php: * (without the If-None-Match header) on that resource, or if "*" is caldav-MOVE.php: if ( isset($request->etag_if_match) && $request->etag_if_match != $src->unique_tag() ) { caldav-MOVE.php: $error = translate( 'Existing resource does not match "If-Match" header - not accepted.'); caldav-MOVE.php: else if ( isset($request->etag_none_match) && $request->etag_none_match != '' && $request->etag_none_match == $src->unique_tag() ) { caldav-MOVE.php: $error = translate( 'Existing resource matches "If-None-Match" header - not accepted.'); caldav-MOVE.php: if ( $error != '' ) $request->DoResponse( 412, $error ); caldav-MOVE.php:$src->NeedPrivilege('DAV::unbind'); caldav-MOVE.php:$dest->NeedPrivilege('DAV::write-content'); caldav-MOVE.php:if ( ! $dest->Exists() ) $dest->NeedPrivilege('DAV::bind'); caldav-MOVE.php: $qry->Exec('move'); // Just in case caldav-MOVE.php: $request->DoResponse( $response_code ); caldav-MOVE.php:if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php:$src_name = $src->dav_name(); caldav-MOVE.php:$dst_name = $dest->dav_name(); caldav-MOVE.php:$src_collection = $src->GetProperty('collection_id'); caldav-MOVE.php:$dst_collection = $dest->GetProperty('collection_id'); caldav-MOVE.php:$src_user_no = $src->GetProperty('user_no'); caldav-MOVE.php:$dst_user_no = $dest->GetProperty('user_no'); caldav-MOVE.php:if ( $src->IsCollection() ) { caldav-MOVE.php: if ( $dest->Exists() ) { caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php: if ( $dest->Exists() ) { caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php: log_caldav_action( 'DELETE', $src->GetProperty('uid'), $src_user_no, $src_collection, $src_name ); caldav-MOVE.php: ':sync_type' => ( $dest->Exists() ? 200 : 201 ) caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php: log_caldav_action( ( $dest->Exists() ? 'UPDATE' : 'INSERT' ), $src->GetProperty('uid'), $dst_user_no, $dst_collection, $dst_name ); caldav-MOVE.php:if ( !$qry->Exec('move') ) rollback(500); caldav-MOVE.php:$request->DoResponse( 200 ); caldav-OPTIONS.php:* CalDAV Server - handle OPTIONS method caldav-OPTIONS.php:$resource = new DAVResource($request->path); caldav-OPTIONS.php://$resource->NeedPrivilege( 'DAV::read', true ); caldav-OPTIONS.php:if ( !$resource->Exists() ) { caldav-OPTIONS.php: $request->DoResponse( 404, translate("No collection found at that location.") ); caldav-OPTIONS.php:$allowed = implode( ', ', array_keys($resource->FetchSupportedMethods()) ); caldav-OPTIONS.php:$request->DoResponse( 200, "" ); caldav-POST.php:* CalDAV Server - handle PUT method caldav-POST.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-POST.php:include_once('caldav-PUT-functions.php'); caldav-POST.php:include_once('freebusy-functions.php'); caldav-POST.php:if ( ! $request->AllowedTo("CALDAV:schedule-send-freebusy") caldav-POST.php: && ! $request->AllowedTo("CALDAV:schedule-send-invite") caldav-POST.php: && ! $request->AllowedTo("CALDAV:schedule-send-reply") ) { caldav-POST.php: // $request->DoResponse(403); caldav-POST.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['post'])) ) { caldav-POST.php: fwrite($fh,$request->raw_post); caldav-POST.php: $fbq_start = $ic->GetPValue('DTSTART'); caldav-POST.php: $fbq_end = $ic->GetPValue('DTEND'); caldav-POST.php: $request->DoResponse( 400, 'All valid freebusy requests MUST contain a DTSTART and a DTEND' ); caldav-POST.php: $attendees = $ic->GetProperties('ATTENDEE'); caldav-POST.php: dbg_error_log( "POST", "Non-compliant iCal request. Using X-WR-ATTENDEE property" ); caldav-POST.php: $wr_attendees = $ic->GetProperties('X-WR-ATTENDEE'); caldav-POST.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); caldav-POST.php: //$params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth, ':email' => $attendee_email ); caldav-POST.php: //if ( !$qry->Exec('POST',__LINE__,__FILE__) ) $request->DoResponse( 501, 'Database error'); caldav-POST.php: //if ( $qry->rows() > 1 ) { caldav-POST.php: // if ( !$qry->QDo('SELECT pprivs(:session_principal::int8,principal_id,:scan_depth::int) AS p, username FROM usr JOIN principal USING(user_no) WHERE usr.email = :email', $params ) ) caldav-POST.php: // $request->DoResponse( 501, 'Database error'); caldav-POST.php: // if ( $qry->rows() == 0 ) { caldav-POST.php: /** Sigh... Go back to the original case-insensitive match */ caldav-POST.php: // $qry->QDo('SELECT pprivs(:session_principal::int8,principal_id,:scan_depth::int) AS p, username FROM usr JOIN principal USING(user_no) WHERE lower(usr.email) = lower(:email)', $params ); caldav-POST.php: $response = $reply->NewXMLElement("response", false, false, 'urn:ietf:params:xml:ns:caldav'); caldav-POST.php: $reply->CalDAVElement($response, "recipient", $reply->href($attendee->Value()) ); caldav-POST.php: //if ( $qry->rows() == 0 ) { caldav-POST.php: // $reply->CalDAVElement($response, "request-status", "3.7;Invalid Calendar User" ); caldav-POST.php: // $reply->CalDAVElement($response, "calendar-data" ); caldav-POST.php: //if ( ! $attendee_usr = $qry->Fetch() ) $request->DoResponse( 501, 'Database error'); caldav-POST.php: //if ( (privilege_to_bits('schedule-query-freebusy') & bindec($attendee_usr->p)) == 0 ) { caldav-POST.php: // $reply->CalDAVElement($response, "request-status", "3.8;No authority" ); caldav-POST.php: // $reply->CalDAVElement($response, "calendar-data" ); caldav-POST.php: $attendee_path_match = '^/'.$attendee_usr->username.'/'; caldav-POST.php: $fb = get_freebusy( $attendee_path_match, $attendee_email,$range_start, $range_end, bindec($attendee_usr->p) ); caldav-POST.php: $fb->AddProperty( 'UID', $ic->GetPValue('UID') ); caldav-POST.php: $fb->SetProperties( $ic->GetProperties('ORGANIZER'), 'ORGANIZER'); caldav-POST.php: $fb->AddProperty( $attendee ); caldav-POST.php: $vcal->VCalendar( array('METHOD' => 'REPLY') ); caldav-POST.php: $vcal->AddComponent( $fb ); caldav-POST.php: $response = $reply->NewXMLElement( "response", false, false, 'urn:ietf:params:xml:ns:caldav' ); caldav-POST.php: $reply->CalDAVElement($response, "recipient", $reply->href($attendee->Value()) ); caldav-POST.php: $reply->CalDAVElement($response, "request-status", "2.0;Success" ); // Cargo-cult setting caldav-POST.php: $reply->CalDAVElement($response, "calendar-data", $vcal->Render() ); caldav-POST.php: $response = $reply->NewXMLElement( "schedule-response", $responses, $reply->GetXmlNsArray(), 'urn:ietf:params:xml:ns:caldav' ); caldav-POST.php: $request->XMLResponse( 200, $response ); caldav-POST.php: $responses[] = $reply->NewXMLElement( "response", false, false, 'urn:ietf:params:xml:ns:caldav' ); caldav-POST.php: $reply->CalDAVElement($response, "request-status", "2.0;Success" ); // Cargo-cult setting caldav-POST.php: $response = $reply->NewXMLElement( "schedule-response", $responses, $reply->GetXmlNsArray() ); caldav-POST.php: $request->XMLResponse( 200, $response ); caldav-POST.php:$ical = new iCalComponent( $request->raw_post ); caldav-POST.php:$method = $ical->GetPValue('METHOD'); caldav-POST.php:$resources = $ical->GetComponents('VTIMEZONE',false); caldav-POST.php: dbg_error_log('POST', 'Handling iTIP "REQUEST" method with "%s" component.', $method, $first->GetType() ); caldav-POST.php: if ( $first->GetType() == 'VFREEBUSY' ) caldav-POST.php: elseif ( $first->GetType() == 'VEVENT' ) { caldav-POST.php: dbg_error_log('POST', 'Ignoring iTIP "REQUEST" with "%s" component.', $first->GetType() ); caldav-POST.php: dbg_error_log('POST', 'Handling iTIP "REPLY" with "%s" component.', $first->GetType() ); CalDAVPrincipal.php: * @var draft-desruisseaux-caldav-sched-03: Identify the URL of the scheduling CalDAVPrincipal.php: * @var draft-desruisseaux-caldav-sched-03: Identify the URL of the scheduling CalDAVPrincipal.php: * @var Whether or not we are using an e-mail address based URL. CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which this one has read permissions on. CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which this one has read-write prmissions for. CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which have read permissions on this one. CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which have write permissions on this one. CalDAVPrincipal.php: * @var The dav_name for this principal - a partial path CalDAVPrincipal.php: $this->exists = null; CalDAVPrincipal.php: $this->url = null; CalDAVPrincipal.php: $this->by_email = false; CalDAVPrincipal.php: dbg_error_log( 'principal', 'Principal: record for %s', $parameters->username ); CalDAVPrincipal.php: $this->user_no = $parameters['user_no']; CalDAVPrincipal.php: $this->username = $parameters['username']; CalDAVPrincipal.php: $this->user_no = $parameters['user_no']; CalDAVPrincipal.php: if ( $username = $this->UsernameFromEMail($parameters['email']) ) { CalDAVPrincipal.php: $this->username = $username; CalDAVPrincipal.php: if ( $username = $this->UsernameFromPath($parameters['path'], $parameters['options']) ) { CalDAVPrincipal.php: $this->username = $username; CalDAVPrincipal.php: else if ( isset($parameters['principal-property-search']) ) { CalDAVPrincipal.php: $usr = $this->PropertySearch($parameters['principal-property-search']); CalDAVPrincipal.php: $this->exists = false; CalDAVPrincipal.php: $this->exists = true; CalDAVPrincipal.php: $this->InitialiseRecord($usr); CalDAVPrincipal.php: $this->url = $parameters['path']; CalDAVPrincipal.php: $this->dav_name = $parameters['path']; CalDAVPrincipal.php: $this->{$k} = $v; CalDAVPrincipal.php: if ( !isset($this->modified) ) $this->modified = $this->updated; CalDAVPrincipal.php: if ( !isset($this->created) ) $this->created = $this->joined; CalDAVPrincipal.php: $this->dav_etag = md5($this->username . $this->updated); CalDAVPrincipal.php: $this->_is_group = (isset($usr->type_id) && $usr->type_id == 3); CalDAVPrincipal.php: $this->principal_url = ConstructURL( '/'.$this->username.'/', true ); CalDAVPrincipal.php: $this->url = $this->principal_url; CalDAVPrincipal.php: $this->principal_address = $this->principal_url . 'principal.vcf'; CalDAVPrincipal.php: $this->user_address_set = array( CalDAVPrincipal.php: 'mailto:'.$this->email, CalDAVPrincipal.php: ConstructURL( '/'.$this->username.'/', true ), CalDAVPrincipal.php:// ConstructURL( '/~'.$this->username.'/', true ), CalDAVPrincipal.php:// ConstructURL( '/__uuids__/'.$this->username.'/', true ), CalDAVPrincipal.php: $this->schedule_inbox_url = sprintf( '%s.in/', $this->url); CalDAVPrincipal.php: $this->schedule_outbox_url = sprintf( '%s.out/', $this->url); CalDAVPrincipal.php: $this->dropbox_url = sprintf( '%s.drop/', $this->url); CalDAVPrincipal.php: $this->notifications_url = sprintf( '%s.notify/', $this->url); CalDAVPrincipal.php: if ( isset ( $c->notifications_server ) ) { CalDAVPrincipal.php: $this->xmpp_uri = 'xmpp:pubsub.'.$c->notifications_server['host'].'?pubsub;node=/davical-'.$this->principal_id; CalDAVPrincipal.php: $this->xmpp_server = $c->notifications_server['host']; CalDAVPrincipal.php: if ( $this->_is_group ) { CalDAVPrincipal.php: $this->group_member_set = array(); CalDAVPrincipal.php: $qry = new AwlQuery('SELECT usr.username FROM group_member JOIN principal ON (principal_id=member_id) JOIN usr USING(user_no) WHERE group_id = :group_id ORDER BY principal.principal_id ', array( ':group_id' => $this->principal_id) ); CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { CalDAVPrincipal.php: while( $member = $qry->Fetch() ) { CalDAVPrincipal.php: $this->group_member_set[] = ConstructURL( '/'. $member->username . '/', true); CalDAVPrincipal.php: $this->group_membership = array(); CalDAVPrincipal.php: $qry = new AwlQuery('SELECT usr.username FROM group_member JOIN principal ON (principal_id=group_id) JOIN usr USING(user_no) WHERE member_id = :member_id UNION SELECT usr.username FROM group_member LEFT JOIN grants ON (to_principal=group_id) JOIN principal ON (principal_id=by_principal) JOIN usr USING(user_no) WHERE member_id = :member_id and by_principal != member_id ORDER BY 1', array( ':member_id' => $this->principal_id ) ); CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { CalDAVPrincipal.php: while( $group = $qry->Fetch() ) { CalDAVPrincipal.php: $this->group_membership[] = ConstructURL( '/'. $group->username . '/', true); CalDAVPrincipal.php: $this->read_proxy_group = null; CalDAVPrincipal.php: $this->write_proxy_group = null; CalDAVPrincipal.php: $this->write_proxy_for = null; CalDAVPrincipal.php: $this->read_proxy_for = null; CalDAVPrincipal.php: dbg_error_log( 'principal', ' User: %s (%d) URL: %s, Home: %s, By Email: %d', $this->username, $this->user_no, $this->url, $this->by_email ); CalDAVPrincipal.php: $this->read_proxy_group = array(); CalDAVPrincipal.php: $this->write_proxy_group = array(); CalDAVPrincipal.php: $this->write_proxy_for = array(); CalDAVPrincipal.php: $this->read_proxy_for = array(); CalDAVPrincipal.php: if ( !isset($c->disable_caldav_proxy) || $c->disable_caldav_proxy === false ) { CalDAVPrincipal.php: $params = array( ':request_principal' => $this->principal_id, ':scan_depth' => $c->permission_scan_depth ); CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { CalDAVPrincipal.php: while( $relationship = $qry->Fetch() ) { CalDAVPrincipal.php: if ( (bindec($relationship->pprivs) & $write_priv) != 0 ) { CalDAVPrincipal.php: $this->write_proxy_for[] = ConstructURL( '/'. $relationship->username . '/', true); CalDAVPrincipal.php: $this->group_membership[] = ConstructURL( '/'. $relationship->username . '/calendar-proxy-write/', true); CalDAVPrincipal.php: $this->read_proxy_for[] = ConstructURL( '/'. $relationship->username . '/', true); CalDAVPrincipal.php: $this->group_membership[] = ConstructURL( '/'. $relationship->username . '/calendar-proxy-read/', true); CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { CalDAVPrincipal.php: while( $relationship = $qry->Fetch() ) { CalDAVPrincipal.php: if ( bindec($relationship->pprivs) & $write_priv ) { CalDAVPrincipal.php: $this->write_proxy_group[] = ConstructURL( '/'. $relationship->username . '/', true); CalDAVPrincipal.php: $this->read_proxy_group[] = ConstructURL( '/'. $relationship->username . '/', true); CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Read-proxy-for: %s', implode(',',$this->read_proxy_for) ); CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Write-proxy-for: %s', implode(',',$this->write_proxy_for) ); CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Read-proxy-group: %s', implode(',',$this->read_proxy_group) ); CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Write-proxy-group: %s', implode(',',$this->write_proxy_group) ); CalDAVPrincipal.php: if ( !isset($this->read_proxy_group) ) $this->FetchProxyGroups(); CalDAVPrincipal.php: return $this->read_proxy_group; CalDAVPrincipal.php: if ( !isset($this->write_proxy_group) ) $this->FetchProxyGroups(); CalDAVPrincipal.php: return $this->write_proxy_group; CalDAVPrincipal.php: * @param string read/write - which sort of proxy list is requested. CalDAVPrincipal.php: if ( !isset($this->read_proxy_for) ) $this->FetchProxyGroups(); CalDAVPrincipal.php: if ( $type == 'write' ) return $this->write_proxy_for; CalDAVPrincipal.php: return $this->read_proxy_for; CalDAVPrincipal.php: * Accessor for the group membership - the groups this principal is a member of CalDAVPrincipal.php: if ( !isset($this->read_proxy_group) ) $this->FetchProxyGroups(); CalDAVPrincipal.php: return $this->group_membership; CalDAVPrincipal.php: * Accessor for the group member set - the members of this group CalDAVPrincipal.php: if ( ! $this->_is_group ) return null; CalDAVPrincipal.php: return $this->group_member_set; CalDAVPrincipal.php: * @param array $options The request options, controlling whether e-mail paths are allowed. CalDAVPrincipal.php: return $session->username; CalDAVPrincipal.php: $username = $this->UsernameFromEMail($username); CalDAVPrincipal.php: * Work out the username, based on the given e-mail CalDAVPrincipal.php: @dbg_error_log( 'principal', 'Retrieving username from e-mail address "%s" ', $email ); CalDAVPrincipal.php: if ( $qry->Exec('principal') && $user = $qry->Fetch() ) { CalDAVPrincipal.php: $username = $user->username; CalDAVPrincipal.php: $this->by_email = true; CalDAVPrincipal.php: return $this->exists; CalDAVPrincipal.php: return $this->_is_group; CalDAVPrincipal.php: return (isset($this->username)?$this->username:'username not set'); CalDAVPrincipal.php: if ( !isset($this->dav_name) ) { CalDAVPrincipal.php: if ( !isset($this->username) ) $this->dav_name = ''; CalDAVPrincipal.php: else $this->dav_name = '/'.$this->username.'/'; CalDAVPrincipal.php: return $this->dav_name; CalDAVPrincipal.php: if ( !isset($this->calendar_home_set) ) { CalDAVPrincipal.php: $this->calendar_home_set = array(); CalDAVPrincipal.php:/* $qry = new AwlQuery('SELECT DISTINCT parent_container FROM collection WHERE is_calendar AND user_no = :user_no', array( ':user_no' => $this->user_no)); CalDAVPrincipal.php: if ( $qry->Exec('principal',__LINE__,__FILE__) ) { CalDAVPrincipal.php: if ( $qry->rows() > 0 ) { CalDAVPrincipal.php: while( $calendar = $qry->Fetch() ) { CalDAVPrincipal.php: $this->calendar_home_set[] = ConstructURL($calendar->parent_container, true); CalDAVPrincipal.php: $this->calendar_home_set[] = $this->principal_url; CalDAVPrincipal.php: return $this->calendar_home_set; CalDAVPrincipal.php: if ( !isset($this->addressbook_home_set) ) { CalDAVPrincipal.php: $this->addressbook_home_set = array(); CalDAVPrincipal.php:/* $qry = new AwlQuery('SELECT DISTINCT parent_container FROM collection WHERE is_addressbook AND user_no = :user_no', array( ':user_no' => $this->user_no)); CalDAVPrincipal.php: if ( $qry->Exec('principal',__LINE__,__FILE__) ) { CalDAVPrincipal.php: if ( $qry->rows() > 0 ) { CalDAVPrincipal.php: while( $addressbook = $qry->Fetch() ) { CalDAVPrincipal.php: $this->addressbook_home_set[] = ConstructURL($addressbook->parent_container, true); CalDAVPrincipal.php: $this->addressbook_home_set[] = $this->principal_url; CalDAVPrincipal.php: return $this->addressbook_home_set; CalDAVPrincipal.php: if ( !isset($this->calendar_free_busy_set) ) { CalDAVPrincipal.php: * calendar-free-busy-set has been dropped from draft 5 of the scheduling extensions for CalDAV CalDAVPrincipal.php: $this->calendar_free_busy_set = array(); CalDAVPrincipal.php: array( ':user_no' => $this->user_no) ); CalDAVPrincipal.php: if ( $qry->Exec('principal',__LINE__,__FILE__) ) { CalDAVPrincipal.php: while( $calendar = $qry->Fetch() ) { CalDAVPrincipal.php: $this->calendar_free_busy_set[] = ConstructURL($calendar->dav_name, true); CalDAVPrincipal.php: return $this->calendar_free_busy_set; CalDAVPrincipal.php: if ( !isset($this->privileges) ) $this->privileges = 0; CalDAVPrincipal.php: if ( is_string($this->privileges) ) $this->privileges = bindec( $this->privileges ); CalDAVPrincipal.php: return $this->privileges; CalDAVPrincipal.php: 'collection_id' => (isset($this->principal_id) ? $this->principal_id : 0), CalDAVPrincipal.php: 'type' => 'principal' . (substr($this->dav_name(), 0, 12) == '/principals/'?'_link':''), CalDAVPrincipal.php: 'user_no' => (isset($this->user_no) ? $this->user_no : 0), CalDAVPrincipal.php: 'username' => $this->username(), CalDAVPrincipal.php: 'dav_name' => $this->dav_name, CalDAVPrincipal.php: 'email' => (isset($this->email) ? $this->email : ''), CalDAVPrincipal.php: 'created' => (isset($this->created) ? $this->created : date('Ymd\THis')), CalDAVPrincipal.php: 'updated' => (isset($this->updated) ? $this->updated : date('Ymd\THis')) CalDAVPrincipal.php: $collection->dav_etag = (isset($this->dav_etag) ? $this->dav_etag : md5($collection->username . $collection->updated)); CalDAVPrincipal.php: $collection->dav_displayname = (isset($this->dav_displayname) ? $this->dav_displayname : (isset($this->fullname) ? $this->fullname : $collection->username)); CalDAVPrincipal.php: $prop->NewElement('getcontenttype', 'httpd/unix-directory' ); CalDAVPrincipal.php: $prop->NewElement('resourcetype', array( new XMLElement('principal'), new XMLElement('collection')) ); CalDAVPrincipal.php: $prop->NewElement('displayname', $this->fullname ); CalDAVPrincipal.php: case 'DAV::principal-URL': CalDAVPrincipal.php: $prop->NewElement('principal-URL', $reply->href($this->principal_url) ); CalDAVPrincipal.php: $prop->NewElement('getlastmodified', ISODateToHTTPDate($this->modified) ); CalDAVPrincipal.php: $prop->NewElement('creationdate', DateToISODate($this->created) ); CalDAVPrincipal.php: $locale = (isset($c->current_locale) ? $c->current_locale : ''); CalDAVPrincipal.php: if ( isset($this->locale) && $this->locale != '' ) $locale = $this->locale; CalDAVPrincipal.php: $prop->NewElement('getcontentlanguage', $locale ); CalDAVPrincipal.php: case 'DAV::group-member-set': CalDAVPrincipal.php: if ( ! $this->_is_group ) return false; CalDAVPrincipal.php: $prop->NewElement('group-member-set', $reply->href($this->group_member_set) ); CalDAVPrincipal.php: case 'DAV::group-membership': CalDAVPrincipal.php: $prop->NewElement('group-membership', $reply->href($this->GroupMembership()) ); CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:schedule-inbox-URL': CalDAVPrincipal.php: $reply->CalDAVElement($prop, 'schedule-inbox-URL', $reply->href($this->schedule_inbox_url) ); CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:schedule-outbox-URL': CalDAVPrincipal.php: $reply->CalDAVElement($prop, 'schedule-outbox-URL', $reply->href($this->schedule_outbox_url) ); CalDAVPrincipal.php: case 'http://calendarserver.org/ns/:dropbox-home-URL': CalDAVPrincipal.php: $reply->CalendarserverElement($prop, 'dropbox-home-URL', $reply->href($this->dropbox_url) ); CalDAVPrincipal.php: case 'http://calendarserver.org/ns/:xmpp-server': CalDAVPrincipal.php: if ( ! isset( $this->xmpp_uri ) ) return false; CalDAVPrincipal.php: $reply->CalendarserverElement($prop, 'xmpp-server', $this->xmpp_server ); CalDAVPrincipal.php: case 'http://calendarserver.org/ns/:xmpp-uri': CalDAVPrincipal.php: if ( ! isset( $this->xmpp_uri ) ) return false; CalDAVPrincipal.php: $reply->CalendarserverElement($prop, 'xmpp-uri', $this->xmpp_uri ); CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:carddav:addressbook-home-set': CalDAVPrincipal.php: $reply->NSElement($prop, $tag, $reply->href( $this->addressbook_home_set() ) ); CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-home-set': CalDAVPrincipal.php: $reply->NSElement($prop, $tag, $reply->href( $this->calendar_home_set() ) ); CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-free-busy-set': CalDAVPrincipal.php: $reply->CalDAVElement( $prop, 'calendar-free-busy-set', $reply->href( $this->calendar_free_busy_set() ) ); CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set': CalDAVPrincipal.php: $reply->CalDAVElement($prop, 'calendar-user-address-set', $reply->href($this->user_address_set) ); CalDAVPrincipal.php: // After a careful reading of RFC3744 we see that this must be the principal-URL of the owner CalDAVPrincipal.php: $reply->DAVElement( $prop, 'owner', $reply->href( $this->principal_url ) ); CalDAVPrincipal.php: case 'DAV::principal-collection-set': CalDAVPrincipal.php: $reply->DAVElement( $prop, 'principal-collection-set', $reply->href( ConstructURL('/') ) ); CalDAVPrincipal.php: case 'DAV::alternate-URI-set': CalDAVPrincipal.php: $prop->NewElement( $reply->Tag($tag)); CalDAVPrincipal.php: case 'SOME-DENIED-PROPERTY': /** @todo indicating the style for future expansion */ CalDAVPrincipal.php: $denied[] = $reply->Tag($tag); CalDAVPrincipal.php: dbg_error_log('principal',': RenderAsXML: Principal "%s"', $this->username ); CalDAVPrincipal.php: if ( ! $this->PrincipalProperty( $tag, $prop, $reply, $denied ) ) { CalDAVPrincipal.php: dbg_error_log( 'principal', 'Request for unsupported property "%s" of principal "%s".', $tag, $this->username ); CalDAVPrincipal.php: $not_found[] = $reply->Tag($tag); CalDAVPrincipal.php: $href = $reply->href($this->url ); CalDAVPrincipal.php: $noprop->NewElement( $v ); CalDAVPrincipal.php: $noprop->NewElement( $v ); caldav-PROPFIND.php:* CalDAV Server - handle PROPFIND method caldav-PROPFIND.php://$request->NeedPrivilege( array('DAV::read', 'urn:ietf:params:xml:ns:caldav:read-free-busy','DAV::read-current-user-privilege-set') ); caldav-PROPFIND.php:if ( !isset($request->xml_tags) ) { caldav-PROPFIND.php: $request->DoResponse( 403, translate("Request body contains no XML data!") ); caldav-PROPFIND.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-PROPFIND.php: $request->DoResponse( 403, translate("Request body is not valid XML data!") ); caldav-PROPFIND.php:$allprop = $xmltree->GetPath('/DAV::propfind/*'); caldav-PROPFIND.php: switch ( $propwrap->GetTag() ) { caldav-PROPFIND.php: $subprop = $propwrap->GetElements(); caldav-PROPFIND.php: $property_list[] = $v->GetTag(); caldav-PROPFIND.php: * Add the calendar-proxy-read/write pseudocollections caldav-PROPFIND.php: if ($parent_path != $request->principal->dav_name()) { caldav-PROPFIND.php: dbg_error_log( 'PROPFIND', 'Not returning proxy response since "%s" != "%s"', $parent_path, $request->principal->dav_name() ); caldav-PROPFIND.php: $proxy_group = $request->principal->ReadProxyGroup(); caldav-PROPFIND.php: $proxy_group = $request->principal->WriteProxyGroup(); caldav-PROPFIND.php: $collection->parent_container = $parent_path; caldav-PROPFIND.php: $collection->dav_name = $parent_path.'calendar-proxy-'.$which.'/'; caldav-PROPFIND.php: $collection->is_calendar = 'f'; caldav-PROPFIND.php: $collection->is_addressbook = 'f'; caldav-PROPFIND.php: $collection->is_principal = 't'; caldav-PROPFIND.php: $collection->is_proxy = 't'; caldav-PROPFIND.php: $collection->proxy_type = $which; caldav-PROPFIND.php: $collection->type = 'proxy'; caldav-PROPFIND.php: $collection->dav_displayname = $collection->dav_name; caldav-PROPFIND.php: $collection->collection_id = 0; caldav-PROPFIND.php: $collection->user_no = $session->user_no; caldav-PROPFIND.php: $collection->username = $session->username; caldav-PROPFIND.php: $collection->email = $session->email; caldav-PROPFIND.php: $collection->created = date('Ymd\THis'); caldav-PROPFIND.php: $collection->dav_etag = md5($c->system_name . $collection->dav_name . implode($proxy_group) ); caldav-PROPFIND.php: $collection->proxy_for = $proxy_group; caldav-PROPFIND.php: $collection->resourcetypes = sprintf('', $which); caldav-PROPFIND.php: $collection->in_freebusy_set = 'f'; caldav-PROPFIND.php: $collection->schedule_transp = 'transp'; caldav-PROPFIND.php: $collection->timezone = null; caldav-PROPFIND.php: $collection->description = ''; caldav-PROPFIND.php: $resource->FetchPrincipal(); caldav-PROPFIND.php: return $resource->RenderAsXML($property_list, $reply); caldav-PROPFIND.php: $bound_from = $collection->bound_from(); caldav-PROPFIND.php: $bound_to = $collection->dav_name(); caldav-PROPFIND.php: if ( !isset($parent_path) ) $parent_path = $collection->dav_name(); caldav-PROPFIND.php: $depth, $collection->dav_name(), $bound_from, $bound_to ); caldav-PROPFIND.php: if ( ! $collection->IsCalendar() && ! $collection->IsAddressbook() ) { caldav-PROPFIND.php: $params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); caldav-PROPFIND.php: if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-PROPFIND.php: while( $binding = $qry->Fetch() ) { caldav-PROPFIND.php: $resource = new DAVResource($binding->dav_name); caldav-PROPFIND.php: //if ( $resource->HavePrivilegeTo('DAV::read', false) ) { caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$binding->dav_name)); caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); caldav-PROPFIND.php: $responses = array_merge($responses, get_collection_contents( $depth - 1, $resource, $binding->dav_name ) ); caldav-PROPFIND.php: if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-PROPFIND.php: while( $subcollection = $qry->Fetch() ) { caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$subcollection->dav_name)); caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); caldav-PROPFIND.php: $responses = array_merge($responses, get_collection_contents( $depth - 1, $resource, caldav-PROPFIND.php: str_replace($resource->parent_path(), $parent_path, $resource->dav_name() ) ) ); caldav-PROPFIND.php: if ( $collection->IsPrincipal() ) { caldav-PROPFIND.php: // Caldav Proxy: 5.1 par. 2: Add child resources calendar-proxy-(read|write) caldav-PROPFIND.php: dbg_error_log('PROPFIND','Adding calendar-proxy-read and write. Path: %s', $bound_from ); caldav-PROPFIND.php: if ( $collection->HavePrivilegeTo('DAV::read', false) ) { caldav-PROPFIND.php: if ( $collection->IsCalendar() ) { caldav-PROPFIND.php: if ( ! $collection->HavePrivilegeTo('all', false) ) { caldav-PROPFIND.php: if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { caldav-PROPFIND.php: $time_limit_clause = " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; caldav-PROPFIND.php: $nome = substr($request->username, 0, 9); caldav-PROPFIND.php: if ( $qryp->Exec("PROPFIND",__LINE__,__FILE__) && $qryp->rows() > 0 ) { caldav-PROPFIND.php: while( $part = $qryp->Fetch() ) { caldav-PROPFIND.php: $sql = "SELECT * FROM phpgw_cal WHERE cal_id = $part->cal_id AND cal_type = 'E'"; caldav-PROPFIND.php: if ( $qry->Exec("PROPFIND",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-PROPFIND.php: while( $item = $qry->Fetch() ) { caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$item->owner)); caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply, $parent_path ); caldav-PROPFIND.php: $sql = "SELECT * FROM phpgw_cal INNER JOIN phpgw_cal_repeats USING(cal_id) WHERE cal_id = $part->cal_id"; caldav-PROPFIND.php: if ( $qry->Exec("PROPFIND",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-PROPFIND.php: while( $item = $qry->Fetch() ) { caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$item->owner)); caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply, $parent_path ); caldav-PROPFIND.php: //if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY caldav_data.dav_id"; caldav-PROPFIND.php: //if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-PROPFIND.php: // while( $item = $qry->Fetch() ) { caldav-PROPFIND.php: // $resource->set_bind_location( str_replace($bound_from,$bound_to,$item->dav_name)); caldav-PROPFIND.php: // $responses[] = $resource->RenderAsXML($property_list, $reply, $parent_path ); caldav-PROPFIND.php:if ( $request->IsProxyRequest() ) { caldav-PROPFIND.php: $response = add_proxy_response($request->proxy_type, $request->principal->dav_name() ); caldav-PROPFIND.php: $resource = new DAVResource($request->path); caldav-PROPFIND.php: if ( ! $resource->Exists() ) { caldav-PROPFIND.php: $request->PreconditionFailed( 404, 'must-exist', translate('That resource is not present on this server.') ); caldav-PROPFIND.php: //$resource->NeedPrivilege('DAV::read'); caldav-PROPFIND.php: if ( $resource->IsCollection() ) { caldav-PROPFIND.php: dbg_error_log('PROPFIND','Getting collection contents: Depth %d, Path: %s', $request->depth, $resource->dav_name() ); caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); caldav-PROPFIND.php: if ( $request->depth > 0 ) { caldav-PROPFIND.php: $responses = array_merge($responses, get_collection_contents( $request->depth - 1, $resource ) ); caldav-PROPFIND.php: //elseif ( $request->HavePrivilegeTo('DAV::read',false) ) caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); caldav-PROPFIND.php:$xmldoc = $reply->Render('multistatus', $responses); caldav-PROPFIND.php:$request->DoResponse( 207, $xmldoc, 'text/xml; charset="utf-8"' ); caldav-PROPPATCH.php:* CalDAV Server - handle PROPPATCH method caldav-PROPPATCH.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-PROPPATCH.php:$dav_resource = new DAVResource($request->path); caldav-PROPPATCH.php:if ( ! ($dav_resource->HavePrivilegeTo('DAV::write-properties') || $dav_resource->IsBinding() ) ) { caldav-PROPPATCH.php: $request->DoResponse( 403 ); caldav-PROPPATCH.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-PROPPATCH.php:// echo $xmltree->Render(); caldav-PROPPATCH.php:if ( $xmltree->GetTag() != "DAV::propertyupdate" ) { caldav-PROPPATCH.php: $request->DoResponse( 403 ); caldav-PROPPATCH.php:$setprops = $xmltree->GetPath("/DAV::propertyupdate/DAV::set/DAV::prop/*"); caldav-PROPPATCH.php:$rmprops = $xmltree->GetPath("/DAV::propertyupdate/DAV::remove/DAV::prop/*"); caldav-PROPPATCH.php:* the special-case stuff as needed and falling through to a default which caldav-PROPPATCH.php:$qry->Begin(); caldav-PROPPATCH.php:$setcalendar = count($xmltree->GetPath('/DAV::propertyupdate/DAV::set/DAV::prop/DAV::resourcetype/urn:ietf:params:xml:ns:caldav:calendar')); caldav-PROPPATCH.php: $tag = $setting->GetTag(); caldav-PROPPATCH.php: $content = $setting->RenderContent(); caldav-PROPPATCH.php: * Can't set displayname on resources - only collections or principals caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() || $dav_resource->IsPrincipal() ) { caldav-PROPPATCH.php: if ( $dav_resource->IsBinding() ) { caldav-PROPPATCH.php: $qry->QDo('UPDATE dav_binding SET dav_displayname = :displayname WHERE dav_name = :dav_name', caldav-PROPPATCH.php: array( ':displayname' => $content, ':dav_name' => $dav_resource->dav_name()) ); caldav-PROPPATCH.php: else if ( $dav_resource->IsPrincipal() ) { caldav-PROPPATCH.php: $qry->QDo('UPDATE dav_principal SET fullname = :displayname, displayname = :displayname, modified = current_timestamp WHERE user_no = :user_no', caldav-PROPPATCH.php: array( ':displayname' => $content, ':user_no' => $request->user_no) ); caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET dav_displayname = :displayname, modified = current_timestamp WHERE dav_name = :dav_name', caldav-PROPPATCH.php: array( ':displayname' => $content, ':dav_name' => $dav_resource->dav_name()) ); caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: $setcollection = count($setting->GetPath('DAV::resourcetype/DAV::collection')); caldav-PROPPATCH.php: $setaddressbook = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:carddav:addressbook')); caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && $setcollection && ! $dav_resource->IsPrincipal() caldav-PROPPATCH.php: && ! $dav_resource->IsBinding() && ! ($setaddressbook && $setcalendar) ) { caldav-PROPPATCH.php: $resourcetypes = $setting->GetPath('DAV::resourcetype/*'); caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET is_calendar = :is_calendar::boolean, is_addressbook = :is_addressbook::boolean, caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':resourcetypes' => $resourcetypes, caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-calendar-transp': caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && ( $dav_resource->IsCalendar() || $setcalendar ) && !$dav_resource->IsBinding() ) { caldav-PROPPATCH.php: $transparency = $setting->GetPath('urn:ietf:params:xml:ns:caldav:schedule-calendar-transp/*'); caldav-PROPPATCH.php: $transparency = preg_replace( '{^.*:}', '', $transparency[0]->GetTag()); caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET schedule_transp = :transparency WHERE dav_name = :dav_name', caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':transparency' => $transparency ) ); caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: translate("The CalDAV:schedule-calendar-transp property may only be set on calendars.") ) caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-free-busy-set': caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'responsedescription', translate("The calendar-free-busy-set is superseded by the schedule-transp property of a calendar collection.") ) caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-timezone': caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && $dav_resource->IsCalendar() && ! $dav_resource->IsBinding() ) { caldav-PROPPATCH.php: $tzcomponent = $setting->GetPath('urn:ietf:params:xml:ns:caldav:calendar-timezone'); caldav-PROPPATCH.php: $tzstring = $tzcomponent[0]->GetContent(); caldav-PROPPATCH.php: $timezones = $calendar->component->GetComponents('VTIMEZONE'); caldav-PROPPATCH.php: $tzid = $tz->GetPValue('TZID'); caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET timezone = :tzid WHERE dav_name = :dav_name', caldav-PROPPATCH.php: array( ':tzid' => $tzid, ':dav_name' => $dav_resource->dav_name()) ); caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: translate("calendar-timezone property is only valid for a calendar.") ) caldav-PROPPATCH.php: * The following properties are read-only, so they will cause the request to fail caldav-PROPPATCH.php: case 'DAV::principal-collection-set': caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set': caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-inbox-URL': caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-outbox-URL': caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: translate("Property is read-only") ) caldav-PROPPATCH.php: $qry->QDo('SELECT set_dav_property( :dav_name, :user_no, :tag::text, :value::text)', caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':user_no' => $request->user_no, ':tag' => $tag, ':value' => $content) ); caldav-PROPPATCH.php: $tag = $setting->GetTag(); caldav-PROPPATCH.php: $content = $setting->RenderContent(); caldav-PROPPATCH.php: $failure['rm-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-timezone': caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && $dav_resource->IsCalendar() && ! $dav_resource->IsBinding() ) { caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET timezone = NULL WHERE dav_name = :dav_name', array( ':dav_name' => $dav_resource->dav_name()) ); caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), caldav-PROPPATCH.php: translate("calendar-timezone property is only valid for a calendar.") ) caldav-PROPPATCH.php: * The following properties are read-only, so they will cause the request to fail caldav-PROPPATCH.php: case 'DAV::principal-collection-set': caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:CALENDAR-USER-ADDRESS-SET': caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-inbox-URL': caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-outbox-URL': caldav-PROPPATCH.php: $failure['rm-'.$tag] = new XMLElement( 'propstat', array( caldav-PROPPATCH.php: new XMLElement('responsedescription', translate("Property is read-only") ) caldav-PROPPATCH.php: $qry->QDo('DELETE FROM property WHERE dav_name=:dav_name AND property_name=:property_name', caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':property_name' => $tag) ); caldav-PROPPATCH.php: $url = ConstructURL($request->path); caldav-PROPPATCH.php: $qry->Rollback(); caldav-PROPPATCH.php: $request->DoResponse( 207, $multistatus->Render(0,''), 'text/xml; charset="utf-8"' ); caldav-PROPPATCH.php:if ( $qry->Commit() ) { caldav-PROPPATCH.php: $url = ConstructURL($request->path); caldav-PROPPATCH.php: $request->DoResponse( 200, $multistatus->Render(0,''), 'text/xml; charset="utf-8"' ); caldav-PROPPATCH.php:$request->DoResponse( 500 ); caldav-PUT-default.php:* CalDAV Server - handle PUT method on unknown (arbitrary) content-types caldav-PUT-default.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { caldav-PUT-default.php: fwrite($fh,$request->raw_post); caldav-PUT-default.php:$lock_opener = $request->FailIfLocked(); caldav-PUT-default.php:$dest = new DAVResource($request->path); caldav-PUT-default.php:$container = $dest->FetchParentContainer(); caldav-PUT-default.php:if ( $container->IsCalendar() ) { caldav-PUT-default.php: $request->PreconditionFailed(412,'urn:ietf:params:xml:ns:caldav:supported-calendar-data', caldav-PUT-default.php: translate('Incorrect content type for calendar: ') . $request->content_type ); caldav-PUT-default.php:else if ( $container->IsAddressbook() ) { caldav-PUT-default.php: $request->PreconditionFailed(412,'urn:ietf:params:xml:ns:carddav:supported-address-data', caldav-PUT-default.php: translate('Incorrect content type for addressbook: ') . $request->content_type ); caldav-PUT-default.php:if ( ! $dest->Exists() ) { caldav-PUT-default.php: if ( $container->IsPrincipal() ) { caldav-PUT-default.php: $request->DoResponse(403,translate('A DAViCal principal collection may only contain collections')); caldav-PUT-default.php: if ( ! $container->Exists() ) { caldav-PUT-default.php: $request->DoResponse( 409, translate('Destination collection does not exist') ); caldav-PUT-default.php: $container->NeedPrivilege('DAV::bind'); caldav-PUT-default.php: if ( $dest->IsCollection() ) { caldav-PUT-default.php: if ( ! isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections ) { caldav-PUT-default.php: $request->DoResponse(403,translate('You may not PUT to a collection URL')); caldav-PUT-default.php: $request->DoResponse(403,translate('PUT on a collection is only allowed for text/calendar content against a calendar collection')); caldav-PUT-default.php: $dest->NeedPrivilege('DAV::write-content'); caldav-PUT-default.php:if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { caldav-PUT-default.php: $request->DoResponse(412); caldav-PUT-default.php:if ( isset($request->etag_if_match) && $request->etag_if_match != $dest->unique_tag() ) { caldav-PUT-default.php: $request->DoResponse(412); caldav-PUT-default.php:$collection_id = $container->GetProperty('collection_id'); caldav-PUT-default.php:$qry->Begin(); caldav-PUT-default.php:$etag = md5($request->raw_post); caldav-PUT-default.php: ':user_no' => $dest->GetProperty('user_no'), caldav-PUT-default.php: ':dav_name' => $dest->bound_from(), caldav-PUT-default.php: ':dav_data' => $request->raw_post, caldav-PUT-default.php: ':session_user' => $session->user_no caldav-PUT-default.php:if ( $dest->Exists() ) { caldav-PUT-default.php:$qry->QDo( $sql, $params ); caldav-PUT-default.php:$qry->QDo("SELECT write_sync_change( $collection_id, $response_code, :dav_name)", array(':dav_name' => $dest->bound_from() ) ); caldav-PUT-default.php:if ( !$qry->Exec('move') ) rollback(500); caldav-PUT-default.php:$request->DoResponse( $response_code ); caldav-PUT-functions.php:* CalDAV Server - handle PUT method caldav-PUT-functions.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-PUT-functions.php:$tz_regex = ':^(Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Brazil|Canada|Chile|Etc|Europe|Indian|Mexico|Mideast|Pacific|US)/[a-z_]+$:i'; caldav-PUT-functions.php: $qry->Rollback(); caldav-PUT-functions.php: if ( isset($bad_events) && isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) { caldav-PUT-functions.php: $request->DoResponse( $error_no, $message ); caldav-PUT-functions.php: $c->messages[] = sprintf(translate('Status: %d, Message: %s, User: %d, Path: %s'), $error_no, $message, $user_no, $path); caldav-PUT-functions.php: if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) { caldav-PUT-functions.php: if ( ! $qry->Exec('PUT',__LINE__,__FILE__) ) { caldav-PUT-functions.php: if ( !isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections == true ) { caldav-PUT-functions.php: if ( $qry->rows() == 0 ) { caldav-PUT-functions.php: $request->DoResponse( 405 ); // Method not allowed caldav-PUT-functions.php: if ( $qry->rows() == 0 ) { caldav-PUT-functions.php: $qry->QDo( $sql, $params ); caldav-PUT-functions.php: $collection = $qry->Fetch(); caldav-PUT-functions.php: $params = array( ':is_public' => ($public?'t':'f'), ':collection_id' => $collection->collection_id ); caldav-PUT-functions.php: if ( ! $qry->QDo($sql,$params) ) { caldav-PUT-functions.php: if( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 1 ) { caldav-PUT-functions.php: $collection = $qry->Fetch(); caldav-PUT-functions.php: if ($collection->public_events_only == 't') { caldav-PUT-functions.php: $resources = $ical->GetComponents('VTIMEZONE',false); caldav-PUT-functions.php: $etag = md5 ( $request->raw_post ); caldav-PUT-functions.php: $attendees = $ic->GetProperties('ATTENDEE'); caldav-PUT-functions.php: $wr_attendees = $ic->GetProperties('X-WR-ATTENDEE'); caldav-PUT-functions.php: dbg_error_log( "POST", "Non-compliant iCal request. Using X-WR-ATTENDEE property" ); caldav-PUT-functions.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); caldav-PUT-functions.php: if ( $attendee_email == $request->principal->email ) { caldav-PUT-functions.php: if ( $attendee->GetParameterValue ( 'PARTSTAT' ) != 'NEEDS-ACTION' || preg_match ( '/^[35]\.[3-9]/', $attendee->GetParameterValue ( 'SCHEDULE-STATUS' ) ) ) { caldav-PUT-functions.php: $attendee->SetParameterValue ('SCHEDULE-STATUS','3.7;Invalid Calendar User'); caldav-PUT-functions.php: $deliver_path = preg_replace ( '/^.*caldav.php/','', $attendee_principal->schedule_inbox_url ); caldav-PUT-functions.php: $priv = $ar->HavePrivilegeTo('schedule-deliver-invite' ); caldav-PUT-functions.php: if ( ! $ar->HavePrivilegeTo('schedule-deliver-invite' ) ){ caldav-PUT-functions.php: $privnodes = array( $reply->href(ConstructURL($attendee_principal->schedule_inbox_url)), new XMLElement( 'privilege' ) ); caldav-PUT-functions.php: $reply->NSElement( $privnodes[1], 'schedule-deliver-invite' ); caldav-PUT-functions.php: $xml = new XMLElement( 'need-privileges', new XMLElement( 'resource', $privnodes) ); caldav-PUT-functions.php: $xmldoc = $reply->Render('error',$xml); caldav-PUT-functions.php: $request->DoResponse( 403, $xmldoc, 'text/xml; charset="utf-8"'); caldav-PUT-functions.php: $attendee->SetParameterValue ('SCHEDULE-STATUS','1.2;Scheduling message has been delivered'); caldav-PUT-functions.php: $ncal->VCalendar (); caldav-PUT-functions.php: $ncal->AddProperty ( 'METHOD', 'REQUEST' ); caldav-PUT-functions.php: $ncal->AddComponent ( array_merge ( $ical->GetComponents('VEVENT',false) , array ($ic) )); caldav-PUT-functions.php: $content = $ncal->Render(); caldav-PUT-functions.php: $cid = $ar->GetProperty('collection_id'); caldav-PUT-functions.php: dbg_error_log('DELIVER', 'to user: %s, to path: %s, collection: %s, from user: %s, caldata %s', $attendee_principal->user_no, $deliver_path, $cid, $request->user_no, $content ); caldav-PUT-functions.php: write_resource( $attendee_principal->user_no, $deliver_path . $etag . '.ics' , caldav-PUT-functions.php: $content , $ar->GetProperty('collection_id'), $request->user_no, caldav-PUT-functions.php: $attendee->SetParameterValue ('SCHEDULE-STATUS','1.2;Scheduling message has been delivered'); caldav-PUT-functions.php: $ncal->VCalendar (); caldav-PUT-functions.php: $ncal->AddProperty ( 'METHOD', 'REQUEST' ); caldav-PUT-functions.php: $ncal->AddComponent ( array_merge ( $ical->GetComponents('VEVENT',false) , array ($ic) )); caldav-PUT-functions.php: $content = $ncal->Render(); caldav-PUT-functions.php: $deliver_path = preg_replace ( '/^.*caldav.php/','', $request->principal->schedule_inbox_url ); caldav-PUT-functions.php: write_resource( $request->user_no, $deliver_path . $etag . '.ics' , caldav-PUT-functions.php: $content , $ar->GetProperty('collection_id'), $request->user_no, caldav-PUT-functions.php: header('Schedule-Tag: "'.$etag . '"' ); caldav-PUT-functions.php: $request->DoResponse( 201, 'Created' ); caldav-PUT-functions.php: $resources = $ical->GetComponents('VTIMEZONE',false); caldav-PUT-functions.php: $etag = md5 ( $request->raw_post ); caldav-PUT-functions.php: $organizer = $ic->GetProperties('ORGANIZER'); caldav-PUT-functions.php: $attendees = array_merge($organizer,$ic->GetProperties('ATTENDEE')); caldav-PUT-functions.php: $wr_attendees = $ic->GetProperties('X-WR-ATTENDEE'); caldav-PUT-functions.php: dbg_error_log( "POST", "Non-compliant iCal request. Using X-WR-ATTENDEE property" ); caldav-PUT-functions.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); caldav-PUT-functions.php: $deliver_path = preg_replace ( '/^.*caldav.php/','', $attendee_principal->schedule_inbox_url ); caldav-PUT-functions.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); caldav-PUT-functions.php: if ( $attendee_email == $request->principal->email ) { caldav-PUT-functions.php: if ( ! $ar->HavePrivilegeTo('schedule-deliver-reply' ) ){ caldav-PUT-functions.php: $privnodes = array( $reply->href(ConstructURL($attendee_principal->schedule_inbox_url)), new XMLElement( 'privilege' ) ); caldav-PUT-functions.php: $reply->NSElement( $privnodes[1], 'schedule-deliver-reply' ); caldav-PUT-functions.php: $xml = new XMLElement( 'need-privileges', new XMLElement( 'resource', $privnodes) ); caldav-PUT-functions.php: $xmldoc = $reply->Render('error',$xml); caldav-PUT-functions.php: $request->DoResponse( 403, $xmldoc, 'text/xml; charset="utf-8"' ); caldav-PUT-functions.php: $ncal->VCalendar (); caldav-PUT-functions.php: $ncal->AddProperty ( 'METHOD', 'REPLY' ); caldav-PUT-functions.php: $ncal->AddComponent ( array_merge ( $ical->GetComponents('VEVENT',false) , array ($ic) )); caldav-PUT-functions.php: $content = $ncal->Render(); caldav-PUT-functions.php: write_resource( $attendee_principal->user_no, $deliver_path . $etag . '.ics' , caldav-PUT-functions.php: $content , $ar->GetProperty('collection_id'), $request->user_no, caldav-PUT-functions.php: $request->DoResponse( 201, 'Created' ); caldav-PUT-functions.php:* @return float The result of the scheduling request, per caldav-sched #3.5.4 caldav-PUT-functions.php: dbg_error_log( 'PUT', 'create_scheduling_requests called with non-object parameter (%s)', gettype($resource) ); caldav-PUT-functions.php: $attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/ATTENDEE'); caldav-PUT-functions.php: $wr_attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/X-WR-ATTENDEE'); caldav-PUT-functions.php: dbg_error_log( 'POST', 'Non-compliant iCal request. Using X-WR-ATTENDEE property' ); caldav-PUT-functions.php: dbg_error_log( 'PUT', 'Event has no attendees - no scheduling required.', count($attendees) ); caldav-PUT-functions.php: $attendee->SetParameterValue( 'SCHEDULE-STATUS', write_scheduling_request( $resource, $attendee->Value() ) ); caldav-PUT-functions.php: dbg_error_log( 'PUT', 'update_scheduling_requests called with non-object parameter (%s)', gettype($resource) ); caldav-PUT-functions.php: $attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/ATTENDEE'); caldav-PUT-functions.php: $wr_attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/X-WR-ATTENDEE'); caldav-PUT-functions.php: dbg_error_log( 'POST', 'Non-compliant iCal request. Using X-WR-ATTENDEE property' ); caldav-PUT-functions.php: dbg_error_log( 'PUT', 'Event has no attendees - no scheduling required.', count($attendees) ); caldav-PUT-functions.php: $attendee->SetParameterValue( 'SCHEDULE-STATUS', write_scheduling_request( $resource, $attendee->Value() ) ); caldav-PUT-functions.php: if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['put'])) ) { caldav-PUT-functions.php: $fh = fopen('/tmp/PUT-2.txt','w'); caldav-PUT-functions.php: $timezones = $calendar->GetComponents('VTIMEZONE',true); caldav-PUT-functions.php: $components = $calendar->GetComponents('VTIMEZONE',false); caldav-PUT-functions.php: $displayname = $calendar->GetPValue('X-WR-CALNAME'); caldav-PUT-functions.php: if ( ! $qry->Exec('PUT',__LINE__,__FILE__) ) rollback_on_error( $caldav_context, $user_no, $path ); caldav-PUT-functions.php: $tz_ids[$tz->GetPValue('TZID')] = $k; caldav-PUT-functions.php: $uid = $comp->GetPValue('UID'); caldav-PUT-functions.php: $tzid = $comp->GetPParamValue('DTSTART', 'TZID'); caldav-PUT-functions.php: if ( !isset($tzid) || $tzid == '' ) $tzid = $comp->GetPParamValue('DUE','TZID'); caldav-PUT-functions.php: if ( ! $qry->Exec('PUT',__LINE__,__FILE__) ) rollback_on_error( $caldav_context, $user_no, $path ); caldav-PUT-functions.php: if ( ! $qry->rows() == 1 ) { caldav-PUT-functions.php: $collection = $qry->Fetch(); caldav-PUT-functions.php: if ( !(isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import) ) $qry->Begin(); caldav-PUT-functions.php: $base_params = array( ':collection_id' => $collection->collection_id ); caldav-PUT-functions.php: if ( !$qry->QDo('DELETE FROM calendar_item WHERE collection_id = :collection_id', $base_params) caldav-PUT-functions.php: || !$qry->QDo('DELETE FROM caldav_data WHERE collection_id = :collection_id', $base_params) ) caldav-PUT-functions.php: rollback_on_error( $caldav_context, $user_no, $collection->collection_id ); caldav-PUT-functions.php: if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin(); caldav-PUT-functions.php: $vcal->VCalendar(); caldav-PUT-functions.php: $vcal->SetComponents($resource); caldav-PUT-functions.php: $icalendar = $vcal->Render(); caldav-PUT-functions.php: $dav_data_params[':caldav_type'] = $first->GetType(); caldav-PUT-functions.php: $dav_data_params[':session_user'] = $session->user_no; caldav-PUT-functions.php: if ( !$qry->QDo($dav_data_insert,$dav_data_params) ) rollback_on_error( $caldav_context, $user_no, $path ); caldav-PUT-functions.php: $qry->QDo('SELECT dav_id FROM caldav_data WHERE dav_name = :dav_name ', array(':dav_name' => $dav_data_params[':dav_name'])); caldav-PUT-functions.php: if ( $qry->rows() == 1 && $row = $qry->Fetch() ) { caldav-PUT-functions.php: $dav_id = $row->dav_id; caldav-PUT-functions.php: $dtstart = $first->GetPValue('DTSTART'); caldav-PUT-functions.php: if ( (!isset($dtstart) || $dtstart == '') && $first->GetPValue('DUE') != '' ) { caldav-PUT-functions.php: $dtstart = $first->GetPValue('DUE'); caldav-PUT-functions.php: $dtend = $first->GetPValue('DTEND'); caldav-PUT-functions.php: dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') ); caldav-PUT-functions.php: if ( $first->GetPValue('DURATION') != '' AND $dtstart != '' ) { caldav-PUT-functions.php: $duration = preg_replace( '#[PT]#', ' ', $first->GetPValue('DURATION') ); caldav-PUT-functions.php: elseif ( $first->GetType() == 'VEVENT' ) { caldav-PUT-functions.php: * non-inclusive end is the end of the calendar date specified by the caldav-PUT-functions.php: * a "DTSTART" property with a DATE-TIME data type but no "DTEND" property, caldav-PUT-functions.php: $value_type = $first->GetPParamValue('DTSTART','VALUE'); caldav-PUT-functions.php: $last_modified = $first->GetPValue('LAST-MODIFIED'); caldav-PUT-functions.php: $dtstamp = $first->GetPValue('DTSTAMP'); caldav-PUT-functions.php: $class = ($collection->public_events_only == 't' ? 'PUBLIC' : $first->GetPValue('CLASS') ); caldav-PUT-functions.php: $tzid = $first->GetPParamValue('DTSTART','TZID'); caldav-PUT-functions.php: if ( !isset($tzid) || $tzid == '' ) $tzid = $first->GetPParamValue('DUE','TZID'); caldav-PUT-functions.php: $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); caldav-PUT-functions.php: $qry->QDo('SET TIMEZONE TO \''.$tz_locn."'" ); caldav-PUT-functions.php: if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 0 ) { caldav-PUT-functions.php: $params[':tzspec'] = (isset($tz) ? $tz->Render() : null ); caldav-PUT-functions.php: $qry->QDo('INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(:tzid,:tzlocn,:tzspec)', $params ); caldav-PUT-functions.php: $calitem_params[':uid'] = $first->GetPValue('UID'); caldav-PUT-functions.php: $calitem_params[':summary'] = $first->GetPValue('SUMMARY'); caldav-PUT-functions.php: $calitem_params[':location'] = $first->GetPValue('LOCATION'); caldav-PUT-functions.php: $calitem_params[':transp'] = $first->GetPValue('TRANSP'); caldav-PUT-functions.php: $calitem_params[':description'] = $first->GetPValue('DESCRIPTION'); caldav-PUT-functions.php: $calitem_params[':rrule'] = $first->GetPValue('RRULE'); caldav-PUT-functions.php: $calitem_params[':url'] = $first->GetPValue('URL'); caldav-PUT-functions.php: $calitem_params[':priority'] = $first->GetPValue('PRIORITY'); caldav-PUT-functions.php: $calitem_params[':due'] = $first->GetPValue('DUE'); caldav-PUT-functions.php: $calitem_params[':percent_complete'] = $first->GetPValue('PERCENT-COMPLETE'); caldav-PUT-functions.php: $calitem_params[':status'] = $first->GetPValue('STATUS'); caldav-PUT-functions.php: $created = $first->GetPValue('CREATED'); caldav-PUT-functions.php: if ( !$qry->QDo($sql,$calitem_params) ) rollback_on_error( $caldav_context, $user_no, $path); caldav-PUT-functions.php: if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Commit(); caldav-PUT-functions.php: if ( !(isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import) ) { caldav-PUT-functions.php: if ( ! $qry->Commit() ) rollback_on_error( $caldav_context, $user_no, $path); caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); caldav-PUT-functions.php: $alarms = $ical->GetComponents('VALARM'); caldav-PUT-functions.php: $qry->SetSql('INSERT INTO calendar_alarm ( dav_id, action, trigger, summary, description, component, next_trigger ) caldav-PUT-functions.php: $qry->Prepare(); caldav-PUT-functions.php: $trigger = array_merge($v->GetProperties('TRIGGER')); caldav-PUT-functions.php: $trigger_type = $trigger->GetParameterValue('VALUE'); caldav-PUT-functions.php: switch ( $trigger->GetParameterValue('RELATED') ) { caldav-PUT-functions.php: case 'DTEND': $related = $ical->GetPValue('DTEND'); break; caldav-PUT-functions.php: case 'DUE': $related = $ical->GetPValue('DUE'); break; caldav-PUT-functions.php: default: $related = $ical->GetPValue('DTSTART'); caldav-PUT-functions.php: $duration = $trigger->Value(); caldav-PUT-functions.php: $minus = (substr($duration,0,1) == '-'); caldav-PUT-functions.php: $related_trigger = trim(preg_replace( '#[PT-]#', ' ', $duration )); caldav-PUT-functions.php: $related_trigger = preg_replace( '{(\d+[WDHMS])}', '-$1 ', $related_trigger ); caldav-PUT-functions.php: $qry->Bind(':action', $v->GetPValue('ACTION')); caldav-PUT-functions.php: $qry->Bind(':trigger', $trigger->Render()); caldav-PUT-functions.php: $qry->Bind(':summary', $v->GetPValue('SUMMARY')); caldav-PUT-functions.php: $qry->Bind(':description', $v->GetPValue('DESCRIPTION')); caldav-PUT-functions.php: $qry->Bind(':component', $v->Render()); caldav-PUT-functions.php: $qry->Bind(':related', $related ); caldav-PUT-functions.php: $qry->Bind(':related_trigger', $related_trigger ); caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); caldav-PUT-functions.php: $attendees = $ical->GetProperties('ATTENDEE'); caldav-PUT-functions.php: $qry->SetSql('INSERT INTO calendar_attendee ( dav_id, status, partstat, cn, attendee, role, rsvp, property ) caldav-PUT-functions.php: $qry->Prepare(); caldav-PUT-functions.php: $attendee = $v->Value(); caldav-PUT-functions.php: dbg_error_log( 'LOG', 'Duplicate: "%s"', $v->Render() ); caldav-PUT-functions.php: $qry->Bind(':attendee', $attendee ); caldav-PUT-functions.php: $qry->Bind(':status', $v->GetParameterValue('STATUS') ); caldav-PUT-functions.php: $qry->Bind(':partstat', $v->GetParameterValue('PARTSTAT') ); caldav-PUT-functions.php: $qry->Bind(':cn', $v->GetParameterValue('CN') ); caldav-PUT-functions.php: $qry->Bind(':role', $v->GetParameterValue('ROLE') ); caldav-PUT-functions.php: $qry->Bind(':rsvp', $v->GetParameterValue('RSVP') ); caldav-PUT-functions.php: $qry->Bind(':property', $v->Render() ); caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); caldav-PUT-functions.php: $processed[$attendee] = $v->Render(); caldav-PUT-functions.php: $resources = $ic->GetComponents('VTIMEZONE',false); // Not matching VTIMEZONE caldav-PUT-functions.php: /** @TODO: Handle writing non-calendar resources, like address book entries or random file data */ caldav-PUT-functions.php: $resource_type = $first->GetType(); caldav-PUT-functions.php: $UID = $first->GetPValue('UID'); caldav-PUT-functions.php: $qry->Exec("PUT"); caldav-PUT-functions.php: if ($qry->rows() < 1) { caldav-PUT-functions.php: $qrycompa->Exec("PUT"); caldav-PUT-functions.php: if ($qrycompa->rows() < 1) { caldav-PUT-functions.php: elseif ($qry->rows() == 1) { caldav-PUT-functions.php: $alarme_time = $first->GetPValue('TRIGGER'); caldav-PUT-functions.php: $alarme_descarta = $first->GetPValue('X-MOZ-LASTACK'); caldav-PUT-functions.php: $start = $first->GetPValue('DTSTART'); caldav-PUT-functions.php: $HJ = date("Y-m-d 00:00:00"); caldav-PUT-functions.php: $hj_seg = $hoje->format("U"); caldav-PUT-functions.php: $DT_START = $dateTime->format("U"); caldav-PUT-functions.php: $hora = $dateTime->format("G"); caldav-PUT-functions.php: $minuto = $dateTime->format("i"); caldav-PUT-functions.php: $end = $first->GetPValue('DTEND'); caldav-PUT-functions.php: $DT_END = $dateTime_end->format("U"); caldav-PUT-functions.php: $execao = $first->GetPValue('EXDATE'); caldav-PUT-functions.php: $modify = $first->GetPValue('LAST-MODIFIED'); caldav-PUT-functions.php: $MOD = $dateTime_mod->format("U"); caldav-PUT-functions.php: $snooze = "X-MOZ-SNOOZE-TIME-$seg"; caldav-PUT-functions.php: $adia_alarme = $first->GetPValue("$snooze"); caldav-PUT-functions.php: $prioridade = $first->GetPValue('PRIORITY'); caldav-PUT-functions.php: $RECUR = $first->GetPValue('RRULE'); caldav-PUT-functions.php: $categoria_utf8 = $first->GetPValue('CATEGORIES'); caldav-PUT-functions.php: //$EXEC = $dateTime->format("U"); caldav-PUT-functions.php: $titulo_utf8 = $first->GetPValue('SUMMARY'); caldav-PUT-functions.php: $descricao_utf8 = preg_replace('/\n/', "\r\n", $first->GetPValue('DESCRIPTION')); caldav-PUT-functions.php: $recur_id = $first->GetPValue('RECURRENCE-ID'); caldav-PUT-functions.php: $cidade_utf8 = $first->GetPValue('LOCATION'); caldav-PUT-functions.php: $class = $first->GetPValue('CLASS'); caldav-PUT-functions.php: $phpgw_query->Exec(); caldav-PUT-functions.php: if ( $phpgw_query->rows() == 0 ) { caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $phpgw_query->Exec(); caldav-PUT-functions.php: $categg = $phpgw_query->Fetch(); caldav-PUT-functions.php: $category_id = $categg->cat_id; caldav-PUT-functions.php: { while ($categgg = $phpgw_query->Fetch()) caldav-PUT-functions.php: if ( $categgg->cat_access == 'public' || $categgg->cat_owner == "$nome") caldav-PUT-functions.php: $category_id = $categgg->cat_id; caldav-PUT-functions.php: $tipo_data = substr($alarme_time, -1); caldav-PUT-functions.php: $alarme = $DT_START - $reducao; caldav-PUT-functions.php: $participantes = $first->GetProperties('ATTENDEE'); caldav-PUT-functions.php: //$test = $ic->component->FirstNonTimezone(); caldav-PUT-functions.php: //$propriedades = $test->GetProperties('PARTSTAT'); caldav-PUT-functions.php: // dbg_error_log("PUT","UMBERTO %s", $c->Value()); caldav-PUT-functions.php: $user = $v->content; caldav-PUT-functions.php: //$atrr = new ldapDrivers($c->authenticate_hook['config']); caldav-PUT-functions.php: $stat = $v->GetParameterValue('PARTSTAT'); caldav-PUT-functions.php: case "NEEDS-ACTION": $estado[$k] = 'U'; caldav-PUT-functions.php: $teste = $first->CollectParameterValues('PARTSTAT'); caldav-PUT-functions.php: case "NEEDS-ACTION": $estado[0] = 'U'; caldav-PUT-functions.php: $laststack = "X-MOZ-LASTACK-PART-$nome"; caldav-PUT-functions.php: if (!$qryusr->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if ($qryusr->rows() == 0) { caldav-PUT-functions.php: if (!$qryusr->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qryuppart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $result=$qryslt->Exec("PUT"); caldav-PUT-functions.php: if ($result->rows() < 1){ caldav-PUT-functions.php: if (!$qrypart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qrypart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $hostbanco = "-@{$iporigem}"; caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qryid->Exec("PUT"); caldav-PUT-functions.php: $cal = $qryid->Fetch(); caldav-PUT-functions.php: $id = "cal:{$cal->max}:0"; caldav-PUT-functions.php: $data = "a:5:{s:4:\"time\";{$time};s:6:\"offset\";i:{$reducao};s:5:\"owner\";i:{$nome};s:7:\"enabled\";i:1;s:6:\"cal_id\";s:5:\"{$cal->max}\";}"; caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qryusr = new AwlQuery("INSERT INTO phpgw_cal_extra ( cal_id, cal_extra_name, cal_extra_value) VALUES ( :cal,'X-MOZ-LASTACK',:alarme)", array(':cal' => $cal->max, ':alarme' => $alarme_descarta)); caldav-PUT-functions.php: if (!$qryusr->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $total = preg_split("[;]", $RECUR, -1, PREG_SPLIT_NO_EMPTY); caldav-PUT-functions.php: $recur_enddate = $dateTime_until->format("U"); caldav-PUT-functions.php: $dias = $intervalo * ($val - 1) * 86400; caldav-PUT-functions.php: $dias = $intervalo * ($val - 1) * 86400 * 7; caldav-PUT-functions.php: $dias = $intervalo * ($val - 1) * 86400 * 31; caldav-PUT-functions.php: $dias = $intervalo * ($val - 1) * 86400 * 365; caldav-PUT-functions.php: //$semana = preg_split("[,]", $val, -1, PREG_SPLIT_NO_EMPTY); caldav-PUT-functions.php: $qryrepet = new AwlQuery("INSERT INTO phpgw_cal_repeats ( cal_id,recur_type, recur_use_end, recur_enddate, recur_interval,recur_data, recur_exception ) VALUES ( :cal,:tipo,0,:recur,:intervalo,:data,:exec)", array( ':cal' => $cal->max,':tipo' => $tipo, ':recur' => $recur_enddate, ':intervalo' => $intervalo, ':data' => $recur_data, ':exec' => $EXEC)); caldav-PUT-functions.php: if (!$qryrepet->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qryusr = new AwlQuery("INSERT INTO phpgw_cal_user ( cal_id, cal_login, cal_status, cal_type) VALUES ( :cal,:nome,'A','u')", array(':cal' => $cal->max, ':nome' => $nome)); caldav-PUT-functions.php: if (!$qryusr->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qrypart = new AwlQuery("INSERT INTO phpgw_cal_user ( cal_id, cal_login, cal_status, cal_type) VALUES ( :cal,:part,'U','u')", array(':cal' => $cal->max, ':part' => $part[$k])); caldav-PUT-functions.php: if (!$qrypart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qrypart_ex = new AwlQuery("UPDATE phpgw_cal SET ex_participants=:expart WHERE owner=:nome AND cal_id=:cal", array(':expart' => $mails, ':nome' => $nome, ':cal' => $cal->max)); caldav-PUT-functions.php: if (!$qrypart_ex->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if ( $first->GetPValue('X-MOZ-SEND-INVITATIONS') == 'TRUE' ){ caldav-PUT-functions.php: $qrypart = new AwlQuery("INSERT INTO phpgw_cal_extra ( cal_id, cal_extra_name, cal_extra_value) VALUES ( :cal,'X-MOZ-SEND-INVITATIONS','true')", array(':cal' => $cal->max)); caldav-PUT-functions.php: if (!$qrypart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qry->Exec("PUT"); caldav-PUT-functions.php: $qry->Exec("PUT"); caldav-PUT-functions.php: dbg_error_log("PUT", "argumento : '%s' valor : '%s' ", $alarme_descarta, $query->rows()); caldav-PUT-functions.php: if ($qry->rows() != 0) { caldav-PUT-functions.php: $qryusr = new AwlQuery("UPDATE phpgw_cal_extra set cal_extra_value=:alarme WHERE cal_id=:cal_id AND cal_extra_name = 'X-MOZ-LASTACK'",array(':alarme' => $alarme_descarta, ':cal_id' => $CALID)); caldav-PUT-functions.php: $qryusr->Exec("PUT"); caldav-PUT-functions.php: $qryusr->Exec("PUT"); caldav-PUT-functions.php: $qryusr = new AwlQuery("INSERT INTO phpgw_cal_extra ( cal_id, cal_extra_name, cal_extra_value) VALUES ( :cal,'X-MOZ-LASTACK',:alarme)", array(':cal' => $CALID,':alarme' => $alarme_descarta)); caldav-PUT-functions.php: if (!$qryusr->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qryusr->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qry->Exec("PUT"); caldav-PUT-functions.php: if ($qry->rows == 0) { caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qry->Exec("PUT"); caldav-PUT-functions.php: VALUES ( DEFAULT,:hostbanco,:nome,:category_id,:DTSTART,:MOD,:DTEND,:prioridade,:tipo,:public,:titulo,:cidade,:descricao,:ref)",array(':hostbanco' => $hostbanco, ':nome' => $nome,':category_id' => $category_id,':DTSTART' => dataTParaSegundos($recur_id["DTSTART"]),':MOD' => dataTParaSegundos($recur_id["LAST-MODIFIED"]),':DTEND' => dataTParaSegundos($recur_id["DTEND"]) ,':prioridade' => $recur_id["PRIORITY"],':tipo' => $tipo,':public' => $public,':titulo' => $titulo,':cidade' => $cidade,':descricao' => $descricao,':ref' => $reference)); caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qryid->Exec("PUT"); caldav-PUT-functions.php: $call = $qryid->Fetch(); caldav-PUT-functions.php: $qry = new AwlQuery("INSERT INTO phpgw_cal_user ( cal_id, cal_login, cal_status, cal_type) VALUES ( :cal,:nome,'A','u');",array(':cal' => $call->max,':nome' => $nome)); caldav-PUT-functions.php: if (!$qry->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if ( $qryid->Exec("PUT",__LINE__,__FILE__) && $qryid->rows() > 0 && $DT_START != $alarme) caldav-PUT-functions.php: { $alarmew = $qryid->Fetch(); caldav-PUT-functions.php: $tempo_ant = $data_seg - $reducao; caldav-PUT-functions.php: $id_cal_novo = "cal:$call->max:0"; caldav-PUT-functions.php: $dados_alarme= "a:5:{s:4:\"time\";i:$tempo_ant;s:6:\"offset\";i:$reducao;s:5:\"owner\";i:$nome;s:7:\"enabled\";i:1;s:6:\"cal_id\";s:5:\"$call->max\";}"; caldav-PUT-functions.php: if (!$qrysy->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $total = preg_split("[;]", $RECUR, -1, PREG_SPLIT_NO_EMPTY); caldav-PUT-functions.php: $recur_enddate = $dateTime_until->format("U"); caldav-PUT-functions.php: $semana = preg_split("[,]", $val, -1, PREG_SPLIT_NO_EMPTY); caldav-PUT-functions.php: if (!$qryrepet->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: //if (!$qryuppart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qryuppart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $result=$qryslt->Exec("PUT"); caldav-PUT-functions.php: if ($result->rows < 1){ caldav-PUT-functions.php: if (!$qrypart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: if (!$qrypart->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $qrypart_ex = new AwlQuery("UPDATE phpgw_cal SET ex_participants=:expart WHERE owner=:nome AND cal_id=:cal_id", array(':expart' => $mails,':nome' => $nome,':cal_id' => $cal->max)); caldav-PUT-functions.php: if (!$qrypart_ex->Exec("PUT")) rollback_on_error($caldav_context, $user_no, $path); caldav-PUT-functions.php: $resources = $ic->GetComponents('VTIMEZONE',false); // Not matching VTIMEZONE caldav-PUT-functions.php: /** @TODO: Handle writing non-calendar resources, like address book entries or random file data */ caldav-PUT-functions.php: $resource_type = $first->GetType(); caldav-PUT-functions.php: $qry->Begin(); caldav-PUT-functions.php: if ( !$qry->QDo($sql,$params) ) { caldav-PUT-functions.php: $qry->QDo('SELECT dav_id FROM caldav_data WHERE dav_name = :dav_name ', array(':dav_name' => $path)); caldav-PUT-functions.php: if ( $qry->rows() == 1 && $row = $qry->Fetch() ) { caldav-PUT-functions.php: $dav_id = $row->dav_id; caldav-PUT-functions.php: $dtstart = $first->GetPValue('DTSTART'); caldav-PUT-functions.php: if ( (!isset($dtstart) || $dtstart == '') && $first->GetPValue('DUE') != '' ) { caldav-PUT-functions.php: $dtstart = $first->GetPValue('DUE'); caldav-PUT-functions.php: $dtend = $first->GetPValue('DTEND'); caldav-PUT-functions.php: dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') ); caldav-PUT-functions.php: if ( $first->GetPValue('DURATION') != '' AND $dtstart != '' ) { caldav-PUT-functions.php: $duration = preg_replace( '#[PT]#', ' ', $first->GetPValue('DURATION') ); caldav-PUT-functions.php: elseif ( $first->GetType() == 'VEVENT' ) { caldav-PUT-functions.php: * non-inclusive end is the end of the calendar date specified by the caldav-PUT-functions.php: * a "DTSTART" property with a DATE-TIME data type but no "DTEND" property, caldav-PUT-functions.php: $value_type = $first->GetPParamValue('DTSTART','VALUE'); caldav-PUT-functions.php: $last_modified = $first->GetPValue('LAST-MODIFIED'); caldav-PUT-functions.php: $dtstamp = $first->GetPValue('DTSTAMP'); caldav-PUT-functions.php: $class = $first->GetPValue('CLASS'); caldav-PUT-functions.php: $tzid = $first->GetPParamValue('DTSTART','TZID'); caldav-PUT-functions.php: if ( !isset($tzid) || $tzid == '' ) $tzid = $first->GetPParamValue('DUE','TZID'); caldav-PUT-functions.php: $timezones = $ic->GetComponents('VTIMEZONE'); caldav-PUT-functions.php: if ( $tz->GetPValue('TZID') != $tzid ) { caldav-PUT-functions.php: dbg_error_log( 'ERROR', ' Event includes TZID[%s] but uses TZID[%s]!', $tz->GetPValue('TZID'), $tzid ); caldav-PUT-functions.php: $tzid = $tz->GetPValue('TZID'); caldav-PUT-functions.php: $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); caldav-PUT-functions.php: $qry->QDo('SET TIMEZONE TO \''.$tz_locn."'" ); caldav-PUT-functions.php: if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 0 ) { caldav-PUT-functions.php: $params[':tzspec'] = (isset($tz) ? $tz->Render() : null ); caldav-PUT-functions.php: $qry->QDo('INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(:tzid,:tzlocn,:tzspec)', $params ); caldav-PUT-functions.php: $created = $first->GetPValue('CREATED'); caldav-PUT-functions.php: $calitem_params[':uid'] = $first->GetPValue('UID'); caldav-PUT-functions.php: $calitem_params[':summary'] = $first->GetPValue('SUMMARY'); caldav-PUT-functions.php: $calitem_params[':location'] = $first->GetPValue('LOCATION'); caldav-PUT-functions.php: $calitem_params[':transp'] = $first->GetPValue('TRANSP'); caldav-PUT-functions.php: $calitem_params[':description'] = $first->GetPValue('DESCRIPTION'); caldav-PUT-functions.php: $calitem_params[':rrule'] = $first->GetPValue('RRULE'); caldav-PUT-functions.php: $calitem_params[':url'] = $first->GetPValue('URL'); caldav-PUT-functions.php: $calitem_params[':priority'] = $first->GetPValue('PRIORITY'); caldav-PUT-functions.php: $calitem_params[':due'] = $first->GetPValue('DUE'); caldav-PUT-functions.php: $calitem_params[':percent_complete'] = $first->GetPValue('PERCENT-COMPLETE'); caldav-PUT-functions.php: $calitem_params[':status'] = $first->GetPValue('STATUS'); caldav-PUT-functions.php: log_caldav_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path ); caldav-PUT-functions.php: $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path ); caldav-PUT-functions.php: if ( !$qry->Exec('PUT',__LINE__,__FILE__) ) { caldav-PUT-functions.php: $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $path ) ); caldav-PUT-functions.php: $qry->Commit(); caldav-PUT-functions.php: if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 1 ) { caldav-PUT-functions.php: $collection = $qry->Fetch(); caldav-PUT-functions.php: $user_no = $collection->user_no; caldav-PUT-functions.php: return write_resource( $user_no, $path, $caldav_data, $collection->collection_id, $user_no, $etag, $ic, $put_action_type, false, $write_action_log ); caldav-PUT-functions.php: substr("$datatz", 0,4)) + $HorarioTimeZone->getoffset($HorarioTime);//ano caldav-PUT-functions.php: $teste = getdate($dataseg - $HorarioTimeZone->getoffset($HorarioTime)); caldav-PUT-functions.php: $ajuste_dia=-86400; caldav-PUT.php:* CalDAV Server - handle PUT method caldav-PUT.php:$dav_resource = new DAVResource($request->path); caldav-PUT.php:if ( ! $dav_resource->HavePrivilegeTo('DAV::write-content') ) { caldav-PUT.php: $request->DoResponse(403); caldav-PUT.php:if ( ! $dav_resource->Exists() && ! $dav_resource->HavePrivilegeTo('DAV::bind') ) { caldav-PUT.php: $request->DoResponse(403); caldav-PUT.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { caldav-PUT.php: fwrite($fh,$request->raw_post); caldav-PUT.php:include_once('caldav-PUT-functions.php'); caldav-PUT.php://controlRequestContainer( $dav_resource->GetProperty('username'), $dav_resource->GetProperty('user_no'), $dav_resource->bound_from(), true); caldav-PUT.php:$lock_opener = $request->FailIfLocked(); caldav-PUT.php://if ( $dav_resource->IsCollection() ) { caldav-PUT.php:// if ( $dav_resource->IsPrincipal() || $dav_resource->IsBinding() || !isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections == true ) { caldav-PUT.php:// $request->DoResponse( 405 ); // Method not allowed caldav-PUT.php: * as an import. The code is in caldav-PUT-functions.php caldav-PUT.php:// import_collection($request->raw_post,$request->user_no,$request->path,true, $appending); caldav-PUT.php:// $request->DoResponse( 200 ); caldav-PUT.php:$etag = md5($request->raw_post); caldav-PUT.php:$ic = new iCalComponent( $request->raw_post ); caldav-PUT.php:if ( ! $dav_resource->Exists() && (isset($request->etag_if_match) && $request->etag_if_match != '') ) { caldav-PUT.php: $request->PreconditionFailed(412,'if-match'); caldav-PUT.php:if ( $dav_resource->Exists() ) { caldav-PUT.php: if ( isset($request->etag_if_match) && $request->etag_if_match != '' && $request->etag_if_match != $dav_resource->unique_tag() ) { caldav-PUT.php: $request->PreconditionFailed(412,'if-match', translate( 'Existing resource does not match "If-Match" header - not accepted.')); caldav-PUT.php: else if ( isset($request->etag_none_match) && $request->etag_none_match != '' caldav-PUT.php: && ($request->etag_none_match == $dav_resource->unique_tag() || $request->etag_none_match == '*') ) { caldav-PUT.php: * (without the If-None-Match header) on that resource, or if "*" is caldav-PUT.php: $request->PreconditionFailed(412,'if-none-match', translate( 'Existing resource matches "If-None-Match" header - not accepted.')); caldav-PUT.php:$put_action_type = ($dav_resource->Exists() ? 'UPDATE' : 'INSERT'); caldav-PUT.php:write_resource( $dav_resource->GetProperty('user_no'), $dav_resource->bound_from(), $request->raw_post, $dav_resource->GetProperty('collection_id'), caldav-PUT.php: $session->user_no, $etag, $ic, $put_action_type, true, true ); caldav-PUT.php:$request->DoResponse( ($dav_resource->Exists() ? 204 : 201) ); caldav-PUT-vcard.php:* CalDAV Server - handle PUT method on VCARD content-types caldav-PUT-vcard.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { caldav-PUT-vcard.php: fwrite($fh,$request->raw_post); caldav-PUT-vcard.php:$lock_opener = $request->FailIfLocked(); caldav-PUT-vcard.php:$dest = new DAVResource($request->path); caldav-PUT-vcard.php:$container = $dest->FetchParentContainer(); caldav-PUT-vcard.php:if ( ! $dest->Exists() ) { caldav-PUT-vcard.php: if ( $container->IsPrincipal() ) { caldav-PUT-vcard.php: $request->DoResponse(403,translate('A DAViCal principal collection may only contain collections')); caldav-PUT-vcard.php: if ( ! $container->Exists() ) { caldav-PUT-vcard.php: $request->DoResponse( 409, translate('Destination collection does not exist') ); caldav-PUT-vcard.php: $container->NeedPrivilege('DAV::bind'); caldav-PUT-vcard.php: if ( $dest->IsCollection() ) { caldav-PUT-vcard.php: if ( ! isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections ) { caldav-PUT-vcard.php: $request->DoResponse(403,translate('You may not PUT to a collection URL')); caldav-PUT-vcard.php: $request->DoResponse(403,translate('PUT on a collection is only allowed for text/calendar content against a calendar collection')); caldav-PUT-vcard.php: $dest->NeedPrivilege('DAV::write-content'); caldav-PUT-vcard.php:if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { caldav-PUT-vcard.php: $request->DoResponse(412); caldav-PUT-vcard.php:if ( isset($request->etag_if_match) && $request->etag_if_match != $dest->unique_tag() ) { caldav-PUT-vcard.php: $request->DoResponse(412); caldav-PUT-vcard.php:$collection_id = $container->GetProperty('collection_id'); caldav-PUT-vcard.php:$qry->Begin(); caldav-PUT-vcard.php:$etag = md5($request->raw_post); caldav-PUT-vcard.php: ':user_no' => $dest->GetProperty('user_no'), caldav-PUT-vcard.php: ':dav_name' => $dest->bound_from(), caldav-PUT-vcard.php: ':dav_data' => $request->raw_post, caldav-PUT-vcard.php: ':session_user' => $session->user_no caldav-PUT-vcard.php:if ( $dest->Exists() ) { caldav-PUT-vcard.php: $qry->QDo( $sql, $params ); caldav-PUT-vcard.php: $qry->QDo("SELECT dav_id FROM caldav_data WHERE dav_name = :dav_name ", array(':dav_name' => $params[':dav_name']) ); caldav-PUT-vcard.php: $qry->QDo( $sql, $params ); caldav-PUT-vcard.php: $qry->QDo("SELECT currval('dav_id_seq') AS dav_id" ); caldav-PUT-vcard.php:$row = $qry->Fetch(); caldav-PUT-vcard.php:$vcard = new vCard( $request->raw_post ); caldav-PUT-vcard.php:$vcard->Write( $row->dav_id, $dest->Exists() ); caldav-PUT-vcard.php:$qry->QDo("SELECT write_sync_change( $collection_id, $response_code, :dav_name)", array(':dav_name' => $dest->bound_from() ) ); caldav-PUT-vcard.php:if ( !$qry->QDo('COMMIT') ) rollback(500); caldav-PUT-vcard.php:$request->DoResponse( $response_code ); caldav-REPORT-calquery.php: $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); caldav-REPORT-calquery.php: $expand_range_start = $expansion[0]->GetAttribute('start'); caldav-REPORT-calquery.php: $expand_range_end = $expansion[0]->GetAttribute('end'); caldav-REPORT-calquery.php:$qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-query'); caldav-REPORT-calquery.php:$proptype = $qry_content[0]->GetTag(); caldav-REPORT-calquery.php: $qry_props = $xmltree->GetPath('/urn:ietf:params:xml:ns:caldav:calendar-query/'.$proptype.'/*'); caldav-REPORT-calquery.php: foreach( $qry_content[0]->GetElements() AS $k => $v ) { caldav-REPORT-calquery.php: $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); caldav-REPORT-calquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); caldav-REPORT-calquery.php: if ( $qry_content[1]->GetTag() == 'DAV::include' ) { caldav-REPORT-calquery.php: foreach( $qry_content[1]->GetElements() AS $k => $v ) { caldav-REPORT-calquery.php: $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ caldav-REPORT-calquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); caldav-REPORT-calquery.php: * There can only be *one* FILTER element, and it must contain *one* COMP-FILTER caldav-REPORT-calquery.php: * element. In every case I can see this contained COMP-FILTER element will be a caldav-REPORT-calquery.php:$qry_filters = $xmltree->GetPath('/urn:ietf:params:xml:ns:caldav:calendar-query/urn:ietf:params:xml:ns:caldav:filter/*'); caldav-REPORT-calquery.php: if ( $qry_filters->GetTag() == "urn:ietf:params:xml:ns:caldav:comp-filter" && $qry_filters->GetAttribute("name") == "VCALENDAR" ) caldav-REPORT-calquery.php: $qry_filters = $qry_filters->GetContent(); // Everything is inside a VCALENDAR AFAICS caldav-REPORT-calquery.php: dbg_error_log("calquery", "Got bizarre CALDAV:FILTER[%s=%s]] which does not contain comp-filter = VCALENDAR!!", $qry_filters->GetTag(), $qry_filters->GetAttribute("name") ); caldav-REPORT-calquery.php: dbg_error_log("calquery","Applying filter for item '%s'", $item->dav_name ); caldav-REPORT-calquery.php: $ical = new iCalendar( array( "icalendar" => $item->caldav_data) ); caldav-REPORT-calquery.php: return $ical->TestFilter($filters); caldav-REPORT-calquery.php: $tag = $v->GetTag(); caldav-REPORT-calquery.php: dbg_error_log("calquery", "Processing $tag into SQL - %d, '%s', %d\n", count($components), $property, isset($parameter) ); caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:is-not-defined': caldav-REPORT-calquery.php: $not_defined = "not-"; // then fall through to IS-DEFINED case caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:is-defined': caldav-REPORT-calquery.php: dbg_error_log("calquery", "Could not handle 'is-%sdefined' on property %s, parameter %s in SQL", $not_defined, $property, $parameter ); caldav-REPORT-calquery.php: case 'completed': /** @todo when it can be handled in the SQL - see around line 200 below */ caldav-REPORT-calquery.php: if ( ! $target_collection->IsSchedulingCollection() ) { caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:time-range': caldav-REPORT-calquery.php: $start_column = ($components[sizeof($components)-1] == 'VTODO' ? "due" : 'dtend'); // The column we compare against the START attribute caldav-REPORT-calquery.php: $start = $v->GetAttribute("start"); caldav-REPORT-calquery.php: $finish = $v->GetAttribute("end"); caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:text-match': caldav-REPORT-calquery.php: $search = $v->GetContent(); caldav-REPORT-calquery.php: $negate = $v->GetAttribute("negate-condition"); caldav-REPORT-calquery.php: $collation = $v->GetAttribute("collation"); caldav-REPORT-calquery.php: case 'i;ascii-casemap': caldav-REPORT-calquery.php: dbg_error_log("calquery", " text-match: (%s IS NULL OR %s%s %s '%s') ", $property, (isset($negate) && strtolower($negate) == "yes" ? "NOT ": ""), caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:comp-filter': caldav-REPORT-calquery.php: $comp_filter_name = $v->GetAttribute("name"); caldav-REPORT-calquery.php: $subfilter = $v->GetContent(); caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:prop-filter': caldav-REPORT-calquery.php: $propertyname = $v->GetAttribute("name"); caldav-REPORT-calquery.php: case 'PERCENT-COMPLETE': caldav-REPORT-calquery.php: dbg_error_log("calquery", "Could not handle 'prop-filter' on %s in SQL", $propertyname ); caldav-REPORT-calquery.php: $subfilter = $v->GetContent(); caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:param-filter': caldav-REPORT-calquery.php: return false; // Can't handle PARAM-FILTER conditions in the SQL caldav-REPORT-calquery.php: $parameter = $v->GetAttribute("name"); caldav-REPORT-calquery.php: $subfilter = $v->GetContent(); caldav-REPORT-calquery.php:$target_collection = new DAVResource($request->path); caldav-REPORT-calquery.php:$bound_from = $target_collection->bound_from(); caldav-REPORT-calquery.php:if ( !$target_collection->Exists() ) { caldav-REPORT-calquery.php: $request->DoResponse( 404 ); caldav-REPORT-calquery.php:if ( ! ($target_collection->IsCalendar() || $target_collection->IsSchedulingCollection()) ) { caldav-REPORT-calquery.php: $request->DoResponse( 403, translate('The calendar-query report must be run against a calendar or a scheduling collection') ); caldav-REPORT-calquery.php:$where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id(); caldav-REPORT-calquery.php:if ( $target_collection->Privileges() != privilege_to_bits('DAV::all') ) { caldav-REPORT-calquery.php:if ( isset($c->hide_TODO) && $c->hide_TODO && ! $target_collection->HavePrivilegeTo('DAV::write-content') ) { caldav-REPORT-calquery.php:if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { caldav-REPORT-calquery.php: $where .= " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; caldav-REPORT-calquery.php:if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; caldav-REPORT-calquery.php:if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-REPORT-calquery.php: while( $calendar_object = $qry->Fetch() ) { caldav-REPORT-calquery.php: if ( $bound_from != $target_collection->dav_name() ) { caldav-REPORT-calquery.php: $calendar_object->dav_name = str_replace( $bound_from, $target_collection->dav_name(), $calendar_object->dav_name); caldav-REPORT-calquery.php: $vResource = new vComponent($calendar_object->caldav_data); caldav-REPORT-calquery.php: $calendar_object->caldav_data = $expanded->Render(); caldav-REPORT-calquery.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); caldav-REPORT-calquery.php:$request->XMLResponse( 207, $multistatus ); caldav-REPORT-cardquery.php: $expansion = $address_data_xml->GetElements(); caldav-REPORT-cardquery.php: $address_data_properties[strtoupper($v->GetAttribute('name'))] = true; caldav-REPORT-cardquery.php:$qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:carddav:addressbook-query'); caldav-REPORT-cardquery.php:$proptype = $qry_content[0]->GetTag(); caldav-REPORT-cardquery.php: $qry_props = $xmltree->GetPath('/urn:ietf:params:xml:ns:carddav:addressbook-query/'.$proptype.'/*'); caldav-REPORT-cardquery.php: foreach( $qry_content[0]->GetElements() AS $k => $v ) { caldav-REPORT-cardquery.php: $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); caldav-REPORT-cardquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:carddav:address-data' ) get_address_properties($v); caldav-REPORT-cardquery.php: if ( $qry_content[1]->GetTag() == 'DAV::include' ) { caldav-REPORT-cardquery.php: foreach( $qry_content[1]->GetElements() AS $k => $v ) { caldav-REPORT-cardquery.php: $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ caldav-REPORT-cardquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:carddav:address-data' ) get_address_properties($v); caldav-REPORT-cardquery.php:$qry_filters = $xmltree->GetPath('/urn:ietf:params:xml:ns:carddav:addressbook-query/urn:ietf:params:xml:ns:carddav:filter/*'); caldav-REPORT-cardquery.php: dbg_error_log("cardquery","Applying filter for item '%s'", $item->dav_name ); caldav-REPORT-cardquery.php: $vcard = new vComponent( $item->caldav_data ); caldav-REPORT-cardquery.php: return $vcard->TestFilter($filters); caldav-REPORT-cardquery.php: $tag = $v->GetTag(); caldav-REPORT-cardquery.php: dbg_error_log("cardquery", "Processing $tag into SQL - %d, '%s', %d\n", count($components), $property, isset($parameter) ); caldav-REPORT-cardquery.php: case 'urn:ietf:params:xml:ns:carddav:text-match': caldav-REPORT-cardquery.php: $search = $v->GetContent(); caldav-REPORT-cardquery.php: $negate = $v->GetAttribute("negate-condition"); caldav-REPORT-cardquery.php: $collation = $v->GetAttribute("collation"); caldav-REPORT-cardquery.php: case 'i;ascii-casemap': caldav-REPORT-cardquery.php: case 'i;unicode-casemap': caldav-REPORT-cardquery.php: dbg_error_log("cardquery", " text-match: (%s%s %s '%s') ", (isset($negate) && strtolower($negate) == "yes" ? "NOT ": ""), caldav-REPORT-cardquery.php: case 'urn:ietf:params:xml:ns:carddav:prop-filter': caldav-REPORT-cardquery.php: $propertyname = $v->GetAttribute("name"); caldav-REPORT-cardquery.php: dbg_error_log("cardquery", "Could not handle 'prop-filter' on %s in SQL", $propertyname ); caldav-REPORT-cardquery.php: $subfilter = $v->GetContent(); caldav-REPORT-cardquery.php: case 'urn:ietf:params:xml:ns:carddav:param-filter': caldav-REPORT-cardquery.php: return false; /** Figure out how to handle PARAM-FILTER conditions in the SQL */ caldav-REPORT-cardquery.php: $parameter = $v->GetAttribute("name"); caldav-REPORT-cardquery.php: $subfilter = $v->GetContent(); caldav-REPORT-cardquery.php:$target_collection = new DAVResource($request->path); caldav-REPORT-cardquery.php:$bound_from = $target_collection->bound_from(); caldav-REPORT-cardquery.php:if ( !$target_collection->Exists() ) { caldav-REPORT-cardquery.php: $request->DoResponse( 404 ); caldav-REPORT-cardquery.php:if ( ! ($target_collection->IsAddressbook() || $target_collection->IsSchedulingCollection()) ) { caldav-REPORT-cardquery.php: $request->DoResponse( 403, translate('The addressbook-query report must be run against an addressbook collection') ); caldav-REPORT-cardquery.php:$where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id(); caldav-REPORT-cardquery.php:if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; caldav-REPORT-cardquery.php:if ( $qry->Exec("cardquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-REPORT-cardquery.php: while( $address_object = $qry->Fetch() ) { caldav-REPORT-cardquery.php: if ( $bound_from != $target_collection->dav_name() ) { caldav-REPORT-cardquery.php: $address_object->dav_name = str_replace( $bound_from, $target_collection->dav_name(), $address_object->dav_name); caldav-REPORT-cardquery.php: $vcard = new VCard($address_object->caldav_data); caldav-REPORT-cardquery.php: $vcard->MaskProperties($address_data_properties); caldav-REPORT-cardquery.php: $address_object->caldav_data = $vcard->Render(); caldav-REPORT-cardquery.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); caldav-REPORT-cardquery.php:$request->XMLResponse( 207, $multistatus ); caldav-REPORT-expand-property.php: $propstat_set = $multistatus_response->GetElements('propstat'); caldav-REPORT-expand-property.php: $status = $v->GetElements('status'); caldav-REPORT-expand-property.php: if ( preg_match( '{^HTTP/\S+\s+200}', $status[0]->GetContent() ) ) { caldav-REPORT-expand-property.php: $props = $propstat_200->GetElements('prop'); caldav-REPORT-expand-property.php: $properties = array_merge($properties,$p->GetElements()); caldav-REPORT-expand-property.php:// dbg_error_log('REPORT',' get_href_containers: Checking property "%s" for hrefs.', $property->GetNSTag() ); caldav-REPORT-expand-property.php: $hrefs = $property->GetElements('href'); caldav-REPORT-expand-property.php: $pname = $property->GetAttribute('name'); caldav-REPORT-expand-property.php: $pns = $property->GetAttribute('namespace'); caldav-REPORT-expand-property.php: $subtrees[$pname] = $property->GetElements(); caldav-REPORT-expand-property.php: $part_response = $resource->RenderAsXML( $props, $reply ); caldav-REPORT-expand-property.php: $hrefs = $property->GetElements(); caldav-REPORT-expand-property.php: $pname = $property->GetTag(); caldav-REPORT-expand-property.php: $pns = $property->GetAttribute('xmlns'); caldav-REPORT-expand-property.php: $content = $v->GetContent(); caldav-REPORT-expand-property.php: $property->SetContent( expand_properties($paths, $subtrees[$pname], $reply, false) ); caldav-REPORT-expand-property.php:$property_tree = $xmltree->GetPath('/DAV::expand-property/DAV::property'); caldav-REPORT-expand-property.php:$multistatus = new XMLElement( "multistatus", expand_properties( $request->path, $property_tree, $reply), $reply->GetXmlNsArray() ); caldav-REPORT-expand-property.php:$request->XMLResponse( 207, $multistatus ); caldav-REPORT-freebusy.php: * Handle the FREE-BUSY-QUERY variant of REPORT caldav-REPORT-freebusy.php:include_once("freebusy-functions.php"); caldav-REPORT-freebusy.php:$fbq_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:free-busy-query'); caldav-REPORT-freebusy.php:$fbq_start = $fbq_content[0]->GetAttribute('start'); caldav-REPORT-freebusy.php:$fbq_end = $fbq_content[0]->GetAttribute('end'); caldav-REPORT-freebusy.php: $request->DoResponse( 400, 'All valid freebusy requests MUST contain a time-range filter' ); caldav-REPORT-freebusy.php:$freebusy = get_freebusy( '^'.$request->path.$request->DepthRegexTail(), $range_start, $range_end ); caldav-REPORT-freebusy.php:$result->VCalendar(); caldav-REPORT-freebusy.php:$result->AddComponent($freebusy); caldav-REPORT-freebusy.php:$request->DoResponse( 200, $result->Render(), 'text/calendar' ); caldav-REPORT-multiget.php:* Handle the calendar-multiget REPORT request. caldav-REPORT-multiget.php: $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); caldav-REPORT-multiget.php: $expand_range_start = $expansion[0]->GetAttribute('start'); caldav-REPORT-multiget.php: $expand_range_end = $expansion[0]->GetAttribute('end'); caldav-REPORT-multiget.php:$proptype = $qry_content[0]->GetTag(); caldav-REPORT-multiget.php: $qry_props = $xmltree->GetPath('/*/'.$proptype.'/*'); caldav-REPORT-multiget.php: foreach( $qry_content[0]->GetElements() AS $k => $v ) { caldav-REPORT-multiget.php: $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); caldav-REPORT-multiget.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); caldav-REPORT-multiget.php: if ( $qry_content[1]->GetTag() == 'DAV::include' ) { caldav-REPORT-multiget.php: foreach( $qry_content[1]->GetElements() AS $k => $v ) { caldav-REPORT-multiget.php: $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ caldav-REPORT-multiget.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); caldav-REPORT-multiget.php:$collection = new DAVResource($request->path); caldav-REPORT-multiget.php:$bound_from = $collection->bound_from(); caldav-REPORT-multiget.php:$mg_hrefs = $xmltree->GetPath('/*/DAV::href'); caldav-REPORT-multiget.php: * anything up to the matching request->path (which will include any http...) and then caldav-REPORT-multiget.php: $href = $bound_from . preg_replace( "{^.*\E$request->path\Q}", '', rawurldecode($v->GetContent()) ); caldav-REPORT-multiget.php://$where = " WHERE caldav_data.collection_id = " . $collection->resource_id(); caldav-REPORT-multiget.php: if ( $collection->Privileges() != privilege_to_bits('DAV::all') ) { caldav-REPORT-multiget.php: if ( isset($c->hide_TODO) && $c->hide_TODO && ! $collection->Privileges() == privilege_to_bits('all') ) { caldav-REPORT-multiget.php: $filtro = "uid=".$request->username; caldav-REPORT-multiget.php: if ( $qryp->Exec("REPORT-MULTIGET",__LINE__,__FILE__) && $qryp->rows() > 0 ) { caldav-REPORT-multiget.php: while( $part = $qryp->Fetch() ) { caldav-REPORT-multiget.php: $sql = "SELECT * FROM phpgw_cal WHERE cal_id = $part->cal_id AND cal_type = 'E'"; caldav-REPORT-multiget.php: if ( $qry->Exec("REPORT-MULTIGET",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-REPORT-multiget.php: while( $calendar_object = $qry->Fetch() ) { caldav-REPORT-multiget.php: if ( $bound_from != $collection->dav_name() ) { caldav-REPORT-multiget.php: $calendar_object->dav_name = str_replace( $bound_from, $collection->dav_name(), $calendar_object->dav_name); caldav-REPORT-multiget.php: $vResource = new vComponent($calendar_object->caldav_data); caldav-REPORT-multiget.php: $calendar_object->caldav_data = $expanded->Render(); caldav-REPORT-multiget.php: $sql = "SELECT * FROM phpgw_cal INNER JOIN phpgw_cal_repeats USING(cal_id) WHERE cal_id = $part->cal_id"; caldav-REPORT-multiget.php: if ( $qry->Exec("PROPFIND",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-REPORT-multiget.php: while( $calendar_object = $qry->Fetch() ) { caldav-REPORT-multiget.php: if ( $bound_from != $collection->dav_name() ) { caldav-REPORT-multiget.php: $calendar_object->dav_name = str_replace( $bound_from, $collection->dav_name(), $calendar_object->dav_name); caldav-REPORT-multiget.php: $vResource = new vComponent($calendar_object->caldav_data); caldav-REPORT-multiget.php: $calendar_object->caldav_data = $expanded->Render(); caldav-REPORT-multiget.php://if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $where .= " ORDER BY caldav_data.dav_id"; caldav-REPORT-multiget.php://if ( $qry->Exec('REPORT',__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-REPORT-multiget.php:// while( $dav_object = $qry->Fetch() ) { caldav-REPORT-multiget.php:// if ( $bound_from != $collection->dav_name() ) { caldav-REPORT-multiget.php:// $dav_object->dav_name = str_replace( $bound_from, $collection->dav_name(), $dav_object->dav_name); caldav-REPORT-multiget.php:// $vResource = new vComponent($dav_object->caldav_data); caldav-REPORT-multiget.php:// $dav_object->caldav_data = $expanded->Render(); caldav-REPORT-multiget.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); caldav-REPORT-multiget.php:$request->XMLResponse( 207, $multistatus ); caldav-REPORT.php:* CalDAV Server - handle REPORT method caldav-REPORT.php:require_once('RRule-v2.php'); caldav-REPORT.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['report']) && $c->dbg['report'])) ) { caldav-REPORT.php: fwrite($fh,$request->raw_post); caldav-REPORT.php:if ( !isset($request->xml_tags) ) { caldav-REPORT.php: $request->DoResponse( 406, translate("REPORT body contains no XML data!") ); caldav-REPORT.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); caldav-REPORT.php: $request->DoResponse( 406, translate("REPORT body is not valid XML data!") ); caldav-REPORT.php:$target = new DAVResource($request->path); caldav-REPORT.php:if ( $xmltree->GetTag() != 'DAV::principal-property-search' caldav-REPORT.php: && $xmltree->GetTag() != 'DAV::principal-property-search-set' ) { caldav-REPORT.php: //$target->NeedPrivilege( array('DAV::read', 'urn:ietf:params:xml:ns:caldav:read-free-busy'), true ); // They may have either caldav-REPORT.php:$reportnum = -1; caldav-REPORT.php:if ( $xmltree->GetTag() == 'urn:ietf:params:xml:ns:caldav:free-busy-query' ) { caldav-REPORT.php: include("caldav-REPORT-freebusy.php"); caldav-REPORT.php:switch( $xmltree->GetTag() ) { caldav-REPORT.php: case 'DAV::principal-property-search': caldav-REPORT.php: include("caldav-REPORT-principal.php"); caldav-REPORT.php: case 'DAV::principal-search-property-set': caldav-REPORT.php: include("caldav-REPORT-pps-set.php"); caldav-REPORT.php: case 'DAV::sync-collection': caldav-REPORT.php: include("caldav-REPORT-sync-collection.php"); caldav-REPORT.php: case 'DAV::expand-property': caldav-REPORT.php: include("caldav-REPORT-expand-property.php"); caldav-REPORT.php:// dbg_error_log("REPORT","Building XML Response for item '%s'", $item->dav_name ); caldav-REPORT.php:// $caldav_data = $item->caldav_data; caldav-REPORT.php:// $displayname = $item->summary; caldav-REPORT.php:// if ( isset($properties['calendar-data']) || isset($properties['displayname']) ) { caldav-REPORT.php:// if ( !$request->AllowedTo('all') && $session->user_no != $item->user_no ){ caldav-REPORT.php:// if ( $item->class == 'CONFIDENTIAL' || !$request->AllowedTo('read') ) { caldav-REPORT.php:// $resources = $ical->GetComponents('VTIMEZONE',false); caldav-REPORT.php:// $confidential->SetType($first->GetType()); caldav-REPORT.php:// $confidential->AddProperty( 'SUMMARY', translate('Busy') ); caldav-REPORT.php:// $confidential->AddProperty( 'CLASS', 'CONFIDENTIAL' ); caldav-REPORT.php:// $confidential->SetProperties( $first->GetProperties('DTSTART'), 'DTSTART' ); caldav-REPORT.php:// $confidential->SetProperties( $first->GetProperties('RRULE'), 'RRULE' ); caldav-REPORT.php:// $confidential->SetProperties( $first->GetProperties('DURATION'), 'DURATION' ); caldav-REPORT.php:// $confidential->SetProperties( $first->GetProperties('DTEND'), 'DTEND' ); caldav-REPORT.php:// $confidential->SetProperties( $first->GetProperties('UID'), 'UID' ); caldav-REPORT.php:// $ical->SetComponents(array($confidential),$confidential->GetType()); caldav-REPORT.php:// $caldav_data = $ical->Render(); caldav-REPORT.php:// $url = ConstructURL($item->dav_name); caldav-REPORT.php:// $prop->NewElement($k, $contentlength ); caldav-REPORT.php:// case 'calendar-data': caldav-REPORT.php:// $reply->CalDAVElement($prop, $k, $caldav_data ); caldav-REPORT.php:// $prop->NewElement($k, "text/calendar" ); caldav-REPORT.php:// case 'current-user-principal': caldav-REPORT.php:// $prop->NewElement("current-user-principal", $request->current_user_principal_xml); caldav-REPORT.php:// $prop->NewElement($k, $displayname ); caldav-REPORT.php:// $prop->NewElement($k); // Just an empty resourcetype for a non-collection. caldav-REPORT.php:// $prop->NewElement($k, '"'.$item->dav_etag.'"' ); caldav-REPORT.php:// case '"current-user-privilege-set"': caldav-REPORT.php:// $prop->NewElement($k, privileges($request->permissions) ); caldav-REPORT.php:// case 'SOME-DENIED-PROPERTY': /** indicating the style for future expansion */ caldav-REPORT.php:// $noprop->NewElement( strtolower($v) ); caldav-REPORT.php: $filtro = "uid=".$request->username; caldav-REPORT.php: $request->DoResponse( 501, 'Database error'); caldav-REPORT.php: dbg_error_log("REPORT","Building XML Response for item '%s' usuario '%s'", $item->cal_id,$nome ); caldav-REPORT.php: $alarme_id = $item->cal_id; caldav-REPORT.php: if ( $alarme->Exec("REPORT",__LINE__,__FILE__) && $alarme->rows() > 0 ){ caldav-REPORT.php: $nao_alarme = new AwlQuery( "SELECT * FROM phpgw_cal_extra WHERE cal_id = :alarme_id AND (cal_extra_name = 'X-MOZ-LASTACK' OR cal_extra_name = :X-MOZ-LASTACK-PART)",array( ':alarme_id' => '$alarme_id', ':X-MOZ-LASTACK-PART' => 'X-MOZ-LASTACK-PART-$nome')); caldav-REPORT.php: if ( $nao_alarme->Exec("REPORT",__LINE__,__FILE__) && $nao_alarme->rows() > 0 ){ caldav-REPORT.php: $alarmeqryno = $nao_alarme->Fetch(); caldav-REPORT.php: $moz = "\r\nX-MOZ-LASTACK:$alarmeqryno->cal_extra_value"; caldav-REPORT.php: $adiamento = new AwlQuery( "SELECT * FROM phpgw_cal_extra WHERE cal_id = :alarme_id AND cal_extra_name LIKE 'X-MOZ-SNOOZE%'", array( ':alarme_id' => '$alarme_id')); caldav-REPORT.php: if ( $adiamento->Exec("REPORT",__LINE__,__FILE__) && $adiamento->rows() > 0 ){ caldav-REPORT.php: $admno = $adiamento->Fetch(); caldav-REPORT.php: $moz .= "\r\n$admno->cal_extra_name:$admno->cal_extra_value"; caldav-REPORT.php: //$deleta->Exec("calquery",__LINE__,__FILE__); caldav-REPORT.php: $alarmeqry = $alarme->Fetch(); caldav-REPORT.php: $tempo = split(";", $alarmeqry->data, 4); caldav-REPORT.php: $tempoalarme = $alarmeqry->next;// + $mais; caldav-REPORT.php: $agora = $agoranow->format("U"); caldav-REPORT.php: if ( $tempoalarme >= $agora | $item->cal_type == 'M'){ caldav-REPORT.php: $VALARME = "\r\nBEGIN:VALARM\r\nTRIGGER;VALUE=DURATION:-PT${minutos}M\r\nDESCRIPTION:Mozilla Alarm: alarme\r\nACTION:DISPLAY\r\nEND:VALARM"; caldav-REPORT.php: $VALARME = "\r\nBEGIN:VALARM\r\nTRIGGER;VALUE=DURATION:-PT${hora}H\r\nDESCRIPTION:Mozilla Alarm: alarme\r\nACTION:DISPLAY\r\nEND:VALARM"; caldav-REPORT.php: $VALARME = "\r\nBEGIN:VALARM\r\nTRIGGER;VALUE=DURATION:-P1W\r\nDESCRIPTION:Mozilla Alarm: alarme\r\nACTION:DISPLAY\r\nEND:VALARM"; caldav-REPORT.php: $VALARME = "\r\nBEGIN:VALARM\r\nTRIGGER;VALUE=DURATION:-P${dia}D\r\nDESCRIPTION:Mozilla Alarm: alarme\r\nACTION:DISPLAY\r\nEND:VALARM"; caldav-REPORT.php: ///$create_data = dataSegundosParaT($item->datetime); caldav-REPORT.php: //if (strlen($item->category)>2){ caldav-REPORT.php: if ($item->category != "" ){ caldav-REPORT.php: $phpgw_query = new AwlQuery ($x, array(':category' => '$item->category')); caldav-REPORT.php: if ( $phpgw_query->Exec() && $phpgw_query->rows() > 0 ) { caldav-REPORT.php: while( $id_cale = $phpgw_query->Fetch() ) { caldav-REPORT.php: $categories = utf8_encode($id_cale->cat_name); caldav-REPORT.php: //$categories = $id_cale->cat_name; caldav-REPORT.php: $displayname = $item->title; caldav-REPORT.php: $querypart = new AwlQuery( $part2 , array(':cal_id' => '$item->cal_id')); caldav-REPORT.php: if ( $querypart->Exec("REPORT",__LINE__,__FILE__) && $querypart->rows() > 0 ) { caldav-REPORT.php: while( $id_cale = $querypart->Fetch() ) { caldav-REPORT.php: if ($item->owner != $id_cale->cal_login){ caldav-REPORT.php: $filtro = "uidNumber=$id_cale->cal_login" ; caldav-REPORT.php: switch ($id_cale->cal_status){ caldav-REPORT.php: $estado[$i] = "NEEDS-ACTION"; caldav-REPORT.php: if ( isset($item->ex_participants)) caldav-REPORT.php: $mails = split("[?,]",$item->ex_participants); caldav-REPORT.php: $members = $members."\nATTENDEE;RSVP=TRUE;CN=$cn[$i];PARTSTAT=$estado[$i];ROLE=REQ-PARTICIPANT:MAILTO:$mail[$i]\r"; caldav-REPORT.php: $members = $members."\nATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:MAILTO:$mails[$i]\r"; caldav-REPORT.php: $mdate = $item->mdatetime; caldav-REPORT.php: $calid = $item->cal_id; caldav-REPORT.php: $date = $item->datetime; caldav-REPORT.php: $edate = $item->edatetime; caldav-REPORT.php: $titulo = utf8_encode($item->title); caldav-REPORT.php: $local = utf8_encode($item->location); caldav-REPORT.php: $descricao = utf8_encode($item->description); caldav-REPORT.php: $convite = new AwlQuery( "SELECT cal_extra_value FROM phpgw_cal_extra WHERE cal_id = :cal_id", array(':cal_id' => '$item->cal_id')); caldav-REPORT.php: if ( $convite->Exec("REPORT",__LINE__,__FILE__) && $convite->rows() > 0 ) { caldav-REPORT.php: $xmozconvite = $convite->Fetch(); caldav-REPORT.php: if ($xmozconvite->cal_extra_value == "TRUE"){ caldav-REPORT.php: $envia_convite = "X-MOZ-SEND-INVITATIONS:TRUE"; caldav-REPORT.php: $convite = new AwlQuery( "DELETE FROM phpgw_cal_extra WHERE cal_id = :cal_id", array(':cal_id' => '$item->cal_id')); caldav-REPORT.php: $convite->Exec("REPORT",__LINE__,__FILE__); caldav-REPORT.php: $envia_convite = "X-MOZ-SEND-INVITATIONS:FALSE"; caldav-REPORT.php: if ( $item->is_public == 0 ){ caldav-REPORT.php: if ( $item->cal_type == 'M' ){ caldav-REPORT.php: if ( $item->recur_exception != ''){ caldav-REPORT.php: $listadeexcecao = explode("," , $item->recur_exception); caldav-REPORT.php: $phpgw_query = new AwlQuery ($x, array(':cal_id' => '$item->cal_id')); caldav-REPORT.php: if ( $phpgw_query->Exec() && $phpgw_query->rows() > 0 ) { caldav-REPORT.php: while( $id_cale = $phpgw_query->Fetch() ) { caldav-REPORT.php: $data_antiga = date("Ymd\THis",$item->datetime); caldav-REPORT.php: $data_nova = date("Ymd\THis",$id_cale->datetime); caldav-REPORT.php: if ( $data_n->getOffset() > $data_a->getOffset() ) caldav-REPORT.php: $dias = $data_n->format('z') - $data_a->format('z'); caldav-REPORT.php: $dias = $item->datetime + ($dias*86400) - 3600; caldav-REPORT.php: elseif ( $data_n->getOffset() < $data_a->getOffset() ) caldav-REPORT.php: $dias = $data_n->format('z') - $data_a->format('z'); caldav-REPORT.php: $dias = $item->datetime + ($dias*86400) + 3600; caldav-REPORT.php: $dias = $data_n->format('z') - $data_a->format('z'); caldav-REPORT.php: $dias = $item->datetime + ($dias*86400); caldav-REPORT.php: if ( $item->recur_enddate != 0){ caldav-REPORT.php: $until = dataSegundosParaT($item->recur_enddate,1); caldav-REPORT.php: $until = dataSegundosParaT($item->recur_enddate + 86400,1); caldav-REPORT.php: $intervalo = $item->recur_interval; caldav-REPORT.php: switch($item->recur_type){ caldav-REPORT.php: $dia_sem = converte_semana($item->recur_data); caldav-REPORT.php: if($item->recur_data != ""){ caldav-REPORT.php: $response = "BEGIN:VCALENDAR\r\nPRODID:-//davical.org//NONSGML AWL Calendar//EN\r\nVERSION:2.9.9"; caldav-REPORT.php: $response .= "\r\nBEGIN:VEVENT\r\nCREATED:$create_data\r\nLAST-MODIFIED:$modify_data\r\nDTSTAMP:$create_data\r\nUID:$item->cal_id@$item->owner\r\n${members}\r\nSUMMARY:$titulo\r\n$recurrence_id\r\nDTSTART;TZID=America/Sao_Paulo:$start_data\r\nDTEND;TZID=America/Sao_Paulo:$end_data\r\nLOCATION:$local\r\nCATEGORIES:$categories\r\nDESCRIPTION:".preg_replace('/\r\n/', '\\n', $descricao)."\r\nPRIORITY:$item->priority\r\nRRULE:$Rrule${exe}${moz}\r\nCLASS:$classe$VALARME\r\nTRANSP:TRANSPARENT\r\n$envia_convite\r\nEND:VEVENT\r\n"; caldav-REPORT.php: $dav_nam = "{$item->cal_id}@{$item->owner}"; caldav-REPORT.php: $dav_etag_nam="{md5($item->cal_id.$item->owner.$item->lastmodified)}"; caldav-REPORT.php: $dav_name = "/{$session->username}/{$item->cal_id}@{$item->owner}.ics"; caldav-REPORT.php: $prop->NewElement($k, $contentlength ); caldav-REPORT.php: case 'calendar-data': caldav-REPORT.php: $reply->CalDAVElement($prop, $k, $caldav_data ); caldav-REPORT.php: $prop->NewElement($k, "text/calendar" ); caldav-REPORT.php: case 'current-user-principal': caldav-REPORT.php: $prop->NewElement("current-user-principal", $request->current_user_principal_xml); caldav-REPORT.php: $prop->NewElement($k, $displayname ); caldav-REPORT.php: $prop->NewElement($k); // Just an empty resourcetype for a non-collection. caldav-REPORT.php: $prop->NewElement($k, "$dav_nam" ); caldav-REPORT.php: case '"current-user-privilege-set"': caldav-REPORT.php: $prop->NewElement($k, privileges($request->permissions) ); caldav-REPORT.php: case 'SOME-DENIED-PROPERTY': /** indicating the style for future expansion */ caldav-REPORT.php: $noprop->NewElement( strtolower($v) ); caldav-REPORT.php: dbg_error_log("REPORT","Building XML Response for item '%s'", $item->dav_name ); caldav-REPORT.php: $caldav_data = $item->caldav_data; caldav-REPORT.php: $displayname = preg_replace( '{^.*/}', '', $item->dav_name ); caldav-REPORT.php: switch( $item->caldav_type ) { caldav-REPORT.php: $displayname = $item->summary; caldav-REPORT.php: $displayname = $item->fn; caldav-REPORT.php: $contenttype = 'text/x-vcard'; caldav-REPORT.php: if ( isset($properties['calendar-data']) || isset($properties['displayname']) ) { caldav-REPORT.php: if ( !$request->AllowedTo('all') && $session->user_no != $item->user_no ){ caldav-REPORT.php: if ( $type == 'calendar' && $item->class == 'CONFIDENTIAL' || !$request->AllowedTo('read') ) { caldav-REPORT.php: $resources = $ical->GetComponents('VTIMEZONE',false); caldav-REPORT.php: $confidential->SetType($first->GetType()); caldav-REPORT.php: $confidential->AddProperty( 'SUMMARY', translate('Busy') ); caldav-REPORT.php: $confidential->AddProperty( 'CLASS', 'CONFIDENTIAL' ); caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DTSTART'), 'DTSTART' ); caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('RRULE'), 'RRULE' ); caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DURATION'), 'DURATION' ); caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DTEND'), 'DTEND' ); caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('UID'), 'UID' ); caldav-REPORT.php: $ical->SetComponents(array($confidential),$confidential->GetType()); caldav-REPORT.php: $caldav_data = $ical->Render(); caldav-REPORT.php: $url = ConstructURL($item->dav_name); caldav-REPORT.php: $prop->NewElement($k, $contentlength ); caldav-REPORT.php: case 'calendar-data': caldav-REPORT.php: if ( $type == 'calendar' ) $reply->CalDAVElement($prop, $k, $caldav_data ); caldav-REPORT.php: case 'address-data': caldav-REPORT.php: if ( $type == 'vcard' ) $reply->CardDAVElement($prop, $k, $caldav_data ); caldav-REPORT.php: $prop->NewElement($k, $contenttype ); caldav-REPORT.php: case 'current-user-principal': caldav-REPORT.php: $prop->NewElement("current-user-principal", $request->current_user_principal_xml); caldav-REPORT.php: $prop->NewElement($k, $displayname ); caldav-REPORT.php: $prop->NewElement($k); // Just an empty resourcetype for a non-collection. caldav-REPORT.php: $prop->NewElement($k, '"'.$item->dav_etag.'"' ); caldav-REPORT.php: case '"current-user-privilege-set"': caldav-REPORT.php: $prop->NewElement($k, privileges($request->permissions) ); caldav-REPORT.php: case 'SOME-DENIED-PROPERTY': /** indicating the style for future expansion */ caldav-REPORT.php: $noprop->NewElement( strtolower($v) ); caldav-REPORT.php: $noprop->NewElement( strtolower($v) ); caldav-REPORT.php:if ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:caldav:calendar-query" ) { caldav-REPORT.php: $calquery = $xmltree->GetPath("/urn:ietf:params:xml:ns:caldav:calendar-query/*"); caldav-REPORT.php: include("caldav-REPORT-calquery.php"); caldav-REPORT.php:elseif ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:caldav:calendar-multiget" ) { caldav-REPORT.php: $qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-multiget'); caldav-REPORT.php: include("caldav-REPORT-multiget.php"); caldav-REPORT.php:elseif ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:carddav:addressbook-multiget" ) { caldav-REPORT.php: $qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:carddav:addressbook-multiget'); caldav-REPORT.php: include("caldav-REPORT-multiget.php"); caldav-REPORT.php:elseif ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:carddav:addressbook-query" ) { caldav-REPORT.php: $cardquery = $xmltree->GetPath("/urn:ietf:params:xml:ns:carddav:addressbook-query/*"); caldav-REPORT.php: include("caldav-REPORT-cardquery.php"); caldav-REPORT.php: $request->PreconditionFailed( 403, 'DAV::supported-report', sprintf( '"%s" is not a supported report type') ); caldav-REPORT.php: $nova = substr($retorna, 0, -1); caldav-REPORT.php: substr("$datatz", 0,4)) + $HorarioTimeZone->getoffset($HorarioTime);//ano caldav-REPORT.php: //$teste = getdate($dataseg - $HorarioTimeZone->getoffset($HorarioTime)); caldav-REPORT.php: $teste = getdate($dataseg - $HorarioTimeZone->getoffset($HorarioTime)); caldav-REPORT-pps-set.php:* DAViCal CalDAV Server - handle principal-search-property-set report (RFC3744) caldav-REPORT-pps-set.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-REPORT-pps-set.php: $xmldoc->NSElement($prop, $property ); caldav-REPORT-pps-set.php: return new XMLElement( 'principal-search-property', $prop ); caldav-REPORT-pps-set.php: 'urn:ietf:params:xml:ns:caldav:calendar-home-set', caldav-REPORT-pps-set.php: 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set' caldav-REPORT-pps-set.php:$report = new XMLElement( 'principal-search-property-set', $responses, $reply->GetXmlNsArray() ); caldav-REPORT-pps-set.php:$request->XMLResponse( 207, $report ); caldav-REPORT-principal.php:$searches = $xmltree->GetPath('/DAV::principal-property-search/DAV::property-search'); caldav-REPORT-principal.php:$CS_search_test = $xmltree->GetAttribute('test'); caldav-REPORT-principal.php: $qry_props = $search->GetPath('/DAV::property-search/DAV::prop/*'); // There may be many caldav-REPORT-principal.php: $match = $search->GetPath('/DAV::property-search/DAV::match'); // There may only be one caldav-REPORT-principal.php: $match = $match[0]->GetContent(); caldav-REPORT-principal.php: switch( $v1->GetTag() ) { caldav-REPORT-principal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set': caldav-REPORT-principal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-home-set': caldav-REPORT-principal.php: * @todo We should handle a lot more properties here. principal-URL seems a likely one to be used. caldav-REPORT-principal.php: dbg_error_log("principal", "Unhandled tag '%s' to match '%s'\n", $v1->GetTag(), $match ); caldav-REPORT-principal.php:$get_props = $xmltree->GetPath('/DAV::principal-property-search/DAV::prop/*'); caldav-REPORT-principal.php: $properties[] = $v1->GetTag(); caldav-REPORT-principal.php:if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows() > 0 ) { caldav-REPORT-principal.php: while( $row = $qry->Fetch() ) { caldav-REPORT-principal.php: $responses[] = $principal->RenderAsXML( $properties, $reply ); caldav-REPORT-principal.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); caldav-REPORT-principal.php:$request->XMLResponse( 207, $multistatus ); caldav-REPORT-sync-collection.php:* CalDAV Server - handle sync-collection report (draft-daboo-webdav-sync-01) caldav-REPORT-sync-collection.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ caldav-REPORT-sync-collection.php:$sync_tokens = $xmltree->GetPath('/DAV::sync-collection/DAV::sync-token'); caldav-REPORT-sync-collection.php:$sync_token = $sync_tokens[0]->GetContent(); caldav-REPORT-sync-collection.php:dbg_error_log( 'sync', " sync-token: %s", $sync_token ); caldav-REPORT-sync-collection.php:$props = $xmltree->GetElements('DAV::prop'); caldav-REPORT-sync-collection.php:$props = $v->GetContent(); caldav-REPORT-sync-collection.php: $proplist[] = $v->GetTag(); caldav-REPORT-sync-collection.php:$collection = new DAVResource( $request->path ); caldav-REPORT-sync-collection.php:$params = array( ':collection_id' => $collection->GetProperty('collection_id'), ':sync_token' => $sync_token ); caldav-REPORT-sync-collection.php:if ( !$qry->Exec("REPORT",__LINE__,__FILE__) || $qry->rows() <= 0 ) { caldav-REPORT-sync-collection.php: $request->DoResponse( 500, translate("Database error") ); caldav-REPORT-sync-collection.php:$row = $qry->Fetch(); caldav-REPORT-sync-collection.php:if ( !isset($row->new_sync_token) ) { caldav-REPORT-sync-collection.php: if ( !$qry->QDo($sql, $params) || $qry->rows() <= 0 ) { caldav-REPORT-sync-collection.php: $request->DoResponse( 500, translate("Database error") ); caldav-REPORT-sync-collection.php: $row = $qry->Fetch(); caldav-REPORT-sync-collection.php:$new_token = $row->new_sync_token; caldav-REPORT-sync-collection.php:if ( $qry->Exec("REPORT",__LINE__,__FILE__) ) { caldav-REPORT-sync-collection.php: while( $object = $qry->Fetch() ) { caldav-REPORT-sync-collection.php: if ( $object->dav_name == $last_dav_name ) { caldav-REPORT-sync-collection.php: if ( $object->sync_status == 404 ) { caldav-REPORT-sync-collection.php: new XMLElement( 'href', ConstructURL($object->dav_name) ), caldav-REPORT-sync-collection.php: new XMLElement( 'status', display_status($object->sync_status) ) caldav-REPORT-sync-collection.php: $responses[] = new XMLElement( 'sync-response', $resultset ); caldav-REPORT-sync-collection.php: else if ( $object->sync_status == 201 && $first_status == 404 ) { caldav-REPORT-sync-collection.php: new XMLElement( 'href', ConstructURL($object->dav_name) ), caldav-REPORT-sync-collection.php: new XMLElement( 'status', display_status($object->sync_status) ) caldav-REPORT-sync-collection.php: $responses[] = new XMLElement( 'sync-response', $resultset ); caldav-REPORT-sync-collection.php: new XMLElement( 'href', ConstructURL($object->dav_name) ), caldav-REPORT-sync-collection.php: new XMLElement( 'status', display_status($object->sync_status) ) caldav-REPORT-sync-collection.php: if ( $object->sync_status != 404 ) { caldav-REPORT-sync-collection.php: $resultset = array_merge( $resultset, $dav_resource->GetPropStat($proplist,$reply) ); caldav-REPORT-sync-collection.php: if ( isset($c->use_old_sync_response_tag) && $c->use_old_sync_response_tag ) $response_tag = 'sync-response'; caldav-REPORT-sync-collection.php: $first_status = $object->sync_status; caldav-REPORT-sync-collection.php: $last_dav_name = $object->dav_name; caldav-REPORT-sync-collection.php: $responses[] = new XMLElement( 'sync-token', $new_token ); caldav-REPORT-sync-collection.php: $request->DoResponse( 500, translate("Database error") ); caldav-REPORT-sync-collection.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); caldav-REPORT-sync-collection.php:$request->XMLResponse( 207, $multistatus ); CalDAVRequest.php:* - Ascertaining the paths CalDAVRequest.php:* - Ascertaining the current user's permission to those paths. CalDAVRequest.php:* - Utility functions which we can use to decide whether this CalDAVRequest.php: * The 'current_user_principal_xml' the DAV:current-user-principal answer. An CalDAVRequest.php: * calendar, schedule-inbox, schedule-outbox CalDAVRequest.php: * calendar, schedule-inbox, schedule-outbox CalDAVRequest.php: $this->supported_privileges = array( CalDAVRequest.php: 'write-content' => translate('Write content'), CalDAVRequest.php: 'write-properties' => translate('Write properties') CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:read-free-busy' => translate('Read the free/busy information for a calendar collection'), CalDAVRequest.php: 'read-acl' => translate('Read ACLs for a resource or collection'), CalDAVRequest.php: 'read-current-user-privilege-set' => translate('Read the details of the current user\'s access control to this resource.'), CalDAVRequest.php: 'write-acl' => translate('Write ACLs for a resource or collection'), CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-deliver' => array( CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-deliver-invite'=> translate('Deliver scheduling invitations from an organiser to this scheduling inbox'), CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-deliver-reply' => translate('Deliver scheduling replies from an attendee to this scheduling inbox'), CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-query-freebusy' => translate('Allow free/busy enquiries targeted at the owner of this scheduling inbox') CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send' => array( CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send-invite' => translate('Send scheduling invitations as an organiser from the owner of this scheduling outbox.'), CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send-reply' => translate('Send scheduling replies as an attendee from the owner of this scheduling outbox.'), CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send-freebusy' => translate('Send free/busy enquiries') CalDAVRequest.php: $this->options = $options; CalDAVRequest.php: if ( !isset($this->options['allow_by_email']) ) $this->options['allow_by_email'] = false; CalDAVRequest.php: $this->principal = (object) array( 'username' => $session->username, 'user_no' => $session->user_no ); CalDAVRequest.php: $this->raw_post = file_get_contents ( 'php://input'); CalDAVRequest.php: if ( (isset($c->dbg['ALL']) && $c->dbg['ALL']) || (isset($c->dbg['request']) && $c->dbg['request']) ) { CalDAVRequest.php: dbg_error_log( "LOG headers", "-->%s: %s", $k, $v ); CalDAVRequest.php: $lines = preg_split( '#[\r\n]+#', $this->raw_post); CalDAVRequest.php: dbg_error_log( "LOG request", "-->%s", $v ); CalDAVRequest.php: $this->method = $_SERVER['REQUEST_METHOD']; CalDAVRequest.php: $this->content_type = (isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : null); CalDAVRequest.php: if ( preg_match( '{^(\S+/\S+)\s*(;.*)?$}', $this->content_type, $matches ) ) { CalDAVRequest.php: $this->content_type = $matches[1]; CalDAVRequest.php: if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' ) { CalDAVRequest.php: if ( !preg_match( '{^(text|application)/xml$}', $this->content_type ) ) { CalDAVRequest.php: dbg_error_log( "LOG request", 'Request is "%s" but client set content-type to "%s". Assuming they meant XML!', CalDAVRequest.php: $request->method, $this->content_type ); CalDAVRequest.php: $this->content_type = 'text/xml'; CalDAVRequest.php: $this->user_agent = ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Probably Mulberry")); CalDAVRequest.php: $this->depth = $_SERVER['HTTP_DEPTH']; CalDAVRequest.php: * is not present then a reasonable request-type-dependent default should be CalDAVRequest.php: switch( $this->method ) { CalDAVRequest.php: $this->depth = 'infinity'; CalDAVRequest.php: $this->depth = 0; CalDAVRequest.php: if ( $this->depth == 'infinity' ) $this->depth = DEPTH_INFINITY; CalDAVRequest.php: $this->depth = intval($this->depth); CalDAVRequest.php: if ( isset($_SERVER['HTTP_DESTINATION']) ) $this->destination = $_SERVER['HTTP_DESTINATION']; CalDAVRequest.php: $this->overwrite = ( isset($_SERVER['HTTP_OVERWRITE']) && ($_SERVER['HTTP_OVERWRITE'] == 'F') ? false : true ); // RFC4918, 9.8.4 says default True. CalDAVRequest.php: * LOCK things use an "If" header to hold the lock in some cases, and "Lock-token" in others CalDAVRequest.php: if ( isset($_SERVER['HTTP_IF']) ) $this->if_clause = $_SERVER['HTTP_IF']; CalDAVRequest.php: $this->lock_token = $matches[1]; CalDAVRequest.php: $this->ticket = new DAVTicket($_GET['ticket']); CalDAVRequest.php: $this->ticket = new DAVTicket($_SERVER['HTTP_TICKET']); CalDAVRequest.php: $this->timeout = (isset($c->maximum_lock_timeout) ? $c->maximum_lock_timeout : 86400 * 100); CalDAVRequest.php: elseif ( strtolower(substr($v,0,7)) == 'second-' ) { CalDAVRequest.php: $this->timeout = min( intval(substr($v,7)), (isset($c->maximum_lock_timeout) ? $c->maximum_lock_timeout : 86400 * 100) ); CalDAVRequest.php: if ( ! isset($this->timeout) || $this->timeout == 0 ) $this->timeout = (isset($c->default_lock_timeout) ? $c->default_lock_timeout : 900); CalDAVRequest.php: $this->path = (isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "/"); CalDAVRequest.php: $this->path = rawurldecode($this->path); CalDAVRequest.php: if ( preg_match( '#^(/[^/]+/[^/]+).ics$#', $this->path, $matches ) ) { CalDAVRequest.php: $this->path = $matches[1]. '/'; CalDAVRequest.php: // dbg_error_log( "caldav", "Sanitising path '%s'", $this->path ); CalDAVRequest.php: if ( preg_match( $bad_chars_regex, $this->path ) ) { CalDAVRequest.php: $this->DoResponse( 400, translate("The calendar path contains illegal characters.") ); CalDAVRequest.php: if ( strstr($this->path,'//') ) $this->path = preg_replace( '#//+#', '/', $this->path); CalDAVRequest.php: $this->user_no = $session->user_no; CalDAVRequest.php: $this->username = $session->username; CalDAVRequest.php: if ( $session->user_no > 0 ) { CalDAVRequest.php: $this->current_user_principal_url = new XMLElement('href', ConstructURL('/'.$session->username.'/') ); CalDAVRequest.php: $this->current_user_principal_url = new XMLElement('unauthenticated' ); CalDAVRequest.php: * we SHOULD return a Content-location header with the correction... CalDAVRequest.php: * - The exact request. CalDAVRequest.php: * - If the exact request, doesn't end in '/', then the request URL with a '/' appended CalDAVRequest.php: * - The request URL truncated to the last '/' CalDAVRequest.php: $params = array( ':exact_name' => $this->path ); CalDAVRequest.php: if ( !preg_match( '#/$#', $this->path ) ) { CalDAVRequest.php: $params[':truncated_name'] = preg_replace( '#[^/]*$#', '', $this->path); CalDAVRequest.php: $params[':trailing_slash_name'] = $this->path."/"; CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { CalDAVRequest.php: if ( $row->dav_name == $this->path."/" ) { CalDAVRequest.php: $this->path = $row->dav_name; CalDAVRequest.php: dbg_error_log( "caldav", "Path is actually a collection - sending Content-Location header." ); CalDAVRequest.php: header( "Content-Location: ".ConstructURL($this->path) ); CalDAVRequest.php: $this->collection_id = $row->collection_id; CalDAVRequest.php: $this->collection_path = $row->dav_name; CalDAVRequest.php: $this->collection_type = ($row->is_calendar == 't' ? 'calendar' : 'collection'); CalDAVRequest.php: $this->collection = $row; CalDAVRequest.php: if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->path, $matches ) ) { CalDAVRequest.php: $this->collection_type = 'schedule-'. $matches[3]. 'box'; CalDAVRequest.php: $this->collection->type = $this->collection_type; CalDAVRequest.php: else if ( preg_match( '{^( ( / ([^/]+) / ) \.(in|out)/ ) [^/]*$}x', $this->path, $matches ) ) { CalDAVRequest.php: // The request is for a scheduling inbox or outbox (or something inside one) and we should auto-create it CalDAVRequest.php: $this->collection_type = 'schedule-'. $matches[4]. 'box'; CalDAVRequest.php: $params[':resourcetypes'] = sprintf('', $this->collection_type ); CalDAVRequest.php: $qry->Exec('caldav',__LINE__,__FILE__); CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { CalDAVRequest.php: $this->collection_id = $row->collection_id; CalDAVRequest.php: $this->collection_path = $matches[1]; CalDAVRequest.php: $this->collection = $row; CalDAVRequest.php: $this->collection->type = $this->collection_type; CalDAVRequest.php: else if ( preg_match( '#^((/[^/]+/)calendar-proxy-(read|write))/?[^/]*$#', $this->path, $matches ) ) { CalDAVRequest.php: $this->collection_type = 'proxy'; CalDAVRequest.php: $this->_is_proxy_request = true; CalDAVRequest.php: $this->proxy_type = $matches[3]; CalDAVRequest.php: $this->collection_path = $matches[1].'/'; // Enforce trailling '/' CalDAVRequest.php: if ( $this->collection_path == $this->path."/" ) { CalDAVRequest.php: $this->path .= '/'; CalDAVRequest.php: dbg_error_log( "caldav", "Path is actually a (proxy) collection - sending Content-Location header." ); CalDAVRequest.php: header( "Content-Location: ".ConstructURL($this->path) ); CalDAVRequest.php: else if ( $this->options['allow_by_email'] && preg_match( '#^/(\S+@\S+[.]\S+)/?$#', $this->path) ) { CalDAVRequest.php: $this->collection_id = -1; CalDAVRequest.php: $this->collection_type = 'email'; CalDAVRequest.php: $this->collection_path = $this->path; CalDAVRequest.php: $this->_is_principal = true; CalDAVRequest.php: else if ( preg_match( '#^(/[^/]+)/?$#', $this->path, $matches) || preg_match( '#^(/principals/[^/]+/[^/]+)/?$#', $this->path, $matches) ) { CalDAVRequest.php: $this->collection_id = -1; CalDAVRequest.php: $this->collection_path = $matches[1].'/'; // Enforce trailling '/' CalDAVRequest.php: $this->collection_type = 'principal'; CalDAVRequest.php: $this->_is_principal = true; CalDAVRequest.php: if ( $this->collection_path == $this->path."/" ) { CalDAVRequest.php: $this->path .= '/'; CalDAVRequest.php: dbg_error_log( "caldav", "Path is actually a collection - sending Content-Location header." ); CalDAVRequest.php: header( "Content-Location: ".ConstructURL($this->path) ); CalDAVRequest.php: if ( preg_match( '#^(/principals/[^/]+/[^/]+)/?$#', $this->path, $matches) ) { CalDAVRequest.php: $this->depth = 0; CalDAVRequest.php: else if ( $this->path == '/' ) { CalDAVRequest.php: $this->collection_id = -1; CalDAVRequest.php: $this->collection_path = '/'; CalDAVRequest.php: $this->collection_type = 'root'; CalDAVRequest.php: if ( $this->collection_path == $this->path ) $this->_is_collection = true; CalDAVRequest.php: dbg_error_log( "caldav", " Collection '%s' is %d, type %s", $this->collection_path, $this->collection_id, $this->collection_type ); CalDAVRequest.php: $this->principal = new CalDAVPrincipal( array( "path" => $this->path, "options" => $this->options ) ); CalDAVRequest.php: if ( isset($this->principal->user_no) ) $this->user_no = $this->principal->user_no; CalDAVRequest.php: if ( isset($this->principal->username)) $this->username = $this->principal->username; CalDAVRequest.php: if ( isset($this->principal->by_email) && $this->principal->by_email) $this->by_email = true; CalDAVRequest.php: if ( isset($this->principal->principal_id)) $this->principal_id = $this->principal->principal_id; CalDAVRequest.php: if ( $this->collection_type == 'principal' || $this->collection_type == 'email' || $this->collection_type == 'proxy' ) { CalDAVRequest.php: $this->collection = $this->principal->AsCollection(); CalDAVRequest.php: if( $this->collection_type == 'proxy' ) { CalDAVRequest.php: $this->collection = $this->principal->AsCollection(); CalDAVRequest.php: $this->collection->is_proxy = 't'; CalDAVRequest.php: $this->collection->type = 'proxy'; CalDAVRequest.php: $this->collection->proxy_type = $this->proxy_type; CalDAVRequest.php: $this->collection->dav_displayname = sprintf('Proxy %s for %s', $this->proxy_type, $this->principal->username() ); CalDAVRequest.php: elseif( $this->collection_type == 'root' ) { CalDAVRequest.php: $this->collection = (object) array( CalDAVRequest.php: 'dav_etag' => md5($c->system_name), CalDAVRequest.php: 'dav_displayname' => $c->system_name, CalDAVRequest.php: $this->setPermissions(); CalDAVRequest.php: $this->supported_methods = array( CalDAVRequest.php: if ( $this->IsCollection() ) { CalDAVRequest.php: switch ( $this->collection_type ) { CalDAVRequest.php: $this->supported_methods = array( CalDAVRequest.php: case 'schedule-inbox': CalDAVRequest.php: case 'schedule-outbox': CalDAVRequest.php: $this->supported_methods = array_merge( CalDAVRequest.php: $this->supported_methods, CalDAVRequest.php: $this->supported_methods['GET'] = ''; CalDAVRequest.php: $this->supported_methods['PUT'] = ''; CalDAVRequest.php: $this->supported_methods['HEAD'] = ''; CalDAVRequest.php: $this->supported_methods['GET'] = ''; CalDAVRequest.php: $this->supported_methods['PUT'] = ''; CalDAVRequest.php: $this->supported_methods['HEAD'] = ''; CalDAVRequest.php: $this->supported_methods['MKCOL'] = ''; CalDAVRequest.php: $this->supported_methods['MKCALENDAR'] = ''; CalDAVRequest.php: $this->supported_methods['PROPPATCH'] = ''; CalDAVRequest.php: $this->supported_methods['BIND'] = ''; CalDAVRequest.php: $this->supported_methods = array_merge( CalDAVRequest.php: $this->supported_methods, CalDAVRequest.php: /**** comentado por motivos de incmpatibilidade do sync-collection CalDAVRequest.php: $this->supported_reports = array( CalDAVRequest.php: 'DAV::principal-property-search' => '', CalDAVRequest.php: 'DAV::expand-property' => '', CalDAVRequest.php: 'DAV::sync-collection' => '' CalDAVRequest.php: $this->supported_reports = array( CalDAVRequest.php: 'DAV::principal-property-search' => '', CalDAVRequest.php: 'DAV::expand-property' => '' CalDAVRequest.php: if ( isset($this->collection) && $this->collection->is_calendar ) { CalDAVRequest.php: $this->supported_reports = array_merge( CalDAVRequest.php: $this->supported_reports, CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:calendar-query' => '', CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:calendar-multiget' => '', CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:free-busy-query' => '' CalDAVRequest.php: if ( isset($this->collection) && $this->collection->is_addressbook ) { CalDAVRequest.php: $this->supported_reports = array_merge( CalDAVRequest.php: $this->supported_reports, CalDAVRequest.php: 'urn:ietf:params:xml:ns:carddav:addressbook-query' => '', CalDAVRequest.php: 'urn:ietf:params:xml:ns:carddav:addressbook-multiget' => '' CalDAVRequest.php: if ( isset($this->content_type) && preg_match( '#(application|text)/xml#', $this->content_type ) ) { CalDAVRequest.php: $xml_parser = xml_parser_create_ns('UTF-8'); CalDAVRequest.php: $this->xml_tags = array(); CalDAVRequest.php: $rc = xml_parse_into_struct( $xml_parser, $this->raw_post, $this->xml_tags ); CalDAVRequest.php: $this->XMLResponse( 400, new XMLElement( 'error', new XMLElement('invalid-xml'), array( 'xmlns' => 'DAV:') ) ); CalDAVRequest.php: if ( count($this->xml_tags) ) { CalDAVRequest.php: $this->xml_tags = null; CalDAVRequest.php: dbg_error_log( "ERROR", "Incoming request sent content-type XML with no XML request body." ); CalDAVRequest.php: * Look out for If-None-Match or If-Match headers CalDAVRequest.php: $this->etag_none_match = str_replace('"','',$_SERVER["HTTP_IF_NONE_MATCH"]); CalDAVRequest.php: if ( $this->etag_none_match == '' ) unset($this->etag_none_match); CalDAVRequest.php: $this->etag_if_match = str_replace('"','',$_SERVER["HTTP_IF_MATCH"]); CalDAVRequest.php: if ( $this->etag_if_match == '' ) unset($this->etag_if_match); CalDAVRequest.php: $this->user_no = $session->user_no; CalDAVRequest.php: $this->username = $session->username; CalDAVRequest.php: $this->principal_id = $session->principal_id; CalDAVRequest.php: if ( $this->path == '/' || $this->path == '' ) { CalDAVRequest.php: $path_split = explode('/', $this->path ); CalDAVRequest.php: $this->username = $path_split[1]; CalDAVRequest.php: if ( $this->username == 'principals' ) $this->username = $path_split[3]; CalDAVRequest.php: if ( isset($this->options['allow_by_email']) && preg_match( '#/(\S+@\S+[.]\S+)/?$#', $this->path, $matches) ) { CalDAVRequest.php: $this->by_email = $matches[1]; CalDAVRequest.php: array(':email' => $this->by_email ) ); CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $user = $qry->Fetch() ) { CalDAVRequest.php: $this->user_no = $user->user_no; CalDAVRequest.php: $this->username = $user->username; CalDAVRequest.php: $this->principal_id = $user->principal_id; CalDAVRequest.php: elseif( $user = getUserByName($this->username,'caldav',__LINE__,__FILE__)) { CalDAVRequest.php: $this->principal = $user; CalDAVRequest.php: $this->user_no = $user->user_no; CalDAVRequest.php: $this->principal_id = $user->principal_id; CalDAVRequest.php: if ( $this->path == '/' || $this->path == '' ) { CalDAVRequest.php: $this->privileges = privilege_to_bits( array('read','read-free-busy','read-acl')); CalDAVRequest.php: else if ( $session->AllowedTo("Admin") || $session->user_no == $this->user_no ) { CalDAVRequest.php: $this->privileges = privilege_to_bits('all'); CalDAVRequest.php: dbg_error_log( "caldav", "Full permissions for %s", ( $session->user_no == $this->user_no ? "user accessing their own hierarchy" : "a systems administrator") ); CalDAVRequest.php: $this->privileges = 0; CalDAVRequest.php: if ( $this->IsPublic() ) { CalDAVRequest.php: $this->privileges = privilege_to_bits(array('read','read-free-busy')); CalDAVRequest.php: else if ( isset($c->public_freebusy_url) && $c->public_freebusy_url ) { CalDAVRequest.php: $this->privileges = privilege_to_bits('read-free-busy'); CalDAVRequest.php: $params = array( ':session_principal_id' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); CalDAVRequest.php: if ( isset($this->by_email) && $this->by_email ) { CalDAVRequest.php: $params[':request_principal_id'] = $this->principal_id; CalDAVRequest.php: $params[':request_path'] = $this->path; CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $permission_result = $qry->Fetch() ) CalDAVRequest.php: $this->privileges |= bindec($permission_result->perm); CalDAVRequest.php: dbg_error_log( 'caldav', 'Restricted permissions for user accessing someone elses hierarchy: %s', decbin($this->privileges) ); CalDAVRequest.php: if ( isset($this->ticket) && $this->ticket->MatchesPath($this->path) ) { CalDAVRequest.php: $this->privileges |= $this->ticket->privileges(); CalDAVRequest.php: dbg_error_log( 'caldav', 'Applying permissions for ticket "%s" now: %s', $this->ticket->id(), decbin($this->privileges) ); CalDAVRequest.php: $this->permissions = array(); CalDAVRequest.php: $privs = bits_to_privilege($this->privileges); CalDAVRequest.php: $this->permissions[$v] = $type; CalDAVRequest.php: * that. At present we only maintain permissions on a per-collection basis though. CalDAVRequest.php: if ( !isset($this->_locks_found) ) { CalDAVRequest.php: $this->_locks_found = array(); CalDAVRequest.php: $qry->Exec('caldav',__LINE__,__FILE__); CalDAVRequest.php: $qry = new AwlQuery($sql, array( ':dav_name' => $this->path, ':pattern_end_match' => ($this->IsInfiniteDepth() ? '' : '$') ) ); CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) ) { CalDAVRequest.php: while( $lock_row = $qry->Fetch() ) { CalDAVRequest.php: $this->_locks_found[$lock_row->opaquelocktoken] = $lock_row; CalDAVRequest.php: $this->DoResponse(500,translate("Database Error")); CalDAVRequest.php: foreach( $this->_locks_found AS $lock_token => $lock_row ) { CalDAVRequest.php: if ( $lock_row->depth == DEPTH_INFINITY || $lock_row->dav_name == $this->path ) { CalDAVRequest.php: if ( isset($this->collection) && isset($this->collection->publicly_readable) && $this->collection->publicly_readable == 't' ) { CalDAVRequest.php: if ( isset($this->path) ) return $this->path; CalDAVRequest.php: if ( $this->IsInfiniteDepth() ) return 'infinity'; CalDAVRequest.php: return $this->depth; CalDAVRequest.php: if ( $this->IsInfiniteDepth() ) return ''; CalDAVRequest.php: if ( $this->depth == 0 ) return '$'; CalDAVRequest.php: if ( isset($this->_locks_found) && isset($this->_locks_found[$lock_token]) ) { CalDAVRequest.php: return $this->_locks_found[$lock_token]; CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) ) { CalDAVRequest.php: $lock_row = $qry->Fetch(); CalDAVRequest.php: $this->_locks_found = array( $lock_token => $lock_row ); CalDAVRequest.php: return $this->_locks_found[$lock_token]; CalDAVRequest.php: $this->DoResponse( 500, translate("Database Error") ); CalDAVRequest.php: if ( isset($this->lock_token) && $this->lock_token == $lock_token ) { CalDAVRequest.php: if ( isset($this->if_clause) ) { CalDAVRequest.php: dbg_error_log( "caldav", "Checking lock token '%s' against '%s'", $lock_token, $this->if_clause ); CalDAVRequest.php: $tokens = preg_split( '/[<>]/', $this->if_clause ); CalDAVRequest.php: @dbg_error_log( "caldav", "Invalid lock token '%s' - not in Lock-token (%s) or If headers (%s) ", $lock_token, $this->lock_token, $this->if_clause ); CalDAVRequest.php: if ( !isset($this->_locks_found) && false === $this->IsLocked() ) return false; CalDAVRequest.php: if ( isset($this->_locks_found[$lock_token]) ) return $this->_locks_found[$lock_token]; CalDAVRequest.php: if ( $existing_lock = $this->IsLocked() ) { // NOTE Assignment in if() is expected here. CalDAVRequest.php: dbg_error_log( "caldav", "There is a lock on '%s'", $this->path); CalDAVRequest.php: if ( ! $this->ValidateLockToken($existing_lock) ) { CalDAVRequest.php: $lock_row = $this->GetLockRow($existing_lock); CalDAVRequest.php: * Already locked - deny it CalDAVRequest.php: new XMLElement( 'href', $lock_row->dav_name ), CalDAVRequest.php: if ( $lock_row->dav_name != $this->path ) { CalDAVRequest.php: new XMLElement( 'href', $this->path ), CalDAVRequest.php: $xmldoc = $response->Render(0,''); CalDAVRequest.php: $this->DoResponse( 207, $xmldoc, 'text/xml; charset="utf-8"' ); CalDAVRequest.php: * Coerces the Content-type of the request into something valid/appropriate CalDAVRequest.php: if ( isset($this->content_type) ) { CalDAVRequest.php: $type = explode( '/', $this->content_type, 2); CalDAVRequest.php: /** Null (or peculiar) content-type supplied so we have to try and work it out... */ CalDAVRequest.php: $first_word = trim(substr( $this->raw_post, 0, 30)); CalDAVRequest.php: dbg_error_log( 'LOG WARNING', 'Application sent content-type of "%s" instead of "text/xml"', CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)') ); CalDAVRequest.php: $this->content_type = 'text/xml'; CalDAVRequest.php: dbg_error_log( 'LOG WARNING', 'Application sent content-type of "%s" instead of "text/calendar"', CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)') ); CalDAVRequest.php: $this->content_type = 'text/calendar'; CalDAVRequest.php: dbg_error_log( 'LOG WARNING', 'Application sent content-type of "%s" instead of "text/vcard"', CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)') ); CalDAVRequest.php: $this->content_type = 'text/vcard'; CalDAVRequest.php: dbg_error_log( 'LOG NOTICE', 'Unusual content-type of "%s" and first word of content is "%s"', CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)'), $first_word ); CalDAVRequest.php: if ( !isset($this->_is_collection) ) { CalDAVRequest.php: $this->_is_collection = preg_match( '#/$#', $this->path ); CalDAVRequest.php: return $this->_is_collection; CalDAVRequest.php: if ( !$this->IsCollection() || !isset($this->collection) ) return false; CalDAVRequest.php: return $this->collection->is_calendar == 't'; CalDAVRequest.php: if ( !$this->IsCollection() || !isset($this->collection) ) return false; CalDAVRequest.php: return $this->collection->is_addressbook == 't'; CalDAVRequest.php: if ( !isset($this->_is_principal) ) { CalDAVRequest.php: $this->_is_principal = preg_match( '#^/[^/]+/$#', $this->path ); CalDAVRequest.php: return $this->_is_principal; CalDAVRequest.php: if ( !isset($this->_is_proxy_request) ) { CalDAVRequest.php: $this->_is_proxy_request = preg_match( '#^/[^/]+/calendar-proxy-(read|write)/?[^/]*$#', $this->path ); CalDAVRequest.php: return $this->_is_proxy_request; CalDAVRequest.php: return ($this->depth == DEPTH_INFINITY); CalDAVRequest.php: return $this->collection_id; CalDAVRequest.php: if ( $privs === null ) $privs = $this->supported_privileges; CalDAVRequest.php: $reply->NSElement($privilege,$k); CalDAVRequest.php: dbg_error_log( 'caldav', '"%s" is a container of sub-privileges.', $k ); CalDAVRequest.php: $privset = array_merge($privset, $this->BuildSupportedPrivileges($reply,$v)); CalDAVRequest.php: $privileges[] = new XMLElement('supported-privilege',$privset); CalDAVRequest.php: * +------------+------------------------------------------------------+ CalDAVRequest.php: * +------------+------------------------------------------------------+ CalDAVRequest.php: * | REPORT | DAV:read or CALDAV:read-free-busy (on all referenced | CalDAVRequest.php: * +------------+------------------------------------------------------+ CalDAVRequest.php: dbg_error_log('caldav', 'Checking whether "%s" is allowed to "%s"', $session->username, $activity); CalDAVRequest.php: if ( isset($this->permissions['all']) ) return true; CalDAVRequest.php: case "CALDAV:schedule-send-freebusy": CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); CalDAVRequest.php: case "CALDAV:schedule-send-invite": CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); CalDAVRequest.php: case "CALDAV:schedule-send-reply": CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['unbind']); CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['write-properties']); CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['write-content']); CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['bind']); CalDAVRequest.php: if ( !isset($this->permissions['write']) || !isset($this->permissions['bind']) ) return false; CalDAVRequest.php: if ( $this->is_principal ) return false; CalDAVRequest.php: if ( $this->path == '/' ) return false; CalDAVRequest.php:// decbin($this->privileges), ($this->privileges & $test_bits), decbin($this->privileges & $test_bits) ); CalDAVRequest.php: return (($this->privileges & $test_bits) > 0 ); CalDAVRequest.php: return $this->privileges; CalDAVRequest.php:// decbin($this->privileges), ($this->privileges & $test_bits), decbin($this->privileges & $test_bits) ); CalDAVRequest.php: return ($this->privileges & $test_bits) > 0; CalDAVRequest.php: * Sometimes it's a perfectly formed request, but we just don't do that :-( CalDAVRequest.php: dbg_error_log("ERROR", " %s: Support for $v:$k properties is not implemented yet", $this->method ); CalDAVRequest.php: $badprops->NewElement(strtolower($k),false,array("xmlns" => strtolower($v))); CalDAVRequest.php: $this->XMLResponse( 422, $error ); CalDAVRequest.php: * Send a need-privileges error response. This function will only return CalDAVRequest.php: if ( $this->HavePrivilegeTo($privileges) ) return; CalDAVRequest.php: $href = $this->path; CalDAVRequest.php: $privnodes = array( $reply->href(ConstructURL($href)), new XMLElement( 'privilege' ) ); CalDAVRequest.php: $reply->NSElement( $privnodes[1], $privileges[0] ); CalDAVRequest.php: $xml = new XMLElement( 'need-privileges', new XMLElement( 'resource', $privnodes) ); CalDAVRequest.php: $xmldoc = $reply->Render('error',$xml); CalDAVRequest.php: $this->DoResponse( 403, $xmldoc, 'text/xml; charset="utf-8"' ); CalDAVRequest.php: $xmldoc = sprintf(' CalDAVRequest.php: $this->DoResponse( $status, $xmldoc, 'text/xml; charset="utf-8"' ); CalDAVRequest.php: $this->DoResponse( 400, $text ); CalDAVRequest.php: $xmldoc = $xmltree->Render(0,''); CalDAVRequest.php: $this->DoResponse( $status, $xmldoc, 'text/xml; charset="utf-8"' ); CalDAVRequest.php: * Utility function we call when we have a simple status-based response to CalDAVRequest.php: function DoResponse( $status, $message="", $content_type="text/plain; charset=\"utf-8\"" ) { CalDAVRequest.php: @header( sprintf("X-DAViCal-Version: DAViCal/%d.%d.%d; DB/%d.%d.%d", $c->code_major, $c->code_minor, $c->code_patch, $c->schema_major, $c->schema_minor, $c->schema_patch) ); CalDAVRequest.php: @header( "Content-type: ".$content_type ); CalDAVRequest.php: if ( (isset($c->dbg['ALL']) && $c->dbg['ALL']) || (isset($c->dbg['response']) && $c->dbg['response']) || $status > 399 ) { CalDAVRequest.php: dbg_error_log( "LOG headers", "-->%s", $v ); CalDAVRequest.php: dbg_error_log( "LOG response", "-->%s", $v ); CalDAVRequest.php: header( "Content-Length: ".strlen($message) ); CalDAVRequest.php: if ( isset($c->dbg['caldav']) && $c->dbg['caldav'] ) { CalDAVRequest.php: dbg_error_log("caldav", "Status: %d, Message: %s, User: %d, Path: %s", $status, $message, $session->user_no, $this->path); CalDAVRequest.php: if ( isset($c->dbg['statistics']) && $c->dbg['statistics'] ) { CalDAVRequest.php: $script_time = microtime(true) - $c->script_start_time; CalDAVRequest.php: $this->method, $status, $script_time, $c->total_query_time, $this->path); check_UTF8.php: * http://iki.fi/hsivonen/php-utf8/ check_UTF8.php: * Version 1.0, 2003-05-30 check_UTF8.php: * Takes an UTF-8 string and returns an array of ints representing the check_UTF8.php: * Returns false if the input string isn't a valid UTF-8 octet sequence. check_UTF8.php: // When mState is zero we expect either a US-ASCII character or a check_UTF8.php: // multi-octet sequence. check_UTF8.php: // US-ASCII, pass straight through. check_UTF8.php: * (b) outside the Unicode range of 0-0x10FFFF. check_UTF8.php: /* Current octet is neither in the US-ASCII range nor a legal first check_UTF8.php: * octet of a multi-octet sequence. check_UTF8.php: // When mState is non-zero, we expect a continuation of the multi-octet check_UTF8.php: $shift = ($mState - 1) * 6; check_UTF8.php: if (0 == --$mState) { check_UTF8.php: /* End of the multi-octet sequence. mUcs4 now contains the final check_UTF8.php: // From Unicode 3.1, non-shortest form is illegal check_UTF8.php: * Incomplete multi-octet sequence. check_UTF8.php: * a UTF-8 string. Astral planes are supported ie. the ints in the check_UTF8.php: // nop -- zap the BOM davical_configuration_missing.php:include("page-header.php"); davical_configuration_missing.php:

There is no configuration file present in /etc/davical/$_SERVER[SERVER_NAME]-conf.php so davical_configuration_missing.php:

Well, you're seeing this! At least you have DAViCal installed :-) You also have Apache and PHP working davical_configuration_missing.php: or later so keep downloading new versions and trying again. Or make some guesses. Or bug Andrew :-)

davical_configuration_missing.php:// \$c->domain_name = 'davical.example.com'; davical_configuration_missing.php:// \$c->sysabbr = 'davical'; davical_configuration_missing.php:// \$c->system_name = 'DAViCal CalDAV Server'; davical_configuration_missing.php: \$c->admin_email = 'admin@example.com'; davical_configuration_missing.php: \$c->pg_connect[] = 'dbname=davical user=davical_app'; davical_configuration_missing.php:configuring someone for the admin e-mail is a really good idea.

davical_configuration_missing.php:include("page-footer.php"); DAViCalSession.php:// the records related to the logged-on user... (the where clause gets added). DAViCalSession.php: $this->Session($sid); DAViCalSession.php: if ( !isset($u->principal_id) ) { DAViCalSession.php: // If they don't have a principal_id set then we should re-read from our local database DAViCalSession.php: $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $u->username) ); DAViCalSession.php: if ( $qry->Exec() && $qry->rows() == 1 ) { DAViCalSession.php: $u = $qry->Fetch(); DAViCalSession.php: $this->GetRoles(); DAViCalSession.php: if ( function_exists('awl_set_locale') && isset($this->locale) && $this->locale != '' ) { DAViCalSession.php: awl_set_locale($this->locale); DAViCalSession.php: $this->roles = array(); DAViCalSession.php: $sql = 'SELECT role_name FROM roles JOIN role_member ON roles.role_no=role_member.role_no WHERE user_no = '.$this->user_no; DAViCalSession.php: if ( $qry->Exec('DAViCalSession') && $qry->rows() > 0 ) { DAViCalSession.php: while( $role = $qry->Fetch() ) { DAViCalSession.php: $this->roles[$role->role_name] = 1; DAViCalSession.php: if ( (isset($c->restrict_admin_domain) && $c->restrict_admin_domain != $current_domain) DAViCalSession.php: || (isset($c->restrict_admin_port) && $c->restrict_admin_port != $_SERVER['SERVER_PORT'] ) ) { DAViCalSession.php: if ( isset($c->restrict_admin_roles) && $roles == '' ) $roles = $c->restrict_admin_roles; DAViCalSession.php: if ( $this->logged_in && $roles == '' ) return; DAViCalSession.php: if ( ! $this->logged_in ) { DAViCalSession.php: $c->messages[] = i18n('You must log in to use this system.'); DAViCalSession.php: include_once('page-header.php'); DAViCalSession.php: if ( $this->login_failed ) { DAViCalSession.php: $c->messages[] = i18n('Invalid user name or password.'); DAViCalSession.php: .' '.translate($c->system_name).' ' DAViCalSession.php: echo '

'.translate('If you would like to request access, please e-mail').' '.$c->admin_email."

\n"; DAViCalSession.php: echo $this->RenderLoginPanel(); DAViCalSession.php: if ( $this->AllowedTo($v) ) return; DAViCalSession.php: $c->messages[] = i18n('You are not authorised to use this function.'); DAViCalSession.php: include_once('page-header.php'); DAViCalSession.php: include('page-footer.php'); DAViCalSession.php:$session->_CheckLogin(); DAVResource.php: * @var True if this resource is a principal-URL DAVResource.php: $this->exists = null; DAVResource.php: $this->bound_from = null; DAVResource.php: $this->dav_name = null; DAVResource.php: $this->unique_tag = null; DAVResource.php: $this->resource = null; DAVResource.php: $this->collection = null; DAVResource.php: $this->principal = null; DAVResource.php: $this->parent = null; DAVResource.php: $this->resourcetypes = null; DAVResource.php: $this->contenttype = null; DAVResource.php: $this->privileges = null; DAVResource.php: $this->dead_properties = null; DAVResource.php: $this->supported_methods = null; DAVResource.php: $this->supported_reports = null; DAVResource.php: $this->_is_collection = false; DAVResource.php: $this->_is_principal = false; DAVResource.php: $this->_is_calendar = false; DAVResource.php: $this->_is_binding = false; DAVResource.php: $this->_is_addressbook = false; DAVResource.php: $this->_is_proxy_request = false; DAVResource.php: $this->FromRow($parameters); DAVResource.php: $this->FromPath($parameters['path']); DAVResource.php: $this->FromPath($parameters); DAVResource.php: $this->exists = true; DAVResource.php: // $this->dav_name = $row->dav_name; DAVResource.php: $this->dav_name = $row->owner; DAVResource.php: //$this->bound_from = (isset($row->bound_from)? $row->bound_from : $row->dav_name); DAVResource.php: $this->bound_from = (isset($row->bound_from)? $row->bound_from : $row->owner); DAVResource.php: $this->_is_collection = preg_match( '{/$}', $this->owner ); DAVResource.php: if ( $this->_is_collection ) { DAVResource.php: $this->contenttype = 'httpd/unix-directory'; DAVResource.php: $this->collection = (object) array(); DAVResource.php: $this->resource_id = $row->collection_id; DAVResource.php: $this->_is_principal = preg_match( '{^/[^/]+/$}', $this->dav_name ); DAVResource.php: if ( preg_match( '#^(/principals/[^/]+/[^/]+)/?$#', $this->dav_name, $matches) ) { DAVResource.php: $this->collection->dav_name = $matches[1].'/'; DAVResource.php: $this->collection->type = 'principal_link'; DAVResource.php: $this->_is_principal = true; DAVResource.php: $this->resource = (object) array(); DAVResource.php: //if ( isset($row->dav_id) ) $this->resource_id = $row->dav_id; DAVResource.php: if ( isset($row->cal_id) ) $this->resource_id = $row->cal_id; DAVResource.php: dbg_error_log( 'DAVResource', ':FromRow: Named "%s" is%s a collection.', $this->dav_name, ($this->_is_collection?'':' not') ); DAVResource.php: if ( $this->_is_collection ) DAVResource.php: $this->collection->{$k} = $v; DAVResource.php: $this->resource->{$k} = $v; DAVResource.php: // $this->{$k} = $v; DAVResource.php: $this->resourcetypes = ''; DAVResource.php: $this->unique_tag = '"'.$v.'@'.$this->dav_name.'"'; DAVResource.php: $this->unique_tag = '"'.$v.'@'.$this->dav_name.'"'; DAVResource.php: $this->resourcetypes = ''; DAVResource.php: // $this->unique_tag = '"'.$v.'"'; DAVResource.php: if ( $this->_is_collection ) { DAVResource.php: if ( !isset( $this->collection->type ) || $this->collection->type == 'collection' ) { DAVResource.php: if ( $this->_is_principal ) DAVResource.php: $this->collection->type = 'principal'; DAVResource.php: else if ( $row->is_calendar == 't' ) { DAVResource.php: $this->collection->type = 'calendar'; DAVResource.php: else if ( $row->is_addressbook == 't' ) { DAVResource.php: $this->collection->type = 'addressbook'; DAVResource.php: else if ( isset($row->is_proxy) && $row->is_proxy == 't' ) { DAVResource.php: $this->collection->type = 'proxy'; DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) DAVResource.php: $this->collection->type = 'schedule-'. $matches[3]. 'box'; DAVResource.php: else if ( $this->dav_name == '/' ) DAVResource.php: $this->collection->type = 'root'; DAVResource.php: $this->collection->type = 'collection'; DAVResource.php: $this->_is_calendar = ($this->collection->is_calendar == 't'); DAVResource.php: $this->_is_addressbook = ($this->collection->is_addressbook == 't'); DAVResource.php: $this->_is_proxy_request= ($this->collection->type == 'proxy'); DAVResource.php: if ( $this->_is_principal && !isset($this->resourcetypes) ) { DAVResource.php: $this->resourcetypes = ''; DAVResource.php: else if ( $this->_is_proxy_request ) { DAVResource.php: $this->resourcetypes = $this->collection->resourcetypes; DAVResource.php: if ( isset($this->collection->dav_displayname) ) $this->collection->displayname = $this->collection->dav_displayname; DAVResource.php: $this->resourcetypes = ''; DAVResource.php: //if ( isset($this->resource->caldav_data) ) { DAVResource.php: if ( isset($this->resource->owner) ) { DAVResource.php: //if ( substr($this->resource->caldav_data,0,15) == 'BEGIN:VCALENDAR' ) $this->contenttype = 'text/calendar'; DAVResource.php: $this->contenttype = 'text/calendar'; DAVResource.php: $this->resource->displayname = $this->resource->title; DAVResource.php: $this->contenttype = 'text/vcard'; DAVResource.php: $this->resource->displayname = $this->resource->names_ordered; DAVResource.php: $this->dav_name = DeconstructURL($inpath); DAVResource.php: $this->FetchCollection(); DAVResource.php: if ( $this->_is_collection ) { DAVResource.php: if ( $this->_is_principal || $this->collection->type == 'principal' ) $this->FetchPrincipal(); DAVResource.php: $this->FetchResource(); DAVResource.php: $this->dav_name, ($this->_is_collection?' '.$this->resourcetypes:' not'), ($this->_is_principal?' and a principal':'') ); DAVResource.php: * - also discussed at more length in 5.2 DAVResource.php: * - The exact request. DAVResource.php: * - If the exact request, doesn't end in '/', then the request URL with a '/' appended DAVResource.php: * - The request URL truncated to the last '/' DAVResource.php: dbg_error_log( 'DAVResource', ':FetchCollection: Looking for collection for "%s".', $this->dav_name ); DAVResource.php: $this->collection = (object) array( DAVResource.php: 'collection_id' => -1, DAVResource.php: $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); DAVResource.php: if ( !preg_match( '#/$#', $this->dav_name ) ) { DAVResource.php: $params[':up_to_slash'] = preg_replace( '#[^/]*$#', '', $this->dav_name); DAVResource.php: $params[':plus_slash'] = $this->dav_name.'/'; DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { DAVResource.php: $this->collection = $row; DAVResource.php: $this->collection->exists = true; DAVResource.php: if ( $row->is_calendar == 't' ) DAVResource.php: $this->collection->type = 'calendar'; DAVResource.php: else if ( $row->is_addressbook == 't' ) DAVResource.php: $this->collection->type = 'addressbook'; DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) DAVResource.php: $this->collection->type = 'schedule-'. $matches[3]. 'box'; DAVResource.php: $this->collection->type = 'collection'; DAVResource.php: else if ( preg_match( '{^( ( / ([^/]+) / ) \.(in|out)/ ) [^/]*$}x', $this->dav_name, $matches ) ) { DAVResource.php: // The request is for a scheduling inbox or outbox (or something inside one) and we should auto-create it DAVResource.php: $this->collection_type = 'schedule-'. $matches[4]. 'box'; DAVResource.php: $params[':resourcetypes'] = sprintf('', $this->collection_type ); DAVResource.php: $qry->Exec('DAVResource'); DAVResource.php: $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { DAVResource.php: $this->collection = $row; DAVResource.php: $this->collection->exists = true; DAVResource.php: $this->collection->type = $this->collection_type; DAVResource.php: else if ( preg_match( '#^(/([^/]+)/calendar-proxy-(read|write))/?[^/]*$#', $this->dav_name, $matches ) ) { DAVResource.php: $this->collection->type = 'proxy'; DAVResource.php: $this->_is_proxy_request = true; DAVResource.php: $this->proxy_type = $matches[3]; DAVResource.php: $this->collection->dav_name = $this->dav_name; DAVResource.php: $this->collection->dav_displayname = sprintf( '%s proxy %s', $matches[2], $matches[3] ); DAVResource.php: $this->collection->exists = true; DAVResource.php: $this->collection->parent_container = $matches[1] . '/'; DAVResource.php: else if ( preg_match( '#^(/[^/]+)/?$#', $this->dav_name, $matches) DAVResource.php: || preg_match( '#^((/principals/[^/]+/)[^/]+)/?$#', $this->dav_name, $matches) ) { DAVResource.php: $this->_is_principal = true; DAVResource.php: $this->FetchPrincipal(); DAVResource.php: else if ( $this->dav_name == '/' ) { DAVResource.php: $this->collection->dav_name = '/'; DAVResource.php: $this->collection->type = 'root'; DAVResource.php: $this->collection->exists = true; DAVResource.php: $this->collection->displayname = $c->system_name; DAVResource.php: $this->collection->default_privileges = (1 | 16 | 32); DAVResource.php: $this->collection->parent_container = '/'; DAVResource.php: $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); DAVResource.php: if ( !preg_match( '#/$#', $this->dav_name ) ) { DAVResource.php: $params[':up_to_slash'] = preg_replace( '#[^/]*$#', '', $this->dav_name); DAVResource.php: $params[':plus_slash'] = $this->dav_name.'/'; DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { DAVResource.php: $this->collection = $row; DAVResource.php: $this->collection->exists = true; DAVResource.php: $this->_is_binding = true; DAVResource.php: $this->collection->parent_set = $row->parent_container; DAVResource.php: $this->collection->parent_container = $row->bind_parent_container; DAVResource.php: $this->bound_from = str_replace( $row->bound_to, $row->dav_name, $this->dav_name); DAVResource.php: $this->collection->bound_from = $row->dav_name; DAVResource.php: $this->collection->dav_name = $row->bound_to; DAVResource.php: if ( isset($row->access_ticket_id) ) { DAVResource.php: if ( !isset($this->tickets) ) $this->tickets = array(); DAVResource.php: $this->tickets[] = new DAVTicket($row->access_ticket_id); DAVResource.php: if ( $row->is_calendar == 't' ) DAVResource.php: $this->collection->type = 'calendar'; DAVResource.php: else if ( $row->is_addressbook == 't' ) DAVResource.php: $this->collection->type = 'addressbook'; DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) DAVResource.php: $this->collection->type = 'schedule-'. $matches[3]. 'box'; DAVResource.php: $this->collection->type = 'collection'; DAVResource.php: dbg_error_log( 'DAVResource', 'No collection for path "%s".', $this->dav_name ); DAVResource.php: $this->collection->exists = false; DAVResource.php: $this->collection->dav_name = preg_replace('{/[^/]*$}', '/', $this->dav_name); DAVResource.php: @dbg_error_log( 'DAVResource', ':FetchCollection: Found collection named "%s" of type "%s".', $this->collection->dav_name, $this->collection->type ); DAVResource.php: $this->_is_collection = ( $this->_is_principal || $this->collection->dav_name == $this->dav_name || $this->collection->dav_name == $this->dav_name.'/' ); DAVResource.php: if ( $this->_is_collection ) { DAVResource.php: $this->dav_name = $this->collection->dav_name; DAVResource.php: $this->resource_id = $this->collection->collection_id; DAVResource.php: $this->_is_calendar = ($this->collection->type == 'calendar'); DAVResource.php: $this->_is_addressbook = ($this->collection->type == 'addressbook'); DAVResource.php: $this->contenttype = 'httpd/unix-directory'; DAVResource.php: if ( !isset($this->exists) && isset($this->collection->exists) ) { DAVResource.php: $this->exists = $this->collection->exists; DAVResource.php: if ( $this->exists ) { DAVResource.php: if ( isset($this->collection->dav_etag) ) $this->unique_tag = '"'.$this->collection->dav_etag.'"'; DAVResource.php: if ( isset($this->collection->created) ) $this->created = $this->collection->created; DAVResource.php: if ( isset($this->collection->modified) ) $this->modified = $this->collection->modified; DAVResource.php: if ( isset($this->collection->dav_displayname) ) $this->collection->displayname = $this->collection->dav_displayname; DAVResource.php: if ( !isset($this->parent) ){ DAVResource.php: $this->FetchParentContainer(); DAVResource.php: $this->user_no = $this->parent->GetProperty('user_no'); DAVResource.php: if ( isset($this->collection->resourcetypes) ) DAVResource.php: $this->resourcetypes = $this->collection->resourcetypes; DAVResource.php: $this->resourcetypes = ''; DAVResource.php: if ( $this->_is_principal ) $this->resourcetypes .= ''; DAVResource.php: if ( $this->_is_addressbook ) $this->resourcetypes .= ''; DAVResource.php: if ( $this->_is_calendar ) $this->resourcetypes .= ''; DAVResource.php: if ( isset($this->principal) ) return; DAVResource.php: $this->principal = new CalDAVPrincipal( array( "path" => $this->bound_from() ) ); DAVResource.php: if ( $this->_is_principal && $this->principal->Exists() ) { DAVResource.php: $this->exists = true; DAVResource.php: $this->unique_tag = $this->principal->dav_etag; DAVResource.php: $this->created = $this->principal->created; DAVResource.php: $this->modified = $this->principal->modified; DAVResource.php: $this->resourcetypes = ''; DAVResource.php: $this->resource_id = $this->principal->principal_id; DAVResource.php: $this->collection = $this->principal->AsCollection(); DAVResource.php: $this->user_no = $this->principal->user_no; DAVResource.php: elseif ( $this->_is_principal ) { DAVResource.php: $this->exists = false; DAVResource.php: $this->collection->dav_name = $this->dav_name; DAVResource.php: $this->collection->type = 'principal'; DAVResource.php: if ( isset($this->exists) ) return; // True or false, we've got what we can already DAVResource.php: if ( $this->_is_collection ) return; // We have all we're going to read DAVResource.php: $params = array( ':dav_name' => $this->bound_from() ); DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() > 0 ) { DAVResource.php: $this->exists = true; DAVResource.php: $this->resource = $qry->Fetch(); DAVResource.php: $this->unique_tag = $this->resource->dav_etag; DAVResource.php: $this->created = $this->resource->created; DAVResource.php: $this->modified = $this->resource->modified; DAVResource.php: $this->resource_id = $this->resource->dav_id; DAVResource.php: if ( substr($this->resource->caldav_data,0,15) == 'BEGIN:VCALENDAR' ) { DAVResource.php: $this->contenttype = 'text/calendar'; DAVResource.php: $this->resourcetypes = ''; DAVResource.php: $this->exists = false; DAVResource.php: if ( isset($this->dead_properties) ) return; DAVResource.php: $this->dead_properties = array(); DAVResource.php: $qry = new AwlQuery('SELECT property_name, property_value FROM property WHERE dav_name= :dav_name', array(':dav_name' => $this->dav_name) ); DAVResource.php: if ( $qry->Exec('DAVResource') ) { DAVResource.php: while ( $property = $qry->Fetch() ) { DAVResource.php: $this->dead_properties[$property->property_name] = $property->property_value; DAVResource.php: if ( $this->dav_name == '/' ) return null; DAVResource.php: if ( !isset($this->parent) ) { DAVResource.php: if ( $this->_is_collection ) { DAVResource.php: dbg_error_log( 'DAVResource', 'Retrieving "%s" - parent of "%s" (dav_name: %s)', $this->parent_path(), $this->collection->dav_name, $this->dav_name() ); DAVResource.php: $this->parent = new DAVResource( $this->parent_path() ); DAVResource.php: dbg_error_log( 'DAVResource', 'Retrieving "%s" - parent of "%s" (dav_name: %s)', $this->parent_path(), $this->collection->dav_name, $this->dav_name() ); DAVResource.php: $this->parent = new DAVResource($this->collection->dav_name); DAVResource.php: return $this->parent; DAVResource.php: if ( $this->dav_name == '/' || $this->dav_name == '' ) { DAVResource.php: $this->privileges = (1 | 16 | 32); // read + read-acl + read-current-user-privilege-set DAVResource.php: if ( $session->AllowedTo('Admin') ) { DAVResource.php: $this->privileges = privilege_to_bits('all'); DAVResource.php: if ( $this->IsPrincipal() ) { DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: $this->privileges = $this->principal->Privileges(); DAVResource.php: dbg_error_log( 'DAVResource', 'Privileges of "%s" for user accessing "%s"', $this->privileges, $this->principal->username() ); DAVResource.php: if ( ! isset($this->collection) ) $this->FetchCollection(); DAVResource.php: $this->privileges = 0; DAVResource.php: if ( !isset($this->collection->path_privs) ) { DAVResource.php: /*if ( !isset($this->parent) ) $this->FetchParentContainer(); DAVResource.php: $this->collection->path_privs = $this->parent->Privileges(); DAVResource.php: $this->collection->user_no = $this->parent->GetProperty('user_no'); DAVResource.php: $this->collection->principal_id = $this->parent->GetProperty('principal_id'); DAVResource.php: $filtro = "uid=".$session->username; DAVResource.php: $this->collection->user_no = $uidnumber['uidNumber']; DAVResource.php: $this->privileges = privilege_to_bits('all');//$this->collection->path_privs; DAVResource.php: if ( is_string($this->privileges) ) $this->privileges = bindec( $this->privileges ); DAVResource.php: decbin($this->privileges), $session->username, $this->dav_name() ); DAVResource.php: if ( isset($request->ticket) && $request->ticket->MatchesPath($this->bound_from()) ) { DAVResource.php: $this->privileges |= $request->ticket->privileges(); DAVResource.php: dbg_error_log( 'DAVResource', 'Applying permissions for ticket "%s" now: %s', $request->ticket->id(), decbin($this->privileges) ); DAVResource.php: if ( isset($this->tickets) ) { DAVResource.php: if ( !isset($this->resource_id) ) $this->FetchResource(); DAVResource.php: foreach( $this->tickets AS $k => $ticket ) { DAVResource.php: if ( $ticket->MatchesResource($this->resource_id()) || $ticket->MatchesPath($this->bound_from()) ) { DAVResource.php: $this->privileges |= $ticket->privileges(); DAVResource.php: dbg_error_log( 'DAVResource', 'Applying permissions for ticket "%s" now: %s', $ticket->id(), decbin($this->privileges) ); DAVResource.php: if ( !isset($this->privileges) ) $this->FetchPrivileges(); DAVResource.php: return $this->privileges; DAVResource.php: if ( !isset($this->privileges) ) $this->FetchPrivileges(); DAVResource.php: $do_what, decbin($test_bits), decbin($this->privileges), ($this->privileges & $test_bits), decbin($this->privileges & $test_bits) ); DAVResource.php: return ($this->privileges & $test_bits) > 0; DAVResource.php: return ($this->privileges & $test_bits) == $test_bits; DAVResource.php: if ( $this->HavePrivilegeTo($privilege, $any) ) return; DAVResource.php: $request->NeedPrivilege( $privilege, $this->dav_name ); DAVResource.php: if ( !isset($this->privileges) ) $this->FetchPrivileges(); DAVResource.php: $privilege_names = bits_to_privilege($this->privileges, ($this->_is_collection ? $this->collection->type : null ) ); DAVResource.php: if ( isset($this->supported_methods) ) return $this->supported_methods; DAVResource.php: $this->supported_methods = array( DAVResource.php: if ( $this->IsCollection() ) { DAVResource.php:/* if ( $this->IsPrincipal() ) { DAVResource.php: $this->supported_methods['MKCALENDAR'] = ''; DAVResource.php: $this->supported_methods['MKCOL'] = ''; DAVResource.php: switch ( $this->collection->type ) { DAVResource.php: $this->supported_methods = array( DAVResource.php: case 'schedule-outbox': DAVResource.php: $this->supported_methods = array_merge( DAVResource.php: $this->supported_methods, DAVResource.php: case 'schedule-inbox': DAVResource.php: $this->supported_methods['GET'] = ''; DAVResource.php: $this->supported_methods['PUT'] = ''; DAVResource.php: $this->supported_methods['HEAD'] = ''; DAVResource.php: $this->supported_methods['MKTICKET'] = ''; DAVResource.php: $this->supported_methods['DELTICKET'] = ''; DAVResource.php: $this->supported_methods['MKTICKET'] = ''; DAVResource.php: $this->supported_methods['DELTICKET'] = ''; DAVResource.php: $this->supported_methods['GET'] = ''; DAVResource.php: $this->supported_methods['PUT'] = ''; DAVResource.php: $this->supported_methods['HEAD'] = ''; DAVResource.php: $this->supported_methods['MKCOL'] = ''; DAVResource.php: $this->supported_methods['MKCALENDAR'] = ''; DAVResource.php: $this->supported_methods['PROPPATCH'] = ''; DAVResource.php: $this->supported_methods = array_merge( DAVResource.php: $this->supported_methods, DAVResource.php: return $this->supported_methods; DAVResource.php: if ( !isset($this->supported_methods) ) $this->FetchSupportedMethods(); DAVResource.php: foreach( $this->supported_methods AS $k => $v ) { DAVResource.php: $methods[] = new XMLElement( 'supported-method', null, array('name' => $k) ); DAVResource.php: if ( isset($this->supported_reports) ) return $this->supported_reports; DAVResource.php: /************* comentado por incompatibilidade do sync-collection DAVResource.php: $this->supported_reports = array( DAVResource.php: 'DAV::principal-property-search' => '', DAVResource.php: 'DAV::principal-search-property-set' => '', DAVResource.php: 'DAV::expand-property' => '', DAVResource.php: 'DAV::sync-collection' => '' DAVResource.php: $this->supported_reports = array( DAVResource.php: 'DAV::principal-property-search' => '', DAVResource.php: 'DAV::principal-search-property-set' => '', DAVResource.php: 'DAV::expand-property' => '' DAVResource.php: if ( !isset($this->collection) ) $this->FetchCollection(); DAVResource.php: if ( $this->collection->is_calendar ) { DAVResource.php: $this->supported_reports = array_merge( DAVResource.php: $this->supported_reports, DAVResource.php: 'urn:ietf:params:xml:ns:caldav:calendar-query' => '', DAVResource.php: 'urn:ietf:params:xml:ns:caldav:calendar-multiget' => '', DAVResource.php: 'urn:ietf:params:xml:ns:caldav:free-busy-query' => '' DAVResource.php: if ( $this->collection->is_addressbook ) { DAVResource.php: $this->supported_reports = array_merge( DAVResource.php: $this->supported_reports, DAVResource.php: 'urn:ietf:params:xml:ns:carddav:addressbook-query' => '', DAVResource.php: 'urn:ietf:params:xml:ns:carddav:addressbook-multiget' => '' DAVResource.php: return $this->supported_reports; DAVResource.php: if ( !isset($this->supported_reports) ) $this->FetchSupportedReports(); DAVResource.php: foreach( $this->supported_reports AS $k => $v ) { DAVResource.php: $reply->NSElement($report, $k ); DAVResource.php: $reports[] = new XMLElement('supported-report', $report ); DAVResource.php: if ( isset($this->access_tickets) ) return; DAVResource.php: $this->access_tickets = array(); DAVResource.php: EXTRACT( \'epoch\' FROM (access_ticket.expires - current_timestamp)) AS seconds, DAVResource.php: $params = array(':collection_id' => $this->collection->collection_id, ':scan_depth' => $c->permission_scan_depth); DAVResource.php: if ( $this->IsCollection() ) { DAVResource.php: if ( !isset($this->exists) ) $this->FetchResource(); DAVResource.php: $params[':dav_id'] = $this->resource->dav_id; DAVResource.php: if ( isset($this->exists) && !$this->exists ) return; DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() ) { DAVResource.php: while( $ticket = $qry->Fetch() ) { DAVResource.php: $this->access_tickets[] = $ticket; DAVResource.php: * If the current user does not have DAV::read-acl privilege on this resource they DAVResource.php: if ( !isset($this->access_tickets) ) $this->FetchTickets(); DAVResource.php: $show_all = $this->HavePrivilegeTo('DAV::read-acl'); DAVResource.php: foreach( $this->access_tickets AS $meh => $trow ) { DAVResource.php: if ( !$show_all && ( $trow->dav_owner_id == $session->principal_id || $request->ticket->id() == $trow->ticket_id ) ) continue; DAVResource.php: dbg_error_log( 'DAVResource', ':BuildTicketinfo: Adding access_ticket "%s" which is "%s".', $trow->ticket_id, $trow->privileges ); DAVResource.php: $ticket = new XMLElement( $reply->Tag( 'ticketinfo', 'http://www.xythos.com/namespaces/StorageServer', 'TKT' ) ); DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:id', $trow->ticket_id ); DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:owner', $reply->href( ConstructURL($trow->principal_dav_name)) ); DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:timeout', (isset($trow->seconds) ? sprintf( 'Seconds-%d', $trow->seconds) : 'infinity') ); DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:visits', 'infinity' ); DAVResource.php: foreach( bits_to_privilege(bindec($trow->privileges) & bindec($trow->grantor_collection_privileges) ) AS $k => $v ) { DAVResource.php: $privs[] = $reply->NewXMLElement($v); DAVResource.php: $reply->NSElement($ticket, 'DAV::privilege', $privs ); DAVResource.php: * that. At present we only maintain permissions on a per-collection basis though. DAVResource.php: if ( !isset($this->_locks_found) ) { DAVResource.php: $this->_locks_found = array(); DAVResource.php: $qry = new AwlQuery($sql, array( ':this_path' => $this->dav_name, ':match_end' => ($depth == DEPTH_INFINITY ? '' : '$') ) ); DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) ) { DAVResource.php: while( $lock_row = $qry->Fetch() ) { DAVResource.php: $this->_locks_found[$lock_row->opaquelocktoken] = $lock_row; DAVResource.php: $this->DoResponse(500,i18n("Database Error")); DAVResource.php: foreach( $this->_locks_found AS $lock_token => $lock_row ) { DAVResource.php: if ( $lock_row->depth == DEPTH_INFINITY || $lock_row->dav_name == $this->dav_name ) { DAVResource.php: return $this->_is_collection; DAVResource.php: return $this->_is_collection && $this->_is_principal; DAVResource.php: return $this->_is_collection && $this->_is_calendar; DAVResource.php: if ( $this->_is_collection && preg_match( '{schedule-(inbox|outbox)}', $this->collection->type, $matches ) ) { DAVResource.php: return $this->_is_collection && $this->_is_addressbook; DAVResource.php: return $this->_is_binding; DAVResource.php: if ( ! isset($this->exists) ) { DAVResource.php: if ( $this->IsPrincipal() ) { DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: $this->exists = $this->principal->Exists(); DAVResource.php: else if ( ! $this->IsCollection() ) { DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); DAVResource.php:// dbg_error_log('DAVResource',' Checking whether "%s" exists. It would appear %s.', $this->dav_name, ($this->exists ? 'so' : 'not') ); DAVResource.php: return $this->exists; DAVResource.php: if ( $this->collection->dav_name != $this->dav_name ) { DAVResource.php: return $this->collection->exists; DAVResource.php: $parent = $this->FetchParentContainer(); DAVResource.php: return $parent->Exists(); DAVResource.php: if ( isset($this->dav_name) ) return $this->dav_name; DAVResource.php: if ( isset($this->bound_from) ) return $this->bound_from; DAVResource.php: return $this->dav_name(); DAVResource.php: if ( !isset($this->bound_from) && isset($this->dav_name) ) { DAVResource.php: $this->bound_from = $this->dav_name; DAVResource.php: $this->dav_name = $new_dav_name; DAVResource.php: return $this->dav_name; DAVResource.php: if ( $this->IsCollection() ) { DAVResource.php: if ( !isset($this->collection) ) $this->FetchCollection(); DAVResource.php: if ( !isset($this->collection->parent_container) ) { DAVResource.php: $this->collection->parent_container = preg_replace( '{[^/]+/$}', '', $this->bound_from()); DAVResource.php: return $this->collection->parent_container; DAVResource.php: return preg_replace( '{[^/]+$}', '', $this->bound_from()); DAVResource.php: * Returns the principal-URL for this resource DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: if ( $this->principal->Exists() ) { DAVResource.php: return $this->principal->principal_url; DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); DAVResource.php: return $this->resource; DAVResource.php: //if ( isset($this->unique_tag) ) return $this->unique_tag; DAVResource.php: if ( isset($this->unique_tag) ) DAVResource.php: if ( $this->IsPrincipal() && !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: else if ( !$this->_is_collection && !isset($this->resource) ) $this->FetchResource(); DAVResource.php: if ( $this->exists !== true || !isset($this->unique_tag) ) $this->unique_tag = ''; DAVResource.php: //return $this->unique_tag; DAVResource.php: * Returns the definitive resource_id for this resource - usually a dav_id DAVResource.php: if ( isset($this->resource_id) ) return $this->resource_id; DAVResource.php: if ( $this->IsPrincipal() && !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: else if ( !$this->_is_collection && !isset($this->resource) ) $this->FetchResource(); DAVResource.php: if ( $this->exists !== true || !isset($this->resource_id) ) $this->resource_id = null; DAVResource.php: return $this->resource_id; DAVResource.php: return ( isset($this->collection->publicly_readable) && $this->collection->publicly_readable == 't' ); DAVResource.php: if ( $this->IsPrincipal() ) return 'root'; DAVResource.php: if ( !$this->IsCollection() ) return $this->collection->type; DAVResource.php: if ( ! isset($this->collection->parent_container) ) return null; DAVResource.php: if ( isset($this->parent_container_type) ) return $this->parent_container_type; DAVResource.php: if ( preg_match('#/[^/]+/#', $this->collection->parent_container) ) { DAVResource.php: $this->parent_container_type = 'principal'; DAVResource.php: array( ':parent_name' => $this->collection->parent_container ) ); DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() > 0 && $parent = $qry->Fetch() ) { DAVResource.php: if ( $parent->is_calendar == 't' ) DAVResource.php: $this->parent_container_type = 'calendar'; DAVResource.php: else if ( $parent->is_addressbook == 't' ) DAVResource.php: $this->parent_container_type = 'addressbook'; DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) DAVResource.php: $this->parent_container_type = 'schedule-'. $matches[3]. 'box'; DAVResource.php: $this->parent_container_type = 'collection'; DAVResource.php: $this->parent_container_type = null; DAVResource.php: return $this->parent_container_type; DAVResource.php: * BuildACE - construct an XMLElement subtree for a DAV::ace DAVResource.php: $privilege_names = bits_to_privilege($privs, ($this->_is_collection ? $this->collection->type : 'resource')); DAVResource.php: $xmldoc->NSElement($privilege,$k); DAVResource.php: $privilege->NewElement($k); DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: $default_privs = $this->principal->default_privileges; DAVResource.php: if ( isset($this->collection->default_privileges) ) $default_privs = $this->collection->default_privileges; DAVResource.php: $acl[] = $this->BuildACE($xmldoc, pow(2,25) - 1, new XMLElement('property', new XMLElement('owner')) ); DAVResource.php: array( ':collection_id' => $this->collection->collection_id, ':principal_id' => $this->principal->principal_id ) ); DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() > 0 ) { DAVResource.php: while( $grant = $qry->Fetch() ) { DAVResource.php: if ( !isset($by_collection) ) $by_collection = isset($grant->by_collection); DAVResource.php: if ( $by_collection && !isset($grant->by_collection) ) break; DAVResource.php: $acl[] = $this->BuildACE($xmldoc, $grant->privileges, $xmldoc->href(ConstructURL($grant->dav_name)) ); DAVResource.php: $acl[] = $this->BuildACE($xmldoc, $default_privs, new XMLElement('authenticated') ); DAVResource.php: * Return general server-related properties, in plain form DAVResource.php: return $this->collection->collection_id; DAVResource.php: if ( isset($this->resourcetypes) ) { DAVResource.php: $this->resourcetypes = preg_replace('{^\s*<(.*)/>\s*$}', '$1', $this->resourcetypes); DAVResource.php: $type_list = preg_split('{(/>\s*<|\n)}', $this->resourcetypes); DAVResource.php: if ( isset($this->{$name}) ) return $this->{$name}; DAVResource.php: if ( $this->_is_principal ) { DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: if ( isset($this->principal->{$name}) ) return $this->principal->{$name}; DAVResource.php: if ( isset($this->collection->{$name}) ) return $this->collection->{$name}; DAVResource.php: else if ( $this->_is_collection ) { DAVResource.php: if ( isset($this->collection->{$name}) ) return $this->collection->{$name}; DAVResource.php: if ( isset($this->principal->{$name}) ) return $this->principal->{$name}; DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); DAVResource.php: if ( isset($this->resource->{$name}) ) return $this->resource->{$name}; DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: if ( isset($this->principal->{$name}) ) return $this->principal->{$name}; DAVResource.php: if ( isset($this->collection->{$name}) ) return $this->collection->{$name}; DAVResource.php: // dbg_error_log( 'DAVResource', ':GetProperty: Failed to find property "%s" on "%s".', $name, $this->dav_name ); DAVResource.php: if ( isset($this->dead_properties) ) $this->FetchDeadProperties(); DAVResource.php: $allprop = array_merge( (isset($this->dead_properties)?$this->dead_properties:array()), DAVResource.php: 'DAV::owner', 'DAV::principal-URL', 'DAV::current-user-principal', DAVResource.php: 'urn:ietf:params:xml:ns:carddav:max-resource-size', 'urn:ietf:params:xml:ns:carddav:supported-address-data', DAVResource.php: 'urn:ietf:params:xml:ns:carddav:addressbook-description', 'urn:ietf:params:xml:ns:carddav:addressbook-home-set' DAVResource.php: * Return general server-related properties for this URL DAVResource.php:// dbg_error_log( 'DAVResource', 'Processing "%s" on "%s".', $tag, $this->dav_name ); DAVResource.php: $property_list = $this->DAV_AllProperties(); DAVResource.php: $this->ResourceProperty($v, $prop, $reply, $discarded); DAVResource.php: $prop->NewElement('href', ConstructURL($this->dav_name) ); DAVResource.php: case 'DAV::resource-id': DAVResource.php: if ( $this->resource_id > 0 ) DAVResource.php: $reply->DAVElement( $prop, 'resource-id', $reply->href(ConstructURL('/.resources/'.$this->resource_id) ) ); DAVResource.php: case 'DAV::parent-set': DAVResource.php: $qry = new AwlQuery($sql, array( ':bound_from' => $this->bound_from() ) ); DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() > 0 ) { DAVResource.php: while( $row = $qry->Fetch() ) { DAVResource.php: $parents[$row->parent_container] = true; DAVResource.php: $parents[preg_replace( '{(?<=/)[^/]+/?$}','',$this->bound_from())] = true; DAVResource.php: $parents[preg_replace( '{(?<=/)[^/]+/?$}','',$this->dav_name())] = true; DAVResource.php: $parent_set = $reply->DAVElement( $prop, 'parent-set' ); DAVResource.php: $reply->DAVElement($parent_set, 'parent', array( DAVResource.php: $reply->DAVElement($parent_set, 'parent', array( DAVResource.php: //if ( !isset($this->contenttype) && !$this->_is_collection && !isset($this->resource) ) $this->FetchResource(); DAVResource.php: if ( !isset($this->contenttype) && !isset($this->resource) ) $this->FetchResource(); DAVResource.php: $prop->NewElement('getcontenttype', $this->contenttype ); DAVResource.php: $resourcetypes = $prop->NewElement('resourcetype' ); DAVResource.php: $type_list = $this->GetProperty('resourcetype'); DAVResource.php: $reply->NSElement( $resourcetypes, $v ); DAVResource.php: if ( $this->_is_binding ) { DAVResource.php: $reply->NSElement( $resourcetypes, 'http://xmlns.davical.org/davical:webdav-binding' ); DAVResource.php: $reply->NSElement($prop, $tag, ISODateToHTTPDate($this->GetProperty('modified')) ); DAVResource.php: $reply->NSElement($prop, $tag, DateToISODate($this->GetProperty('created')) ); DAVResource.php: if ( $this->_is_collection ) return false; DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); DAVResource.php: if ( isset($this->resource) ) { DAVResource.php: $reply->NSElement($prop, $tag, strlen($this->resource->caldav_data) ); DAVResource.php: $locale = (isset($c->current_locale) ? $c->current_locale : ''); DAVResource.php: if ( isset($this->locale) && $this->locale != '' ) $locale = $this->locale; DAVResource.php: $reply->NSElement($prop, $tag, $locale ); DAVResource.php: case 'DAV::acl-restrictions': DAVResource.php: $reply->NSElement($prop, $tag, array( new XMLElement('grant-only'), new XMLElement('no-invert') ) ); DAVResource.php: case 'DAV::inherited-acl-set': DAVResource.php: if ( ! $this->_is_collection ) { DAVResource.php: $inherited_acls[] = $reply->href(ConstructURL($this->collection->dav_name)); DAVResource.php: $reply->NSElement($prop, $tag, $inherited_acls ); DAVResource.php: // After a careful reading of RFC3744 we see that this must be the principal-URL of the owner DAVResource.php: $owner_url = ( isset($this->_is_binding) && $this->_is_binding ? $this->collection->bind_owner_url : $this->principal_url() ); DAVResource.php: $reply->DAVElement( $prop, 'owner', $reply->href( $owner_url ) ); DAVResource.php: case 'DAV::alternate-URI-set': DAVResource.php: $reply->NSElement($prop, $tag ); DAVResource.php: if ( $this->_is_collection ) return false; DAVResource.php: $reply->NSElement($prop, $tag, $this->unique_tag() ); DAVResource.php: if ( ! $this->_is_collection ) return false; DAVResource.php: $reply->NSElement($prop, $tag, $this->unique_tag() ); DAVResource.php: case 'http://calendarserver.org/ns/:calendar-proxy-read-for': DAVResource.php: case 'http://calendarserver.org/ns/:calendar-proxy-write-for': DAVResource.php: $reply->CalendarserverElement($prop, 'calendar-proxy-'.$proxy_type.'-for', $reply->href( $this->principal->ProxyFor($proxy_type) ) ); DAVResource.php: case 'DAV::current-user-privilege-set': DAVResource.php: //if ( $this->HavePrivilegeTo('DAV::read-current-user-privilege-set') ) { DAVResource.php: $reply->NSElement($prop, $tag, $this->BuildPrivileges() ); DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-data': DAVResource.php: if ( ! $this->IsCalendar() && ! $this->IsSchedulingCollection() ) return false; DAVResource.php: $reply->NSElement($prop, $tag, 'text/calendar' ); DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set': DAVResource.php: if ( ! $this->_is_collection ) return false; DAVResource.php: if ( $this->IsCalendar() ) DAVResource.php: else if ( $this->IsSchedulingCollection() ) DAVResource.php: $components[] = $reply->NewXMLElement( 'comp', '', array('name' => $v), 'urn:ietf:params:xml:ns:caldav'); DAVResource.php: $reply->CalDAVElement($prop, 'supported-calendar-component-set', $components ); DAVResource.php: case 'DAV::supported-method-set': DAVResource.php: $prop->NewElement('supported-method-set', $this->BuildSupportedMethods() ); DAVResource.php: case 'DAV::supported-report-set': DAVResource.php: $prop->NewElement('supported-report-set', $this->BuildSupportedReports( $reply ) ); DAVResource.php: $prop->NewElement('supportedlock', DAVResource.php: case 'DAV::supported-privilege-set': DAVResource.php: $prop->NewElement('supported-privilege-set', $request->BuildSupportedPrivileges($reply) ); DAVResource.php: case 'DAV::current-user-principal': DAVResource.php: $prop->NewElement('current-user-principal', $reply->href( $request->principal->principal_url ) ); DAVResource.php: case 'SOME-DENIED-PROPERTY': /** @todo indicating the style for future expansion */ DAVResource.php: $denied[] = $reply->Tag($tag); DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:calendar-timezone': DAVResource.php: if ( ! $this->_is_collection ) return false; DAVResource.php: if ( !isset($this->collection->tz_spec) || $this->collection->tz_spec == '' ) return false; DAVResource.php: $cal->VCalendar(); DAVResource.php: $cal->AddComponent( new iCalComponent($this->collection->tz_spec) ); DAVResource.php: $reply->NSElement($prop, $tag, $cal->Render() ); DAVResource.php: case 'urn:ietf:params:xml:ns:carddav:address-data': DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:calendar-data': DAVResource.php: if ( $this->_is_collection ) return false; DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); DAVResource.php: $reply->NSElement($prop, $tag, $this->resource->caldav_data ); DAVResource.php: case 'urn:ietf:params:xml:ns:carddav:max-resource-size': DAVResource.php: if ( ! $this->_is_collection || !$this->_is_addressbook ) return false; DAVResource.php: $reply->NSElement($prop, $tag, 65500 ); DAVResource.php: case 'urn:ietf:params:xml:ns:carddav:supported-address-data': DAVResource.php: if ( ! $this->_is_collection || !$this->_is_addressbook ) return false; DAVResource.php: $address_data = $reply->NewXMLElement( 'address-data', false, DAVResource.php: array( 'content-type' => 'text/vcard', 'version' => '3.0'), 'urn:ietf:params:xml:ns:carddav'); DAVResource.php: $reply->NSElement($prop, $tag, $address_data ); DAVResource.php: if ( $this->HavePrivilegeTo('DAV::read-acl') ) { DAVResource.php: $reply->NSElement($prop, $tag, $this->GetACL( $reply ) ); DAVResource.php: $reply->NSElement($prop,'http://www.xythos.com/namespaces/StorageServer:ticketdiscovery', $this->BuildTicketinfo($reply) ); DAVResource.php: $property_value = $this->GetProperty(preg_replace('{^.*:}', '', $tag)); DAVResource.php: $reply->NSElement($prop, $tag, $property_value ); DAVResource.php: if ( !isset($this->dead_properties) ) $this->FetchDeadProperties(); DAVResource.php: if ( isset($this->dead_properties[$tag]) ) { DAVResource.php: $reply->NSElement($prop, $tag, $this->dead_properties[$tag] ); DAVResource.php:// dbg_error_log( 'DAVResource', 'Request for unsupported property "%s" of path "%s".', $tag, $this->dav_name ); DAVResource.php: dbg_error_log('DAVResource',':GetPropStat: propstat for href "%s"', $this->dav_name ); DAVResource.php: $tag = $tag->GetTag(); DAVResource.php: $found = $this->ResourceProperty($tag, $prop, $reply, $denied ); DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); DAVResource.php: $found = $this->principal->PrincipalProperty( $tag, $prop, $reply, $denied ); DAVResource.php:// dbg_error_log( 'DAVResource', 'Request for unsupported property "%s" of resource "%s".', $tag, $this->dav_name ); DAVResource.php: $not_found[] = $reply->Tag($tag); DAVResource.php: $reply->NSElement($noprop, $v); DAVResource.php: $noprop->NewElement($v); DAVResource.php: dbg_error_log('DAVResource',':RenderAsXML: Resource "%s" exists(%d)', $this->dav_name, $this->Exists() ); DAVResource.php: if ( !$this->Exists() ) return null; DAVResource.php: $elements = $this->GetPropStat( $properties, $reply ); DAVResource.php: $dav_name = str_replace( $this->parent_path(), $bound_parent_path, $this->dav_name ); DAVResource.php: $dav_name = $this->dav_name; DAVResource.php: array_unshift( $elements, $reply->href(ConstructURL($dav_name))); DAVTicket.php: $this->dav_name = null; DAVTicket.php: $this->target_collection_id = null; DAVTicket.php: $this->target_resource_id = null; DAVTicket.php: $this->expiry = null; DAVTicket.php: $this->expired = true; DAVTicket.php: $this->dav_owner_id = null; DAVTicket.php: $this->ticket_id = $ticket_id; DAVTicket.php: $this->privileges = 0; DAVTicket.php: $this->grantor_collection_privileges = 0; DAVTicket.php: array(':ticket_id' => $ticket_id, ':scan_depth' => $c->permission_scan_depth) DAVTicket.php: if ( $qry->Exec('DAVTicket',__LINE__,__FILE__) && $qry->rows() == 1 && $t = $qry->Fetch() ) { DAVTicket.php: if ( ! $t->expired ) { DAVTicket.php: $this->{$k} = $v; DAVTicket.php: $this->expired = false; DAVTicket.php: $this->privileges = bindec($this->privileges); DAVTicket.php: $this->grantor_collection_privileges = bindec($this->grantor_collection_privileges); DAVTicket.php: dbg_error_log( 'DAVTicket', 'Found a current ticket for "%s"', implode(', ',bits_to_privilege($this->privileges())) ); DAVTicket.php: dbg_error_log( 'DAVTicket', 'Found an expired ticket: %s - %s', $ticket_id, $t->expires ); DAVTicket.php: if ( isset($this->target_resource_id) ) { DAVTicket.php: $qry = new AwlQuery( 'SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id', array(':dav_id' => $this->target_resource_id ) ); DAVTicket.php: if ( $qry->Exec('DAVTicket',__LINE__,__FILE__) && $qry->rows() == 1 && $r = $qry->Fetch() ) { DAVTicket.php: $this->dav_name = $r->dav_name; DAVTicket.php: return $this->dav_name; DAVTicket.php: return $this->ticket_id; DAVTicket.php: return ($this->privileges & $this->grantor_collection_privileges); DAVTicket.php: $length = strlen($this->dav_name); DAVTicket.php: return (substr($test_path, 0, $length) == $this->dav_name); DAVTicket.php: return ($test_resource_id == $this->target_collection_id || $test_resource_id == $this->target_resource_id); drivers_ldap.php:require_once("auth-functions.php"); drivers_ldap.php: /**#@-*/ drivers_ldap.php: $this->__construct($config); drivers_ldap.php: $c->messages[] = i18n("drivers_ldap : function ldap_connect not defined, check your php_ldap module"); drivers_ldap.php: $this->valid=false; drivers_ldap.php: ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, $config['protocolVersion']); drivers_ldap.php: ldap_set_option($this->connect, LDAP_OPT_REFERRALS, $config['optReferrals']); drivers_ldap.php: $this->connect=ldap_connect($host, $port); drivers_ldap.php: $this->connect=ldap_connect($host); drivers_ldap.php: if (! $this->connect){ drivers_ldap.php: $c->messages[] = sprintf(translate( 'drivers_ldap : Unable to connect to LDAP with port %s on host %s'), $port, $host ); drivers_ldap.php: $this->valid=false; drivers_ldap.php: if (!ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, 3)) { drivers_ldap.php: $c->messages[] = i18n('drivers_ldap : Failed to set LDAP to use protocol version 3, TLS not supported'); drivers_ldap.php: $this->valid=false; drivers_ldap.php: if (!ldap_start_tls($this->connect)) { drivers_ldap.php: $c->messages[] = i18n('drivers_ldap : Could not start TLS: ldap_start_tls() failed'); drivers_ldap.php: $this->valid=false; drivers_ldap.php: $this->ldap_query_one = 'ldap_read'; drivers_ldap.php: $this->ldap_query_all = 'ldap_read'; drivers_ldap.php: $this->ldap_query_one = 'ldap_list'; drivers_ldap.php: $this->ldap_query_all = 'ldap_search'; drivers_ldap.php: $this->ldap_query_one = 'ldap_search'; drivers_ldap.php: $this->ldap_query_all = 'ldap_search'; drivers_ldap.php: if (!ldap_bind($this->connect, (isset($config['bindDN']) ? $config['bindDN'] : null), (isset($config['passDN']) ? $config['passDN'] : null) ) ){ drivers_ldap.php: $c->messages[] = i18n( 'drivers_ldap : Unable to bind to LDAP - check your configuration for bindDN and passDN, and that your LDAP server is reachable'); drivers_ldap.php: $this->valid=false; drivers_ldap.php: $this->valid = true; drivers_ldap.php: $this->baseDNUsers = is_string($config['baseDNUsers']) ? array($config['baseDNUsers']) : $config['baseDNUsers']; drivers_ldap.php: $this->filterUsers = (isset($config['filterUsers']) ? $config['filterUsers'] : null); drivers_ldap.php: $this->baseDNGroups = is_string($config['baseDNGroups']) ? array($config['baseDNGroups']) : $config['baseDNGroups']; drivers_ldap.php: $this->filterGroups = (isset($config['filterGroups']) ? $config['filterGroups'] : null); drivers_ldap.php: $host=$c->authenticate_hook['config']['host']; drivers_ldap.php: $port=$c->authenticate_hook['config']['port']; drivers_ldap.php: $c->messages[] = i18n("drivers_ldap : function ldap_connect not defined, check your php_ldap module"); drivers_ldap.php: $this->valid=false; drivers_ldap.php: $c->messages[] = sprintf(i18n( "drivers_ldap : Unable to connect to LDAP with port %s on host %s"), $port,$host ); drivers_ldap.php: $this->valid=false; drivers_ldap.php: $baseDNUsers = $c->authenticate_hook['config']['baseDNUsers']; drivers_ldap.php: $query = $this->ldap_query_all; drivers_ldap.php: foreach($this->baseDNGroups as $baseDNGroups) { drivers_ldap.php: $entry = $query($this->connect,$baseDNGroups,$this->filterGroups,$attributes); drivers_ldap.php: if (!ldap_first_entry($this->connect,$entry)) { drivers_ldap.php: $c->messages[] = sprintf(translate('Error NoGroupFound with filter >%s<, attributes >%s< , dn >%s<'), drivers_ldap.php: $this->filterGroups, drivers_ldap.php: for($i = ldap_first_entry($this->connect,$entry); drivers_ldap.php: $i && $arr = ldap_get_attributes($this->connect,$i); drivers_ldap.php: $i = ldap_next_entry($this->connect,$i) ) { drivers_ldap.php: $query = $this->ldap_query_one; drivers_ldap.php: foreach($this->baseDNUsers as $baseDNUsers) { drivers_ldap.php: $entry = $query($this->connect, $baseDNUsers, $filter, $attributes); drivers_ldap.php: if (ldap_first_entry($this->connect,$entry) ) drivers_ldap.php: if ( !ldap_first_entry($this->connect, $entry) ){ drivers_ldap.php: $dnUser = ldap_get_dn($this->connect, ldap_first_entry($this->connect,$entry)); drivers_ldap.php: if ( isset($c->authenticate_hook['config']['i_use_mode_kerberos']) && $c->authenticate_hook['config']['i_use_mode_kerberos'] == "i_know_what_i_am_doing") { drivers_ldap.php: if ( !@ldap_bind($this->connect, $dnUser, $passwd) ) { drivers_ldap.php: $i = ldap_first_entry($this->connect,$entry); drivers_ldap.php: $arr = ldap_get_attributes($this->connect,$i); drivers_ldap.php: $ldapDrivers =& new ldapDrivers($c->authenticate_hook['config']); drivers_ldap.php: if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value']) ) { drivers_ldap.php: foreach ( $c->authenticate_hook['config']['default_value'] as $field => $value ) { drivers_ldap.php: $usr->{$field} = $value; drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from configured defaults", $field, $value ); drivers_ldap.php: $usr->{$field} = $ldap_values[$value]; drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$value], $value ); drivers_ldap.php: if ( !$ldapDriver->valid ) { drivers_ldap.php: $mapping = $c->authenticate_hook['config']['mapping_field']; drivers_ldap.php: if ( preg_match( '/^\(/', $ldapDriver->filterUsers ) ) { drivers_ldap.php: $filter_munge = $ldapDriver->filterUsers; drivers_ldap.php: else if ( isset($ldapDriver->filterUsers) && $ldapDriver->filterUsers != '' ) { drivers_ldap.php: $filter_munge = "($ldapDriver->filterUsers)"; drivers_ldap.php: $valid = $ldapDriver->requestUser( $filter, $attributes, $username, $password ); drivers_ldap.php: foreach($c->authenticate_hook['config']['format_updated'] as $k => $v) drivers_ldap.php: $valid[$mapping["updated"]] = "$Y-$m-$d $H:$M:$S"; drivers_ldap.php: $db_timestamp = $usr->updated; drivers_ldap.php: $db_timestamp = substr(strtr($db_timestamp, array(':' => '',' '=>'','-'=>'')),0,14); drivers_ldap.php: if($ldapDriver->valid){ drivers_ldap.php: $mapping = $c->authenticate_hook['config']['group_mapping_field']; drivers_ldap.php: $ldap_groups_tmp = $ldapDriver->getAllGroups($attributes); drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); drivers_ldap.php: while($db_group = $qry->Fetch()) { drivers_ldap.php: $db_groups[$db_group->group_name] = $db_group->group_name; drivers_ldap.php: $db_group_members[$db_group->group_name][] = $db_group->member_name; drivers_ldap.php: $c->messages[] = sprintf(i18n('- creating groups : %s'),join(', ',$groups_to_create)); drivers_ldap.php: if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value']) ) { drivers_ldap.php: foreach ( $c->authenticate_hook['config']['default_value'] as $field => $value ) { drivers_ldap.php: $usr->{$field} = $value; drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from configured defaults", $field, $value ); drivers_ldap.php: $user->user_no = 0; drivers_ldap.php: $user->{$field} = $ldap_values[$value]; drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$value], $value ); drivers_ldap.php: if ($user->fullname=="") { drivers_ldap.php: $user->fullname = $group; drivers_ldap.php: if ($user->displayname=="") { drivers_ldap.php: $user->displayname = $group; drivers_ldap.php: $user->username = $group; drivers_ldap.php: $user->updated = "now"; /** @todo Use the 'updated' timestamp from LDAP for groups too */ drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); drivers_ldap.php: $c->messages[] = sprintf(i18n('- adding users %s to group : %s'),join(',',$ldap_groups_info[$group][$mapping['members']]),$group); drivers_ldap.php: $qry->Exec('sync_LDAP_groups',__LINE__,__FILE__); drivers_ldap.php: $c->messages[] = sprintf(i18n('- updating groups : %s'),join(', ',$groups_to_update)); drivers_ldap.php: $c->messages[] = sprintf(i18n('- adding %s to group : %s'),join(', ', $add_users ), $group); drivers_ldap.php: $qry->Exec('sync_LDAP_groups',__LINE__,__FILE__); drivers_ldap.php: $c->messages[] = sprintf(i18n('- removing %s from group : %s'),join(', ', $remove_users ), $group); drivers_ldap.php: $qry->Exec('sync_LDAP_groups',__LINE__,__FILE__); drivers_ldap.php: $c->messages[] = sprintf(i18n('- deactivate groups : %s'),join(', ',$groups_to_deactivate)); drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); drivers_ldap.php: if($ldapDriver->valid){ drivers_ldap.php: $mapping = $c->authenticate_hook['config']['mapping_field']; drivers_ldap.php: $ldap_users_tmp = $ldapDriver->getAllUsers($attributes); drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); drivers_ldap.php: while($db_user = $qry->Fetch()) { drivers_ldap.php: $db_users[] = $db_user->username; drivers_ldap.php: $db_users_info[$db_user->username] = array('user_no' => $db_user->user_no, 'updated' => $db_user->updated); drivers_ldap.php: $c->messages[] = sprintf(i18n('- creating record for users : %s'),join(', ',$users_to_create)); drivers_ldap.php: foreach($c->authenticate_hook['config']['format_updated'] as $k => $v) drivers_ldap.php: $valid[$mapping["updated"]] = "$Y-$m-$d $H:$M:$S"; drivers_ldap.php: if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) continue; drivers_ldap.php: $c->messages[] = sprintf(i18n('- deactivating users : %s'),join(', ',$users_to_deactivate)); drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); drivers_ldap.php: foreach($c->authenticate_hook['config']['format_updated'] as $k => $v) drivers_ldap.php: $valid[$mapping["updated"]] = "$Y-$m-$d $H:$M:$S"; drivers_ldap.php: $db_timestamp = substr(strtr($db_users_info[$username]['updated'], array(':' => '',' '=>'','-'=>'')),0,14); drivers_ldap.php: $c->messages[] = sprintf(i18n('- updating user records : %s'),join(', ',$users_to_update)); drivers_ldap.php: $c->messages[] = sprintf(i18n('- nothing done on : %s'),join(', ', $users_nothing_done)); drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); drivers_ldap.php: while($db_user = $qry->Fetch()) { drivers_ldap.php: $admins = $db_user->admins; drivers_ldap.php: $c->messages[] = sprintf(i18n('Warning: there are no active admin users, you should fix this before logging out.')); drivers_pwauth_pam.php:require_once("auth-functions.php"); drivers_pwauth_pam.php: /**#@-*/ drivers_pwauth_pam.php: $this->__construct($config); drivers_pwauth_pam.php: $c->messages[] = drivers_pwauth_pam.php: $this->valid=false; drivers_pwauth_pam.php: $program = $c->authenticate_hook['config']['path']; drivers_pwauth_pam.php: $email_base = $c->authenticate_hook['config']['email_base']; drivers_squid_pam.php:require_once("auth-functions.php"); drivers_squid_pam.php: /**#@-*/ drivers_squid_pam.php: $this->__construct($config); drivers_squid_pam.php: $c->messages[] = sprintf(i18n( 'drivers_squid_pam : Unable to find %s file'), $config ); drivers_squid_pam.php: $this->valid=false; drivers_squid_pam.php: $cmd = "echo '" . $username . "' '" . $password . "' | " . $c->authenticate_hook['config']['script'] . " -n common-auth"; drivers_squid_pam.php: 'email' => $username . "@" . $c->authenticate_hook['config']['email_base'], freebusy-functions.php:include_once('RRule-v2.php'); freebusy-functions.php: //if ( !isset($bin_privs) ) $bin_privs = $request->Privileges(); freebusy-functions.php: $request->DoResponse( 400, 'All valid freebusy requests MUST contain a time-range filter' ); freebusy-functions.php: $request->DoResponse( 501, 'Database error'); freebusy-functions.php: // $params = array( ':path_match' => $path_match, ':start' => $range_start->UTC(), ':end' => $range_end->UTC() ); freebusy-functions.php: // if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= ' ORDER BY dav_id'; freebusy-functions.php: // if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows() > 0 ) { freebusy-functions.php: // while( $calendar_object = $qry->Fetch() ) { freebusy-functions.php: // if ( $calendar_object->status == 'TENTATIVE' ) { freebusy-functions.php: // $extra = ';BUSY-TENTATIVE'; freebusy-functions.php: // dbg_error_log( "REPORT", " FreeBusy: Not transparent, tentative or cancelled: %s, %s", $calendar_object->start, $calendar_object->finish ); freebusy-functions.php: // $ics = new vComponent($calendar_object->caldav_data); freebusy-functions.php: // $expansion = $expanded->GetComponents( array('VEVENT'=>true,'VTODO'=>true,'VJOURNAL'=>true) ); freebusy-functions.php:// printf( "Type: %s\n", $v->GetType()); freebusy-functions.php:// echo "-----------------------------------------------------\n"; freebusy-functions.php: // $start_date = $v->GetProperty('DTSTART'); freebusy-functions.php: // $start_date = new RepeatRuleDateTime($start_date->Value()); freebusy-functions.php: // $duration = $v->GetProperty('DURATION'); freebusy-functions.php: // $duration = ( !isset($duration) ? 'P1D' : $duration->Value()); freebusy-functions.php: // $end_date->modify( $duration ); freebusy-functions.php: // $thisfb = $start_date->UTC() .'/'. $end_date->UTC() . $extra; freebusy-functions.php: if ( $qry->Exec("POST",__LINE__,__FILE__) && $qry->rows() > 0 ) { freebusy-functions.php: while( $calendar_object = $qry->Fetch() ) { freebusy-functions.php: if ( $calendar_object->is_public == 1 ) { freebusy-functions.php: if ( $calendar_object->cal_status == 'A' ) { freebusy-functions.php: elseif ( $calendar_object->cal_status == 'U' ) { freebusy-functions.php: $extra = ';BUSY-UNAVAILABLE'; freebusy-functions.php: elseif ( $calendar_object->cal_status == 'T' ) { freebusy-functions.php: $extra = ';BUSY-TENTATIVE'; freebusy-functions.php: switch ( $calendar_object->cal_type ) { freebusy-functions.php: dbg_error_log( "POST", " FreeBusy: nao recorrente: %s, %s", $calendar_object->datetime, $calendar_object->edatetime ); freebusy-functions.php: $DT_START = $dateTime->format("U"); freebusy-functions.php: $DT_END = $dateTime_end->format("U"); freebusy-functions.php: if ( $calendar_object->datetime >= $DT_START && $calendar_object->edatetime <= $DT_END) freebusy-functions.php: $busydate_s = dataSegundosParaT($calendar_object->datetime,1); freebusy-functions.php: $busydate_e = dataSegundosParaT($calendar_object->edatetime,1); freebusy-functions.php: $busydate_s = dataSegundosParaT($calendar_object->datetime,1); freebusy-functions.php: $busydate_e = dataSegundosParaT($calendar_object->edatetime,1); freebusy-functions.php: dbg_error_log( "POST", " FreeBusy: recorrente: %s, %s", $calendar_object->datetime, $calendar_object->edatetime ); freebusy-functions.php: $DT_START = $dateTime->format("U"); freebusy-functions.php: $DT_END = $dateTime_end->format("U"); freebusy-functions.php: $hora_extra = $dateTime->format("G") * 3600; freebusy-functions.php: $difer = $calendar_object->edatetime - $calendar_object->datetime; freebusy-functions.php: $qryp = new PgQuery( "SELECT * from phpgw_cal_repeats where cal_id = ? ", $calendar_object->cal_id); freebusy-functions.php: if ( $qryp->Exec("POST",__LINE__,__FILE__) && $qryp->rows > 0 ) { freebusy-functions.php: $calendar_repeats = $qryp->Fetch(); freebusy-functions.php: if ( $calendar_repeats->recur_enddate >= $DT_START && $calendar_repeats->recur_enddate <= $DT_END ) freebusy-functions.php: { $next_cal = date_create($calendar_object->datetime); freebusy-functions.php: $data_diferencial =$DT_START - $calendar_object->datetime; freebusy-functions.php: // while ($data_incrementa <= $calendar_repeats->recur_enddate) freebusy-functions.php: $intervalo = ($calendar_repeats->recur_interval == 0) ? "1" : "$calendar_repeats->recur_interval"; freebusy-functions.php: switch ( $calendar_repeats->recur_type ) freebusy-functions.php: $data_incrementa = $DT_START - $soma; freebusy-functions.php: while ($data_incrementa <= $calendar_repeats->recur_enddate) freebusy-functions.php: $data_incrementa = $DT_START - $soma; freebusy-functions.php: while ($data_incrementa <= $calendar_repeats->recur_enddate) freebusy-functions.php: $difer_semana = $DT_START - $data_incrementa; freebusy-functions.php: $semana = str_split(converte_semana($calendar_repeats->recur_data)); freebusy-functions.php: $week = $dia_semana->format("w") + 1; freebusy-functions.php: $diferenca = $semana[$i] - $week; freebusy-functions.php: $data_incrementa = $calendar_object->datetime; freebusy-functions.php: while ($data_incrementa <= $calendar_repeats->recur_enddate) freebusy-functions.php: $dias_mes = $mes_data->format("t"); freebusy-functions.php: $dias_mes = $mes_data->format("t"); freebusy-functions.php: $i--; freebusy-functions.php: $obj_mes = dataSegundosParaT($calendar_object->datetime,1); freebusy-functions.php: $mes = $data_mes->format("m"); freebusy-functions.php: $ano = $data_mes->format("Y"); freebusy-functions.php: // $semana_mes = $data_mes->format("W") - $dia_primeiro->format("W"); freebusy-functions.php: $difer_semana = $calendar_object->datetime - $dia_primeiro->format("U"); freebusy-functions.php: $dia_semana = $data_mes->format("D"); freebusy-functions.php: $final = "-1 week $dia_semana"; freebusy-functions.php: $data_incrementa = $calendar_object->datetime; freebusy-functions.php: $obj_mes = dataSegundosParaT($calendar_object->datetime,1); freebusy-functions.php: $mes = $date_mes->format("m"); freebusy-functions.php: $ano = $date_mes->format("Y"); freebusy-functions.php: $dia = $date_mes->format("d"); freebusy-functions.php: $hora = $date_mes->format("G"); freebusy-functions.php: $minuto = $date_mes->format("i"); freebusy-functions.php: $data_incrementa = $calendar_object->datetime ; freebusy-functions.php: while ($data_incrementa <= $calendar_repeats->recur_enddate) freebusy-functions.php: $data_incrementa = date("U",strtotime("$ano-$mes-$dia +1 year")); freebusy-functions.php: { if ( $calendar_repeats->recur_enddate >= $DT_START || $calendar_repeats->recur_enddate == 0 ) freebusy-functions.php: {$next_cal = date_create($calendar_object->datetime); freebusy-functions.php: $data_diferencial =$DT_START - $calendar_object->datetime; freebusy-functions.php: // while ($data_incrementa <= $calendar_repeats->recur_enddate) freebusy-functions.php: $intervalo = ($calendar_repeats->recur_interval == 0) ? "1" : "$calendar_repeats->recur_interval"; freebusy-functions.php: switch ( $calendar_repeats->recur_type ) freebusy-functions.php: //$hora_extra = $dateTime->format("G") * 3600; freebusy-functions.php: $data_incrementa = $DT_START - $soma; freebusy-functions.php: $data_incrementa = $DT_START - $soma; freebusy-functions.php: $difer_semana = $DT_START - $data_incrementa; freebusy-functions.php: $semana = str_split(converte_semana($calendar_repeats->recur_data)); freebusy-functions.php: $week = $dia_semana->format("w") + 1; freebusy-functions.php: $diferenca = $semana[$i] - $week; freebusy-functions.php: $data_incrementa = $calendar_object->datetime; freebusy-functions.php: $dias_mes = $mes_data->format("t"); freebusy-functions.php: $dias_mes = $mes_data->format("t"); freebusy-functions.php: $i--; freebusy-functions.php: $obj_mes = dataSegundosParaT($calendar_object->datetime,1); freebusy-functions.php: $mes = $data_mes->format("m"); freebusy-functions.php: $ano = $data_mes->format("Y"); freebusy-functions.php: //$semana_mes = $data_mes->format("W") - $dia_primeiro->format("W"); freebusy-functions.php: $difer_semana = $calendar_object->datetime - $dia_primeiro->format("U"); freebusy-functions.php: $dia_semana = $data_mes->format("D"); freebusy-functions.php: $final = "-1 week $dia_semana"; freebusy-functions.php: $data_incrementa = $calendar_object->datetime; freebusy-functions.php: $obj_mes = dataSegundosParaT($calendar_object->datetime,1); freebusy-functions.php: $mes = $date_mes->format("m"); freebusy-functions.php: $ano = $date_mes->format("Y"); freebusy-functions.php: $dia = $date_mes->format("d"); freebusy-functions.php: $hora = $date_mes->format("G"); freebusy-functions.php: $minuto = $date_mes->format("i"); freebusy-functions.php: $data_incrementa = $calendar_object->datetime ; freebusy-functions.php: $data_incrementa = date("U",strtotime("$ano-$mes-$dia +1 year")); freebusy-functions.php: $i--; freebusy-functions.php: // dbg_error_log( "POST", " FreeBusy: Not transparent, tentative or cancelled: %s, %s", $calendar_object->start, $calendar_object->finish ); freebusy-functions.php: $freebusy->SetType('VFREEBUSY'); freebusy-functions.php: $freebusy->AddProperty('DTSTAMP', date('Ymd\THis\Z')); freebusy-functions.php: $freebusy->AddProperty('DTSTART', $range_start->UTC()); freebusy-functions.php: $freebusy->AddProperty('DTEND', $range_end->UTC()); freebusy-functions.php: $freebusy->AddProperty( 'FREEBUSY', $text[0], (isset($text[1]) ? array('FBTYPE' => $text[1]) : null) ); freebusy-functions.php: $teste = getdate($dataseg - $HorarioTimeZone->getoffset($HorarioTime)); freebusy-functions.php: //$nova = substr($retorna, 0, -1); HTTPAuthSession.php: * User e-mail HTTPAuthSession.php: /**#@-*/ HTTPAuthSession.php: if ( isset($c->http_auth_mode) && $c->http_auth_mode == "Digest" ) { HTTPAuthSession.php: $this->DigestAuthSession(); HTTPAuthSession.php: $this->BasicAuthSession(); HTTPAuthSession.php: * @param string $auth_header The WWW-Authenticate header details. HTTPAuthSession.php: $auth_header = sprintf( 'WWW-Authenticate: Basic realm="%s"', $c->system_name); HTTPAuthSession.php: header('Content-type: text/plain; ; charset="utf-8"' ); HTTPAuthSession.php: else if ( isset($c->authenticate_hook['server_auth_type']) && $c->authenticate_hook['server_auth_type'] == $_SERVER['AUTH_TYPE'] HTTPAuthSession.php: if ( ! isset($c->authenticate_hook['call']) ) { HTTPAuthSession.php: $c->authenticate_hook['call'] = 'auth_external'; HTTPAuthSession.php: if ( $u = $this->CheckPassword( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) { HTTPAuthSession.php: $this->AssignSessionDetails($u); HTTPAuthSession.php: if ( isset($c->allow_unauthenticated) && $c->allow_unauthenticated ) { HTTPAuthSession.php: $this->user_no = -1; HTTPAuthSession.php: $this->username = 'guest'; HTTPAuthSession.php: $this->fullname = 'Unauthenticated User'; HTTPAuthSession.php: $this->email = 'invalid'; HTTPAuthSession.php: $this->AuthFailedResponse(); HTTPAuthSession.php: if ( $data = $this->ParseDigestHeader($_SERVER['PHP_AUTH_DIGEST']) ) { HTTPAuthSession.php: $A1 = md5($data['username'] . ':' . $c->system_name . ':' . $user_password); HTTPAuthSession.php: $this->AssignSessionDetails($u); HTTPAuthSession.php: $opaque = md5($c->system_name); HTTPAuthSession.php: $this->AuthFailedResponse( sprintf('WWW-Authenticate: Digest realm="%s", qop="auth,auth-int", nonce="%s", opaque="%s"', $c->system_name, $nonce, $opaque ) ); HTTPAuthSession.php: * - largely sourced from the PHP documentation HTTPAuthSession.php: if ( isset($c->authenticate_hook) && isset($c->authenticate_hook['call']) && function_exists($c->authenticate_hook['call']) ) { HTTPAuthSession.php: * - Accept a username / password HTTPAuthSession.php: * - Confirm the username / password are correct HTTPAuthSession.php: * - Create (or update) a 'usr' record in our database HTTPAuthSession.php: * - Return the 'usr' record as an object HTTPAuthSession.php: * - Return === false when authentication fails HTTPAuthSession.php: * - Configuration data will be in $c->authenticate_hook['config'], which might be an array, or whatever is needed. HTTPAuthSession.php: $hook_response = call_user_func( $c->authenticate_hook['call'], $username, $password ); HTTPAuthSession.php: if (isset($c->authenticate_hook['optional']) && $c->authenticate_hook['optional']) { HTTPAuthSession.php: dbg_error_log( "BasicAuth", ":CheckPassword: Name:%s, Pass:%s, File:%s, Active:%s", $username, $password, $usr->password, ($usr->active?'Yes':'No') ); HTTPAuthSession.php: if ( $usr->active && session_validate_password( $password, $usr->password ) ) { HTTPAuthSession.php: return ( isset($this->logged_in) && $this->logged_in && isset($this->roles[$whatever]) && $this->roles[$whatever] ); HTTPAuthSession.php: $this->roles = array(); HTTPAuthSession.php: array( ':user_no' => $this->user_no) ); HTTPAuthSession.php: if ( $qry->Exec('BasicAuth') && $qry->rows() > 0 ) { HTTPAuthSession.php: while( $role = $qry->Fetch() ) { HTTPAuthSession.php: $this->roles[$role->role_name] = true; HTTPAuthSession.php: if ( !isset($u->principal_id) ) { HTTPAuthSession.php: // If they don't have a principal_id set then we should re-read from our local database HTTPAuthSession.php: $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $u->username) ); HTTPAuthSession.php: if ( $qry->Exec() && $qry->rows() == 1 ) { HTTPAuthSession.php: $u = $qry->Fetch(); HTTPAuthSession.php: $this->{$k} = $v; HTTPAuthSession.php: $this->GetRoles(); HTTPAuthSession.php: $this->logged_in = true; HTTPAuthSession.php: if ( function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "" ) { HTTPAuthSession.php: awl_set_locale($this->locale); interactive-page.php:$home_menu->AddOption(translate('Logout'), $c->base_url.'/index.php?logout', translate('Log out of DAViCal') ); interactive-page.php:$help_menu->AddOption(translate('DAViCal Homepage'),'http://www.davical.org/',translate('The DAViCal Home Page'), false, 6000, true ); interactive-page.php:$help_menu->AddOption(translate('DAViCal Wiki'),'http://wiki.davical.org/'.$wiki_help,translate('Visit the DAViCal Wiki'), false, 7000, true ); interactive-page.php:$help_menu->AddOption(translate('Request Feature'),'http://davical.uservoice.com/',translate('Go to the DAViCal Feature Requests'), false, 8000, true ); interactive-page.php:$help_menu->AddOption(translate('Report Bug'),'http://sourceforge.net/tracker/?func=add&group_id=179845&atid=890785',translate('Report a bug in the system'), false, 9000, true ); interactive-page.php:$user_menu->AddOption(translate('View My Details'),$c->base_url.'/admin.php?action=edit&t=principal&id='.$session->principal_id,translate('View my own principal record')); interactive-page.php:$user_menu->AddOption(translate('List Users'),$c->base_url.'/admin.php?action=browse&t=principal&type=1'); interactive-page.php:$user_menu->AddOption(translate('List Resources'),$c->base_url.'/admin.php?action=browse&t=principal&type=2'); interactive-page.php:$user_menu->AddOption(translate('List Groups'),$c->base_url.'/admin.php?action=browse&t=principal&type=3'); interactive-page.php:if ( $session->AllowedTo('Admin' )) { interactive-page.php: $admin_menu->AddOption(translate('Setup'),$c->base_url.'/setup.php',translate('Setup DAViCal') ); interactive-page.php: $admin_menu->AddOption(translate('Upgrade Database'),$c->base_url.'/upgrade.php',translate('Upgrade DAViCal database schema') ); interactive-page.php: $admin_menu->AddOption(translate('Import Calendars'),$c->base_url.'/tools.php',translate('Operations on your calendar') ); interactive-page.php: $user_menu->AddOption(translate('Inactive Principals'),$c->base_url.'/admin.php?action=browse&t=principal&active=f'); interactive-page.php: $user_menu->AddOption(translate('Create Principal'),$c->base_url.'/admin.php?action=edit&t=principal',translate('Create a new principal (i.e. a new user, resource or group)')); interactive-page.php:$main_menu->AddSubMenu($home_menu, translate('Home'), $c->base_url.'/index.php', translate('Home Page'), false, 1000); interactive-page.php:$main_menu->AddSubMenu($user_menu, translate('User Functions'), $c->base_url.'/admin.php?action=browse&t=principal&type=1', translate('Browse all users'), false, 2000); interactive-page.php:$main_menu->AddSubMenu($admin_menu, translate('Administration'), $c->base_url.'/index.php', translate('Administration'), false, 3000); interactive-page.php:$main_menu->AddSubMenu($help_menu, translate('Help'), $c->base_url.'/help.php',translate('Help on the current screen'), false, 9000); iSchedule.php:* - verifying Domain Key signatures iSchedule.php:* - delivering remote scheduling requests to local users inboxes iSchedule.php:* - Utility functions which we can use to decide whether this iSchedule.php: $this->selector = 'cal'; iSchedule.php: if ( is_object ( $c ) && isset ( $c->scheduling_dkim_selector ) ) iSchedule.php: $this->scheduling_dkim_selector = $c->scheduling_dkim_selector ; iSchedule.php: $dkim = dns_get_record ( $this->remote_selector . '._domainkey.' . $this->remote_server , DNS_TXT ); iSchedule.php: $this->dk = $dkim [ 0 ] [ 'txt' ]; iSchedule.php: $this->failed = true; iSchedule.php: if ( $this->failed == true ) iSchedule.php: $clean = preg_replace ( '/[\s\t]*([;=])[\s\t]*/', '$1', $this->dk ); iSchedule.php: $this->parsed = array(); iSchedule.php: $this->parsed [ $key ] = $value; iSchedule.php: $this->parsed_ignored [ $key ] = $value; iSchedule.php: $this->failed = true; iSchedule.php: if ( isset ( $this->parsed [ 's' ] ) ) iSchedule.php: if ( ! preg_match ( '/(\*|calendar)/', $this->parsed [ 's' ] ) ) iSchedule.php: if ( isset ( $this->parsed [ 'k' ] ) && $this->parsed [ 'k' ] != 'rsa' ) iSchedule.php: if ( isset ( $this->parsed [ 't' ] ) && ! preg_match ( '/^[y:s]+$/', $this->parsed [ 't' ] ) ) iSchedule.php: if ( preg_match ( '/y/', $this->parsed [ 't' ] ) ) iSchedule.php: $this->failOnError = false; iSchedule.php: if ( preg_match ( '/s/', $this->parsed [ 't' ] ) ) iSchedule.php: $this->subdomainsOK = false; iSchedule.php: if ( isset ( $this->parsed [ 'g' ] ) ) iSchedule.php: $this->remote_user_rule = $this->parsed [ 'g' ]; iSchedule.php: if ( isset ( $this->parsed [ 'p' ] ) ) iSchedule.php: $data = "-----BEGIN PUBLIC KEY-----\n" . implode ("\n",str_split ( preg_replace ( '/_/', '', $this->parsed [ 'p' ] ), 64 )) . "\n-----END PUBLIC KEY-----"; iSchedule.php: $this->remote_public_key = $data; iSchedule.php: $this->failed = false; iSchedule.php: $this->remote_ssl = false; iSchedule.php: $r = dns_get_record ( '_ischedules._tcp.' . $this->domain , DNS_SRV ); iSchedule.php: $this->remote_ssl = true; iSchedule.php: $r = dns_get_record ( '_ischedule._tcp.' . $this->domain , DNS_SRV ); iSchedule.php: elseif ( $this->try_anyway == true ) iSchedule.php: $remote_server = $this->domain; iSchedule.php: $this->remote_server = $remote_server; iSchedule.php: $this->remote_port = $remote_port; iSchedule.php: $remote_capabilities = file_get_contents ( 'http'. ( $this->remote_ssl ? 's' : '' ) . '://' . iSchedule.php: $this->remote_server . ':' . $this->remote_port . iSchedule.php: '/.well-known/ischedule?query=capabilities' ); iSchedule.php: $xmltree = BuildXMLTree( $request->xml_tags, $position); iSchedule.php: $request->DoResponse( 406, translate("REPORT body is not valid XML data!") ); iSchedule.php: $dk['s'] = $this->selector; iSchedule.php: $dk['d'] = $this->domain; iSchedule.php: $dk['c'] = 'simple-http'; iSchedule.php: //a=rsa-sha1; d=caveman.name; s=cal; c=simple-http; q=dns/txt; h=Originator:Recipient:Host:Content-Type; b iSchedule.php: * @param string $sig the value of the DKIM-Signature header iSchedule.php: $this->failed = true; iSchedule.php: // the canonicalization method is currently undefined as of draft-01 of the iSchedule spec iSchedule.php: // but it does define the value, it should be simple-http. RFC4871 also defines two methods iSchedule.php: if ( ! preg_match ( '{(simple|simple-http|relaxed)(/(simple|simple-http|relaxed))?}', $dkim['c'], $matches ) ) // canonicalization method iSchedule.php: $this->body_cannon = $matches[2]; iSchedule.php: $this->body_cannon = $matches[1]; iSchedule.php: $this->header_cannon = $matches[1]; iSchedule.php: if ( $dkim['a'] != 'rsa-sha1' && $dkim['a'] != 'rsa-sha256' ) iSchedule.php: $this->remote_server = $dkim['d']; iSchedule.php: $this->remote_user = substr ( $dkim [ 'i' ], 0, strpos ( $dkim [ 'i' ], '@' ) - 1 ); iSchedule.php: $this->remote_selector = $dkim['s']; iSchedule.php: $this->signed_headers = preg_split ( '/:/', $dkim['h'] ); iSchedule.php: foreach ( $this->signed_headers as $h ) iSchedule.php: if ( ( ! isset ( $_SERVER['HTTP_' . strtr ( strtoupper ( $h ), '-', '_' ) ] ) && iSchedule.php: ! isset ( $_SERVER[ strtr ( strtoupper ( $h ), '-', '_' ) ] ) ) iSchedule.php: || strtolower ( $h ) == 'dkim-signature' ) iSchedule.php: $this->signed_length = $dkim['l']; iSchedule.php: $this->failed = false; iSchedule.php: $this->DKSig = $dkim; iSchedule.php: $this->remote_user = $matches[1]; iSchedule.php: $this->domain = $matches[2]; iSchedule.php: $this->failed = true; iSchedule.php: foreach ( $this->signed_headers as $h ) iSchedule.php: if ( isset ( $_SERVER['HTTP_' . strtoupper ( strtr ( $h, '-', '_' ) ) ] ) ) iSchedule.php: $signed .= "$h: " . $_SERVER['HTTP_' . strtoupper ( strtr ( $h, '-', '_' ) ) ] . "\n"; iSchedule.php: $signed .= "$h: " . $_SERVER[ strtoupper ( strtr ( $h, '-', '_' ) ) ] . "\n"; iSchedule.php: $body = $request->raw_post; iSchedule.php: if ( ! isset ( $this->signed_length ) ) iSchedule.php: $this->signed_length = strlen ( $body ); iSchedule.php: $body = substr ( $body, 0, $this->signed_length ); iSchedule.php: if ( isset ( $this->remote_user_rule ) ) iSchedule.php: if ( $this->remote_user_rule != '*' && ! stristr ( $this->remote_user, $this->remote_user_rule ) ) iSchedule.php: $body_hash = base64_encode ( hash ( preg_replace ( '/^.*(sha[1256]+).*/','$1', $this->DKSig['a'] ), $body , true ) ); iSchedule.php: if ( $this->DKSig['bh'] != $body_hash ) iSchedule.php: $signed .= 'DKIM-Signature: ' . $sig; iSchedule.php: $verify = openssl_verify ( $signed, base64_decode ( $this->DKSig['b'] ), $this->remote_public_key ); iSchedule.php: $this->failed = false; iSchedule.php: $request->DoResponse( 403, translate('DKIM signature missing') ); iSchedule.php: $err = $this->parseDKIM ( $sig ); iSchedule.php: if ( $err !== true || $this->failed ) iSchedule.php: $request->DoResponse( 403, translate('DKIM signature invalid ' ) . "\n" . $err . "\n" . $sig ); iSchedule.php: if ( ! $this->getTxt () || $this->failed ) iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(DNS ERROR)') ); iSchedule.php: if ( ! $this->parseTxt () || $this->failed ) iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(KEY Parse ERROR)') ); iSchedule.php: if ( ! $this->validateKey () || $this->failed ) iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(KEY Validation ERROR)') ); iSchedule.php: if ( ! $this->verifySignature () || $this->failed ) iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(Signature verification ERROR)') . $this->verifySignature() ); iSchedule.php:if ( $d->validateRequest ( ) ) iSchedule.php: include ( 'caldav-POST.php' ); log_caldav_action.php: if ( !isset($c->action_log_name) ) { log_caldav_action.php: $logfile = fopen( $c->action_log_name, "a+" ); other_translated_strings.php:i18n("Admin "); other_translated_strings.php:i18n("Group "); other_translated_strings.php:i18n("Public "); other_translated_strings.php:i18n("Resource "); other_translated_strings.php:i18n("No. "); other_translated_strings.php:i18n("No "); other_translated_strings.php:i18n("Id "); other_translated_strings.php:i18n("forget me not "); page-footer.php: if ( isset($c->scripts) && is_array($c->scripts) ) { page-footer.php: foreach ( $c->scripts AS $script ) { page-footer.php: if ( isset($c->dbg['statistics']) && $c->dbg['statistics'] ) { page-footer.php: $script_time = microtime(true) - $c->script_start_time; page-footer.php: $_SERVER['REQUEST_METHOD'], 200, $script_time, $c->total_query_time, $_SERVER['REQUEST_URI']); page-header.php:if ( !isset($c->page_title) ) { page-header.php: $c->page_title = translate('DAViCal CalDAV Server'); page-header.php: if ( $GLOBALS['session']->AllowedTo('Admin') || $GLOBALS['session']->AllowedTo('Support') ) { page-header.php: return ' ['.$display_url.'] '; page-header.php: header( 'Content-type: text/html; charset="utf-8"' ); page-header.php: echo ''; page-header.php: page-header.php:$c->page_title page-header.php: foreach ( $c->stylesheets AS $stylesheet ) { page-header.php: if ( isset($c->local_styles) ) { page-header.php: foreach ( $c->local_styles AS $stylesheet ) { page-header.php: if ( isset($c->print_styles) ) { page-header.php: foreach ( $c->print_styles AS $stylesheet ) { page-header.php: if ( isset($main_menu) ) echo $main_menu->RenderAsCSS(); page-header.php: if ( isset($related_menu) && $related_menu->Size() > 0 ) { page-header.php: echo $related_menu->Render( true ); page-header.php: if ( isset($c->messages) && is_array($c->messages) && count($c->messages) > 0 ) { page-header.php: foreach( $c->messages AS $i => $msg ) { Privileges:always.php.in:$c->script_start_time = microtime(true); Privileges:always.php.in:// An ultra-simple exception handler to catch errors that occur Privileges:always.php.in: echo "Uncaught early exception: ", $e->getMessage(), "\nAt line ", $e->getLine(), " of ", $e->getFile(), "\n"; Privileges:always.php.in: $trace = array_reverse($e->getTrace()); Privileges:always.php.in:$c->sysabbr = 'davical'; Privileges:always.php.in:$c->admin_email = 'admin@davical.example.com'; Privileges:always.php.in:$c->system_name = 'DAViCal CalDAV Server'; Privileges:always.php.in:$c->domain_name = (isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:$_SERVER['SERVER_ADDR']); Privileges:always.php.in:$c->save_time_zone_defs = true; Privileges:always.php.in:$c->collections_always_exist = false; Privileges:always.php.in:$c->allow_get_email_visibility = false; Privileges:always.php.in:$c->permission_scan_depth = 2; Privileges:always.php.in:$c->expand_pdo_parameters = true; Privileges:always.php.in:$c->home_calendar_name = 'home'; Privileges:always.php.in:$c->enable_row_linking = true; Privileges:always.php.in:$c->enable_scheduling = false; Privileges:always.php.in:$c->http_auth_mode = 'Basic'; Privileges:always.php.in:// $c->default_locale = array('es_MX', 'es_AR', 'es', 'pt'); // An array of locales to try, or just a single locale Privileges:always.php.in:// $c->local_tzid = 'Pacific/Auckland'; // Perhaps we should read from /etc/timezone - I wonder how standard that is? Privileges:always.php.in:$c->default_locale = 'en'; Privileges:always.php.in:$c->locale_path = '../locale'; Privileges:always.php.in:$c->base_url = preg_replace('#/[^/]+\.php.*$#', '', $_SERVER['SCRIPT_NAME']); Privileges:always.php.in:$c->base_directory = preg_replace('#/[^/]*$#', '', $_SERVER['DOCUMENT_ROOT']); Privileges:always.php.in:$c->default_privileges = array('read-free-busy', 'schedule-deliver'); Privileges:always.php.in:$c->stylesheets = array( $c->base_url.'/davical.css' ); Privileges:always.php.in:$c->images = $c->base_url . '/images'; Privileges:always.php.in:$c->template_usr = array( 'active' => true, Privileges:always.php.in: 'email_ok' => date('Y-m-d') Privileges:always.php.in:$c->hide_TODO = true; // VTODO only visible to collection owner Privileges:always.php.in:$c->readonly_webdav_collections = true; // WebDAV access is readonly Privileges:always.php.in:$c->total_query_time = 0; Privileges:always.php.in:$c->dbg = array(); Privileges:always.php.in: @dbg_error_log( 'WARN', "Your webserver is not setting the SERVER_NAME parameter. You may need to set \$c->domain_name in your configuration. Using IP address meanhwhile..." ); Privileges:always.php.in:$c->protocol_server_port = sprintf( '%s://%s%s', Privileges:always.php.in:$c->protocol_server_port_script = $c->protocol_server_port . ($_SERVER['SCRIPT_NAME'] == '/index.php' ? '' : $_SERVER['SCRIPT_NAME']); Privileges:always.php.in:if ( @file_exists('/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php') ) { Privileges:always.php.in: include('/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php'); Privileges:always.php.in:else if ( @file_exists('/usr/local/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php') ) { Privileges:always.php.in: include('/usr/local/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php'); Privileges:always.php.in:if ( !isset($c->page_title) ) $c->page_title = $c->system_name; Privileges:always.php.in:else if ( isset($c->dbg['script_start']) && $c->dbg['script_start'] ) { Privileges:always.php.in: $_SERVER['REQUEST_METHOD'], $c->protocol_server_port_script, $_SERVER['PATH_INFO'], $c->base_url, $c->base_directory ); Privileges:always.php.in:putenv("LANG=". $c->default_locale); Privileges:always.php.in:awl_set_locale($c->default_locale); Privileges:always.php.in:init_gettext( 'davical', $c->locale_path ); Privileges:always.php.in:$c->code_version = 0; Privileges:always.php.in:$c->version_string = '0.9.8.3'; // The actual version # is replaced into that during the build /release process Privileges:always.php.in:if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->version_string, $matches) ) { Privileges:always.php.in: $c->code_major = $matches[1]; Privileges:always.php.in: $c->code_minor = $matches[2]; Privileges:always.php.in: $c->code_patch = $matches[3]; Privileges:always.php.in: $c->code_version = (($c->code_major * 1000) + $c->code_minor).'.'.$c->code_patch; Privileges:always.php.in: dbg_error_log('caldav', 'Version (%d.%d.%d) == %s', $c->code_major, $c->code_minor, $c->code_patch, $c->code_version); Privileges:always.php.in: header( sprintf('Server: %d.%d', $c->code_major, $c->code_minor) ); Privileges:always.php.in:$_SERVER['SERVER_NAME'] = $c->domain_name; Privileges:always.php.in:$c->want_dbversion = array(1,2,8); Privileges:always.php.in:$c->schema_version = 0; Privileges:always.php.in:if ( $qry->Exec('always',__LINE__,__FILE__) && $row = $qry->Fetch() ) { Privileges:always.php.in: $c->schema_version = doubleval( sprintf( '%d%03d.%03d', $row->schema_major, $row->schema_minor, $row->schema_patch) ); Privileges:always.php.in: $c->wanted_version = doubleval( sprintf( '%d%03d.%03d', $c->want_dbversion[0], $c->want_dbversion[1], $c->want_dbversion[2]) ); Privileges:always.php.in: $c->schema_major = $row->schema_major; Privileges:always.php.in: $c->schema_minor = $row->schema_minor; Privileges:always.php.in: $c->schema_patch = $row->schema_patch; Privileges:always.php.in: if ( $c->schema_version < $c->wanted_version ) { Privileges:always.php.in: $c->messages[] = sprintf( 'Database schema needs upgrading. Current: %d.%d.%d, Desired: %d.%d.%d', Privileges:always.php.in: $row->schema_major, $row->schema_minor, $row->schema_patch, $c->want_dbversion[0], $c->want_dbversion[1], $c->want_dbversion[2]); Privileges:always.php.in: if ( isset($_SERVER['HTTP_X_DAVICAL_TESTCASE']) ) $qry->QDo('SET TIMEZONE TO \'Pacific/Auckland\''); Privileges:always.php.in: if ( isset($session->principal_id) ) { Privileges:always.php.in: $params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:always.php.in: if ( $qry->Exec('always',__LINE__,__FILE__) && $qry->rows() == 1 && $row = $qry->Fetch() ) { Privileges:always.php.in: if ( isset($session->principal_id) ) { Privileges:always.php.in: $_known_users_name[$row->username] = $row; Privileges:always.php.in: $_known_users_id[$row->user_no] = $row; Privileges:always.php.in: $_known_users_pid[$row->principal_id] = $row; Privileges:always.php.in:* Return a user record identified by e-mail address, caching it for any subsequent lookup Privileges:always.php.in: /** We don't actually maintain a cache-access by e-mail, since it's rare */ Privileges:always.php.in: if ( strtolower($email) == strtolower($v->email) ) return $v; Privileges:always.php.in: case 203: $ans = 'Non-Authoritative Information'; break; Privileges:always.php.in: case 207: $ans = 'Multi-Status'; break; Privileges:always.php.in: case 414: $ans = 'Request-URI Too Long'; break; Privileges:always.php.in: if ( ! isset($c->_url_script_path) ) { Privileges:always.php.in: $c->_url_script_path = (preg_match('#/$#', $c->protocol_server_port_script) ? 'caldav.php' : ''); Privileges:always.php.in: $c->_url_script_path = $c->protocol_server_port_script . $c->_url_script_path; Privileges:always.php.in: $url = $c->_url_script_path; Privileges:always.php.in: if ( !isset($c->deconstruction_base_path) ) $c->deconstruction_base_path = ConstructURL('/'); Privileges:always.php.in: if ( preg_match( '%^(.*?)'.str_replace('%', '\\%',$c->deconstruction_base_path).'(.*)$%', $dav_name, $matches ) ) { Privileges:always.php.in: if ( $matches[1] == '' || $matches[1] == $c->protocol_server_port ) { Privileges:always.php.in: case 'write-properties' : $out_priv |= 2; break; Privileges:always.php.in: case 'write-content' : $out_priv |= 4; break; Privileges:always.php.in: case 'read-acl' : $out_priv |= 16; break; Privileges:always.php.in: case 'read-current-user-privilege-set' : $out_priv |= 32; break; Privileges:always.php.in: case 'write-acl' : $out_priv |= 256; break; Privileges:always.php.in: case 'read-free-busy' : $out_priv |= 512; break; Privileges:always.php.in: case 'schedule-deliver-invite' : $out_priv |= 1024; break; Privileges:always.php.in: case 'schedule-deliver-reply' : $out_priv |= 2048; break; Privileges:always.php.in: case 'schedule-query-freebusy' : $out_priv |= 4096; break; Privileges:always.php.in: case 'schedule-send-invite' : $out_priv |= 8192; break; Privileges:always.php.in: case 'schedule-send-reply' : $out_priv |= 16384; break; Privileges:always.php.in: case 'schedule-send-freebusy' : $out_priv |= 32768; break; Privileges:always.php.in: case 'schedule-deliver' : $out_priv |= 7168; break; // 1024 + 2048 + 4096 Privileges:always.php.in: case 'schedule-send' : $out_priv |= 57344; break; // 8192 + 16384 + 32768 Privileges:always.php.in: if ( ($out_priv & DAVICAL_MAXPRIV) >= DAVICAL_MAXPRIV ) $out_priv = pow(2,24) - 1; Privileges:always.php.in: if ( ($raw_bits & 16) != 0 ) $out_priv[] = 'DAV::read-acl'; Privileges:always.php.in: if ( ($raw_bits & 32) != 0 ) $out_priv[] = 'DAV::read-current-user-privilege-set'; Privileges:always.php.in: if ( ($raw_bits & 256) != 0 ) $out_priv[] = 'DAV::write-acl'; Privileges:always.php.in: if ( ($resourcetype == 'calendar' || $resourcetype == 'proxy') && ($raw_bits & 512) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:read-free-busy'; Privileges:always.php.in: if ( ($raw_bits & 2) != 0 ) $out_priv[] = 'DAV::write-properties'; Privileges:always.php.in: if ( ($raw_bits & 4) != 0 ) $out_priv[] = 'DAV::write-content'; Privileges:always.php.in: if ( $resourcetype == 'schedule-inbox' && ($raw_bits & 7168) != 0 ) { Privileges:always.php.in: if ( ($raw_bits & 7168) == 7168 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-deliver'; Privileges:always.php.in: if ( ($raw_bits & 1024) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-deliver-invite'; Privileges:always.php.in: if ( ($raw_bits & 2048) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-deliver-reply'; Privileges:always.php.in: if ( ($raw_bits & 4096) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-query-freebusy'; Privileges:always.php.in: if ( $resourcetype == 'schedule-outbox' && ($raw_bits & 57344) != 0 ) { Privileges:always.php.in: if ( ($raw_bits & 57344) == 57344 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send'; Privileges:always.php.in: if ( ($raw_bits & 8192) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send-invite'; Privileges:always.php.in: if ( ($raw_bits & 16384) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send-reply'; Privileges:always.php.in: if ( ($raw_bits & 32768) != 0 ) $out_priv[] = 'urn:ietf:params:xml:ns:caldav:schedule-send-freebusy'; Privileges:always.php.in: $xmldoc->NSElement($privilege,$k); Privileges:always.php.in: $privilege->NewElement($k); Privileges:auth-functions.php:* - Accept a username / password Privileges:auth-functions.php:* - Confirm the username / password are correct Privileges:auth-functions.php:* - Create (or update) a 'usr' record in our database Privileges:auth-functions.php:* - Return the 'usr' record as an object Privileges:auth-functions.php:* - Return === false when authentication fails Privileges:auth-functions.php:* - Configuration data will be in $c->authenticate_hook['config'], which might be an array, or whatever is needed. Privileges:auth-functions.php:* - This file should be included Privileges:auth-functions.php:* - $c->authenticate_hook['call'] should be set to the name of the plugin Privileges:auth-functions.php:* - $c->authenticate_hook['config'] should be set up with any configuration data for the plugin Privileges:auth-functions.php: if ( ! isset($c->home_calendar_name) || strlen($c->home_calendar_name) == 0 ) return true; Privileges:auth-functions.php: //$calendar_path = $parent_path . $c->home_calendar_name."/"; Privileges:auth-functions.php: $dav_etag = md5($usr->user_no . $calendar_path); Privileges:auth-functions.php: ':user_no' => $usr->user_no, Privileges:auth-functions.php: ':displayname' => $usr->fullname, Privileges:auth-functions.php: if ( $qry->Exec() ) { Privileges:auth-functions.php: $c->messages[] = i18n("Home calendar added."); Privileges:auth-functions.php: $c->messages[] = i18n("There was an error writing to the database."); Privileges:auth-functions.php: if ( !isset($usr->user_no) || intval($usr->user_no) == 0 ) { Privileges:auth-functions.php: $qry->Exec('Login',__LINE__,__FILE__); Privileges:auth-functions.php: $sequence_value = $qry->Fetch(true); // Fetch as an array Privileges:auth-functions.php: $usr->user_no = $sequence_value[0]; Privileges:auth-functions.php: $qry = new AwlQuery('SELECT * FROM usr WHERE user_no = :user_no', array(':user_no' => $usr->user_no) ); Privileges:auth-functions.php: if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) { Privileges:auth-functions.php: if ( $old = $qry->Fetch() ) { Privileges:auth-functions.php: if ( $old->{$k} != $v ) { Privileges:auth-functions.php: dbg_error_log("Login","User '%s' field '%s' changed from '%s' to '%s'", $usr->username, $k, $old->{$k}, $v ); Privileges:auth-functions.php: dbg_error_log("Login","No changes to user record for '%s' - leaving as-is.", $usr->username ); Privileges:auth-functions.php: if ( isset($usr->active) && $usr->active == 'f' ) return false; Privileges:auth-functions.php: dbg_error_log("Login","Changes to user record for '%s' - updating.", $usr->username ); Privileges:auth-functions.php: if ( $type != 'INSERT' ) $params[':user_no'] = $usr->user_no; Privileges:auth-functions.php: $qry->Exec('Login',__LINE__,__FILE__); Privileges:auth-functions.php: if ( isset($usr->active) && ($usr->active === 'f' || $usr->active === false) ) return false; Privileges:auth-functions.php: array( ':privs' => privilege_to_bits($c->default_privileges), ':username' => $usr->username) ); Privileges:auth-functions.php: $qry->Exec('Login',__LINE__,__FILE__); Privileges:auth-functions.php: CreateHomeCalendar($usr->username); Privileges:auth-functions.php:* require_once('auth-functions.php'); Privileges:auth-functions.php:* $c->authenticate_hook = array( Privileges:auth-functions.php: $persistent = isset($c->authenticate_hook['config']['use_persistent']) && $c->authenticate_hook['config']['use_persistent']; Privileges:auth-functions.php: if ( isset($c->authenticate_hook['config']['columns']) ) Privileges:auth-functions.php: $cols = $c->authenticate_hook['config']['columns']; Privileges:auth-functions.php: if ( isset($c->authenticate_hook['config']['where']) ) Privileges:auth-functions.php: $andwhere = ' AND '.$c->authenticate_hook['config']['where']; Privileges:auth-functions.php: $authconn = $qry->SetConnection($c->authenticate_hook['config']['connection'], ($persistent ? array(PDO::ATTR_PERSISTENT => true) : null)); Privileges:auth-functions.php: if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) { Privileges:auth-functions.php: $usr = $qry->Fetch(); Privileges:auth-functions.php: if ( session_validate_password( $password, $usr->password ) ) { Privileges:auth-functions.php: if ( isset($usr->active) && $usr->active == 'f' ) return false; Privileges:auth-functions.php: $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $usr->username) ); Privileges:auth-functions.php: if ( $qry->Exec() && $qry->rows() == 1 ) { Privileges:auth-functions.php: $principal = $qry->Fetch(); Privileges:caldav-ACL.php:* CalDAV Server - handle ACL method Privileges:caldav-ACL.php:$request->NeedPrivilege('DAV::write-acl'); Privileges:caldav-ACL.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { Privileges:caldav-ACL.php: fwrite($fh,$request->raw_post); Privileges:caldav-ACL.php:$resource = new DAVResource( $request->path ); Privileges:caldav-ACL.php: (DAV:no-ace-conflict): The ACEs submitted in the ACL request MUST NOT Privileges:caldav-ACL.php: that an implementation-specific ACL restriction has been violated. Privileges:caldav-ACL.php: (DAV:no-protected-ace-conflict): The ACEs submitted in the ACL Privileges:caldav-ACL.php: (DAV:no-inherited-ace-conflict): The ACEs submitted in the ACL Privileges:caldav-ACL.php: implementation-dependent. Implementations MUST either report this Privileges:caldav-ACL.php: (DAV:limited-number-of-aces): The number of ACEs submitted in the ACL Privileges:caldav-ACL.php: However, ACL-compliant servers MUST support at least one ACE granting Privileges:caldav-ACL.php: (DAV:deny-before-grant): All non-inherited deny ACEs MUST precede all Privileges:caldav-ACL.php: non-inherited grant ACEs. Privileges:caldav-ACL.php: (DAV:grant-only): The ACEs submitted in the ACL request MUST NOT Privileges:caldav-ACL.php: restrictions of the resource include the DAV:grant-only constraint Privileges:caldav-ACL.php: (DAV:no-invert): The ACL request MUST NOT include a DAV:invert Privileges:caldav-ACL.php: the resource includes the DAV:no-invert constraint (defined in Privileges:caldav-ACL.php: (DAV:no-abstract): The ACL request MUST NOT attempt to grant or deny Privileges:caldav-ACL.php: (DAV:not-supported-privilege): The ACEs submitted in the ACL request Privileges:caldav-ACL.php: (DAV:missing-required-principal): The result of the ACL request MUST Privileges:caldav-ACL.php: DAV:required-principal XML element in the ACL semantics of that Privileges:caldav-ACL.php: (DAV:recognized-principal): Every principal URL in the ACL request Privileges:caldav-ACL.php: (DAV:allowed-principal): The principals specified in the ACEs Privileges:caldav-ACL.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-ACL.php:$aces = $xmltree->GetPath("/DAV::acl/*"); Privileges:caldav-ACL.php:$grantor = new DAVResource($request->path); Privileges:caldav-ACL.php:if ( ! $grantor->Exists() ) $request->DoResponse( 404 ); Privileges:caldav-ACL.php:if ( $grantor->IsPrincipal() ) $by_principal = $grantor->GetProperty('principal_id'); Privileges:caldav-ACL.php:else if ( $grantor->IsCollection() ) $by_collection = $grantor->GetProperty('collection_id'); Privileges:caldav-ACL.php:else $request->PreconditionFailed(403,'not-supported-privilege','ACLs may only be applied to Principals or Collections'); Privileges:caldav-ACL.php:$qry->Exec('ACL',__LINE__,__FILE__); Privileges:caldav-ACL.php: $elements = $ace->GetContent(); Privileges:caldav-ACL.php: if ( $principal->GetTag() != 'DAV::principal' ) $request->MalformedRequest('ACL request must contain a principal, not '.$principal->GetTag()); Privileges:caldav-ACL.php: $grant_tag = $grant->GetTag(); Privileges:caldav-ACL.php: if ( $grant_tag == 'DAV::deny' ) $request->PreconditionFailed(403,'grant-only'); Privileges:caldav-ACL.php: if ( $grant_tag == 'DAV::invert' ) $request->PreconditionFailed(403,'no-invert'); Privileges:caldav-ACL.php: if ( $grant->GetTag() != 'DAV::grant' ) $request->MalformedRequest('ACL request must contain a principal for each ACE'); Privileges:caldav-ACL.php: $xml_privs = $grant->GetPath("/DAV::grant/DAV::privilege/*"); Privileges:caldav-ACL.php: $privilege_names[] = $priv->GetTag(); Privileges:caldav-ACL.php: $principal_content = $principal->GetContent(); Privileges:caldav-ACL.php: if ( count($principal_content) != 1 ) $request->MalformedRequest('ACL request must contain exactly one principal per ACE'); Privileges:caldav-ACL.php: switch( $principal_content->GetTag() ) { Privileges:caldav-ACL.php: $principal_property = $principal_content->GetContent(); Privileges:caldav-ACL.php: if ( $principal_property[0]->GetTag() != 'DAV::owner' ) $request->PreconditionFailed(403, 'recognized-principal' ); Privileges:caldav-ACL.php: $request->PreconditionFailed(403, 'no-protected-ace-conflict', 'Owner must always have all permissions' ); Privileges:caldav-ACL.php: $request->PreconditionFailed(403, 'allowed-principal', 'May not set privileges for unauthenticated users' ); Privileges:caldav-ACL.php: $principal = new DAVResource( DeconstructURL($principal_content->GetContent()) ); Privileges:caldav-ACL.php: if ( ! $principal->Exists() || !$principal->IsPrincipal() ) Privileges:caldav-ACL.php: $request->PreconditionFailed(403,'recognized-principal', 'Principal "' + $principal_content->GetContent() + '" not found.'); Privileges:caldav-ACL.php: $sqlparms = array( ':to_principal' => $principal->GetProperty('principal_id') ); Privileges:caldav-ACL.php: if ( $qry->Exec('ACL',__LINE__,__FILE__) && $qry->rows() == 1 && $current = $qry->Fetch() ) { Privileges:caldav-ACL.php: $qry->Exec('ACL',__LINE__,__FILE__); Privileges:caldav-ACL.php: if ( bindec($grantor->GetProperty('default_privileges')) == $privileges ) continue; // There is no change, so skip it Privileges:caldav-ACL.php: $qry->Exec('ACL',__LINE__,__FILE__); Privileges:caldav-ACL.php: $request->PreconditionFailed(403, 'allowed-principal', 'May not set privileges for unauthenticated users' ); Privileges:caldav-ACL.php: $request->PreconditionFailed(403, 'recognized-principal' ); Privileges:caldav-ACL.php:$qry->Exec('ACL',__LINE__,__FILE__); Privileges:caldav-ACL.php:$request->DoResponse( 200 ); Privileges:caldav-BIND.php:* CalDAV Server - handle BIND method Privileges:caldav-BIND.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-BIND.php:$request->NeedPrivilege('DAV::bind'); Privileges:caldav-BIND.php:if ( ! $request->IsCollection() ) { Privileges:caldav-BIND.php: $request->PreconditionFailed(403,'DAV::bind-into-collection',translate('The BIND Request-URI MUST identify a collection.')); Privileges:caldav-BIND.php:$parent_container = $request->path; Privileges:caldav-BIND.php:if ( ! $parent->Exists() || $parent->IsSchedulingCollection() ) { Privileges:caldav-BIND.php: $request->PreconditionFailed(403, 'DAV::method-not-allowed',translate('The BIND method is not allowed at that location.') ); Privileges:caldav-BIND.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-BIND.php:$segment = $xmltree->GetElements('DAV::segment'); Privileges:caldav-BIND.php:$segment = $segment[0]->GetContent(); Privileges:caldav-BIND.php: $request->PreconditionFailed(403, 'DAV::name-allowed',translate('That destination name contains invalid characters.') ); Privileges:caldav-BIND.php:$href = $xmltree->GetElements('DAV::href'); Privileges:caldav-BIND.php:$href = $href[0]->GetContent(); Privileges:caldav-BIND.php:if ( $destination->Exists() ) { Privileges:caldav-BIND.php: $request->PreconditionFailed(403,'DAV::can-overwrite',translate('A resource already exists at the destination.')); Privileges:caldav-BIND.php:if ( !$source->Exists() ) { Privileges:caldav-BIND.php: $request->PreconditionFailed(403,'DAV::bind-source-exists',translate('The BIND Request MUST identify an existing resource.')); Privileges:caldav-BIND.php:if ( $source->IsPrincipal() || !$source->IsCollection() ) { Privileges:caldav-BIND.php: $request->PreconditionFailed(403,'DAV::binding-allowed',translate('DAViCal only allows BIND requests for collections at present.')); Privileges:caldav-BIND.php: ':target_id' => $source->GetProperty('collection_id'), Privileges:caldav-BIND.php: ':ticket_id' => (isset($request->ticket) ? $request->ticket->id() : null), Privileges:caldav-BIND.php: ':parent_container' => $parent->dav_name(), Privileges:caldav-BIND.php: ':session_principal' => $session->principal_id, Privileges:caldav-BIND.php: ':displayname' => $source->GetProperty('displayname') Privileges:caldav-BIND.php:if ( $qry->Exec('BIND',__LINE__,__FILE__) ) { Privileges:caldav-BIND.php: $request->DoResponse(201); Privileges:caldav-BIND.php: $request->DoResponse(500,translate('Database Error')); Privileges:caldav-client.php:* removed curl - now using fsockopen Privileges:caldav-client.php:* changed 2009 by Andres Obrero - Switzerland andres@obrero.ch Privileges:caldav-client.php: $this->user = $user; Privileges:caldav-client.php: $this->pass = $pass; Privileges:caldav-client.php: $this->calendar = $calendar; Privileges:caldav-client.php: $this->headers = array(); Privileges:caldav-client.php: if ( preg_match( '#^(https?)://([a-z0-9.-]+)(:([0-9]+))?(/.*)$#', $base_url, $matches ) ) { Privileges:caldav-client.php: $this->server = $matches[2]; Privileges:caldav-client.php: $this->base_url = $matches[5]; Privileges:caldav-client.php: $this->protocol = 'ssl'; Privileges:caldav-client.php: $this->port = 443; Privileges:caldav-client.php: $this->protocol = 'tcp'; Privileges:caldav-client.php: $this->port = 80; Privileges:caldav-client.php: $this->port = intval($matches[4]); Privileges:caldav-client.php: * Adds an If-Match or If-None-Match header Privileges:caldav-client.php: $this->headers[] = sprintf( "%s-Match: %s", ($match ? "If" : "If-None"), $etag); Privileges:caldav-client.php: $this->headers[] = 'Depth: '. ($depth == '1' ? "1" : ($depth == 'infinity' ? $depth : "0") ); Privileges:caldav-client.php: if ( !isset($user_agent) ) $user_agent = $this->user_agent; Privileges:caldav-client.php: $this->user_agent = $user_agent; Privileges:caldav-client.php: * Add a Content-type: header. Privileges:caldav-client.php: $this->headers[] = "Content-type: $type"; Privileges:caldav-client.php: $this->httpResponse = trim($response); Privileges:caldav-client.php: $this->httpResponse = trim(substr($response, 0, $pos)); Privileges:caldav-client.php: $this->xmlResponse = trim(substr($response, $pos)); Privileges:caldav-client.php: return $this->httpRequest; Privileges:caldav-client.php: return $this->httpResponse; Privileges:caldav-client.php: return $this->xmlRequest; Privileges:caldav-client.php: return $this->xmlResponse; Privileges:caldav-client.php: $headers[] = $this->requestMethod." ". $this->base_url . $relative_url . " HTTP/1.1"; Privileges:caldav-client.php: $headers[] = "Authorization: Basic ".base64_encode($this->user .":". $this->pass ); Privileges:caldav-client.php: $headers[] = "Host: ".$this->server .":".$this->port; Privileges:caldav-client.php: foreach( $this->headers as $ii => $head ) { Privileges:caldav-client.php: $headers[] = "Content-Length: " . strlen($this->body); Privileges:caldav-client.php: $headers[] = "User-Agent: " . $this->user_agent; Privileges:caldav-client.php: $this->httpRequest = join("\r\n",$headers); Privileges:caldav-client.php: $this->xmlRequest = $this->body; Privileges:caldav-client.php: $fip = fsockopen( $this->protocol . '://' . $this->server, $this->port, $errno, $errstr, _FSOCK_TIMEOUT); //error handling? Privileges:caldav-client.php: if ( !fwrite($fip, $this->httpRequest."\r\n\r\n".$this->body) ) { fclose($fip); return false; } Privileges:caldav-client.php: $this->headers = array(); // reset the headers array for our next request Privileges:caldav-client.php: $this->ParseResponse($rsp); Privileges:caldav-client.php: $this->requestMethod = "OPTIONS"; Privileges:caldav-client.php: $this->body = ""; Privileges:caldav-client.php: $headers = $this->DoRequest($relative_url); Privileges:caldav-client.php: $options_header = preg_replace( '/^.*Allow: ([a-z, ]+)\r?\n.*/is', '$1', $headers ); Privileges:caldav-client.php: $this->body = $xml; Privileges:caldav-client.php: $this->requestMethod = $request_method; Privileges:caldav-client.php: $this->SetContentType("text/xml"); Privileges:caldav-client.php: return $this->DoRequest($relative_url); Privileges:caldav-client.php: $this->body = ""; Privileges:caldav-client.php: $this->requestMethod = "GET"; Privileges:caldav-client.php: return $this->DoRequest( $relative_url ); Privileges:caldav-client.php: $this->body = $icalendar; Privileges:caldav-client.php: $this->requestMethod = "PUT"; Privileges:caldav-client.php: $this->SetMatch( ($etag != '*'), $etag ); Privileges:caldav-client.php: $this->SetContentType("text/icalendar"); Privileges:caldav-client.php: $headers = $this->DoRequest($relative_url); Privileges:caldav-client.php: $this->body = ""; Privileges:caldav-client.php: $this->requestMethod = "DELETE"; Privileges:caldav-client.php: $this->SetMatch( true, $etag ); Privileges:caldav-client.php: $this->DoRequest($relative_url); Privileges:caldav-client.php: return $this->resultcode; Privileges:caldav-client.php: * @param string $filter XML fragment which is the element of a calendar-query Privileges:caldav-client.php: * be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: $this->DoXMLRequest( 'REPORT', $xml, $relative_url ); Privileges:caldav-client.php: $xml_parser = xml_parser_create_ns('UTF-8'); Privileges:caldav-client.php: $this->xml_tags = array(); Privileges:caldav-client.php: xml_parse_into_struct( $xml_parser, $this->xmlResponse, $this->xml_tags ); Privileges:caldav-client.php: foreach( $this->xml_tags as $k => $v ) { Privileges:caldav-client.php: case 'URN:IETF:PARAMS:XML:NS:CALDAV:CALENDAR-DATA': Privileges:caldav-client.php: $range = ""; Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: return $this->DoCalendarQuery($filter, $relative_url); Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: COMPLETED Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: CANCELLED Privileges:caldav-client.php: $time_range Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: return $this->DoCalendarQuery($filter, $relative_url); Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: $uid Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: Privileges:caldav-client.php: return $this->DoCalendarQuery($filter, $relative_url); Privileges:caldav-client.php: return $this->DoGETRequest( $relative_url . $href ); Privileges:caldav-client.php:* $options = $cal->DoOptionsRequest(); Privileges:caldav-client.php:* $cal->SetDepth(1); Privileges:caldav-client.php:* $folder_xml = $cal->DoXMLRequest("PROPFIND", '' ); Privileges:caldav-client.php:* $events = $cal->GetEvents("20070101T000000Z","20070201T000000Z"); Privileges:caldav-client.php:* $options = $cal->DoOptionsRequest(); Privileges:caldav-client.php:* Privileges:caldav-client.php:* // $cal->SetDepth(1); Privileges:caldav-client.php:* // $folder_xml = $cal->DoXMLRequest("PROPFIND", $xmlC); Privileges:caldav-client.php:* $events = $cal->GetEvents("20090201T000000Z","20090301T000000Z"); Privileges:caldav-client.php:* print "\n---------------------------------------------\n"; Privileges:caldav-client-v2.php:* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LGPL version 3 or later Privileges:caldav-client-v2.php: $this->url = $url; Privileges:caldav-client-v2.php: $this->displayname = $displayname; Privileges:caldav-client-v2.php: $this->getctag = $getctag; Privileges:caldav-client-v2.php: return( '(URL: '.$this->url.' Ctag: '.$this->getctag.' Displayname: '.$this->displayname .')'. "\n" ); Privileges:caldav-client-v2.php: * The principal-URL we're using Privileges:caldav-client-v2.php: * The calendar-URL we're using Privileges:caldav-client-v2.php: * The calendar-home-set we're using Privileges:caldav-client-v2.php: $this->user = $user; Privileges:caldav-client-v2.php: $this->pass = $pass; Privileges:caldav-client-v2.php: $this->headers = array(); Privileges:caldav-client-v2.php: if ( preg_match( '#^(https?)://([a-z0-9.-]+)(:([0-9]+))?(/.*)$#', $base_url, $matches ) ) { Privileges:caldav-client-v2.php: $this->server = $matches[2]; Privileges:caldav-client-v2.php: $this->base_url = $matches[5]; Privileges:caldav-client-v2.php: $this->protocol = 'ssl'; Privileges:caldav-client-v2.php: $this->port = 443; Privileges:caldav-client-v2.php: $this->protocol = 'tcp'; Privileges:caldav-client-v2.php: $this->port = 80; Privileges:caldav-client-v2.php: $this->port = intval($matches[4]); Privileges:caldav-client-v2.php: * Adds an If-Match or If-None-Match header Privileges:caldav-client-v2.php: $this->headers['match'] = sprintf( "%s-Match: %s", ($match ? "If" : "If-None"), $etag); Privileges:caldav-client-v2.php: $this->headers['depth'] = 'Depth: '. ($depth == '1' ? "1" : ($depth == 'infinity' ? $depth : "0") ); Privileges:caldav-client-v2.php: if ( !isset($user_agent) ) $user_agent = $this->user_agent; Privileges:caldav-client-v2.php: $this->user_agent = $user_agent; Privileges:caldav-client-v2.php: * Add a Content-type: header. Privileges:caldav-client-v2.php: $this->headers['content-type'] = "Content-type: $type"; Privileges:caldav-client-v2.php: $this->calendar_url = $url; Privileges:caldav-client-v2.php: $this->httpResponse = trim($response); Privileges:caldav-client-v2.php: $this->httpResponse = trim(substr($response, 0, $pos)); Privileges:caldav-client-v2.php: $this->xmlResponse = trim(substr($response, $pos)); Privileges:caldav-client-v2.php: $this->xmlResponse = preg_replace('{>[^>]*$}s', '>',$this->xmlResponse ); Privileges:caldav-client-v2.php: $parser = xml_parser_create_ns('UTF-8'); Privileges:caldav-client-v2.php: if ( xml_parse_into_struct( $parser, $this->xmlResponse, $this->xmlnodes, $this->xmltags ) === 0 ) { Privileges:caldav-client-v2.php: printf( "XML parsing error: %s - %s\n", xml_get_error_code($parser), xml_error_string(xml_get_error_code($parser)) ); Privileges:caldav-client-v2.php:// echo "\nNodes array............................................................\n"; print_r( $this->xmlnodes ); Privileges:caldav-client-v2.php:// echo "\nTags array............................................................\n"; print_r( $this->xmltags ); Privileges:caldav-client-v2.php: printf( "\nXML Reponse:\n%s\n", $this->xmlResponse ); Privileges:caldav-client-v2.php: return $this->httpRequest; Privileges:caldav-client-v2.php: return $this->httpResponseHeaders; Privileges:caldav-client-v2.php: return $this->httpResponseBody; Privileges:caldav-client-v2.php: return $this->xmlRequest; Privileges:caldav-client-v2.php: return $this->xmlResponse; Privileges:caldav-client-v2.php: if ( !isset($url) ) $url = $this->base_url; Privileges:caldav-client-v2.php: $this->request_url = $url; Privileges:caldav-client-v2.php: if ( preg_match( '{[^%?&=+,.-_/a-z0-9]}', $url ) ) { Privileges:caldav-client-v2.php: $headers[] = $this->requestMethod." ". $url . " HTTP/1.1"; Privileges:caldav-client-v2.php: $headers[] = "Authorization: Basic ".base64_encode($this->user .":". $this->pass ); Privileges:caldav-client-v2.php: $headers[] = "Host: ".$this->server .":".$this->port; Privileges:caldav-client-v2.php: if ( !isset($this->headers['content-type']) ) $this->headers['content-type'] = "Content-type: text/plain"; Privileges:caldav-client-v2.php: foreach( $this->headers as $ii => $head ) { Privileges:caldav-client-v2.php: $headers[] = "Content-Length: " . strlen($this->body); Privileges:caldav-client-v2.php: $headers[] = "User-Agent: " . $this->user_agent; Privileges:caldav-client-v2.php: $this->httpRequest = join("\r\n",$headers); Privileges:caldav-client-v2.php: $this->xmlRequest = $this->body; Privileges:caldav-client-v2.php: $this->httpResponse = ''; Privileges:caldav-client-v2.php: $this->xmlResponse = ''; Privileges:caldav-client-v2.php: $fip = fsockopen( $this->protocol . '://' . $this->server, $this->port, $errno, $errstr, _FSOCK_TIMEOUT); //error handling? Privileges:caldav-client-v2.php: if ( !fwrite($fip, $this->httpRequest."\r\n\r\n".$this->body) ) { fclose($fip); return false; } Privileges:caldav-client-v2.php: list( $this->httpResponseHeaders, $this->httpResponseBody ) = preg_split( '{\r?\n\r?\n}s', $response, 2 ); Privileges:caldav-client-v2.php: if ( preg_match( '{Transfer-Encoding: chunked}i', $this->httpResponseHeaders ) ) $this->Unchunk(); Privileges:caldav-client-v2.php: $this->headers = array(); // reset the headers array for our next request Privileges:caldav-client-v2.php: $this->ParseResponse($this->httpResponseBody); Privileges:caldav-client-v2.php: $chunks = $this->httpResponseBody; Privileges:caldav-client-v2.php: if ( preg_match('{^((\r\n)?\s*([ 0-9a-fA-F]+)(;[^\n]*)?\r?\n)}', $chunks, $matches ) ) { Privileges:caldav-client-v2.php: // printf( "---------------------------------\n%s\n---------------------------------\n", substr($chunks,$pos,$bytes) ); Privileges:caldav-client-v2.php: $this->httpResponseBody = $content; Privileges:caldav-client-v2.php: $this->requestMethod = "OPTIONS"; Privileges:caldav-client-v2.php: $this->body = ""; Privileges:caldav-client-v2.php: $headers = $this->DoRequest($url); Privileges:caldav-client-v2.php: $options_header = preg_replace( '/^.*Allow: ([a-z, ]+)\r?\n.*/is', '$1', $headers ); Privileges:caldav-client-v2.php: $this->body = $xml; Privileges:caldav-client-v2.php: $this->requestMethod = $request_method; Privileges:caldav-client-v2.php: $this->SetContentType("text/xml"); Privileges:caldav-client-v2.php: return $this->DoRequest($url); Privileges:caldav-client-v2.php: $this->body = ""; Privileges:caldav-client-v2.php: $this->requestMethod = "GET"; Privileges:caldav-client-v2.php: return $this->DoRequest( $url ); Privileges:caldav-client-v2.php: $this->body = ""; Privileges:caldav-client-v2.php: $this->requestMethod = "HEAD"; Privileges:caldav-client-v2.php: return $this->DoRequest( $url ); Privileges:caldav-client-v2.php: $this->body = $icalendar; Privileges:caldav-client-v2.php: $this->requestMethod = "PUT"; Privileges:caldav-client-v2.php: $this->SetMatch( ($etag != '*'), $etag ); Privileges:caldav-client-v2.php: $this->SetContentType('text/calendar; encoding="utf-8"'); Privileges:caldav-client-v2.php: $this->DoRequest($url); Privileges:caldav-client-v2.php: if ( preg_match( '{^ETag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1]; Privileges:caldav-client-v2.php: printf( "No etag in:\n%s\n", $this->httpResponseHeaders ); Privileges:caldav-client-v2.php: $save_request = $this->httpRequest; Privileges:caldav-client-v2.php: $save_response_headers = $this->httpResponseHeaders; Privileges:caldav-client-v2.php: $this->DoHEADRequest( $url ); Privileges:caldav-client-v2.php: if ( preg_match( '{^Etag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1]; Privileges:caldav-client-v2.php: printf( "Still No etag in:\n%s\n", $this->httpResponseHeaders ); Privileges:caldav-client-v2.php: $this->httpRequest = $save_request; Privileges:caldav-client-v2.php: $this->httpResponseHeaders = $save_response_headers; Privileges:caldav-client-v2.php: $this->body = ""; Privileges:caldav-client-v2.php: $this->requestMethod = "DELETE"; Privileges:caldav-client-v2.php: $this->SetMatch( true, $etag ); Privileges:caldav-client-v2.php: $this->DoRequest($url); Privileges:caldav-client-v2.php: return $this->resultcode; Privileges:caldav-client-v2.php: $this->SetDepth($depth); Privileges:caldav-client-v2.php: $xml->NSElement($prop,$v); Privileges:caldav-client-v2.php: $this->body = $xml->Render('propfind',$prop ); Privileges:caldav-client-v2.php: $this->requestMethod = "PROPFIND"; Privileges:caldav-client-v2.php: $this->SetContentType("text/xml"); Privileges:caldav-client-v2.php: $this->DoRequest($url); Privileges:caldav-client-v2.php: return $this->GetXmlResponse(); Privileges:caldav-client-v2.php: $this->principal_url = $url; Privileges:caldav-client-v2.php: return $this->principal_url; Privileges:caldav-client-v2.php: * Get/Set the calendar-home-set URL Privileges:caldav-client-v2.php: * @param $url array of string The calendar-home-set URLs to set Privileges:caldav-client-v2.php: $this->calendar_home_set = $urls; Privileges:caldav-client-v2.php: return $this->calendar_home_set; Privileges:caldav-client-v2.php: * Get/Set the calendar-home-set URL Privileges:caldav-client-v2.php: $this->calendar_urls = $urls; Privileges:caldav-client-v2.php: return $this->calendar_urls; Privileges:caldav-client-v2.php: foreach( $this->xmltags[$tagname] AS $k => $v ) { Privileges:caldav-client-v2.php: if ( $this->xmlnodes[$j]['tag'] == 'DAV::href' ) { Privileges:caldav-client-v2.php: return rawurldecode($this->xmlnodes[$j]['value']); Privileges:caldav-client-v2.php: if ( isset($this->xmltags[$tagname]) && isset($this->xmltags[$tagname][$i]) ) { Privileges:caldav-client-v2.php: $j = $this->xmltags[$tagname][$i]; Privileges:caldav-client-v2.php: while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::href' ) { Privileges:caldav-client-v2.php:// printf( "Node[$j]: %s\n", $this->xmlnodes[$j]['tag']); Privileges:caldav-client-v2.php: if ( $this->xmlnodes[$j]['tag'] == 'DAV::status' && $this->xmlnodes[$j]['value'] != 'HTTP/1.1 200 OK' ) return null; Privileges:caldav-client-v2.php:// printf( "Node[$j]: %s\n", $this->xmlnodes[$j]['tag']); Privileges:caldav-client-v2.php: if ( $j > 0 && isset($this->xmlnodes[$j]['value']) ) { Privileges:caldav-client-v2.php:// printf( "Value[$j]: %s\n", $this->xmlnodes[$j]['value']); Privileges:caldav-client-v2.php: return rawurldecode($this->xmlnodes[$j]['value']); Privileges:caldav-client-v2.php: if ( isset($this->xmltags[$tagname]) && isset($this->xmltags[$tagname][$i]) ) { Privileges:caldav-client-v2.php: $j = $this->xmltags[$tagname][$i]; Privileges:caldav-client-v2.php: while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::resourcetype' ); Privileges:caldav-client-v2.php: while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::href' ); Privileges:caldav-client-v2.php: if ( $j > 0 && isset($this->xmlnodes[$j]['value']) ) { Privileges:caldav-client-v2.php: return rawurldecode($this->xmlnodes[$j]['value']); Privileges:caldav-client-v2.php: $level = $this->xmlnodes[$nodenum]['level']; Privileges:caldav-client-v2.php: while ( $this->xmlnodes[++$nodenum]['level'] >= $level ) { Privileges:caldav-client-v2.php: if ( $this->xmlnodes[$nodenum]['tag'] == 'DAV::propstat' ) { Privileges:caldav-client-v2.php: if ( $this->xmlnodes[$nodenum]['type'] == 'open' ) { Privileges:caldav-client-v2.php: elseif ( !isset($this->xmlnodes[$nodenum]) || !is_array($this->xmlnodes[$nodenum]) ) { Privileges:caldav-client-v2.php: elseif ( $this->xmlnodes[$nodenum]['tag'] == 'DAV::status' ) { Privileges:caldav-client-v2.php: $status = $this->xmlnodes[$nodenum]['value']; Privileges:caldav-client-v2.php: $props[] = $this->xmlnodes[$nodenum]; Privileges:caldav-client-v2.php: * @param string $url The URL to find the principal-URL from Privileges:caldav-client-v2.php: $xml = $this->DoPROPFINDRequest( $url, array('resourcetype', 'current-user-principal', 'owner', 'principal-URL', Privileges:caldav-client-v2.php: 'urn:ietf:params:xml:ns:caldav:calendar-home-set'), 1); Privileges:caldav-client-v2.php: $principal_url = $this->HrefForProp('DAV::principal'); Privileges:caldav-client-v2.php: foreach( array('DAV::current-user-principal', 'DAV::principal-URL', 'DAV::owner') AS $href ) { Privileges:caldav-client-v2.php: $principal_url = $this->HrefValueInside($href); Privileges:caldav-client-v2.php: return $this->PrincipalURL($principal_url); Privileges:caldav-client-v2.php: * @param string $url The URL to find the calendar-home-set from Privileges:caldav-client-v2.php: if ( !isset($this->principal_url) ) { Privileges:caldav-client-v2.php: $this->FindPrincipal(); Privileges:caldav-client-v2.php: $this->DoPROPFINDRequest( $this->principal_url, array('urn:ietf:params:xml:ns:caldav:calendar-home-set'), 0); Privileges:caldav-client-v2.php: foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-home-set'] AS $k => $v ) { Privileges:caldav-client-v2.php: if ( $this->xmlnodes[$v]['type'] != 'open' ) continue; Privileges:caldav-client-v2.php: while( $this->xmlnodes[++$v]['type'] != 'close' && $this->xmlnodes[$v]['tag'] != 'urn:ietf:params:xml:ns:caldav:calendar-home-set' ) { Privileges:caldav-client-v2.php:// printf( "Tag: '%s' = '%s'\n", $this->xmlnodes[$v]['tag'], $this->xmlnodes[$v]['value']); Privileges:caldav-client-v2.php: if ( $this->xmlnodes[$v]['tag'] == 'DAV::href' && isset($this->xmlnodes[$v]['value']) ) Privileges:caldav-client-v2.php: $calendar_home[] = rawurldecode($this->xmlnodes[$v]['value']); Privileges:caldav-client-v2.php: $calendar_home = $this->FindCalendarHome(true); Privileges:caldav-client-v2.php: return $this->CalendarHomeSet($calendar_home); Privileges:caldav-client-v2.php: if ( !isset($this->calendar_home_set[0]) ) { Privileges:caldav-client-v2.php: $this->FindCalendarHome(); Privileges:caldav-client-v2.php: $this->DoPROPFINDRequest( $this->calendar_home_set[0], array('resourcetype','displayname','http://calendarserver.org/ns/:getctag'), 1); Privileges:caldav-client-v2.php: if ( isset($this->xmltags['urn:ietf:params:xml:ns:caldav:calendar']) ) { Privileges:caldav-client-v2.php: foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar'] AS $k => $v ) { Privileges:caldav-client-v2.php: $calendar_urls[$this->HrefForProp('urn:ietf:params:xml:ns:caldav:calendar', $k)] = 1; Privileges:caldav-client-v2.php: foreach( $this->xmltags['DAV::href'] AS $i => $hnode ) { Privileges:caldav-client-v2.php: $href = rawurldecode($this->xmlnodes[$hnode]['value']); Privileges:caldav-client-v2.php: $ok_props = $this->GetOKProps($hnode); Privileges:caldav-client-v2.php: $calendar->getctag = $v['value']; Privileges:caldav-client-v2.php: $calendar->displayname = $v['value']; Privileges:caldav-client-v2.php: return $this->CalendarUrls($calendars); Privileges:caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); Privileges:caldav-client-v2.php: $calendar_properties = array( 'resourcetype', 'displayname', 'http://calendarserver.org/ns/:getctag', 'urn:ietf:params:xml:ns:caldav:calendar-timezone', 'supported-report-set' ); Privileges:caldav-client-v2.php: $this->DoPROPFINDRequest( $this->calendar_url, $calendar_properties, 0); Privileges:caldav-client-v2.php: $hnode = $this->xmltags['DAV::href'][0]; Privileges:caldav-client-v2.php: $href = rawurldecode($this->xmlnodes[$hnode]['value']); Privileges:caldav-client-v2.php: $ok_props = $this->GetOKProps($hnode); Privileges:caldav-client-v2.php: $calendar->{$name} = $v['value']; Privileges:caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); Privileges:caldav-client-v2.php: $this->DoPROPFINDRequest( $this->calendar_url, array('getetag'), 1); Privileges:caldav-client-v2.php: if ( isset($this->xmltags['DAV::getetag']) ) { Privileges:caldav-client-v2.php: foreach( $this->xmltags['DAV::getetag'] AS $k => $v ) { Privileges:caldav-client-v2.php: $href = $this->HrefForProp('DAV::getetag', $k); Privileges:caldav-client-v2.php: if ( isset($href) && isset($this->xmlnodes[$v]['value']) ) $etags[$href] = $this->xmlnodes[$v]['value']; Privileges:caldav-client-v2.php: * Get a bunch of events for a calendar with a calendar-multiget report Privileges:caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); Privileges:caldav-client-v2.php: $this->body = << Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: $this->requestMethod = "REPORT"; Privileges:caldav-client-v2.php: $this->SetContentType("text/xml"); Privileges:caldav-client-v2.php: $this->DoRequest( $this->calendar_url ); Privileges:caldav-client-v2.php: if ( isset($this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-data']) ) { Privileges:caldav-client-v2.php: foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-data'] AS $k => $v ) { Privileges:caldav-client-v2.php: $href = $this->HrefForProp('urn:ietf:params:xml:ns:caldav:calendar-data', $k); Privileges:caldav-client-v2.php:// echo "Calendar-data:\n"; print_r($this->xmlnodes[$v]); Privileges:caldav-client-v2.php: $events[$href] = $this->xmlnodes[$v]['value']; Privileges:caldav-client-v2.php: $this->DoGETRequest($href); Privileges:caldav-client-v2.php: $events[$href] = $this->httpResponseBody; Privileges:caldav-client-v2.php: * @param string $filter XML fragment which is the element of a calendar-query Privileges:caldav-client-v2.php: * be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied Privileges:caldav-client-v2.php: if ( isset($url) ) $this->SetCalendar($url); Privileges:caldav-client-v2.php: $this->body = << Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: $this->requestMethod = "REPORT"; Privileges:caldav-client-v2.php: $this->SetContentType("text/xml"); Privileges:caldav-client-v2.php: $this->DoRequest( $this->calendar_url ); Privileges:caldav-client-v2.php: foreach( $this->xmltags as $k => $v ) { Privileges:caldav-client-v2.php: case 'urn:ietf:params:xml:ns:caldav:calendar-data': Privileges:caldav-client-v2.php: $range = ""; Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: return $this->DoCalendarQuery($filter, $relative_url); Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: COMPLETED Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: CANCELLED Privileges:caldav-client-v2.php: $time_range Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: return $this->DoCalendarQuery($filter, $relative_url); Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: $uid Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: Privileges:caldav-client-v2.php: return $this->DoCalendarQuery($filter, $relative_url); Privileges:caldav-client-v2.php: return $this->DoGETRequest( $href ); Privileges:caldav-client-v2.php:* $options = $cal->DoOptionsRequest(); Privileges:caldav-client-v2.php:* $cal->SetDepth(1); Privileges:caldav-client-v2.php:* $folder_xml = $cal->DoXMLRequest("PROPFIND", '' ); Privileges:caldav-client-v2.php:* $events = $cal->GetEvents("20070101T000000Z","20070201T000000Z"); Privileges:caldav-client-v2.php:* $options = $cal->DoOptionsRequest(); Privileges:caldav-client-v2.php:* Privileges:caldav-client-v2.php:* // $cal->SetDepth(1); Privileges:caldav-client-v2.php:* // $folder_xml = $cal->DoXMLRequest("PROPFIND", $xmlC); Privileges:caldav-client-v2.php:* $events = $cal->GetEvents("20090201T000000Z","20090301T000000Z"); Privileges:caldav-client-v2.php:* print "\n---------------------------------------------\n"; Privileges:caldav-DELETE.php:* CalDAV Server - handle DELETE method Privileges:caldav-DELETE.php:$dav_resource = new DAVResource($request->path); Privileges:caldav-DELETE.php:$container = $dav_resource->FetchParentContainer(); Privileges:caldav-DELETE.php:$container->NeedPrivilege('DAV::unbind'); Privileges:caldav-DELETE.php:$lock_opener = $request->FailIfLocked(); Privileges:caldav-DELETE.php: if ( $qry->Exec('DELETE',__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-DELETE.php: while( $row = $qry->Fetch() ) { Privileges:caldav-DELETE.php: delete_collection($row->child_id); Privileges:caldav-DELETE.php: if ( $qry->QDo("SELECT write_sync_change(collection_id, 404, caldav_data.dav_name) FROM caldav_data WHERE collection_id = :collection_id", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM property WHERE dav_name LIKE (SELECT dav_name FROM collection WHERE collection_id = :collection_id) || '%'", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM locks WHERE dav_name LIKE (SELECT dav_name FROM collection WHERE collection_id = :collection_id) || '%'", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM caldav_data WHERE collection_id = :collection_id", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM collection WHERE collection_id = :collection_id", $params ) ) { Privileges:caldav-DELETE.php: @dbg_error_log( "DELETE", "DELETE (collection): User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); Privileges:caldav-DELETE.php:if ( !$dav_resource->Exists() )$request->DoResponse( 404 ); Privileges:caldav-DELETE.php:if ( ! ( $dav_resource->resource_id() > 0 ) ) { Privileges:caldav-DELETE.php: $request->DoResponse( 403 ); Privileges:caldav-DELETE.php:$qry->Begin(); Privileges:caldav-DELETE.php:if ( $dav_resource->IsBinding() ) { Privileges:caldav-DELETE.php: $params = array( ':dav_name' => $dav_resource->dav_name() ); Privileges:caldav-DELETE.php: if ( $qry->QDo("DELETE FROM dav_binding WHERE dav_name = :dav_name", $params ) Privileges:caldav-DELETE.php: && $qry->Commit() ) { Privileges:caldav-DELETE.php: @dbg_error_log( "DELETE", "DELETE: Binding: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); Privileges:caldav-DELETE.php: $request->DoResponse( 204 ); Privileges:caldav-DELETE.php:else if ( $dav_resource->IsCollection() ) { Privileges:caldav-DELETE.php: if ( delete_collection( $dav_resource->resource_id() ) && $qry->Commit() ) { Privileges:caldav-DELETE.php: $request->DoResponse( 204 ); Privileges:caldav-DELETE.php: if ( (isset($request->etag_if_match) && $request->etag_if_match != $dav_resource->unique_tag() ) ) { Privileges:caldav-DELETE.php: $request->DoResponse( 412, translate("Resource has changed on server - not deleted") ); Privileges:caldav-DELETE.php: $params = array( ':dav_id' => $dav_resource->resource_id() ); Privileges:caldav-DELETE.php: if ( $qry->QDo("SELECT write_sync_change(collection_id, 404, caldav_data.dav_name) FROM caldav_data WHERE dav_id = :dav_id", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM property WHERE dav_name = (SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id)", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM locks WHERE dav_name = (SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id)", $params ) Privileges:caldav-DELETE.php: && $qry->QDo("DELETE FROM caldav_data WHERE dav_id = :dav_id", $params ) Privileges:caldav-DELETE.php: && $qry->Commit() ) { Privileges:caldav-DELETE.php: @dbg_error_log( "DELETE", "DELETE: User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); Privileges:caldav-DELETE.php: log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $dav_resource->GetProperty('collection_id'), $request->path ); Privileges:caldav-DELETE.php: $request->DoResponse( 204 ); Privileges:caldav-DELETE.php:$request->DoResponse( 500 ); Privileges:caldav-DELTICKET.php:* CalDAV Server - handle DELTICKET method in line with defunct proposed RFC Privileges:caldav-DELTICKET.php:* from: http://tools.ietf.org/html/draft-ito-dav-ticket-00 Privileges:caldav-DELTICKET.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-DELTICKET.php:if ( ! $request->HavePrivilegeTo('DAV::unbind') && $request->ticket->owner() != $session->principal_id ) { Privileges:caldav-DELTICKET.php: $request->NeedPrivilege('DAV::unbind'); Privileges:caldav-DELTICKET.php:if ( ! isset($request->ticket) ) { Privileges:caldav-DELTICKET.php: $r = new DAVResource($request->path); Privileges:caldav-DELTICKET.php: if ( ! $r->Exists() ) { Privileges:caldav-DELTICKET.php: $request->PreconditionFailed(404,'not-found'); Privileges:caldav-DELTICKET.php: $request->PreconditionFailed(412,'ticket-does-not-exist','The specified ticket does not exist'); Privileges:caldav-DELTICKET.php: $request->MalformedRequest('No ticket specified'); Privileges:caldav-DELTICKET.php:$qry = new AwlQuery('DELETE FROM access_ticket WHERE ticket_id=:ticket_id', array( ':ticket_id' => $request->ticket->id() ) ); Privileges:caldav-DELTICKET.php:if ( $qry->Exec('DELTICKET', __LINE__, __FILE__) ) { Privileges:caldav-DELTICKET.php: $request->DoResponse( 204 ); Privileges:caldav-DELTICKET.php:$request->DoResponse( 500 ); Privileges:caldav-GET.php:* CalDAV Server - handle GET method Privileges:caldav-GET.php:$dav_resource = new DAVResource($request->path); Privileges:caldav-GET.php:$dav_resource->NeedPrivilege( array('urn:ietf:params:xml:ns:caldav:read-free-busy','DAV::read') ); Privileges:caldav-GET.php:if ( ! $dav_resource->Exists() ) { Privileges:caldav-GET.php: $request->DoResponse( 404, translate("Resource Not Found.") ); Privileges:caldav-GET.php: // so we will present an obfuscated version of the event that just says "Busy" (translated :-) Privileges:caldav-GET.php: $confidential->SetType($icalendar->GetType()); Privileges:caldav-GET.php: $confidential->AddProperty( 'SUMMARY', translate('Busy') ); Privileges:caldav-GET.php: $confidential->AddProperty( 'CLASS', 'CONFIDENTIAL' ); Privileges:caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('DTSTART'), 'DTSTART' ); Privileges:caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('RRULE'), 'RRULE' ); Privileges:caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('DURATION'), 'DURATION' ); Privileges:caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('DTEND'), 'DTEND' ); Privileges:caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('UID'), 'UID' ); Privileges:caldav-GET.php: $confidential->SetProperties( $icalendar->GetProperties('CREATED'), 'CREATED' ); Privileges:caldav-GET.php:if ( $dav_resource->IsCollection() ) { Privileges:caldav-GET.php: if ( ! $dav_resource->IsCalendar() && !(isset($c->get_includes_subcollections) && $c->get_includes_subcollections) ) { Privileges:caldav-GET.php: $request->DoResponse( 405, translate("GET requests on collections are only supported for calendars.") ); Privileges:caldav-GET.php: if ( isset($c->get_includes_subcollections) && $c->get_includes_subcollections ) { Privileges:caldav-GET.php: $params = array( ':path_match' => '^'.$request->path ); Privileges:caldav-GET.php: $params = array( ':collection_id' => $dav_resource->resource_id() ); Privileges:caldav-GET.php: if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= ' ORDER BY dav_id'; Privileges:caldav-GET.php: if ( !$qry->Exec("GET",__LINE__,__FILE__) ) { Privileges:caldav-GET.php: $request->DoResponse( 500, translate("Database Error") ); Privileges:caldav-GET.php: $vcal->VCalendar(); Privileges:caldav-GET.php: $displayname = $dav_resource->GetProperty('displayname'); Privileges:caldav-GET.php: $vcal->AddProperty("X-WR-CALNAME", $displayname); Privileges:caldav-GET.php: while( $event = $qry->Fetch() ) { Privileges:caldav-GET.php: $ical = new iCalComponent( $event->caldav_data ); Privileges:caldav-GET.php: $event_zones = $ical->GetComponents('VTIMEZONE',true); Privileges:caldav-GET.php: $tzid = $tz->GetPValue('TZID'); Privileges:caldav-GET.php: $comps = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-GET.php: $tzid = $comp->GetPParamValue('DTSTART', 'TZID'); if ( isset($tzid) && !isset($need_zones[$tzid]) ) $need_zones[$tzid] = 1; Privileges:caldav-GET.php: $tzid = $comp->GetPParamValue('DUE', 'TZID'); if ( isset($tzid) && !isset($need_zones[$tzid]) ) $need_zones[$tzid] = 1; Privileges:caldav-GET.php: $tzid = $comp->GetPParamValue('DTEND', 'TZID'); if ( isset($tzid) && !isset($need_zones[$tzid]) ) $need_zones[$tzid] = 1; Privileges:caldav-GET.php: if ( $dav_resource->HavePrivilegeTo('all',false) || $session->user_no == $event->user_no || $session->user_no == $event->logged_user Privileges:caldav-GET.php: || ( $c->allow_get_email_visibility && $comp->IsAttendee($session->email) ) ) { Privileges:caldav-GET.php: $vcal->AddComponent($comp); Privileges:caldav-GET.php: if ( $event->class == 'PRIVATE' ) continue; Privileges:caldav-GET.php: if ( ! $dav_resource->HavePrivilegeTo('DAV::read') || $event->class == 'CONFIDENTIAL' ) { Privileges:caldav-GET.php: $vcal->AddComponent(obfuscated_event($comp)); Privileges:caldav-GET.php: elseif ( isset($c->hide_alarm) && $c->hide_alarm ) { Privileges:caldav-GET.php: $comp->ClearComponents('VALARM'); Privileges:caldav-GET.php: $vcal->AddComponent($comp); Privileges:caldav-GET.php: $vcal->AddComponent($comp); Privileges:caldav-GET.php: if ( isset($timezones[$tzid]) ) $vcal->AddComponent($timezones[$tzid]); Privileges:caldav-GET.php: $response = $vcal->Render(); Privileges:caldav-GET.php: header( 'Content-Length: '.strlen($response) ); Privileges:caldav-GET.php: header( 'Etag: '.$dav_resource->unique_tag() ); Privileges:caldav-GET.php: $request->DoResponse( 200, ($request->method == 'HEAD' ? '' : $response), 'text/calendar; charset="utf-8"' ); Privileges:caldav-GET.php:$resource = $dav_resource->resource(); Privileges:caldav-GET.php:$ic = new iCalComponent( $resource->caldav_data ); Privileges:caldav-GET.php:if ( $dav_resource->HavePrivilegeTo('all', false) || $session->user_no == $resource->user_no || $session->user_no == $resource->logged_user Privileges:caldav-GET.php: || ( $c->allow_get_email_visibility && $ic->IsAttendee($session->email) ) ) { Privileges:caldav-GET.php:else if ( $resource->class != 'PRIVATE' ) { Privileges:caldav-GET.php: if ( ! $dav_resource->HavePrivilegeTo('DAV::read') || ( $resource->class == 'CONFIDENTIAL' && ! $request->HavePrivilegeTo('DAV::write-content') ) ) { Privileges:caldav-GET.php: $ical = new iCalComponent( $resource->caldav_data ); Privileges:caldav-GET.php: $comps = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-GET.php: $ical->SetComponents( array($confidential), $resource->caldav_type ); Privileges:caldav-GET.php: $resource->caldav_data = $ical->Render(); Privileges:caldav-GET.php:// else $resource->class == 'PRIVATE' and this person may not see it. Privileges:caldav-GET.php: $request->DoResponse( 403, translate("Forbidden") ); Privileges:caldav-GET.php:header( 'Etag: "'.$resource->dav_etag.'"' ); Privileges:caldav-GET.php:header( 'Content-Length: '.strlen($resource->caldav_data) ); Privileges:caldav-GET.php:switch( $resource->caldav_type ) { Privileges:caldav-GET.php: $contenttype = 'text/x-vcard'; Privileges:caldav-GET.php:$request->DoResponse( 200, ($request->method == 'HEAD' ? '' : $resource->caldav_data), $contenttype.'; charset="utf-8"' ); Privileges:caldav-LOCK.php:if ( ! $request->AllowedTo('write') ) { Privileges:caldav-LOCK.php: $request->NeedPrivilege( 'write', $request->path ); Privileges:caldav-LOCK.php:if ( ! isset($request->xml_tags) ) { Privileges:caldav-LOCK.php: if ( isset($request->lock_token) ) { Privileges:caldav-LOCK.php: $request->xml_tags = array(); Privileges:caldav-LOCK.php: $request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('missing-xml-for-request'), $reply->GetXmlNsArray() ) ); Privileges:caldav-LOCK.php:foreach( $request->xml_tags AS $k => $v ) { Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", ":Request: %s -> %s", $v['type'], $tag ); Privileges:caldav-LOCK.php:$request->UnsupportedRequest($unsupported); // Won't return if there was unsupported stuff. Privileges:caldav-LOCK.php:$lock_opener = $request->FailIfLocked(); Privileges:caldav-LOCK.php:if ( $request->method == "LOCK" ) { Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", "Attempting to lock resource '%s'", $request->path); Privileges:caldav-LOCK.php: if ( ($lock_token = $request->IsLocked()) ) { // NOTE Assignment in if() is expected here. Privileges:caldav-LOCK.php: ':dav_name' => $request->path, Privileges:caldav-LOCK.php: ':request_depth' => $request->depth, Privileges:caldav-LOCK.php: ':timeout' => $request->timeout.' seconds' Privileges:caldav-LOCK.php: header( "Lock-Token: " ); Privileges:caldav-LOCK.php: $qry->Exec("LOCK",__LINE__,__FILE__); Privileges:caldav-LOCK.php: $lock_row = $request->GetLockRow($lock_token); Privileges:caldav-LOCK.php: new XMLElement( 'locktype', new XMLElement( $lock_row->type )), Privileges:caldav-LOCK.php: new XMLElement( 'lockscope', new XMLElement( $lock_row->scope )), Privileges:caldav-LOCK.php: new XMLElement( 'depth', $request->GetDepthName() ), Privileges:caldav-LOCK.php: new XMLElement( 'owner', new XMLElement( 'href', $lock_row->owner )), Privileges:caldav-LOCK.php: new XMLElement( 'timeout', 'Second-'.$request->timeout), Privileges:caldav-LOCK.php:elseif ( $request->method == "UNLOCK" ) { Privileges:caldav-LOCK.php: * @TODO: respond with preconditionfailed(409,'lock-token-matches-request-uri') if Privileges:caldav-LOCK.php: dbg_error_log( "LOCK", "Attempting to unlock resource '%s'", $request->path); Privileges:caldav-LOCK.php: if ( ($lock_token = $request->IsLocked()) ) { // NOTE Assignment in if() is expected here. Privileges:caldav-LOCK.php: $qry->Exec("LOCK",__LINE__,__FILE__); Privileges:caldav-LOCK.php: $request->DoResponse( 204 ); Privileges:caldav-LOCK.php:$xmldoc = $prop->Render(0,''); Privileges:caldav-LOCK.php:$request->DoResponse( 200, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:caldav-MKCOL.php:* CalDAV Server - handle MKCOL and MKCALENDAR method Privileges:caldav-MKCOL.php:* @copyright Catalyst IT Ltd, Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-MKCOL.php:$request->NeedPrivilege('DAV::bind'); Privileges:caldav-MKCOL.php:$displayname = $request->path; Privileges:caldav-MKCOL.php:if ( ! preg_match( '#/$#', $request->path ) ) { Privileges:caldav-MKCOL.php: dbg_error_log( 'MKCOL', 'Add trailling "/" to "%s"', $request->path); Privileges:caldav-MKCOL.php: $request->path .= '/'; Privileges:caldav-MKCOL.php:if ( preg_match( '#^(.*/)([^/]+)(/)?$#', $request->path, $matches ) ) { Privileges:caldav-MKCOL.php:if ( $parent->IsSchedulingCollection( 'inbox' ) ) { Privileges:caldav-MKCOL.php: $request->PreconditionFailed(403, 'urn:ietf:params:xml:ns:caldav:no-mkcol-in-inbox' ); Privileges:caldav-MKCOL.php:$request_type = $request->method; Privileges:caldav-MKCOL.php:if ( isset($request->xml_tags) ) { Privileges:caldav-MKCOL.php: $xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-MKCOL.php: if ( $xmltree->GetTag() == 'DAV::mkcol' ) $request_type = 'extended-mkcol'; Privileges:caldav-MKCOL.php: if ( $xmltree->GetTag() != 'urn:ietf:params:xml:ns:caldav:mkcalendar' && $request_type != 'extended-mkcol' ) { Privileges:caldav-MKCOL.php: $request->DoResponse( 406, sprintf('The XML is not a "DAV::mkcol" or "urn:ietf:params:xml:ns:caldav:mkcalendar" document (%s)', $xmltree->GetTag()) ); Privileges:caldav-MKCOL.php: $setprops = $xmltree->GetContent(); // Privileges:caldav-MKCOL.php: $setprops = $setprops[0]->GetContent(); // Privileges:caldav-MKCOL.php: $setprops = $setprops[0]->GetContent(); // the array of properties. Privileges:caldav-MKCOL.php: $tag = $setting->GetTag(); Privileges:caldav-MKCOL.php: $content = $setting->RenderContent(); Privileges:caldav-MKCOL.php: $is_addressbook = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:carddav:addressbook')); Privileges:caldav-MKCOL.php: $is_calendar = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:caldav:calendar')); Privileges:caldav-MKCOL.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-MKCOL.php: new XMLElement( 'prop', new XMLElement($reply->Tag($tag))), Privileges:caldav-MKCOL.php: $resourcetypes = $setting->GetPath('DAV::resourcetype/*'); Privileges:caldav-MKCOL.php: dbg_error_log( 'MKCOL', 'Displayname is "/" to "%s"', $request->path); Privileges:caldav-MKCOL.php: $parent_container = $request->path; Privileges:caldav-MKCOL.php: $request->path .= $content . '/'; Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set': /** Ignored, since we will support all component types */ Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-data': /** Ignored, since we will support iCalendar 2.0 */ Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:calendar-data': /** Ignored, since we will support iCalendar 2.0 */ Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:max-resource-size': /** Ignored, since we will support arbitrary size */ Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:min-date-time': /** Ignored, since we will support arbitrary time */ Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:max-date-time': /** Ignored, since we will support arbitrary time */ Privileges:caldav-MKCOL.php: case 'urn:ietf:params:xml:ns:caldav:max-instances': /** Ignored, since we will support arbitrary instances */ Privileges:caldav-MKCOL.php: * The following properties are read-only, so they will cause the request to fail Privileges:caldav-MKCOL.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-MKCOL.php: new XMLElement( 'prop', new XMLElement($reply->Tag($tag))), Privileges:caldav-MKCOL.php: new XMLElement('responsedescription', translate('Property is read-only') ) Privileges:caldav-MKCOL.php: $props[] = new XMLElement($reply->Tag($tag)); Privileges:caldav-MKCOL.php: if ( $request_type == 'extended-mkcol' ) { Privileges:caldav-MKCOL.php: $request->DoResponse( $failure_code, $reply->Render('mkcol-response', array_merge( $status, $failure ), 'text/xml; charset="utf-8"' ) ); Privileges:caldav-MKCOL.php: array_unshift( $failure, $reply->href( ConstructURL($request->path) ) ); Privileges:caldav-MKCOL.php: $request->DoResponse( 207, $reply->Render('multistatus', new XMLElement( 'response', $failure )), 'text/xml; charset="utf-8"' ); Privileges:caldav-MKCOL.php:$qry = new AwlQuery( $sql, array( ':dav_name' => $request->path) ); Privileges:caldav-MKCOL.php:if ( ! $qry->Exec('MKCOL',__LINE__,__FILE__) ) { Privileges:caldav-MKCOL.php: $request->DoResponse( 500, translate('Error querying database.') ); Privileges:caldav-MKCOL.php:if ( $qry->rows() != 0 ) { Privileges:caldav-MKCOL.php: $request->DoResponse( 405, translate('A collection already exists at that location.') ); Privileges:caldav-MKCOL.php:$qry->Begin(); Privileges:caldav-MKCOL.php:if ( ! $qry->QDo( 'INSERT INTO collection ( user_no, parent_container, dav_name, dav_etag, dav_displayname, Privileges:caldav-MKCOL.php: ':user_no' => $request->user_no, Privileges:caldav-MKCOL.php: ':dav_name' => $request->path, Privileges:caldav-MKCOL.php: ':dav_etag' => md5($request->user_no. $request->path), Privileges:caldav-MKCOL.php: $request->DoResponse( 500, translate('Error writing calendar details to database.') ); Privileges:caldav-MKCOL.php: if ( ! $qry->QDo('SELECT set_dav_property( :dav_name, :user_no, :tag::text, :value::text )', Privileges:caldav-MKCOL.php: array( ':dav_name' => $request->path, ':user_no' => $request->user_no, ':tag' => $k, ':value' => $v) ) ) { Privileges:caldav-MKCOL.php: $request->DoResponse( 500, translate('Error writing calendar properties to database.') ); Privileges:caldav-MKCOL.php:if ( !$qry->Commit() ) { Privileges:caldav-MKCOL.php: $request->DoResponse( 500, translate('Error writing calendar details to database.') ); Privileges:caldav-MKCOL.php:dbg_error_log( 'MKCOL', 'New calendar "%s" created named "%s" for user "%d" in parent "%s"', $request->path, $displayname, $session->user_no, $parent_container); Privileges:caldav-MKCOL.php:header('Cache-Control: no-cache'); /** RFC4791 mandates this at 5.3.1 */ Privileges:caldav-MKCOL.php:$request->DoResponse( 201, '' ); Privileges:caldav-MKCOL.php:* Privileges:caldav-MKCOL.php:* Calendar restricted to events. Privileges:caldav-MKCOL.php:* Privileges:caldav-MKCOL.php:* Privileges:caldav-MKCOL.php:* Privileges:caldav-MKTICKET.php:* CalDAV Server - handle MKTICKET method in line with defunct proposed RFC Privileges:caldav-MKTICKET.php:* from: http://tools.ietf.org/html/draft-ito-dav-ticket-00 Privileges:caldav-MKTICKET.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-MKTICKET.php:$request->NeedPrivilege('DAV::bind'); Privileges:caldav-MKTICKET.php:$target = new DAVResource( $request->path ); Privileges:caldav-MKTICKET.php:if ( ! $target->Exists() ) { Privileges:caldav-MKTICKET.php: $request->XMLResponse( 404, new XMLElement( 'error', new XMLElement('resource-must-not-be-null'), $reply->GetXmlNsArray() ) ); Privileges:caldav-MKTICKET.php:if ( ! isset($request->xml_tags) ) { Privileges:caldav-MKTICKET.php: $request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('missing-xml-for-request'), $reply->GetXmlNsArray() ) ); Privileges:caldav-MKTICKET.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-MKTICKET.php:if ( $xmltree->GetTag() != 'http://www.xythos.com/namespaces/StorageServer:ticketinfo' && Privileges:caldav-MKTICKET.php: $xmltree->GetTag() != 'DAV::ticketinfo' ) { Privileges:caldav-MKTICKET.php: $request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('invalid-xml-for-request'), $reply->GetXmlNsArray() ) ); Privileges:caldav-MKTICKET.php:$ticket_timeout = 'Seconds-3600'; Privileges:caldav-MKTICKET.php:$ticket_privs_array = array('read-free-busy'); Privileges:caldav-MKTICKET.php:foreach( $xmltree->GetContent() AS $k => $v ) { Privileges:caldav-MKTICKET.php: switch( $v->GetTag() ) { Privileges:caldav-MKTICKET.php: $ticket_timeout = $v->GetContent(); Privileges:caldav-MKTICKET.php: $ticket_privs_array = $v->GetElements(); // Ensure we always get an array back Privileges:caldav-MKTICKET.php: $ticket_privileges |= privilege_to_bits( $v1->GetTag() ); Privileges:caldav-MKTICKET.php: if ( $ticket_privileges & privilege_to_bits('read') ) $ticket_privileges |= privilege_to_bits( array('read-free-busy', 'read-current-user-privilege-set') ); Privileges:caldav-MKTICKET.php: if ( $ticket_privileges & privilege_to_bits('read-free-busy') ) $ticket_privileges |= privilege_to_bits( 'schedule-query-freebusy'); Privileges:caldav-MKTICKET.php:else if ( preg_match( '{^([a-z]+)-(\d+)$}i', $ticket_timeout, $matches ) ) { Privileges:caldav-MKTICKET.php: /** It isn't specified, but timeout seems to be 'unit-number' like 'Seconds-3600', so we make it '3600 Seconds' which PostgreSQL understands */ Privileges:caldav-MKTICKET.php:$collection_id = $target->GetProperty('collection_id'); Privileges:caldav-MKTICKET.php:$resource_id = $target->GetProperty('dav_id'); Privileges:caldav-MKTICKET.php: ':owner' => $session->principal_id, Privileges:caldav-MKTICKET.php: $result = $qry->Exec('MKTICKET', __LINE__, __FILE__); Privileges:caldav-MKTICKET.php: $reply->NSElement($privs, $v); Privileges:caldav-MKTICKET.php: new XMLElement( 'owner', $reply->href( ConstructURL('/'.$session->username.'/') ) ), Privileges:caldav-MKTICKET.php:$prop = new XMLElement( "prop", new XMLElement('T:ticketdiscovery', $ticketinfo), $reply->GetXmlNsArray() ); Privileges:caldav-MKTICKET.php:$request->XMLResponse( 200, $prop ); Privileges:caldav-MOVE.php:* CalDAV Server - handle MOVE method Privileges:caldav-MOVE.php:$request->NeedPrivilege('DAV::unbind'); Privileges:caldav-MOVE.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['move']) && $c->dbg['move'])) ) { Privileges:caldav-MOVE.php: fwrite($fh,$request->raw_post); Privileges:caldav-MOVE.php:$lock_opener = $request->FailIfLocked(); Privileges:caldav-MOVE.php:$dest = new DAVResource($request->destination); Privileges:caldav-MOVE.php:if ( $dest->dav_name() == '/' || $dest->IsPrincipal() ) { Privileges:caldav-MOVE.php: $dest->NeedPrivilege('DAV::bind'); Privileges:caldav-MOVE.php:if ( ! $dest->ContainerExists() ) { Privileges:caldav-MOVE.php: $request->DoResponse( 409, translate('Destination collection does not exist') ); Privileges:caldav-MOVE.php:if ( ! $request->overwrite && $dest->Exists() ) { Privileges:caldav-MOVE.php: $request->DoResponse( 412, translate('Not overwriting existing destination resource') ); Privileges:caldav-MOVE.php:if ( isset($request->etag_none_match) && $request->etag_none_match != '*' ) { Privileges:caldav-MOVE.php: $request->DoResponse( 412 ); /** request to move, but only if there is no source? WTF! */ Privileges:caldav-MOVE.php:$src = new DAVResource($request->path); Privileges:caldav-MOVE.php:if ( ! $src->Exists() ) { Privileges:caldav-MOVE.php: $request->DoResponse( 412, translate('Source resource does not exist.') ); Privileges:caldav-MOVE.php:if ( $src->IsCollection() ) { Privileges:caldav-MOVE.php: switch( $dest->ContainerType() ) { Privileges:caldav-MOVE.php: case 'schedule-inbox': Privileges:caldav-MOVE.php: case 'schedule-outbox': Privileges:caldav-MOVE.php: $request->DoResponse( 412, translate('Special collections may not contain a calendar or other special collection.') ); Privileges:caldav-MOVE.php: if ( (isset($request->etag_if_match) && $request->etag_if_match != '' ) Privileges:caldav-MOVE.php: || ( isset($request->etag_none_match) && $request->etag_none_match != '') ) { Privileges:caldav-MOVE.php: * (without the If-None-Match header) on that resource, or if "*" is Privileges:caldav-MOVE.php: if ( isset($request->etag_if_match) && $request->etag_if_match != $src->unique_tag() ) { Privileges:caldav-MOVE.php: $error = translate( 'Existing resource does not match "If-Match" header - not accepted.'); Privileges:caldav-MOVE.php: else if ( isset($request->etag_none_match) && $request->etag_none_match != '' && $request->etag_none_match == $src->unique_tag() ) { Privileges:caldav-MOVE.php: $error = translate( 'Existing resource matches "If-None-Match" header - not accepted.'); Privileges:caldav-MOVE.php: if ( $error != '' ) $request->DoResponse( 412, $error ); Privileges:caldav-MOVE.php:$src->NeedPrivilege('DAV::unbind'); Privileges:caldav-MOVE.php:$dest->NeedPrivilege('DAV::write-content'); Privileges:caldav-MOVE.php:if ( ! $dest->Exists() ) $dest->NeedPrivilege('DAV::bind'); Privileges:caldav-MOVE.php: $qry->Exec('move'); // Just in case Privileges:caldav-MOVE.php: $request->DoResponse( $response_code ); Privileges:caldav-MOVE.php:if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php:$src_name = $src->dav_name(); Privileges:caldav-MOVE.php:$dst_name = $dest->dav_name(); Privileges:caldav-MOVE.php:$src_collection = $src->GetProperty('collection_id'); Privileges:caldav-MOVE.php:$dst_collection = $dest->GetProperty('collection_id'); Privileges:caldav-MOVE.php:$src_user_no = $src->GetProperty('user_no'); Privileges:caldav-MOVE.php:$dst_user_no = $dest->GetProperty('user_no'); Privileges:caldav-MOVE.php:if ( $src->IsCollection() ) { Privileges:caldav-MOVE.php: if ( $dest->Exists() ) { Privileges:caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php: if ( $dest->Exists() ) { Privileges:caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php: log_caldav_action( 'DELETE', $src->GetProperty('uid'), $src_user_no, $src_collection, $src_name ); Privileges:caldav-MOVE.php: ':sync_type' => ( $dest->Exists() ? 200 : 201 ) Privileges:caldav-MOVE.php: if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php: log_caldav_action( ( $dest->Exists() ? 'UPDATE' : 'INSERT' ), $src->GetProperty('uid'), $dst_user_no, $dst_collection, $dst_name ); Privileges:caldav-MOVE.php:if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-MOVE.php:$request->DoResponse( 200 ); Privileges:caldav-OPTIONS.php:* CalDAV Server - handle OPTIONS method Privileges:caldav-OPTIONS.php:$resource = new DAVResource($request->path); Privileges:caldav-OPTIONS.php://$resource->NeedPrivilege( 'DAV::read', true ); Privileges:caldav-OPTIONS.php:if ( !$resource->Exists() ) { Privileges:caldav-OPTIONS.php: $request->DoResponse( 404, translate("No collection found at that location.") ); Privileges:caldav-OPTIONS.php:$allowed = implode( ', ', array_keys($resource->FetchSupportedMethods()) ); Privileges:caldav-OPTIONS.php:$request->DoResponse( 200, "" ); Privileges:caldav-POST.php:* CalDAV Server - handle PUT method Privileges:caldav-POST.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-POST.php:include_once('caldav-PUT-functions.php'); Privileges:caldav-POST.php:include_once('freebusy-functions.php'); Privileges:caldav-POST.php:if ( ! $request->AllowedTo("CALDAV:schedule-send-freebusy") Privileges:caldav-POST.php: && ! $request->AllowedTo("CALDAV:schedule-send-invite") Privileges:caldav-POST.php: && ! $request->AllowedTo("CALDAV:schedule-send-reply") ) { Privileges:caldav-POST.php: // $request->DoResponse(403); Privileges:caldav-POST.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['post'])) ) { Privileges:caldav-POST.php: fwrite($fh,$request->raw_post); Privileges:caldav-POST.php: $fbq_start = $ic->GetPValue('DTSTART'); Privileges:caldav-POST.php: $fbq_end = $ic->GetPValue('DTEND'); Privileges:caldav-POST.php: $request->DoResponse( 400, 'All valid freebusy requests MUST contain a DTSTART and a DTEND' ); Privileges:caldav-POST.php: $attendees = $ic->GetProperties('ATTENDEE'); Privileges:caldav-POST.php: dbg_error_log( "POST", "Non-compliant iCal request. Using X-WR-ATTENDEE property" ); Privileges:caldav-POST.php: $wr_attendees = $ic->GetProperties('X-WR-ATTENDEE'); Privileges:caldav-POST.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); Privileges:caldav-POST.php: $params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth, ':email' => $attendee_email ); Privileges:caldav-POST.php: if ( !$qry->Exec('POST',__LINE__,__FILE__) ) $request->DoResponse( 501, 'Database error'); Privileges:caldav-POST.php: if ( $qry->rows() > 1 ) { Privileges:caldav-POST.php: if ( !$qry->QDo('SELECT pprivs(:session_principal::int8,principal_id,:scan_depth::int) AS p, username FROM usr JOIN principal USING(user_no) WHERE usr.email = :email', $params ) ) Privileges:caldav-POST.php: $request->DoResponse( 501, 'Database error'); Privileges:caldav-POST.php: if ( $qry->rows() == 0 ) { Privileges:caldav-POST.php: /** Sigh... Go back to the original case-insensitive match */ Privileges:caldav-POST.php: $qry->QDo('SELECT pprivs(:session_principal::int8,principal_id,:scan_depth::int) AS p, username FROM usr JOIN principal USING(user_no) WHERE lower(usr.email) = lower(:email)', $params ); Privileges:caldav-POST.php: $response = $reply->NewXMLElement("response", false, false, 'urn:ietf:params:xml:ns:caldav'); Privileges:caldav-POST.php: $reply->CalDAVElement($response, "recipient", $reply->href($attendee->Value()) ); Privileges:caldav-POST.php: if ( $qry->rows() == 0 ) { Privileges:caldav-POST.php: $reply->CalDAVElement($response, "request-status", "3.7;Invalid Calendar User" ); Privileges:caldav-POST.php: $reply->CalDAVElement($response, "calendar-data" ); Privileges:caldav-POST.php: if ( ! $attendee_usr = $qry->Fetch() ) $request->DoResponse( 501, 'Database error'); Privileges:caldav-POST.php: if ( (privilege_to_bits('schedule-query-freebusy') & bindec($attendee_usr->p)) == 0 ) { Privileges:caldav-POST.php: $reply->CalDAVElement($response, "request-status", "3.8;No authority" ); Privileges:caldav-POST.php: $reply->CalDAVElement($response, "calendar-data" ); Privileges:caldav-POST.php: $attendee_path_match = '^/'.$attendee_usr->username.'/'; Privileges:caldav-POST.php: $fb = get_freebusy( $attendee_path_match, $range_start, $range_end, bindec($attendee_usr->p) ); Privileges:caldav-POST.php: $fb->AddProperty( 'UID', $ic->GetPValue('UID') ); Privileges:caldav-POST.php: $fb->SetProperties( $ic->GetProperties('ORGANIZER'), 'ORGANIZER'); Privileges:caldav-POST.php: $fb->AddProperty( $attendee ); Privileges:caldav-POST.php: $vcal->VCalendar( array('METHOD' => 'REPLY') ); Privileges:caldav-POST.php: $vcal->AddComponent( $fb ); Privileges:caldav-POST.php: $response = $reply->NewXMLElement( "response", false, false, 'urn:ietf:params:xml:ns:caldav' ); Privileges:caldav-POST.php: $reply->CalDAVElement($response, "recipient", $reply->href($attendee->Value()) ); Privileges:caldav-POST.php: $reply->CalDAVElement($response, "request-status", "2.0;Success" ); // Cargo-cult setting Privileges:caldav-POST.php: $reply->CalDAVElement($response, "calendar-data", $vcal->Render() ); Privileges:caldav-POST.php: $response = $reply->NewXMLElement( "schedule-response", $responses, $reply->GetXmlNsArray(), 'urn:ietf:params:xml:ns:caldav' ); Privileges:caldav-POST.php: $request->XMLResponse( 200, $response ); Privileges:caldav-POST.php: $responses[] = $reply->NewXMLElement( "response", false, false, 'urn:ietf:params:xml:ns:caldav' ); Privileges:caldav-POST.php: $reply->CalDAVElement($response, "request-status", "2.0;Success" ); // Cargo-cult setting Privileges:caldav-POST.php: $response = $reply->NewXMLElement( "schedule-response", $responses, $reply->GetXmlNsArray() ); Privileges:caldav-POST.php: $request->XMLResponse( 200, $response ); Privileges:caldav-POST.php:$ical = new iCalComponent( $request->raw_post ); Privileges:caldav-POST.php:$method = $ical->GetPValue('METHOD'); Privileges:caldav-POST.php:$resources = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-POST.php: dbg_error_log('POST', 'Handling iTIP "REQUEST" method with "%s" component.', $method, $first->GetType() ); Privileges:caldav-POST.php: if ( $first->GetType() == 'VFREEBUSY' ) Privileges:caldav-POST.php: elseif ( $first->GetType() == 'VEVENT' ) { Privileges:caldav-POST.php: dbg_error_log('POST', 'Ignoring iTIP "REQUEST" with "%s" component.', $first->GetType() ); Privileges:caldav-POST.php: dbg_error_log('POST', 'Handling iTIP "REPLY" with "%s" component.', $first->GetType() ); Privileges:CalDAVPrincipal.php: * @var draft-desruisseaux-caldav-sched-03: Identify the URL of the scheduling Privileges:CalDAVPrincipal.php: * @var draft-desruisseaux-caldav-sched-03: Identify the URL of the scheduling Privileges:CalDAVPrincipal.php: * @var Whether or not we are using an e-mail address based URL. Privileges:CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which this one has read permissions on. Privileges:CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which this one has read-write prmissions for. Privileges:CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which have read permissions on this one. Privileges:CalDAVPrincipal.php: * @var caldav-cu-proxy-02: The principals which have write permissions on this one. Privileges:CalDAVPrincipal.php: * @var The dav_name for this principal - a partial path Privileges:CalDAVPrincipal.php: $this->exists = null; Privileges:CalDAVPrincipal.php: $this->url = null; Privileges:CalDAVPrincipal.php: $this->by_email = false; Privileges:CalDAVPrincipal.php: dbg_error_log( 'principal', 'Principal: record for %s', $parameters->username ); Privileges:CalDAVPrincipal.php: $this->user_no = $parameters['user_no']; Privileges:CalDAVPrincipal.php: $this->username = $parameters['username']; Privileges:CalDAVPrincipal.php: $this->user_no = $parameters['user_no']; Privileges:CalDAVPrincipal.php: if ( $username = $this->UsernameFromEMail($parameters['email']) ) { Privileges:CalDAVPrincipal.php: $this->username = $username; Privileges:CalDAVPrincipal.php: if ( $username = $this->UsernameFromPath($parameters['path'], $parameters['options']) ) { Privileges:CalDAVPrincipal.php: $this->username = $username; Privileges:CalDAVPrincipal.php: else if ( isset($parameters['principal-property-search']) ) { Privileges:CalDAVPrincipal.php: $usr = $this->PropertySearch($parameters['principal-property-search']); Privileges:CalDAVPrincipal.php: $this->exists = false; Privileges:CalDAVPrincipal.php: $this->exists = true; Privileges:CalDAVPrincipal.php: $this->InitialiseRecord($usr); Privileges:CalDAVPrincipal.php: $this->url = $parameters['path']; Privileges:CalDAVPrincipal.php: $this->dav_name = $parameters['path']; Privileges:CalDAVPrincipal.php: $this->{$k} = $v; Privileges:CalDAVPrincipal.php: if ( !isset($this->modified) ) $this->modified = $this->updated; Privileges:CalDAVPrincipal.php: if ( !isset($this->created) ) $this->created = $this->joined; Privileges:CalDAVPrincipal.php: $this->dav_etag = md5($this->username . $this->updated); Privileges:CalDAVPrincipal.php: $this->_is_group = (isset($usr->type_id) && $usr->type_id == 3); Privileges:CalDAVPrincipal.php: $this->principal_url = ConstructURL( '/'.$this->username.'/', true ); Privileges:CalDAVPrincipal.php: $this->url = $this->principal_url; Privileges:CalDAVPrincipal.php: $this->principal_address = $this->principal_url . 'principal.vcf'; Privileges:CalDAVPrincipal.php: $this->user_address_set = array( Privileges:CalDAVPrincipal.php: 'mailto:'.$this->email, Privileges:CalDAVPrincipal.php: ConstructURL( '/'.$this->username.'/', true ), Privileges:CalDAVPrincipal.php:// ConstructURL( '/~'.$this->username.'/', true ), Privileges:CalDAVPrincipal.php:// ConstructURL( '/__uuids__/'.$this->username.'/', true ), Privileges:CalDAVPrincipal.php: $this->schedule_inbox_url = sprintf( '%s.in/', $this->url); Privileges:CalDAVPrincipal.php: $this->schedule_outbox_url = sprintf( '%s.out/', $this->url); Privileges:CalDAVPrincipal.php: $this->dropbox_url = sprintf( '%s.drop/', $this->url); Privileges:CalDAVPrincipal.php: $this->notifications_url = sprintf( '%s.notify/', $this->url); Privileges:CalDAVPrincipal.php: if ( isset ( $c->notifications_server ) ) { Privileges:CalDAVPrincipal.php: $this->xmpp_uri = 'xmpp:pubsub.'.$c->notifications_server['host'].'?pubsub;node=/davical-'.$this->principal_id; Privileges:CalDAVPrincipal.php: $this->xmpp_server = $c->notifications_server['host']; Privileges:CalDAVPrincipal.php: if ( $this->_is_group ) { Privileges:CalDAVPrincipal.php: $this->group_member_set = array(); Privileges:CalDAVPrincipal.php: $qry = new AwlQuery('SELECT usr.username FROM group_member JOIN principal ON (principal_id=member_id) JOIN usr USING(user_no) WHERE group_id = :group_id ORDER BY principal.principal_id ', array( ':group_id' => $this->principal_id) ); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { Privileges:CalDAVPrincipal.php: while( $member = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: $this->group_member_set[] = ConstructURL( '/'. $member->username . '/', true); Privileges:CalDAVPrincipal.php: $this->group_membership = array(); Privileges:CalDAVPrincipal.php: $qry = new AwlQuery('SELECT usr.username FROM group_member JOIN principal ON (principal_id=group_id) JOIN usr USING(user_no) WHERE member_id = :member_id UNION SELECT usr.username FROM group_member LEFT JOIN grants ON (to_principal=group_id) JOIN principal ON (principal_id=by_principal) JOIN usr USING(user_no) WHERE member_id = :member_id and by_principal != member_id ORDER BY 1', array( ':member_id' => $this->principal_id ) ); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { Privileges:CalDAVPrincipal.php: while( $group = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: $this->group_membership[] = ConstructURL( '/'. $group->username . '/', true); Privileges:CalDAVPrincipal.php: $this->read_proxy_group = null; Privileges:CalDAVPrincipal.php: $this->write_proxy_group = null; Privileges:CalDAVPrincipal.php: $this->write_proxy_for = null; Privileges:CalDAVPrincipal.php: $this->read_proxy_for = null; Privileges:CalDAVPrincipal.php: dbg_error_log( 'principal', ' User: %s (%d) URL: %s, Home: %s, By Email: %d', $this->username, $this->user_no, $this->url, $this->by_email ); Privileges:CalDAVPrincipal.php: $this->read_proxy_group = array(); Privileges:CalDAVPrincipal.php: $this->write_proxy_group = array(); Privileges:CalDAVPrincipal.php: $this->write_proxy_for = array(); Privileges:CalDAVPrincipal.php: $this->read_proxy_for = array(); Privileges:CalDAVPrincipal.php: if ( !isset($c->disable_caldav_proxy) || $c->disable_caldav_proxy === false ) { Privileges:CalDAVPrincipal.php: $params = array( ':request_principal' => $this->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { Privileges:CalDAVPrincipal.php: while( $relationship = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: if ( (bindec($relationship->pprivs) & $write_priv) != 0 ) { Privileges:CalDAVPrincipal.php: $this->write_proxy_for[] = ConstructURL( '/'. $relationship->username . '/', true); Privileges:CalDAVPrincipal.php: $this->group_membership[] = ConstructURL( '/'. $relationship->username . '/calendar-proxy-write/', true); Privileges:CalDAVPrincipal.php: $this->read_proxy_for[] = ConstructURL( '/'. $relationship->username . '/', true); Privileges:CalDAVPrincipal.php: $this->group_membership[] = ConstructURL( '/'. $relationship->username . '/calendar-proxy-read/', true); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('CalDAVPrincipal') && $qry->rows() > 0 ) { Privileges:CalDAVPrincipal.php: while( $relationship = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: if ( bindec($relationship->pprivs) & $write_priv ) { Privileges:CalDAVPrincipal.php: $this->write_proxy_group[] = ConstructURL( '/'. $relationship->username . '/', true); Privileges:CalDAVPrincipal.php: $this->read_proxy_group[] = ConstructURL( '/'. $relationship->username . '/', true); Privileges:CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Read-proxy-for: %s', implode(',',$this->read_proxy_for) ); Privileges:CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Write-proxy-for: %s', implode(',',$this->write_proxy_for) ); Privileges:CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Read-proxy-group: %s', implode(',',$this->read_proxy_group) ); Privileges:CalDAVPrincipal.php:// @dbg_error_log( 'principal', 'Write-proxy-group: %s', implode(',',$this->write_proxy_group) ); Privileges:CalDAVPrincipal.php: if ( !isset($this->read_proxy_group) ) $this->FetchProxyGroups(); Privileges:CalDAVPrincipal.php: return $this->read_proxy_group; Privileges:CalDAVPrincipal.php: if ( !isset($this->write_proxy_group) ) $this->FetchProxyGroups(); Privileges:CalDAVPrincipal.php: return $this->write_proxy_group; Privileges:CalDAVPrincipal.php: * @param string read/write - which sort of proxy list is requested. Privileges:CalDAVPrincipal.php: if ( !isset($this->read_proxy_for) ) $this->FetchProxyGroups(); Privileges:CalDAVPrincipal.php: if ( $type == 'write' ) return $this->write_proxy_for; Privileges:CalDAVPrincipal.php: return $this->read_proxy_for; Privileges:CalDAVPrincipal.php: * Accessor for the group membership - the groups this principal is a member of Privileges:CalDAVPrincipal.php: if ( !isset($this->read_proxy_group) ) $this->FetchProxyGroups(); Privileges:CalDAVPrincipal.php: return $this->group_membership; Privileges:CalDAVPrincipal.php: * Accessor for the group member set - the members of this group Privileges:CalDAVPrincipal.php: if ( ! $this->_is_group ) return null; Privileges:CalDAVPrincipal.php: return $this->group_member_set; Privileges:CalDAVPrincipal.php: * @param array $options The request options, controlling whether e-mail paths are allowed. Privileges:CalDAVPrincipal.php: return $session->username; Privileges:CalDAVPrincipal.php: $username = $this->UsernameFromEMail($username); Privileges:CalDAVPrincipal.php: * Work out the username, based on the given e-mail Privileges:CalDAVPrincipal.php: @dbg_error_log( 'principal', 'Retrieving username from e-mail address "%s" ', $email ); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('principal') && $user = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: $username = $user->username; Privileges:CalDAVPrincipal.php: $this->by_email = true; Privileges:CalDAVPrincipal.php: return $this->exists; Privileges:CalDAVPrincipal.php: return $this->_is_group; Privileges:CalDAVPrincipal.php: return (isset($this->username)?$this->username:'username not set'); Privileges:CalDAVPrincipal.php: if ( !isset($this->dav_name) ) { Privileges:CalDAVPrincipal.php: if ( !isset($this->username) ) $this->dav_name = ''; Privileges:CalDAVPrincipal.php: else $this->dav_name = '/'.$this->username.'/'; Privileges:CalDAVPrincipal.php: return $this->dav_name; Privileges:CalDAVPrincipal.php: if ( !isset($this->calendar_home_set) ) { Privileges:CalDAVPrincipal.php: $this->calendar_home_set = array(); Privileges:CalDAVPrincipal.php:/* $qry = new AwlQuery('SELECT DISTINCT parent_container FROM collection WHERE is_calendar AND user_no = :user_no', array( ':user_no' => $this->user_no)); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('principal',__LINE__,__FILE__) ) { Privileges:CalDAVPrincipal.php: if ( $qry->rows() > 0 ) { Privileges:CalDAVPrincipal.php: while( $calendar = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: $this->calendar_home_set[] = ConstructURL($calendar->parent_container, true); Privileges:CalDAVPrincipal.php: $this->calendar_home_set[] = $this->principal_url; Privileges:CalDAVPrincipal.php: return $this->calendar_home_set; Privileges:CalDAVPrincipal.php: if ( !isset($this->addressbook_home_set) ) { Privileges:CalDAVPrincipal.php: $this->addressbook_home_set = array(); Privileges:CalDAVPrincipal.php:/* $qry = new AwlQuery('SELECT DISTINCT parent_container FROM collection WHERE is_addressbook AND user_no = :user_no', array( ':user_no' => $this->user_no)); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('principal',__LINE__,__FILE__) ) { Privileges:CalDAVPrincipal.php: if ( $qry->rows() > 0 ) { Privileges:CalDAVPrincipal.php: while( $addressbook = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: $this->addressbook_home_set[] = ConstructURL($addressbook->parent_container, true); Privileges:CalDAVPrincipal.php: $this->addressbook_home_set[] = $this->principal_url; Privileges:CalDAVPrincipal.php: return $this->addressbook_home_set; Privileges:CalDAVPrincipal.php: if ( !isset($this->calendar_free_busy_set) ) { Privileges:CalDAVPrincipal.php: * calendar-free-busy-set has been dropped from draft 5 of the scheduling extensions for CalDAV Privileges:CalDAVPrincipal.php: $this->calendar_free_busy_set = array(); Privileges:CalDAVPrincipal.php: array( ':user_no' => $this->user_no) ); Privileges:CalDAVPrincipal.php: if ( $qry->Exec('principal',__LINE__,__FILE__) ) { Privileges:CalDAVPrincipal.php: while( $calendar = $qry->Fetch() ) { Privileges:CalDAVPrincipal.php: $this->calendar_free_busy_set[] = ConstructURL($calendar->dav_name, true); Privileges:CalDAVPrincipal.php: return $this->calendar_free_busy_set; Privileges:CalDAVPrincipal.php: if ( !isset($this->privileges) ) $this->privileges = 0; Privileges:CalDAVPrincipal.php: if ( is_string($this->privileges) ) $this->privileges = bindec( $this->privileges ); Privileges:CalDAVPrincipal.php: return $this->privileges; Privileges:CalDAVPrincipal.php: 'collection_id' => (isset($this->principal_id) ? $this->principal_id : 0), Privileges:CalDAVPrincipal.php: 'type' => 'principal' . (substr($this->dav_name(), 0, 12) == '/principals/'?'_link':''), Privileges:CalDAVPrincipal.php: 'user_no' => (isset($this->user_no) ? $this->user_no : 0), Privileges:CalDAVPrincipal.php: 'username' => $this->username(), Privileges:CalDAVPrincipal.php: 'dav_name' => $this->dav_name, Privileges:CalDAVPrincipal.php: 'email' => (isset($this->email) ? $this->email : ''), Privileges:CalDAVPrincipal.php: 'created' => (isset($this->created) ? $this->created : date('Ymd\THis')), Privileges:CalDAVPrincipal.php: 'updated' => (isset($this->updated) ? $this->updated : date('Ymd\THis')) Privileges:CalDAVPrincipal.php: $collection->dav_etag = (isset($this->dav_etag) ? $this->dav_etag : md5($collection->username . $collection->updated)); Privileges:CalDAVPrincipal.php: $collection->dav_displayname = (isset($this->dav_displayname) ? $this->dav_displayname : (isset($this->fullname) ? $this->fullname : $collection->username)); Privileges:CalDAVPrincipal.php: $prop->NewElement('getcontenttype', 'httpd/unix-directory' ); Privileges:CalDAVPrincipal.php: $prop->NewElement('resourcetype', array( new XMLElement('principal'), new XMLElement('collection')) ); Privileges:CalDAVPrincipal.php: $prop->NewElement('displayname', $this->fullname ); Privileges:CalDAVPrincipal.php: case 'DAV::principal-URL': Privileges:CalDAVPrincipal.php: $prop->NewElement('principal-URL', $reply->href($this->principal_url) ); Privileges:CalDAVPrincipal.php: $prop->NewElement('getlastmodified', ISODateToHTTPDate($this->modified) ); Privileges:CalDAVPrincipal.php: $prop->NewElement('creationdate', DateToISODate($this->created) ); Privileges:CalDAVPrincipal.php: $locale = (isset($c->current_locale) ? $c->current_locale : ''); Privileges:CalDAVPrincipal.php: if ( isset($this->locale) && $this->locale != '' ) $locale = $this->locale; Privileges:CalDAVPrincipal.php: $prop->NewElement('getcontentlanguage', $locale ); Privileges:CalDAVPrincipal.php: case 'DAV::group-member-set': Privileges:CalDAVPrincipal.php: if ( ! $this->_is_group ) return false; Privileges:CalDAVPrincipal.php: $prop->NewElement('group-member-set', $reply->href($this->group_member_set) ); Privileges:CalDAVPrincipal.php: case 'DAV::group-membership': Privileges:CalDAVPrincipal.php: $prop->NewElement('group-membership', $reply->href($this->GroupMembership()) ); Privileges:CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:schedule-inbox-URL': Privileges:CalDAVPrincipal.php: $reply->CalDAVElement($prop, 'schedule-inbox-URL', $reply->href($this->schedule_inbox_url) ); Privileges:CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:schedule-outbox-URL': Privileges:CalDAVPrincipal.php: $reply->CalDAVElement($prop, 'schedule-outbox-URL', $reply->href($this->schedule_outbox_url) ); Privileges:CalDAVPrincipal.php: case 'http://calendarserver.org/ns/:dropbox-home-URL': Privileges:CalDAVPrincipal.php: $reply->CalendarserverElement($prop, 'dropbox-home-URL', $reply->href($this->dropbox_url) ); Privileges:CalDAVPrincipal.php: case 'http://calendarserver.org/ns/:xmpp-server': Privileges:CalDAVPrincipal.php: if ( ! isset( $this->xmpp_uri ) ) return false; Privileges:CalDAVPrincipal.php: $reply->CalendarserverElement($prop, 'xmpp-server', $this->xmpp_server ); Privileges:CalDAVPrincipal.php: case 'http://calendarserver.org/ns/:xmpp-uri': Privileges:CalDAVPrincipal.php: if ( ! isset( $this->xmpp_uri ) ) return false; Privileges:CalDAVPrincipal.php: $reply->CalendarserverElement($prop, 'xmpp-uri', $this->xmpp_uri ); Privileges:CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:carddav:addressbook-home-set': Privileges:CalDAVPrincipal.php: $reply->NSElement($prop, $tag, $reply->href( $this->addressbook_home_set() ) ); Privileges:CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-home-set': Privileges:CalDAVPrincipal.php: $reply->NSElement($prop, $tag, $reply->href( $this->calendar_home_set() ) ); Privileges:CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-free-busy-set': Privileges:CalDAVPrincipal.php: $reply->CalDAVElement( $prop, 'calendar-free-busy-set', $reply->href( $this->calendar_free_busy_set() ) ); Privileges:CalDAVPrincipal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set': Privileges:CalDAVPrincipal.php: $reply->CalDAVElement($prop, 'calendar-user-address-set', $reply->href($this->user_address_set) ); Privileges:CalDAVPrincipal.php: // After a careful reading of RFC3744 we see that this must be the principal-URL of the owner Privileges:CalDAVPrincipal.php: $reply->DAVElement( $prop, 'owner', $reply->href( $this->principal_url ) ); Privileges:CalDAVPrincipal.php: case 'DAV::principal-collection-set': Privileges:CalDAVPrincipal.php: $reply->DAVElement( $prop, 'principal-collection-set', $reply->href( ConstructURL('/') ) ); Privileges:CalDAVPrincipal.php: case 'DAV::alternate-URI-set': Privileges:CalDAVPrincipal.php: $prop->NewElement( $reply->Tag($tag)); Privileges:CalDAVPrincipal.php: case 'SOME-DENIED-PROPERTY': /** @todo indicating the style for future expansion */ Privileges:CalDAVPrincipal.php: $denied[] = $reply->Tag($tag); Privileges:CalDAVPrincipal.php: dbg_error_log('principal',': RenderAsXML: Principal "%s"', $this->username ); Privileges:CalDAVPrincipal.php: if ( ! $this->PrincipalProperty( $tag, $prop, $reply, $denied ) ) { Privileges:CalDAVPrincipal.php: dbg_error_log( 'principal', 'Request for unsupported property "%s" of principal "%s".', $tag, $this->username ); Privileges:CalDAVPrincipal.php: $not_found[] = $reply->Tag($tag); Privileges:CalDAVPrincipal.php: $href = $reply->href($this->url ); Privileges:CalDAVPrincipal.php: $noprop->NewElement( $v ); Privileges:CalDAVPrincipal.php: $noprop->NewElement( $v ); Privileges:caldav-PROPFIND.php:* CalDAV Server - handle PROPFIND method Privileges:caldav-PROPFIND.php://$request->NeedPrivilege( array('DAV::read', 'urn:ietf:params:xml:ns:caldav:read-free-busy','DAV::read-current-user-privilege-set') ); Privileges:caldav-PROPFIND.php:if ( !isset($request->xml_tags) ) { Privileges:caldav-PROPFIND.php: $request->DoResponse( 403, translate("Request body contains no XML data!") ); Privileges:caldav-PROPFIND.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-PROPFIND.php: $request->DoResponse( 403, translate("Request body is not valid XML data!") ); Privileges:caldav-PROPFIND.php:$allprop = $xmltree->GetPath('/DAV::propfind/*'); Privileges:caldav-PROPFIND.php: switch ( $propwrap->GetTag() ) { Privileges:caldav-PROPFIND.php: $subprop = $propwrap->GetElements(); Privileges:caldav-PROPFIND.php: $property_list[] = $v->GetTag(); Privileges:caldav-PROPFIND.php: * Add the calendar-proxy-read/write pseudocollections Privileges:caldav-PROPFIND.php: if ($parent_path != $request->principal->dav_name()) { Privileges:caldav-PROPFIND.php: dbg_error_log( 'PROPFIND', 'Not returning proxy response since "%s" != "%s"', $parent_path, $request->principal->dav_name() ); Privileges:caldav-PROPFIND.php: $proxy_group = $request->principal->ReadProxyGroup(); Privileges:caldav-PROPFIND.php: $proxy_group = $request->principal->WriteProxyGroup(); Privileges:caldav-PROPFIND.php: $collection->parent_container = $parent_path; Privileges:caldav-PROPFIND.php: $collection->dav_name = $parent_path.'calendar-proxy-'.$which.'/'; Privileges:caldav-PROPFIND.php: $collection->is_calendar = 'f'; Privileges:caldav-PROPFIND.php: $collection->is_addressbook = 'f'; Privileges:caldav-PROPFIND.php: $collection->is_principal = 't'; Privileges:caldav-PROPFIND.php: $collection->is_proxy = 't'; Privileges:caldav-PROPFIND.php: $collection->proxy_type = $which; Privileges:caldav-PROPFIND.php: $collection->type = 'proxy'; Privileges:caldav-PROPFIND.php: $collection->dav_displayname = $collection->dav_name; Privileges:caldav-PROPFIND.php: $collection->collection_id = 0; Privileges:caldav-PROPFIND.php: $collection->user_no = $session->user_no; Privileges:caldav-PROPFIND.php: $collection->username = $session->username; Privileges:caldav-PROPFIND.php: $collection->email = $session->email; Privileges:caldav-PROPFIND.php: $collection->created = date('Ymd\THis'); Privileges:caldav-PROPFIND.php: $collection->dav_etag = md5($c->system_name . $collection->dav_name . implode($proxy_group) ); Privileges:caldav-PROPFIND.php: $collection->proxy_for = $proxy_group; Privileges:caldav-PROPFIND.php: $collection->resourcetypes = sprintf('', $which); Privileges:caldav-PROPFIND.php: $collection->in_freebusy_set = 'f'; Privileges:caldav-PROPFIND.php: $collection->schedule_transp = 'transp'; Privileges:caldav-PROPFIND.php: $collection->timezone = null; Privileges:caldav-PROPFIND.php: $collection->description = ''; Privileges:caldav-PROPFIND.php: $resource->FetchPrincipal(); Privileges:caldav-PROPFIND.php: return $resource->RenderAsXML($property_list, $reply); Privileges:caldav-PROPFIND.php: $bound_from = $collection->bound_from(); Privileges:caldav-PROPFIND.php: $bound_to = $collection->dav_name(); Privileges:caldav-PROPFIND.php: if ( !isset($parent_path) ) $parent_path = $collection->dav_name(); Privileges:caldav-PROPFIND.php: $depth, $collection->dav_name(), $bound_from, $bound_to ); Privileges:caldav-PROPFIND.php: if ( ! $collection->IsCalendar() && ! $collection->IsAddressbook() ) { Privileges:caldav-PROPFIND.php: $params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:caldav-PROPFIND.php: if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-PROPFIND.php: while( $binding = $qry->Fetch() ) { Privileges:caldav-PROPFIND.php: $resource = new DAVResource($binding->dav_name); Privileges:caldav-PROPFIND.php: //if ( $resource->HavePrivilegeTo('DAV::read', false) ) { Privileges:caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$binding->dav_name)); Privileges:caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); Privileges:caldav-PROPFIND.php: $responses = array_merge($responses, get_collection_contents( $depth - 1, $resource, $binding->dav_name ) ); Privileges:caldav-PROPFIND.php: if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-PROPFIND.php: while( $subcollection = $qry->Fetch() ) { Privileges:caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$subcollection->dav_name)); Privileges:caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); Privileges:caldav-PROPFIND.php: $responses = array_merge($responses, get_collection_contents( $depth - 1, $resource, Privileges:caldav-PROPFIND.php: str_replace($resource->parent_path(), $parent_path, $resource->dav_name() ) ) ); Privileges:caldav-PROPFIND.php: if ( $collection->IsPrincipal() ) { Privileges:caldav-PROPFIND.php: // Caldav Proxy: 5.1 par. 2: Add child resources calendar-proxy-(read|write) Privileges:caldav-PROPFIND.php: dbg_error_log('PROPFIND','Adding calendar-proxy-read and write. Path: %s', $bound_from ); Privileges:caldav-PROPFIND.php: //if ( $collection->HavePrivilegeTo('DAV::read', false) ) { Privileges:caldav-PROPFIND.php: if ( $collection->IsCalendar() ) { Privileges:caldav-PROPFIND.php: if ( ! $collection->HavePrivilegeTo('all', false) ) { Privileges:caldav-PROPFIND.php: if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { Privileges:caldav-PROPFIND.php: $time_limit_clause = " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; Privileges:caldav-PROPFIND.php: if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY caldav_data.dav_id"; Privileges:caldav-PROPFIND.php: if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-PROPFIND.php: while( $item = $qry->Fetch() ) { Privileges:caldav-PROPFIND.php: $resource->set_bind_location( str_replace($bound_from,$bound_to,$item->dav_name)); Privileges:caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply, $parent_path ); Privileges:caldav-PROPFIND.php:if ( $request->IsProxyRequest() ) { Privileges:caldav-PROPFIND.php: $response = add_proxy_response($request->proxy_type, $request->principal->dav_name() ); Privileges:caldav-PROPFIND.php: $resource = new DAVResource($request->path); Privileges:caldav-PROPFIND.php: if ( ! $resource->Exists() ) { Privileges:caldav-PROPFIND.php: $request->PreconditionFailed( 404, 'must-exist', translate('That resource is not present on this server.') ); Privileges:caldav-PROPFIND.php: //$resource->NeedPrivilege('DAV::read'); Privileges:caldav-PROPFIND.php: if ( $resource->IsCollection() ) { Privileges:caldav-PROPFIND.php: dbg_error_log('PROPFIND','Getting collection contents: Depth %d, Path: %s', $request->depth, $resource->dav_name() ); Privileges:caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); Privileges:caldav-PROPFIND.php: if ( $request->depth > 0 ) { Privileges:caldav-PROPFIND.php: $responses = array_merge($responses, get_collection_contents( $request->depth - 1, $resource ) ); Privileges:caldav-PROPFIND.php: //elseif ( $request->HavePrivilegeTo('DAV::read',false) ) Privileges:caldav-PROPFIND.php: $responses[] = $resource->RenderAsXML($property_list, $reply); Privileges:caldav-PROPFIND.php:$xmldoc = $reply->Render('multistatus', $responses); Privileges:caldav-PROPFIND.php:$request->DoResponse( 207, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:caldav-PROPPATCH.php:* CalDAV Server - handle PROPPATCH method Privileges:caldav-PROPPATCH.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-PROPPATCH.php:$dav_resource = new DAVResource($request->path); Privileges:caldav-PROPPATCH.php:if ( ! ($dav_resource->HavePrivilegeTo('DAV::write-properties') || $dav_resource->IsBinding() ) ) { Privileges:caldav-PROPPATCH.php: $request->DoResponse( 403 ); Privileges:caldav-PROPPATCH.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-PROPPATCH.php:// echo $xmltree->Render(); Privileges:caldav-PROPPATCH.php:if ( $xmltree->GetTag() != "DAV::propertyupdate" ) { Privileges:caldav-PROPPATCH.php: $request->DoResponse( 403 ); Privileges:caldav-PROPPATCH.php:$setprops = $xmltree->GetPath("/DAV::propertyupdate/DAV::set/DAV::prop/*"); Privileges:caldav-PROPPATCH.php:$rmprops = $xmltree->GetPath("/DAV::propertyupdate/DAV::remove/DAV::prop/*"); Privileges:caldav-PROPPATCH.php:* the special-case stuff as needed and falling through to a default which Privileges:caldav-PROPPATCH.php:$qry->Begin(); Privileges:caldav-PROPPATCH.php:$setcalendar = count($xmltree->GetPath('/DAV::propertyupdate/DAV::set/DAV::prop/DAV::resourcetype/urn:ietf:params:xml:ns:caldav:calendar')); Privileges:caldav-PROPPATCH.php: $tag = $setting->GetTag(); Privileges:caldav-PROPPATCH.php: $content = $setting->RenderContent(); Privileges:caldav-PROPPATCH.php: * Can't set displayname on resources - only collections or principals Privileges:caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() || $dav_resource->IsPrincipal() ) { Privileges:caldav-PROPPATCH.php: if ( $dav_resource->IsBinding() ) { Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE dav_binding SET dav_displayname = :displayname WHERE dav_name = :dav_name', Privileges:caldav-PROPPATCH.php: array( ':displayname' => $content, ':dav_name' => $dav_resource->dav_name()) ); Privileges:caldav-PROPPATCH.php: else if ( $dav_resource->IsPrincipal() ) { Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE dav_principal SET fullname = :displayname, displayname = :displayname, modified = current_timestamp WHERE user_no = :user_no', Privileges:caldav-PROPPATCH.php: array( ':displayname' => $content, ':user_no' => $request->user_no) ); Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET dav_displayname = :displayname, modified = current_timestamp WHERE dav_name = :dav_name', Privileges:caldav-PROPPATCH.php: array( ':displayname' => $content, ':dav_name' => $dav_resource->dav_name()) ); Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: $setcollection = count($setting->GetPath('DAV::resourcetype/DAV::collection')); Privileges:caldav-PROPPATCH.php: $setaddressbook = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:carddav:addressbook')); Privileges:caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && $setcollection && ! $dav_resource->IsPrincipal() Privileges:caldav-PROPPATCH.php: && ! $dav_resource->IsBinding() && ! ($setaddressbook && $setcalendar) ) { Privileges:caldav-PROPPATCH.php: $resourcetypes = $setting->GetPath('DAV::resourcetype/*'); Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET is_calendar = :is_calendar::boolean, is_addressbook = :is_addressbook::boolean, Privileges:caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':resourcetypes' => $resourcetypes, Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-calendar-transp': Privileges:caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && ( $dav_resource->IsCalendar() || $setcalendar ) && !$dav_resource->IsBinding() ) { Privileges:caldav-PROPPATCH.php: $transparency = $setting->GetPath('urn:ietf:params:xml:ns:caldav:schedule-calendar-transp/*'); Privileges:caldav-PROPPATCH.php: $transparency = preg_replace( '{^.*:}', '', $transparency[0]->GetTag()); Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET schedule_transp = :transparency WHERE dav_name = :dav_name', Privileges:caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':transparency' => $transparency ) ); Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: translate("The CalDAV:schedule-calendar-transp property may only be set on calendars.") ) Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-free-busy-set': Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'responsedescription', translate("The calendar-free-busy-set is superseded by the schedule-transp property of a calendar collection.") ) Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-timezone': Privileges:caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && $dav_resource->IsCalendar() && ! $dav_resource->IsBinding() ) { Privileges:caldav-PROPPATCH.php: $tzcomponent = $setting->GetPath('urn:ietf:params:xml:ns:caldav:calendar-timezone'); Privileges:caldav-PROPPATCH.php: $tzstring = $tzcomponent[0]->GetContent(); Privileges:caldav-PROPPATCH.php: $timezones = $calendar->component->GetComponents('VTIMEZONE'); Privileges:caldav-PROPPATCH.php: $tzid = $tz->GetPValue('TZID'); Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET timezone = :tzid WHERE dav_name = :dav_name', Privileges:caldav-PROPPATCH.php: array( ':tzid' => $tzid, ':dav_name' => $dav_resource->dav_name()) ); Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: translate("calendar-timezone property is only valid for a calendar.") ) Privileges:caldav-PROPPATCH.php: * The following properties are read-only, so they will cause the request to fail Privileges:caldav-PROPPATCH.php: case 'DAV::principal-collection-set': Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set': Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-inbox-URL': Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-outbox-URL': Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: translate("Property is read-only") ) Privileges:caldav-PROPPATCH.php: $qry->QDo('SELECT set_dav_property( :dav_name, :user_no, :tag::text, :value::text)', Privileges:caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':user_no' => $request->user_no, ':tag' => $tag, ':value' => $content) ); Privileges:caldav-PROPPATCH.php: $tag = $setting->GetTag(); Privileges:caldav-PROPPATCH.php: $content = $setting->RenderContent(); Privileges:caldav-PROPPATCH.php: $failure['rm-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:calendar-timezone': Privileges:caldav-PROPPATCH.php: if ( $dav_resource->IsCollection() && $dav_resource->IsCalendar() && ! $dav_resource->IsBinding() ) { Privileges:caldav-PROPPATCH.php: $qry->QDo('UPDATE collection SET timezone = NULL WHERE dav_name = :dav_name', array( ':dav_name' => $dav_resource->dav_name()) ); Privileges:caldav-PROPPATCH.php: $failure['set-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ), Privileges:caldav-PROPPATCH.php: translate("calendar-timezone property is only valid for a calendar.") ) Privileges:caldav-PROPPATCH.php: * The following properties are read-only, so they will cause the request to fail Privileges:caldav-PROPPATCH.php: case 'DAV::principal-collection-set': Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:CALENDAR-USER-ADDRESS-SET': Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-inbox-URL': Privileges:caldav-PROPPATCH.php: case 'urn:ietf:params:xml:ns:caldav:schedule-outbox-URL': Privileges:caldav-PROPPATCH.php: $failure['rm-'.$tag] = new XMLElement( 'propstat', array( Privileges:caldav-PROPPATCH.php: new XMLElement('responsedescription', translate("Property is read-only") ) Privileges:caldav-PROPPATCH.php: $qry->QDo('DELETE FROM property WHERE dav_name=:dav_name AND property_name=:property_name', Privileges:caldav-PROPPATCH.php: array( ':dav_name' => $dav_resource->dav_name(), ':property_name' => $tag) ); Privileges:caldav-PROPPATCH.php: $url = ConstructURL($request->path); Privileges:caldav-PROPPATCH.php: $qry->Rollback(); Privileges:caldav-PROPPATCH.php: $request->DoResponse( 207, $multistatus->Render(0,''), 'text/xml; charset="utf-8"' ); Privileges:caldav-PROPPATCH.php:if ( $qry->Commit() ) { Privileges:caldav-PROPPATCH.php: $url = ConstructURL($request->path); Privileges:caldav-PROPPATCH.php: $request->DoResponse( 200, $multistatus->Render(0,''), 'text/xml; charset="utf-8"' ); Privileges:caldav-PROPPATCH.php:$request->DoResponse( 500 ); Privileges:caldav-PUT-default.php:* CalDAV Server - handle PUT method on unknown (arbitrary) content-types Privileges:caldav-PUT-default.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { Privileges:caldav-PUT-default.php: fwrite($fh,$request->raw_post); Privileges:caldav-PUT-default.php:$lock_opener = $request->FailIfLocked(); Privileges:caldav-PUT-default.php:$dest = new DAVResource($request->path); Privileges:caldav-PUT-default.php:$container = $dest->FetchParentContainer(); Privileges:caldav-PUT-default.php:if ( $container->IsCalendar() ) { Privileges:caldav-PUT-default.php: $request->PreconditionFailed(412,'urn:ietf:params:xml:ns:caldav:supported-calendar-data', Privileges:caldav-PUT-default.php: translate('Incorrect content type for calendar: ') . $request->content_type ); Privileges:caldav-PUT-default.php:else if ( $container->IsAddressbook() ) { Privileges:caldav-PUT-default.php: $request->PreconditionFailed(412,'urn:ietf:params:xml:ns:carddav:supported-address-data', Privileges:caldav-PUT-default.php: translate('Incorrect content type for addressbook: ') . $request->content_type ); Privileges:caldav-PUT-default.php:if ( ! $dest->Exists() ) { Privileges:caldav-PUT-default.php: if ( $container->IsPrincipal() ) { Privileges:caldav-PUT-default.php: $request->DoResponse(403,translate('A DAViCal principal collection may only contain collections')); Privileges:caldav-PUT-default.php: if ( ! $container->Exists() ) { Privileges:caldav-PUT-default.php: $request->DoResponse( 409, translate('Destination collection does not exist') ); Privileges:caldav-PUT-default.php: $container->NeedPrivilege('DAV::bind'); Privileges:caldav-PUT-default.php: if ( $dest->IsCollection() ) { Privileges:caldav-PUT-default.php: if ( ! isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections ) { Privileges:caldav-PUT-default.php: $request->DoResponse(403,translate('You may not PUT to a collection URL')); Privileges:caldav-PUT-default.php: $request->DoResponse(403,translate('PUT on a collection is only allowed for text/calendar content against a calendar collection')); Privileges:caldav-PUT-default.php: $dest->NeedPrivilege('DAV::write-content'); Privileges:caldav-PUT-default.php:if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { Privileges:caldav-PUT-default.php: $request->DoResponse(412); Privileges:caldav-PUT-default.php:if ( isset($request->etag_if_match) && $request->etag_if_match != $dest->unique_tag() ) { Privileges:caldav-PUT-default.php: $request->DoResponse(412); Privileges:caldav-PUT-default.php:$collection_id = $container->GetProperty('collection_id'); Privileges:caldav-PUT-default.php:$qry->Begin(); Privileges:caldav-PUT-default.php:$etag = md5($request->raw_post); Privileges:caldav-PUT-default.php: ':user_no' => $dest->GetProperty('user_no'), Privileges:caldav-PUT-default.php: ':dav_name' => $dest->bound_from(), Privileges:caldav-PUT-default.php: ':dav_data' => $request->raw_post, Privileges:caldav-PUT-default.php: ':session_user' => $session->user_no Privileges:caldav-PUT-default.php:if ( $dest->Exists() ) { Privileges:caldav-PUT-default.php:$qry->QDo( $sql, $params ); Privileges:caldav-PUT-default.php:$qry->QDo("SELECT write_sync_change( $collection_id, $response_code, :dav_name)", array(':dav_name' => $dest->bound_from() ) ); Privileges:caldav-PUT-default.php:if ( !$qry->Exec('move') ) rollback(500); Privileges:caldav-PUT-default.php:$request->DoResponse( $response_code ); Privileges:caldav-PUT-functions.php:* CalDAV Server - handle PUT method Privileges:caldav-PUT-functions.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-PUT-functions.php:$tz_regex = ':^(Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Brazil|Canada|Chile|Etc|Europe|Indian|Mexico|Mideast|Pacific|US)/[a-z_]+$:i'; Privileges:caldav-PUT-functions.php: $qry->Rollback(); Privileges:caldav-PUT-functions.php: if ( isset($bad_events) && isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) { Privileges:caldav-PUT-functions.php: $request->DoResponse( $error_no, $message ); Privileges:caldav-PUT-functions.php: $c->messages[] = sprintf(translate('Status: %d, Message: %s, User: %d, Path: %s'), $error_no, $message, $user_no, $path); Privileges:caldav-PUT-functions.php: if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) { Privileges:caldav-PUT-functions.php: if ( ! $qry->Exec('PUT',__LINE__,__FILE__) ) { Privileges:caldav-PUT-functions.php: if ( !isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections == true ) { Privileges:caldav-PUT-functions.php: if ( $qry->rows() == 0 ) { Privileges:caldav-PUT-functions.php: $request->DoResponse( 405 ); // Method not allowed Privileges:caldav-PUT-functions.php: if ( $qry->rows() == 0 ) { Privileges:caldav-PUT-functions.php: $qry->QDo( $sql, $params ); Privileges:caldav-PUT-functions.php: $collection = $qry->Fetch(); Privileges:caldav-PUT-functions.php: $params = array( ':is_public' => ($public?'t':'f'), ':collection_id' => $collection->collection_id ); Privileges:caldav-PUT-functions.php: if ( ! $qry->QDo($sql,$params) ) { Privileges:caldav-PUT-functions.php: if( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 1 ) { Privileges:caldav-PUT-functions.php: $collection = $qry->Fetch(); Privileges:caldav-PUT-functions.php: if ($collection->public_events_only == 't') { Privileges:caldav-PUT-functions.php: $resources = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-PUT-functions.php: $etag = md5 ( $request->raw_post ); Privileges:caldav-PUT-functions.php: $attendees = $ic->GetProperties('ATTENDEE'); Privileges:caldav-PUT-functions.php: $wr_attendees = $ic->GetProperties('X-WR-ATTENDEE'); Privileges:caldav-PUT-functions.php: dbg_error_log( "POST", "Non-compliant iCal request. Using X-WR-ATTENDEE property" ); Privileges:caldav-PUT-functions.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); Privileges:caldav-PUT-functions.php: if ( $attendee_email == $request->principal->email ) { Privileges:caldav-PUT-functions.php: if ( $attendee->GetParameterValue ( 'PARTSTAT' ) != 'NEEDS-ACTION' || preg_match ( '/^[35]\.[3-9]/', $attendee->GetParameterValue ( 'SCHEDULE-STATUS' ) ) ) { Privileges:caldav-PUT-functions.php: $attendee->SetParameterValue ('SCHEDULE-STATUS','3.7;Invalid Calendar User'); Privileges:caldav-PUT-functions.php: $deliver_path = preg_replace ( '/^.*caldav.php/','', $attendee_principal->schedule_inbox_url ); Privileges:caldav-PUT-functions.php: $priv = $ar->HavePrivilegeTo('schedule-deliver-invite' ); Privileges:caldav-PUT-functions.php: if ( ! $ar->HavePrivilegeTo('schedule-deliver-invite' ) ){ Privileges:caldav-PUT-functions.php: $privnodes = array( $reply->href(ConstructURL($attendee_principal->schedule_inbox_url)), new XMLElement( 'privilege' ) ); Privileges:caldav-PUT-functions.php: $reply->NSElement( $privnodes[1], 'schedule-deliver-invite' ); Privileges:caldav-PUT-functions.php: $xml = new XMLElement( 'need-privileges', new XMLElement( 'resource', $privnodes) ); Privileges:caldav-PUT-functions.php: $xmldoc = $reply->Render('error',$xml); Privileges:caldav-PUT-functions.php: $request->DoResponse( 403, $xmldoc, 'text/xml; charset="utf-8"'); Privileges:caldav-PUT-functions.php: $attendee->SetParameterValue ('SCHEDULE-STATUS','1.2;Scheduling message has been delivered'); Privileges:caldav-PUT-functions.php: $ncal->VCalendar (); Privileges:caldav-PUT-functions.php: $ncal->AddProperty ( 'METHOD', 'REQUEST' ); Privileges:caldav-PUT-functions.php: $ncal->AddComponent ( array_merge ( $ical->GetComponents('VEVENT',false) , array ($ic) )); Privileges:caldav-PUT-functions.php: $content = $ncal->Render(); Privileges:caldav-PUT-functions.php: $cid = $ar->GetProperty('collection_id'); Privileges:caldav-PUT-functions.php: dbg_error_log('DELIVER', 'to user: %s, to path: %s, collection: %s, from user: %s, caldata %s', $attendee_principal->user_no, $deliver_path, $cid, $request->user_no, $content ); Privileges:caldav-PUT-functions.php: write_resource( $attendee_principal->user_no, $deliver_path . $etag . '.ics' , Privileges:caldav-PUT-functions.php: $content , $ar->GetProperty('collection_id'), $request->user_no, Privileges:caldav-PUT-functions.php: $attendee->SetParameterValue ('SCHEDULE-STATUS','1.2;Scheduling message has been delivered'); Privileges:caldav-PUT-functions.php: $ncal->VCalendar (); Privileges:caldav-PUT-functions.php: $ncal->AddProperty ( 'METHOD', 'REQUEST' ); Privileges:caldav-PUT-functions.php: $ncal->AddComponent ( array_merge ( $ical->GetComponents('VEVENT',false) , array ($ic) )); Privileges:caldav-PUT-functions.php: $content = $ncal->Render(); Privileges:caldav-PUT-functions.php: $deliver_path = preg_replace ( '/^.*caldav.php/','', $request->principal->schedule_inbox_url ); Privileges:caldav-PUT-functions.php: write_resource( $request->user_no, $deliver_path . $etag . '.ics' , Privileges:caldav-PUT-functions.php: $content , $ar->GetProperty('collection_id'), $request->user_no, Privileges:caldav-PUT-functions.php: header('Schedule-Tag: "'.$etag . '"' ); Privileges:caldav-PUT-functions.php: $request->DoResponse( 201, 'Created' ); Privileges:caldav-PUT-functions.php: $resources = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-PUT-functions.php: $etag = md5 ( $request->raw_post ); Privileges:caldav-PUT-functions.php: $organizer = $ic->GetProperties('ORGANIZER'); Privileges:caldav-PUT-functions.php: $attendees = array_merge($organizer,$ic->GetProperties('ATTENDEE')); Privileges:caldav-PUT-functions.php: $wr_attendees = $ic->GetProperties('X-WR-ATTENDEE'); Privileges:caldav-PUT-functions.php: dbg_error_log( "POST", "Non-compliant iCal request. Using X-WR-ATTENDEE property" ); Privileges:caldav-PUT-functions.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); Privileges:caldav-PUT-functions.php: $deliver_path = preg_replace ( '/^.*caldav.php/','', $attendee_principal->schedule_inbox_url ); Privileges:caldav-PUT-functions.php: $attendee_email = preg_replace( '/^mailto:/', '', $attendee->Value() ); Privileges:caldav-PUT-functions.php: if ( $attendee_email == $request->principal->email ) { Privileges:caldav-PUT-functions.php: if ( ! $ar->HavePrivilegeTo('schedule-deliver-reply' ) ){ Privileges:caldav-PUT-functions.php: $privnodes = array( $reply->href(ConstructURL($attendee_principal->schedule_inbox_url)), new XMLElement( 'privilege' ) ); Privileges:caldav-PUT-functions.php: $reply->NSElement( $privnodes[1], 'schedule-deliver-reply' ); Privileges:caldav-PUT-functions.php: $xml = new XMLElement( 'need-privileges', new XMLElement( 'resource', $privnodes) ); Privileges:caldav-PUT-functions.php: $xmldoc = $reply->Render('error',$xml); Privileges:caldav-PUT-functions.php: $request->DoResponse( 403, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:caldav-PUT-functions.php: $ncal->VCalendar (); Privileges:caldav-PUT-functions.php: $ncal->AddProperty ( 'METHOD', 'REPLY' ); Privileges:caldav-PUT-functions.php: $ncal->AddComponent ( array_merge ( $ical->GetComponents('VEVENT',false) , array ($ic) )); Privileges:caldav-PUT-functions.php: $content = $ncal->Render(); Privileges:caldav-PUT-functions.php: write_resource( $attendee_principal->user_no, $deliver_path . $etag . '.ics' , Privileges:caldav-PUT-functions.php: $content , $ar->GetProperty('collection_id'), $request->user_no, Privileges:caldav-PUT-functions.php: $request->DoResponse( 201, 'Created' ); Privileges:caldav-PUT-functions.php:* @return float The result of the scheduling request, per caldav-sched #3.5.4 Privileges:caldav-PUT-functions.php: dbg_error_log( 'PUT', 'create_scheduling_requests called with non-object parameter (%s)', gettype($resource) ); Privileges:caldav-PUT-functions.php: $attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/ATTENDEE'); Privileges:caldav-PUT-functions.php: $wr_attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/X-WR-ATTENDEE'); Privileges:caldav-PUT-functions.php: dbg_error_log( 'POST', 'Non-compliant iCal request. Using X-WR-ATTENDEE property' ); Privileges:caldav-PUT-functions.php: dbg_error_log( 'PUT', 'Event has no attendees - no scheduling required.', count($attendees) ); Privileges:caldav-PUT-functions.php: $attendee->SetParameterValue( 'SCHEDULE-STATUS', write_scheduling_request( $resource, $attendee->Value() ) ); Privileges:caldav-PUT-functions.php: dbg_error_log( 'PUT', 'update_scheduling_requests called with non-object parameter (%s)', gettype($resource) ); Privileges:caldav-PUT-functions.php: $attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/ATTENDEE'); Privileges:caldav-PUT-functions.php: $wr_attendees = $resource->GetPropertiesByPath('/VCALENDAR/*/X-WR-ATTENDEE'); Privileges:caldav-PUT-functions.php: dbg_error_log( 'POST', 'Non-compliant iCal request. Using X-WR-ATTENDEE property' ); Privileges:caldav-PUT-functions.php: dbg_error_log( 'PUT', 'Event has no attendees - no scheduling required.', count($attendees) ); Privileges:caldav-PUT-functions.php: $attendee->SetParameterValue( 'SCHEDULE-STATUS', write_scheduling_request( $resource, $attendee->Value() ) ); Privileges:caldav-PUT-functions.php: if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['put'])) ) { Privileges:caldav-PUT-functions.php: $fh = fopen('/tmp/PUT-2.txt','w'); Privileges:caldav-PUT-functions.php: $timezones = $calendar->GetComponents('VTIMEZONE',true); Privileges:caldav-PUT-functions.php: $components = $calendar->GetComponents('VTIMEZONE',false); Privileges:caldav-PUT-functions.php: $displayname = $calendar->GetPValue('X-WR-CALNAME'); Privileges:caldav-PUT-functions.php: if ( ! $qry->Exec('PUT',__LINE__,__FILE__) ) rollback_on_error( $caldav_context, $user_no, $path ); Privileges:caldav-PUT-functions.php: $tz_ids[$tz->GetPValue('TZID')] = $k; Privileges:caldav-PUT-functions.php: $uid = $comp->GetPValue('UID'); Privileges:caldav-PUT-functions.php: $tzid = $comp->GetPParamValue('DTSTART', 'TZID'); Privileges:caldav-PUT-functions.php: if ( !isset($tzid) || $tzid == '' ) $tzid = $comp->GetPParamValue('DUE','TZID'); Privileges:caldav-PUT-functions.php: if ( ! $qry->Exec('PUT',__LINE__,__FILE__) ) rollback_on_error( $caldav_context, $user_no, $path ); Privileges:caldav-PUT-functions.php: if ( ! $qry->rows() == 1 ) { Privileges:caldav-PUT-functions.php: $collection = $qry->Fetch(); Privileges:caldav-PUT-functions.php: if ( !(isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import) ) $qry->Begin(); Privileges:caldav-PUT-functions.php: $base_params = array( ':collection_id' => $collection->collection_id ); Privileges:caldav-PUT-functions.php: if ( !$qry->QDo('DELETE FROM calendar_item WHERE collection_id = :collection_id', $base_params) Privileges:caldav-PUT-functions.php: || !$qry->QDo('DELETE FROM caldav_data WHERE collection_id = :collection_id', $base_params) ) Privileges:caldav-PUT-functions.php: rollback_on_error( $caldav_context, $user_no, $collection->collection_id ); Privileges:caldav-PUT-functions.php: if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin(); Privileges:caldav-PUT-functions.php: $vcal->VCalendar(); Privileges:caldav-PUT-functions.php: $vcal->SetComponents($resource); Privileges:caldav-PUT-functions.php: $icalendar = $vcal->Render(); Privileges:caldav-PUT-functions.php: $dav_data_params[':caldav_type'] = $first->GetType(); Privileges:caldav-PUT-functions.php: $dav_data_params[':session_user'] = $session->user_no; Privileges:caldav-PUT-functions.php: if ( !$qry->QDo($dav_data_insert,$dav_data_params) ) rollback_on_error( $caldav_context, $user_no, $path ); Privileges:caldav-PUT-functions.php: $qry->QDo('SELECT dav_id FROM caldav_data WHERE dav_name = :dav_name ', array(':dav_name' => $dav_data_params[':dav_name'])); Privileges:caldav-PUT-functions.php: if ( $qry->rows() == 1 && $row = $qry->Fetch() ) { Privileges:caldav-PUT-functions.php: $dav_id = $row->dav_id; Privileges:caldav-PUT-functions.php: $dtstart = $first->GetPValue('DTSTART'); Privileges:caldav-PUT-functions.php: if ( (!isset($dtstart) || $dtstart == '') && $first->GetPValue('DUE') != '' ) { Privileges:caldav-PUT-functions.php: $dtstart = $first->GetPValue('DUE'); Privileges:caldav-PUT-functions.php: $dtend = $first->GetPValue('DTEND'); Privileges:caldav-PUT-functions.php: dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') ); Privileges:caldav-PUT-functions.php: if ( $first->GetPValue('DURATION') != '' AND $dtstart != '' ) { Privileges:caldav-PUT-functions.php: $duration = preg_replace( '#[PT]#', ' ', $first->GetPValue('DURATION') ); Privileges:caldav-PUT-functions.php: elseif ( $first->GetType() == 'VEVENT' ) { Privileges:caldav-PUT-functions.php: * non-inclusive end is the end of the calendar date specified by the Privileges:caldav-PUT-functions.php: * a "DTSTART" property with a DATE-TIME data type but no "DTEND" property, Privileges:caldav-PUT-functions.php: $value_type = $first->GetPParamValue('DTSTART','VALUE'); Privileges:caldav-PUT-functions.php: $last_modified = $first->GetPValue('LAST-MODIFIED'); Privileges:caldav-PUT-functions.php: $dtstamp = $first->GetPValue('DTSTAMP'); Privileges:caldav-PUT-functions.php: $class = ($collection->public_events_only == 't' ? 'PUBLIC' : $first->GetPValue('CLASS') ); Privileges:caldav-PUT-functions.php: $tzid = $first->GetPParamValue('DTSTART','TZID'); Privileges:caldav-PUT-functions.php: if ( !isset($tzid) || $tzid == '' ) $tzid = $first->GetPParamValue('DUE','TZID'); Privileges:caldav-PUT-functions.php: $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); Privileges:caldav-PUT-functions.php: $qry->QDo('SET TIMEZONE TO \''.$tz_locn."'" ); Privileges:caldav-PUT-functions.php: if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 0 ) { Privileges:caldav-PUT-functions.php: $params[':tzspec'] = (isset($tz) ? $tz->Render() : null ); Privileges:caldav-PUT-functions.php: $qry->QDo('INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(:tzid,:tzlocn,:tzspec)', $params ); Privileges:caldav-PUT-functions.php: $calitem_params[':uid'] = $first->GetPValue('UID'); Privileges:caldav-PUT-functions.php: $calitem_params[':summary'] = $first->GetPValue('SUMMARY'); Privileges:caldav-PUT-functions.php: $calitem_params[':location'] = $first->GetPValue('LOCATION'); Privileges:caldav-PUT-functions.php: $calitem_params[':transp'] = $first->GetPValue('TRANSP'); Privileges:caldav-PUT-functions.php: $calitem_params[':description'] = $first->GetPValue('DESCRIPTION'); Privileges:caldav-PUT-functions.php: $calitem_params[':rrule'] = $first->GetPValue('RRULE'); Privileges:caldav-PUT-functions.php: $calitem_params[':url'] = $first->GetPValue('URL'); Privileges:caldav-PUT-functions.php: $calitem_params[':priority'] = $first->GetPValue('PRIORITY'); Privileges:caldav-PUT-functions.php: $calitem_params[':due'] = $first->GetPValue('DUE'); Privileges:caldav-PUT-functions.php: $calitem_params[':percent_complete'] = $first->GetPValue('PERCENT-COMPLETE'); Privileges:caldav-PUT-functions.php: $calitem_params[':status'] = $first->GetPValue('STATUS'); Privileges:caldav-PUT-functions.php: $created = $first->GetPValue('CREATED'); Privileges:caldav-PUT-functions.php: if ( !$qry->QDo($sql,$calitem_params) ) rollback_on_error( $caldav_context, $user_no, $path); Privileges:caldav-PUT-functions.php: if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Commit(); Privileges:caldav-PUT-functions.php: if ( !(isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import) ) { Privileges:caldav-PUT-functions.php: if ( ! $qry->Commit() ) rollback_on_error( $caldav_context, $user_no, $path); Privileges:caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); Privileges:caldav-PUT-functions.php: $alarms = $ical->GetComponents('VALARM'); Privileges:caldav-PUT-functions.php: $qry->SetSql('INSERT INTO calendar_alarm ( dav_id, action, trigger, summary, description, component, next_trigger ) Privileges:caldav-PUT-functions.php: $qry->Prepare(); Privileges:caldav-PUT-functions.php: $trigger = array_merge($v->GetProperties('TRIGGER')); Privileges:caldav-PUT-functions.php: $trigger_type = $trigger->GetParameterValue('VALUE'); Privileges:caldav-PUT-functions.php: switch ( $trigger->GetParameterValue('RELATED') ) { Privileges:caldav-PUT-functions.php: case 'DTEND': $related = $ical->GetPValue('DTEND'); break; Privileges:caldav-PUT-functions.php: case 'DUE': $related = $ical->GetPValue('DUE'); break; Privileges:caldav-PUT-functions.php: default: $related = $ical->GetPValue('DTSTART'); Privileges:caldav-PUT-functions.php: $duration = $trigger->Value(); Privileges:caldav-PUT-functions.php: $minus = (substr($duration,0,1) == '-'); Privileges:caldav-PUT-functions.php: $related_trigger = trim(preg_replace( '#[PT-]#', ' ', $duration )); Privileges:caldav-PUT-functions.php: $related_trigger = preg_replace( '{(\d+[WDHMS])}', '-$1 ', $related_trigger ); Privileges:caldav-PUT-functions.php: $qry->Bind(':action', $v->GetPValue('ACTION')); Privileges:caldav-PUT-functions.php: $qry->Bind(':trigger', $trigger->Render()); Privileges:caldav-PUT-functions.php: $qry->Bind(':summary', $v->GetPValue('SUMMARY')); Privileges:caldav-PUT-functions.php: $qry->Bind(':description', $v->GetPValue('DESCRIPTION')); Privileges:caldav-PUT-functions.php: $qry->Bind(':component', $v->Render()); Privileges:caldav-PUT-functions.php: $qry->Bind(':related', $related ); Privileges:caldav-PUT-functions.php: $qry->Bind(':related_trigger', $related_trigger ); Privileges:caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); Privileges:caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); Privileges:caldav-PUT-functions.php: $attendees = $ical->GetProperties('ATTENDEE'); Privileges:caldav-PUT-functions.php: $qry->SetSql('INSERT INTO calendar_attendee ( dav_id, status, partstat, cn, attendee, role, rsvp, property ) Privileges:caldav-PUT-functions.php: $qry->Prepare(); Privileges:caldav-PUT-functions.php: $attendee = $v->Value(); Privileges:caldav-PUT-functions.php: dbg_error_log( 'LOG', 'Duplicate: "%s"', $v->Render() ); Privileges:caldav-PUT-functions.php: $qry->Bind(':attendee', $attendee ); Privileges:caldav-PUT-functions.php: $qry->Bind(':status', $v->GetParameterValue('STATUS') ); Privileges:caldav-PUT-functions.php: $qry->Bind(':partstat', $v->GetParameterValue('PARTSTAT') ); Privileges:caldav-PUT-functions.php: $qry->Bind(':cn', $v->GetParameterValue('CN') ); Privileges:caldav-PUT-functions.php: $qry->Bind(':role', $v->GetParameterValue('ROLE') ); Privileges:caldav-PUT-functions.php: $qry->Bind(':rsvp', $v->GetParameterValue('RSVP') ); Privileges:caldav-PUT-functions.php: $qry->Bind(':property', $v->Render() ); Privileges:caldav-PUT-functions.php: $qry->Exec('PUT',__LINE__,__FILE__); Privileges:caldav-PUT-functions.php: $processed[$attendee] = $v->Render(); Privileges:caldav-PUT-functions.php: $resources = $ic->GetComponents('VTIMEZONE',false); // Not matching VTIMEZONE Privileges:caldav-PUT-functions.php: /** @TODO: Handle writing non-calendar resources, like address book entries or random file data */ Privileges:caldav-PUT-functions.php: $resource_type = $first->GetType(); Privileges:caldav-PUT-functions.php: $qry->Begin(); Privileges:caldav-PUT-functions.php: if ( !$qry->QDo($sql,$params) ) { Privileges:caldav-PUT-functions.php: $qry->QDo('SELECT dav_id FROM caldav_data WHERE dav_name = :dav_name ', array(':dav_name' => $path)); Privileges:caldav-PUT-functions.php: if ( $qry->rows() == 1 && $row = $qry->Fetch() ) { Privileges:caldav-PUT-functions.php: $dav_id = $row->dav_id; Privileges:caldav-PUT-functions.php: $dtstart = $first->GetPValue('DTSTART'); Privileges:caldav-PUT-functions.php: if ( (!isset($dtstart) || $dtstart == '') && $first->GetPValue('DUE') != '' ) { Privileges:caldav-PUT-functions.php: $dtstart = $first->GetPValue('DUE'); Privileges:caldav-PUT-functions.php: $dtend = $first->GetPValue('DTEND'); Privileges:caldav-PUT-functions.php: dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') ); Privileges:caldav-PUT-functions.php: if ( $first->GetPValue('DURATION') != '' AND $dtstart != '' ) { Privileges:caldav-PUT-functions.php: $duration = preg_replace( '#[PT]#', ' ', $first->GetPValue('DURATION') ); Privileges:caldav-PUT-functions.php: elseif ( $first->GetType() == 'VEVENT' ) { Privileges:caldav-PUT-functions.php: * non-inclusive end is the end of the calendar date specified by the Privileges:caldav-PUT-functions.php: * a "DTSTART" property with a DATE-TIME data type but no "DTEND" property, Privileges:caldav-PUT-functions.php: $value_type = $first->GetPParamValue('DTSTART','VALUE'); Privileges:caldav-PUT-functions.php: $last_modified = $first->GetPValue('LAST-MODIFIED'); Privileges:caldav-PUT-functions.php: $dtstamp = $first->GetPValue('DTSTAMP'); Privileges:caldav-PUT-functions.php: $class = $first->GetPValue('CLASS'); Privileges:caldav-PUT-functions.php: $tzid = $first->GetPParamValue('DTSTART','TZID'); Privileges:caldav-PUT-functions.php: if ( !isset($tzid) || $tzid == '' ) $tzid = $first->GetPParamValue('DUE','TZID'); Privileges:caldav-PUT-functions.php: $timezones = $ic->GetComponents('VTIMEZONE'); Privileges:caldav-PUT-functions.php: if ( $tz->GetPValue('TZID') != $tzid ) { Privileges:caldav-PUT-functions.php: dbg_error_log( 'ERROR', ' Event includes TZID[%s] but uses TZID[%s]!', $tz->GetPValue('TZID'), $tzid ); Privileges:caldav-PUT-functions.php: $tzid = $tz->GetPValue('TZID'); Privileges:caldav-PUT-functions.php: $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); Privileges:caldav-PUT-functions.php: $qry->QDo('SET TIMEZONE TO \''.$tz_locn."'" ); Privileges:caldav-PUT-functions.php: if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 0 ) { Privileges:caldav-PUT-functions.php: $params[':tzspec'] = (isset($tz) ? $tz->Render() : null ); Privileges:caldav-PUT-functions.php: $qry->QDo('INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(:tzid,:tzlocn,:tzspec)', $params ); Privileges:caldav-PUT-functions.php: $created = $first->GetPValue('CREATED'); Privileges:caldav-PUT-functions.php: $calitem_params[':uid'] = $first->GetPValue('UID'); Privileges:caldav-PUT-functions.php: $calitem_params[':summary'] = $first->GetPValue('SUMMARY'); Privileges:caldav-PUT-functions.php: $calitem_params[':location'] = $first->GetPValue('LOCATION'); Privileges:caldav-PUT-functions.php: $calitem_params[':transp'] = $first->GetPValue('TRANSP'); Privileges:caldav-PUT-functions.php: $calitem_params[':description'] = $first->GetPValue('DESCRIPTION'); Privileges:caldav-PUT-functions.php: $calitem_params[':rrule'] = $first->GetPValue('RRULE'); Privileges:caldav-PUT-functions.php: $calitem_params[':url'] = $first->GetPValue('URL'); Privileges:caldav-PUT-functions.php: $calitem_params[':priority'] = $first->GetPValue('PRIORITY'); Privileges:caldav-PUT-functions.php: $calitem_params[':due'] = $first->GetPValue('DUE'); Privileges:caldav-PUT-functions.php: $calitem_params[':percent_complete'] = $first->GetPValue('PERCENT-COMPLETE'); Privileges:caldav-PUT-functions.php: $calitem_params[':status'] = $first->GetPValue('STATUS'); Privileges:caldav-PUT-functions.php: log_caldav_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path ); Privileges:caldav-PUT-functions.php: $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path ); Privileges:caldav-PUT-functions.php: if ( !$qry->Exec('PUT',__LINE__,__FILE__) ) { Privileges:caldav-PUT-functions.php: $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $path ) ); Privileges:caldav-PUT-functions.php: $qry->Commit(); Privileges:caldav-PUT-functions.php: if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 1 ) { Privileges:caldav-PUT-functions.php: $collection = $qry->Fetch(); Privileges:caldav-PUT-functions.php: $user_no = $collection->user_no; Privileges:caldav-PUT-functions.php: return write_resource( $user_no, $path, $caldav_data, $collection->collection_id, $user_no, $etag, $ic, $put_action_type, false, $write_action_log ); Privileges:caldav-PUT.php:* CalDAV Server - handle PUT method Privileges:caldav-PUT.php:$dav_resource = new DAVResource($request->path); Privileges:caldav-PUT.php:if ( ! $dav_resource->HavePrivilegeTo('DAV::write-content') ) { Privileges:caldav-PUT.php: $request->DoResponse(403); Privileges:caldav-PUT.php:if ( ! $dav_resource->Exists() && ! $dav_resource->HavePrivilegeTo('DAV::bind') ) { Privileges:caldav-PUT.php: $request->DoResponse(403); Privileges:caldav-PUT.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { Privileges:caldav-PUT.php: fwrite($fh,$request->raw_post); Privileges:caldav-PUT.php:include_once('caldav-PUT-functions.php'); Privileges:caldav-PUT.php:controlRequestContainer( $dav_resource->GetProperty('username'), $dav_resource->GetProperty('user_no'), $dav_resource->bound_from(), true); Privileges:caldav-PUT.php:$lock_opener = $request->FailIfLocked(); Privileges:caldav-PUT.php:if ( $dav_resource->IsCollection() ) { Privileges:caldav-PUT.php: if ( $dav_resource->IsPrincipal() || $dav_resource->IsBinding() || !isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections == true ) { Privileges:caldav-PUT.php: $request->DoResponse( 405 ); // Method not allowed Privileges:caldav-PUT.php: * as an import. The code is in caldav-PUT-functions.php Privileges:caldav-PUT.php: import_collection($request->raw_post,$request->user_no,$request->path,true, $appending); Privileges:caldav-PUT.php: $request->DoResponse( 200 ); Privileges:caldav-PUT.php:$etag = md5($request->raw_post); Privileges:caldav-PUT.php:$ic = new iCalComponent( $request->raw_post ); Privileges:caldav-PUT.php:if ( ! $dav_resource->Exists() && (isset($request->etag_if_match) && $request->etag_if_match != '') ) { Privileges:caldav-PUT.php: $request->PreconditionFailed(412,'if-match'); Privileges:caldav-PUT.php:if ( $dav_resource->Exists() ) { Privileges:caldav-PUT.php: if ( isset($request->etag_if_match) && $request->etag_if_match != '' && $request->etag_if_match != $dav_resource->unique_tag() ) { Privileges:caldav-PUT.php: $request->PreconditionFailed(412,'if-match', translate( 'Existing resource does not match "If-Match" header - not accepted.')); Privileges:caldav-PUT.php: else if ( isset($request->etag_none_match) && $request->etag_none_match != '' Privileges:caldav-PUT.php: && ($request->etag_none_match == $dav_resource->unique_tag() || $request->etag_none_match == '*') ) { Privileges:caldav-PUT.php: * (without the If-None-Match header) on that resource, or if "*" is Privileges:caldav-PUT.php: $request->PreconditionFailed(412,'if-none-match', translate( 'Existing resource matches "If-None-Match" header - not accepted.')); Privileges:caldav-PUT.php:$put_action_type = ($dav_resource->Exists() ? 'UPDATE' : 'INSERT'); Privileges:caldav-PUT.php:write_resource( $dav_resource->GetProperty('user_no'), $dav_resource->bound_from(), $request->raw_post, $dav_resource->GetProperty('collection_id'), Privileges:caldav-PUT.php: $session->user_no, $etag, $ic, $put_action_type, true, true ); Privileges:caldav-PUT.php:$request->DoResponse( ($dav_resource->Exists() ? 204 : 201) ); Privileges:caldav-PUT-vcard.php:* CalDAV Server - handle PUT method on VCARD content-types Privileges:caldav-PUT-vcard.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { Privileges:caldav-PUT-vcard.php: fwrite($fh,$request->raw_post); Privileges:caldav-PUT-vcard.php:$lock_opener = $request->FailIfLocked(); Privileges:caldav-PUT-vcard.php:$dest = new DAVResource($request->path); Privileges:caldav-PUT-vcard.php:$container = $dest->FetchParentContainer(); Privileges:caldav-PUT-vcard.php:if ( ! $dest->Exists() ) { Privileges:caldav-PUT-vcard.php: if ( $container->IsPrincipal() ) { Privileges:caldav-PUT-vcard.php: $request->DoResponse(403,translate('A DAViCal principal collection may only contain collections')); Privileges:caldav-PUT-vcard.php: if ( ! $container->Exists() ) { Privileges:caldav-PUT-vcard.php: $request->DoResponse( 409, translate('Destination collection does not exist') ); Privileges:caldav-PUT-vcard.php: $container->NeedPrivilege('DAV::bind'); Privileges:caldav-PUT-vcard.php: if ( $dest->IsCollection() ) { Privileges:caldav-PUT-vcard.php: if ( ! isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections ) { Privileges:caldav-PUT-vcard.php: $request->DoResponse(403,translate('You may not PUT to a collection URL')); Privileges:caldav-PUT-vcard.php: $request->DoResponse(403,translate('PUT on a collection is only allowed for text/calendar content against a calendar collection')); Privileges:caldav-PUT-vcard.php: $dest->NeedPrivilege('DAV::write-content'); Privileges:caldav-PUT-vcard.php:if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { Privileges:caldav-PUT-vcard.php: $request->DoResponse(412); Privileges:caldav-PUT-vcard.php:if ( isset($request->etag_if_match) && $request->etag_if_match != $dest->unique_tag() ) { Privileges:caldav-PUT-vcard.php: $request->DoResponse(412); Privileges:caldav-PUT-vcard.php:$collection_id = $container->GetProperty('collection_id'); Privileges:caldav-PUT-vcard.php:$qry->Begin(); Privileges:caldav-PUT-vcard.php:$etag = md5($request->raw_post); Privileges:caldav-PUT-vcard.php: ':user_no' => $dest->GetProperty('user_no'), Privileges:caldav-PUT-vcard.php: ':dav_name' => $dest->bound_from(), Privileges:caldav-PUT-vcard.php: ':dav_data' => $request->raw_post, Privileges:caldav-PUT-vcard.php: ':session_user' => $session->user_no Privileges:caldav-PUT-vcard.php:if ( $dest->Exists() ) { Privileges:caldav-PUT-vcard.php: $qry->QDo( $sql, $params ); Privileges:caldav-PUT-vcard.php: $qry->QDo("SELECT dav_id FROM caldav_data WHERE dav_name = :dav_name ", array(':dav_name' => $params[':dav_name']) ); Privileges:caldav-PUT-vcard.php: $qry->QDo( $sql, $params ); Privileges:caldav-PUT-vcard.php: $qry->QDo("SELECT currval('dav_id_seq') AS dav_id" ); Privileges:caldav-PUT-vcard.php:$row = $qry->Fetch(); Privileges:caldav-PUT-vcard.php:$vcard = new vCard( $request->raw_post ); Privileges:caldav-PUT-vcard.php:$vcard->Write( $row->dav_id, $dest->Exists() ); Privileges:caldav-PUT-vcard.php:$qry->QDo("SELECT write_sync_change( $collection_id, $response_code, :dav_name)", array(':dav_name' => $dest->bound_from() ) ); Privileges:caldav-PUT-vcard.php:if ( !$qry->QDo('COMMIT') ) rollback(500); Privileges:caldav-PUT-vcard.php:$request->DoResponse( $response_code ); Privileges:caldav-REPORT-calquery.php: $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); Privileges:caldav-REPORT-calquery.php: $expand_range_start = $expansion[0]->GetAttribute('start'); Privileges:caldav-REPORT-calquery.php: $expand_range_end = $expansion[0]->GetAttribute('end'); Privileges:caldav-REPORT-calquery.php:$qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-query'); Privileges:caldav-REPORT-calquery.php:$proptype = $qry_content[0]->GetTag(); Privileges:caldav-REPORT-calquery.php: $qry_props = $xmltree->GetPath('/urn:ietf:params:xml:ns:caldav:calendar-query/'.$proptype.'/*'); Privileges:caldav-REPORT-calquery.php: foreach( $qry_content[0]->GetElements() AS $k => $v ) { Privileges:caldav-REPORT-calquery.php: $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); Privileges:caldav-REPORT-calquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); Privileges:caldav-REPORT-calquery.php: if ( $qry_content[1]->GetTag() == 'DAV::include' ) { Privileges:caldav-REPORT-calquery.php: foreach( $qry_content[1]->GetElements() AS $k => $v ) { Privileges:caldav-REPORT-calquery.php: $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ Privileges:caldav-REPORT-calquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); Privileges:caldav-REPORT-calquery.php: * There can only be *one* FILTER element, and it must contain *one* COMP-FILTER Privileges:caldav-REPORT-calquery.php: * element. In every case I can see this contained COMP-FILTER element will be a Privileges:caldav-REPORT-calquery.php:$qry_filters = $xmltree->GetPath('/urn:ietf:params:xml:ns:caldav:calendar-query/urn:ietf:params:xml:ns:caldav:filter/*'); Privileges:caldav-REPORT-calquery.php: if ( $qry_filters->GetTag() == "urn:ietf:params:xml:ns:caldav:comp-filter" && $qry_filters->GetAttribute("name") == "VCALENDAR" ) Privileges:caldav-REPORT-calquery.php: $qry_filters = $qry_filters->GetContent(); // Everything is inside a VCALENDAR AFAICS Privileges:caldav-REPORT-calquery.php: dbg_error_log("calquery", "Got bizarre CALDAV:FILTER[%s=%s]] which does not contain comp-filter = VCALENDAR!!", $qry_filters->GetTag(), $qry_filters->GetAttribute("name") ); Privileges:caldav-REPORT-calquery.php: dbg_error_log("calquery","Applying filter for item '%s'", $item->dav_name ); Privileges:caldav-REPORT-calquery.php: $ical = new iCalendar( array( "icalendar" => $item->caldav_data) ); Privileges:caldav-REPORT-calquery.php: return $ical->TestFilter($filters); Privileges:caldav-REPORT-calquery.php: $tag = $v->GetTag(); Privileges:caldav-REPORT-calquery.php: dbg_error_log("calquery", "Processing $tag into SQL - %d, '%s', %d\n", count($components), $property, isset($parameter) ); Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:is-not-defined': Privileges:caldav-REPORT-calquery.php: $not_defined = "not-"; // then fall through to IS-DEFINED case Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:is-defined': Privileges:caldav-REPORT-calquery.php: dbg_error_log("calquery", "Could not handle 'is-%sdefined' on property %s, parameter %s in SQL", $not_defined, $property, $parameter ); Privileges:caldav-REPORT-calquery.php: case 'completed': /** @todo when it can be handled in the SQL - see around line 200 below */ Privileges:caldav-REPORT-calquery.php: if ( ! $target_collection->IsSchedulingCollection() ) { Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:time-range': Privileges:caldav-REPORT-calquery.php: $start_column = ($components[sizeof($components)-1] == 'VTODO' ? "due" : 'dtend'); // The column we compare against the START attribute Privileges:caldav-REPORT-calquery.php: $start = $v->GetAttribute("start"); Privileges:caldav-REPORT-calquery.php: $finish = $v->GetAttribute("end"); Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:text-match': Privileges:caldav-REPORT-calquery.php: $search = $v->GetContent(); Privileges:caldav-REPORT-calquery.php: $negate = $v->GetAttribute("negate-condition"); Privileges:caldav-REPORT-calquery.php: $collation = $v->GetAttribute("collation"); Privileges:caldav-REPORT-calquery.php: case 'i;ascii-casemap': Privileges:caldav-REPORT-calquery.php: dbg_error_log("calquery", " text-match: (%s IS NULL OR %s%s %s '%s') ", $property, (isset($negate) && strtolower($negate) == "yes" ? "NOT ": ""), Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:comp-filter': Privileges:caldav-REPORT-calquery.php: $comp_filter_name = $v->GetAttribute("name"); Privileges:caldav-REPORT-calquery.php: $subfilter = $v->GetContent(); Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:prop-filter': Privileges:caldav-REPORT-calquery.php: $propertyname = $v->GetAttribute("name"); Privileges:caldav-REPORT-calquery.php: case 'PERCENT-COMPLETE': Privileges:caldav-REPORT-calquery.php: dbg_error_log("calquery", "Could not handle 'prop-filter' on %s in SQL", $propertyname ); Privileges:caldav-REPORT-calquery.php: $subfilter = $v->GetContent(); Privileges:caldav-REPORT-calquery.php: case 'urn:ietf:params:xml:ns:caldav:param-filter': Privileges:caldav-REPORT-calquery.php: return false; // Can't handle PARAM-FILTER conditions in the SQL Privileges:caldav-REPORT-calquery.php: $parameter = $v->GetAttribute("name"); Privileges:caldav-REPORT-calquery.php: $subfilter = $v->GetContent(); Privileges:caldav-REPORT-calquery.php:$target_collection = new DAVResource($request->path); Privileges:caldav-REPORT-calquery.php:$bound_from = $target_collection->bound_from(); Privileges:caldav-REPORT-calquery.php:if ( !$target_collection->Exists() ) { Privileges:caldav-REPORT-calquery.php: $request->DoResponse( 404 ); Privileges:caldav-REPORT-calquery.php:if ( ! ($target_collection->IsCalendar() || $target_collection->IsSchedulingCollection()) ) { Privileges:caldav-REPORT-calquery.php: $request->DoResponse( 403, translate('The calendar-query report must be run against a calendar or a scheduling collection') ); Privileges:caldav-REPORT-calquery.php:$where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id(); Privileges:caldav-REPORT-calquery.php:if ( $target_collection->Privileges() != privilege_to_bits('DAV::all') ) { Privileges:caldav-REPORT-calquery.php:if ( isset($c->hide_TODO) && $c->hide_TODO && ! $target_collection->HavePrivilegeTo('DAV::write-content') ) { Privileges:caldav-REPORT-calquery.php:if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { Privileges:caldav-REPORT-calquery.php: $where .= " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; Privileges:caldav-REPORT-calquery.php:if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; Privileges:caldav-REPORT-calquery.php:if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-REPORT-calquery.php: while( $calendar_object = $qry->Fetch() ) { Privileges:caldav-REPORT-calquery.php: if ( $bound_from != $target_collection->dav_name() ) { Privileges:caldav-REPORT-calquery.php: $calendar_object->dav_name = str_replace( $bound_from, $target_collection->dav_name(), $calendar_object->dav_name); Privileges:caldav-REPORT-calquery.php: $vResource = new vComponent($calendar_object->caldav_data); Privileges:caldav-REPORT-calquery.php: $calendar_object->caldav_data = $expanded->Render(); Privileges:caldav-REPORT-calquery.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-calquery.php:$request->XMLResponse( 207, $multistatus ); Privileges:caldav-REPORT-cardquery.php: $expansion = $address_data_xml->GetElements(); Privileges:caldav-REPORT-cardquery.php: $address_data_properties[strtoupper($v->GetAttribute('name'))] = true; Privileges:caldav-REPORT-cardquery.php:$qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:carddav:addressbook-query'); Privileges:caldav-REPORT-cardquery.php:$proptype = $qry_content[0]->GetTag(); Privileges:caldav-REPORT-cardquery.php: $qry_props = $xmltree->GetPath('/urn:ietf:params:xml:ns:carddav:addressbook-query/'.$proptype.'/*'); Privileges:caldav-REPORT-cardquery.php: foreach( $qry_content[0]->GetElements() AS $k => $v ) { Privileges:caldav-REPORT-cardquery.php: $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); Privileges:caldav-REPORT-cardquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:carddav:address-data' ) get_address_properties($v); Privileges:caldav-REPORT-cardquery.php: if ( $qry_content[1]->GetTag() == 'DAV::include' ) { Privileges:caldav-REPORT-cardquery.php: foreach( $qry_content[1]->GetElements() AS $k => $v ) { Privileges:caldav-REPORT-cardquery.php: $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ Privileges:caldav-REPORT-cardquery.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:carddav:address-data' ) get_address_properties($v); Privileges:caldav-REPORT-cardquery.php:$qry_filters = $xmltree->GetPath('/urn:ietf:params:xml:ns:carddav:addressbook-query/urn:ietf:params:xml:ns:carddav:filter/*'); Privileges:caldav-REPORT-cardquery.php: dbg_error_log("cardquery","Applying filter for item '%s'", $item->dav_name ); Privileges:caldav-REPORT-cardquery.php: $vcard = new vComponent( $item->caldav_data ); Privileges:caldav-REPORT-cardquery.php: return $vcard->TestFilter($filters); Privileges:caldav-REPORT-cardquery.php: $tag = $v->GetTag(); Privileges:caldav-REPORT-cardquery.php: dbg_error_log("cardquery", "Processing $tag into SQL - %d, '%s', %d\n", count($components), $property, isset($parameter) ); Privileges:caldav-REPORT-cardquery.php: case 'urn:ietf:params:xml:ns:carddav:text-match': Privileges:caldav-REPORT-cardquery.php: $search = $v->GetContent(); Privileges:caldav-REPORT-cardquery.php: $negate = $v->GetAttribute("negate-condition"); Privileges:caldav-REPORT-cardquery.php: $collation = $v->GetAttribute("collation"); Privileges:caldav-REPORT-cardquery.php: case 'i;ascii-casemap': Privileges:caldav-REPORT-cardquery.php: case 'i;unicode-casemap': Privileges:caldav-REPORT-cardquery.php: dbg_error_log("cardquery", " text-match: (%s%s %s '%s') ", (isset($negate) && strtolower($negate) == "yes" ? "NOT ": ""), Privileges:caldav-REPORT-cardquery.php: case 'urn:ietf:params:xml:ns:carddav:prop-filter': Privileges:caldav-REPORT-cardquery.php: $propertyname = $v->GetAttribute("name"); Privileges:caldav-REPORT-cardquery.php: dbg_error_log("cardquery", "Could not handle 'prop-filter' on %s in SQL", $propertyname ); Privileges:caldav-REPORT-cardquery.php: $subfilter = $v->GetContent(); Privileges:caldav-REPORT-cardquery.php: case 'urn:ietf:params:xml:ns:carddav:param-filter': Privileges:caldav-REPORT-cardquery.php: return false; /** Figure out how to handle PARAM-FILTER conditions in the SQL */ Privileges:caldav-REPORT-cardquery.php: $parameter = $v->GetAttribute("name"); Privileges:caldav-REPORT-cardquery.php: $subfilter = $v->GetContent(); Privileges:caldav-REPORT-cardquery.php:$target_collection = new DAVResource($request->path); Privileges:caldav-REPORT-cardquery.php:$bound_from = $target_collection->bound_from(); Privileges:caldav-REPORT-cardquery.php:if ( !$target_collection->Exists() ) { Privileges:caldav-REPORT-cardquery.php: $request->DoResponse( 404 ); Privileges:caldav-REPORT-cardquery.php:if ( ! ($target_collection->IsAddressbook() || $target_collection->IsSchedulingCollection()) ) { Privileges:caldav-REPORT-cardquery.php: $request->DoResponse( 403, translate('The addressbook-query report must be run against an addressbook collection') ); Privileges:caldav-REPORT-cardquery.php:$where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id(); Privileges:caldav-REPORT-cardquery.php:if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; Privileges:caldav-REPORT-cardquery.php:if ( $qry->Exec("cardquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-REPORT-cardquery.php: while( $address_object = $qry->Fetch() ) { Privileges:caldav-REPORT-cardquery.php: if ( $bound_from != $target_collection->dav_name() ) { Privileges:caldav-REPORT-cardquery.php: $address_object->dav_name = str_replace( $bound_from, $target_collection->dav_name(), $address_object->dav_name); Privileges:caldav-REPORT-cardquery.php: $vcard = new VCard($address_object->caldav_data); Privileges:caldav-REPORT-cardquery.php: $vcard->MaskProperties($address_data_properties); Privileges:caldav-REPORT-cardquery.php: $address_object->caldav_data = $vcard->Render(); Privileges:caldav-REPORT-cardquery.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-cardquery.php:$request->XMLResponse( 207, $multistatus ); Privileges:caldav-REPORT-expand-property.php: $propstat_set = $multistatus_response->GetElements('propstat'); Privileges:caldav-REPORT-expand-property.php: $status = $v->GetElements('status'); Privileges:caldav-REPORT-expand-property.php: if ( preg_match( '{^HTTP/\S+\s+200}', $status[0]->GetContent() ) ) { Privileges:caldav-REPORT-expand-property.php: $props = $propstat_200->GetElements('prop'); Privileges:caldav-REPORT-expand-property.php: $properties = array_merge($properties,$p->GetElements()); Privileges:caldav-REPORT-expand-property.php:// dbg_error_log('REPORT',' get_href_containers: Checking property "%s" for hrefs.', $property->GetNSTag() ); Privileges:caldav-REPORT-expand-property.php: $hrefs = $property->GetElements('href'); Privileges:caldav-REPORT-expand-property.php: $pname = $property->GetAttribute('name'); Privileges:caldav-REPORT-expand-property.php: $pns = $property->GetAttribute('namespace'); Privileges:caldav-REPORT-expand-property.php: $subtrees[$pname] = $property->GetElements(); Privileges:caldav-REPORT-expand-property.php: $part_response = $resource->RenderAsXML( $props, $reply ); Privileges:caldav-REPORT-expand-property.php: $hrefs = $property->GetElements(); Privileges:caldav-REPORT-expand-property.php: $pname = $property->GetTag(); Privileges:caldav-REPORT-expand-property.php: $pns = $property->GetAttribute('xmlns'); Privileges:caldav-REPORT-expand-property.php: $content = $v->GetContent(); Privileges:caldav-REPORT-expand-property.php: $property->SetContent( expand_properties($paths, $subtrees[$pname], $reply, false) ); Privileges:caldav-REPORT-expand-property.php:$property_tree = $xmltree->GetPath('/DAV::expand-property/DAV::property'); Privileges:caldav-REPORT-expand-property.php:$multistatus = new XMLElement( "multistatus", expand_properties( $request->path, $property_tree, $reply), $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-expand-property.php:$request->XMLResponse( 207, $multistatus ); Privileges:caldav-REPORT-freebusy.php: * Handle the FREE-BUSY-QUERY variant of REPORT Privileges:caldav-REPORT-freebusy.php:include_once("freebusy-functions.php"); Privileges:caldav-REPORT-freebusy.php:$fbq_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:free-busy-query'); Privileges:caldav-REPORT-freebusy.php:$fbq_start = $fbq_content[0]->GetAttribute('start'); Privileges:caldav-REPORT-freebusy.php:$fbq_end = $fbq_content[0]->GetAttribute('end'); Privileges:caldav-REPORT-freebusy.php: $request->DoResponse( 400, 'All valid freebusy requests MUST contain a time-range filter' ); Privileges:caldav-REPORT-freebusy.php:$freebusy = get_freebusy( '^'.$request->path.$request->DepthRegexTail(), $range_start, $range_end ); Privileges:caldav-REPORT-freebusy.php:$result->VCalendar(); Privileges:caldav-REPORT-freebusy.php:$result->AddComponent($freebusy); Privileges:caldav-REPORT-freebusy.php:$request->DoResponse( 200, $result->Render(), 'text/calendar' ); Privileges:caldav-REPORT-multiget.php:* Handle the calendar-multiget REPORT request. Privileges:caldav-REPORT-multiget.php: $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); Privileges:caldav-REPORT-multiget.php: $expand_range_start = $expansion[0]->GetAttribute('start'); Privileges:caldav-REPORT-multiget.php: $expand_range_end = $expansion[0]->GetAttribute('end'); Privileges:caldav-REPORT-multiget.php:$proptype = $qry_content[0]->GetTag(); Privileges:caldav-REPORT-multiget.php: $qry_props = $xmltree->GetPath('/*/'.$proptype.'/*'); Privileges:caldav-REPORT-multiget.php: foreach( $qry_content[0]->GetElements() AS $k => $v ) { Privileges:caldav-REPORT-multiget.php: $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); Privileges:caldav-REPORT-multiget.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); Privileges:caldav-REPORT-multiget.php: if ( $qry_content[1]->GetTag() == 'DAV::include' ) { Privileges:caldav-REPORT-multiget.php: foreach( $qry_content[1]->GetElements() AS $k => $v ) { Privileges:caldav-REPORT-multiget.php: $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ Privileges:caldav-REPORT-multiget.php: if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); Privileges:caldav-REPORT-multiget.php:$collection = new DAVResource($request->path); Privileges:caldav-REPORT-multiget.php:$bound_from = $collection->bound_from(); Privileges:caldav-REPORT-multiget.php:$mg_hrefs = $xmltree->GetPath('/*/DAV::href'); Privileges:caldav-REPORT-multiget.php: * anything up to the matching request->path (which will include any http...) and then Privileges:caldav-REPORT-multiget.php: $href = $bound_from . preg_replace( "{^.*\E$request->path\Q}", '', rawurldecode($v->GetContent()) ); Privileges:caldav-REPORT-multiget.php:$where = " WHERE caldav_data.collection_id = " . $collection->resource_id(); Privileges:caldav-REPORT-multiget.php: if ( $collection->Privileges() != privilege_to_bits('DAV::all') ) { Privileges:caldav-REPORT-multiget.php: if ( isset($c->hide_TODO) && $c->hide_TODO && ! $collection->Privileges() == privilege_to_bits('all') ) { Privileges:caldav-REPORT-multiget.php:if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $where .= " ORDER BY caldav_data.dav_id"; Privileges:caldav-REPORT-multiget.php:if ( $qry->Exec('REPORT',__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-REPORT-multiget.php: while( $dav_object = $qry->Fetch() ) { Privileges:caldav-REPORT-multiget.php: if ( $bound_from != $collection->dav_name() ) { Privileges:caldav-REPORT-multiget.php: $dav_object->dav_name = str_replace( $bound_from, $collection->dav_name(), $dav_object->dav_name); Privileges:caldav-REPORT-multiget.php: $vResource = new vComponent($dav_object->caldav_data); Privileges:caldav-REPORT-multiget.php: $dav_object->caldav_data = $expanded->Render(); Privileges:caldav-REPORT-multiget.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-multiget.php:$request->XMLResponse( 207, $multistatus ); Privileges:caldav-REPORT.php:* CalDAV Server - handle REPORT method Privileges:caldav-REPORT.php:require_once('RRule-v2.php'); Privileges:caldav-REPORT.php:if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['report']) && $c->dbg['report'])) ) { Privileges:caldav-REPORT.php: fwrite($fh,$request->raw_post); Privileges:caldav-REPORT.php:if ( !isset($request->xml_tags) ) { Privileges:caldav-REPORT.php: $request->DoResponse( 406, translate("REPORT body contains no XML data!") ); Privileges:caldav-REPORT.php:$xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:caldav-REPORT.php: $request->DoResponse( 406, translate("REPORT body is not valid XML data!") ); Privileges:caldav-REPORT.php:$target = new DAVResource($request->path); Privileges:caldav-REPORT.php:if ( $xmltree->GetTag() != 'DAV::principal-property-search' Privileges:caldav-REPORT.php: && $xmltree->GetTag() != 'DAV::principal-property-search-set' ) { Privileges:caldav-REPORT.php: //$target->NeedPrivilege( array('DAV::read', 'urn:ietf:params:xml:ns:caldav:read-free-busy'), true ); // They may have either Privileges:caldav-REPORT.php:$reportnum = -1; Privileges:caldav-REPORT.php:if ( $xmltree->GetTag() == 'urn:ietf:params:xml:ns:caldav:free-busy-query' ) { Privileges:caldav-REPORT.php: include("caldav-REPORT-freebusy.php"); Privileges:caldav-REPORT.php:switch( $xmltree->GetTag() ) { Privileges:caldav-REPORT.php: case 'DAV::principal-property-search': Privileges:caldav-REPORT.php: include("caldav-REPORT-principal.php"); Privileges:caldav-REPORT.php: case 'DAV::principal-search-property-set': Privileges:caldav-REPORT.php: include("caldav-REPORT-pps-set.php"); Privileges:caldav-REPORT.php: case 'DAV::sync-collection': Privileges:caldav-REPORT.php: include("caldav-REPORT-sync-collection.php"); Privileges:caldav-REPORT.php: case 'DAV::expand-property': Privileges:caldav-REPORT.php: include("caldav-REPORT-expand-property.php"); Privileges:caldav-REPORT.php: dbg_error_log("REPORT","Building XML Response for item '%s'", $item->dav_name ); Privileges:caldav-REPORT.php: $caldav_data = $item->caldav_data; Privileges:caldav-REPORT.php: $displayname = $item->summary; Privileges:caldav-REPORT.php: if ( isset($properties['calendar-data']) || isset($properties['displayname']) ) { Privileges:caldav-REPORT.php: if ( !$request->AllowedTo('all') && $session->user_no != $item->user_no ){ Privileges:caldav-REPORT.php: if ( $item->class == 'CONFIDENTIAL' || !$request->AllowedTo('read') ) { Privileges:caldav-REPORT.php: $resources = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-REPORT.php: $confidential->SetType($first->GetType()); Privileges:caldav-REPORT.php: $confidential->AddProperty( 'SUMMARY', translate('Busy') ); Privileges:caldav-REPORT.php: $confidential->AddProperty( 'CLASS', 'CONFIDENTIAL' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DTSTART'), 'DTSTART' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('RRULE'), 'RRULE' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DURATION'), 'DURATION' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DTEND'), 'DTEND' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('UID'), 'UID' ); Privileges:caldav-REPORT.php: $ical->SetComponents(array($confidential),$confidential->GetType()); Privileges:caldav-REPORT.php: $caldav_data = $ical->Render(); Privileges:caldav-REPORT.php: $url = ConstructURL($item->dav_name); Privileges:caldav-REPORT.php: $prop->NewElement($k, $contentlength ); Privileges:caldav-REPORT.php: case 'calendar-data': Privileges:caldav-REPORT.php: $reply->CalDAVElement($prop, $k, $caldav_data ); Privileges:caldav-REPORT.php: $prop->NewElement($k, "text/calendar" ); Privileges:caldav-REPORT.php: case 'current-user-principal': Privileges:caldav-REPORT.php: $prop->NewElement("current-user-principal", $request->current_user_principal_xml); Privileges:caldav-REPORT.php: $prop->NewElement($k, $displayname ); Privileges:caldav-REPORT.php: $prop->NewElement($k); // Just an empty resourcetype for a non-collection. Privileges:caldav-REPORT.php: $prop->NewElement($k, '"'.$item->dav_etag.'"' ); Privileges:caldav-REPORT.php: case '"current-user-privilege-set"': Privileges:caldav-REPORT.php: $prop->NewElement($k, privileges($request->permissions) ); Privileges:caldav-REPORT.php: case 'SOME-DENIED-PROPERTY': /** indicating the style for future expansion */ Privileges:caldav-REPORT.php: $noprop->NewElement( strtolower($v) ); Privileges:caldav-REPORT.php: dbg_error_log("REPORT","Building XML Response for item '%s'", $item->dav_name ); Privileges:caldav-REPORT.php: $caldav_data = $item->caldav_data; Privileges:caldav-REPORT.php: $displayname = preg_replace( '{^.*/}', '', $item->dav_name ); Privileges:caldav-REPORT.php: switch( $item->caldav_type ) { Privileges:caldav-REPORT.php: $displayname = $item->summary; Privileges:caldav-REPORT.php: $displayname = $item->fn; Privileges:caldav-REPORT.php: $contenttype = 'text/x-vcard'; Privileges:caldav-REPORT.php: if ( isset($properties['calendar-data']) || isset($properties['displayname']) ) { Privileges:caldav-REPORT.php: if ( !$request->AllowedTo('all') && $session->user_no != $item->user_no ){ Privileges:caldav-REPORT.php: if ( $type == 'calendar' && $item->class == 'CONFIDENTIAL' || !$request->AllowedTo('read') ) { Privileges:caldav-REPORT.php: $resources = $ical->GetComponents('VTIMEZONE',false); Privileges:caldav-REPORT.php: $confidential->SetType($first->GetType()); Privileges:caldav-REPORT.php: $confidential->AddProperty( 'SUMMARY', translate('Busy') ); Privileges:caldav-REPORT.php: $confidential->AddProperty( 'CLASS', 'CONFIDENTIAL' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DTSTART'), 'DTSTART' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('RRULE'), 'RRULE' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DURATION'), 'DURATION' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('DTEND'), 'DTEND' ); Privileges:caldav-REPORT.php: $confidential->SetProperties( $first->GetProperties('UID'), 'UID' ); Privileges:caldav-REPORT.php: $ical->SetComponents(array($confidential),$confidential->GetType()); Privileges:caldav-REPORT.php: $caldav_data = $ical->Render(); Privileges:caldav-REPORT.php: $url = ConstructURL($item->dav_name); Privileges:caldav-REPORT.php: $prop->NewElement($k, $contentlength ); Privileges:caldav-REPORT.php: case 'calendar-data': Privileges:caldav-REPORT.php: if ( $type == 'calendar' ) $reply->CalDAVElement($prop, $k, $caldav_data ); Privileges:caldav-REPORT.php: case 'address-data': Privileges:caldav-REPORT.php: if ( $type == 'vcard' ) $reply->CardDAVElement($prop, $k, $caldav_data ); Privileges:caldav-REPORT.php: $prop->NewElement($k, $contenttype ); Privileges:caldav-REPORT.php: case 'current-user-principal': Privileges:caldav-REPORT.php: $prop->NewElement("current-user-principal", $request->current_user_principal_xml); Privileges:caldav-REPORT.php: $prop->NewElement($k, $displayname ); Privileges:caldav-REPORT.php: $prop->NewElement($k); // Just an empty resourcetype for a non-collection. Privileges:caldav-REPORT.php: $prop->NewElement($k, '"'.$item->dav_etag.'"' ); Privileges:caldav-REPORT.php: case '"current-user-privilege-set"': Privileges:caldav-REPORT.php: $prop->NewElement($k, privileges($request->permissions) ); Privileges:caldav-REPORT.php: case 'SOME-DENIED-PROPERTY': /** indicating the style for future expansion */ Privileges:caldav-REPORT.php: $noprop->NewElement( strtolower($v) ); Privileges:caldav-REPORT.php: $noprop->NewElement( strtolower($v) ); Privileges:caldav-REPORT.php:if ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:caldav:calendar-query" ) { Privileges:caldav-REPORT.php: $calquery = $xmltree->GetPath("/urn:ietf:params:xml:ns:caldav:calendar-query/*"); Privileges:caldav-REPORT.php: include("caldav-REPORT-calquery.php"); Privileges:caldav-REPORT.php:elseif ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:caldav:calendar-multiget" ) { Privileges:caldav-REPORT.php: $qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-multiget'); Privileges:caldav-REPORT.php: include("caldav-REPORT-multiget.php"); Privileges:caldav-REPORT.php:elseif ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:carddav:addressbook-multiget" ) { Privileges:caldav-REPORT.php: $qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:carddav:addressbook-multiget'); Privileges:caldav-REPORT.php: include("caldav-REPORT-multiget.php"); Privileges:caldav-REPORT.php:elseif ( $xmltree->GetTag() == "urn:ietf:params:xml:ns:carddav:addressbook-query" ) { Privileges:caldav-REPORT.php: $cardquery = $xmltree->GetPath("/urn:ietf:params:xml:ns:carddav:addressbook-query/*"); Privileges:caldav-REPORT.php: include("caldav-REPORT-cardquery.php"); Privileges:caldav-REPORT.php: $request->PreconditionFailed( 403, 'DAV::supported-report', sprintf( '"%s" is not a supported report type') ); Privileges:caldav-REPORT-pps-set.php:* DAViCal CalDAV Server - handle principal-search-property-set report (RFC3744) Privileges:caldav-REPORT-pps-set.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-REPORT-pps-set.php: $xmldoc->NSElement($prop, $property ); Privileges:caldav-REPORT-pps-set.php: return new XMLElement( 'principal-search-property', $prop ); Privileges:caldav-REPORT-pps-set.php: 'urn:ietf:params:xml:ns:caldav:calendar-home-set', Privileges:caldav-REPORT-pps-set.php: 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set' Privileges:caldav-REPORT-pps-set.php:$report = new XMLElement( 'principal-search-property-set', $responses, $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-pps-set.php:$request->XMLResponse( 207, $report ); Privileges:caldav-REPORT-principal.php:$searches = $xmltree->GetPath('/DAV::principal-property-search/DAV::property-search'); Privileges:caldav-REPORT-principal.php:$CS_search_test = $xmltree->GetAttribute('test'); Privileges:caldav-REPORT-principal.php: $qry_props = $search->GetPath('/DAV::property-search/DAV::prop/*'); // There may be many Privileges:caldav-REPORT-principal.php: $match = $search->GetPath('/DAV::property-search/DAV::match'); // There may only be one Privileges:caldav-REPORT-principal.php: $match = $match[0]->GetContent(); Privileges:caldav-REPORT-principal.php: switch( $v1->GetTag() ) { Privileges:caldav-REPORT-principal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-user-address-set': Privileges:caldav-REPORT-principal.php: case 'urn:ietf:params:xml:ns:caldav:calendar-home-set': Privileges:caldav-REPORT-principal.php: * @todo We should handle a lot more properties here. principal-URL seems a likely one to be used. Privileges:caldav-REPORT-principal.php: dbg_error_log("principal", "Unhandled tag '%s' to match '%s'\n", $v1->GetTag(), $match ); Privileges:caldav-REPORT-principal.php:$get_props = $xmltree->GetPath('/DAV::principal-property-search/DAV::prop/*'); Privileges:caldav-REPORT-principal.php: $properties[] = $v1->GetTag(); Privileges:caldav-REPORT-principal.php:if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:caldav-REPORT-principal.php: while( $row = $qry->Fetch() ) { Privileges:caldav-REPORT-principal.php: $responses[] = $principal->RenderAsXML( $properties, $reply ); Privileges:caldav-REPORT-principal.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-principal.php:$request->XMLResponse( 207, $multistatus ); Privileges:caldav-REPORT-sync-collection.php:* CalDAV Server - handle sync-collection report (draft-daboo-webdav-sync-01) Privileges:caldav-REPORT-sync-collection.php:* @copyright Morphoss Ltd - http://www.morphoss.com/ Privileges:caldav-REPORT-sync-collection.php:$sync_tokens = $xmltree->GetPath('/DAV::sync-collection/DAV::sync-token'); Privileges:caldav-REPORT-sync-collection.php:$sync_token = $sync_tokens[0]->GetContent(); Privileges:caldav-REPORT-sync-collection.php:dbg_error_log( 'sync', " sync-token: %s", $sync_token ); Privileges:caldav-REPORT-sync-collection.php:$props = $xmltree->GetElements('DAV::prop'); Privileges:caldav-REPORT-sync-collection.php:$props = $v->GetContent(); Privileges:caldav-REPORT-sync-collection.php: $proplist[] = $v->GetTag(); Privileges:caldav-REPORT-sync-collection.php:$collection = new DAVResource( $request->path ); Privileges:caldav-REPORT-sync-collection.php:$params = array( ':collection_id' => $collection->GetProperty('collection_id'), ':sync_token' => $sync_token ); Privileges:caldav-REPORT-sync-collection.php:if ( !$qry->Exec("REPORT",__LINE__,__FILE__) || $qry->rows() <= 0 ) { Privileges:caldav-REPORT-sync-collection.php: $request->DoResponse( 500, translate("Database error") ); Privileges:caldav-REPORT-sync-collection.php:$row = $qry->Fetch(); Privileges:caldav-REPORT-sync-collection.php:if ( !isset($row->new_sync_token) ) { Privileges:caldav-REPORT-sync-collection.php: if ( !$qry->QDo($sql, $params) || $qry->rows() <= 0 ) { Privileges:caldav-REPORT-sync-collection.php: $request->DoResponse( 500, translate("Database error") ); Privileges:caldav-REPORT-sync-collection.php: $row = $qry->Fetch(); Privileges:caldav-REPORT-sync-collection.php:$new_token = $row->new_sync_token; Privileges:caldav-REPORT-sync-collection.php:if ( $qry->Exec("REPORT",__LINE__,__FILE__) ) { Privileges:caldav-REPORT-sync-collection.php: while( $object = $qry->Fetch() ) { Privileges:caldav-REPORT-sync-collection.php: if ( $object->dav_name == $last_dav_name ) { Privileges:caldav-REPORT-sync-collection.php: if ( $object->sync_status == 404 ) { Privileges:caldav-REPORT-sync-collection.php: new XMLElement( 'href', ConstructURL($object->dav_name) ), Privileges:caldav-REPORT-sync-collection.php: new XMLElement( 'status', display_status($object->sync_status) ) Privileges:caldav-REPORT-sync-collection.php: $responses[] = new XMLElement( 'sync-response', $resultset ); Privileges:caldav-REPORT-sync-collection.php: else if ( $object->sync_status == 201 && $first_status == 404 ) { Privileges:caldav-REPORT-sync-collection.php: new XMLElement( 'href', ConstructURL($object->dav_name) ), Privileges:caldav-REPORT-sync-collection.php: new XMLElement( 'status', display_status($object->sync_status) ) Privileges:caldav-REPORT-sync-collection.php: $responses[] = new XMLElement( 'sync-response', $resultset ); Privileges:caldav-REPORT-sync-collection.php: new XMLElement( 'href', ConstructURL($object->dav_name) ), Privileges:caldav-REPORT-sync-collection.php: new XMLElement( 'status', display_status($object->sync_status) ) Privileges:caldav-REPORT-sync-collection.php: if ( $object->sync_status != 404 ) { Privileges:caldav-REPORT-sync-collection.php: $resultset = array_merge( $resultset, $dav_resource->GetPropStat($proplist,$reply) ); Privileges:caldav-REPORT-sync-collection.php: if ( isset($c->use_old_sync_response_tag) && $c->use_old_sync_response_tag ) $response_tag = 'sync-response'; Privileges:caldav-REPORT-sync-collection.php: $first_status = $object->sync_status; Privileges:caldav-REPORT-sync-collection.php: $last_dav_name = $object->dav_name; Privileges:caldav-REPORT-sync-collection.php: $responses[] = new XMLElement( 'sync-token', $new_token ); Privileges:caldav-REPORT-sync-collection.php: $request->DoResponse( 500, translate("Database error") ); Privileges:caldav-REPORT-sync-collection.php:$multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); Privileges:caldav-REPORT-sync-collection.php:$request->XMLResponse( 207, $multistatus ); Privileges:CalDAVRequest.php:* - Ascertaining the paths Privileges:CalDAVRequest.php:* - Ascertaining the current user's permission to those paths. Privileges:CalDAVRequest.php:* - Utility functions which we can use to decide whether this Privileges:CalDAVRequest.php: * The 'current_user_principal_xml' the DAV:current-user-principal answer. An Privileges:CalDAVRequest.php: * calendar, schedule-inbox, schedule-outbox Privileges:CalDAVRequest.php: * calendar, schedule-inbox, schedule-outbox Privileges:CalDAVRequest.php: $this->supported_privileges = array( Privileges:CalDAVRequest.php: 'write-content' => translate('Write content'), Privileges:CalDAVRequest.php: 'write-properties' => translate('Write properties') Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:read-free-busy' => translate('Read the free/busy information for a calendar collection'), Privileges:CalDAVRequest.php: 'read-acl' => translate('Read ACLs for a resource or collection'), Privileges:CalDAVRequest.php: 'read-current-user-privilege-set' => translate('Read the details of the current user\'s access control to this resource.'), Privileges:CalDAVRequest.php: 'write-acl' => translate('Write ACLs for a resource or collection'), Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-deliver' => array( Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-deliver-invite'=> translate('Deliver scheduling invitations from an organiser to this scheduling inbox'), Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-deliver-reply' => translate('Deliver scheduling replies from an attendee to this scheduling inbox'), Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-query-freebusy' => translate('Allow free/busy enquiries targeted at the owner of this scheduling inbox') Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send' => array( Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send-invite' => translate('Send scheduling invitations as an organiser from the owner of this scheduling outbox.'), Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send-reply' => translate('Send scheduling replies as an attendee from the owner of this scheduling outbox.'), Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:schedule-send-freebusy' => translate('Send free/busy enquiries') Privileges:CalDAVRequest.php: $this->options = $options; Privileges:CalDAVRequest.php: if ( !isset($this->options['allow_by_email']) ) $this->options['allow_by_email'] = false; Privileges:CalDAVRequest.php: $this->principal = (object) array( 'username' => $session->username, 'user_no' => $session->user_no ); Privileges:CalDAVRequest.php: $this->raw_post = file_get_contents ( 'php://input'); Privileges:CalDAVRequest.php: if ( (isset($c->dbg['ALL']) && $c->dbg['ALL']) || (isset($c->dbg['request']) && $c->dbg['request']) ) { Privileges:CalDAVRequest.php: dbg_error_log( "LOG headers", "-->%s: %s", $k, $v ); Privileges:CalDAVRequest.php: $lines = preg_split( '#[\r\n]+#', $this->raw_post); Privileges:CalDAVRequest.php: dbg_error_log( "LOG request", "-->%s", $v ); Privileges:CalDAVRequest.php: $this->method = $_SERVER['REQUEST_METHOD']; Privileges:CalDAVRequest.php: $this->content_type = (isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : null); Privileges:CalDAVRequest.php: if ( preg_match( '{^(\S+/\S+)\s*(;.*)?$}', $this->content_type, $matches ) ) { Privileges:CalDAVRequest.php: $this->content_type = $matches[1]; Privileges:CalDAVRequest.php: if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' ) { Privileges:CalDAVRequest.php: if ( !preg_match( '{^(text|application)/xml$}', $this->content_type ) ) { Privileges:CalDAVRequest.php: dbg_error_log( "LOG request", 'Request is "%s" but client set content-type to "%s". Assuming they meant XML!', Privileges:CalDAVRequest.php: $request->method, $this->content_type ); Privileges:CalDAVRequest.php: $this->content_type = 'text/xml'; Privileges:CalDAVRequest.php: $this->user_agent = ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Probably Mulberry")); Privileges:CalDAVRequest.php: $this->depth = $_SERVER['HTTP_DEPTH']; Privileges:CalDAVRequest.php: * is not present then a reasonable request-type-dependent default should be Privileges:CalDAVRequest.php: switch( $this->method ) { Privileges:CalDAVRequest.php: $this->depth = 'infinity'; Privileges:CalDAVRequest.php: $this->depth = 0; Privileges:CalDAVRequest.php: if ( $this->depth == 'infinity' ) $this->depth = DEPTH_INFINITY; Privileges:CalDAVRequest.php: $this->depth = intval($this->depth); Privileges:CalDAVRequest.php: if ( isset($_SERVER['HTTP_DESTINATION']) ) $this->destination = $_SERVER['HTTP_DESTINATION']; Privileges:CalDAVRequest.php: $this->overwrite = ( isset($_SERVER['HTTP_OVERWRITE']) && ($_SERVER['HTTP_OVERWRITE'] == 'F') ? false : true ); // RFC4918, 9.8.4 says default True. Privileges:CalDAVRequest.php: * LOCK things use an "If" header to hold the lock in some cases, and "Lock-token" in others Privileges:CalDAVRequest.php: if ( isset($_SERVER['HTTP_IF']) ) $this->if_clause = $_SERVER['HTTP_IF']; Privileges:CalDAVRequest.php: $this->lock_token = $matches[1]; Privileges:CalDAVRequest.php: $this->ticket = new DAVTicket($_GET['ticket']); Privileges:CalDAVRequest.php: $this->ticket = new DAVTicket($_SERVER['HTTP_TICKET']); Privileges:CalDAVRequest.php: $this->timeout = (isset($c->maximum_lock_timeout) ? $c->maximum_lock_timeout : 86400 * 100); Privileges:CalDAVRequest.php: elseif ( strtolower(substr($v,0,7)) == 'second-' ) { Privileges:CalDAVRequest.php: $this->timeout = min( intval(substr($v,7)), (isset($c->maximum_lock_timeout) ? $c->maximum_lock_timeout : 86400 * 100) ); Privileges:CalDAVRequest.php: if ( ! isset($this->timeout) || $this->timeout == 0 ) $this->timeout = (isset($c->default_lock_timeout) ? $c->default_lock_timeout : 900); Privileges:CalDAVRequest.php: $this->path = (isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "/"); Privileges:CalDAVRequest.php: $this->path = rawurldecode($this->path); Privileges:CalDAVRequest.php: if ( preg_match( '#^(/[^/]+/[^/]+).ics$#', $this->path, $matches ) ) { Privileges:CalDAVRequest.php: $this->path = $matches[1]. '/'; Privileges:CalDAVRequest.php: // dbg_error_log( "caldav", "Sanitising path '%s'", $this->path ); Privileges:CalDAVRequest.php: if ( preg_match( $bad_chars_regex, $this->path ) ) { Privileges:CalDAVRequest.php: $this->DoResponse( 400, translate("The calendar path contains illegal characters.") ); Privileges:CalDAVRequest.php: if ( strstr($this->path,'//') ) $this->path = preg_replace( '#//+#', '/', $this->path); Privileges:CalDAVRequest.php: $this->user_no = $session->user_no; Privileges:CalDAVRequest.php: $this->username = $session->username; Privileges:CalDAVRequest.php: if ( $session->user_no > 0 ) { Privileges:CalDAVRequest.php: $this->current_user_principal_url = new XMLElement('href', ConstructURL('/'.$session->username.'/') ); Privileges:CalDAVRequest.php: $this->current_user_principal_url = new XMLElement('unauthenticated' ); Privileges:CalDAVRequest.php: * we SHOULD return a Content-location header with the correction... Privileges:CalDAVRequest.php: * - The exact request. Privileges:CalDAVRequest.php: * - If the exact request, doesn't end in '/', then the request URL with a '/' appended Privileges:CalDAVRequest.php: * - The request URL truncated to the last '/' Privileges:CalDAVRequest.php: $params = array( ':exact_name' => $this->path ); Privileges:CalDAVRequest.php: if ( !preg_match( '#/$#', $this->path ) ) { Privileges:CalDAVRequest.php: $params[':truncated_name'] = preg_replace( '#[^/]*$#', '', $this->path); Privileges:CalDAVRequest.php: $params[':trailing_slash_name'] = $this->path."/"; Privileges:CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { Privileges:CalDAVRequest.php: if ( $row->dav_name == $this->path."/" ) { Privileges:CalDAVRequest.php: $this->path = $row->dav_name; Privileges:CalDAVRequest.php: dbg_error_log( "caldav", "Path is actually a collection - sending Content-Location header." ); Privileges:CalDAVRequest.php: header( "Content-Location: ".ConstructURL($this->path) ); Privileges:CalDAVRequest.php: $this->collection_id = $row->collection_id; Privileges:CalDAVRequest.php: $this->collection_path = $row->dav_name; Privileges:CalDAVRequest.php: $this->collection_type = ($row->is_calendar == 't' ? 'calendar' : 'collection'); Privileges:CalDAVRequest.php: $this->collection = $row; Privileges:CalDAVRequest.php: if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->path, $matches ) ) { Privileges:CalDAVRequest.php: $this->collection_type = 'schedule-'. $matches[3]. 'box'; Privileges:CalDAVRequest.php: $this->collection->type = $this->collection_type; Privileges:CalDAVRequest.php: else if ( preg_match( '{^( ( / ([^/]+) / ) \.(in|out)/ ) [^/]*$}x', $this->path, $matches ) ) { Privileges:CalDAVRequest.php: // The request is for a scheduling inbox or outbox (or something inside one) and we should auto-create it Privileges:CalDAVRequest.php: $this->collection_type = 'schedule-'. $matches[4]. 'box'; Privileges:CalDAVRequest.php: $params[':resourcetypes'] = sprintf('', $this->collection_type ); Privileges:CalDAVRequest.php: $qry->Exec('caldav',__LINE__,__FILE__); Privileges:CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { Privileges:CalDAVRequest.php: $this->collection_id = $row->collection_id; Privileges:CalDAVRequest.php: $this->collection_path = $matches[1]; Privileges:CalDAVRequest.php: $this->collection = $row; Privileges:CalDAVRequest.php: $this->collection->type = $this->collection_type; Privileges:CalDAVRequest.php: else if ( preg_match( '#^((/[^/]+/)calendar-proxy-(read|write))/?[^/]*$#', $this->path, $matches ) ) { Privileges:CalDAVRequest.php: $this->collection_type = 'proxy'; Privileges:CalDAVRequest.php: $this->_is_proxy_request = true; Privileges:CalDAVRequest.php: $this->proxy_type = $matches[3]; Privileges:CalDAVRequest.php: $this->collection_path = $matches[1].'/'; // Enforce trailling '/' Privileges:CalDAVRequest.php: if ( $this->collection_path == $this->path."/" ) { Privileges:CalDAVRequest.php: $this->path .= '/'; Privileges:CalDAVRequest.php: dbg_error_log( "caldav", "Path is actually a (proxy) collection - sending Content-Location header." ); Privileges:CalDAVRequest.php: header( "Content-Location: ".ConstructURL($this->path) ); Privileges:CalDAVRequest.php: else if ( $this->options['allow_by_email'] && preg_match( '#^/(\S+@\S+[.]\S+)/?$#', $this->path) ) { Privileges:CalDAVRequest.php: $this->collection_id = -1; Privileges:CalDAVRequest.php: $this->collection_type = 'email'; Privileges:CalDAVRequest.php: $this->collection_path = $this->path; Privileges:CalDAVRequest.php: $this->_is_principal = true; Privileges:CalDAVRequest.php: else if ( preg_match( '#^(/[^/]+)/?$#', $this->path, $matches) || preg_match( '#^(/principals/[^/]+/[^/]+)/?$#', $this->path, $matches) ) { Privileges:CalDAVRequest.php: $this->collection_id = -1; Privileges:CalDAVRequest.php: $this->collection_path = $matches[1].'/'; // Enforce trailling '/' Privileges:CalDAVRequest.php: $this->collection_type = 'principal'; Privileges:CalDAVRequest.php: $this->_is_principal = true; Privileges:CalDAVRequest.php: if ( $this->collection_path == $this->path."/" ) { Privileges:CalDAVRequest.php: $this->path .= '/'; Privileges:CalDAVRequest.php: dbg_error_log( "caldav", "Path is actually a collection - sending Content-Location header." ); Privileges:CalDAVRequest.php: header( "Content-Location: ".ConstructURL($this->path) ); Privileges:CalDAVRequest.php: if ( preg_match( '#^(/principals/[^/]+/[^/]+)/?$#', $this->path, $matches) ) { Privileges:CalDAVRequest.php: $this->depth = 0; Privileges:CalDAVRequest.php: else if ( $this->path == '/' ) { Privileges:CalDAVRequest.php: $this->collection_id = -1; Privileges:CalDAVRequest.php: $this->collection_path = '/'; Privileges:CalDAVRequest.php: $this->collection_type = 'root'; Privileges:CalDAVRequest.php: if ( $this->collection_path == $this->path ) $this->_is_collection = true; Privileges:CalDAVRequest.php: dbg_error_log( "caldav", " Collection '%s' is %d, type %s", $this->collection_path, $this->collection_id, $this->collection_type ); Privileges:CalDAVRequest.php: $this->principal = new CalDAVPrincipal( array( "path" => $this->path, "options" => $this->options ) ); Privileges:CalDAVRequest.php: if ( isset($this->principal->user_no) ) $this->user_no = $this->principal->user_no; Privileges:CalDAVRequest.php: if ( isset($this->principal->username)) $this->username = $this->principal->username; Privileges:CalDAVRequest.php: if ( isset($this->principal->by_email) && $this->principal->by_email) $this->by_email = true; Privileges:CalDAVRequest.php: if ( isset($this->principal->principal_id)) $this->principal_id = $this->principal->principal_id; Privileges:CalDAVRequest.php: if ( $this->collection_type == 'principal' || $this->collection_type == 'email' || $this->collection_type == 'proxy' ) { Privileges:CalDAVRequest.php: $this->collection = $this->principal->AsCollection(); Privileges:CalDAVRequest.php: if( $this->collection_type == 'proxy' ) { Privileges:CalDAVRequest.php: $this->collection = $this->principal->AsCollection(); Privileges:CalDAVRequest.php: $this->collection->is_proxy = 't'; Privileges:CalDAVRequest.php: $this->collection->type = 'proxy'; Privileges:CalDAVRequest.php: $this->collection->proxy_type = $this->proxy_type; Privileges:CalDAVRequest.php: $this->collection->dav_displayname = sprintf('Proxy %s for %s', $this->proxy_type, $this->principal->username() ); Privileges:CalDAVRequest.php: elseif( $this->collection_type == 'root' ) { Privileges:CalDAVRequest.php: $this->collection = (object) array( Privileges:CalDAVRequest.php: 'dav_etag' => md5($c->system_name), Privileges:CalDAVRequest.php: 'dav_displayname' => $c->system_name, Privileges:CalDAVRequest.php: $this->setPermissions(); Privileges:CalDAVRequest.php: $this->supported_methods = array( Privileges:CalDAVRequest.php: if ( $this->IsCollection() ) { Privileges:CalDAVRequest.php: switch ( $this->collection_type ) { Privileges:CalDAVRequest.php: $this->supported_methods = array( Privileges:CalDAVRequest.php: case 'schedule-inbox': Privileges:CalDAVRequest.php: case 'schedule-outbox': Privileges:CalDAVRequest.php: $this->supported_methods = array_merge( Privileges:CalDAVRequest.php: $this->supported_methods, Privileges:CalDAVRequest.php: $this->supported_methods['GET'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['PUT'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['HEAD'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['GET'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['PUT'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['HEAD'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['MKCOL'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['MKCALENDAR'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['PROPPATCH'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods['BIND'] = ''; Privileges:CalDAVRequest.php: $this->supported_methods = array_merge( Privileges:CalDAVRequest.php: $this->supported_methods, Privileges:CalDAVRequest.php: /**** comentado por motivos de incmpatibilidade do sync-collection Privileges:CalDAVRequest.php: $this->supported_reports = array( Privileges:CalDAVRequest.php: 'DAV::principal-property-search' => '', Privileges:CalDAVRequest.php: 'DAV::expand-property' => '', Privileges:CalDAVRequest.php: 'DAV::sync-collection' => '' Privileges:CalDAVRequest.php: $this->supported_reports = array( Privileges:CalDAVRequest.php: 'DAV::principal-property-search' => '', Privileges:CalDAVRequest.php: 'DAV::expand-property' => '' Privileges:CalDAVRequest.php: if ( isset($this->collection) && $this->collection->is_calendar ) { Privileges:CalDAVRequest.php: $this->supported_reports = array_merge( Privileges:CalDAVRequest.php: $this->supported_reports, Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:calendar-query' => '', Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:calendar-multiget' => '', Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:caldav:free-busy-query' => '' Privileges:CalDAVRequest.php: if ( isset($this->collection) && $this->collection->is_addressbook ) { Privileges:CalDAVRequest.php: $this->supported_reports = array_merge( Privileges:CalDAVRequest.php: $this->supported_reports, Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:carddav:addressbook-query' => '', Privileges:CalDAVRequest.php: 'urn:ietf:params:xml:ns:carddav:addressbook-multiget' => '' Privileges:CalDAVRequest.php: if ( isset($this->content_type) && preg_match( '#(application|text)/xml#', $this->content_type ) ) { Privileges:CalDAVRequest.php: $xml_parser = xml_parser_create_ns('UTF-8'); Privileges:CalDAVRequest.php: $this->xml_tags = array(); Privileges:CalDAVRequest.php: $rc = xml_parse_into_struct( $xml_parser, $this->raw_post, $this->xml_tags ); Privileges:CalDAVRequest.php: $this->XMLResponse( 400, new XMLElement( 'error', new XMLElement('invalid-xml'), array( 'xmlns' => 'DAV:') ) ); Privileges:CalDAVRequest.php: if ( count($this->xml_tags) ) { Privileges:CalDAVRequest.php: $this->xml_tags = null; Privileges:CalDAVRequest.php: dbg_error_log( "ERROR", "Incoming request sent content-type XML with no XML request body." ); Privileges:CalDAVRequest.php: * Look out for If-None-Match or If-Match headers Privileges:CalDAVRequest.php: $this->etag_none_match = str_replace('"','',$_SERVER["HTTP_IF_NONE_MATCH"]); Privileges:CalDAVRequest.php: if ( $this->etag_none_match == '' ) unset($this->etag_none_match); Privileges:CalDAVRequest.php: $this->etag_if_match = str_replace('"','',$_SERVER["HTTP_IF_MATCH"]); Privileges:CalDAVRequest.php: if ( $this->etag_if_match == '' ) unset($this->etag_if_match); Privileges:CalDAVRequest.php: $this->user_no = $session->user_no; Privileges:CalDAVRequest.php: $this->username = $session->username; Privileges:CalDAVRequest.php: $this->principal_id = $session->principal_id; Privileges:CalDAVRequest.php: if ( $this->path == '/' || $this->path == '' ) { Privileges:CalDAVRequest.php: $path_split = explode('/', $this->path ); Privileges:CalDAVRequest.php: $this->username = $path_split[1]; Privileges:CalDAVRequest.php: if ( $this->username == 'principals' ) $this->username = $path_split[3]; Privileges:CalDAVRequest.php: if ( isset($this->options['allow_by_email']) && preg_match( '#/(\S+@\S+[.]\S+)/?$#', $this->path, $matches) ) { Privileges:CalDAVRequest.php: $this->by_email = $matches[1]; Privileges:CalDAVRequest.php: array(':email' => $this->by_email ) ); Privileges:CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $user = $qry->Fetch() ) { Privileges:CalDAVRequest.php: $this->user_no = $user->user_no; Privileges:CalDAVRequest.php: $this->username = $user->username; Privileges:CalDAVRequest.php: $this->principal_id = $user->principal_id; Privileges:CalDAVRequest.php: elseif( $user = getUserByName($this->username,'caldav',__LINE__,__FILE__)) { Privileges:CalDAVRequest.php: $this->principal = $user; Privileges:CalDAVRequest.php: $this->user_no = $user->user_no; Privileges:CalDAVRequest.php: $this->principal_id = $user->principal_id; Privileges:CalDAVRequest.php: if ( $this->path == '/' || $this->path == '' ) { Privileges:CalDAVRequest.php: $this->privileges = privilege_to_bits( array('read','read-free-busy','read-acl')); Privileges:CalDAVRequest.php: else if ( $session->AllowedTo("Admin") || $session->user_no == $this->user_no ) { Privileges:CalDAVRequest.php: $this->privileges = privilege_to_bits('all'); Privileges:CalDAVRequest.php: dbg_error_log( "caldav", "Full permissions for %s", ( $session->user_no == $this->user_no ? "user accessing their own hierarchy" : "a systems administrator") ); Privileges:CalDAVRequest.php: $this->privileges = 0; Privileges:CalDAVRequest.php: if ( $this->IsPublic() ) { Privileges:CalDAVRequest.php: $this->privileges = privilege_to_bits(array('read','read-free-busy')); Privileges:CalDAVRequest.php: else if ( isset($c->public_freebusy_url) && $c->public_freebusy_url ) { Privileges:CalDAVRequest.php: $this->privileges = privilege_to_bits('read-free-busy'); Privileges:CalDAVRequest.php: $params = array( ':session_principal_id' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:CalDAVRequest.php: if ( isset($this->by_email) && $this->by_email ) { Privileges:CalDAVRequest.php: $params[':request_principal_id'] = $this->principal_id; Privileges:CalDAVRequest.php: $params[':request_path'] = $this->path; Privileges:CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) && $permission_result = $qry->Fetch() ) Privileges:CalDAVRequest.php: $this->privileges |= bindec($permission_result->perm); Privileges:CalDAVRequest.php: dbg_error_log( 'caldav', 'Restricted permissions for user accessing someone elses hierarchy: %s', decbin($this->privileges) ); Privileges:CalDAVRequest.php: if ( isset($this->ticket) && $this->ticket->MatchesPath($this->path) ) { Privileges:CalDAVRequest.php: $this->privileges |= $this->ticket->privileges(); Privileges:CalDAVRequest.php: dbg_error_log( 'caldav', 'Applying permissions for ticket "%s" now: %s', $this->ticket->id(), decbin($this->privileges) ); Privileges:CalDAVRequest.php: $this->permissions = array(); Privileges:CalDAVRequest.php: $privs = bits_to_privilege($this->privileges); Privileges:CalDAVRequest.php: $this->permissions[$v] = $type; Privileges:CalDAVRequest.php: * that. At present we only maintain permissions on a per-collection basis though. Privileges:CalDAVRequest.php: if ( !isset($this->_locks_found) ) { Privileges:CalDAVRequest.php: $this->_locks_found = array(); Privileges:CalDAVRequest.php: $qry->Exec('caldav',__LINE__,__FILE__); Privileges:CalDAVRequest.php: $qry = new AwlQuery($sql, array( ':dav_name' => $this->path, ':pattern_end_match' => ($this->IsInfiniteDepth() ? '' : '$') ) ); Privileges:CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) ) { Privileges:CalDAVRequest.php: while( $lock_row = $qry->Fetch() ) { Privileges:CalDAVRequest.php: $this->_locks_found[$lock_row->opaquelocktoken] = $lock_row; Privileges:CalDAVRequest.php: $this->DoResponse(500,translate("Database Error")); Privileges:CalDAVRequest.php: foreach( $this->_locks_found AS $lock_token => $lock_row ) { Privileges:CalDAVRequest.php: if ( $lock_row->depth == DEPTH_INFINITY || $lock_row->dav_name == $this->path ) { Privileges:CalDAVRequest.php: if ( isset($this->collection) && isset($this->collection->publicly_readable) && $this->collection->publicly_readable == 't' ) { Privileges:CalDAVRequest.php: if ( isset($this->path) ) return $this->path; Privileges:CalDAVRequest.php: if ( $this->IsInfiniteDepth() ) return 'infinity'; Privileges:CalDAVRequest.php: return $this->depth; Privileges:CalDAVRequest.php: if ( $this->IsInfiniteDepth() ) return ''; Privileges:CalDAVRequest.php: if ( $this->depth == 0 ) return '$'; Privileges:CalDAVRequest.php: if ( isset($this->_locks_found) && isset($this->_locks_found[$lock_token]) ) { Privileges:CalDAVRequest.php: return $this->_locks_found[$lock_token]; Privileges:CalDAVRequest.php: if ( $qry->Exec('caldav',__LINE__,__FILE__) ) { Privileges:CalDAVRequest.php: $lock_row = $qry->Fetch(); Privileges:CalDAVRequest.php: $this->_locks_found = array( $lock_token => $lock_row ); Privileges:CalDAVRequest.php: return $this->_locks_found[$lock_token]; Privileges:CalDAVRequest.php: $this->DoResponse( 500, translate("Database Error") ); Privileges:CalDAVRequest.php: if ( isset($this->lock_token) && $this->lock_token == $lock_token ) { Privileges:CalDAVRequest.php: if ( isset($this->if_clause) ) { Privileges:CalDAVRequest.php: dbg_error_log( "caldav", "Checking lock token '%s' against '%s'", $lock_token, $this->if_clause ); Privileges:CalDAVRequest.php: $tokens = preg_split( '/[<>]/', $this->if_clause ); Privileges:CalDAVRequest.php: @dbg_error_log( "caldav", "Invalid lock token '%s' - not in Lock-token (%s) or If headers (%s) ", $lock_token, $this->lock_token, $this->if_clause ); Privileges:CalDAVRequest.php: if ( !isset($this->_locks_found) && false === $this->IsLocked() ) return false; Privileges:CalDAVRequest.php: if ( isset($this->_locks_found[$lock_token]) ) return $this->_locks_found[$lock_token]; Privileges:CalDAVRequest.php: if ( $existing_lock = $this->IsLocked() ) { // NOTE Assignment in if() is expected here. Privileges:CalDAVRequest.php: dbg_error_log( "caldav", "There is a lock on '%s'", $this->path); Privileges:CalDAVRequest.php: if ( ! $this->ValidateLockToken($existing_lock) ) { Privileges:CalDAVRequest.php: $lock_row = $this->GetLockRow($existing_lock); Privileges:CalDAVRequest.php: * Already locked - deny it Privileges:CalDAVRequest.php: new XMLElement( 'href', $lock_row->dav_name ), Privileges:CalDAVRequest.php: if ( $lock_row->dav_name != $this->path ) { Privileges:CalDAVRequest.php: new XMLElement( 'href', $this->path ), Privileges:CalDAVRequest.php: $xmldoc = $response->Render(0,''); Privileges:CalDAVRequest.php: $this->DoResponse( 207, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:CalDAVRequest.php: * Coerces the Content-type of the request into something valid/appropriate Privileges:CalDAVRequest.php: if ( isset($this->content_type) ) { Privileges:CalDAVRequest.php: $type = explode( '/', $this->content_type, 2); Privileges:CalDAVRequest.php: /** Null (or peculiar) content-type supplied so we have to try and work it out... */ Privileges:CalDAVRequest.php: $first_word = trim(substr( $this->raw_post, 0, 30)); Privileges:CalDAVRequest.php: dbg_error_log( 'LOG WARNING', 'Application sent content-type of "%s" instead of "text/xml"', Privileges:CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)') ); Privileges:CalDAVRequest.php: $this->content_type = 'text/xml'; Privileges:CalDAVRequest.php: dbg_error_log( 'LOG WARNING', 'Application sent content-type of "%s" instead of "text/calendar"', Privileges:CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)') ); Privileges:CalDAVRequest.php: $this->content_type = 'text/calendar'; Privileges:CalDAVRequest.php: dbg_error_log( 'LOG WARNING', 'Application sent content-type of "%s" instead of "text/vcard"', Privileges:CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)') ); Privileges:CalDAVRequest.php: $this->content_type = 'text/vcard'; Privileges:CalDAVRequest.php: dbg_error_log( 'LOG NOTICE', 'Unusual content-type of "%s" and first word of content is "%s"', Privileges:CalDAVRequest.php: (isset($this->content_type)?$this->content_type:'(null)'), $first_word ); Privileges:CalDAVRequest.php: if ( !isset($this->_is_collection) ) { Privileges:CalDAVRequest.php: $this->_is_collection = preg_match( '#/$#', $this->path ); Privileges:CalDAVRequest.php: return $this->_is_collection; Privileges:CalDAVRequest.php: if ( !$this->IsCollection() || !isset($this->collection) ) return false; Privileges:CalDAVRequest.php: return $this->collection->is_calendar == 't'; Privileges:CalDAVRequest.php: if ( !$this->IsCollection() || !isset($this->collection) ) return false; Privileges:CalDAVRequest.php: return $this->collection->is_addressbook == 't'; Privileges:CalDAVRequest.php: if ( !isset($this->_is_principal) ) { Privileges:CalDAVRequest.php: $this->_is_principal = preg_match( '#^/[^/]+/$#', $this->path ); Privileges:CalDAVRequest.php: return $this->_is_principal; Privileges:CalDAVRequest.php: if ( !isset($this->_is_proxy_request) ) { Privileges:CalDAVRequest.php: $this->_is_proxy_request = preg_match( '#^/[^/]+/calendar-proxy-(read|write)/?[^/]*$#', $this->path ); Privileges:CalDAVRequest.php: return $this->_is_proxy_request; Privileges:CalDAVRequest.php: return ($this->depth == DEPTH_INFINITY); Privileges:CalDAVRequest.php: return $this->collection_id; Privileges:CalDAVRequest.php: if ( $privs === null ) $privs = $this->supported_privileges; Privileges:CalDAVRequest.php: $reply->NSElement($privilege,$k); Privileges:CalDAVRequest.php: dbg_error_log( 'caldav', '"%s" is a container of sub-privileges.', $k ); Privileges:CalDAVRequest.php: $privset = array_merge($privset, $this->BuildSupportedPrivileges($reply,$v)); Privileges:CalDAVRequest.php: $privileges[] = new XMLElement('supported-privilege',$privset); Privileges:CalDAVRequest.php: * +------------+------------------------------------------------------+ Privileges:CalDAVRequest.php: * +------------+------------------------------------------------------+ Privileges:CalDAVRequest.php: * | REPORT | DAV:read or CALDAV:read-free-busy (on all referenced | Privileges:CalDAVRequest.php: * +------------+------------------------------------------------------+ Privileges:CalDAVRequest.php: dbg_error_log('caldav', 'Checking whether "%s" is allowed to "%s"', $session->username, $activity); Privileges:CalDAVRequest.php: if ( isset($this->permissions['all']) ) return true; Privileges:CalDAVRequest.php: case "CALDAV:schedule-send-freebusy": Privileges:CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); Privileges:CalDAVRequest.php: case "CALDAV:schedule-send-invite": Privileges:CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); Privileges:CalDAVRequest.php: case "CALDAV:schedule-send-reply": Privileges:CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); Privileges:CalDAVRequest.php: return isset($this->permissions['read']) || isset($this->permissions['urn:ietf:params:xml:ns:caldav:read-free-busy']); Privileges:CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['unbind']); Privileges:CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['write-properties']); Privileges:CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['write-content']); Privileges:CalDAVRequest.php: return isset($this->permissions['write']) || isset($this->permissions['bind']); Privileges:CalDAVRequest.php: if ( !isset($this->permissions['write']) || !isset($this->permissions['bind']) ) return false; Privileges:CalDAVRequest.php: if ( $this->is_principal ) return false; Privileges:CalDAVRequest.php: if ( $this->path == '/' ) return false; Privileges:CalDAVRequest.php:// decbin($this->privileges), ($this->privileges & $test_bits), decbin($this->privileges & $test_bits) ); Privileges:CalDAVRequest.php: return (($this->privileges & $test_bits) > 0 ); Privileges:CalDAVRequest.php: return $this->privileges; Privileges:CalDAVRequest.php:// decbin($this->privileges), ($this->privileges & $test_bits), decbin($this->privileges & $test_bits) ); Privileges:CalDAVRequest.php: return ($this->privileges & $test_bits) > 0; Privileges:CalDAVRequest.php: * Sometimes it's a perfectly formed request, but we just don't do that :-( Privileges:CalDAVRequest.php: dbg_error_log("ERROR", " %s: Support for $v:$k properties is not implemented yet", $this->method ); Privileges:CalDAVRequest.php: $badprops->NewElement(strtolower($k),false,array("xmlns" => strtolower($v))); Privileges:CalDAVRequest.php: $this->XMLResponse( 422, $error ); Privileges:CalDAVRequest.php: * Send a need-privileges error response. This function will only return Privileges:CalDAVRequest.php: if ( $this->HavePrivilegeTo($privileges) ) return; Privileges:CalDAVRequest.php: $href = $this->path; Privileges:CalDAVRequest.php: $privnodes = array( $reply->href(ConstructURL($href)), new XMLElement( 'privilege' ) ); Privileges:CalDAVRequest.php: $reply->NSElement( $privnodes[1], $privileges[0] ); Privileges:CalDAVRequest.php: $xml = new XMLElement( 'need-privileges', new XMLElement( 'resource', $privnodes) ); Privileges:CalDAVRequest.php: $xmldoc = $reply->Render('error',$xml); Privileges:CalDAVRequest.php: $this->DoResponse( 403, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:CalDAVRequest.php: $xmldoc = sprintf(' Privileges:CalDAVRequest.php: $this->DoResponse( $status, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:CalDAVRequest.php: $this->DoResponse( 400, $text ); Privileges:CalDAVRequest.php: $xmldoc = $xmltree->Render(0,''); Privileges:CalDAVRequest.php: $this->DoResponse( $status, $xmldoc, 'text/xml; charset="utf-8"' ); Privileges:CalDAVRequest.php: * Utility function we call when we have a simple status-based response to Privileges:CalDAVRequest.php: function DoResponse( $status, $message="", $content_type="text/plain; charset=\"utf-8\"" ) { Privileges:CalDAVRequest.php: @header( sprintf("X-DAViCal-Version: DAViCal/%d.%d.%d; DB/%d.%d.%d", $c->code_major, $c->code_minor, $c->code_patch, $c->schema_major, $c->schema_minor, $c->schema_patch) ); Privileges:CalDAVRequest.php: @header( "Content-type: ".$content_type ); Privileges:CalDAVRequest.php: if ( (isset($c->dbg['ALL']) && $c->dbg['ALL']) || (isset($c->dbg['response']) && $c->dbg['response']) || $status > 399 ) { Privileges:CalDAVRequest.php: dbg_error_log( "LOG headers", "-->%s", $v ); Privileges:CalDAVRequest.php: dbg_error_log( "LOG response", "-->%s", $v ); Privileges:CalDAVRequest.php: header( "Content-Length: ".strlen($message) ); Privileges:CalDAVRequest.php: if ( isset($c->dbg['caldav']) && $c->dbg['caldav'] ) { Privileges:CalDAVRequest.php: dbg_error_log("caldav", "Status: %d, Message: %s, User: %d, Path: %s", $status, $message, $session->user_no, $this->path); Privileges:CalDAVRequest.php: if ( isset($c->dbg['statistics']) && $c->dbg['statistics'] ) { Privileges:CalDAVRequest.php: $script_time = microtime(true) - $c->script_start_time; Privileges:CalDAVRequest.php: $this->method, $status, $script_time, $c->total_query_time, $this->path); Privileges:check_UTF8.php: * http://iki.fi/hsivonen/php-utf8/ Privileges:check_UTF8.php: * Version 1.0, 2003-05-30 Privileges:check_UTF8.php: * Takes an UTF-8 string and returns an array of ints representing the Privileges:check_UTF8.php: * Returns false if the input string isn't a valid UTF-8 octet sequence. Privileges:check_UTF8.php: // When mState is zero we expect either a US-ASCII character or a Privileges:check_UTF8.php: // multi-octet sequence. Privileges:check_UTF8.php: // US-ASCII, pass straight through. Privileges:check_UTF8.php: * (b) outside the Unicode range of 0-0x10FFFF. Privileges:check_UTF8.php: /* Current octet is neither in the US-ASCII range nor a legal first Privileges:check_UTF8.php: * octet of a multi-octet sequence. Privileges:check_UTF8.php: // When mState is non-zero, we expect a continuation of the multi-octet Privileges:check_UTF8.php: $shift = ($mState - 1) * 6; Privileges:check_UTF8.php: if (0 == --$mState) { Privileges:check_UTF8.php: /* End of the multi-octet sequence. mUcs4 now contains the final Privileges:check_UTF8.php: // From Unicode 3.1, non-shortest form is illegal Privileges:check_UTF8.php: * Incomplete multi-octet sequence. Privileges:check_UTF8.php: * a UTF-8 string. Astral planes are supported ie. the ints in the Privileges:check_UTF8.php: // nop -- zap the BOM Privileges:davical_configuration_missing.php:include("page-header.php"); Privileges:davical_configuration_missing.php:

There is no configuration file present in /etc/davical/$_SERVER[SERVER_NAME]-conf.php so Privileges:davical_configuration_missing.php:

Well, you're seeing this! At least you have DAViCal installed :-) You also have Apache and PHP working Privileges:davical_configuration_missing.php: or later so keep downloading new versions and trying again. Or make some guesses. Or bug Andrew :-)

Privileges:davical_configuration_missing.php:// \$c->domain_name = 'davical.example.com'; Privileges:davical_configuration_missing.php:// \$c->sysabbr = 'davical'; Privileges:davical_configuration_missing.php:// \$c->system_name = 'DAViCal CalDAV Server'; Privileges:davical_configuration_missing.php: \$c->admin_email = 'admin@example.com'; Privileges:davical_configuration_missing.php: \$c->pg_connect[] = 'dbname=davical user=davical_app'; Privileges:davical_configuration_missing.php:configuring someone for the admin e-mail is a really good idea.

Privileges:davical_configuration_missing.php:include("page-footer.php"); Privileges:DAViCalSession.php:// the records related to the logged-on user... (the where clause gets added). Privileges:DAViCalSession.php: $this->Session($sid); Privileges:DAViCalSession.php: if ( !isset($u->principal_id) ) { Privileges:DAViCalSession.php: // If they don't have a principal_id set then we should re-read from our local database Privileges:DAViCalSession.php: $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $u->username) ); Privileges:DAViCalSession.php: if ( $qry->Exec() && $qry->rows() == 1 ) { Privileges:DAViCalSession.php: $u = $qry->Fetch(); Privileges:DAViCalSession.php: $this->GetRoles(); Privileges:DAViCalSession.php: if ( function_exists('awl_set_locale') && isset($this->locale) && $this->locale != '' ) { Privileges:DAViCalSession.php: awl_set_locale($this->locale); Privileges:DAViCalSession.php: $this->roles = array(); Privileges:DAViCalSession.php: $sql = 'SELECT role_name FROM roles JOIN role_member ON roles.role_no=role_member.role_no WHERE user_no = '.$this->user_no; Privileges:DAViCalSession.php: if ( $qry->Exec('DAViCalSession') && $qry->rows() > 0 ) { Privileges:DAViCalSession.php: while( $role = $qry->Fetch() ) { Privileges:DAViCalSession.php: $this->roles[$role->role_name] = 1; Privileges:DAViCalSession.php: if ( (isset($c->restrict_admin_domain) && $c->restrict_admin_domain != $current_domain) Privileges:DAViCalSession.php: || (isset($c->restrict_admin_port) && $c->restrict_admin_port != $_SERVER['SERVER_PORT'] ) ) { Privileges:DAViCalSession.php: if ( isset($c->restrict_admin_roles) && $roles == '' ) $roles = $c->restrict_admin_roles; Privileges:DAViCalSession.php: if ( $this->logged_in && $roles == '' ) return; Privileges:DAViCalSession.php: if ( ! $this->logged_in ) { Privileges:DAViCalSession.php: $c->messages[] = i18n('You must log in to use this system.'); Privileges:DAViCalSession.php: include_once('page-header.php'); Privileges:DAViCalSession.php: if ( $this->login_failed ) { Privileges:DAViCalSession.php: $c->messages[] = i18n('Invalid user name or password.'); Privileges:DAViCalSession.php: .' '.translate($c->system_name).' ' Privileges:DAViCalSession.php: echo '

'.translate('If you would like to request access, please e-mail').' '.$c->admin_email."

\n"; Privileges:DAViCalSession.php: echo $this->RenderLoginPanel(); Privileges:DAViCalSession.php: if ( $this->AllowedTo($v) ) return; Privileges:DAViCalSession.php: $c->messages[] = i18n('You are not authorised to use this function.'); Privileges:DAViCalSession.php: include_once('page-header.php'); Privileges:DAViCalSession.php: include('page-footer.php'); Privileges:DAViCalSession.php:$session->_CheckLogin(); Privileges:DAVResource.php: * @var True if this resource is a principal-URL Privileges:DAVResource.php: $this->exists = null; Privileges:DAVResource.php: $this->bound_from = null; Privileges:DAVResource.php: $this->dav_name = null; Privileges:DAVResource.php: $this->unique_tag = null; Privileges:DAVResource.php: $this->resource = null; Privileges:DAVResource.php: $this->collection = null; Privileges:DAVResource.php: $this->principal = null; Privileges:DAVResource.php: $this->parent = null; Privileges:DAVResource.php: $this->resourcetypes = null; Privileges:DAVResource.php: $this->contenttype = null; Privileges:DAVResource.php: $this->privileges = null; Privileges:DAVResource.php: $this->dead_properties = null; Privileges:DAVResource.php: $this->supported_methods = null; Privileges:DAVResource.php: $this->supported_reports = null; Privileges:DAVResource.php: $this->_is_collection = false; Privileges:DAVResource.php: $this->_is_principal = false; Privileges:DAVResource.php: $this->_is_calendar = false; Privileges:DAVResource.php: $this->_is_binding = false; Privileges:DAVResource.php: $this->_is_addressbook = false; Privileges:DAVResource.php: $this->_is_proxy_request = false; Privileges:DAVResource.php: $this->FromRow($parameters); Privileges:DAVResource.php: $this->FromPath($parameters['path']); Privileges:DAVResource.php: $this->FromPath($parameters); Privileges:DAVResource.php: $this->exists = true; Privileges:DAVResource.php: $this->dav_name = $row->dav_name; Privileges:DAVResource.php: $this->bound_from = (isset($row->bound_from)? $row->bound_from : $row->dav_name); Privileges:DAVResource.php: $this->_is_collection = preg_match( '{/$}', $this->dav_name ); Privileges:DAVResource.php: if ( $this->_is_collection ) { Privileges:DAVResource.php: $this->contenttype = 'httpd/unix-directory'; Privileges:DAVResource.php: $this->collection = (object) array(); Privileges:DAVResource.php: $this->resource_id = $row->collection_id; Privileges:DAVResource.php: $this->_is_principal = preg_match( '{^/[^/]+/$}', $this->dav_name ); Privileges:DAVResource.php: if ( preg_match( '#^(/principals/[^/]+/[^/]+)/?$#', $this->dav_name, $matches) ) { Privileges:DAVResource.php: $this->collection->dav_name = $matches[1].'/'; Privileges:DAVResource.php: $this->collection->type = 'principal_link'; Privileges:DAVResource.php: $this->_is_principal = true; Privileges:DAVResource.php: $this->resource = (object) array(); Privileges:DAVResource.php: if ( isset($row->dav_id) ) $this->resource_id = $row->dav_id; Privileges:DAVResource.php: dbg_error_log( 'DAVResource', ':FromRow: Named "%s" is%s a collection.', $this->dav_name, ($this->_is_collection?'':' not') ); Privileges:DAVResource.php: if ( $this->_is_collection ) Privileges:DAVResource.php: $this->collection->{$k} = $v; Privileges:DAVResource.php: $this->resource->{$k} = $v; Privileges:DAVResource.php: $this->{$k} = $v; Privileges:DAVResource.php: $this->unique_tag = '"'.$v.'"'; Privileges:DAVResource.php: if ( $this->_is_collection ) { Privileges:DAVResource.php: if ( !isset( $this->collection->type ) || $this->collection->type == 'collection' ) { Privileges:DAVResource.php: if ( $this->_is_principal ) Privileges:DAVResource.php: $this->collection->type = 'principal'; Privileges:DAVResource.php: else if ( $row->is_calendar == 't' ) { Privileges:DAVResource.php: $this->collection->type = 'calendar'; Privileges:DAVResource.php: else if ( $row->is_addressbook == 't' ) { Privileges:DAVResource.php: $this->collection->type = 'addressbook'; Privileges:DAVResource.php: else if ( isset($row->is_proxy) && $row->is_proxy == 't' ) { Privileges:DAVResource.php: $this->collection->type = 'proxy'; Privileges:DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) Privileges:DAVResource.php: $this->collection->type = 'schedule-'. $matches[3]. 'box'; Privileges:DAVResource.php: else if ( $this->dav_name == '/' ) Privileges:DAVResource.php: $this->collection->type = 'root'; Privileges:DAVResource.php: $this->collection->type = 'collection'; Privileges:DAVResource.php: $this->_is_calendar = ($this->collection->is_calendar == 't'); Privileges:DAVResource.php: $this->_is_addressbook = ($this->collection->is_addressbook == 't'); Privileges:DAVResource.php: $this->_is_proxy_request= ($this->collection->type == 'proxy'); Privileges:DAVResource.php: if ( $this->_is_principal && !isset($this->resourcetypes) ) { Privileges:DAVResource.php: $this->resourcetypes = ''; Privileges:DAVResource.php: else if ( $this->_is_proxy_request ) { Privileges:DAVResource.php: $this->resourcetypes = $this->collection->resourcetypes; Privileges:DAVResource.php: if ( isset($this->collection->dav_displayname) ) $this->collection->displayname = $this->collection->dav_displayname; Privileges:DAVResource.php: $this->resourcetypes = ''; Privileges:DAVResource.php: if ( isset($this->resource->caldav_data) ) { Privileges:DAVResource.php: if ( substr($this->resource->caldav_data,0,15) == 'BEGIN:VCALENDAR' ) $this->contenttype = 'text/calendar'; Privileges:DAVResource.php: $this->resource->displayname = $this->resource->summary; Privileges:DAVResource.php: $this->dav_name = DeconstructURL($inpath); Privileges:DAVResource.php: $this->FetchCollection(); Privileges:DAVResource.php: if ( $this->_is_collection ) { Privileges:DAVResource.php: if ( $this->_is_principal || $this->collection->type == 'principal' ) $this->FetchPrincipal(); Privileges:DAVResource.php: $this->FetchResource(); Privileges:DAVResource.php: $this->dav_name, ($this->_is_collection?' '.$this->resourcetypes:' not'), ($this->_is_principal?' and a principal':'') ); Privileges:DAVResource.php: * - also discussed at more length in 5.2 Privileges:DAVResource.php: * - The exact request. Privileges:DAVResource.php: * - If the exact request, doesn't end in '/', then the request URL with a '/' appended Privileges:DAVResource.php: * - The request URL truncated to the last '/' Privileges:DAVResource.php: dbg_error_log( 'DAVResource', ':FetchCollection: Looking for collection for "%s".', $this->dav_name ); Privileges:DAVResource.php: $this->collection = (object) array( Privileges:DAVResource.php: 'collection_id' => -1, Privileges:DAVResource.php: $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:DAVResource.php: if ( !preg_match( '#/$#', $this->dav_name ) ) { Privileges:DAVResource.php: $params[':up_to_slash'] = preg_replace( '#[^/]*$#', '', $this->dav_name); Privileges:DAVResource.php: $params[':plus_slash'] = $this->dav_name.'/'; Privileges:DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { Privileges:DAVResource.php: $this->collection = $row; Privileges:DAVResource.php: $this->collection->exists = true; Privileges:DAVResource.php: if ( $row->is_calendar == 't' ) Privileges:DAVResource.php: $this->collection->type = 'calendar'; Privileges:DAVResource.php: else if ( $row->is_addressbook == 't' ) Privileges:DAVResource.php: $this->collection->type = 'addressbook'; Privileges:DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) Privileges:DAVResource.php: $this->collection->type = 'schedule-'. $matches[3]. 'box'; Privileges:DAVResource.php: $this->collection->type = 'collection'; Privileges:DAVResource.php: else if ( preg_match( '{^( ( / ([^/]+) / ) \.(in|out)/ ) [^/]*$}x', $this->dav_name, $matches ) ) { Privileges:DAVResource.php: // The request is for a scheduling inbox or outbox (or something inside one) and we should auto-create it Privileges:DAVResource.php: $this->collection_type = 'schedule-'. $matches[4]. 'box'; Privileges:DAVResource.php: $params[':resourcetypes'] = sprintf('', $this->collection_type ); Privileges:DAVResource.php: $qry->Exec('DAVResource'); Privileges:DAVResource.php: $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { Privileges:DAVResource.php: $this->collection = $row; Privileges:DAVResource.php: $this->collection->exists = true; Privileges:DAVResource.php: $this->collection->type = $this->collection_type; Privileges:DAVResource.php: else if ( preg_match( '#^(/([^/]+)/calendar-proxy-(read|write))/?[^/]*$#', $this->dav_name, $matches ) ) { Privileges:DAVResource.php: $this->collection->type = 'proxy'; Privileges:DAVResource.php: $this->_is_proxy_request = true; Privileges:DAVResource.php: $this->proxy_type = $matches[3]; Privileges:DAVResource.php: $this->collection->dav_name = $this->dav_name; Privileges:DAVResource.php: $this->collection->dav_displayname = sprintf( '%s proxy %s', $matches[2], $matches[3] ); Privileges:DAVResource.php: $this->collection->exists = true; Privileges:DAVResource.php: $this->collection->parent_container = $matches[1] . '/'; Privileges:DAVResource.php: else if ( preg_match( '#^(/[^/]+)/?$#', $this->dav_name, $matches) Privileges:DAVResource.php: || preg_match( '#^((/principals/[^/]+/)[^/]+)/?$#', $this->dav_name, $matches) ) { Privileges:DAVResource.php: $this->_is_principal = true; Privileges:DAVResource.php: $this->FetchPrincipal(); Privileges:DAVResource.php: else if ( $this->dav_name == '/' ) { Privileges:DAVResource.php: $this->collection->dav_name = '/'; Privileges:DAVResource.php: $this->collection->type = 'root'; Privileges:DAVResource.php: $this->collection->exists = true; Privileges:DAVResource.php: $this->collection->displayname = $c->system_name; Privileges:DAVResource.php: $this->collection->default_privileges = (1 | 16 | 32); Privileges:DAVResource.php: $this->collection->parent_container = '/'; Privileges:DAVResource.php: $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); Privileges:DAVResource.php: if ( !preg_match( '#/$#', $this->dav_name ) ) { Privileges:DAVResource.php: $params[':up_to_slash'] = preg_replace( '#[^/]*$#', '', $this->dav_name); Privileges:DAVResource.php: $params[':plus_slash'] = $this->dav_name.'/'; Privileges:DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { Privileges:DAVResource.php: $this->collection = $row; Privileges:DAVResource.php: $this->collection->exists = true; Privileges:DAVResource.php: $this->_is_binding = true; Privileges:DAVResource.php: $this->collection->parent_set = $row->parent_container; Privileges:DAVResource.php: $this->collection->parent_container = $row->bind_parent_container; Privileges:DAVResource.php: $this->bound_from = str_replace( $row->bound_to, $row->dav_name, $this->dav_name); Privileges:DAVResource.php: $this->collection->bound_from = $row->dav_name; Privileges:DAVResource.php: $this->collection->dav_name = $row->bound_to; Privileges:DAVResource.php: if ( isset($row->access_ticket_id) ) { Privileges:DAVResource.php: if ( !isset($this->tickets) ) $this->tickets = array(); Privileges:DAVResource.php: $this->tickets[] = new DAVTicket($row->access_ticket_id); Privileges:DAVResource.php: if ( $row->is_calendar == 't' ) Privileges:DAVResource.php: $this->collection->type = 'calendar'; Privileges:DAVResource.php: else if ( $row->is_addressbook == 't' ) Privileges:DAVResource.php: $this->collection->type = 'addressbook'; Privileges:DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) Privileges:DAVResource.php: $this->collection->type = 'schedule-'. $matches[3]. 'box'; Privileges:DAVResource.php: $this->collection->type = 'collection'; Privileges:DAVResource.php: dbg_error_log( 'DAVResource', 'No collection for path "%s".', $this->dav_name ); Privileges:DAVResource.php: $this->collection->exists = false; Privileges:DAVResource.php: $this->collection->dav_name = preg_replace('{/[^/]*$}', '/', $this->dav_name); Privileges:DAVResource.php: @dbg_error_log( 'DAVResource', ':FetchCollection: Found collection named "%s" of type "%s".', $this->collection->dav_name, $this->collection->type ); Privileges:DAVResource.php: $this->_is_collection = ( $this->_is_principal || $this->collection->dav_name == $this->dav_name || $this->collection->dav_name == $this->dav_name.'/' ); Privileges:DAVResource.php: if ( $this->_is_collection ) { Privileges:DAVResource.php: $this->dav_name = $this->collection->dav_name; Privileges:DAVResource.php: $this->resource_id = $this->collection->collection_id; Privileges:DAVResource.php: $this->_is_calendar = ($this->collection->type == 'calendar'); Privileges:DAVResource.php: $this->_is_addressbook = ($this->collection->type == 'addressbook'); Privileges:DAVResource.php: $this->contenttype = 'httpd/unix-directory'; Privileges:DAVResource.php: if ( !isset($this->exists) && isset($this->collection->exists) ) { Privileges:DAVResource.php: $this->exists = $this->collection->exists; Privileges:DAVResource.php: if ( $this->exists ) { Privileges:DAVResource.php: if ( isset($this->collection->dav_etag) ) $this->unique_tag = '"'.$this->collection->dav_etag.'"'; Privileges:DAVResource.php: if ( isset($this->collection->created) ) $this->created = $this->collection->created; Privileges:DAVResource.php: if ( isset($this->collection->modified) ) $this->modified = $this->collection->modified; Privileges:DAVResource.php: if ( isset($this->collection->dav_displayname) ) $this->collection->displayname = $this->collection->dav_displayname; Privileges:DAVResource.php: if ( !isset($this->parent) ){ Privileges:DAVResource.php: $this->FetchParentContainer(); Privileges:DAVResource.php: $this->user_no = $this->parent->GetProperty('user_no'); Privileges:DAVResource.php: if ( isset($this->collection->resourcetypes) ) Privileges:DAVResource.php: $this->resourcetypes = $this->collection->resourcetypes; Privileges:DAVResource.php: $this->resourcetypes = ''; Privileges:DAVResource.php: if ( $this->_is_principal ) $this->resourcetypes .= ''; Privileges:DAVResource.php: if ( $this->_is_addressbook ) $this->resourcetypes .= ''; Privileges:DAVResource.php: if ( $this->_is_calendar ) $this->resourcetypes .= ''; Privileges:DAVResource.php: if ( isset($this->principal) ) return; Privileges:DAVResource.php: $this->principal = new CalDAVPrincipal( array( "path" => $this->bound_from() ) ); Privileges:DAVResource.php: if ( $this->_is_principal && $this->principal->Exists() ) { Privileges:DAVResource.php: $this->exists = true; Privileges:DAVResource.php: $this->unique_tag = $this->principal->dav_etag; Privileges:DAVResource.php: $this->created = $this->principal->created; Privileges:DAVResource.php: $this->modified = $this->principal->modified; Privileges:DAVResource.php: $this->resourcetypes = ''; Privileges:DAVResource.php: $this->resource_id = $this->principal->principal_id; Privileges:DAVResource.php: $this->collection = $this->principal->AsCollection(); Privileges:DAVResource.php: $this->user_no = $this->principal->user_no; Privileges:DAVResource.php: elseif ( $this->_is_principal ) { Privileges:DAVResource.php: $this->exists = false; Privileges:DAVResource.php: $this->collection->dav_name = $this->dav_name; Privileges:DAVResource.php: $this->collection->type = 'principal'; Privileges:DAVResource.php: if ( isset($this->exists) ) return; // True or false, we've got what we can already Privileges:DAVResource.php: if ( $this->_is_collection ) return; // We have all we're going to read Privileges:DAVResource.php: $params = array( ':dav_name' => $this->bound_from() ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() > 0 ) { Privileges:DAVResource.php: $this->exists = true; Privileges:DAVResource.php: $this->resource = $qry->Fetch(); Privileges:DAVResource.php: $this->unique_tag = $this->resource->dav_etag; Privileges:DAVResource.php: $this->created = $this->resource->created; Privileges:DAVResource.php: $this->modified = $this->resource->modified; Privileges:DAVResource.php: $this->resource_id = $this->resource->dav_id; Privileges:DAVResource.php: if ( substr($this->resource->caldav_data,0,15) == 'BEGIN:VCALENDAR' ) { Privileges:DAVResource.php: $this->contenttype = 'text/calendar'; Privileges:DAVResource.php: $this->resourcetypes = ''; Privileges:DAVResource.php: $this->exists = false; Privileges:DAVResource.php: if ( isset($this->dead_properties) ) return; Privileges:DAVResource.php: $this->dead_properties = array(); Privileges:DAVResource.php: $qry = new AwlQuery('SELECT property_name, property_value FROM property WHERE dav_name= :dav_name', array(':dav_name' => $this->dav_name) ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource') ) { Privileges:DAVResource.php: while ( $property = $qry->Fetch() ) { Privileges:DAVResource.php: $this->dead_properties[$property->property_name] = $property->property_value; Privileges:DAVResource.php: if ( $this->dav_name == '/' ) return null; Privileges:DAVResource.php: if ( !isset($this->parent) ) { Privileges:DAVResource.php: if ( $this->_is_collection ) { Privileges:DAVResource.php: dbg_error_log( 'DAVResource', 'Retrieving "%s" - parent of "%s" (dav_name: %s)', $this->parent_path(), $this->collection->dav_name, $this->dav_name() ); Privileges:DAVResource.php: $this->parent = new DAVResource( $this->parent_path() ); Privileges:DAVResource.php: dbg_error_log( 'DAVResource', 'Retrieving "%s" - parent of "%s" (dav_name: %s)', $this->parent_path(), $this->collection->dav_name, $this->dav_name() ); Privileges:DAVResource.php: $this->parent = new DAVResource($this->collection->dav_name); Privileges:DAVResource.php: return $this->parent; Privileges:DAVResource.php: if ( $this->dav_name == '/' || $this->dav_name == '' ) { Privileges:DAVResource.php: $this->privileges = (1 | 16 | 32); // read + read-acl + read-current-user-privilege-set Privileges:DAVResource.php: if ( $session->AllowedTo('Admin') ) { Privileges:DAVResource.php: $this->privileges = privilege_to_bits('all'); Privileges:DAVResource.php: if ( $this->IsPrincipal() ) { Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: $this->privileges = $this->principal->Privileges(); Privileges:DAVResource.php: dbg_error_log( 'DAVResource', 'Privileges of "%s" for user accessing "%s"', $this->privileges, $this->principal->username() ); Privileges:DAVResource.php: if ( ! isset($this->collection) ) $this->FetchCollection(); Privileges:DAVResource.php: $this->privileges = 0; Privileges:DAVResource.php: if ( !isset($this->collection->path_privs) ) { Privileges:DAVResource.php: if ( !isset($this->parent) ) $this->FetchParentContainer(); Privileges:DAVResource.php: $this->collection->path_privs = $this->parent->Privileges(); Privileges:DAVResource.php: $this->collection->user_no = $this->parent->GetProperty('user_no'); Privileges:DAVResource.php: $this->collection->principal_id = $this->parent->GetProperty('principal_id'); Privileges:DAVResource.php: $this->privileges = $this->collection->path_privs; Privileges:DAVResource.php: if ( is_string($this->privileges) ) $this->privileges = bindec( $this->privileges ); Privileges:DAVResource.php: decbin($this->privileges), $session->username, $this->dav_name() ); Privileges:DAVResource.php: if ( isset($request->ticket) && $request->ticket->MatchesPath($this->bound_from()) ) { Privileges:DAVResource.php: $this->privileges |= $request->ticket->privileges(); Privileges:DAVResource.php: dbg_error_log( 'DAVResource', 'Applying permissions for ticket "%s" now: %s', $request->ticket->id(), decbin($this->privileges) ); Privileges:DAVResource.php: if ( isset($this->tickets) ) { Privileges:DAVResource.php: if ( !isset($this->resource_id) ) $this->FetchResource(); Privileges:DAVResource.php: foreach( $this->tickets AS $k => $ticket ) { Privileges:DAVResource.php: if ( $ticket->MatchesResource($this->resource_id()) || $ticket->MatchesPath($this->bound_from()) ) { Privileges:DAVResource.php: $this->privileges |= $ticket->privileges(); Privileges:DAVResource.php: dbg_error_log( 'DAVResource', 'Applying permissions for ticket "%s" now: %s', $ticket->id(), decbin($this->privileges) ); Privileges:DAVResource.php: if ( !isset($this->privileges) ) $this->FetchPrivileges(); Privileges:DAVResource.php: return $this->privileges; Privileges:DAVResource.php: if ( !isset($this->privileges) ) $this->FetchPrivileges(); Privileges:DAVResource.php: $do_what, decbin($test_bits), decbin($this->privileges), ($this->privileges & $test_bits), decbin($this->privileges & $test_bits) ); Privileges:DAVResource.php: return ($this->privileges & $test_bits) > 0; Privileges:DAVResource.php: return ($this->privileges & $test_bits) == $test_bits; Privileges:DAVResource.php: if ( $this->HavePrivilegeTo($privilege, $any) ) return; Privileges:DAVResource.php: $request->NeedPrivilege( $privilege, $this->dav_name ); Privileges:DAVResource.php: if ( !isset($this->privileges) ) $this->FetchPrivileges(); Privileges:DAVResource.php: $privilege_names = bits_to_privilege($this->privileges, ($this->_is_collection ? $this->collection->type : null ) ); Privileges:DAVResource.php: if ( isset($this->supported_methods) ) return $this->supported_methods; Privileges:DAVResource.php: $this->supported_methods = array( Privileges:DAVResource.php: if ( $this->IsCollection() ) { Privileges:DAVResource.php:/* if ( $this->IsPrincipal() ) { Privileges:DAVResource.php: $this->supported_methods['MKCALENDAR'] = ''; Privileges:DAVResource.php: $this->supported_methods['MKCOL'] = ''; Privileges:DAVResource.php: switch ( $this->collection->type ) { Privileges:DAVResource.php: $this->supported_methods = array( Privileges:DAVResource.php: case 'schedule-outbox': Privileges:DAVResource.php: $this->supported_methods = array_merge( Privileges:DAVResource.php: $this->supported_methods, Privileges:DAVResource.php: case 'schedule-inbox': Privileges:DAVResource.php: $this->supported_methods['GET'] = ''; Privileges:DAVResource.php: $this->supported_methods['PUT'] = ''; Privileges:DAVResource.php: $this->supported_methods['HEAD'] = ''; Privileges:DAVResource.php: $this->supported_methods['MKTICKET'] = ''; Privileges:DAVResource.php: $this->supported_methods['DELTICKET'] = ''; Privileges:DAVResource.php: $this->supported_methods['MKTICKET'] = ''; Privileges:DAVResource.php: $this->supported_methods['DELTICKET'] = ''; Privileges:DAVResource.php: $this->supported_methods['GET'] = ''; Privileges:DAVResource.php: $this->supported_methods['PUT'] = ''; Privileges:DAVResource.php: $this->supported_methods['HEAD'] = ''; Privileges:DAVResource.php: $this->supported_methods['MKCOL'] = ''; Privileges:DAVResource.php: $this->supported_methods['MKCALENDAR'] = ''; Privileges:DAVResource.php: $this->supported_methods['PROPPATCH'] = ''; Privileges:DAVResource.php: $this->supported_methods = array_merge( Privileges:DAVResource.php: $this->supported_methods, Privileges:DAVResource.php: return $this->supported_methods; Privileges:DAVResource.php: if ( !isset($this->supported_methods) ) $this->FetchSupportedMethods(); Privileges:DAVResource.php: foreach( $this->supported_methods AS $k => $v ) { Privileges:DAVResource.php: $methods[] = new XMLElement( 'supported-method', null, array('name' => $k) ); Privileges:DAVResource.php: if ( isset($this->supported_reports) ) return $this->supported_reports; Privileges:DAVResource.php: /************* comentado por incompatibilidade do sync-collection Privileges:DAVResource.php: $this->supported_reports = array( Privileges:DAVResource.php: 'DAV::principal-property-search' => '', Privileges:DAVResource.php: 'DAV::principal-search-property-set' => '', Privileges:DAVResource.php: 'DAV::expand-property' => '', Privileges:DAVResource.php: 'DAV::sync-collection' => '' Privileges:DAVResource.php: $this->supported_reports = array( Privileges:DAVResource.php: 'DAV::principal-property-search' => '', Privileges:DAVResource.php: 'DAV::principal-search-property-set' => '', Privileges:DAVResource.php: 'DAV::expand-property' => '' Privileges:DAVResource.php: if ( !isset($this->collection) ) $this->FetchCollection(); Privileges:DAVResource.php: if ( $this->collection->is_calendar ) { Privileges:DAVResource.php: $this->supported_reports = array_merge( Privileges:DAVResource.php: $this->supported_reports, Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:caldav:calendar-query' => '', Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:caldav:calendar-multiget' => '', Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:caldav:free-busy-query' => '' Privileges:DAVResource.php: if ( $this->collection->is_addressbook ) { Privileges:DAVResource.php: $this->supported_reports = array_merge( Privileges:DAVResource.php: $this->supported_reports, Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:carddav:addressbook-query' => '', Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:carddav:addressbook-multiget' => '' Privileges:DAVResource.php: return $this->supported_reports; Privileges:DAVResource.php: if ( !isset($this->supported_reports) ) $this->FetchSupportedReports(); Privileges:DAVResource.php: foreach( $this->supported_reports AS $k => $v ) { Privileges:DAVResource.php: $reply->NSElement($report, $k ); Privileges:DAVResource.php: $reports[] = new XMLElement('supported-report', $report ); Privileges:DAVResource.php: if ( isset($this->access_tickets) ) return; Privileges:DAVResource.php: $this->access_tickets = array(); Privileges:DAVResource.php: EXTRACT( \'epoch\' FROM (access_ticket.expires - current_timestamp)) AS seconds, Privileges:DAVResource.php: $params = array(':collection_id' => $this->collection->collection_id, ':scan_depth' => $c->permission_scan_depth); Privileges:DAVResource.php: if ( $this->IsCollection() ) { Privileges:DAVResource.php: if ( !isset($this->exists) ) $this->FetchResource(); Privileges:DAVResource.php: $params[':dav_id'] = $this->resource->dav_id; Privileges:DAVResource.php: if ( isset($this->exists) && !$this->exists ) return; Privileges:DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() ) { Privileges:DAVResource.php: while( $ticket = $qry->Fetch() ) { Privileges:DAVResource.php: $this->access_tickets[] = $ticket; Privileges:DAVResource.php: * If the current user does not have DAV::read-acl privilege on this resource they Privileges:DAVResource.php: if ( !isset($this->access_tickets) ) $this->FetchTickets(); Privileges:DAVResource.php: $show_all = $this->HavePrivilegeTo('DAV::read-acl'); Privileges:DAVResource.php: foreach( $this->access_tickets AS $meh => $trow ) { Privileges:DAVResource.php: if ( !$show_all && ( $trow->dav_owner_id == $session->principal_id || $request->ticket->id() == $trow->ticket_id ) ) continue; Privileges:DAVResource.php: dbg_error_log( 'DAVResource', ':BuildTicketinfo: Adding access_ticket "%s" which is "%s".', $trow->ticket_id, $trow->privileges ); Privileges:DAVResource.php: $ticket = new XMLElement( $reply->Tag( 'ticketinfo', 'http://www.xythos.com/namespaces/StorageServer', 'TKT' ) ); Privileges:DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:id', $trow->ticket_id ); Privileges:DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:owner', $reply->href( ConstructURL($trow->principal_dav_name)) ); Privileges:DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:timeout', (isset($trow->seconds) ? sprintf( 'Seconds-%d', $trow->seconds) : 'infinity') ); Privileges:DAVResource.php: $reply->NSElement($ticket, 'http://www.xythos.com/namespaces/StorageServer:visits', 'infinity' ); Privileges:DAVResource.php: foreach( bits_to_privilege(bindec($trow->privileges) & bindec($trow->grantor_collection_privileges) ) AS $k => $v ) { Privileges:DAVResource.php: $privs[] = $reply->NewXMLElement($v); Privileges:DAVResource.php: $reply->NSElement($ticket, 'DAV::privilege', $privs ); Privileges:DAVResource.php: * that. At present we only maintain permissions on a per-collection basis though. Privileges:DAVResource.php: if ( !isset($this->_locks_found) ) { Privileges:DAVResource.php: $this->_locks_found = array(); Privileges:DAVResource.php: $qry = new AwlQuery($sql, array( ':this_path' => $this->dav_name, ':match_end' => ($depth == DEPTH_INFINITY ? '' : '$') ) ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) ) { Privileges:DAVResource.php: while( $lock_row = $qry->Fetch() ) { Privileges:DAVResource.php: $this->_locks_found[$lock_row->opaquelocktoken] = $lock_row; Privileges:DAVResource.php: $this->DoResponse(500,i18n("Database Error")); Privileges:DAVResource.php: foreach( $this->_locks_found AS $lock_token => $lock_row ) { Privileges:DAVResource.php: if ( $lock_row->depth == DEPTH_INFINITY || $lock_row->dav_name == $this->dav_name ) { Privileges:DAVResource.php: return $this->_is_collection; Privileges:DAVResource.php: return $this->_is_collection && $this->_is_principal; Privileges:DAVResource.php: return $this->_is_collection && $this->_is_calendar; Privileges:DAVResource.php: if ( $this->_is_collection && preg_match( '{schedule-(inbox|outbox)}', $this->collection->type, $matches ) ) { Privileges:DAVResource.php: return $this->_is_collection && $this->_is_addressbook; Privileges:DAVResource.php: return $this->_is_binding; Privileges:DAVResource.php: if ( ! isset($this->exists) ) { Privileges:DAVResource.php: if ( $this->IsPrincipal() ) { Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: $this->exists = $this->principal->Exists(); Privileges:DAVResource.php: else if ( ! $this->IsCollection() ) { Privileges:DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php:// dbg_error_log('DAVResource',' Checking whether "%s" exists. It would appear %s.', $this->dav_name, ($this->exists ? 'so' : 'not') ); Privileges:DAVResource.php: return $this->exists; Privileges:DAVResource.php: if ( $this->collection->dav_name != $this->dav_name ) { Privileges:DAVResource.php: return $this->collection->exists; Privileges:DAVResource.php: $parent = $this->FetchParentContainer(); Privileges:DAVResource.php: return $parent->Exists(); Privileges:DAVResource.php: if ( isset($this->dav_name) ) return $this->dav_name; Privileges:DAVResource.php: if ( isset($this->bound_from) ) return $this->bound_from; Privileges:DAVResource.php: return $this->dav_name(); Privileges:DAVResource.php: if ( !isset($this->bound_from) && isset($this->dav_name) ) { Privileges:DAVResource.php: $this->bound_from = $this->dav_name; Privileges:DAVResource.php: $this->dav_name = $new_dav_name; Privileges:DAVResource.php: return $this->dav_name; Privileges:DAVResource.php: if ( $this->IsCollection() ) { Privileges:DAVResource.php: if ( !isset($this->collection) ) $this->FetchCollection(); Privileges:DAVResource.php: if ( !isset($this->collection->parent_container) ) { Privileges:DAVResource.php: $this->collection->parent_container = preg_replace( '{[^/]+/$}', '', $this->bound_from()); Privileges:DAVResource.php: return $this->collection->parent_container; Privileges:DAVResource.php: return preg_replace( '{[^/]+$}', '', $this->bound_from()); Privileges:DAVResource.php: * Returns the principal-URL for this resource Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: if ( $this->principal->Exists() ) { Privileges:DAVResource.php: return $this->principal->principal_url; Privileges:DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: return $this->resource; Privileges:DAVResource.php: if ( isset($this->unique_tag) ) return $this->unique_tag; Privileges:DAVResource.php: if ( $this->IsPrincipal() && !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: else if ( !$this->_is_collection && !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: if ( $this->exists !== true || !isset($this->unique_tag) ) $this->unique_tag = ''; Privileges:DAVResource.php: return $this->unique_tag; Privileges:DAVResource.php: * Returns the definitive resource_id for this resource - usually a dav_id Privileges:DAVResource.php: if ( isset($this->resource_id) ) return $this->resource_id; Privileges:DAVResource.php: if ( $this->IsPrincipal() && !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: else if ( !$this->_is_collection && !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: if ( $this->exists !== true || !isset($this->resource_id) ) $this->resource_id = null; Privileges:DAVResource.php: return $this->resource_id; Privileges:DAVResource.php: return ( isset($this->collection->publicly_readable) && $this->collection->publicly_readable == 't' ); Privileges:DAVResource.php: if ( $this->IsPrincipal() ) return 'root'; Privileges:DAVResource.php: if ( !$this->IsCollection() ) return $this->collection->type; Privileges:DAVResource.php: if ( ! isset($this->collection->parent_container) ) return null; Privileges:DAVResource.php: if ( isset($this->parent_container_type) ) return $this->parent_container_type; Privileges:DAVResource.php: if ( preg_match('#/[^/]+/#', $this->collection->parent_container) ) { Privileges:DAVResource.php: $this->parent_container_type = 'principal'; Privileges:DAVResource.php: array( ':parent_name' => $this->collection->parent_container ) ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() > 0 && $parent = $qry->Fetch() ) { Privileges:DAVResource.php: if ( $parent->is_calendar == 't' ) Privileges:DAVResource.php: $this->parent_container_type = 'calendar'; Privileges:DAVResource.php: else if ( $parent->is_addressbook == 't' ) Privileges:DAVResource.php: $this->parent_container_type = 'addressbook'; Privileges:DAVResource.php: else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) Privileges:DAVResource.php: $this->parent_container_type = 'schedule-'. $matches[3]. 'box'; Privileges:DAVResource.php: $this->parent_container_type = 'collection'; Privileges:DAVResource.php: $this->parent_container_type = null; Privileges:DAVResource.php: return $this->parent_container_type; Privileges:DAVResource.php: * BuildACE - construct an XMLElement subtree for a DAV::ace Privileges:DAVResource.php: $privilege_names = bits_to_privilege($privs, ($this->_is_collection ? $this->collection->type : 'resource')); Privileges:DAVResource.php: $xmldoc->NSElement($privilege,$k); Privileges:DAVResource.php: $privilege->NewElement($k); Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: $default_privs = $this->principal->default_privileges; Privileges:DAVResource.php: if ( isset($this->collection->default_privileges) ) $default_privs = $this->collection->default_privileges; Privileges:DAVResource.php: $acl[] = $this->BuildACE($xmldoc, pow(2,25) - 1, new XMLElement('property', new XMLElement('owner')) ); Privileges:DAVResource.php: array( ':collection_id' => $this->collection->collection_id, ':principal_id' => $this->principal->principal_id ) ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource') && $qry->rows() > 0 ) { Privileges:DAVResource.php: while( $grant = $qry->Fetch() ) { Privileges:DAVResource.php: if ( !isset($by_collection) ) $by_collection = isset($grant->by_collection); Privileges:DAVResource.php: if ( $by_collection && !isset($grant->by_collection) ) break; Privileges:DAVResource.php: $acl[] = $this->BuildACE($xmldoc, $grant->privileges, $xmldoc->href(ConstructURL($grant->dav_name)) ); Privileges:DAVResource.php: $acl[] = $this->BuildACE($xmldoc, $default_privs, new XMLElement('authenticated') ); Privileges:DAVResource.php: * Return general server-related properties, in plain form Privileges:DAVResource.php: return $this->collection->collection_id; Privileges:DAVResource.php: if ( isset($this->resourcetypes) ) { Privileges:DAVResource.php: $this->resourcetypes = preg_replace('{^\s*<(.*)/>\s*$}', '$1', $this->resourcetypes); Privileges:DAVResource.php: $type_list = preg_split('{(/>\s*<|\n)}', $this->resourcetypes); Privileges:DAVResource.php: if ( isset($this->{$name}) ) return $this->{$name}; Privileges:DAVResource.php: if ( $this->_is_principal ) { Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: if ( isset($this->principal->{$name}) ) return $this->principal->{$name}; Privileges:DAVResource.php: if ( isset($this->collection->{$name}) ) return $this->collection->{$name}; Privileges:DAVResource.php: else if ( $this->_is_collection ) { Privileges:DAVResource.php: if ( isset($this->collection->{$name}) ) return $this->collection->{$name}; Privileges:DAVResource.php: if ( isset($this->principal->{$name}) ) return $this->principal->{$name}; Privileges:DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: if ( isset($this->resource->{$name}) ) return $this->resource->{$name}; Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: if ( isset($this->principal->{$name}) ) return $this->principal->{$name}; Privileges:DAVResource.php: if ( isset($this->collection->{$name}) ) return $this->collection->{$name}; Privileges:DAVResource.php:// dbg_error_log( 'DAVResource', ':GetProperty: Failed to find property "%s" on "%s".', $name, $this->dav_name ); Privileges:DAVResource.php: if ( isset($this->dead_properties) ) $this->FetchDeadProperties(); Privileges:DAVResource.php: $allprop = array_merge( (isset($this->dead_properties)?$this->dead_properties:array()), Privileges:DAVResource.php: 'DAV::owner', 'DAV::principal-URL', 'DAV::current-user-principal', Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:carddav:max-resource-size', 'urn:ietf:params:xml:ns:carddav:supported-address-data', Privileges:DAVResource.php: 'urn:ietf:params:xml:ns:carddav:addressbook-description', 'urn:ietf:params:xml:ns:carddav:addressbook-home-set' Privileges:DAVResource.php: * Return general server-related properties for this URL Privileges:DAVResource.php:// dbg_error_log( 'DAVResource', 'Processing "%s" on "%s".', $tag, $this->dav_name ); Privileges:DAVResource.php: $property_list = $this->DAV_AllProperties(); Privileges:DAVResource.php: $this->ResourceProperty($v, $prop, $reply, $discarded); Privileges:DAVResource.php: $prop->NewElement('href', ConstructURL($this->dav_name) ); Privileges:DAVResource.php: case 'DAV::resource-id': Privileges:DAVResource.php: if ( $this->resource_id > 0 ) Privileges:DAVResource.php: $reply->DAVElement( $prop, 'resource-id', $reply->href(ConstructURL('/.resources/'.$this->resource_id) ) ); Privileges:DAVResource.php: case 'DAV::parent-set': Privileges:DAVResource.php: $qry = new AwlQuery($sql, array( ':bound_from' => $this->bound_from() ) ); Privileges:DAVResource.php: if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:DAVResource.php: while( $row = $qry->Fetch() ) { Privileges:DAVResource.php: $parents[$row->parent_container] = true; Privileges:DAVResource.php: $parents[preg_replace( '{(?<=/)[^/]+/?$}','',$this->bound_from())] = true; Privileges:DAVResource.php: $parents[preg_replace( '{(?<=/)[^/]+/?$}','',$this->dav_name())] = true; Privileges:DAVResource.php: $parent_set = $reply->DAVElement( $prop, 'parent-set' ); Privileges:DAVResource.php: $reply->DAVElement($parent_set, 'parent', array( Privileges:DAVResource.php: $reply->DAVElement($parent_set, 'parent', array( Privileges:DAVResource.php: if ( !isset($this->contenttype) && !$this->_is_collection && !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: $prop->NewElement('getcontenttype', $this->contenttype ); Privileges:DAVResource.php: $resourcetypes = $prop->NewElement('resourcetype' ); Privileges:DAVResource.php: $type_list = $this->GetProperty('resourcetype'); Privileges:DAVResource.php: $reply->NSElement( $resourcetypes, $v ); Privileges:DAVResource.php: if ( $this->_is_binding ) { Privileges:DAVResource.php: $reply->NSElement( $resourcetypes, 'http://xmlns.davical.org/davical:webdav-binding' ); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, ISODateToHTTPDate($this->GetProperty('modified')) ); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, DateToISODate($this->GetProperty('created')) ); Privileges:DAVResource.php: if ( $this->_is_collection ) return false; Privileges:DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: if ( isset($this->resource) ) { Privileges:DAVResource.php: $reply->NSElement($prop, $tag, strlen($this->resource->caldav_data) ); Privileges:DAVResource.php: $locale = (isset($c->current_locale) ? $c->current_locale : ''); Privileges:DAVResource.php: if ( isset($this->locale) && $this->locale != '' ) $locale = $this->locale; Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $locale ); Privileges:DAVResource.php: case 'DAV::acl-restrictions': Privileges:DAVResource.php: $reply->NSElement($prop, $tag, array( new XMLElement('grant-only'), new XMLElement('no-invert') ) ); Privileges:DAVResource.php: case 'DAV::inherited-acl-set': Privileges:DAVResource.php: if ( ! $this->_is_collection ) { Privileges:DAVResource.php: $inherited_acls[] = $reply->href(ConstructURL($this->collection->dav_name)); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $inherited_acls ); Privileges:DAVResource.php: // After a careful reading of RFC3744 we see that this must be the principal-URL of the owner Privileges:DAVResource.php: $owner_url = ( isset($this->_is_binding) && $this->_is_binding ? $this->collection->bind_owner_url : $this->principal_url() ); Privileges:DAVResource.php: $reply->DAVElement( $prop, 'owner', $reply->href( $owner_url ) ); Privileges:DAVResource.php: case 'DAV::alternate-URI-set': Privileges:DAVResource.php: $reply->NSElement($prop, $tag ); Privileges:DAVResource.php: if ( $this->_is_collection ) return false; Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $this->unique_tag() ); Privileges:DAVResource.php: if ( ! $this->_is_collection ) return false; Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $this->unique_tag() ); Privileges:DAVResource.php: case 'http://calendarserver.org/ns/:calendar-proxy-read-for': Privileges:DAVResource.php: case 'http://calendarserver.org/ns/:calendar-proxy-write-for': Privileges:DAVResource.php: $reply->CalendarserverElement($prop, 'calendar-proxy-'.$proxy_type.'-for', $reply->href( $this->principal->ProxyFor($proxy_type) ) ); Privileges:DAVResource.php: case 'DAV::current-user-privilege-set': Privileges:DAVResource.php: //if ( $this->HavePrivilegeTo('DAV::read-current-user-privilege-set') ) { Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $this->BuildPrivileges() ); Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-data': Privileges:DAVResource.php: if ( ! $this->IsCalendar() && ! $this->IsSchedulingCollection() ) return false; Privileges:DAVResource.php: $reply->NSElement($prop, $tag, 'text/calendar' ); Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set': Privileges:DAVResource.php: if ( ! $this->_is_collection ) return false; Privileges:DAVResource.php: if ( $this->IsCalendar() ) Privileges:DAVResource.php: else if ( $this->IsSchedulingCollection() ) Privileges:DAVResource.php: $components[] = $reply->NewXMLElement( 'comp', '', array('name' => $v), 'urn:ietf:params:xml:ns:caldav'); Privileges:DAVResource.php: $reply->CalDAVElement($prop, 'supported-calendar-component-set', $components ); Privileges:DAVResource.php: case 'DAV::supported-method-set': Privileges:DAVResource.php: $prop->NewElement('supported-method-set', $this->BuildSupportedMethods() ); Privileges:DAVResource.php: case 'DAV::supported-report-set': Privileges:DAVResource.php: $prop->NewElement('supported-report-set', $this->BuildSupportedReports( $reply ) ); Privileges:DAVResource.php: $prop->NewElement('supportedlock', Privileges:DAVResource.php: case 'DAV::supported-privilege-set': Privileges:DAVResource.php: $prop->NewElement('supported-privilege-set', $request->BuildSupportedPrivileges($reply) ); Privileges:DAVResource.php: case 'DAV::current-user-principal': Privileges:DAVResource.php: $prop->NewElement('current-user-principal', $reply->href( $request->principal->principal_url ) ); Privileges:DAVResource.php: case 'SOME-DENIED-PROPERTY': /** @todo indicating the style for future expansion */ Privileges:DAVResource.php: $denied[] = $reply->Tag($tag); Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:calendar-timezone': Privileges:DAVResource.php: if ( ! $this->_is_collection ) return false; Privileges:DAVResource.php: if ( !isset($this->collection->tz_spec) || $this->collection->tz_spec == '' ) return false; Privileges:DAVResource.php: $cal->VCalendar(); Privileges:DAVResource.php: $cal->AddComponent( new iCalComponent($this->collection->tz_spec) ); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $cal->Render() ); Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:carddav:address-data': Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:caldav:calendar-data': Privileges:DAVResource.php: if ( $this->_is_collection ) return false; Privileges:DAVResource.php: if ( !isset($this->resource) ) $this->FetchResource(); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $this->resource->caldav_data ); Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:carddav:max-resource-size': Privileges:DAVResource.php: if ( ! $this->_is_collection || !$this->_is_addressbook ) return false; Privileges:DAVResource.php: $reply->NSElement($prop, $tag, 65500 ); Privileges:DAVResource.php: case 'urn:ietf:params:xml:ns:carddav:supported-address-data': Privileges:DAVResource.php: if ( ! $this->_is_collection || !$this->_is_addressbook ) return false; Privileges:DAVResource.php: $address_data = $reply->NewXMLElement( 'address-data', false, Privileges:DAVResource.php: array( 'content-type' => 'text/vcard', 'version' => '3.0'), 'urn:ietf:params:xml:ns:carddav'); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $address_data ); Privileges:DAVResource.php: if ( $this->HavePrivilegeTo('DAV::read-acl') ) { Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $this->GetACL( $reply ) ); Privileges:DAVResource.php: $reply->NSElement($prop,'http://www.xythos.com/namespaces/StorageServer:ticketdiscovery', $this->BuildTicketinfo($reply) ); Privileges:DAVResource.php: $property_value = $this->GetProperty(preg_replace('{^.*:}', '', $tag)); Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $property_value ); Privileges:DAVResource.php: if ( !isset($this->dead_properties) ) $this->FetchDeadProperties(); Privileges:DAVResource.php: if ( isset($this->dead_properties[$tag]) ) { Privileges:DAVResource.php: $reply->NSElement($prop, $tag, $this->dead_properties[$tag] ); Privileges:DAVResource.php:// dbg_error_log( 'DAVResource', 'Request for unsupported property "%s" of path "%s".', $tag, $this->dav_name ); Privileges:DAVResource.php: dbg_error_log('DAVResource',':GetPropStat: propstat for href "%s"', $this->dav_name ); Privileges:DAVResource.php: $tag = $tag->GetTag(); Privileges:DAVResource.php: $found = $this->ResourceProperty($tag, $prop, $reply, $denied ); Privileges:DAVResource.php: if ( !isset($this->principal) ) $this->FetchPrincipal(); Privileges:DAVResource.php: $found = $this->principal->PrincipalProperty( $tag, $prop, $reply, $denied ); Privileges:DAVResource.php:// dbg_error_log( 'DAVResource', 'Request for unsupported property "%s" of resource "%s".', $tag, $this->dav_name ); Privileges:DAVResource.php: $not_found[] = $reply->Tag($tag); Privileges:DAVResource.php: $reply->NSElement($noprop, $v); Privileges:DAVResource.php: $noprop->NewElement($v); Privileges:DAVResource.php: dbg_error_log('DAVResource',':RenderAsXML: Resource "%s" exists(%d)', $this->dav_name, $this->Exists() ); Privileges:DAVResource.php: if ( !$this->Exists() ) return null; Privileges:DAVResource.php: $elements = $this->GetPropStat( $properties, $reply ); Privileges:DAVResource.php: $dav_name = str_replace( $this->parent_path(), $bound_parent_path, $this->dav_name ); Privileges:DAVResource.php: $dav_name = $this->dav_name; Privileges:DAVResource.php: array_unshift( $elements, $reply->href(ConstructURL($dav_name))); Privileges:DAVTicket.php: $this->dav_name = null; Privileges:DAVTicket.php: $this->target_collection_id = null; Privileges:DAVTicket.php: $this->target_resource_id = null; Privileges:DAVTicket.php: $this->expiry = null; Privileges:DAVTicket.php: $this->expired = true; Privileges:DAVTicket.php: $this->dav_owner_id = null; Privileges:DAVTicket.php: $this->ticket_id = $ticket_id; Privileges:DAVTicket.php: $this->privileges = 0; Privileges:DAVTicket.php: $this->grantor_collection_privileges = 0; Privileges:DAVTicket.php: array(':ticket_id' => $ticket_id, ':scan_depth' => $c->permission_scan_depth) Privileges:DAVTicket.php: if ( $qry->Exec('DAVTicket',__LINE__,__FILE__) && $qry->rows() == 1 && $t = $qry->Fetch() ) { Privileges:DAVTicket.php: if ( ! $t->expired ) { Privileges:DAVTicket.php: $this->{$k} = $v; Privileges:DAVTicket.php: $this->expired = false; Privileges:DAVTicket.php: $this->privileges = bindec($this->privileges); Privileges:DAVTicket.php: $this->grantor_collection_privileges = bindec($this->grantor_collection_privileges); Privileges:DAVTicket.php: dbg_error_log( 'DAVTicket', 'Found a current ticket for "%s"', implode(', ',bits_to_privilege($this->privileges())) ); Privileges:DAVTicket.php: dbg_error_log( 'DAVTicket', 'Found an expired ticket: %s - %s', $ticket_id, $t->expires ); Privileges:DAVTicket.php: if ( isset($this->target_resource_id) ) { Privileges:DAVTicket.php: $qry = new AwlQuery( 'SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id', array(':dav_id' => $this->target_resource_id ) ); Privileges:DAVTicket.php: if ( $qry->Exec('DAVTicket',__LINE__,__FILE__) && $qry->rows() == 1 && $r = $qry->Fetch() ) { Privileges:DAVTicket.php: $this->dav_name = $r->dav_name; Privileges:DAVTicket.php: return $this->dav_name; Privileges:DAVTicket.php: return $this->ticket_id; Privileges:DAVTicket.php: return ($this->privileges & $this->grantor_collection_privileges); Privileges:DAVTicket.php: $length = strlen($this->dav_name); Privileges:DAVTicket.php: return (substr($test_path, 0, $length) == $this->dav_name); Privileges:DAVTicket.php: return ($test_resource_id == $this->target_collection_id || $test_resource_id == $this->target_resource_id); Privileges:drivers_ldap.php:require_once("auth-functions.php"); Privileges:drivers_ldap.php: /**#@-*/ Privileges:drivers_ldap.php: $this->__construct($config); Privileges:drivers_ldap.php: $c->messages[] = i18n("drivers_ldap : function ldap_connect not defined, check your php_ldap module"); Privileges:drivers_ldap.php: $this->valid=false; Privileges:drivers_ldap.php: ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, $config['protocolVersion']); Privileges:drivers_ldap.php: ldap_set_option($this->connect, LDAP_OPT_REFERRALS, $config['optReferrals']); Privileges:drivers_ldap.php: $this->connect=ldap_connect($host, $port); Privileges:drivers_ldap.php: $this->connect=ldap_connect($host); Privileges:drivers_ldap.php: if (! $this->connect){ Privileges:drivers_ldap.php: $c->messages[] = sprintf(translate( 'drivers_ldap : Unable to connect to LDAP with port %s on host %s'), $port, $host ); Privileges:drivers_ldap.php: $this->valid=false; Privileges:drivers_ldap.php: if (!ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, 3)) { Privileges:drivers_ldap.php: $c->messages[] = i18n('drivers_ldap : Failed to set LDAP to use protocol version 3, TLS not supported'); Privileges:drivers_ldap.php: $this->valid=false; Privileges:drivers_ldap.php: if (!ldap_start_tls($this->connect)) { Privileges:drivers_ldap.php: $c->messages[] = i18n('drivers_ldap : Could not start TLS: ldap_start_tls() failed'); Privileges:drivers_ldap.php: $this->valid=false; Privileges:drivers_ldap.php: $this->ldap_query_one = 'ldap_read'; Privileges:drivers_ldap.php: $this->ldap_query_all = 'ldap_read'; Privileges:drivers_ldap.php: $this->ldap_query_one = 'ldap_list'; Privileges:drivers_ldap.php: $this->ldap_query_all = 'ldap_search'; Privileges:drivers_ldap.php: $this->ldap_query_one = 'ldap_search'; Privileges:drivers_ldap.php: $this->ldap_query_all = 'ldap_search'; Privileges:drivers_ldap.php: if (!ldap_bind($this->connect, (isset($config['bindDN']) ? $config['bindDN'] : null), (isset($config['passDN']) ? $config['passDN'] : null) ) ){ Privileges:drivers_ldap.php: $c->messages[] = i18n( 'drivers_ldap : Unable to bind to LDAP - check your configuration for bindDN and passDN, and that your LDAP server is reachable'); Privileges:drivers_ldap.php: $this->valid=false; Privileges:drivers_ldap.php: $this->valid = true; Privileges:drivers_ldap.php: $this->baseDNUsers = is_string($config['baseDNUsers']) ? array($config['baseDNUsers']) : $config['baseDNUsers']; Privileges:drivers_ldap.php: $this->filterUsers = (isset($config['filterUsers']) ? $config['filterUsers'] : null); Privileges:drivers_ldap.php: $this->baseDNGroups = is_string($config['baseDNGroups']) ? array($config['baseDNGroups']) : $config['baseDNGroups']; Privileges:drivers_ldap.php: $this->filterGroups = (isset($config['filterGroups']) ? $config['filterGroups'] : null); Privileges:drivers_ldap.php: $query = $this->ldap_query_all; Privileges:drivers_ldap.php: foreach($this->baseDNUsers as $baseDNUsers) { Privileges:drivers_ldap.php: $entry = $query($this->connect,$baseDNUsers,$this->filterUsers,$attributes); Privileges:drivers_ldap.php: if (!ldap_first_entry($this->connect,$entry)) { Privileges:drivers_ldap.php: $c->messages[] = sprintf(translate('Error NoUserFound with filter >%s<, attributes >%s< , dn >%s<'), Privileges:drivers_ldap.php: $this->filterUsers, Privileges:drivers_ldap.php: for($i = ldap_first_entry($this->connect,$entry); Privileges:drivers_ldap.php: $i && $arr = ldap_get_attributes($this->connect,$i); Privileges:drivers_ldap.php: $i = ldap_next_entry($this->connect,$i) ) { Privileges:drivers_ldap.php: $query = $this->ldap_query_all; Privileges:drivers_ldap.php: foreach($this->baseDNGroups as $baseDNGroups) { Privileges:drivers_ldap.php: $entry = $query($this->connect,$baseDNGroups,$this->filterGroups,$attributes); Privileges:drivers_ldap.php: if (!ldap_first_entry($this->connect,$entry)) { Privileges:drivers_ldap.php: $c->messages[] = sprintf(translate('Error NoGroupFound with filter >%s<, attributes >%s< , dn >%s<'), Privileges:drivers_ldap.php: $this->filterGroups, Privileges:drivers_ldap.php: for($i = ldap_first_entry($this->connect,$entry); Privileges:drivers_ldap.php: $i && $arr = ldap_get_attributes($this->connect,$i); Privileges:drivers_ldap.php: $i = ldap_next_entry($this->connect,$i) ) { Privileges:drivers_ldap.php: $query = $this->ldap_query_one; Privileges:drivers_ldap.php: foreach($this->baseDNUsers as $baseDNUsers) { Privileges:drivers_ldap.php: $entry = $query($this->connect, $baseDNUsers, $filter, $attributes); Privileges:drivers_ldap.php: if (ldap_first_entry($this->connect,$entry) ) Privileges:drivers_ldap.php: if ( !ldap_first_entry($this->connect, $entry) ){ Privileges:drivers_ldap.php: $dnUser = ldap_get_dn($this->connect, ldap_first_entry($this->connect,$entry)); Privileges:drivers_ldap.php: if ( isset($c->authenticate_hook['config']['i_use_mode_kerberos']) && $c->authenticate_hook['config']['i_use_mode_kerberos'] == "i_know_what_i_am_doing") { Privileges:drivers_ldap.php: if ( !@ldap_bind($this->connect, $dnUser, $passwd) ) { Privileges:drivers_ldap.php: $i = ldap_first_entry($this->connect,$entry); Privileges:drivers_ldap.php: $arr = ldap_get_attributes($this->connect,$i); Privileges:drivers_ldap.php: $ldapDrivers =& new ldapDrivers($c->authenticate_hook['config']); Privileges:drivers_ldap.php: if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value']) ) { Privileges:drivers_ldap.php: foreach ( $c->authenticate_hook['config']['default_value'] as $field => $value ) { Privileges:drivers_ldap.php: $usr->{$field} = $value; Privileges:drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from configured defaults", $field, $value ); Privileges:drivers_ldap.php: $usr->{$field} = $ldap_values[$value]; Privileges:drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$value], $value ); Privileges:drivers_ldap.php: if ( !$ldapDriver->valid ) { Privileges:drivers_ldap.php: $mapping = $c->authenticate_hook['config']['mapping_field']; Privileges:drivers_ldap.php: if ( preg_match( '/^\(/', $ldapDriver->filterUsers ) ) { Privileges:drivers_ldap.php: $filter_munge = $ldapDriver->filterUsers; Privileges:drivers_ldap.php: else if ( isset($ldapDriver->filterUsers) && $ldapDriver->filterUsers != '' ) { Privileges:drivers_ldap.php: $filter_munge = "($ldapDriver->filterUsers)"; Privileges:drivers_ldap.php: $valid = $ldapDriver->requestUser( $filter, $attributes, $username, $password ); Privileges:drivers_ldap.php: foreach($c->authenticate_hook['config']['format_updated'] as $k => $v) Privileges:drivers_ldap.php: $valid[$mapping["updated"]] = "$Y-$m-$d $H:$M:$S"; Privileges:drivers_ldap.php: $db_timestamp = $usr->updated; Privileges:drivers_ldap.php: $db_timestamp = substr(strtr($db_timestamp, array(':' => '',' '=>'','-'=>'')),0,14); Privileges:drivers_ldap.php: if($ldapDriver->valid){ Privileges:drivers_ldap.php: $mapping = $c->authenticate_hook['config']['group_mapping_field']; Privileges:drivers_ldap.php: $ldap_groups_tmp = $ldapDriver->getAllGroups($attributes); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); Privileges:drivers_ldap.php: while($db_group = $qry->Fetch()) { Privileges:drivers_ldap.php: $db_groups[$db_group->group_name] = $db_group->group_name; Privileges:drivers_ldap.php: $db_group_members[$db_group->group_name][] = $db_group->member_name; Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- creating groups : %s'),join(', ',$groups_to_create)); Privileges:drivers_ldap.php: if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value']) ) { Privileges:drivers_ldap.php: foreach ( $c->authenticate_hook['config']['default_value'] as $field => $value ) { Privileges:drivers_ldap.php: $usr->{$field} = $value; Privileges:drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from configured defaults", $field, $value ); Privileges:drivers_ldap.php: $user->user_no = 0; Privileges:drivers_ldap.php: $user->{$field} = $ldap_values[$value]; Privileges:drivers_ldap.php: dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$value], $value ); Privileges:drivers_ldap.php: if ($user->fullname=="") { Privileges:drivers_ldap.php: $user->fullname = $group; Privileges:drivers_ldap.php: if ($user->displayname=="") { Privileges:drivers_ldap.php: $user->displayname = $group; Privileges:drivers_ldap.php: $user->username = $group; Privileges:drivers_ldap.php: $user->updated = "now"; /** @todo Use the 'updated' timestamp from LDAP for groups too */ Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- adding users %s to group : %s'),join(',',$ldap_groups_info[$group][$mapping['members']]),$group); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP_groups',__LINE__,__FILE__); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- updating groups : %s'),join(', ',$groups_to_update)); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- adding %s to group : %s'),join(', ', $add_users ), $group); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP_groups',__LINE__,__FILE__); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- removing %s from group : %s'),join(', ', $remove_users ), $group); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP_groups',__LINE__,__FILE__); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- deactivate groups : %s'),join(', ',$groups_to_deactivate)); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); Privileges:drivers_ldap.php: if($ldapDriver->valid){ Privileges:drivers_ldap.php: $mapping = $c->authenticate_hook['config']['mapping_field']; Privileges:drivers_ldap.php: $ldap_users_tmp = $ldapDriver->getAllUsers($attributes); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); Privileges:drivers_ldap.php: while($db_user = $qry->Fetch()) { Privileges:drivers_ldap.php: $db_users[] = $db_user->username; Privileges:drivers_ldap.php: $db_users_info[$db_user->username] = array('user_no' => $db_user->user_no, 'updated' => $db_user->updated); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- creating record for users : %s'),join(', ',$users_to_create)); Privileges:drivers_ldap.php: foreach($c->authenticate_hook['config']['format_updated'] as $k => $v) Privileges:drivers_ldap.php: $valid[$mapping["updated"]] = "$Y-$m-$d $H:$M:$S"; Privileges:drivers_ldap.php: if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) continue; Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- deactivating users : %s'),join(', ',$users_to_deactivate)); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); Privileges:drivers_ldap.php: foreach($c->authenticate_hook['config']['format_updated'] as $k => $v) Privileges:drivers_ldap.php: $valid[$mapping["updated"]] = "$Y-$m-$d $H:$M:$S"; Privileges:drivers_ldap.php: $db_timestamp = substr(strtr($db_users_info[$username]['updated'], array(':' => '',' '=>'','-'=>'')),0,14); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- updating user records : %s'),join(', ',$users_to_update)); Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('- nothing done on : %s'),join(', ', $users_nothing_done)); Privileges:drivers_ldap.php: $qry->Exec('sync_LDAP',__LINE__,__FILE__); Privileges:drivers_ldap.php: while($db_user = $qry->Fetch()) { Privileges:drivers_ldap.php: $admins = $db_user->admins; Privileges:drivers_ldap.php: $c->messages[] = sprintf(i18n('Warning: there are no active admin users, you should fix this before logging out.')); Privileges:drivers_pwauth_pam.php:require_once("auth-functions.php"); Privileges:drivers_pwauth_pam.php: /**#@-*/ Privileges:drivers_pwauth_pam.php: $this->__construct($config); Privileges:drivers_pwauth_pam.php: $c->messages[] = Privileges:drivers_pwauth_pam.php: $this->valid=false; Privileges:drivers_pwauth_pam.php: $program = $c->authenticate_hook['config']['path']; Privileges:drivers_pwauth_pam.php: $email_base = $c->authenticate_hook['config']['email_base']; Privileges:drivers_squid_pam.php:require_once("auth-functions.php"); Privileges:drivers_squid_pam.php: /**#@-*/ Privileges:drivers_squid_pam.php: $this->__construct($config); Privileges:drivers_squid_pam.php: $c->messages[] = sprintf(i18n( 'drivers_squid_pam : Unable to find %s file'), $config ); Privileges:drivers_squid_pam.php: $this->valid=false; Privileges:drivers_squid_pam.php: $cmd = "echo '" . $username . "' '" . $password . "' | " . $c->authenticate_hook['config']['script'] . " -n common-auth"; Privileges:drivers_squid_pam.php: 'email' => $username . "@" . $c->authenticate_hook['config']['email_base'], Privileges:freebusy-functions.php:include_once('RRule-v2.php'); Privileges:freebusy-functions.php: if ( !isset($bin_privs) ) $bin_privs = $request->Privileges(); Privileges:freebusy-functions.php: $request->DoResponse( 400, 'All valid freebusy requests MUST contain a time-range filter' ); Privileges:freebusy-functions.php: $params = array( ':path_match' => $path_match, ':start' => $range_start->UTC(), ':end' => $range_end->UTC() ); Privileges:freebusy-functions.php: if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= ' ORDER BY dav_id'; Privileges:freebusy-functions.php: if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows() > 0 ) { Privileges:freebusy-functions.php: while( $calendar_object = $qry->Fetch() ) { Privileges:freebusy-functions.php: if ( $calendar_object->status == 'TENTATIVE' ) { Privileges:freebusy-functions.php: $extra = ';BUSY-TENTATIVE'; Privileges:freebusy-functions.php: dbg_error_log( "REPORT", " FreeBusy: Not transparent, tentative or cancelled: %s, %s", $calendar_object->start, $calendar_object->finish ); Privileges:freebusy-functions.php: $ics = new vComponent($calendar_object->caldav_data); Privileges:freebusy-functions.php: $expansion = $expanded->GetComponents( array('VEVENT'=>true,'VTODO'=>true,'VJOURNAL'=>true) ); Privileges:freebusy-functions.php:// printf( "Type: %s\n", $v->GetType()); Privileges:freebusy-functions.php:// echo "-----------------------------------------------------\n"; Privileges:freebusy-functions.php: $start_date = $v->GetProperty('DTSTART'); Privileges:freebusy-functions.php: $start_date = new RepeatRuleDateTime($start_date->Value()); Privileges:freebusy-functions.php: $duration = $v->GetProperty('DURATION'); Privileges:freebusy-functions.php: $duration = ( !isset($duration) ? 'P1D' : $duration->Value()); Privileges:freebusy-functions.php: $end_date->modify( $duration ); Privileges:freebusy-functions.php: $thisfb = $start_date->UTC() .'/'. $end_date->UTC() . $extra; Privileges:freebusy-functions.php: $freebusy->SetType('VFREEBUSY'); Privileges:freebusy-functions.php: $freebusy->AddProperty('DTSTAMP', date('Ymd\THis\Z')); Privileges:freebusy-functions.php: $freebusy->AddProperty('DTSTART', $range_start->UTC()); Privileges:freebusy-functions.php: $freebusy->AddProperty('DTEND', $range_end->UTC()); Privileges:freebusy-functions.php: $freebusy->AddProperty( 'FREEBUSY', $text[0], (isset($text[1]) ? array('FBTYPE' => $text[1]) : null) ); Privileges:HTTPAuthSession.php: * User e-mail Privileges:HTTPAuthSession.php: /**#@-*/ Privileges:HTTPAuthSession.php: if ( isset($c->http_auth_mode) && $c->http_auth_mode == "Digest" ) { Privileges:HTTPAuthSession.php: $this->DigestAuthSession(); Privileges:HTTPAuthSession.php: $this->BasicAuthSession(); Privileges:HTTPAuthSession.php: * @param string $auth_header The WWW-Authenticate header details. Privileges:HTTPAuthSession.php: $auth_header = sprintf( 'WWW-Authenticate: Basic realm="%s"', $c->system_name); Privileges:HTTPAuthSession.php: header('Content-type: text/plain; ; charset="utf-8"' ); Privileges:HTTPAuthSession.php: else if ( isset($c->authenticate_hook['server_auth_type']) && $c->authenticate_hook['server_auth_type'] == $_SERVER['AUTH_TYPE'] Privileges:HTTPAuthSession.php: if ( ! isset($c->authenticate_hook['call']) ) { Privileges:HTTPAuthSession.php: $c->authenticate_hook['call'] = 'auth_external'; Privileges:HTTPAuthSession.php: if ( $u = $this->CheckPassword( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) { Privileges:HTTPAuthSession.php: $this->AssignSessionDetails($u); Privileges:HTTPAuthSession.php: if ( isset($c->allow_unauthenticated) && $c->allow_unauthenticated ) { Privileges:HTTPAuthSession.php: $this->user_no = -1; Privileges:HTTPAuthSession.php: $this->username = 'guest'; Privileges:HTTPAuthSession.php: $this->fullname = 'Unauthenticated User'; Privileges:HTTPAuthSession.php: $this->email = 'invalid'; Privileges:HTTPAuthSession.php: $this->AuthFailedResponse(); Privileges:HTTPAuthSession.php: if ( $data = $this->ParseDigestHeader($_SERVER['PHP_AUTH_DIGEST']) ) { Privileges:HTTPAuthSession.php: $A1 = md5($data['username'] . ':' . $c->system_name . ':' . $user_password); Privileges:HTTPAuthSession.php: $this->AssignSessionDetails($u); Privileges:HTTPAuthSession.php: $opaque = md5($c->system_name); Privileges:HTTPAuthSession.php: $this->AuthFailedResponse( sprintf('WWW-Authenticate: Digest realm="%s", qop="auth,auth-int", nonce="%s", opaque="%s"', $c->system_name, $nonce, $opaque ) ); Privileges:HTTPAuthSession.php: * - largely sourced from the PHP documentation Privileges:HTTPAuthSession.php: if ( isset($c->authenticate_hook) && isset($c->authenticate_hook['call']) && function_exists($c->authenticate_hook['call']) ) { Privileges:HTTPAuthSession.php: * - Accept a username / password Privileges:HTTPAuthSession.php: * - Confirm the username / password are correct Privileges:HTTPAuthSession.php: * - Create (or update) a 'usr' record in our database Privileges:HTTPAuthSession.php: * - Return the 'usr' record as an object Privileges:HTTPAuthSession.php: * - Return === false when authentication fails Privileges:HTTPAuthSession.php: * - Configuration data will be in $c->authenticate_hook['config'], which might be an array, or whatever is needed. Privileges:HTTPAuthSession.php: $hook_response = call_user_func( $c->authenticate_hook['call'], $username, $password ); Privileges:HTTPAuthSession.php: if (isset($c->authenticate_hook['optional']) && $c->authenticate_hook['optional']) { Privileges:HTTPAuthSession.php: dbg_error_log( "BasicAuth", ":CheckPassword: Name:%s, Pass:%s, File:%s, Active:%s", $username, $password, $usr->password, ($usr->active?'Yes':'No') ); Privileges:HTTPAuthSession.php: if ( $usr->active && session_validate_password( $password, $usr->password ) ) { Privileges:HTTPAuthSession.php: return ( isset($this->logged_in) && $this->logged_in && isset($this->roles[$whatever]) && $this->roles[$whatever] ); Privileges:HTTPAuthSession.php: $this->roles = array(); Privileges:HTTPAuthSession.php: array( ':user_no' => $this->user_no) ); Privileges:HTTPAuthSession.php: if ( $qry->Exec('BasicAuth') && $qry->rows() > 0 ) { Privileges:HTTPAuthSession.php: while( $role = $qry->Fetch() ) { Privileges:HTTPAuthSession.php: $this->roles[$role->role_name] = true; Privileges:HTTPAuthSession.php: if ( !isset($u->principal_id) ) { Privileges:HTTPAuthSession.php: // If they don't have a principal_id set then we should re-read from our local database Privileges:HTTPAuthSession.php: $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $u->username) ); Privileges:HTTPAuthSession.php: if ( $qry->Exec() && $qry->rows() == 1 ) { Privileges:HTTPAuthSession.php: $u = $qry->Fetch(); Privileges:HTTPAuthSession.php: $this->{$k} = $v; Privileges:HTTPAuthSession.php: $this->GetRoles(); Privileges:HTTPAuthSession.php: $this->logged_in = true; Privileges:HTTPAuthSession.php: if ( function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "" ) { Privileges:HTTPAuthSession.php: awl_set_locale($this->locale); Privileges:interactive-page.php:$home_menu->AddOption(translate('Logout'), $c->base_url.'/index.php?logout', translate('Log out of DAViCal') ); Privileges:interactive-page.php:$help_menu->AddOption(translate('DAViCal Homepage'),'http://www.davical.org/',translate('The DAViCal Home Page'), false, 6000, true ); Privileges:interactive-page.php:$help_menu->AddOption(translate('DAViCal Wiki'),'http://wiki.davical.org/'.$wiki_help,translate('Visit the DAViCal Wiki'), false, 7000, true ); Privileges:interactive-page.php:$help_menu->AddOption(translate('Request Feature'),'http://davical.uservoice.com/',translate('Go to the DAViCal Feature Requests'), false, 8000, true ); Privileges:interactive-page.php:$help_menu->AddOption(translate('Report Bug'),'http://sourceforge.net/tracker/?func=add&group_id=179845&atid=890785',translate('Report a bug in the system'), false, 9000, true ); Privileges:interactive-page.php:$user_menu->AddOption(translate('View My Details'),$c->base_url.'/admin.php?action=edit&t=principal&id='.$session->principal_id,translate('View my own principal record')); Privileges:interactive-page.php:$user_menu->AddOption(translate('List Users'),$c->base_url.'/admin.php?action=browse&t=principal&type=1'); Privileges:interactive-page.php:$user_menu->AddOption(translate('List Resources'),$c->base_url.'/admin.php?action=browse&t=principal&type=2'); Privileges:interactive-page.php:$user_menu->AddOption(translate('List Groups'),$c->base_url.'/admin.php?action=browse&t=principal&type=3'); Privileges:interactive-page.php:if ( $session->AllowedTo('Admin' )) { Privileges:interactive-page.php: $admin_menu->AddOption(translate('Setup'),$c->base_url.'/setup.php',translate('Setup DAViCal') ); Privileges:interactive-page.php: $admin_menu->AddOption(translate('Upgrade Database'),$c->base_url.'/upgrade.php',translate('Upgrade DAViCal database schema') ); Privileges:interactive-page.php: $admin_menu->AddOption(translate('Import Calendars'),$c->base_url.'/tools.php',translate('Operations on your calendar') ); Privileges:interactive-page.php: $user_menu->AddOption(translate('Inactive Principals'),$c->base_url.'/admin.php?action=browse&t=principal&active=f'); Privileges:interactive-page.php: $user_menu->AddOption(translate('Create Principal'),$c->base_url.'/admin.php?action=edit&t=principal',translate('Create a new principal (i.e. a new user, resource or group)')); Privileges:interactive-page.php:$main_menu->AddSubMenu($home_menu, translate('Home'), $c->base_url.'/index.php', translate('Home Page'), false, 1000); Privileges:interactive-page.php:$main_menu->AddSubMenu($user_menu, translate('User Functions'), $c->base_url.'/admin.php?action=browse&t=principal&type=1', translate('Browse all users'), false, 2000); Privileges:interactive-page.php:$main_menu->AddSubMenu($admin_menu, translate('Administration'), $c->base_url.'/index.php', translate('Administration'), false, 3000); Privileges:interactive-page.php:$main_menu->AddSubMenu($help_menu, translate('Help'), $c->base_url.'/help.php',translate('Help on the current screen'), false, 9000); Privileges:iSchedule.php:* - verifying Domain Key signatures Privileges:iSchedule.php:* - delivering remote scheduling requests to local users inboxes Privileges:iSchedule.php:* - Utility functions which we can use to decide whether this Privileges:iSchedule.php: $this->selector = 'cal'; Privileges:iSchedule.php: if ( is_object ( $c ) && isset ( $c->scheduling_dkim_selector ) ) Privileges:iSchedule.php: $this->scheduling_dkim_selector = $c->scheduling_dkim_selector ; Privileges:iSchedule.php: $dkim = dns_get_record ( $this->remote_selector . '._domainkey.' . $this->remote_server , DNS_TXT ); Privileges:iSchedule.php: $this->dk = $dkim [ 0 ] [ 'txt' ]; Privileges:iSchedule.php: $this->failed = true; Privileges:iSchedule.php: if ( $this->failed == true ) Privileges:iSchedule.php: $clean = preg_replace ( '/[\s\t]*([;=])[\s\t]*/', '$1', $this->dk ); Privileges:iSchedule.php: $this->parsed = array(); Privileges:iSchedule.php: $this->parsed [ $key ] = $value; Privileges:iSchedule.php: $this->parsed_ignored [ $key ] = $value; Privileges:iSchedule.php: $this->failed = true; Privileges:iSchedule.php: if ( isset ( $this->parsed [ 's' ] ) ) Privileges:iSchedule.php: if ( ! preg_match ( '/(\*|calendar)/', $this->parsed [ 's' ] ) ) Privileges:iSchedule.php: if ( isset ( $this->parsed [ 'k' ] ) && $this->parsed [ 'k' ] != 'rsa' ) Privileges:iSchedule.php: if ( isset ( $this->parsed [ 't' ] ) && ! preg_match ( '/^[y:s]+$/', $this->parsed [ 't' ] ) ) Privileges:iSchedule.php: if ( preg_match ( '/y/', $this->parsed [ 't' ] ) ) Privileges:iSchedule.php: $this->failOnError = false; Privileges:iSchedule.php: if ( preg_match ( '/s/', $this->parsed [ 't' ] ) ) Privileges:iSchedule.php: $this->subdomainsOK = false; Privileges:iSchedule.php: if ( isset ( $this->parsed [ 'g' ] ) ) Privileges:iSchedule.php: $this->remote_user_rule = $this->parsed [ 'g' ]; Privileges:iSchedule.php: if ( isset ( $this->parsed [ 'p' ] ) ) Privileges:iSchedule.php: $data = "-----BEGIN PUBLIC KEY-----\n" . implode ("\n",str_split ( preg_replace ( '/_/', '', $this->parsed [ 'p' ] ), 64 )) . "\n-----END PUBLIC KEY-----"; Privileges:iSchedule.php: $this->remote_public_key = $data; Privileges:iSchedule.php: $this->failed = false; Privileges:iSchedule.php: $this->remote_ssl = false; Privileges:iSchedule.php: $r = dns_get_record ( '_ischedules._tcp.' . $this->domain , DNS_SRV ); Privileges:iSchedule.php: $this->remote_ssl = true; Privileges:iSchedule.php: $r = dns_get_record ( '_ischedule._tcp.' . $this->domain , DNS_SRV ); Privileges:iSchedule.php: elseif ( $this->try_anyway == true ) Privileges:iSchedule.php: $remote_server = $this->domain; Privileges:iSchedule.php: $this->remote_server = $remote_server; Privileges:iSchedule.php: $this->remote_port = $remote_port; Privileges:iSchedule.php: $remote_capabilities = file_get_contents ( 'http'. ( $this->remote_ssl ? 's' : '' ) . '://' . Privileges:iSchedule.php: $this->remote_server . ':' . $this->remote_port . Privileges:iSchedule.php: '/.well-known/ischedule?query=capabilities' ); Privileges:iSchedule.php: $xmltree = BuildXMLTree( $request->xml_tags, $position); Privileges:iSchedule.php: $request->DoResponse( 406, translate("REPORT body is not valid XML data!") ); Privileges:iSchedule.php: $dk['s'] = $this->selector; Privileges:iSchedule.php: $dk['d'] = $this->domain; Privileges:iSchedule.php: $dk['c'] = 'simple-http'; Privileges:iSchedule.php: //a=rsa-sha1; d=caveman.name; s=cal; c=simple-http; q=dns/txt; h=Originator:Recipient:Host:Content-Type; b Privileges:iSchedule.php: * @param string $sig the value of the DKIM-Signature header Privileges:iSchedule.php: $this->failed = true; Privileges:iSchedule.php: // the canonicalization method is currently undefined as of draft-01 of the iSchedule spec Privileges:iSchedule.php: // but it does define the value, it should be simple-http. RFC4871 also defines two methods Privileges:iSchedule.php: if ( ! preg_match ( '{(simple|simple-http|relaxed)(/(simple|simple-http|relaxed))?}', $dkim['c'], $matches ) ) // canonicalization method Privileges:iSchedule.php: $this->body_cannon = $matches[2]; Privileges:iSchedule.php: $this->body_cannon = $matches[1]; Privileges:iSchedule.php: $this->header_cannon = $matches[1]; Privileges:iSchedule.php: if ( $dkim['a'] != 'rsa-sha1' && $dkim['a'] != 'rsa-sha256' ) Privileges:iSchedule.php: $this->remote_server = $dkim['d']; Privileges:iSchedule.php: $this->remote_user = substr ( $dkim [ 'i' ], 0, strpos ( $dkim [ 'i' ], '@' ) - 1 ); Privileges:iSchedule.php: $this->remote_selector = $dkim['s']; Privileges:iSchedule.php: $this->signed_headers = preg_split ( '/:/', $dkim['h'] ); Privileges:iSchedule.php: foreach ( $this->signed_headers as $h ) Privileges:iSchedule.php: if ( ( ! isset ( $_SERVER['HTTP_' . strtr ( strtoupper ( $h ), '-', '_' ) ] ) && Privileges:iSchedule.php: ! isset ( $_SERVER[ strtr ( strtoupper ( $h ), '-', '_' ) ] ) ) Privileges:iSchedule.php: || strtolower ( $h ) == 'dkim-signature' ) Privileges:iSchedule.php: $this->signed_length = $dkim['l']; Privileges:iSchedule.php: $this->failed = false; Privileges:iSchedule.php: $this->DKSig = $dkim; Privileges:iSchedule.php: $this->remote_user = $matches[1]; Privileges:iSchedule.php: $this->domain = $matches[2]; Privileges:iSchedule.php: $this->failed = true; Privileges:iSchedule.php: foreach ( $this->signed_headers as $h ) Privileges:iSchedule.php: if ( isset ( $_SERVER['HTTP_' . strtoupper ( strtr ( $h, '-', '_' ) ) ] ) ) Privileges:iSchedule.php: $signed .= "$h: " . $_SERVER['HTTP_' . strtoupper ( strtr ( $h, '-', '_' ) ) ] . "\n"; Privileges:iSchedule.php: $signed .= "$h: " . $_SERVER[ strtoupper ( strtr ( $h, '-', '_' ) ) ] . "\n"; Privileges:iSchedule.php: $body = $request->raw_post; Privileges:iSchedule.php: if ( ! isset ( $this->signed_length ) ) Privileges:iSchedule.php: $this->signed_length = strlen ( $body ); Privileges:iSchedule.php: $body = substr ( $body, 0, $this->signed_length ); Privileges:iSchedule.php: if ( isset ( $this->remote_user_rule ) ) Privileges:iSchedule.php: if ( $this->remote_user_rule != '*' && ! stristr ( $this->remote_user, $this->remote_user_rule ) ) Privileges:iSchedule.php: $body_hash = base64_encode ( hash ( preg_replace ( '/^.*(sha[1256]+).*/','$1', $this->DKSig['a'] ), $body , true ) ); Privileges:iSchedule.php: if ( $this->DKSig['bh'] != $body_hash ) Privileges:iSchedule.php: $signed .= 'DKIM-Signature: ' . $sig; Privileges:iSchedule.php: $verify = openssl_verify ( $signed, base64_decode ( $this->DKSig['b'] ), $this->remote_public_key ); Privileges:iSchedule.php: $this->failed = false; Privileges:iSchedule.php: $request->DoResponse( 403, translate('DKIM signature missing') ); Privileges:iSchedule.php: $err = $this->parseDKIM ( $sig ); Privileges:iSchedule.php: if ( $err !== true || $this->failed ) Privileges:iSchedule.php: $request->DoResponse( 403, translate('DKIM signature invalid ' ) . "\n" . $err . "\n" . $sig ); Privileges:iSchedule.php: if ( ! $this->getTxt () || $this->failed ) Privileges:iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(DNS ERROR)') ); Privileges:iSchedule.php: if ( ! $this->parseTxt () || $this->failed ) Privileges:iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(KEY Parse ERROR)') ); Privileges:iSchedule.php: if ( ! $this->validateKey () || $this->failed ) Privileges:iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(KEY Validation ERROR)') ); Privileges:iSchedule.php: if ( ! $this->verifySignature () || $this->failed ) Privileges:iSchedule.php: $request->DoResponse( 403, translate('DKIM signature validation failed(Signature verification ERROR)') . $this->verifySignature() ); Privileges:iSchedule.php:if ( $d->validateRequest ( ) ) Privileges:iSchedule.php: include ( 'caldav-POST.php' ); Privileges:log_caldav_action.php: if ( !isset($c->action_log_name) ) { Privileges:log_caldav_action.php: $logfile = fopen( $c->action_log_name, "a+" ); Privileges:other_translated_strings.php:i18n("Admin "); Privileges:other_translated_strings.php:i18n("Group "); Privileges:other_translated_strings.php:i18n("Public "); Privileges:other_translated_strings.php:i18n("Resource "); Privileges:other_translated_strings.php:i18n("No. "); Privileges:other_translated_strings.php:i18n("No "); Privileges:other_translated_strings.php:i18n("Id "); Privileges:other_translated_strings.php:i18n("forget me not "); Privileges:page-footer.php: if ( isset($c->scripts) && is_array($c->scripts) ) { Privileges:page-footer.php: foreach ( $c->scripts AS $script ) { Privileges:page-footer.php: if ( isset($c->dbg['statistics']) && $c->dbg['statistics'] ) { Privileges:page-footer.php: $script_time = microtime(true) - $c->script_start_time; Privileges:page-footer.php: $_SERVER['REQUEST_METHOD'], 200, $script_time, $c->total_query_time, $_SERVER['REQUEST_URI']); Privileges:page-header.php:if ( !isset($c->page_title) ) { Privileges:page-header.php: $c->page_title = translate('DAViCal CalDAV Server'); Privileges:page-header.php: if ( $GLOBALS['session']->AllowedTo('Admin') || $GLOBALS['session']->AllowedTo('Support') ) { Privileges:page-header.php: return ' ['.$display_url.'] '; Privileges:page-header.php: header( 'Content-type: text/html; charset="utf-8"' ); Privileges:page-header.php: echo ''; Privileges:page-header.php: Privileges:page-header.php:$c->page_title Privileges:page-header.php: foreach ( $c->stylesheets AS $stylesheet ) { Privileges:page-header.php: if ( isset($c->local_styles) ) { Privileges:page-header.php: foreach ( $c->local_styles AS $stylesheet ) { Privileges:page-header.php: if ( isset($c->print_styles) ) { Privileges:page-header.php: foreach ( $c->print_styles AS $stylesheet ) { Privileges:page-header.php: if ( isset($main_menu) ) echo $main_menu->RenderAsCSS(); Privileges:page-header.php: if ( isset($related_menu) && $related_menu->Size() > 0 ) { Privileges:page-header.php: echo $related_menu->Render( true ); Privileges:page-header.php: if ( isset($c->messages) && is_array($c->messages) && count($c->messages) > 0 ) { Privileges:page-header.php: foreach( $c->messages AS $i => $msg ) { Privileges:PublicSession.php: * User e-mail Privileges:PublicSession.php: /**#@-*/ Privileges:PublicSession.php: $this->user_no = -1; Privileges:PublicSession.php: $this->principal_id = -1; Privileges:PublicSession.php: $this->email = null; Privileges:PublicSession.php: $this->username = 'guest'; Privileges:PublicSession.php: $this->fullname = 'Anonymous'; Privileges:PublicSession.php: $this->groups = ( isset($c->public_groups) ? $c->public_groups : array() ); Privileges:PublicSession.php: $this->roles = array( 'Public' => true ); Privileges:PublicSession.php: $this->logged_in = false; Privileges:PublicSession.php: return ( isset($this->roles[$whatever]) && $this->roles[$whatever] ); Privileges:pubsub.php: $this->status = "online"; Privileges:pubsub.php: $this->setupXmlParser (); Privileges:pubsub.php: if ( ! isset ( $this->jid ) ) Privileges:pubsub.php: return $this->connection = false; Privileges:pubsub.php: if ( ! isset ( $this->idle ) ) Privileges:pubsub.php: $this->idle = true; Privileges:pubsub.php: if ( ! isset ( $this->resource ) ) Privileges:pubsub.php: $this->resource = 'caldav' . getmypid(); Privileges:pubsub.php: if ( ! preg_match ( '/^\//', $this->resource ) ) Privileges:pubsub.php: $this->resource = '/' . $this->resource; Privileges:pubsub.php: $temp = explode ( '@', $this->jid ); Privileges:pubsub.php: $this->username = $temp[0]; Privileges:pubsub.php: if ( ! isset ( $this->server ) ) Privileges:pubsub.php: $this->server = $temp[1]; Privileges:pubsub.php: $r = dns_get_record("_xmpp-client._tcp.". $this->server , DNS_SRV); Privileges:pubsub.php: $this->original_server = $this->server; Privileges:pubsub.php: $this->server = $r[0]['target']; Privileges:pubsub.php: $this->original_port = $this->port; Privileges:pubsub.php: $this->port = $r[0]['port']; Privileges:pubsub.php: if ( ! isset ( $this->port ) ) Privileges:pubsub.php: $this->port = 5222; Privileges:pubsub.php: if ( 'ssl' == $this->tls || ( ! isset ( $this->tls ) && 5223 == $this->port ) ) Privileges:pubsub.php: $url = 'ssl://' . $this->server; Privileges:pubsub.php: elseif ( 'tls' == $this->tls || ( ! isset ( $this->tls ) && 5222 == $this->port ) ) Privileges:pubsub.php: $url = 'tcp://' . $this->server; Privileges:pubsub.php: $url = 'tcp://' . $this->server; Privileges:pubsub.php: if ( isset ( $this->original_server ) ) Privileges:pubsub.php: $this->server = $this->original_server; Privileges:pubsub.php: $this->connection = stream_socket_client ( $url . ':' . $this->port, $errno, $errstring, 10, STREAM_CLIENT_ASYNC_CONNECT ); Privileges:pubsub.php: if ( false === $this->connection ) Privileges:pubsub.php: $this->initializeQueue ( ); Privileges:pubsub.php: socket_set_blocking ( $this->connection, false ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( 'handling features' ); Privileges:pubsub.php: if ( 'STARTTLS' == $node->firstChild->nodeName ) Privileges:pubsub.php: $this->sendQueue[] = ""; Privileges:pubsub.php: $elements = $this->query ( '*/MECHANISM', $node ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( " found " . $elements->length . " matching MECHANISM nodes "); Privileges:pubsub.php: $auth_mech[] = $e->nodeValue; Privileges:pubsub.php: $this->sendQueue[] = "" . base64_encode("\x00" . preg_replace('/@.*$/','',$this->jid) . "\x00" . $this->password) . ""; Privileges:pubsub.php: elseif ( in_array ( 'DIGEST-MD5', $auth_mech ) ) // this code and the associated function are UNTESTED Privileges:pubsub.php: $this->sendQueue[] = ""; Privileges:pubsub.php: $this->recvHandlers['challenge'] = 'digestAuth' ; Privileges:pubsub.php: $this->recvHandlers['success'] = 'handleSuccess' ; Privileges:pubsub.php: $elements = $this->query ( '*/BIND', $node ); Privileges:pubsub.php: if ( ! is_null ( $elements ) && $elements->length > 0 ) Privileges:pubsub.php: if ( $this->debug ) $this->log ( " found " . $elements->length . " matching BIND nodes "); Privileges:pubsub.php: $this->ready = true; Privileges:pubsub.php: stream_set_blocking ( $this->connection, true ); Privileges:pubsub.php: stream_socket_enable_crypto ( $this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT ); Privileges:pubsub.php: stream_set_blocking ( $this->connection, false ); Privileges:pubsub.php: $this->sendQueue[] = "<"."?xml version=\"1.0\"?".">\n\n"; Privileges:pubsub.php: // this code is based solely on the description found @ http://web.archive.org/web/20050224191820/http://cataclysm.cx/wip/digest-md5-crash.html Privileges:pubsub.php: $contents = $node->nodeValue; Privileges:pubsub.php: if ( $challenge['realm'] == $this->server ) // might fail need to handle a response with multiple realms Privileges:pubsub.php: $X = md5 ( preg_replace('/@.*$/','',$this->jid) . ':' . $this->server . ':' . $this->password, true ); Privileges:pubsub.php: $HA1 = md5 ( $X . ':' . $challenge['nonce'] . ':' . $cnonce . ':' . $this->jid . $this->resource ); Privileges:pubsub.php: $HA2 = md5 ( "AUTHENTICATE:xmpp/" . $this->server ); Privileges:pubsub.php: $this->sendQueue[] = "" . Privileges:pubsub.php: base64_encode("username=\"" . preg_replace('/@.*$/','',$this->jid) . "\"," . Privileges:pubsub.php: "realm=\"" . $this->server . "\",nonce=\"" . $challenge['nonce'] . "\",cnonce=\"". $cnonce . "\"," . Privileges:pubsub.php: "nc=00000001,qop=auth,digest-uri=\"xmpp/" . $this->server . "\",response=" . $resp . Privileges:pubsub.php: ",charset=utf-8,authzid=\"". $this->jid . $this->resource . "\"" ) . "" // note the PID component to the resource, just incase Privileges:pubsub.php: $this->sendQueue[] = "" ; Privileges:pubsub.php: $this->loggedIn = true; Privileges:pubsub.php: $this->sendQueue[] = "<"."?xml version=\"1.0\"?".">\n\n"; Privileges:pubsub.php: $this->sendQueue[] = "" . preg_replace('/^\//','',$this->resource) . ""; Privileges:pubsub.php: $this->recvHandlers['stream:error'] = 'handleError' ; Privileges:pubsub.php: $this->recvHandlers['iq'] = 'handleIq' ; Privileges:pubsub.php: $this->recvHandlers['message'] = 'handleMessage' ; Privileges:pubsub.php: $this->mesgcount = 1; Privileges:pubsub.php: if ( $this->debug ) $this->log ( "Handle IQ id:" . $node->getAttribute ( 'id' ) . ' type:' . $node->getAttribute ( 'type' ) . ""); Privileges:pubsub.php: if ( $node->getAttribute ( 'type' ) == 'result' || $node->getAttribute ( 'type' ) == 'error' ) Privileges:pubsub.php: $commandId = $node->getAttribute ( 'id' ); Privileges:pubsub.php: $this->command[$commandId] = true; Privileges:pubsub.php: if ( isset ( $this->handleCommand[$commandId] ) ) Privileges:pubsub.php: $this->finishedCommands[$commandId] = true; Privileges:pubsub.php: if ( method_exists ( $this, $this->handleCommand[$commandId] ) ) Privileges:pubsub.php: call_user_func_array ( array ( $this, $this->handleCommand[$commandId] ), array ( &$node ) ); Privileges:pubsub.php: call_user_func_array ( $this->handleCommand[$commandId], array ( &$node ) ); Privileges:pubsub.php: if ( $node->getAttribute ( 'id' ) == $this->mesgcount && $this->mesgcount < 3 ) Privileges:pubsub.php: $this->sendQueue[] = ""; Privileges:pubsub.php: $this->sendQueue[] = ""; Privileges:pubsub.php: if ( $node->getAttribute ( 'id' ) == '2' && $this->command['2'] == true ) Privileges:pubsub.php: $this->nextreply = $this->mesgcount++; Privileges:pubsub.php: $this->sendQueue[] = "" . $this->status . ''; Privileges:pubsub.php: $this->ready = true; Privileges:pubsub.php: if ( $node->getAttribute ( 'type' ) == 'chat' ) Privileges:pubsub.php: $this->command[$node->getAttribute ( 'id' )] = true; Privileges:pubsub.php: $elements = $this->query ( '//*/body', $node ); Privileges:pubsub.php: if ( 0 < $elements->length ) Privileges:pubsub.php: $temp = $elements->items(0); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "received message " . $temp->nodeValue ); Privileges:pubsub.php: $this->log ( 'STREAM ERROR OCCURRED! XMPP closing connection, this is probably a bug' ); Privileges:pubsub.php: $this->idle = false; Privileges:pubsub.php: $this->close (); Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $send = ""; Privileges:pubsub.php: $this->handleCommand[$msg] = 'discoResult'; Privileges:pubsub.php: $this->sendQueue[] = $send; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: if ( $this->debug ) $this->log ( $node->ownerDocument->saveXML($node) ); Privileges:pubsub.php: $id = $node->getAttribute ( 'id' ); Privileges:pubsub.php: $identity = $this->query ( '*/IDENTITY', $node ); Privileges:pubsub.php: if ( @is_array ( $this->pubsub [ 'create' ] [ $id ] ) && 0 == $identity->length ) Privileges:pubsub.php: $this->pubsubCreateNode( $this->pubsub [ 'create' ] [ $id ] [ 0 ], Privileges:pubsub.php: $this->pubsub [ 'create' ] [ $id ] [ 1 ], Privileges:pubsub.php: $this->pubsub [ 'create' ] [ $id ] [ 2 ], Privileges:pubsub.php: $this->pubsub [ 'create' ] [ $id ] [ 3 ] ); Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $out .= ""; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: $to = 'pubsub.' . $this->server; Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $this->pubsub['create'][$this->mesgcount+1] = array ( $to, $type, $name, $configure ); Privileges:pubsub.php: $this->disco ( $to, 'info', $node ); Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $out = ''; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $out = ''; Privileges:pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $out = ''; Privileges:pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $out = ''; Privileges:pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: $to = 'pubsub.' . $this->server; Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: $out = ''; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: $msg = $this->mesgcount++; Privileges:pubsub.php: if ( 'hometree' == $this->pubsubLayout ) Privileges:pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; Privileges:pubsub.php: $out = ''; Privileges:pubsub.php: $out .= ''; Privileges:pubsub.php: $this->sendQueue[] = $out; Privileges:pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; Privileges:pubsub.php: $this->go(); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "pubsub RESULT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); Privileges:pubsub.php: if ( $node->getAttribute ( 'type' ) == 'error' ) Privileges:pubsub.php: $errnode = $this->query ( 'ERROR', $node ); Privileges:pubsub.php: if ( $errnode->length > 0 && ( '403' == $errnode->item( 0 )->getAttribute ( 'code' ) || '500' == $errnode->item( 0 )->getAttribute ( 'code' ) ) ) Privileges:pubsub.php: if ( 'CREATE' == $node->firstChild->firstChild->tagName ) Privileges:pubsub.php: $pubnode = $node->firstChild->firstChild->getAttribute ( 'node' ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "403 error during CREATE for node '" . $pubnode . "' "); Privileges:pubsub.php: $name = preg_replace ( '/^.*?\/' . $this->username . '\//','', $pubnode ); Privileges:pubsub.php: if ( ! in_array ( 'create', $this->pubsubNext ) ) Privileges:pubsub.php: 'to' => $node->getAttribute ( 'from' ), Privileges:pubsub.php: array_unshift ( $this->pubsubNext, $v ); Privileges:pubsub.php: $this->pubsubDoNext ( ); Privileges:pubsub.php: elseif ( $errnode->length > 0 && '404' == $errnode->item( 0 )->getAttribute ( 'code' ) ) Privileges:pubsub.php: if ( 'PUBLISH' == $node->firstChild->firstChild->tagName ) Privileges:pubsub.php: $pubnode = $node->firstChild->firstChild->getAttribute ( 'node' ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "404 error during PUBLISH for node '" . $pubnode . "' "); Privileges:pubsub.php: $publish = $this->query ( '//*/PUBLISH', $node ); Privileges:pubsub.php: $this->pubsubNext[] = array ( Privileges:pubsub.php: 'to' => $node->getAttribute ( 'from' ), Privileges:pubsub.php: 'name' => preg_replace ( '/^.*?\/' . $this->username . '/','', $pubnode ) , Privileges:pubsub.php: 'contents' => $publish->item( 0 )->firstChild->nodeValue ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "attempting to create node '" . $this->pubsubNext[0]['name'] . "' "); Privileges:pubsub.php: $this->pubsubCreateNode ( $node->getAttribute ( 'from' ) ,'set', preg_replace ( '/^.*?\/' . $this->username . '/','', $pubnode ) ); Privileges:pubsub.php: elseif ( $errnode->length > 0 && '409' == $errnode->item( 0 )->getAttribute ( 'code' ) ) Privileges:pubsub.php: if ( 'CANCEL' == $errnode->item( 0 )->firstChild->tagName || 'CONFLICT' == $errnode->item( 0 )->firstChild->tagName ) Privileges:pubsub.php: $this->pubsubDoNext ( ); Privileges:pubsub.php: elseif ( 0 < count ( $this->pubsubNext ) ) Privileges:pubsub.php: $this->pubsubDoNext ( ); Privileges:pubsub.php: if ( 0 < count ( $this->pubsubNext ) ) Privileges:pubsub.php: $pub = array_shift ( $this->pubsubNext ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "attempting to publish to node '" . $pub['name'] . "' contents '" . $pub['contents'] . "'"); Privileges:pubsub.php: $this->pubsubPublish ( $pub[$to], 'set', $pub['name'], $pub['contents'] ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( "attempting to create node '" . $pub['name'] . "' "); Privileges:pubsub.php: $this->pubsubCreateNode ( $pub[$to], 'set', $pub['name'] ); Privileges:pubsub.php: $this->loggedIn = false; Privileges:pubsub.php: $this->streamTagBegin = '<'."?xml version='1.0'?".">"; Privileges:pubsub.php: $this->streamTagEnd = ''; Privileges:pubsub.php: $this->sendQueue[] = $this->streamTagBegin; Privileges:pubsub.php: $this->recvHandlers['stream:features'] = 'handleFeatures' ; Privileges:pubsub.php: $this->recvHandlers['features'] = 'handleFeatures' ; Privileges:pubsub.php: $this->recvHandlers['proceed'] = 'enableTLS' ; Privileges:pubsub.php: if ( $this->debug ) $this->log ( "SEND: $data"); Privileges:pubsub.php: if ( false !== $this->connection ) Privileges:pubsub.php: if ( fwrite ( $this->connection, $data, $len) === $len ) Privileges:pubsub.php: if ( false !== $this->connection ) Privileges:pubsub.php: $data = fgets ( $this->connection, 4096 ); Privileges:pubsub.php: while ( 0 != strlen ( $moredata = fgets ( $this->connection, 1024 ) ) && 20 < $count++ ) Privileges:pubsub.php: $this->stream .= $data; Privileges:pubsub.php: if ( $this->debug ) $this->log ( "RECV: $data" ); Privileges:pubsub.php: $this->recvQueue = implode ( '', $this->sendQueue ); Privileges:pubsub.php: $this->moredata = false; Privileges:pubsub.php: while ( false !== $this->connection ) Privileges:pubsub.php: if ( 0 < count ( $this->sendQueue ) ) Privileges:pubsub.php: while ( $data = array_shift ( $this->sendQueue ) ) Privileges:pubsub.php: $this->send ( $data ); Privileges:pubsub.php: $data = $this->recv ( ); Privileges:pubsub.php: xml_parse ( $this->xmlparser, $data, false ); Privileges:pubsub.php: while ( $rnode = array_shift ( $this->recvTags ) ) Privileges:pubsub.php: $rname = strtolower ( $rnode->localName ); Privileges:pubsub.php: if ( $this->debug ) $this->log ( " processing $rname "); Privileges:pubsub.php: if ( isset ( $this->recvHandlers[$rname] ) ) //&& is_callable ( $this->recvHandlers[$r->name] ) ) Privileges:pubsub.php: if ( method_exists ( $this, $this->recvHandlers[$rname] ) ) Privileges:pubsub.php: call_user_func_array ( array ( $this, $this->recvHandlers[$rname] ), array ( &$rnode ) ); Privileges:pubsub.php: call_user_func_array ( $this->recvHandlers[$rname], array ( &$rnode ) ); Privileges:pubsub.php: if ( $this->idle === true ) Privileges:pubsub.php: if ( $this->ready == true && count ( $this->handleCommand ) <= count ( $this->command ) ) Privileges:pubsub.php: $this->depth++; Privileges:pubsub.php: $this->processDepth++; Privileges:pubsub.php: if ( strlen ( $matches[1] ) > 0 && ! isset ( $this->namespaces [ $matches[1] ] ) ) Privileges:pubsub.php: $this->xquery->registerNamespace ( $matches[1], $v ); Privileges:pubsub.php: $this->namespaces [ $matches[1] ] = $v; Privileges:pubsub.php: if ( $this->debug ) $this->log ( " adding namespace $k => $v "); Privileges:pubsub.php: $node = $this->doc->createElementNS ( $namespace, $name ); Privileges:pubsub.php: $node = $this->doc->createElement ( $name ); Privileges:pubsub.php: $node->setAttribute ( strtolower ( $k ), $v ); Privileges:pubsub.php: $this->currentXMLNode = $this->currentXMLNode->appendChild ( $node ); Privileges:pubsub.php: $this->depth--; Privileges:pubsub.php: //if ( $this->debug ) $this->log ( "depth: " . $this->depth . " processDepth: " . $this->processDepth . " "); Privileges:pubsub.php: if ( $this->depth == $this->processDepth || 'STREAM:STREAM' == $name || 'STREAM:FEATURES' == $name || 'PROCEED' == $name ) Privileges:pubsub.php: if ( $this->debug ) $this->log ( " adding $name to tags to process "); Privileges:pubsub.php: array_push ( $this->recvTags, $this->currentXMLNode ); // replace with tag Privileges:pubsub.php: $this->currentXMLNode = $this->currentXMLNode->parentNode; Privileges:pubsub.php: $this->currentXMLNode->appendChild ( $this->doc->createTextNode ( $text ) ); Privileges:pubsub.php: $this->depth = 0; Privileges:pubsub.php: $this->xmlparser = xml_parser_create ( ); Privileges:pubsub.php: xml_set_object ( $this->xmlparser, $this ); Privileges:pubsub.php: xml_set_element_handler ( $this->xmlparser, 'startElement', 'endElement' ); Privileges:pubsub.php: xml_set_character_data_handler ( $this->xmlparser, 'parseData' ); Privileges:pubsub.php: $this->doc = new DOMDocument (); Privileges:pubsub.php: $this->xquery = new DOMXpath ( $this->doc ); Privileges:pubsub.php: $this->xquery->registerNamespace ( 'stream', 'http://etherx.jabber.org/streams' ); Privileges:pubsub.php: $this->currentXMLNode = $this->doc->appendChild ( $this->doc->createElement ( 'start' ) ); Privileges:pubsub.php: return $this->xquery->query ( $expression ); Privileges:pubsub.php: return $this->xquery->query ( $expression , $node ); Privileges:pubsub.php: $this->jid = $jid; Privileges:pubsub.php: $this->password = $password; Privileges:pubsub.php: $this->ready = false; Privileges:pubsub.php: if ( false !== $this->connect () ) Privileges:pubsub.php: $this->go (); Privileges:pubsub.php: if ( false !== $this->connection ) Privileges:pubsub.php: $this->send ( ''); Privileges:pubsub.php: fclose ( $this->connection ); Privileges:pubsub.php: $this->connection = false; Privileges:pubsub.php: $this->sendHandler[$command] = $handler; Privileges:pubsub.php: $this->recvHandler[$command] = $handler; Privileges:pubsub.php: $t->tls = 'none'; Privileges:pubsub.php: $t->idle = false; Privileges:pubsub.php: if ( 1 == $c->dbg["ALL"] || 1 == $c->dbg["push"] ) Privileges:pubsub.php: $t->debug = true ; Privileges:pubsub.php: $t->debug = false ; Privileges:pubsub.php: $t->pubsubLayout = 'flat'; Privileges:pubsub.php: $qry->Exec('pubsub'); Privileges:pubsub.php: $row = $qry->Fetch(); Privileges:pubsub.php: $t->open ( $c->notifications_server['jid'], $c->notifications_server['password'] ); Privileges:pubsub.php: if ( isset ( $c->notifications_server['debug_jid'] ) ) Privileges:pubsub.php: $t->sendMessage ( $c->notifications_server['debug_jid'], "ACTION: $action_type\nUSER: $user_no\nDAV NAME: $dav_name\nPRINCIPAL ID: " . $row->principal_id ); Privileges:pubsub.php: $t->pubsubCreate ( '', 'set', '/davical-' . $row->principal_id, 'http://jabber.org/protocol/pubsub#node_configopenplist-apple' ); Privileges:pubsub.php: $t->pubsubPublish ( '', 'set', '/davical-' . $row->principal_id , 'davical' . $uid . '', $uid ); Privileges:pubsub.php: $t->close(); Privileges:RRule.php: /**#@-*/ Privileges:RRule.php: $this->_text = $input->_text; Privileges:RRule.php: $this->_epoch = $input->_epoch; Privileges:RRule.php: $this->_yy = $input->_yy; Privileges:RRule.php: $this->_mo = $input->_mo; Privileges:RRule.php: $this->_dd = $input->_dd; Privileges:RRule.php: $this->_hh = $input->_hh; Privileges:RRule.php: $this->_mi = $input->_mi; Privileges:RRule.php: $this->_ss = $input->_ss; Privileges:RRule.php: $this->_tz = $input->_tz; Privileges:RRule.php: $this->_wkst = 1; // Monday Privileges:RRule.php: $this->SetLocalDate($input); Privileges:RRule.php: $this->SetGMTDate($input); Privileges:RRule.php: $this->SetLocalDate(strtotime($input)); Privileges:RRule.php: $this->SetEpochDate($input); Privileges:RRule.php: $this->_text = $input; Privileges:RRule.php: $this->_PartsFromText(); Privileges:RRule.php: $this->_GMTEpochFromParts(); Privileges:RRule.php: $this->_text = $input; Privileges:RRule.php: $this->_PartsFromText(); Privileges:RRule.php: $this->_EpochFromParts(); Privileges:RRule.php: $this->_epoch = intval($input); Privileges:RRule.php: $this->_TextFromEpoch(); Privileges:RRule.php: $this->_PartsFromText(); Privileges:RRule.php: $this->_text = date('Ymd\THis', $this->_epoch ); Privileges:RRule.php:// dbg_error_log( "RRule", " Text %s from epoch %d", $this->_text, $this->_epoch ); Privileges:RRule.php: $this->_text = gmdate('Ymd\THis', $this->_epoch ); Privileges:RRule.php:// dbg_error_log( "RRule", " Text %s from epoch %d", $this->_text, $this->_epoch ); Privileges:RRule.php: $this->_yy = intval(substr($this->_text,0,4)); Privileges:RRule.php: $this->_mo = intval(substr($this->_text,4,2)); Privileges:RRule.php: $this->_dd = intval(substr($this->_text,6,2)); Privileges:RRule.php: $this->_hh = intval(substr($this->_text,9,2)); Privileges:RRule.php: $this->_mi = intval(substr($this->_text,11,2)); Privileges:RRule.php: $this->_ss = intval(substr($this->_text,13,2)); Privileges:RRule.php: $this->_epoch = gmmktime ( $this->_hh, $this->_mi, $this->_ss, $this->_mo, $this->_dd, $this->_yy ); Privileges:RRule.php:// dbg_error_log( "RRule", " Epoch %d from %04d-%02d-%02d %02d:%02d:%02d", $this->_epoch, $this->_yy, $this->_mo, $this->_dd, $this->_hh, $this->_mi, $this->_ss ); Privileges:RRule.php: $this->_epoch = mktime ( $this->_hh, $this->_mi, $this->_ss, $this->_mo, $this->_dd, $this->_yy ); Privileges:RRule.php:// dbg_error_log( "RRule", " Epoch %d from %04d-%02d-%02d %02d:%02d:%02d", $this->_epoch, $this->_yy, $this->_mo, $this->_dd, $this->_hh, $this->_mi, $this->_ss ); Privileges:RRule.php: $this->_wkst = $ical_weekdays[$weekstart]; Privileges:RRule.php: function Render( $fmt = 'Y-m-d H:i:s' ) { Privileges:RRule.php: return date( $fmt, $this->_epoch ); Privileges:RRule.php: return gmdate( $fmt, $this->_epoch ); Privileges:RRule.php: * No of days in a month 1(Jan) - 12(Dec) Privileges:RRule.php: if ( $mo === false ) $mo = $this->_mo; Privileges:RRule.php: if ( $yy === false ) $yy = $this->_yy; Privileges:RRule.php: if ( $dd == $this->_dd ) return; // Shortcut Privileges:RRule.php: $dd = min($dd,$this->DaysInMonth()); Privileges:RRule.php: $this->_dd = $dd; Privileges:RRule.php: $this->_EpochFromParts(); Privileges:RRule.php: $this->_TextFromEpoch(); Privileges:RRule.php:// dbg_error_log( "RRule", " Adding %d months to %s", $mo, $this->_text ); Privileges:RRule.php: $this->_mo += $mo; Privileges:RRule.php: while ( $this->_mo < 1 ) { Privileges:RRule.php: $this->_mo += 12; Privileges:RRule.php: $this->_yy--; Privileges:RRule.php: while ( $this->_mo > 12 ) { Privileges:RRule.php: $this->_mo -= 12; Privileges:RRule.php: $this->_yy++; Privileges:RRule.php: if ( ($this->_dd > 28 && $this->_mo == 2) || $this->_dd > 30 ) { Privileges:RRule.php: $dim = $this->DaysInMonth(); Privileges:RRule.php: if ( $this->_dd > $dim ) { Privileges:RRule.php: $this->_dd = $dim; Privileges:RRule.php: $this->_EpochFromParts(); Privileges:RRule.php: $this->_TextFromEpoch(); Privileges:RRule.php:// dbg_error_log( "RRule", " Added %d months and got %s", $mo, $this->_text ); Privileges:RRule.php: $at_start = $this->_text; Privileges:RRule.php: $this->_dd += $dd; Privileges:RRule.php: while ( 1 > $this->_dd ) { Privileges:RRule.php: $this->_mo--; Privileges:RRule.php: if ( $this->_mo < 1 ) { Privileges:RRule.php: $this->_mo += 12; Privileges:RRule.php: $this->_yy--; Privileges:RRule.php: $this->_dd += $this->DaysInMonth(); Privileges:RRule.php: while ( ($dim = $this->DaysInMonth($this->_mo)) < $this->_dd ) { Privileges:RRule.php: $this->_dd -= $dim; Privileges:RRule.php: $this->_mo++; Privileges:RRule.php: if ( $this->_mo > 12 ) { Privileges:RRule.php: $this->_mo -= 12; Privileges:RRule.php: $this->_yy++; Privileges:RRule.php: $this->_EpochFromParts(); Privileges:RRule.php: $this->_TextFromEpoch(); Privileges:RRule.php:// dbg_error_log( "RRule", " Added %d days to %s and got %s", $dd, $at_start, $this->_text ); Privileges:RRule.php: $sign = ( $sign == "-" ? -1 : 1); Privileges:RRule.php:// dbg_error_log( "RRule", " Adding duration to '%s' of sign: %d, days: %s, time: %s", $this->_text, $sign, $days, $time ); Privileges:RRule.php: $this->AddDays( $days * $sign ); Privileges:RRule.php:// dbg_error_log( "RRule", " Adding %02d:%02d:%02d * %d to %02d:%02d:%02d", $hh, $mi, $ss, $sign, $this->_hh, $this->_mi, $this->_ss ); Privileges:RRule.php: $this->_hh += ($hh * $sign); Privileges:RRule.php: $this->_mi += ($mi * $sign); Privileges:RRule.php: $this->_ss += ($ss * $sign); Privileges:RRule.php: if ( $this->_ss < 0 ) { $this->_mi -= (intval(abs($this->_ss/60))+1); $this->_ss += ((intval(abs($this->_mi/60))+1) * 60); } Privileges:RRule.php: if ( $this->_ss > 59) { $this->_mi += (intval(abs($this->_ss/60))+1); $this->_ss -= ((intval(abs($this->_mi/60))+1) * 60); } Privileges:RRule.php: if ( $this->_mi < 0 ) { $this->_hh -= (intval(abs($this->_mi/60))+1); $this->_mi += ((intval(abs($this->_mi/60))+1) * 60); } Privileges:RRule.php: if ( $this->_mi > 59) { $this->_hh += (intval(abs($this->_mi/60))+1); $this->_mi -= ((intval(abs($this->_mi/60))+1) * 60); } Privileges:RRule.php: if ( $this->_hh < 0 ) { $this->AddDays( -1 * (intval(abs($this->_hh/24))+1) ); $this->_hh += ((intval(abs($this->_hh/24))+1)*24); } Privileges:RRule.php: if ( $this->_hh > 23) { $this->AddDays( (intval(abs($this->_hh/24))+1) ); $this->_hh -= ((intval(abs($this->_hh/24))+1)*24); } Privileges:RRule.php: $this->_EpochFromParts(); Privileges:RRule.php: $this->_TextFromEpoch(); Privileges:RRule.php: if ( $from->_epoch < $this->_epoch ) { Privileges:RRule.php: return( "-". $from->DateDifference( $self ) ); Privileges:RRule.php:// if ( $from->_yy == $this->_yy && $from->_mo == $this->_mo ) { Privileges:RRule.php: $diff = $from->_epoch - $this->_epoch; Privileges:RRule.php:* ==> This code is not needed then :-) Privileges:RRule.php: $yy = $from->_yy - $this->_yy; Privileges:RRule.php: $mo = $from->_mo - $this->_mo; Privileges:RRule.php: $dd = $from->_dd - $this->_dd; Privileges:RRule.php: $hh = $from->_hh - $this->_hh; Privileges:RRule.php: $mi = $from->_mi - $this->_mi; Privileges:RRule.php: $ss = $from->_ss - $this->_ss; Privileges:RRule.php: if ( $ss < 0 ) { $mi -= 1; $ss += 60; } Privileges:RRule.php: if ( $mi < 0 ) { $hh -= 1; $mi += 60; } Privileges:RRule.php: if ( $hh < 0 ) { $dd -= 1; $hh += 24; } Privileges:RRule.php: if ( $dd < 0 ) { $mo -= 1; $dd += $this->DaysInMonth(); } // Which will use $this->_(mo|yy) - seemingly sensible Privileges:RRule.php: if ( $mo < 0 ) { $yy -= 1; $mo += 12; } Privileges:RRule.php: * @param string $monthlist A comma-separated list of months. Privileges:RRule.php:// dbg_error_log( "RRule", " Testing BYMONTH %s against month %d", (isset($monthlist) ? $monthlist : "no month list"), $this->_mo ); Privileges:RRule.php: return isset($months[$this->_mo]); Privileges:RRule.php: $days_in_month = $this->DaysInMonth(); Privileges:RRule.php: $first_dow = (date('w',$this->_epoch) - $this->_dd + 36) % 7; Privileges:RRule.php: $days = $this->MonthDays($first_dow,$days_in_month,$v); Privileges:RRule.php: $days_in_month = $this->DaysInMonth(); Privileges:RRule.php: $dow = date('w',$this->_epoch); Privileges:RRule.php: $dd = $this->_dd - $dow + $daynum; Privileges:RRule.php: if ( $daynum < $this->_wkst ) $dd += 7; Privileges:RRule.php: if ( $dd > $this->_dd || !$increasing ) $set[$dd] = $dd; Privileges:RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $lesser->_text ); Privileges:RRule.php: return ( $this->_text > $lesser->_text ); Privileges:RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $lesser ); Privileges:RRule.php: return ( $this->_text > $lesser ); // These sorts of dates are designed that way... Privileges:RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $greater->_text ); Privileges:RRule.php: return ( $this->_text < $greater->_text ); Privileges:RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $greater ); Privileges:RRule.php: return ( $this->_text < $greater ); // These sorts of dates are designed that way... Privileges:RRule.php: * Given a MonthDays string like "1MO", "-2WE" return an integer day of the month. Privileges:RRule.php: preg_match( '/([0-9-]*)(MO|TU|WE|TH|FR|SA|SU)/', $dayspec, $matches); Privileges:RRule.php: $first_matching_day = 1 + ($dow - $dow_first); Privileges:RRule.php: $numeric--; Privileges:RRule.php: * Given set position descriptions like '1', '3', '11', '-3' or '-1' and a set, Privileges:RRule.php: $positions = explode( '[^0-9-]', $bysplist ); Privileges:RRule.php: $v--; Privileges:RRule.php: ( ";" x-name "=" text ) Privileges:RRule.php: enddate =/ date-time ;An UTC value Privileges:RRule.php: minus = "-" Privileges:RRule.php: /**#@-*/ Privileges:RRule.php: $this->_first = new iCalDate($start); Privileges:RRule.php: $this->_finished = false; Privileges:RRule.php: $this->_started = false; Privileges:RRule.php: $this->_dates = array(); Privileges:RRule.php: $this->_current = -1; Privileges:RRule.php: $this->_rule = preg_replace( '/\s/m', '', $rrule); Privileges:RRule.php: if ( substr($this->_rule, 0, 6) == 'RRULE:' ) { Privileges:RRule.php: $this->_rule = substr($this->_rule, 6); Privileges:RRule.php: dbg_error_log( "RRule", " new RRule: Start: %s, RRULE: %s", $start->Render(), $this->_rule ); Privileges:RRule.php: $parts = explode(';',$this->_rule); Privileges:RRule.php: $this->_part = array( 'INTERVAL' => 1 ); Privileges:RRule.php: $this->_part[$type] = $value; Privileges:RRule.php: if ( !isset($this->_part['FREQ']) ) { Privileges:RRule.php: if ( isset($this->_part['COUNT']) && isset($this->_part['UNTIL']) ) { Privileges:RRule.php: if ( isset($this->_part['COUNT']) && intval($this->_part['COUNT']) < 1 ) { Privileges:RRule.php: if ( !preg_match( '/(YEAR|MONTH|WEEK|DAI)LY/', $this->_part['FREQ']) ) { Privileges:RRule.php: if ( $this->_part['FREQ'] == "YEARLY" ) { Privileges:RRule.php: $this->_part['INTERVAL'] *= 12; Privileges:RRule.php: $this->_part['FREQ'] = "MONTHLY"; Privileges:RRule.php: $ptr = $this->_current; Privileges:RRule.php:// dbg_error_log( "RRule", " WithinScope: Processing list of %d days relative to %s", count($relative_days), $base->Render() ); Privileges:RRule.php: $days_in_month = $test->DaysInMonth(); Privileges:RRule.php:// dbg_error_log( "RRule", " WithinScope: Testing for day %d based on %s, with %d days in month", $day, $test->Render(), $days_in_month ); Privileges:RRule.php: $test->SetMonthDay($days_in_month); Privileges:RRule.php: $test->AddDays(1); Privileges:RRule.php: $day -= $days_in_month; Privileges:RRule.php: $test->SetMonthDay($day); Privileges:RRule.php: $test->SetMonthDay(1); Privileges:RRule.php: $test->AddDays(-1); Privileges:RRule.php: $days_in_month = $test->DaysInMonth(); Privileges:RRule.php: $test->SetMonthDay($day); Privileges:RRule.php: $test->SetMonthDay($day); Privileges:RRule.php:// dbg_error_log( "RRule", " WithinScope: Testing if %s is within scope", count($relative_days), $test->Render() ); Privileges:RRule.php: if ( isset($this->_part['UNTIL']) && $test->GreaterThan($this->_part['UNTIL']) ) { Privileges:RRule.php: $this->_finished = true; Privileges:RRule.php: // if ( $this->_current >= 0 && $test->LessThan($this->_dates[$this->_current]) ) continue; Privileges:RRule.php: if ( !$test->LessThan($this->_first) ) { Privileges:RRule.php:// dbg_error_log( "RRule", " WithinScope: Looks like %s is within scope", $test->Render() ); Privileges:RRule.php: if ( isset($this->_part['COUNT']) && $ptr >= $this->_part['COUNT'] ) { Privileges:RRule.php: $this->_finished = true; Privileges:RRule.php: if ( $this->_current < 0 ) { Privileges:RRule.php: $next = new iCalDate($this->_first); Privileges:RRule.php: $this->_current++; Privileges:RRule.php: $next = new iCalDate($this->_dates[$this->_current]); Privileges:RRule.php: $this->_current++; Privileges:RRule.php: if ( isset($this->_dates[$this->_current]) ) { Privileges:RRule.php:// dbg_error_log( "RRule", " GetNext: Returning %s, (%d'th)", $this->_dates[$this->_current]->Render(), $this->_current ); Privileges:RRule.php: return $this->_dates[$this->_current]; Privileges:RRule.php: if ( isset($this->_part['COUNT']) && $this->_current >= $this->_part['COUNT'] ) // >= since _current is 0-based and COUNT is 1-based Privileges:RRule.php: $this->_finished = true; Privileges:RRule.php: if ( $this->_finished ) { Privileges:RRule.php: if ( isset($this->_part['WKST']) ) $next->SetWeekStart($this->_part['WKST']); Privileges:RRule.php: if ( $this->_part['FREQ'] == "MONTHLY" ) { Privileges:RRule.php: $limit--; Privileges:RRule.php: $limit--; Privileges:RRule.php: if ( $this->_started ) { Privileges:RRule.php: $next->AddMonths($this->_part['INTERVAL']); Privileges:RRule.php: $this->_started = true; Privileges:RRule.php: while ( isset($this->_part['BYMONTH']) && $limit > 0 && ! $next->TestByMonth($this->_part['BYMONTH']) ); Privileges:RRule.php: if ( isset($this->_part['BYDAY']) ) { Privileges:RRule.php: $days = $next->GetMonthByDay($this->_part['BYDAY']); Privileges:RRule.php: else if ( isset($this->_part['BYMONTHDAY']) ) { Privileges:RRule.php: $days = $next->GetMonthByMonthDay($this->_part['BYMONTHDAY']); Privileges:RRule.php: $days[$next->_dd] = $next->_dd; Privileges:RRule.php: if ( isset($this->_part['BYSETPOS']) ) { Privileges:RRule.php: $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days); Privileges:RRule.php: $days = $this->WithinScope( $next, $days); Privileges:RRule.php: while( $limit && count($days) < 1 && ! $this->_finished ); Privileges:RRule.php: else if ( $this->_part['FREQ'] == "WEEKLY" ) { Privileges:RRule.php: $limit--; Privileges:RRule.php: if ( $this->_started ) { Privileges:RRule.php: $next->AddDays($this->_part['INTERVAL'] * 7); Privileges:RRule.php: $this->_started = true; Privileges:RRule.php: if ( isset($this->_part['BYDAY']) ) { Privileges:RRule.php: $days = $next->GetWeekByDay($this->_part['BYDAY'], false ); Privileges:RRule.php: $days[$next->_dd] = $next->_dd; Privileges:RRule.php: if ( isset($this->_part['BYSETPOS']) ) { Privileges:RRule.php: $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days); Privileges:RRule.php: $days = $this->WithinScope( $next, $days); Privileges:RRule.php: while( $limit && count($days) < 1 && ! $this->_finished ); Privileges:RRule.php: else if ( $this->_part['FREQ'] == "DAILY" ) { Privileges:RRule.php: $limit--; Privileges:RRule.php: if ( $this->_started ) { Privileges:RRule.php: $next->AddDays($this->_part['INTERVAL']); Privileges:RRule.php: if ( isset($this->_part['BYDAY']) ) { Privileges:RRule.php: $days = $next->GetWeekByDay($this->_part['BYDAY'], $this->_started ); Privileges:RRule.php: $days[$next->_dd] = $next->_dd; Privileges:RRule.php: if ( isset($this->_part['BYSETPOS']) ) { Privileges:RRule.php: $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days); Privileges:RRule.php: $days = $this->WithinScope( $next, $days); Privileges:RRule.php: $this->_started = true; Privileges:RRule.php: while( $limit && count($days) < 1 && ! $this->_finished ); Privileges:RRule.php: $ptr = $this->_current; Privileges:RRule.php: $this->_dates[$ptr++] = $v; Privileges:RRule.php: if ( isset($this->_dates[$this->_current]) ) { Privileges:RRule.php:// dbg_error_log( "RRule", " GetNext: Returning %s, (%d'th)", $this->_dates[$this->_current]->Render(), $this->_current ); Privileges:RRule.php: return $this->_dates[$this->_current]; Privileges:RRule-v2.php: $this->tz_defined = false; Privileges:RRule-v2.php: $this->tz_defined = $dtz; Privileges:RRule-v2.php: dbg_error_log( 'ERROR', 'Could not parse timezone "%s" - will use floating time', $original ); Privileges:RRule-v2.php: $this->tz_defined = false; Privileges:RRule-v2.php: if ( $this->tz_defined === false ) return false; Privileges:RRule-v2.php: $tzid = $this->getName(); Privileges:RRule-v2.php: return $this->tz_defined; Privileges:RRule-v2.php: // public static $Format = 'Y-m-d H:i:s'; Privileges:RRule-v2.php: $this->is_date = false; Privileges:RRule-v2.php: if ( preg_match('{;?VALUE=DATE[:;]}', $date, $matches) ) $this->is_date = true; Privileges:RRule-v2.php: elseif ( preg_match('{:([12]\d{3}) (0[1-9]|1[012]) (0[1-9]|[12]\d|3[01]Z?) $}x', $date, $matches) ) $this->is_date = true; Privileges:RRule-v2.php: $this->tzid = 'UTC'; Privileges:RRule-v2.php: $this->tzid = $dtz->tzid(); Privileges:RRule-v2.php: $this->tzid = null; Privileges:RRule-v2.php: if ( strlen($matches[1]) == 8 ) $this->is_date = true; Privileges:RRule-v2.php: $this->tzid = 'UTC'; Privileges:RRule-v2.php: $this->tzid = null; Privileges:RRule-v2.php: $this->tzid = $dtz->tzid(); Privileges:RRule-v2.php: $this->tzid = $dtz->getName(); Privileges:RRule-v2.php: return (string)parent::format(self::$Format) . ' ' . parent::getTimeZone()->getName(); Privileges:RRule-v2.php: return $this->format('Ymd'); Privileges:RRule-v2.php: if ( preg_match('{^(-)?P((\d+)W)?((\d+)D)?T?((\d+)H)?((\d+)M)?((\d+)S)?$}', $interval, $matches) ) { Privileges:RRule-v2.php:// printf( "Modify '%s' by: >>%s<<\n", $this->__toString(), $interval ); Privileges:RRule-v2.php: return $this->__toString(); Privileges:RRule-v2.php: if ( isset($this->tzid) && $this->tzid != 'UTC' ) { Privileges:RRule-v2.php: $offset = 0 - $dtz->getOffset($gmt); Privileges:RRule-v2.php: $gmt->modify( $offset . ' seconds' ); Privileges:RRule-v2.php: if ( $this->is_date ) return $gmt->format('Ymd'); Privileges:RRule-v2.php: return $gmt->format('Ymd\THis\Z'); Privileges:RRule-v2.php: if ( isset($this->tzid) && $this->tzid != 'UTC' ) { Privileges:RRule-v2.php: $result = ';TZID='.$this->tzid; Privileges:RRule-v2.php: if ( $this->is_date ) { Privileges:RRule-v2.php: $result .= ';VALUE=DATE:' . $this->format('Ymd'); Privileges:RRule-v2.php: $result .= ':' . $this->format('Ymd\THis'); Privileges:RRule-v2.php: if ( isset($this->tzid) && $this->tzid == 'UTC' ) { Privileges:RRule-v2.php: return sprintf( 'PT%dM', intval(($end_stamp->epoch() - $this->epoch()) / 60) ); Privileges:RRule-v2.php: $this->tzid = $tz->tzid(); Privileges:RRule-v2.php: $this->base = ( is_object($basedate) ? $basedate : new RepeatRuleDateTime($basedate) ); Privileges:RRule-v2.php: if ( preg_match('{FREQ=([A-Z]+)(;|$)}', $rrule, $m) ) $this->freq = $m[1]; Privileges:RRule-v2.php: if ( preg_match('{UNTIL=([0-9TZ]+)(;|$)}', $rrule, $m) ) $this->until = new RepeatRuleDateTime($m[1]); Privileges:RRule-v2.php: if ( preg_match('{COUNT=([0-9]+)(;|$)}', $rrule, $m) ) $this->count = $m[1]; Privileges:RRule-v2.php: if ( preg_match('{INTERVAL=([0-9]+)(;|$)}', $rrule, $m) ) $this->interval = $m[1]; Privileges:RRule-v2.php: if ( preg_match('{WKST=(MO|TU|WE|TH|FR|SA|SU)(;|$)}', $rrule, $m) ) $this->wkst = $m[1]; Privileges:RRule-v2.php: if ( preg_match('{BYDAY=(([+-]?[0-9]{0,2}(MO|TU|WE|TH|FR|SA|SU),?)+)(;|$)}', $rrule, $m) ) $this->byday = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYYEARDAY=([0-9,+-]+)(;|$)}', $rrule, $m) ) $this->byyearday = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYWEEKNO=([0-9,+-]+)(;|$)}', $rrule, $m) ) $this->byweekno = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYMONTHDAY=([0-9,+-]+)(;|$)}', $rrule, $m) ) $this->bymonthday = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYMONTH=(([+-]?[0-1]?[0-9],?)+)(;|$)}', $rrule, $m) ) $this->bymonth = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYSETPOS=(([+-]?[0-9]{1,3},?)+)(;|$)}', $rrule, $m) ) $this->bysetpos = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYSECOND=([0-9,]+)(;|$)}', $rrule, $m) ) $this->bysecond = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYMINUTE=([0-9,]+)(;|$)}', $rrule, $m) ) $this->byminute = explode(',',$m[1]); Privileges:RRule-v2.php: if ( preg_match('{BYHOUR=([0-9,]+)(;|$)}', $rrule, $m) ) $this->byhour = explode(',',$m[1]); Privileges:RRule-v2.php: if ( !isset($this->interval) ) $this->interval = 1; Privileges:RRule-v2.php: switch( $this->freq ) { Privileges:RRule-v2.php: case 'SECONDLY': $this->freq_name = 'second'; break; Privileges:RRule-v2.php: case 'MINUTELY': $this->freq_name = 'minute'; break; Privileges:RRule-v2.php: case 'HOURLY': $this->freq_name = 'hour'; break; Privileges:RRule-v2.php: case 'DAILY': $this->freq_name = 'day'; break; Privileges:RRule-v2.php: case 'WEEKLY': $this->freq_name = 'week'; break; Privileges:RRule-v2.php: case 'MONTHLY': $this->freq_name = 'month'; break; Privileges:RRule-v2.php: case 'YEARLY': $this->freq_name = 'year'; break; Privileges:RRule-v2.php: $this->frequency_string = sprintf('+%d %s', $this->interval, $this->freq_name ); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Frequency modify string is: '%s', base is: '%s'\n", $this->frequency_string, $this->base->format('c') ); Privileges:RRule-v2.php: $this->Start(); Privileges:RRule-v2.php: $this->base->setTimezone(new DateTimeZone($tzstring)); Privileges:RRule-v2.php: $this->instances = array(); Privileges:RRule-v2.php: $this->GetMoreInstances(); Privileges:RRule-v2.php: $this->rewind(); Privileges:RRule-v2.php: $this->finished = false; Privileges:RRule-v2.php: $this->position = -1; Privileges:RRule-v2.php: $this->position++; Privileges:RRule-v2.php: return $this->current(); Privileges:RRule-v2.php: if ( !$this->valid() ) return null; Privileges:RRule-v2.php: if ( !isset($this->instances[$this->position]) ) $this->GetMoreInstances(); Privileges:RRule-v2.php: if ( !$this->valid() ) return null; Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Returning date from position %d: %s (%s)\n", $this->position, $this->instances[$this->position]->format('c'), $this->instances[$this->position]->UTC() ); Privileges:RRule-v2.php: return $this->instances[$this->position]; Privileges:RRule-v2.php: if ( !$this->valid() ) return null; Privileges:RRule-v2.php: if ( !isset($this->instances[$this->position]) ) $this->GetMoreInstances(); Privileges:RRule-v2.php: if ( !isset($this->keys[$this->position]) ) { Privileges:RRule-v2.php: $this->keys[$this->position] = $this->instances[$this->position]; Privileges:RRule-v2.php: return $this->keys[$this->position]; Privileges:RRule-v2.php: if ( isset($this->instances[$this->position]) || !$this->finished ) return true; Privileges:RRule-v2.php: if ( $this->finished ) return; Privileges:RRule-v2.php: while( !$this->finished && !$got_more && $loops++ < $loop_limit ) { Privileges:RRule-v2.php: if ( !isset($this->current_base) ) { Privileges:RRule-v2.php: $this->current_base = clone($this->base); Privileges:RRule-v2.php: $this->current_base->modify( $this->frequency_string ); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Getting more instances from: '%s' - %d\n", $this->current_base->format('c'), count($this->instances) ); Privileges:RRule-v2.php: $this->current_set = array( clone($this->current_base) ); Privileges:RRule-v2.php: foreach( $rrule_expand_limit[$this->freq] AS $bytype => $action ) { Privileges:RRule-v2.php: if ( isset($this->{$bytype}) ) $this->{$action.'_'.$bytype}(); Privileges:RRule-v2.php: if ( !isset($this->current_set[0]) ) break; Privileges:RRule-v2.php: sort($this->current_set); Privileges:RRule-v2.php: if ( isset($this->bysetpos) ) $this->limit_bysetpos(); Privileges:RRule-v2.php: $position = count($this->instances) - 1; Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Inserting %d from current_set into position %d\n", count($this->current_set), $position + 1 ); Privileges:RRule-v2.php: foreach( $this->current_set AS $k => $instance ) { Privileges:RRule-v2.php: if ( $instance < $this->base ) continue; Privileges:RRule-v2.php: if ( isset($this->until) && $instance > $this->until ) { Privileges:RRule-v2.php: $this->finished = true; Privileges:RRule-v2.php: if ( !isset($this->instances[$position]) || $instance != $this->instances[$position] ) { Privileges:RRule-v2.php: $this->instances[$position] = $instance; Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Added date %s into position %d in current set\n", $instance->format('c'), $position ); Privileges:RRule-v2.php: if ( isset($this->count) && ($position + 1) >= $this->count ) $this->finished = true; Privileges:RRule-v2.php: $date_parts = explode(',',$date->format('Y,m,d,H,i,s')); Privileges:RRule-v2.php: $tz = $date->getTimezone(); Privileges:RRule-v2.php: $date->setDate( $date_parts[0], $date_parts[1], $date_parts[2] ); Privileges:RRule-v2.php: $date->setTime( $date_parts[3], $date_parts[4], $date_parts[5] ); Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->bymonth AS $k => $month ) { Privileges:RRule-v2.php: $expanded = $this->date_mask( clone($instance), null, $month, null, null, null, null); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYMONTH $month into date %s\n", $expanded->format('c') ); Privileges:RRule-v2.php: $this->current_set[] = $expanded; Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->bymonthday AS $k => $monthday ) { Privileges:RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, $monthday, null, null, null); Privileges:RRule-v2.php: $dow_of_instance = $day_in_week->format('w'); // 0 == Sunday Privileges:RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { Privileges:RRule-v2.php: $offset = $dow - $dow_of_instance; Privileges:RRule-v2.php: $expanded->modify( sprintf('+%d day', $offset) ); Privileges:RRule-v2.php: $this->current_set[] = $expanded; Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(W) $weekday into date %s\n", $expanded->format('c') ); Privileges:RRule-v2.php: $first_of_month = $this->date_mask( clone($day_in_month), null, null, 1, null, null, null); Privileges:RRule-v2.php: $dow_of_first = $first_of_month->format('w'); // 0 == Sunday Privileges:RRule-v2.php: $days_in_month = cal_days_in_month(CAL_GREGORIAN, $first_of_month->format('m'), $first_of_month->format('Y')); Privileges:RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { Privileges:RRule-v2.php: if ( preg_match('{([+-])?(\d)?(MO|TU|WE|TH|FR|SA|SU)}', $weekday, $matches ) ) { Privileges:RRule-v2.php: $first_dom = 1 + $dow - $dow_of_first; if ( $first_dom < 1 ) $first_dom +=7; // e.g. 1st=WE, dow=MO => 1+1-3=-1 => MO is 6th, etc. Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanding BYDAY(M) $weekday in month of %s\n", $instance->format('c') ); Privileges:RRule-v2.php: $whichweek--; Privileges:RRule-v2.php: if ( $matches[1] == '-' ) { Privileges:RRule-v2.php: while( $monthday > $days_in_month ) $monthday -= 7; Privileges:RRule-v2.php: $monthday -= (7 * $whichweek); Privileges:RRule-v2.php: $expanded = $this->date_mask( clone($day_in_month), null, null, $monthday, null, null, null); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(M) $weekday now $monthday into date %s\n", $expanded->format('c') ); Privileges:RRule-v2.php: $this->current_set[] = $expanded; Privileges:RRule-v2.php: $expanded = $this->date_mask( clone($day_in_month), null, null, $monthday, null, null, null); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(M) $weekday now $monthday into date %s\n", $expanded->format('c') ); Privileges:RRule-v2.php: $this->current_set[] = $expanded; Privileges:RRule-v2.php: $first_of_year = $this->date_mask( clone($day_in_year), null, 1, 1, null, null, null); Privileges:RRule-v2.php: $dow_of_first = $first_of_year->format('w'); // 0 == Sunday Privileges:RRule-v2.php: $days_in_year = 337 + cal_days_in_month(CAL_GREGORIAN, 2, $first_of_year->format('Y')); Privileges:RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { Privileges:RRule-v2.php: if ( preg_match('{([+-])?(\d)?(MO|TU|WE|TH|FR|SA|SU)}', $weekday, $matches ) ) { Privileges:RRule-v2.php: $first_doy = 1 + $dow - $dow_of_first; if ( $first_doy < 1 ) $first_doy +=7; // e.g. 1st=WE, dow=MO => 1+1-3=-1 => MO is 6th, etc. Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanding BYDAY(Y) $weekday from date %s\n", $instance->format('c') ); Privileges:RRule-v2.php: $whichweek--; Privileges:RRule-v2.php: if ( $matches[1] == '-' ) { Privileges:RRule-v2.php: while( $yearday > $days_in_year ) $yearday -= 7; Privileges:RRule-v2.php: $yearday -= (7 * $whichweek); Privileges:RRule-v2.php: $expanded->modify(sprintf('+%d day', $yearday - 1)); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(Y) $weekday now $yearday into date %s\n", $expanded->format('c') ); Privileges:RRule-v2.php: $this->current_set[] = $expanded; Privileges:RRule-v2.php: $expanded->modify(sprintf('+%d day', $first_doy - 1)); Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(Y) $weekday now $yearday into date %s\n", $expanded->format('c') ); Privileges:RRule-v2.php: $this->current_set[] = clone($expanded); Privileges:RRule-v2.php: $expanded->modify('+1 week'); Privileges:RRule-v2.php: if ( !isset($this->current_set[0]) ) return; Privileges:RRule-v2.php: if ( $this->freq == 'MONTHLY' || $this->freq == 'YEARLY' ) { Privileges:RRule-v2.php: if ( isset($this->bymonthday) || isset($this->byyearday) ) { Privileges:RRule-v2.php: $this->limit_byday(); /** Per RFC5545 3.3.10 from note 1&2 to table */ Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: if ( $this->freq == 'MONTHLY' ) { Privileges:RRule-v2.php: $this->expand_byday_in_month($instance); Privileges:RRule-v2.php: else if ( $this->freq == 'WEEKLY' ) { Privileges:RRule-v2.php: $this->expand_byday_in_week($instance); Privileges:RRule-v2.php: if ( isset($this->bymonth) ) { Privileges:RRule-v2.php: $this->expand_byday_in_month($instance); Privileges:RRule-v2.php: else if ( isset($this->byweekno) ) { Privileges:RRule-v2.php: $this->expand_byday_in_week($instance); Privileges:RRule-v2.php: $this->expand_byday_in_year($instance); Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->bymonth AS $k => $month ) { Privileges:RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, null, $hour, null, null); Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->bymonth AS $k => $month ) { Privileges:RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, null, null, $minute, null); Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->bymonth AS $k => $second ) { Privileges:RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, null, null, null, $second); Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->{$element_name} AS $k => $element_value ) { Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Limiting '$fmt_char' on '%s' => '%s' ?=? '%s' ? %s\n", $instance->format('c'), $instance->format($fmt_char), $element_value, ($instance->format($fmt_char) == $element_value ? 'Yes' : 'No') ); Privileges:RRule-v2.php: if ( $instance->format($fmt_char) == $element_value ) $this->current_set[] = $instance; Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { Privileges:RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Limiting '$fmt_char' on '%s' => '%s' ?=? '%s' (%d) ? %s\n", $instance->format('c'), $instance->format($fmt_char), $weekday, $dow, ($instance->format($fmt_char) == $dow ? 'Yes' : 'No') ); Privileges:RRule-v2.php: if ( $instance->format($fmt_char) == $dow ) $this->current_set[] = $instance; Privileges:RRule-v2.php: private function limit_bymonth() { $this->limit_generally( 'm', 'bymonth' ); } Privileges:RRule-v2.php: private function limit_byyearday() { $this->limit_generally( 'z', 'byyearday' ); } Privileges:RRule-v2.php: private function limit_bymonthday() { $this->limit_generally( 'd', 'bymonthday' ); } Privileges:RRule-v2.php: private function limit_byhour() { $this->limit_generally( 'H', 'byhour' ); } Privileges:RRule-v2.php: private function limit_byminute() { $this->limit_generally( 'i', 'byminute' ); } Privileges:RRule-v2.php: private function limit_bysecond() { $this->limit_generally( 's', 'bysecond' ); } Privileges:RRule-v2.php: $instances = $this->current_set; Privileges:RRule-v2.php: $this->current_set = array(); Privileges:RRule-v2.php: foreach( $this->bysetpos AS $k => $element_value ) { Privileges:RRule-v2.php: $this->current_set[] = $instances[$element_value - 1]; Privileges:RRule-v2.php: $this->current_set[] = $instances[$count + $element_value]; Privileges:RRule-v2.php: $properties = $component->GetProperties($property); Privileges:RRule-v2.php: $timezone = $p->GetParameterValue('TZID'); Privileges:RRule-v2.php: $rdate = $p->Value(); Privileges:RRule-v2.php: $expansion[$rdate->UTC()] = $component; Privileges:RRule-v2.php: $recur = $component->GetProperty($property); Privileges:RRule-v2.php: $recur = $recur->Value(); Privileges:RRule-v2.php: $this_start = $component->GetProperty('DTSTART'); Privileges:RRule-v2.php: $timezone = $this_start->GetParameterValue('TZID'); Privileges:RRule-v2.php: $this_start = new RepeatRuleDateTime($this_start->Value(),$timezone); Privileges:RRule-v2.php: while( $date = $rule->next() ) { Privileges:RRule-v2.php:// printf( "[%3d] %s\n", $i, $date->UTC() ); Privileges:RRule-v2.php: $expansion[$date->UTC()] = $component; Privileges:RRule-v2.php:* @param object $range_start A RepeatRuleDateTime which is the beginning of the range for events, default -6 weeks Privileges:RRule-v2.php: $components = $vResource->GetComponents(); Privileges:RRule-v2.php: if ( !isset($range_start) ) { $range_start = new RepeatRuleDateTime(); $range_start->modify('-6 weeks'); } Privileges:RRule-v2.php: if ( !isset($range_end) ) { $range_end = clone($range_start); $range_end->modify('+6 months'); } Privileges:RRule-v2.php: if ( $comp->GetType() != 'VEVENT' && $comp->GetType() != 'VTODO' && $comp->GetType() != 'VJOURNAL' ) { Privileges:RRule-v2.php: $dtstart = $comp->GetProperty('DTSTART'); Privileges:RRule-v2.php: $tzid = $dtstart->GetParameterValue('TZID'); Privileges:RRule-v2.php: $dtstart = new RepeatRuleDateTime( $dtstart->Value(), $tzid ); Privileges:RRule-v2.php: $instances[$dtstart->UTC()] = $comp; Privileges:RRule-v2.php: $p = $comp->GetProperty('RECURRENCE-ID'); Privileges:RRule-v2.php: if ( isset($p) && $p->Value() != '' ) { Privileges:RRule-v2.php: $range = $p->GetParameterValue('RANGE'); Privileges:RRule-v2.php: $recur_tzid = $p->GetParameterValue('TZID'); Privileges:RRule-v2.php: $recur_utc = new RepeatRuleDateTime($p->Value(),$recur_tzid); Privileges:RRule-v2.php: $recur_utc = $recur_utc->UTC(); Privileges:RRule-v2.php: $start_utc = $range_start->UTC(); Privileges:RRule-v2.php: $end_utc = $range_end->UTC(); Privileges:RRule-v2.php: $end_type = ($comp->GetType() == 'VTODO' ? 'DUE' : 'DTEND'); Privileges:RRule-v2.php: $duration = $comp->GetProperty('DURATION'); Privileges:RRule-v2.php: if ( !isset($duration) || $duration->Value() == '' ) { Privileges:RRule-v2.php: $instance_start = $comp->GetProperty('DTSTART'); Privileges:RRule-v2.php: $dtsrt = new RepeatRuleDateTime( $instance_start->Value(), $instance_start->GetParameterValue('TZID')); Privileges:RRule-v2.php: $instance_end = $comp->GetProperty($end_type); Privileges:RRule-v2.php: $dtend = new RepeatRuleDateTime( $instance_end->Value(), $instance_end->GetParameterValue('TZID')); Privileges:RRule-v2.php: $duration = $dtstart->RFC5545Duration( $dtend ); Privileges:RRule-v2.php: $duration = $duration->Value(); Privileges:RRule-v2.php: $latest_start->modify('-'.$duration); Privileges:RRule-v2.php: $early_start = $latest_start->UTC(); Privileges:RRule-v2.php: $component->ClearProperties( array('DTSTART'=> true, 'DUE' => true, 'DTEND' => true) ); Privileges:RRule-v2.php: $component->AddProperty('DTSTART', $utc ); Privileges:RRule-v2.php: $component->AddProperty('DURATION', $duration ); Privileges:RRule-v2.php: $vResource->SetComponents($new_components); Privileges:RRule-v2.php: $vResource->SetComponents(array()); Privileges:test-RRULE.php:header("Content-type: text/plain"); Privileges:test-RRULE.php: $this->description = $description; Privileges:test-RRULE.php: $this->dtstart = $start; Privileges:test-RRULE.php: $this->recur = $recur; Privileges:test-RRULE.php: $this->result_description = $result_description; Privileges:test-RRULE.php: $rule = new RRule( new iCalDate($this->dtstart), $this->recur ); Privileges:test-RRULE.php: $date = $rule->GetNext(); Privileges:test-RRULE.php: $result .= " " . $date->Render(); Privileges:test-RRULE.php: $qry = new AwlQuery($sql, $this->dtstart, $this->recur); Privileges:test-RRULE.php: // printf( "%s\n", $qry->querystring); Privileges:test-RRULE.php: if ( $qry->Exec("test") && $qry->rows > 0 ) { Privileges:test-RRULE.php: while( $row = $qry->Fetch() ) { Privileges:test-RRULE.php: $result .= " " . $row->event_date; Privileges:test-RRULE.php: , new RRuleTest( "Monthly, on the 1st monday, 2nd wednesday, 3rd friday and last sunday, forever", "20061117T073000", "RRULE:FREQ=MONTHLY;BYDAY=1MO,2WE,3FR,-1SU" ) Privileges:test-RRULE.php: , new RRuleTest( "The last working day of each month", "20061107T113000", "RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1" ) Privileges:test-RRULE.php: , new RRuleTest( "Time zone 2", "19700927T020000", "FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=9" ) Privileges:test-RRULE.php: , new RRuleTest( "Time zone 3", "19810329T030000", "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU" ) Privileges:test-RRULE.php: echo "$test->dtstart - $test->recur\n"; Privileges:test-RRULE.php: echo "$test->description\n"; Privileges:test-RRULE.php: $php_result = $test->PHPTest(); Privileges:test-RRULE.php: $sql_result = $test->SQLTest(); Privileges:test-RRULE.php: echo "PHP & SQL results are identical :-)\n"; Privileges:test-RRULE.php: echo "PHP & SQL results differ :-(\n"; Privileges:vcard.php: fn TEXT, -- fullname Privileges:vcard.php: n TEXT, -- Name Surname;First names Privileges:vcard.php: $in_transaction = ($qry->TransactionState() == 1); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Begin(); Privileges:vcard.php: $properties = $this->GetProperties( $wanted ); Privileges:vcard.php: $pname = ':' . strtolower($v->Name()); Privileges:vcard.php: if ( !isset($params[$pname]) /** @TODO: or this is one is in the user's language */ ) $params[$pname] = $v->Value(); Privileges:vcard.php: $qry->QDo( $sql, $params ); Privileges:vcard.php: $this->WriteAddresses($dav_id); Privileges:vcard.php: $this->WritePhones($dav_id); Privileges:vcard.php: $this->WriteEmails($dav_id); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Commit(); Privileges:vcard.php: property TEXT -- The full text of the property Privileges:vcard.php: $addresses = $this->GetProperties('ADR'); Privileges:vcard.php: $in_transaction = ($qry->TransactionState() == 1); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Begin(); Privileges:vcard.php: $qry->QDo('DELETE FROM addressbook_address_adr WHERE dav_id = :dav_id', $params ); Privileges:vcard.php: $params[':type'] = $adr->GetParameterValue('TYPE'); Privileges:vcard.php: $address = explode(';',$adr->Value()); Privileges:vcard.php: $params[':property'] = $adr->Render(); Privileges:vcard.php: $qry->QDo( 'INSERT INTO addressbook_address_adr (dav_id, type, box_no, unit_no, street_address, locality, region, postcode, country, property) Privileges:vcard.php: if ( ! $in_transaction ) $qry->Commit(); Privileges:vcard.php: property TEXT -- The full text of the property Privileges:vcard.php: $telephones = $this->GetProperties('TEL'); Privileges:vcard.php: $in_transaction = ($qry->TransactionState() == 1); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Begin(); Privileges:vcard.php: $qry->QDo('DELETE FROM addressbook_address_tel WHERE dav_id = :dav_id', $params ); Privileges:vcard.php: $params[':type'] = $tel->GetParameterValue('TYPE'); Privileges:vcard.php: $params[':tel'] = $tel->Value(); Privileges:vcard.php: $params[':property'] = $tel->Render(); Privileges:vcard.php: $qry->QDo( 'INSERT INTO addressbook_address_tel (dav_id, type, tel, property) VALUES( :dav_id, :type, :tel, :property)', $params ); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Commit(); Privileges:vcard.php: property TEXT -- The full text of the property Privileges:vcard.php: $emails = $this->GetProperties('EMAIL'); Privileges:vcard.php: $in_transaction = ($qry->TransactionState() == 1); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Begin(); Privileges:vcard.php: $qry->QDo('DELETE FROM addressbook_address_email WHERE dav_id = :dav_id', $params ); Privileges:vcard.php: $params[':type'] = $email->GetParameterValue('TYPE'); Privileges:vcard.php: $params[':email'] = $email->Value(); Privileges:vcard.php: $params[':property'] = $email->Render(); Privileges:vcard.php: $qry->QDo( 'INSERT INTO addressbook_address_email (dav_id, type, email, property) VALUES( :dav_id, :type, :email, :property)', $params ); Privileges:vcard.php: if ( ! $in_transaction ) $qry->Commit(); PublicSession.php: * User e-mail PublicSession.php: /**#@-*/ PublicSession.php: $this->user_no = -1; PublicSession.php: $this->principal_id = -1; PublicSession.php: $this->email = null; PublicSession.php: $this->username = 'guest'; PublicSession.php: $this->fullname = 'Anonymous'; PublicSession.php: $this->groups = ( isset($c->public_groups) ? $c->public_groups : array() ); PublicSession.php: $this->roles = array( 'Public' => true ); PublicSession.php: $this->logged_in = false; PublicSession.php: return ( isset($this->roles[$whatever]) && $this->roles[$whatever] ); pubsub.php: $this->status = "online"; pubsub.php: $this->setupXmlParser (); pubsub.php: if ( ! isset ( $this->jid ) ) pubsub.php: return $this->connection = false; pubsub.php: if ( ! isset ( $this->idle ) ) pubsub.php: $this->idle = true; pubsub.php: if ( ! isset ( $this->resource ) ) pubsub.php: $this->resource = 'caldav' . getmypid(); pubsub.php: if ( ! preg_match ( '/^\//', $this->resource ) ) pubsub.php: $this->resource = '/' . $this->resource; pubsub.php: $temp = explode ( '@', $this->jid ); pubsub.php: $this->username = $temp[0]; pubsub.php: if ( ! isset ( $this->server ) ) pubsub.php: $this->server = $temp[1]; pubsub.php: $r = dns_get_record("_xmpp-client._tcp.". $this->server , DNS_SRV); pubsub.php: $this->original_server = $this->server; pubsub.php: $this->server = $r[0]['target']; pubsub.php: $this->original_port = $this->port; pubsub.php: $this->port = $r[0]['port']; pubsub.php: if ( ! isset ( $this->port ) ) pubsub.php: $this->port = 5222; pubsub.php: if ( 'ssl' == $this->tls || ( ! isset ( $this->tls ) && 5223 == $this->port ) ) pubsub.php: $url = 'ssl://' . $this->server; pubsub.php: elseif ( 'tls' == $this->tls || ( ! isset ( $this->tls ) && 5222 == $this->port ) ) pubsub.php: $url = 'tcp://' . $this->server; pubsub.php: $url = 'tcp://' . $this->server; pubsub.php: if ( isset ( $this->original_server ) ) pubsub.php: $this->server = $this->original_server; pubsub.php: $this->connection = stream_socket_client ( $url . ':' . $this->port, $errno, $errstring, 10, STREAM_CLIENT_ASYNC_CONNECT ); pubsub.php: if ( false === $this->connection ) pubsub.php: $this->initializeQueue ( ); pubsub.php: socket_set_blocking ( $this->connection, false ); pubsub.php: if ( $this->debug ) $this->log ( 'handling features' ); pubsub.php: if ( 'STARTTLS' == $node->firstChild->nodeName ) pubsub.php: $this->sendQueue[] = ""; pubsub.php: $elements = $this->query ( '*/MECHANISM', $node ); pubsub.php: if ( $this->debug ) $this->log ( " found " . $elements->length . " matching MECHANISM nodes "); pubsub.php: $auth_mech[] = $e->nodeValue; pubsub.php: $this->sendQueue[] = "" . base64_encode("\x00" . preg_replace('/@.*$/','',$this->jid) . "\x00" . $this->password) . ""; pubsub.php: elseif ( in_array ( 'DIGEST-MD5', $auth_mech ) ) // this code and the associated function are UNTESTED pubsub.php: $this->sendQueue[] = ""; pubsub.php: $this->recvHandlers['challenge'] = 'digestAuth' ; pubsub.php: $this->recvHandlers['success'] = 'handleSuccess' ; pubsub.php: $elements = $this->query ( '*/BIND', $node ); pubsub.php: if ( ! is_null ( $elements ) && $elements->length > 0 ) pubsub.php: if ( $this->debug ) $this->log ( " found " . $elements->length . " matching BIND nodes "); pubsub.php: $this->ready = true; pubsub.php: stream_set_blocking ( $this->connection, true ); pubsub.php: stream_socket_enable_crypto ( $this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT ); pubsub.php: stream_set_blocking ( $this->connection, false ); pubsub.php: $this->sendQueue[] = "<"."?xml version=\"1.0\"?".">\n\n"; pubsub.php: // this code is based solely on the description found @ http://web.archive.org/web/20050224191820/http://cataclysm.cx/wip/digest-md5-crash.html pubsub.php: $contents = $node->nodeValue; pubsub.php: if ( $challenge['realm'] == $this->server ) // might fail need to handle a response with multiple realms pubsub.php: $X = md5 ( preg_replace('/@.*$/','',$this->jid) . ':' . $this->server . ':' . $this->password, true ); pubsub.php: $HA1 = md5 ( $X . ':' . $challenge['nonce'] . ':' . $cnonce . ':' . $this->jid . $this->resource ); pubsub.php: $HA2 = md5 ( "AUTHENTICATE:xmpp/" . $this->server ); pubsub.php: $this->sendQueue[] = "" . pubsub.php: base64_encode("username=\"" . preg_replace('/@.*$/','',$this->jid) . "\"," . pubsub.php: "realm=\"" . $this->server . "\",nonce=\"" . $challenge['nonce'] . "\",cnonce=\"". $cnonce . "\"," . pubsub.php: "nc=00000001,qop=auth,digest-uri=\"xmpp/" . $this->server . "\",response=" . $resp . pubsub.php: ",charset=utf-8,authzid=\"". $this->jid . $this->resource . "\"" ) . "" // note the PID component to the resource, just incase pubsub.php: $this->sendQueue[] = "" ; pubsub.php: $this->loggedIn = true; pubsub.php: $this->sendQueue[] = "<"."?xml version=\"1.0\"?".">\n\n"; pubsub.php: $this->sendQueue[] = "" . preg_replace('/^\//','',$this->resource) . ""; pubsub.php: $this->recvHandlers['stream:error'] = 'handleError' ; pubsub.php: $this->recvHandlers['iq'] = 'handleIq' ; pubsub.php: $this->recvHandlers['message'] = 'handleMessage' ; pubsub.php: $this->mesgcount = 1; pubsub.php: if ( $this->debug ) $this->log ( "Handle IQ id:" . $node->getAttribute ( 'id' ) . ' type:' . $node->getAttribute ( 'type' ) . ""); pubsub.php: if ( $node->getAttribute ( 'type' ) == 'result' || $node->getAttribute ( 'type' ) == 'error' ) pubsub.php: $commandId = $node->getAttribute ( 'id' ); pubsub.php: $this->command[$commandId] = true; pubsub.php: if ( isset ( $this->handleCommand[$commandId] ) ) pubsub.php: $this->finishedCommands[$commandId] = true; pubsub.php: if ( method_exists ( $this, $this->handleCommand[$commandId] ) ) pubsub.php: call_user_func_array ( array ( $this, $this->handleCommand[$commandId] ), array ( &$node ) ); pubsub.php: call_user_func_array ( $this->handleCommand[$commandId], array ( &$node ) ); pubsub.php: if ( $node->getAttribute ( 'id' ) == $this->mesgcount && $this->mesgcount < 3 ) pubsub.php: $this->sendQueue[] = ""; pubsub.php: $this->sendQueue[] = ""; pubsub.php: if ( $node->getAttribute ( 'id' ) == '2' && $this->command['2'] == true ) pubsub.php: $this->nextreply = $this->mesgcount++; pubsub.php: $this->sendQueue[] = "" . $this->status . ''; pubsub.php: $this->ready = true; pubsub.php: if ( $node->getAttribute ( 'type' ) == 'chat' ) pubsub.php: $this->command[$node->getAttribute ( 'id' )] = true; pubsub.php: $elements = $this->query ( '//*/body', $node ); pubsub.php: if ( 0 < $elements->length ) pubsub.php: $temp = $elements->items(0); pubsub.php: if ( $this->debug ) $this->log ( "received message " . $temp->nodeValue ); pubsub.php: $this->log ( 'STREAM ERROR OCCURRED! XMPP closing connection, this is probably a bug' ); pubsub.php: $this->idle = false; pubsub.php: $this->close (); pubsub.php: $msg = $this->mesgcount++; pubsub.php: $send = ""; pubsub.php: $this->handleCommand[$msg] = 'discoResult'; pubsub.php: $this->sendQueue[] = $send; pubsub.php: $this->go(); pubsub.php: if ( $this->debug ) $this->log ( $node->ownerDocument->saveXML($node) ); pubsub.php: $id = $node->getAttribute ( 'id' ); pubsub.php: $identity = $this->query ( '*/IDENTITY', $node ); pubsub.php: if ( @is_array ( $this->pubsub [ 'create' ] [ $id ] ) && 0 == $identity->length ) pubsub.php: $this->pubsubCreateNode( $this->pubsub [ 'create' ] [ $id ] [ 0 ], pubsub.php: $this->pubsub [ 'create' ] [ $id ] [ 1 ], pubsub.php: $this->pubsub [ 'create' ] [ $id ] [ 2 ], pubsub.php: $this->pubsub [ 'create' ] [ $id ] [ 3 ] ); pubsub.php: $msg = $this->mesgcount++; pubsub.php: $out .= ""; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->go(); pubsub.php: $to = 'pubsub.' . $this->server; pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $this->pubsub['create'][$this->mesgcount+1] = array ( $to, $type, $name, $configure ); pubsub.php: $this->disco ( $to, 'info', $node ); pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $msg = $this->mesgcount++; pubsub.php: $out = ''; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; pubsub.php: $this->go(); pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $msg = $this->mesgcount++; pubsub.php: $out = ''; pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->go(); pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $msg = $this->mesgcount++; pubsub.php: $out = ''; pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->go(); pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $msg = $this->mesgcount++; pubsub.php: $out = ''; pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->go(); pubsub.php: $to = 'pubsub.' . $this->server; pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $msg = $this->mesgcount++; pubsub.php: $out = ''; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; pubsub.php: $this->go(); pubsub.php: $msg = $this->mesgcount++; pubsub.php: if ( 'hometree' == $this->pubsubLayout ) pubsub.php: $node = '/home/' . $this->server . '/' . $this->username . $name; pubsub.php: $out = ''; pubsub.php: $out .= ''; pubsub.php: $this->sendQueue[] = $out; pubsub.php: $this->handleCommand[ $msg ] = 'pubsubResult'; pubsub.php: $this->go(); pubsub.php: if ( $this->debug ) $this->log ( "pubsub RESULT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); pubsub.php: if ( $node->getAttribute ( 'type' ) == 'error' ) pubsub.php: $errnode = $this->query ( 'ERROR', $node ); pubsub.php: if ( $errnode->length > 0 && ( '403' == $errnode->item( 0 )->getAttribute ( 'code' ) || '500' == $errnode->item( 0 )->getAttribute ( 'code' ) ) ) pubsub.php: if ( 'CREATE' == $node->firstChild->firstChild->tagName ) pubsub.php: $pubnode = $node->firstChild->firstChild->getAttribute ( 'node' ); pubsub.php: if ( $this->debug ) $this->log ( "403 error during CREATE for node '" . $pubnode . "' "); pubsub.php: $name = preg_replace ( '/^.*?\/' . $this->username . '\//','', $pubnode ); pubsub.php: if ( ! in_array ( 'create', $this->pubsubNext ) ) pubsub.php: 'to' => $node->getAttribute ( 'from' ), pubsub.php: array_unshift ( $this->pubsubNext, $v ); pubsub.php: $this->pubsubDoNext ( ); pubsub.php: elseif ( $errnode->length > 0 && '404' == $errnode->item( 0 )->getAttribute ( 'code' ) ) pubsub.php: if ( 'PUBLISH' == $node->firstChild->firstChild->tagName ) pubsub.php: $pubnode = $node->firstChild->firstChild->getAttribute ( 'node' ); pubsub.php: if ( $this->debug ) $this->log ( "404 error during PUBLISH for node '" . $pubnode . "' "); pubsub.php: $publish = $this->query ( '//*/PUBLISH', $node ); pubsub.php: $this->pubsubNext[] = array ( pubsub.php: 'to' => $node->getAttribute ( 'from' ), pubsub.php: 'name' => preg_replace ( '/^.*?\/' . $this->username . '/','', $pubnode ) , pubsub.php: 'contents' => $publish->item( 0 )->firstChild->nodeValue ); pubsub.php: if ( $this->debug ) $this->log ( "attempting to create node '" . $this->pubsubNext[0]['name'] . "' "); pubsub.php: $this->pubsubCreateNode ( $node->getAttribute ( 'from' ) ,'set', preg_replace ( '/^.*?\/' . $this->username . '/','', $pubnode ) ); pubsub.php: elseif ( $errnode->length > 0 && '409' == $errnode->item( 0 )->getAttribute ( 'code' ) ) pubsub.php: if ( 'CANCEL' == $errnode->item( 0 )->firstChild->tagName || 'CONFLICT' == $errnode->item( 0 )->firstChild->tagName ) pubsub.php: $this->pubsubDoNext ( ); pubsub.php: elseif ( 0 < count ( $this->pubsubNext ) ) pubsub.php: $this->pubsubDoNext ( ); pubsub.php: if ( 0 < count ( $this->pubsubNext ) ) pubsub.php: $pub = array_shift ( $this->pubsubNext ); pubsub.php: if ( $this->debug ) $this->log ( "attempting to publish to node '" . $pub['name'] . "' contents '" . $pub['contents'] . "'"); pubsub.php: $this->pubsubPublish ( $pub[$to], 'set', $pub['name'], $pub['contents'] ); pubsub.php: if ( $this->debug ) $this->log ( "attempting to create node '" . $pub['name'] . "' "); pubsub.php: $this->pubsubCreateNode ( $pub[$to], 'set', $pub['name'] ); pubsub.php: $this->loggedIn = false; pubsub.php: $this->streamTagBegin = '<'."?xml version='1.0'?".">"; pubsub.php: $this->streamTagEnd = ''; pubsub.php: $this->sendQueue[] = $this->streamTagBegin; pubsub.php: $this->recvHandlers['stream:features'] = 'handleFeatures' ; pubsub.php: $this->recvHandlers['features'] = 'handleFeatures' ; pubsub.php: $this->recvHandlers['proceed'] = 'enableTLS' ; pubsub.php: if ( $this->debug ) $this->log ( "SEND: $data"); pubsub.php: if ( false !== $this->connection ) pubsub.php: if ( fwrite ( $this->connection, $data, $len) === $len ) pubsub.php: if ( false !== $this->connection ) pubsub.php: $data = fgets ( $this->connection, 4096 ); pubsub.php: while ( 0 != strlen ( $moredata = fgets ( $this->connection, 1024 ) ) && 20 < $count++ ) pubsub.php: $this->stream .= $data; pubsub.php: if ( $this->debug ) $this->log ( "RECV: $data" ); pubsub.php: $this->recvQueue = implode ( '', $this->sendQueue ); pubsub.php: $this->moredata = false; pubsub.php: while ( false !== $this->connection ) pubsub.php: if ( 0 < count ( $this->sendQueue ) ) pubsub.php: while ( $data = array_shift ( $this->sendQueue ) ) pubsub.php: $this->send ( $data ); pubsub.php: $data = $this->recv ( ); pubsub.php: xml_parse ( $this->xmlparser, $data, false ); pubsub.php: while ( $rnode = array_shift ( $this->recvTags ) ) pubsub.php: $rname = strtolower ( $rnode->localName ); pubsub.php: if ( $this->debug ) $this->log ( " processing $rname "); pubsub.php: if ( isset ( $this->recvHandlers[$rname] ) ) //&& is_callable ( $this->recvHandlers[$r->name] ) ) pubsub.php: if ( method_exists ( $this, $this->recvHandlers[$rname] ) ) pubsub.php: call_user_func_array ( array ( $this, $this->recvHandlers[$rname] ), array ( &$rnode ) ); pubsub.php: call_user_func_array ( $this->recvHandlers[$rname], array ( &$rnode ) ); pubsub.php: if ( $this->idle === true ) pubsub.php: if ( $this->ready == true && count ( $this->handleCommand ) <= count ( $this->command ) ) pubsub.php: $this->depth++; pubsub.php: $this->processDepth++; pubsub.php: if ( strlen ( $matches[1] ) > 0 && ! isset ( $this->namespaces [ $matches[1] ] ) ) pubsub.php: $this->xquery->registerNamespace ( $matches[1], $v ); pubsub.php: $this->namespaces [ $matches[1] ] = $v; pubsub.php: if ( $this->debug ) $this->log ( " adding namespace $k => $v "); pubsub.php: $node = $this->doc->createElementNS ( $namespace, $name ); pubsub.php: $node = $this->doc->createElement ( $name ); pubsub.php: $node->setAttribute ( strtolower ( $k ), $v ); pubsub.php: $this->currentXMLNode = $this->currentXMLNode->appendChild ( $node ); pubsub.php: $this->depth--; pubsub.php: //if ( $this->debug ) $this->log ( "depth: " . $this->depth . " processDepth: " . $this->processDepth . " "); pubsub.php: if ( $this->depth == $this->processDepth || 'STREAM:STREAM' == $name || 'STREAM:FEATURES' == $name || 'PROCEED' == $name ) pubsub.php: if ( $this->debug ) $this->log ( " adding $name to tags to process "); pubsub.php: array_push ( $this->recvTags, $this->currentXMLNode ); // replace with tag pubsub.php: $this->currentXMLNode = $this->currentXMLNode->parentNode; pubsub.php: $this->currentXMLNode->appendChild ( $this->doc->createTextNode ( $text ) ); pubsub.php: $this->depth = 0; pubsub.php: $this->xmlparser = xml_parser_create ( ); pubsub.php: xml_set_object ( $this->xmlparser, $this ); pubsub.php: xml_set_element_handler ( $this->xmlparser, 'startElement', 'endElement' ); pubsub.php: xml_set_character_data_handler ( $this->xmlparser, 'parseData' ); pubsub.php: $this->doc = new DOMDocument (); pubsub.php: $this->xquery = new DOMXpath ( $this->doc ); pubsub.php: $this->xquery->registerNamespace ( 'stream', 'http://etherx.jabber.org/streams' ); pubsub.php: $this->currentXMLNode = $this->doc->appendChild ( $this->doc->createElement ( 'start' ) ); pubsub.php: return $this->xquery->query ( $expression ); pubsub.php: return $this->xquery->query ( $expression , $node ); pubsub.php: $this->jid = $jid; pubsub.php: $this->password = $password; pubsub.php: $this->ready = false; pubsub.php: if ( false !== $this->connect () ) pubsub.php: $this->go (); pubsub.php: if ( false !== $this->connection ) pubsub.php: $this->send ( ''); pubsub.php: fclose ( $this->connection ); pubsub.php: $this->connection = false; pubsub.php: $this->sendHandler[$command] = $handler; pubsub.php: $this->recvHandler[$command] = $handler; pubsub.php: $t->tls = 'none'; pubsub.php: $t->idle = false; pubsub.php: if ( 1 == $c->dbg["ALL"] || 1 == $c->dbg["push"] ) pubsub.php: $t->debug = true ; pubsub.php: $t->debug = false ; pubsub.php: $t->pubsubLayout = 'flat'; pubsub.php: $qry->Exec('pubsub'); pubsub.php: $row = $qry->Fetch(); pubsub.php: $t->open ( $c->notifications_server['jid'], $c->notifications_server['password'] ); pubsub.php: if ( isset ( $c->notifications_server['debug_jid'] ) ) pubsub.php: $t->sendMessage ( $c->notifications_server['debug_jid'], "ACTION: $action_type\nUSER: $user_no\nDAV NAME: $dav_name\nPRINCIPAL ID: " . $row->principal_id ); pubsub.php: $t->pubsubCreate ( '', 'set', '/davical-' . $row->principal_id, 'http://jabber.org/protocol/pubsub#node_configopenplist-apple' ); pubsub.php: $t->pubsubPublish ( '', 'set', '/davical-' . $row->principal_id , 'davical' . $uid . '', $uid ); pubsub.php: $t->close(); RRule.php: /**#@-*/ RRule.php: $this->_text = $input->_text; RRule.php: $this->_epoch = $input->_epoch; RRule.php: $this->_yy = $input->_yy; RRule.php: $this->_mo = $input->_mo; RRule.php: $this->_dd = $input->_dd; RRule.php: $this->_hh = $input->_hh; RRule.php: $this->_mi = $input->_mi; RRule.php: $this->_ss = $input->_ss; RRule.php: $this->_tz = $input->_tz; RRule.php: $this->_wkst = 1; // Monday RRule.php: $this->SetLocalDate($input); RRule.php: $this->SetGMTDate($input); RRule.php: $this->SetLocalDate(strtotime($input)); RRule.php: $this->SetEpochDate($input); RRule.php: $this->_text = $input; RRule.php: $this->_PartsFromText(); RRule.php: $this->_GMTEpochFromParts(); RRule.php: $this->_text = $input; RRule.php: $this->_PartsFromText(); RRule.php: $this->_EpochFromParts(); RRule.php: $this->_epoch = intval($input); RRule.php: $this->_TextFromEpoch(); RRule.php: $this->_PartsFromText(); RRule.php: $this->_text = date('Ymd\THis', $this->_epoch ); RRule.php:// dbg_error_log( "RRule", " Text %s from epoch %d", $this->_text, $this->_epoch ); RRule.php: $this->_text = gmdate('Ymd\THis', $this->_epoch ); RRule.php:// dbg_error_log( "RRule", " Text %s from epoch %d", $this->_text, $this->_epoch ); RRule.php: $this->_yy = intval(substr($this->_text,0,4)); RRule.php: $this->_mo = intval(substr($this->_text,4,2)); RRule.php: $this->_dd = intval(substr($this->_text,6,2)); RRule.php: $this->_hh = intval(substr($this->_text,9,2)); RRule.php: $this->_mi = intval(substr($this->_text,11,2)); RRule.php: $this->_ss = intval(substr($this->_text,13,2)); RRule.php: $this->_epoch = gmmktime ( $this->_hh, $this->_mi, $this->_ss, $this->_mo, $this->_dd, $this->_yy ); RRule.php:// dbg_error_log( "RRule", " Epoch %d from %04d-%02d-%02d %02d:%02d:%02d", $this->_epoch, $this->_yy, $this->_mo, $this->_dd, $this->_hh, $this->_mi, $this->_ss ); RRule.php: $this->_epoch = mktime ( $this->_hh, $this->_mi, $this->_ss, $this->_mo, $this->_dd, $this->_yy ); RRule.php:// dbg_error_log( "RRule", " Epoch %d from %04d-%02d-%02d %02d:%02d:%02d", $this->_epoch, $this->_yy, $this->_mo, $this->_dd, $this->_hh, $this->_mi, $this->_ss ); RRule.php: $this->_wkst = $ical_weekdays[$weekstart]; RRule.php: function Render( $fmt = 'Y-m-d H:i:s' ) { RRule.php: return date( $fmt, $this->_epoch ); RRule.php: return gmdate( $fmt, $this->_epoch ); RRule.php: * No of days in a month 1(Jan) - 12(Dec) RRule.php: if ( $mo === false ) $mo = $this->_mo; RRule.php: if ( $yy === false ) $yy = $this->_yy; RRule.php: if ( $dd == $this->_dd ) return; // Shortcut RRule.php: $dd = min($dd,$this->DaysInMonth()); RRule.php: $this->_dd = $dd; RRule.php: $this->_EpochFromParts(); RRule.php: $this->_TextFromEpoch(); RRule.php:// dbg_error_log( "RRule", " Adding %d months to %s", $mo, $this->_text ); RRule.php: $this->_mo += $mo; RRule.php: while ( $this->_mo < 1 ) { RRule.php: $this->_mo += 12; RRule.php: $this->_yy--; RRule.php: while ( $this->_mo > 12 ) { RRule.php: $this->_mo -= 12; RRule.php: $this->_yy++; RRule.php: if ( ($this->_dd > 28 && $this->_mo == 2) || $this->_dd > 30 ) { RRule.php: $dim = $this->DaysInMonth(); RRule.php: if ( $this->_dd > $dim ) { RRule.php: $this->_dd = $dim; RRule.php: $this->_EpochFromParts(); RRule.php: $this->_TextFromEpoch(); RRule.php:// dbg_error_log( "RRule", " Added %d months and got %s", $mo, $this->_text ); RRule.php: $at_start = $this->_text; RRule.php: $this->_dd += $dd; RRule.php: while ( 1 > $this->_dd ) { RRule.php: $this->_mo--; RRule.php: if ( $this->_mo < 1 ) { RRule.php: $this->_mo += 12; RRule.php: $this->_yy--; RRule.php: $this->_dd += $this->DaysInMonth(); RRule.php: while ( ($dim = $this->DaysInMonth($this->_mo)) < $this->_dd ) { RRule.php: $this->_dd -= $dim; RRule.php: $this->_mo++; RRule.php: if ( $this->_mo > 12 ) { RRule.php: $this->_mo -= 12; RRule.php: $this->_yy++; RRule.php: $this->_EpochFromParts(); RRule.php: $this->_TextFromEpoch(); RRule.php:// dbg_error_log( "RRule", " Added %d days to %s and got %s", $dd, $at_start, $this->_text ); RRule.php: $sign = ( $sign == "-" ? -1 : 1); RRule.php:// dbg_error_log( "RRule", " Adding duration to '%s' of sign: %d, days: %s, time: %s", $this->_text, $sign, $days, $time ); RRule.php: $this->AddDays( $days * $sign ); RRule.php:// dbg_error_log( "RRule", " Adding %02d:%02d:%02d * %d to %02d:%02d:%02d", $hh, $mi, $ss, $sign, $this->_hh, $this->_mi, $this->_ss ); RRule.php: $this->_hh += ($hh * $sign); RRule.php: $this->_mi += ($mi * $sign); RRule.php: $this->_ss += ($ss * $sign); RRule.php: if ( $this->_ss < 0 ) { $this->_mi -= (intval(abs($this->_ss/60))+1); $this->_ss += ((intval(abs($this->_mi/60))+1) * 60); } RRule.php: if ( $this->_ss > 59) { $this->_mi += (intval(abs($this->_ss/60))+1); $this->_ss -= ((intval(abs($this->_mi/60))+1) * 60); } RRule.php: if ( $this->_mi < 0 ) { $this->_hh -= (intval(abs($this->_mi/60))+1); $this->_mi += ((intval(abs($this->_mi/60))+1) * 60); } RRule.php: if ( $this->_mi > 59) { $this->_hh += (intval(abs($this->_mi/60))+1); $this->_mi -= ((intval(abs($this->_mi/60))+1) * 60); } RRule.php: if ( $this->_hh < 0 ) { $this->AddDays( -1 * (intval(abs($this->_hh/24))+1) ); $this->_hh += ((intval(abs($this->_hh/24))+1)*24); } RRule.php: if ( $this->_hh > 23) { $this->AddDays( (intval(abs($this->_hh/24))+1) ); $this->_hh -= ((intval(abs($this->_hh/24))+1)*24); } RRule.php: $this->_EpochFromParts(); RRule.php: $this->_TextFromEpoch(); RRule.php: if ( $from->_epoch < $this->_epoch ) { RRule.php: return( "-". $from->DateDifference( $self ) ); RRule.php:// if ( $from->_yy == $this->_yy && $from->_mo == $this->_mo ) { RRule.php: $diff = $from->_epoch - $this->_epoch; RRule.php:* ==> This code is not needed then :-) RRule.php: $yy = $from->_yy - $this->_yy; RRule.php: $mo = $from->_mo - $this->_mo; RRule.php: $dd = $from->_dd - $this->_dd; RRule.php: $hh = $from->_hh - $this->_hh; RRule.php: $mi = $from->_mi - $this->_mi; RRule.php: $ss = $from->_ss - $this->_ss; RRule.php: if ( $ss < 0 ) { $mi -= 1; $ss += 60; } RRule.php: if ( $mi < 0 ) { $hh -= 1; $mi += 60; } RRule.php: if ( $hh < 0 ) { $dd -= 1; $hh += 24; } RRule.php: if ( $dd < 0 ) { $mo -= 1; $dd += $this->DaysInMonth(); } // Which will use $this->_(mo|yy) - seemingly sensible RRule.php: if ( $mo < 0 ) { $yy -= 1; $mo += 12; } RRule.php: * @param string $monthlist A comma-separated list of months. RRule.php:// dbg_error_log( "RRule", " Testing BYMONTH %s against month %d", (isset($monthlist) ? $monthlist : "no month list"), $this->_mo ); RRule.php: return isset($months[$this->_mo]); RRule.php: $days_in_month = $this->DaysInMonth(); RRule.php: $first_dow = (date('w',$this->_epoch) - $this->_dd + 36) % 7; RRule.php: $days = $this->MonthDays($first_dow,$days_in_month,$v); RRule.php: $days_in_month = $this->DaysInMonth(); RRule.php: $dow = date('w',$this->_epoch); RRule.php: $dd = $this->_dd - $dow + $daynum; RRule.php: if ( $daynum < $this->_wkst ) $dd += 7; RRule.php: if ( $dd > $this->_dd || !$increasing ) $set[$dd] = $dd; RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $lesser->_text ); RRule.php: return ( $this->_text > $lesser->_text ); RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $lesser ); RRule.php: return ( $this->_text > $lesser ); // These sorts of dates are designed that way... RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $greater->_text ); RRule.php: return ( $this->_text < $greater->_text ); RRule.php:// dbg_error_log( "RRule", " Comparing %s with %s", $this->_text, $greater ); RRule.php: return ( $this->_text < $greater ); // These sorts of dates are designed that way... RRule.php: * Given a MonthDays string like "1MO", "-2WE" return an integer day of the month. RRule.php: preg_match( '/([0-9-]*)(MO|TU|WE|TH|FR|SA|SU)/', $dayspec, $matches); RRule.php: $first_matching_day = 1 + ($dow - $dow_first); RRule.php: $numeric--; RRule.php: * Given set position descriptions like '1', '3', '11', '-3' or '-1' and a set, RRule.php: $positions = explode( '[^0-9-]', $bysplist ); RRule.php: $v--; RRule.php: ( ";" x-name "=" text ) RRule.php: enddate =/ date-time ;An UTC value RRule.php: minus = "-" RRule.php: /**#@-*/ RRule.php: $this->_first = new iCalDate($start); RRule.php: $this->_finished = false; RRule.php: $this->_started = false; RRule.php: $this->_dates = array(); RRule.php: $this->_current = -1; RRule.php: $this->_rule = preg_replace( '/\s/m', '', $rrule); RRule.php: if ( substr($this->_rule, 0, 6) == 'RRULE:' ) { RRule.php: $this->_rule = substr($this->_rule, 6); RRule.php: dbg_error_log( "RRule", " new RRule: Start: %s, RRULE: %s", $start->Render(), $this->_rule ); RRule.php: $parts = explode(';',$this->_rule); RRule.php: $this->_part = array( 'INTERVAL' => 1 ); RRule.php: $this->_part[$type] = $value; RRule.php: if ( !isset($this->_part['FREQ']) ) { RRule.php: if ( isset($this->_part['COUNT']) && isset($this->_part['UNTIL']) ) { RRule.php: if ( isset($this->_part['COUNT']) && intval($this->_part['COUNT']) < 1 ) { RRule.php: if ( !preg_match( '/(YEAR|MONTH|WEEK|DAI)LY/', $this->_part['FREQ']) ) { RRule.php: if ( $this->_part['FREQ'] == "YEARLY" ) { RRule.php: $this->_part['INTERVAL'] *= 12; RRule.php: $this->_part['FREQ'] = "MONTHLY"; RRule.php: $ptr = $this->_current; RRule.php:// dbg_error_log( "RRule", " WithinScope: Processing list of %d days relative to %s", count($relative_days), $base->Render() ); RRule.php: $days_in_month = $test->DaysInMonth(); RRule.php:// dbg_error_log( "RRule", " WithinScope: Testing for day %d based on %s, with %d days in month", $day, $test->Render(), $days_in_month ); RRule.php: $test->SetMonthDay($days_in_month); RRule.php: $test->AddDays(1); RRule.php: $day -= $days_in_month; RRule.php: $test->SetMonthDay($day); RRule.php: $test->SetMonthDay(1); RRule.php: $test->AddDays(-1); RRule.php: $days_in_month = $test->DaysInMonth(); RRule.php: $test->SetMonthDay($day); RRule.php: $test->SetMonthDay($day); RRule.php:// dbg_error_log( "RRule", " WithinScope: Testing if %s is within scope", count($relative_days), $test->Render() ); RRule.php: if ( isset($this->_part['UNTIL']) && $test->GreaterThan($this->_part['UNTIL']) ) { RRule.php: $this->_finished = true; RRule.php: // if ( $this->_current >= 0 && $test->LessThan($this->_dates[$this->_current]) ) continue; RRule.php: if ( !$test->LessThan($this->_first) ) { RRule.php:// dbg_error_log( "RRule", " WithinScope: Looks like %s is within scope", $test->Render() ); RRule.php: if ( isset($this->_part['COUNT']) && $ptr >= $this->_part['COUNT'] ) { RRule.php: $this->_finished = true; RRule.php: if ( $this->_current < 0 ) { RRule.php: $next = new iCalDate($this->_first); RRule.php: $this->_current++; RRule.php: $next = new iCalDate($this->_dates[$this->_current]); RRule.php: $this->_current++; RRule.php: if ( isset($this->_dates[$this->_current]) ) { RRule.php:// dbg_error_log( "RRule", " GetNext: Returning %s, (%d'th)", $this->_dates[$this->_current]->Render(), $this->_current ); RRule.php: return $this->_dates[$this->_current]; RRule.php: if ( isset($this->_part['COUNT']) && $this->_current >= $this->_part['COUNT'] ) // >= since _current is 0-based and COUNT is 1-based RRule.php: $this->_finished = true; RRule.php: if ( $this->_finished ) { RRule.php: if ( isset($this->_part['WKST']) ) $next->SetWeekStart($this->_part['WKST']); RRule.php: if ( $this->_part['FREQ'] == "MONTHLY" ) { RRule.php: $limit--; RRule.php: $limit--; RRule.php: if ( $this->_started ) { RRule.php: $next->AddMonths($this->_part['INTERVAL']); RRule.php: $this->_started = true; RRule.php: while ( isset($this->_part['BYMONTH']) && $limit > 0 && ! $next->TestByMonth($this->_part['BYMONTH']) ); RRule.php: if ( isset($this->_part['BYDAY']) ) { RRule.php: $days = $next->GetMonthByDay($this->_part['BYDAY']); RRule.php: else if ( isset($this->_part['BYMONTHDAY']) ) { RRule.php: $days = $next->GetMonthByMonthDay($this->_part['BYMONTHDAY']); RRule.php: $days[$next->_dd] = $next->_dd; RRule.php: if ( isset($this->_part['BYSETPOS']) ) { RRule.php: $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days); RRule.php: $days = $this->WithinScope( $next, $days); RRule.php: while( $limit && count($days) < 1 && ! $this->_finished ); RRule.php: else if ( $this->_part['FREQ'] == "WEEKLY" ) { RRule.php: $limit--; RRule.php: if ( $this->_started ) { RRule.php: $next->AddDays($this->_part['INTERVAL'] * 7); RRule.php: $this->_started = true; RRule.php: if ( isset($this->_part['BYDAY']) ) { RRule.php: $days = $next->GetWeekByDay($this->_part['BYDAY'], false ); RRule.php: $days[$next->_dd] = $next->_dd; RRule.php: if ( isset($this->_part['BYSETPOS']) ) { RRule.php: $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days); RRule.php: $days = $this->WithinScope( $next, $days); RRule.php: while( $limit && count($days) < 1 && ! $this->_finished ); RRule.php: else if ( $this->_part['FREQ'] == "DAILY" ) { RRule.php: $limit--; RRule.php: if ( $this->_started ) { RRule.php: $next->AddDays($this->_part['INTERVAL']); RRule.php: if ( isset($this->_part['BYDAY']) ) { RRule.php: $days = $next->GetWeekByDay($this->_part['BYDAY'], $this->_started ); RRule.php: $days[$next->_dd] = $next->_dd; RRule.php: if ( isset($this->_part['BYSETPOS']) ) { RRule.php: $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days); RRule.php: $days = $this->WithinScope( $next, $days); RRule.php: $this->_started = true; RRule.php: while( $limit && count($days) < 1 && ! $this->_finished ); RRule.php: $ptr = $this->_current; RRule.php: $this->_dates[$ptr++] = $v; RRule.php: if ( isset($this->_dates[$this->_current]) ) { RRule.php:// dbg_error_log( "RRule", " GetNext: Returning %s, (%d'th)", $this->_dates[$this->_current]->Render(), $this->_current ); RRule.php: return $this->_dates[$this->_current]; RRule-v2.php: $this->tz_defined = false; RRule-v2.php: $this->tz_defined = $dtz; RRule-v2.php: dbg_error_log( 'ERROR', 'Could not parse timezone "%s" - will use floating time', $original ); RRule-v2.php: $this->tz_defined = false; RRule-v2.php: if ( $this->tz_defined === false ) return false; RRule-v2.php: $tzid = $this->getName(); RRule-v2.php: return $this->tz_defined; RRule-v2.php: // public static $Format = 'Y-m-d H:i:s'; RRule-v2.php: $this->is_date = false; RRule-v2.php: if ( preg_match('{;?VALUE=DATE[:;]}', $date, $matches) ) $this->is_date = true; RRule-v2.php: elseif ( preg_match('{:([12]\d{3}) (0[1-9]|1[012]) (0[1-9]|[12]\d|3[01]Z?) $}x', $date, $matches) ) $this->is_date = true; RRule-v2.php: $this->tzid = 'UTC'; RRule-v2.php: $this->tzid = $dtz->tzid(); RRule-v2.php: $this->tzid = null; RRule-v2.php: if ( strlen($matches[1]) == 8 ) $this->is_date = true; RRule-v2.php: $this->tzid = 'UTC'; RRule-v2.php: $this->tzid = null; RRule-v2.php: $this->tzid = $dtz->tzid(); RRule-v2.php: $this->tzid = $dtz->getName(); RRule-v2.php: return (string)parent::format(self::$Format) . ' ' . parent::getTimeZone()->getName(); RRule-v2.php: return $this->format('Ymd'); RRule-v2.php: if ( preg_match('{^(-)?P((\d+)W)?((\d+)D)?T?((\d+)H)?((\d+)M)?((\d+)S)?$}', $interval, $matches) ) { RRule-v2.php:// printf( "Modify '%s' by: >>%s<<\n", $this->__toString(), $interval ); RRule-v2.php: return $this->__toString(); RRule-v2.php: if ( isset($this->tzid) && $this->tzid != 'UTC' ) { RRule-v2.php: $offset = 0 - $dtz->getOffset($gmt); RRule-v2.php: $gmt->modify( $offset . ' seconds' ); RRule-v2.php: if ( $this->is_date ) return $gmt->format('Ymd'); RRule-v2.php: return $gmt->format('Ymd\THis\Z'); RRule-v2.php: if ( isset($this->tzid) && $this->tzid != 'UTC' ) { RRule-v2.php: $result = ';TZID='.$this->tzid; RRule-v2.php: if ( $this->is_date ) { RRule-v2.php: $result .= ';VALUE=DATE:' . $this->format('Ymd'); RRule-v2.php: $result .= ':' . $this->format('Ymd\THis'); RRule-v2.php: if ( isset($this->tzid) && $this->tzid == 'UTC' ) { RRule-v2.php: return sprintf( 'PT%dM', intval(($end_stamp->epoch() - $this->epoch()) / 60) ); RRule-v2.php: $this->tzid = $tz->tzid(); RRule-v2.php: $this->base = ( is_object($basedate) ? $basedate : new RepeatRuleDateTime($basedate) ); RRule-v2.php: if ( preg_match('{FREQ=([A-Z]+)(;|$)}', $rrule, $m) ) $this->freq = $m[1]; RRule-v2.php: if ( preg_match('{UNTIL=([0-9TZ]+)(;|$)}', $rrule, $m) ) $this->until = new RepeatRuleDateTime($m[1]); RRule-v2.php: if ( preg_match('{COUNT=([0-9]+)(;|$)}', $rrule, $m) ) $this->count = $m[1]; RRule-v2.php: if ( preg_match('{INTERVAL=([0-9]+)(;|$)}', $rrule, $m) ) $this->interval = $m[1]; RRule-v2.php: if ( preg_match('{WKST=(MO|TU|WE|TH|FR|SA|SU)(;|$)}', $rrule, $m) ) $this->wkst = $m[1]; RRule-v2.php: if ( preg_match('{BYDAY=(([+-]?[0-9]{0,2}(MO|TU|WE|TH|FR|SA|SU),?)+)(;|$)}', $rrule, $m) ) $this->byday = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYYEARDAY=([0-9,+-]+)(;|$)}', $rrule, $m) ) $this->byyearday = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYWEEKNO=([0-9,+-]+)(;|$)}', $rrule, $m) ) $this->byweekno = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYMONTHDAY=([0-9,+-]+)(;|$)}', $rrule, $m) ) $this->bymonthday = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYMONTH=(([+-]?[0-1]?[0-9],?)+)(;|$)}', $rrule, $m) ) $this->bymonth = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYSETPOS=(([+-]?[0-9]{1,3},?)+)(;|$)}', $rrule, $m) ) $this->bysetpos = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYSECOND=([0-9,]+)(;|$)}', $rrule, $m) ) $this->bysecond = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYMINUTE=([0-9,]+)(;|$)}', $rrule, $m) ) $this->byminute = explode(',',$m[1]); RRule-v2.php: if ( preg_match('{BYHOUR=([0-9,]+)(;|$)}', $rrule, $m) ) $this->byhour = explode(',',$m[1]); RRule-v2.php: if ( !isset($this->interval) ) $this->interval = 1; RRule-v2.php: switch( $this->freq ) { RRule-v2.php: case 'SECONDLY': $this->freq_name = 'second'; break; RRule-v2.php: case 'MINUTELY': $this->freq_name = 'minute'; break; RRule-v2.php: case 'HOURLY': $this->freq_name = 'hour'; break; RRule-v2.php: case 'DAILY': $this->freq_name = 'day'; break; RRule-v2.php: case 'WEEKLY': $this->freq_name = 'week'; break; RRule-v2.php: case 'MONTHLY': $this->freq_name = 'month'; break; RRule-v2.php: case 'YEARLY': $this->freq_name = 'year'; break; RRule-v2.php: $this->frequency_string = sprintf('+%d %s', $this->interval, $this->freq_name ); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Frequency modify string is: '%s', base is: '%s'\n", $this->frequency_string, $this->base->format('c') ); RRule-v2.php: $this->Start(); RRule-v2.php: $this->base->setTimezone(new DateTimeZone($tzstring)); RRule-v2.php: $this->instances = array(); RRule-v2.php: $this->GetMoreInstances(); RRule-v2.php: $this->rewind(); RRule-v2.php: $this->finished = false; RRule-v2.php: $this->position = -1; RRule-v2.php: $this->position++; RRule-v2.php: return $this->current(); RRule-v2.php: if ( !$this->valid() ) return null; RRule-v2.php: if ( !isset($this->instances[$this->position]) ) $this->GetMoreInstances(); RRule-v2.php: if ( !$this->valid() ) return null; RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Returning date from position %d: %s (%s)\n", $this->position, $this->instances[$this->position]->format('c'), $this->instances[$this->position]->UTC() ); RRule-v2.php: return $this->instances[$this->position]; RRule-v2.php: if ( !$this->valid() ) return null; RRule-v2.php: if ( !isset($this->instances[$this->position]) ) $this->GetMoreInstances(); RRule-v2.php: if ( !isset($this->keys[$this->position]) ) { RRule-v2.php: $this->keys[$this->position] = $this->instances[$this->position]; RRule-v2.php: return $this->keys[$this->position]; RRule-v2.php: if ( isset($this->instances[$this->position]) || !$this->finished ) return true; RRule-v2.php: if ( $this->finished ) return; RRule-v2.php: while( !$this->finished && !$got_more && $loops++ < $loop_limit ) { RRule-v2.php: if ( !isset($this->current_base) ) { RRule-v2.php: $this->current_base = clone($this->base); RRule-v2.php: $this->current_base->modify( $this->frequency_string ); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Getting more instances from: '%s' - %d\n", $this->current_base->format('c'), count($this->instances) ); RRule-v2.php: $this->current_set = array( clone($this->current_base) ); RRule-v2.php: foreach( $rrule_expand_limit[$this->freq] AS $bytype => $action ) { RRule-v2.php: if ( isset($this->{$bytype}) ) $this->{$action.'_'.$bytype}(); RRule-v2.php: if ( !isset($this->current_set[0]) ) break; RRule-v2.php: sort($this->current_set); RRule-v2.php: if ( isset($this->bysetpos) ) $this->limit_bysetpos(); RRule-v2.php: $position = count($this->instances) - 1; RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Inserting %d from current_set into position %d\n", count($this->current_set), $position + 1 ); RRule-v2.php: foreach( $this->current_set AS $k => $instance ) { RRule-v2.php: if ( $instance < $this->base ) continue; RRule-v2.php: if ( isset($this->until) && $instance > $this->until ) { RRule-v2.php: $this->finished = true; RRule-v2.php: if ( !isset($this->instances[$position]) || $instance != $this->instances[$position] ) { RRule-v2.php: $this->instances[$position] = $instance; RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Added date %s into position %d in current set\n", $instance->format('c'), $position ); RRule-v2.php: if ( isset($this->count) && ($position + 1) >= $this->count ) $this->finished = true; RRule-v2.php: $date_parts = explode(',',$date->format('Y,m,d,H,i,s')); RRule-v2.php: $tz = $date->getTimezone(); RRule-v2.php: $date->setDate( $date_parts[0], $date_parts[1], $date_parts[2] ); RRule-v2.php: $date->setTime( $date_parts[3], $date_parts[4], $date_parts[5] ); RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->bymonth AS $k => $month ) { RRule-v2.php: $expanded = $this->date_mask( clone($instance), null, $month, null, null, null, null); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYMONTH $month into date %s\n", $expanded->format('c') ); RRule-v2.php: $this->current_set[] = $expanded; RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->bymonthday AS $k => $monthday ) { RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, $monthday, null, null, null); RRule-v2.php: $dow_of_instance = $day_in_week->format('w'); // 0 == Sunday RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { RRule-v2.php: $offset = $dow - $dow_of_instance; RRule-v2.php: $expanded->modify( sprintf('+%d day', $offset) ); RRule-v2.php: $this->current_set[] = $expanded; RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(W) $weekday into date %s\n", $expanded->format('c') ); RRule-v2.php: $first_of_month = $this->date_mask( clone($day_in_month), null, null, 1, null, null, null); RRule-v2.php: $dow_of_first = $first_of_month->format('w'); // 0 == Sunday RRule-v2.php: $days_in_month = cal_days_in_month(CAL_GREGORIAN, $first_of_month->format('m'), $first_of_month->format('Y')); RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { RRule-v2.php: if ( preg_match('{([+-])?(\d)?(MO|TU|WE|TH|FR|SA|SU)}', $weekday, $matches ) ) { RRule-v2.php: $first_dom = 1 + $dow - $dow_of_first; if ( $first_dom < 1 ) $first_dom +=7; // e.g. 1st=WE, dow=MO => 1+1-3=-1 => MO is 6th, etc. RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanding BYDAY(M) $weekday in month of %s\n", $instance->format('c') ); RRule-v2.php: $whichweek--; RRule-v2.php: if ( $matches[1] == '-' ) { RRule-v2.php: while( $monthday > $days_in_month ) $monthday -= 7; RRule-v2.php: $monthday -= (7 * $whichweek); RRule-v2.php: $expanded = $this->date_mask( clone($day_in_month), null, null, $monthday, null, null, null); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(M) $weekday now $monthday into date %s\n", $expanded->format('c') ); RRule-v2.php: $this->current_set[] = $expanded; RRule-v2.php: $expanded = $this->date_mask( clone($day_in_month), null, null, $monthday, null, null, null); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(M) $weekday now $monthday into date %s\n", $expanded->format('c') ); RRule-v2.php: $this->current_set[] = $expanded; RRule-v2.php: $first_of_year = $this->date_mask( clone($day_in_year), null, 1, 1, null, null, null); RRule-v2.php: $dow_of_first = $first_of_year->format('w'); // 0 == Sunday RRule-v2.php: $days_in_year = 337 + cal_days_in_month(CAL_GREGORIAN, 2, $first_of_year->format('Y')); RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { RRule-v2.php: if ( preg_match('{([+-])?(\d)?(MO|TU|WE|TH|FR|SA|SU)}', $weekday, $matches ) ) { RRule-v2.php: $first_doy = 1 + $dow - $dow_of_first; if ( $first_doy < 1 ) $first_doy +=7; // e.g. 1st=WE, dow=MO => 1+1-3=-1 => MO is 6th, etc. RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanding BYDAY(Y) $weekday from date %s\n", $instance->format('c') ); RRule-v2.php: $whichweek--; RRule-v2.php: if ( $matches[1] == '-' ) { RRule-v2.php: while( $yearday > $days_in_year ) $yearday -= 7; RRule-v2.php: $yearday -= (7 * $whichweek); RRule-v2.php: $expanded->modify(sprintf('+%d day', $yearday - 1)); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(Y) $weekday now $yearday into date %s\n", $expanded->format('c') ); RRule-v2.php: $this->current_set[] = $expanded; RRule-v2.php: $expanded->modify(sprintf('+%d day', $first_doy - 1)); RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Expanded BYDAY(Y) $weekday now $yearday into date %s\n", $expanded->format('c') ); RRule-v2.php: $this->current_set[] = clone($expanded); RRule-v2.php: $expanded->modify('+1 week'); RRule-v2.php: if ( !isset($this->current_set[0]) ) return; RRule-v2.php: if ( $this->freq == 'MONTHLY' || $this->freq == 'YEARLY' ) { RRule-v2.php: if ( isset($this->bymonthday) || isset($this->byyearday) ) { RRule-v2.php: $this->limit_byday(); /** Per RFC5545 3.3.10 from note 1&2 to table */ RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: if ( $this->freq == 'MONTHLY' ) { RRule-v2.php: $this->expand_byday_in_month($instance); RRule-v2.php: else if ( $this->freq == 'WEEKLY' ) { RRule-v2.php: $this->expand_byday_in_week($instance); RRule-v2.php: if ( isset($this->bymonth) ) { RRule-v2.php: $this->expand_byday_in_month($instance); RRule-v2.php: else if ( isset($this->byweekno) ) { RRule-v2.php: $this->expand_byday_in_week($instance); RRule-v2.php: $this->expand_byday_in_year($instance); RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->bymonth AS $k => $month ) { RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, null, $hour, null, null); RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->bymonth AS $k => $month ) { RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, null, null, $minute, null); RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->bymonth AS $k => $second ) { RRule-v2.php: $this->current_set[] = $this->date_mask( clone($instance), null, null, null, null, null, $second); RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->{$element_name} AS $k => $element_value ) { RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Limiting '$fmt_char' on '%s' => '%s' ?=? '%s' ? %s\n", $instance->format('c'), $instance->format($fmt_char), $element_value, ($instance->format($fmt_char) == $element_value ? 'Yes' : 'No') ); RRule-v2.php: if ( $instance->format($fmt_char) == $element_value ) $this->current_set[] = $instance; RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->byday AS $k => $weekday ) { RRule-v2.php: if ( $GLOBALS['debug_rrule'] ) printf( "Limiting '$fmt_char' on '%s' => '%s' ?=? '%s' (%d) ? %s\n", $instance->format('c'), $instance->format($fmt_char), $weekday, $dow, ($instance->format($fmt_char) == $dow ? 'Yes' : 'No') ); RRule-v2.php: if ( $instance->format($fmt_char) == $dow ) $this->current_set[] = $instance; RRule-v2.php: private function limit_bymonth() { $this->limit_generally( 'm', 'bymonth' ); } RRule-v2.php: private function limit_byyearday() { $this->limit_generally( 'z', 'byyearday' ); } RRule-v2.php: private function limit_bymonthday() { $this->limit_generally( 'd', 'bymonthday' ); } RRule-v2.php: private function limit_byhour() { $this->limit_generally( 'H', 'byhour' ); } RRule-v2.php: private function limit_byminute() { $this->limit_generally( 'i', 'byminute' ); } RRule-v2.php: private function limit_bysecond() { $this->limit_generally( 's', 'bysecond' ); } RRule-v2.php: $instances = $this->current_set; RRule-v2.php: $this->current_set = array(); RRule-v2.php: foreach( $this->bysetpos AS $k => $element_value ) { RRule-v2.php: $this->current_set[] = $instances[$element_value - 1]; RRule-v2.php: $this->current_set[] = $instances[$count + $element_value]; RRule-v2.php: $properties = $component->GetProperties($property); RRule-v2.php: $timezone = $p->GetParameterValue('TZID'); RRule-v2.php: $rdate = $p->Value(); RRule-v2.php: $expansion[$rdate->UTC()] = $component; RRule-v2.php: $recur = $component->GetProperty($property); RRule-v2.php: $recur = $recur->Value(); RRule-v2.php: $this_start = $component->GetProperty('DTSTART'); RRule-v2.php: $timezone = $this_start->GetParameterValue('TZID'); RRule-v2.php: $this_start = new RepeatRuleDateTime($this_start->Value(),$timezone); RRule-v2.php: while( $date = $rule->next() ) { RRule-v2.php:// printf( "[%3d] %s\n", $i, $date->UTC() ); RRule-v2.php: $expansion[$date->UTC()] = $component; RRule-v2.php:* @param object $range_start A RepeatRuleDateTime which is the beginning of the range for events, default -6 weeks RRule-v2.php: $components = $vResource->GetComponents(); RRule-v2.php: if ( !isset($range_start) ) { $range_start = new RepeatRuleDateTime(); $range_start->modify('-6 weeks'); } RRule-v2.php: if ( !isset($range_end) ) { $range_end = clone($range_start); $range_end->modify('+6 months'); } RRule-v2.php: if ( $comp->GetType() != 'VEVENT' && $comp->GetType() != 'VTODO' && $comp->GetType() != 'VJOURNAL' ) { RRule-v2.php: $dtstart = $comp->GetProperty('DTSTART'); RRule-v2.php: $tzid = $dtstart->GetParameterValue('TZID'); RRule-v2.php: $dtstart = new RepeatRuleDateTime( $dtstart->Value(), $tzid ); RRule-v2.php: $instances[$dtstart->UTC()] = $comp; RRule-v2.php: $p = $comp->GetProperty('RECURRENCE-ID'); RRule-v2.php: if ( isset($p) && $p->Value() != '' ) { RRule-v2.php: $range = $p->GetParameterValue('RANGE'); RRule-v2.php: $recur_tzid = $p->GetParameterValue('TZID'); RRule-v2.php: $recur_utc = new RepeatRuleDateTime($p->Value(),$recur_tzid); RRule-v2.php: $recur_utc = $recur_utc->UTC(); RRule-v2.php: $start_utc = $range_start->UTC(); RRule-v2.php: $end_utc = $range_end->UTC(); RRule-v2.php: $end_type = ($comp->GetType() == 'VTODO' ? 'DUE' : 'DTEND'); RRule-v2.php: $duration = $comp->GetProperty('DURATION'); RRule-v2.php: if ( !isset($duration) || $duration->Value() == '' ) { RRule-v2.php: $instance_start = $comp->GetProperty('DTSTART'); RRule-v2.php: $dtsrt = new RepeatRuleDateTime( $instance_start->Value(), $instance_start->GetParameterValue('TZID')); RRule-v2.php: $instance_end = $comp->GetProperty($end_type); RRule-v2.php: $dtend = new RepeatRuleDateTime( $instance_end->Value(), $instance_end->GetParameterValue('TZID')); RRule-v2.php: $duration = $dtstart->RFC5545Duration( $dtend ); RRule-v2.php: $duration = $duration->Value(); RRule-v2.php: $latest_start->modify('-'.$duration); RRule-v2.php: $early_start = $latest_start->UTC(); RRule-v2.php: $component->ClearProperties( array('DTSTART'=> true, 'DUE' => true, 'DTEND' => true) ); RRule-v2.php: $component->AddProperty('DTSTART', $utc ); RRule-v2.php: $component->AddProperty('DURATION', $duration ); RRule-v2.php: $vResource->SetComponents($new_components); RRule-v2.php: $vResource->SetComponents(array()); test-RRULE.php:header("Content-type: text/plain"); test-RRULE.php: $this->description = $description; test-RRULE.php: $this->dtstart = $start; test-RRULE.php: $this->recur = $recur; test-RRULE.php: $this->result_description = $result_description; test-RRULE.php: $rule = new RRule( new iCalDate($this->dtstart), $this->recur ); test-RRULE.php: $date = $rule->GetNext(); test-RRULE.php: $result .= " " . $date->Render(); test-RRULE.php: $qry = new AwlQuery($sql, $this->dtstart, $this->recur); test-RRULE.php: // printf( "%s\n", $qry->querystring); test-RRULE.php: if ( $qry->Exec("test") && $qry->rows > 0 ) { test-RRULE.php: while( $row = $qry->Fetch() ) { test-RRULE.php: $result .= " " . $row->event_date; test-RRULE.php: , new RRuleTest( "Monthly, on the 1st monday, 2nd wednesday, 3rd friday and last sunday, forever", "20061117T073000", "RRULE:FREQ=MONTHLY;BYDAY=1MO,2WE,3FR,-1SU" ) test-RRULE.php: , new RRuleTest( "The last working day of each month", "20061107T113000", "RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1" ) test-RRULE.php: , new RRuleTest( "Time zone 2", "19700927T020000", "FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=9" ) test-RRULE.php: , new RRuleTest( "Time zone 3", "19810329T030000", "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU" ) test-RRULE.php: echo "$test->dtstart - $test->recur\n"; test-RRULE.php: echo "$test->description\n"; test-RRULE.php: $php_result = $test->PHPTest(); test-RRULE.php: $sql_result = $test->SQLTest(); test-RRULE.php: echo "PHP & SQL results are identical :-)\n"; test-RRULE.php: echo "PHP & SQL results differ :-(\n"; vcard.php: fn TEXT, -- fullname vcard.php: n TEXT, -- Name Surname;First names vcard.php: $in_transaction = ($qry->TransactionState() == 1); vcard.php: if ( ! $in_transaction ) $qry->Begin(); vcard.php: $properties = $this->GetProperties( $wanted ); vcard.php: $pname = ':' . strtolower($v->Name()); vcard.php: if ( !isset($params[$pname]) /** @TODO: or this is one is in the user's language */ ) $params[$pname] = $v->Value(); vcard.php: $qry->QDo( $sql, $params ); vcard.php: $this->WriteAddresses($dav_id); vcard.php: $this->WritePhones($dav_id); vcard.php: $this->WriteEmails($dav_id); vcard.php: if ( ! $in_transaction ) $qry->Commit(); vcard.php: property TEXT -- The full text of the property vcard.php: $addresses = $this->GetProperties('ADR'); vcard.php: $in_transaction = ($qry->TransactionState() == 1); vcard.php: if ( ! $in_transaction ) $qry->Begin(); vcard.php: $qry->QDo('DELETE FROM addressbook_address_adr WHERE dav_id = :dav_id', $params ); vcard.php: $params[':type'] = $adr->GetParameterValue('TYPE'); vcard.php: $address = explode(';',$adr->Value()); vcard.php: $params[':property'] = $adr->Render(); vcard.php: $qry->QDo( 'INSERT INTO addressbook_address_adr (dav_id, type, box_no, unit_no, street_address, locality, region, postcode, country, property) vcard.php: if ( ! $in_transaction ) $qry->Commit(); vcard.php: property TEXT -- The full text of the property vcard.php: $telephones = $this->GetProperties('TEL'); vcard.php: $in_transaction = ($qry->TransactionState() == 1); vcard.php: if ( ! $in_transaction ) $qry->Begin(); vcard.php: $qry->QDo('DELETE FROM addressbook_address_tel WHERE dav_id = :dav_id', $params ); vcard.php: $params[':type'] = $tel->GetParameterValue('TYPE'); vcard.php: $params[':tel'] = $tel->Value(); vcard.php: $params[':property'] = $tel->Render(); vcard.php: $qry->QDo( 'INSERT INTO addressbook_address_tel (dav_id, type, tel, property) VALUES( :dav_id, :type, :tel, :property)', $params ); vcard.php: if ( ! $in_transaction ) $qry->Commit(); vcard.php: property TEXT -- The full text of the property vcard.php: $emails = $this->GetProperties('EMAIL'); vcard.php: $in_transaction = ($qry->TransactionState() == 1); vcard.php: if ( ! $in_transaction ) $qry->Begin(); vcard.php: $qry->QDo('DELETE FROM addressbook_address_email WHERE dav_id = :dav_id', $params ); vcard.php: $params[':type'] = $email->GetParameterValue('TYPE'); vcard.php: $params[':email'] = $email->Value(); vcard.php: $params[':property'] = $email->Render(); vcard.php: $qry->QDo( 'INSERT INTO addressbook_address_email (dav_id, type, email, property) VALUES( :dav_id, :type, :email, :property)', $params ); vcard.php: if ( ! $in_transaction ) $qry->Commit();