function cancelLicense($option) { global $database; $row = new mosDMLicenses($database); $row->bind(DOCMAN_Utils::stripslashes($_POST)); $row->checkin(); mosRedirect("index2.php?option={$option}§ion=licenses"); }
function cancelLicense($option) { $mainframe = JFactory::getApplication(); $database = JFactory::getDBO(); $row = new mosDMLicenses($database); $row->bind(DOCMAN_Utils::stripslashes($_POST)); $row->checkin(); $mainframe->redirect("index.php?option={$option}§ion=licenses"); }
function stripslashes($post) { if (get_magic_quotes_gpc()) { $ret = ''; if (is_string($post)) { $ret = stripslashes($post); } else { if (is_array($post)) { $ret = array(); foreach ($post as $key => $val) { $ret[$key] = DOCMAN_Utils::stripslashes($val); } } else { $ret = $post; } } return $ret; } return $post; }
function saveConfig() { DOCMAN_token::check() or die('Invalid Token'); global $_DOCMAN, $task; $mainframe = JFactory::getApplication(); $_POST = DOCMAN_Utils::stripslashes($_POST); $docmanMax = DOCMAN_Utils::text2number($_POST['maxAllowed']); $_POST['maxAllowed'] = $docmanMax; $sysUploadMax = DOCMAN_Utils::text2number(ini_get('upload_max_filesize')); $sysPostMax = DOCMAN_Utils::text2number(ini_get('post_max_size')); $max = min($sysUploadMax, $sysPostMax); if ($docmanMax < 0) { $mainframe->redirect("index.php?option=com_docman§ion=config", _DML_CONFIG_ERROR_UPLOAD); } $override_edit = _DM_ASSIGN_NONE; $author = JRequest::getBool('assign_edit_author', 0, 'post'); $editor = JRequest::getBool('assign_edit_editor', 0, 'post'); if ($author) { $override_edit = _DM_ASSIGN_BY_AUTHOR; } if ($editor) { $override_edit = _DM_ASSIGN_BY_EDITOR; } if ($author && $editor) { $override_edit = _DM_ASSIGN_BY_AUTHOR_EDITOR; } $_POST['editor_assign'] = $override_edit; unset($_POST['assign_edit_author']); unset($_POST['assign_edit_editor']); $override_down = _DM_ASSIGN_NONE; $author = JRequest::getBool('assign_download_author', 0, 'post'); $editor = JRequest::getBool('assign_download_editor', 0, 'post'); if ($author) { $override_down = _DM_ASSIGN_BY_AUTHOR; } if ($editor) { $override_down = _DM_ASSIGN_BY_EDITOR; } if ($author && $editor) { $override_down = _DM_ASSIGN_BY_AUTHOR_EDITOR; } $_POST['reader_assign'] = $override_down; unset($_POST['assign_download_author']); unset($_POST['assign_download_editor']); foreach ($_POST as $key => $value) { $_DOCMAN->setCfg($key, $value); } if ($_DOCMAN->saveConfig()) { if ($max < $docmanMax) { $mainframe->redirect("index.php?option=com_docman§ion=config", _DML_CONFIG_WARNING . DOCMAN_UTILS::number2text($max)); } else { $section = $task == 'apply' ? '§ion=config' : ''; $mainframe->redirect('index.php?option=com_docman' . $section, _DML_CONFIG_UPDATED); } } else { $mainframe->redirect("index.php?option=com_docman§ion=config", _DML_CONFIG_ERROR); } }
function saveDocument($uid) { DOCMAN_token::check() or die('Invalid Token'); global $_DOCMAN, $_DMUSER; jimport('joomla.filesystem.file'); $database = JFactory::getDBO(); //fetch params $params = JRequest::getVar('params', array(), 'request', 'array'); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['attribs'] = implode("\n", $txt); } $doc = new mosDMDocument($database); $doc->load(JRequest::getInt('id')); // get the uploaded filename from the session $session = JFactory::getSession(); if ($session->get('docman.dmfilename')) { $_POST['dmfilename'] = $session->get('docman.dmfilename'); $_POST['document_url'] = $session->get('docman.document_url'); } else { $_POST['dmfilename'] = $doc->dmfilename; unset($_POST['document_url']); } $doc->bind(DOCMAN_Utils::stripslashes($_POST)); // plugins $logbot = new DOCMAN_mambot('onLog'); $postbot = new DOCMAN_mambot('onAfterEditDocument'); $logbot->setParm('document', $doc); $logbot->setParm('file', $_POST['dmfilename']); $logbot->setParm('user', $_DMUSER); if (!$uid) { $logbot->copyParm('process', 'new document'); } else { $logbot->copyParm('process', 'edit document'); } $logbot->copyParm('new', !$uid); $postbot->setParmArray($logbot->getParm()); // let's indicate last update information to store if ($doc->save()) { $session->set('docman.dmfilename', null); $session->set('docman.document_url', null); $logbot->copyParm('msg', 'Document saved'); $logbot->copyParm('status', 'LOG_OK'); $logbot->trigger(); // if submited for the first time lets do auto-approve/publish operations if (!$uid) { autoApprove($doc); autoPublish($doc); } // If document is saved, trigger the postbot. $postbot->trigger(); if ($postbot->getError()) { $logbot->copyParm('msg', $postbot->getErrorMsg()); $logbot->copyParm('status', 'LOG_ERROR'); $logbot->trigger(); _returnTo('cat_view', $postbot->getErrorMsg()); } _returnTo('cat_view', _DML_THANKSDOCMAN, $doc->catid); } // doc->save failed. Log error $logbot->copyParm('msg', $doc->getError()); $logbot->copyParm('status', 'LOG_ERROR'); $logbot->trigger(); _returnTo('cat_view', _DML_PROBLEM_SAVING_DOCUMENT); }
/** * Cancels an edit operation * * @param string $ The name of the category section * @param integer $ A unique category id */ function cancelCategory() { $database = JFactory::getDBO(); $mainframe = JFactory::getApplication(); $row = new mosDMCategory($database); $row->bind(DOCMAN_Utils::stripslashes($_POST)); $row->checkin(); $mainframe->redirect('index.php?option=com_docman§ion=categories'); }
function saveDocument() { DOCMAN_token::check() or die('Invalid Token'); global $task, $_DMUSER; $database = JFactory::getDBO(); $mainframe = JFactory::getApplication(); //fetch current id $cid = JRequest::getInt('cid', 0, 'post'); //fetch params $params = JRequest::getVar('params', array(), 'post', 'array'); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['attribs'] = implode("\n", $txt); } $doc = new mosDMDocument($database); // Create record $doc->load($cid); // Load from id $doc->bind(DOCMAN_Utils::stripslashes($_POST)); /* ------------------------------ * * MAMBOT - Setup All Mambots * * ------------------------------ */ $logbot = new DOCMAN_mambot('onLog'); $postbot = new DOCMAN_mambot('onAfterEditDocument'); $logbot->setParm('document', $doc); $logbot->setParm('file', DOCMAN_Utils::stripslashes($_POST['dmfilename'])); $logbot->setParm('user', $_DMUSER); if (!$cid) { $logbot->copyParm('process', 'new document'); } else { $logbot->copyParm('process', 'edit document'); } $logbot->copyParm('new', !$cid); $postbot->setParmArray($logbot->getParm()); $postbot->trigger(); if ($postbot->getError()) { $logbot->copyParm('msg', $postbot->getErrorMsg()); $logbot->copyParm('status', 'LOG_ERROR'); $logbot->trigger(); $mainframe->redirect("index.php?option=com_docman§ion=documents", $postbot->getErrorMsg()); } if ($doc->save()) { // Update from browser $logbot->copyParm('msg', 'Document saved'); $logbot->copyParm('status', 'LOG_OK'); $logbot->trigger(); if ($task == 'save') { $url = 'index.php?option=com_docman§ion=documents'; } else { // $task = 'apply' $url = 'index.php?option=com_docman§ion=documents&task=edit&cid[0]=' . $doc->id; } $mainframe->redirect($url, _DML_SAVED_CHANGES); } $logbot->copyParm('msg', $doc->getError()); $logbot->copyParm('status', 'LOG_ERROR'); $logbot->trigger(); $mainframe->redirect('index.php?option=com_docman§ion=documents', $doc->getError()); }
function cancel() { $this->bind(DOCMAN_Utils::stripslashes($_POST)); $this->checkin(); return true; }
function saveDocument($uid) { DOCMAN_token::check() or die('Invalid Token'); global $database, $_DMUSER; //fetch params $params = mosGetParam($_REQUEST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['attribs'] = implode("\n", $txt); } $doc = new mosDMDocument($database); $doc->load($uid); // Load from id $doc->bind(DOCMAN_Utils::stripslashes($_POST)); /* ------------------------------ * * MAMBOT - Setup All Mambots * * ------------------------------ */ $logbot = new DOCMAN_mambot('onLog'); $postbot = new DOCMAN_mambot('onAfterEditDocument'); $logbot->setParm('document', $doc); $logbot->setParm('file', $_POST['dmfilename']); $logbot->setParm('user', $_DMUSER); if (!$uid) { $logbot->copyParm('process', 'new document'); } else { $logbot->copyParm('process', 'edit document'); } $logbot->copyParm('new', !$uid); $postbot->setParmArray($logbot->getParm()); $postbot->trigger(); if ($postbot->getError()) { $logbot->copyParm('msg', $postbot->getErrorMsg()); $logbot->copyParm('status', 'LOG_ERROR'); $logbot->trigger(); _returnTo('cat_view', $postbot->getErrorMsg()); } // let's indicate last update information to store if ($doc->save()) { $logbot->copyParm('msg', 'Document saved'); $logbot->copyParm('status', 'LOG_OK'); $logbot->trigger(); // if submited for the first time lets do auto-approve/publish operations if (!$uid) { autoApprove($doc); autoPublish($doc); } /* removed $message: undefined * original code: * _returnTo('cat_view', _DML_THANKSDOCMAN . $message ? "<br />" . $message : '', $doc->catid); */ _returnTo('cat_view', _DML_THANKSDOCMAN, $doc->catid); } // doc->save failed. Log error $logbot->copyParm('msg', $doc->getError()); $logbot->copyParm('status', 'LOG_ERROR'); $logbot->trigger(); _returnTo('cat_view', _DML_PROBLEM_SAVING_DOCUMENT); }
/** * Uploads a file using the HTTP protocol * * @desc Uploads a file using HTTP. * @param void * @return boolean Returns true if succeed and false if not. Sets $this->_err with false. */ function uploadHTTP(&$file, $path, $validate = _DM_VALIDATE_ALL) { $name = DOCMAN_Utils::stripslashes($file['name']); $errorcode = $file['error'] ? $file['error'] : 0; $temp_name = trim($file['tmp_name']); if ($validate & _DM_VALIDATE_PATH && !$this->validatePath($path) || $validate & _DM_VALIDATE_NAME && !$this->validateName($name) || $validate & _DM_VALIDATE_EXISTS && !$this->validateExists($name, $path) || $validate & _DM_VALIDATE_SIZE && !$this->validateSize($temp_name) || $validate & _DM_VALIDATE_EXT && !$this->validateExt($name)) { return false; } if ($errorcode == 0) { return $this->_upload($name, $temp_name, $path); } // Finish by handling errors switch ($errorcode) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $this->_err = _DML_SIZEEXCEEDS; break; case UPLOAD_ERR_PARTIAL: $this->_err = _DML_ONLYPARTIAL; break; case UPLOAD_ERR_NO_FILE: $this->_err = _DML_NOUPLOADED; break; default: $this->_err = _DML_TRANSFERERROR . " {$errorcode}"; break; } return false; }
/** * Cancels an edit operation * * @param string $ The name of the category section * @param integer $ A unique category id */ function cancelCategory() { global $database; $row = new mosDMCategory($database); $row->bind(DOCMAN_Utils::stripslashes($_POST)); $row->checkin(); mosRedirect('index2.php?option=com_docman§ion=categories'); }
<?php /** * DOCman 1.4.x - Joomla! Document Manager * @version $Id: files.php 657 2008-03-21 10:03:58Z mjaz $ * @package DOCman_1.4 * @copyright (C) 2003-2008 The DOCman Development Team * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.joomlatools.org/ Official website **/ defined('_VALID_MOS') or die('Restricted access'); include_once dirname(__FILE__) . '/files.html.php'; require_once $_DOCMAN->getPath('classes', 'file'); require_once $_DOCMAN->getPath('classes', 'utils'); // retrieve some expected url (or form) arguments $old_filename = mosGetParam(DOCMAN_Utils::stripslashes($_REQUEST), 'old_filename', 1); switch ($task) { case "new": // make a new document using the selected file // modify the request and go to 'documents' view $_REQUEST['section'] = 'documents'; $_REQUEST['uploaded_file'] = $cid[0]; $GLOBALS['section'] = 'documents'; $GLOBALS['uploaded_file'] = $cid[0]; include_once $_DOCMAN->getPath('includes', 'documents'); break; case "upload": $step = mosGetParam($_REQUEST, 'step', 1); $method = mosGetParam($_POST, 'radiobutton', null); if (!$method) { $method = mosGetParam($_REQUEST, 'method', 'http');