function show_personal_media(&$out, &$lang) { if (!canAccessPersonalMedia()) { die("You can't access!"); } require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.mimetype.php'; require_once _base_ . '/lib/lib.multimedia.php'; $url = getPopupBaseUrl(); $tab = new Table(); $user_id = (int) Docebo::user()->getIdSt(); //if(Get::sett('hteditor') == 'tinymce') { $GLOBALS['page']->add('' . '<script type="text/javascript" type="text/javascript" src="' . Get::rel_path('base') . '/addons/tiny_mce/tiny_mce_popup.js"></script>', 'page_head'); $GLOBALS['page']->add('<script type="text/javascript">' . 'var FileBrowserDialogue = { init : function () { // Here goes your code for setting your custom things onLoad. var allLinks = document.getElementsByTagName("link"); allLinks[allLinks.length-1].parentNode.removeChild(allLinks[allLinks.length-1]); }, mySubmit : function (url) { var URL = url; var win = tinyMCEPopup.getWindowArg("window"); // insert information now win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = URL; // for image browsers: update image dimensions if(win.ImageDialog) { if (win.ImageDialog.getImageData) win.ImageDialog.getImageData(); if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(URL); } // close popup window tinyMCEPopup.close(); } } tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue); ' . '</script>', 'page_head'); //} $head = array($lang->def("_PREVIEW"), $lang->def("_TYPE"), $lang->def("_FILENAME")); $head[] = "<img src=\"" . getPathImage() . "standard/download.png\" alt=\"" . $lang->def("_ATTACHMENT") . "\" title=\"" . $lang->def("_ATTACHMENT") . "\" />"; $head[] = "<img src=\"" . getPathImage() . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . "\" />"; $head_type = array('preview80', 'image', '', 'image', 'image'); $tab->setColsStyle($head_type); $tab->addHead($head); $path = (strlen(dirname($_SERVER['PHP_SELF'])) != 1 ? dirname($_SERVER['PHP_SELF']) : '') . '/'; $path .= $GLOBALS["where_files_relative"]; $site_url = "http://" . $_SERVER['HTTP_HOST'] . $path . '/common/users/'; $qtxt = "\r\n\tSELECT *\r\n\tFROM " . $GLOBALS["prefix_fw"] . "_user_file\r\n\tWHERE user_idst='" . $user_id . "'"; $q = sql_query($qtxt); if ($q && mysql_num_rows($q) > 0) { while ($row = mysql_fetch_array($q)) { $rowcnt = array(); if (!empty($row["media_url"])) { $rowcnt[] = " "; } else { $file = _USER_FPATH . rawurlencode($row["real_fname"]); $rowcnt[] = "<div style=\"text-align: center;\">" . '<a href="#" onclick="javascript:window.open(\'' . $file . '\',\'\');return false;">' . "<img height=\"120\" src=\"" . $file . "\" alt=\"" . $row["fname"] . "\" title=\"" . $row["fname"] . "\" /></a></div>"; } $img = "<img src=\"" . getPathImage('fw') . mimeDetect($file) . "\" alt=\"" . $row["fname"] . "\" title=\" "; $img .= $row["fname"] . "\" />\n"; $rowcnt[] = $img; $rowcnt[] = $row["fname"]; if (!empty($row["media_url"])) { $type = getMediaType($row["media_url"]); } else { $type = getMediaType($row["fname"]); } $sel_url = $url . "&op=select&from=personal&type=" . $type . "&item_id=" . $row["id"]; $img = "<img src=\"" . getPathImage() . "standard/download.png\" alt=\"" . $lang->def("_ATTACHMENT") . "\" title=\"" . $lang->def("_ATTACHMENT") . "\" />\n"; $rowcnt[] = '<a href="' . $sel_url . '" ' . (Get::sett('hteditor') == 'tinymce' ? 'onclick="FileBrowserDialogue.mySubmit(\'' . $site_url . $row["real_fname"] . '\'); return false;"' : '') . '>' . $img . "</a>\n"; $img = "<img src=\"" . getPathImage('fw') . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . "\" />\n"; $rowcnt[] = "<a href=\"" . $url . "&op=delpersonal&item_id=" . $row["id"] . "\">" . $img . "</a>\n"; $tab->addBody($rowcnt); } } $url = getPopupBaseUrl() . "&op=addpersonal"; $tab->addActionAdd("<a href=\"" . $url . "\">" . $lang->def("_ADD") . "</a>"); if (isset($_GET['result'])) { switch ($_GET['result']) { case "invalid_ext": $GLOBALS['page']->add(getErrorUi($lang->def('_INVALID_EXTENSION'))); break; case "upload_err": $GLOBALS['page']->add(getErrorUi($lang->def('_ERROR_UPLOAD'))); break; case "upload_ok": $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL'))); break; } } $GLOBALS['page']->add($tab->getTable()); }
/** * @param string $label_name * @param string $id * @param string $name * @param string $value * @param string $filename * @param string $show_current * @param string $show_del_checkbox * @param string $add_old_info * @param string $old_prefix * @param string $del_arr_name * @param string $alt_name * @param string $other_after * @param string $other_before */ public static function getExtendedFileField($label_name, $id, $name, $value = FALSE, $filename = FALSE, $show_current = TRUE, $show_del_checkbox = TRUE, $add_old_info = TRUE, $old_prefix = FALSE, $del_arr_name = FALSE, $alt_name = '', $other_after = '', $other_before = '') { $res = ""; $res .= '<div class="form_extended_file_field">'; $res .= Form::getFilefield($label_name, $id, $name, $value, $alt_name, $other_after, $other_before); if ($show_current) { if ($value !== FALSE && !empty($value)) { if ($filename === FALSE) { if (substr_count($value, "_") >= 3) { $break_apart = explode('_', $value); $break_apart[0] = $break_apart[1] = $break_apart[2] = ''; $filename = substr(implode('_', $break_apart), 3); } else { $filename = $value; } } require_once _base_ . '/lib/lib.mimetype.php'; $ext = strtolower(end(explode(".", $filename))); $img = "<img src=\"" . getPathImage('fw') . mimeDetect($filename) . "\" "; $img .= "alt=\"" . $ext . "\" title=\"" . $ext . "\" />"; if ($show_del_checkbox) { $del_arr_name = $del_arr_name !== FALSE ? $del_arr_name : "file_to_del"; $check_id = $del_arr_name . "_" . $id; $check_name = $del_arr_name . "[" . $id . "]"; $checkbox = Form::getInputCheckbox($check_id, $check_name, $value, FALSE, "") . " "; $checkbox .= Form::getLabel($check_id, Lang::t("_DELETE_FILE", "standard", "framework"), "nofloat"); $res .= Form::getLineBox($img . " " . $filename, $checkbox); } else { $res .= Form::openFormLine(); $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . $img . " " . $filename; $res .= Form::closeFormLine(); } } else { $res .= Form::openFormLine(); $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . Lang::t("_NONE", "standard", "framework"); $res .= Form::closeFormLine(); } } if ($add_old_info) { $old_prefix = $old_prefix !== FALSE ? $old_prefix : "old"; $res .= "\n"; $res .= Form::getHidden($old_prefix . "_" . $id, $old_prefix . "_" . $name, $value); } $res .= "</div>\n"; return $res; }
function forumsearchmessage() { checkPerm('view'); $search_arg = $_SESSION['forum']['search_arg']; require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('forum', 'lms'); $id_thread = importVar('idThread', true, 0); $ini_thread = importVar('ini_thread'); $sema_perm = checkPerm('sema', true); $moderate = checkPerm('moderate', true); $mod_perm = checkPerm('mod', true); $acl_man =& Docebo::user()->getAclManager(); $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE')); $tb->initNavBar('ini', 'link'); $tb->setLink('index.php?modname=forum&op=searchmessage&idThread=' . $id_thread . '&ini_thread=' . $ini_thread); $ini = $tb->getSelectedElement(); $ini_page = $tb->getSelectedPage(); // Some info about forum and thread $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'"; list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t) = sql_fetch_row(sql_query($thread_query)); $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'"; list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query)); ++$tot_message; //set as readed if needed if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) { unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]); } if ($ini == 0 && !isset($_GET['result'])) { sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'"); } $page_title = array('index.php?modname=forum&op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&op=search&ini=' . $ini_thread => $thread_title, $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg); if ($erased_t && !$mod_perm && !$moderate) { $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content'); return; } // Who have semantic evaluation $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema"); while (list($msg_sema) = sql_fetch_row($re_sema)) { $forum_sema[$msg_sema] = 1; } // Find post $messages = array(); $authors = array(); $authors_names = array(); $authors_info = array(); $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem')); while ($record = mysql_fetch_assoc($re_message)) { $messages[$record['idMessage']] = $record; $authors[$record['author']] = $record['author']; if ($record['modified_by'] != 0) { $authors[$record['modified_by']] = $record['modified_by']; } } $authors_names =& $acl_man->getUsers($authors); $level_name = CourseLevel::getLevels(); // Retriving level and number of post of th authors $re_num_post = sql_query("\r\n\tSELECT u.idUser, u.level, COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\tGROUP BY u.idUser, u.level"); while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) { $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]); } $type_h = array('forum_sender', 'forum_text'); $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); // Compose messagges display $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto'); while (list($id_message, $message_info) = each($messages)) { // sender info $m_author = $message_info['author']; if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') { $img_size = @getimagesize($path . $authors_names[$m_author][ACL_INFO_AVATAR]); } $sender = '<div class="forum_author">' . (isset($authors_names[$m_author]) ? $authors_names[$m_author][ACL_INFO_LASTNAME] . $authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) : $authors_names[$m_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$m_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</div>' . '<div class="forum_level">' . $lang->def('_LEVEL') . ' : ' . $authors_info[$m_author]['level'] . '</div>' . (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_names[$m_author][ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" />' : '') . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<img src="' . getPathImage() . 'standard/identity.png" alt=">" /> ' . '<a href="index.php?modname=forum&op=viewprofile&idMessage=' . $id_message . '&ini=' . $ini_page . '&idThread=' . $id_thread . '">' . $lang->def('_VIEW_PROFILE') . '</a>'; // msg info $msgtext = ''; $msgtext .= '<div class="forum_post_posted">' . $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>'; if ($message_info['locked']) { $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>'; } else { if ($message_info['attach'] != '') { $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&op=download&id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>'; } $textof = str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof'])); $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $message_info['title']) : $message_info['title']) . '</div>'; $msgtext .= '<div class="forum_post_text">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $textof) : $textof) . '</div>'; if ($message_info['modified_by'] != 0) { $modify_by = $message_info['modified_by']; $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$modify_by]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>'; } if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') { $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>'; } } $content = array($sender, $msgtext); $tb->addBody($content); // some action that you can do with this message $action = ''; if ($moderate || $mod_perm) { if ($message_info['locked']) { $action .= '<a href="index.php?modname=forum&op=moderatemessage&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> '; } else { $action .= '<a href="index.php?modname=forum&op=moderatemessage&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> '; } } if (!$locked_t && !$locked_f || $mod_perm || $moderate) { $action .= '<a href="index.php?modname=forum&op=addmessage&idThread=' . $id_thread . '&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>'; } if ($moderate || $mod_perm || $m_author == getLogUserId()) { $action .= '<a href="index.php?modname=forum&op=modmessage&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&op=delmessage&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> '; } $tb->addBodyExpanded($action, 'forum_action'); } if (!$locked_t && !$locked_f || $mod_perm || $moderate) { $tb->addActionAdd('<a href="index.php?modname=forum&op=addmessage&idThread=' . $id_thread . '&ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_REPLY') . '</a>'); } $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&op=search&idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content'); if ($moderate || $mod_perm) { $GLOBALS['page']->add('<div class="forum_action_top">' . '<a href="index.php?modname=forum&op=modstatusthread&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&op=changeerased&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content'); } $GLOBALS['page']->add($tb->getTable(), 'content'); if ($moderate || $mod_perm) { $GLOBALS['page']->add('<div class="forum_action_bottom">' . '<a href="index.php?modname=forum&op=modstatusthread&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&op=changeerased&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content'); } $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content'); }
function getViewUserFiles() { require_once _base_ . '/lib/lib.navbar.php'; $viewer = $this->getViewer(); $type = Get::req('type', DOTY_MIXED, ''); $this->loadUserData($viewer); // main container --------------------------------------------------------------------- $html = '<h1>' . $this->_lang->def('_PROFILE') . ': ' . $this->resolveUsername() . '</h1>'; $html .= '<div id="up_user_info" class="up_user_info">'; $html .= $this->getUserRelatedAction($type); require_once $GLOBALS['where_framework'] . '/lib/lib.myfiles.php'; $user_file = new MyFilesPolicy($this->_user_profile->getIdUser(), $this->getViewer(), $this->_up_data_man->isFriend($this->_user_profile->getIdUser(), $this->getViewer()), $this->_up_data_man->isTeacher($this->getViewer())); $num_files = $user_file->getFileCount($type); $nav_bar = new NavBar('ini', UP_FILE_LIMIT, $num_files, 'link'); $ini = $nav_bar->getSelectedElement(); $nav_bar->setLink($this->_url_man->getUrl($this->_varname_action . '=view_files&type=' . $type . '')); $re_files = $user_file->getFileList($type, false, $ini, UP_FILE_LIMIT); switch ($type) { case "image": $html .= '<h2 class="up_type1">' . $this->_lang->def('_IMAGES') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">'; if ($re_files && $num_files > 0) { $html .= '<ul class="image_list">'; while ($image = $user_file->fetch_row($re_files)) { $size = @getimagesize($GLOBALS['where_files_relative'] . $user_file->getFileAddress($image[MYFILE_FILE_NAME])); $class_limit = ''; if ($size[0] > 200 && $size[0] > $size[1]) { $class_limit = 'image_limit_width'; } if ($size[1] > 200 && $size[0] < $size[1]) { $class_limit = 'image_limit_height'; } $html .= '<li>' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $image[MYFILE_ID_FILE]) . '">' . '<img class="user_image ' . $class_limit . '" src="' . $GLOBALS['where_files_relative'] . $user_file->getFileAddress($image[MYFILE_FILE_NAME]) . '" ' . 'title="' . strip_tags($image[MYFILE_DESCRIPTION]) . '" alt="' . strip_tags($image[MYFILE_TITLE]) . '" />' . '<br/>' . $image[MYFILE_TITLE] . '</a>' . '</li>'; } $html .= '</ul>'; } else { $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>'; } $html .= '<div class="nofloat"></div>' . '</div>'; break; case "video": $html .= '<h2 class="up_type1">' . $this->_lang->def('_USER_VIDEOS') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">'; if ($re_files && $num_files > 0) { require_once _base_ . '/lib/lib.multimedia.php'; $html .= '<ul class="video_list">'; while ($video = $user_file->fetch_row($re_files)) { $play_code = getEmbedPlay($GLOBALS['where_files_relative'] . $user_file->getFilePath(), $video[MYFILE_FILE_NAME], false, '250', false, false); $class_limit = ''; $html .= '<li>' . ($play_code === false ? implode('_', array_slice(explode('_', $video[MYFILE_FILE_NAME]), 3)) : $play_code) . '<br />' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $video[MYFILE_ID_FILE]) . '">' . $video[MYFILE_TITLE] . ($play_code === false ? ' (' . $this->_lang->def('_DOWNLOAD') . ')' : '') . '</a>' . '</li>'; } $html .= '</ul>'; } else { $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>'; } $html .= '<div class="nofloat"></div>' . '</div>'; break; case "audio": $html .= '<h2 class="up_type1">' . $this->_lang->def('_USER_AUDIO') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">'; if ($re_files && $num_files > 0) { require_once _base_ . '/lib/lib.multimedia.php'; $html .= '<ul class="video_list">'; while ($audio = $user_file->fetch_row($re_files)) { $play_code = getEmbedPlay($GLOBALS['where_files_relative'] . $user_file->getFilePath(), $audio[MYFILE_FILE_NAME], false, '250', false, false); $class_limit = ''; $html .= '<li>' . ($play_code === false ? implode('_', array_slice(explode('_', $audio[MYFILE_FILE_NAME]), 3)) : $play_code) . '<br />' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $audio[MYFILE_ID_FILE]) . '">' . $audio[MYFILE_TITLE] . ($play_code === false ? ' (' . $this->_lang->def('_DOWNLOAD') . ')' : '') . '</a>' . '</li>'; } $html .= '</ul>'; } else { $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>'; } $html .= '<div class="nofloat"></div>' . '</div>'; break; case "other": $html .= '<h2 class="up_type1">' . $this->_lang->def('_USER_OTHER') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">'; if ($re_files && $num_files > 0) { require_once _base_ . '/lib/lib.multimedia.php'; $html .= '<ul class="other_list">'; while ($other = $user_file->fetch_row($re_files)) { $class_limit = ''; $html .= '<li>' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $other[MYFILE_ID_FILE]) . '">' . '<img src="' . getPathImage('fw') . mimeDetect($user_file->getFilePath() . $other[MYFILE_FILE_NAME]) . '" alt="myme-type" />' . $other[MYFILE_TITLE] . '</a>' . '<br/>' . $other[MYFILE_DESCRIPTION] . '</li>'; } $html .= '</ul>'; } else { $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>'; } $html .= '<div class="nofloat"></div>' . '</div>'; break; } $html .= $nav_bar->getNavBar($ini); $html .= '</div>'; return $html; }
/** * display the field for interaction * * @param int $id_user if alredy exists a entry for the user load as default value * @param bool $freeze if true, disable the user interaction * * @return string of field xhtml code * * @access public */ function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL) { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.mimetype.php'; list($user_entry) = sql_fetch_row(sql_query("\r\n\t\tSELECT user_entry\r\n\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\tWHERE id_user = '******' AND\r\n\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\tid_common_son = '0'")); $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE lang_code = '" . getLanguage() . "' AND id_common = '" . (int) $this->id_common . "' AND type_field = '" . $this->getFieldType() . "'"); list($translation) = sql_fetch_row($re_field); if ($user_entry != '') { $entry_link = '<a href="' . Get::rel_path('adm') . '/index.php?modname=field&op=manage&fo=special&type_field=' . $this->getFieldType() . '&id_user='******'&id_common=' . $this->id_common . '">' . '<img src="' . getPathImage() . mimeDetect($user_entry) . '" alt="' . Lang::t('_MIME_TYPE') . '" />' . ' ' . Lang::t('_DOWNLOAD') . '</a> <a id="4upLLoad" href="javascript:void();" onclick="document.getElementById(\'upLLoad\').style.display = \'inline\';document.getElementById(\'4upLLoad\').style.display=\'none\'">' . Lang::t('_MOD', 'standard', 'framework') . '</a>'; } else { $entry_link = Lang::t('_NO_FILE_UPLOADED', 'field', 'framework') . ' <a id="4upLLoad" href="javascript:void();" onclick="document.getElementById(\'upLLoad\').style.display = \'inline\';document.getElementById(\'4upLLoad\').style.display=\'none\'">' . Lang::t('_MODIFY', 'field', 'framework') . '</a>'; } if ($value !== NULL) { $user_entry = $value; } if ($freeze) { return Form::getLineBox($translation . ' : ', $entry_link); } return Form::getFilefield($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', '', $translation, '', '', $entry_link); }
function remfiles() { checkPerm('mod'); $lang =& DoceboLanguage::createInstance('course'); require_once _base_ . '/lib/lib.upload.php'; if (isset($_GET['confirm']) && $_GET['confirm'] == '1') { list($old_file) = sql_fetch_row(sql_query("\r\n\t\tSELECT path \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_course_file \r\n\t\tWHERE id_course='" . $_SESSION['idCourse'] . "' AND id_file='" . (int) $_GET['id_file'] . "'")); $size = Get::file_size($GLOBALS['where_files_relative'] . _PATH_COURSE . $old_file); if (!sl_unlink(_PATH_COURSE . $old_file)) { $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE'))); return; } $GLOBALS['course_descriptor']->subFileToUsedSpace(false, $size); if (!sql_query("\r\n\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_course_file \r\n\t\tWHERE id_course = '" . (int) $_SESSION['idCourse'] . "' AND id_file = '" . (int) $_GET['id_file'] . "'")) { $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE'))); return; } Util::jump_to('index.php?modname=course&op=infocourse'); } else { list($title, $file) = sql_fetch_row(sql_query("\r\n\t\tSELECT title, path \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_course_file \r\n\t\tWHERE id_course = '" . (int) $_SESSION['idCourse'] . "' AND id_file = '" . (int) $_GET['id_file'] . "'")); //request erase confirm $GLOBALS['page']->add(getTitleArea(array('index.php?modname=course&op=infocourse' => $lang->def('_INFO'), $lang->def('_DEL')), 'infocourse') . '<div class="std_block">' . getDeleteUi($lang->def('_AREYOUSURE'), '<img src="' . getPathImage('fw') . mimeDetect($file) . '" alt="mime-type" /> ' . $title, true, 'index.php?modname=course&op=remfiles&id_file=' . (int) $_GET['id_file'] . '&confirm=1', 'index.php?modname=course&op=infocourse') . '</div>', 'content'); } }
function show_files($id, $row, $modimg) { $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $lang =& DoceboLanguage::createInstance('project', "lms"); $out->add('<div class="inline_block">' . "\n" . '<h2 class="heading">' . $lang->def("_PRJFILES") . '</h2>' . '<div class="content">'); $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_files WHERE pid='{$id}' ORDER BY ftitle;"); if ($query && mysql_num_rows($query) > 0) { $out->add('<table width="100%">' . "\n"); while ($data = mysql_fetch_array($query)) { $fname = $data["fname"]; $img = '<img src="' . getPathImage('fw') . mimeDetect(_FPATH . $fname) . '" alt="myme-type" />'; $readlink = $modlink = $dellink = ''; $readlink = "<a href=\"index.php?modname=project&op=prjreaditem&type=file&id={$id}&itemid=" . $data["id"] . "\">" . $data["ftitle"] . "</a>"; $out->add('<tr><td class="image">' . "\n" . '<a href="index.php?modname=project&op=download&type=file&id=' . $data['id'] . '">' . $img . '</a>' . '</td><td>' . "\n" . $readlink); if (!empty($data["fver"])) { $out->add(" " . $lang->def("_VERSION") . " " . $data["fver"]); } $out->add("</td>" . "\n"); if (is_owner(Docebo::user()->getIdSt(), $id) || is_admin(Docebo::user()->getIdSt(), $id)) { $modlink = "<a href=\"index.php?modname=project&op=prjedititem&type=file&id={$id}&itemid=" . $data["id"] . "\"><img src=\"" . getPathImage() . "standard/edit.png\" alt=\"" . $lang->def("_MOD") . "\" /></a>"; $dellink = "<a href=\"index.php?modname=project&op=prjdelitem&type=file&id={$id}&itemid=" . $data["id"] . "\"><img src=\"" . getPathImage() . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" /></a>"; } $out->add('<td class="image">' . $modlink . '</td><td class="image">' . $dellink . '</td>' . "\n"); $out->add("</tr>\n"); } $out->add("</table>\n"); } else { $out->add(Lang::t('_NO_DATA', 'standard')); } $out->add('</div>'); if (is_owner(Docebo::user()->getIdSt(), $id) || is_admin(Docebo::user()->getIdSt(), $id)) { $out->add('<div class="actions">' . '<a href="index.php?modname=project&op=prjadditem&type=file&id=' . $id . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def("_NEW") . '" /> ' . $lang->def("_NEW") . '</a>' . '</div>' . "\n"); } $out->add('</div>'); }
function message($tk, $perm, $url, $pb) { if (!$perm["can_read"]) { die("You can't access!"); } require_once _base_ . '/lib/lib.mimetype.php'; require_once _base_ . '/lib/lib.table.php'; $ini = importVar('ini', true, 0); $acl_man =& Docebo::user()->getAclManager(); $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto'); $mod_perm = $perm["can_moderate"]; $read_perm = $perm["can_read"]; $write_perm = $perm["can_write"]; $upload_perm = $perm["can_upload"]; $res = ""; if ((int) $pb != 0) { $pbtxt = "&pb={$pb}"; } else { $pbtxt = ""; } // find message $qtxt = "\r\n\t\tSELECT idMessage, author, posted, title, textof, attach, locked\r\n\t\tFROM " . $this->prefix . "_sysforum AS t1\r\n\t\tWHERE " . get_sql_tk_str($tk, "t1") . "\r\n\t\tORDER BY posted"; $reMessage = sql_query($qtxt); // find info about authors $reNumPost = sql_query("\r\n\t\tSELECT author, COUNT(*)\r\n\t\tFROM " . $this->prefix . "_sysforum\r\n\t\tWHERE author <> '1'\r\n\t\tGROUP BY author"); $authors = array(); while (list($id_a, $num_post_a) = sql_fetch_row($reNumPost)) { $authors[$id_a] = $id_a; $user_post[$id_a] = $num_post_a; } $authors_info =& $acl_man->getUsers($authors); $tab = new Table(0); $contentH = array($this->lang->def("_AUTHOR"), $this->lang->def("_TEXTOF")); $typeH = array('forum_sender', 'forum_text'); $tab->setColsStyle($typeH); $tab->addHead($contentH); while (list($idM, $author, $posted, $title, $textof, $attach, $locked_m) = sql_fetch_row($reMessage)) { // message author if (isset($authors_info[$author]) && $authors_info[$author][ACL_INFO_AVATAR] != '') { $img_size = @getimagesize($path . $authors_info[$author][ACL_INFO_AVATAR]); } $who = '<div class="forum_author">' . (isset($authors_info[$author]) ? $this->getAuthorName($acl_man->relativeId($authors_info[$author][ACL_INFO_USERID]), $authors_info[$author][ACL_INFO_FIRSTNAME], $authors_info[$author][ACL_INFO_LASTNAME]) : Lang::t('_UNKNOWN_AUTHOR', 'sysforum')) . '</div>' . ($authors_info[$author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_info[$author][ACL_INFO_AVATAR] . '" alt="' . $this->lang->def('_AVATAR') . '" />' : ''); /*.'<div class="forum_numpost">'.$this->lang->def('_NUMPOST').' : ' .( isset($user_post[$author]) ? $user_post[$author] : 0 ) .'</div>';*/ // message text------------------------------------------------ $posted_datetime = Format::date($posted); $posted_time = time(); //$GLOBALS["regset"]->ddate->getTimeStamp(); $mess = ''; $mess .= '<div class="forum_post_posted">' . $this->lang->def("_DATE") . ' : ' . $posted_datetime . ' ' . $this->loadDistance($posted_time) . '</div>'; if ($attach) { $mess .= '<div class="forum_post_attach">' . '<a href="' . $url . '&sf_op=download&sf_fileid=' . $idM . $this->getUrlExtra() . '">' . $this->lang->def("_ATTACHMENT") . ' : ' . '<img src="' . getPathImage('fw') . mimeDetect($attach) . '" alt="' . $this->lang->def("_ATTACHMENT") . '" /></a>' . '</div>'; } if (!$locked_m) { $mess .= '<div class="forum_post_title">' . $this->lang->def("_SUBJECT") . ' : ' . $title . '</div>' . '<div class="forum_post_text">' . $textof . '</div>'; if (isset($authors_info[$author]) && $authors_info[$author][ACL_INFO_SIGNATURE] != '') { $mess .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_info[$author][ACL_INFO_SIGNATURE] . '</div>'; } } else { $mess .= '<div class="forum_post_locked">' . $this->lang->def("_LOCKEDMESS") . '</div>'; } // action------------------------------------------------------- $action = "\n" . '<div class="forumAction"> '; if ($mod_perm) { $action .= '<a href="' . $url . '&sf_op=lockmessage' . $pbtxt . '&idMessage=' . $idM . $this->getUrlExtra() . '">'; if ($locked_m) { $action .= '<img src="' . getPathImage() . 'forum/demoderate.gif" alt="' . $this->lang->def("_FREEMESS") . '" />'; } else { $action .= '<img src="' . getPathImage() . 'forum/moderate.gif" alt="' . $this->lang->def("_LOCKMESS") . '" />'; } $action .= '</a>'; } if ($author == Docebo::user()->getIdSt() && ($write_perm || $mod_perm) && !$locked_m && $author != "1") { $action .= ' <a href="' . $url . '&sf_op=modmessage' . $pbtxt . '&idMessage=' . $idM . $this->getUrlExtra() . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $this->lang->def("_MOD") . '" title="' . $this->lang->def("_MOD") . '" /></a>'; } $action .= '</div>'; $tab->addBody(array($who, $mess)); $tab->addBody(array('', $action)); } $action_row = ''; if (!$locked_m && $write_perm || $mod_perm) { $url_add = $url . '&sf_op=addmessage' . $pbtxt . $this->getUrlExtra(); $this->out->add($tab->addActionAdd('<div class="forumAdd"><a href="' . $url_add . '"> <img src="' . getPathImage() . 'standard/add.png" title="' . $this->lang->def("_ADDMESSAGE") . '" alt="' . $this->lang->def("_ADDMESSAGE") . '" /> ' . $this->lang->def("_ADDMESSAGE") . '</a></div>')); } $res .= $tab->getTable(); return $res; }
function readmessage() { //checkPerm('view'); $out = $GLOBALS['page']; $out->setWorkingZone('content'); $um =& UrlManager::getInstance("message"); $acl_man =& Docebo::user()->getAclManager(); $from = importVar('out'); // check the viewer rights $re_viewer = $this->db->query("\r\n\t\tSELECT *\r\n\t\tFROM %adm_message_user\r\n\t\tWHERE idMessage = '" . $_GET['id_message'] . "' AND idUser = '******' "); if (!$this->db->num_rows($re_viewer)) { self::message(); return; } $re_user = $this->db->query("\r\n\t\tUPDATE %adm_message_user AS user\r\n\t\tSET user.read = '" . _MESSAGE_READED . "'\r\n\t\tWHERE user.idMessage = '" . $_GET['id_message'] . "' AND user.idUser = '******' AND user.read = '" . _MESSAGE_UNREADED . "' "); list($sender, $posted, $title, $textof, $attach, $priority) = $this->db->fetch_row($this->db->query("\r\n\t\tSELECT sender, posted, title, textof, attach, priority\r\n\t\tFROM %adm_message\r\n\t\tWHERE idMessage = '" . $_GET['id_message'] . "'")); $sender_info = $acl_man->getUser($sender, false); $author = $sender_info[ACL_INFO_LASTNAME] . $sender_info[ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($sender_info[ACL_INFO_USERID]) : $sender_info[ACL_INFO_LASTNAME] . ' ' . $sender_info[ACL_INFO_FIRSTNAME]; $title_url = $this->mvc_urls ? "index.php?r=message/show" . ($from == 'out' ? '&active_tab=outbox' : '') : $um->getUrl($from == 'out' ? '&active_tab=outbox' : ''); $page_title = array($title_url => Lang::t('_MESSAGES'), Lang::t('_READ') . ' : ' . $title); $download_url = $this->mvc_urls ? 'index.php?r=message/download&id_message=' . $_GET['id_message'] : $um->getUrl('op=download&id_message=' . $_GET['id_message']); $output = ""; $output .= $this->messageGetTitleArea($page_title, 'message') . '<div class="std_block">' . '<h2 class="message_title"><b>' . Lang::t('_TITLE') . ': </b>' . $title . '</h2>' . '<br/>' . '<p><b>' . Lang::t('_SENDER') . ' : </b>' . $author . '</p>' . '<p><b>' . Lang::t('_DATE') . ' : </b>' . Format::date($posted) . '</p>' . '<br/>' . '<p><b>' . Lang::t('_TEXTOF') . '</b></p>' . '<div>' . $textof . '</div>' . '<br />' . ($attach != '' ? '<div class="message_attach"><span class="text_bold">' . Lang::t('_ATTACHMENT') . ' : </span>' . '<a href="' . $download_url . '">' . '<img src="' . getPathImage('fw') . mimeDetect($attach) . '" alt="' . Lang::t('_MIME') . '" />' . preg_replace('/^\\d*_\\d*_\\d*_(.*)/is', '$1', $attach) . '</a></div>' : ''); $sender_arr[$sender_info[ACL_INFO_IDST]] = $sender_info[ACL_INFO_IDST]; if ($sender == getLogUserId()) { $reply_url = $this->mvc_urls ? "index.php?r=message/add&id_forward=" . $_GET['id_message'] . "" : $um->getUrl("op=addmessage&id_forward=" . $_GET['id_message'] . ""); $output .= '<p class="message_reply"><a href="' . $reply_url . '">' . Lang::t('_NEXT') . '</a></p>'; } else { $reply_url = $this->mvc_urls ? 'index.php?r=message/write&reply_recipients=' . urlencode(serialize($sender_arr)) : $um->getUrl('op=writemessage&reply_recipients=' . urlencode(serialize($sender_arr))); $output .= '<p class="message_reply"><a href="' . $reply_url . '">' . Lang::t('_REPLY') . '</a></p>'; } $output .= '</div>'; cout($output, 'content'); }