function buildProperties()
 {
     $fields = array();
     $link = null;
     if ($this->command != 'Add Bookmark') {
         $link = $this->tree->getLink(SB_reqValInt('lid_acl'));
         if (!$link) {
             return null;
         }
     } else {
         $link = new SB_Tree_Link(array());
     }
     $fields['-hidden1-'] = array('name' => 'lid_acl', 'value' => $link->id);
     $fields['URL'] = array('name' => 'url');
     if ($this->command != 'Delete Bookmark') {
         /* Show the 'Retrieve Info' button only in case it has not been yet
          * performed
          */
         $fields['Get Bookmark Information'] = array('type' => 'addbutton');
         $fields['-hidden4-'] = array('name' => 'origin', 'value' => $this->command);
     }
     $fields['Bookmark Name'] = array('name' => 'name', 'maxlength' => 255);
     $size = strlen($link->comment);
     $MAXSIZETOEDIT = 4096;
     if ($size <= $MAXSIZETOEDIT) {
         $fields['Description'] = array('name' => 'comment', 'type' => 'textarea');
     } else {
         $fields['-raw1-'] = SB_T("Description too long for inplace editing, please use export feature!");
     }
     if ($this->um->getParam('user', 'use_favicons')) {
         $fields['Favicon'] = array('name' => 'favicon', 'maxsize' => 32000);
         $fields['-raw2-'] = '';
     }
     if (strlen(SB_reqVal('url'))) {
         $link->url = SB_reqVal('url');
     }
     if ($this->getInfo && strlen(SB_reqVal('url'))) {
         $link->name = SB_reqVal('name');
         $link->comment = SB_reqVal('comment');
         $link->favicon = SB_reqVal('favicon');
         /* Try to get the title and favicon */
         require_once './inc/pageparser.inc.php';
         $page = new SB_PageParser($link->url);
         if ($page->getInformation(array('CHARSET', 'TITLE', 'FAVURL', 'DESC', 'KEYWORDS'))) {
             $cp = 'iso-8859-1';
             if ($page->errorCode['CHARSET'] < PP_ERR) {
                 $cp = $page->info['CHARSET'];
             }
             require_once './inc/converter.inc.php';
             $c = new SB_Converter($this->um->getParam('config', 'use_conv_engine'), $cp);
             if (!$link->name && isset($page->info['TITLE'])) {
                 $link->name = $c->utf8RawUrlDecode($page->info['TITLE']);
             }
             if (!$link->comment && isset($page->info['DESC'])) {
                 $link->comment = $c->utf8RawUrlDecode($page->info['DESC']);
             }
             if ($this->um->getParam('user', 'use_favicons')) {
                 if (!$link->favicon && isset($page->info['FAVURL'])) {
                     $link->favicon = $page->info['FAVURL'];
                     /* Show the retrieved favicon. */
                     if ($this->command == 'Add Bookmark') {
                         /* Show the retrieved favicon. */
                         $wrong = SB_Skin::imgsrc('link_wrong_favicon');
                         $fields['-raw2-'] = "<div><img class='favicon' alt='' src='" . $link->favicon . "' onerror='this.src=\"{$wrong}\"'></div>";
                     } else {
                         $fields['-raw2-'] = $this->_buildFavicon(SB_reqValInt('lid_acl'), $link->favicon);
                     }
                 }
             }
         }
     }
     $fields['URL']['value'] = $link->url;
     $fields['Bookmark Name']['value'] = $link->name;
     $fields['Description']['value'] = $link->comment;
     if ($this->um->getParam('user', 'use_favicons')) {
         if ($this->command != 'Add Bookmark') {
             $favicon = $link->favicon;
             if (substr($link->favicon, 0, 7) == 'binary:') {
                 require_once './inc/faviconcache.inc.php';
                 $fc =& SB_FaviconCache::staticInstance();
                 $favicon = 'data:image/x-icon;base64,' . base64_encode($fc->faviconGet($link->favicon, null));
             }
             if ($link->favicon) {
                 $fields['-raw2-'] = $this->_buildFavicon($link->id, $link->favicon);
             }
         }
         $fields['Favicon']['value'] = $link->favicon;
     }
     $size = strlen($link->comment);
     $MAXSIZETOEDIT = 4096;
     if ($size <= $MAXSIZETOEDIT) {
         $fields['Description'] = array('name' => 'comment', 'type' => 'textarea', 'value' => $link->comment);
     } else {
         $fields['-raw1-'] = SB_T("Description too long for inplace editing, please use export feature!");
     }
     $fields['Feed Bookmark'] = array('name' => 'is_feed', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_is_feed'));
     if ($link->is_feed) {
         $fields['Feed Bookmark']['checked'] = null;
     }
     if ($this->command == 'Add Bookmark' || $this->tree->inMyTree($link->id_parent)) {
         $fields['Private'] = array('name' => 'private', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_private'));
         if ($link->private) {
             $fields['Private']['checked'] = null;
         }
     }
     if ($link->is_dead) {
         $fields['Dead Bookmark'] = array('name' => 'is_dead_check', 'type' => 'checkbox', 'checked' => null, 'title' => SB_P('command::tooltip_is_dead_check'));
         $fields['-hidden2-'] = array('name' => 'is_dead', 'type' => 'hidden', 'value' => 1);
     }
     if ($this->um->getParam('config', 'use_outbound_connection')) {
         $fields['Exclude From Validation'] = array('name' => 'novalidate', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_novalidate'));
         if (!$link->validate) {
             $fields['Exclude From Validation']['checked'] = null;
         }
     }
     $fields['Target'] = array('name' => 'link_target', 'value' => $link->target);
     if ($this->command != 'Delete Bookmark') {
         if ($this->um->getParam('config', 'comment_impex') && strlen($link->comment) > 0 || strlen($link->comment) >= $MAXSIZETOEDIT) {
             $fields['Export Description'] = array('name' => 'command', 'type' => 'addbutton');
         }
         if ($this->um->getParam('config', 'comment_impex')) {
             $fields['Import Description'] = array('name' => 'command', 'type' => 'addbutton');
         }
     }
     if ($this->command == 'Properties') {
         $fields['Delete Bookmark'] = array('type' => 'addbutton');
     }
     return $fields;
 }
Beispiel #2
0
function IEInstall()
{
    $install = $_REQUEST['install'];
    $code = '{3F218DFB-00FF-297C-4D54-57696C4A6F6F}';
    $title = 'SiteBar';
    $url = SB_Page::absBaseUrl() . 'index.php';
    $reg = '';
    $filename = '';
    $ctxUrl = SB_Page::absBaseUrl() . 'ctxmenu.php';
    require_once './inc/converter.inc.php';
    $charsetKey = 'Charset in MS Windows';
    $c = new SB_Converter(!$um || $um->getParam('config', 'use_conv_engine'), SB_T($charsetKey) == $charsetKey ? null : SB_T($charsetKey));
    $addLink = $c->fromUTF8(SB_T('Add Link to SiteBar'));
    $addPage = $c->fromUTF8(SB_T('Add Page to SiteBar'));
    if ($install) {
        $filename = "InstallSiteBar.reg";
        // See http://msdn.microsoft.com/workshop/browser/ext/tutorials/explorer.asp
        $reg = <<<__INSTALL
REGEDIT4

[HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}]
@="{$title}"

[HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}\\Implemented Categories]

[HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}\\Implemented Categories\\{00021493-0000-0000-C000-000000000046}]

[HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}\\InProcServer32]
@="shdocvw.dll"
"ThreadingModel"="Apartment"

[HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}\\Instance]
"CLSID"="{4D5C8C2A-D075-11d0-B416-00C04FB90376}"

[HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}\\Instance\\InitPropertyBag]
"Url"="{$url}"

[-HKEY_CURRENT_USER\\Software\\Classes\\Component Categories\\{00021493-0000-0000-C000-000000000046}\\Enum]

[-HKEY_CURRENT_USER\\Software\\Classes\\Component Categories\\{00021494-0000-0000-C000-000000000046}\\Enum]

[HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\{$addLink}]
"Contexts"=hex:22
"Flags"=hex:01
@="{$ctxUrl}?add=link"

[HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\{$addPage}]
"Contexts"=hex:01
"Flags"=hex:01
@="{$ctxUrl}?add=page"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\Explorer Bars\\{$code}]
"BarSize"=hex:B4
"Name"="{$title}"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\Extensions\\{23F5C49C-74DF-42BA-A194-FF92A3B59FED}]
"ButtonText" = "SiteBar"
"MenuText" = "SiteBar Panel"
"MenuStatusBar"="Display SiteBar Panel"
"Icon" = hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,73,68,65,6c,6c,33,32,2e,64,6c,6c,2c,31,37,33,00
"HotIcon" = hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,73,68,65,6c,6c,33,32,2e,64,6c,6c,2c,31,37,33,00
"CLSID" = "{E0DD6CAB-2D10-11D2-8F1A-0000F87ABD16}"
"BandCLSID" = "{$code}"
"Default Visible"="Yes"
__INSTALL;
    } else {
        $filename = 'UnInstallSiteBar.reg';
        $reg = <<<__UNINSTALL
REGEDIT4

[-HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{$code}]
[-HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\Explorer Bars\\{$code}]
[-HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\Extensions\\{23F5C49C-74DF-42BA-A194-FF92A3B59FED}]
[-HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Add Link to SiteBar]
[-HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Add Page to SiteBar]
[-HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\{$addLink}]
[-HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\{$addPage}]
__UNINSTALL;
    }
    header('Content-Type: application/octet-stream' . "\r");
    header('Content-Disposition: attachment; filename="' . $filename . "\"\r");
    header('Content-Transfer-Encoding: binary' . "\r");
    header('Content-Length: ' . strlen($reg) . "\r");
    echo $reg;
    exit;
}
Beispiel #3
0
    function _buildCodepage()
    {
        if (!$this->um->getParam('config', 'use_conv_engine')) {
            return;
        }
        require_once './inc/converter.inc.php';
        $cnv = new SB_Converter();
        function _cmdlangCmp(&$a, $b)
        {
            return strcmp($a[1], $b[1]);
        }
        uasort($cnv->languages, '_cmdlangCmp');
        reset($cnv->languages);
        ?>
    <div class="label"><?php 
        echo SB_T('Codepage');
        ?>
</div>
    <select class="language" name="cp">
<?php 
        echo "\t\t" . '<option value="utf-8">' . SB_T('Default (%s)', 'utf-8') . '</option>' . "\n";
        foreach ($cnv->languages as $key => $value) {
            if ($cnv->getEngine() == SB_CHARSET_IGNORE && !($value[2] == 'iso-8859-1')) {
                continue;
            }
            $lang_name = ucfirst(substr(strstr($value[0], '|'), 1));
            echo "\t\t" . '<option value="' . $value[2] . '">' . $lang_name . ' (' . $key . ')</option>' . "\n";
        }
        ?>
    </select>
<?php 
        if ($cnv->getEngine() == SB_CHARSET_IGNORE) {
            echo SB_P('command::noiconv');
        }
    }