/**
     * Adds a site to the buffer.
     *
     * @param object site $site The site to add.
     * @param integer $indent The indent level of the object
     */
    function addSite(&$site, $indent)
    {
        $tabs = $this->_getTabs($indent);
        $this->_buffer .= '
' . $tabs . '<site';
        $this->_buffer .= ' name="' . $site->getField('name') . '"';
        $this->_buffer .= ' owner="' . slot::getOwner($site->getField('name')) . '"';
        $this->_buffer .= ' title="' . addslashes($site->getField('title')) . '"';
        $this->_buffer .= ' type="' . $site->getField('type') . '"';
        $this->_buffer .= '>';
        foreach ($site->sections as $key => $val) {
            if ($site->sections[$key]->getField('type') == 'link') {
                $this->addNavLink($site->sections[$key], $indent + 1);
            }
            if ($site->sections[$key]->getField('type') == 'heading') {
                $this->addHeading($site->sections[$key], $indent + 1);
            }
            if ($site->sections[$key]->getField('type') == 'divider') {
                $this->addDivider($site->sections[$key], $indent + 1);
            } else {
                $this->addSection($site->sections[$key], $indent + 1);
            }
        }
        $this->_buffer .= '
' . $tabs . '</site>
';
    }
Esempio n. 2
0
                 break;
             }
         }
     }
 }
 //---------------------------
 // check view permissions
 //---------------------------
 if (!$thisPage || !$thisPage->canview("everyone")) {
     print "\t\t<title>Error</title>\n";
     ob_start();
     print "You may not view this RSS Feed. This may be due to any of the following reasons:<br />";
     print "<ul>";
     if ($thisSite->site_does_not_exist) {
         print "<li>This feed does not exist. ";
         if ($_SESSION[auser] == slot::getOwner($thisSite->name) || $allowpersonalsites && $_SESSION[atype] != 'visitor' && $thisSite->name == $_SESSION[auser]) {
             print "<br /><a href='{$PHP_SELF}?{$sid}&amp;action=add_site&amp;sitename=" . $thisSite->name . "'>Create Site</a>";
         }
         print "</li>";
     } else {
         if (!$thisPage) {
             print "<li>Requested page object doesn't exist.</li>";
         } else {
             print "<li>The feed has not been made public by the owner.</li>";
         }
     }
     print "</ul>";
     $description = htmlspecialchars(ob_get_contents(), ENT_QUOTES);
     ob_end_clean();
     print "\t\t<description>";
     print $description;
Esempio n. 3
0
/**
 * Build an array of all of the sites and slots that the user
 * is either the owner of or an editor (has permission add, edit, and delete) of
 */
function allSitesSlots($user)
{
    global $classes, $usersFutureClasses;
    $allsites = array();
    // The user's personal site
    if ($user == slot::getOwner($user) || !slot::exists($user)) {
        $allsites[$user] = array();
        $allsites[$user]['slot_name'] = $user;
        $allsites[$user]['slot_type'] = 'personal';
        $allsites[$user]['owner_uname'] = $user;
        $allsites[$user]['site_exits'] = false;
    }
    // Add slots that the user is an owner of.
    // This will include all of the created sites as well
    $allsites = array_merge($allsites, $slots);
    // Add the sites that the user is a Site-Level Editor for.
    $allsites = array_merge($allsites, segue::getSiteInfoWhereUserIsSiteLevelEditor($user));
    $sitesEditorOf = segue::getSiteInfoWhereUserIsSiteLevelEditor($user);
    $usersAllClasses = array();
    if ($_SESSION[atype] == 'prof') {
        foreach ($classes as $n => $v) {
            $usersAllClasses[] = $n;
        }
        foreach ($usersFutureClasses as $n => $v) {
            $usersAllClasses[] = $n;
        }
    }
    printpre($allsites);
    printpre($usersAllClasses);
    printpre($sitesEditorOf);
    printpre($sitesOwnerOf);
    printpre($slots);
    $allsites = array_unique(array_merge($allsites, $usersAllClasses, $sitesOwnerOf, $sitesEditorOf, $slots));
    $allGroups = group::getGroupsOwnedBy($user);
    $sitesInGroups = array();
    foreach ($allGroups as $n => $g) {
        $sitesInGroups = array_unique(array_merge($sitesInGroups, group::getClassesFromName($g)));
    }
    foreach ($allsites as $n => $site) {
        if (!in_array($site, $sitesInGroups)) {
            $allsites2[] = $site;
        }
    }
    $allsites = array_merge($allsites2, $allGroups);
    asort($allsites);
    /*	print "<pre>"; print_r($usersAllClasses); print "</pre>"; */
    $sites = array();
    $slots = array();
    foreach ($allsites as $n => $site) {
        $siteObj =& new site($site);
        $exists = $siteObj->fetchFromDB();
        if ($exists) {
            $sites[] = $site;
        } else {
            $slots[] = $site;
        }
    }
    return array($sites, $slots);
}
 /**
  * Adds a site to the buffer.
  *
  * @param object site $site The site to add.
  * @param integer $indent The indent level of the object
  */
 function addSite(&$site)
 {
     // Add flags for when to add permissions rows
     $site->spiderDownLockedFlag();
     $siteElement =& $this->_document->createElement('site');
     $this->_document->appendChild($siteElement);
     // site id and type
     $siteElement->setAttribute('owner', slot::getOwner($site->getField('name')));
     $siteElement->setAttribute('type', $site->getField('type'));
     // Media quota
     $slot = new Slot($site->getField('name'));
     $quota = $slot->getField('quota');
     if ($quota) {
         $siteElement->setAttribute('mediaQuota', $quota);
     }
     $this->addCommonProporties($site, $siteElement);
     // use the slot-name for backwards-compatability
     $siteElement->setAttribute('id', $site->getField('name'));
     // header
     $header =& $this->_document->createElement('header');
     $siteElement->appendChild($header);
     $header->appendChild($this->_document->createTextNode(htmlspecialchars($site->getField('header'))));
     // footer
     $footer =& $this->_document->createElement('footer');
     $siteElement->appendChild($footer);
     $footer->appendChild($this->_document->createTextNode(htmlspecialchars($site->getField('footer'))));
     // Theme
     $this->addTheme($site, $siteElement);
     // Media
     $this->addMedia($site, $siteElement);
     // sections
     foreach ($site->sections as $key => $val) {
         if ($site->sections[$key]->getField('type') == 'link') {
             $this->addSectionNavLink($site->sections[$key], $siteElement);
         } else {
             if ($site->sections[$key]->getField('type') == 'heading') {
                 $this->addHeading($site->sections[$key], $siteElement);
             } else {
                 if ($site->sections[$key]->getField('type') == 'divider') {
                     $this->addDivider($site->sections[$key], $siteElement);
                 } else {
                     $this->addSection($site->sections[$key], $siteElement);
                 }
             }
         }
     }
 }