Merge commit 'a252f82f085b8284d353a31a7fa583b8f12da4fa' into seeddms-5.0.0-pre3

This commit is contained in:
Uwe Steinmann 2015-04-23 12:38:31 +02:00
commit 2781974f7b
9 changed files with 52 additions and 23 deletions

View File

@ -50,12 +50,22 @@ class SeedDMS_Core_Group {
$this->_dms = null;
} /* }}} */
/**
* Create an instance of a group object
*
* @param string|integer $id Id, name of group, depending
* on the 3rd parameter.
* @param object $dms instance of dms
* @param string $by search by group name if set to 'name'.
* Search by Id of group if left empty.
* @return object instance of class SeedDMS_Core_Group
*/
public static function getInstance($id, $dms, $by='') { /* {{{ */
$db = $dms->getDB();
switch($by) {
case 'name':
$queryStr = "SELECT * FROM `tblGroups` WHERE `name` = ".$this->db->qstr($name);
$queryStr = "SELECT * FROM `tblGroups` WHERE `name` = ".$db->qstr($id);
break;
default:
$queryStr = "SELECT * FROM `tblGroups` WHERE id = " . (int) $id;

View File

@ -155,17 +155,29 @@ class SeedDMS_Core_User {
$this->_dms = null;
}
/**
* Create an instance of a user object
*
* @param string|integer $id Id, login name, or email of user, depending
* on the 3rd parameter.
* @param object $dms instance of dms
* @param string $by search by [name|email]. If 'name' is passed, the method
* will check for the 4th paramater and also filter by email. If this
* parameter is left empty, the user will be search by its Id.
* @param string $email optional email address if searching for name
* @return object instance of class SeedDMS_Core_User
*/
public static function getInstance($id, $dms, $by='', $email='') { /* {{{ */
$db = $dms->getDB();
switch($by) {
case 'name':
$queryStr = "SELECT * FROM tblUsers WHERE login = ".$this->db->qstr($login);
$queryStr = "SELECT * FROM tblUsers WHERE login = ".$db->qstr($id);
if($email)
$queryStr .= " AND email=".$this->db->qstr($email);
$queryStr .= " AND email=".$db->qstr($email);
break;
case 'email':
$queryStr = "SELECT * FROM tblUsers WHERE email = ".$this->db->qstr($email);
$queryStr = "SELECT * FROM tblUsers WHERE email = ".$db->qstr($id);
break;
default:
$queryStr = "SELECT * FROM tblUsers WHERE id = " . (int) $id;

View File

@ -57,17 +57,21 @@ class SeedDMS_Extension_Mgr {
*/
function createExtensionConf() { /* {{{ */
$extensions = self::getExtensions();
$fp = fopen($this->cachedir."/extensions.php", "w");
if($extensions) {
foreach($extensions as $_ext) {
if(file_exists($this->extdir . "/" . $_ext . "/conf.php")) {
$content = file_get_contents($this->extdir . "/" . $_ext . "/conf.php");
fwrite($fp, $content);
$fp = fopen(self::getExtensionsConfFile(), "w");
if($fp) {
if($extensions) {
foreach($extensions as $_ext) {
if(file_exists($this->extdir . "/" . $_ext . "/conf.php")) {
$content = file_get_contents($this->extdir . "/" . $_ext . "/conf.php");
fwrite($fp, $content);
}
}
}
fclose($fp);
return true;
} else {
return false;
}
fclose($fp);
//include($this->cachedir."/extensions.php");
} /* }}} */
function getExtensions() { /* {{{ */

View File

@ -306,7 +306,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
$index = SeedDMS_Lucene_Indexer::open($settings->_luceneDir);
if($index) {
SeedDMS_Lucene_Indexer::init($settings->_stopWordsFile);
$index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, isset($settings->_convcmd) ? $settings->_convcmd : null, true));
$index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, isset($settings->converters['fulltext']) ? $settings->converters['fulltext'] : null, true));
}
}
@ -315,7 +315,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
$res = $document->addNotify($user->getID(), true);
}
/* Check if additional notification shall be added */
if($_POST['notification_users']) {
if(!empty($_POST['notification_users'])) {
foreach($_POST['notification_users'] as $notuserid) {
$notuser = $dms->getUser($notuserid);
if($notuser) {
@ -324,7 +324,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
}
}
}
if($_POST['notification_groups']) {
if(!empty($_POST['notification_groups'])) {
foreach($_POST['notification_groups'] as $notgroupid) {
$notgroup = $dms->getGroup($notgroupid);
if($notgroup) {

View File

@ -591,7 +591,7 @@ switch($command) {
$index = SeedDMS_Lucene_Indexer::open($settings->_luceneDir);
if($index) {
SeedDMS_Lucene_Indexer::init($settings->_stopWordsFile);
$index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, isset($settings->_convcmd) ? $settings->_convcmd : null, true));
$index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, isset($settings->converters['fulltext']) ? $settings->converters['fulltext'] : null, true));
}
}

View File

@ -34,7 +34,7 @@ if(!checkFormKey('extensionmgr')) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
}
$extMgr = new SeedDMS_Extension_Mgr($db, $settings->_rootDir."/ext", $settings->_cacheDir);
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$extconffile = $extMgr->getExtensionsConfFile();
$extMgr->createExtensionConf();

View File

@ -58,7 +58,7 @@ function tree($folder, $indent='') {
foreach($documents as $document) {
echo $indent." ".$document->getId().":".$document->getName()."\n";
if(!($hits = $index->find('document_id:'.$document->getId()))) {
$index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, $settings->_converters ? $settings->_converters : null));
$index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, isset($settings->converters['fulltext']) ? $settings->converters['fulltext'] : null));
} else {
$hit = $hits[0];
$created = (int) $hit->getDocument()->getFieldValue('created');

View File

@ -1043,7 +1043,10 @@ function folderSelected<?php echo $form ?>(id, name) {
}
echo "</select>";
} else {
echo "<input type=\"text\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".($attribute ? htmlspecialchars($attribute->getValue()) : '')."\" />";
if($attribute && strlen($attribute->getValue()) > 30)
echo "<textarea name=\"".$fieldname."[".$attrdef->getId()."]\">".htmlspecialchars($attribute->getValue())."</textarea>";
else
echo "<input type=\"text\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".($attribute ? htmlspecialchars($attribute->getValue()) : '')."\" />";
}
} /* }}} */

View File

@ -72,7 +72,7 @@ if(!is_writeable($settings->_configFilePath)) {
</ul>
<div class="tab-content">
<div class="tab-pane active" id="site">
<div class="tab-pane <?php if(!$currenttab || $currenttab == 'site') echo 'active'; ?>" id="site">
<?php $this->contentContainerStart(); ?>
<table class="table-condensed">
<!--
@ -255,7 +255,7 @@ if(!is_writeable($settings->_configFilePath)) {
<?php $this->contentContainerEnd(); ?>
</div>
<div class="tab-pane" id="system">
<div class="tab-pane <?php if($currenttab == 'system') echo 'active'; ?>" id="system">
<?php $this->contentContainerStart(); ?>
<table class="table-condensed">
<!--
@ -433,7 +433,7 @@ if(!is_writeable($settings->_configFilePath)) {
<?php $this->contentContainerEnd(); ?>
</div>
<div class="tab-pane" id="advanced">
<div class="tab-pane <?php if($currenttab == 'advanced') echo 'active'; ?>" id="advanced">
<?php $this->contentContainerStart(); ?>
<table class="table-condensed">
<!--
@ -586,7 +586,7 @@ if(!is_writeable($settings->_configFilePath)) {
<?php $this->contentContainerEnd(); ?>
</div>
<div class="tab-pane" id="extensions">
<div class="tab-pane <?php if($currenttab == 'extensions') echo 'active'; ?>" id="extensions">
<?php $this->contentContainerStart(); ?>
<table class="table-condensed">
<!--