function licenseDocumentForm(&$links, &$paths, &$data, $inline = 0) { $action = _taskLink('license_result', JRequest::getInt('gid', 0), array('bid' => $data->id)); ob_start(); ?> <form action="<?php echo DOCMAN_Compat::sefRelToAbs($action); ?> " method="POST" enctype="multipart/form-data"> <input type="hidden" name="inline" value="<?php echo $inline; ?> " /> <input type="radio" name="agree" value="0" checked /><?php echo _DML_DONT_AGREE; ?> <input type="radio" name="agree" value="1" /><?php echo _DML_AGREE; ?> <br /><br /> <input name="submit" value="<?php echo _DML_PROCEED; ?> " type="submit" /> </form> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
function DOCMAN_File($name, $path) { $path = DOCMAN_Compat::mosPathName($path); if (!is_dir($path)) { $path = dirname($path); // Make sure there's a trailing slash in the path $path = DOCMAN_Compat::mosPathName($path); } $this->name = trim($name); $this->path = $path; if (strcasecmp(substr($this->name, 0, _DM_DOCUMENT_LINK_LNG), _DM_DOCUMENT_LINK) == 0) { $url = substr($this->name, 6); if (substr($url, 0, 7) != 'file://') { $this->_isLink = true; $this->size = 0; $this->mime = 'link'; } else { $this->_isLink = false; $this->name = DOCMAN_Utils::basename($url); $this->path = dirname($url) . '/'; $this->size = @filesize($url); $this->mime = DOCMAN_MIME_Magic::filenameToMIME($url, false); } } else { $this->_isLink = false; $this->size = @filesize($this->path . $this->name); $this->mime = DOCMAN_MIME_Magic::filenameToMIME($this->name, false); $this->name = DOCMAN_Utils::basename($name); } $this->ext = $this->getExtension(); }
function mosReadDirectory($path, $filter = '.', $recurse = false, $fullpath = false) { $arr = array(); if (!@is_dir($path)) { return $arr; } $handle = opendir($path); while ($file = readdir($handle)) { $dir = DOCMAN_Compat::mosPathName($path . '/' . $file, false); $isDir = is_dir($dir); if ($file != "." && $file != "..") { if (preg_match("/{$filter}/", $file)) { if ($fullpath) { $arr[] = trim(DOCMAN_Compat::mosPathName($path . '/' . $file, false)); } else { $arr[] = trim($file); } } if ($recurse && $isDir) { $arr2 = DOCMAN_Compat::mosReadDirectory($dir, $filter, $recurse, $fullpath); $arr = array_merge($arr, $arr2); } } } closedir($handle); asort($arr); return $arr; }
/** * Compiles a list of installed, version 4.5+ templates * * Based on xml files found. If no xml file found the template * is ignored */ function showThemes() { global $database, $mainframe, $_DOCMAN; global $mosConfig_absolute_path, $mosConfig_list_limit; $limit = $mainframe->getUserStateFromRequest('viewlistlimit', 'limit', $mosConfig_list_limit); $limitstart = $mainframe->getUserStateFromRequest("view{com_docman}limitstart", 'limitstart', 0); $themesBaseDir = mosPathName($_DOCMAN->getPath('themes')); $rows = array(); // Read the template dir to find templates $themesDirs = DOCMAN_Compat::mosReadDirectory($themesBaseDir); $rowid = 0; // Check that the directory contains an xml file foreach ($themesDirs as $themeDir) { $path = mosPathName($themesBaseDir . $themeDir); $xmlFilesInDir = DOCMAN_Compat::mosReadDirectory($path, '.xml'); foreach ($xmlFilesInDir as $xmlFile) { $rows[] =& parseXMLFile($rowid, $path . $xmlFile); $rowid++; } } require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php'; $pageNav = new mosPageNav(count($rows), $limitstart, $limit); $rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit); HTML_DMThemes::showThemes($rows, $pageNav); }
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; }
function editDocument($uid) { require_once JPATH_ADMINISTRATOR . "/components/com_docman/classes/DOCMAN_utils.class.php"; require_once JPATH_ADMINISTRATOR . "/components/com_docman/classes/DOCMAN_params.class.php"; global $_DOCMAN, $_DMUSER; $database = JFactory::getDBO(); $my = JFactory::getUser(); $mainframe = JFactory::getApplication(); // disable the main menu to force user to use buttons $_REQUEST['hidemainmenu'] = 1; //@TODO :: Needs to be tested //$uploaded_file = mosGetParam(DOCMAN_Utils::stripslashes($_REQUEST), "uploaded_file", ""); $uploaded_file = JRequest::getString('uploaded_file', ''); $doc = new mosDMDocument($database); if ($uid) { $doc->load($uid); if ($doc->checked_out) { if ($doc->checked_out != $my->id) { $mainframe->redirect("index.php?option={$option}", _DML_THE_MODULE . " {$row->title} " . _DML_IS_BEING); } } else { // check out document... $doc->checkout($my->id); } } else { $doc->init_record(); } // Begin building interface information... $lists = array(); $lists['document_url'] = ''; //make sure $lists['original_dmfilename'] = $doc->dmfilename; if (strcasecmp(substr($doc->dmfilename, 0, _DM_DOCUMENT_LINK_LNG), _DM_DOCUMENT_LINK) == 0) { $lists['document_url'] = substr($doc->dmfilename, _DM_DOCUMENT_LINK_LNG); $doc->dmfilename = _DM_DOCUMENT_LINK; } // category select list $options = array(JHTML::_('select.option', '0', _DML_SELECT_CAT)); $lists['catid'] = dmHTML::categoryList($doc->catid, "", $options); // check if we have at least one category defined $database->setQuery("SELECT id " . "\n FROM #__categories " . "\n WHERE section='com_docman'", 0, 1); if (!($checkcats = $database->loadObjectList())) { $mainframe->redirect("index.php?option=com_docman§ion=categories", _DML_PLEASE_SEL_CAT); } // select lists $lists['approved'] = JHTML::_('select.booleanlist', 'approved', 'class="inputbox"', $doc->approved); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $doc->published); // licenses list $database->setQuery("SELECT id, name " . "\n FROM #__docman_licenses " . "\n ORDER BY name ASC"); $licensesTemp = $database->loadObjectList(); $licenses[] = JHTML::_('select.option', '0', _DML_NO_LICENSE); foreach ($licensesTemp as $licensesTemp) { $licenses[] = JHTML::_('select.option', $licensesTemp->id, $licensesTemp->name); } $lists['licenses'] = JHTML::_('select.genericlist', $licenses, 'dmlicense_id', 'class="inputbox" size="1"', 'value', 'text', $doc->dmlicense_id); // licenses display list $licenses_display[] = JHTML::_('select.option', '0', _DML_NO); $licenses_display[] = JHTML::_('select.option', '1', _DML_YES); $lists['licenses_display'] = JHTML::_('select.genericlist', $licenses_display, 'dmlicense_display', 'class="inputbox" size="1"', 'value', 'text', $doc->dmlicense_display); if ($uploaded_file == '') { // Create docs List $dm_path = $_DOCMAN->getCfg('dmpath'); $fname_reject = $_DOCMAN->getCfg('fname_reject'); $docFiles = DOCMAN_Compat::mosReadDirectory($dm_path); $docs = array(JHTML::_('select.option', '', _DML_SELECT_FILE)); $docs[] = JHTML::_('select.option', _DM_DOCUMENT_LINK, _DML_LINKED); if (count($docFiles) > 0) { foreach ($docFiles as $file) { if (substr($file, 0, 1) == '.') { continue; } //ignore files starting with . if (@is_dir($dm_path . '/' . $file)) { continue; } //ignore directories if ($fname_reject && preg_match("/^(" . $fname_reject . ")\$/i", $file)) { continue; } //ignore certain filenames if (preg_match("/^(" . _DM_FNAME_REJECT . ")\$/i", $file)) { continue; } //ignore certain filenames //$query = "SELECT * FROM #__docman WHERE dmfilename='" . $database->getEscaped($file) . "'"; //$database->setQuery($query); //if (!($result = $database->query())) { // echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; //} //if ($database->getNumRows($result) == 0 || $doc->dmfilename == $file) { $docs[] = JHTML::_('select.option', $file); //} } //end foreach $docsFiles } if (count($docs) < 1) { $mainframe->redirect("index.php?option={$option}&task=upload", _DML_YOU_MUST_UPLOAD); } $lists['dmfilename'] = JHTML::_('select.genericlist', $docs, 'dmfilename', 'class="inputbox" size="1"', 'value', 'text', $doc->dmfilename); } else { // uploaded_file isn't blank $filename = split("\\.", $uploaded_file); $row->dmname = $filename[0]; $docs = array(JHTML::_('select.option', $uploaded_file)); $lists['dmfilename'] = JHTML::_('select.genericlist', $docs, 'dmfilename', 'class="inputbox" size="1"', 'value', 'text', $doc->dmfilename); } // endif uploaded_file // permissions lists $lists['viewer'] = dmHTML::viewerList($doc, 'dmowner'); $lists['maintainer'] = dmHTML::maintainerList($doc, 'dmmantainedby'); // updater user information $last = array(); if ($doc->dmlastupdateby > '0' && $doc->dmlastupdateby != $my->id) { $database->setQuery("SELECT id, name FROM #__users WHERE id=" . (int) $doc->dmlastupdateby); $last = $database->loadObjectList(); } else { $last[0]->name = $my->name ? $my->name : $my->username; } // "Super Administrator" // creator user information $created = array(); if ($doc->dmsubmitedby > '0' && $doc->dmsubmitedby != $my->id) { $database->setQuery("SELECT id, name FROM #__users WHERE id=" . (int) $doc->dmsubmitedby); $created = $database->loadObjectList(); } else { $created[0]->name = $my->name ? $my->name : $my->username; } // "Super Administrator" // Imagelist $lists['image'] = dmHTML::imageList('dmthumbnail', $doc->dmthumbnail); // Params definitions $params_path = JPATH_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()) { $mainframe->redirect("index.php?option=com_docman§ion=documents", $prebot->getErrorMsg()); } HTML_DMDocuments::editDocument($doc, $lists, $last, $created, $params); }
/** * @param string The name of the form element * @param string The value of the element * @param object The xml element for the parameter * @param string The control name * @return string The html for the element */ function _form_filelist($name, $value, &$node, $control_name) { // path to images directory $path = JPATH_ROOT . DS . $node->getAttribute('directory'); $filter = $node->getAttribute('filter'); $files = DOCMAN_Compat::mosReadDirectory($path, $filter); $options = array(); foreach ($files as $file) { $options[] = JHTML::_('select.option', $file, $file); } if (!$node->getAttribute('hide_none')) { array_unshift($options, JHTML::_('select.option', '-1', '- ' . 'Do Not Use' . ' -')); } if (!$node->getAttribute('hide_default')) { array_unshift($options, JHTML::_('select.option', '', '- ' . 'Use Default' . ' -')); } return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, "param{$name}"); }
function showCPanel() { global $_DOCMAN; ?> <script language="JavaScript" src="<?php echo JURI::root(true); ?> /administrator/components/com_docman/includes/js/docmanjavascript.js"></script> <?php JToolBarHelper::title(' ', 'dm_logo'); ?> <table class="adminform"> <tr> <td width="55%" valign="top"> <div id="cpanel"> <?php $link = "index.php?option=com_docman&section=files"; HTML_DMDocman::_quickiconButton($link, 'dm_files_48.png', _DML_FILES, _DM_ICONPATH); $link = "index.php?option=com_docman&section=files&task=upload"; HTML_DMDocman::_quickiconButton($link, 'dm_newfile_48.png', _DML_NEW_FILE, _DM_ICONPATH); $link = "index.php?option=com_docman&section=documents"; HTML_DMDocman::_quickiconButton($link, 'dm_documents_48.png', _DML_DOCS, _DM_ICONPATH); $link = "index.php?option=com_docman&section=documents&task=new"; HTML_DMDocman::_quickiconButton($link, 'dm_newdocument_48.png', _DML_NEW_DOCUMENT, _DM_ICONPATH); $link = "index.php?option=com_docman&section=categories"; HTML_DMDocman::_quickiconButton($link, 'dm_categories_48.png', _DML_CATS, _DM_ICONPATH); $link = "index.php?option=com_docman&section=groups"; HTML_DMDocman::_quickiconButton($link, 'dm_groups_48.png', _DML_GROUPS, _DM_ICONPATH); $link = "index.php?option=com_docman&section=licenses"; HTML_DMDocman::_quickiconButton($link, 'dm_licenses_48.png', _DML_LICENSES, _DM_ICONPATH); $link = "index.php?option=com_docman&task=stats"; HTML_DMDocman::_quickiconButton($link, 'dm_stats_48.png', _DML_STATS, _DM_ICONPATH); $link = "index.php?option=com_docman&section=logs"; HTML_DMDocman::_quickiconButton($link, 'dm_logs_48.png', _DML_DOWNLOAD_LOGS, _DM_ICONPATH); $link = "index.php?option=com_docman&section=config"; HTML_DMDocman::_quickiconButton($link, 'dm_config_48.png', _DML_CONFIG, _DM_ICONPATH); $link = "index.php?option=com_docman&section=themes"; HTML_DMDocman::_quickiconButton($link, 'dm_templatemanager_48.png', _DML_THEMES, _DM_ICONPATH); $link = "index.php?option=com_docman&section=themes&task=edit&cid[0]=" . $_DOCMAN->getCfg('icon_theme'); HTML_DMDocman::_quickiconButton($link, 'dm_edittheme_48.png', _DML_EDIT_DEFAULT_THEME, _DM_ICONPATH); $link = "index.php?option=com_docman&section=cleardata"; HTML_DMDocman::_quickiconButton($link, 'dm_cleardata_48.png', _DML_CLEARDATA, _DM_ICONPATH); HTML_DMDocman::_quickiconButton(_DM_HELP_URL, 'dm_help_48.png', _DML_HELP, _DM_ICONPATH, '_blank'); ?> </div> </td> <td width="45%" valign="top"> <div style="width=100%;"> <form action="index.php" method="post" name="adminForm"> <?php DOCMAN_Compat::mosLoadAdminModules('dmcpanel', 1); ?> <input type="hidden" name="sectionid" value="" /> <input type="hidden" id="cid" name="cid[]" value="" /> <input type="hidden" name="option" value="com_docman" /> <input type="hidden" name="task" value="" /> </form> </div> </td> </tr> </table> <?php include_once JPATH_ROOT . DS . 'components' . DS . 'com_docman' . DS . 'footer.php'; }
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; }
/** * Count the number of files in the data folder */ function cntFiles() { global $_DOCMAN; $files = DMInstallHelper::getDefaultFiles(); $dir = DOCMAN_Compat::mosReadDirectory($_DOCMAN->getCfg('dmpath')); return count(array_diff($dir, $files)); }
/** * @param string The name of the form element * @param string The value of the element * @param object The xml element for the parameter * @param string The control name * @return string The html for the element */ function _form_filelist($name, $value, &$node, $control_name) { global $mosConfig_absolute_path; // path to images directory $path = $mosConfig_absolute_path . $node->getAttribute('directory'); $filter = $node->getAttribute('filter'); $files = DOCMAN_Compat::mosReadDirectory($path, $filter); $options = array(); foreach ($files as $file) { $options[] = mosHTML::makeOption($file, $file); } if (!$node->getAttribute('hide_none')) { array_unshift($options, mosHTML::makeOption('-1', '- ' . 'Do Not Use' . ' -')); } if (!$node->getAttribute('hide_default')) { array_unshift($options, mosHTML::makeOption('', '- ' . 'Use Default' . ' -')); } return mosHTML::selectList($options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, "param{$name}"); }
/** * 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 _showTabDocument(&$row, &$lists, &$last, &$created) { ?> <fieldset class="adminform"> <legend><?php echo _DML_TITLE_DOCINFORMATION; ?> </legend> <table class="admintable"> <tr> <td class="key"> <?php echo _DML_THUMBNAIL; ?> </td> <td> <?php echo $lists['image']; ?> <br /><br /> <script language="javascript" type="text/javascript"> <!-- if (document.forms[0].dmthumbnail.options.value){ jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'dmthumbnail' ); } else { jsimg='../images/M_images/blank.png'; } document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="Preview" />'); //--> </script> </td> </tr> <tr> <td class="key"><?php echo _DML_FILE; ?> </td> <td><?php echo $lists['dmfilename']; ?> </td> </tr> <tr> <td class="key"><?php echo _DML_DATE; ?> </td> <td> <?php echo DOCMAN_Compat::calendar('dmdate_published', $row->dmdate_published); ?> </td> </tr> <tr> <td class="key"> <label class="hasTip" title="<?php echo _DML_DOCURL . '::' . _DML_DOCURL_TOOLTIP; ?> "><?php echo _DML_DOCURL; ?> </label> </td> <td> <input class="inputbox" type="text" name="document_url" size="50" maxlength="200" value="<?php echo htmlspecialchars($lists['document_url'], ENT_QUOTES); ?> " /> </td> </tr> <tr> <td class="key"> <label class="hasTip" title="<?php echo _DML_HOMEPAGE . '::' . _DML_HOMEPAGE_TOOLTIP; ?> "><?php echo _DML_HOMEPAGE; ?> </label> </td> <td> <input class="inputbox" type="text" name="dmurl" size="50" maxlength="200" value="<?php echo $row->dmurl; /*htmlspecialchars($row->dmurl, ENT_QUOTES);*/ ?> " /> </td> <td><!--<i>(<?php echo _DML_MAKE_SURE; ?> )</i>--></td> </tr> </table> </fieldset> <?php }
function editLicense($option, &$row) { global $mosConfig_absolute_path; mosMakeHtmlSafe($row); ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } if (form.name.value == "") { alert ( "<?php echo _E_WARNTITLE; ?> " ); } else { <?php getEditorContents('editor1', 'license'); ?> submitform( pressbutton ); } } </script> <form action="index2.php" method="post" name="adminForm" id="adminForm"> <?php $tmp = ($row->id ? _DML_EDIT : _DML_ADD) . ' ' . _DML_LICENSES; dmHTML::adminHeading($tmp, 'licenses'); ?> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform"> <tr> <td width="20%" align="right"><?php echo _DML_NAME; ?> :</td> <td width="80%"> <input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php echo $row->name; ?> " /> </td> </tr> <tr> <td valign="top" align="right"><?php echo _DML_LICENSE_TEXT; ?> :</td> <td> <?php DOCMAN_Compat::editorArea('editor1', $row->license, 'license', '700', '600', '60', '30'); ?> </td> </tr> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <input type="hidden" name="option" value="com_docman" /> <input type="hidden" name="section" value="licenses" /> <input type="hidden" name="task" value="" /> <?php echo DOCMAN_token::render(); ?> </form> </table> <?php include_once $mosConfig_absolute_path . "/components/com_docman/footer.php"; }
/** * Custom install method * * @param int $ The id of the module * @param string $ The URL option * @param int $ The client id */ function uninstall($id) { $database = JFactory::getDBO(); // Delete directories $path = JPATH_SITE . DS . 'components' . DS . 'com_docman' . DS . 'themes' . DS . $id; $id = str_replace('..', '', $id); if (trim($id)) { if (is_dir($path)) { return deldir(DOCMAN_Compat::mosPathName($path)); } else { $this->setError(4, _DML_DIRNOTEXISTS); return false; } } else { $this->setError(4, _DML_TEMPLATEEMPTY); return false; } }
function installTheme($userfile) { DOCMAN_token::check() or die('Invalid Token'); // Check that the zlib is available if (!extension_loaded('zlib')) { HTML_DMThemes::showInstallMessage(_DML_NEED_ZLIB, _DML_INSTALLER_ERROR, 'index.php?option=com_docman&task=cpanel'); exit; } $installer = new DOCMAN_InstallerTheme(); $path = DOCMAN_Compat::mosPathName($userfile); if (!is_dir($path)) { $path = dirname($path); } if (!$installer->installPackage($path)) { showErrorMessage($installer); exit; } HTML_DMThemes::showInstallMessage('', _DML_SUCCESFULLY_INSTALLED . ' ' . $installer->installFilename(), 'index.php?option=com_docman§ion=themes'); }
function plugin() { DOCMAN_Compat::calendarJS(); }
function _showTabDocument(&$row, &$lists, &$last, &$created) { ?> <table class="adminform"> <tr> <th colspan="3"><?php echo _DML_TITLE_DOCINFORMATION; ?> </th> <tr> <tr> <td> <?php echo _DML_THUMBNAIL; ?> </td> <td> <?php echo $lists['image']; ?> </td> <td rowspan="4" width="50%"> <script language="javascript" type="text/javascript"> <!-- if (document.forms[0].dmthumbnail.options.value){ jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'dmthumbnail' ); } else { jsimg='../images/M_images/blank.png'; } document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="Preview" />'); //--> </script> </td> </tr> <tr> <td align="right"><?php echo _DML_FILE; ?> </td> <td><?php echo $lists['dmfilename']; ?> </td> </tr> <tr> <td width="20%" align="right"><?php echo _DML_DATE; ?> </td> <td> <?php echo DOCMAN_Compat::calendar('dmdate_published', $row->dmdate_published); ?> </td> </tr> <tr> <td valign="top"><?php echo _DML_DOCURL; echo DOCMAN_Utils::mosToolTip(_DML_DOCURL_TOOLTIP . '</span>', _DML_DOCURL); ?> </td> <td> <input class="inputbox" type="text" name="document_url" size="50" maxlength="200" value="<?php echo htmlspecialchars($lists['document_url'], ENT_QUOTES); ?> " /> </td> </tr> <tr> <td width="250" valign="top"><?php echo _DML_HOMEPAGE; echo DOCMAN_Utils::mosToolTip(_DML_HOMEPAGE_TOOLTIP . '</span>', _DML_HOMEPAGE); ?> <!--<i>(<?php echo _DML_MAKE_SURE; ?> )</i>--> </td> <td> <input class="inputbox" type="text" name="dmurl" size="50" maxlength="200" value="<?php echo $row->dmurl; /*htmlspecialchars($row->dmurl, ENT_QUOTES);*/ ?> " /> </td> </tr> </table> <?php }
/** * Writes the edit form for new and existing categories * * @param mosCategory $ The category object * @param string $ * @param array $ */ function edit(&$row, $section, &$lists, $redirect) { if ($row->image == "") { $row->image = 'blank.png'; } JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'description'); jimport('joomla.html.editor'); $editor =& JFactory::getEditor(); ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton, section) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } if ( form.name.value == "" || form.title.value == "") { alert('<?php echo _DML_CAT_MUST_SELECT_NAME; ?> '); } else { <?php echo $editor->save('description'); ?> submitform(pressbutton); } } </script> <form action="index.php" method="post" name="adminForm"> <?php $tmp = ($row->id ? _DML_EDIT : _DML_ADD) . ' ' . _DML_CAT . ' ' . $row->name; dmHTML::adminHeading($tmp, 'categories'); ?> <div class="col width-50"> <fieldset class="adminform"> <legend><?php echo _DML_CATDETAILS; ?> </legend> <table class="admintable"> <tr> <td class="key"><label><?php echo _DML_CATTITLE; ?> :</label></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 class="key"><?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 class="key"><?php echo _DML_PARENTITEM; ?> :</td> <td><?php echo $lists['parent']; ?> </td> </tr> <tr> <td class="key"><?php echo _DML_IMAGE; ?> :</td> <td><?php echo $lists['image']; ?> <br /><br /> <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 class="key"><?php echo _DML_IMAGEPOS; ?> :</td> <td><?php echo $lists['image_position']; ?> </td> </tr> <tr> <td class="key"><?php echo _DML_ORDERING; ?> :</td> <td><?php echo $lists['ordering']; ?> </td> </tr> <tr> <td class="key"><?php echo _DML_ACCESSLEVEL; ?> :</td> <td><?php echo $lists['access']; ?> </td> </tr> <tr> <td class="key"><?php echo _DML_PUBLISHED; ?> :</td> <td><?php echo $lists['published']; ?> </td> </tr> </table> </fieldset> </div> <div class="col width-50"> <fieldset class="adminform"> <legend><?php echo _DML_DESCRIPTION; ?> </legend> <?php // parameters : areaname, content, hidden field, width, height, rows, cols DOCMAN_Compat::editorArea('editor1', $row->description, 'description', '440', '282', '50', '5'); ?> </fieldset> </div> <div style="clear: both;"></div> <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 JPATH_ROOT . "/components/com_docman/footer.php"; }
function imageList($name, &$active, $javascript = null, $directory = null) { if (!$javascript) { $javascript = "onchange=\"javascript:if (document.adminForm." . $name . ".options[selectedIndex].value!='') {document.imagelib.src='../images/stories/' + document.adminForm." . $name . ".options[selectedIndex].value} else {document.imagelib.src='../images/blank.png'}\""; } if (!$directory) { $directory = '/images/stories'; } $imageFiles = DOCMAN_Compat::mosReadDirectory(JPATH_ROOT . $directory); $images = array(JHTML::_('select.option', '', _DML_SELECTIMAGE)); foreach ($imageFiles as $file) { if (eregi("bmp|gif|jpg|png", $file)) { $images[] = JHTML::_('select.option', $file); } } $images = JHTML::_('select.genericlist', $images, $name, 'id="' . $name . '" class="inputbox" size="1" ' . $javascript, 'value', 'text', $active); return $images; }
function _showTabDocument(&$row, &$lists, $last, $created) { global $_DOCMAN, $_DMUSER; DOCMAN_Compat::calendarJS(); ?> <table class="adminform"> <tbody> <tr> <td> <label for="dmname"><?php echo _DML_TITLE; ?> </label><br /> <input class="inputbox" type="text" name="dmname" size="50" maxlength="100" value="<?php echo $row->dmname; ?> " /> <p> <label for="catid"><?php echo _DML_CATEGORY; ?> </label><br /> <?php echo $lists['catid']; ?> </p> <p> <label for="dmdate_published"><?php echo _DML_DATE; ?> </label><br /> <?php DOCMAN_Compat::calendar('dmdate_published', $row->dmdate_published); ?> </p> <p> <label for="dmthumbnail"><?php echo _DML_THUMBNAIL; ?> </label><br /> <?php echo $lists['dmthumbnail']; ?> <img src="images/stories/<?php echo $lists['dmthumbnail_preview']; ?> " id="dmthumbnail_preview" alt="Preview" /> </p> <p> <label for="dmfilename"><?php echo _DML_FILE; ?> </label><br /> <?php echo $lists['dmfilename']; ?> </p> <?php if (isset($row->dmlink)) { ?> <p> <label for="dmfilename"><?php echo _DML_DOCURL; ?> </label><br /> <input class="inputbox" type="text" name="document_url" size="50" maxlength="200" value="<?php echo $row->dmlink; ?> " /> <?php echo DOCMAN_Utils::mosToolTip(_DML_DOCURL_TOOLTIP . '</span>', _DML_DOCURL); ?> </p> <?php } ?> <p> <label class="nofloat" for="dmurl"><?php echo _DML_HOMEPAGE; ?> </label><br /> <input class="inputbox" type="text" name="dmurl" size="50" maxlength="200" value="<?php echo $row->dmurl; ?> " /> <?php echo DOCMAN_Utils::mosToolTip(_DML_HOMEPAGE_TOOLTIP . '</span>', _DML_HOMEPAGE); ?> <div><i>(<?php echo _DML_MAKE_SURE; ?> )</i></div> </p> <?php if (!$row->approved && $_DMUSER->canApprove()) { ?> <p> <label><?php echo _DML_APPROVED; ?> </label><br /> <?php echo $lists['approved']; ?> </p> <?php } if ($row->approved && $_DMUSER->canPublish()) { ?> <p> <label><?php echo _DML_PUBLISHED; ?> </label><br /> <?php echo $lists['published']; ?> </p> <?php } ?> </td> </tr> </tbody> </table> <?php }
function showCPanel() { global $mosConfig_live_site, $mosConfig_absolute_path; global $_DOCMAN; ?> <script language="JavaScript" src="<?php echo $mosConfig_live_site; ?> /administrator/components/com_docman/includes/js/docmanjavascript.js"></script> <?php if (defined('_DM_J15')) { JToolBarHelper::title(' ', 'dm_logo'); } else { ?> <table> <tr> <th><img border="0" alt="DOCman logo" src="components/com_docman/images/dm_logo.png" /></th> </tr> </table> <?php } ?> <table class="adminform"> <tr> <td width="55%" valign="top"> <div id="cpanel"> <?php $link = "index2.php?option=com_docman&section=files"; HTML_DMDocman::_quickiconButton($link, 'dm_files_48.png', _DML_FILES, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=files&task=upload"; HTML_DMDocman::_quickiconButton($link, 'dm_newfile_48.png', _DML_NEW_FILE, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=documents"; HTML_DMDocman::_quickiconButton($link, 'dm_documents_48.png', _DML_DOCS, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=documents&task=new"; HTML_DMDocman::_quickiconButton($link, 'dm_newdocument_48.png', _DML_NEW_DOCUMENT, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=categories"; HTML_DMDocman::_quickiconButton($link, 'categories.png', _DML_CATS); $link = "index2.php?option=com_docman&section=groups"; HTML_DMDocman::_quickiconButton($link, 'user.png', _DML_GROUPS); $link = "index2.php?option=com_docman&section=licenses"; HTML_DMDocman::_quickiconButton($link, 'dm_licenses_48.png', _DML_LICENSES, _DM_ICONPATH); $link = "index2.php?option=com_docman&task=stats"; HTML_DMDocman::_quickiconButton($link, 'dm_stats_48.png', _DML_STATS, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=logs"; HTML_DMDocman::_quickiconButton($link, 'dm_logs_48.png', _DML_DOWNLOAD_LOGS, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=config"; HTML_DMDocman::_quickiconButton($link, 'config.png', _DML_CONFIG); $link = "index2.php?option=com_docman&section=themes"; HTML_DMDocman::_quickiconButton($link, 'templatemanager.png', _DML_THEMES); $link = "index2.php?option=com_docman&section=themes&task=edit&cid[0]=" . $_DOCMAN->getCfg('icon_theme'); HTML_DMDocman::_quickiconButton($link, 'dm_edittheme_48.png', _DML_EDIT_DEFAULT_THEME, _DM_ICONPATH); $link = "index2.php?option=com_docman&section=cleardata"; HTML_DMDocman::_quickiconButton($link, 'dm_cleardata_48.png', _DML_CLEARDATA, _DM_ICONPATH); $link = "index2.php?option=com_docman&task=credits"; HTML_DMDocman::_quickiconButton($link, 'credits.png', _DML_CREDITS); HTML_DMDocman::_quickiconButton(_DM_HELP_URL, 'dm_help_48.png', _DML_HELP, _DM_ICONPATH, '_blank'); ?> </div> </td> <td width="45%" valign="top"> <div style="width=100%;"> <form action="index2.php" method="post" name="adminForm"> <?php DOCMAN_Compat::mosLoadAdminModules('dmcpanel', 1); ?> <input type="hidden" name="sectionid" value="" /> <input type="hidden" id="cid" name="cid[]" value="" /> <input type="hidden" name="option" value="com_docman" /> <input type="hidden" name="task" value="" /> </form> </div> </td> </tr> </table> <?php include_once $mosConfig_absolute_path . "/components/com_docman/footer.php"; }
function editLicense($option, &$row) { JFilterOutput::objectHTMLSafe($row); ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } <?php jimport('joomla.html.editor'); $editor =& JFactory::getEditor(); echo $editor->save('license'); ?> submitform( pressbutton ); } </script> <form action="index.php" method="post" name="adminForm" id="adminForm"> <?php $tmp = ($row->id ? _DML_EDIT : _DML_ADD) . ' ' . _DML_LICENSES; dmHTML::adminHeading($tmp, 'licenses'); ?> <fieldset class="adminform"> <legend><?php echo _DML_LICENSE; ?> </legend> <table class="admintable"> <tr> <td class="key"><?php echo _DML_NAME; ?> :</td> <td> <input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php echo $row->name; ?> " /> </td> </tr> <tr> <td class="key"><?php echo _DML_LICENSE_TEXT; ?> :</td> <td> <?php DOCMAN_Compat::editorArea('editor1', $row->license, 'license', '700', '600', '60', '30'); ?> </td> </tr> </table> </fieldset> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <input type="hidden" name="option" value="com_docman" /> <input type="hidden" name="section" value="licenses" /> <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'; }