示例#1
0
function insertScore($username, $points)
{
    $position = getPosition($points);
    $connection = dbConnect();
    $username = empty($username) ? null : $username;
    $sql = "INSERT INTO punteggi( utente, punti, posizione ) VALUES(\"" . $username . "\",\"" . $points . "\",\"" . $position . "\")";
    mysql_query($sql) or die("Errore durante la query SQL: " . mysql_error());
    mysql_close($connection);
    printScores($username, $points);
}
示例#2
0
/**
 * Part 2 only
 *
 * @param array   $reindeerList
 * @param integer $stopTime
 *
 * @return mixed
 */
function getScore($reindeerList, $stopTime)
{
    for ($i = 1; $i <= $stopTime; $i++) {
        $positionList = getPosition($reindeerList, $i);
        $max = max($positionList);
        foreach ($positionList as $reindeer => $position) {
            if ($position === $max) {
                if (empty($score[$reindeer])) {
                    $score[$reindeer] = 0;
                }
                $score[$reindeer]++;
            }
        }
    }
    return $score;
}
示例#3
0
     if (argsLen($args, 1)) {
         getAddress($args[0]);
     } else {
         incorrect();
     }
     break;
 case 'getWorksite':
     if (argsLen($args, 1)) {
         getWorksite($args[0]);
     } else {
         incorrect();
     }
     break;
 case 'getPosition':
     if (argsLen($args, 1)) {
         getPosition($args[0]);
     } else {
         incorrect();
     }
     break;
 case 'getFirstName':
     if (argsLen($args, 1)) {
         getFirstName($args[0]);
     } else {
         incorrect();
     }
     break;
 case 'getLastName':
     if (argsLen($args, 1)) {
         getLastName($args[0]);
     } else {
示例#4
0
    }
} elseif ($action == 'edit') {
    S::gp(array('id', 'page'));
    $articleModule = $articleService->getArticleModule($id);
    $userid = $articleModule->userId;
    if (!checkEditPurview($windid, $articleModule->columnId) && $userid != $winduid) {
        Showmsg('你没有权限编辑本栏目的文章');
    }
    if (!$step) {
        if (!$page) {
            $page = 1;
        }
        if (!is_object($articleModule)) {
            Showmsg('文章不存在');
        }
        $pagePosition = getPosition($articleModule->columnId, '', '', $cms_sitename);
        $columnService = C::loadClass('columnservice');
        /* @var $columnService PW_columnService */
        $columns = $columnService->getAllOrderColumns(0, $windid);
        $attach = initAttach($articleModule->attach);
        $postdate = get_date($articleModule->postDate);
        $atc_content = $articleModule->getPageContent($page);
        $articleModule->showError();
        $pages = $articleModule->getPages($page, CMS_BASEURL . 'q=post&action=edit&id=' . $id . '&');
        list($attachAllow, $imageAllow) = initFileTypeInfo($db_uploadfiletype);
        require_once M_P . 'require/header.php';
    } else {
        S::gp(array('cms_subject', 'atc_content', 'cms_descrip'), 'P', 0);
        S::gp(array('cms_sourcetype', 'cms_sourceid', 'cid', 'cms_jumpurl', 'cms_author', 'cms_frominfo', 'cms_fromurl', 'cms_relate', 'flashatt', 'oldatt_desc', 'addnewpage', 'cms_timelimit'));
        $cms_timelimit = $cms_timelimit && (isGM($windid) || checkEditPurview($windid)) ? PwStrtoTime($cms_timelimit) : $timestamp;
        $cms_jumpurl = $cms_jumpurl && (isGM($windid) || checkEditPurview($windid)) ? $cms_jumpurl : '';
示例#5
0
require_once './functions.php';
/*function encrypt($string, $key = '')
{
	if ($key == '') return base64_encode($string);
	$result = '';
	for($i=0; $i<strlen($string); $i++)
	{
		$char = substr($string, $i, 1);
		$keychar = substr($key, ($i % strlen($key))-1, 1);
		$char = chr(ord($char)+ord($keychar));
		$result .= $char;
	}
	return base64_encode($result);
}*/
$treasurerEmail = getPosition("Treasurer")[0];
if (!$CHOIR) {
    die("Choir is not set");
}
if (isset($_POST['emails'])) {
    $emailArr = json_decode($_POST['emails']);
    $amountArr = json_decode($_POST['amounts']);
    $descriptionArr = json_decode($_POST['descriptions']);
    $sendArr = json_decode($_POST['sendEmails']);
    $typeArr = json_decode($_POST['types']);
    $semArr = json_decode($_POST['semesters']);
    $count = 0;
    foreach ($emailArr as $email) {
        if ($email == '') {
            continue;
        }
function loadBlocks($block_ids = '', $settings = array(), $where = '', $parameters = array(), $orderby = '', $return_unique = false)
{
    global $smcFunc;
    if (!empty($block_ids)) {
        $block_ids = !is_array($block_ids) ? array($block_ids) : $block_ids;
    }
    //$where validate and order
    if (!empty($where)) {
        $where = 'AND ' . $where;
    }
    validateOrder($orderby);
    $parameters += array('uno' => 1, 'cero' => 0, 'block_ids' => $block_ids);
    //Set the left join
    $left_join = '';
    if (!empty($parameters['id_template'])) {
        $left_join = '
		INNER JOIN {db_prefix}adk_blocks_template AS t ON (t.id_block = b.id AND t.id_template = {int:id_template})';
    }
    //Let's load all blocks....
    $sql = $smcFunc['db_query']('', '
		SELECT b.id, b.echo, b.name AS title, b.img, b.type, b.empty_body, b.empty_title, 
		b.empty_collapse, b.permissions
		FROM {db_prefix}adk_blocks AS b
		' . $left_join . '
		WHERE 1=1 ' . (!empty($where) ? $where : '') . (!empty($block_ids) ? ' AND id IN ({array_int:block_ids})' : '') . '
		' . $orderby, $parameters);
    //The Misterious array
    $columns = array('left' => '', 'center' => '', 'right' => '', 'bottom' => '', 'top' => '');
    //Set the num_rows
    $num_rows = $smcFunc['db_num_rows']($sql);
    while ($row = $smcFunc['db_fetch_assoc']($sql)) {
        $row['title'] = parse_if_utf8($row['title']);
        $columna = !empty($settings[$row['id']]['columna']) ? $settings[$row['id']]['columna'] : 0;
        $orden = !empty($settings[$row['id']]['orden']) ? $settings[$row['id']]['orden'] : 0;
        //Set the position
        $position = getPosition($columna);
        $columns[$position][] = array('id' => $row['id'], 'echo' => un_htmlspecialchars($row['echo']), 'title' => $row['title'], 'name' => $row['title'], 'orden' => $orden, 'columna' => $columna, 'img' => $row['img'], 'type' => $row['type'], 'b' => $row['empty_body'], 't' => $row['empty_title'], 'c' => $row['empty_collapse'], 'p' => $row['permissions']);
    }
    if ($num_rows == 1 && $return_unique) {
        //Create $one_block variable
        foreach ($columns[$position][0] as $unique_column => $value) {
            $one_block[$unique_column] = $value;
        }
        $columns = $one_block;
    }
    $smcFunc['db_free_result']($sql);
    //Add some information
    $columns += array('num_rows' => $num_rows);
    //Returns as array the columns...
    return $columns;
}
示例#7
0
function test_writePostion()
{
    appendTestMessage(NEW_LINE_LOG . " >> Tests writing of single position..." . NEW_LINE_LOG);
    appendTestMessage("Prepare: Create new user");
    $ret = checkUser("dUser", "dPassword");
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Check parameter lat");
    $ret = writePostion('', '', '', '', '', '', '', '', '', '');
    if (!$ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Check parameter lon");
    $ret = writePostion('', '', '47.50457163540115', '', '', '', '', '', '', '');
    if (!$ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Prepare: Create new user");
    $ret = checkUser("dUser", "dPassword");
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks (individually 1) for user (no positions yet)");
    $ret = getLastPostionsAndTracksIndividually('');
    if (isNullOrEmptyString($ret)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks (individually 2) for user (no positions yet)");
    $ret = getLastPostionsAndTracksIndividually('dUser');
    if (isNullOrEmptyString($ret)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks (individually 3) for user (no positions yet)");
    $ret = getLastPostionsAndTracksIndividually('dUser=2013-03-03 15:48:47.484', 'true');
    if (isNullOrEmptyString($ret)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Test helper function to write the postion.csv > new");
    $ret = writePositionFile('dUser', 'test;test;test');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    $testDateTime = getDateForTimezoneOffset('dUser', '', false);
    appendTestMessage("Write single position");
    $csvLine = 'lat=47.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDateTime;
    $ret = writePositionFile('dUser', $csvLine);
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Write lat and lon");
    $ret = writePostion('dUser', '', '42.50457163540115', '11.071390274487026', '', '', '', '', '2012-03-03T15:48:47.484', 'true');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks (individually 1) for user  (one position yet) no track for today");
    $ret = getLastPostionsAndTracksIndividually('dUser');
    $expectedTracks = '[positions]' . PHP_EOL . 'user=dUser;lat=42.50457163540115;lon=11.071390274487026;time=2012-03-03T15:48:47.484';
    if ($ret == $expectedTracks) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks (individually 2) for user  (one position yet) - track excluded because of time");
    $ret = getLastPostionsAndTracksIndividually('dUser=2012-03-03T15:48:47.4841');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;lat=42.50457163540115;lon=11.071390274487026;time=2012-03-03T15:48:47.484';
    if ($ret == $expectedTracks) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    $testDate = getDateForTimezoneOffset('dUser', '', true);
    appendTestMessage("Write lat and lon");
    $ret = writePostion('dUser', '', '42.50457163540115', '11.071390274487026', '', '', '', '', $testDate . 'T15:48:47.484', 'true');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    $today = getDateForTimezoneOffset('dUser', '', true);
    $gpxFileName = $today . '.csv';
    appendTestMessage("Check for a data file (gpx) for this user");
    $ret = getUsersForDataFileName('dUser', $gpxFileName);
    if ($ret == 'dUser') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // TODO: New
    appendTestMessage("Check for a data file (gpx) for this user. But exclude the user");
    $ret = getUsersForDataFileName('dUser', $gpxFileName, 'dUser');
    if ($ret == '') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("View single position");
    $csvLine0 = 'lat=42.50457163540115;lon=11.071390274487026;time=' . $testDate . 'T15:48:47.484';
    $ret = getPosition('dUser');
    if ($ret === $csvLine0) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("View single position (parameter = getGroupPostions");
    $ret = getGroupPostions('dUser');
    $expectedLine = 'user=dUser;' . $csvLine0;
    if ($ret === $expectedLine) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Write lat and lon");
    $ret = writePostion('dUser', 'cGroup_changed', '43.50457163540115', '11.071390274487026', '171.61432', '0.7065948', '1067.652498529502', '6.0', $testDate . 'T15:48:48.484', 'true');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for user (omit tracks)");
    $ret = getLastPostionsAndTracksIndividually('dUser', 'false');
    $expectedTracks = '[positions]' . PHP_EOL . 'user=dUser;lat=43.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:48:48.484';
    if ($ret == $expectedTracks) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for user (omit tracks)");
    $ret = getLastPostionsAndTracksIndividually('dUser', 'no');
    $expectedTracks = '[positions]' . PHP_EOL . 'user=dUser;lat=43.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:48:48.484';
    if ($ret == $expectedTracks) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for user (two positions yet no last time given)");
    $ret = getLastPostionsAndTracksIndividually('dUser', 'true');
    $expectedTracks = '[positions]' . PHP_EOL . 'user=dUser;lat=43.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:48:48.484' . PHP_EOL . '[track-dUser]' . PHP_EOL . 'lat=42.50457163540115;lon=11.071390274487026;time=' . $testDate . 'T15:48:47.484' . PHP_EOL . 'lat=43.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:48:48.484';
    if ($ret == $expectedTracks) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("View single position");
    $csvLine1 = 'lat=43.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:48:48.484';
    $ret = getPosition('dUser');
    if ($ret === $csvLine1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Write empty multiline positions");
    $ret = writePostions('dUser', 'cGroup_changed', '', 'true');
    if (!$ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Write multiline positions");
    $csvLine2 = 'lat=44.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:41.484';
    $csvLine3 = 'lat=45.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:42.484';
    $csvLine4 = 'lat=46.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:43.484';
    $csvLines2_4 = $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    $csvLines0_4 = $csvLine0 . PHP_EOL . $csvLine1 . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    $ret = writePostions('dUser', 'cGroup_changed', $csvLines2_4, 'true');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("View single position set by multiline writing");
    $ret = getPosition('dUser');
    if ($ret === $csvLine4) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individally for user (five positions yet, last time given)");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:48:48.484');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    if ($ret == $expectedTracks) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("List tracks");
    $ret = listTracks('dUser');
    $expectedFileName = '2012-03-03.gpx';
    if ($ret == $expectedFileName) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("List tracks");
    $ret = listTracksCSV('dUser');
    $expectedFileNames1 = $testDate . '.csv' . PHP_EOL . '2012-03-03.csv';
    $expectedFileNames2 = '2012-03-03.csv' . PHP_EOL . $testDate . '.csv';
    if ($ret === $expectedFileNames1 || $ret === $expectedFileNames2) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get track check empty parameter date");
    $ret = getTrack('dUser', '', '');
    if ($ret === $csvLines0_4) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get track");
    $ret = getTrack('dUser', $today, '');
    if ($ret === $csvLines0_4) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // Review: This test seems to be double, see test somewhere above
    appendTestMessage("Get track after a certain line number only");
    $ret = getTrack('dUser', $today, $testDate . 'T15:48:48.484');
    if ($ret === $csvLines2_4) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get track after a certain line number (at end already)");
    $ret = getTrack('dUser', $today, $testDate . 'T15:54:43.484');
    if ($ret === '') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get postions of group");
    $ret = getPositions('cGroup_changed');
    $expectedString = 'user=dUser;' . $csvLine4;
    if ($ret === $expectedString) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // TODO: New
    appendTestMessage("Get postions of group. But exclude the user dUser");
    $ret = getPositions('cGroup_changed', dUser);
    if ($ret === '') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // Add second user with same group
    appendTestMessage("Prepare: Create new user");
    $ret = checkUser("eUser", "ePassword");
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Check for a data file (gpx) for this user. A second user is in the group but without this file.");
    $ret = getUsersForDataFileName('dUser', $gpxFileName);
    if ($ret == 'dUser') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // TODO: New
    appendTestMessage("Check for a data file (gpx) for this user. AND exclude the user. A second user is in the group but without this file.");
    $ret = getUsersForDataFileName('dUser', $gpxFileName, 'dUser');
    if ($ret == '') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Prepare: Write position new second user with same group");
    $csvLine5 = 'lat=47.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:43.484';
    $ret = writePostions('eUser', 'cGroup_changed', $csvLine5, 'true');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Check for a data file (gpx) for this user. A second user is in the group now.");
    $ret = getUsersForDataFileName('dUser', $gpxFileName);
    $expectedUsers = 'dUser' . PHP_EOL . 'eUser';
    $expectedUsers1 = 'eUser' . PHP_EOL . 'dUser';
    if ($ret == $expectedUsers || $ret == $expectedUsers1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // TODO: New
    appendTestMessage("Check for a data file (gpx) for this user. But exclude the user. A second user is in the group now.");
    $ret = getUsersForDataFileName('dUser', $gpxFileName, 'dUser');
    $expectedUsers = 'eUser';
    if ($ret == $expectedUsers) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get postions of the two members of the group");
    $ret = getPositions('cGroup_changed');
    $expectedPostions = 'user=dUser;' . $csvLine4 . PHP_EOL . 'user=eUser;' . $csvLine5;
    $expectedPostions1 = 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine4;
    if ($ret === $expectedPostions || $ret === $expectedPostions1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // TODO: New
    appendTestMessage("Get postions of the two members of the group. Exclude user eUser");
    $ret = getPositions('cGroup_changed', 'eUser');
    $expectedPostions = 'user=dUser;' . $csvLine4;
    if ($ret === $expectedPostions) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users (last time given - 1)");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:48:48.484');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users (last line given - 2)");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:48:48.484;eUser');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users (last line given - 3)");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:48:48.484;eUser='******'T15:54:42.484');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users (last line given - 4)");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:48:48.484;eUser='******'T15:54:43.484');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users (last line given - 5)");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:54:43.484' . ';eUser='******'T15:54:43.484');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine4 . PHP_EOL . 'user=eUser;' . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine4;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get postions of the two members of the group (param = getGroupPostions");
    $ret = getGroupPostions('dUser');
    if ($ret === $expectedPostions || $ret === $expectedPostions1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Util: write some csv files to create gpx (later)");
    if (test_writeGpxFromCsv()) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Create gpx from csv and list. Check eUser");
    $ret = listTracks('eUser');
    $expected1 = "2013-03-10.gpx" . PHP_EOL . "2013-03-11.gpx";
    $expected2 = "2013-03-11.gpx" . PHP_EOL . "2013-03-10.gpx";
    if ($ret == $expected1 || $ret == $expected2) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Create gpx from csv and list. Check dUser");
    $ret = listTracks('dUser');
    $expected1 = "2013-03-10.gpx" . PHP_EOL . "2012-03-03.gpx";
    $expected2 = "2012-03-03.gpx" . PHP_EOL . "2013-03-10.gpx";
    if ($ret == $expected1 || $ret == $expected2) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Write multiline positions with different dates");
    $csvLine6 = 'lat=44.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=2012-04-03T15:54:41.484';
    $csvLine7 = 'lat=45.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:44.484';
    $csvLine8 = 'lat=46.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:45.484';
    $csvLines6_8 = $csvLine6 . PHP_EOL . $csvLine7 . PHP_EOL . $csvLine8;
    $csvLines0_8_dUser = $csvLine0 . PHP_EOL . $csvLine1 . PHP_EOL . $csvLine2 . PHP_EOL . $csvLine3 . PHP_EOL . $csvLine4 . PHP_EOL . $csvLine7 . PHP_EOL . $csvLine8;
    $ret = writePostions('dUser', 'cGroup_changed', $csvLines6_8, 'true');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users all lines");
    $ret = getLastPostionsAndTracksIndividually('dUser;eUser');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine8 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLines0_8_dUser . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine8 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLines0_8_dUser;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users all lines");
    $ret = getLastPostionsAndTracksIndividually('dUser='******'T15:54:44.484;eUser');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine8 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine8 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine8 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLine8;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("List tracks");
    $ret = listTracksCSV('dUser');
    $expectedFileNames1 = $testDate . '.csv' . PHP_EOL . '2012-03-03.csv' . PHP_EOL . '2012-04-03.csv' . PHP_EOL . '2013-03-10.csv';
    $searchString = '/' . $testDate . '.csv/i';
    if (preg_match($searchString, $ret, $matches)) {
        $foundTime = $matches[0];
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    $searchString = '/2012-03-03.csv/i';
    if (preg_match($searchString, $ret, $matches)) {
        $foundTime = $matches[0];
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    $searchString = '/2012-04-03.csv/i';
    if (preg_match($searchString, $ret, $matches)) {
        $foundTime = $matches[0];
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    $searchString = '/2013-03-10.csv/i';
    if (preg_match($searchString, $ret, $matches)) {
        $foundTime = $matches[0];
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Write multiline positions with different dates and track not stored");
    $csvLine6 = 'lat=44.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=2012-04-03T15:54:41.484';
    $csvLine7 = 'lat=45.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:44.484';
    $csvLine8 = 'lat=46.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:45.484';
    $csvLine9 = 'lat=46.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=' . $testDate . 'T15:54:46.484';
    $csvLines6_9 = $csvLine6 . PHP_EOL . $csvLine7 . PHP_EOL . $csvLine8 . PHP_EOL . $csvLine9;
    $ret = writePostions('dUser', 'cGroup_changed', $csvLines6_9, 'false');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get tracks individually for 2 users all lines");
    $ret = getLastPostionsAndTracksIndividually('dUser;eUser');
    $expectedTracks = "[positions]" . PHP_EOL . 'user=dUser;' . $csvLine9 . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLines0_8_dUser . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5;
    $expectedTracks1 = "[positions]" . PHP_EOL . 'user=eUser;' . $csvLine5 . PHP_EOL . 'user=dUser;' . $csvLine9 . PHP_EOL . '[track-eUser]' . PHP_EOL . $csvLine5 . PHP_EOL . '[track-dUser]' . PHP_EOL . $csvLines0_8_dUser;
    if ($ret == $expectedTracks || $ret == $expectedTracks1) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    return true;
}
示例#8
0
}
// Get the position of all users belonging to the group of this user of a user
$getGroupPositionsForUser = getParam('getGroupPostions');
if (!isNullOrEmptyString($getGroupPositionsForUser)) {
    $currentPositions = getGroupPostions($user);
    if (isNullOrEmptyString($currentPositions)) {
        setServerError("Failed to get group postions for user {$user}.");
        return;
    }
    setServerResponse($currentPositions);
    return;
}
// Get the position of a user
$getPositionForUser = getParam('getPosition');
if (!isNullOrEmptyString($getPositionForUser)) {
    $currentPosition = getPosition($getPositionForUser);
    if (isNullOrEmptyString($currentPosition)) {
        setServerError("Failed to get postion for user {$getPositionForUser}.");
        return;
    }
    setServerResponse($currentPosition);
    return;
}
// Get the positions of a group
$getPositionsForGroup = getParam('getPositions');
if (!isNullOrEmptyString($getPositionsForGroup)) {
    $currentPositions = getPositions($getPositionsForGroup);
    if (isNullOrEmptyString($currentPositions)) {
        setServerError("Failed to get postions for group {$getPositionsForGroup}.");
        return;
    }
function renderTop()
{
    ?>
	<link type="text/css" rel="stylesheet" href="three/css/top.css"></link>
	<script type="text/javascript" src="three/js/three.min.js"></script>
	<script type="text/javascript" src="three/js/CSS3DRenderer.js"></script>
	<script type="text/javascript" src="three/js/OrbitControls.js"></script>
	<script type="text/javascript" src="three/js/dat.gui.min.js"></script>
	<script type="text/javascript" src="three/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="three/js/top.js"></script>

	<script type="text/javascript" src="three/js/jszip.min.js" charset="UTF-8"></script>
	<script type="text/javascript" src="three/js/FileSaver.min.js"></script>
	<script type="text/javascript" src="three/js/FlowDesignerProjectExport.js" charset="UTF-8"></script>

	<script type="text/javascript" src="three/js/gbxmlExport.js" charset="UTF-8"></script>

<?php 
    echo "<script>\n";
    global $rowindex;
    $row = spotEntity('row', isset($rowindex[$_REQUEST['tab']]) ? $rowindex[$_REQUEST['tab']] : $rowindex['default']);
    echo "row_id = " . $row['id'] . ";\n";
    echo "row_name = \"" . $row['name'] . "\";\n";
    # get room size data
    $query = 'SELECT width, depth, height FROM room_size where row_id = ' . $row['id'] . ';';
    $result = usePreparedSelectBlade($query);
    $width = -1;
    $depth = -1;
    $height = -1;
    foreach ($result as $key => $value) {
        $width = $value['width'];
        $depth = $value['depth'];
        $height = $value['height'];
    }
    echo "init( {$width} ,{$depth}, {$height} );\n";
    echo "render();\n";
    # get rack data
    $allracks = scanRealmByText('rack');
    $query = 'SELECT rack_id FROM rack_airconditioner where row_id = ' . $row['id'] . ';';
    $result = usePreparedSelectBlade($query);
    $airids = array();
    foreach ($result as $key => $value) {
        array_push($airids, $value['rack_id']);
    }
    $airdatas = array();
    # the rack that is no position information
    $noposracks = array();
    $positions = getPosition($row["id"]);
    $objectDatas = array();
    # mesh data
    foreach ($allracks as $rack) {
        //if($rack['row_id'] == $row['id']) {
        if ($rack['row_id'] == $row['id']) {
            # get position information
            $position = 'null';
            if (isset($positions[$rack["id"]])) {
                $position = $positions[$rack["id"]];
                $position = "[ {$position['pos_x']}, {$position['pos_y']}, {$position['pos_z']} ]";
            }
            $type = 'rack';
            if (in_array($rack['id'], $airids)) {
                $type = 'airconditioner';
            }
            $size = '[ 70, 220, 110 ]';
            amplifyCell($rack);
            $mountedObjects = array();
            $mountedObjectIds = $rack['mountedObjects'];
            foreach ($mountedObjectIds as $objectid) {
                $object = spotEntity('object', $objectid);
                # item information
                $query = "select name from item_information where objectid = '{$objectid}' and key_ like 'sensor.%' order by itemid asc;";
                $result = usePreparedSelectBlade($query);
                // there is only one senesor in Object
                //$items = $result->fetchAll(PDO::FETCH_ASSOC);
                $item = $result->fetch(PDO::FETCH_ASSOC);
                unset($result);
                $mountedObjects[$objectid] = array('name' => $object['name'], 'has_problems' => $object['has_problems'], 'item' => $item['name']);
            }
            $rack['mountedObjects'] = $mountedObjects;
            echo "showRack(" . json_encode($rack) . ", \"{$type}\", {$size}, {$position});";
        }
    }
    echo '</script>';
}
示例#10
0
<?php

require_once './functions.php';
if (!isset($_POST['eventNo'])) {
    die("No event number provided");
}
$eventNo = mysql_real_escape_string($_POST['eventNo']);
$replacement = mysql_real_escape_string($_POST['replacement']);
$reason = mysql_real_escape_string($_POST['reason']);
//if they didn't specify a reason, don't let them off the hook
if ($reason == "") {
    die("You need a reason.  Try again.<br><div class='btn' id='retryAbsenceButton' value='{$eventNo}'>try again</div>");
}
$attendanceOfficers = implode(", ", getPosition("Vice President")) . ", " . implode(", ", getPosition("President"));
# TODO Check for duplicate queries and display an error message if a request has already been submitted for this event
if (!mysql_query("insert into `absencerequest` (reason,memberID,eventNo) values ('{$reason}','{$USER}','{$eventNo}')")) {
    die("Query failed: " . mysql_error());
}
$mail = sendMessageEmail($attendanceOfficers, $USER, 'Name:  ' . fullNameFromEmail($USER) . '<br>Event:  ' . getEventName($eventNo) . '<br>Reason:  ' . $reason, 'Absence Request on Gree-C-Web');
echo "<p>Your request has been submitted.  You lazy bum!</p>";
            echo get_username($vo["uid"]);
            ?>
</td>
				<td><a href="<?php 
            echo U('Home/Index/artc', array('id' => $vo['id']));
            ?>
" target="_blank"><?php 
            echo $vo["title"];
            ?>
</a></td>
				<td><?php 
            echo getStatus($vo['status']);
            ?>
</td>
				<td><?php 
            echo getPosition($vo['tj']);
            ?>
</td>
				<td><input type="checkbox" name="ids" class="j-icheck" value="<?php 
            echo $vo['id'];
            ?>
"></td>
				<td>
                    <a href="<?php 
            echo U('edit', array('id' => $vo['id']));
            ?>
" rel="articleedit<?php 
            echo $vo["id"];
            ?>
"  class="btn small bg-blue" title="编辑<?php 
            echo $vo["title"];
示例#12
0
function getPlanning($dotd, $h1begin, $h1end, $h2begin, $h2end, $epn, $salle)
{
    if ($h1begin == 0 and $h2begin > 0) {
        $h1begin = $h2begin;
    }
    if ($h2end == 0 and $h1begin > 0) {
        $h2end = $h1end;
    }
    if ($h1begin == 0 and $h2end == 0) {
        return FALSE;
        exit;
    }
    // Initialisation des variables
    $graf = "";
    $unit = getConfig("unit_config", "unit_default_config", $epn);
    // unité dans la table config
    $unitLabel = 30;
    // echelle de division du temps pour les labels des heures
    $h1begin = floor($h1begin / 60) * 60;
    // on recupere l"heure de debut ex : 9h15 =>9h => 540mn
    if ($h2end != floor($h2end / 60) * 60) {
        $h2end = floor($h2end / 60) * 60 + 60;
    }
    // on recupere l"heure de fin ex : 19h15 =>20h
    $nbTotM = $h2end - $h1begin;
    // nombre total de minute d'ouverture
    $widthPause = getWidth($h2begin - $h1end, $nbTotM, $unit) * (60 / $unit);
    $positionPause = getPosition($h1end, $h1begin, getWidthPerUnit($nbTotM, $unit)) * (60 / $unit);
    // selection des machines par salle
    $result = getAllMaterielDispo($salle);
    // affichage du resultat
    if (mysqli_num_rows($result) < 1) {
        $graf = "Aucun ordinateur dans la salle s&eacute;lection&eacute;e, veuillez choisir une autre salle";
    } else {
        // Creation du tableau
        $graf .= "<table  class=\"table table-condensed\">";
        // ligne des horaires - echelle au dessus des reservations
        $graf .= "<tr><td></td><td >";
        for ($i = 0; $i < $nbTotM / $unitLabel; $i++) {
            if ($i == $nbTotM / $unitLabel - 1) {
                $largeur = getWidth(60, $nbTotM, $unitLabel) - 2;
                if (strlen(getTime($h1begin + $i * $unitLabel)) <= 3) {
                    $graf .= "<div class=\"labelHor\" style=\"width:" . $largeur . "%;\">|" . getTime($h1begin + $i * $unitLabel) . "</div>";
                } else {
                    $graf .= "<div class=\"labelHor1\" style=\"width:" . $largeur . "%;\">|30</div>";
                }
            } else {
                $time = getTime($h1begin + $i * $unitLabel);
                if (strlen(getTime($h1begin + $i * $unitLabel)) <= 3) {
                    $graf .= "<div class=\"labelHor\" style=\"width:" . getWidth(60, $nbTotM, $unitLabel) . "%;\">|" . $time . "</div>";
                } else {
                    $graf .= "<div class=\"labelHor1\" style=\"width:" . getWidth(60, $nbTotM, $unitLabel) . "%;\">|30</div>";
                }
            }
        }
        $graf .= "</td></tr>";
        //affichage des machines + liste des reservations
        while ($row = mysqli_fetch_array($result)) {
            //old function affichage par usage//
            if ($row['NB'] == "") {
                $nbCritere = '';
            } else {
                $nbCritere = ' (' . $row['NB'] . ')';
            }
            ///
            if (strtotime($dotd) < strtotime(date("Y-m-d"))) {
                $graf .= "<tr><td class=\"computer\" >" . $row["nom_computer"] . "</td>\n                        <td class=\"horaire\">";
            } else {
                /*if(COUNT($usage)==$row['NB']) // si la recherche est exacte
                  {
                    $graf .= "<tr><td class=\"computer2\"><a href=\"index.php?m=7&idepn=".$epn."&idcomp=".$row["id_computer"]."&nomcomp=".$row["nom_computer"]."&date=".$dotd."\">".$row["nom_computer"]."".$nbCritere."</a></td>
                                <td class=\"horaire\">" ;
                    $lineExist = TRUE ;         
                                
                  }
                  else // sinon on affiche les resultats avec les autres criteres de recherche
                  {*/
                if (FALSE == checkInter($row["id_computer"])) {
                    //si pas d'intervention
                    $graf .= "<tr><td class=\"computer\"><a href=\"index.php?m=7&idepn=" . $epn . "&idcomp=" . $row["id_computer"] . "&nomcomp=" . $row["nom_computer"] . "&date=" . $dotd . "\">" . $row["nom_computer"] . "" . $nbCritere . "</a></td>\n                            <td class=\"horaire\">";
                } else {
                    $graf .= "<tr><td class=\"computer\"><span data-toggle=\"tooltip\" title=\"Une intervention est en cours sur ce poste, pas de réservation possible !\" class=\"text-red\">" . $row["nom_computer"] . "</span></td>\n                            <td class=\"horaire\">";
                }
                //  }
            }
            // affichage des horaires et des occupations
            $result2 = getResa($row["id_computer"], $dotd);
            $width = 0;
            $position = 0;
            $widthTmp = 0;
            $widthTmp2 = 0;
            $i = 0;
            while ($row2 = mysqli_fetch_array($result2)) {
                $i = 0;
                // largeur en % du div representant la resa
                $width = getWidth($row2["duree_resa"], $nbTotM, $unit) * (60 / $unit);
                // recupere la position absolue dans le tableau
                $positionTmp = getPosition($row2["debut_resa"], $h1begin, getWidthPerUnit($nbTotM, $unit));
                // position en % du div en cours (represente l'ecart avec celui de devant)
                $position = ($positionTmp - $widthTmp2) * (60 / $unit) - $unit / 60 * $i;
                if ($position < 0) {
                    $position = 0;
                }
                // Affichage de la ligne d'une machine;
                $urlGraf = "#p" . $row2["id_user_resa"];
                //Ajout lien vers ancre dans la liste//$_SERVER['REQUEST_URI'] ; //."&idResa=".$row2['id_resa'];
                if ($_SESSION['status'] == 3 or $_SESSION['status'] == 4) {
                    // comment d'admin et d'anim
                    $altGraf = "(" . getUserName($row2["id_user_resa"]) . " - " . getTime($row2["debut_resa"]) . " &agrave; " . getTime($row2["debut_resa"] + $row2["duree_resa"]) . ")";
                } else {
                    // comment d'utilisateur
                    $altGraf = "(" . getTime($row2["debut_resa"]) . " &agrave; " . getTime($row2["debut_resa"] + $row2["duree_resa"]) . ")";
                }
                $graf .= "<div class=\"unitbusy\" style=\"width:" . $width . "%;left:" . $position . "%;\">\n                                <a href=\"" . $urlGraf . "\" alt=\"" . $altGraf . "\" title=\"" . $altGraf . "\">" . getTime($row2["duree_resa"]) . "</a>\n                            </div>";
                $widthTmp = $widthTmp + $width;
                $widthTmp2 = $widthTmp / (60 / $unit);
                ++$i;
                //echo $position.'% = (PA:'.$positionTmp.'-W'.$widthTmp.')*(60/'.$unit.') -- width:'.$width.'% -- nbTotM:'.$nbTotM.'<br/>';
            }
            // fin de l'affichage des horaires et des occupations
            $graf .= "</td></tr>";
        }
        // ligne des horaires - echelle en dessous du tableau de reservation 2
        $graf .= "<tr><td></td><td >";
        for ($i = 0; $i < $nbTotM / $unitLabel; $i++) {
            if ($i == $nbTotM / $unitLabel - 1) {
                if (strlen(getTime($h1begin + $i * $unitLabel)) <= 3) {
                    $graf .= "<div class=\"labelHor\" style=\"width:" . (getWidth(60, $nbTotM, $unitLabel) - 2) . "%;\">|" . getTime($h1begin + $i * $unitLabel) . "</div>";
                } else {
                    $graf .= "<div class=\"labelHor1\" style=\"width:" . (getWidth(60, $nbTotM, $unitLabel) - 2) . "%;\">|30</div>";
                }
            } else {
                if (strlen(getTime($h1begin + $i * $unitLabel)) <= 3) {
                    $graf .= "<div class=\"labelHor\" style=\"width:" . getWidth(60, $nbTotM, $unitLabel) . "%;\">|" . getTime($h1begin + $i * $unitLabel) . "</div>";
                } else {
                    $graf .= "<div class=\"labelHor1\" style=\"width:" . getWidth(60, $nbTotM, $unitLabel) . "%;\">|30</div>";
                }
            }
        }
        $graf .= "</td></tr>";
        $graf .= "</table>";
    }
    return $graf;
}
示例#13
0
/**
 *
 * @param type $user user name as String
 * @param type $excludeRequestingUser if not empty or null the user (param $user) will be excluded the return positions
 * @return type
 *  a) the user is not in a group > return the last postion as CSV
 *         Example: user=Peter;lat=47.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=2013-03-03T15:48:47.484
 *  b) the user belongs to a group > return CSV strings. Each user one line containing the last position
 *         Example:
 *              user=Peter;lat=47.50457163540115;lon=11.071390274487026;bearing=171.61432;speed=0.7065948;altitude=1067.652498529502;accuracy=6.0;time=2013-03-03T15:48:47.484
 *              user=Lisa;lat=47.50451538021159;lon=11.071421406744932;bearing=173.14859;speed=0.0;altitude=1068.2914401409275;accuracy=6.0;time=2013-03-03T15:48:57.511
 */
function getGroupPostions($user, $excludeRequestingUser)
{
    // Get the group if any
    $foundGroup = getGroup($user);
    if ($foundGroup != '') {
        // yes, user is in group
        return getPositions($foundGroup, $excludeRequestingUser);
    } else {
        // no group > get the postion of this user only
        if (!isNullOrEmptyString($excludeRequestingUser)) {
            return '';
        } else {
            $postions = getPosition($user);
            if (isNullOrEmptyString($postions)) {
                return '';
            }
            $csv = 'user='******';' . $postions;
            return $csv;
        }
    }
}
示例#14
0
function getContentByJavascript($url, $num)
{
    $html = file_get_contents($url);
    $content_position = getPosition($html, "\$.MSNImageSlider.Images");
    $content_endPosition = getPosition($html, "\$.MSNImageSlider.Index");
    $content = substr($html, $content_position, $content_endPosition - $content_position);
    $tag_position = getPosition($content, "[");
    $tag_endPosition = getPosition($content, "]");
    $content = substr($content, $tag_position + 1, $tag_endPosition - $tag_position - 1);
    $array = html_separator($content, "}");
    foreach ($array as $key => $value) {
        if ($tag_position = strpos($value, "{")) {
            $content = substr($value, $tag_position + 1);
            $content_array = html_separator($content, ",");
            foreach ($content_array as $content_key => $content_html) {
                if (strpos($content_html, "src")) {
                    $tag_position = getPosition($content_html, "'");
                    $tag_endPosition = getPosition($content_html, "'", "last");
                    $content = substr($content_html, $tag_position, $tag_endPosition - $tag_position + 1);
                    echo "<img src=" . $content . "></img>";
                    echo "<br />";
                }
                if (strpos($content_html, "text")) {
                    $tag_position = getPosition($content_html, "'");
                    $tag_endPosition = getPosition($content_html, "'", "last");
                    $content = substr($content_html, $tag_position + 1, $tag_endPosition - $tag_position - 1);
                    echo $content;
                    echo "<br />";
                }
            }
        }
    }
}
示例#15
0
 $listeGains = getListeMeilleursGains($saison_id);
 if (sizeof($listeGains) > 0) {
     echo "<table class='jeu'>";
     $sommetotale = 0;
     for ($i = 0; $i < sizeof($listeGains); $i++) {
         $gain = $listeGains[$i];
         // Lecture des propriétés du joueur
         $joueur_id = stripslashes($gain["joueur_id"]);
         $somme = stripslashes($gain["total"]);
         if ($i % 2 == 1) {
             echo "<tr class='enreg impaire'>";
         } else {
             echo "<tr class='enreg'>";
         }
         $j = $i + 1;
         echo "<td width=\"150\"><b>" . getPosition($i) . "</b></td>\n";
         echo "<td width=\"150\">" . getNomJoueurTab($listeJoueurs, $joueur_id) . "</td>\n";
         echo "<td width=\"200\">" . round($somme, 1) . " Euros</td>\n";
         $sommetotale += $somme;
         echo "</tr>\n";
     }
     echo "</table>";
     echo "<h4>Soit un total de " . $sommetotale . " Euros</h4>";
 } else {
     echo "<h4>Pas le moindre Gain !</h4>";
 }
 // Tableau pour le graphique
 $G_ListeJeux = array();
 $G_ListeJoueurs = array();
 $G_ListeResultats = array();
 $TotalMoyenneGenerale = array();
示例#16
0
function editTemplate()
{
    global $smcFunc, $context, $txt;
    checkSession('get');
    if (empty($_REQUEST['id'])) {
        fatal_lang_error('adkfatal_template_invalid_id', false);
    }
    //Get the id_template
    $id_template = (int) $_REQUEST['id'];
    //Load Template
    $set = $smcFunc['db_query']('', '
		SELECT id_template, type, place
		FROM {db_prefix}adk_blocks_template_admin
		WHERE id_template = {int:id_template}', array('id_template' => $id_template));
    list($id_template, $type, $place) = $smcFunc['db_fetch_row']($set);
    $smcFunc['db_free_result']($set);
    //Set in a context variable
    $context += array('id_template' => $id_template, 'type' => $type, 'place' => $place);
    //Load Blocks
    $sql = $smcFunc['db_query']('', '
		SELECT b.id, b.name, b.type AS block_type, b.img, 
			IFNULL(t.id_block, 0) AS id_block_template, t.columna, t.orden
		FROM {db_prefix}adk_blocks AS b
		LEFT JOIN {db_prefix}adk_blocks_template AS t ON (t.id_block = b.id AND t.id_template = {int:template})
		ORDER BY t.orden', array('template' => $id_template));
    $context['blocks_admin'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($sql)) {
        $context['blocks_admin'][getPosition($row['columna'])][$row['id']] = array('id' => $row['id'], 'name' => $row['name'], 'type' => $row['block_type'], 'img' => $row['img'], 'columna' => !empty($row['columna']) ? $row['columna'] : 6, 'orden' => !empty($row['orden']) ? $row['orden'] : 1);
    }
    $smcFunc['db_free_result']($sql);
    //Set title and tmeplate
    $context['sub_template'] = 'edit_the_template';
    $context['page_title'] = $txt['adkblock_edit_template'] . ' {' . $type . (!empty($place) ? '=' . $place : '') . '}';
}
示例#17
0
    $pageCache = L::loadClass('pagecache', 'pagecache');
    $pageCacheConfig = C::loadClass('pagecacheconfiglist', 'pagecache');
    $pageCache->init($pageCacheConfig);
    $tmpHotArticle = $pageCache->getData('hotArticle');
    $hotArticle = $articleService->filterArticles($tmpHotArticle);
    list($columns, $columnInfo) = $columnService->getCurrentAndSubColumns($column);
    if (!S::isArray($columns)) {
        list($columns, $columnInfo) = $columnService->getCurrentAndSubColumns($columnInfo['parent_id']);
    }
    /* update hits */
    /*$hitfile = D_P . "data/bbscache/cms_hits.txt";
    	$hitsize = @filesize($hitfile);
    	if ($hitsize && $hitsize > 1024) {
    		updateArticleHits();
    	}*/
    $pagePosition = getPosition($column, '', '', $cms_sitename);
    $_definedSeo = array('title' => $subColumns[$column]['seotitle'], 'metaDescription' => $subColumns[$column]['seodesc'], 'metaKeywords' => $subColumns[$column]['seokeywords']);
    cmsSeoSettings('index', $_definedSeo, $subColumns[$column]['name']);
} elseif ($action == 'del') {
    define('AJAX', 1);
    S::gp(array('ids', 'column_id'));
    /*
    if(!checkEditPurview($windid,$column_id)) {
    	Showmsg('您没有权限删除帖子');
    }
    */
    if (strpos($ids, ',')) {
        $ids = explode(',', $ids);
    }
    $articleDB = C::loadDB('article');
    $list = $articleDB->getArticlesByIds(is_array($ids) ? $ids : array($ids));
示例#18
0
文件: checkPW.php 项目: rdnjm/ici
<?php

session_start();
include '../needs/connString.php';
include 'functions.php';
$empNum = mysqli_escape_string($link, $_POST['empNum']);
$password = mysqli_escape_string($link, $_POST['password']);
$query = "SELECT employeeNum FROM emplogin WHERE employeeNum = '{$empNum}';" or die("Error " . mysqli_error());
$result = conString($query);
$rows = mysqli_num_rows($result);
if ($rows == 1) {
    $query = "SELECT pass FROM emplogin WHERE employeeNum = '{$empNum}' AND pass = '******';" or die("Error " . mysqli_error());
    $result = conString($query);
    $rows = mysqli_num_rows($result);
    if ($rows == 1) {
        getPosition($empNum);
        header("LOCATION: ../");
    } else {
        header("LOCATION: ../login.php?err=1");
    }
} else {
    header("LOCATION: ../login.php?err=101");
}