From f48d06bce9f3e9e7e557e407fb31f8f5a0024b2f Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 2 Dec 2014 15:48:34 +0100 Subject: [PATCH] Minor - format code. --- main/inc/lib/document.lib.php | 67 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index f027366f67..11ffdd259d 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -612,7 +612,9 @@ class DocumentManager $doc_list[] = $row; } - if ($row['filetype'] == 'file' && pathinfo($row['path'], PATHINFO_EXTENSION) == 'html') { + if ($row['filetype'] == 'file' && + pathinfo($row['path'], PATHINFO_EXTENSION) == 'html' + ) { // Templates management $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES); $sql = "SELECT id FROM $table_template @@ -740,7 +742,7 @@ class DocumentManager } if ($to_group_id <> 0) { - $sql = "SELECT DISTINCT docs.id, path + $sql = "SELECT DISTINCT docs.id, path FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs ON ( docs.id = last.ref AND @@ -914,7 +916,8 @@ class DocumentManager // Check $sql = "SELECT td.id, readonly, tp.insert_user_id FROM $TABLE_DOCUMENT td, $TABLE_PROPERTY tp - WHERE td.c_id = $course_id AND + WHERE + td.c_id = $course_id AND tp.c_id = $course_id AND td.session_id = $sessionId AND tp.ref= td.id AND @@ -1466,7 +1469,7 @@ class DocumentManager * Unset a document as template * * @param int $document_id - * @param string $couse_code + * @param string $course_code * @param int $user_id */ public static function unset_document_as_template($document_id, $course_code, $user_id) @@ -1491,7 +1494,8 @@ class DocumentManager } /** - * Return true if the documentpath have visibility=1 as item_property (you should use the is_visible_by_id) + * Return true if the documentpath have visibility=1 as + * item_property (you should use the is_visible_by_id) * * @param string $document_path the relative complete path of the document * @param array $course the _course array info of the document's course @@ -2264,21 +2268,21 @@ class DocumentManager // then possible closing brackets if we were in the opening bracket case // OR something like @import() $res = preg_match_all( - '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' . - // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much - // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name - '([ \n\t\r]+)?(' . - // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself - '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' . - '|' . - // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself - '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' . - '))' . - '|' . - // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities) - '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/', - $attrString, - $regs + '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' . + // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much + // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name + '([ \n\t\r]+)?(' . + // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself + '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' . + '|' . + // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself + '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' . + '))' . + '|' . + // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities) + '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/', + $attrString, + $regs ); } catch (Exception $e) { error_log('Caught exception: ' . $e->getMessage(), 0); @@ -2947,12 +2951,12 @@ class DocumentManager $visual_other_percentage = 4 * $other_percentage; $message .= get_lang('PercentageQuotaInUse') . ': ' . $percentage . '%.
' . - get_lang('PercentageQuotaFree') . ': ' . $other_percentage . '%.
'; + get_lang('PercentageQuotaFree') . ': ' . $other_percentage . '%.
'; $show_percentage = ' ' . $percentage . '%'; $message .= '
' . - '
 
' . - '' . $show_percentage . '
'; + '
 
' . + '' . $show_percentage . ''; echo $message; } @@ -4059,10 +4063,10 @@ class DocumentManager $formatTypes = array('text', 'spreadsheet', 'presentation', 'drawing'); foreach ($formatTypes as $formatType) { if ( - in_array( - $extension, - self::getJodconverterExtensionList($mode, $formatType) - ) + in_array( + $extension, + self::getJodconverterExtensionList($mode, $formatType) + ) ) { $formatTypesList[] = $formatType; } @@ -4213,10 +4217,10 @@ class DocumentManager { $nanoGongJarFile = api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar'; $html = ''; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; $html .= ''; return $html; } @@ -4668,6 +4672,7 @@ class DocumentManager (path = '".$folder."' OR path = '$folderWithSuffix') AND (session_id = 0 OR session_id = $sessionId) "; + $rs = Database::query($sql); if (Database::num_rows($rs)) { return true;