1.10.x
Angel Fernando Quiroz Campos 11 years ago
commit 80f524718e
  1. 77
      main/inc/lib/document.lib.php

@ -612,7 +612,9 @@ class DocumentManager
$doc_list[] = $row; $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 // Templates management
$table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES); $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES);
$sql = "SELECT id FROM $table_template $sql = "SELECT id FROM $table_template
@ -731,7 +733,7 @@ class DocumentManager
} }
if ($can_see_invisible) { if ($can_see_invisible) {
//condition for the session // condition for the session
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$show_users_condition = ""; $show_users_condition = "";
@ -740,8 +742,9 @@ class DocumentManager
} }
if ($to_group_id <> 0) { 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 FROM $TABLE_ITEMPROPERTY AS last
INNER JOIN $TABLE_DOCUMENT AS docs
ON ( ON (
docs.id = last.ref AND docs.id = last.ref AND
last.tool = '" . TOOL_DOCUMENT . "' AND last.tool = '" . TOOL_DOCUMENT . "' AND
@ -752,10 +755,12 @@ class DocumentManager
docs.filetype = 'folder' AND docs.filetype = 'folder' AND
last.to_group_id = " . $to_group_id . " AND last.to_group_id = " . $to_group_id . " AND
docs.path NOT LIKE '%shared_folder%' AND docs.path NOT LIKE '%shared_folder%' AND
docs.path NOT LIKE '%_DELETED_%' AND
last.visibility <> 2 $condition_session "; last.visibility <> 2 $condition_session ";
} else { } else {
$sql = "SELECT DISTINCT docs.id, path $sql = "SELECT DISTINCT docs.id, path
FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs FROM $TABLE_ITEMPROPERTY AS last
INNER JOIN $TABLE_DOCUMENT AS docs
ON ( ON (
docs.id = last.ref AND docs.id = last.ref AND
last.tool = '" . TOOL_DOCUMENT . "' AND last.tool = '" . TOOL_DOCUMENT . "' AND
@ -764,6 +769,7 @@ class DocumentManager
) )
WHERE WHERE
docs.filetype = 'folder' AND docs.filetype = 'folder' AND
docs.path NOT LIKE '%_DELETED_%' AND
last.to_group_id = 0 AND last.to_group_id = 0 AND
last.visibility <> 2 last.visibility <> 2
$show_users_condition $condition_session "; $show_users_condition $condition_session ";
@ -914,7 +920,8 @@ class DocumentManager
// Check // Check
$sql = "SELECT td.id, readonly, tp.insert_user_id $sql = "SELECT td.id, readonly, tp.insert_user_id
FROM $TABLE_DOCUMENT td, $TABLE_PROPERTY tp 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 tp.c_id = $course_id AND
td.session_id = $sessionId AND td.session_id = $sessionId AND
tp.ref= td.id AND tp.ref= td.id AND
@ -1466,7 +1473,7 @@ class DocumentManager
* Unset a document as template * Unset a document as template
* *
* @param int $document_id * @param int $document_id
* @param string $couse_code * @param string $course_code
* @param int $user_id * @param int $user_id
*/ */
public static function unset_document_as_template($document_id, $course_code, $user_id) public static function unset_document_as_template($document_id, $course_code, $user_id)
@ -1491,7 +1498,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 string $document_path the relative complete path of the document
* @param array $course the _course array info of the document's course * @param array $course the _course array info of the document's course
@ -2264,21 +2272,21 @@ class DocumentManager
// then possible closing brackets if we were in the opening bracket case // then possible closing brackets if we were in the opening bracket case
// OR something like @import() // OR something like @import()
$res = preg_match_all( $res = preg_match_all(
'/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' . '/(((([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_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much
// '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name
'([ \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]+))' . -> doesn't restrict close enough to the url itself
'(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' . '(=([ \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]+)\))' . -> doesn't restrict close enough to the url itself
'(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' . '(\(([ \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]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities)
'(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/', '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/',
$attrString, $attrString,
$regs $regs
); );
} catch (Exception $e) { } catch (Exception $e) {
error_log('Caught exception: ' . $e->getMessage(), 0); error_log('Caught exception: ' . $e->getMessage(), 0);
@ -2947,12 +2955,12 @@ class DocumentManager
$visual_other_percentage = 4 * $other_percentage; $visual_other_percentage = 4 * $other_percentage;
$message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' . $message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' .
get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />'; get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />';
$show_percentage = '&nbsp;' . $percentage . '%'; $show_percentage = '&nbsp;' . $percentage . '%';
$message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' . $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' .
'<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>' . '<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>' .
'<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>'; '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>';
echo $message; echo $message;
} }
@ -4059,10 +4067,10 @@ class DocumentManager
$formatTypes = array('text', 'spreadsheet', 'presentation', 'drawing'); $formatTypes = array('text', 'spreadsheet', 'presentation', 'drawing');
foreach ($formatTypes as $formatType) { foreach ($formatTypes as $formatType) {
if ( if (
in_array( in_array(
$extension, $extension,
self::getJodconverterExtensionList($mode, $formatType) self::getJodconverterExtensionList($mode, $formatType)
) )
) { ) {
$formatTypesList[] = $formatType; $formatTypesList[] = $formatType;
} }
@ -4213,10 +4221,10 @@ class DocumentManager
{ {
$nanoGongJarFile = api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar'; $nanoGongJarFile = api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar';
$html = '<applet id="applet" archive="'.$nanoGongJarFile.'" code="gong.NanoGong" width="160" height="95">'; $html = '<applet id="applet" archive="'.$nanoGongJarFile.'" code="gong.NanoGong" width="160" height="95">';
$html .= '<param name="SoundFileURL" value="'.$file.'" />'; $html .= '<param name="SoundFileURL" value="'.$file.'" />';
$html .= '<param name="ShowSaveButton" value="false" />'; $html .= '<param name="ShowSaveButton" value="false" />';
$html .= '<param name="ShowTime" value="true" />'; $html .= '<param name="ShowTime" value="true" />';
$html .= '<param name="ShowRecordButton" value="false" />'; $html .= '<param name="ShowRecordButton" value="false" />';
$html .= '</applet>'; $html .= '</applet>';
return $html; return $html;
} }
@ -4668,6 +4676,7 @@ class DocumentManager
(path = '".$folder."' OR path = '$folderWithSuffix') AND (path = '".$folder."' OR path = '$folderWithSuffix') AND
(session_id = 0 OR session_id = $sessionId) (session_id = 0 OR session_id = $sessionId)
"; ";
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::num_rows($rs)) { if (Database::num_rows($rs)) {
return true; return true;

Loading…
Cancel
Save