Ejemplo n.º 1
0
    /**
     * @todo document this
     */
    function action_skinedittype($msg = '')
    {
        global $member, $manager;
        $skinid = intRequestVar('skinid');
        $type = requestVar('type');
        $member->isAdmin() or $this->disallow();
        $type = trim($type);
        $type = strtolower($type);
        if (!isValidShortName($type)) {
            $this->error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
        }
        $skin =& new SKIN($skinid);
        $friendlyNames = SKIN::getFriendlyNames();
        $this->pagehead();
        ?>
		<p>(<a href="index.php?action=skinoverview"><?php 
        echo _SKIN_GOBACK;
        ?>
</a>)</p>

		<h2><?php 
        echo _SKIN_EDITPART_TITLE;
        ?>
 '<?php 
        echo htmlspecialchars($skin->getName());
        ?>
': <?php 
        echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type));
        ?>
</h2>

		<?php 
        if ($msg) {
            echo "<p>" . _MESSAGE . ": {$msg}</p>";
        }
        ?>

		<div style="width:100%;">
		<form method="post" action="index.php">
		<div>

		<input type="hidden" name="action" value="skinupdate" />
		<?php 
        $manager->addTicketHidden();
        ?>
		<input type="hidden" name="skinid" value="<?php 
        echo $skinid;
        ?>
" />
		<input type="hidden" name="type" value="<?php 
        echo $type;
        ?>
" />

		<input type="submit" value="<?php 
        echo _SKIN_UPDATE_BTN;
        ?>
" onclick="return checkSubmit();" />
		<input type="reset" value="<?php 
        echo _SKIN_RESET_BTN;
        ?>
" />
		(skin type: <?php 
        echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type));
        ?>
)
		<?php 
        if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
            help('skinpart' . $type);
        } else {
            help('skinpartspecial');
        }
        ?>
		<br />

		<textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><?php 
        echo htmlspecialchars($skin->getContent($type));
        ?>
</textarea>

		<br />
		<input type="submit" tabindex="20" value="<?php 
        echo _SKIN_UPDATE_BTN;
        ?>
" onclick="return checkSubmit();" />
		<input type="reset" value="<?php 
        echo _SKIN_RESET_BTN;
        ?>
" />
		(skin type: <?php 
        echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type));
        ?>
)

		<br /><br />
		<?php 
        echo _SKIN_ALLOWEDVARS;
        ?>
		<?php 
        $actions = SKIN::getAllowedActionsForType($type);
        sort($actions);
        while ($current = array_shift($actions)) {
            // skip deprecated vars
            if ($current == 'ifcat') {
                continue;
            }
            if ($current == 'imagetext') {
                continue;
            }
            if ($current == 'vars') {
                continue;
            }
            echo helplink('skinvar-' . $current) . "{$current}</a>";
            if (count($actions) != 0) {
                echo ", ";
            }
        }
        echo '<br /><br />' . _SKINEDIT_ALLOWEDBLOGS;
        $query = 'SELECT bshortname, bname FROM ' . sql_table('blog');
        showlist($query, 'table', array('content' => 'shortblognames'));
        echo '<br />' . _SKINEDIT_ALLOWEDTEMPLATESS;
        $query = 'SELECT tdname as name, tddesc as description FROM ' . sql_table('template_desc');
        showlist($query, 'table', array('content' => 'shortnames'));
        echo '</div></form></div>';
        $this->pagefoot();
    }
Ejemplo n.º 2
0
function listplug_table_skinlist($template, $type)
{
    global $CONF, $DIR_SKINS, $manager;
    switch ($type) {
        case 'HEAD':
            echo "<th>" . _LISTS_NAME . "</th><th>" . _LISTS_DESC . "</th><th colspan='3'>" . _LISTS_ACTIONS . "</th>";
            break;
        case 'BODY':
            $current = $template['current'];
            echo '<td>';
            // use a special style for the default skin
            if ($current->sdnumber == $CONF['BaseSkin']) {
                echo '<strong>', htmlspecialchars($current->sdname), '</strong>';
            } else {
                echo htmlspecialchars($current->sdname);
            }
            echo '<br /><br />';
            echo _LISTS_TYPE, ': ', htmlspecialchars($current->sdtype);
            echo '<br />', _LIST_SKINS_INCMODE, ' ', $current->sdincmode == 'skindir' ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
            if ($current->sdincpref) {
                echo '<br />', _LIST_SKINS_INCPREFIX, ' ', htmlspecialchars($current->sdincpref);
            }
            // add preview image when present
            if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png')) {
                echo '<br /><br />';
                $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
                if ($hasEnlargement) {
                    echo '<a href="', $CONF['SkinsURL'], htmlspecialchars($current->sdincpref), 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';
                }
                $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));
                echo '<img class="skinpreview" src="', $CONF['SkinsURL'], htmlspecialchars($current->sdincpref), 'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';
                if ($hasEnlargement) {
                    echo '</a>';
                }
                if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html')) {
                    $url = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';
                    $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));
                    echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';
                }
            }
            echo "</td>";
            echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);
            // show list of defined parts
            $r = sql_query('SELECT stype FROM ' . sql_table('skin') . ' WHERE sdesc=' . $current->sdnumber . ' ORDER BY ' . " stype NOT IN ('index', 'item', 'error', 'search', 'archive', 'archivelist', 'imagepopup', 'member') ASC , " . ' stype ASC');
            $types = array();
            while ($o = sql_fetch_object($r)) {
                array_push($types, $o->stype);
            }
            if (sizeof($types) > 0) {
                $friendlyNames = SKIN::getFriendlyNames();
                for ($i = 0; $i < sizeof($types); $i++) {
                    $type = $types[$i];
                    if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
                        $types[$i] = '<li>' . helpHtml('skinpart' . $type) . ' <a href="index.php?action=skinedittype&amp;skinid=' . $current->sdnumber . '&amp;type=' . $type . '" tabindex="' . $template['tabindex'] . '">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
                    } else {
                        $types[$i] = '<li>' . helpHtml('skinpartspecial') . ' <a href="index.php?action=skinedittype&amp;skinid=' . $current->sdnumber . '&amp;type=' . $type . '" tabindex="' . $template['tabindex'] . '">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
                    }
                }
                echo '<br /><br />', _LIST_SKINS_DEFINED, ' <ul>', implode($types, ''), '</ul>';
            }
            echo "</td>";
            echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid={$current->sdnumber}' tabindex='" . $template['tabindex'] . "'>" . _LISTS_EDIT . "</a></td>";
            $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
            echo "<td style=\"white-space:nowrap\"><a href='", htmlspecialchars($url), "' tabindex='" . $template['tabindex'] . "'>" . _LISTS_CLONE . "</a></td>";
            echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid={$current->sdnumber}' tabindex='" . $template['tabindex'] . "'>" . _LISTS_DELETE . "</a></td>";
            break;
    }
}