public function refreshSession() { // if(session_status()!=PHP_SESSION_ACTIVE){ session_start(); // } MeinBlog::log('refreshSession: ' . json_encode($_SESSION)); if (empty($_SESSION['user_id'])) { $this->user_id = null; $this->user_info = null; } else { $this->user_id = $_SESSION['user_id']; $this->user_info = $this->getUserAgent()->getUser($this->user_id); } }
function update($file_id, $editor_id, $title = false, $abstract = false, $category_id = false, $content = false) { // MeinBlog::log("update($file_id,$editor_id,$title=false,$abstract=false,$category_id=false,$content=false)"); if (empty($file_id) || empty($editor_id)) { return false; } $this->pdo->beginTransaction(); try { if ($content !== false) { $afx = MBFileContent::update($file_id, $content, $editor_id); if ($afx !== 1) { throw new Exception("Error in modifying file content.", 1); } } $sql_set = " update_time=NOW(), main_editor_id = " . $this->pdo->quote($editor_id, PDO::PARAM_INT); if ($title !== false) { $sql_set .= ', title = ' . $this->pdo->quote($title); } if ($abstract !== false) { if ($abstract === null) { $sql_set .= ', abstract = NULL '; } else { $sql_set .= ', abstract = ' . $this->pdo->quote($abstract); } } if ($category_id !== false) { $sql_set .= ', category_id = ' . $this->pdo->quote($category_id, PDO::PARAM_INT); } $sql = "UPDATE mb_file_header SET {$sql_set} WHERE file_id=" . $this->pdo->quote($file_id, PDO::PARAM_INT); $afx = $this->pdo->exec($sql); if ($afx !== 1) { throw new Exception("Error in modifying file header.", 1); } $this->pdo->commit(); return true; } catch (Exception $e) { $this->pdo->rollBack(); MeinBlog::log($e->getMessage()); } return false; }