function fetchMethodForm($uid, $step, $update = false)
 {
     global $task;
     switch ($step) {
         case 2:
             $lists = array();
             $lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false);
             $lists['url'] = '';
             $lists['localfile'] = '';
             return HTML_DMUploadMethod::transferFileForm($lists);
             break;
         case 3:
             $url = stripslashes(mosGetParam($_REQUEST, 'url', 'http://'));
             $file = stripslashes(mosGetParam($_REQUEST, 'localfile', ''));
             $err = DMUploadMethod::transferFileProcess($uid, $step, $url, $file);
             if ($err['_error']) {
                 _returnTo($task, $err['_errmsg'], '', array("method" => 'transfer', "step" => $step - 1, "localfile" => $file, "url" => DOCMAN_Utils::safeEncodeURL($url)));
             }
             $catid = $update ? 0 : $uid;
             $docid = $update ? $uid : 0;
             return fetchEditDocumentForm($docid, $file->name, $catid);
             break;
         default:
             break;
     }
     return true;
 }
 function fetchMethodForm($uid, $step, $update = false)
 {
     global $task;
     switch ($step) {
         case 2:
             $lists = array();
             $lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false);
             return HTML_DMUploadMethod::linkFileForm($lists);
             break;
         case 3:
             $url = stripslashes(JRequest::getString('url', 'http://'));
             $err = DMUploadMethod::linkFileProcess($uid, $step, $url);
             if ($err['_error']) {
                 _returnTo($task, $err['_errmsg'], '', array("method" => 'link', "step" => $step - 1, "localfile" => '', "url" => DOCMAN_Utils::safeEncodeURL($url)));
             }
             $uploaded = DOCMAN_Utils::safeEncodeURL(_DM_DOCUMENT_LINK . $url);
             $catid = $update ? 0 : $uid;
             $docid = $update ? $uid : 0;
             $session = JFactory::getSession();
             $session->set('docman.dmfilename', _DM_DOCUMENT_LINK);
             $session->set('docman.document_url', $url);
             return fetchEditDocumentForm($docid, $uploaded, $catid);
             break;
         default:
             break;
     }
     return true;
 }
Example #3
0
function cancelLicense($option)
{
    global $database;
    $row = new mosDMLicenses($database);
    $row->bind(DOCMAN_Utils::stripslashes($_POST));
    $row->checkin();
    mosRedirect("index2.php?option={$option}&section=licenses");
}
Example #4
0
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}&section=licenses");
}
/**
* Search method
* @param 'text'     element is the search term(s)
* @param 'phrase'   element is whether this is a term/phrase/word to search for
* @param 'ordering' element is how to sort the results
*
* Returns an array that contains:
* 	title		Title of the article (ie subject)
*	section		Section name. We use 'Forum:category/section'
*	text		Text from matching articles
*	created		Date created (standard format 2004-....)
*	browsernav	'2' to open in this window
*	href		the link to get back to here.
*
*/
function botSearchDocman($phrase, $mode = '', $ordering = '', $areas = null)
{
    global $_DOCMAN, $Itemid;
    $database = JFactory::getDBO();
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchDocmanAreas()))) {
            return array();
        }
    }
    $phrase = trim($phrase);
    if ($phrase == '') {
        return array();
    }
    $plugin =& JPluginHelper::getPlugin('search', 'docman.searchbot');
    $params = new JParameter($plugin->params);
    $section_prefix = $params->get('prefix', 'Downloads: ');
    $section_suffix = $params->get('suffix', '');
    $search_name = $params->get('search_name', 0);
    $search_desc = $params->get('search_description', 0);
    $search_cat = $params->get('search_cat', 0);
    $hreftask = $params->get('href', 'download');
    if (!($search_name || $search_desc || $search_cat)) {
        return array();
    }
    // INTERFACE to standard class
    $search_for = array(array('search_phrase' => $phrase, 'search_mode' => $mode));
    // ...href...
    $DMItemid = DOCMAN_Utils::getItemid();
    switch ($hreftask) {
        case 'download':
            $href = "CONCAT('index.php?option=com_docman&task=doc_download&gid=', DM.id, '&Itemid={$DMItemid}' )";
            break;
        case 'details':
            $href = "CONCAT('index.php?option=com_docman&task=doc_details&gid=', DM.id, '&Itemid={$DMItemid}' )";
            break;
        case 'display':
        default:
            $href = "CONCAT('index.php?option=com_docman&task=cat_view&gid=', DM.catid, '&Itemid={$DMItemid}' )";
            break;
    }
    $columns = array("DM.dmname" => "title", "DM.dmdescription" => "text", "DM.dmlastupdateon" => "created", "'2'" => "browsernav", "{$href}" => "href", "DM.catid" => "catid");
    $options = array();
    if ($search_name) {
        $options[] = 'search_name';
    }
    if ($search_desc) {
        $options[] = 'search_desc';
    }
    if ($search_cat) {
        $options[] = 'search_cat';
    }
    $options['section_prefix'] = $section_prefix;
    $options['section_suffix'] = $section_suffix;
    $options['hreftask'] = $hreftask;
    return DOCMAN_Docs::search($search_for, $ordering, 0, $columns, $options);
}
    function transferFileForm($lists)
    {
        ob_start();
        ?>
    	<form action="<?php 
        echo sefRelToAbs($lists['action']);
        ?>
" method="post" id="dm_frmupload" class="dm_form">
		<fieldset class="input">
			<p><label for="url"><?php 
        echo _DML_REMOTEURL;
        ?>
</label><br />
	   		<input name="url" type="text" id="url" value="<?php 
        echo $lists['url'];
        ?>
" />
			<?php 
        echo DOCMAN_Utils::mosToolTip(_DML_REMOTEURLTT . '</span>', _DML_REMOTEURL . ':');
        ?>
</p>
			<p><label for="localfile"><?php 
        echo _DML_LOCALNAME;
        ?>
</label><br />
	   		<input name="localfile" type="text" id="url" value="<?php 
        echo $lists['localfile'];
        ?>
">
			<?php 
        echo DOCMAN_Utils::mosToolTip(_DML_LOCALNAMETT . '</span>', _DML_LOCALNAME . ':');
        ?>
</p>
		</fieldset>
	   	<fieldset class="dm_button">
			<input name="submit" id="dm_btn_back"   class="button" value="<?php 
        echo _DML_BACK;
        ?>
" onclick="window.history.back()" type="button" >
			<input name="submit" id="dm_btn_submit" class="button" value="<?php 
        echo _DML_TRANSFER;
        ?>
" type="submit" />
        </fieldset>
        <input type="hidden" name="method" value="transfer" />
        <?php 
        echo DOCMAN_token::render();
        ?>
        </form>
    	<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Example #7
0
 function _setConfig()
 {
     global $_DOCMAN;
     // Get the configuartion object
     require_once $this->path . "themeConfig.php";
     $this->setError('docman');
     $theme = new StdClass();
     $theme->conf =& new themeConfig();
     $theme->name = $this->name;
     $theme->path = $_DOCMAN->getPath('themes', $this->name, 1);
     $theme->icon = DOCMAN_Utils::pathIcon(null, 1);
     $theme->png = DOCMAN_Utils::supportPng();
     $this->theme =& $theme;
 }
 function _setConfig()
 {
     global $_DOCMAN;
     // Get the configuartion object
     require_once $this->path . 'themeConfig.php';
     $this->setError('docman');
     $theme = new StdClass();
     $theme->conf = new themeConfig();
     $theme->name = $this->name;
     if (!$this->name) {
         throw new Exception('Theme name not found');
     }
     $theme->path = $_DOCMAN->getPath('themes', $this->name, 1);
     $theme->icon = DOCMAN_Utils::pathIcon(null, 1);
     $theme->png = DOCMAN_Utils::supportPng();
     $this->theme =& $theme;
 }
Example #9
0
function fetchCategoryList($id)
{
    global $_DOCMAN, $_DMUSER;
    $children = DOCMAN_Cats::getChildsByUserAccess($id);
    $items = array();
    foreach ($children as $child) {
        $cat = new DOCMAN_Category($child->id);
        // process content mambots
        DOCMAN_Utils::processContentBots($cat, 'description');
        $item = new StdClass();
        $item->links =& $cat->getLinkObject();
        $item->paths =& $cat->getPathObject();
        $item->data =& $cat->getDataObject();
        $items[] = $item;
    }
    // display the entries
    return HTML_DMCategories::displayCategoryList($items);
}
    /**
     * Output a <script></script> link to a dynamic generated JavaScript file.
     *
     * @access public
     * @return string
     */
    function plugin($params = null)
    {
        global $task, $gid;
        $link = JURI::root(true) . "/index.php?option=com_docman&task={$task}&tmpl=component";
        if (is_array($params)) {
            $link .= "&" . DOCMAN_Utils::implode_assoc('=', '&', $params);
        }
        $link .= "&script=1";
        ob_start();
        ?>
        <script language="javascript" type="text/javascript" src="<?php 
        echo $link;
        ?>
"></script>
        <?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Example #11
0
function getSearchResult($gid, $itemid)
{
    global $search_mode, $ordering, $invert_search, $reverse_order, $search_where, $search_phrase, $search_catid;
    $search_mode = ($invert_search ? '-' : '') . $search_mode;
    $searchList = array(array('search_mode' => $search_mode, 'search_phrase' => $search_phrase));
    $ordering = ($reverse_order ? '-' : '') . $ordering;
    $rows = DOCMAN_Docs::search($searchList, $ordering, $search_catid, '', $search_where);
    // This acts as the search header - so they can perform search again
    if (count($rows) == 0) {
        $msg = _DML_NOKEYWORD;
    } else {
        $msg = sprintf(_DML_SEARCH . ' ' . _DML_SEARCH_MATCHES, count($rows));
    }
    $items = array();
    if (count($rows) > 0) {
        foreach ($rows as $row) {
            // onFetchDocument event, type = list
            $bot = new DOCMAN_mambot('onFetchDocument');
            $bot->setParm('id', $row->id);
            $bot->copyParm('type', 'list');
            $bot->trigger();
            if ($bot->getError()) {
                _returnTo('cat_view', $bot->getErrorMsg());
            }
            // load doc
            $doc =& DOCMAN_Document::getInstance($row->id);
            // process content mambots
            DOCMAN_Utils::processContentBots($doc, 'dmdescription');
            $item = new StdClass();
            $item->buttons =& $doc->getLinkObject();
            $item->paths =& $doc->getPathObject();
            $item->data =& $doc->getDataObject();
            $item->data->category = $row->section;
            $items[] = $item;
        }
    }
    return $items;
}
    /**
     * Output a <script></script> link to a dynamic generated JavaScript file.
     *
     * @access public
     * @return string
     */
    function plugin($params = null)
    {
        global $mainframe, $mosConfig_live_site;
        global $task, $gid;
        if (defined('_DM_J15')) {
            $link = $mosConfig_live_site . "/index.php?option=com_docman&task={$task}&tmpl=component";
        } else {
            $link = $mosConfig_live_site . "/index2.php?option=com_docman&task={$task}&no_html=1";
        }
        if (is_array($params)) {
            $link .= "&" . DOCMAN_Utils::implode_assoc('=', '&', $params);
        }
        $link .= "&script=1";
        ob_start();
        ?>
        <script language="javascript" type="text/javascript" src="<?php 
        echo $link;
        ?>
"></script>
        <?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Example #13
0
 function getAncestorsRecurse($id, &$cats, &$ancestors)
 {
     $cat = new StdClass();
     $cat->name = $cats[$id]->name;
     $cat->title = $cats[$id]->title;
     $sef = defined('_DM_J15') ? false : true;
     $cat->link = DOCMAN_Utils::taskLink('cat_view', $id, null, $sef);
     $ancestors[] =& $cat;
     $id = $cats[$id]->parent;
     if ($id != 0) {
         DOCMAN_Cats::getAncestorsRecurse($id, $cats, $ancestors);
     }
 }
Example #14
0
if (!$cntItems) {
    ?>
     	<tr><th><?php 
    echo _DML_MOD_NEWS_NO_ITEMS;
    ?>
</th></tr><?php 
} else {
    $cntItems = $cntItems > $limit ? $limit : $cntItems;
    for ($j = 0; $j < $cntItems; $j++) {
        $item =& $rss->get_item($j);
        ?>
           	<tr><td>
             	<a href="<?php 
        echo $item->get_link();
        ?>
" target="_blank"><?php 
        echo $item->get_title();
        ?>
</a><?php 
        if ($description = DOCMAN_Utils::snippet($item->get_description(), $desc_truncate)) {
            ?>
                 	<br /><?php 
            echo $description;
        }
        ?>
          	</td></tr><?php 
    }
}
?>
 </tbody>
</table>
 /**
  * @param object A param tag node
  * @return array Any array of the label, the form element and the tooltip
  */
 function renderParam(&$param, $control_name = 'params')
 {
     $result = array();
     $name = $param->getAttribute('name');
     $label = $param->getAttribute('label');
     $value = $this->get($name, $param->getAttribute('default'));
     $description = $param->getAttribute('description');
     $result[0] = $label ? $label : $name;
     if ($result[0] == '@spacer') {
         $result[0] = '<hr />';
     } else {
         if ($result[0]) {
             $result[0] .= ':';
         }
     }
     $type = $param->getAttribute('type');
     if (in_array('_form_' . $type, $this->_methods)) {
         $result[1] = call_user_func(array($this, '_form_' . $type), $name, $value, $param, $control_name);
     } else {
         $result[1] = _HANDLER . ' = ' . $type;
     }
     if ($description) {
         $result[2] = DOCMAN_Utils::mosToolTip($description, $name);
     } else {
         $result[2] = '';
     }
     return $result;
 }
Example #16
0
</th>
	</tr><?php 
if (!count($rows)) {
    echo '<tr><td>' . _DML_MOD_MOST_NODOCUMENTS . '</tr></td>';
}
foreach ($rows as $row) {
    ?>
    	<tr>
    	    <td><a href="#edit" onClick="submitcpform('<?php 
    echo $row->id;
    ?>
', '<?php 
    echo $row->id;
    ?>
')"><?php 
    echo $row->dmname;
    ?>
</a>
    	    </td>
    	    <td align="right"><?php 
    echo $row->dmcounter;
    ?>
</td>
    	</tr><?php 
}
?>
    <tr><th colspan="2"><?php 
DOCMAN_Utils::getModuleButtons($name);
?>
</th></tr>
</table>
Example #17
0
 function maintainerList(&$doc, $name, $attributes = null, $tabOffset = 0)
 {
     global $_DMUSER;
     $html = '';
     if ($_DMUSER->canAssignMaintainer($doc)) {
         //create select list
         $select =& new dmHTML_UserSelect($name, 1, $attributes, $tabOffset);
         $select->addOption(_DML_SELECT_USER, _DM_PERMIT_NOOWNER);
         $select->addGeneral(_DML_NO_USER_ACCESS);
         $select->addMamboGroups();
         $select->addDocmanGroups();
         $select->addUsers();
         $select->setSelectedValues(array($doc->dmmantainedby));
         $html = $select->toHtml();
     } else {
         $username = DOCMAN_Utils::getUserName($doc->dmmantainedby);
         $html .= '<input type="text" readonly="readonly" value="' . $username . '"  />';
         $html .= '<input type="hidden" name="dmmantainedby" value="' . $doc->dmmantainedby . '" />';
     }
     return $html;
 }
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);
}
    function configuration(&$lists)
    {
        global $_DOCMAN;
        jimport('joomla.html.pane');
        $tabs =& JPane::getInstance('Tabs', array('useCookies' => true));
        JHTML::_('behavior.tooltip');
        ?>

        <script language="JavaScript" src="<?php 
        echo JURI::root(true);
        ?>
/includes/js/overlib_mini.js" type="text/javascript"></script>

		<style>
			.dmtitle { background-color: #EEE; font-weight:  bold; border-bottom: 1px solid #BBB; }
			.checkList label { padding-left: 10px; }
			select option.label { background-color: #EEE; border: 1px solid #DDD; color : #333; }
		</style>

        <?php 
        dmHTML::adminHeading(_DML_CONFIGURATION, 'config');
        ?>

        <div class="dm_filters">
            <span class="componentheading">docman.config.php:
			 <?php 
        echo is_writable(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'docman.config.php') ? '<b><font color="green">' . _DML_WRITABLE . '</font></b>' : '<b><font color="red">' . _DML_UNWRITABLE . '</font></b>';
        ?>
			</span>
        </div>

        <script language="javascript" type="text/javascript">
            function submitbutton(pressbutton) {
                var form = document.adminForm;
                if (pressbutton == 'cancel') {
                    submitform( pressbutton );
                    return;
                }
		  $msg = "";
          if (form.dmpath.value == ""){
			$msg = "\n<?php 
        echo _DML_CFG_ERR_DOCPATH;
        ?>
";
		  }
		  if( isNaN( parseInt( form.perpage.value ) ) ||
			  parseInt( form.perpage.value ) < 1 ) {
			$msg += "\n<?php 
        echo _DML_CFG_ERR_PERPAGE;
        ?>
";
		  }
		  if( isNaN( parseInt( form.days_for_new.value ) ) ||
			  parseInt( form.days_for_new.value ) < 0 ) {
			$msg += "\n<?php 
        echo _DML_CFG_ERR_NEW;
        ?>
";
		  }
		  if( isNaN( parseInt( form.hot.value ) ) ||
			  parseInt( form.hot.value ) < 0 ) {
			$msg += "\n<?php 
        echo _DML_CFG_ERR_HOT;
        ?>
";
		  }
		  if( form.user_upload.value == "<?php 
        echo _DM_PERMIT_NOOWNER;
        ?>
"){
			$msg += "\n<?php 
        echo _DML_CFG_ERR_UPLOAD;
        ?>
";
		  }
		  if( form.user_approve.value == "<?php 
        echo _DM_PERMIT_NOOWNER;
        ?>
" ){
			$msg += "\n<?php 
        echo _DML_CFG_ERR_APPROVE;
        ?>
";
		  }
		  if( form.default_viewer.value == "<?php 
        echo _DM_PERMIT_NOOWNER;
        ?>
" ){
			$msg += "\n<?php 
        echo _DML_CFG_ERR_DOWNLOAD;
        ?>
";
		  }
		  if( form.default_editor.value == "<?php 
        echo _DM_PERMIT_NOOWNER;
        ?>
" ){
			$msg += "\n<?php 
        echo _DML_CFG_ERR_EDIT;
        ?>
";
		  }

          if ( $msg != "" ){
                $msghdr = "<?php 
        echo _DML_ENTRY_ERRORS;
        ?>
";
                $msghdr += '\n=================================';
                alert( $msghdr+$msg+'\n' );

          } else {
        	   submitform( pressbutton );
          }
        }

        /* Make sure the user can only use 0-9 and K, M, G */
        function dmFilesize(f) {
        	var re = /[0-9KMGkmg]*/;
            f.value = f.value.match(re);
        }
        </script>

        <form action="index.php?option=com_docman&amp;task=saveconfig" method="post" name="adminForm" id="adminForm">
        <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

        <?php 
        echo $tabs->startPane("configPane");
        echo $tabs->startPanel(_DML_GENERAL, "general-page");
        ?>
	    <fieldset class="adminform">
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<?php 
        echo _DML_VERSION;
        ?>
	            </td>
	            <td><?php 
        echo _DM_VERSION;
        ?>
</td>
	            <td>&nbsp;</td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_PATHFORSTORING . '::' . _DML_CFG_PATHTT;
        ?>
"><?php 
        echo _DML_CFG_PATHFORSTORING;
        ?>
</label>
	            </td>
	            <td>
	                <?php 
        $newpath = JPATH_ROOT . DS . _DM_DEFAULT_DATA_FOLDER;
        $path = $_DOCMAN->getCfg('dmpath');
        if (empty($path) || !is_dir($path)) {
            $path = $newpath;
        }
        ?>
	                <input size="50" type="text" name="dmpath" value="<?php 
        echo $path;
        ?>
" />
	            </td>
				<td>
	                <input type="button" value="<?php 
        echo _DML_RESETDEFAULT;
        ?>
" name="Reset" onclick="document.adminForm.dmpath.value='<?php 
        echo addslashes($newpath);
        ?>
';" />
	            </td>
	        </tr>
	    </table>
	    </fieldset>
        <?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(_DML_FRONTEND, "frontend-page");
        ?>
    	<fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_GENERALSET;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_SECTIONISDOWN . '::' . _DML_CFG_SECTIONTT;
        ?>
"><?php 
        echo _DML_CFG_SECTIONISDOWN;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['isDown'];
        ?>
</td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_EXTENSIONSVIEWING . '::' . _DML_CFG_EXTENSIONSVIEWINGTT;
        ?>
"><?php 
        echo _DML_CFG_EXTENSIONSVIEWING;
        ?>
:</label>
	            </td>
	            <td><input type="text" name="viewtypes" value="<?php 
        echo $_DOCMAN->getCfg('viewtypes', "pdf|doc|txt|jpg|jpeg|gif|png");
        ?>
" style="width: 200px" /></td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_NUMBEROFDOCS . '::' . _DML_CFG_NUMBERTT;
        ?>
"><?php 
        echo _DML_CFG_NUMBEROFDOCS;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['perpage'];
        ?>
</td>
	        </tr>
	         <tr>
	            <td class="key">
	            	<label><?php 
        echo _DML_CFG_DEFAULTLISTING;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['default_order'];
        ?>
 <?php 
        echo $lists['default_order2'];
        ?>
</td>
	        </tr>
	    </table>
	    </fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_THEMES;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label><?php 
        echo _DML_CFG_ICONSIZE;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['icon_size'];
        ?>
</td>
	        </tr>
	         <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_TRIMWHITESPACE . '::' . _DML_CFG_TRIMWHITESPACETT;
        ?>
"><?php 
        echo _DML_CFG_TRIMWHITESPACE;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['trimwhitespace'];
        ?>
</td>
	        </tr>
	     </table>
	    </fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_EXTRADOCINFO;
        ?>
</legend>
	    <table class="admintable">
	         <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_DAYSFORNEW . '::' . _DML_CFG_DAYSFORNEWTT;
        ?>
"><?php 
        echo _DML_CFG_DAYSFORNEW;
        ?>
</label>
	            </td>
	            <td><input type="text" name="days_for_new" value="<?php 
        echo $_DOCMAN->getCfg('days_for_new', 5);
        ?>
" /></td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_HOT . '::' . _DML_CFG_HOTTT;
        ?>
"><?php 
        echo _DML_CFG_HOT;
        ?>
</label>
	            </td>
	            <td><input type="text" name="hot" value="<?php 
        echo $_DOCMAN->getCfg('hot', 100);
        ?>
" /></td>
	        </tr>
	        <tr >
	            <td class="key">
	            	<label></label>
	            	<?php 
        echo _DML_CFG_DISPLAYLICENSES;
        ?>
</td>
	            <td><?php 
        echo $lists['display_license'];
        ?>
</td>
	        </tr>
	         <tr >
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_PROCESS_BOTS . '::' . _DML_CFG_PROCESS_BOTSTT;
        ?>
"></label>
	            	<?php 
        echo _DML_CFG_PROCESS_BOTS;
        ?>
</td>
	            <td><?php 
        echo $lists['process_bots'];
        ?>
</td>
	        </tr>
	    </table>
	    </fieldset>
        <?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(_DML_PERMISSIONS, "permissions-page");
        ?>
        <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_GUESTPERM;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_GUEST . '::' . _DML_CFG_GUEST_TT;
        ?>
"><?php 
        echo _DML_CFG_GUEST;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['guest'];
        ?>
</td>
	        </tr>
	    </table>
	    </fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_FRONTPERM;
        ?>
</legend>
	    <table class="admintable">
	         <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_UPLOAD . '::' . _DML_CFG_UPLOADTT;
        ?>
"><?php 
        echo _DML_CFG_UPLOAD;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['user_upload']->toHtml();
        ?>
</td>
	        </tr>
	         <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_APPROVE . '::' . _DML_CFG_APPROVETT;
        ?>
"><?php 
        echo _DML_CFG_APPROVE;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['user_approve']->toHtml();
        ?>
</td>
	        </tr>
	         <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_PUBLISH . '::' . _DML_CFG_PUBLISHTT;
        ?>
"><?php 
        echo _DML_CFG_PUBLISH;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['user_publish']->toHtml();
        ?>
</td>
	        </tr>
    	</table>
    	</fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_DOCPERM;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_VIEW . '::' . _DML_CFG_VIEWTT;
        ?>
"><?php 
        echo _DML_CFG_VIEW;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['default_viewer']->toHtml();
        ?>
</td>
	        </tr>
	         <?php 
        $author_checked = '';
        $editor_checked = '';
        $assign = $_DOCMAN->getCfg('reader_assign');
        if ($assign == 1 || $assign == 3) {
            $author_checked = 'checked';
        }
        if ($assign == 2 || $assign == 3) {
            $editor_checked = 'checked';
        }
        ?>
			<tr>
				<td class="key">
					<label class="hasTip" title="<?php 
        echo _DML_CFG_WHOCANAREADER . '::' . _DML_CFG_WHOCANAREADERTT;
        ?>
"><?php 
        echo _DML_CFG_OVERRIDEVIEW;
        ?>
</label>
				</td>
				<td class="checkList">
					<input type="checkbox" name="assign_download_author" id="assign_download_author" <?php 
        echo $author_checked;
        ?>
 /><label for="assign_download_author"><?php 
        echo _DML_CREATOR;
        ?>
</label><br />
					<input type="checkbox" name="assign_download_editor" id="assign_download_editor" <?php 
        echo $editor_checked;
        ?>
 /><label for="assign_download_editor"><?php 
        echo _DML_EDITOR;
        ?>
</label><br />
				</td>
			</tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_MAINTAIN . '::' . _DML_CFG_MAINTAINTT;
        ?>
"><?php 
        echo _DML_CFG_MAINTAIN;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['default_maintainer']->toHtml();
        ?>
</td>
	        </tr>
	        <?php 
        $author_checked = '';
        $editor_checked = '';
        $assign = $_DOCMAN->getCfg('editor_assign');
        if ($assign == 1 || $assign == 3) {
            $author_checked = 'checked';
        }
        if ($assign == 2 || $assign == 3) {
            $editor_checked = 'checked';
        }
        ?>

			<tr>
				<td class="key">
					<label class="hasTip" title="<?php 
        echo _DML_CFG_WHOCANAEDITOR . '::' . _DML_CFG_WHOCANAEDITORTT;
        ?>
"><?php 
        echo _DML_CFG_OVERRIDEMANT;
        ?>
</label>
				</td>
				<td class="checkList">
					<input type="checkbox" name="assign_edit_author" id="assign_edit_author" <?php 
        echo $author_checked;
        ?>
 /><label for="assign_edit_author"><?php 
        echo _DML_CREATOR;
        ?>
</label><br />
					<input type="checkbox" name="assign_edit_editor" id="assign_edit_editor" <?php 
        echo $editor_checked;
        ?>
 /><label for="assign_edit_editor"><?php 
        echo _DML_EDITOR;
        ?>
</label><br />
				</td>
			</tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_INDIVIDUAL_PERM . '::' . _DML_CFG_INDIVIDUAL_PERMTT;
        ?>
"><?php 
        echo _DML_CFG_INDIVIDUAL_PERM;
        ?>
</label>
	           	</td>
	            <td><?php 
        echo $lists['individual_perm'];
        ?>
</td>
	        </tr>
		</table>
   		</fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_CREATORPERM;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_CREATORS_PERM . '::' . _DML_CFG_CREATORSPERMTT;
        ?>
"><?php 
        echo _DML_CFG_CREATORS_PERM;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['creator_can'];
        ?>
</td>
	        </tr>
    	</table>
    	</fieldset>
        <?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(_DML_UPLOAD, "upload-page");
        ?>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_GENERALSET;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
				<td class="key">
					<label class="hasTip" title="<?php 
        echo _DML_CFG_UPMETHODS . '::' . _DML_CFG_UPMETHODSTT;
        ?>
"><?php 
        echo _DML_CFG_UPMETHODS;
        ?>
</label>
				</td>
				<td><?php 
        echo $lists['methods'];
        ?>
</td>
			</tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_MAXFILESIZE . '::' . _DML_CFG_MAXFILESIZETT . ini_get('upload_max_filesize');
        ?>
"><?php 
        echo _DML_CFG_MAXFILESIZE;
        ?>
</label>
	            </td>
	            <td><input type="text" name="maxAllowed" onkeyup="javascript:dmFilesize(this)" value="<?php 
        echo DOCMAN_Utils::number2text($_DOCMAN->getCfg('maxAllowed', 1024000));
        ?>
" /> <small><?php 
        echo JText::_('Maximum');
        ?>
: <?php 
        echo $lists['maxini'];
        ?>
</small></td>
	        </tr>
	         <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_OVERWRITEFILES . '::' . _DML_CFG_OVERWRITEFILESTT;
        ?>
"><?php 
        echo _DML_CFG_OVERWRITEFILES;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['overwrite'];
        ?>
</td>
	        </tr>
	    </table>
   		</fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_FILEXTENSIONS;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_EXTALLOWED . '::' . _DML_CFG_EXTALLOWEDTT;
        ?>
"><?php 
        echo _DML_CFG_EXTALLOWED;
        ?>
</label>
	            </td>
	            <td><input type="text" name="extensions" value="<?php 
        echo $_DOCMAN->getCfg('extensions', "zip|rar|pdf|txt");
        ?>
" /></td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_USERCANUPLOAD . '::' . _DML_CFG_USERCANUPLOADTT;
        ?>
"><?php 
        echo _DML_CFG_USERCANUPLOAD;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['user_all'];
        ?>
</td>
	        </tr>
	    </table>
   		</fieldset>
	    <fieldset class="adminform">
    	<legend><?php 
        echo _DML_CFG_FILENAMES;
        ?>
</legend>
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_LOWERCASE . '::' . _DML_CFG_LOWERCASETT;
        ?>
"><?php 
        echo _DML_CFG_LOWERCASE;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['fname_lc'];
        ?>
</td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_FILENAMEBLANKS . '::' . _DML_CFG_FILENAMEBLANKSTT;
        ?>
"><?php 
        echo _DML_CFG_FILENAMEBLANKS;
        ?>
:</label>
	            </td>
	            <td><?php 
        echo $lists['fname_blank'];
        ?>
</td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_REJECTFILENAMES . '::' . _DML_CFG_REJECTFILENAMESTT;
        ?>
"><?php 
        echo _DML_CFG_REJECTFILENAMES;
        ?>
:</label>
	            </td>
	            <td><input type="text" name="fname_reject" value="<?php 
        echo htmlentities($_DOCMAN->getCfg('fname_reject', ''), ENT_QUOTES);
        ?>
" /></td>
	        </tr>
	    </table>
	    </fieldset>
        <?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(_DML_SECURITY, "security-page");
        ?>
	    <fieldset class="adminform">
	    <table class="admintable">
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_ANTILEECH . '::' . _DML_CFG_ANTILEECHTT;
        ?>
"><?php 
        echo _DML_CFG_ANTILEECH;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['security_anti_leech'];
        ?>
</td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_ALLOWEDHOSTS . '::' . _DML_CFG_ALLOWEDHOSTSTT;
        ?>
"><?php 
        echo _DML_CFG_ALLOWEDHOSTS;
        ?>
</label>
	            </td>
	            <td><input type="text" name="security_allowed_hosts" value="<?php 
        echo $_DOCMAN->getCfg('security_allowed_hosts', $_SERVER["HTTP_HOST"]);
        ?>
" /></td>
	            <td>
	            <input type="button" value="<?php 
        echo _DML_RESETDEFAULT;
        ?>
" name="Reset" onclick="document.adminForm.security_allowed_hosts.value='<?php 
        echo $_SERVER['HTTP_HOST'];
        ?>
';" />
	            </td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_LOG . '::' . _DML_CFG_LOGTT;
        ?>
"><?php 
        echo _DML_CFG_LOG;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['log'];
        ?>
</td>
	        </tr>
	        <tr>
	            <td class="key">
	            	<label class="hasTip" title="<?php 
        echo _DML_CFG_HIDE_REMOTE . '::' . _DML_CFG_HIDE_REMOTETT;
        ?>
"><?php 
        echo _DML_CFG_HIDE_REMOTE;
        ?>
</label>
	            </td>
	            <td><?php 
        echo $lists['hide_remote'];
        ?>
</td>
	        </tr>
	    </table>
	    </fieldset>

        <?php 
        echo $tabs->endPanel();
        echo $tabs->endPane();
        ?>
        <input type="hidden" name="id" value="" />
        <input type="hidden" name="task" value="" />
        <input type="hidden" name="option" value="com_docman" />
        <input type="hidden" name="section" value="config" />
        <input type="hidden" name="docman_version" value="<?php 
        echo _DM_VERSION;
        ?>
" />
        <?php 
        echo DOCMAN_token::render();
        ?>
    </form>

    <?php 
        include_once JPATH_SITE . DS . 'components' . DS . 'com_docman' . DS . 'footer.php';
        ?>

    <?php 
    }
function _returnTo($task, $msg = '', $gid = '', $params = null)
{
    return DOCMAN_Utils::returnTo($task, $msg, $gid, $params);
}
Example #21
0
 function _formatNew(&$objDBDoc)
 {
     global $_DOCMAN;
     $days = $_DOCMAN->getCfg('days_for_new');
     $result = null;
     if ($days > 0 && DOCMAN_Utils::Daysdiff($objDBDoc->dmdate_published) > $days - 2 * $days && DOCMAN_Utils::Daysdiff($objDBDoc->dmdate_published) <= 0) {
         $result = _DML_NEW;
     }
     return $result;
 }
Example #22
0
 function cancel()
 {
     $this->bind(DOCMAN_Utils::stripslashes($_POST));
     $this->checkin();
     return true;
 }
Example #23
0
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&section=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&section=config", _DML_CONFIG_WARNING . DOCMAN_UTILS::number2text($max));
        } else {
            $section = $task == 'apply' ? '&section=config' : '';
            $mainframe->redirect('index.php?option=com_docman' . $section, _DML_CONFIG_UPDATED);
        }
    } else {
        $mainframe->redirect("index.php?option=com_docman&section=config", _DML_CONFIG_ERROR);
    }
}
Example #24
0
    function _showTabLicense(&$row, &$lists, $last, $created)
    {
        global $_DOCMAN, $_DMUSER;
        ?>
    	<fieldset class="input">
    	<p>
			<label for="dmlicense_id"><?php 
        echo _DML_LICENSE_TYPE;
        ?>
</label><br />
			<?php 
        echo $lists['licenses'];
        ?>
			<?php 
        echo DOCMAN_Utils::mosToolTip(_DML_LICENSE_TOOLTIP . '</span>', _DML_LICENSE_TYPE);
        ?>
		</p>
    	<p>
			<label for="dmlicense_display"><?php 
        echo _DML_DISPLAY_LICENSE;
        ?>
</label><br />
			<?php 
        echo $lists['licenses_display'];
        ?>
			<?php 
        echo DOCMAN_Utils::mosToolTip(_DML_DISPLAY_LIC_TOOLTIP . '</span>', _DML_DISPLAY_LIC);
        ?>
		</p>
        </fieldset>
        <?php 
    }
Example #25
0
    function uploadWizard_transfer()
    {
        global $mosConfig_live_site;
        ?>

		<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
        <script language="Javascript" src="<?php 
        echo $mosConfig_live_site;
        ?>
/administrator/components/com_docman/includes/js/docmanjavascript.js"></script>
		<script language="Javascript" src="<?php 
        echo $mosConfig_live_site;
        ?>
/includes/js/overlib_mini.js"></script>
    	<style type="text/css">
		.style1 {
    		font-family: Verdana, Arial, Helvetica, sans-serif;
    		font-weight: bold;
		}
		.style2 {color: #FF0000}
		.style3 {color: #FFFFFF}
		</style>

		<div id="Layer1" style="position:absolute; margin-left: auto; margin-right: auto;  width:200px; height:130px; z-index:1; visibility: hidden; left: 14px; top: 11px; background-color: #99989D; layer-background-color: #FF0000; border: 3px solid #F19518;">
  		<div align="center" class="style1">
    		<p align="center" class="style2"><br />
    		<span class="style3"><?php 
        echo _DML_DOCMANISTRANSF;
        ?>
</span></p>
    		<p align="center" class="style2"><img src="<?php 
        echo $mosConfig_live_site;
        ?>
/administrator/components/com_docman/images/dm_progress.gif" ></p>
    		<p align="center" class="style3"><?php 
        echo _DML_PLEASEWAIT;
        ?>
<br />
    	</p>
  		</div>
		</div>
    	<form action="index2.php?option=com_docman&section=files&task=upload&step=3&method=transfer" method="post" onSubmit="MM_showHideLayers('Layer1','','show')">
        <?php 
        dmHTML::adminHeading(_DML_TRANSFERFROMWEB, 'files');
        ?>
        <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
        <tr>
            <td width="40%" align="center"> <div align="right"><img src="<?php 
        echo $mosConfig_live_site;
        ?>
/administrator/components/com_docman/images/dm_upload_48.png">
            </td>
	    <td nowrap><?php 
        echo _DML_REMOTEURL;
        ?>
:</td>
            <td align="left">
            <div align="left">
                <input name="url" type="text" id="url" value="http://">
            </div></td>
	    <td align="left"><?php 
        echo DOCMAN_Utils::mosToolTip(_DML_REMOTEURLTT . '</span>', _DML_REMOTEURL);
        ?>
</td>
	</tr>
	<tr><td colspan="4">&nbsp;</td></tr>
	<tr>
	    <td>&nbsp;</td>
            <td><?php 
        echo _DML_LOCALNAME;
        ?>
:</td>
            <td align="left">
            <div align="left">
                <input name="localfile" type="text" id="url" value="">
            </div></td>
	    <td align="left" width="40%"><?php 
        echo DOCMAN_Utils::mosToolTip(_DML_LOCALNAMETT . '</span>', _DML_LOCALNAME);
        ?>
</td>
        </tr>
        <tr>
            <td colspan="2" align="center">&nbsp;</td>
            <td align="center"><div align="left">
                <input type="button" name="Submit2" value="&lt;&lt;&lt;" onclick="window.history.back()">
                <input type="submit" name="Submit" value="<?php 
        echo _DML_SUBMIT;
        ?>
">
            </td>
        </tr>
      </table>
    <?php 
        echo DOCMAN_token::render();
        ?>
    </form>

    <form action="index2.php" method="post" name="adminForm">
        <input type="hidden" name="option" value="com_docman" />
        <input type="hidden" name="section" value="files" />
        <input type="hidden" name="task" value="" />
        <input type="hidden" name="boxchecked" value="0" />
    </form>
    <?php 
    }
function filesSelectList(&$doc, $std_opt = 'class="inputbox" size="1"')
{
    /*
     * PROGRAMMER NOTE:
     * Do NOT use FULL url for description on links. This could expose passwords
     * (Not a wise idea though they could get them elsewhere in the system...)
     */
    $options = array();
    $selected = null;
    if (!$doc->id) {
        if ($doc->dmfilename == _DM_DOCUMENT_LINK) {
            //create options
            $options[] = JHTML::_('select.option', _DM_DOCUMENT_LINK, _DML_LINKED);
            $selected = _DM_DOCUMENT_LINK;
            //change document data
            $parsed_url = parse_url($doc->dmlink);
            $doc->dmname = _DML_LINKTO . (isset($parsed_url['path']) ? DOCMAN_Utils::basename($parsed_url['path']) : $parsed_url['host']);
            $doc->dmdescription = "\n" . _DML_DOCLINKTO . ':' . $parsed_url['scheme'] . '://' . $parsed_url['host'] . (isset($parsed_url['path']) ? $parsed_url['path'] : '') . (isset($parsed_url['query']) ? $parsed_url['query'] : '') . "\n\n" . _DML_DOCLINKON . ':' . strftime("%a, %Y-%b-%d %R");
        } else {
            //create options
            $options[] = JHTML::_('select.option', $doc->dmfilename);
            $selected = $doc->dmfilename;
            //change document data
            $doc->dmname = substr($doc->dmfilename, 0, strrpos($doc->dmfilename, "."));
        }
    } else {
        //create options
        $options[] = JHTML::_('select.option', '', _DML_SELECT_FILE);
        if (!is_null($doc->id)) {
            $options[] = JHTML::_('select.option', $doc->dmfilename, _DML_CURRENT . ': ' . $doc->dmfilename);
        }
        $files = DOCMAN_docs::getFilesByUserAccess();
        foreach ($files as $file) {
            if (is_null($doc->id) || $file->dmfilename != $doc->dmfilename) {
                $options[] = JHTML::_('select.option', $file->dmfilename);
            }
        }
        if (count($options) < 2) {
            //_returnTo('upload', _DML_YOU_MUST_UPLOAD);
        }
        $selected = $doc->dmfilename;
    }
    $list = JHTML::_('select.genericlist', $options, 'dmfilename', $std_opt, 'value', 'text', $selected);
    return $list;
}
Example #27
0
/**
* 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&section=categories');
}
Example #28
0
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&section=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&section=documents';
        } else {
            // $task = 'apply'
            $url = 'index.php?option=com_docman&section=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&section=documents', $doc->getError());
}
Example #29
0
function fetchEditDocumentForm($uid, $filename = null, $catid = 0)
{
    global $database, $mosConfig_absolute_path;
    global $_DOCMAN, $_DMUSER;
    $doc = new mosDMDocument($database);
    if ($uid) {
        $doc->load($uid);
        //Load the document
        //check user permissions
        $err = $_DMUSER->canPreformTask($doc, 'Edit');
        if ($err) {
            _returnTo('cat_view', $err, $doc->catid);
        }
    } else {
        $doc->init_record();
        //Initialise a document
        //check user permissions
        $err = $_DMUSER->canPreformTask($doc, 'Upload');
        if ($err) {
            _returnTo('cat_view', $err, $doc->catid);
        }
    }
    //checkout the document
    $doc->checkout($_DMUSER->userid);
    // Set document filename
    if (!is_null($filename)) {
        $filename = DOCMAN_Utils::safeDecodeURL($filename);
        $doc->dmfilename = $filename;
    }
    // Set document url
    $prefix = substr($doc->dmfilename, 0, _DM_DOCUMENT_LINK_LNG);
    if (strcasecmp($prefix, _DM_DOCUMENT_LINK) == 0) {
        $doc->dmlink = substr($doc->dmfilename, _DM_DOCUMENT_LINK_LNG);
        $doc->dmfilename = _DM_DOCUMENT_LINK;
    }
    $lists = array();
    // Set filename
    $lists['dmfilename'] = filesSelectList($doc);
    // Built category select list
    $options = array(mosHTML::makeOption('0', _DML_SELECT_CAT));
    if ($uid) {
        $lists['catid'] = dmHTML::categoryList($doc->catid, "", $options);
    } else {
        $lists['catid'] = dmHTML::categoryList($catid, "", $options);
    }
    // Build select lists
    $lists['approved'] = mosHTML::yesnoRadioList('approved', 'class="inputbox"', $doc->approved);
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $doc->published);
    $lists['viewer'] = dmHTML::viewerList($doc, 'dmowner');
    $lists['maintainer'] = dmHTML::maintainerList($doc, 'dmmantainedby');
    $lists['licenses'] = licenseSelectList($doc);
    $lists['licenses_display'] = licenseDisplayList($doc);
    // Built image list
    $lists['dmthumbnail'] = dmHTML::imageList('dmthumbnail', $doc->dmthumbnail);
    $lists['dmthumbnail_preview'] = $doc->dmthumbnail;
    // Find lastupdate user
    $last = array();
    if ($doc->dmlastupdateby > _DM_PERMIT_USER) {
        $database->setQuery("SELECT id, name " . "\n FROM #__users " . "\n WHERE id=" . (int) $doc->dmlastupdateby);
        $last = $database->loadObjectList();
    } else {
        $last[0]->name = "Super Administrator";
    }
    // Find createdby user
    $created = array();
    if ($doc->dmsubmitedby > _DM_PERMIT_USER) {
        $database->setQuery("SELECT id, name " . "\n FROM #__users " . "\n WHERE id=" . (int) $doc->dmsubmitedby);
        $created = $database->loadObjectList();
    } else {
        $created[0]->name = "Super Administrator";
    }
    // update 'dmlastupdateon'
    $doc->dmlastupdateon = date("Y-m-d H:i:s");
    // Params definitions
    $params = null;
    $params_path = $mosConfig_absolute_path . '/administrator/components/com_docman/docman.params.xml';
    if (file_exists($params_path)) {
        $params =& new dmParameters($doc->attribs, $params_path, 'params');
    }
    /* ------------------------------ *
     *   MAMBOT - Setup All Mambots   *
     * ------------------------------ */
    $prebot = new DOCMAN_mambot('onBeforeEditDocument');
    $prebot->setParm('document', $doc);
    $prebot->setParm('filename', $filename);
    $prebot->setParm('user', $_DMUSER);
    if (!$uid) {
        $prebot->copyParm('process', 'new document');
    } else {
        $prebot->copyParm('process', 'edit document');
    }
    $prebot->trigger();
    if ($prebot->getError()) {
        _returnTo('cat_view', $prebot->getErrorMsg());
    }
    return HTML_DMDocuments::editDocumentForm($doc, $lists, $last, $created, $params);
}
Example #30
0
    function _showTabLicense(&$row, &$lists, &$last, &$created)
    {
        ?>
    	<table class="adminform">
    	<tr>
			<th colspan="2"><?php 
        echo _DML_TITLE_DOCLICENSES;
        ?>
</th>
		<tr>
    	<tr>
    		<td width="250" ><?php 
        echo _DML_LICENSE_TYPE;
        ?>
</td>
    		<td>
    		<?php 
        echo $lists['licenses'];
        echo DOCMAN_Utils::mosToolTip(_DML_LICENSE_TOOLTIP . '</span>', _DML_LICENSE_TYPE);
        ?>
    		</td>
    	</tr>
    	<tr>
    		<td><?php 
        echo _DML_DISPLAY_LICENSE;
        ?>
</td>
    		<td>
    		<?php 
        echo $lists['licenses_display'];
        echo DOCMAN_Utils::mosToolTip(_DML_DISPLAY_LIC_TOOLTIP . '</span>', _DML_DISPLAY_LIC);
        ?>
    		</td>
    	</tr>
    	</table>
    	<?php 
    }