} else { ImageCopyResized($image2, $image, 0, 0, 0, 0, $thumb_w, $thumb_h, $image_dim_x, $image_dim_y); } ImageDestroy($image); } if ($gallery_settings['photo_watermark_text']) { $enc = array("&", """, "'", "\", """, "'", "<", ">"); $dec = array("&", "\"", "'", "\\", '\\"', "\\'", "<", ">"); // drop the function and use a rgb output. $black = ImageColorAllocate($image2 ? $image2 : $image, 0, 0, 0); // lets just do a rgb value instead of converting. // bugged //@todo: drop function and scan image brightness to go for either black or white. $colors1 = convert_color($gallery_settings['photo_watermark_text_color1']); $colors2 = convert_color($gallery_settings['photo_watermark_text_color2']); $colors3 = convert_color($gallery_settings['photo_watermark_text_color3']); $color1 = ImageColorAllocate($image2 ? $image2 : $image, $colors1['r'], $colors1['g'], $colors1['b']); $color2 = ImageColorAllocate($image2 ? $image2 : $image, $colors2['r'], $colors2['g'], $colors2['b']); $color3 = ImageColorAllocate($image2 ? $image2 : $image, $colors3['r'], $colors3['g'], $colors3['b']); //move text y $mty1 = ($thumb_h ? $thumb_h : $image_dim_y) - ($thumb_h ? 40 : 50); $mty2 = ($thumb_h ? $thumb_h : $image_dim_y) - ($thumb_h ? 25 : 35); $mty3 = ($thumb_h ? $thumb_h : $image_dim_y) - ($thumb_h ? 15 : 20); $album_title = str_replace("\r", "", $data['album_title']); $album_title = str_replace("\n", "", $album_title); $album_title = preg_replace("[\\[(.*?)\\]]", "", $album_title); $album_title = preg_replace("<\\<(.*?)\\>>", "", $album_title); $album_title = trimlink($album_title, 75); $album_title = str_replace($enc, $dec, $album_title); $album_description = str_replace("\r", "", $data['album_description']); $album_description = str_replace("\n", "", $album_description);
function loadgame() { // 4.2 [GameName] $this->game['name'] = ''; for ($i = 0; $this->data[$i] != chr(0); $i++) { $this->game['name'] .= $this->data[$i]; } $this->data = substr($this->data, $i + 2); // 0-byte ending the string + 1 unknown byte // 4.3 [Encoded String] $temp = ''; for ($i = 0; $this->data[$i] != chr(0); $i++) { if ($i % 8 == 0) { $mask = ord($this->data[$i]); } else { $temp .= chr(ord($this->data[$i]) - !($mask & 1 << $i % 8)); } } $this->data = substr($this->data, $i + 1); // 4.4 [GameSettings] $this->game['speed'] = convert_speed(ord($temp[0])); if (ord($temp[1]) & 1) { $this->game['visibility'] = convert_visibility(0); } else { if (ord($temp[1]) & 2) { $this->game['visibility'] = convert_visibility(1); } else { if (ord($temp[1]) & 4) { $this->game['visibility'] = convert_visibility(2); } else { if (ord($temp[1]) & 8) { $this->game['visibility'] = convert_visibility(3); } } } } $this->game['observers'] = convert_observers(((ord($temp[1]) & 16) == true) + 2 * ((ord($temp[1]) & 32) == true)); $this->game['teams_together'] = convert_bool(ord($temp[1]) & 64); $this->game['lock_teams'] = convert_bool(ord($temp[2])); $this->game['full_shared_unit_control'] = convert_bool(ord($temp[3]) & 1); $this->game['random_hero'] = convert_bool(ord($temp[3]) & 2); $this->game['random_races'] = convert_bool(ord($temp[3]) & 4); if (ord($temp[3]) & 64) { $this->game['observers'] = convert_observers(4); } $temp = substr($temp, 13); // 5 unknown bytes + checksum // 4.5 [Map&CreatorName] $temp = explode(chr(0), $temp); $this->game['creator'] = $temp[1]; $this->game['map'] = $temp[0]; // 4.6 [PlayerCount] $temp = unpack('Vslots', $this->data); $this->data = substr($this->data, 4); $this->game['slots'] = $temp['slots']; // 4.7 [GameType] $this->game['type'] = convert_game_type(ord($this->data[0])); $this->game['private'] = convert_bool(ord($this->data[1])); $this->data = substr($this->data, 8); // 2 bytes are unknown and 4.8 [LanguageID] is useless // 4.9 [PlayerList] while (ord($this->data[0]) == 0x16) { $this->loadplayer(); $this->data = substr($this->data, 4); } // 4.10 [GameStartRecord] $temp = unpack('Crecord_id/vrecord_length/Cslot_records', $this->data); $this->data = substr($this->data, 4); $this->game = array_merge($this->game, $temp); $slot_records = $temp['slot_records']; // 4.11 [SlotRecord] for ($i = 0; $i < $slot_records; $i++) { if ($this->header['major_v'] >= 7) { $temp = unpack('Cplayer_id/x1/Cslot_status/Ccomputer/Cteam/Ccolor/Crace/Cai_strength/Chandicap', $this->data); $this->data = substr($this->data, 9); } elseif ($this->header['major_v'] >= 3) { $temp = unpack('Cplayer_id/x1/Cslot_status/Ccomputer/Cteam/Ccolor/Crace/Cai_strength', $this->data); $this->data = substr($this->data, 8); } else { $temp = unpack('Cplayer_id/x1/Cslot_status/Ccomputer/Cteam/Ccolor/Crace', $this->data); $this->data = substr($this->data, 7); } $temp['color'] = convert_color($temp['color']); $temp['race'] = convert_race($temp['race']); $temp['ai_strength'] = convert_ai($temp['ai_strength']); if ($temp['slot_status'] == 2) { // do not add empty slots $this->players[$temp['player_id']] = array_merge($this->players[$temp['player_id']], $temp); // Tome of Retraining $this->players[$temp['player_id']]['retraining_time'] = 0; } } // 4.12 [RandomSeed] $temp = unpack('Vrandom_seed/Cselect_mode/Cstart_spots', $this->data); $this->data = substr($this->data, 6); $this->game['random_seed'] = $temp['random_seed']; $this->game['select_mode'] = convert_select_mode($temp['select_mode']); if ($temp['start_spots'] != 0xcc) { // tournament replays from battle.net website don't have this info $this->game['start_spots'] = $temp['start_spots']; } }
public function actionLogin() { global $fr_version, $fr_platform; $vals = $this->_input->filter(array('username' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING, 'md5_password' => XenForo_Input::STRING, 'fr_username' => XenForo_Input::STRING, 'fr_b' => XenForo_Input::UINT, 'token' => XenForo_Input::STRING)); $login_model = $this->_getLoginModel(); $user_model = $this->_getUserModel(); $options = XenForo_Application::get('options'); $navbg = ''; $style = $options->forumrunnerColor; if ($style) { // Convert to right style. iPhone needs r,g,b. Android needs #rrggbb. $color = convert_color($style); if (is_iphone() && strlen($color) == 7) { $r = hexdec(substr($color, 1, 2)); $g = hexdec(substr($color, 3, 2)); $b = hexdec(substr($color, 5, 2)); $color = "{$r},{$g},{$b}"; } $navbg = $color; } $authenticated = false; $requires_authentication = false; $out = array(); if (!$vals['username'] || !$vals['password'] && !$vals['md5_password']) { if (!XenForo_Visitor::getInstance()->hasPermission('general', 'view')) { $requires_authentication = true; } $options = XenForo_Application::get('options'); if (!$options->boardActive && !XenForo_Visitor::getInstance()->get('is_admin')) { $requires_authentication = true; } } else { $user_id = $user_model->validateAuthentication($vals['username'], $vals['password'], $error); if (!$user_id) { $login_model->logLoginAttempt($vals['username']); json_error($error->render(), RV_BAD_PASSWORD); } $login_model->clearLoginAttempts($vals['username']); $user_model->setUserRememberCookie($user_id); XenForo_Model_Ip::log($user_id, 'user', $user_id, 'login'); XenForo_Application::get('session')->changeUserId($user_id); XenForo_Visitor::setup($user_id); $out['username'] = prepare_utf8_string(XenForo_Visitor::getInstance()->get('username')); $authenticated = true; } $out += array('authenticated' => $authenticated, 'v' => $fr_version, 'p' => $fr_platform, 'requires_authentication' => $requires_authentication); if ($navbg != '') { $out['navbg'] = $navbg; } if (is_iphone() && $options->forumrunnerAdsAdMobPublisherIDiPhone) { $out['admob'] = $options->forumrunnerAdsAdMobPublisherIDiPhone; } else { if (is_android() && $options->forumrunnerAdsAdMobPublisherIDAndroid) { $out['admob'] = $options->forumrunnerAdsAdMobPublisherIDAndroid; } } if ($options->forumrunnerGoogleAnalyticsID && $options->forumrunnerGoogleAnalyticsID != '') { $out['gan'] = $options->forumrunnerGoogleAnalyticsID; } if ($options->forumrunnerFacebookApplicationID && $options->forumrunnerFacebookApplicationID != '') { $out['fb'] = $options->forumrunnerFacebookApplicationID; } if ($options->forumrunnerRegistration) { $out['reg'] = true; } fr_update_push_user($vals['fr_username'], $vals['fr_b'], $vals['token']); return $out; }
if (in_array(strtolower(pathinfo($FLIR['font'], PATHINFO_EXTENSION)), array('pfb', 'pfm'))) { // pfm doesn't work // You can try uncommenting this line to see what kind of mileage you get. err('FONT_PS_UNSUPPORTED'); // PostScript will work as long as you don't set any kind of spacing... unless you are using Windows (PHP bug?). $FLIR['postscript'] = true; $FLIR['ps'] = array('kerning' => 0, 'space' => 0); if (false === @($FLIR['ps']['font'] = imagepsloadfont($FLIR['font']))) { err('FONT_PS_COULDNT_LOAD'); } } $FLIR['color'] = convert_color($FStyle['cColor']); if ($FLIR['bkg_transparent']) { $FLIR['bkgcolor'] = array('red' => abs($FLIR['color']['red'] - 100), 'green' => abs($FLIR['color']['green'] - 100), 'blue' => abs($FLIR['color']['blue'] - 100)); } else { $FLIR['bkgcolor'] = convert_color($FStyle['cBackground'], false, 'FFFFFF'); } $FLIR['opacity'] = is_number($FStyle['cOpacity'], true) ? $FStyle['cOpacity'] * 100 : 100; if ($FLIR['opacity'] > 100 || $FLIR['opacity'] < 0) { $FLIR['opacity'] = 100; } $FLIR['text'] = $_GET['text'] != '' ? str_replace(array('{amp}nbsp;', '{amp}', '{plus}'), array(' ', '&', '+'), trim($_GET['text'], "\t\n\r")) : 'null'; $FLIR['cache'] = get_cache_fn(md5(($FLIR['mode'] == 'wrap' ? $FLIR['maxwidth'] : '') . $FLIR['font'] . (print_r($FStyle, true) . $FLIR['text'])), $FLIR['output']); $FLIR['text_encoded'] = $FLIR['text']; $FLIR['text'] = $FLIR['original_text'] = strip_tags(html_entity_decode_utf8($FLIR['text'])); $SPACE_BOUNDS = false; if (is_number($FStyle['cSpacing'], true, false, true)) { $SPACE_BOUNDS = bounding_box(' '); $spaces = ceil($FStyle['cSpacing'] / $SPACE_BOUNDS['width']); if ($spaces > 0) { $FLIR['text'] = space_out($FLIR['text'], $spaces);
function handle_bbcode_color($action, $attributes, $content, $params, $node_object) { global $web_colors, $nuke_quotes; if ($action == 'validate') { return true; } $attributes['default'] = str_replace(""", "", $attributes['default']); if ($nuke_quotes) { return '[COLOR="' . $attributes['default'] . '"]' . $content . '[/COLOR]'; } // Figure out if this is a default web color $pre = strtolower($attributes['default']); $color = ''; if (isset($web_colors[$pre])) { $color = $web_colors[$pre]; } else { $color = convert_color($pre); } if ($color != '') { return "<color color=\"{$color}\">{$content}</color>"; } else { return $content; } }
$FLIR['dpi'] = preg_match('#^\\d+$#', $_GET['d']) ? $_GET['d'] : 96; if ($FStyle['hq'] == 'true') { $FLIR['dpi'] /= 2; } $FLIR['size'] = is_number($CSS['font-size'], true) ? $CSS['font-size'] : UNKNOWN_FONT_SIZE; // pixels $FLIR['size_pts'] = get_points($FLIR['dpi'], $FLIR['size']); $FLIR['maxheight'] = is_number($_GET['h']) ? $_GET['h'] : UNKNOWN_FONT_SIZE; // pixels $FLIR['maxwidth'] = is_number($_GET['w']) ? $_GET['w'] : 800; // pixels $FLIR['color'] = convert_color($CSS['color']); if ($FLIR['bkg_transparent']) { $FLIR['bkgcolor'] = array('red' => abs($FLIR['color']['red'] - 100), 'green' => abs($FLIR['color']['green'] - 100), 'blue' => abs($FLIR['color']['blue'] - 100)); } else { $FLIR['bkgcolor'] = convert_color($CSS['background-color'], false, 'FFFFFF'); } $FLIR['opacity'] = is_number($CSS['opacity'], true) ? $CSS['opacity'] * 100 : 100; if ($FLIR['opacity'] > 100 || $FLIR['opacity'] < 0) { $FLIR['opacity'] = 100; } $FLIR['text_encoded'] = $_GET['t'] != '' ? prepare_text($_GET['t']) : 'null'; $FLIR['text'] = html_entity_decode_utf8($FLIR['text_encoded']); /* echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head>