コード例 #1
0
ファイル: sitebar.inc.php プロジェクト: codeministry/sitebar
    function drawHead()
    {
        $this->drawHeadPage();
        if ($this->useToolTips) {
            ?>
<div id="toolTip"></div>
<?php 
        }
        $this->writeMenu('node', $this->nodeMenu);
        $this->writeMenu('link', $this->linkMenu);
        // TODO       $this->writeMenu('nodeDrag', $this->nodeDragMenu);
        // TODO       $this->writeMenu('linkDrag', $this->linkDragMenu);
        $this->drawHeadLogo();
        $this->drawToolBar();
        $this->drawWarning();
        if ($this->appError) {
            echo <<<_DOC
<div id="warning">
{$this->appError}
</div>
_DOC;
        }
        if ($this->switches['user'] && strlen($this->switches['user'])) {
            $message = SB_T("Hide bookmarks from %s!", $this->switches['user']);
            echo '
<div id="info"><a href="' . SB_Page::absBaseUrl() . '?user="******"http://sitebar.org/version.php");
                    $lines = $page->getContent();
                    if (!$this->hasErrors()) {
                        $this->um->db->setData('version', 'Version');
                        $this->um->db->setData('version', 'lastcheck', time());
                        $this->um->db->setData('version', 'failed_count');
                        foreach ($lines as $line) {
                            if (preg_match("/^(.*)=(.*)\$/", $line, $reg)) {
                                $this->um->db->setData('version', $reg[1], $reg[2]);
                            }
                        }
                    } else {
                        $errors =& $this->getErrors();
                        // Hide errors
                        $errors = array();
                        echo '<div id="versionCheck">';
                        echo SB_T('Error during version check!');
                        echo '<br>';
                        echo SB_T('Will try in %d hours again.', 6);
                        echo "</div>\r";
                        $this->um->db->setData('version', 'lastcheck', time() - $interval + 60 * 60 * 6);
                        $this->um->db->setData('version', 'failed_count', intval($this->um->db->getData('version', 'failed_count')) + 1);
                    }
                }
                if (!$this->um->db->getData('version', 'failed_count')) {
                    $lastVersion = $this->um->db->getData('version', 'Version');
                    if ($lastVersion && version_compare(SB_CURRENT_RELEASE, $lastVersion, '<')) {
                        $this->um->db->setData('version', 'newversion', $lastVersion);
                        echo '<div id="versionCheck">';
                        $link = sprintf(' <a href="%s"' . SB_Page::target() . '>%s</a>', $this->um->db->getData('version', 'Download URL'), $lastVersion);
                        echo SB_T('New version available') . ': ' . $link;
                        echo '<br>';
                        echo SB_T('Severity') . ': ' . $this->um->db->getData('version', 'Severity');
                        echo "</div>\r";
                    }
                }
            }
        }
    }