function commandPaste()
 {
     $targetID = SB_reqValInt('nid_acl');
     $sourceId = SB_reqVal('sid', true);
     $sourceIsNode = SB_reqVal('stype', true);
     $move = SB_reqVal('mode', true) == 'Move';
     $this->executePaste($targetID, $sourceId, $sourceIsNode, $move, SB_reqVal('content'));
 }
Example #2
0
    function writeFields($optional, &$customButton, &$enabled)
    {
        $this->writingOptionalFields = $optional;
        $expertMode = $this->um->getParam('user', 'expert_mode');
        foreach ($this->fields as $name => $params) {
            $optionalField = !$expertMode && (is_array($params) && isset($params['optional']) && $params['optional']);
            if ($optionalField && !$optional) {
                continue;
            }
            if (!$optionalField && $optional) {
                continue;
            }
            if (!is_array($params)) {
                if (strpos($name, '-raw') === 0) {
                    echo $params;
                } else {
                    ?>
<div class="label"><?php 
                    echo $params;
                    ?>
</div>
<?php 
                }
                continue;
            }
            $star = '';
            if (isset($params['mandatory']) && $params['mandatory']) {
                $star = '<span class="mandatory">&#42;</span>';
            }
            ?>
<div>
<?php 
            if (!isset($params['type'])) {
                $params['type'] = 'text';
            }
            $disabled = !$params || array_key_exists('disabled', $params);
            // Is at least one field enabled
            $enabled = $name[0] != '-' && !$disabled || $enabled;
            // If we have disabled field then keep the value that would
            // be otherwise lost. Needed to go back.
            if ($disabled && $params['type'] == 'text') {
                $params['value'] = str_replace('"', "'", $params['value']);
                ?>
    <input type="hidden" name="<?php 
                echo SB_safeVal($params, 'name');
                ?>
" value="<?php 
                echo $params['value'];
                ?>
">
<?php 
                $params['name'] = '';
                // Don't use name with disabled fields.
            }
            if ($name[0] == '-') {
                $params['value'] = str_replace('"', "'", $params['value']);
                ?>
    <input type="hidden" name="<?php 
                echo $params['name'];
                ?>
" value="<?php 
                echo $params['value'];
                ?>
">
<?php 
            } elseif (isset($params['type']) && ($params['type'] == 'checkbox' || $params['type'] == 'radio')) {
                $id = 'l_' . (isset($params['name']) ? $params['name'] : '_noname');
                $params['id'] = $id;
                if (!isset($params['value'])) {
                    $params['value'] = 1;
                }
                ?>
    <div class="check" <?php 
                echo $this->getToolTip($params);
                ?>
>
        <input <?php 
                echo $this->getFieldParams($params);
                ?>
>
        <label for="<?php 
                echo $id;
                ?>
"><?php 
                echo isset($params['-raw']) ? $name : SB_T($name);
                ?>
</label>
    </div>
<?php 
            } elseif (isset($params['type']) && $params['type'] == 'select') {
                unset($params['type']);
                ?>
    <div class="label"><?php 
                echo SB_T($name) . $star;
                ?>
</div>
    <div class="data">
        <select <?php 
                echo $this->getFieldParams($params);
                ?>
>
<?php 
                $this->{$params}['_options'](isset($params['_select']) ? $params['_select'] : null, isset($params['_exclude']) ? $params['_exclude'] : null);
                ?>
        </select>
    </div>
<?php 
            } elseif (isset($params['type']) && $params['type'] == 'selectextern') {
                unset($params['type']);
                ?>
    <div class="label"><?php 
                echo SB_T($name) . $star;
                ?>
</div>
    <div class="data">
        <select <?php 
                echo $this->getFieldParams($params);
                ?>
>
<?php 
                $params['_options'](isset($params['_select']) ? $params['_select'] : null, isset($params['_exclude']) ? $params['_exclude'] : null);
                ?>
        </select>
    </div>
<?php 
            } elseif (isset($params['type']) && $params['type'] == 'callback') {
                if (isset($params['show_label']) && $params['show_label']) {
                    ?>
                    <div class="label"><?php 
                    echo SB_T($name) . $star;
                    ?>
</div>
<?php 
                }
                $this->{$params}['function'](isset($params['params']) ? $params['params'] : null);
            } elseif (isset($params['type']) && $params['type'] == 'callbackextern') {
                $params['function'](isset($params['params']) ? $params['params'] : null);
            } elseif (isset($params['type']) && $params['type'] == 'button' || $params['type'] == 'addbutton') {
                if ($this->um->isAuthorized($name, false, null, SB_reqValInt('nid_acl'), SB_reqValInt('lid_acl'))) {
                    if ($params['type'] == 'button') {
                        $customButton = true;
                    }
                    ?>
    <div>
        <input class="button customButton"
               type="button"
               onclick="this.form.button.value=this.getAttribute('x_value');this.form.submit();"
               x_value="<?php 
                    echo $name;
                    ?>
"
               value="<?php 
                    echo SB_T($name);
                    ?>
">
    </div>
<?php 
                }
            } elseif (isset($params['type']) && $params['type'] == 'textarea') {
                unset($params['type']);
                if (!isset($params['rows'])) {
                    $params['rows'] = 5;
                }
                if (!isset($params['cols'])) {
                    $params['cols'] = 1;
                }
                ?>
    <div class="label" <?php 
                echo $this->getFieldParams($params, 'title');
                ?>
><?php 
                echo SB_T($name) . $star;
                ?>
</div>
    <div class="data">
        <textarea <?php 
                echo $this->getFieldParams($params);
                ?>
><?php 
                echo isset($params['value']) ? $params['value'] : '';
                ?>
</textarea>
    </div>
<?php 
            } else {
                ?>
    <div class="label"><?php 
                echo SB_T($name) . $star;
                ?>
</div>
    <div class="data">
        <input <?php 
                echo $this->getFieldParams($params);
                ?>
>
        <input type="hidden" name="label_<?php 
                echo $params['name'];
                ?>
" value="<?php 
                echo $name;
                ?>
">
    </div>
<?php 
            }
            ?>
</div>
<?php 
        }
    }
 function commandDeleteBookmark()
 {
     $link = $this->tree->getLink(SB_reqValInt('lid_acl'));
     if (!$link) {
         return;
     }
     $this->tree->removeLink($link->id);
     $node = $this->tree->getNode($link->id_parent);
     if (!$node) {
         return;
     }
     if (!$this->um->getParam('user', 'use_trash') && $node->hasRight('purge')) {
         $this->tree->purgeNode($link->id_parent);
     }
 }
Example #4
0
 function buildShowFeedURL()
 {
     $fields = array();
     $url = $this->_buildExportUrl();
     $fields['Copy'] = array('name' => 'copy', 'value' => str_replace('&amp;', '&', $url));
     $fields['-label1-'] = SB_T('Open in New Window');
     $fields['-raw1-'] = "<a href='{$url}' target='_blank'>{$url}</a>";
     $url .= '&amp;mode=plain';
     $fields['-label2-'] = SB_T('Open as Plain Text');
     $fields['-raw2-'] = "<a href='{$url}' target='_blank'>{$url}</a>";
     if (!SB_reqChk('doall')) {
         $fields['-hidden1-'] = array('name' => 'nid_acl', 'value' => SB_reqValInt('nid_acl'));
     } else {
         $fields['-hidden1-'] = array('name' => 'doall', 'value' => 1);
     }
     $fields['Export Bookmarks'] = array('type' => 'button');
     return $fields;
 }