@@ -200,59 +200,59 @@ discard block |
||
| 200 | 200 | parent::startElement($uri, $element, $attrs); |
| 201 | 201 | |
| 202 | 202 | switch ($this->_xmlStack) { |
| 203 | - case 3: |
|
| 204 | - if ($element == 'Source') { |
|
| 205 | - // <SyncML><SyncHdr><Source> |
|
| 206 | - $this->_isSource = true; |
|
| 207 | - } elseif ($element == 'Cred') { |
|
| 208 | - $this->_isCred = true; |
|
| 209 | - } |
|
| 210 | - break; |
|
| 203 | + case 3: |
|
| 204 | + if ($element == 'Source') { |
|
| 205 | + // <SyncML><SyncHdr><Source> |
|
| 206 | + $this->_isSource = true; |
|
| 207 | + } elseif ($element == 'Cred') { |
|
| 208 | + $this->_isCred = true; |
|
| 209 | + } |
|
| 210 | + break; |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | function endElement($uri, $element) |
| 215 | 215 | { |
| 216 | 216 | switch ($this->_xmlStack) { |
| 217 | - case 2: |
|
| 218 | - // </SyncHdr></SyncML> |
|
| 219 | - Horde::logMessage('SyncML['. session_id() .']: package ' |
|
| 220 | - . $this->_msgID.' +++++++++++++++++++++ started', |
|
| 221 | - __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 222 | - |
|
| 223 | - // Find the state. |
|
| 224 | - //Horde::logMessage('SymcML: SyncHdr done. Try to load state from session.', |
|
| 225 | - // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 226 | - $state =& $this->getStateFromSession($this->_sourceURI, $this->_locName, $this->_sessionID); |
|
| 227 | - |
|
| 228 | - $state->setVersion($this->_version); |
|
| 229 | - $state->setMsgID($this->_msgID); |
|
| 230 | - $state->setTargetURI($this->_targetURI); |
|
| 231 | - $state->setWBXML(is_a($this->_output, 'XML_WBXML_Encoder')); |
|
| 232 | - |
|
| 233 | - if (isset($this->_credData) |
|
| 234 | - && isset($this->_locName) |
|
| 235 | - && !$state->isAuthorized()) { |
|
| 236 | - $state->setPassword($this->_credData); |
|
| 237 | - $state->setLocName($this->_locName); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - if (isset($this->_maxMsgSize)) { |
|
| 241 | - $state->setMaxMsgSize($this->_maxMsgSize); |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - // $_SESSION['SyncML.state'] = $state; |
|
| 245 | - |
|
| 246 | - #Horde::logMessage('SymcML: session id 2 =' . session_id(), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 247 | - |
|
| 248 | - // Got the state; now write our SyncHdr header. |
|
| 249 | - $this->outputSyncHdr($this->_output); |
|
| 250 | - break; |
|
| 251 | - |
|
| 252 | - case 3: |
|
| 253 | - if ($element == 'VerProto') { |
|
| 254 | - // </VerProto></SyncHdr></SyncML> |
|
| 255 | - switch (strtolower(trim($this->_chars))) { |
|
| 217 | + case 2: |
|
| 218 | + // </SyncHdr></SyncML> |
|
| 219 | + Horde::logMessage('SyncML['. session_id() .']: package ' |
|
| 220 | + . $this->_msgID.' +++++++++++++++++++++ started', |
|
| 221 | + __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 222 | + |
|
| 223 | + // Find the state. |
|
| 224 | + //Horde::logMessage('SymcML: SyncHdr done. Try to load state from session.', |
|
| 225 | + // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 226 | + $state =& $this->getStateFromSession($this->_sourceURI, $this->_locName, $this->_sessionID); |
|
| 227 | + |
|
| 228 | + $state->setVersion($this->_version); |
|
| 229 | + $state->setMsgID($this->_msgID); |
|
| 230 | + $state->setTargetURI($this->_targetURI); |
|
| 231 | + $state->setWBXML(is_a($this->_output, 'XML_WBXML_Encoder')); |
|
| 232 | + |
|
| 233 | + if (isset($this->_credData) |
|
| 234 | + && isset($this->_locName) |
|
| 235 | + && !$state->isAuthorized()) { |
|
| 236 | + $state->setPassword($this->_credData); |
|
| 237 | + $state->setLocName($this->_locName); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + if (isset($this->_maxMsgSize)) { |
|
| 241 | + $state->setMaxMsgSize($this->_maxMsgSize); |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + // $_SESSION['SyncML.state'] = $state; |
|
| 245 | + |
|
| 246 | + #Horde::logMessage('SymcML: session id 2 =' . session_id(), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 247 | + |
|
| 248 | + // Got the state; now write our SyncHdr header. |
|
| 249 | + $this->outputSyncHdr($this->_output); |
|
| 250 | + break; |
|
| 251 | + |
|
| 252 | + case 3: |
|
| 253 | + if ($element == 'VerProto') { |
|
| 254 | + // </VerProto></SyncHdr></SyncML> |
|
| 255 | + switch (strtolower(trim($this->_chars))) { |
|
| 256 | 256 | case 'syncml/1.2': |
| 257 | 257 | $this->_version = 2; |
| 258 | 258 | break; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | default: |
| 263 | 263 | $this->_version = 0; |
| 264 | 264 | break; |
| 265 | - } |
|
| 265 | + } |
|
| 266 | 266 | } elseif ($element == 'SessionID') { |
| 267 | 267 | // </SessionID></SyncHdr></SyncML> |
| 268 | 268 | $this->_sessionID = trim($this->_chars); |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | break; |
| 294 | 294 | |
| 295 | - case 4: |
|
| 296 | - switch ($element) { |
|
| 295 | + case 4: |
|
| 296 | + switch ($element) { |
|
| 297 | 297 | case 'LocURI': |
| 298 | 298 | if ($this->_isSource) { |
| 299 | 299 | // </LocURI></Source></SyncHdr></SyncML> |
@@ -319,20 +319,20 @@ discard block |
||
| 319 | 319 | //</MaxMsgSize></Meta></SyncHdr></SyncML> |
| 320 | 320 | $this->_maxMsgSize = trim($this->_chars); |
| 321 | 321 | break; |
| 322 | - } |
|
| 322 | + } |
|
| 323 | 323 | break; |
| 324 | 324 | |
| 325 | - case 5: |
|
| 326 | - if ($this->_isCred) { |
|
| 327 | - if ($element == 'Format') { |
|
| 328 | - // </Format></Meta></Cred></SyncHdr></SyncML> |
|
| 329 | - $this->_credFormat = trim($this->_chars); |
|
| 330 | - } elseif ($element == 'Type') { |
|
| 331 | - // </Type></Meta></Cred></SyncHdr></SyncML> |
|
| 332 | - $this->_credType = trim($this->_chars); |
|
| 333 | - } |
|
| 334 | - } |
|
| 335 | - break; |
|
| 325 | + case 5: |
|
| 326 | + if ($this->_isCred) { |
|
| 327 | + if ($element == 'Format') { |
|
| 328 | + // </Format></Meta></Cred></SyncHdr></SyncML> |
|
| 329 | + $this->_credFormat = trim($this->_chars); |
|
| 330 | + } elseif ($element == 'Type') { |
|
| 331 | + // </Type></Meta></Cred></SyncHdr></SyncML> |
|
| 332 | + $this->_credType = trim($this->_chars); |
|
| 333 | + } |
|
| 334 | + } |
|
| 335 | + break; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | parent::endElement($uri, $element); |
@@ -484,71 +484,71 @@ discard block |
||
| 484 | 484 | $state =& $_SESSION['SyncML.state']; |
| 485 | 485 | |
| 486 | 486 | switch ($this->_xmlStack) { |
| 487 | - case 2: |
|
| 488 | - $this->_actionCommands = false; // so far, we have not seen commands that require action from our side |
|
| 489 | - $state->_sendFinal = false; |
|
| 490 | - |
|
| 491 | - // <SyncML><SyncBody> |
|
| 492 | - $this->_output->startElement($uri, $element, $attrs); |
|
| 493 | - |
|
| 494 | - if ($state->getLocName()) { |
|
| 495 | - if ($state->isAuthConfirmed()) { |
|
| 496 | - // Right our status about the header |
|
| 497 | - $status = new Horde_SyncML_Command_Status(($state->isAuthorized()) ? |
|
| 498 | - RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS, 'SyncHdr'); |
|
| 499 | - } else { |
|
| 500 | - // Right our status about the header. |
|
| 501 | - $status = new Horde_SyncML_Command_Status(($state->isAuthorized()) ? |
|
| 502 | - RESPONSE_AUTHENTICATION_ACCEPTED : RESPONSE_INVALID_CREDENTIALS, 'SyncHdr'); |
|
| 503 | - } |
|
| 504 | - } else { |
|
| 505 | - // Request credentials if not sent so far |
|
| 506 | - $status = new Horde_SyncML_Command_Status(RESPONSE_MISSING_CREDENTIALS, 'SyncHdr'); |
|
| 507 | - } |
|
| 487 | + case 2: |
|
| 488 | + $this->_actionCommands = false; // so far, we have not seen commands that require action from our side |
|
| 489 | + $state->_sendFinal = false; |
|
| 490 | + |
|
| 491 | + // <SyncML><SyncBody> |
|
| 492 | + $this->_output->startElement($uri, $element, $attrs); |
|
| 493 | + |
|
| 494 | + if ($state->getLocName()) { |
|
| 495 | + if ($state->isAuthConfirmed()) { |
|
| 496 | + // Right our status about the header |
|
| 497 | + $status = new Horde_SyncML_Command_Status(($state->isAuthorized()) ? |
|
| 498 | + RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS, 'SyncHdr'); |
|
| 499 | + } else { |
|
| 500 | + // Right our status about the header. |
|
| 501 | + $status = new Horde_SyncML_Command_Status(($state->isAuthorized()) ? |
|
| 502 | + RESPONSE_AUTHENTICATION_ACCEPTED : RESPONSE_INVALID_CREDENTIALS, 'SyncHdr'); |
|
| 503 | + } |
|
| 504 | + } else { |
|
| 505 | + // Request credentials if not sent so far |
|
| 506 | + $status = new Horde_SyncML_Command_Status(RESPONSE_MISSING_CREDENTIALS, 'SyncHdr'); |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | - $status->setSourceRef($state->getSourceURI()); |
|
| 510 | - $status->setTargetRef($state->getTargetURI()); |
|
| 511 | - $status->setCmdRef(0); |
|
| 512 | - $state->clearNumberOfElements(); |
|
| 509 | + $status->setSourceRef($state->getSourceURI()); |
|
| 510 | + $status->setTargetRef($state->getTargetURI()); |
|
| 511 | + $status->setCmdRef(0); |
|
| 512 | + $state->clearNumberOfElements(); |
|
| 513 | 513 | |
| 514 | - /*$str = 'authorized=' . $state->isAuthorized(); |
|
| 514 | + /*$str = 'authorized=' . $state->isAuthorized(); |
|
| 515 | 515 | $str .= ' version=' . $state->getVersion(); |
| 516 | 516 | $str .= ' msgid=' . $state->getMsgID(); |
| 517 | 517 | $str .= ' source=' . $state->getSourceURI(); |
| 518 | 518 | $str .= ' target=' . $state->getTargetURI(); |
| 519 | 519 | */ |
| 520 | - $this->_currentCmdID = $status->output($this->_currentCmdID, $this->_output); |
|
| 521 | - if ($state->isAuthorized()) { |
|
| 522 | - $state->AuthConfirmed(); |
|
| 523 | - } |
|
| 524 | - break; |
|
| 525 | - |
|
| 526 | - case 3: |
|
| 527 | - // <SyncML><SyncBody><[Command]> |
|
| 528 | - #Horde::logMessage('SyncML['. session_id() ."]: found command $element ", __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 529 | - $this->_currentCommand = Horde_SyncML_Command::factory($element); |
|
| 530 | - $this->_currentCommand->startElement($uri, $element, $attrs); |
|
| 531 | - |
|
| 532 | - if ($element != 'Status' && $element != 'Map' && $element != 'Final') { |
|
| 533 | - // We've got to do something! This can't be the last |
|
| 534 | - // packet. |
|
| 535 | - $this->_actionCommands = true; |
|
| 536 | - Horde::logMessage('SyncML['. session_id() ."]: found action commands <$element> ", __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 537 | - } |
|
| 538 | - |
|
| 539 | - switch ($element) |
|
| 540 | - { |
|
| 520 | + $this->_currentCmdID = $status->output($this->_currentCmdID, $this->_output); |
|
| 521 | + if ($state->isAuthorized()) { |
|
| 522 | + $state->AuthConfirmed(); |
|
| 523 | + } |
|
| 524 | + break; |
|
| 525 | + |
|
| 526 | + case 3: |
|
| 527 | + // <SyncML><SyncBody><[Command]> |
|
| 528 | + #Horde::logMessage('SyncML['. session_id() ."]: found command $element ", __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 529 | + $this->_currentCommand = Horde_SyncML_Command::factory($element); |
|
| 530 | + $this->_currentCommand->startElement($uri, $element, $attrs); |
|
| 531 | + |
|
| 532 | + if ($element != 'Status' && $element != 'Map' && $element != 'Final') { |
|
| 533 | + // We've got to do something! This can't be the last |
|
| 534 | + // packet. |
|
| 535 | + $this->_actionCommands = true; |
|
| 536 | + Horde::logMessage('SyncML['. session_id() ."]: found action commands <$element> ", __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 537 | + } |
|
| 538 | + |
|
| 539 | + switch ($element) |
|
| 540 | + { |
|
| 541 | 541 | case 'Sync': |
| 542 | 542 | $state->setSyncStatus(CLIENT_SYNC_STARTED); |
| 543 | 543 | Horde::logMessage('SyncML['. session_id() .']: syncStatus(client sync started) ' . $state->getSyncStatus(), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 544 | 544 | break; |
| 545 | - } |
|
| 545 | + } |
|
| 546 | 546 | break; |
| 547 | 547 | |
| 548 | - default: |
|
| 549 | - // <SyncML><SyncBody><Command><...> |
|
| 550 | - $this->_currentCommand->startElement($uri, $element, $attrs); |
|
| 551 | - break; |
|
| 548 | + default: |
|
| 549 | + // <SyncML><SyncBody><Command><...> |
|
| 550 | + $this->_currentCommand->startElement($uri, $element, $attrs); |
|
| 551 | + break; |
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | |
@@ -221,30 +221,30 @@ |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | switch (count($this->_stack)) { |
| 224 | - case 2: |
|
| 225 | - if ($element == 'Replace' || |
|
| 226 | - $element == 'Add' || |
|
| 227 | - $element == 'Delete') { |
|
| 228 | - $this->_syncElements[] = &$this->_curItem; |
|
| 229 | - unset($this->_curItem); |
|
| 230 | - } |
|
| 231 | - break; |
|
| 232 | - |
|
| 233 | - case 3: |
|
| 234 | - if ($element == 'LocURI' && !isset($this->_curItem)) { |
|
| 235 | - if ($this->_stack[1] == 'Source') { |
|
| 236 | - $this->_sourceURI = trim($this->_chars); |
|
| 237 | - } elseif ($this->_stack[1] == 'Target') { |
|
| 238 | - $targetURIData = explode('?/',trim($this->_chars)); |
|
| 239 | - |
|
| 240 | - $this->_targetURI = $targetURIData[0]; |
|
| 241 | - |
|
| 242 | - if (isset($targetURIData[1])) { |
|
| 243 | - $this->_targetURIParameters = $targetURIData[1]; |
|
| 244 | - } |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - break; |
|
| 224 | + case 2: |
|
| 225 | + if ($element == 'Replace' || |
|
| 226 | + $element == 'Add' || |
|
| 227 | + $element == 'Delete') { |
|
| 228 | + $this->_syncElements[] = &$this->_curItem; |
|
| 229 | + unset($this->_curItem); |
|
| 230 | + } |
|
| 231 | + break; |
|
| 232 | + |
|
| 233 | + case 3: |
|
| 234 | + if ($element == 'LocURI' && !isset($this->_curItem)) { |
|
| 235 | + if ($this->_stack[1] == 'Source') { |
|
| 236 | + $this->_sourceURI = trim($this->_chars); |
|
| 237 | + } elseif ($this->_stack[1] == 'Target') { |
|
| 238 | + $targetURIData = explode('?/',trim($this->_chars)); |
|
| 239 | + |
|
| 240 | + $this->_targetURI = $targetURIData[0]; |
|
| 241 | + |
|
| 242 | + if (isset($targetURIData[1])) { |
|
| 243 | + $this->_targetURIParameters = $targetURIData[1]; |
|
| 244 | + } |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + break; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | parent::endElement($uri, $element); |
@@ -94,45 +94,45 @@ |
||
| 94 | 94 | $state = &$_SESSION['SyncML.state']; |
| 95 | 95 | |
| 96 | 96 | switch (count($this->_stack)) { |
| 97 | - case 2: |
|
| 98 | - if ($element == 'MapItem') { |
|
| 99 | - $sync = $state->getSync($this->_targetLocURI); |
|
| 100 | - if (!$state->isAuthorized()) { |
|
| 101 | - Horde::logMessage('SyncML: Not Authorized in the middle of MapItem!', __FILE__, __LINE__, PEAR_LOG_ERR); |
|
| 102 | - } else { |
|
| 103 | - Horde::logMessage("SyncML: creating Map for source=" . |
|
| 104 | - $this->_mapSource . " and target=" . $this->_mapTarget, __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 105 | - // Overwrite existing data by removing it first: |
|
| 106 | - $ts = $state->getServerAnchorNext($this->_targetLocURI); |
|
| 107 | - $r = $state->setUID($this->_targetLocURI, $this->_mapSource, $this->_mapTarget, $ts); |
|
| 108 | - if (is_a($r, 'PEAR_Error')) { |
|
| 109 | - Horde::logMessage('SyncML: PEAR Error: ' . $r->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR); |
|
| 110 | - return false; |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - break; |
|
| 115 | - |
|
| 116 | - case 3: |
|
| 117 | - if ($element == 'LocURI') { |
|
| 118 | - if ($this->_stack[1] == 'Source') { |
|
| 119 | - $this->_sourceLocURI = trim($this->_chars); |
|
| 120 | - } elseif ($this->_stack[1] == 'Target') { |
|
| 121 | - $targetLocURIData = explode('?/',trim($this->_chars)); |
|
| 122 | - $this->_targetLocURI = $targetLocURIData[0]; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - break; |
|
| 126 | - |
|
| 127 | - case 4: |
|
| 128 | - if ($element == 'LocURI') { |
|
| 129 | - if ($this->_stack[2] == 'Source') { |
|
| 130 | - $this->_mapSource = trim($this->_chars); |
|
| 131 | - } elseif ($this->_stack[2] == 'Target') { |
|
| 132 | - $this->_mapTarget = trim($this->_chars); |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - break; |
|
| 97 | + case 2: |
|
| 98 | + if ($element == 'MapItem') { |
|
| 99 | + $sync = $state->getSync($this->_targetLocURI); |
|
| 100 | + if (!$state->isAuthorized()) { |
|
| 101 | + Horde::logMessage('SyncML: Not Authorized in the middle of MapItem!', __FILE__, __LINE__, PEAR_LOG_ERR); |
|
| 102 | + } else { |
|
| 103 | + Horde::logMessage("SyncML: creating Map for source=" . |
|
| 104 | + $this->_mapSource . " and target=" . $this->_mapTarget, __FILE__, __LINE__, PEAR_LOG_DEBUG); |
|
| 105 | + // Overwrite existing data by removing it first: |
|
| 106 | + $ts = $state->getServerAnchorNext($this->_targetLocURI); |
|
| 107 | + $r = $state->setUID($this->_targetLocURI, $this->_mapSource, $this->_mapTarget, $ts); |
|
| 108 | + if (is_a($r, 'PEAR_Error')) { |
|
| 109 | + Horde::logMessage('SyncML: PEAR Error: ' . $r->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR); |
|
| 110 | + return false; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + break; |
|
| 115 | + |
|
| 116 | + case 3: |
|
| 117 | + if ($element == 'LocURI') { |
|
| 118 | + if ($this->_stack[1] == 'Source') { |
|
| 119 | + $this->_sourceLocURI = trim($this->_chars); |
|
| 120 | + } elseif ($this->_stack[1] == 'Target') { |
|
| 121 | + $targetLocURIData = explode('?/',trim($this->_chars)); |
|
| 122 | + $this->_targetLocURI = $targetLocURIData[0]; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + break; |
|
| 126 | + |
|
| 127 | + case 4: |
|
| 128 | + if ($element == 'LocURI') { |
|
| 129 | + if ($this->_stack[2] == 'Source') { |
|
| 130 | + $this->_mapSource = trim($this->_chars); |
|
| 131 | + } elseif ($this->_stack[2] == 'Target') { |
|
| 132 | + $this->_mapTarget = trim($this->_chars); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + break; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | parent::endElement($uri, $element); |
@@ -414,40 +414,40 @@ |
||
| 414 | 414 | function endElement($uri, $element) |
| 415 | 415 | { |
| 416 | 416 | switch (count($this->_stack)) { |
| 417 | - case 2: |
|
| 418 | - if ($element == 'Data') { |
|
| 419 | - $this->_alert = intval(trim($this->_chars)); |
|
| 417 | + case 2: |
|
| 418 | + if ($element == 'Data') { |
|
| 419 | + $this->_alert = intval(trim($this->_chars)); |
|
| 420 | + } |
|
| 421 | + break; |
|
| 422 | + |
|
| 423 | + case 4: |
|
| 424 | + if ($element == 'LocURI') { |
|
| 425 | + switch ($this->_stack[2]) { |
|
| 426 | + case 'Source': |
|
| 427 | + $this->_sourceLocURI = trim($this->_chars); |
|
| 428 | + break; |
|
| 429 | + case 'Target': |
|
| 430 | + $targetLocURIData = explode('?/',trim($this->_chars)); |
|
| 431 | + |
|
| 432 | + $this->_targetLocURI = $targetLocURIData[0]; |
|
| 433 | + |
|
| 434 | + if (isset($targetLocURIData[1])) { |
|
| 435 | + $this->_targetLocURIParameters = $targetLocURIData[1]; |
|
| 436 | + } |
|
| 437 | + break; |
|
| 438 | + } |
|
| 420 | 439 | } |
| 421 | 440 | break; |
| 422 | 441 | |
| 423 | - case 4: |
|
| 424 | - if ($element == 'LocURI') { |
|
| 425 | - switch ($this->_stack[2]) { |
|
| 426 | - case 'Source': |
|
| 427 | - $this->_sourceLocURI = trim($this->_chars); |
|
| 428 | - break; |
|
| 429 | - case 'Target': |
|
| 430 | - $targetLocURIData = explode('?/',trim($this->_chars)); |
|
| 431 | - |
|
| 432 | - $this->_targetLocURI = $targetLocURIData[0]; |
|
| 433 | - |
|
| 434 | - if (isset($targetLocURIData[1])) { |
|
| 435 | - $this->_targetLocURIParameters = $targetLocURIData[1]; |
|
| 436 | - } |
|
| 437 | - break; |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - break; |
|
| 441 | - |
|
| 442 | - case 5: |
|
| 443 | - switch ($element) { |
|
| 444 | - case 'Next': |
|
| 445 | - $this->_metaAnchorNext = trim($this->_chars); |
|
| 446 | - break; |
|
| 447 | - case 'Last': |
|
| 448 | - $this->_metaAnchorLast = trim($this->_chars); |
|
| 449 | - break; |
|
| 450 | - } |
|
| 442 | + case 5: |
|
| 443 | + switch ($element) { |
|
| 444 | + case 'Next': |
|
| 445 | + $this->_metaAnchorNext = trim($this->_chars); |
|
| 446 | + break; |
|
| 447 | + case 'Last': |
|
| 448 | + $this->_metaAnchorLast = trim($this->_chars); |
|
| 449 | + break; |
|
| 450 | + } |
|
| 451 | 451 | break; |
| 452 | 452 | |
| 453 | 453 | case 7: |
@@ -1219,13 +1219,13 @@ discard block |
||
| 1219 | 1219 | function convertClient2Server($content, $contentType) |
| 1220 | 1220 | { |
| 1221 | 1221 | switch ($contentType) { |
| 1222 | - case 'text/calendar': |
|
| 1223 | - case 'text/x-icalendar': |
|
| 1224 | - case 'text/x-vcalendar': |
|
| 1225 | - case 'text/x-vevent': |
|
| 1226 | - case 'text/x-vtodo': |
|
| 1227 | - // $content = preg_replace('/^UID:.*\n/m', '', $content, 1); |
|
| 1228 | - break; |
|
| 1222 | + case 'text/calendar': |
|
| 1223 | + case 'text/x-icalendar': |
|
| 1224 | + case 'text/x-vcalendar': |
|
| 1225 | + case 'text/x-vevent': |
|
| 1226 | + case 'text/x-vtodo': |
|
| 1227 | + // $content = preg_replace('/^UID:.*\n/m', '', $content, 1); |
|
| 1228 | + break; |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | return $content; |
@@ -1242,13 +1242,13 @@ discard block |
||
| 1242 | 1242 | function convertServer2Client($content, $contentType) |
| 1243 | 1243 | { |
| 1244 | 1244 | switch ($contentType) { |
| 1245 | - case 'text/calendar': |
|
| 1246 | - case 'text/x-icalendar': |
|
| 1247 | - case 'text/x-vcalendar': |
|
| 1248 | - case 'text/x-vevent': |
|
| 1249 | - case 'text/x-vtodo': |
|
| 1250 | - // $content = preg_replace('/^UID:.*\n/m', '', $content, 1); |
|
| 1251 | - break; |
|
| 1245 | + case 'text/calendar': |
|
| 1246 | + case 'text/x-icalendar': |
|
| 1247 | + case 'text/x-vcalendar': |
|
| 1248 | + case 'text/x-vevent': |
|
| 1249 | + case 'text/x-vtodo': |
|
| 1250 | + // $content = preg_replace('/^UID:.*\n/m', '', $content, 1); |
|
| 1251 | + break; |
|
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | // FIXME: utf8 really should be fine. But the P900 seems to |
@@ -35,35 +35,35 @@ |
||
| 35 | 35 | $this->_container->getAttribute('METHOD') : 'PUBLISH'; |
| 36 | 36 | |
| 37 | 37 | switch ($method) { |
| 38 | - case 'PUBLISH': |
|
| 39 | - $requiredAttributes['DTSTART'] = time(); |
|
| 40 | - $requiredAttributes['SUMMARY'] = ''; |
|
| 41 | - break; |
|
| 42 | - |
|
| 43 | - case 'REQUEST': |
|
| 44 | - $requiredAttributes['ATTENDEE'] = ''; |
|
| 45 | - $requiredAttributes['DTSTART'] = time(); |
|
| 46 | - $requiredAttributes['SUMMARY'] = ''; |
|
| 47 | - break; |
|
| 48 | - |
|
| 49 | - case 'REPLY': |
|
| 50 | - $requiredAttributes['ATTENDEE'] = ''; |
|
| 51 | - break; |
|
| 52 | - |
|
| 53 | - case 'ADD': |
|
| 54 | - $requiredAttributes['DTSTART'] = time(); |
|
| 55 | - $requiredAttributes['SEQUENCE'] = 1; |
|
| 56 | - $requiredAttributes['SUMMARY'] = ''; |
|
| 57 | - break; |
|
| 58 | - |
|
| 59 | - case 'CANCEL': |
|
| 60 | - $requiredAttributes['ATTENDEE'] = ''; |
|
| 61 | - $requiredAttributes['SEQUENCE'] = 1; |
|
| 62 | - break; |
|
| 63 | - |
|
| 64 | - case 'REFRESH': |
|
| 65 | - $requiredAttributes['ATTENDEE'] = ''; |
|
| 66 | - break; |
|
| 38 | + case 'PUBLISH': |
|
| 39 | + $requiredAttributes['DTSTART'] = time(); |
|
| 40 | + $requiredAttributes['SUMMARY'] = ''; |
|
| 41 | + break; |
|
| 42 | + |
|
| 43 | + case 'REQUEST': |
|
| 44 | + $requiredAttributes['ATTENDEE'] = ''; |
|
| 45 | + $requiredAttributes['DTSTART'] = time(); |
|
| 46 | + $requiredAttributes['SUMMARY'] = ''; |
|
| 47 | + break; |
|
| 48 | + |
|
| 49 | + case 'REPLY': |
|
| 50 | + $requiredAttributes['ATTENDEE'] = ''; |
|
| 51 | + break; |
|
| 52 | + |
|
| 53 | + case 'ADD': |
|
| 54 | + $requiredAttributes['DTSTART'] = time(); |
|
| 55 | + $requiredAttributes['SEQUENCE'] = 1; |
|
| 56 | + $requiredAttributes['SUMMARY'] = ''; |
|
| 57 | + break; |
|
| 58 | + |
|
| 59 | + case 'CANCEL': |
|
| 60 | + $requiredAttributes['ATTENDEE'] = ''; |
|
| 61 | + $requiredAttributes['SEQUENCE'] = 1; |
|
| 62 | + break; |
|
| 63 | + |
|
| 64 | + case 'REFRESH': |
|
| 65 | + $requiredAttributes['ATTENDEE'] = ''; |
|
| 66 | + break; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | foreach ($requiredAttributes as $name => $default_value) { |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | foreach ($rrules as $rrule) { |
| 92 | 92 | $t = explode('=', $rrule); |
| 93 | 93 | switch ($t[0]) { |
| 94 | - case 'FREQ': |
|
| 95 | - switch($t[1]) { |
|
| 94 | + case 'FREQ': |
|
| 95 | + switch($t[1]) { |
|
| 96 | 96 | case 'YEARLY': |
| 97 | 97 | if ($rrule_interval == 12) { |
| 98 | 98 | return false; |
@@ -107,53 +107,53 @@ discard block |
||
| 107 | 107 | break; |
| 108 | 108 | default: |
| 109 | 109 | return false; |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | break; |
| 112 | 112 | |
| 113 | - case 'INTERVAL': |
|
| 114 | - if ($rrule_interval && $t[1] != $rrule_interval) { |
|
| 115 | - return false; |
|
| 116 | - } |
|
| 117 | - $rrule_interval = intval($t[1]); |
|
| 118 | - if ($rrule_interval != 1 && $rrule_interval != 12) { |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - break; |
|
| 122 | - |
|
| 123 | - case 'COUNT': |
|
| 124 | - if ($switch_year + intval($t[1]) < intval($year)) { |
|
| 125 | - return false; |
|
| 126 | - } |
|
| 127 | - break; |
|
| 128 | - |
|
| 129 | - case 'BYMONTH': |
|
| 130 | - $month = intval($t[1]); |
|
| 131 | - break; |
|
| 132 | - |
|
| 133 | - case 'BYDAY': |
|
| 134 | - $len = strspn($t[1], '1234567890-+'); |
|
| 135 | - if ($len == 0) { |
|
| 136 | - return false; |
|
| 137 | - } |
|
| 138 | - $weekday = substr($t[1], $len); |
|
| 139 | - $weekdays = array( |
|
| 140 | - 'SU' => 0, |
|
| 141 | - 'MO' => 1, |
|
| 142 | - 'TU' => 2, |
|
| 143 | - 'WE' => 3, |
|
| 144 | - 'TH' => 4, |
|
| 145 | - 'FR' => 5, |
|
| 146 | - 'SA' => 6 |
|
| 147 | - ); |
|
| 148 | - $weekday = $weekdays[$weekday]; |
|
| 149 | - $which = intval(substr($t[1], 0, $len)); |
|
| 150 | - break; |
|
| 151 | - |
|
| 152 | - case 'UNTIL': |
|
| 153 | - if (intval($year) > intval(substr($t[1], 0, 4))) { |
|
| 154 | - return false; |
|
| 155 | - } |
|
| 156 | - break; |
|
| 113 | + case 'INTERVAL': |
|
| 114 | + if ($rrule_interval && $t[1] != $rrule_interval) { |
|
| 115 | + return false; |
|
| 116 | + } |
|
| 117 | + $rrule_interval = intval($t[1]); |
|
| 118 | + if ($rrule_interval != 1 && $rrule_interval != 12) { |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + break; |
|
| 122 | + |
|
| 123 | + case 'COUNT': |
|
| 124 | + if ($switch_year + intval($t[1]) < intval($year)) { |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 127 | + break; |
|
| 128 | + |
|
| 129 | + case 'BYMONTH': |
|
| 130 | + $month = intval($t[1]); |
|
| 131 | + break; |
|
| 132 | + |
|
| 133 | + case 'BYDAY': |
|
| 134 | + $len = strspn($t[1], '1234567890-+'); |
|
| 135 | + if ($len == 0) { |
|
| 136 | + return false; |
|
| 137 | + } |
|
| 138 | + $weekday = substr($t[1], $len); |
|
| 139 | + $weekdays = array( |
|
| 140 | + 'SU' => 0, |
|
| 141 | + 'MO' => 1, |
|
| 142 | + 'TU' => 2, |
|
| 143 | + 'WE' => 3, |
|
| 144 | + 'TH' => 4, |
|
| 145 | + 'FR' => 5, |
|
| 146 | + 'SA' => 6 |
|
| 147 | + ); |
|
| 148 | + $weekday = $weekdays[$weekday]; |
|
| 149 | + $which = intval(substr($t[1], 0, $len)); |
|
| 150 | + break; |
|
| 151 | + |
|
| 152 | + case 'UNTIL': |
|
| 153 | + if (intval($year) > intval(substr($t[1], 0, 4))) { |
|
| 154 | + return false; |
|
| 155 | + } |
|
| 156 | + break; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -191,64 +191,64 @@ |
||
| 191 | 191 | $this->_xmlStack++; |
| 192 | 192 | |
| 193 | 193 | switch ($this->_xmlStack) { |
| 194 | - case 1: |
|
| 195 | - // <SyncML> |
|
| 196 | - // Defined in SyncML Representation Protocol, version 1.1 5.2.1 |
|
| 197 | - $this->_output->startElement($uri, $element, $attrs); |
|
| 198 | - break; |
|
| 199 | - |
|
| 200 | - case 2: |
|
| 201 | - // Either <SyncML><SyncHdr> or <SyncML><SyncBody> |
|
| 202 | - if (!isset($this->_contentHandler)) { |
|
| 203 | - // If not defined then create SyncHdr. |
|
| 204 | - $this->_contentHandler = new Horde_SyncML_SyncmlHdr(); |
|
| 205 | - $this->_contentHandler->setOutput($this->_output); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - $this->_contentHandler->startElement($uri, $element, $attrs); |
|
| 209 | - break; |
|
| 210 | - |
|
| 211 | - default: |
|
| 212 | - if (isset($this->_contentHandler)) { |
|
| 213 | - $this->_contentHandler->startElement($uri, $element, $attrs); |
|
| 214 | - } |
|
| 215 | - break; |
|
| 194 | + case 1: |
|
| 195 | + // <SyncML> |
|
| 196 | + // Defined in SyncML Representation Protocol, version 1.1 5.2.1 |
|
| 197 | + $this->_output->startElement($uri, $element, $attrs); |
|
| 198 | + break; |
|
| 199 | + |
|
| 200 | + case 2: |
|
| 201 | + // Either <SyncML><SyncHdr> or <SyncML><SyncBody> |
|
| 202 | + if (!isset($this->_contentHandler)) { |
|
| 203 | + // If not defined then create SyncHdr. |
|
| 204 | + $this->_contentHandler = new Horde_SyncML_SyncmlHdr(); |
|
| 205 | + $this->_contentHandler->setOutput($this->_output); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + $this->_contentHandler->startElement($uri, $element, $attrs); |
|
| 209 | + break; |
|
| 210 | + |
|
| 211 | + default: |
|
| 212 | + if (isset($this->_contentHandler)) { |
|
| 213 | + $this->_contentHandler->startElement($uri, $element, $attrs); |
|
| 214 | + } |
|
| 215 | + break; |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | function endElement($uri, $element) |
| 220 | 220 | { |
| 221 | 221 | switch ($this->_xmlStack) { |
| 222 | - case 1: |
|
| 223 | - // </SyncML> |
|
| 224 | - // Defined in SyncML Representation Protocol, version 1.1 5.2.1 |
|
| 225 | - $this->_output->endElement($uri, $element); |
|
| 226 | - break; |
|
| 227 | - |
|
| 228 | - case 2: |
|
| 229 | - // Either </SyncHdr></SyncML> or </SyncBody></SyncML> |
|
| 230 | - if ($element == 'SyncHdr') { |
|
| 231 | - // Then we get the state from SyncMLHdr, and create a new |
|
| 232 | - // SyncMLBody. |
|
| 233 | - $this->_contentHandler->endElement($uri, $element); |
|
| 234 | - |
|
| 235 | - unset($this->_contentHandler); |
|
| 236 | - |
|
| 237 | - $this->_contentHandler = new Horde_SyncML_SyncmlBody(); |
|
| 238 | - $this->_contentHandler->setOutput($this->_output); |
|
| 239 | - } else { |
|
| 240 | - // No longer used. |
|
| 241 | - $this->_contentHandler->endElement($uri, $element); |
|
| 242 | - unset($this->_contentHandler); |
|
| 243 | - } |
|
| 244 | - break; |
|
| 245 | - |
|
| 246 | - default: |
|
| 247 | - // </*></SyncHdr></SyncML> or </*></SyncBody></SyncML> |
|
| 248 | - if (isset($this->_contentHandler)) { |
|
| 249 | - $this->_contentHandler->endElement($uri, $element); |
|
| 250 | - } |
|
| 251 | - break; |
|
| 222 | + case 1: |
|
| 223 | + // </SyncML> |
|
| 224 | + // Defined in SyncML Representation Protocol, version 1.1 5.2.1 |
|
| 225 | + $this->_output->endElement($uri, $element); |
|
| 226 | + break; |
|
| 227 | + |
|
| 228 | + case 2: |
|
| 229 | + // Either </SyncHdr></SyncML> or </SyncBody></SyncML> |
|
| 230 | + if ($element == 'SyncHdr') { |
|
| 231 | + // Then we get the state from SyncMLHdr, and create a new |
|
| 232 | + // SyncMLBody. |
|
| 233 | + $this->_contentHandler->endElement($uri, $element); |
|
| 234 | + |
|
| 235 | + unset($this->_contentHandler); |
|
| 236 | + |
|
| 237 | + $this->_contentHandler = new Horde_SyncML_SyncmlBody(); |
|
| 238 | + $this->_contentHandler->setOutput($this->_output); |
|
| 239 | + } else { |
|
| 240 | + // No longer used. |
|
| 241 | + $this->_contentHandler->endElement($uri, $element); |
|
| 242 | + unset($this->_contentHandler); |
|
| 243 | + } |
|
| 244 | + break; |
|
| 245 | + |
|
| 246 | + default: |
|
| 247 | + // </*></SyncHdr></SyncML> or </*></SyncBody></SyncML> |
|
| 248 | + if (isset($this->_contentHandler)) { |
|
| 249 | + $this->_contentHandler->endElement($uri, $element); |
|
| 250 | + } |
|
| 251 | + break; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | if (isset($this->_chars)) { |
@@ -708,20 +708,20 @@ |
||
| 708 | 708 | $suffix = 'dll'; |
| 709 | 709 | } else { |
| 710 | 710 | switch (PHP_OS) { |
| 711 | - case 'HP-UX': |
|
| 712 | - $suffix = 'sl'; |
|
| 713 | - break; |
|
| 711 | + case 'HP-UX': |
|
| 712 | + $suffix = 'sl'; |
|
| 713 | + break; |
|
| 714 | 714 | |
| 715 | - case 'AIX': |
|
| 716 | - $suffix = 'a'; |
|
| 717 | - break; |
|
| 715 | + case 'AIX': |
|
| 716 | + $suffix = 'a'; |
|
| 717 | + break; |
|
| 718 | 718 | |
| 719 | - case 'OSX': |
|
| 720 | - $suffix = 'bundle'; |
|
| 721 | - break; |
|
| 719 | + case 'OSX': |
|
| 720 | + $suffix = 'bundle'; |
|
| 721 | + break; |
|
| 722 | 722 | |
| 723 | - default: |
|
| 724 | - $suffix = 'so'; |
|
| 723 | + default: |
|
| 724 | + $suffix = 'so'; |
|
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | |