relocation && $unset)) unset($_SESSION['mes_' . $name]); return $message; } /** * Save message in session * * $relocate - is relocate predicted * @param string $name message name * @param string $value value * @param boolean $relocate */ function setVar($name, $value, $relocate = true) { $this->relocation = $this->relocation || $relocate; $_SESSION['mes_' . $name] = $value; } /** * Set error * * @param string $name message name * @param string $value value * @param boolean $relocate */ function setError($name, $value, $relocate = true) { $this->setVar($name, '
Ошибка:
' . $value . '
', $relocate); } /** * Set message * * @param string $name message name * @param string $value value * @param boolean $relocate */ function setMessage($name, $value, $relocate = true) { $this->setVar($name, '
Сообщение:
' . $value . '
', $relocate); } /** * Add new message to list * * @param string $message message * @param boolean $relocate */ function addMessage($message, $relocate = true) { $this->relocation = $this->relocation || $relocate; $_SESSION['_MESSAGES'][] = $message; } /** * Add new error to list * * @param string $error message * @param boolean $relocate */ function addError($error, $relocate = true) { $this->relocation = $this->relocation || $relocate; $_SESSION['_ERRORS'][] = $error; } /** * Clear error list */ function clearErrors() { $_SESSION['_ERRORS'] = array(); } /** * Clear messages list */ function clearMessages() { $_SESSION['_MESSAGES'] = array(); } /** * Returns the number of errors in the session */ function isErrors() { return count($_SESSION['_ERRORS']); } /** * Get messages list * * @param boolean $unset delete after reading (if isRelocate==true, then message save) * @param boolean $hard delete message after reading, even isRelocate==true * @return string message */ function getMessages($unset = true, $hard = false) { $messages = (isset($_SESSION['_MESSAGES'])) ? $_SESSION['_MESSAGES'] : array(); if ($hard || (!$this->relocation && $unset)) $_SESSION['_MESSAGES'] = array(); if (count($messages)) return "
Сообщение:
" . implode("
", $messages) . "
"; return ''; } /** * Get a list of messages in a modal window * * @param boolean $unset delete after reading (if isRelocate==true, then message save) * @param boolean $hard delete message after reading, even isRelocate==true * @param boolean $JSStarter add a "; } $this->clearMessages(); $this->clearErrors(); } /** * Get a list of messages in a modal window (alias the getMessagesJS function) * * @param boolean $unset delete after reading (if isRelocate==true, then message save) * @param boolean $hard delete message after reading, even isRelocate==true * @param boolean $JSStarter add a "; } $this->clearMessages(); $this->clearErrors(); } /** * Get a list of messages in a parent window * * @param boolean $unset delete after reading (if isRelocate==true, then message save) * @param boolean $hard delete message after reading, even isRelocate==true */ function getMessagesJSP($unset = true, $hard = false) { $messages = (isset($_SESSION['_MESSAGES'])) ? $_SESSION['_MESSAGES'] : array(); if ($hard || (!$this->relocation && $unset)) $_SESSION['_MESSAGES'] = array(); echo ""; $this->clearMessages(); } /** * Get errors list * * @param boolean $unset delete after reading (if isRelocate==true, then message save) * @param boolean $hard delete message after reading, even isRelocate==true * @return string error message */ function getErrors($unset = true, $hard = false) { $errors = (isset($_SESSION['_ERRORS'])) ? $_SESSION['_ERRORS'] : array(); if ($hard || (!$this->relocation && $unset)) $_SESSION['_ERRORS'] = array(); if (count($errors)) return "
Ошибка:
" . implode("
", $errors) . "
"; return ''; } /** * Send message to user * * @global db $db * @param int $senderId sender * @param int $recipientId recipient * @param string $subject subject * @param string $text text messages * @return source SQL-query result */ function send($senderId, $recipientId, $subject, $text) { global $db; $subject = addslashes(stripslashes($subject)); $text = addslashes(stripslashes($text)); $time = mktime(); return $db->query("INSERT INTO `cms_messages`(`user_id`, `sender_id`, `subject`, `text`, `status`, `time`) VALUES ('$recipientId', '$senderId', '$subject', '$text', 'u', '$time')"); } /** * Send request to publicate * * @global db $db * @global user $user * @param int $structureId * @param int $sectionIdToCheckRights * @param string $tableName * @param int $recordId * @param int $userId * @param string $flag * @param string $url * @return source SQL-query result */ function sendRequest($structureId, $sectionIdToCheckRights, $tableName, $recordId, $userId = 0, $flag = '', $url = '') { global $db, $user; $userId = ($userId) ? $userId : $user->id; $time = mktime(); if (!$url) $url = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "/") + 1); return $db->query("INSERT INTO `cms_requests`(`str_id`, `rights`, `table`, `record_id`, `user_id`, `time`, `flag`, `url`) VALUES ('$structureId', '$sectionIdToCheckRights', '$tableName', '$recordId', '$userId', '$time', '$flag', '$url')"); } } new Messenger(); ?>can not create file (/var/virtual/www/cpreuro.ru/httpdocs/cache/personal/42216.ser)