Exemplo n.º 1
0
function zpm_postamble($ggame)
{
    if (skip()) {
        return;
    }
    global $zpm_utime;
    $end_t = microtime(true);
    $time_t = floor(($end_t - $zpm_utime) * 1000000);
    $start_t_f = floor($zpm_utime);
    $name = basename($_SERVER['SCRIPT_NAME']);
    if (isset($ggame) && $ggame != "") {
        $name = $ggame . "^" . $name;
    }
    log_entry($name, $time_t, $start_t_f);
    zperfmon_disable();
    $zpm_utime = ZPM_INIT_VAL;
    return;
}
Exemplo n.º 2
0
  * replace specific url with general url
  ******************************************************************************/
 $mod_header = convertInteralLinksToTags($_SESSION[settings][sitename], $_SESSION[siteObj]->getField("header"));
 $mod_footer = convertInteralLinksToTags($_SESSION[settings][sitename], $_SESSION[siteObj]->getField("footer"));
 // Lets pass the cleaning of editor text off to the editor.
 $mod_header = cleanEditorText($mod_header);
 $mod_footer = cleanEditorText($mod_footer);
 $_SESSION[siteObj]->setField("header", $mod_header);
 $_SESSION[siteObj]->setField("footer", $mod_footer);
 if ($_SESSION[settings][add]) {
     $_SESSION[siteObj]->insertDB();
     log_entry("add_site", "{$_SESSION['auser']} added " . $_SESSION[siteObj]->name, $_SESSION[siteObj]->name, $_SESSION[siteObj]->id, "site");
 }
 if ($_SESSION[settings][edit]) {
     $_SESSION[siteObj]->updateDB(1);
     log_entry("edit_site", "{$_SESSION['auser']} edited " . $_SESSION[siteObj]->name, $_SESSION[siteObj]->name, $_SESSION[siteObj]->id, "site");
 }
 /* ----------------------------------------------------- */
 /*   will have to update this to use object-related site copy functions */
 // --- Copy the Template on add ---
 if ($_SESSION[settings][add] && $_SESSION[settings][template] != "") {
     /* 			copySite($_SESSION[settings][template],$_SESSION[siteObj]->getField("name")); */
     $_SESSION[siteObj]->applyTemplate($_SESSION[settings][template]);
 } else {
     if ($_SESSION[settings][add]) {
         /* 			copySite("template0",$_SESSION[siteObj]->getField("name")); */
         $_SESSION[siteObj]->applyTemplate("template0");
     }
 }
 // do recursive enable
 if ($_SESSION[settings][recursiveenable]) {
Exemplo n.º 3
0
function deleteuserfile($fileid)
{
    global $uploaddir, $site, $settings;
    $query = "\n\t\t\tSELECT \n\t\t\t\t* \n\t\t\tFROM \n\t\t\t\tmedia \n\t\t\t\t\tINNER JOIN\n\t\t\t\tslot\n\t\t\t\t\tON\n\t\t\t\tmedia.FK_site = slot.FK_site\n\t\t\tWHERE \n\t\t\t\tmedia_id='" . addslashes($fileid) . "'\n\t";
    $r = db_query($query);
    $a = db_fetch_assoc($r);
    $a[media_tag] = urldecode($a[media_tag]);
    $siteObj =& new site($a[slot_name]);
    $file_path = $uploaddir . "/" . $siteObj->getField("name") . "/" . $a[media_tag];
    //	$file_path = "../segue_userfiles/afranco/close2.gif";
    //	print "file = \"$file_path\" <br />";
    if (file_exists($file_path)) {
        //		$exists = file_exists($file_path);
        //		print "fileexists = $exists $file_path<br /> ";
        $success = unlink($file_path);
        //		print "success = $success <br />";
        if ($success) {
            $query = "DELETE FROM media WHERE media_id='" . addslashes($fileid) . "' LIMIT 1";
            db_query($query);
            log_entry("media_delete", "{$_SESSION['auser']} deleted file: " . $a[media_tag] . ", id: {$fileid}, from site " . $siteObj->getField("name"), $siteObj->name, $siteObj->id, "site");
        } else {
            log_entry("media_error", "Delete failed of file: " . $a[media_tag] . ", id: {$fileid}, from site " . $siteObj->getField("name") . " by " . $_SESSION[auser], $siteObj->name, $siteObj->id, "site");
            error("File could not be Deleted");
        }
    } else {
        log_entry("media_error", "Delete failed of file: " . $a[media_tag] . ", id: {$fileid}, from site " . $siteObj->getField("name") . " by " . $_SESSION[auser] . ". File does not exist. Removed entry.", $siteObj->name, $siteObj->id, "site");
        error("File does not exist. Its Entry was deleted");
        $query = "DELETE FROM media WHERE media_id='" . addslashes($fileid) . "' LIMIT 1";
        db_query($query);
    }
}
Exemplo n.º 4
0
function loginvalid($user, $pass, $alreadyloggedin = 0)
{
    global $_auth_mods;
    // we have two choices in this function. either the user has already logged in
    // or we have to check for them
    if ($alreadyloggedin) {
        //		print "lmethod: $_SESSION['lmethod'] - $_SESSION['luser']<br />";
        if (!$_SESSION[lmethod]) {
            error("An unknown error happened during authentication. Please <a href='index.php?login'>logout</a> and try again. Ignore the error(s) below.");
            return 0;
        }
        $func = "_valid_" . $_SESSION[lmethod];
        /* 		if ($func($user,$pass)) */
        /* 			return 1;		// ok, they passed the test */
        /* 		else */
        /* 			return 0; */
        return 1;
    } else {
        $valid = 0;
        //		$valid = $x = _valid_pam($user,$pass);
        //		print_r($_auth_mods);
        foreach ($_auth_mods as $_auth) {
            $func = "_valid_" . $_auth;
            //			print "<br />AUTH: trying ".$_auth ."..."; //debug
            if ($x = $func($user, $pass)) {
                $valid = 1;
                break;
            }
        }
        //		print "<br />$valid<br />";
        //		print_r($x);
        if ($valid) {
            // register all of the needed variables
            // and send them to the correct page
            // set the acting user variables.. default to same as login -- may change later
            $_SESSION[aid] = $_SESSION[lid] = $x[id];
            $_SESSION[auser] = $_SESSION[luser] = $user;
            //			$_SESSION[lpass] = $pass;
            $_SESSION[afname] = $_SESSION[lfname] = $x[fullname];
            $_SESSION[aemail] = $_SESSION[lemail] = $x[email];
            $_SESSION[atype] = $_SESSION[ltype] = $x[type];
            $_SESSION[amethod] = $_SESSION[lmethod] = $x[method];
            log_entry("login", "{$_SESSION['luser']} authenticated");
            return 1;
        } else {
            return 0;
        }
    }
    return 0;
}
Exemplo n.º 5
0
             log_entry("Possible fraud. Error with receiver_email. " . strtolower(NOCHEX_EMAIL) . " != " . strtolower($To_email));
             $VERIFIED = false;
         }
         // check so that transactrion id cannot be reused
         $sql = "SELECT * FROM transactions WHERE txn_id='{$txn_id}' ";
         $result = mysql_query($sql) or die(mysql_error() . $sql);
         if (mysql_num_rows($result) > 0) {
             nc_mail_error("Possible fraud. Transaction id: {$txn_id} is already in the database. \n");
             log_entry("Possible fraud. Transaction id: {$txn_id} is already in the database.");
             $VERIFIED = false;
         }
         $entry_line = "verified: {$res}";
         log_entry($entry_line);
     } else {
         if (strcmp($res, "DECLINED") == 0) {
             log_entry($entry_line);
             // log for manual investigation
             $VERIFIED = false;
             $payment_status = 'Denied';
         }
     }
 }
 fclose($fp);
 // if VERIFIED=1 process payment
 if ($VERIFIED) {
     switch ($payment_status) {
         case "Completed":
             // Funds successfully transferred
             complete_order($user_id, $order_id);
             debit_transaction($order_id, $amount, 'GBP', $txn_id, $reason, 'NOCHEX');
             break;
Exemplo n.º 6
0
    $thisSite->updateDB();
    /* 	$pages = decode_array(db_get_value("sections","pages","id=$delete_section")); */
    /* 	$query = "delete from sections where id=$delete_section"; */
    /* 	db_query($query); // delete the section entry */
    /* 	$newsections = array(); */
    /* 	foreach($sections as $se) { */
    /* 		if ($se != $delete_section) array_push($newsections, $se); */
    /* 	} */
    /* 	$sections = encode_array($newsections); */
    /* 	$query = "update sites set sections='$sections' where name='$site'"; */
    /* 	db_query($query); // update the sections array in the site entry */
    /* 	 */
    /* 	// now delete all associated pages and stories and discussions */
    /* 	 */
    /* 	foreach ($pages as $p) { */
    /* 		$stories = decode_array(db_get_value("pages","stories","id=$p")); */
    /* 		db_query("delete from pages where id=$p"); */
    /* 		foreach ($stories as $s) { */
    /* 			$type = db_get_value("stories","type","id=$s"); */
    /* 			if ($type == 'file' || $type=='image') */
    /* 				deleteuserfile($s,urldecode(db_get_value("stories","longertext","id=$s"))); */
    /* 			db_query("delete from stories where id=$s"); */
    /* 		} */
    /* 	} */
    /* 	// done; */
    log_entry("delete_section", "{$_SESSION['auser']} deleted section id {$_REQUEST['delete_section']}", $_REQUEST[site], $_REQUEST[site], "site");
} else {
    log_entry("delete_section", "{$_SESSION['auser']} deleting section id {$_REQUEST['delete_section']} failed", $_REQUEST[site], $_REQUEST[delete_section], "section");
}
header("Location: {$PHP_SELF}?{$sid}&site={$_REQUEST['site']}&action=viewsite");
exit;
Exemplo n.º 7
0
<?php

/* $Id$ */
/* $stories = decode_array(db_get_value("pages","stories","id=$page")); */
/*  */
/* print count($stories) . " stories in array<br />"; */
/* print permission($_SESSION['auser'],PAGE,DELETE,$page) . " permission<br />"; */
/* print "$site_owner is the owner. should be ". db_get_value("sites","addedby","name='$site'") ."<br />"; */
if ($thisPage->hasPermission("delete", $_SESSION[auser])) {
    $thisPage->delStory($_REQUEST[delete_story]);
    $thisPage->updateDB();
    /* 	$a = db_get_line("stories","id=$delete_story"); */
    /* 	if ($a[type] != 'story') { */
    /* //		deleteuserfile($delete_story,urldecode($a[longertext])); */
    /* 	} */
    /* 	$query = "delete from stories where id=$delete_story"; */
    /* 	db_query($query); */
    /* 	$newstories = array(); */
    /* 	foreach ($stories as $s) { */
    /* 		if ($s != $delete_story) array_push($newstories,$s); */
    /* 	} */
    /* 	$stories = encode_array($newstories); */
    /* 	$query = "update pages set stories='$stories' where id=$page"; */
    /* 	db_query($query); */
    log_entry("delete_story", "{$_SESSION['auser']} deleted story id {$_REQUEST['delete_story']}", $thisPage->owning_site, $_REQUEST[story], "story");
} else {
    log_entry("delete_story", "{$_SESSION['auser']} deleting story id {$_REQUEST['delete_story']} failed", $thisPage->owning_site, $_REQUEST[story], "story");
}
header("Location: {$PHP_SELF}?{$sid}&site={$_REQUEST['site']}&section={$_REQUEST['section']}&page={$_REQUEST['page']}&action=viewsite");
exit;
Exemplo n.º 8
0
    foreach ($_auth_mods as $_auth) {
        $func = "_valid_" . $_auth;
        //			print "<br />AUTH: trying ".$_auth ."..."; //debug
        if ($x = $func($changeauser, "", 1)) {
            $valid = 1;
            break;
        }
    }
    if ($valid) {
        $_SESSION[auser] = $changeauser;
        $_SESSION[aemail] = $x[email];
        $_SESSION[afname] = $x[fullname];
        $_SESSION[atype] = $x[type];
        $_SESSION[aid] = $x[id];
        $_SESSION[amethod] = $x[method];
        log_entry("change_auser", $_SESSION['luser'] . " as " . $_SESSION['auser']);
        unset($_SESSION["discussion_set"]);
        unset($_SESSION["oldversion"]);
        unset($_SESSION["newversion"]);
        unset($_SESSION["expand_personalsites"]);
        unset($_SESSION["expand_recentactivity"]);
        unset($_SESSION["expand_othersites"]);
        unset($_SESSION["expand_editorsites"]);
        unset($_SESSION["expand_pastclasses"]);
        unset($_SESSION["expand_upcomingclasses"]);
    }
}
//printpre("<p>$_SESSION['aid'], $_SESSION['afname'], $_SESSION['auser'], $_SESSION['aemail'], $_SESSION['atype']<br />");
//exit();
$getVars = "";
foreach ($_GET as $key => $val) {
Exemplo n.º 9
0
     $radioButtonCode .= "<input type=radio name=contactSelect onclick=\"javascript:setContactId('{$row['call_record_id']}','{$found['contactId']}')\" value={$found['contactId']}>&nbsp;&nbsp;<a id=\"astmultcontact\" title=\"{$mouseOverTitle}\" href=\"index.php?module=Contacts&action=DetailView&record={$found['contactId']}\">{$found['contactFullName']}</a><BR>";
     // <a id=\"astmultcompany\" href=\"index.php?module=Accounts&action=DetailView&record={$found['company_id']}\">{$found['company']}</a>
     // In the only 1 matching contact case, we can set the contact_id db column to cut down on doing expensive sql queries to find matching contact.
     if (empty($row['contact_id']) && !$isMultipleContactCase) {
         //$tempContactId = preg_replace('/[^a-z0-9\-\. ]/i', '', $contactRow['contact_id']);
         //$tempCallRecordId = preg_replace('/[^a-z0-9\-\. ]/i', '', $row['call_record_id']);
         //$insertQuery = "UPDATE asterisk_log SET contact_id='$tempContactId' WHERE call_record_id='$tempCallRecordId'";
         //$current_user->db->query($insertQuery, false);
         // This is a special case where a contact record is created after the call started.
         // Such As... Call begins, then user clicks create new contact, call ends...
         $_REQUEST['action'] = 'setContactId';
         $_REQUEST['call_record'] = $row['call_record_id'];
         $_REQUEST['contact_id'] = $contactRow['contact_id'];
         $_REQUEST['id'] = $row['asterisk_id'];
         require_once "custom/modules/Asterisk/include/controller.php";
         log_entry("after_setContactId.... {$isNoMatchingContactCase} ... {$isMultipleContactCase} ... '{$row['contact_id']}' \n", "C:/callListener.log");
     }
 }
 // End while $contactRow
 if ($isMultipleContactCase) {
     $found['contactFullName'] = $mod_strings["ASTERISKLBL_MULTIPLE_MATCHES"];
 }
 // Check OpenCNAM if we don't already have the Company Name in Sugar.
 if (!isset($found['company']) && $sugar_config['asterisk_opencnam_enabled'] == "true") {
     //log_entry("company not set", "c:\callListenerLog.txt");
     if ($row['opencnam'] == NULL) {
         //log_entry("Null in db\n", "c:\callListenerLog.txt");
         $tempCnamResult = opencnam_fetch($phoneToFind);
         $tempCnamResult = preg_replace('/[^a-z0-9\\-\\. ]/i', '', $tempCnamResult);
         $tempCallRecordId = preg_replace('/[^a-z0-9\\-\\. ]/i', '', $row['call_record_id']);
         $cnamUpdateQuery = "UPDATE asterisk_log SET opencnam='{$tempCnamResult}' WHERE call_record_id='{$tempCallRecordId}'";
Exemplo n.º 10
0
 }
 /******************************************************************************
  * Save: calls insertDB and updateDB functions
  ******************************************************************************/
 if ($_SESSION[settings][edit]) {
     $_SESSION[pageObj]->updateDB();
     log_entry("edit_page", "{$_SESSION['auser']} edited page id " . $_SESSION[pageObj]->id . " in site " . $_SESSION[pageObj]->owning_site . ", section " . $_SESSION[pageObj]->owning_section, $_SESSION[pageObj]->owning_site, $_SESSION[pageObj]->id, "page");
     //	$query = "update pages set editedby='$_SESSION['auser']',"; $where = " where id=$_SESSION[settings][page]";
     //		printpre($_REQUEST[location]);
     //	exit();
 }
 if ($_SESSION[settings][add]) {
     // automatically inherit permissions from above;
     $_SESSION[pageObj]->setPermissions($thisSection->getPermissions());
     $_SESSION[pageObj]->insertDB();
     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']);
function print_wrapper($str)
{
    global $is_cli;
    global $ENABLE_LOGGING;
    print $str;
    if ($ENABLE_LOGGING) {
        log_entry($str);
    }
    if (!$is_cli) {
        print "</br>";
    }
}
Exemplo n.º 12
0
 $_SESSION[storyObj]->setField("longertext", $text);
 // check make sure the owner is the current user if they are changing permissions
 /* 		if ($site_owner != $_SESSION[auser]) { */
 /* 			if ($_SESSION[settings][edit]) $_SESSION[storyObj]->buildPermissionsArray(); */
 /* 			else $_SESSION[storyObj]->setPermissions($thisPage->getPermissions()); */
 /* 		} */
 /******************************************************************************
  * Save: calls insertDB and updateDB functions
  ******************************************************************************/
 if ($_SESSION[settings][add]) {
     $_SESSION[storyObj]->insertDB();
     log_entry("add_story", "{$_SESSION['auser']} added content id " . $_SESSION[storyObj]->id . " in site " . $_SESSION[storyObj]->owning_site . ", section " . $_SESSION[storyObj]->owning_section . ", page " . $_SESSION[storyObj]->owning_page, $_SESSION[storyObj]->owning_site, $_SESSION[storyObj]->id, "story");
 }
 if ($_SESSION[settings][edit]) {
     $_SESSION[storyObj]->updateDB();
     log_entry("edit_story", "{$_SESSION['auser']} edited content id " . $_SESSION[storyObj]->id . " in site " . $_SESSION[storyObj]->owning_site . ", section " . $_SESSION[storyObj]->owning_section . ", page " . $_SESSION[storyObj]->owning_page, $_SESSION[storyObj]->owning_site, $_SESSION[storyObj]->id, "story");
 }
 //		$text = recordInternalLinks ($_SESSION[settings][site],$_SESSION[settings][section],$_SESSION[settings][page], $_SESSION[storyObj]->id, $_SESSION[storyObj]->getField("shorttext"));
 //		$text = recordInternalLinks ($_SESSION[settings][site],$_SESSION[settings][section],$_SESSION[settings][page], $_SESSION[storyObj]->id, $_SESSION[storyObj]->getField("longertext"));
 $_SESSION[storyObj]->updatePermissionsDB(TRUE);
 $_SESSION[storyObj]->deletePendingEditors();
 /******************************************************************************
  * If this version is different, then save version to  to version table
  ******************************************************************************/
 //
 // 			$version_short = $_SESSION[storyObj]->getField("shorttext");
 // 			$version_long = $_SESSION[storyObj]->getField("longertext");
 // 			$story_id = $_SESSION[storyObj]->id;
 // 			// printpre($version_short);
 // 			save_version($version_short, $version_long, $story_id);
 /******************************************************************************
Exemplo n.º 13
0
        /******************************************************************************
         * Link section types: replace specific url with general url ($linkpath)
         ******************************************************************************/
        if ($_SESSION[sectionObj]->getField("type") == 'link') {
            $_SESSION[sectionObj]->setField("url", convertInteralLinksToTags($_SESSION[settings][site], $_SESSION[sectionObj]->getField("url")));
        }
        // add the new section id to the sites table
        if ($_SESSION[settings][add]) {
            $_SESSION[sectionObj]->setPermissions($thisSite->getPermissions());
            $_SESSION[sectionObj]->insertDB();
            log_entry("add_section", "{$_SESSION['auser']} added section id " . $_SESSION[sectionObj]->id . " in site " . $_SESSION[sectionObj]->owning_site, $_SESSION[sectionObj]->owning_site, $_SESSION[sectionObj]->id, "section");
            //			convertAddNodeLinks($_SESSION[sectionObj]->owning_site, $_SESSION[sectionObj]->id, $_SESSION[settings][source_story], $_SESSION[settings][source_title], $page=0, $story=0);
        }
        if ($_SESSION[settings][edit]) {
            $_SESSION[sectionObj]->updateDB();
            log_entry("edit_section", "{$_SESSION['auser']} edited section id " . $_SESSION[sectionObj]->id . " in site " . $_SESSION[sectionObj]->owning_site, $_SESSION[sectionObj]->owning_site, $_SESSION[sectionObj]->id, "section");
        }
        header("Location: index.php?{$sid}&action=viewsite&site=" . $_SESSION[sectionObj]->owning_site . ($_SESSION[sectionObj]->getField("type") == 'section' ? "&section=" . $_SESSION[sectionObj]->id : ""));
        exit;
    } else {
        $_SESSION[settings][step] = 1;
    }
}
// ------- print out the add form -------
// --- The Navigation Links for the sidebar ---
$leftlinks = "_________________<br /><table>";
$leftlinks .= "<tr><td>";
if ($_SESSION[settings][step] == 1) {
    $leftlinks .= "&rArr; ";
}
$leftlinks .= "</td><td>";
Exemplo n.º 14
0
function handle_team_registration($bid, $pin, $extra_args = array())
{
    $team_registration = sanitized_team_registration();
    $user = get_user($bid);
    $tid = $user["tid"];
    $team = get_team($tid);
    $team_members = get_team_members($tid);
    // Choose appropriate action to perform.
    if (strcmp($team_registration["teamRegistrationAction"], "remove") == 0) {
        $userToRemove = get_user($team_registration["teamRegistrationBid"]);
        if ($userToRemove != null && $userToRemove["tid"] == $tid) {
            assign_user_to_team($userToRemove["bid"], PASSPORT_NO_TEAM_TID);
            log_entry(LOG_MODE_USER, LOG_USER_ACTION_REMOVE_TEAM_MEMBER, array("actorUid" => $user["uid"], "actorBid" => $user["bid"], "targetUid" => $user_to_add["uid"], "targetBid" => $user_to_add["bid"], "targetTid" => PASSPORT_NO_TEAM_TID, comment => addslashes(serialize($team_registration))));
            $team = get_team($tid);
            $team_members = get_team_members($tid);
            return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "teamMemberJustRemoved" => $user_to_remove, "teamMembers" => $team_members, "team" => $team) + $extra_args);
        }
    } else {
        if (strcmp($team_registration["teamRegistrationAction"], "create") == 0) {
            if (valid_team_name($team_registration["teamName"])) {
                $tid = register_team($team_registration["teamName"], $user["uid"]);
                log_entry(LOG_MODE_USER, LOG_USER_ACTION_CREATE_TEAM, array("actorUid" => $user["uid"], "actorBid" => $user["bid"], "targetTid" => $tid, comment => addslashes(serialize($team_registration))));
                if ($tid == PASSPORT_NO_TEAM_TID) {
                    return array("view" => "team_registration_create", "args" => array("bid" => $bid, "pin" => $pin) + $extra_args);
                }
                assign_user_to_team($bid, $tid);
                log_entry(LOG_MODE_USER, LOG_USER_ACTION_ADD_TEAM_MEMBER, array("actorUid" => $user["uid"], "actorBid" => $user["bid"], "targetUid" => $user["uid"], "targetBid" => $user["bid"], "targetTid" => $tid, comment => addslashes(serialize($team_registration))));
                $team_members = get_team_members($tid);
                $team = get_team($tid);
                return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "teamJustCreated" => true, "teamMembers" => $team_members, "team" => $team) + $extra_args);
            } else {
                return array("view" => "team_registration_create", "args" => array("bid" => $bid, "pin" => $pin, "teamNameInvalid" => true) + $extra_args);
            }
        } else {
            if (strcmp($team_registration["teamRegistrationAction"], "add") == 0) {
                $user = get_user($bid);
                $team = get_team($user["tid"]);
                $team_members = get_team_members($user["tid"]);
                if (count($team_members) < MAX_TEAM_MEMBERS) {
                    if (validate_login($team_registration["teamRegistrationBid"], $team_registration["teamRegistrationPin"])) {
                        $user_to_add = get_user($team_registration["teamRegistrationBid"]);
                        if ($user_to_add["tid"] == PASSPORT_NO_TEAM_TID) {
                            assign_user_to_team($user_to_add["bid"], $tid);
                            log_entry(LOG_MODE_USER, LOG_USER_ACTION_ADD_TEAM_MEMBER, array("actorUid" => $user["uid"], "actorBid" => $user["bid"], "targetUid" => $user_to_add["uid"], "targetBid" => $user_to_add["bid"], "targetTid" => $tid, comment => addslashes(serialize($team_registration))));
                            $team_members = get_team_members($user["tid"]);
                            return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "teamMemberJustAdded" => $user_to_add, "teamMembers" => $team_members, "team" => $team) + $extra_args);
                        } else {
                            return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "alreadyOnTeam" => true, "teamMembers" => $team_members, "team" => $team) + $extra_args);
                        }
                    } else {
                        return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "teamMemberBad" => true, "teamMembers" => $team_members, "team" => $team) + $extra_args);
                    }
                } else {
                    return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "teamFull" => true, "teamMembers" => $team_members, "team" => $team) + $extra_args);
                }
            }
        }
    }
    // No action specified, just need to show the user the current members.
    return array("view" => "team_registration_add", "args" => array("bid" => $bid, "pin" => $pin, "teamMembers" => $team_members, "team" => $team) + $extra_args);
}
Exemplo n.º 15
0
<?php

/* $Id$ */
$pagetitle = "Delete Site";
$s =& new site($_REQUEST['name']);
$s->fetchDown(1);
/* print "<pre>"; print_r($s); print "</pre>"; */
if (sitenamevalid($_REQUEST['name'])) {
    if ($_REQUEST[confirm]) {
        $s->delete();
        log_entry("delete_site", $_SESSION['auser'] . " deleted site " . $_REQUEST['name'], $s->getField("name"), $s->id, "site");
    } else {
        printc("Are you <b>SURE</b> you want to delete the site <i>" . $s->getField("title") . "</i>?? This operation is <b>irreversable</b>. You will <b>never</b> see any of the content of this site again, including all sections, pages, content, and discussions. You better be <b>ABSOLUTELY SURE</b> you want to do this! If so, hit 'Delete'.<br /><br />");
        printc("<form action='{$PHP_SELF}?{$sid}&amp;action=delete_site&amp;name=" . $_REQUEST['name'] . "'><input type='hidden' name='confirm' value='1' />");
        printc("<input type='hidden' name='name' value='" . $_REQUEST['name'] . "' />");
        printc("<input type='hidden' name='action' value='delete_site' />");
        printc("<input type='button' value='&lt;&lt; Back' onclick='history.go(-1)' /> <input type='submit' value='Delete' />");
        printc("</form>");
        /* 		print "<pre>"; print_r($s); print "</pre>"; */
        return;
    }
} else {
    log_entry("delete_site", $_SESSION['auser'] . " deleting site '" . $_REQUEST['name'] . "' failed", $s->getField("name"), $s->id, "site");
}
header("Location: {$PHP_SELF}?{$sid}");
exit;
Exemplo n.º 16
0
function swap_model()
{
    // TODO: sanitize
    $lastname = $_POST["ln"];
    $old_bid = filter_input(INPUT_POST, 'old_bid', FILTER_SANITIZE_NUMBER_INT);
    $new_bid = filter_input(INPUT_POST, 'new_bid', FILTER_SANITIZE_NUMBER_INT);
    if (isset($old_bid) || isset($new_bid)) {
        if (isset($old_bid) && isset($new_bid)) {
            $ouser = get_user($old_bid);
            $nuser = get_user($new_bid);
            if ($ouser != null && $ouser["s"] == PASSPORT_STATE_REGISTERED && $nuser != null && $nuser["s"] == PASSPORT_STATE_UNREGISTERED) {
                swap_passports($old_bid, $new_bid);
                log_entry(LOG_MODE_ADMIN, LOG_ADMIN_ACTION_SWAP_PASSPORT, array("adminUser" => http_authenticated_user(), "targetUid" => $ouser["uid"], "targetBid" => $ouser["bid"], "targetBid2" => $nuser["bid"], "comment" => "Deleted UID: " . $nuser["uid"]));
                return array("view" => "swap", "args" => array("justSwapped" => true, "old_bid" => $old_bid, "new_bid" => $new_bid));
            }
        }
        return array("view" => "swap", "args" => array("matches" => get_users_by_lastname($lastname), "ln" => $lastname, "swapError" => true));
    } else {
        if (isset($lastname)) {
            return array("view" => "swap", "args" => array("matches" => get_users_by_lastname($lastname), "ln" => $lastname));
        }
    }
    return array("view" => "swap", "args" => array());
}
Exemplo n.º 17
0
if ($_REQUEST[copysite] && $_REQUEST[newname] && $_REQUEST[origname]) {
    $newname = $_REQUEST[newname];
    $origSite =& new site($_REQUEST[origname]);
    $origSite->fetchDown(1);
    /******************************************************************************
     * Check to make sure that the slot is not already in use.
     * Hitting refresh after copying a site, will insert a second copy of the site
     * if we don't check for this.
     ******************************************************************************/
    $query = "SELECT FK_site FROM slot WHERE slot_name = '" . addslashes($newname) . "'";
    $r = db_query($query);
    $a = db_fetch_assoc($r);
    if (!$a[FK_site]) {
        $copyDiscussions = $_REQUEST['copy_discussions'] ? TRUE : FALSE;
        $origSite->copySite($newname, TRUE, $copyDiscussions);
        log_entry("copy_site", "{$_SESSION['auser']} copied site " . $origname . " to " . $newname, $newname, $origSite->id, "site");
        // Should maybe be the newsite's id.
    }
}
/******************************************************************************
 * Links to other segue instances
 ******************************************************************************/
if ($allowclasssites != $allowpersonalsites && ($personalsitesurl != "" || $classsitesurl != "")) {
    if ($allowclasssites) {
        add_link(topnav, "Classes");
        add_link(topnav, "Community", "{$personalsitesurl}", '', '', '');
    } else {
        add_link(topnav, "Classes", "{$classsitesurl}", '', '', '');
        add_link(topnav, "Community");
    }
}
Exemplo n.º 18
0
session_start();

include "config/config.php";
include "advantis-functions.php";

// Enable/disable debug

if (isset($_GET["debug"])) {
    $debug = $_GET["debug"];
    $_SESSION["debug"] = $debug;
    $username = $_SESSION['username'];

    if ($debug) {
        debug_msg("Debugging enabled for user $username.");
    } else {
        log_entry("DEBUG: Debugging disabled for user $username.");
    }


} elseif (isset($_SESSION["debug"])) {
    $debug = $_SESSION["debug"];
}


// Get user data for the session
$userId     = $_SESSION['user'];
$userRights = $_SESSION['rights'];

// Output session variables to debug window
#debug_var ("User details",      get_user_name ($userId));
debug_var ("Session variables", $_SESSION);
Exemplo n.º 19
0
/* $pages = decode_array(db_get_value("sections","pages","id=$section")); */
/* $p = new page($_REQUEST[site],$_REQUEST[section],$_REQUEST[delete_page]); */
/* $p->fetchFromDB(); */
if ($thisSection->hasPermission("delete", $_SESSION[auser])) {
    $thisSection->delPage($_REQUEST[delete_page]);
    $thisSection->updateDB();
    /* 	$stories = decode_array(db_get_value("pages","stories","id=$delete_page")); // get stories to delete */
    /* 	$query = "delete from pages where id=$delete_page"; */
    /* 	db_query($query); // delete the story entry */
    /* 	// now remove the entry from the section's pages array */
    /* 	$newpages = array(); */
    /* 	foreach ($pages as $p) { */
    /* 		if ($p != $delete_page) array_push($newpages,$p); */
    /* 	} */
    /* 	$pages = encode_array($newpages); */
    /* 	$query = "update sections set pages='$pages' where id=$section"; */
    /* 	db_query($query); */
    /* 	 */
    /* 	// now delete all of the stories associated with the page */
    /* 	foreach ($stories as $s) { */
    /* 		$type = db_get_value("stories","type","id=$s"); */
    /* 		if ($type == 'file' || $type=='image') */
    /* 			deleteuserfile($s,urldecode(db_get_value("stories","longertext","id=$s"))); */
    /* 		db_query("delete from stories where id=$s"); */
    /* 	} */
    log_entry("delete_page", "{$_SESSION['auser']} deleted page id {$_REQUEST['delete_page']}", $thisSection->owning_site, $_REQUEST[section], "section");
} else {
    log_entry("delete_page", "{$_SESSION['auser']} deleting page id {$_REQUEST['delete_page']} failed", $thisSection->owning_site, $_REQUEST[delete_page], "page");
}
header("Location: {$PHP_SELF}?{$sid}&site={$_REQUEST['site']}&section={$_REQUEST['section']}&action=viewsite");
exit;
Exemplo n.º 20
0
db_connect($dbhost, $dbuser, $dbpass, $dbdb);
if ($del = $_REQUEST[del]) {
    // we're deleting something
    //	print $del;
    if ($del == 'group') {
        $query = "UPDATE class SET FK_classgroup=NULL WHERE FK_classgroup='" . addslashes($_REQUEST['group']) . "'";
        db_query($query);
        $query = "DELETE FROM classgroup WHERE classgroup_id='" . addslashes($_REQUEST['group']) . "'";
        db_query($query);
        log_entry("classgroups", "" . $_SESSION['auser'] . " removed group " . db_get_value("classgroup", "classgroup_name", "classgroup_id='" . addslashes($_REQUEST[group]) . "'"), "NULL", '".addslashes($group)."', "classgroup");
    }
    if ($del == 'class') {
        $query = "UPDATE class SET FK_classgroup=NULL WHERE class_id='" . addslashes($_REQUEST['class']) . "'";
        printpre($query);
        db_query($query);
        log_entry("classgroup", "" . $_SESSION['auser'] . " removed {$class} from group " . db_get_value("classgroup", "classgroup_name", "classgroup_id='" . addslashes($_REQUEST[group]) . "'"), "NULL", $_REQUEST[group], "classgroup");
    }
    print <<<END

<script type='text/javascript'>
// <![CDATA[

\tfunction updater() {
\t\topener.window.location="index.php?{$sid}"; 
\t}

// ]]>
</script>

END;
}
Exemplo n.º 21
0
            if ($_REQUEST['action'] == "COPY" && $parentObj->id == $_SESSION['origSection']) {
                $removeOrigional = 0;
            } else {
                $removeOrigional = 1;
            }
            log_entry($actionlc . "_page", $_SESSION['auser'] . " " . $actionlc . "d page " . $partObj->id . " from site " . $_SESSION['origSite'] . ", section " . $_SESSION['origSection'] . " to site " . $parentObj->owning_site . ", section " . $parentObj->id, $parentObj->owning_site, $parentObj->id, "section");
        } else {
            if ($_SESSION['type'] == "story") {
                $partObj = $_SESSION['origSiteObj']->sections[$_SESSION['origSection']]->pages[$_SESSION['origPage']]->stories[$_SESSION['origStory']];
                $parentObj = $siteObj->sections[$_REQUEST['section']]->pages[$_REQUEST['page']];
                if ($_REQUEST['action'] == "COPY" && $parentObj->id == $_SESSION['origPage']) {
                    $removeOrigional = 0;
                } else {
                    $removeOrigional = 1;
                }
                log_entry($actionlc . "_story", $_SESSION['auser'] . " " . $actionlc . "d story " . $partObj->id . " from site " . $_SESSION['origSite'] . ", section " . $_SESSION['origSection'] . ", page " . $_SESSION['origPage'] . " to site " . $parentObj->owning_site . ", section " . $parentObj->owning_section . ", page " . $parentObj->id, $parentObj->owning_site, $parentObj->id, "story");
            } else {
                print "Major Error!!!!!!!!!!!!!!!!!!!!!!  AHHHHHhhhhhhhh!!!!!!!!!!!!!!!!!!!!";
            }
        }
    }
    // make a copy of the origional to delete later.
    if (version_compare(phpversion(), '5.0') < 0) {
        eval('
function clone($object) {
	return $object;
}
');
    }
    $origPartObj = clone $partObj;
    if ($_REQUEST['site'] == $_SESSION['origSite']) {
Exemplo n.º 22
0
function log_session($operation) {

    // Get user details
    $userId     = $_SESSION['user'];
    $username   = $_SESSION['username'];
    $userIPaddr = $_SERVER['REMOTE_ADDR'];
    $userBrowser= $_SERVER['HTTP_USER_AGENT'];

    if ($operation == "login") {
        if (!$_SESSION['logged']) {

            $_SESSION['logged'] = true;

            $log_entry = "$userIPaddr User logged in id$userId $username [$userBrowser]";

        } // else ignore multiple logins for same user session
    } elseif ($operation == "logout") {
        if ($_SESSION['logged']) {

            $_SESSION['logged'] = false;
            $log_entry = "$userIPaddr User logged out id$userId $username";
        } // else ignore multiple logouts for same user session

    } elseif ($operation == "badlogin") {
        if ($_SESSION['badlogin']) {

            $username = $_SESSION['badlogin'];
            unset ($_SESSION['badlogin']);
        }
        $log_entry = "$userIPaddr Login attempt failed for user ($username)";

    } else {
        $log_entry = "log_session(): Invalid operation $operation";
        debug_msg ($log_entry);
    }

    log_entry ($log_entry);
}