コード例 #1
0
ファイル: inc.js.php プロジェクト: rbraband/iSefrengo-Dev
function set_filedata($db, $imorexport, $idclient)
{
    global $tmp, $tpl, $action, $idjsfile, $cms_lang, $cfg_cms, $perm, $sess;
    // variablen belegen
    $idjs = $db->f("idjs");
    // get perms for testing
    if (!empty($idclient)) {
        $test_type = 'js_file';
        $test_id = $idjs;
        if (!$perm->have_perm(2, "js_file", $idjs)) {
            return 0;
        }
    } else {
        $test_type = 'area_js';
        $test_id = '0';
    }
    // Hintergrundfarbe wählen
    $tmp['ENTRY_BGCOLOR'] = '#FFFFFF';
    $tmp['ENTRY_BGCOLOROVER'] = '#fff7ce';
    // filename und description
    $tmp['ENTRY_ICON'] = make_image('ressource_browser/icons/rb_typ_js.gif', '', '16', '16', false, 'class="icon"');
    $tmp['ENTRY_NAME'] = htmlentities($db->f('filename'), ENT_COMPAT, 'UTF-8');
    // handle delete css-file
    if ($action == 30 && $idjs == $idjsfile && $perm->have_perm(5, $test_type, $test_id)) {
        $tmp['ENTRY_NAME'] = $tmp['ENTRY_NAME'] . '  ' . make_image_link3("main.php?area=js&action=deletefile&idjsfile=" . $idjs . "&idupl=" . $db->f('idupl') . "&idclient={$idclient}", 'but_confirm.gif', 'but_cancel_delete.gif', $cms_lang['js_file_delete_confirm'], $cms_lang['js_file_delete_cancel'], 'action', 'deletethis');
    }
    $tmp['ENTRY_DESCRIPTION'] = htmlentities($db->f('description'), ENT_COMPAT, 'UTF-8');
    // buttons vorbesetzen
    $tmp['ENTRY_DOWNLOAD'] = make_image_link2($url = '#', $image = 'space.gif', '', '16', '16', '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_DUPLICATE'] = make_image_link2($url = '#', $image = 'space.gif', '', '16', '16', '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_EDIT'] = make_image_link2($url = '#', $image = 'space.gif', '', '16', '16', '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_DELBUT'] = make_image_link2($url = '#', $image = 'space.gif', '', '16', '16', '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_IMEXPORT'] = make_image_link2($url = '#', $image = 'space.gif', '', '16', '16', '', '', '', 'action', '', '', '', 'action');
    // button: download js-file - wenn nicht im import
    if (!empty($idclient) && $perm->have_perm(8, $test_type, $test_id)) {
        $tmp['ENTRY_DOWNLOAD'] = make_image_link2("main.php?area=js&action=downloadfile&idjsfile=" . $db->f('idupl') . "&idclient={$idclient}", 'but_download.gif', $cms_lang['js_file_download'], '16', '16', '', '', '', 'action', '', '', '', 'action');
    }
    // buttons: edit, copy,
    if (!empty($idjs) && $perm->have_perm(3, $test_type, $test_id) || empty($idclient) && $perm->have_perm(3, $test_type, $test_id)) {
        // button: edit js-file
        $tmp['ENTRY_EDIT'] = make_image_link2("main.php?area=js_edit_file&idjsfile=" . $idjs . "&idclient={$idclient}", 'but_edit.gif', $cms_lang['js_file_edit'], '16', '16', '', '', '', 'action', '', '', '', 'action');
        // button: duplicate js-file -- benötigt auch Neu-Anlegen-Rechte
        if ($perm->have_perm(2, 'area_js')) {
            $tmp['ENTRY_DUPLICATE'] = make_image_link2("main.php?area=js_edit_file&action=10&idjsfile=" . $idjs . "&idclient={$idclient}", 'but_duplicate.gif', $cms_lang['js_file_duplicate'], '16', '16', '', '', '', 'action', '', '', '', 'action');
        }
    }
    // button: delete js-file
    if ($perm->have_perm(5, $test_type, $test_id)) {
        $tmp['ENTRY_DELBUT'] = make_image_link2("main.php?area=js&action=30&idjsfile=" . $idjs . "&idclient={$idclient}", 'but_deleteside.gif', $cms_lang['js_file_delete'], '16', '16', '', '', '', 'action', 'deletethis', '', '', 'action');
    }
    // button: export js-file
    $rights_okay = $imorexport == 'import' ? $perm->have_perm(13, $test_type, $test_id) : $perm->have_perm(14, $test_type, $test_id);
    if ($rights_okay && !empty($idjs)) {
        $upl = $imorexport == 'import' ? '&idupl=' . $db->f('idupl') : '';
        $tmp['ENTRY_IMEXPORT'] = make_image_link2("main.php?area=js&action=" . $imorexport . "&idjsfile=" . $idjs . $upl . "&idclient={$idclient}", $imorexport . '.gif', $cms_lang['js_' . $imorexport], '16', '16', '', '', '', 'action', '', '', '', 'action');
    }
    $tpl->setVariable($tmp);
    $tpl->parseCurrentBlock();
    unset($tmp);
    return 1;
}
コード例 #2
0
ファイル: inc.css.php プロジェクト: rbraband/iSefrengo-Dev
function set_rule_data($db, $imorexport)
{
    global $tmp, $tpl, $ruleserror, $action, $idcss, $idcssfile, $idexpand, $idclient, $cms_lang, $cfg_cms, $perm, $sess;
    if ($perm->have_perm('17', 'css_file', $idexpand)) {
        // Zeige alle CSS-regeln, wenn der User die Berechtigung zum Anzeigen von CSS-Regeln hat
        // background-color of css-rules
        $tmp['DETAIL_BGCOLOR'] = $db->f("status") == 1 ? '#FFFFFF' : '#FFEFDE';
        $tmp['DETAIL_BGCOLOROVER'] = $db->f("status") == 1 ? '#FFF7CE' : '#FFF7CE';
        if (!$db->f('status')) {
            $ruleserror = '1';
        }
        // buttons
        $tmp['DETAIL_EDIT'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
        $tmp['DETAIL_DELBUT'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
        $tmp['DETAIL_DUPLICATE'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
        $tmp['DETAIL_EXIMPORT'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
        // css-rule name and description
        // jb - 29.08.2004 - added details as tooltip for comfort
        // jb - 04.09.2004 - added debug info: idcss of rule
        $tmp['DETAIL_ICON'] = make_image('but_style.gif', '', '16', '16');
        $tmp['DETAIL_NAME'] = '<a class="action" href="javascript:void(0)" title="' . htmlspecialchars($db->f('styles'), ENT_QUOTES, 'UTF-8') . '">' . htmlentities($db->f('type')) . htmlentities($db->f('name')) . ($cfg_cms['debug_active'] ? ' (' . $db->f('idcss') . ')' : '') . '</a>';
        // handle delete css-rule
        if ($action == 30 && $db->f('idcss') == $idcss && $perm->have_perm('21', 'css_file', $idexpand)) {
            $tmp['DETAIL_NAME'] = $tmp['DETAIL_NAME'] . '&nbsp;&nbsp;' . make_image_link3("main.php?area=css&action=deleterule&idcssfile={$idcssfile}&idexpand={$idexpand}&idcss=" . $db->f('idcss') . "&idclient={$idclient}", 'but_confirm.gif', 'but_cancel_delete.gif', $cms_lang['css_delete_confirm'], $cms_lang['css_delete_cancel'], 'action', 'deletethis');
        }
        $tmp['DETAIL_DESCRIPTION'] = htmlentities($db->f('description'), ENT_COMPAT, 'UTF-8');
        // buttons
        if ($perm->have_perm('19', 'css_file', $idexpand)) {
            $url = $imorexport == 'export' ? "&idexpand={$idexpand}&idcssfile={$idexpand}" : "&idcssfile={$idcssfile}";
            // button: edit css-rule
            $tmp['DETAIL_EDIT'] = make_image_link2("main.php?area=css_edit" . $url . "&idcss=" . $db->f('idcss') . "&idclient={$idclient}", 'but_edit.gif', $cms_lang['css_edit'], '16', '16', '', '', '', 'action', '', '', '', 'action');
            // button: duplicate css-rule, benötigt zusätzlich create rechte
            if ($perm->have_perm('18', 'area_css')) {
                $tmp['DETAIL_DUPLICATE'] = make_image_link2("main.php?area=css_edit&action=10" . $url . "&idcss=" . $db->f('idcss') . "&idclient={$idclient}", 'but_duplicate.gif', $cms_lang['css_duplicate'], '16', '16', '', '', '', 'action', '', '', '', 'action');
            }
        }
        if ($perm->have_perm('21', 'css_file', $idexpand)) {
            // button: delete css-rule
            $tmp['DETAIL_DELBUT'] = make_image_link2("main.php?area=css&action=30" . $url . "&idcss=" . $db->f("idcss") . "&idclient={$idclient}", 'but_deleteside.gif', $cms_lang['css_delete'], '16', '16', '', '', '', 'action', 'deletethis', '', '', 'action');
        }
        // button: export or import css-rule
        if ($perm->have_perm('29', 'css_file', $idcssfile) && $imorexport == 'import' && $idclient == 0 || $perm->have_perm('30', 'css_file', $idexpand) && $imorexport == 'export' && $idclient != 0) {
            $url = "&idexpand={$idcssfile}&idcssfile={$idcssfile}";
            $tmp['DETAIL_EXIMPORT'] = make_image_link2("main.php?area=css&action={$imorexport}" . $url . "&idcss=" . $db->f('idcss') . "&idclient={$idclient}", "{$imorexport}.gif", $cms_lang['css_' . $imorexport], '16', '16', '', '', '', 'action', '', '', '', 'action');
        }
    }
}
コード例 #3
0
ファイル: inc.upl.php プロジェクト: rbraband/iSefrengo-Dev
function showDirectory($level, $line_array, $prefixexpand, $status, $monocolor = false)
{
    global $tpl, $idopen, $client, $iddirectory, $action, $cms_lang, $newname, $sess, $perm, $filelevel, $fileexpand;
    global $newdirname, $newdirdescription, $idexpand, $cfg_client, $cfg_cms, $viewtype;
    $named_place = '<a name="dirworkplace"></a>';
    $iddir = $line_array['iddirectory'];
    $selected = '';
    $class = $monocolor ? $monocolor : '#FFFFFF';
    $class2 = $monocolor ? $monocolor : '#FFF7CE';
    $hint = $cms_lang['upl_opendir'];
    $pict = 'but_folder_off2.gif';
    $expand = $iddir . '_' . $level ? $prefixexpand : '';
    $actionexpand = $idexpand;
    $indent = $level == -1 ? 4 : $level * 21 + 4;
    if ($idopen == $iddir) {
        $class = $monocolor ? $monocolor : '#DEEFFF';
        $class2 = $monocolor ? $monocolor : '#FFF7CE';
        $hint = $cms_lang['upl_closedir'];
        $pict = 'but_folder.gif';
        $selected = ' selected';
        $expand = $level ? '-' . $expand : '';
    }
    // directory informations
    $link = 'main.php?area=upl&amp;action=%s&amp;idexpand=' . $actionexpand . '&amp;iddirectory=' . $iddir . '&amp;viewtype=' . $viewtype;
    $tmp['ENTRY_SHOWDETAIL'] = $level < 0 ? $line_array['name'] : make_image_link2('main.php?area=upl&amp;viewtype=' . $viewtype . '&amp;idexpand=' . $expand, $pict, $hint, '', '', '', '', '', 'action', '', '', $line_array['name'], 'action');
    $tmp['ENTRY_BGCOLOR'] = $class;
    $tmp['ENTRY_BGCOLOROVER'] = $class2;
    $tmp['ENTRY_STYLE'] = ' style="padding-left: ' . $indent . 'px;" ';
    $tmp['ENTRY_DESCRIPTION'] = $line_array['description'];
    // buttons and actions
    $tmp['ENTRY_SCAN'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_NEW'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_EDIT'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
    $tmp['ENTRY_DELBUT'] = make_image_link2('#', 'space.gif', '', 16, 16, '', '', '', 'action', '', '', '', 'action');
    // check if root directory
    if ($level < 0) {
        // button for changing the view
        // Auswahl für Detail- oder Compact-Modus
        if ($viewtype == 'compact') {
            $tmp['ENTRY_SPECIAL'] = make_image_link2(sprintf($link, 150), 'but_viewdetail.gif', $cms_lang['upl_changeviewdetail'], 16, 16, '', '', '', '', '', '', '', 'action');
        } else {
            $tmp['ENTRY_SPECIAL'] = make_image_link2(sprintf($link, 150), 'but_viewcompact.gif', $cms_lang['upl_changeviewcompact'], 16, 16, '', '', '', '', '', '', '', 'action');
        }
        // clear dir name
        $line_array['dirname'] = '';
    } else {
    }
    // buttons for functions
    // check permission for create directory
    if ($perm->have_perm(2, 'folder', $iddir)) {
        $tmp['ENTRY_NEW'] = make_image_link2(sprintf($link, 100), 'but_newcat.gif', $cms_lang['upl_createdir'], 16, 16, '', '', '', '', 'dirworkplace', '', '', 'action');
    }
    // check permission for edit directory
    if ($perm->have_perm(3, 'folder', $iddir)) {
        if ($level >= 0) {
            $tmp['ENTRY_EDIT'] = make_image_link2(sprintf($link, 110), 'but_edit.gif', $cms_lang['upl_editdir'], 16, 16, '', '', '', '', 'dirworkplace', '', '', 'action');
        }
    }
    // check permission for delete directory
    if ($perm->have_perm(5, 'folder', $iddir)) {
        if ($level >= 0) {
            $tmp['ENTRY_DELBUT'] = make_image_link2(sprintf($link, 120), 'but_delete.gif', $cms_lang['upl_deletedir'], 16, 16, '', '', '', '', 'dirworkplace', '', '', 'action');
        }
    }
    // check permission for directory scan
    if ($perm->have_perm(11, 'area_upl') && $level == -1 || $perm->have_perm(11, 'folder', $iddir)) {
        $link = 'main.php?area=scancontrol&amp;action=%s&amp;idexpand=' . $actionexpand . '&amp;iddirectory=' . $iddir . '&amp;viewtype=' . $viewtype;
        $tmp['ENTRY_SCAN'] = make_image_link5(sprintf($link, 'scandir'), 'but_folder_scan.gif', $level == -1 ? $cms_lang['upl_scandir_root'] : $cms_lang['upl_scandir'], 16, 16, 'scanwin', 'width=400,height=400,scrollbars=0', '', '', 'action', '', '', '', 'action');
    }
    // handle called actions
    // functions will override the description or add something to the name
    if ($iddirectory == $line_array['iddirectory']) {
        switch ($action) {
            // create new directory
            case 100:
                $actionname = 'createdir';
                // show directory that will contain the new directory
                $tmp['ENTRY_SHOWDETAIL'] = $tmp['ENTRY_SHOWDETAIL'] . $named_place;
                $tpl->setVariable($tmp);
                $tpl->parseCurrentBlock();
                unset($tmp);
                // create line for new directory
                quoteSaveText($newdirname);
                quoteSaveText($newdirdescription);
                $tmp['ENTRY_SHOWDETAIL'] = '<input type="text" name="newdirname" value="' . $newdirname . '" size="20" maxlength="255" />';
                $tmp['ENTRY_BGCOLOR'] = $class;
                $tmp['ENTRY_BGCOLOROVER'] = $class2;
                $tmp['ENTRY_STYLE'] = ' style="padding-left: ' . ($indent + 3) . 'px;" ';
                $tmp['ENTRY_DESCRIPTION'] = $cms_lang['upl_description'] . ':<br /><textarea name="newdirdescription" rows="3" cols="50">' . $newdirdescription . '</textarea><br /> ';
                $tmp['ENTRY_DESCRIPTION'] = $tmp['ENTRY_DESCRIPTION'] . make_image_link4('but_confirm.gif', 'but_cancel_delete.gif', $cms_lang['upl_createdir'], $cms_lang['upl_cancel'], '', '', 'main.php?area=upl&amp;viewtype=' . $viewtype . '&amp;idexpand=' . $actionexpand . '&amp;iddirectory=' . $iddir, '16', '16');
                break;
                // edit existing directory
            // edit existing directory
            case 110:
                $actionname = 'editdir';
                quoteSaveText($newdirname);
                quoteSaveText($newdirdescription);
                $tmp['ENTRY_SHOWDETAIL'] = $named_place . make_image_link2('main.php?area=upl&amp;idexpand=' . $expand, $pict, $hint, 16, 16, '', '', '', 'action', '', '', '', 'action');
                $tmp['ENTRY_NAME'] = '<input type="text" name="newdirname" value="' . ($newdirname ? $newdirname : $line_array['name']) . '" size="20" maxlength="255" />';
                $tmp['ENTRY_DESCRIPTION'] = $cms_lang['upl_description'] . ':<br /><textarea name="newdirdescription" rows="3" cols="50">' . ($newdirdescription ? $newdirdescription : $line_array['description']) . '</textarea><br /> ';
                if ($perm->have_perm(6, 'folder', $iddirectory)) {
                    $panel = $perm->get_right_panel('folder', $iddirectory, array('formname' => 'fmedit'), 'img');
                    if (!empty($panel)) {
                        $tmp['ENTRY_DESCRIPTION'] = $tmp['ENTRY_DESCRIPTION'] . implode("", $panel);
                    }
                }
                $tmp['ENTRY_DESCRIPTION'] = $tmp['ENTRY_DESCRIPTION'] . make_image_link4('but_confirm.gif', 'but_cancel_delete.gif', $cms_lang['upl_editdir'], $cms_lang['upl_cancel'], '', '', 'main.php?area=upl&amp;viewtype=' . $viewtype . '&amp;idexpand=' . $actionexpand . '&amp;iddirectory=' . $iddir, '16', '16');
                break;
                // delete directory
            // delete directory
            case 120:
                $tmp['ENTRY_DELETE'] = make_image_link3('main.php?area=upl&amp;action=deletedir&amp;viewtype=' . $viewtype . '&amp;iddirectory=' . $line_array['iddirectory'] . '&amp;idclient=' . $client . '&amp;idexpand=' . $expand, 'but_confirm.gif', 'but_cancel_delete.gif', $cms_lang['upl_deletedir'], $cms_lang['upl_cancel'], '', 'dirworkplace');
                break;
                // to do for version 1.x
                // 130: copy directory
                // 140: move directory
                // 170: download directory
            // to do for version 1.x
            // 130: copy directory
            // 140: move directory
            // 170: download directory
            default:
                break;
        }
        if ($actionname) {
            makeRowEdit($tmp, array('url' => 'main.php?action=' . $actionname, 'enctype' => 'text/plain', 'block' => 'ROWEDIT', 'hidden' => array('area' => 'upl', 'idexpand' => $actionexpand, 'iddirectory' => $line_array['iddirectory'], 'parentid' => $line_array['iddirectory'], 'parentdirname' => $line_array['dirname'], 'dirdescription' => $line_array['iddirectory'], 'dirname' => $line_array['dirname'], 'viewtype' => $viewtype)));
        }
    }
    $tpl->setVariable($tmp);
    $tpl->parseCurrentBlock();
    unset($tmp);
    if ($idopen == $iddir) {
        $tpl->setCurrentBlock('PASTENTRY');
        $filelevel = $level;
        $fileexpand = str_replace('-', '', $actionexpand);
    }
}