Skip to content

Commit

Permalink
Fixed opendocman#180 - added max query result setting
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlawrence committed Oct 18, 2014
1 parent 2252aa3 commit 6f5f74e
Show file tree
Hide file tree
Showing 26 changed files with 130 additions and 34 deletions.
5 changes: 3 additions & 2 deletions Dept_Perms_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Dept_Perms_class.php - Dept_Perms is designed to handle permission settings of each department.
Copyright (C) 2002-2004 Stephen Lawrence, Khoa Nguyen
Copyright (C) 2005-2011 Stephen Lawrence Jr.
Copyright (C) 2005-2014 Stephen Lawrence Jr.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
Expand Down Expand Up @@ -90,7 +90,8 @@ function loadData_UserPerm($right)
AND
data.id=deptperms.fid
AND
data.publishable=1";
data.publishable=1"
. " LIMIT {$GLOBALS['CONFIG']['max_query']}";
$result = mysql_query($query, $this->connection) or die("Error in querying: $query" .mysql_error());
//$fileid_array[$index][0] ==> fid
//$fileid_array[$index][1] ==> owner
Expand Down
8 changes: 5 additions & 3 deletions User_Perms_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ function loadData_UserPerm($right)
FROM
{$GLOBALS['CONFIG']['db_prefix']}$this->TABLE_DATA as d
WHERE
d.publishable = 1";
d.publishable = 1 "
. "LIMIT {$GLOBALS['CONFIG']['max_query']}";
}
elseif ($this->user_obj->isReviewer())
{
Expand All @@ -108,7 +109,8 @@ function loadData_UserPerm($right)
AND
dr.dept_id = d.department
AND
dr.user_id = $this->id";
dr.user_id = $this->id"
. " LIMIT {$GLOBALS['CONFIG']['max_query']}";
}
else
{
Expand All @@ -125,7 +127,7 @@ function loadData_UserPerm($right)
up.rights>=$right
AND
d.publishable = 1
)";
) LIMIT {$GLOBALS['CONFIG']['max_query']}";
}
//$start = getmicrotime();
$result = mysql_query($query, $this->connection) or die("Error in querying: $query" .mysql_error());
Expand Down
3 changes: 2 additions & 1 deletion database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ CREATE TABLE IF NOT EXISTS odm_odmsys
sys_value varchar(255)
) ENGINE = MYISAM;

INSERT INTO odm_odmsys VALUES (NULL,'version','1.2.6.3');
INSERT INTO odm_odmsys VALUES (NULL,'version','1.2.9');

CREATE TABLE IF NOT EXISTS `odm_settings` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
Expand Down Expand Up @@ -264,6 +264,7 @@ INSERT INTO `odm_settings` VALUES(NULL,'try_nis', 'False', 'Attempt NIS password
INSERT INTO `odm_settings` VALUES(NULL,'theme', 'tweeter', 'Which theme to use?', '');
INSERT INTO `odm_settings` VALUES(NULL,'language', 'english', 'Set the default language (english, spanish, turkish, etc.). Local users may override this setting. Check include/language folder for languages available', 'alpha|req');
INSERT INTO `odm_settings` VALUES(NULL,'base_url', 'http://localhost/opendocman', 'Set this to the url of the site. No need for trailing \"/\" here', 'url');
INSERT INTO `odm_settings` VALUES(NULL,'max_query', '500', 'Set this to the maximum number of rows you want to be returned in a file listing.', 'num');

CREATE TABLE IF NOT EXISTS `odm_filetypes` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
Expand Down
11 changes: 8 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,14 @@ function list_files($fileid_array, $userperms_obj, $dataDir, $showCheckBox = 'fa
'rejectpage'=>$rejectpage
);
//print_r($file_list_arr);exit;

}


$limit_reached = false;
if(count($file_list_arr) >= $GLOBALS['CONFIG']['max_query']) {
$limit_reached = true;
}

$GLOBALS['smarty']->assign('limit_reached', $limit_reached);
$GLOBALS['smarty']->assign('showCheckBox', $showCheckBox);
//print_r($file_list_arr);exit;
$GLOBALS['smarty']->assign('file_list_arr', $file_list_arr);
Expand Down Expand Up @@ -923,4 +928,4 @@ function redirect_visitor($url='')
}
}

}
}
3 changes: 2 additions & 1 deletion includes/language/arabic.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@
$lang['message_if_you_are_unable_to_view3'] = '<br> لبدء تحميله إلى محطة العمل المحلية للحصول على عرض محلي.';//Abduh says :this value must be changed
$lang['message_initial_import'] = 'استيراد اولي';
$lang['message_last_message'] = 'اخر رسالة';
$lang['message_latest_version'] = 'احدث اصدار';
$lang['message_latest_version'] = 'احدث اصدار';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'انت تحتاج على الاقل على ادارة واحدة'; //Abduh says :this value must be changed
$lang['message_no_author_comments_available'] = 'لايوجد تعليقات متاحة';
$lang['message_no_description_available'] = 'لايوجد وصف متاح';
Expand Down
1 change: 1 addition & 0 deletions includes/language/bangla.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'প্রাথমিক আমদানি';
$lang['message_last_message'] = 'সর্বশেষ বার্তা';
$lang['message_latest_version'] = 'সর্বশেষ ভার্সন';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'অন্ততঃ একটি বিভাগ প্রয়োজন ';
$lang['message_no_author_comments_available'] = 'লেখকের কোন মন্তব্য উপলভ্য নয়';
$lang['message_no_description_available'] = 'কোন বিবরণ উপলভ্য নয়';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/chinese.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//ENGLISH LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: fanquanfang
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = '初始载入';
$lang['message_last_message'] = '上一消息';
$lang['message_latest_version'] = '上一版本';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = '你至少需要一个部门';
$lang['message_no_author_comments_available'] = '没有作者评语';
$lang['message_no_description_available'] = '没有描述';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/croatian.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//CROATIAN LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: Mihovil Stanić
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Početni uvoz';
$lang['message_last_message'] = 'Posljednja poruka';
$lang['message_latest_version'] = 'Najnovija inačica';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Odaberite barem jedan odjel';
$lang['message_no_author_comments_available'] = 'Autorov komentar nije dostupan';
$lang['message_no_description_available'] = 'Opis nije dostupan';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/czech.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//CZECH LANGUAGE FILE
// (C) 2013 Stephen Lawrence Jr.
// (C) 2013-14 Stephen Lawrence Jr.
// Translated by: The Opice
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Úvodní import';
$lang['message_last_message'] = 'Poslední zpráva';
$lang['message_latest_version'] = 'Aktuální verze';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Je potřeba alespoň jedno oddělení';
$lang['message_no_author_comments_available'] = 'Poznámky nejsou dostupné';
$lang['message_no_description_available'] = 'Popis není dostupný';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/danish.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//DANISH LANGUAGE FILE
// (C) 2013 Stephen Lawrence Jr.
// (C) 2013-14 Stephen Lawrence Jr.
// Translated by: Lars J. Helbo
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -288,6 +288,7 @@
$lang['message_initial_import'] = 'Oprindelig import';
$lang['message_last_message'] = 'Sidste besked';
$lang['message_latest_version'] = 'Nyeste version';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Du skal mindst bruge en afdeling';
$lang['message_no_author_comments_available'] = 'Ingen forfatterkommentar tilgængelig';
$lang['message_no_description_available'] = 'Ingen beskrivelse tilgængelig';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/dutch.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//DUTCH LANGUAGE FILE
// (C) 2010-2013 Stephen Lawrence Jr.
// (C) 2010-2014 Stephen Lawrence Jr.
// Translated by: Jan Sepp
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Oorspronkelijk geïmporteerde versie';
$lang['message_last_message'] = 'Laatste melding';
$lang['message_latest_version'] = 'Jongste versie';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'U heeft minimaal een afdeling nodig';
$lang['message_no_author_comments_available'] = 'Geen commentaar van de auteur beschikbaar';
$lang['message_no_description_available'] = 'Geen beschrijving beschikbaar';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/english.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//ENGLISH LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: Stephen Lawrence Jr.
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Initial Import';
$lang['message_last_message'] = 'Last Message';
$lang['message_latest_version'] = 'Latest version';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'You need at least one department';
$lang['message_no_author_comments_available'] = 'No author comments available';
$lang['message_no_description_available'] = 'No description available';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/french.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//FRENCH LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: François Vallée, Peter Host
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Import Initial';
$lang['message_last_message'] = 'Dernier Message';
$lang['message_latest_version'] = 'Dernière version';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Il doit y avoir à minima Un département';
$lang['message_no_author_comments_available'] = 'Pas de commentaires de l\'auteur pour l\'instant';
$lang['message_no_description_available'] = 'Pas de Description disponible';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/german.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// GERMAN LANGUAGE FILE
// (C) 2012 Stephen Lawrence Jr.
// (C) 2012-14 Stephen Lawrence Jr.
// Translated by: Martin Waiss
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Erstimport';
$lang['message_last_message'] = 'Aktuelle Nachricht';
$lang['message_latest_version'] = 'Aktuelle Version';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Mindestens ein Bereich wird benötigt';
$lang['message_no_author_comments_available'] = 'Keine Autorenkommentare verfügbar';
$lang['message_no_description_available'] = 'Keine Beschreibung verfügbar';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/italian.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// ITALIAN LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: Mainieri Paolo; updated by Andrea Garelli (2013)
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Primo caricamento';
$lang['message_last_message'] = 'Ultimo messaggio';
$lang['message_latest_version'] = 'Ultima versione';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Hai bisogno di almeno un settore';
$lang['message_no_author_comments_available'] = 'Nessun commento presente';
$lang['message_no_description_available'] = 'Nessuna descrizione presente';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/portuguese.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//PORTUGUESE LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: Mahdy Mussa, Flávio Veras
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Importação Inicial';
$lang['message_last_message'] = 'Última Mensagem';
$lang['message_latest_version'] = 'Última versão';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Você necessita pelo menos um departamento';
$lang['message_no_author_comments_available'] = 'Nenhum autor de comentário disponível';
$lang['message_no_description_available'] = 'Nenhuma descrição disponível';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/romanian.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//ROMANIAN LANGUAGE FILE
// (C) 20010-2013 Stephen Lawrence Jr.
// (C) 20010-2014 Stephen Lawrence Jr.
// Translated by: Radu Toma
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -287,6 +287,7 @@
$lang['message_initial_import'] = 'Incarcarea initiala';
$lang['message_last_message'] = 'Ultimu mesaj';
$lang['message_latest_version'] = 'Ultima versiune';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Trebuie sa selectezi cel putin un Departament';
$lang['message_no_author_comments_available'] = 'Nu sunt comentarii disponibile';
$lang['message_no_description_available'] = 'Nu exista descriere disponibila';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/spanish.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//SPANISH LANGUAGE FILE
//(C) 2010-2013 Stephen Lawrence Jr.
//(C) 2010-2014 Stephen Lawrence Jr.
// Translators: Obed Alberto Castillo Reyes <[email protected]>, Ernesto Parra <[email protected]>
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -286,6 +286,7 @@
$lang['message_initial_import'] = 'Importaci&oacute;n Inicial';
$lang['message_last_message'] = '&Uacute;ltimo Mensaje:';
$lang['message_latest_version'] = 'Esta es la Versi&oacute;n mas Reciente';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'Usted requiere por lo menos un Area';
$lang['message_no_author_comments_available'] = 'El autor no gener&oacute; comentarios';
$lang['message_no_description_available'] = 'Descripci&oacute;n no disponible';
Expand Down
3 changes: 2 additions & 1 deletion includes/language/turkish.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
//Turkish LANGUAGE FILE
//(C) 2010-2012 Stephen Lawrence Jr.
//(C) 2010-2014 Stephen Lawrence Jr.
// Translator: "A. Murat Ergin" <[email protected]>
/*
This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -160,6 +160,7 @@
$lang['message_initial_import'] = "Ba&#351;lang&#305;&#231; i&#231;eri aktarmas&#305;";
$lang['message_last_message'] = "Son mesaj:";
$lang['message_latest_version'] = 'Latest version';
$lang['message_max_number_of_results'] = 'There are more results than allowed, please use the <a href="search.php">Search</a> page to narrow your results.';
$lang['message_need_one_department'] = 'You need at least one department';
$lang['message_no_author_comments_available'] = 'No author comments available';
$lang['message_no_description_available'] = "Tan&#305;mlama yok";
Expand Down
Loading

0 comments on commit 6f5f74e

Please sign in to comment.