/** * Down notify. * * @access public * @return void */ public function downNotify() { $notifyDir = $this->app->getBasePath() . 'www/data/notify/'; $packageFile = $notifyDir . 'notify.zip'; $loginFile = $notifyDir . 'config.json'; /* write login info into tmp file. */ $loginInfo = new stdclass(); $userInfo = new stdclass(); $userInfo->Account = $this->app->user->account; $userInfo->Url = common::getSysURL() . $this->config->webRoot; $userInfo->PassMd5 = ''; $userInfo->Role = $this->app->user->role; $userInfo->AutoSignIn = true; $userInfo->Lang = $this->cookie->lang; $loginInfo->User = $userInfo; $loginInfo->LastLoginTime = time() / 86400 + 25569; $loginInfo = json_encode($loginInfo); file_put_contents($loginFile, $loginInfo); define('PCLZIP_TEMPORARY_DIR', $notifyDir); $this->app->loadClass('pclzip', true); /* remove the old config.json, add a new one. */ $archive = new pclzip($packageFile); $result = $archive->delete(PCLZIP_OPT_BY_NAME, 'config.json'); if ($result == 0) { die("Error : " . $archive->errorInfo(true)); } $result = $archive->add($loginFile, PCLZIP_OPT_REMOVE_ALL_PATH); if ($result == 0) { die("Error : " . $archive->errorInfo(true)); } unlink($loginFile); $this->fetch('file', 'sendDownHeader', array('fileName' => 'notify.zip', 'zip', file_get_contents($packageFile))); $result = $archive->delete(PCLZIP_OPT_BY_NAME, 'config.json'); if ($result == 0) { die("Error : " . $archive->errorInfo(true)); } }