Example #1
0
function DrawNotesEngine($id)
{
    global $page;
    //check if there is an action in queue
    if (isset($_GET["action"])) {
        switch ($_GET["action"]) {
            case "login":
                ValidateLogin();
                break;
            case "logout":
                session_destroy();
                echo "<script> window.location.href = 'index.php?cat=didattica&page=dispense'; </script>";
                break;
        }
    }
    $path = "/";
    //prepare delete modal
    $is_auth = validateUser();
    if (isset($_SESSION["notes-user"])) {
        $user = $_SESSION["notes-user"];
    } elseif (isset($_SESSION["user"])) {
        $user = $_SESSION["user"];
    }
    $permissions = validatePermissions($is_auth);
    echo "<input type='hidden' name='authlevel' id='authlevel' value='{$permissions}'>";
    echo "<div id='notes-container'>";
    include "core/modules/php/notes-engine-modals.php";
    if ($is_auth) {
        echo "<!--[if lte IE 9]>\n            <div class='alert alert-danger' role='alert'>\n                <i class='fa fa-exclamation-circle'></i> <b>Attenzione!</b>: Il browser Internet Explorer fino alla versione 10\n                non supporta il caricamento dei file tramite AJAX. Si prega di utilizzare una versione aggiornata di\n                <a href='http://windows.microsoft.com/it-it/internet-explorer/download-ie' target='_blank'>Internet Explorer</a>\n                (10 o successiva) o un altro browser come <a href='https://www.mozilla.org/it/firefox/new/' target='_blank'>Mozilla Firefox</a>\n                o <a href='http://www.google.it/intl/it/chrome/browser/' target='_blank'>Google Chrome</a>\n            </div>\n            <![endif]-->";
    }
    echo "<div class='btn-toolbar' role='toolbar'>";
    if ($is_auth) {
        echo "<div class='btn-group'>\n             <button type='button' class='btn btn-success dropdown-toggle' data-toggle='dropdown'><span class='fa fa-plus'></span> Nuovo</button>\n             <ul class='dropdown-menu' role='menu'>\n                <li><a href='#' id='new-folder-command'><i class='fa fa-folder fa-fw'></i> Cartella</a></li>\n                <li class='divider'></li>\n                <li><a href='#' id='upload-file-command'><i class='fa fa-cloud-upload fa-fw'></i> Carica file</a></li>\n                <li class='divider'></li>\n                <li class='disabled'><a href='#'><i class='fa fa-file-text fa-fw'></i> Articolo</a></li>\n                <li class='disabled'><a href='#'><i class='fa fa-code fa-fw'></i> File di codice</a></li>\n             </ul>\n            </div>";
        echo "<div class='btn-group pull-right'>\n             <button type='button' class='btn btn-default dropdown-toggle' id='userbutton' data-toggle='dropdown'><i class='fa fa-user'></i> {$user}</button>\n             <ul class='dropdown-menu' role='menu'>\n                <li><a href='#' id='show-usage-command'><i class='fa fa-tasks fa-fw'></i> Mostra utilizzo</a></li>\n                <li class='divider'></li>\n                <li><a href='#' id='edit-user-command'><i class='fa fa-wrench fa-fw'></i> Modifica utente</a></li>\n                <li><a href='index.php?cat=didattica&page=dispense&action=logout'><i class='fa fa-sign-out fa-fw'></i> Esci</a></li>\n             </ul>\n            </div>";
    } else {
        $form = "<form action='index.php?cat=didattica&page=dispense&action=login' method='POST'>\n                    <div class='input-group'>\n                        <span class='input-group-addon'><span class='fa fa-user'></span></span>\n                        <input type='text' class='form-control' placeholder='Nome utente' name='username'>\n                    </div>\n                    <br>\n                    <div class='input-group'>\n                        <span class='input-group-addon'><span class='fa fa-lock'></span></span>\n                        <input type='password' class='form-control' placeholder='Password' name='password'>\n                    </div>\n                    <br>\n                    <input type='submit' class='btn btn-default' value='Accedi'>\n                </form>";
        echo "<div class='btn-group pull-right'>\n                <button type='button' class='btn btn-default popover-standard' data-container='body' data-toggle='popover' data-html='true' data-placement='bottom' title='Accedi come docente' data-content=\"{$form}\">Accedi</button>\n             </div>";
    }
    echo "<div class='btn-group' id='breadcrumb-container'>";
    displayBreadcrumbs($path);
    echo "</div></div>";
    echo "<div id='notes-fileview'>";
    displayFiles($path);
    echo "</div>";
    echo "</div>";
}
Example #2
0
function DrawFileManager($path)
{
    global $page;
    include "modules/php/file-manager-modals.php";
    //Avviso per gli utenti di versioni vecchie di IE
    echo "<!--[if lte IE 9]>\n            <div class='alert alert-danger' role='alert'>\n                <i class='fa fa-exclamation-circle'></i> <b>Attenzione!</b>: Il browser Internet Explorer fino alla versione 10\n                non supporta il caricamento dei file tramite AJAX. Si prega di utilizzare una versione aggiornata di\n                <a href='http://windows.microsoft.com/it-it/internet-explorer/download-ie' target='_blank'>Internet Explorer</a>\n                (10 o successiva) o un altro browser come <a href='https://www.mozilla.org/it/firefox/new/' target='_blank'>Mozilla Firefox</a>\n                o <a href='http://www.google.it/intl/it/chrome/browser/' target='_blank'>Google Chrome</a>\n            </div>\n            <![endif]-->";
    echo "<div class='btn-toolbar' role='toolbar'>";
    echo "<div class='btn-group'>\n             <button type='button' class='btn btn-success dropdown-toggle' data-toggle='dropdown'><span class='fa fa-plus'></span> Nuovo</button>\n             <ul class='dropdown-menu' role='menu'>\n                <li><a href='#' id='new-folder-command'><i class='fa fa-folder fa-fw'></i> Cartella</a></li>\n                <li class='divider'></li>\n                <li><a href='#' id='upload-file-command'><i class='fa fa-cloud-upload fa-fw'></i> Carica file</a></li>\n             </ul>\n            </div>";
    if ($path == "files") {
        $files_active = "active";
    } else {
        $img_active = "active";
    }
    echo "<div class='btn-group pull-right' data-toggle='buttons'>\n    <label class='btn btn-default {$files_active}'>\n        <input type='radio' name='options' id='show-files' autocomplete='off' checked> Gestione files <span class='label label-default'>files</span>\n    </label>\n    <label class='btn btn-default {$img_active}'>\n        <input type='radio' name='options' id='show-images' autocomplete='off'> Gestione immagini <span class='label label-default'>img</span>\n    </label></div>";
    echo "<div class='btn-group' id='breadcrumb-container'>";
    displayBreadcrumbs($path);
    echo "</div></div>";
    echo "<div id='manager-fileview'>";
    displayFiles($path);
    echo "</div>";
    echo "</div>";
}
Example #3
0
}
if ($company_id) {
    $q->addWhere('project_company = ' . (int) $company_id);
}
if ($project_id) {
    $q->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
    $q->addWhere('file_task = ' . (int) $task_id);
}
$q->addGroup('file_version_id');
// counts total recs from selection
$xpg_totalrecs = count($q->loadList());
$pageNav = buildPaginationNav($AppUI, $m, $tab, $xpg_totalrecs, $xpg_pagesize, $page);
echo $pageNav;
?>
<script language="javascript" type="text/javascript">
function expand(id){
  var element = document.getElementById(id);
  element.style.display = (element.style.display == '' || element.style.display == 'none') ? 'block' : 'none';
}
</script>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl list">
    <?php 
global $showProject;
$showProject = true;
echo displayFiles($AppUI, 0, $task_id, $project_id, $company_id);
?>
</table>
<?php 
echo $pageNav;
Example #4
0
function getFolders($parent, $level = 0)
{
    global $AppUI, $allowed_folders_ary, $denied_folders_ary, $tab, $m, $a, $company_id, $allowed_companies, $project_id, $task_id, $current_uri, $file_types;
    // retrieve all children of $parent
    $folder_where = "file_folder_parent='{$parent}'";
    //   $folder_where .= (count($denied_folders_ary) > 0) ? "\nAND file_folder_id NOT IN (" . implode(",", $denied_folders_ary) . ")" : "";
    $q = new DBQuery();
    $q->addTable('file_folders');
    $q->addQuery('*');
    $q->addWhere($folder_where);
    $q->addOrder('file_folder_name');
    $folder_sql = $q->prepare();
    $q->clear();
    $folders = db_loadList($folder_sql);
    // display each child
    foreach ($folders as $row) {
        if (array_key_exists($row['file_folder_id'], $allowed_folders_ary) or array_key_exists($parent, $allowed_folders_ary)) {
            // indent and display the title of this child
            $file_count = countFiles($row['file_folder_id']);
            echo '<ul><li><table width="100%"><tr><td><span class="folder-name">';
            if ($m == 'files') {
                echo '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            echo dPshowImage('./modules/files/images/folder5_small.png', '16', '16', 'folder icon', 'show only this folder');
            if ($m == 'files') {
                '</a>' . '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            echo $row['file_folder_name'];
            if ($m == 'files') {
                '</a>';
            }
            if ($file_count > 0) {
                echo ' <a href="#ff' . $row['file_folder_id'] . '" onClick="expand(\'files_' . $row['file_folder_id'] . '\')" class="has-files">(' . $file_count . ' files) +</a>';
            }
            echo "</td>\n";
            echo '	<form name="frm_remove_folder_' . $row['file_folder_id'] . '" action="?m=files" method="post">
				<input type="hidden" name="dosql" value="do_folder_aed" />
				<input type="hidden" name="del" value="1" />
				<input type="hidden" name="file_folder_id" value="' . $row['file_folder_id'] . '" />
				<input type="hidden" name="redirect" value="' . $current_uri . '" />
				</form>';
            echo "<td align='right' width='64' nowrap>\n";
            echo '<a href="./index.php?m=files&amp;a=addedit_folder&amp;folder=' . $row['file_folder_id'] . '">' . dPshowImage('./modules/files/images/filesaveas.png', '16', '16', 'edit icon', 'edit this folder') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit_folder&amp;file_folder_parent=' . $row['file_folder_id'] . '&amp;file_folder_id=0">' . dPshowImage('./modules/files/images/edit_add.png', '', '', 'new folder', 'add a new subfolder') . '</a>' . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this folder?\')) {document.frm_remove_folder_' . $row['file_folder_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '', '', 'delete icon', 'delete this folder') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit&amp;folder=' . $row['file_folder_id'] . '&amp;project_id=' . $project_id . '&amp;file_id=0">' . dPshowImage('./modules/files/images/folder_new.png', '', '', 'new file', 'add new file to this folder') . '</a>';
            echo "</td></tr></table></span>\n";
            if ($file_count > 0) {
                echo '<div class="files-list" id="files_' . $row['file_folder_id'] . '" style="display: none;">';
                displayFiles($row['file_folder_id']);
                echo "</div>";
            }
        }
        // call this function again to display this
        // child's children
        if (!getFolders($row['file_folder_id'], $level + 1)) {
            echo "</li>";
        } else {
            echo "</li></ul>";
        }
    }
    return true;
}
function displayFolders($folder_id = 0, $level = 0)
{
    global $AppUI, $m, $a, $tab;
    global $current_uri;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    $q = new DBQuery();
    $folders = array();
    // retrieve all info of $folder_id
    if ($folder_id) {
        $q->addTable('file_folders', 'ff');
        $q->addQuery('ff.*');
        $q->addWhere('ff.file_folder_id = ' . $folder_id);
        $folder_sql = $q->prepare();
        $q->clear();
        $folders = db_loadList($folder_sql);
    } else {
        $folders[0]['file_folder_name'] = $AppUI->_('Root');
        $folders[0]['file_folder_description'] = '';
        $folder_id = 0;
    }
    //get file count for folder
    $file_count = countFiles($folder_id);
    //check permissions
    $canAccess_this = getPermission('file_folders', 'access', $folder_id);
    $canRead_this = getPermission('file_folders', 'view', $folder_id);
    $canEdit_this = getPermission('file_folders', 'edit', $folder_id);
    $canAuthor_this = getPermission('file_folders', 'add', $folder_id);
    $canDelete_this = getPermission('file_folders', 'delete', $folder_id);
    if (!$canRead_this && $folder_id) {
        return;
    }
    foreach ($folders as $row) {
        //"loop" through one folder
        if ($canRead_this && $level) {
            // indent and display the title
            echo '<table width="100%"><tr>' . "\n";
            echo '<td>' . "\n";
        }
        echo '<span class="folder-name' . (!($folder_id && $level) ? '-current' : '') . '">' . "\n";
        echo ($m == 'files' ? '<a' . ($folder_id ? ' href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . $tab . '&folder=' . $folder_id . '"' : '') . ' name="ff' . $folder_id . '">' : '') . "\n";
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/folder5_small.png', '16', '16', 'folder icon', $AppUI->_('show only this folder')) . $row['file_folder_name'] . "\n";
        echo ($m == 'files' ? '</a>' : '') . "\n";
        if ($file_count > 0) {
            echo '<a href="#ff' . $folder_id . '" onClick="expand(' . "'files_" . $folder_id . "'" . ')" class="has-files">(' . $file_count . ' files) +</a>' . "\n";
        }
        echo "</span>\n" . ($level ? "</td>\n" : '');
        if ($row['file_folder_description'] && !($folder_id && $level)) {
            echo '<p>' . $row['file_folder_description'] . '</p>';
        } else {
            if ($level) {
                if ($folder_id) {
                    echo '<form id="frm_remove_folder_' . $folder_id . '" name="frm_remove_folder_' . $folder_id . '" action="?m=files" method="post">' . "\n" . '<input type="hidden" name="dosql" value="do_folder_aed" />' . "\n" . '<input type="hidden" name="del" value="1" />' . "\n" . '<input type="hidden" name="file_folder_id" value="' . $folder_id . '" />' . "\n" . '<input type="hidden" name="redirect" value="' . $current_uri . '" />' . "</form>\n";
                    echo '<td align="right" width="64" nowrap="nowrap">' . "\n";
                    //edit folder
                    if ($canEdit_this) {
                        echo '<a href="./index.php?m=files&a=addedit_folder&folder=' . $folder_id . '">' . dPshowImage(DP_BASE_URL . '/modules/files/images/filesaveas.png', '16', '16', 'edit icon', 'edit this folder') . '</a>';
                    }
                    //add folder
                    if ($canAuthor_this) {
                        echo '<a href="./index.php?m=files&a=addedit_folder&file_folder_parent=' . $folder_id . '&folder=0">' . dPshowImage(DP_BASE_URL . '/modules/files/images/edit_add.png', '16', '16', 'new folder', $AppUI->_('add a new subfolder')) . '</a>';
                    }
                    if ($canDelete_this) {
                        //remove folder
                        echo '<a href="#" onclick="delCheck(' . "'" . $folder_id . "'" . ')">' . dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete icon', $AppUI->_('delete this folder')) . '</a>';
                    }
                    //add file to folder
                    echo '<a href="./index.php?m=files&a=addedit&folder=' . $folder_id . '&project_id=' . $project_id . '&file_id=0">' . dPshowImage(DP_BASE_URL . '/modules/files/images/folder_new.png', '16', '16', 'new file', $AppUI->_('add new file to this folder')) . '</a>';
                    echo "</td>\n";
                    echo "</tr></table>\n";
                }
            }
        }
        if ($file_count > 0) {
            //echo ('<div class="files-list" id="files_' . $folder_id . '" style="display:'
            //      . (($level || $open_folder ) ? 'none' : 'block') . ';">');
            echo '<div class="files-list" id="files_' . $folder_id . '" style="display: none;">';
            displayFiles($folder_id);
            echo '</div>';
        } else {
            if ($folder && !($folder_id && $level)) {
                echo $AppUI->_('No Result(s)');
            }
        }
    }
    // retrieve all children of $folder_id
    $q->addTable('file_folders', 'ff');
    $q->addQuery('ff.*');
    $q->addWhere('ff.file_folder_parent = ' . $folder_id);
    if (count($allowedFolderIDs)) {
        $q->addWhere($allowedFolderIDs);
    }
    $q->addOrder('ff.file_folder_name');
    $folder_children_sql = $q->prepare();
    $q->clear();
    $folders_children = db_loadList($folder_children_sql);
    foreach ($folders_children as $kid_row) {
        // call this function again to its children
        echo '<ul><li>';
        displayFolders($kid_row['file_folder_id'], $level + 1);
        echo '</li></ul>';
    }
}
function getFolders($parent, $level = 0)
{
    global $AppUI, $allowed_folders_ary, $denied_folders_ary, $tab, $m, $a, $company_id, $allowed_companies, $project_id, $task_id, $current_uri, $file_types;
    // retrieve all children of $parent
    $file_folder = new CFileFolder();
    $folders = $file_folder->getFoldersByParent($parent);
    $s = '';
    // display each child
    foreach ($folders as $row) {
        if (array_key_exists($row['file_folder_id'], $allowed_folders_ary) or array_key_exists($parent, $allowed_folders_ary)) {
            $file_count = countFiles($row['file_folder_id']);
            $s .= '<tr><td colspan="20">';
            if ($m == 'files') {
                $s .= '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            $s .= '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" width="16" height="16" style="float: left; border: 0px;" />';
            $s .= $row['file_folder_name'];
            if ($m == 'files') {
                $s .= '</a>';
            }
            if ($file_count > 0) {
                $s .= ' <a href="javascript: void(0);" onClick="expand(\'files_' . $row['file_folder_id'] . '\')" class="has-files">(' . $file_count . ' files) +</a>';
            }
            $s .= '<form name="frm_remove_folder_' . $row['file_folder_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
                    <input type="hidden" name="dosql" value="do_folder_aed" />
                    <input type="hidden" name="del" value="1" />
                    <input type="hidden" name="file_folder_id" value="' . $row['file_folder_id'] . '" />
                    </form>';
            $s .= '<a style="float:left;" href="./index.php?m=files&amp;a=addedit_folder&amp;folder=' . $row['file_folder_id'] . '">' . w2PshowImage('filesaveas.png', '16', '16', 'edit icon', 'edit this folder', 'files') . '</a>' . '<a style="float:left;" href="./index.php?m=files&amp;a=addedit_folder&amp;file_folder_parent=' . $row['file_folder_id'] . '&amp;file_folder_id=0">' . w2PshowImage('edit_add.png', '', '', 'new folder', 'add a new subfolder', 'files') . '</a>' . '<a style="float:right;" href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this folder?\')) {document.frm_remove_folder_' . $row['file_folder_id'] . '.submit()}">' . w2PshowImage('remove.png', '', '', 'delete icon', 'delete this folder', 'files') . '</a>' . '<a style="float:left;" href="./index.php?m=files&amp;a=addedit&amp;folder=' . $row['file_folder_id'] . '&amp;project_id=' . $project_id . '&amp;file_id=0">' . w2PshowImage('folder_new.png', '', '', 'new file', 'add new file to this folder', 'files') . '</a>';
            $s .= '</td></tr>';
            if ($file_count > 0) {
                $s .= '<div class="files-list" id="files_' . $row['file_folder_id'] . '" style="display: none;">';
                $s .= displayFiles($AppUI, $row['file_folder_id'], $task_id, $project_id, $company_id);
                $s .= "</div>";
            }
        }
    }
    return $s;
}
Example #7
0
 attemptLogin();
 // Check referer
 if (checkReferer() == 1) {
     // Process any FTP actions
     processActions();
     // Display content when logged in
     if ($_SESSION["loggedin"] == 1) {
         if ($ajaxRequest == 0) {
             displayFormStart();
             displayFtpActions();
             displayAjaxDivOpen();
         }
         // Display FTP folder history
         displayFtpHistory();
         // Display folder/file listing
         displayFiles();
         // Load error window
         displayErrors();
         if ($ajaxRequest == 0) {
             displayAjaxDivClose();
             displayAjaxIframe();
             displayUploadProgress();
             displayAjaxFooter();
             loadJsLangVars();
             loadAjax();
             writeHiddenDivs();
             displayFormEnd();
             //displayAjaxIframe();
             loadEditableExts();
         }
     }
Example #8
0
    $testteams = getTestTeams();
    foreach ($testteams as $t) {
        $tid = $t['tid'];
        $teamname = $t['name'];
        echo "<option value='{$tid}' ";
        if ($tid == $teamid) {
            echo "SELECTED ";
        }
        echo ">{$teamname}\n";
    }
    echo "</select><input type='submit' value='set' name='setPuzzleTestTeam'></form>\n";
    echo "</div>";
}
// Show files
echo "<div class='fileInfo'>";
displayFiles($uid, $pid);
echo "</div>";
// Link to post-prod site
echo "<br />";
echo "<div class='postProd'>";
displayPostProd($uid, $pid, isStatusInPostProd($puzzleInfo['pstatus']));
echo "</div>";
echo "<br />";
echo "<div class='puzzApproval'>";
displayPuzzApproval($uid, $pid);
echo "</div>";
echo "<br />";
echo "<div class='priority'>";
displayPuzzPriority($uid, $pid);
echo "</div>";
echo "<br />";
Example #9
0
function getFolders($parent, $level = 0)
{
    global $AppUI, $allowed_folders_ary, $denied_folders_ary, $tab, $m, $a, $company_id, $allowed_companies, $project_id, $task_id, $current_uri, $file_types;
    // retrieve all children of $parent
    $folder_where = 'file_folder_parent = \'' . $parent . '\'';
    //   $folder_where .= (count($denied_folders_ary) > 0) ? "\nAND file_folder_id NOT IN (" . implode(',', $denied_folders_ary) . ")" : "";
    $q = new DBQuery();
    $q->addTable('file_folders');
    $q->addQuery('*');
    $q->addWhere($folder_where);
    $q->addOrder('file_folder_name');
    $folders = $q->loadList();
    $q->clear();
    $s = '';
    // display each child
    foreach ($folders as $row) {
        if (array_key_exists($row['file_folder_id'], $allowed_folders_ary) or array_key_exists($parent, $allowed_folders_ary)) {
            // indent and display the title of this child
            $file_count = countFiles($row['file_folder_id']);
            $s .= '<ul><li><table width="100%"><tr><td><span class="folder-name">';
            if ($m == 'files') {
                $s .= '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            $s .= w2PshowImage('folder5_small.png', '16', '16', 'folder icon', 'show only this folder', 'files');
            if ($m == 'files') {
                '</a>' . '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            $s .= $row['file_folder_name'];
            if ($m == 'files') {
                '</a>';
            }
            if ($file_count > 0) {
                $s .= ' <a href="javascript: void(0);" onClick="expand(\'files_' . $row['file_folder_id'] . '\')" class="has-files">(' . $file_count . ' files) +</a>';
            }
            $s .= '</td><form name="frm_remove_folder_' . $row['file_folder_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
				<input type="hidden" name="dosql" value="do_folder_aed" />
				<input type="hidden" name="del" value="1" />
				<input type="hidden" name="file_folder_id" value="' . $row['file_folder_id'] . '" />
				<input type="hidden" name="redirect" value="' . $current_uri . '" />
				</form>';
            $s .= '<td align="right" width="64" nowrap="nowrap">';
            $s .= '<a href="./index.php?m=files&amp;a=addedit_folder&amp;folder=' . $row['file_folder_id'] . '">' . w2PshowImage('filesaveas.png', '16', '16', 'edit icon', 'edit this folder', 'files') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit_folder&amp;file_folder_parent=' . $row['file_folder_id'] . '&amp;file_folder_id=0">' . w2PshowImage('edit_add.png', '', '', 'new folder', 'add a new subfolder', 'files') . '</a>' . '<a href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this folder?\')) {document.frm_remove_folder_' . $row['file_folder_id'] . '.submit()}">' . w2PshowImage('remove.png', '', '', 'delete icon', 'delete this folder', 'files') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit&amp;folder=' . $row['file_folder_id'] . '&amp;project_id=' . $project_id . '&amp;file_id=0">' . w2PshowImage('folder_new.png', '', '', 'new file', 'add new file to this folder', 'files') . '</a>';
            $s .= '</td></tr></table></span>';
            if ($file_count > 0) {
                $s .= '<div class="files-list" id="files_' . $row['file_folder_id'] . '" style="display: none;">';
                $s .= displayFiles($row['file_folder_id']);
                $s .= "</div>";
            }
        }
        // call this function again to display this
        // child's children
        // getFolders *always* returns true, so there's no point in checking it
        $s .= getFolders($row['file_folder_id'], $level + 1) . '</li></ul>';
        /*
        		if (!getFolders($row['file_folder_id'], $level + 1)) {
        			$s .= '</li>';
        		} else {
        			$s .= '</li></ul>';
        		}
        */
    }
    /*
     *  getFolders  would *alway* return true and would echo the results.  It
     * makes more sense to simply return the results.  Then the calling code can
     * echo it, capture it for parsing, or whatever else needs to be done.  There
     * should be less inadvertent actions as a result.
     */
    return $s;
}
Example #10
0
function getFolders($parent, $level = 0)
{
    global $AppUI, $allowed_folders_ary, $denied_folders_ary, $tab, $m, $a, $company_id, $allowed_companies, $project_id, $task_id, $current_uri, $file_types;
    // retrieve all children of $parent
    $file_folder = new CFileFolder();
    $folders = $file_folder->getFoldersByParent($parent);
    $s = '';
    // display each child
    foreach ($folders as $row) {
        if (array_key_exists($row['file_folder_id'], $allowed_folders_ary) or array_key_exists($parent, $allowed_folders_ary)) {
            $file_count = countFiles($row['file_folder_id']);
            $s .= '<tr><td colspan="20">';
            if ($m == 'files') {
                $s .= '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            $s .= '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" width="16" height="16" style="float: left; border: 0px;" />';
            $s .= $row['file_folder_name'];
            if ($m == 'files') {
                $s .= '</a>';
            }
            if ($file_count > 0) {
                $s .= ' <a href="javascript: void(0);" onClick="expand(\'files_' . $row['file_folder_id'] . '\')" class="has-files">(' . $file_count . ' files) +</a>';
            }
            $s .= '<form name="frm_remove_folder_' . $row['file_folder_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
                    <input type="hidden" name="dosql" value="do_folder_aed" />
                    <input type="hidden" name="del" value="1" />
                    <input type="hidden" name="file_folder_id" value="' . $row['file_folder_id'] . '" />
                    </form>';
            $s .= '<a style="float:left;" href="./index.php?m=files&amp;a=addedit_folder&amp;folder=' . $row['file_folder_id'] . '">' . w2PshowImage('filesaveas.png', '16', '16', 'edit icon', 'edit this folder', 'files') . '</a>' . '<a style="float:left;" href="./index.php?m=files&amp;a=addedit_folder&amp;file_folder_parent=' . $row['file_folder_id'] . '&amp;file_folder_id=0">' . w2PshowImage('edit_add.png', '', '', 'new folder', 'add a new subfolder', 'files') . '</a>' . '<a style="float:right;" href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this folder?\')) {document.frm_remove_folder_' . $row['file_folder_id'] . '.submit()}">' . w2PshowImage('remove.png', '', '', 'delete icon', 'delete this folder', 'files') . '</a>' . '<a style="float:left;" href="./index.php?m=files&amp;a=addedit&amp;folder=' . $row['file_folder_id'] . '&amp;project_id=' . $project_id . '&amp;file_id=0">' . w2PshowImage('folder_new.png', '', '', 'new file', 'add new file to this folder', 'files') . '</a>';
            $s .= '</td></tr>';
            if ($file_count > 0) {
                $s .= '<div class="files-list" id="files_' . $row['file_folder_id'] . '" style="display: none;">';
                $s .= displayFiles($AppUI, $row['file_folder_id'], $task_id, $project_id, $company_id);
                $s .= "</div>";
            }
        }
        // call this function again to display this
        // child's children
        // getFolders *always* returns true, so there's no point in checking it
        //$s .= getFolders($row['file_folder_id'], $level + 1).'</li></ul>';
    }
    /*
     *  getFolders  would *alway* return true and would echo the results.  It
     * makes more sense to simply return the results.  Then the calling code can
     * echo it, capture it for parsing, or whatever else needs to be done.  There
     * should be less inadvertent actions as a result.
     */
    return $s;
}
Example #11
0
<?php

if (!isset($page)) {
    die("403: Not authorized to call this page directly");
}
$module["action"] = "library";
include "core/modules/notes-engine.php";
//process request by calling the correct functions
if (isset($_POST["action"])) {
    switch ($_POST["action"]) {
        case "load-path":
            $path = findPath($connection->escape_string($_POST["folder"]));
            displayFiles($path);
            break;
        case "update-breadcrumb":
            $path = findPath($connection->escape_string($_POST["folder"]));
            displayBreadcrumbs($path);
            break;
        case "delete-file":
            deleteFile($connection->escape_string($_POST["path"]), $connection->escape_string($_POST["container"]));
            break;
        case "delete-folder":
            deleteFolder($connection->escape_string($_POST["id"]));
            break;
        case "new-folder":
            newFolder($connection->escape_string($_POST["name"]), $connection->escape_string($_POST["path"]));
            break;
        case "edit-folder":
            editFolder($connection->escape_string($_POST["name"]), $connection->escape_string($_POST["id"]));
            break;
        case "get-usage":