function ErrorLogFunction($errno, $errstr, $errfile, $errline) { //echo "<b>Custom error:</b> [$errno] $errstr<br />"; //echo " Error on line $errline in $errfile<br />"; //debugLog('errorLog\\'.date("Ymd").'.log', date("Y-m-d H:i:s"). ' '.$errno. ' : '.$errstr.' on line '.$errline.' in '.$errfile . "\n"); debugLog('errorLog/' . date("Ymd") . '.log', date("Y-m-d H:i:s") . ' ' . $errno . ' : ' . $errstr . ' on line ' . $errline . ' in ' . $errfile . "\n"); }
function _saveFolderData($devid, $folders) { if (!is_array($folders) || empty($folders)) { return false; } $unique_folders = array(); foreach ($folders as $folder) { if (!isset($folder->type)) { continue; } // don't save folder-ids for emails if ($folder->type == SYNC_FOLDER_TYPE_INBOX) { continue; } // no folder from that type or the default folder if (!array_key_exists($folder->type, $unique_folders) || $folder->parentid == 0) { $unique_folders[$folder->type] = $folder->serverid; } } // Treo does initial sync for calendar and contacts too, so we need to fake // these folders if they are not supported by the backend if (!array_key_exists(SYNC_FOLDER_TYPE_APPOINTMENT, $unique_folders)) { $unique_folders[SYNC_FOLDER_TYPE_APPOINTMENT] = SYNC_FOLDER_TYPE_DUMMY; } if (!array_key_exists(SYNC_FOLDER_TYPE_CONTACT, $unique_folders)) { $unique_folders[SYNC_FOLDER_TYPE_CONTACT] = SYNC_FOLDER_TYPE_DUMMY; } if (!file_put_contents(BASE_PATH . STATE_DIR . "/compat-{$devid}", serialize($unique_folders))) { debugLog("_saveFolderData: Data could not be saved!"); } }
function readFeed($location, $cacheLife, $cacheDir, $proxy) { $cachePrefix = 'pmgallery_'; $cacheDir = empty($cacheDir) ? dirname(__FILE__) . '/cache' : $cacheDir; $cache = $cacheDir . '/' . $cachePrefix . md5($location); // clean out old cache files cleanDir($cacheDir, $cachePrefix . '*', $cacheLife); //First check for an existing version of the time, and then check to see whether or not it's expired. if (!empty($cacheLife) && file_exists($cache) && filesize($cache) > 0 && filemtime($cache) > time() - $cacheLife) { debugLog('cached...: ' . $cache); //If there's a valid cache file, load its data. $feedXml = file_get_contents($cache); } else { debugLog('NOT cached...'); //If there's no valid cache file, grab a live version of the data and save it to a temporary file. //Once the file is complete, copy it to a permanent file. (This prevents concurrency issues.) //TODO: Error handling -- unable to open stream $ctx = stream_context_create(array('http' => array('proxy' => $proxy, 'request_fulluri' => true))); debugLog('Location: ' . $location); $feedXml = file_get_contents($location, false, $ctx); $tempName = tempnam($cacheDir, 't_' . $cachePrefix); // prefix with t_ to prevent other processes deleting file_put_contents($tempName, $feedXml); if (copy($tempName, $cache)) { // copy forces overwrite if file is past cachelife unlink($tempName); } } return $feedXml; }
function ImportMessageChange($id, $message) { if (strtolower(get_class($message)) != $this->_type) { return true; } // ignore other types // prevent sending the same object twice in one request if (in_array($id, $this->_seenObjects)) { debugLog("Object {$id} discarded! Object already sent in this request."); return true; } $this->_seenObjects[] = $id; if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) { $this->_encoder->startTag(SYNC_ADD); } else { $this->_encoder->startTag(SYNC_MODIFY); } $this->_encoder->startTag(SYNC_SERVERENTRYID); $this->_encoder->content($id); $this->_encoder->endTag(); $this->_encoder->startTag(SYNC_DATA); $message->encode($this->_encoder); $this->_encoder->endTag(); $this->_encoder->endTag(); return true; }
function sanitize($post) { foreach ($post as $key => $val) { $post[$key] = strip_tags($val); } debugLog("Sanitized POST: " . print_r($post, 1)); return $post; }
function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { $bt = debug_backtrace(); debugLog("------------------------- ERROR BACKTRACE -------------------------"); debugLog("trace error: {$errfile}:{$errline} {$errstr} ({$errno}) - backtrace: " . (count($bt) - 1) . " steps"); for ($i = 1, $bt_length = count($bt); $i < $bt_length; $i++) { debugLog("trace: {$i}:" . $bt[$i]['file'] . ":" . $bt[$i]['line'] . " - " . (isset($bt[$i]['class']) ? $bt[$i]['class'] . $bt[$i]['type'] : "") . $bt[$i]['function'] . "()"); } }
/** * Provides an error protected cacheImage for PHP 5 * */ function cacheImage_protected($newfilename, $imgfile, $args, $allow_watermark = false, $theme, $album) { try { cacheImage($newfilename, $imgfile, $args, $allow_watermark, $theme, $album); return true; } catch (Exception $e) { debugLog('cacheImage(' . $newfilename . ') exception: ' . $e->getMessage()); return false; } }
function dbgprintf_wrapout($string, $html) { if (!CITADEL_DEBUG_HTML) { if ($html) { debugLog("<< " . $string . "\n"); } } else { printf($string); } }
/** * Provides an [not] error protected read of image EXIF/IPTC data for PHP 4 * * @param string $path image path * @return array */ function read_exif_data_protected($path) { if (DEBUG_EXIF) { debugLog("Begin read_exif_data_protected({$path})"); } $rslt = read_exif_data_raw($path, false); if (DEBUG_EXIF) { debugLog("End read_exif_data_protected({$path})"); } return $rslt; }
/** * 自动加载类文件 * * @return void */ function __autoload($class) { // $class_file = ROOT_DIR.(strpos($class,'M_')===0?'model':'lib').'/class.' . $class . '.php'; $class_file = ROOT_DIR . 'include/class.' . $class . '.php'; if (class_exists($class_file, false)) { return; } elseif (!is_readable($class_file)) { debugLog("unable to read class file " . $class, debug_backtrace()); throw new Exception("unable to read class file "); } else { include $class_file; } }
function ImportFolderChange($folder) { // The HierarchyExporter exports all kinds of changes. // Frequently these changes are not relevant for the mobiles, // as something changes but the relevant displayname and parentid // stay the same. These changes will be dropped and not sent if (is_array($this->foldercache) && array_key_exists($folder->serverid, $this->foldercache) && $this->foldercache[$folder->serverid]->displayname == $folder->displayname && $this->foldercache[$folder->serverid]->parentid == $folder->parentid && $this->foldercache[$folder->serverid]->type == $folder->type) { debugLog("Change for folder '" . $folder->displayname . "' will not be sent as modification is not relevant"); return true; } array_push($this->changed, $folder); $this->count++; return true; }
/** * 获取并设置区域信息 */ protected function regionInfo() { if (empty($key)) { // 采用行政区域参数 if (!empty($_GET['region'])) { $_region = Tools::convertToUtf8(urldecode($_GET['region'])); $city = explode('市', $_region); if (!empty($city[0])) { $key = explode('省', $city[0]); } else { $key = $_region; } } elseif (!empty($_GET['area'])) { $_area = Tools::convertToUtf8(urldecode($_GET['area'])); $key = explode(',', $_area); } elseif (!empty($_GET['prov']) || !empty($_GET['city'])) { $key[] = Tools::convertToUtf8(trim($_GET['prov'])); // 关键词——2 $key[] = empty($_GET['city']) ? '' : Tools::convertToUtf8(trim($_GET['city'])); // 关键词2——2 } // 采用ip参数 if (empty($key[1]) && empty($key[0])) { if (!empty($_GET['geoip'])) { $ip = trim($_GET['geoip']); } else { $ip = !empty($_COOKIE['geoip']) ? trim($_COOKIE['geoip']) : ''; } preg_match('/[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}/', $ip, $matches); $ip = $matches[0]; $key = !$ip ? null : GeoTool::getAreaNameByIp($ip); } } // 市 if (empty($key[1])) { // $key [1] = $key [0]; // unset ( $key [0] ); } else { $this->region['city'] = Tools::convertToUtf8($key[1]); } // 省 if (empty($key[0])) { // unset ( $key [0] ); } else { $this->region['prov'] = Tools::convertToUtf8($key[0]); } debugLog(__CLASS__ . ':region', $this->region); }
/** * Decides what to do with the current url setup * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function invokeRoute() { // Get instanced $objRoute = Core_Classes_coreObj::getRoute(); $module = $this->module; $this->module = 'Admin_Modules_' . $this->module; // if defaults are being loaded for the core acp panel, then we want dashboard not index if ($this->action == 'index' && $module == 'core') { $this->action = 'dashboard'; } // if nothing is selected, index all the way if (is_empty($this->action)) { $this->action = 'index'; } $action = array($this->action); if (strpos($this->action, '/') !== false) { $action = explode('/', $this->action); } $panels = cmsROOT . 'modules/%s/panels/'; $panels = sprintf($panels, $module); // check if we are dealing with the sub panels or not if (file_exists($panels) && is_readable($panels) && count(glob($panels . 'panel.*.php'))) { // we are ! $method = array_shift($action); if (!isset($action[0]) || is_empty($action[0])) { $action[0] = $method; } $args = array('method' => $method, 'args' => $action); // check the panel to see if it exists, if so include it $path = sprintf($panels, $module) . 'panel.' . $args['method'] . '.php'; if (file_exists($path) && is_readable($path)) { require_once $path; DEBUG ? debugLog($path, 'invokeRoute(): Loaded sub panel... ') : ''; } else { trigger_error('Error: Could not load ACP Panel: ' . $path); } // then call to it like normal :D $method = reflectMethod($this->module . '_' . $args['method'], $args['args'][0], $args); } else { $method = reflectMethod($this->module, array_shift($action), $action); } if ($method === false) { $objRoute->throwHTTP(404); } }
/** * Provides an error protected read of image EXIF/IPTC data * * @param string $path image path * @return array * */ function read_exif_data_protected($path) { if (DEBUG_EXIF) { debugLog("Begin read_exif_data_protected({$path})"); $start = microtime(true); } try { $rslt = read_exif_data_raw($path, false); } catch (Exception $e) { debugLog("read_exif_data({$path}) exception: " . $e->getMessage()); $rslt = array(); } if (DEBUG_EXIF) { $time = microtime(true) - $start; debugLog(sprintf("End read_exif_data_protected({$path}) [%f]", $time)); } return $rslt; }
function stop($queue_name) { debugLog('stop now ..'); $pidfile = APP . "log/monitor/{$queue_name}.pid"; if (file_exists($pidfile)) { $pid = file_get_contents($pidfile); if ($pid && posix_kill($pid, 0)) { $ret = posix_kill($pid, SIGTERM); if ($ret) { debugLog("Send stop signal to process {$pid} success"); pcntl_waitpid($pid, $status); debugLog("process {$pid} is stop"); file_put_contents($pidfile, "0"); } else { debugLog("Send stop signal to {$pid} faild"); } } } }
function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { $bt = debug_backtrace(); switch ($errno) { case 8192: // E_DEPRECATED since PHP 5.3.0 // do not handle this message break; case E_NOTICE: case E_WARNING: debugLog("{$errfile}:{$errline} {$errstr} ({$errno})"); break; default: debugLog("------------------------- ERROR BACKTRACE -------------------------"); debugLog("trace error: {$errfile}:{$errline} {$errstr} ({$errno}) - backtrace: " . (count($bt) - 1) . " steps"); for ($i = 1, $bt_length = count($bt); $i < $bt_length; $i++) { debugLog("trace: {$i}:" . $bt[$i]['file'] . ":" . $bt[$i]['line'] . " - " . (isset($bt[$i]['class']) ? $bt[$i]['class'] . $bt[$i]['type'] : "") . $bt[$i]['function'] . "()"); } break; } }
function ImportMessageReadFlag($id, $flags) { if ($this->_type != "syncmail") { return true; } // prevent sending readflags for objects that delete information was sentbefore if (in_array($id, $this->_deletedObjects)) { debugLog("Object {$id} discarded! Object got deleted prior the readflag set request arrived."); return true; } $this->_encoder->startTag(SYNC_MODIFY); $this->_encoder->startTag(SYNC_SERVERENTRYID); $this->_encoder->content($id); $this->_encoder->endTag(); $this->_encoder->startTag(SYNC_DATA); $this->_encoder->startTag(SYNC_POOMMAIL_READ); $this->_encoder->content($flags); $this->_encoder->endTag(); $this->_encoder->endTag(); $this->_encoder->endTag(); return true; }
/** * 返回用户信息,增加缓存 * * @param string $_user_id * @param bool $big_photo * false * @param number $cache_time * 3600 * @return array 不管用户是否存在都返回相关信息,可以使用字段“Account”判断用户是否存在 */ protected function getUserInfo($_user_id, $big_photo = false, $cache_time = 3600) { if (empty($_user_id)) { return array(); } $_key = md5(__METHOD__ . $_user_id . $big_photo); $cache_info = $this->cacheData($_key, null, $cache_time); debugLog(__METHOD__ . ':cache:' . !empty($this->cache_obj) . ':' . $_key . ':' . $_user_id, empty($cache_info['user_id']) ? 'miss' : 'hit'); if (!empty($cache_info['user_id'])) { return $cache_info; } else { $_data = User::GetProfile($_user_id); debugLog(__METHOD__ . ':User::GetProfile:' . $_user_id, $_data); $return['user_id'] = $_user_id; $return['nickname'] = empty($_data['nickname']) ? $_user_id : $_data['nickname']; $return['head'] = empty($_data['head']) ? null : $_data['head']; $return['photo'] = User::GetPhotoUrl($_user_id, $big_photo, $return['head']); $return['user_url'] = User::UserUrl($_user_id); // 可以使用这个字段来判断用户是否存在 $return['Account'] = empty($_data['Account']) ? null : $_data['Account']; $this->cacheData($_key, $return, $cache_time); return $return; } }
/** * @desc Finds all of the users in the course * @param $courseid -- the course id * @return record containing user information ( username, userid) */ function _wwassignment_get_course_students($courseid) { debugLog("Begin get_course_students({$courseid} )"); debugLog("courseID is " . print_r($courseid, true)); $context = get_context_instance(CONTEXT_COURSE, $courseid); debugLog("context is " . print_r($context, true)); $users = array(); $roles_used_in_context = get_roles_used_in_context($context); //debugLog("roles used ". print_r($roles_used_in_context, true)); foreach ($roles_used_in_context as $role) { $roleid = $role->id; debugLog("roleid should be 5 for a student {$roleid}"); //debugLog(get_role_users($roleid, $context, true) ); if ($new_users = get_role_users($roleid, $context, true)) { $users = array_merge($users, $new_users); //FIXME a user could be liseted twice } debugLog("display users " . print_r($users, true)); } debugLog("display users in course--on"); debugLog("users again" . print_r($users, true)); debugLog("End get_course_students({$courseid} )"); return $users; }
/** * filter sub arrays using a callback function on keys * * @param array $array array of arrays to filter * @param callable $callback callback function that return true or false * @param array $args array or arguments for callback, callable(array[n]->key(array[n]),args) * @return array array of arrays with select keys removed */ function filterSubArrayKey($array, $callback, $callbackargs) { if (function_exists($callback)) { foreach ($array as &$subarray) { foreach ($subarray as $key => $value) { // filter from array if callback returns true if ($callback($key, $callbackargs)) { unset($subarray[$key]); } } } } else { debugLog(__FUNCTION__ . ': callback not reachable: ' . $callback); } return $array; }
function HandleRequest($backend, $cmd, $devid, $protocolversion) { switch ($cmd) { case 'Sync': $status = HandleSync($backend, $protocolversion, $devid); break; case 'SendMail': $status = HandleSendMail($backend, $protocolversion); break; case 'SmartForward': $status = HandleSmartForward($backend, $protocolversion); break; case 'SmartReply': $status = HandleSmartReply($backend, $protocolversion); break; case 'GetAttachment': $status = HandleGetAttachment($backend, $protocolversion); break; case 'GetHierarchy': $status = HandleGetHierarchy($backend, $protocolversion, $devid); break; case 'CreateCollection': $status = HandleCreateCollection($backend, $protocolversion); break; case 'DeleteCollection': $status = HandleDeleteCollection($backend, $protocolversion); break; case 'MoveCollection': $status = HandleMoveCollection($backend, $protocolversion); break; case 'FolderSync': $status = HandleFolderSync($backend, $protocolversion); break; case 'FolderCreate': $status = HandleFolderCreate($backend, $protocolversion); break; case 'FolderDelete': $status = HandleFolderDelete($backend, $protocolversion); break; case 'FolderUpdate': $status = HandleFolderUpdate($backend, $protocolversion); break; case 'MoveItems': $status = HandleMoveItems($backend, $protocolversion); break; case 'GetItemEstimate': $status = HandleGetItemEstimate($backend, $protocolversion, $devid); break; case 'MeetingResponse': $status = HandleMeetingResponse($backend, $protocolversion); break; case 'Notify': // Used for sms-based notifications (pushmail) $status = HandleNotify($backend, $protocolversion); break; case 'Ping': // Used for http-based notifications (pushmail) $status = HandlePing($backend, $devid, $protocolversion); break; case 'Provision': $status = PROVISIONING === true ? HandleProvision($backend, $devid, $protocolversion) : false; break; case 'Search': $status = HandleSearch($backend, $devid, $protocolversion); break; default: debugLog("unknown command - not implemented"); $status = false; break; } return $status; }
function logContent($content) { if (!WBXML_DEBUG) { return; } $spaces = str_repeat(" ", count($this->logStack)); debugLog("O " . $spaces . $content); }
/** * Create the Cached Pages XML file * * Reads in each page of the site and creates a single XML file called * data/pages/pages.array * * @since 3.1 * */ function create_pagesxml($flag) { global $pagesArray; $success = ''; // debugLog("create_pagesxml: " . $flag); if (isset($_GET['upd']) && $_GET['upd'] == "edit-success" || $flag === true || $flag == 'true') { $pagesArray = array(); // debugLog("create_pagesxml proceeding"); $menu = ''; $filem = GSDATAOTHERPATH . "pages.xml"; $path = GSDATAPAGESPATH; $dir_handle = @opendir($path) or die("create_pagesxml: Unable to open {$path}"); $filenames = array(); while ($filename = readdir($dir_handle)) { $ext = substr($filename, strrpos($filename, '.') + 1); if ($ext == "xml") { $filenames[] = $filename; } } $count = 0; $xml = @new SimpleXMLExtended('<channel></channel>'); if (count($filenames) != 0) { foreach ($filenames as $file) { if ($file == "." || $file == ".." || is_dir(GSDATAPAGESPATH . $file) || $file == ".htaccess") { // not a page data file } else { $thisfile = file_get_contents($path . $file); $data = simplexml_load_string($thisfile); if (!$data) { // handle corrupt page xml debugLog("page {$file} is corrupt"); continue; } $count++; $id = $data->url; $pages = $xml->addChild('item'); // $pages->addChild('url', $id); // $pagesArray[(string)$id]['url']=(string)$id; foreach ($data->children() as $item => $itemdata) { if ($item != "content") { $note = $pages->addChild($item); $note->addCData($itemdata); $pagesArray[(string) $id][$item] = (string) $itemdata; } } $note = $pages->addChild('slug'); $note->addCData($id); $pagesArray[(string) $id]['slug'] = (string) $id; $pagesArray[(string) $id]['filename'] = $file; $note = $pages->addChild('filename'); $note->addCData($file); } // else } // end foreach } // endif if ($flag === true || $flag == 'true') { // Plugin Authors should add custom fields etc.. here $xml = exec_filter('pagecache', $xml); // sanity check in case the filter does not come back properly or returns null if ($xml) { $success = $xml->asXML($filem); } // debugLog("create_pagesxml saved: ". $success); exec_action('pagecache-aftersave'); return $success; } } }
require_once dirname(__FILE__) . '/class-album.php'; require_once dirname(__FILE__) . '/class-image.php'; require_once dirname(__FILE__) . '/class-search.php'; $_zp_loaded_plugins = array(); // load the class & filter plugins if (OFFSET_PATH != 2) { // setup does not need (and might have problems with) plugins $masks[] = CLASS_PLUGIN; if (OFFSET_PATH) { $masks[] = ADMIN_PLUGIN | FEATURE_PLUGIN; } if (DEBUG_PLUGINS) { if (OFFSET_PATH) { debugLog('Loading the "class" "feature" and "admin" plugins.'); } else { debugLog('Loading the "class" plugins.'); } } foreach ($masks as $mask) { foreach (getEnabledPlugins() as $extension => $plugin) { $priority = $plugin['priority']; if ($priority & $mask) { if (DEBUG_PLUGINS) { list($usec, $sec) = explode(" ", microtime()); $start = (double) $usec + (double) $sec; } require_once $plugin['path']; $_zp_loaded_plugins[$extension] = $extension; if (DEBUG_PLUGINS) { zpFunctions::pluginDebug($extension, $priority, $start); }
$r = min(1, $r); } $nw = round($watermark_width * $r); $nh = round($watermark_height * $r); if ($nw != $watermark_width || $nh != $watermark_height) { $watermark = zp_imageResizeAlpha($watermark, $nw, $nh); } // Position Overlay in Bottom Right $dest_x = max(0, floor(($imw - $nw) * $offset_w)); $dest_y = max(0, floor(($imh - $nh) * $offset_h)); zp_copyCanvas($newim, $watermark, $dest_x, $dest_y, 0, 0, $nw, $nh); zp_imageKill($watermark); } $iMutex->unlock(); if (!zp_imageOutput($newim, $suffix, $cache_path, $quality) && DEBUG_IMAGE) { debugLog('full-image failed to create:' . $image); } } } if (!is_null($cache_path)) { if ($disposal == 'Download' || !OPEN_IMAGE_CACHE) { require_once dirname(__FILE__) . '/lib-MimeTypes.php'; $mimetype = getMimeString($suffix); $fp = fopen($cache_path, 'rb'); // send the right headers header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header("Content-Type: {$mimetype}"); header("Content-Length: " . filesize($image_path)); // dump the picture and stop the script fpassthru($fp); fclose($fp);
/** * Z-Push helper for error logging * removing PEAR dependency * * @param string debug message * @return boolean always false as there was an error * @access private */ function raiseError($message) { debugLog("z_RFC822 error: " . $message); return false; }
function icalTimezoneFix($ical) { $stdTZpos = strpos($ical, "BEGIN:STANDARD"); $dltTZpos = strpos($ical, "BEGIN:DAYLIGHT"); // do not try to fix ical if TZ definitions are not set if ($stdTZpos === false || $dltTZpos === false) { return $ical; } $eventDate = substr($ical, strpos($ical, ":", strpos($ical, "DTSTART", strpos($ical, "BEGIN:VEVENT"))) + 1, 8); $posStd = strpos($ical, "DTSTART:", $stdTZpos) + strlen("DTSTART:"); $posDst = strpos($ical, "DTSTART:", $dltTZpos) + strlen("DTSTART:"); $beginStandard = substr($ical, $posStd, 8); $beginDaylight = substr($ical, $posDst, 8); if ($eventDate < $beginStandard && $eventDate < $beginDaylight) { debugLog("icalTimezoneFix for event on {$eventDate}, standard:{$beginStandard}, daylight:{$beginDaylight}"); $year = intval(date("Y")) - 1; $ical = substr_replace($ical, $year, $beginStandard < $beginDaylight ? $posDst : $posStd, strlen($year)); } return $ical; }
function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { debugLog("{$errfile}:{$errline} {$errstr} ({$errno})"); }
if ($editing && $userid !== _id($_POST['user'])) { $error = i18n_r('ER_REQ_PROC_FAIL'); break; } $userid = _id($_POST['user']); $file = $userid . '.xml'; if ($adding && path_is_safe(GSUSERSPATH . $file, GSUSERSPATH)) { $error = i18n_r('INVALID_USER'); // user already exists break; } if (!path_is_safe(dirname(GSUSERSPATH . $file), GSUSERSPATH, true)) { $error = i18n_r('INVALID_USER'); break; } debugLog("saving profile " . $userid); if (isset($_POST['name'])) { $name = var_in($_POST['name']); } if (isset($_POST['email'])) { $email = var_in($_POST['email'], 'email'); } if (isset($_POST['timezone'])) { $timezone = var_in($_POST['timezone']); } if (isset($_POST['lang'])) { $lang = var_in($_POST['lang']); } if (isset($_POST['show_htmleditor'])) { $htmleditor = var_in($_POST['show_htmleditor']); } else {
print "<h3>Error</h3><p>\n"; print "There was a problem processing the <i>{$cmd}</i> command from your PDA.\n"; print "</BODY>\n"; } } break; case 'GET': header("Content-type: text/html"); ?> <BODY> <h3>GET not supported</h3><p> This is the z-push location and can only be accessed by Microsoft ActiveSync-capable devices. </BODY> <?php break; } // destruct backend $backend->Logoff(); debugLog("end"); debugLog("--------"); $len = ob_get_length(); $data = ob_get_contents(); ob_end_clean(); // Unfortunately, even though zpush can stream the data to the client // with a chunked encoding, using chunked encoding also breaks the progress bar // on the PDA. So we de-chunk here and just output a content-length header and // send it as a 'normal' packet. If the output packet exceeds 1MB (see ob_start) // then it will be sent as a chunked packet anyway because PHP will have to flush // the buffer. header("Content-Length: {$len}"); print $data;