function updateDocumentForm($list, $links, $paths, $data)
    {
        $action = _taskLink('doc_update_process', $data->id);
        ob_start();
        ?>
       <form action="<?php 
        echo sefRelToAbs($action);
        ?>
" method="post" enctype="multipart/form-data" id="dm_frmupdate" class="dm_form" >
       <fieldset class="input">
       		<p>
       			<label for="upload"><?php 
        echo _DML_SELECTFILE;
        ?>
</label><br />
	   			<input id="upload" name="upload" type="file" />
	   		</p>
       </fieldset>
	   <fieldset class="dm_button">
	   		<p>
	   			<input name="submit" class="button" value="<?php 
        echo _DML_UPLOAD;
        ?>
" type="submit" />
	   		</p>
	   </fieldset>
       <?php 
        echo DOCMAN_token::render();
        ?>
 	   </form>
        <?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
    function showClearData($rows)
    {
        ?>
<form action="index.php" method="post" name="adminForm">
        <?php 
        dmHTML::adminHeading(_DML_CLEARDATA, 'cleardata');
        ?>

        <table class="adminlist">
          <thead>
          <tr>
            <th width="20" align="left">
                <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" />
            </th>
            <th width="98%" align="left">
                <?php 
        echo _DML_CLEARDATA_ITEM;
        ?>
            </th>
          </tr>
          </thead>
          <tbody>
          <?php 
        $k = 0;
        foreach ($rows as $i => $row) {
            ?>
            <tr class="row<?php 
            echo $k;
            ?>
">
                <td width="20">
                    <?php 
            echo JHTML::_('grid.id', $i, $row->name);
            ?>
                </td>
                <td>
                    <?php 
            echo $row->friendlyname;
            ?>
                </td>
            </tr><?php 
            $k = 1 - $k;
        }
        ?>
          </tbody>
        </table>
        <input type="hidden" name="option" value="com_docman" />
        <input type="hidden" name="section" value="cleardata" />
        <input type="hidden" name="task" value="" />
        <input type="hidden" name="boxchecked" value="0" />
        <?php 
        echo DOCMAN_token::render();
        ?>
        </form>
        <?php 
        include_once JPATH_ROOT . DS . 'components' . DS . 'com_docman' . DS . 'footer.php';
    }
 function linkFileProcess($uid, $step, $url)
 {
     DOCMAN_token::check() or die('Invalid Token');
     global $_DMUSER, $_DOCMAN;
     if ($url == '') {
         return array('_error' => 1, '_errmsg' => _DML_FILENAME_REQUIRED);
     }
     $path = $_DOCMAN->getCfg('dmpath');
     //get file validation settings
     if ($_DMUSER->isSpecial) {
         $validate = _DM_VALIDATE_ADMIN;
     } else {
         if ($_DOCMAN->getCfg('user_all', false)) {
             $validate = _DM_VALIDATE_USER_ALL;
         } else {
             $validate = _DM_VALIDATE_USER;
         }
     }
     //upload the file
     $upload = new DOCMAN_FileUpload();
     $file = $upload->uploadLINK($url, $validate);
     if (!$file) {
         $msg = _DML_ERROR_LINKING . " - " . $upload->_err;
         return array('_error' => 1, '_errmsg' => $msg);
     }
     $msg = _DML_LINKED;
     return array('_error' => 0, '_errmsg' => $msg);
 }
 function _formatLink($task, $params = array(), $sef = true, $indexfile = 'index.php', $token = false)
 {
     global $_DOCMAN;
     require_once $_DOCMAN->getPath('classes', 'token');
     if ($token) {
         $params[DOCMAN_token::get(false)] = 1;
     }
     $link = DOCMAN_Utils::taskLink($task, $this->objDBTable->id, $params, $sef, $indexfile);
     return $link;
 }
    function uploadFileForm($lists)
    {
        $progressImg = JURI::root(true) . '/administrator/components/com_docman/images/dm_progress.gif';
        ob_start();
        ?>
		<form action="<?php 
        echo JRoute::_($lists['action']);
        ?>
" method="post" enctype="multipart/form-data" id="dm_frmupload" class="dm_form">
		<fieldset class="dm_adminform">
        <table class="dm_admintable">
        <tr>
        	<td colspan="2"><div id="progress" style="display:none;"><img style="border:1px solid black;" src="<?php 
        echo $progressImg;
        ?>
" alt="Upload Progress" />&nbsp;<?php 
        echo _DML_ISUPLOADING;
        ?>
</div></td>
        </tr>
        <tr>
			<td class="dm_key">
				<label for="upload"><?php 
        echo _DML_SELECTFILE;
        ?>
</label>
			</td>
			<td>
				<input id="upload" name="upload" type="file" name="file" />
			</td>
		</tr>
		</table>
       	</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_UPLOAD;
        ?>
" type="submit" onclick="document.getElementById('progress').style.display = 'block';" />
	   	</fieldset>
	   	<input type="hidden" name="method" value="http" />
        <?php 
        echo DOCMAN_token::render();
        ?>
		</form>

		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
    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;
    }
Exemple #7
0
function clearData($cid = array())
{
    DOCMAN_token::check() or die('Invalid Token');
    $msgs = array();
    $cleardata = new DOCMAN_Cleardata($cid);
    $cleardata->clear();
    $rows =& $cleardata->getList();
    foreach ($rows as $row) {
        $msgs[] = $row->msg;
    }
    mosRedirect('index2.php?option=com_docman&section=cleardata', implode(' | ', $msgs));
}
Exemple #8
0
function clearData($cid = array())
{
    DOCMAN_token::check('request') or die('Invalid Token');
    $mainframe = JFactory::getApplication();
    $msgs = array();
    $cleardata = new DOCMAN_Cleardata($cid);
    $cleardata->clear();
    $rows =& $cleardata->getList();
    foreach ($rows as $row) {
        $msgs[] = $row->msg;
    }
    $mainframe->redirect('index.php?option=com_docman&section=cleardata', implode(' | ', $msgs));
}
    function linkFileForm($lists)
    {
        ob_start();
        ?>
    	<form action="<?php 
        echo DOCMAN_Compat::sefRelToAbs($lists['action']);
        ?>
" method="post" id="dm_frmupload" class="dm_form">
    	<fieldset class="dm_adminform">
        <table class="dm_admintable">
        <tr>
			<td class="dm_key">
				<label for="url" class="hasTip" title="<?php 
        echo _DML_REMOTEURL . '::' . _DML_LINKURLTT;
        ?>
"><?php 
        echo _DML_REMOTEURL;
        ?>
</label>
			</td>
			<td>
				<input name="url" type="text" id="url" value="<?php 
        /*echo $parms['url'];*/
        ?>
" />
			</td>
		</tr>
		</table>
		</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_LINK;
        ?>
" type="submit" />
       	 </fieldset>
       	 <input type="hidden" name="method" value="link" />
         <?php 
        echo DOCMAN_token::render();
        ?>
       	</form>
   		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Exemple #10
0
function removeLog($cid)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database, $_DMUSER;
    $log = new mosDMLog($database);
    $rows = $log->loadRows($cid);
    // For log mambots
    if ($log->remove($cid)) {
        if ($rows) {
            $logbot = new DOCMAN_mambot('onLogDelete');
            $logbot->setParm('user', $_DMUSER);
            $logbot->copyParm('process', 'delete log');
            $logbot->setParm('rows', $rows);
            $logbot->trigger();
            // Delete the logs
        }
        mosRedirect("index2.php?option=com_docman&section=logs");
    }
}
Exemple #11
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 
    }
Exemple #12
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);
    }
}
Exemple #13
0
    function showLicenses($option, $rows, $search, $pageNav)
    {
        global $database, $my, $mosConfig_absolute_path, $mosConfig_live_site;
        ?>
		<form action="index2.php" method="post" name="adminForm">
        <?php 
        dmHTML::adminHeading(_DML_LICENSES, 'licenses');
        ?>
        <div class="dm_filters">
            <?php 
        echo _DML_FILTER_NAME;
        ?>
            <input type="text" name="search" value="<?php 
        echo $search;
        ?>
" class="inputbox" onChange="document.adminForm.submit();" />
        </div>

		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
            <thead>
			<tr>
				<th width="2%" class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></th>
				<th class="title" width="30%" nowrap="nowrap"><div align="left"><?php 
        echo _DML_NAME;
        ?>
</div></th>
                <th class="title" width="68%"><div align="left"><?php 
        echo _DML_LICENSE_TEXT;
        ?>
</div></th>
			</tr>
            </thead>

            <tfoot><tr><td colspan="11"><?php 
        echo $pageNav->getListFooter();
        ?>
</td></tr></tfoot>

            <tbody>
		   <?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            echo "<tr class=\"row{$k}\">";
            echo "<td width=\"20\">";
            ?>
    					<input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="cid[]" value="<?php 
            echo $row->id;
            ?>
" onclick="isChecked(this.checked);" />
    					</td>
    					<td align="left">
    						<a href="#edit" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','edit')">
    						<?php 
            echo $row->name;
            ?>
    						</a>
    					</td>
                        <td align="left">
                            <?php 
            echo $row->license;
            ?>
                        </td>
    				</tr>
    				<?php 
            $k = 1 - $k;
        }
        ?>
            </tbody>
		  </table>


		  <input type="hidden" name="option" value="com_docman" />
		  <input type="hidden" name="section" value="licenses" />
		  <input type="hidden" name="task" value="licenses" />
		  <input type="hidden" name="boxchecked" value="0" />
          <?php 
        echo DOCMAN_token::render();
        ?>
		</form>
	  <?php 
        include_once $mosConfig_absolute_path . "/components/com_docman/footer.php";
    }
Exemple #14
0
function deleteDocument($uid)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database, $_DMUSER;
    $doc = new mosDMDocument($database);
    $doc->load($uid);
    //check user permissions
    $err = $_DMUSER->canPreformTask($doc, 'Delete');
    if ($err) {
        _returnTo('cat_view', $err, $doc->catid);
    }
    //delete the docmument
    $doc->remove(array($uid));
    _returnTo('cat_view', _DML_DOCDELETED, $doc->catid);
}
Exemple #15
0
    function copyDocumentForm($cid, &$lists, &$items)
    {
        global $mosConfig_absolute_path;
        ?>
        <?php 
        dmHTML::adminHeading(_DML_COPYTOCAT, 'categories');
        ?>

        <form action="index2.php" method="post" name="adminForm" class="adminform" id="dm_moveform">
        <table class="adminform">
        <tr>
            <td align="left" valign="middle" width="10%">
            <strong><?php 
        echo _DML_COPYTOCAT;
        ?>
</strong>
            <?php 
        echo $lists['categories'];
        ?>
            </td>
            <td align="left" valign="top" width="20%">
            <strong><?php 
        echo _DML_DOCSCOPIED;
        ?>
</strong>
            <?php 
        echo "<ol>";
        foreach ($items as $item) {
            echo "<li>" . $item->dmname . "</li>";
        }
        echo "</ol>";
        ?>
            </td>
        </tr>
        </table>
        <input type="hidden" name="option" value="com_docman" />
        <input type="hidden" name="section" value="documents" />
        <input type="hidden" name="task" value="copy_process" />
        <input type="hidden" name="boxchecked" value="1" />
        <?php 
        foreach ($cid as $id) {
            echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"{$id}\" />";
        }
        ?>
        <?php 
        echo DOCMAN_token::render();
        ?>
        </form>
        <?php 
        include_once $mosConfig_absolute_path . "/components/com_docman/footer.php";
    }
function saveThemeCSS()
{
    DOCMAN_token::check() or die('Invalid Token');
    global $_DOCMAN, $task;
    $mainframe = JFactory::getApplication();
    $theme = trim(JRequest::getCmd('theme', '', 'post'));
    $filecontent = JRequest::getString('filecontent', '', 'post', JREQUEST_ALLOWHTML);
    if (!file_exists($_DOCMAN->getPath('themes') . DS . $theme)) {
        echo "<script> alert('Theme not found'); window.history.go(-1);</script>\n";
        exit;
    }
    if (!$theme) {
        $mainframe->redirect('index.php?option=com_docman&section=themes', _DML_OPFAILED_NO_TEMPLATE);
    }
    if (!$filecontent) {
        $mainframe->redirect('index.php?option=com_docman&section=themes', _DML_OPFAILED_CONTENT_EMPTY);
    }
    $file = $_DOCMAN->getPath('themes', $theme) . "/css/theme.css";
    if (is_writable($file) == false) {
        $mainframe->redirect('index.php?option=com_docman&section=themes', _DML_OPFAILED_UNWRITABLE);
    }
    if ($fp = fopen($file, 'w')) {
        fputs($fp, stripslashes($filecontent));
        fclose($fp);
        if ($task == 'save_css') {
            $url = 'index.php?option=com_docman&section=themes';
        } else {
            // $task = 'apply_css'
            $url = 'index.php?option=com_docman&section=themes&task=edit_css&cid[0]=' . $theme;
        }
        $mainframe->redirect($url, _DML_SAVED_CHANGES);
    } else {
        $mainframe->redirect('index.php?option=com_docman&section=themes', _DML_OPFAILED_CANT_OPEN_FILE);
    }
}
Exemple #17
0
/**
* changes the access level of a record
*
* @param integer $ The increment to reorder by
*/
function accessCategory($uid, $access)
{
    DOCMAN_token::check() or die('Invalid Token');
    $database = JFactory::getDBO();
    $mainframe = JFactory::getApplication();
    $row = new mosDMCategory($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    $mainframe->redirect('index.php?option=com_docman&section=categories');
}
 function transferFileProcess($uid, $step, $url, &$file)
 {
     DOCMAN_token::check() or die('Invalid Token');
     global $_DMUSER, $_DOCMAN;
     if ($file == '') {
         return array('_error' => 1, '_errmsg' => _DML_FILENAME_REQUIRED);
     }
     /* ------------------------------ *
      *   MAMBOT - Setup All Mambots   *
      * ------------------------------ */
     $logbot = new DOCMAN_mambot('onLog');
     $prebot = new DOCMAN_mambot('onBeforeUpload');
     $postbot = new DOCMAN_mambot('onAfterUpload');
     $logbot->setParm('filename', $file);
     $logbot->setParm('user', $_DMUSER);
     $logbot->copyParm('process', 'upload');
     $prebot->setParmArray($logbot->getParm());
     // Copy the parms over
     $postbot->setParmArray($logbot->getParm());
     /* ------------------------------ *
      *   Pre-upload                    *
      * ------------------------------ */
     $prebot->trigger();
     if ($prebot->getError()) {
         $logbot->setParm('msg', $prebot->getErrorMsg());
         $logbot->copyParm('status', 'LOG_ERROR');
         $logbot->trigger();
         return array('_error' => 1, '_errmsg' => $prebot->getErrorMsg());
     }
     /* ------------------------------ *
      *   Upload                        *
      * ------------------------------ */
     $path = $_DOCMAN->getCfg('dmpath') . DS;
     //get file validation settings
     if ($_DMUSER->isSpecial) {
         $validate = _DM_VALIDATE_ADMIN;
     } else {
         if ($_DOCMAN->getCfg('user_all', false)) {
             $validate = _DM_VALIDATE_USER_ALL;
         } else {
             $validate = _DM_VALIDATE_USER;
         }
     }
     //upload the file
     $upload = new DOCMAN_FileUpload();
     $file = $upload->uploadURL($url, $path, $validate, $file);
     /* -------------------------------- *
      *    Post-upload                   *
      * -------------------------------- */
     if (!$file) {
         $msg = _DML_ERROR_UPLOADING . " - " . $upload->_err;
         $logbot->setParm('msg', $msg);
         $logbot->setParm('file', $url);
         $logbot->copyParm('status', 'LOG_ERROR');
         $logbot->trigger();
         return array('_error' => 1, '_errmsg' => $msg);
     }
     $msg = "&quot;" . $file->name . "&quot; " . _DML_UPLOADED;
     $logbot->copyParm(array('msg' => $msg, 'status' => 'LOG_OK'));
     $logbot->trigger();
     $postbot->setParm('file', $file);
     $postbot->trigger();
     if ($postbot->getError()) {
         $logbot->setParm('msg', $postbot->getErrorMsg());
         $logbot->copyParm('status', 'LOG_ERROR');
         $logbot->trigger();
         return array('_error' => 1, '_errmsg' => $postbot->getErrorMsg());
     }
     return array('_error' => 0, '_errmsg' => $msg);
 }
Exemple #19
0
    /**
     * Writes the edit form for new and existing categories
     *
     * @param mosCategory $ The category object
     * @param string $
     * @param array $
     */
    function edit(&$row, $section, &$lists, $redirect)
    {
        global $mosConfig_live_site, $mosConfig_absolute_path;
        if ($row->image == "") {
            $row->image = 'blank.png';
        }
        mosMakeHtmlSafe($row, ENT_QUOTES, 'description');
        ?>
		<script language="javascript" type="text/javascript">
		function submitbutton(pressbutton, section) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			if ( form.name.value == "" ) {
				alert('<?php 
        echo _DML_CAT_MUST_SELECT_NAME;
        ?>
');
			} else {
				<?php 
        getEditorContents('editor1', 'description');
        ?>
				submitform(pressbutton);
			}
		}
		</script>

		<form action="index2.php" method="post" name="adminForm">

        <?php 
        $tmp = ($row->id ? _DML_EDIT : _DML_ADD) . ' ' . _DML_CAT . ' ' . $row->name;
        dmHTML::adminHeading($tmp, 'categories');
        ?>

		<table width="100%">
		<tr>
			<td valign="top">
				<table class="adminform">
				<tr>
					<th colspan="3">
					<?php 
        echo _DML_CATDETAILS;
        ?>
					</th>
				<tr>
				<tr>
					<td>
					<?php 
        echo _DML_CATTITLE;
        ?>
:
					</td>
					<td colspan="2">
					<input class="text_area" type="text" name="title" value="<?php 
        echo $row->title;
        ?>
" size="50" maxlength="50" title="A short name to appear in menus" />
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        echo _DML_CATNAME;
        ?>
:
					</td>
					<td colspan="2">
					<input class="text_area" type="text" name="name" value="<?php 
        echo $row->name;
        ?>
" size="50" maxlength="255" title="<?php 
        echo _DML_LONGNAME;
        ?>
" />
					</td>
				</tr>
				<tr>
					<td align="right"><?php 
        echo _DML_PARENTITEM;
        ?>
:</td>
					<td>
					<?php 
        echo $lists['parent'];
        ?>
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        echo _DML_IMAGE;
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['image'];
        ?>
					</td>
					<td rowspan="4" width="50%">
					<script language="javascript" type="text/javascript">
					if (document.forms[0].image.options.value!=''){
					  jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'image' );
					} else {
					  jsimg='../images/M_images/blank.png';
					}
					document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php 
        echo _DML_PREVIEW;
        ?>
" />');
					</script>
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        echo _DML_IMAGEPOS;
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['image_position'];
        ?>
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        echo _DML_ORDERING;
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['ordering'];
        ?>
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        echo _DML_ACCESSLEVEL;
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['access'];
        ?>
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        echo _DML_PUBLISHED;
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['published'];
        ?>
					</td>
				</tr>
				<tr>
					<td valign="top">
					<?php 
        echo _DML_DESCRIPTION;
        ?>
:
					</td>
					<td colspan="2">
					<?php 
        // parameters : areaname, content, hidden field, width, height, rows, cols
        DOCMAN_Compat::editorArea('editor1', $row->description, 'description', '500', '200', '50', '5');
        ?>
					</td>
				</tr>
				</table>
			</td>
        </tr>
		</table>

		<input type="hidden" name="option" value="com_docman" />
		<input type="hidden" name="section" value="categories" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="oldtitle" value="<?php 
        echo $row->title;
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="sectionid" value="com_docman" />
		<input type="hidden" name="redirect" value="<?php 
        echo $redirect;
        ?>
" />
        <?php 
        echo DOCMAN_token::render();
        ?>
		</form>
        <?php 
        include_once $mosConfig_absolute_path . "/components/com_docman/footer.php";
    }
    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 
    }
Exemple #21
0
function copyDocumentProcess($cid)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database, $my;
    // get the id of the category to copy the document to
    $categoryCopy = mosGetParam($_POST, 'catid', '');
    // preform move
    $doc = new mosDMDocument($database);
    $doc->copy($cid, $categoryCopy);
    // output status message
    $cids = implode(',', $cid);
    $total = count($cid);
    $cat = new mosDMCategory($database);
    $cat->load($categoryCopy);
    $msg = $total . ' ' . _DML_DOCUMENTS_COPIED_TO . ' ' . $cat->name;
    mosRedirect('index2.php?option=com_docman&section=documents', $msg);
}
function uploadWizard($step = 1, $method = 'http', $old_filename)
{
    global $_DOCMAN;
    $mainframe = JFactory::getApplication();
    $database = JFactory::getDBO();
    switch ($step) {
        case 1:
            $lists['methods'] = dmHTML::uploadSelectList($method);
            HTML_DMFiles::uploadWizard($lists);
            break;
        case 2:
            switch ($method) {
                case 'http':
                    HTML_DMFiles::uploadWizard_http($old_filename);
                    break;
                case 'ftp':
                    HTML_DMFiles::uploadWizard_ftp();
                    break;
                case 'link':
                    $mainframe->redirect("index.php?option=com_docman&section=documents&task=new&makelink=1", _DML_CREATEALINK);
                    // HTML_DMFiles::uploadWizard_link();
                    break;
                case 'transfer':
                    HTML_DMFiles::uploadWizard_transfer();
                    break;
                default:
                    $mainframe->redirect("index.php?option=com_docman&section=files", _DML_SELECTMETHODFIRST);
            }
            break;
        case 3:
            DOCMAN_token::check() or die('Invalid Token');
            switch ($method) {
                case 'http':
                    $path = $_DOCMAN->getCfg('dmpath');
                    $upload = new DOCMAN_FileUpload();
                    $file_upload = JRequest::getVar('upload', '', 'files', 'array');
                    $result =& $upload->uploadHTTP($file_upload, $path, _DM_VALIDATE_ADMIN);
                    if (!$result) {
                        $mainframe->redirect("index.php?option=com_docman&section=files", _DML_ERROR_UPLOADING . " - " . $upload->_err);
                    } else {
                        $batch = JRequest::getCmd('batch', null);
                        if ($batch && $old_filename != null) {
                            require_once JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
                            if (!extension_loaded('zlib')) {
                                $mainframe->redirect("index.php?option=com_docman&section=files", _DML_ZLIB_ERROR);
                            }
                            $target_directory = $_DOCMAN->getCfg('dmpath');
                            $zip = new PclZip($target_directory . DS . $result->name);
                            $file_to_unzip = preg_replace('/(.+)\\..*$/', '$1', $target_directory . DS . $result->name);
                            if (!$zip->extract($target_directory)) {
                                $mainframe->redirect("index.php?option=com_docman&section=files", _DML_UNZIP_ERROR);
                            }
                            @unlink($target_directory . DS . $result->name);
                        }
                        if ($old_filename && $old_filename != $file_upload['name']) {
                            $file = $_DOCMAN->getCfg('dmpath') . DS . $old_filename;
                            @unlink($file);
                            $database->setQuery("UPDATE #__docman SET dmfilename='" . $database->getEscaped($result->name) . "' WHERE dmfilename='" . $database->getEscaped($old_filename) . "'");
                            if (!$database->query()) {
                                echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1);</script>\n";
                                exit;
                            }
                        }
                        //HTML_DMFiles::uploadWizard_sucess($result, $batch, $old_filename);
                        $mainframe->redirect("index.php?option=com_docman&section=files&task=upload&step=4" . "&result=" . urlencode($result->name) . "&batch=" . (0 + $batch) . "&old_filename=" . $old_filename, _DML_SUCCESS . ' &quot;' . $result->name . '&quot; - ' . _DML_FILEUPLOADED);
                    }
                    break;
                case 'ftp':
                    break;
                case 'link':
                    break;
                case 'transfer':
                    $url = stripslashes(JRequest::getString('url', null, 'post'));
                    $name = stripslashes(JRequest::getString('localfile', null, 'post'));
                    $path = $_DOCMAN->getCfg('dmpath') . DS;
                    $upload = new DOCMAN_FileUpload();
                    $result = $upload->uploadURL($url, $path, _DM_VALIDATE_ADMIN, $name);
                    if ($result) {
                        // HTML_DMFiles::uploadWizard_sucess($result, 0, 1);
                        $mainframe->redirect("index.php?option=com_docman&section=files&task=upload&step=4" . "&result=" . urlencode($result->name) . "&batch=0&old_filename=1", _DML_SUCCESS . ' &quot;' . $result->name . '&quot; - ' . _DML_FILEUPLOADED);
                    } else {
                        $mainframe->redirect("index.php?option=com_docman&section=files", $upload->_err);
                    }
                    break;
            }
            break;
        case '4':
            /* New step that gives us a header completion message rather than
            		   "in body" completion. For uniformity
            		 */
            $file = new StdClass();
            $file->name = urlencode(stripslashes(JRequest::getString('result', 'INTERNAL ERROR')));
            $batch = JRequest::getInt('batch', 0);
            $old_filename = JRequest::getString('old_filename', null);
            HTML_DMFiles::uploadWizard_sucess($file, $batch, $old_filename, 0);
            break;
    }
    //End switch($step)
}
    function messageForm($group, $list)
    {
        ?>
        <form action="index.php" name="adminForm" method="POST">
        <?php 
        dmHTML::adminHeading(_DML_EMAIL_GROUP, 'sendemail');
        ?>

        <table cellpadding="5" cellspacing="1" border="0" width="100%" class="adminform">
            <tr>
                <td width="150"><?php 
        echo _DML_GROUP;
        ?>
:</td>
                <td width="85%"><?php 
        echo $group->groups_name;
        ?>
</td>
			</tr>
            <tr>
                <td width="150"><?php 
        echo _DML_SUBJECT;
        ?>
:</td>
                <td width="85%"><input class="inputbox" type="text" name="mm_subject" value="" size="50"></td>
            </tr>
            <tr>
                <td width="150"><?php 
        echo _DML_EMAIL_LEADIN;
        ?>
:</td>
                <td width="85%"><textarea cols="50" rows="2" name="mm_leadin" wrap="virtual"
					class="inputbox"><?php 
        echo $list['leadin'];
        ?>
</textarea></td>
			</tr>
            <tr>
                <td width="150" valign="top"><?php 
        echo _DML_MESSAGE;
        ?>
:</td>
                <td width="85%"><textarea cols="50" rows="5" name="mm_message" wrap="virtual" class="inputbox"></textarea></td>
            </tr>
        </table>
        <!--<input type="submit" name="submit" value="<?php 
        echo _DML_SEND_EMAIL;
        ?>
">-->
        <input type="hidden" name="option" value="com_docman" />
        <input type="hidden" name="section" value="groups" />
        <input type="hidden" name="task" value="" />
        <input type="hidden" name="gid" value="<?php 
        echo $group->groups_id;
        ?>
" />
        <?php 
        echo DOCMAN_token::render();
        ?>
        </form>
        <?php 
        include_once JPATH_SITE . DS . 'components' . DS . 'com_docman' . DS . 'footer.php';
    }
Exemple #24
0
function sendEmail($gid)
{
    DOCMAN_token::check() or die('Invalid Token');
    // this is a generic mass mail sender to groups members.
    // From frontend you will find a email to group function specific for a document.
    $database = JFactory::getDBO();
    $my = JFactory::getUser();
    $mainframe = JFactory::getApplication();
    $this_index = 'index.php?option=com_docman&section=groups';
    $message = JRequest::getString("mm_message", '', 'post');
    $subject = JRequest::getString("mm_subject", '', 'post');
    $leadin = JRequest::getString("mm_leadin", '', 'post');
    if (!$message || !$subject) {
        $mainframe->redirect($this_index . '&task=emailgroup&gid=' . $gid, _DML_FILL_FORM);
    }
    $usertmp = trim(strtolower($my->usertype));
    if ($usertmp != "super administrator" && $usertmp != "superadministrator" && $usertmp != "manager") {
        $mainframe->redirect("index.php", _DML_ONLY_ADMIN_EMAIL);
    }
    // Get the 'TO' list of addresses
    $database->setQuery("SELECT * " . "\n FROM #__docman_groups " . "\n WHERE groups_id=" . (int) $gid);
    $email_group = $database->loadObjectList();
    $database->setQuery("SELECT id,name,username,email " . "\n FROM #__users" . "\n WHERE id in ( " . $email_group[0]->groups_members . ")" . "\n   AND email !=''");
    $listofusers = $database->loadObjectList();
    if (!count($listofusers)) {
        $mainframe->redirect($this_index, _DML_NO_TARGET_EMAIL . " " . $email_groups[0]->name);
    }
    // Get 'FROM' sending email address (Use default)
    if (!$mainframe->getCfg('mailfrom')) {
        $database->setQuery("SELECT email " . "\n FROM #__users " . "\n WHERE id=" . $my->id);
        $my->email = $database->loadResult();
        echo $database->getErrorMsg();
        $mainframe->setCfg('mailfrom', $my->email);
    }
    // Build e-mail message format
    $message = ($leadin ? stripslashes($leadin) . "\r\n\r\n" : '') . stripslashes($message);
    $subject = stripslashes($subject);
    // ------- Obsolete: ...kept for historical purposes....
    // $headers = "MIME-Version: 1.0\r\n"
    // . "From: "    .$mosConfig_sitename." <".$my->email.">\r\n"
    // . "Reply-To: ".$mosConfig_sitename." <".$my->email.">\r\n"
    // . "X-Priority: 3\r\n"
    // . "X-MSMail-Priority: Low\r\n"
    // . "X-Mailer: DOCman\r\n"
    // ;
    // mail($emailtosend->email, $subject, $message, $headers);
    // TO:              SUBJECT:  (message) Headers
    // ------------   Send email using standard mosMail function
    foreach ($listofusers as $emailtosend) {
        JUTility::sendMail($mainframe->getCfg('mailfrom'), $mainframe->getCfg('fromname'), $emailtosend->email, $subject, $message);
    }
    $mainframe->redirect($this_index, _DML_EMAIL_SENT_TO . " " . count($listofusers) . " " . _DML_USERS);
}
Exemple #25
0
    function moveDocumentForm($lists, $links, $paths, $data)
    {
        $action = _taskLink('doc_move_process', $data->id);
        ob_start();
        ?>
		<form action="<?php 
        echo DOCMAN_Compat::sefRelToAbs($action);
        ?>
" method="post" id="dm_frmmove" class="dm_form" >
		<fieldset class="dm_adminform">
		<table class="dm_admintable">
		<tr>
			<td class="dm_key">
				<label for="name"><?php 
        echo _DML_DOC;
        ?>
</label>
			</td>
			<td>
				<span id="name"><?php 
        echo $data->dmname;
        ?>
 (<?php 
        echo $data->filename;
        ?>
)</span>
			</td>
		</tr>
		<tr>
			<td class="dm_key">
				<label for="catid"><?php 
        echo _DML_MOVETO;
        ?>
</label>
			</td>
			<td>
				<?php 
        echo $lists['categories'];
        ?>
			</td>
		</tr>
		</table>
		</fieldset>
		<fieldset class="dm_button">
 			<p>
 				<input name="submit" class="button" value="<?php 
        echo _DML_MOVETHEFILES;
        ?>
" type="submit" />
 			</p>
 		</fieldset>
        <?php 
        echo DOCMAN_token::render();
        ?>
 		</form>
 		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Exemple #26
0
/**
* changes the access level of a record
*
* @param integer $ The increment to reorder by
*/
function accessCategory($uid, $access)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database;
    $row = new mosDMCategory($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index2.php?option=com_docman&section=categories');
}
    function editCSSSource($theme, &$content)
    {
        global $_DOCMAN;
        ?>
		<form action="index.php" method="post" name="adminForm">

        <?php 
        dmHTML::adminHeading(_DML_STYLESHEET_EDITOR, 'templates');
        ?>


		<table class="adminform">
		<tr>
			<th colspan="4">
			<?php 
        echo _DML_PATH;
        ?>
: <?php 
        echo $_DOCMAN->getPath('themes', $theme);
        ?>
/css/theme.css
			<?php 
        $css_path = $file = $_DOCMAN->getPath('themes', $theme) . "/css/theme.css";
        echo is_writable($css_path) ? '<b><font color="green">
			 - ' . _DML_WRITABLE . '</font></b>' : '<b><font color="red"> - ' . _DML_UNWRITABLE . '</font></b>';
        ?>
			</th>
		</tr>
		<tr>
			<td>
			<textarea style="width:99%" rows="25" name="filecontent" class="inputbox"><?php 
        echo $content;
        ?>
</textarea>
			</td>
		</tr>
		</table>
		<input type="hidden" name="theme" value="<?php 
        echo $theme;
        ?>
" />
		<input type="hidden" name="option" value="com_docman" />
		<input type="hidden" name="section" value="themes" />
		<input type="hidden" name="task" value="" />
        <?php 
        echo DOCMAN_token::render();
        ?>
		</form>
		<?php 
        include_once JPATH_SITE . DS . 'components' . DS . 'com_docman' . DS . 'footer.php';
    }
Exemple #28
0
function copyDocumentProcess($cid)
{
    DOCMAN_token::check() or die('Invalid Token');
    $mainframe = JFactory::getApplication();
    $database = JFactory::getDBO();
    $my = JFactory::getUser();
    // get the id of the category to copy the document to
    $categoryCopy = JRequest::getInt('catid', '', 'post');
    // preform move
    $doc = new mosDMDocument($database);
    $doc->copy($cid, $categoryCopy);
    // output status message
    $cids = implode(',', $cid);
    $total = count($cid);
    $cat = new mosDMCategory($database);
    $cat->load($categoryCopy);
    $msg = $total . ' ' . _DML_DOCUMENTS_COPIED_TO . ' ' . $cat->name;
    $mainframe->redirect('index.php?option=com_docman&section=documents', $msg);
}
Exemple #29
0
    function showLogs($option, $rows, $search, $pageNav)
    {
        global $database, $my, $mosConfig_absolute_path, $mosConfig_live_site;
        ?>
		<form action="index2.php" method="post" name="adminForm">
        <?php 
        dmHTML::adminHeading(_DML_DOWNLOAD_LOGS, 'logs');
        ?>
			<div class="dm_filters">
                <?php 
        echo _DML_FILTER;
        ?>
				<input type="text" name="search" value="<?php 
        echo $search;
        ?>
" class="inputbox" onChange="document.adminForm.submit();" />
            </div>
			<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
            <thead>
				<tr>
					<th width="2%" class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></th>
					<th class="title" width="10%" nowrap="nowrap"><div align="center"><?php 
        echo _DML_DATE;
        ?>
</div></th>
					<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php 
        echo _DML_USER;
        ?>
</div></th>
					<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php 
        echo _DML_IP;
        ?>
</div></th>
					<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php 
        echo _DML_DOCUMENT;
        ?>
</div></th>
					<th class="title" width="10%" nowrap="nowrap"><div align="center"><?php 
        echo _DML_BROWSER;
        ?>
</div></th>
					<th class="title" width="10%" nowrap="nowrap"><div align="center"><?php 
        echo _DML_OS;
        ?>
</div></th>
				</tr>
             </thead>

             <tfoot><tr><td colspan="11"><?php 
        echo $pageNav->getListFooter();
        ?>
</td></tr></tfoot>

             <tbody>

				<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            echo "<tr class=\"row{$k}\">";
            echo "<td width=\"20\">";
            ?>

			<input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="cid[]" value="<?php 
            echo $row->id;
            ?>
" onclick="isChecked(this.checked);" />
					</td>
					<td align="center">
						<?php 
            echo $row->log_datetime;
            ?>
					</td>
					<td align="center">
						<?php 
            echo $row->user;
            ?>
					</td>
					<td align="center">
						<a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php 
            echo $row->log_ip;
            ?>
" target="_blank"><?php 
            echo $row->log_ip;
            ?>
</a>
					</td>
					<td align="center">
						 <?php 
            echo $row->dmname;
            ?>
					</td>
					<td align="center">
						 <?php 
            echo $row->log_browser;
            ?>
					</td>
					<td align="center">
						 <?php 
            echo $row->log_os;
            ?>
					</td>
				</tr>
				<?php 
            $k = 1 - $k;
        }
        ?>
        </tbody>
		</table>

		<input type="hidden" name="option" value="com_docman" />
		<input type="hidden" name="section" value="logs" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
        <?php 
        echo DOCMAN_token::render();
        ?>
		</form>

		<?php 
        include_once $mosConfig_absolute_path . "/components/com_docman/footer.php";
    }
Exemple #30
0
function removeLicense($cid, $option)
{
    DOCMAN_token::check() or die('Invalid Token');
    $mainframe = JFactory::getApplication();
    $database = JFactory::getDBO();
    if (!is_array($cid) || count($cid) < 1) {
        echo "<script> alert(" . _DML_SELECT_ITEM_DEL . "); window.history.go(-1);</script>\n";
        exit;
    }
    if (count($cid)) {
        $cids = implode(',', $cid);
        // lets see if some document is using this license
        for ($g = 0; $g < count($cid); $g++) {
            $ttt = $cid[$g];
            $ttt = $ttt - 2 * $ttt - 10;
            $query = "SELECT id FROM #__docman WHERE dmlicense_id=" . (int) $ttt;
            $database->setQuery($query);
            if (!($result = $database->query())) {
                echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
            }
            if ($database->getNumRows($result) != 0) {
                $mainframe->redirect("index.php?option=com_docman&task=viewgroups", _DML_CANNOT_DEL_LICENSE);
            }
        }
        $database->setQuery("DELETE FROM #__docman_licenses WHERE id IN ({$cids})");
        if (!$database->query()) {
            echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        }
    }
    $mainframe->redirect("index.php?option=com_docman&section=licenses");
}