예제 #1
0
파일: informer.php 프로젝트: velocat/phpbb3
function create_informer($id, $mode = 'add')
{
    global $db, $user, $phpbb_root_path, $phpEx;
    //echo($id. '-'.$mode); return;
    //$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    //$phpEx = substr(strrchr(__FILE__, '.'), 1);
    //include_once($phpbb_root_path . 'portal/includes/functions_meeting.'.$phpEx);
    if ($user->data['user_id'] == 2) {
        //	error_reporting(E_ALL);
        //	ini_set('display_errors', '1');
    }
    if ($user->data['user_id'] == ANONYMOUS) {
        return;
    }
    // ----------------------------------
    // Get access status for this meeting
    // ----------------------------------
    $sql = "SELECT m.meeting_id, m.meeting_by_user, mg.meeting_group FROM " . MEETING_DATA_TABLE . " m, " . MEETING_USERGROUP_TABLE . " mg\n\t\tWHERE m.meeting_id = {$id}\n\t\tAND mg.meeting_id = m.meeting_id";
    $result = $db->sql_query($sql);
    $meetings_access_ids = array();
    while ($row = $db->sql_fetchrow($result)) {
        $meeting_id = $row['meeting_id'];
        $meeting_group = $row['meeting_group'];
        $meeting_by_author = $row['meeting_by_user'];
        if ($meeting_by_author == $user->data['user_id']) {
            $meetings_access_ids[$meeting_id] = TRUE;
        }
        if ($meeting_group == -1) {
            $meetings_access_ids[$meeting_id] = TRUE;
        } elseif ($meeting_group == -2) {
            $sql2 = "SELECT * FROM " . ZEBRA_TABLE . "\n\t\t\t\tWHERE user_id = " . $meeting_by_author . "\n\t\t\t\t\tAND zebra_id = " . $user->data['user_id'] . "\n\t\t\t\t\tAND friend = 1";
            $result2 = $db->sql_query($sql2);
            if ($row2 = $db->sql_fetchrow($result2) || $meeting_by_author == $user->data['user_id']) {
                $meetings_access_ids[$meeting_id] = TRUE;
            }
            $db->sql_freeresult($result2);
            $private_meeting = 2;
        } else {
            $sql_auth_id = "SELECT g.group_id FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug\n\t\t\t\tWHERE g.group_id = {$meeting_group}\n\t\t\t\t\tAND g.group_id = ug.group_id\n\t\t\t\t\tAND ug.user_pending <> " . TRUE . "\n\t\t\t\t\tAND ug.user_id = " . $user->data['user_id'];
            $result_auth_id = $db->sql_query($sql_auth_id);
            $row = $db->sql_fetchrow($result_auth_id);
            $db->sql_freeresult($result_auth_id);
            if ($row) {
                $meetings_access_ids[$meeting_id] = TRUE;
            }
        }
    }
    $db->sql_freeresult($result);
    if ($meetings_access_ids[$id] == FALSE) {
        return;
        //trigger_error($user->lang['NOT_ACCESS_MEETING']);
    }
    //--------------------------
    // MAIN WORK вывод покатушки
    //
    $country = $user->data['user_from_country'];
    $icon_edit_clear = '<img src="images/Edit_icon.png" alt="' . $user->lang['EDIT_TXT'] . '" title="' . $user->lang['EDIT_TXT'] . '" align="absmiddle" />';
    $sql = "SELECT m.*, u1.username as create_username, u1.user_hide_reputation, u1.user_reputation, m.meeting_phone as phone, m.meeting_views, u1.user_id as create_user_id, u2.username as edit_username, u2.user_id as edit_user_id, u1.user_avatar as user_avatar, u1.user_avatar_type as user_avatar_type, u1.user_avatar_width, u1.user_avatar_height, p.pf_meeting_auth, p.pf_meeting_uchast, p.pf_user_km, p1.pf_meeting_auth as coorg_auth, p1.pf_meeting_uchast as coorg_uchast, p1.pf_user_km as coorg_km, u3.username as coorg_username, u3.user_id as coorg_user_id, u3.user_avatar as coorg_avatar, u3.user_avatar_type as coorg_avatar_type, u3.user_avatar_width as coorg_avatar_width, u3.user_avatar_height as coorg_avatar_height, u3.user_hide_reputation as coorg_hide_reputation, u3.user_reputation as coorg_reputation, u1.user_meeting_coauth as auth_coorg_num_meeting   \n\t\t\tFROM " . MEETING_DATA_TABLE . " m, " . USERS_TABLE . " u1, " . USERS_TABLE . " u2, " . USERS_TABLE . " u3, " . PROFILE_FIELDS_DATA_TABLE . " p, " . PROFILE_FIELDS_DATA_TABLE . " p1 \n\t\t\tWHERE m.meeting_id =" . $id . "\n\t\t\t\tAND m.meeting_by_user = u1.user_id\n\t\t\t\tAND p.user_id = m.meeting_by_user\n\t\t\t\tAND m.meeting_edit_by_user = u2.user_id\n\t\t\t\tAND m.meeting_coorg = u3.user_id\n\t\t\t\tAND p1.user_id = m.meeting_coorg";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $type = $row['type'];
        $hidereputation = $row['user_hide_reputation'] == 0 ? false : true;
        $coorg_hidereputation = $row['coorg_hide_reputation'] == 0 ? false : true;
        $reputation_text = $row['user_reputation'];
        $coorg_reputation_text = $row['coorg_reputation'];
        $meeting_views = $row['meeting_views'];
        $meeting_country = $row['meeting_country_id'];
        $meeting_region = $row['meeting_region'];
        $meeting_town = $row['meeting_town'];
        $meeting_time = $row['meeting_time'];
        $start_time = $meeting_check_time = $row['meeting_time'];
        //$meeting_moder = $row['meeting_moder'];
        $meeting_moder = $meeting_check_until = !$meeting_moder ? $row['meeting_until'] : $meeting_moder;
        $meeting_until = $row['meeting_until'];
        $meeting_sbor = $row['meeting_sbor'];
        $meeting_location = $row['meeting_location'];
        $meeting_subject = $row['meeting_subject'];
        $meeting_desc = $row['meeting_desc'];
        $meeting_link = $row['meeting_link'];
        $meeting_link_gps = $row['meeting_link_gps'];
        $meeting_places = $row['meeting_places'];
        $meeting_by_username = $row['create_username'];
        $meeting_by_coorgname = $row['coorg_username'];
        $meeting_phone = $row['phone'];
        $meeting_by_user_auth = $row['pf_meeting_auth'];
        $meeting_by_user_auth = $row['auth_coorg_num_meeting'] ? $meeting_by_user_auth . ' <span title="coorganizator">(' . $row['auth_coorg_num_meeting'] . ')</span> ' : $meeting_by_user_auth;
        $meeting_by_user_uchast = $row['pf_meeting_uchast'];
        $meeting_by_user_km = $row['pf_user_km'];
        $meeting_by_user_id = append_sid("memberlist.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['create_user_id']);
        $meeting_org = "memberlist.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['create_user_id'];
        $meeting_by_coorg_auth = $row['coorg_auth'];
        $meeting_by_coorg_uchast = $row['coorg_uchast'];
        $meeting_by_coorg_km = $row['coorg_km'];
        $meeting_by_coorg_id = append_sid("memberlist.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['meeting_coorg']);
        $meeting_coorg = "memberlist.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['meeting_coorg'];
        $meeting_by_id = $row['create_user_id'];
        $meeting_by_id_coorg = $row['meeting_coorg'];
        $meeting_edit_by_username = $row['edit_username'];
        $meeting_edit_by_user_id = append_sid("memberlist.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['edit_user_id']);
        $meeting_start_value = $row['meeting_start_value'];
        $meeting_recure_value = $row['meeting_recure_value'];
        $meeting_guest_overall = $row['meeting_guest_overall'];
        $meeting_guest_single = $row['meeting_guest_single'];
        $meeting_guest_names = $row['meeting_guest_names'];
        $meeting_creator = $row['meeting_by_user'];
        $meeting_creator_coorg = $row['meeting_coorg'];
        $user_avatar = $row['user_avatar'];
        $meeting_guest_phone = $row['meeting_phone_allow'];
        $meeting_el_ot = $row['meeting_el_ot'];
        $meeting_el_do = $row['meeting_el_do'];
        $meeting_el_link = $row['meeting_el_link'];
        $meeting_el_time = $row['meeting_el_time'];
        $meeting_marshrut = $row['meeting_marshrut'];
        $marshrut_return = $row['marshrut_return'];
        $meeting_trebovania = $row['meeting_trebovania'];
        $meeting_authavat_type = $row['user_avatar_type'];
        $meeting_otmena = $row['meeting_otmena'];
        $meeting_reason = $row['meeting_reason'];
        $meeting_plain_km = $row['meeting_plain_km'];
        $meeting_comeback = $row['comeback'];
        $meeting_comeback_mesto = $row['comeback_mesto'];
        $meeting_plain_road = $row['meeting_plain_road'];
        $meeting_km = $row['meeting_km'];
        $meeting_attr = $row['meeting_attr'];
        $meeting_days = $row['meeting_days'];
        $bbcode_uid = $row['bbcode_uid'];
        $bbcode_bitfield = $row['bbcode_bitfield'];
        $meeting_onbike = $row['meeting_onbike'];
        $tags = $row['meeting_tags'];
        $auth_coorg_num_meeting = $row['auth_coorg_num_meeting'];
        $meeting_for_marshrut = $row['meeting_for_marshrut'];
        $meeting_hard = $row['meeting_hard'];
        $meeting_map_off = $row['meeting_map_off'];
        $speedprofile = $row['speedprofile'];
        $meeting_anonce = $row['meeting_anonce'];
        if ($meeting_anonce == 1) {
            $anonce_data = get_data_anonce($id);
            $anonce = htmlspecialchars_decode($anonce_data['anonce']);
            $anonce_org = $anonce_data['anonce_org'];
            $anonce_org_id = $anonce_data['anonce_org_id'];
            $anonce_type = $anonce_data['anonce_type'];
        }
        /*
        		
        switch( $anonce_type )
        {
        	case 1:
        		//$hard_title = $user->lang['MEETING_HARD'] . ': ' . $user->lang['MEETING_HARD_0'];
        		$anonce_image_class = 'clubicon1';
        		$anonce_image = '<img src="images/club/vm.png" alt="" align="absmiddle" />';
        	break;
        	case 2:
        		$anonce_image_class = 'clubicon2';
        		$anonce_image = '<img src="images/club/3x9.png" alt="" align="absmiddle" />';
        	break;
        	case 3:
        		$anonce_image_class = 'clubicon3';
        		$anonce_image = '<img src="images/club/vz.png" alt="" align="absmiddle" />';
        	break;
        	case 4:
        		$anonce_image_class = 'clubicon4';
        		$anonce_image = '<img src="images/club/car.png" alt="" align="absmiddle" />';
        	break;
        	case 5:
        		$anonce_image_class = 'clubicon5';
        		$anonce_image = '<img src="images/club/kat.png" alt="" align="absmiddle" />';
        	break;
        	case 10:
        		$anonce_image_class = 'clubicon10';
        		$anonce_image = '<img src="images/club/alert_blue.png" alt="" align="absmiddle" />';
        	break;
        	default:
        		$anonce_image_class = '';
        	break;
        }
        */
        // Hardest
        switch ($meeting_hard) {
            case 0:
                $hard_title = ' (' . $user->lang['MEETING_HARD_0'] . ')';
                $hard_image = 'images/stars/0.gif';
                break;
            case 1:
                $hard_title = ' (' . $user->lang['MEETING_HARD_1'] . ')';
                $hard_image = 'images/stars/1.gif';
                break;
            case 2:
                $hard_title = ' (' . $user->lang['MEETING_HARD_2'] . ')';
                $hard_image = 'images/stars/2.gif';
                break;
            case 3:
                $hard_title = ' (' . $user->lang['MEETING_HARD_3'] . ')';
                $hard_image = 'images/stars/3.gif';
                break;
            case 4:
                $hard_title = ' (' . $user->lang['MEETING_HARD_4'] . ')';
                $hard_image = 'images/stars/4.gif';
                break;
            case 5:
                $hard_title = ' (' . $user->lang['MEETING_HARD_5'] . ')';
                $hard_image = 'images/stars/5.gif';
                break;
            case 6:
                $hard_title = ' (' . $user->lang['MEETING_HARD_6'] . ')';
                $hard_image = 'images/stars/6.gif';
                break;
        }
        // Attributes
        if ($meeting_attr != 0) {
            $meeting_attributes = explode("-", $meeting_attr);
            get_meeting_attributes($meeting_attributes);
        } else {
            $meeting_attr = '';
        }
        switch ($meeting_onbike) {
            case 1:
                $marshrut_img = "images/meet_bicycle.png";
                $type_title = $user->lang['MEETING_ONBIKE_1'];
                break;
            case 0:
                $marshrut_img = "images/meet_hiking.png";
                $type_title = $user->lang['MEETING_ONBIKE_2'];
                break;
            case 2:
                $marshrut_img = "images/meet_ski.png";
                $type_title = $user->lang['MEETING_ONBIKE_3'];
                break;
            case 3:
                $marshrut_img = "images/meet_roller.png";
                $type_title = $user->lang['MEETING_ONBIKE_4'];
                break;
            case 4:
                $marshrut_img = "images/meet_skates.png";
                //$type_title = $user->lang['MEETING_ONBIKE_4'];
                break;
        }
        $commerce_image = $type == 7 ? ' <img src="images/atributes/commerce.gif" alt="' . $user->lang['MEETING_COMMERCE'] . '" title="' . $user->lang['MEETING_COMMERCE'] . '" /> ' : '';
        $attributes = $meeting_attr;
        $img_return = $marshrut_return == 1 ? ' <img src="images/atributes/00.gif" alt="' . $user->lang['MARSHRUT_RETURN'] . '" title="' . $user->lang['MARSHRUT_RETURN'] . '" /> ' : '';
        $attributes = '<img src="' . $marshrut_img . '" title="' . $type_title . '" alt="' . $type_title . '" /> ' . $commerce_image . $img_return . $attributes;
        // Plain kilometers
        list($meeting_plain_road_1, $meeting_plain_road_2, $meeting_plain_road_3, $meeting_plain_road_4, $meeting_plain_road_5) = array_map('intval', explode('-', $meeting_plain_road));
        //$range_road = road_construct($meeting_plain_road);
        $meeting_plain_road_descr = '';
        $meeting_plain_road_descr .= $meeting_plain_road_1 == 0 ? '' : $meeting_plain_road_1 . ' ' . $user->lang['MEETING_PLAIN_ROAD_1'];
        $meeting_plain_road_descr .= $meeting_plain_road_2 == 0 ? '' : ($meeting_plain_road_1 == 0 ? '' : ' / ') . $meeting_plain_road_2 . ' ' . $user->lang['MEETING_PLAIN_ROAD_2'];
        $meeting_plain_road_descr .= $meeting_plain_road_3 == 0 ? '' : ($meeting_plain_road_1 == 0 && $meeting_plain_road_2 == 0 ? '' : ' / ') . $meeting_plain_road_3 . ' ' . $user->lang['MEETING_PLAIN_ROAD_3'];
        $meeting_plain_road_descr .= $meeting_plain_road_4 == 0 ? '' : ($meeting_plain_road_1 == 0 && $meeting_plain_road_2 == 0 && $meeting_plain_road_3 == 0 ? '' : ' / ') . $meeting_plain_road_4 . ' ' . $user->lang['MEETING_PLAIN_ROAD_4'];
        $meeting_plain_road_descr .= $meeting_plain_road_5 == 0 ? '' : ($meeting_plain_road_1 == 0 && $meeting_plain_road_2 == 0 && $meeting_plain_road_3 == 0 && $meeting_plain_road_4 == 0 ? '' : ' / ') . $meeting_plain_road_5 . ' ' . $user->lang['MEETING_PLAIN_ROAD_5S'];
        $meeting_plain_road_descr .= '';
        $meeting_plain_road_1 = $meeting_plain_road_1 == 0 ? '' : $meeting_plain_road_1;
        $meeting_plain_road_2 = $meeting_plain_road_2 == 0 ? '' : ($meeting_plain_road_1 == 0 ? '' : '/') . $meeting_plain_road_2;
        $meeting_plain_road_3 = $meeting_plain_road_3 == 0 ? '' : ($meeting_plain_road_1 == 0 && $meeting_plain_road_2 == 0 ? '' : '/') . $meeting_plain_road_3;
        $meeting_plain_road_4 = $meeting_plain_road_4 == 0 ? '' : ($meeting_plain_road_1 == 0 && $meeting_plain_road_2 == 0 && $meeting_plain_road_3 == 0 ? '' : '/') . $meeting_plain_road_4;
        $meeting_plain_road_5 = $meeting_plain_road_5 == 0 ? '' : ($meeting_plain_road_1 == 0 && $meeting_plain_road_2 == 0 && $meeting_plain_road_3 == 0 && $meeting_plain_road_4 == 0 ? '' : '/') . $meeting_plain_road_5;
        $meeting_geo1 = $row['meeting_geo1'];
        $meeting_geocheck_1 = $row['meeting_geocheck_1'];
        $meeting_geo2 = $row['meeting_geo2'];
        $meeting_geocheck_2 = $row['meeting_geocheck_2'];
        $meeting_geo3 = $row['meeting_geo3'];
        $meeting_geocheck_3 = $row['meeting_geocheck_3'];
        $meeting_geo_count = 0;
        $meeting_geo_count = $meeting_geo1 == 0 ? $meeting_geo_count : $meeting_geo_count + 1;
        $meeting_geo_count = $meeting_geo2 == 0 ? $meeting_geo_count : $meeting_geo_count + 1;
        $meeting_geo_count = $meeting_geo3 == 0 ? $meeting_geo_count : $meeting_geo_count + 1;
        // TAGS ==============
        if ($tags) {
            //include_once($phpbb_root_path . 'portal/includes/functions_meeting.' . $phpEx);
            if ($user->data['user_id'] == 2) {
                //exit($phpbb_root_path . 'portal/includes/functions_meeting.' . $phpEx);
            }
            $color = false;
            $clear_tags = tags_meeting_handle_data_end_clear($tags, $marshrut_return, $color);
        } else {
            $clear_tags = replace_cyr('cм. в описании');
        }
        // END TAGS ==========
    }
    // Текстовая дата и время
    $meeting_time_utc = $meeting_time;
    $meeting_comeback_utc = $meeting_comeback;
    $text_data = get_textdate($id);
    $meeting_comeback = $meeting_comeback > 1288490400 && time() < 1288490400 ? $meeting_comeback != 0 ? $meeting_comeback - 3600 : 0 : $meeting_comeback;
    $meeting_time = $text_data['text_time'] ? $text_data['text_time'] : $user->format_date($meeting_time);
    $meeting_until = $user->format_date($meeting_until);
    $meeting_comeback = $text_data['text_back'] && $text_data['text_back'] != '0  0, 0:00' ? $text_data['text_back'] : ($meeting_comeback != 0 ? $user->format_date($meeting_comeback) : '');
    $meeting_sbor = $text_data['text_sbor'] ? $text_data['text_sbor'] : $user->format_date($meeting_sbor, "H:i");
    $meeting_sbor = $text_data['text_sbor'] == '0:00' ? '' : $meeting_sbor;
    list($date, $time) = explode(", ", $meeting_time);
    list($day, $month, $year) = explode(' ', $date);
    $date = $day . ' ' . $month;
    if ($user->data['user_id'] == 2) {
        //trigger_error($year);
    }
    /*
    		if ($meeting_link_gps)
    		{
    			$mystring = $meeting_link_gps;
    			$findme   = 'gpsies';
    			$pos = strpos($mystring, $findme);
    
    			if ($pos === false) {
       				$marshrut_iframe = '';
    			} 
    			else 
    			{
       				$marshrut_iframe = '';
    				$m_link = str_replace('map.do', 'mapOnly.do', $mystring);
    				$marshrut_iframe = $m_link;
    			}
    			$content_gps = file_get_contents('http://example.com/image.php');	
    		}
    */
    //$submit = (isset($_POST['submit'])) ? true : false;
    if ($mode == 't') {
    } else {
        if ($mode == 'test') {
            header("Content-type: image/png; charset=utf-8");
        }
        //
        //header("Content-Disposition: attachment; filename=\"bage.png\";\n\n");
        $im = imagecreatefrompng("images/informer2.png");
        $hard_image = @imagecreatefromgif($hard_image);
        imagecopy($im, $hard_image, 207, 107, 0, 0, 80, 16);
        $onbike_image = @imagecreatefrompng($marshrut_img);
        imagecopy($im, $onbike_image, 45, 250, 0, 0, 30, 30);
        $string = my_mb_ucfirst($meeting_subject);
        //$user->data['username'];//'Солёный Пёс';//$_GET['text'];
        $str_size = mb_strlen($string);
        $font_size = 5;
        //$string = replace_cyr($string);
        //$user_from = replace_cyr('Откуда: ').''.$user_from ;
        //$string =  imagechar ($im , 20 , int $x , int $y , string $c , int $color )
        $orange = imagecolorallocate($im, 220, 210, 60);
        $black = imagecolorallocate($im, 0, 0, 0);
        $red = imagecolorallocate($im, 240, 0, 0);
        $gray = imagecolorallocate($im, 100, 100, 100);
        $white = imagecolorallocate($im, 250, 250, 250);
        $px = (imagesx($im) - 50.5 * strlen($string)) / 2;
        if ($str_size > 21) {
            if ($str_size > 50) {
                $koef_size = 3;
                $wrap = 60;
                $h_otstup = 23;
            } else {
                $koef_size = 3.5;
                $wrap = 55;
                $h_otstup = $str_size > 30 ? 30 : 45;
            }
            $string = str_replace("-", " - ", $string);
            //Указываем позиции текста
            $pos_string = imagettfbbox(3.5 * $font_size, 0, "images/bagy/DomIno.ttf", wordwrap($string, 55));
            imagettftext($im, $koef_size * $font_size, 0, 51 + abs((400 - $pos_string[2]) / 2), $h_otstup + 1, $red, "images/bagy/DomIno.ttf", wordwrap($string, $wrap));
            imagettftext($im, $koef_size * $font_size, 0, 50 + abs((400 - $pos_string[2]) / 2), $h_otstup, $black, "images/bagy/DomIno.ttf", wordwrap($string, $wrap));
        } else {
            $pos_string = imagettfbbox(5 * $font_size, 0, "images/bagy/DomIno.ttf", $string);
            imagettftext($im, 5 * $font_size, 0, 51 + (400 - $pos_string[2]) / 2, 43, $red, "images/bagy/DomIno.ttf", $string);
            imagettftext($im, 5 * $font_size, 0, 50 + (400 - $pos_string[2]) / 2, 42, $black, "images/bagy/DomIno.ttf", $string);
        }
        //Указываем позиции текста
        $pos_time = imagettfbbox(3 * $font_size, 0, "images/bagy/ARICYRB.TTF", $time);
        $pos_date = imagettfbbox(5 * $font_size, 0, "images/bagy/ARICYRB.TTF", $day);
        $pos_month = imagettfbbox(3 * $font_size, 0, "images/bagy/ARICYRB.TTF", $month);
        $pos_year = imagettfbbox(1.5 * $font_size, 0, "images/bagy/ARICYRB.TTF", $year);
        imagettftext($im, 5 * $font_size, 0, (400 - $pos_date[2]) / 2 - 139, 201, $gray, "images/bagy/ARICYRB.TTF", $day);
        imagettftext($im, 5 * $font_size, 0, (400 - $pos_date[2]) / 2 - 140, 200, $red, "images/bagy/ARICYRB.TTF", $day);
        imagettftext($im, 3 * $font_size, 0, (400 - $pos_month[2]) / 2 - 139, 221, $gray, "images/bagy/ARICYRB.TTF", $month);
        imagettftext($im, 3 * $font_size, 0, (400 - $pos_month[2]) / 2 - 140, 220, $red, "images/bagy/ARICYRB.TTF", $month);
        imagettftext($im, 1.5 * $font_size, 0, (400 - $pos_year[2]) / 2 - 139, 232, $gray, "images/bagy/ARICYRB.TTF", $year);
        imagettftext($im, 1.5 * $font_size, 0, (400 - $pos_year[2]) / 2 - 140, 231, $red, "images/bagy/ARICYRB.TTF", $year);
        imagettftext($im, 3 * $font_size, 0, (400 - $pos_time[2]) / 2 - 140, 168, $gray, "images/bagy/ARICYRB.TTF", $time);
        imagettftext($im, 3 * $font_size, 0, (400 - $pos_time[2]) / 2 - 140, 167, $white, "images/bagy/ARICYRB.TTF", $time);
        imagettftext($im, 2.5 * $font_size, 0, 213, 95, $black, "images/bagy/DomIno.ttf", $meeting_km ? $meeting_km : $meeting_plain_km);
        imagettftext($im, 2.5 * $font_size, 0, 335, 95, $black, "images/bagy/DomIno.ttf", $meeting_days);
        imagettftext($im, 1.5 * $font_size, 0, 290, 119, $black, "images/bagy/ARICYR.TTF", $hard_title);
        imagettftext($im, 2.5 * $font_size, 0, 260, 143, $black, "images/bagy/DomIno.ttf", replace_cyr(" в ") . ($meeting_sbor ? $meeting_sbor : $time));
        imagettftext($im, 2.5 * $font_size, 0, 125, 159, $black, "images/bagy/DomIno.ttf", $meeting_location);
        imagettftext($im, 1.5 * $font_size, 0, 123, 228, $black, "images/bagy/ARICYR.TTF", wordwrap(character_limit($clear_tags, 220), 90));
        $meeting_desc = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $meeting_desc);
        $meeting_trebovania = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $meeting_trebovania);
        $meeting_desc = preg_replace("!(\\[|<\\?)(.*?)(\\]|\\?>)!ise", "", $meeting_desc);
        $meeting_desc = preg_replace("!&lt;(.*?)&gt;!ise", "", $meeting_desc);
        //$meeting_desc = ($board_config['allow_bbcode']) ? bbencode_second_pass($meeting_desc, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $meeting_desc);
        //$meeting_trebovania = ($board_config['allow_bbcode']) ? bbencode_second_pass($meeting_trebovania, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $meeting_trebovania);
        $meeting_trebovania = explode_str_on_words($meeting_trebovania, false);
        $meeting_desc = explode_str_on_words($meeting_desc, false);
        $meeting_desc = character_limit($meeting_desc, 200);
        imagettftext($im, 1.5 * $font_size, 0, 123, 295, $black, "images/bagy/ARICYRB.TTF", wordwrap($meeting_desc, 87));
        imagettftext($im, 1.5 * $font_size, 0, 260, 178, $black, "images/bagy/ARICYR.TTF", replace_cyr('(в %) '));
        imagettftext($im, 1.5 * $font_size, 0, 123, 190, $black, "images/bagy/ARICYR.TTF", !$meeting_plain_road || $meeting_plain_road == '0-0-0' || $meeting_plain_road == '0-0-0-0-0' || $meeting_onbike == 4 ? '' : wordwrap($meeting_plain_road_descr, 100));
        $meeting_by_coorgname = $meeting_by_coorgname ? ', ' . $meeting_by_coorgname : '';
        imagettftext($im, 2 * $font_size, 0, 225, 376, $black, "images/bagy/ARICYR.TTF", $meeting_by_username . ($meeting_by_id_coorg > 1 ? $meeting_by_coorgname : ''));
        //imagettftext($im, 2*$font_size, 0, 100, 390, $black, "images/bagy/ARICYRB.TTF", $str_size);
        //========================
        //--Вывод подписавшихся---
        $sql = "SELECT m.user_id, m.meeting_sure, m.meeting_guests, m.user_age, m.user_bagaze, u.username,  u.user_gender, u.user_occ,  u.user_garage as bike_id, u.model as ___ FROM " . MEETING_USER_TABLE . " m, " . USERS_TABLE . " u\n\t\t\tWHERE m.user_id = u.user_id\n\t\t\t\tAND m.meeting_id = {$id}\n\t\t\tORDER BY m.meeting_sure, u.username";
        $result = $db->sql_query($sql);
        $meeting_total_user_ids = 0;
        $meeting_user_ids = 0;
        $meeting_user = '';
        $meeting_sure = 0;
        $total_guests = 0;
        $meeting_guests = 0;
        $bagaze = 0;
        $marker_bagaz = 0;
        $current_user_bagaze = 0;
        $remain_guests = 0;
        $guest_places = '';
        $meeting_users_sql = $user->data['user_id'] . ', ' . ANONYMOUS;
        $s_meeting_signoffs = '';
        $signed_on = FALSE;
        $dobav_metka = 0;
        $current_user = $user->data['user_id'];
        while ($row = $db->sql_fetchrow($result)) {
            $dobav_metka = $user->data['user_id'] == $row['user_id'] ? 1 : $dobav_metka == 1 ? 1 : 0;
            $meeting_user_gender = $row['user_gender'];
            $signed_on_user = $row['user_id'];
            $meeting_users_sql .= ', ' . $signed_on_user;
            $guests = $row['meeting_guests'];
            $bagaze = $row['user_bagaze'];
            $m_user_age = $row['user_age'] != 0 ? $row['user_age'] : '';
            if ($signed_on_user == $current_user) {
                $signed_on = TRUE;
                $meeting_guests = $guests;
            } else {
                $total_guests += $row['meeting_sure'] ? $guests : 0;
            }
            if ($meeting_user_gender == 1) {
                $gender = '<img src="images/m.gif" align="absmiddle">';
            } else {
                if ($meeting_user_gender == 2) {
                    $gender = '<img src="images/z.gif" align="absmiddle">';
                } else {
                    $gender = '&nbsp;&nbsp;&nbsp;';
                }
            }
            if ($guests) {
                //$template->assign_block_vars('guest_names_block', array());
                $user_num_guests = 0;
                $sql2 = "SELECT guest_prename, guest_name FROM " . MEETING_GUESTNAMES_TABLE . "\n\t\t\t\t\tWHERE meeting_id = {$id}\n\t\t\t\t\t\tAND user_id = " . $row['user_id'] . "\n\t\t\t\t\tORDER BY guest_name, guest_prename";
                $result2 = $db->sql_query($sql2);
                $user_guest_names = array();
                while ($row2 = $db->sql_fetchrow($result2)) {
                    $user_guest_names['prename'][] = $row2['guest_prename'];
                    $user_guest_names['name'][] = $row2['guest_name'];
                    $user_num_guests++;
                }
                $db->sql_freeresult($result2);
                $user_remain_guests = sizeof($my_guest_names['name']);
            }
            $meeting_sure += $row['meeting_sure'];
            $meeting_user_ids += $row['meeting_sure'] ? 1 : 0;
            $meeting_total_user_ids++;
        }
        $db->sql_freeresult($result);
        $remain_guests -= $meeting_guests;
        $total_guests += $meeting_guests;
        $total_meeting_users = $meeting_user_ids + $total_guests;
        if ($meeting_otmena == 1) {
            $meeting_closed_img = 'status3.png';
        } else {
            imagettftext($im, 3.5 * $font_size, 0, 35, 330, $black, "images/bagy/DomIno.ttf", $total_meeting_users . replace_cyr(' чел.'));
            $meeting_closed_img = $meeting_time_utc < time() ? 'status.png' : '';
            $meeting_closed_img = $meeting_time_utc < time() && $meeting_comeback_utc > time() ? 'status2.png' : $meeting_closed_img;
        }
        //imagettftext($im, 3.5*$font_size, 0, 35, 330, $black, "images/bagy/DomIno.ttf", $meeting_time_utc . time());
        if ($meeting_closed_img != '') {
            $im2 = @imagecreatefrompng('images/' . $meeting_closed_img);
            imagecopy($im, $im2, 60, 50, 0, 0, 350, 350);
        }
        // --------------
        // Запись в файл
        // --------------
        delete_informer($id);
        if ($meeting_anonce == 0) {
            @chmod('userpix/image', 0777);
            imagepng($im, "userpix/image/informer" . $id . ".png");
            @chmod('userpix/image', 0755);
        }
        if ($mode == 'test') {
            imagepng($im);
        }
        //if( is_resource($im) ) { imagedestroy($im) };
        if (is_resource($im)) {
            imagedestroy($im);
        }
        //if (!empty($image)) { imagedestroy($image) };
        //imagedestroy($image);
        //if (!empty($im2)) { imagedestroy($im2) };
        if (is_resource($im2)) {
            imagedestroy($im2);
        }
        //if (!empty($im_status)) { imagedestroy($im_status) };
        //imagedestroy($im_status);
        //if (!empty($hard_image)) { imagedestroy($hard_image) };
        if (is_resource($hard_image)) {
            imagedestroy($hard_image);
        }
        if (is_resource($onbike_image)) {
            imagedestroy($onbike_image);
        }
    }
    return;
}
예제 #2
0
     $sql = "UPDATE " . MARSHRUT_DATA_TABLE . "\n\t\t\tSET marshrut_geo1 = " . ($datageo[1]['geoid'] ? $datageo[1]['geoid'] : 0) . ",\n\t\t\t\tmeeting_geocheck_1 = " . $datageo[1]['chk'] . ",\n\t\t\t\tmarshrut_geo2 = " . ($datageo[2]['geoid'] ? $datageo[2]['geoid'] : 0) . ",\n\t\t\t\tmeeting_geocheck_2 = " . $datageo[2]['chk'] . ",\n\t\t\t\tmarshrut_geo3 = " . ($datageo[3]['geoid'] ? $datageo[3]['geoid'] : 0) . ",\n\t\t\t\tmeeting_geocheck_3 = " . $datageo[3]['chk'] . "\n\t\t\tWHERE meeting_id = " . $id;
     $db->sql_query($sql);
 }
 // -------------------
 //  END Äîáàâëåíèå Òàéíèêîâ
 // -------------------
 // -------------------
 //      Информер
 // -------------------
 if ($meeting_informer == 1 && $group_id[0] == -1 && $meeting_anonce != 1 || $user->data['user_id'] == 2) {
     $meetID = $id == 0 ? $next_id : $id;
     include_once $phpbb_root_path . 'informer.' . $phpEx;
     create_informer($meetID, 'inf_create');
 } else {
     include_once $phpbb_root_path . 'informer.' . $phpEx;
     delete_informer($meetID, 'inf_del');
 }
 // -------------------
 //    END Информер
 // -------------------
 // Óâåäîìëåíèå î Íîâîé Ïîêàòóøêå
 //if($id == 0 && $user->data['user_id'] !=2)
 if (!$id || $id == 0) {
     $txt_data = get_textdate($next_id);
     //ðåãèîí
     $sql = "SELECT region_name\n\t\t\tFROM " . REGION_TABLE . "\n\t\t\tWHERE region_id =" . $meeting_region;
     $result = $db->sql_query($sql);
     while ($region_row = $db->sql_fetchrow($result)) {
         $meeting_region_name = $region_row['region_name'];
     }
     $db->sql_freeresult($result);