コード例 #1
0
function maintSwitch()
{
    //All date and time values stored in mysql should be in UTC.
    global $debug, $message, $success, $Dbc;
    $output = '';
    try {
        if (MODE == 'setMaintMode') {
            if (empty($_POST['maintModeStartTime']) || empty($_POST['maintModeEndTime'])) {
                $params = array($_SESSION['userId'], null, null);
            } else {
                $maintModeStartTime = Adrlist_Time::localToUtc($_POST['maintModeStartTime'], false);
                $maintModeStartTime = $maintModeStartTime->format('Y-m-d H:i:s');
                $maintModeEndTime = Adrlist_Time::localToUtc($_POST['maintModeEndTime'], false);
                $maintModeEndTime = $maintModeEndTime->format('Y-m-d H:i:s');
                $params = array($_SESSION['userId'], $maintModeStartTime, $maintModeEndTime);
            }
            $stmt = $Dbc->prepare("UPDATE\n\tadminControl\nSET\n\tuserId = ?,\n\tmaintModeStartTime = ?,\n\tmaintModeEndTime = ?");
            $stmt->execute($params);
            $success = true;
            pdoError(__LINE__, $stmt, $params, 0);
            returnData();
        } else {
            $stmt = $Dbc->query("SELECT\n\tmaintModeStartTime AS 'maintModeStartTime',\n\tmaintModeEndTime AS 'maintModeEndTime'\nFROM\n\tadminControl");
            $row = $stmt->fetch(PDO::FETCH_ASSOC);
            $startTimeDisplay = TIMESTAMP > strtotime($row['maintModeStartTime']) ? TIMESTAMP : $row['maintModeStartTime'];
            $startTimeDisplay = Adrlist_Time::utcToLocal($startTimeDisplay, false)->format('F d, Y H:i:s');
            $endTimeDisplay = Adrlist_Time::addToDate(TIMESTAMP, 'hour', 1);
            $endTimeDisplay = TIMESTAMP > strtotime($row['maintModeEndTime']) ? $endTimeDisplay : $row['maintModeEndTime'];
            $endTimeDisplay = Adrlist_Time::utcToLocal($endTimeDisplay, false)->format('F d, Y H:i:s');
            $output .= '			<p>
				Maintenance mode will prevent all non-admin user access to the authorized sections of the site. It is highly recommended that this mode be used to perform updates and changes to the site.
			</p>
			<p>
				Both must be valid dates for maint mode to function. All dates are shown in local time according to your saved timezone setting.
			</p>
			<div class="center textCenter">
				<div class="ui-field-contain">
					<label class="bold" for="maintModeStartTime">Start on</label>
					<input type="text" id="maintModeStartTime" value="' . $startTimeDisplay . '">
				</div>
				<button class="ui-btn ui-btn-inline ui-btn-a ui-shadow ui-corner-all" id="clearMaintModeStartTime">Clear</button>
				<div class="ui-field-contain">
					<label class="bold" for="maintModeEndTime">End on</label>
					<input type="text" id="maintModeEndTime" value="' . $endTimeDisplay . '">
				</div>
				<button class="ui-btn ui-btn-inline ui-btn-a ui-shadow ui-corner-all" id="clearMaintModeEndTime">Clear</button>
				<button class="ui-btn ui-btn-inline ui-btn-a ui-shadow ui-corner-all" id="maintModeSave">Save</button>
			</div>
';
        }
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
        returnData();
    }
    return $output;
}
コード例 #2
0
ファイル: reportMethods.php プロジェクト: mark-orussa/Adrlist
function buildReport()
{
    global $debug, $message, $success, $Dbc;
    try {
        $output = '
	<div class="indent textLeft" id="reportReturn">';
        $Dbc->beginTransaction();
        //Get the user's lists. User must be a list admin or list owner.
        $stmt = $Dbc->prepare("SELECT\n\tcharacters.charId AS 'charId',\n\tcharacters.charName AS 'charName',\n\tCOUNT(DISTINCT characters.charId) AS 'charCount',\n\tCOUNT(linesTable.lineId) AS 'lineCount',\n\tlists.listId AS 'listId',\n\tlists.listName AS 'listName',\n\tlists.created AS 'created'\nFROM\n\tlists\nJOIN\n\t(userListSettings JOIN users ON userListSettings.userId = users.userId) ON userListSettings.listId = lists.listId\nJOIN\n\tlinesTable ON linesTable.listId = lists.listId\nJOIN\n\tuserSiteSettings ON userSiteSettings.listId = lists.listId\nJOIN\n\tcharacters ON characters.charId = linesTable.charId AND\n\t(userListSettings.listRoleId > 2) AND\n\tusers.userId = ? AND\n\tlists.listId = ?");
        $params = array($_SESSION['userId'], $_SESSION['listId']);
        $stmt->execute($params);
        $rowsFound = 0;
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $rowsFound = true;
            $output .= '
	<div class="textCenter" style="padding:10px 0px 0px 0px;">General Info for ' . $row['listName'] . '</div>
	<table class="textCenter" style="width:100%">
		<tr>
			<td class="tdRight">Created:</td>
			<td class="textLeft">' . Adrlist_Time::utcToLocal($row['created']) . '</td>
		</tr>
		<tr>
			<td class="tdRight">Lines:</td>
			<td class="textLeft">' . $row['lineCount'] . '</td>
		</tr>
		<tr>
			<td class="tdRight">Characters:</td>
			<td class="textLeft">' . $row['charCount'] . '</td>
		</tr>
	</table>';
        }
        if (!$rowsFound) {
            $output .= 'There were no lines.';
        }
        $Dbc->commit();
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
        if (MODE == 'buildReport') {
            returnData();
        } else {
            return $output;
        }
    }
    if (MODE == 'buildReport') {
        returnData();
    } else {
        return $output;
    }
}
コード例 #3
0
ファイル: functions.php プロジェクト: mark-orussa/Adrlist
<?php

/* This script and site designed and built by Mark O'Russa, Mark Pro Audio Inc. Copyright 2008-2013.
Functions only here. They are listed in alphabetical order.
*/
$fileInfo = array('fileName' => 'includes/functions.php');
$debug->newFile($fileInfo['fileName']);
if (MODE == 'buildFaqPopupContent') {
    buildFaqPopupContent();
} elseif (MODE == 'buildTimeZones') {
    Adrlist_Time::buildTimeZones();
}
function br2nl($string)
{
    //Convert <br> tags to \n.
    if (is_array($string)) {
        foreach ($string as $key => $value) {
            $value = str_replace('<br>', "", $value);
            $value = str_replace('<br ' . '/>', "", $value);
            //The concatenation is to prevent being replaced from a replace-all action.
        }
    } else {
        $string = str_replace('<br>', "", $string);
        $string = str_replace('<br ' . '/>', "", $string);
        //The concatenation is to prevent being replaced from a replace-all action.
    }
    return $string;
}
function breakEmail($email, $length = 20)
{
    //This will break $email at the @ symbol if it is over $length characters long.
コード例 #4
0
ファイル: payPalMethods.php プロジェクト: mark-orussa/Adrlist
function buildPdtErrors()
{
    global $debug, $message, $success, $Dbc;
    $output = '';
    try {
        $pdtErrorQueryStart = "SELECT\n\tpdtErrorId AS pdtErrorId,\n\ttime AS 'time',\n\terrorMessage AS 'error'\nFROM\n\tpdtError";
        if (isset($_POST['searchVal']) && !empty($_POST['searchVal'])) {
            $search = true;
            $searchVal = '%' . trim($_POST['searchVal']) . '%';
            $debug->add('$searchVal: ' . "{$searchVal}.");
            $pdtErrorQuery = $pdtErrorQueryStart . "\nWHERE\n\tpdtErrorId LIKE ?\nORDER BY\n\tpdtErrorId DESC";
            $pdtErrorStmt = $Dbc->prepare($pdtErrorQuery);
            $pdtErrorParams = array($searchVal);
            $pdtErrorStmt->execute($pdtErrorParams);
        } else {
            $search = false;
            $searchVal = '';
            $pdtErrorQuery = $pdtErrorQueryStart . "\nORDER BY\n\tpdtErrorId DESC";
            $pdtErrorStmt = $Dbc->prepare($pdtErrorQuery);
            $pdtErrorStmt->execute();
        }
        $class = 'rowAlt';
        $foundRows = false;
        $content = '';
        while ($row = $pdtErrorStmt->fetch(PDO::FETCH_ASSOC)) {
            $pdtErrorId = $row['ipnId'];
            if ($class == 'rowWhite') {
                $class = 'rowAlt';
            } else {
                $class = 'rowWhite';
            }
            $time = Adrlist_Time::utcToLocal($row['time']);
            $output .= '
		<div class="break ' . $class . '">
			<div class="absolute" style="line-height:.9em;right:8px">
				<div class="textRight textXsmall">PDT Id: ' . $row[pdtErrorId] . '</div>
				<div class="textRight textSmall">' . $time . '</div>
			</div>
			<div class="row textSmall" style="width:60px">' . $row['tx'] . '</div>
			<div class="textLeft">' . $row['error'] . '</div>
		</div>';
        }
        $success = true;
        $returnThis['returnCode'] = $output;
        if ($foundRows) {
            $output .= '<div class="rowTitle" style="width:60px">tx</div>
			<div class="rowTitle" style="width:300px">Actions</div>' . $content;
        } else {
            $output .= '<div class="break">No PDT errors found.</div>';
        }
        $success = true;
        $returnThis['buildPdtErrors'] = $output;
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
        if (MODE == 'buildPdt') {
            returnData();
        }
    }
    if (MODE == 'buildPdt') {
        returnData();
    } else {
        return $output;
    }
}
コード例 #5
0
function buildAmazonBilling()
{
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        //See if the user has an account.
        $accountCheckCountStmt = "SELECT\n\tCOUNT(*) AS 'count'\nFROM\n\tbillingOffers\nJOIN\n\tuserBilling ON userBilling.billingOfferId = billingOffers.billingOfferId\nJOIN\n\tusers ON users.userId = userBilling.userId\nWHERE\n\tbillingOffers.renewable = 1";
        $accountCheckStmt = "SELECT\n\tuserBilling.userId AS 'userId',\n\t(SELECT CONCAT_WS(' ', users.firstName, users.lastName)) as 'userName',\n\tbillingOffers.billingOfferId AS 'billingOfferId',\n\tbillingOffers.offerName AS 'planName',\n\tbillingOffers.period AS 'period',\n\tuserBilling.dateAdded AS 'dateAdded'\nFROM\n\tbillingOffers\nJOIN\n\tuserBilling ON userBilling.billingOfferId = billingOffers.billingOfferId\nJOIN\n\tusers ON users.userId = userBilling.userId\nWHERE\n\tbillingOffers.renewable = 1";
        if (empty($_POST['searchVal'])) {
            $search = false;
            $accountCheckParams = array();
            $accountCheckCountStmt = $Dbc->prepare($accountCheckCountStmt);
        } else {
            $search = true;
            $searchVal = '%' . trim($_POST['searchVal']) . '%';
            $debug->add('$searchval: ' . $searchVal);
            $endStmt = " AND\n\t(users.firstName LIKE ? || users.lastName LIKE ? || billingOffers.offerName LIKE ?)\n";
            $accountCheckStmt .= $endStmt;
            $accountCheckParams = array($searchVal, $searchVal, $searchVal);
            $accountCheckCountStmt = $Dbc->prepare($accountCheckCountStmt . $endStmt);
        }
        $accountCheckCountStmt->execute($accountCheckParams);
        $count = $accountCheckCountStmt->fetch(PDO::FETCH_ASSOC);
        $itemCount = $count['count'];
        $pagination = new Adrlist_Pagination('buildAmazonBilling', 'buildAmazonBilling', $itemCount, 'Search Billing', $search);
        list($offset, $limit) = $pagination->offsetLimit();
        $accountCheckStmt .= "\nLIMIT {$offset}, {$limit}";
        $accountCheckStmt = $Dbc->prepare($accountCheckStmt);
        $accountCheckStmt->execute($accountCheckParams);
        $userPlans = array();
        $foundRows = false;
        while ($row = $accountCheckStmt->fetch(PDO::FETCH_ASSOC)) {
            $foundRows = true;
            //Add the question to the user's support section.
            if ($row['period'] == 'month') {
                $date = Adrlist_Time::addToDate($row['dateAdded'], $row['period'], 1);
                $row[] = $date = $date->format('Y-m-d');
            } elseif ($row['period'] == 'year') {
                $date = Adrlist_Time::addToDate($row['dateAdded'], $row['period'], 1);
                $row[] = $date = $date->format('Y-m-d');
            }
            $userPlans[] = $row;
        }
        $cssWidths = array(3, 20, 10, 20, 5, 20, 20);
        $titleRowArray = array('userId', 'User', 'billingOfferId', 'Plan Name', 'Period', 'Date Added', 'Next Billing Date');
        $buildRows = new Adrlist_BuildRows($titleRowArray, $userPlans, $cssWidths);
        $output .= '<div>
	<input type="text" style="width:20em" id="billingDate"> Date <span class="buttonBlueThin" id="addMonth">Add a Month</span> <input type="text" id="dateDestination">
</div>' . $pagination->output();
        $output .= $foundRows ? $buildRows->output() : '<div class="textCenter" style="margin:1em">No records were found.</div>';
        if (MODE == 'buildAmazonBilling') {
            $success = true;
            $returnThis['holder'] = 'amazonBillingHolder';
            $returnThis['output'] = $output;
        }
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'buildAmazonBilling') {
        returnData();
    } else {
        return $output;
    }
}
コード例 #6
0
ファイル: Time.php プロジェクト: mark-orussa/Adrlist
    public static function buildTimeZones()
    {
        //Build a drop down list of times every 15 minutes. This function is dependent on date_default_timezone_set('UTC').
        global $debug, $message, $success, $Dbc, $returnThis;
        $output = '';
        try {
            if (empty($_POST['timestampMilliseconds'])) {
                throw new Adrlist_CustomException('', '$_POST[\'timestamp\'] is empty.');
            } elseif (empty($_POST['offsetMinutes'])) {
                throw new Adrlist_CustomException('', '$_POST[\'offsetMinutes\'] is empty.');
            }
            $label = empty($_POST['label']) ? 'Time Zone' : $_POST['label'];
            $jsTimestamp = round(($_POST['timestampMilliseconds'] - $_POST['offsetMinutes'] * 1000 * 60) / 1000);
            $debug->add('$_POST[\'timestampMilliseconds\']: ' . $_POST['timestampMilliseconds'] . '<br>
	$_POST[\'offsetMinutes\']: ' . $_POST['offsetMinutes'] . '<br>
	$jsTimestamp: ' . "{$jsTimestamp}.");
            $now = time();
            $timeZones = DateTimeZone::listIdentifiers();
            $potentialTimeZones = array();
            $allTimeZones = array();
            foreach ($timeZones as $timeZone) {
                //Use the DateTime class to determine the local time for $location.
                $dt = new DateTime('@' . $now);
                //Accepts a strtotime() string.
                $dt->setTimeZone(new DateTimeZone($timeZone));
                //Change to a different timezone.
                //$timestamp = $dt->format('U');
                $formatted = $dt->format('M j, g:i A');
                $timestamp = strtotime($formatted);
                $allTimeZones[$timeZone] = $timestamp . ', ' . $formatted;
                if (abs($timestamp - $jsTimestamp) < 450) {
                    //7 1/2 minutes
                    $potentialTimeZones[] = $timeZone;
                }
            }
            //$debug->printArray($allTimeZones,'$allTimeZones');
            //$debug->printArray($potentialTimeZones,'$potentialTimeZones');
            //If the user is logged in, select their current timezone.
            if (!empty($_SESSION['userId'])) {
                $checkStmt = $Dbc->prepare("SELECT\n\ttimeZone AS 'timeZone'\nFROM\n\tuserSiteSettings\nWHERE\n\tuserId = ?");
                $checkStmt->execute(array($_SESSION['userId']));
                $row = $checkStmt->fetch(PDO::FETCH_ASSOC);
                $selectedTimeZone = $row['timeZone'];
            } else {
                $selectedTimeZone = '';
            }
            $output .= '<div class="ui-field-contain">';
            $output .= '<label for="timeZoneSelect" class="select">' . $label . '</label>
<select name="timeZoneSelect" id="timeZoneSelect" data-mini="false" data-inline="true">';
            foreach ($potentialTimeZones as $timeZone) {
                $output .= '<option value="' . $timeZone . '"';
                if ($selectedTimeZone && $timeZone == $selectedTimeZone) {
                    $output .= ' selected="selected"';
                } elseif ($timeZone == 'America/Los_Angeles') {
                    $output .= ' selected="selected"';
                }
                $output .= '>' . Adrlist_Time::timeZoneDisplay($timeZone) . '</option>';
            }
            $output .= '</select>
</div>';
            $success = true;
            $returnThis['timeZones'] = $output;
        } catch (Adrlist_CustomException $e) {
        } catch (PDOException $e) {
            error(__LINE__, '', '<pre>' . $e . '</pre>');
        }
        if (MODE == 'buildTimeZones') {
            returnData();
        } else {
            return $output;
        }
    }
コード例 #7
0
function saveSettings()
{
    //Save the user's settings.
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        if (empty($_POST['timeZone'])) {
            throw new Adrlist_CustomException('', '$_POST[\'timeZone\'] is empty.');
        } elseif (empty($_POST['dateFormat'])) {
            throw new Adrlist_CustomException('', '$_POST[\'dateFormat\'] is empty.');
        } elseif (!isset($_POST['viewListOnLogin'])) {
            throw new Adrlist_CustomException('', '$_POST[\'viewListOnLogin\'] is not set.');
        } elseif (!isset($_POST['defaultShowCharacterColors'])) {
            throw new Adrlist_CustomException('', '$_POST[\'defaultShowCharacterColors\'] is not set.');
        }
        $debug->add('$_POST[\'dateFormat\']: ' . $_POST['dateFormat'] . '<br>
$_POST[\'viewListOnLogin\']: ' . $_POST['viewListOnLogin'] . '<br>
$_POST[\'defaultShowCharacterColors\']: ' . $_POST['defaultShowCharacterColors']);
        //Get the dateFormat.
        $dateFormatArray = Adrlist_Time::getDateFormats();
        list($dateFormat, $example) = $dateFormatArray[$_POST['dateFormat']];
        $_SESSION['dateFormat'] = $dateFormat;
        $viewListOnLogin = $_POST['viewListOnLogin'] === 'true' ? 1 : 0;
        $defaultShowCharacterColors = $_POST['defaultShowCharacterColors'] === 'true' ? 1 : 0;
        $debug->add('viewListOnLogin: '******'<br>
defaultShowCharacterColors: ' . "{$defaultShowCharacterColors}.");
        $stmt = $Dbc->prepare("UPDATE\n\tuserSiteSettings\nSET\n\ttimeZone = ?,\n\tdateFormatId = ?,\n\tviewListOnLogin = ?,\n\tdefaultShowCharacterColors = ?\nWHERE\n\tuserSiteSettings.userId = ?");
        $params = array($_POST['timeZone'], $_POST['dateFormat'], $viewListOnLogin, $defaultShowCharacterColors, $_SESSION['userId']);
        $stmt->execute($params);
        $message .= 'Saved Settings';
        $success = MODE == 'saveSettings' ? true : $success;
        //It's okay if no lines were updated by these queries.
    } catch (Adrlist_CustomException $e) {
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'saveSettings') {
        returnData();
    }
}
コード例 #8
0
function tcValidateAll()
{
    /*
    Validates an entire list's timecode fields. Builds a new list of lines.
    */
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        //Get the framerate of the current list.
        if (empty($_SESSION['framerate'])) {
            $framerateStmt = $Dbc->prepare("SELECT\n\tframerate AS 'framerate'\nFROM\n\tframerates\nWHERE\n\tfrId = ?");
            $framerateStmt->execute(array($_SESSION['frId']));
            $framerate = $framerateStmt->fetch(PDO::FETCH_ASSOC);
            $framerate = $fpc['framerate'];
        } else {
            $framerate = $_SESSION['framerate'];
        }
        $tcValidateStmt = "SELECT\n\tlinesTable.lineId AS 'lineId',\n\tcharacters.charName AS 'charName',\n\tcharacters.charColor AS 'charColor',\n\tlinesTable.reel AS 'reel',\n\tlinesTable.scene AS 'scene',\n\tlinesTable.tcIn AS 'tcIn',\n\tlinesTable.tcOut AS 'tcOut',\n\tlinesTable.line AS 'line',\n\tlinesTable.notes AS 'notes',\n\tlinesTable.deleted AS 'deleted',\n\tlinesTable.cId AS 'cId',\n\tlinesTable.created AS 'created',\n\tlinesTable.mId AS 'mId',\n\tlinesTable.modified AS 'modified',\n\tlinesTable.dId AS 'dId',\n\tlinesTable.deleted AS 'deleted',\n\tlinesTable.comId AS 'comId',\n\tlinesTable.completed AS 'completed'\nFROM\n\tlinesTable\nJOIN\n\tcharacters ON characters.charId = linesTable.charId AND\n\tlinesTable.listId = ? AND\n\tlinesTable.deleted IS NULL";
        if (empty($_SESSION['orderBy']) || $_SESSION['orderBy'] == 'NULL') {
            $orderBy = 'tcIn';
        } else {
            $pieces = explode(' ', $_SESSION['orderBy']);
            $orderBy = $pieces[0];
        }
        if (!empty($orderBy) && $orderBy != 'NULL') {
            $orderDirection = $_SESSION['orderDirection'];
            if ($orderBy == 'charId') {
                $orderByQuery = "\nORDER BY\n\tcharacters.charName" . $orderDirection;
            } else {
                $orderByQuery = "\nORDER BY LENGTH(linesTable." . $orderBy . ") " . $orderDirection . ", linesTable." . $orderBy . " " . $orderDirection;
            }
        } else {
            if ($orderBy == 'charId') {
                $orderByQuery = "\nORDER BY characters.charName";
            } else {
                $orderByQuery = "\nORDER BY LENGTH(linesTable.tcIn), linesTable.tcIn";
            }
        }
        $tcValidateStmt = $Dbc->prepare($tcValidateStmt . $orderByQuery);
        $tcValidateStmt->execute(array($_SESSION['listId']));
        $selectUsersStmt = $Dbc->prepare("SELECT\n\t(SELECT CONCAT_WS(' ', users.firstName, users.lastName) FROM users WHERE users.userId = ?) AS 'creator',\n\t(SELECT CONCAT_WS(' ', users.firstName, users.lastName) FROM users WHERE users.userId = ?) AS 'modifier',\n\t(SELECT CONCAT_WS(' ', users.firstName, users.lastName) FROM users WHERE users.userId = ?) AS 'deleter',\n\t(SELECT CONCAT_WS(' ', users.firstName, users.lastName) FROM users WHERE users.userId = ?) AS 'recorder'\nFROM\n\tlinesTable\nWHERE\n\tlinesTable.lineId = ?");
        $lineNumbering = 0;
        $foundRows = false;
        $tcBad = false;
        $lines = '<div style="margin-top:4em"></div>';
        $debug->add('Iteration ' . $lineNumbering);
        $framerate = $_SESSION['framerate'];
        while ($row = $tcValidateStmt->fetch(PDO::FETCH_ASSOC)) {
            //Validate the timecode values.
            $tcInValid = true;
            $tcOutValid = true;
            $tcCompareValid = true;
            $tcInFrames = tcToFrames($row['tcIn'], $_SESSION['fps']);
            $tcOutFrames = tcToFrames($row['tcOut'], $_SESSION['fps']);
            $tcInValidate = tcValidate($row['tcIn'], $framerate);
            $tcOutValidate = tcValidate($row['tcOut'], $framerate);
            $tcInParts = explode(':', $row['tcIn']);
            $tcInHours = $tcInParts[0];
            $tcOutParts = explode(':', $row['tcOut']);
            $tcOutHours = $tcOutParts[0];
            $reelHours = intThis($row['reel']);
            $tcValidateMessage = '';
            if (is_numeric($reelHours)) {
                if ($tcInHours != $reelHours) {
                    $tcInValid = false;
                    $debug->add('TC In hours do not match reel hours.', debug_backtrace());
                    $tcValidateMessage .= 'TC In hours do not match reel hours.';
                }
                if ($tcOutHours != $reelHours) {
                    $tcOutValid = false;
                    $debug->add('TC Out hours do not match reel hours.', debug_backtrace());
                    $tcValidateMessage .= ' TC Out hours do not match reel hours.';
                }
            }
            if (empty($row['tcIn'])) {
                $tcInValid = false;
                $debug->add('TC In is empty.', debug_backtrace());
                $tcValidateMessage .= ' TC In is empty.';
            } elseif (!$tcInValidate['success']) {
                $tcInValid = false;
                $debug->add($tcInValidate['tcValidateMessage'], debug_backtrace());
                $tcValidateMessage .= ' TC In ' . $tcInValidate['tcValidateMessage'];
            } elseif (empty($row['tcOut'])) {
                $tcOutValid = false;
                $debug->add('TC Out is empty.', debug_backtrace());
                $tcValidateMessage .= ' TC Out is empty.';
            } elseif (!$tcOutValidate['success']) {
                $tcOutValid = false;
                $debug->add($tcOutValidate['tcValidateMessage'], debug_backtrace());
                $tcValidateMessage .= ' TC Out ' . $tcOutValidate['tcValidateMessage'];
            } elseif ($tcInFrames <= $tcOutFrames) {
                $debug->add('We have success here. $tcInFrames:' . $tcInFrames . ' < $tcOutFrames: ' . $tcOutFrames);
                $tcValidateMessage .= '';
            } else {
                $tcCompareValid = false;
                $debug->add('$tcIn is later than $tcOut. $tcInFrames:' . $tcInFrames . ' < $tcOutFrames: ' . $tcOutFrames, debug_backtrace());
                $tcValidateMessage .= ' TC In is later than TC Out.';
            }
            if (!$tcInValid || !$tcOutValid) {
                $tcBad = true;
                $lineNumbering++;
                if ((bool) $_SESSION['showCharacterColors']) {
                    $bgColor = $row['charColor'];
                } else {
                    if ($bgColor == COLORGRAY) {
                        $bgColor = 'FFFFFF';
                    } else {
                        $bgColor = COLORGRAY;
                    }
                }
                $selectUsersParams = array($row['cId'], $row['mId'], $row['dId'], $row['comId'], $_SESSION['listId']);
                $selectUsersStmt->execute($selectUsersParams);
                $usersRow = $selectUsersStmt->fetch(PDO::FETCH_ASSOC);
                $creator = $usersRow['creator'];
                $modifier = empty($usersRow['modifier']) ? '' : $usersRow['modifier'];
                $deleter = empty($usersRow['deleter']) ? '' : $usersRow['deleter'];
                $recorder = empty($usersRow['recorder']) ? '' : $usersRow['recorder'];
                $lines .= '<table class="lineMain">
			<tr>
		<td class="lineLeft" style="background-color:#' . $bgColor . ';">
			Character:&nbsp;' . $row['charName'] . '
			<table class="textLeft" style="width:100%">
				<tr>
					<td class="textLeft" style="width:50%">Reel:&nbsp;' . $row['reel'] . '</td>
					<td class="textLeft" style="width:50%">Scene:&nbsp;' . $row['scene'] . '</td>
				</tr>
			</table>
			<table class="textLeft">
				<tr>
					<td class="tdRight">TC In:&nbsp;</td>
					<td><input class="tcValidate" id="tcValidateIn' . $row['lineId'] . '" otherfield="tcValidateOut' . $row['lineId'] . '" value="' . $row['tcIn'] . '" style="background-color:#';
                if (!$tcInValid || !$tcCompareValid) {
                    $lines .= 'FFACAC';
                } else {
                    $lines .= 'D4FFAB';
                }
                $lines .= '"></td>
					<td class="textLeft" rowspan="2"><img src="' . LINKIMAGES . '/swap.png" alt="Swap" id="swapvalidate" lineid="' . $row['lineId'] . '" style="height:36px;width:36px"></td>
				</tr>
				<tr>
					<td class="tdRight">TC Out:&nbsp;</td>
					<td><input class="tcValidate" id="tcValidateOut' . $row['lineId'] . '" otherfield="tcValidateIn' . $row['lineId'] . '" value="' . $row['tcOut'] . '" style="background-color:#';
                if (!$tcOutValid || !$tcCompareValid) {
                    $lines .= 'FFACAC';
                } else {
                    $lines .= 'D4FFAB';
                }
                $lines .= '"></td>
				</tr>
			</table>
<div class="red textCenter">' . $tcValidateMessage . '</div>
			<div class="buttonBlueThin textCenter" id="tcValidateSave' . $row['lineId'] . '" lineid="' . $row['lineId'] . '">Save</div>
			<div class="lineHistory">created';
                $lines .= empty($creator) ? '' : ' by ' . $creator;
                $lines .= empty($row['created']) ? '' : ' on ' . Adrlist_Time::utcToLocal($row['created']);
                $lines .= '						<br>';
                if (!empty($modifier) && !empty($row['modified'])) {
                    $lines .= 'modified by ' . $modifier . ' on ' . Adrlist_Time::utcToLocal($row['modified']) . '<br>';
                }
                if (empty($row['deleted']) || $row['deleted'] == '0000-00-00 00:00:00') {
                    $deleted = false;
                } else {
                    $lines .= 'deleted by ' . $deleter . ' on ' . Adrlist_Time::utcToLocal($row['deleted']);
                    $deleted = true;
                }
                if (empty($row['completed']) || $row['completed'] == '0000-00-00 00:00:00') {
                    $completed = false;
                } else {
                    $lines .= 'completed by ' . $recorder . ' on ' . Adrlist_Time::utcToLocal($row['completed']);
                    $completed = true;
                }
                $lines .= '
			</div>
		</td>
		<td style="background-color:#' . $bgColor . ';" class="textLeft top">
			<table class="lineRight">
				<tr>
					<td class="lineCell1">Line:</td>
					<td class="lineCell2">' . nl2br($row['line'], 1) . '</td>
				</tr>
				<tr>
					<td class="lineCell3" rowspan="2">Notes:</td>
					<td class="lineCell4">' . $row['notes'] . '</td>
				</tr>
			</table>
		</td>
		<td class="lineButtonColumn" style="background-color:#';
                if ($completed) {
                    $lines .= 'B1FF99';
                } elseif ($deleted) {
                    $lines .= 'FF7070';
                } else {
                    $lines .= 'EEE';
                }
                $lines .= '">
			<div class="relative">
				<div class="lineCount" style="top:-5px">' . $lineNumbering . '</div>
			</div>
			';
                if (isset($_SESSION['listRoleId']) && $_SESSION['listRoleId'] > 1) {
                    if ($deleted) {
                        $lines .= '	<div>Deleted</div>
			';
                    }
                    if ($completed) {
                        $lines .= '	<div>Completed</div>';
                    }
                }
                $lines .= '				</td>
						</tr>
					</table>
					<div class="relative" id="editLineHolderAfterThis' . $row['lineId'] . '">
						<div class="lineCount" style="bottom:2px">
							Line #' . $row['lineId'] . '
						</div>
					</div>';
            }
        }
        $output .= $tcBad ? $lineNumbering . ' lines have invalid timecode values.' : '';
        $output .= $lines;
        $success = MODE == 'tcValidateAll' ? true : false;
        $returnThis['tcValidateAll'] = $tcBad ? $output : 'All lines have valid timecode.';
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'tcValidateAll') {
        returnData();
    } else {
        return $output;
    }
}
コード例 #9
0
function supportSend()
{
    //Disabled the recaptcha 2014-03-09.
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        $emailValidate = emailValidate($_POST['supportEmail']);
        if (empty($_POST['supportName'])) {
            throw new Adrlist_CustomException('', '$_POST[\'supportName\'] is empty.');
        } elseif ($emailValidate === false) {
            throw new Adrlist_CustomException('', '$_POST[\'supportEmail\'] is not valid.');
        } elseif (empty($_POST['supportMessage'])) {
            throw new Adrlist_CustomException('', '$_POST[\'supportMessage\'] is empty.');
        }
        /*elseif(empty($_POST['recaptcha_challenge_field'])){
        			throw new Adrlist_CustomException('','$_POST[\'recaptcha_challenge_field\'] is empty.');
        		}elseif(empty($_POST['recaptcha_response_field'])){
        			throw new Adrlist_CustomException('','$_POST[\'recaptcha_response_field\'] is empty.');
        		}
        		$resp = recaptcha_check_answer(RECAPTCHAPRIVATEKEY, $_SERVER["REMOTE_ADDR"], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
        		if($resp->is_valid || LOCAL){
        			$debug->add('The recaptcha response is valid.');*/
        //See if the user has an account.
        $accountCheckStmt = $Dbc->prepare("SELECT\n\tuserId AS 'userId'\nFROM\n\tusers\nWHERE\n\tprimaryEmail = ? OR\n\tsecondaryEmail = ?");
        $accountCheckStmt->execute(array($_POST['supportEmail'], $_POST['supportEmail']));
        if ($row = $accountCheckStmt->fetch(PDO::FETCH_ASSOC)) {
            //Add the question to the user's support section.
            $newMessage = new Adrlist_MessageCenter();
            $message .= 'Thank you for contacting us!<br>
<br>
Your message has been received. A response will be sent to the message center.';
            $newMessage->newMessage($row['userId'], 1, 'A message sent from the contact page', $_POST['supportMessage']);
        } else {
            //Send the message.
            $subject = $_POST['supportName'] . ' sent a message to support at ' . THENAMEOFTHESITE . '.';
            $bodyText = 'From: ' . $_POST['supportName'] . ' (' . $_POST['supportEmail'] . ')
Sent on: ' . Adrlist_Time::utcToLocal(false, false)->format('F d, Y H:i:s') . '.';
            $bodyHtml = 'From: ' . $_POST['supportName'] . ' (' . $_POST['supportEmail'] . ')<br>
Sent on: ' . Adrlist_Time::utcToLocal(false, false)->format('F d, Y H:i:s') . '<br>
Mesage:<br>
' . nl2br($_POST['supportMessage']);
            //$fromAddress,$toAddress,$subject,$bodyHtml,$bodyText,$senderAddress = NULL,$returnAddress = NULL
            if (email($_POST['supportEmail'], EMAILSUPPORT, $subject, $bodyHtml, $bodyText, $_POST['supportEmail'])) {
                $message .= 'Thank you for contacting us! We will get back to you as soon as we can.';
                $success = true;
                $debug->add('used the function email(' . $_POST['supportEmail'] . ',' . EMAILSUPPORT . ',$subject,$bodyHtml,$bodyText,' . EMAILSUPPORT);
                $debug->add('$subject:' . $subject . '<br>
$bodyHtml:' . $bodyHtml . '<br>
$bodyText:' . $bodyText);
            } else {
                throw new Adrlist_CustomException('', 'There was a problem trying to send an email.');
            }
        }
        /*}else{
        			//Set the error code so that we can display it.
        			$message .= 'The reCAPTCHA wasn\'t entered correctly. Please enter the new reCAPTCHA.';
        			$debug->add('reCAPTCHA said: ' . $resp->error);
        		}*/
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'supportSend') {
        returnData();
    }
}
コード例 #10
0
ファイル: Billing.php プロジェクト: mark-orussa/Adrlist
 public static function getUserPlan($userId)
 {
     global $debug, $Dbc;
     try {
         if (empty($userId)) {
             throw new Adrlist_CustomException('', '$userId is empty.');
         } elseif (!is_numeric($userId)) {
             throw new Adrlist_CustomException('', '$userId is not numeric.');
         }
         $checkPlansStmt = $Dbc->prepare("SELECT\n\tbillingOffers.billingOfferId AS 'billingOfferId' ,\n\tbillingOffers.offerName AS 'name' ,\n\tbillingOffers.offerType AS 'type',\n\tbillingOffers.terms AS 'terms',\n\tbillingOffers.offerLength AS 'length',\n\tbillingOffers.period AS 'period',\n\tbillingOffers.renewable AS 'renewable',\n\tbillingOffers.credits AS 'credits',\n\tbillingOffers.startDate AS 'startDate',\n\tbillingOffers.endDate AS 'endDate',\n\tuserBilling.userBillingId AS 'userBillingId',\n\tuserBilling.userBillingActionId AS 'userBillingActionId',\n\tuserBilling.dateAdded AS 'dateAdded'\nFROM\n\tbillingOffers\nJOIN\n\tuserBilling ON userBilling.billingOfferId = billingOffers.billingOfferId AND\n\tuserBilling.userId = ?");
         $checkPlansStmt->execute(array($userId));
         $plansCount = 0;
         $credits = 0;
         while ($row = $checkPlansStmt->fetch(PDO::FETCH_ASSOC)) {
             //Check whether the plan or promotion has expired.
             $expires = Adrlist_Time::addToDate($row['dateAdded'], $row['period'], $row['length']);
             $expires = $expires->getTimestamp();
             $validCredit = false;
             if (empty($row['startDate']) && empty($row['endDate'])) {
                 $validCredit = true;
             } else {
                 if (!empty($row['startDate'])) {
                     $validCredit = strtotime($row['startDate']) <= strtotime($row['dateAdded']) ? true : false;
                 }
                 if (!empty($value['endDate'])) {
                     $validCredit = strtotime($row['endDate']) >= strtotime($row['dateAdded']) ? true : false;
                 }
             }
             if (!$row['renewable'] && $expires < TIMESTAMP) {
                 //A non-renewable plan or promotion has expired.
                 $validCredit = false;
             }
             $row['validCredit'] = $validCredit;
             $credits = $validCredit ? $credits + $row['credits'] : $credits;
             $userBillingInfo[] = $row;
             $plansCount++;
         }
         $userBillingInfo['credits'] = $credits;
         if ($plansCount > 1) {
             throw new Adrlist_CustomException('', 'The user has more than one active plan or promotion, which shouldn\'t be possible.');
         }
     } catch (Adrlist_CustomException $e) {
     } catch (PDOException $e) {
         $debug->add('<pre>' . $e . '</pre>');
         error(__LINE__, '', '');
     }
     return empty($userBillingInfo) ? false : $userBillingInfo;
 }
コード例 #11
0
function transferListStep1()
{
    /*
    Builds the transfer list form.
    */
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        if (empty($_POST['listId'])) {
            throw new Adrlist_CustomException('', '$_POST[\'listId\'] is empty.');
        }
        $Dbc->beginTransaction();
        //Get the list info.
        $listInfo = getListInfo($_SESSION['userId'], $_POST['listId']);
        //Verify the user has a sufficient role to transfer the list.
        if ($listInfo === false || $listInfo['listRoleId'] < 4) {
            throw new Adrlist_CustomException('Your role does not allow you to transfer this list.', '');
        }
        //Check for a pending transfer.
        $pendingTransferStmt = $Dbc->prepare("SELECT\n\ttlId AS 'tlId',\n\tfirstName AS 'firstName',\n\tlastName AS 'lastName',\n\tintendedEmail AS 'intendedEmail',\n\ttransferListCode AS 'transferListCode',\n\tlistId AS 'listId',\n\tlistRoleId AS 'listRoleId',\n\tsenderId AS 'senderId',\n\tsentDate AS 'sentDate',\n\trespondDate AS 'respondDate'\nFROM\n\ttransferList\nWHERE\n\tlistId = ?");
        $pendingTransferStmt->execute(array($_POST['listId']));
        $pendingTransfer = $pendingTransferStmt->fetch(PDO::FETCH_ASSOC);
        $debug->printArray($pendingTransfer, '$pendingTransfer');
        if (empty($pendingTransfer)) {
            //Prepare to insert a record.
            $output .= '<div class="myAccountTitle">
	Transfer "' . $listInfo['listName'] . '"
</div>
Enter the email address of the person you want to transfer this list to.
<div class="ui-field-contain">
	<label for="intendedEmail" unused="ui-hidden-accessible">Email</label>
	<input autocapitalize="off" autocorrect="off" autoreset="true" data-wrapper-class="true" id="intendedEmail" goswitch="transferListStep2" name="intendedEmail" placeholder="" value="" type="email">
</div>
<div class="ui-field-contain">
	<label for="intendedEmailRetype" unused="ui-hidden-accessible">Re-enter Email</label>
	<input autocapitalize="off" autocorrect="off" autoreset="true" data-wrapper-class="true" id="intendedEmailRetype" goswitch="transferListStep2" name="intendedEmailRetype" placeholder="" value="" type="email">
</div>
<button class="ui-btn ui-btn-inline ui-shadow ui-corner-all ui-btn-icon-left ui-icon-action" id="transferListStep2" listId="' . $_POST['listId'] . '">Transfer</button>' . cancelButton();
            $success = true;
            $returnThis['transferListStep1'] = $output;
        } else {
            //Show the pending transfer info.
            $output .= '<div class="myAccountTitle">
	Pending Transfer for "' . $listInfo['listName'] . '"
</div>
<div class="columnParent">
	<div class="break">
		<div style="font-weight:none" class="columnLeft">
			Recipient\'s Email Address:
		</div>
		<div class="columnRight">
			' . $pendingTransfer['intendedEmail'] . '
		</div>
	</div>
	<div class="break">
		<div class="columnLeft">
			Transfer Started:
		</div>
		<div class="columnRight">
			' . Adrlist_Time::utcToLocal($pendingTransfer['sentDate']) . '
		</div>
	</div>
</div>
<button class="ui-btn ui-btn-inline ui-shadow ui-corner-all ui-btn-icon-left ui-icon-delete" id="transferListStop" listId="' . $_POST['listId'] . '">Stop Transfer</button>' . cancelButton();
            if (MODE == 'transferListStep1') {
                $success = true;
                $returnThis['transferListStep1'] = $output;
            }
        }
    } catch (Adrlist_CustomException $e) {
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'transferListStep1') {
        returnData();
    }
}
コード例 #12
0
function buildUMLists()
{
    //Build the user management lists section.
    global $debug, $message, $success, $Dbc;
    $message = '';
    try {
        //Get the framerate values.
        $frameratesArray = getFramerates();
        //Get the user's lists and folders with lists.
        //Lists not in folders.
        $buildListsQueryStart = "SELECT\n\tlists.listId AS 'listId',\n\tlists.listName AS 'listName',\n\tlists.frId AS 'frId',\n\tlists.created AS 'listCreated',\n\tlists.modified AS 'listModified'\nFROM\n\tlists";
        //Folders.
        $buildFoldersQueryStart = "SELECT\n\tfolders.folderId AS 'folderId',\n\tfolders.folderName AS 'folderName',\n\tfolders.created AS 'folderCreated',\n\tfolders.modified AS 'folderModified',\n\tDATE_FORMAT(expires, '%M %D, %Y') AS 'expires'\nFROM\n\tfolders";
        if (empty($_POST['searchVal']) && empty($_POST['letters'])) {
            //Search for specific user(s).
            $success = true;
            //Will reset to show no users.
        } else {
            if (empty($_POST['searchVal']) && !empty($_POST['letters'])) {
                $search = false;
                $_POST['letters'] = trim($_POST['letters']);
                $buildListsQuery = $buildListsQueryStart . "\nWHERE\n\tfolderId IS NULL AND\n\tlistName RLIKE ?\nORDER BY\n\tlistName";
                $buildFoldersQuery = $buildFoldersQueryStart . "\nWHERE\n\tfolderName RLIKE ?\nORDER BY\n\tfolderName";
                $listStmt = $Dbc->prepare($buildListsQuery);
                $listParams = array('^[' . $_POST['letters'] . ']');
                $folderStmt = $Dbc->prepare($buildFoldersQuery);
                $folderParams = array('^[' . $_POST['letters'] . ']');
            } elseif (!empty($_POST['searchVal'])) {
                //Search for specific user(s).
                $search = true;
                $searchVal = '%' . trim($_POST['searchVal']) . '%';
                $debug->add('$searchval: ' . $searchVal);
                $buildListsQuery = $buildListsQueryStart . "\nWHERE\n\tfolderId IS NULL AND\n\tlistName LIKE ?\nORDER BY\n\tlistName";
                $buildFoldersQuery = $buildFoldersQueryStart . "\nWHERE\n\tfolderName LIKE ?\nORDER BY\n\tfolderName";
                $listStmt = $Dbc->prepare($buildListsQuery);
                $listParams = array($searchVal);
                $folderStmt = $Dbc->prepare($buildFoldersQuery);
                $folderParams = array($searchVal);
            }
            $listStmt->execute($listParams);
            $folderStmt->execute($folderParams);
            $output = '<div class="sectionTitle textCenter">Lists</div>
<div>
	<span class="textLeft" id="addFolderStep1" onClick=""><img alt="" class="linkPadding middle" src="' . LINKIMAGES . '/addFolder.png" style="height:15px;width:15px;"><span class="link middle">Add Folder</span></span>' . faqLink(30) . '
	<span class="textLeft" id="addListStep1" onClick=""><img alt="" class="linkPadding middle" src="' . LINKIMAGES . '/add.png" style="height:15px;width:15px;"><span class="link middle">Add List</span></span>
</div>
<div class="textLeft">
';
            $output .= '
	<div class="rowTitle" style="min-width:100px;width:30%">
		<div class="row textLeft" style="width:40px;padding:0 0 0 5px;">
			Type
		</div>
		Name
	</div>
	<div class="rowTitle" style="min-width:3em;width:8%">Framerate</div>
	<div class="rowTitle" style="min-width:5em;width:8%">Role' . faqLink(24) . '</div>
	<div class="rowTitle" style="min-width:5em;width:15%">Created</div>
	<div class="rowTitle" style="min-width:5em;width:15%">Modified</div>
	<div class="rowTitle" style="min-width:5em;width:24%"><div class="textRight">Actions' . faqLink(35) . '</div></div>
	<div class="hr2"></div>
';
            $class = 'rowWhite';
            $foundLists = false;
            $foundFolders = false;
            $lists = array();
            while ($row = $listStmt->fetch(PDO::FETCH_ASSOC)) {
                $foundLists = true;
                if (!array_key_exists($row['listId'], $lists)) {
                    $lists[$row['listId']] = array('listName' => $row['listName'], 'frId' => $row['frId'], 'created' => $row['listCreated'], 'modified' => $row['listModified']);
                }
            }
            $folders = array();
            if (empty($searchVal)) {
                while ($foldersRow = $folderStmt->fetch(PDO::FETCH_ASSOC)) {
                    $foundFolders = true;
                    //Get the lists inside the folders.
                    $listsInFoldersStmt = $Dbc->prepare("SELECT\n\tlists.listId AS 'listId',\n\tlists.listName AS 'listName',\n\tlists.frId AS 'frId',\n\tlists.created AS 'listCreated',\n\tlists.modified AS 'listModified'\nFROM\n\tlists\nJOIN\n\tfolders ON folders.folderId = lists.folderId AND\n\tfolders.folderId = ?");
                    $listsInFoldersParams = array($foldersRow['folderId']);
                    $listsInFoldersStmt->execute($listsInFoldersParams);
                    if (!array_key_exists($foldersRow['folderId'], $folders)) {
                        $folders[$foldersRow['folderId']] = array('folderName' => $foldersRow['folderName'], 'created' => $foldersRow['folderCreated'], 'modified' => $foldersRow['folderModified']);
                    }
                    while ($listsInFoldersRow = $listsInFoldersStmt->fetch(PDO::FETCH_ASSOC)) {
                        $foundListsInFolders = true;
                        $folders[$foldersRow['folderId']]['lists'][$listsInFoldersRow['listId']] = array('listName' => $listsInFoldersRow['listName'], 'frId' => $listsInFoldersRow['frId'], 'created' => $listsInFoldersRow['listCreated'], 'modified' => $listsInFoldersRow['listModified']);
                    }
                }
            } else {
                //When searching, if the term is not found in a folder name, then the folder and it's lists will not be included. This prevents lists matching the search term from appearing. We must therefore create an entirely separate query to search for terms in lists inside of folders.
                $listsInFoldersSearchStmt = $Dbc->prepare("SELECT\n\tlists.listId AS 'listId',\n\tlists.listName AS 'listName',\n\tlists.frId AS 'frId',\n\tlists.created AS 'listCreated',\n\tlists.modified AS 'listModified',\n\tfolders.folderId AS 'folderId',\n\tfolders.folderName AS 'folderName',\n\tfolders.created AS 'folderCreated',\n\tfolders.modified AS 'folderModified'\nFROM\n\tlists\nJOIN\n\tfolders ON folders.folderId = lists.folderId AND\n\tlists.listName LIKE ?");
                $debug->add('searching lists in folders.');
                $listsInFoldersSearchParams = array($searchVal);
                $listsInFoldersSearchStmt->execute($listsInFoldersSearchParams);
                while ($listsInFoldersSearchRow = $listsInFoldersSearchStmt->fetch(PDO::FETCH_ASSOC)) {
                    $foundFolders = true;
                    if (!array_key_exists($listsInFoldersSearchRow['folderId'], $folders)) {
                        $folders[$listsInFoldersSearchRow['folderId']] = array('folderName' => $listsInFoldersSearchRow['folderName'], 'folderRoleId' => $listsInFoldersSearchRow['folderRoleId'], 'created' => $listsInFoldersSearchRow['folderCreated'], 'modified' => $listsInFoldersSearchRow['folderModified']);
                    }
                    $folders[$listsInFoldersSearchRow['folderId']]['lists'][$listsInFoldersSearchRow['listId']] = array('listName' => $listsInFoldersSearchRow['listName'], 'listRoleId' => $listsInFoldersSearchRow['listRoleId'], 'frId' => $listsInFoldersSearchRow['frId'], 'created' => $listsInFoldersSearchRow['listCreated'], 'modified' => $listsInFoldersSearchRow['listModified']);
                }
            }
            //$debug->printArray($lists,'$lists');
            $debug->printArray($folders, '$folders');
            /*An nest of arrays:
            			Array $folders:
            array (
              2 => 
              array (
            	'folderName' => 'Junk Food',
            	'folderRoleId' => '3',
            	'modified' => '2012-02-25 11:26:45',
            	'lists' => 
            	array (
            	  9 => 
            	  array (
            		'listName' => '\'63 Comet',
            		'listRoleId' => '3',
            		'modified' => '2012-02-17 13:51:17',
            	  ),
            	  12 => 
            	  array (
            		'listName' => 'The Awesome List2',
            		'listRoleId' => '2',
            		'modified' => '2012-02-25 07:49:32',
            	  ),
            	),
              ),
              14 => 
              array (
            	'folderName' => 'My Super Awesome Folder',
            	'folderRoleId' => '1',
            	'modified' => NULL,
            	'lists' => 
            	array (
            	  '' => 
            	  array (
            		'listName' => NULL,
            		'listRoleId' => NULL,
            		'modified' => NULL,
            	  ),
            	),
              ),
              1 => 
              array (
            	'folderName' => 'Scizors',
            	'folderRoleId' => '1',
            	'modified' => NULL,
            	'lists' => 
            	array (
            	  1 => 
            	  array (
            		'listName' => 'River of Sorrow',
            		'listRoleId' => '2',
            		'modified' => '2011-04-22 07:33:44',
            	  ),
            	  6 => 
            	  array (
            		'listName' => 'Hit List',
            		'listRoleId' => '2',
            		'modified' => '2011-10-04 06:20:19',
            	  ),
            	  4 => 
            	  array (
            		'listName' => 'I AM',
            		'listRoleId' => '2',
            		'modified' => '2010-06-18 23:51:11',
            	  ),
            	  2 => 
            	  array (
            		'listName' => 'Norman',
            		'listRoleId' => '2',
            		'modified' => '2009-08-03 23:12:36',
            	  ),
            	  8 => 
            	  array (
            		'listName' => 'Thunderballs S1E1',
            		'listRoleId' => '2',
            		'modified' => '2011-06-28 20:44:14',
            	  ),
            	  5 => 
            	  array (
            		'listName' => 'Locked Down',
            		'listRoleId' => '2',
            		'modified' => '2012-01-25 09:48:27',
            	  ),
            	  3 => 
            	  array (
            		'listName' => 'Wrong Turn At Tahoe',
            		'listRoleId' => '2',
            		'modified' => '2009-07-27 05:31:23',
            	  ),
            	),
              ),
            )
            		*/
            //Build the lists not in folders.
            foreach ($lists as $listId => $listValues) {
                if ($class == 'rowWhite') {
                    $class = 'rowAlt';
                } else {
                    $class = 'rowWhite';
                }
                $output .= '	<div class="overflowauto relative ' . $class . '">
		<div class="row textLeft" style="min-width:100px;width:30%">
			<div class="row textLeft" style="width:40px;padding:0 0 0 5px;">
				<img alt="" src="' . LINKIMAGES . '/list.png" style="height:15px;width:15px">
			</div>
			<span id="listName' . $listId . '">' . $listValues['listName'] . '</span>
		</div>
		<div class="row" style="min-width:3em;width:8%">' . $frameratesArray[$listValues['frId']] . '</div>
		<div class="row textSmall" style="min-width:5em;width:15%">
			';
                if (empty($listValues['created'])) {
                    $output .= 'n/a';
                } else {
                    $output .= Adrlist_Time::utcToLocal($listValues['created']);
                }
                $output .= '		</div>
		<div class="row textSmall" style="min-width:5em;width:15%">
			';
                if (empty($listValues['modified'])) {
                    $output .= 'n/a';
                } else {
                    $output .= Adrlist_Time::utcToLocal($listValues['modified']);
                }
                $output .= '		</div>
			<div class="bold hand row" id="rowActionsButtonList' . $listId . '" uniqueId="List' . $listId . '" style="min-width:5em;width:24%" onClick="">
				<div class="textRight">
					List Actions <img alt="" class="middle" src="' . LINKIMAGES . '/greenArrowRight.png" style="height:12px;width:12px">
				</div>
			</div>
';
                //The rowActions for lists not in folders.
                $output .= '<div class="hide right" id="rowActionsHolderList' . $listId . '" listId="' . $listId . '" style="background-color:inherit">
			<ul class="textLeft" style="list-style:none;margin:5px 0px">
				<li class="actions" id="editList' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/edit.png" style="height:20px;width:20px;"><span class="linkPadding">Edit</span>
				</li>
				<li class="actions" id="listPropertiesStep1' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/tools.png" style="height:20px;width:20px;"><span class="linkPadding">Properties</span>
				</li>
				<li class="actions" id="buildListUsers' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/charSearch.png" style="height:20px;width:20px;"><span class="linkPadding">Manage Users</span>
				</li>
				<li class="actions" id="transferList' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/transfer.png" style="height:20px;width:20px;"><span class="linkPadding">Transfer</span>
				</li>
				<li class="actions" id="lockListStep1' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/lock.png"  style="height:20px;width:20px;"><span class="linkPadding">Lock</span>
				</li>
				<li class="actions" id="deleteListStep1' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/trash.png"  style="height:20px;width:20px;"><span class="linkPadding">Delete</span>
				</li>
			</ul>
		</div>
	</div>
';
                //End rowActions.
            }
            //End lists not in folders.
            //Build folders.
            foreach ($folders as $folderId => $folderValues) {
                $output .= '	<div class="folderRow" id="rowActionsFolder' . $folderId . '">
		<div class="hand row textLeft" id="toggleFolderLists' . $folderId . '" folderid="' . $folderId . '" onClick="" style="min-width:100px;width:30%">
			<div class="row textLeft" style="width:40px;padding:0 0 0 5px;">
				<img alt="" src="' . LINKIMAGES . '/folder.png" style="height:20px;width:20px"><span><img id="folderListsImg' . $folderId . '" thing="Lists" src="' . LINKIMAGES . '/bulletArrow';
                $output .= $search ? 'Down' : 'Right';
                $output .= '.png" style="height:20px;width:20px;"></span>
			</div>
			<span id="folderName' . $folderId . '">' . $folderValues['folderName'] . '</span>
		</div>
		<div class="row" style="min-width:3em;width:8%"></div>
		<div class="row textSmall" style="min-width:5em;width:15%">
			';
                if (empty($folderValues['created'])) {
                    $output .= 'n/a';
                } else {
                    $output .= Adrlist_Time::utcToLocal($folderValues['created']);
                }
                $output .= '		</div>
		<div class="row textSmall" style="min-width:5em;width:15%">
			';
                if (empty($folderValues['modified'])) {
                    $output .= 'n/a';
                } else {
                    $output .= Adrlist_Time::utcToLocal($folderValues['modified']);
                }
                $output .= '		</div>
			<div class="bold hand row" id="rowActionsButtonFolder' . $folderId . '" onClick="" uniqueId="Folder' . $folderId . '" style="min-width:5em;width:24%">
				<div class="textRight">
					Folder Actions <img alt="" class="middle" id="folderActionsImg' . $folderId . '" src="' . LINKIMAGES . '/greenArrowRight.png" style="height:12px;width:12px"">
				</div>
			</div>
';
                //The folder rowActions.
                $output .= '			<div class="hide right" id="rowActionsHolderFolder' . $folderId . '" style="background-color:inherit">
				<ul class="textLeft" style="list-style:none;margin:5px 0px">
					<li class="actions" id="renameFolderStep1' . $folderId . '" folderid="' . $folderId . '" folderName="' . $folderValues['folderName'] . '" onClick="">
						<img alt="" class="middle" src="' . LINKIMAGES . '/pencil.png" style="height:1.6em;width:1.6em"><span class="linkPadding">Rename</span>
					</li>
					<li class="actions" id="buildFolderUsers' . $folderId . '" folderid="' . $folderId . '" onClick="">
						<img alt="" class="middle" src="' . LINKIMAGES . '/charSearch.png" style="height:1.6em;width:1.6em"><span class="linkPadding">Manage Users</span>
					</li>
					<li class="actions" id="deleteFolder' . $folderId . '" folderid="' . $folderId . '" folderName="' . $folderValues['folderName'] . '" onClick="">
						<img alt="" class="middle" src="' . LINKIMAGES . '/trash.png" style="height:1.6em;width:1.6em"><span class="linkPadding">Delete</span>
					</li>
				</ul>
			</div>
		<div';
                $output .= $search ? '' : ' class="hide"';
                $output .= ' id="folderListsHolder' . $folderId . '">
';
                //The lists in the folder.
                $listCount = 0;
                if (empty($folderValues['lists'])) {
                    $output .= '<div class="break textCenter">There are no lists in this folder.</div>';
                }
                if (array_key_exists('lists', $folderValues)) {
                    foreach ($folderValues['lists'] as $listId => $listValues) {
                        if ($class == 'rowWhite') {
                            $class = 'rowAlt';
                        } else {
                            $class = 'rowWhite';
                        }
                        $output .= '			<div class=" ' . $class . '" id="rowActionsList' . $listId . '">
				<div class="row textLeft" style="min-height:21px;min-width:170px;width:30%">
					<div class="row textLeft" style="width:40px;padding:0 0 0 5px;">
						<img alt="" src="' . LINKIMAGES . '/list.png" style="height:15px;left:5px;width:15px">
					</div>
					<span id="listName' . $listId . '">' . $listValues['listName'] . '</span>
				</div>
				<div class="row" style="min-width:3em;width:8%">' . $frameratesArray[$listValues['frId']] . '</div>
				<div class="row textSmall" style="min-width:5em;width:15%">
			';
                        if (empty($listValues['created'])) {
                            $output .= 'n/a';
                        } else {
                            $output .= Adrlist_Time::utcToLocal($listValues['created']);
                        }
                        $output .= '				</div>
				<div class="row textSmall" style="min-width:5em;width:15%">
			';
                        if (empty($listValues['modified'])) {
                            $output .= 'n/a';
                        } else {
                            $output .= Adrlist_Time::utcToLocal($listValues['modified']);
                        }
                        $output .= '				</div>
				<div class="bold hand row" id="rowActionsButtonList' . $listId . '" uniqueId="List' . $listId . '" style="min-width:5em;width:24%">
					<div class="textRight">
						List Actions <img alt="" class="middle" src="' . LINKIMAGES . '/greenArrowRight.png" style="height:12px;width:12px">
					</div>
				</div>
';
                        //The rowActions for lists in folders.
                        $output .= '<div class="hide right" id="rowActionsHolderList' . $listId . '" style="background-color:inherit">
			<ul class="textLeft" style="list-style:none;margin:5px 0px">
				<li class="actions" id="editList' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/edit.png" style="height:1.6em;width:1.6em;"><span class="linkPadding">Edit</span>
				</li>
				<li class="actions" id="listPropertiesStep1' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/tools.png" style="height:20px;width:20px;"><span class="linkPadding">Properties</span>
				</li>
				<li class="actions" id="buildListUsers' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/charSearch.png" style="height:1.6em;width:1.6em;"><span class="linkPadding">Manage Users</span>
				</li>
				<li class="actions" id="transferListStep1' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/transfer.png" style="height:1.6em;width:1.6em;"><span class="linkPadding">Transfer</span>
				</li>
				<li class="actions" id="lockListStep1' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/lock.png"  style="height:1.6em;width:1.6em;"><span class="linkPadding">Lock</span>
				</li>
				<li class="actions" id="deleteListStep1' . $listId . '" listId="' . $listId . '" onClick="">
					<img alt="" class="middle" src="' . LINKIMAGES . '/trash.png"  style="height:1.6em;width:1.6em;"><span class="linkPadding">Delete</span>
				</li>
			</ul>
		</div>
	</div>
';
                        //End lists in folders.
                    }
                }
                $output .= '		</div>
	</div>
';
                //End folders.
            }
            if (!$foundLists && !$foundFolders) {
                if ($search) {
                    $output .= '<div class="red textCenter" style="padding:5px 0px 10px 0px;">There are no matches for "' . $_POST['searchVal'] . '".</div>';
                } else {
                    $output .= '<div class="textCenter" style="padding:5px 0px 10px 0px;">You are not associated with any folders or lists.</div>';
                }
                pdoError(__LINE__, $listStmt, $listParams, true);
                pdoError(__LINE__, $folderStmt, $folderParams, true);
                if (isset($listsInFoldersStmt)) {
                    pdoError(__LINE__, $listsInFoldersStmt, $listsInFoldersParams, true);
                }
                if (!empty($listsInFoldersSearchStmt)) {
                    pdoError(__LINE__, $listsInFoldersSearchStmt, $listsInFoldersSearchParams, true);
                }
            }
            $output .= '</div>
';
            $success = true;
            $returnThis['buildUMLists'] = $output;
        }
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'buildUMLists') {
        returnData();
    } else {
        return $output;
    }
}