function ma_move_execute($modids, $post)
{
    $section_id = -1;
    foreach ($post as $key => $val) {
        if ($key == 'section') {
            $section = decode_array($val);
            $section_id = $section['id'];
        }
    }
    if ($section_id == -1) {
        return;
    }
    $section = get_record("course_sections", "id", $section_id);
    $message = "";
    if ($section) {
        foreach ($modids as $modid) {
            $cm = get_record("course_modules", "id", $modid);
            if (!moveto_module($cm, $section)) {
                $message .= "Could not move module {$modid}, ";
            }
        }
    } else {
        $message = "No sections were selected";
    }
    return $message;
}
Exemple #2
0
function serverCopySite($orig, $dest)
{
    $sections = decode_array(db_get_value("sites", "sections", "name='{$orig}'"));
    $nsections = array();
    foreach ($sections as $s) {
        $sa = db_get_line("sections", "id={$s}");
        $squery = "insert into sections set addedby='" . addslashes($_SESSION['auser']) . "', addedtimestamp=NOW()";
        $squery .= ",title='{$sa['title']}', active={$sa['active']}, type='{$sa['type']}', url='{$sa['url']}'";
        $pages = decode_array($sa[pages]);
        $npages = array();
        foreach ($pages as $p) {
            $pa = db_get_line("pages", "id={$p}");
            $pquery = "insert into pages set addedby='" . addslashes($_SESSION['auser']) . "', addedtimestamp=NOW()";
            $pquery .= ",ediscussion=1,archiveby='{$pa['archiveby']}',url='{$pa['url']}',type='{$pa['type']}',title='{$pa['title']}', showcreator={$pa['showcreator']}, showdate={$pa['showdate']}, locked={$pa['locked']}, active={$pa['active']}";
            $stories = decode_array($pa[stories]);
            $nstories = array();
            foreach ($stories as $st) {
                $sta = db_get_line("stories", "id={$st}");
                $stquery = "insert into stories set addedby='" . addslashes($_SESSION['auser']) . "', addedtimestamp=NOW()";
                $stquery .= ",type='{$sta['type']}',texttype='{$sta['texttype']}',category='{$sta['category']}',title='{$sta['title']}', discuss={$sta['discuss']}, discusspermissions='{$sta['discusspermissions']}', shorttext='{$sta['shorttext']}', longertext='{$sta['longertext']}', locked={$sta['locked']}, url='{$sa['url']}'";
                db_query($stquery);
                //				print "$stquery<br />";
                $nstories[] = lastid();
            }
            $stories = encode_array($nstories);
            $pquery .= ",stories='{$stories}'";
            db_query($pquery);
            $npages[] = lastid();
            //			print "$pquery<br />";
        }
        $pages = encode_array($npages);
        $squery .= ",pages='{$pages}'";
        db_query($squery);
        $nsections[] = lastid();
        //		print "$squery<br />";
    }
    $sections = encode_array($nsections);
    $query = "update sites set sections='{$sections}' where name='{$dest}'";
    db_query($query);
    //	print "$query<br />";
}
Exemple #3
0
body, table, td, th, input {
	font-size: 12px;
	font-family: "Verdana", "sans-serif";
}

input {
	border: 1px solid black;
	background-color: white;
	font-size: 10px;
}

</style>

<?php 
print $content;
$sections = decode_array($sa['sections']);
if ($_REQUEST['show'] == 'wiki') {
    print "<table cellspacing='1' width='100%'>";
    print "<tr><td >";
    print "<div style='font-size: 11px;'>";
    print "Any of the titles below can be used to create a wiki link.  Simply copy and\n\tpaste a title into the Segue editor. <br /><br />";
    print "</div>";
    print "<div style='font-size: 10px;'>";
    print "<i>(The double brackets indicate a wiki link.  For example, if you have a page \n\twhose title is \"Introduction\", to make a link to that page, use [[introduction]].)</i>";
    print "<br />For more information, see:" . helplink('wiki');
    print "</div>";
    print "</td></tr>";
    print "</table>";
}
print "<table cellspacing='1' width='100%'>";
print "<tr>";
 }
 //				foreach($editors as $user) {
 for ($i = 0; $i < 3; $i++) {
     print "<td class='td{$color}' align='center'" . ($i == 0 ? "  style='border-left: 2px solid #fff;'" : "") . ">";
     print $pa[type] != 'url' && $pp[$user][$i] ? "X" : "&nbsp;";
     print "</td>";
 }
 //				}
 print "</tr>";
 $color = 1 - $color;
 $stories = decode_array($pa['stories']);
 $j = 1;
 foreach ($stories as $s) {
     print "<tr>";
     $sa = db_get_line("stories", "id='" . addslashes($s) . "'");
     $sp = decode_array($sa[permissions]);
     print "<td class='td{$color}' style='padding-left: 40px'>";
     /*if ($sa[type]=='story')*/
     print "<a href='#' onClick{$nl}='opener.window.location=\"index.php?{$sid}&action=viewsite&site={$site}&section={$sec}&page={$p}\"'>";
     print "{$j}. &nbsp; {$sa['title']}";
     /*if ($sa[type]=='story')*/
     print "</a>";
     //				print "<br /><pre>";print_r($sp);print "</pre>";
     print "</td>";
     //					foreach($editors as $user) {
     print "<td class='td{$color}' align='center'" . (1 ? "  style='border-left: 2px solid #fff;'" : "") . ">n/a</td>";
     for ($i = 1; $i < 3; $i++) {
         print "<td class='td{$color}' align='center'" . ($i == 0 ? "  style='border-left: 2px solid #fff;'" : "") . ">";
         print $sa[type] != 'url' && $sp[$user][$i] ? "X" : "&nbsp;";
         print "</td>";
     }
Exemple #5
0
// the theme and settings are defined in the config.inc.php
if ($theme && !preg_match('/^[a-z_0-9-\\s]+$/', $theme)) {
    die("Error: Invalid theme, can only contain letters and numbers.");
}
if (!$pervasivethemes && in_array($action, $pervasiveActions)) {
    $theme = $programtheme;
    $themesettings = $programthemesettings;
}
// if there isn't any other theme set, use the default theme
if (!$theme) {
    $theme = $defaulttheme;
    $themesettings = $defaultthemesettings;
}
// decode themesettings
if ($themesettings) {
    $themesettings = decode_array($themesettings);
}
//output the HTML
if (!defined("CONFIGS_INCLUDED")) {
    die("Error: improper application flow. Configuration must be included first.");
}
if (!preg_match('/^[a-z_0-9]+$/i', $theme)) {
    die('Error: invalid theme, "' . $theme . '".');
}
include "themes/{$theme}/output.inc.php";
// ------------------
// if register_globals is off, we have to do some hacking to get things to work:
if (!ini_get("register_globals")) {
    $_ign = array("editors", "obj", "settings", "siteObj", "sectionObj", "pageObj", "storyObj", "auser", "lpass", "afname", "aemail", "atype", "amethod", "lmethod", "ltype", "lemail", "lfname", "luser", "lid", "aid", "expand_upcomingclasses", "expand_pastclasses", "expand_editorsites", "expand_othersites", "expand_personalsites", "expand_recentactivity", "discussion_set", "oldversion", "newversion", "html_editor", 'flat_discussion');
    foreach (array_keys($_SESSION) as $n) {
        if (!in_array($n, $_ign)) {
    if ($_SESSION[settings][add]) {
        $_SESSION[siteObj]->addEditor("everyone");
        //We aren't storing the permissions from form 1.
        $_SESSION[siteObj]->addEditor("institute");
        $_SESSION[siteObj]->setUserPermissionDown("view", "everyone", "1");
    }
    if ($_SESSION[settings][edit]) {
        if (!$_SESSION[settings][sitename]) {
            $_SESSION[settings][sitename] = $_REQUEST[edit_site];
            $_SESSION[siteObj]->setSiteName($_REQUEST[edit_site]);
        }
        $_SESSION[siteObj]->fetchDown(1);
        $_SESSION[siteObj]->buildPermissionsArray(0, 1);
        /* ---------------------------------------------------- 
        	 uncomment this line when permissions are set and done */
        $_SESSION[settings][copydownpermissions] = decode_array($_SESSION[settings][copydownpermissions]);
        $_SESSION[settings][site_owner] = $site_owner;
    }
    $_SESSION[siteObj]->initFormDates();
    $dontCheckError = 1;
}
/* ---------------------------------------------------------------------------------------------*/
/*						ERROR CHECKING															*/
if ($_SESSION[settings][step] == 1 && !$dontCheckError) {
    if (!$_SESSION[siteObj]->getField("title") || $_SESSION[siteObj]->getField("title") == '') {
        error("You must enter a site title.");
    }
    if ($_SESSION[siteObj]->getField("name") == "") {
        error("You must enter a name for this site. Sites without names will be broken.");
    }
    if (!ereg("^([0-9A-Za-z_-]*)\$", $_SESSION[siteObj]->getField("name"))) {
function insite($site, $section, $page = 0, $story = 0)
{
    $ok = 1;
    if (!in_array($section, decode_array(db_get_value("sites", "sections", "name='" . addslashes($site) . "'")))) {
        $ok = 0;
    }
    if ($page && !in_array($page, decode_array(db_get_value("sections", "pages", "id='" . addslashes($section) . "'")))) {
        $ok = 0;
    }
    if ($story && !in_array($story, decode_array(db_get_value("pages", "stories", "id='" . addslashes($page) . "'")))) {
        $ok = 0;
    }
    return $ok;
}
Exemple #8
0
function RelatedPostings($tid)
{
    global $tasks_url;
    $result = mysql_query("SELECT related_postings FROM tasks WHERE task_id = {$tid}");
    $related_postings = mysql_result($result, 0, "related_postings");
    echo "<table class='tasks'>\n";
    echo "<tr><td width='100%'><b>Related Topic ID&nbsp;&nbsp;</b>";
    echo "<form action='{$tasks_url}' method='post'>";
    echo "<input type='hidden' name='action' value='add_related_topic'>";
    echo "<input type='hidden' name='task_id' value='{$tid}'>";
    echo "<input type='text' name='related_posting' size='30' class='taskinp1'>&nbsp;&nbsp;";
    echo "<input type='submit' value='Add' class='taskinp2'>\n";
    echo " (Optional)";
    echo "</form>";
    $related_postings = decode_array($related_postings);
    asort($related_postings);
    while (list($key, $val) = each($related_postings)) {
        $row = get_topic_details($val);
        $forum_url = get_url_to_view_forum($row["forum_id"]);
        $topic_url = get_url_to_view_topic($row["topic_id"]);
        echo "<form action='{$tasks_url}' method='post'>";
        echo "<input type='hidden' name='action' value='remove_related_topic'>";
        echo "<input type='hidden' name='task_id' value='{$tid}'>";
        echo "<input type='hidden' name='related_posting' value='" . $row["topic_id"] . "'>";
        echo "<a href='{$forum_url}'>" . $row['forum_name'] . "</a>";
        echo "&nbsp;&raquo;&nbsp;";
        echo "<a href='{$topic_url}'>" . $row['title'] . "</a>";
        echo " (Posted by: " . $row['creator_username'] . " - " . $row['num_replies'] . " replies)\n";
        echo "<input type='submit' value='Remove' class='taskinp2'>\n";
        echo "</form>";
    }
    echo "</td></tr></table>";
}
     log_entry("add_page", "{$_SESSION['auser']} added page id " . $_SESSION[pageObj]->id . " in site " . $_SESSION[pageObj]->owning_site . ", section " . $_SESSION[pageObj]->owning_section, $_SESSION[pageObj]->owning_site, $_SESSION[pageObj]->id, "page");
     //			convertAddNodeLinks($_SESSION[pageObj]->owning_site, $_SESSION[pageObj]->owning_section, $_SESSION[settings][source_story], $_SESSION[settings][source_title], $_SESSION[pageObj]->id, $story=0);
 }
 // do the recursive update of active flag and such... .... ugh
 $_SESSION[settings][permissions] = decode_array($_SESSION[settings][permissions]);
 if ($_SESSION[settings][edit] && ($_SESSION[settings][recursiveenable] || count($_SESSION[settings][copydownpermissions]))) {
     // recursively change the $active or $permissions field for all parts of the site
     $stories = decode_array(db_get_value("pages", "stories", "id='" . addslashes($_SESSION[settings][page]) . "'"));
     foreach ($stories as $s) {
         $sa = db_get_line("stories", "id='" . addslashes($s) . "'");
         $chg = array();
         if ($recursiveenable && permission($_SESSION['auser'], PAGE, EDIT, $p)) {
             $chg[] = "active='" . addslashes($_SESSION[settings][active]) . "'";
         }
         if (count($_SESSION[settings][copydownpermissions]) && $_SESSION['auser'] == $_SESSION[settings][site_owner]) {
             $sp = decode_array($sa['permissions']);
             foreach ($_SESSION[settings][copydownpermissions] as $e) {
                 $sp[$e] = $_SESSION[settings][permissions][$e];
             }
             $sp = encode_array($sp);
             $chg[] = "permissions='" . addslashes($sp) . "'";
         }
         $query = "update stories set " . implode(",", $chg) . " where id='" . addslashes($s) . "'";
         print "--> " . $query . "<br />";
         if (count($chg)) {
             db_query($query);
         }
     }
 }
 header("Location: index.php?{$sid}&action=viewsite&site=" . $thisSite->name . "&section=" . $thisSection->id . ($_SESSION[pageObj]->getField("type") == 'page' ? "&page=" . $_SESSION[pageObj]->id : ""));
 exit;
require_once $include_file;
$confirm_function = "ma_" . $action . "_confirm";
$continue_function = "ma_" . $action . "_continue";
$execute_function = "ma_" . $action . "_execute";
$confirm_function_exists = function_exists($confirm_function);
$continue_function_exists = function_exists($continue_function);
$execute_function_exists = function_exists($execute_function);
$do_page = $do || !$confirm_function_exists;
// action has been confirmed or there is no confirm function
$confirm_page = ($continue || !$continue_function_exists) && !$do_page;
// past the continue page, or no continue function
if ($do_page) {
    // Action has been confirmed OR there is no confirm function
    if ($do) {
        $modids = decode_array($_POST['modids']);
        $post = decode_array($_POST['post']);
    } else {
        $post = $_POST;
    }
    if ($modids) {
        if (!$execute_function_exists) {
            error("Required function '{$execute_function}' does not exist");
        }
        $message = $execute_function($modids, $post);
        rebuild_course_cache($post['courseid']);
        redirect($return_to, $message);
    }
} else {
    $modnames = massaction_get_modnames($modids);
    $string = '';
    // Get the custom string for the chosen action;
Exemple #11
0
 $viewpermissions = $sa[viewpermissions];
 $added = timestamp2usdate($sa[addedtimestamp]);
 $edited = $sa[editedtimestamp];
 $editedby = $sa[editedby];
 print "added by <i>{$addedby}</i> on {$added}" . ($editedby ? ", edited by <i>{$editedby}</i> on " . timestamp2usdate($edited) : "");
 print "</td>";
 print "</tr>";
 if ($sa[type] == 'url') {
     print "<tr><td colspan='5' class='pad'>";
     print "url: <i>{$sa['url']}</i>";
     print "</td></tr>";
 }
 $pages = decode_array($sa[pages]);
 foreach ($pages as $p) {
     $pa = db_get_line("pages", "id='" . addslashes($p) . "'");
     $stories = decode_array($pa[stories]);
     $nums = count($stories);
     $nlocked = 0;
     foreach ($stories as $st) {
         $sta = db_get_line("stories", "id='" . addslashes($st) . "'");
         if ($sta[locked]) {
             $nlocked++;
         }
     }
     print "<tr>";
     print "<td class='pad'><li>{$pa['title']}</td>";
     print "<td>{$pa['type']}</td>";
     print "<td align='center'>" . ($sa[active] ? "yes" : "no") . "</td>";
     print "<td align='center'>" . ($pa[locked] ? "yes" : "no") . "</td>";
     print "<td align='center'>";
     if ($pa[type] == 'page') {