Exemple #1
0
<?php

include 'adminapi.php';
if (isset($_GET['id'])) {
    // this is an update operation
    $id = $_GET['id'];
    $form = findOrgById($id);
}
if ($_POST['submit'] == "delete") {
    header("Location: deleteorg.php?id={$id}");
    return;
}
$form["status"] = $_POST["status"];
$form["seats"] = $_POST["seats"];
if (!isset($_POST['tier'])) {
    $_POST['tier'] = "";
}
$form["tier"] = $_POST["tier"];
$form["comment"] = $_POST["comment"];
if (isset($id)) {
    // this is an update operation
    $pageTitle = "Unable to update Organization";
    if ($_POST["server"] != $form["server"]) {
        // Moving orgs between servers is unsupported
        $pageInfo = "<span style=\"error\">Cannot move orgs</span>";
    } else {
        // update the data base accordingly
        $rs = true;
        if ($_POST["name"] != $form["name"]) {
            // rename the org
            $rs = renameOrg($form["server"], $id, $_POST["name"]);
Exemple #2
0
 <div class="sub_header">
   <p>Screens (active / total): ' . $ahost->ok->activeScreens . ' / ' . $ahost->ok->totalScreens . '</p>
 </div>';
 if (!isset($ahost->ok)) {
     echo '<table cellpadding="0" cellspacing="0">';
     echo '<td><span style="color:red">HOST IS DOWN: ' . (string) $ahost->failed . '</span></td></table>';
     echo '</div>';
 } else {
     echo '<table cellpadding="0" cellspacing="0" class="alternate">
   <tbody>
     <tr>
       <th>Screen</th><th>Application</th><th>Organization</th><th>Forum</th>
     </tr>';
     foreach ($ahost->ok->screen as $screen) {
         $list = explode('/', $screen->description);
         $org = findOrgById($list[1]);
         if (isset($org)) {
             $org = $org['name'];
         } else {
             $org = $list[1];
         }
         echo '<tr>';
         echo '<td>' . $screen->attributes()->number . '</td>';
         echo '<td>' . $screen->name . '</td>';
         echo '<td>' . $org . '</td>';
         echo '<td>' . $list[2] . '</td>';
         echo '</tr>';
     }
     echo '
   </tbody>
 </table>
<?php

include 'propsapi.php';
if (isset($_GET['id'])) {
    $orgid = $_GET['id'];
    $orgForm = findOrgById($orgid);
    $orgLabel = $orgForm['name'];
} else {
    $orgid = '';
    $orgLabel = 'All Organizations';
}
$sections = array("Feature Enablements" => array("EnabledFeatures.AnyUserCanInvite" => "Any User can Invite", "EnabledFeatures.InviteByRole" => "Invitation by role", "EnabledFeatures.WebCam" => "WebCam Input", "EnabledFeatures.PersonalShare" => "Personal Share", "EnabledFeatures.ForumPages" => "Forum Pages", "EnabledFeatures.OfflineUploads" => "Lobby Uploads", "EnabledFeatures.PublicChat" => "Public Text Chat", "EnabledFeatures.PrivateChat" => "Private Text Chat", "EnabledFeatures.SessionRecording" => "Session DVR", "EnabledFeatures.Webcast" => "Webcast", "EnabledFeatures.SecureVideo" => "Secure Video"), "Forum Limits" => array("Limits.MaxForumsPerOrg" => "Max. Number of Forums in Org", "Limits.MaxUsersPerForum" => "Max. Number of Users in Forum", "Limits.MaxAppsPerForum" => "Max. Number of Apps in Forum"), "Jitter Buffer Defaults" => array("SoundQuality.MinJitterBuffer" => "Min Jitter Buffer", "SoundQuality.MaxJitterBuffer" => "Max Jitter Buffer"), "Streaming Video Limits" => array("Limits.StreamingVideoBitrate" => "Max. Bit Rate", "Limits.StreamingVideoWidth" => "Max. Width of Video", "Limits.StreamingVideoHeight" => "Max. Height of Video"));
function makeForumsProperties($id)
{
    global $sections;
    if ($id != '') {
        echo "<form method=\"POST\" action=\"updateprops.php?id={$id}\" class=\"form\">";
    } else {
        echo "<form method=\"POST\" action=\"updateprops.php\" class=\"form\">";
    }
    foreach ($sections as $label => $props) {
        echo "<fieldset><legend>{$label}</legend><ul>";
        $originals = getForumsProperties('', array_keys($props));
        $values = getForumsProperties($id, array_keys($props));
        foreach ($props as $key => $name) {
            $value = $values[$key];
            if ($value == $originals[$key]) {
                echo "<li><label>{$name}</label>";
            } else {
                echo "<li><label><b>{$name}</b></label>";
            }
Exemple #4
0
function deleteOrg($id)
{
    $org = findOrgById($id);
    if (!isset($org)) {
        return;
    }
    if ($org['sfdc'] != "") {
        updateSF('organizations', $id, $org['sfdc']);
        $accounts = findAccountsByOrg($id);
        foreach ($accounts as $account) {
            if ($account['sfdc'] != "") {
                updateSF('org_members', $account['id'], $account['sfdc']);
            }
        }
    }
    $odbc = odbcConnect();
    $stmt = odbc_prepare($odbc, "DELETE FROM org_members WHERE org_id = ?");
    $rs = odbc_execute($stmt, array($id));
    if (!$rs) {
        odbc_close($odbc);
        return false;
    }
    $stmt = odbc_prepare($odbc, "DELETE FROM organizations WHERE id = ?");
    $rs = odbc_execute($stmt, array($id));
    odbc_close($odbc);
    return $rs;
}
Exemple #5
0
<?php

include "serverapi.php";
$user = $_POST["user"];
$password = $_POST["password"];
$group = $_POST["group"];
$orgid = $_POST["orgid"];
$props = array("OpenQwaq.AD.ServerName", "OpenQwaq.AD.BaseDN", "OpenQwaq.AD.ListScript");
$props = getServerConfigProperties("localhost", $props);
$server = $props['OpenQwaq.AD.ServerName'];
$basedn = $props['OpenQwaq.AD.BaseDN'];
$script = $props['OpenQwaq.AD.ListScript'];
$org = findOrgById($orgid);
if (!isset($org)) {
    echo "No organization specified";
    return;
}
var_dump($org);
$command = $script . ' -u ' . escapeshellarg($user) . ' -p ' . escapeshellarg($password) . ' -s ' . escapeshellarg($server) . ' -g ' . escapeshellarg($group);
var_dump($command);
$output = array();
exec($command, $output, $result);
var_dump($output);
if ($result == 0) {
    // parse script response from output
    $response = implode("\n", $output);
} else {
    $response = "<failed>Script failed: Return value: {$result}</failed>";
}
$xml = new SimpleXMLElement($response);
$success = $xml->getName();
Exemple #6
0
function analyzeData($logStart, $logStop)
{
    $forumData = array();
    $orgData = array();
    $userData = array();
    $globalData = newDataSet();
    $meetingPlace = array();
    $odbc = odbcConnect();
    $start = time();
    echo "\nCounting Total Users";
    flush();
    $rs = odbc_exec($odbc, "SELECT count(*) from users");
    $count = odbc_result($rs, 1);
    odbc_close($odbc);
    $globalData["totalUsers"] = $count;
    $where = "WHERE ";
    // NOTE: The comparisons below are carefully chosen.
    // The reporing tool only runs *after* the period it reports on is
    // past, so it never includes the day that the script is executed on
    // In other words, a montly report run on October 1st, needs to report
    // the period starting from (and INCLUDING) Sep 1st through Sep 30st
    // and EXCLUDING Oct 1st.
    //
    // This is counter-intuitive if you want to run the report using -daily
    // since you won't get the stats for today. In order to get the stats
    // for today (which isn't over yet) you need to run the script with
    // tomorrow's date as an argument.
    if ($logStart != "") {
        $where = $where . "date(logdate) >= '{$logStart}' AND ";
    }
    if ($logStop != "") {
        $where = $where . "date(logdate) < '{$logStop}' AND ";
    }
    $odbc = odbcLogConnect();
    // -------------------------------------------------------------
    // Meeting analysis
    // -------------------------------------------------------------
    // First we establish a timeline for all meetings that have
    // happened by collecting enter/leave events for each recorded
    // log event (forumsLogin, forumsLogout, teleport)
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    echo "\nStarting global meeting analysis";
    $count = 0;
    $meetings = array();
    $rs = odbc_exec($odbc, "SELECT * " . "FROM sp_activity_log " . $where . "action in " . "('forumsLogin', 'forumsLogout', 'teleport') ");
    while (odbc_fetch_row($rs)) {
        if ($count % 100 == 0) {
            echo "(" . count($meetings) . ")";
            flush();
        }
        $count = $count + 1;
        $action = odbc_result($rs, "action");
        $user = odbc_result($rs, "user");
        $oid = odbc_result($rs, "org");
        $extra = odbc_result($rs, "extra");
        $date = odbc_result($rs, "logdate");
        $org = findOrgById($oid);
        if (isset($org)) {
            $org = $org["name"];
        } else {
            $org = $oid;
        }
        $forum = $org . "/" . $extra;
        if (!isset($userData[$user])) {
            $userData[$user] = newDataSet();
        }
        if (!isset($orgData[$org])) {
            $orgData[$org] = newDataSet();
        }
        if (!isset($forumData[$forum])) {
            $forumData[$forum] = newDataSet();
        }
        // echo "\n\t$action: $extra ($user)";
        // skip teleport within the same forum
        if ($action == 'teleport' && isset($meetingPlace[$user]) && $meetingPlace[$user] == $forum) {
            // echo " (skipped) ";
            continue;
        }
        if ($action == 'forumsLogin') {
            // Keep a record of the uses being present in the org/global
            $forumData[$forum]["present"][$user] = $user;
            $orgData[$org]["present"][$user] = $user;
            $globalData["present"][$user] = $user;
            // Count the number of logins
            $globalData["logins"] += 1;
            $orgData[$org]["logins"] += 1;
            $userData[$user]["logins"] += 1;
            $forumData[$forum]["logins"] += 1;
            // Update concurrent user count
            $orgData[$org]["maxConcurrentUsers"] = max($orgData[$org]["maxConcurrentUsers"], count($orgData[$org]["present"]));
            $globalData["maxConcurrentUsers"] = max($globalData["maxConcurrentUsers"], count($globalData["present"]));
            $forumData[$forum]["maxConcurrentUsers"] = max($forumData[$forum]["maxConcurrentUsers"], count($forumData[$forum]["present"]));
        }
        if ($action == 'forumsLogout') {
            // Clean out presence info for that user
            unset($orgData[$org]["present"][$user]);
            unset($globalData["present"][$user]);
            unset($forumData[$forum]["present"][$user]);
        }
        if ($action == 'teleport' || $action == 'forumsLogout') {
            // process the last location for this user now
            // that we know where she went after being in her
            // previous meeting place.
            if (isset($meetingPlace[$user])) {
                $meeting = $meetingPlace[$user];
                $meetings[$meeting][] = array("date" => $meetingStart[$user], "type" => "enter", "user" => $user, "org" => $org, "forum" => $extra);
                $meetings[$meeting][] = array("date" => $date, "type" => "leave", "user" => $user, "org" => $org, "forum" => $extra);
            } else {
                // echo "\nFound $action without login: $org/$extra/$user\n";
            }
            unset($meetingStart[$user]);
            unset($meetingPlace[$user]);
        }
        if ($action == 'teleport' || $action == 'forumsLogin') {
            $meetingStart[$user] = $date;
            $meetingPlace[$user] = $forum;
            // Count active forums
            if (isset($globalData["forums"][$forum])) {
                $globalData["forums"][$forum] += 1;
            } else {
                $globalData["forums"][$forum] = 1;
            }
            if (isset($userData[$user]["forums"][$forum])) {
                $userData[$user]["forums"][$forum] += 1;
            } else {
                $userData[$user]["forums"][$forum] = 1;
            }
            if (isset($orgData[$org]["forums"][$forum])) {
                $orgData[$org]["forums"][$forum] += 1;
            } else {
                $orgData[$org]["forums"][$forum] = 1;
            }
        }
    }
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    //
    // Now that we have the events for each meeting do the analysis
    //
    foreach ($meetings as $key => $events) {
        echo "\nAnalyzing Meetings in {$key}";
        usort($events, "sortByDate");
        $usersInForum = array();
        $usersInMeeting = array();
        $maxUsersInForum = 0;
        foreach ($events as $action) {
            $user = $action['user'];
            $org = $action['org'];
            $forum = $action['org'] . "/" . $action["forum"];
            // echo "{$action['type']}: $user / {$action['date']}\n";
            if ($action['type'] == "enter") {
                $usersInForum[$user] = strtotime($action['date']);
                $usersInMeeting[$user] = $usersInForum[$user];
                if (count($usersInForum) == 2) {
                    // meeting starts
                    // update solo time for previous lone user
                    $soloTime = strtotime($action['date']) - $soloStart;
                    // echo "\n\tSolo Time for $user: $soloTime";
                    $userData[$soloUser]['soloTime'] += $soloTime;
                    $orgData[$org]['soloTime'] += $soloTime;
                    $globalData['soloTime'] += $soloTime;
                    $forumData[$forum]['soloTime'] += $soloTime;
                    // set meeting start date
                    $meetingStart = strtotime($action['date']);
                    // update the lone user's meeting start time
                    $usersInForum[$soloUser] = $meetingStart;
                    $usersInMeeting = $usersInForum;
                }
            }
            if ($action['type'] == "leave") {
                if (count($usersInForum) > 1) {
                    // if there is at least one user left,
                    // update meeting time for the user leaving
                    $groupTime = strtotime($action['date']) - $usersInForum[$user];
                    $userData[$user]['groupTime'] += $groupTime;
                }
                unset($usersInForum[$user]);
                if (count($usersInForum) == 1) {
                    // meeting ends, update meeting end date for forum / org
                    $groupTime = strtotime($action['date']) - $meetingStart;
                    // echo "\n\tGroup Time for forum: $groupTime";
                    $globalData['groupTime'] += $groupTime;
                    $globalData['meetingCount'] += 1;
                    $orgData[$org]['groupTime'] += $groupTime;
                    $orgData[$org]['meetingCount'] += 1;
                    $forumData[$forum]['groupTime'] += $groupTime;
                    $forumData[$forum]['meetingCount'] += 1;
                    foreach (array_keys($usersInMeeting) as $user) {
                        $userData[$user]['meetingCount'] += 1;
                    }
                }
                if (count($usersInForum) == 1) {
                    // last user left; count solo time
                    $soloTime = strtotime($action['date']) - $soloStart;
                    // echo "\n\tSolo Time for $user: $soloTime";
                    $forumData[$forum]['soloTime'] += $soloTime;
                    $userData[$user]['soloTime'] += $soloTime;
                    $orgData[$org]['soloTime'] += $soloTime;
                    $globalData['soloTime'] += $soloTime;
                }
            }
            if (count($usersInForum) == 1) {
                // only one user left in forum after event
                // start counting solo time for that user
                $userNames = array_keys($usersInForum);
                $soloUser = $userNames[0];
                $soloStart = strtotime($action['date']);
            }
            // echo "\n\t\t{$action['type']}: ".implode(", ", array_keys($usersInForum));
        }
        echo " - " . (time() - $start) . " secs ";
        $start = time();
    }
    // -------------------------------------------------------------
    // Number of forums created
    // -------------------------------------------------------------
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    echo "\nCounting New Forums";
    flush();
    $rs = odbc_exec($odbc, "SELECT * " . "FROM sp_activity_log " . $where . "action = 'createService'");
    while (odbc_fetch_row($rs)) {
        $user = odbc_result($rs, "user");
        $org = odbc_result($rs, "org");
        $globalData["newForums"] += 1;
        if (!isset($userData[$user])) {
            $userData[$user] = newDataSet();
        }
        if (!isset($orgData[$org])) {
            $orgData[$org] = newDataSet();
        }
        $userData[$user]["newForums"] += 1;
        $orgData[$org]["newForums"] += 1;
    }
    // -------------------------------------------------------------
    // Number and types of apps used
    // -------------------------------------------------------------
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    echo "\nCounting App Launches";
    flush();
    $rs = odbc_exec($odbc, "SELECT * " . "FROM sp_activity_log " . $where . "action = 'launchApp'");
    while (odbc_fetch_row($rs)) {
        $user = odbc_result($rs, "user");
        $oid = odbc_result($rs, "org");
        $org = findOrgById($oid);
        $app = odbc_result($rs, "extra");
        if (isset($org)) {
            $org = $org['name'];
        } else {
            $org = $oid;
        }
        if (!isset($userData[$user])) {
            $userData[$user] = newDataSet();
        }
        if (!isset($orgData[$org])) {
            $orgData[$org] = newDataSet();
        }
        $globalData["appsLaunched"] += 1;
        $userData[$user]["appsLaunched"] += 1;
        $orgData[$org]["appsLaunched"] += 1;
        if (!isset($globalData["apps"][$app])) {
            $globalData["apps"][$app] = 1;
        } else {
            $globalData["apps"][$app] += 1;
        }
        if (!isset($userData[$user]["apps"][$app])) {
            $userData[$user]["apps"][$app] = 1;
        } else {
            $userData[$user]["apps"][$app] += 1;
        }
        if (!isset($orgData[$org]["apps"][$app])) {
            $orgData[$org]["apps"][$app] = 1;
        } else {
            $orgData[$org]["apps"][$app] += 1;
        }
    }
    // -------------------------------------------------------------
    // Forum pages usage
    // -------------------------------------------------------------
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    echo "\nCounting Web Downloads";
    flush();
    $rs = odbc_exec($odbc, "SELECT * " . "FROM sp_activity_log " . $where . "action = 'webActivity' and extra like 'download:%'");
    while (odbc_fetch_row($rs)) {
        $user = odbc_result($rs, "user");
        $oid = odbc_result($rs, "org");
        $org = findOrgById($oid);
        if (isset($org)) {
            $org = $org['name'];
        } else {
            $org = $oid;
        }
        if (!isset($userData[$user])) {
            $userData[$user] = newDataSet();
        }
        if (!isset($orgData[$org])) {
            $orgData[$org] = newDataSet();
        }
        $globalData["webDownloads"] += 1;
        $userData[$user]["webDownloads"] += 1;
        $orgData[$org]["webDownloads"] += 1;
    }
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    echo "\nCounting Web Uploads";
    flush();
    $rs = odbc_exec($odbc, "SELECT * " . "FROM sp_activity_log " . $where . "action = 'upload'");
    while (odbc_fetch_row($rs)) {
        $user = odbc_result($rs, "user");
        $oid = odbc_result($rs, "org");
        $org = findOrgById($oid);
        if (isset($org)) {
            $org = $org['name'];
        } else {
            $org = $oid;
        }
        if (!isset($userData[$user])) {
            $userData[$user] = newDataSet();
        }
        if (!isset($orgData[$org])) {
            $orgData[$org] = newDataSet();
        }
        $globalData["webUploads"] += 1;
        $userData[$user]["webUploads"] += 1;
        $orgData[$org]["webUploads"] += 1;
    }
    echo " - " . (time() - $start) . " secs ";
    $start = time();
    echo "\nCounting QRL Launches";
    flush();
    $rs = odbc_exec($odbc, "SELECT count(*) " . "FROM sp_activity_log " . $where . "action = 'qwq'");
    $count = odbc_result($rs, 1);
    $globalData["Web Launches (QRL)"] = $count;
    odbc_close($odbc);
    $results = array("global" => $globalData, "orgs" => $orgData, "users" => $userData, "forums" => $forumData);
    return $results;
}