Exemplo n.º 1
0
 function exists($name, $checkldap = 0)
 {
     $query = "SELECT slot_id FROM slot WHERE slot_name='" . addslashes($name) . "'";
     if (db_num_rows(db_query($query)) > 0) {
         return 1;
     }
     // check the ldap
     /* 		print "ldapfname '".ldapfname($name)."'"; */
     if ($checkldap) {
         if (is_string(ldapfname($name))) {
             return 1;
         }
     }
     return 0;
 }
 * print out list of editors, checkboxes for choosing, delete editor links.
 ******************************************************************************/
if ($edlist = $_SESSION[obj]->getEditors()) {
    $color = 0;
    foreach ($edlist as $e) {
        $e = htmlentities($e);
        print "\n\t\t<tr>";
        print "\n\t\t\t<td class='td{$color}' align='center'>\n\t\t\t\t<input type='checkbox' name='editors[]' value='{$e}' " . (in_array($e, $_SESSION[editors]) ? " checked='checked'" : "") . " />\n\t\t\t</td>";
        print "\n\t\t\t<td class='td{$color}'>";
        if ($e == "everyone") {
            print "Everyone (everyone) - will override other entries</td>";
        } else {
            if ($e == "institute") {
                print $cfg[inst_name] . " Users (institute)</td>";
            } else {
                print ldapfname($e) . " ({$e})</td>";
            }
        }
        // Remove links
        print "\n\t\t\t<td class='td{$color}' align='center'>";
        if ($e == 'everyone' || $e == 'institute') {
            print "&nbsp;";
        } else {
            print "<a href='#' onclick='delEditor(\"{$e}\");'>remove</a>";
        }
        print "</td>";
        print "\n\t\t</tr>";
        $color = 1 - $color;
    }
} else {
    print "\n\t\t<tr>\n\t\t\t<td class='td1' > &nbsp; </td>\n\t\t\t<td class='td1' colspan='2'>no editors added</td>\n\t\t</tr>";
Exemplo n.º 3
0
 function outputForm(&$o, $d = 0, $canAddEditors = true)
 {
     global $cfg;
     $sitename = $o->owning_site;
     if ($_SESSION[settings][edit] && !$o->builtPermissions) {
         $o->buildPermissionsArray();
     }
     // ---- Editor actions ----
     if ($_REQUEST[edaction] == 'add') {
         if (isgroup($_REQUEST[edname])) {
             $classes = group::getClassesFromName($_REQUEST[edname]);
             foreach ($classes as $class) {
                 $o->addEditor($class);
             }
         } else {
             $o->addEditor($_REQUEST[edname]);
         }
     }
     if ($_REQUEST[edaction] == 'del') {
         $o->delEditor($_REQUEST[edname]);
     }
     printc("\n<input type='hidden' name='edaction' value='' />");
     printc("\n<input type='hidden' name='edname' value='' />");
     if ($className = $sitename) {
         print "<script type='text/javascript'>";
         print "\n// <![CDATA[";
         print "\nfunction addClassEditor() {";
         print "\n\tf = document.addform;";
         print "\n\tf.edaction.value='add';";
         print "\n\tf.edname.value='{$className}';";
         print "\n\tf.submit();";
         print "\n}";
         print "\n// ]]>";
         print "\n</script>";
     }
     $a = array(0 => 4, 1 => 1);
     printc("\n<style type='text/css'>th, .td0, .td1 {font-size: 10px;}</style>");
     printc("\n<table width='100%' style='border: 1px solid gray'>");
     printc("\n<tr><th width='50%'>name</th>\t<th colspan='" . $a[$d] . "' width='30%'>permissions</th>");
     if ($canAddEditors) {
         printc("<th>del</th>");
     }
     printc("</tr>");
     printc("\n<tr><th>&nbsp;</th>" . ($d ? "<th>discuss</th>" : "<th>add</th><th>edit</th><th>delete</th><th>view</th>"));
     if ($canAddEditors) {
         printc("<th>&nbsp;</th>");
     }
     printc("</tr>");
     if ($edlist = $o->getEditors()) {
         $permissions = $o->getPermissions();
         if (count($edlist)) {
             $color = 0;
             foreach ($edlist as $e) {
                 // :: hack ::
                 // this is needed until "anonymous" discussion is enabled. could be v 2.0
                 //if ($e == 'everyone') continue;
                 // :: /hack ::
                 printc("\n<tr><td class='td{$color}' align='left'>");
                 if ($e == "everyone") {
                     printc("Everyone (will override other entries)</td>");
                 } else {
                     if ($e == "institute") {
                         printc($cfg[inst_name] . " Users</td>");
                     } else {
                         printc(ldapfname($e) . " ({$e})</td>");
                     }
                 }
                 for ($i = 0; $i < 5; $i++) {
                     $skip = 0;
                     $nob = 0;
                     if ($d && $i < 4) {
                         $skip = 1;
                     }
                     if (!$d && $i == 4) {
                         $skip = 1;
                     }
                     if (!$d && (($e == 'everyone' || $e == 'institute') && $i != 3)) {
                         $nob = 1;
                     }
                     if (!$skip) {
                         printc("\n<td class='td{$color}' align='center'>");
                         if ($nob) {
                             printc("&nbsp;");
                         } else {
                             printc("\n<input type='checkbox' name='permissions[{$e}][{$i}]' value='1'" . ($permissions[$e][$i] ? " checked='checked'" : "") . " />");
                         }
                         printc("</td>");
                     }
                     if ($skip || $nob) {
                         printc("\n<input type='hidden' name='permissions[{$e}][{$i}]' value='" . $permissions[$e][$i] . "' />");
                     }
                 }
                 printc("</td>");
                 if ($canAddEditors) {
                     printc("\n<td class='td{$color}' align='center'>");
                     if ($e == 'everyone' || $e == 'institute') {
                         printc("&nbsp;");
                     } else {
                         printc("<a href='#' onclick='delEditor(\"{$e}\");'>remove</a>");
                     }
                     printc("</td>");
                 }
                 printc("</tr>");
                 $color = 1 - $color;
             }
         }
     } else {
         printc("\n<tr><td class='td1' > &nbsp; </td><td class='td1' colspan=" . ($a[$d] + 1) . ">no editors added</td></tr>");
     }
     if ($canAddEditors) {
         printc("\n<tr><th colspan=" . ($a[$d] + 1) . ">");
         $className = array();
         if (isgroup($sitename)) {
             $className = $sitename;
         } else {
             $className = $sitename;
         }
         if (is_array($className)) {
             foreach ($className as $class) {
                 if (!in_array($class, $edlist)) {
                     printc("<a href='#' onclick='addClassEditor();'>Add students in " . $sitename . "</a><br />");
                     break;
                 } else {
                     printc("&nbsp;");
                 }
             }
         }
         printc("</th><th><a href='add_editor.php?{$sid}' target='addeditor' onclick='doWindow(\"addeditor\",400,250);'>add editor</a></th></tr>");
     }
     printc("\n</table>");
     //		if ($_SESSION[settings][edit]) printc("<a href='editor_access.php?$sid&amp;site=".$sitename."' onclick='doWindow(\"permissions\",600,400)' target='permissions'>Permissions as of last save</a>");
 }
Exemplo n.º 4
0
            if ($i > 0) {
                print " &nbsp; | &nbsp; ";
            }
            print "\n\t<a href='#' onclick=\"sendWindow('sitepreview',800,600,'" . $url . "')\">";
            print $name;
            print "</a>";
            $i++;
        }
        print "\n\t &nbsp;  As: &nbsp; &nbsp;";
        if ($e == "everyone") {
            print "Everyone (everyone)";
        } else {
            if ($e == "institute") {
                print $cfg[inst_name] . " Users (institute)";
            } else {
                print ldapfname($e) . " ({$e})";
            }
        }
        print "\n\t</td>";
        print "\n</tr>";
        $color = 1 - $color;
    }
    ?>
	</table>
	<br />Note: Only 'View Mode' and 'Edit Mode' can be previewed. 
	<br />If you click on a link to Edit, Add, make a New Post, etc, you will leave the preview and execute do that function as yourself.
<?php 
}
?>
</body>
</html>