function BlockPlayer($check, $sid, $num, $type, $length)
{
    $objResponse = new xajaxResponse();
    global $userbank, $username;
    $sid = (int) $sid;
    $length = (int) $length;
    if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Hacking Attempt", $username . " tried to process a playerblock, but doesnt have access.");
        return $objResponse;
    }
    //get the server data
    $sdata = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
    //test if server is online
    if ($test = @fsockopen($sdata['ip'], $sdata['port'], $errno, $errstr, 2)) {
        @fclose($test);
        require_once INCLUDES_PATH . "/CServerRcon.php";
        $r = new CServerRcon($sdata['ip'], $sdata['port'], $sdata['rcon']);
        if (!$r->Auth()) {
            $GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "' LIMIT 1;");
            $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'>Wrong RCON Password, please change!</font>");
            $objResponse->addScript('set_counter(1);');
            return $objResponse;
        }
        $ret = $r->rconCommand("status");
        // show hostname instead of the ip, but leave the ip in the title
        require_once "../includes/system-functions.php";
        $hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
        $hostname = trunc(htmlspecialchars($hostname[1][0]), 25, false);
        if (!empty($hostname)) {
            $objResponse->addAssign("srvip_{$num}", "innerHTML", "<font size='1'><span title='" . $sdata['ip'] . ":" . $sdata['port'] . "'>" . $hostname . "</span></font>");
        }
        $gothim = false;
        $search = preg_match_all(STATUS_PARSE, $ret, $matches, PREG_PATTERN_ORDER);
        //search for the steamid on the server
        foreach ($matches[3] as $match) {
            if (substr($match, 8) == substr($check, 8)) {
                // gotcha!!! kick him!
                $gothim = true;
                $GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_comms` SET sid = '" . $sid . "' WHERE authid = '" . $check . "' AND RemovedBy IS NULL;");
                $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.blockit.php"));
                $kick = $r->sendCommand("sc_fw_block " . $type . " " . $length . " " . $match);
                $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Player Found & blocked!!!</u></b></font>");
                $objResponse->addScript("set_counter('-1');");
                return $objResponse;
            }
        }
        if (!$gothim) {
            $objResponse->addAssign("srv_{$num}", "innerHTML", "<font size='1'>Player not found.</font>");
            $objResponse->addScript('set_counter(1);');
            return $objResponse;
        }
    } else {
        $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'><i>Can't connect to server.</i></font>");
        $objResponse->addScript('set_counter(1);');
        return $objResponse;
    }
}
Example #2
0
/**
 * Get the name to display in the top right of the navigation bar
 *
 * @param number $maxLength        	
 * @return string
 */
function getName($maxLength = 15)
{
    global $userProfile;
    $displayName = "";
    if ($userProfile) {
        $displayName = $userProfile->email;
    }
    $displayName = trunc($displayName, $maxLength);
    return $displayName;
}
Example #3
0
function _get_description($id, $post_type)
{
    if (get_field('meta_description') != '') {
        $descr = get_field('meta_description');
    } else {
        if ($post_type == 'post') {
            $descr = trunc(strip_tags(get_field('person_bio')), 30);
        } else {
            $descr = get_field('meta_description', $GLOBALS['HOME_ID']);
        }
    }
    return $descr;
}
Example #4
0
    ?>
				<h1 class="navbar-displayname">
					<div class="visible-inline-xs"><?php 
    echo trunc($communityName, 20);
    ?>
</div>
					<div class="visible-inline-sm"><?php 
    echo trunc($communityName, 40);
    ?>
</div>
					<div class="visible-inline-md"><?php 
    echo trunc($communityName, 45);
    ?>
</div>
					<div class="visible-inline-lg"><?php 
    echo trunc($communityName, 50);
    ?>
</div>
				</h1>
				<?php 
}
?>
			</span>
		</div>

		<!-- Collect the nav links, forms, and other content for toggling -->
		<div
			class="collapse navbar-collapse navbar-right navbar-main-collapse">
			<?php 
echo $nav->build();
?>
Example #5
0
 public function sortOutValues($data)
 {
     //net value is unit-price * quantity
     $this->net_value = round(bcmul($this->sales_qty, $this->sales_price, 4), 2);
     //tax  (in the UK at least) is dependent on the tax_rate of the item, and the tax status of the customer.
     //this function is a wrapper to a call to a config-dependent method
     $tax_percentage = calc_tax_percentage($data['tax_rate_id'], $data['tax_status_id'], $this->net_value);
     $this->tax_percentage = $tax_percentage;
     //tax_value is the tax percentage of the net value
     $this->tax_value = trunc(bcmul($this->net_value, $tax_percentage), 2);
 }
Example #6
0
require_once "cnf.php";
if (isset($_GET['load_more'])) {
    $l_id = $_GET['l_id'];
    $data = array();
    $q = mysql_query("select *, s.id as sid from shule as s join pic as p join user as u on s.author=u.id and s.cover=p.id where s.id<{$l_id} order by s.id desc limit 6");
    $qt = mysql_query("select id from shule");
    $tot_r = mysql_num_rows($qt);
    while ($r = mysql_fetch_assoc($q)) {
        $id = $r['sid'];
        $title = $r['title'];
        $cover = $r['src'];
        $intro = $r['body'];
        $published = $r['created'];
        $category = $r['category'];
        $intro = trunc($intro, 25, $id);
        switch ($category) {
            case 1:
                $category = "Apps";
                break;
            case 2:
                $category = "Gadgets";
                break;
            case 3:
                $category = "Startups";
                break;
            case 4:
                $category = "Social";
                break;
            case 5:
                $category = "Multimedia";
Example #7
0
    function displayInbox()
    {
        global $db, $form, $user;
        echo '
<div class="green_contentbox">
			<div class="green_content_top">
				<h3 class="content_box_header">Personal Messaging System - Inbox</h3>
			</div>
			<div class="green_content">
					<form action="process.php" method="post">
					<input type="hidden" name="cmd" value="delete_message" />
					<table class="general_info" width="95%" cellpadding="0" cellspacing="0">
					<tr>
						<td width="5%">
						</td>
						<td class="minor_header" width="25%">
							<h4 class="content_box_minor_header">
								Title
							</h4>
						</td>
						<td class="minor_header" width="25%">
							<h4 class="content_box_minor_header">
								Preview
							</h4>
						</td>
						<td class="minor_header" width="25%">
							<h4 class="content_box_minor_header">
								From
							</h4>
						</td>
						<td class="minor_header" width="10%">
							<h4 class="content_box_minor_header">
								Date
							</h4>
						</td>
						<td class="minor_header" width="10%" >
							<h4 class="content_box_minor_header">
								Read?
							</h4>
						</td>
					</tr>
					';
        $sql = 'select id 
			from messages
			where messages.to = "' . $user->username . '"
			order by date desc
			;';
        $result = mysql_query($sql);
        while ($row = mysql_fetch_array($result)) {
            $message = new Message();
            $message->getInfo($user->username, $row['id']);
            if ($db->messages($user->username) == 0) {
                echo 'You do not have any messages.';
            } else {
                echo '
				<tr>
					<td>
						<input type="checkbox" name="delete[]" value="' . $message->id . '" />
					</td>
					<td>
						<a class="' . $message->class . '" href="index.php?view=user_personal&cmd=displayInbox&mid=' . $message->id . '">' . $message->title . '</font>
					</td>
					<td>
						' . trunc($message->text, 5) . '
					</td>
					<td>
						' . $db->titleFromUsername($message->from) . '
					</td>
					<td>
						' . dateFromTimestamp($message->date) . '
					</td>
					<td>
						';
                if ($message->read == 1) {
                    echo 'Yes';
                }
                if ($message->read == 0) {
                    echo 'No';
                }
                echo '
					</td>
				</tr>
				';
            }
        }
        echo '
					</table>
					<br />
					<hr class="cb" />	
					<input type="submit" value="Delete Selected" />
					<div>' . $form->error("security") . '</div>
					<div>' . $_SESSION['event'] . '</div>
					</form>
					<hr class="cb" />	
						<a class="return" href="index.php?view=console">Click Here to return to your Console</a>
			</div>
			<div class="green_content_bottom">
			</div>
		</div>


			';
    }
Example #8
0
    function display($select)
    {
        global $db;
        switch ($select) {
            case 1:
                echo '
					<div class="news_header_left">
						<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a>
						</div>
						<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a>
						</div>
						<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a>
						</div>
						<div class="news_header_text_1" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
							<h3>' . $this->news_list[1]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
							<p class="newstext">' . trunc(strip_tags($this->news_list[1]->news), 25) . '</p>
							<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[1]->poster) . '</strong> at 
								<strong>' . dateFromTimestamp_Long($this->news_list[1]->date) . '</strong></h5>
						</div>
					</div>
				';
                break;
            case 2:
                echo '
					<div class="news_header_left">
						<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a></div>
						<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a></div>
						<div class="news_header_text_2" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
							<h3>' . $this->news_list[2]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
							<p class="newstext">' . trunc(strip_tags($this->news_list[2]->news), 25) . '</p>
							<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[2]->poster) . '</strong> at 
								<strong>' . dateFromTimestamp_Long($this->news_list[2]->date) . '</strong></h5>
						</div>
						<div class="news_header_title_1" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=1">' . $this->news_list[1]->title . '</a></div>
					</div>
				';
                break;
            case 3:
                echo '
					<div class="news_header_left">
						<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a></div>
						<div class="news_header_text_3" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
							<h3>' . $this->news_list[3]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
							<p class="newstext">' . trunc(strip_tags($this->news_list[3]->news), 25) . '</p>
							<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[3]->poster) . '</strong> at 
								<strong>' . dateFromTimestamp_Long($this->news_list[3]->date) . '</strong></h5>
						</div>
						<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a></div>
						<div class="news_header_title_1" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=1">' . $this->news_list[1]->title . '</a></div>
					</div>
				';
                break;
            case 4:
                echo '
					<div class="news_header_left">
						<div class="news_header_text_4" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
							<h3>' . $this->news_list[4]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
							<p class="newstext">' . trunc(strip_tags($this->news_list[4]->news), 25) . '</p>
							<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[4]->poster) . '</strong> at 
								<strong>' . dateFromTimestamp_Long($this->news_list[4]->date) . '</strong></h5>
						</div>
						<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a></div>
						<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a></div>
						<div class="news_header_title_1" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=1">' . $this->news_list[1]->title . '</a></div>
					</div>
				';
                break;
            default:
                echo '
					<div class="news_header_left">
						<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a>
						</div>
						<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a>
						</div>
						<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
							<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a>
						</div>
						<div class="news_header_text_1" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
							<h3>' . $this->news_list[1]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
							<p class="newstext">' . trunc(strip_tags($this->news_list[1]->news), 25) . '</p>
							<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[1]->poster) . '</strong> at 
								<strong>' . dateFromTimestamp_Long($this->news_list[1]->date) . '</strong></h5>
						</div>
					</div>
				';
                break;
        }
    }
function KickPlayer($check, $sid, $num, $type)
{
    $objResponse = new xajaxResponse();
    global $userbank, $username;
    $sid = (int) $sid;
    if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Ошибка доступа", $username . " пытался кого-то кикнуть, не имея на это прав.");
        return $objResponse;
    }
    //get the server data
    $sdata = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
    //test if server is online
    if ($test = @fsockopen($sdata['ip'], $sdata['port'], $errno, $errstr, 2)) {
        @fclose($test);
        require_once INCLUDES_PATH . "/CServerRcon.php";
        $r = new CServerRcon($sdata['ip'], $sdata['port'], $sdata['rcon']);
        if (!$r->Auth()) {
            $GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "' LIMIT 1;");
            $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'>Неверный РКОН!</font>");
            $objResponse->addScript('set_counter(1);');
            return $objResponse;
        }
        $ret = $r->rconCommand("status");
        // show hostname instead of the ip, but leave the ip in the title
        require_once "../includes/system-functions.php";
        $hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
        $hostname = trunc(htmlspecialchars($hostname[1][0]), 25, false);
        if (!empty($hostname)) {
            $objResponse->addAssign("srvip_{$num}", "innerHTML", "<font size='1'><span title='" . $sdata['ip'] . ":" . $sdata['port'] . "'>" . $hostname . "</span></font>");
        }
        $gothim = false;
        $search = preg_match_all(STATUS_PARSE, $ret, $matches, PREG_PATTERN_ORDER);
        //search for the steamid on the server
        if ((int) $type == 0) {
            foreach ($matches[3] as $match) {
                if (substr($match, 8) == substr($check, 8)) {
                    // gotcha!!! kick him!
                    $gothim = true;
                    $GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_bans` SET sid = '" . $sid . "' WHERE authid = '" . $check . "' AND RemovedBy IS NULL;");
                    $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.kickit.php"));
                    $kick = $r->sendCommand("kickid " . $match . " \"Вы были забанены, посетите http://" . $_SERVER['HTTP_HOST'] . $requri . " для большей информации.\"");
                    $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Игрок найден и кикнут!!!</u></b></font>");
                    $objResponse->addScript("set_counter('-1');");
                    return $objResponse;
                }
            }
        } else {
            if ((int) $type == 1) {
                // search for the ip on the server
                $id = 0;
                foreach ($matches[8] as $match) {
                    $ip = explode(":", $match);
                    $ip = $ip[0];
                    if ($ip == $check) {
                        $userid = $matches[1][$id];
                        // gotcha!!! kick him!
                        $gothim = true;
                        $GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_bans` SET sid = '" . $sid . "' WHERE ip = '" . $check . "' AND RemovedBy IS NULL;");
                        $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.kickit.php"));
                        $kick = $r->sendCommand("kickid " . $userid . " \"Вы были забанены, посетите http://" . $_SERVER['HTTP_HOST'] . $requri . " для большей информации.\"");
                        $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Игрок найден и кикнут!!!</u></b></font>");
                        $objResponse->addScript("set_counter('-1');");
                        return $objResponse;
                    }
                    $id++;
                }
            }
        }
        if (!$gothim) {
            $objResponse->addAssign("srv_{$num}", "innerHTML", "<font size='1'>Игрок не найден.</font>");
            $objResponse->addScript('set_counter(1);');
            return $objResponse;
        }
    } else {
        $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'><i>Нет соединения с сервером.</i></font>");
        $objResponse->addScript('set_counter(1);');
        return $objResponse;
    }
}
Example #10
0
 function Float2BinaryDecimal($floatvalue)
 {
     // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
     $maxbits = 128;
     // to how many bits of precision should the calculations be taken?
     $intpart = trunc($floatvalue);
     $floatpart = abs($floatvalue - $intpart);
     $pointbitstring = '';
     while ($floatpart != 0 && strlen($pointbitstring) < $maxbits) {
         $floatpart *= 2;
         $pointbitstring .= (string) trunc($floatpart);
         $floatpart -= trunc($floatpart);
     }
     $binarypointnumber = decbin($intpart) . '.' . $pointbitstring;
     return $binarypointnumber;
 }
Example #11
0
function getVOCheaderFilepointer(&$fd, &$ThisFileInfo)
{
    $OriginalAVdataOffset = $ThisFileInfo['avdataoffset'];
    fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
    $VOCheader = fread($fd, 26);
    if (substr($VOCheader, 0, 19) != 'Creative Voice File') {
        $ThisFileInfo['error'] .= "\n" . 'Expecting "Creative Voice File" at offset ' . $ThisFileInfo['avdataoffset'] . ', found "' . substr($VOCheader, 0, 19) . '"';
        return false;
    }
    $ThisFileInfo['fileformat'] = 'voc';
    $ThisFileInfo['audio']['dataformat'] = 'voc';
    $ThisFileInfo['audio']['bitrate_mode'] = 'cbr';
    $ThisFileInfo['audio']['channels'] = 1;
    // might be overriden below
    $ThisFileInfo['audio']['bits_per_sample'] = 8;
    // might be overriden below
    // byte #     Description
    // ------     ------------------------------------------
    // 00-12      'Creative Voice File'
    // 13         1A (eof to abort printing of file)
    // 14-15      Offset of first datablock in .voc file (std 1A 00 in Intel Notation)
    // 16-17      Version number (minor,major) (VOC-HDR puts 0A 01)
    // 18-19      2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
    $ThisFileInfo['voc']['header']['datablock_offset'] = LittleEndian2Int(substr($VOCheader, 20, 2));
    $ThisFileInfo['voc']['header']['minor_version'] = LittleEndian2Int(substr($VOCheader, 22, 1));
    $ThisFileInfo['voc']['header']['major_version'] = LittleEndian2Int(substr($VOCheader, 23, 1));
    do {
        $BlockOffset = ftell($fd);
        $BlockData = fread($fd, 4);
        $BlockType = LittleEndian2Int(substr($BlockData, 0, 1));
        $BlockSize = LittleEndian2Int(substr($BlockData, 1, 3));
        $ThisBlock = array();
        switch ($BlockType) {
            case 0:
                // Terminator
                // do nothing, we'll break out of the loop down below
                break;
            case 1:
                // Sound data
                $BlockData .= fread($fd, 2);
                if ($ThisFileInfo['avdataoffset'] <= $OriginalAVdataOffset) {
                    $ThisFileInfo['avdataoffset'] = ftell($fd);
                }
                fseek($fd, $BlockSize - 2, SEEK_CUR);
                $ThisBlock['sample_rate_id'] = LittleEndian2Int(substr($BlockData, 4, 1));
                $ThisBlock['compression_type'] = LittleEndian2Int(substr($BlockData, 5, 1));
                $ThisBlock['compression_name'] = VOCcompressionTypeLookup($ThisBlock['compression_type']);
                if ($ThisBlock['compression_type'] <= 3) {
                    $ThisFileInfo['voc']['compressed_bits_per_sample'] = CastAsInt(str_replace('-bit', '', $ThisBlock['compression_name']));
                }
                if (empty($ThisFileInfo['audio']['sample_rate'])) {
                    // Less accurate than the Extended block (#8) data
                    // SR byte = 256-(1000000/sample_rate)
                    $ThisFileInfo['audio']['sample_rate'] = trunc(1000000 / (256 - $ThisBlock['sample_rate_id']) / $ThisFileInfo['audio']['channels']);
                }
                break;
            case 2:
                // Sound continue
            // Sound continue
            case 3:
                // Silence
            // Silence
            case 4:
                // Marker
            // Marker
            case 6:
                // Repeat
            // Repeat
            case 7:
                // End repeat
                // nothing useful, just skip
                fseek($fd, $BlockSize, SEEK_CUR);
                break;
            case 8:
                // Extended
                $BlockData .= fread($fd, 4);
                //00-01  Time Constant:
                //   Mono: 65536 - (256000000 / sample_rate)
                // Stereo: 65536 - (256000000 / (sample_rate * 2))
                $ThisBlock['time_constant'] = LittleEndian2Int(substr($BlockData, 4, 2));
                $ThisBlock['pack_method'] = LittleEndian2Int(substr($BlockData, 6, 1));
                $ThisBlock['stereo'] = (bool) LittleEndian2Int(substr($BlockData, 7, 1));
                $ThisFileInfo['audio']['channels'] = $ThisBlock['stereo'] ? 2 : 1;
                $ThisFileInfo['audio']['sample_rate'] = trunc(256000000 / (65536 - $ThisBlock['time_constant']) / $ThisFileInfo['audio']['channels']);
                break;
            case 9:
                // data block that supersedes blocks 1 and 8. Used for stereo, 16 bit
                $BlockData .= fread($fd, 12);
                if ($ThisFileInfo['avdataoffset'] <= $OriginalAVdataOffset) {
                    $ThisFileInfo['avdataoffset'] = ftell($fd);
                }
                fseek($fd, $BlockSize - 12, SEEK_CUR);
                $ThisBlock['sample_rate'] = LittleEndian2Int(substr($BlockData, 4, 4));
                $ThisBlock['bits_per_sample'] = LittleEndian2Int(substr($BlockData, 8, 1));
                $ThisBlock['channels'] = LittleEndian2Int(substr($BlockData, 9, 1));
                $ThisBlock['wFormat'] = LittleEndian2Int(substr($BlockData, 10, 2));
                $ThisBlock['compression_name'] = VOCwFormatLookup($ThisBlock['wFormat']);
                if (VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat'])) {
                    $ThisFileInfo['voc']['compressed_bits_per_sample'] = VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat']);
                }
                $ThisFileInfo['audio']['sample_rate'] = $ThisBlock['sample_rate'];
                $ThisFileInfo['audio']['bits_per_sample'] = $ThisBlock['bits_per_sample'];
                $ThisFileInfo['audio']['channels'] = $ThisBlock['channels'];
                break;
            default:
                $ThisFileInfo['warning'] .= "\n" . 'Unhandled block type "' . $BlockType . '" at offset ' . $BlockOffset;
                fseek($fd, $BlockSize, SEEK_CUR);
                break;
        }
        if (!empty($ThisBlock)) {
            $ThisBlock['block_offset'] = $BlockOffset;
            $ThisBlock['block_size'] = $BlockSize;
            $ThisBlock['block_type_id'] = $BlockType;
            $ThisFileInfo['voc']['blocks'][] = $ThisBlock;
        }
    } while (!feof($fd) && $BlockType != 0);
    // Terminator block doesn't have size field, so seek back 3 spaces
    fseek($fd, -3, SEEK_CUR);
    if (!empty($ThisFileInfo['voc']['compressed_bits_per_sample'])) {
        $ThisFileInfo['playtime_seconds'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8 / ($ThisFileInfo['voc']['compressed_bits_per_sample'] * $ThisFileInfo['audio']['channels'] * $ThisFileInfo['audio']['sample_rate']);
        $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8 / $ThisFileInfo['playtime_seconds'];
    }
    return true;
}
while (!$res->EOF) {
    $info = array();
    $info['name'] = stripslashes($res->fields[3]);
    $info['created'] = SBDate($dateformat, $res->fields['created']);
    $ltemp = explode(",", $res->fields[6] == 0 ? 'Навсегда' : SecondsToString(intval($res->fields[6])));
    $info['length'] = $ltemp[0];
    $info['icon'] = empty($res->fields[13]) ? 'web.png' : $res->fields[13];
    $info['authid'] = $res->fields[2];
    $info['ip'] = $res->fields[1];
    if ($res->fields[15] == 1) {
        $info['search_link'] = "index.php?p=banlist&advSearch=" . $info['ip'] . "&advType=ip&Submit";
    } else {
        $info['search_link'] = "index.php?p=banlist&advSearch=" . $info['authid'] . "&advType=steamid&Submit";
    }
    $info['link_url'] = "window.location = '" . $info['search_link'] . "';";
    $info['short_name'] = trunc($info['name'], 25, false);
    if ($res->fields[14] == 'D' || $res->fields[14] == 'U' || $res->fields[14] == 'E' || $res->fields[6] && $res->fields[5] < time()) {
        $info['unbanned'] = true;
        if ($res->fields[14] == 'D') {
            $info['ub_reason'] = 'У';
        } elseif ($res->fields[14] == 'U') {
            $info['ub_reason'] = 'Р';
        } else {
            $info['ub_reason'] = 'И';
        }
    } else {
        $info['unbanned'] = false;
    }
    array_push($bans, $info);
    $res->MoveNext();
}
Example #13
0
 /** public function get_outcome
  *		Returns the current outcome of the previous move
  *
  * @param void
  * @return bool game winner
  */
 public function get_outcome()
 {
     call(__METHOD__);
     call($this->get_board_ascii());
     $return = array();
     // search the board for matching attributes
     // search vertical
     for ($x = 0; $x < 4; ++$x) {
         for ($y = 0; $y < 4; ++$y) {
             $index = $x + $y * 4;
             $piece = $this->board[$index];
             if ('.' == $piece) {
                 $and = $not = false;
                 break;
             }
             if (0 == $y) {
                 $and = hexdec($piece);
                 $not = trunc(~hexdec($piece), 4);
             } else {
                 $and = $and & hexdec($piece);
                 $not = trunc($not & ~hexdec($piece), 4);
             }
             // no need to keep searching if the ones we have don't match
             if (!$and && !$not) {
                 break;
             }
         }
         if ($and || $not) {
             $cols = array('A', 'B', 'C', 'D');
             $return[$cols[$x]] = $and | $not;
         }
     }
     // search horizontal
     for ($y = 0; $y < 4; ++$y) {
         for ($x = 0; $x < 4; ++$x) {
             $index = $x + $y * 4;
             $piece = $this->board[$index];
             if ('.' == $piece) {
                 $and = $not = false;
                 break;
             }
             if (0 == $x) {
                 $and = hexdec($piece);
                 $not = trunc(~hexdec($piece), 4);
             } else {
                 $and = $and & hexdec($piece);
                 $not = trunc($not & ~hexdec($piece), 4);
             }
             // no need to keep searching if the ones we have don't match
             if (!$and && !$not) {
                 break;
             }
         }
         if ($and || $not) {
             $return[$y + 1] = $and | $not;
         }
     }
     // search diagonal
     for ($i = 0; $i < 2; ++$i) {
         for ($j = 0; $j < 4; ++$j) {
             for ($k = 0; $k < 4; ++$k) {
                 if (!$this->diagonal_torus && 0 < $j) {
                     $and = $not = false;
                     continue;
                 }
                 $x = $k + $j;
                 $y = $k;
                 while (4 <= $x) {
                     $x -= 4;
                 }
                 if ($i) {
                     $x = 3 - $x;
                 }
                 $index = $x + $y * 4;
                 $piece = $this->board[$index];
                 if ('.' == $piece) {
                     $and = $not = false;
                     break;
                 }
                 if (0 == $k) {
                     $and = hexdec($piece);
                     $not = trunc(~hexdec($piece), 4);
                 } else {
                     $and = $and & hexdec($piece);
                     $not = trunc($not & ~hexdec($piece), 4);
                 }
                 // no need to keep searching if the ones we have don't match
                 if (!$and && !$not) {
                     break;
                 }
             }
             if ($and || $not) {
                 $diags = array('\\', '/');
                 $l = $j;
                 if ($i) {
                     $l = 3 - $j;
                 }
                 $return[$diags[$i] . ' ' . chr(65 + $l)] = $and | $not;
             }
         }
     }
     // search small squares
     if ($this->small_square_matches) {
         for ($i = 0; $i < 16; ++$i) {
             for ($j = 0; $j < 4; ++$j) {
                 $x = $j % 2;
                 // vert addition
                 $y = (int) floor($j / 2) * 4;
                 // horz addition
                 // fix for edges
                 if (3 == $i % 4) {
                     // right edge
                     if (!$this->small_square_torus) {
                         $and = $not = false;
                         break;
                     }
                     $x *= -3;
                     // adjust vert
                 }
                 if (12 <= $i) {
                     // bottom edge
                     if (!$this->small_square_torus) {
                         $and = $not = false;
                         break;
                     }
                     $y *= -3;
                     // adjust horz
                 }
                 if (!$this->small_square_torus && 3 == $i % 4 && 12 <= $i) {
                     $and = $not = false;
                     break;
                 }
                 $index = $i + $x + $y;
                 $piece = $this->board[$index];
                 if ('.' == $piece) {
                     $and = $not = false;
                     break;
                 }
                 if (0 == $j) {
                     $and = hexdec($piece);
                     $not = trunc(~hexdec($piece), 4);
                 } else {
                     $and = $and & hexdec($piece);
                     $not = trunc($not & ~hexdec($piece), 4);
                 }
                 // no need to keep searching if the ones we have don't match
                 if (!$and && !$not) {
                     break;
                 }
             }
             if ($and || $not) {
                 $return[$this->index_to_target($i)] = $and | $not;
             }
         }
     }
     // check if the game is over due to draw
     if (!$return && false === strpos($this->board, '.')) {
         $return = array('DRAW');
     }
     call($return);
     return $return;
 }
Example #14
0
    function widget($args, $instance)
    {
        $cache = wp_cache_get('etheme_widget_recent_entries', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? false : $instance['title']);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
        if ($r->have_posts()) {
            ?>
        <?php 
            echo $before_widget;
            ?>
        <?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
            <div>
                <?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
                    <div class="recent-post-mini">
                        <?php 
                $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), array(130, 130));
                $url = $thumb[0];
                if ($url && $url != '') {
                    ?>
                            <a class="postimg" href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                    ?>
"><img src="<?php 
                    echo etheme_get_image(false, 70, 70);
                    ?>
" /></a>
                            
                        <?php 
                }
                ?>
                        <?php 
                if (get_the_title()) {
                    $title = get_the_title();
                } else {
                    $title = get_the_ID();
                }
                $title = trunc($title, 10);
                ?>
                        <a href="<?php 
                the_permalink();
                ?>
" <?php 
                if (!$url || $url == '') {
                    echo 'style="width:100%;"';
                }
                ?>
 title="<?php 
                echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                ?>
">
                            <?php 
                echo $title;
                ?>
 
                        </a><br />
                        <?php 
                _e('by', ETHEME_DOMAIN);
                ?>
 <strong><?php 
                the_author();
                ?>
</strong><br>
                        <?php 
                the_time(get_option('date_format'));
                ?>
                        <div class="clear"></div>
                    </div>
                <?php 
            }
            ?>
            </div>
        <?php 
            echo $after_widget;
            wp_reset_query();
            // Restore global post data stomped by the_post().
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_add('etheme_widget_recent_entries', $cache, 'widget');
    }
Example #15
0
<table cellpadding="0" cellspacing="0" class="db-table">
<tr>
<th>Source URL</th>
<th>Magnet URL</th>
<th>Description</th>
<th>More Info</th>
</tr>
<?php 
while ($row = mysql_fetch_array($result)) {
    echo "</td><td>";
    echo '<a href="' . $row['url'] . '">Source</a>';
    echo "</td><td>";
    echo '<a href="' . $row['magnet'] . '">Download</a>';
    echo "</td><td>";
    if ($trunc == TRUE) {
        echo trunc($row['description'], 15);
    } else {
        echo nl2br($row['description']);
    }
    echo "</td><td>";
    echo '<a href="index.php?id=' . $row['id'] . '">Info</a>';
    echo "</td></tr>";
}
echo "</table>";
if (!($id || $search)) {
    ?>
You are at page: <?php 
    echo $page;
    ?>
 of <?php 
    echo $totpages;
Example #16
0
    function widget($args, $instance)
    {
        $cache = wp_cache_get('etheme_widget_recent_entries', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $box_id = rand(1000, 10000);
        $title = apply_filters('widget_title', empty($instance['title']) ? false : $instance['title']);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        $slider = !empty($instance['slider']) ? (int) $instance['slider'] : false;
        $r = new WP_Query(array('posts_per_page' => $number, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
        if ($r->have_posts()) {
            ?>
        <?php 
            echo $before_widget;
            ?>
        <?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
            <?php 
            if ($slider) {
                ?>
                <div class="owl-carousel blogCarousel slider-<?php 
                echo $box_id;
                ?>
">
            <?php 
            }
            ?>
			<ul class="blog-post-list slide-item">
                <?php 
            $i = 0;
            while ($r->have_posts()) {
                $r->the_post();
                $i++;
                ?>
	                <?php 
                if (get_the_title()) {
                    $title = get_the_title();
                } else {
                    $title = get_the_ID();
                }
                $title = trunc($title, 10);
                ?>
					<li>
						<div class="media">
							<a class="pull-left" href="#">
								<time class="date-event"><span class="number"><?php 
                the_time('d');
                ?>
</span> <?php 
                the_time('M');
                ?>
</time>
							</a>
							<div class="media-body">
								<h4 class="media-heading"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                echo $title;
                ?>
</a></h4>
								<?php 
                _e('by', ETHEME_DOMAIN);
                ?>
 <strong><?php 
                the_author();
                ?>
</strong> 
							</div>
						</div>
                    </li>
                <?php 
                if ($i % 2 == 0 && $i != $r->post_count) {
                    ?>
                        </ul>
                        <ul class="blog-post-list slide-item">
                <?php 
                }
                ?>
                <?php 
            }
            ?>
            </ul>
            <?php 
            if ($slider) {
                ?>
                </div>
                <script type="text/javascript">
                    jQuery(document).ready(function($) {
                        jQuery(".slider-<?php 
                echo $box_id;
                ?>
").owlCarousel({
                            items:1,
                            navigation: true,
                            lazyLoad: true,
                            rewindNav: false,
                            addClassActive: true,
                            itemsCustom: [1600, 1]
                        });
                    });
                </script>
            <?php 
            }
            ?>
        <?php 
            echo $after_widget;
            wp_reset_query();
            // Restore global post data stomped by the_post().
        }
        if (isset($args['widget_id'])) {
            $cache[$args['widget_id']] = ob_get_flush();
            wp_cache_add('etheme_widget_recent_entries', $cache, 'widget');
        }
    }
Example #17
0
				</a>
			<?php 
}
?>

			<?php 
if ($hover == 'description') {
    ?>
				<div class="product-mask">
					<div class="mask-text">
						<h4><?php 
    _e('Product description', ETHEME_DOMAIN);
    ?>
</h4>
						<?php 
    echo trunc(get_the_excerpt(), etheme_get_option('descr_length'));
    ?>
						<p><a href="<?php 
    the_permalink();
    ?>
" class="read-more-link button"><?php 
    _e('Read More', ETHEME_DOMAIN);
    ?>
</a></p>
					</div>
				</div>
			<?php 
}
?>

			<?php 
Example #18
0
function ServerHostPlayers_list($sid, $type = "servers", $obId = "")
{
    $objResponse = new xajaxResponse();
    require INCLUDES_PATH . '/CServerInfo.php';
    $sids = explode(";", $sid, -1);
    if (count($sids) < 1) {
        return $objResponse;
    }
    $ret = "";
    for ($i = 0; $i < count($sids); $i++) {
        $sid = (int) $sids[$i];
        $res = $GLOBALS['db']->GetRow("SELECT sid, ip, port FROM " . DB_PREFIX . "_servers WHERE sid = {$sid}");
        if (empty($res[1]) || empty($res[2])) {
            return $objResponse;
        }
        $info = array();
        $sinfo = new CServerInfo($res[1], $res[2]);
        $info = $sinfo->getInfo();
        if (!empty($info['hostname'])) {
            $ret .= trunc($info['hostname'], 48, false) . "<br />";
        } else {
            $ret .= "<b>Error connecting</b> (<i>" . $res[1] . ":" . $res[2] . "</i>)<br />";
        }
    }
    if ($type == "id") {
        $objResponse->addAssign("{$obId}", "innerHTML", $ret);
    } else {
        $objResponse->addAssign("ban_server_{$type}", "innerHTML", $ret);
    }
    return $objResponse;
}
Example #19
0
function ydp_to_ymd($y, $d)
{
    $md = array(array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365), array(0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366));
    $d -= 1;
    $m = trunc($d / 29);
    if ($md[isleap($y) - 0][$m] > $d) {
        $m -= 1;
    }
    $d = $d - $md[isleap($y) - 0][$m] + 1;
    $m += 1;
    return strcat($y, '-', str_pad_left($m, 2, '0'), '-', str_pad_left($d, 2, '0'));
}