示例#1
0
 function toSubmit($payment)
 {
     $merId = $this->getConf($payment['M_OrderId'], 'member_id');
     $ikey = $this->getConf($payment['M_OrderId'], 'PrivateKey');
     //$order->M_Language = "tchinese";
     $payment["M_Language"] = "tchinese";
     //
     //$order->M_Amount = Floor($order->M_Amount);
     //$verify = md5($ikey."|".$merId."|".$order->M_OrderId."|".$order->M_Amount."|".$this->getConf('SecondPrivateKey'));
     $payment["M_Amount"] = Floor($payment["M_Amount"]);
     $verify = md5($ikey . "|" . $merId . "|" . $payment["M_OrderId"] . "|" . $payment["M_Amount"] . "|" . $this->getConf($payment['M_OrderId'], 'SecondPrivateKey'));
     $return["mid"] = $merId;
     $return["ordernum"] = $payment["M_OrderId"];
     //$order->M_OrderId;
     $return["txid"] = $payment["M_OrderId"];
     //$order->M_OrderId;
     $return["iid"] = "0";
     $return["amount"] = $payment["M_Amount"];
     //$order->M_Amount;
     $return["cname"] = $payment["R_Name"];
     //$order->R_Name;
     $return["caddress"] = $payment["R_Address"];
     //$order->R_Address;
     $return["language"] = $payment["M_Language"];
     //$order->M_Language;
     $return["version"] = "1.0";
     $return["return_url"] = $this->callbackUrl;
     $return["verify"] = $verify;
     return $return;
 }
示例#2
0
/**
*   Get Same Object 
*/
function event_getobject($event, $cityid)
{
    global $db, $phpEx, $phpbb_root_path, $user;
    $message = '';
    //根据膜拜次数确定物品加成
    $getobject = $getobject + Floor($userdata['worship'] / 1000);
    $sql = 'SELECT event.*,object.name FROM ' . EVENT_PROBABILITY . ' AS event  
			LEFT ' . OBJECTS_TABLE . " AS object ON (event.object_id=object.object_id)\r\n\t\t\t\t\tWHERE event.event_id=" . $event . ' AND event.city_id=' . $cityid;
    $db->sql_query($sql);
    $get_rand = rand(1, 60000);
    $objectid = 0;
    while ($row = $db->sql_fetchrow($result)) {
        if ((int) $row[s_numerator] < $get_rand && (int) $row[e_numerator] > $get_rand) {
            $object_id = $row['object_id'];
        }
    }
    if ($objectid != 0) {
        //添加物品
        $sql = 'SELECT * FROM ' . USER_BAG . "  \r\n\t\t\t\t\t\tWHERE user_id=" . $user->data['user_id'] . ' AND objectid=' . $objectid;
        if ($db->sql_query($sql) && $db->sql_affectedrows()) {
            $sql = 'UPDATE ' . USER_BAG . ' SET  object_num=object_num+' . $getobject . " WHERE user_id=" . $user->data['user_id'] . ' AND objectid=' . $objectid;
        } else {
            $sql = 'INSERT INTO ' . USER_BAG . " (user_id,objectid,object_num,object_type)  VALUES ( " . $user->data['user_id'] . ',' . $objectid . ',' . $getobject . ',' . $sys_objects[$objectid]['objecttype'] . ')';
        }
        $db->sql_query($sql);
        $db->sql_freeresult($result);
        $message = sprintf('得到 %d 个' . $row['name'], $getobject);
    }
    return $message;
}
示例#3
0
function JulianDayToGregorian($Julian)
{
    #---------------------------------------------------------------------------
    $Julian = $Julian - 1721119;
    $Calc1 = 4 * $Julian - 1;
    #---------------------------------------------------------------------------
    $Year = Floor($Calc1 / 146097);
    $Julian = Floor($Calc1 - 146097 * $Year);
    $Day = Floor($Julian / 4);
    $Calc2 = 4 * $Day + 3;
    #---------------------------------------------------------------------------
    $Julian = Floor($Calc2 / 1461);
    $Day = $Calc2 - 1461 * $Julian;
    $Day = Floor(($Day + 4) / 4);
    $Calc3 = 5 * $Day - 3;
    #---------------------------------------------------------------------------
    $Month = Floor($Calc3 / 153);
    $Day = $Calc3 - 153 * $Month;
    $Day = Floor(($Day + 5) / 5);
    $Year = 100 * $Year + $Julian;
    #---------------------------------------------------------------------------
    if ($Month < 10) {
        $Month = $Month + 3;
    } else {
        #-------------------------------------------------------------------------
        $Month = $Month - 9;
        $Year = $Year + 1;
    }
    #---------------------------------------------------------------------------
    return MkTime(0, 0, 0, $Month, $Day, $Year);
}
示例#4
0
function ApplyMask(&$image, $mask)
{
    // Create copy of mask as mask may not be the same size as image
    $mask_resized = ImageCreateTrueColor(ImageSX($image), ImageSY($image));
    ImageCopyResampled($mask_resized, $mask, 0, 0, 0, 0, ImageSX($image), ImageSY($image), ImageSX($mask), ImageSY($mask));
    // Create working temp
    $mask_blendtemp = ImageCreateTrueColor(ImageSX($image), ImageSY($image));
    $color_background = ImageColorAllocate($mask_blendtemp, 0, 0, 0);
    ImageFilledRectangle($mask_blendtemp, 0, 0, ImageSX($mask_blendtemp), ImageSY($mask_blendtemp), $color_background);
    // switch off single color alph and switch on full alpha channel
    ImageAlphaBlending($mask_blendtemp, false);
    ImageSaveAlpha($mask_blendtemp, true);
    // loop the entire image and set pixels, this will be slow for large images
    for ($x = 0; $x < ImageSX($image); $x++) {
        for ($y = 0; $y < ImageSY($image); $y++) {
            $RealPixel = GetPixelColor($image, $x, $y);
            $MaskPixel = GrayscalePixel(GetPixelColor($mask_resized, $x, $y));
            $MaskAlpha = 127 - Floor($MaskPixel['red'] / 2) * (1 - $RealPixel['alpha'] / 127);
            $newcolor = ImageColorAllocateAlpha($mask_blendtemp, $RealPixel['red'], $RealPixel['green'], $RealPixel['blue'], $MaskAlpha);
            ImageSetPixel($mask_blendtemp, $x, $y, $newcolor);
        }
    }
    // don't need the mask copy anymore
    ImageDestroy($mask_resized);
    // switch off single color alph and switch on full alpha channel
    ImageAlphaBlending($image, false);
    ImageSaveAlpha($image, true);
    // replace the image with the blended temp
    ImageCopy($image, $mask_blendtemp, 0, 0, 0, 0, ImageSX($mask_blendtemp), ImageSY($mask_blendtemp));
    ImageDestroy($mask_blendtemp);
}
示例#5
0
文件: map.html.php 项目: norter/Game
function determineCoordsFromParameters($caveData, $mapSize)
{
    // default Werte: Koordinaten of the given caveData (that is the data of the presently selected own cave)
    $xCoord = $caveData['xCoord'];
    $yCoord = $caveData['yCoord'];
    $message = '';
    // wenn in die Minimap geklickt wurde, zoome hinein
    if (($minimap_x = Request::getVar('minimap_x', 0)) && ($minimap_y = Request::getVar('minimap_y', 0)) && ($scaling = Request::getVar('scaling', 0)) !== 0) {
        $xCoord = Floor($minimap_x * 100 / $scaling) + $mapSize['minX'];
        $yCoord = Floor($minimap_y * 100 / $scaling) + $mapSize['minY'];
    } else {
        if ($caveName = Request::getVar('caveName', '')) {
            $coords = getCaveByName($caveName);
            if (!$coords['xCoord']) {
                $message = sprintf(_('Die Höhle mit dem Namen: "%s" konnte nicht gefunden werden!'), $caveName);
            } else {
                $xCoord = $coords['xCoord'];
                $yCoord = $coords['yCoord'];
                $message = sprintf(_('Die Höhle mit dem Namen: "%s" befindet sich in (%d|%d).'), $caveName, $xCoord, $yCoord);
            }
        } else {
            if (($targetCaveID = Request::getVar('targetCaveID', 0)) !== 0) {
                $coords = getCaveByID($targetCaveID);
                if ($coords === null) {
                    $message = sprintf(_('Die Höhle mit der ID: "%d" konnte nicht gefunden werden!'), $targetCaveID);
                } else {
                    $xCoord = $coords['xCoord'];
                    $yCoord = $coords['yCoord'];
                    $message = sprintf(_('Die Höhle mit der ID: "%d" befindet sich in (%d|%d).'), $targetCaveID, $xCoord, $yCoord);
                }
            } else {
                if (Request::getVar('xCoord', 0) && Request::getVar('yCoord', 0)) {
                    $xCoord = Request::getVar('xCoord', 0);
                    $yCoord = Request::getVar('yCoord', 0);
                }
            }
        }
    }
    // Koordinaten begrenzen
    if ($xCoord < $mapSize['minX']) {
        $xCoord = $mapSize['minX'];
    }
    if ($yCoord < $mapSize['minY']) {
        $yCoord = $mapSize['minY'];
    }
    if ($xCoord > $mapSize['maxX']) {
        $xCoord = $mapSize['maxX'];
    }
    if ($yCoord > $mapSize['maxY']) {
        $yCoord = $mapSize['maxY'];
    }
    return array('xCoord' => $xCoord, 'yCoord' => $yCoord, 'message' => $message);
}
示例#6
0
	function rvb2hexa($composante){
		$hexa=array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");

		$hex1=Floor($composante/16);
		$hex2=$composante-$hex1*16;
		$chaine=$hexa["$hex1"].$hexa["$hex2"];
		$fich=fopen("/tmp/svg.txt","a+");
		/*
		fwrite($fich,"Composante: $composante\n");
		fwrite($fich,"\$hex1: $hex1\n");
		fwrite($fich,"\$hex2: $hex2\n");
		fwrite($fich,"\$chaine: $chaine\n");
		*/
		return $chaine;
	}
示例#7
0
 protected function process(ViewBag $viewbag)
 {
     $thumbnailer = $this->movie->getThumbnailer();
     $viewbag->Thumbnailer = $thumbnailer;
     // List of defined cutpoints
     $max = $this->movie->getMaxSeek();
     $duration_sec = $this->movie->duration();
     $viewbag->CutList = array();
     foreach ($this->list->getCutRegions() as $v) {
         $left = $v[0];
         $right = $v[1];
         $duration_mark = ($right == -1 ? $max : $right) - $left;
         $secs = Floor(DoubleVal($duration_mark) / $max * $duration_sec);
         $c = new StdClass();
         $c->Timestamp = sprintf("%02d:%02d:%02d ", floor($secs / 3600), $secs % 3600 / 60, $secs % 60);
         $c->Left = $left;
         $c->Right = $right == -1 ? $max : $right;
         $viewbag->CutList[] = $c;
     }
     $this->SetView($this->ajax ? "MovieAjax" : "Movie");
 }
示例#8
0
 function toSubmit($payment)
 {
     if ($this->getConf('system.shoplang') == "en_US") {
         $this->submitUrl = "https://gwpay.com.tw/form_Sc_to5e.php";
     } else {
         $this->submitUrl = "https://gwpay.com.tw/form_Sc_to5.php";
     }
     $merId = $this->getConf($payment["M_OrderId"], 'member_id');
     $ikey = $this->getConf($payment["M_OrderId"], 'PrivateKey');
     $payment["M_Amount"] = Floor($payment["M_Amount"]);
     //$order->M_Amount = Floor($order->M_Amount);
     $return['act'] = "auth";
     $return['client'] = $merId;
     $return['od_sob'] = $payment["M_OrderId"];
     //$order->M_OrderId;
     $return['amount'] = $payment["M_Amount"];
     //$order->M_Amount;
     $return['email'] = $payment["R_Email"];
     //$order->R_Email;
     $return['roturl'] = $this->callbackUrl;
     return $return;
 }
示例#9
0
 public function ConvertMinutes2Hours($Minutes)
 {
     if ($Minutes < 0) {
         $Min = Abs($Minutes);
     } else {
         $Min = $Minutes;
     }
     $iHours = Floor($Min / 60);
     $Minutes = ($Min - $iHours * 60) / 100;
     $tHours = $iHours + $Minutes;
     if ($Minutes < 0) {
         $tHours = $tHours * -1;
     }
     $aHours = explode(".", $tHours);
     $iHours = $aHours[0];
     if (empty($aHours[1])) {
         $aHours[1] = "00";
     }
     $Minutes = $aHours[1];
     if (strlen($Minutes) < 2) {
         $Minutes = $Minutes . "0";
     }
     $tHours = $iHours . ":" . $Minutes;
     return $tHours;
 }
示例#10
0
     exit;
 }
 GetWeaponDetails("{$TactFactory['c_wep']}", 'CustWepS');
 if (isset($secureCustom)) {
     $secureCustom = 1;
     if ($ttlused_pt + $CustWepS['complexity'] * 10 > $TactFactory['c_point'] || $ttlused_pt <= 0) {
         echo "改造點數不足或出錯!";
         postFooter();
         exit;
     }
 } else {
     $secureCustom = 0;
 }
 $CustomedAtk = Floor($CustWepS['atk'] * $atkc_pt * 0.005);
 $CustomedHit = Floor($CustWepS['hit'] * $hitc_pt * 0.005);
 $CustomedRd = Floor($CustWepS['rd'] * $rdc_pt * 0.005);
 $CustomedENCc = $CustWepS['enc'] * (1 + $atkc_pt * 0.01) * (1 + $rdc_pt * 0.01) * (1 + $hitc_pt * 0.01);
 $CustomedENC = Ceil($CustomedENCc - $CustomedENCc * $encc_pt * 0.005);
 $fixedname = preg_replace('/([!@#$%^&*()[\\]\\{}\'",.\\/<>?|]|--)+/', '', $fixedname);
 if ($namefix > 2 || $namefix < 1) {
     echo "Cannot Get Fix Type";
     postFooter();
     exit;
 }
 unset($sql);
 if (strlen($fixedname) > 32) {
     echo "專用名稱過長!";
     postFooter();
     exit;
 }
 $costPt = $ttlused_pt;
示例#11
0
 function milmillon($nummierod)
 {
     if ($nummierod >= 1000000000 && $nummierod < 2000000000) {
         $num_letrammd = "MIL " . cienmillon($nummierod % 1000000000);
     }
     if ($nummierod >= 2000000000 && $nummierod < 10000000000) {
         $num_letrammd = unidad(Floor($nummierod / 1000000000)) . " MIL " . cienmillon($nummierod % 1000000000);
     }
     if ($nummierod < 1000000000) {
         $num_letrammd = cienmillon($nummierod);
     }
     return $num_letrammd;
 }
示例#12
0
文件: Tura.php 项目: Andrzej100/dom
 /**
  * Dodaje punkty za szybkosć 
  * @param type $szybkoscg
  * @param type $szybkoscp
  * @return type
  */
 public function obliczpunkty($szybkoscg, $szybkoscp)
 {
     $punkty = Floor($szybkoscg / $szybkoscp);
     --$punkty;
     return $punkty;
 }
示例#13
0
					
					//echo "\$lig_param->nom=$lig_param->nom<br />";
					//echo "\$lig_param->valeur=$lig_param->valeur";
					$nom=$lig_param->nom;
					$$nom=$lig_param->valeur;
					
					//if($lig_param->nom=='trombino_pdf_nb_lig') {$trombino_pdf_nb_lig=$lig_param->value;}
					//elseif($lig_param->nom=='trombino_pdf_nb_col') {$trombino_pdf_nb_col=$lig_param->value;}
				}

				// Nombre de cases par page
				$nb_cell=$trombino_pdf_nb_lig*$trombino_pdf_nb_col;
				// Hauteur d'un cadre
				$haut_cadre=Floor($hauteur_page-$MargeHaut-$MargeBas-$hauteur_classe-$ecart_sous_classe-($trombino_pdf_nb_lig-1)*$dy)/$trombino_pdf_nb_lig;
				// Largeur d'un cadre
				$larg_cadre=Floor($largeur_page-$MargeDroite-$MargeGauche-($trombino_pdf_nb_col-1)*$dx)/$trombino_pdf_nb_col;

				/*
				$msg.="\$trombino_pdf_nb_lig=$trombino_pdf_nb_lig<br />";
				$msg.="\$trombino_pdf_nb_col=$trombino_pdf_nb_col<br />";
				$msg.="\$nb_cell=$nb_cell<br />";
				$msg.="\$haut_cadre=$haut_cadre<br />";
				$msg.="\$larg_cadre=$larg_cadre<br />";
				*/

				$msg.="Traitement des découpes avec une grille de $trombino_pdf_nb_col colonnes sur $trombino_pdf_nb_lig lignes (id_grille n°$id_grille).<br />";

				if (isset($GLOBALS['multisite']) AND $GLOBALS['multisite'] == 'y') {
					// On récupère le RNE de l'établissement
					$repertoire2=$_COOKIE['RNE']."/";
				}
示例#14
0
     $sql = "UPDATE `" . $GLOBALS['DBPrefix'] . "phpeb_user_general_info` SET `cash` = '{$GenVal['cash']}',\r\n`msuit` = {$GenVal['msuit']} WHERE `username` = '{$Pl_Value['USERNAME']}' LIMIT 1;";
     mysql_query($sql);
     echo "<form action=gmscrn_main.php?action=proc method=post name=frmreturn target=Alpha>";
     echo "<p align=center style=\"font-size: 16pt\">购买完成了!<br><input type=submit value=\"返回\" onClick=\"parent.Beta.location.replace('gen_info.php')\"></p>";
 } elseif ($actionc == 'sell') {
     GetMsDetails("{$GenVal['msuit']}", 'NowMS');
     $Pl_WepD = explode('<!>', $GameVal['eqwep']);
     GetWeaponDetails("{$Pl_WepD['0']}", 'Pl_SyWepD');
     $Pl_WepE = explode('<!>', $GameVal['p_equip']);
     GetWeaponDetails("{$Pl_WepE['0']}", 'Pl_SyWepE');
     if (!$GenVal['msuit']) {
         echo "你没有机体!!<br>";
         PostFooter();
         exit;
     }
     $SellPrice = Floor($NowMS['price'] / 2 + $NowMS['price'] * 0.2);
     $GenVal['cash'] = $GenVal['cash'] + $SellPrice;
     $GameVal['hpmax'] = $GameVal['hpmax'] - $NowMS['hpfix'];
     $GameVal['enmax'] = $GameVal['enmax'] - $NowMS['enfix'];
     $GenVal['msuit'] = '0';
     $HP_Sub = $EN_Sub = 0;
     if (ereg('(ExtHP)+', $Pl_SyWepE['spec'])) {
         $a = ereg_replace('.*ExtHP<', '', $Pl_SyWepE['spec']);
         $HP_Sub = intval($a);
     }
     if (ereg('(ExtEN)+', $Pl_SyWepE['spec'])) {
         $a = ereg_replace('.*ExtEN<', '', $Pl_SyWepE['spec']);
         $EN_Sub = intval($a);
     }
     $GameVal['hpmax'] -= $HP_Sub;
     $GameVal['enmax'] -= $EN_Sub;
示例#15
0
 function bcmul($Num1 = '0', $Num2 = '0')
 {
     // check if they're both plain numbers
     if (!preg_match("/^\\d+\$/", $Num1) || !preg_match("/^\\d+\$/", $Num2)) {
         return 0;
     }
     // remove zeroes from beginning of numbers
     for ($i = 0; $i < strlen($Num1); $i++) {
         if (@$Num1[$i] != '0') {
             $Num1 = substr($Num1, $i);
             break;
         }
     }
     for ($i = 0; $i < strlen($Num2); $i++) {
         if (@$Num2[$i] != '0') {
             $Num2 = substr($Num2, $i);
             break;
         }
     }
     // get both number lengths
     $Len1 = strlen($Num1);
     $Len2 = strlen($Num2);
     // $Rema is for storing the calculated numbers and $Rema2 is for carrying the remainders
     $Rema = $Rema2 = array();
     // we start by making a $Len1 by $Len2 table (array)
     for ($y = $i = 0; $y < $Len1; $y++) {
         for ($x = 0; $x < $Len2; $x++) {
             // we use the classic lattice method for calculating the multiplication..
             // this will multiply each number in $Num1 with each number in $Num2 and store it accordingly
             @($Rema[$i++ % $Len2] .= sprintf('%02d', (int) $Num1[$y] * (int) $Num2[$x]));
         }
     }
     // cycle through each stored number
     for ($y = 0; $y < $Len2; $y++) {
         for ($x = 0; $x < $Len1 * 2; $x++) {
             // add up the numbers in the diagonal fashion the lattice method uses
             @($Rema2[Floor(($x - 1) / 2) + 1 + $y] += (int) $Rema[$y][$x]);
         }
     }
     // reverse the results around
     $Rema2 = array_reverse($Rema2);
     // cycle through all the results again
     for ($i = 0; $i < count($Rema2); $i++) {
         // reverse this item, split, keep the first digit, spread the other digits down the array
         $Rema3 = str_split(strrev($Rema2[$i]));
         for ($o = 0; $o < count($Rema3); $o++) {
             if ($o == 0) {
                 @($Rema2[$i + $o] = $Rema3[$o]);
             } else {
                 @($Rema2[$i + $o] += $Rema3[$o]);
             }
         }
     }
     // implode $Rema2 so it's a string and reverse it, this is the result!
     $Rema2 = strrev(implode($Rema2));
     // just to make sure, we delete the zeros from the beginning of the result and return
     while (strlen($Rema2) > 1 && $Rema2[0] == '0') {
         $Rema2 = substr($Rema2, 1);
     }
     return $Rema2;
 }
示例#16
0
function getCaveMapContent($caves, $caveID, $playerID)
{
    global $params, $config, $terrainList;
    $caveData = $caves[$caveID];
    $message = '';
    // template öffnen
    $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/map.ihtml');
    // Grundparameter setzen
    tmpl_set($template, 'modus', MAP);
    tmpl_set($template, 'cave_book_link', CAVE_BOOK);
    // ADDED by chris--- for cavebook
    // default Werte: Koordinaten dieser Höhle
    $xCoord = $caveData['xCoord'];
    $yCoord = $caveData['yCoord'];
    // Größe der Karte wird benötigt
    $mapSize = getMapSize();
    // wenn in die Minimap geklickt wurde, zoome hinein
    if (!empty($params->POST->minimap_x) && !empty($params->POST->minimap_y) && $params->POST->scaling != 0) {
        $xCoord = Floor($params->POST->minimap_x * 100 / $params->POST->scaling) + $mapSize['minX'];
        $yCoord = Floor($params->POST->minimap_y * 100 / $params->POST->scaling) + $mapSize['minY'];
    } else {
        if (!empty($params->POST->caveName)) {
            $coords = getCaveByName($params->POST->caveName);
            if (sizeof($coords) == 0) {
                $message = 'Die Siedlung mit dem Namen: "' . $params->POST->caveName . '" konnte nicht gefunden werden!';
            } else {
                $xCoord = $coords['xCoord'];
                $yCoord = $coords['yCoord'];
                $message = 'Die Siedlung mit dem Namen: "' . $params->POST->caveName . '" befindet sich in (' . $xCoord . ' | ' . $yCoord . ').';
            }
        } else {
            if (!empty($params->POST->targetCaveID)) {
                $coords = getCaveByID($params->POST->targetCaveID);
                if ($coords === null) {
                    $message = 'Die Siedlung mit der ID: "' . $params->POST->targetCaveID . '" konnte nicht gefunden werden!';
                } else {
                    $xCoord = $coords['xCoord'];
                    $yCoord = $coords['yCoord'];
                    $message = 'Die Siedlung mit der ID: "' . $params->POST->targetCaveID . '" befindet sich in (' . $xCoord . ' | ' . $yCoord . ').';
                }
            } else {
                if (!empty($params->POST->xCoord) && !empty($params->POST->yCoord)) {
                    $xCoord = $params->POST->xCoord;
                    $yCoord = $params->POST->yCoord;
                }
            }
        }
    }
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $message);
    }
    // Koordinaten begrenzen
    if ($xCoord < $mapSize['minX']) {
        $xCoord = $mapSize['minX'];
    }
    if ($yCoord < $mapSize['minY']) {
        $yCoord = $mapSize['minY'];
    }
    if ($xCoord > $mapSize['maxX']) {
        $xCoord = $mapSize['maxX'];
    }
    if ($yCoord > $mapSize['maxY']) {
        $yCoord = $mapSize['maxY'];
    }
    // width und height anpassen
    $MAP_WIDTH = min(MAP_WIDTH, $mapSize['maxX'] - $mapSize['minX'] + 1);
    $MAP_HEIGHT = min(MAP_HEIGHT, $mapSize['maxY'] - $mapSize['minY'] + 1);
    // Nun befinden sich in $xCoord und $yCoord die gesuchten Koordinaten.
    // ermittele nun die linke obere Ecke des Bildausschnittes
    $minX = min(max($xCoord - intval($MAP_WIDTH / 2), $mapSize['minX']), $mapSize['maxX'] - $MAP_WIDTH + 1);
    $minY = min(max($yCoord - intval($MAP_HEIGHT / 2), $mapSize['minY']), $mapSize['maxY'] - $MAP_HEIGHT + 1);
    // ermittele nun die rechte untere Ecke des Bildausschnittes
    $maxX = $minX + $MAP_WIDTH - 1;
    $maxY = $minY + $MAP_HEIGHT - 1;
    // get the map details
    $caveDetails = getCaveDetailsByCoords($minX, $minY, $maxX, $maxY);
    $map = array();
    foreach ($caveDetails as $cave) {
        // ADDED by chris--- for Quests --------------------------------------------------------------------------------
        global $db;
        if ($cave['quest_cave'] && !isCaveInvisibleToPlayer($cave['caveID'], $playerID, $db) && $cave['invisible_name'] != "") {
            $cave['cavename'] = $cave['invisible_name'];
        }
        // -------------------------------------------------------------------------------------------------------
        $cell = array('terrain' => strtolower($terrainList[$cave['terrain']]['name']), 'alt' => "{$cave['cavename']} - ({$cave['xCoord']}|{$cave['yCoord']})", 'link' => "modus=" . MAP_DETAIL . "&targetCaveID={$cave['caveID']}");
        // unbewohnte Höhle
        // ADDED by chris--- for Quests
        // ----------------------------------------------------------
        // checking if this cave is a quest cave and if its visible to the player (than he knows the quest)
        // if he does not know the quest the cave is invisible
        if ($cave['quest_cave'] && isCaveInvisibleToPlayer($cave['caveID'], $playerID, $db)) {
            $cave['playerID'] = 0;
        }
        // ----------------------------------------------------------
        if ($cave['playerID'] == 0) {
            // als Frei! zeigen, wenn man missionieren kann
            if (sizeof($caves) < $params->SESSION->user['takeover_max_caves'] && $cave['takeoverable'] == 1) {
                $text = "Frei!";
                $file = "icon_cave_empty";
                // als Einöde zeigen, wenn man nicht mehr missionieren kann
            } else {
                $text = "Ein&ouml;de";
                $file = "icon_waste";
            }
            // oder Dunkelheit zeigen?
            if ($cave['terrain'] == 4 && $text != "Frei!") {
                $text = "verdorrtes Land";
                $file = "icon_waste";
            }
            // bewohnte Höhle
        } else {
            // eigene Höhle
            if ($cave['playerID'] == $params->SESSION->user['playerID']) {
                $file = "icon_cave_own";
            } else {
                $file = "icon_cave_other";
                if ($cave['quest_cave']) {
                    $file = "icon_cave_quest";
                }
            }
            // mit Artefakt
            if ($cave['artefacts'] != 0 && ($cave['tribe'] != GOD_ALLY || $params->SESSION->user['tribe'] == GOD_ALLY)) {
                $file .= "_artefact";
            }
            // link zum Tribe einfügen
            $cell['link_tribe'] = "modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($cave['tribe']));
            // Clan abkürzen
            $decodedTribe = unhtmlentities($cave['tribe']);
            if (strlen($decodedTribe) > 10) {
                $cell['text_tribe'] = htmlentities(substr($decodedTribe, 0, 8)) . "..";
            } else {
                $cell['text_tribe'] = $cave['tribe'];
            }
            // Besitzer
            $decodedOwner = unhtmlentities($cave['name']);
            if (strlen($decodedOwner) > 10) {
                $text = htmlentities(substr($decodedOwner, 0, 8)) . "..";
            } else {
                $text = $cave['name'];
            }
            // übernehmbare Höhlen können gekennzeichnet werden
            if ($cave['secureCave'] != 1) {
                $cell['unsecure'] = array('dummy' => '');
            }
        }
        $cell['file'] = $file;
        $cell['text'] = $text;
        // Wenn die Höhle ein Artefakt enthält und man berechtigt ist -> anzeigen
        if ($cave['artefacts'] != 0 && ($cave['tribe'] != GOD_ALLY || $params->SESSION->user['tribe'] == GOD_ALLY)) {
            $cell['artefacts'] = $cave['artefacts'];
            $cell['artefacts_text'] = "Artefakte: {$cave['artefacts']}";
        }
        $map[$cave['xCoord']][$cave['yCoord']] = $cell;
    }
    // Karte mit Beschriftungen ausgeben
    // über alle Zeilen
    for ($j = $minY - 1; $j <= $maxY + 1; ++$j) {
        tmpl_iterate($template, '/ROWS');
        // über alle Spalten
        for ($i = $minX - 1; $i <= $maxX + 1; ++$i) {
            tmpl_iterate($template, '/ROWS/CELLS');
            // leere Zellen
            if (($j == $minY - 1 || $j == $maxY + 1) && ($i == $minX - 1 || $i == $maxX + 1)) {
                tmpl_set($template, "/ROWS/CELLS", getEmptyCell());
                // x-Beschriftung
            } else {
                if ($j == $minY - 1 || $j == $maxY + 1) {
                    tmpl_set($template, "/ROWS/CELLS", getLegendCell('x', $i));
                    // y-Beschriftung
                } else {
                    if ($i == $minX - 1 || $i == $maxX + 1) {
                        tmpl_set($template, "/ROWS/CELLS", getLegendCell('y', $j));
                        // Kartenzelle
                    } else {
                        tmpl_set($template, "/ROWS/CELLS", getMapCell($map, $i, $j));
                    }
                }
            }
        }
    }
    // ADDED by chris--- for cavebook:
    // Getting entries
    $cavelist = cavebook_getEntries($params->SESSION->user['playerID']);
    // Show the cave table
    for ($i = 0; $i < sizeof($cavelist[id]); $i++) {
        $cavename = $cavelist[name][$i];
        // the current cavename
        $cavebookID = $cavelist[id][$i];
        $cave_x = $cavelist[x][$i];
        $cave_y = $cavelist[y][$i];
        tmpl_iterate($template, '/BOOKENTRY');
        tmpl_set($template, 'BOOKENTRY/book_entry', $cavename);
        tmpl_set($template, 'BOOKENTRY/book_id', $cavebookID);
        tmpl_set($template, 'BOOKENTRY/book_x', $cave_x);
        tmpl_set($template, 'BOOKENTRY/book_y', $cave_y);
    }
    // Minimap
    $width = $mapSize['maxX'] - $mapSize['minX'] + 1;
    $height = $mapSize['maxY'] - $mapSize['minY'] + 1;
    // compute mapcenter coords
    $mcX = $minX + intval($MAP_WIDTH / 2);
    $mcY = $minY + intval($MAP_HEIGHT / 2);
    tmpl_set($template, "/MINIMAP", array('file' => "images/minimap.png.php?x=" . $xCoord . "&y=" . $yCoord, 'modus' => MAP, 'width' => intval($width * MINIMAP_SCALING / 100), 'height' => intval($height * MINIMAP_SCALING / 100), 'scaling' => MINIMAP_SCALING));
    tmpl_set($template, '/O', array('modus' => MAP, 'x' => $mcX + $MAP_WIDTH, 'y' => $mcY));
    tmpl_set($template, '/SO', array('modus' => MAP, 'x' => $mcX + $MAP_WIDTH, 'y' => $mcY + $MAP_HEIGHT));
    tmpl_set($template, '/S', array('modus' => MAP, 'x' => $mcX, 'y' => $mcY + $MAP_HEIGHT));
    tmpl_set($template, '/SW', array('modus' => MAP, 'x' => $mcX - $MAP_WIDTH, 'y' => $mcY + $MAP_HEIGHT));
    tmpl_set($template, '/W', array('modus' => MAP, 'x' => $mcX - $MAP_WIDTH, 'y' => $mcY));
    tmpl_set($template, '/NW', array('modus' => MAP, 'x' => $mcX - $MAP_WIDTH, 'y' => $mcY - $MAP_HEIGHT));
    tmpl_set($template, '/N', array('modus' => MAP, 'x' => $mcX, 'y' => $mcY - $MAP_HEIGHT));
    tmpl_set($template, '/NO', array('modus' => MAP, 'x' => $mcX + $MAP_WIDTH, 'y' => $mcY - $MAP_HEIGHT));
    return tmpl_parse($template);
}
示例#17
0
 if (ereg('(DoubleMon)+', $Pl_Spec)) {
     $Pl_Gain_Money *= 2;
 }
 if ($StrikePercentage == 0) {
     $Pl_Gain_Money = 0;
 }
 $Pl_Gen['cash'] += floor($Pl_Gain_Money + $Pl_Game['rank'] * 0.075);
 //Gain Bounty
 $Gain_Bounty = 0;
 if ($Op_Gen['bounty'] > 100 && $VictoryFlag == 1) {
     if ($Op_Gen['bounty'] <= 50000) {
         $Gain_Bounty = $Op_Gen['bounty'];
     } elseif ($Op_Gen['bounty'] <= 100000) {
         $Gain_Bounty = Floor($Op_Gen['bounty'] * 0.5);
     } else {
         $Gain_Bounty = Floor($Op_Gen['bounty'] * 0.1);
     }
     $Op_Gen['bounty'] -= $Gain_Bounty;
     if ($Gain_Bounty) {
         $sql = "UPDATE `" . $GLOBALS['DBPrefix'] . "phpeb_user_bank` SET `savings` = `savings`+{$Gain_Bounty} WHERE `username` = '{$Pl_Value['USERNAME']}' LIMIT 1;";
         mysql_query($sql);
         unset($sql);
     }
     $Gain_BountyFlag = '1';
 }
 //Update Player Status
 switch ($VictoryFlag) {
     case '1':
         $Op_Game['status'] = '1';
         $Pl_Game['victory'] += 1;
         $Pl_Game['v_points'] += 1;
示例#18
0
	function	dst_y( $hImg )
	{
		$valid_height = imageSY( $this->hButton ) - $this->top_margin - $this->bottom_margin ;
		$dst_y = $this->top_margin+Floor( ( $valid_height - imageSY($hImg) ) / 2 );
		return $dst_y ;
	}
示例#19
0
                break;
        }
        if ($from_type > $to_type) {
            $db->sql_transaction('begin');
            $num = $exchange_money * pow(10, $from_type - $to_type);
            $sql = 'UPDATE ' . USER_INFO . ' SET ' . $table_col . '=' . $table_col . '-' . $exchange_money . '
						WHERE user_id=' . $user->data['user_id'];
            $db->sql_query($sql);
            $sql = 'UPDATE ' . USER_INFO . ' SET ' . $table2_col . '=' . $table2_col . '+' . $num . '
						WHERE user_id=' . $user->data['user_id'];
            $db->sql_query($sql);
            $db->sql_transaction('commit');
            $message = sprintf($user->lang['SUCCEED_EXCHANGE'], $exchange_money) . $coin . sprintf($user->lang['EXCHANGE_MONEY'], $num) . $coin2;
        } else {
            $db->sql_transaction('begin');
            $num = Floor($exchange_money / pow(10, $to_type - $from_type));
            $sql = 'UPDATE ' . USER_INFO . ' SET ' . $table_col . '=' . $table_col . '-' . $num * pow(10, $to_type - $from_type) . '
						WHERE user_id=' . $user->data['user_id'];
            $db->sql_query($sql);
            $sql = 'UPDATE ' . USER_INFO . ' SET ' . $table2_col . '=' . $table2_col . '+' . $num . '
						WHERE user_id=' . $user->data['user_id'];
            $db->sql_query($sql);
            $db->sql_transaction('commit');
            $message = sprintf($user->lang['SUCCEED_EXCHANGE'], $num * pow(10, $to_type - $from_type)) . $coin . sprintf($user->lang['EXCHANGE_MONEY'], $num) . $coin2;
        }
        $url = "bank.{$phpEx}{$SID}";
        meta_refresh(3, $url);
        trigger_error($message);
        unset($num, $table2_col, $table_col, $coin, $coin2);
        $db->sql_freeresult($result);
        break;
 private static function route_binarySearch($needle, $haystack, $comparator)
 {
     if (count($haystack) == 0) {
         return FALSE;
     }
     // credits: temporal dot pl at gmail dot com
     // reference: http://php.net/manual/en/function.array-search.php
     $high = Count($haystack) - 1;
     $low = 0;
     while ($high >= $low) {
         $probe = (int) Floor(($high + $low) / 2);
         $comparison = $comparator($haystack[$probe]['term'], $needle);
         if ($comparison < 0) {
             $low = $probe + 1;
         } elseif ($comparison > 0) {
             $high = $probe - 1;
         } else {
             return $probe;
         }
     }
     //The loop ended without a match
     //Compensate for needle greater than highest haystack element
     if ($comparator($haystack[count($haystack) - 1]['term'], $needle) < 0) {
         $probe = count($haystack);
     }
     return FALSE;
 }
示例#21
0
function getCaveMapContent($caves, $caveID)
{
    global $params, $config, $terrainList;
    $caveData = $caves[$caveID];
    $message = '';
    // template öffnen
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'map.ihtml');
    // Grundparameter setzen
    tmpl_set($template, 'modus', MAP);
    // default Werte: Koordinaten dieser Höhle
    $xCoord = $caveData['xCoord'];
    $yCoord = $caveData['yCoord'];
    // Größe der Karte wird benötigt
    $mapSize = getMapSize();
    // wenn in die Minimap geklickt wurde, zoome hinein
    if (isset($params->POST->minimap_x) && isset($params->POST->minimap_y) && $params->POST->scaling != 0) {
        $xCoord = Floor($params->POST->minimap_x * 100 / $params->POST->scaling) + $mapSize['minX'];
        $yCoord = Floor($params->POST->minimap_y * 100 / $params->POST->scaling) + $mapSize['minY'];
    } else {
        if (isset($params->POST->caveName)) {
            $coords = getCaveByName($params->POST->caveName);
            if (sizeof($coords) == 0) {
                $message = sprintf(_('Die Höhle mit dem Namen: "%s" konnte nicht gefunden werden!'), $params->POST->caveName);
            } else {
                $xCoord = $coords['xCoord'];
                $yCoord = $coords['yCoord'];
                $message = sprintf(_('Die Höhle mit dem Namen: "%s" befindet sich in (%d|%d).'), $params->POST->caveName, $xCoord, $yCoord);
            }
        } else {
            if (isset($params->POST->targetCaveID)) {
                $coords = getCaveByID($params->POST->targetCaveID);
                if ($coords === null) {
                    $message = sprintf(_('Die Höhle mit der ID: "%d" konnte nicht gefunden werden!'), $params->POST->targetCaveID);
                } else {
                    $xCoord = $coords['xCoord'];
                    $yCoord = $coords['yCoord'];
                    $message = sprintf(_('Die Höhle mit der ID: "%d" befindet sich in (%d|%d).'), $params->POST->targetCaveID, $xCoord, $yCoord);
                }
            } else {
                if (isset($params->POST->xCoord) && isset($params->POST->yCoord)) {
                    $xCoord = $params->POST->xCoord;
                    $yCoord = $params->POST->yCoord;
                }
            }
        }
    }
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $message);
    }
    // Koordinaten begrenzen
    if ($xCoord < $mapSize['minX']) {
        $xCoord = $mapSize['minX'];
    }
    if ($yCoord < $mapSize['minY']) {
        $yCoord = $mapSize['minY'];
    }
    if ($xCoord > $mapSize['maxX']) {
        $xCoord = $mapSize['maxX'];
    }
    if ($yCoord > $mapSize['maxY']) {
        $yCoord = $mapSize['maxY'];
    }
    // width und height anpassen
    $MAP_WIDTH = min(MAP_WIDTH, $mapSize['maxX'] - $mapSize['minX'] + 1);
    $MAP_HEIGHT = min(MAP_HEIGHT, $mapSize['maxY'] - $mapSize['minY'] + 1);
    // Nun befinden sich in $xCoord und $yCoord die gesuchten Koordinaten.
    // ermittele nun die linke obere Ecke des Bildausschnittes
    $minX = min(max($xCoord - intval($MAP_WIDTH / 2), $mapSize['minX']), $mapSize['maxX'] - $MAP_WIDTH + 1);
    $minY = min(max($yCoord - intval($MAP_HEIGHT / 2), $mapSize['minY']), $mapSize['maxY'] - $MAP_HEIGHT + 1);
    // ermittele nun die rechte untere Ecke des Bildausschnittes
    $maxX = $minX + $MAP_WIDTH - 1;
    $maxY = $minY + $MAP_HEIGHT - 1;
    // get the map details
    $caveDetails = getCaveDetailsByCoords($minX, $minY, $maxX, $maxY);
    $map = array();
    foreach ($caveDetails as $cave) {
        $cell = array('terrain' => 'terrain' . $cave['terrain'], 'alt' => "{$cave['cavename']} - ({$cave['xCoord']}|{$cave['yCoord']}) - {$cave['region']}", 'link' => "modus=map_detail&amp;targetCaveID={$cave['caveID']}");
        // unbewohnte Höhle
        if ($cave['playerID'] == 0) {
            // als Frei! zeigen
            if ($cave['takeoverable'] == 1) {
                $text = _('Frei!');
                $file = "icon_cave_empty";
                // als Einöde zeigen
            } else {
                $text = _('Einöde');
                $file = "icon_waste";
            }
            // bewohnte Höhle
        } else {
            // eigene Höhle
            if ($cave['playerID'] == $params->SESSION->player->playerID) {
                $file = "icon_cave_own";
            } else {
                $file = "icon_cave_other";
            }
            // mit Artefakt
            if ($cave['artefacts'] != 0 && ($cave['tribe'] != GOD_ALLY || $params->SESSION->player->tribe == GOD_ALLY)) {
                $file .= "_artefact";
            }
            // link zum Tribe einfügen
            $cell['link_tribe'] = "modus=tribe_detail&amp;tribe=" . urlencode(unhtmlentities($cave['tribe']));
            // Stamm abkürzen
            $decodedTribe = unhtmlentities($cave['tribe']);
            if (strlen($decodedTribe) > 10) {
                $cell['text_tribe'] = htmlentities(substr($decodedTribe, 0, 8)) . "..";
            } else {
                $cell['text_tribe'] = $cave['tribe'];
            }
            // Besitzer
            $decodedOwner = unhtmlentities($cave['name']);
            if (strlen($decodedOwner) > 10) {
                $text = htmlentities(substr($decodedOwner, 0, 8)) . "..";
            } else {
                $text = $cave['name'];
            }
            // übernehmbare Höhlen können gekennzeichnet werden
            if ($cave['secureCave'] != 1) {
                $cell['unsecure'] = array('dummy' => '');
            }
        }
        $cell['file'] = $file;
        $cell['text'] = $text;
        // Wenn die Höhle ein Artefakt enthält und man berechtigt ist -> anzeigen
        if ($cave['artefacts'] != 0 && ($cave['tribe'] != GOD_ALLY || $params->SESSION->player->tribe == GOD_ALLY)) {
            $cell['artefacts'] = $cave['artefacts'];
            $cell['artefacts_text'] = sprintf(_('Artefakte: %d'), $cave['artefacts']);
        }
        $map[$cave['xCoord']][$cave['yCoord']] = $cell;
    }
    // Karte mit Beschriftungen ausgeben
    // über alle Zeilen
    for ($j = $minY - 1; $j <= $maxY + 1; ++$j) {
        tmpl_iterate($template, '/ROWS');
        // über alle Spalten
        for ($i = $minX - 1; $i <= $maxX + 1; ++$i) {
            tmpl_iterate($template, '/ROWS/CELLS');
            // leere Zellen
            if (($j == $minY - 1 || $j == $maxY + 1) && ($i == $minX - 1 || $i == $maxX + 1)) {
                tmpl_set($template, "/ROWS/CELLS", getCornerCell());
                // x-Beschriftung
            } else {
                if ($j == $minY - 1 || $j == $maxY + 1) {
                    tmpl_set($template, "/ROWS/CELLS", getLegendCell('x', $i));
                    // y-Beschriftung
                } else {
                    if ($i == $minX - 1 || $i == $maxX + 1) {
                        tmpl_set($template, "/ROWS/CELLS", getLegendCell('y', $j));
                        // Kartenzelle
                    } else {
                        tmpl_set($template, "/ROWS/CELLS", getMapCell($map, $i, $j));
                    }
                }
            }
        }
    }
    // Minimap
    $width = $mapSize['maxX'] - $mapSize['minX'] + 1;
    $height = $mapSize['maxY'] - $mapSize['minY'] + 1;
    // compute mapcenter coords
    $mcX = $minX + intval($MAP_WIDTH / 2);
    $mcY = $minY + intval($MAP_HEIGHT / 2);
    tmpl_set($template, "/MINIMAP", array('file' => "images/minimap.png.php?x=" . $xCoord . "&amp;y=" . $yCoord, 'modus' => MAP, 'width' => intval($width * MINIMAP_SCALING / 100), 'height' => intval($height * MINIMAP_SCALING / 100), 'scaling' => MINIMAP_SCALING));
    tmpl_set($template, '/O', array('modus' => MAP, 'x' => $mcX + $MAP_WIDTH, 'y' => $mcY));
    tmpl_set($template, '/SO', array('modus' => MAP, 'x' => $mcX + $MAP_WIDTH, 'y' => $mcY + $MAP_HEIGHT));
    tmpl_set($template, '/S', array('modus' => MAP, 'x' => $mcX, 'y' => $mcY + $MAP_HEIGHT));
    tmpl_set($template, '/SW', array('modus' => MAP, 'x' => $mcX - $MAP_WIDTH, 'y' => $mcY + $MAP_HEIGHT));
    tmpl_set($template, '/W', array('modus' => MAP, 'x' => $mcX - $MAP_WIDTH, 'y' => $mcY));
    tmpl_set($template, '/NW', array('modus' => MAP, 'x' => $mcX - $MAP_WIDTH, 'y' => $mcY - $MAP_HEIGHT));
    tmpl_set($template, '/N', array('modus' => MAP, 'x' => $mcX, 'y' => $mcY - $MAP_HEIGHT));
    tmpl_set($template, '/NO', array('modus' => MAP, 'x' => $mcX + $MAP_WIDTH, 'y' => $mcY - $MAP_HEIGHT));
    // Module "CaveBookmarks" Integration
    // FIXME should know whether the module is installed
    if (TRUE) {
        // show CAVEBOOKMARKS context
        tmpl_set($template, '/CAVEBOOKMARKS/iterate', '');
        // get model
        $cb_model = new CaveBookmarks_Model();
        // get bookmarks
        $bookmarks = $cb_model->getCaveBookmarks(true);
        // set bookmarks
        if (sizeof($bookmarks)) {
            tmpl_set($template, '/CAVEBOOKMARKS/CAVEBOOKMARK', $bookmarks);
        }
    }
    return tmpl_parse($template);
}
示例#22
0
	//$_SESSION['graphe_largeurMat']=$largeurMat;

	//$_SESSION['graphe_x0']=$largeurGrad;
	// ZUT! Je ne récupère pas la variable...
	//===========================================




	//===========================================
	if((!isset($seriemin))||(!isset($seriemax))){
		//Bandes verticales alternées:
		for($i=1;$i<$nbMat+1;$i++){
			$x1=round($largeurGrad+($i-1)*$largeurMat);
			$x2=round($largeurGrad+$i*$largeurMat);
			if($i-2*Floor($i/2)==0){
				imageFilledRectangle($img,$x1,$hauteurMoy,$x2,$hauteur+$hauteurMoy,$bande1);
			}
			else{
				imageFilledRectangle($img,$x1,$hauteurMoy,$x2,$hauteur+$hauteurMoy,$bande2);
			}

		}
	}
	else{
		// Ou affichage des bandes min-max
		for($i=1;$i<$nbMat+1;$i++){
			// Les +2 et -2 servent à laisser un jour entre les bandes pour une meilleure lisibilité
			$x1=round($largeurGrad+($i-1)*$largeurMat)+2;
			$x2=round($largeurGrad+$i*$largeurMat)-2;
			$ordonneemin=round($hauteurMoy+$hauteur-$moy_min[$i]*$hauteur/20);
示例#23
0
function GetFilePath($Table, $ID)
{
    #-------------------------------------------------------------------------------
    # директория файлов
    $DirPath = SPrintF('%s/hosts/%s/files/%s', SYSTEM_PATH, HOST_ID, $Table);
    #-------------------------------------------------------------------------------
    # путь к файлу
    $SubDirPath = '';
    #-------------------------------------------------------------------------------
    $IDa = $ID;
    #-------------------------------------------------------------------------------
    while ($IDa > 0) {
        #-------------------------------------------------------------------------------
        $SubDirPath = SPrintF('/%s%s', $IDa % 100, $SubDirPath);
        $IDa = Floor($IDa / 100);
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    $FileDirPath = SPrintF('%s%s', $DirPath, $SubDirPath);
    #-------------------------------------------------------------------------------
    $FilePath = SPrintF('%s/%s.bin', $FileDirPath, $ID);
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return array('FileDir' => $FileDirPath, 'FilePath' => $FilePath);
    #-------------------------------------------------------------------------------
}
 function milmillon($nummierod){
  if ($nummierod >= 1000000000 && $nummierod <2000000000){
   $num_letrammd = "MIL ".($this->cienmillon($nummierod%1000000000));
  }
  if ($nummierod >= 2000000000 && $nummierod <10000000000){
   $num_letrammd = $this->unidad(Floor($nummierod/1000000000))." MIL ".($this->cienmillon($nummierod%1000000000));
  }
  if ($nummierod < 1000000000)
   $num_letrammd = $this->cienmillon($nummierod);
  
  return $num_letrammd;
 } 
示例#25
0
 public static function milmillon($nummierod)
 {
     if ($nummierod >= 1000000000 && $nummierod < 2000000000) {
         $num_letrammd = "MIL " . self::cienmillon($nummierod % 1000000000);
     }
     if ($nummierod >= 2000000000 && $nummierod < 10000000000) {
         $num_letrammd = self::unidad(Floor($nummierod / 1000000000)) . " MIL " . self::cienmillon($nummierod % 1000000000);
     }
     if ($nummierod < 1000000000) {
         $num_letrammd = self::cienmillon($nummierod);
     }
     return $num_letrammd;
 }
示例#26
0
 $Comp = Comp_Load('Form/Select', array('name' => 'Day', 'value' => 'init'), array('init' => '-'));
 if (Is_Error($Comp)) {
     return ERROR | @Trigger_Error(500);
 }
 #-----------------------------------------------------------------
 if ($IsPeriods) {
     $Comp->AddAttribs(array('disabled' => 'true'));
 }
 #-----------------------------------------------------------------
 $Div->AddChild($Comp);
 #-----------------------------------------------------------------
 $Table[] = array('Дата окончания', $Div);
 #-----------------------------------------------------------------
 #-----------------------------------------------------------------
 if ($ISPswScheme['CostDay'] > 0) {
     $DaysFromBallance = Floor($ISPswOrder['ContractBalance'] / $ISPswScheme['CostDay']);
     #-------------------------------------------------------------------------------
     $DaysFromBallance = Comp_Load('Bonuses/DaysCalculate', $DaysFromBallance, $ISPswScheme, $ISPswOrder, $UserID);
     if (Is_Error($DaysFromBallance)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     if ($MinDaysPay <= $DaysFromBallance) {
         if ($IsPeriods) {
             #---------------------------------------------------------------
             $Comp = Comp_Load('Form/Input', array('onclick' => 'form.Period.disabled = true;form.Year.disabled = true;form.Month.disabled = true;form.Day.disabled = true;', 'name' => 'Calendar', 'type' => 'radio'));
             if (Is_Error($Comp)) {
                 return ERROR | @Trigger_Error(500);
             }
         }
}
fseek($handle, 88);
$tempbyte1 = fread($handle, 1);
$tempbyte2 = fread($handle, 1);
$height = (ord($tempbyte1) << 8) + ord($tempbyte2);
$tempbyte1 = fread($handle, 1);
$tempbyte2 = fread($handle, 1);
$width = (ord($tempbyte1) << 8) + ord($tempbyte2);
//  widthextension := ifthen((width mod 8) <> 0, width + (8 - (width mod 8)), width);
$widthextension = $width % 8 != 0 ? $width + (8 - $width % 8) : $width;
for ($i = 0; $i < $height * Floor($widthextension / 8); $i++) {
    $buffer = fread($handle, 1);
    $pixels[$i] = ord($buffer);
    //        echo dechex(ord($buffer)).' ';
}
$ilength = $height * Floor($widthextension / 8);
$store = array_fill(0, $ilength * 8, hexdec("FFFFFF"));
$index = 0;
for ($i = 0; $i <= $ilength - 1; $i++) {
    $bitByte = $pixels[$i];
    $k = 7;
    //        echo '<br>'.decbin($bitByte).': ';
    while ($k >= 0) {
        //              echo ($bitByte & (1 << $k)).', ';
        //              echo '('.decbin(1 << $k).')';
        $store[$index] = ($bitByte & 1 << $k) != 0 ? hexdec("FF") : 0;
        $index++;
        $k--;
    }
}
$img = imagecreate($width, $height);
示例#28
0
 $Comp = Comp_Load('Form/Select', array('name' => 'Day', 'value' => 'init'), array('init' => '-'));
 if (Is_Error($Comp)) {
     return ERROR | @Trigger_Error(500);
 }
 #-----------------------------------------------------------------
 if ($IsPeriods) {
     $Comp->AddAttribs(array('disabled' => 'true'));
 }
 #-----------------------------------------------------------------
 $Div->AddChild($Comp);
 #-----------------------------------------------------------------
 $Table[] = array('Дата окончания', $Div);
 #-----------------------------------------------------------------
 #-----------------------------------------------------------------
 if ($VPSScheme['CostDay'] > 0) {
     $DaysFromBallance = Floor($VPSOrder['ContractBalance'] / $VPSScheme['CostDay']);
     #-------------------------------------------------------------------------------
     $DaysFromBallance = Comp_Load('Bonuses/DaysCalculate', $DaysFromBallance, $VPSScheme, $VPSOrder, $UserID);
     if (Is_Error($DaysFromBallance)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     if ($MinDaysPay <= $DaysFromBallance) {
         if ($IsPeriods) {
             #---------------------------------------------------------------
             $Comp = Comp_Load('Form/Input', array('onclick' => 'form.Period.disabled = true;form.Year.disabled = true;form.Month.disabled = true;form.Day.disabled = true;', 'name' => 'Calendar', 'type' => 'radio'));
             if (Is_Error($Comp)) {
                 return ERROR | @Trigger_Error(500);
             }
         }
示例#29
0
     $SellW_Options .= "<option value=WepB>{$SysWepB['name']}(备用武器一)\n";
 }
 if ($UsrWepC[0]) {
     GetWeaponDetails("{$UsrWepC['0']}", 'SysWepC');
     if ($UsrWepC[2]) {
         if ($UsrWepC[2] == 1) {
             $SysWepC['name'] = $UsrWepC[3] . $SysWepC['name'] . "<sub>?</sub>";
         } else {
             $SysWepC['name'] = $SysWepC['name'] . $UsrWepC[3] . "<sub>?</sub>";
         }
         $SysWepC['atk'] += $UsrWepC[4];
         $SysWepC['hit'] += $UsrWepC[5];
         $SysWepC['rd'] += $UsrWepC[6];
         $SysWepC['enc'] = $UsrWepC[7];
     }
     $SellP_C = Floor(($SysWepC['price'] * 0.5 + $SysWepC['price'] * 0.1) / 10000) * 10000;
     echo "<tr align=center>";
     echo "<td width=\"195\">{$SysWepC['name']}</td>";
     echo "<td width=\"80\">" . number_format($SysWepC[atk]) . "</td>";
     echo "<td width=\"30\">{$SysWepC['hit']}</td>";
     echo "<td width=\"30\">{$SysWepC['rd']}</td>";
     echo "<td width=\"40\">{$SysWepC['enc']}</td>";
     $SysWepCSpecs = ReturnSpecs($SysWepC['spec']);
     echo "<td width=\"120\">{$SysWepCSpecs}</td>";
     echo "<td width=\"85\">" . number_format($SellP_C) . "</td>";
     echo "</tr>";
     $SellW_Options .= "<option value=WepC>{$SysWepC['name']}(备用武器二)\n";
 }
 echo "<form action=equip.php?action=sellwep method=post name=sellwepform>";
 echo "<input type=hidden value='process' name=actionb>";
 echo "<input type=hidden value='validcode' name=actionc>";
示例#30
0
        //si le nombre de tranche divise le référentiel de la note (note_sur) on affiche des label entier, sinon on affiche pas de légende pour le notes.
        $val = $i * $note_sur_serie / $nb_tranches;
    } else {
        $val = "";
    }
    echo "<text x=\"{$xtext}\" y=\"{$ytext}\" style=\"fill:{$axes}; font-size:x-small;\">{$val}</text>\n";
}
for ($i = 0; $i < count($notes); $i++) {
    //$v=Ceil($notes[$i]/$largeur)*$largeur;
    //$v=Floor($notes[$i]/$largeur)*$largeur;
    //$w=$v+$largeur;
    if ($notes[$i] == $note_sur_serie) {
        // Modif pour faire passer les notes 20 dans la tranche [0;20[
        $notes[$i] = $note_sur_serie - 0.1;
    }
    $tab_tranche[Floor($notes[$i] * $nb_tranches / $note_sur_serie)]++;
}
echo "<!-- Graduations verticales -->\n";
$eff_max = max($tab_tranche);
$dy = $hauteur_utile / $eff_max;
for ($i = 0; $i < $eff_max; $i++) {
    $x1 = $marge - 3;
    $x2 = $marge + 3;
    $y = $marge + $hauteur_utile - $dy * $i;
    echo "<line x1=\"{$x1}\" y1=\"{$y}\" x2=\"{$x2}\" y2=\"{$y}\" style=\"stroke:{$axes}; stroke-width:{$epaisseur_grad}\"/>\n";
    $xtext = 10;
    $ytext = $y;
    echo "<text x=\"{$xtext}\" y=\"{$ytext}\" style=\"fill:{$axes}; font-size:small;\">{$i}</text>\n";
}
echo "<!-- Barres de l'histogramme -->\n";
for ($i = 0; $i < count($tab_tranche); $i++) {