Exemple #1
0
function mysql2AssocArray($mysqlPostRow)
{
    global $db, $userPosition, $forumId, $usersForumId;
    $postId = $mysqlPostRow['id'];
    // Times
    $htmlDatetime = date('c', $mysqlPostRow['post_time']);
    $readableTime = date('D, d M Y H:i:s', $mysqlPostRow['post_time']);
    $niceTime = nicetime($mysqlPostRow['post_time']);
    // User and message
    $forumUser = html_entity_decode($mysqlPostRow['sender']);
    $forumUser = smilify($forumUser, $forumUser);
    $forumMessage = URL2link(smilify(nl2br(html_entity_decode($mysqlPostRow['message'])), $forumUser));
    // ip address, delete, edit button
    $headerActions = $userPosition == 'Webmaster' ? decode_ip($mysqlPostRow['ipaddress']) . ' 
        <a class="forum-post-delete" style="color:black;" title="Delete post" href="forum/delete/' . $postId . '">
            <i class="fa fa-trash-o"></i> <span class="sr-only">Delete</span>
        </a>' : '';
    if ($mysqlPostRow['users_forum_id'] == $usersForumId || $userPosition == 'Webmaster') {
        $headerActions .= '
            <a class="forum-post-edit" style="color:black;" title="Edit post" href="forum/edit/' . $postId . '">
                <i class="fa fa-pencil"></i> <span class="sr-only">Edit</span>
            </a>';
    }
    // Likes
    $likeCount = mysqli_query($db, "SELECT count(1) c FROM forum_plusone WHERE message = {$postId} LIMIT 1");
    $likeCount = mysqli_fetch_array($likeCount)['c'];
    if (mysqli_num_rows(mysqli_query($db, "SELECT 1 FROM forum_plusone WHERE message = {$postId} AND cookie = '{$usersForumId}' LIMIT 1"))) {
        $likedClass = 'liked';
        $likeTitle = 'Approved';
    } else {
        $likedClass = 'not-liked';
        $likeTitle = 'Approve Post';
    }
    return array('id' => $mysqlPostRow['id'], 'parentPostId' => $mysqlPostRow['parent_id'], 'htmlDatetime' => $htmlDatetime, 'readableTime' => $readableTime, 'niceTime' => $niceTime, 'forumUser' => $forumUser, 'forumMessage' => $forumMessage, 'headerActions' => $headerActions, 'likeCount' => $likeCount, 'likedClass' => $likedClass, 'likeTitle' => $likeTitle);
}
 /**
  * validate function
  * Validate the response and challenge strings of a recaptcha captcha.
  * @return bool
  * @author Rich Martin
  **/
 public function validate($response, $challenge)
 {
     // validate captcha
     $privatekey = "6Lc96AAAAAAAAM8m1ok23XZpJxWKD7iGagzckTab";
     $resp = recaptcha_check_answer($privatekey, decode_ip(USER_IP), $challenge, $response);
     // needless to say, blow up if it's wrong.
     if ((bool) $resp->is_valid == FALSE && !empty($resp->error)) {
         throw new CircuitValidationException("Please fill in the two words to submit your entry.");
     }
     return TRUE;
 }
function grab($url)
{
    $html = scraperWiki::scrape($url);
    $dom = new simple_html_dom();
    $dom->load($html);
    foreach ($dom->find("#tbl_proxy_list tr") as $data) {
        $tds = $data->find("td");
        if (count($tds) == 7) {
            $input = decode_ip((string) $tds[0]);
            $record = array('ip' => $input);
            scraperwiki::save(array('ip'), $record);
        }
    }
}
Exemple #4
0
 $mailcontent = '';
 while (list($key, $val) = each($_POST)) {
     strip_tags(removecrlf("{$key} => {$val}"));
     //if ($val != ''){
     $mailcontent .= "{$key} = {$val} \n";
     //}
 }
 require_once BASEDIR . 'includes/classes/phpmailer.php';
 $CLASS['mail']->ClearAll();
 $sender_name = removecrlf($sender_name);
 $sender_email = removecrlf($sender_email);
 $msg = $MAIN_CFG['global']['sitename'] . "\n\n";
 $msg .= _SENDERNAME . ': ' . $sender_name . "\n";
 $msg .= _SENDEREMAIL . ': ' . $sender_email . "\n";
 $msg .= _MESSAGE . ": " . stripslashes($mailcontent) . "\n\n--\n";
 $msg .= _POSTEDBY . " IP: " . decode_ip($userinfo['user_ip']) . " \n\n";
 // ChinaBrit
 $CLASS['mail']->SetLanguage();
 if ($MAIN_CFG['email']['smtp_on']) {
     $CLASS['mail']->IsSMTP();
     // set mailer to use SMTP
     $CLASS['mail']->Host = $MAIN_CFG['email']['smtphost'];
     if ($MAIN_CFG['email']['smtp_auth']) {
         $CLASS['mail']->SMTPAuth = true;
         // turn on SMTP authentication
         $CLASS['mail']->Username = $MAIN_CFG['email']['smtp_uname'];
         // SMTP username
         $CLASS['mail']->Password = $MAIN_CFG['email']['smtp_pass'];
         // SMTP password
     }
 }
Exemple #5
0
                $link_reg_ip .= profile_url($row) . ' ';
            }
        }
        if (!empty($last_ip)) {
            $link_last_ip .= $lang['OTHER_IP'] . ' ';
            foreach ($last_ip as $row) {
                $link_last_ip .= profile_url($row) . ' ';
            }
        }
        if ($profiledata['user_level'] == ADMIN && !IS_ADMIN) {
            $reg_ip = $last_ip = $lang['HIDDEN'];
        } elseif ($profiledata['user_level'] == MOD && IS_MOD) {
            $reg_ip = $last_ip = $lang['HIDDEN'];
        } else {
            $user_reg_ip = decode_ip($profiledata['user_reg_ip']);
            $user_last_ip = decode_ip($profiledata['user_last_ip']);
            $reg_ip = '<a href="' . $bb_cfg['whois_info'] . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
            $last_ip = '<a href="' . $bb_cfg['whois_info'] . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
        }
        $this->response['ip_list_html'] = '
			<br /><table class="mod_ip bCenter borderless" cellspacing="1">
				<tr class="row5" >
					<td>' . $lang['REG_IP'] . '</td>
					<td class="tCenter">' . $reg_ip . '</td>
					<td><div>' . $link_reg_ip . '</div></td>
				</tr>
				<tr class="row4">
					<td>' . $lang['LAST_IP'] . '</td>
					<td class="tCenter">' . $last_ip . '</td>
					<td><div>' . $link_last_ip . '</div></td>
				</tr>
            $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
            // We are running on windows, force delivery to use our smtp functions
            // since php's are broken by default
            $board_config['smtp_delivery'] = 1;
            $board_config['smtp_host'] = @$ini_val('SMTP');
        }
        $emailer = new emailer($board_config['smtp_delivery']);
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        for ($i = 0; $i < count($bcc_list); $i++) {
            $emailer->bcc($bcc_list[$i]);
        }
        $email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
        $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
        $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
        $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
        $emailer->use_template('admin_send_email');
        $emailer->email_address($board_config['board_email']);
        $emailer->set_subject($subject);
        $emailer->extra_headers($email_headers);
        $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
        $emailer->send();
        $emailer->reset();
        message_die(GENERAL_MESSAGE, $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.{$phpEx}?pane=right") . '">', '</a>'));
    }
}
if ($error) {
    $template->set_filenames(array('reg_header' => 'error_body.tpl'));
    $template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
    $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
    /**
     * Load the contents of the old tables into the database
     */
    function convert_data($mode, $sub)
    {
        global $db, $gallery_config, $template, $user, $phpbb_root_path, $phpEx;
        function decode_ip($int_ip)
        {
            $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
            $phpbb3_ip = hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
            return $phpbb3_ip;
        }
        $this->page_title = $user->lang['STAGE_IN_PROGRESS'];
        $convert_prefix = request_var('convert_prefix', '');
        $step = request_var('step', 0);
        $next_update_url = $body = '';
        switch ($step) {
            case 0:
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT *
					FROM ' . $convert_prefix . 'album_rate
					ORDER BY rate_pic_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $ary = array('rate_image_id' => $row['rate_pic_id'], 'rate_user_id' => $row['rate_user_id'] < 0 ? ANONYMOUS : $row['rate_user_id'], 'rate_user_ip' => decode_ip($row['rate_user_ip']), 'rate_point' => $row['rate_point']);
                    $batch_ary[$current_batch][] = $ary;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_RATES_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_RATES'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=1");
                break;
            case 1:
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT c.*, u.user_colour
					FROM ' . $convert_prefix . 'album_comment c
					LEFT JOIN ' . USERS_TABLE . ' u
						ON c.comment_user_id = u.user_id
					ORDER BY c.comment_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['comment_uid'] = $row['comment_options'] = $row['comment_bitfield'] = '';
                    $row['comment'] = $row['comment_text'];
                    $comment_text_data = generate_text_for_edit($row['comment'], $row['comment_uid'], $row['comment_options']);
                    $comment_data = array('comment_id' => $row['comment_id'], 'comment_image_id' => $row['comment_pic_id'], 'comment_user_id' => $row['comment_user_id'] < 0 ? ANONYMOUS : $row['comment_user_id'], 'comment_username' => $row['comment_username'], 'comment_user_colour' => isset($row['user_colour']) ? $row['user_colour'] : '', 'comment_user_ip' => decode_ip($row['comment_user_ip']), 'comment_time' => $row['comment_time'], 'comment' => $comment_text_data['text'], 'comment_uid' => '', 'comment_bitfield' => '', 'comment_options' => 7, 'comment_edit_time' => isset($row['comment_edit_time']) ? $row['comment_edit_time'] : 0, 'comment_edit_count' => isset($row['comment_edit_count']) ? $row['comment_edit_count'] : 0, 'comment_edit_user_id' => isset($row['comment_edit_user_id']) ? $row['comment_edit_user_id'] < 0 ? ANONYMOUS : $row['comment_edit_user_id'] : 0);
                    generate_text_for_storage($comment_data['comment'], $comment_data['comment_uid'], $comment_data['comment_bitfield'], $comment_data['comment_options'], 1, 1, 1);
                    unset($comment_data['comment_options']);
                    $batch_ary[$current_batch][] = $comment_data;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_COMMENTS_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_COMMENTS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=2");
                break;
            case 2:
                $personal_albums = '0';
                $left_id = 1;
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT *
					FROM ' . $convert_prefix . 'album_cat
					ORDER BY cat_order';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['cat_user_id'] = isset($row['cat_user_id']) ? $row['cat_user_id'] : 0;
                    if ($row['cat_user_id'] != 0) {
                        $personal_albums .= '_' . $row['cat_id'];
                    } else {
                        $row['album_desc_uid'] = $row['album_desc_options'] = $row['album_desc_bitfield'] = '';
                        $row['album_desc'] = $row['cat_desc'];
                        $album_desc_data = generate_text_for_edit($row['album_desc'], $row['album_desc_uid'], $row['album_desc_options']);
                        $album_data = array('album_id' => $row['cat_id'], 'album_name' => $row['cat_title'], 'parent_id' => 0, 'left_id' => $left_id, 'right_id' => $left_id + 1, 'album_parents' => '', 'album_type' => ALBUM_CAT, 'album_status' => ITEM_UNLOCKED, 'album_desc' => $album_desc_data['text'], 'album_desc_uid' => '', 'album_desc_bitfield' => '', 'album_desc_options' => 7);
                        generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], true, true, true);
                        $left_id = $left_id + 2;
                        $batch_ary[$current_batch][] = $album_data;
                        $current_batch_size++;
                        if ($current_batch_size = $this->batch_size) {
                            $current_batch_size = 1;
                            $current_batch++;
                        }
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_ALBUMS_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_ALBUMS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=3&amp;personal_albums={$personal_albums}");
                break;
            case 3:
                $personal_albums = explode('_', request_var('personal_albums', ''));
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT i.*, u.user_colour, u.username
					FROM ' . $convert_prefix . 'album i
					LEFT JOIN ' . USERS_TABLE . ' u
						ON i.pic_user_id = u.user_id
					ORDER BY i.pic_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['image_desc_uid'] = $row['image_desc_options'] = $row['image_desc_bitfield'] = '';
                    $row['image_desc'] = $row['pic_desc'];
                    $image_desc_data = generate_text_for_edit($row['image_desc'], $row['image_desc_uid'], $row['image_desc_options']);
                    $image_data = array('image_id' => $row['pic_id'], 'image_filename' => $row['pic_filename'], 'image_thumbnail' => $row['pic_thumbnail'], 'image_name' => $row['pic_title'], 'image_name_clean' => utf8_clean_string($row['pic_title']), 'image_desc' => $image_desc_data['text'], 'image_desc_uid' => '', 'image_desc_bitfield' => '', 'image_desc_options' => 7, 'image_user_id' => $row['pic_user_id'] < 0 ? ANONYMOUS : $row['pic_user_id'], 'image_username' => isset($row['username']) ? $row['username'] : $row['pic_username'], 'image_username_clean' => isset($row['username']) ? utf8_clean_string($row['username']) : utf8_clean_string($row['pic_username']), 'image_user_colour' => isset($row['user_colour']) ? $row['user_colour'] : '', 'image_user_ip' => decode_ip($row['pic_user_ip']), 'image_time' => $row['pic_time'], 'image_album_id' => in_array($row['pic_cat_id'], $personal_albums) ? 0 : $row['pic_cat_id'], 'image_view_count' => $row['pic_view_count'], 'image_status' => $row['pic_lock'] ? IMAGE_LOCKED : $row['pic_approval'], 'image_reported' => 0, 'image_exif_data' => '');
                    generate_text_for_storage($image_data['image_desc'], $image_data['image_desc_uid'], $image_data['image_desc_bitfield'], $image_data['image_desc_options'], true, true, true);
                    unset($image_data['image_desc_options']);
                    $batch_ary[$current_batch][] = $image_data;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_IMAGES_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_IMAGES'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=4");
                break;
            case 4:
                $personal_albums = 0;
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT i.image_id, i.image_username, image_user_id
					FROM ' . GALLERY_IMAGES_TABLE . " AS i\n\t\t\t\t\tWHERE image_album_id = 0\n\t\t\t\t\tGROUP BY i.image_user_id DESC";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $album_data = array('album_name' => $row['image_username'], 'parent_id' => 0, 'album_desc_options' => 7, 'album_desc' => '', 'album_parents' => '', 'album_type' => ALBUM_UPLOAD, 'album_status' => ITEM_UNLOCKED, 'album_user_id' => $row['image_user_id'] < 0 ? ANONYMOUS : $row['image_user_id']);
                    $db->sql_query('INSERT INTO ' . GALLERY_ALBUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $album_data));
                    $new_personal_album_id = $db->sql_nextid();
                    $personal_albums++;
                    $user_data = array('personal_album_id' => $new_personal_album_id, 'user_id' => $row['image_user_id']);
                    $batch_ary[$current_batch][] = $user_data;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                    $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . " \n\t\t\t\t\t\t\tSET image_album_id = {$new_personal_album_id}\n\t\t\t\t\t\t\tWHERE image_album_id = 0\n\t\t\t\t\t\t\t\tAND image_user_id  = " . (int) $row['image_user_id'];
                    $db->sql_query($sql);
                }
                $db->sql_freeresult($result);
                if (sizeof($batch_ary)) {
                    foreach ($batch_ary as $batch => $ary) {
                        $db->sql_multi_insert(GALLERY_USERS_TABLE, $ary);
                    }
                }
                // Update the config for the statistic on the index
                $sql = 'SELECT a.album_id, u.user_id, u.username, u.user_colour
					FROM ' . GALLERY_ALBUMS_TABLE . ' a
					LEFT JOIN ' . USERS_TABLE . ' u
						ON u.user_id = a.album_user_id
					WHERE a.album_user_id <> 0
						AND a.parent_id = 0
					ORDER BY a.album_id DESC';
                $result = $db->sql_query_limit($sql, 1);
                $newest_pgallery = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                set_gallery_config('newest_pgallery_user_id', (int) $newest_pgallery['user_id']);
                set_gallery_config('newest_pgallery_username', (string) $newest_pgallery['username']);
                set_gallery_config('newest_pgallery_user_colour', (string) $newest_pgallery['user_colour']);
                set_gallery_config('newest_pgallery_album_id', (int) $newest_pgallery['album_id']);
                set_gallery_config('personal_counter', $personal_albums);
                $body = $user->lang['CONVERTED_PERSONALS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=5");
                break;
            case 5:
                //Step 5.1: Number of public images and last_image_id
                $sql = 'SELECT COUNT(image_id) images, MAX(image_id) last_image_id, image_album_id
					FROM ' . GALLERY_IMAGES_TABLE . '
					WHERE image_status <> ' . IMAGE_UNAPPROVED . '
					GROUP BY image_album_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('album_images' => $row['images'], 'album_last_image_id' => $row['last_image_id']);
                    $sql = 'UPDATE ' . GALLERY_ALBUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
						WHERE ' . $db->sql_in_set('album_id', $row['image_album_id']);
                    $db->sql_query($sql);
                }
                $db->sql_freeresult($result);
                //Step 5.2: Number of real images and album_type
                $sql = 'SELECT COUNT(image_id) images, image_album_id
					FROM ' . GALLERY_IMAGES_TABLE . '
					GROUP BY image_album_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('album_images_real' => $row['images'], 'album_type' => ALBUM_UPLOAD);
                    $sql = 'UPDATE ' . GALLERY_ALBUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
						WHERE ' . $db->sql_in_set('album_id', $row['image_album_id']);
                    $db->sql_query($sql);
                }
                $db->sql_freeresult($result);
                //Step 5.3: Last image data
                $sql = 'SELECT a.album_id, a.album_last_image_id, i.image_time, i.image_name, i.image_user_id, i.image_username, i.image_user_colour, u.user_colour
					FROM ' . GALLERY_ALBUMS_TABLE . ' a
					LEFT JOIN ' . GALLERY_IMAGES_TABLE . ' i
						ON a.album_last_image_id = i.image_id
					LEFT JOIN ' . USERS_TABLE . ' u
						ON a.album_user_id = u.user_id
					WHERE a.album_last_image_id > 0';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('album_last_image_time' => $row['image_time'], 'album_last_image_name' => $row['image_name'], 'album_last_username' => $row['image_username'], 'album_last_user_colour' => isset($row['user_colour']) ? $row['user_colour'] : '', 'album_last_user_id' => $row['image_user_id']);
                    $sql = 'UPDATE ' . GALLERY_ALBUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
						WHERE ' . $db->sql_in_set('album_id', $row['album_id']);
                    $db->sql_query($sql);
                }
                $db->sql_freeresult($result);
                $body = $user->lang['CONVERTED_RESYNC_ALBUMS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=6");
                break;
            case 6:
                $num_images = 0;
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT u.user_id, COUNT(i.image_id) AS images
					FROM ' . USERS_TABLE . ' u
					LEFT JOIN ' . GALLERY_IMAGES_TABLE . ' i
						ON i.image_user_id = u.user_id
							AND i.image_status <> ' . IMAGE_UNAPPROVED . '
					GROUP BY i.image_user_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $num_images = $num_images + $row['images'];
                    $sql = 'UPDATE ' . GALLERY_USERS_TABLE . ' SET user_images = ' . (int) $row['images'] . '
						WHERE user_id = ' . (int) $row['user_id'];
                    $db->sql_query($sql);
                    if ($db->sql_affectedrows() <= 0) {
                        $ary = array('user_id' => $row['user_id'], 'user_images' => $row['images']);
                        $batch_ary[$current_batch][] = $ary;
                        $current_batch_size++;
                        if ($current_batch_size = $this->batch_size) {
                            $current_batch_size = 1;
                            $current_batch++;
                        }
                    }
                }
                $db->sql_freeresult($result);
                if (sizeof($batch_ary)) {
                    foreach ($batch_ary as $batch => $ary) {
                        $db->sql_multi_insert(GALLERY_USERS_TABLE, $ary);
                    }
                }
                set_config('num_images', $num_images, true);
                $body = $user->lang['CONVERTED_RESYNC_COUNTS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=7");
                break;
            case 7:
                $sql = 'SELECT rate_image_id, COUNT(rate_user_ip) image_rates, AVG(rate_point) image_rate_avg, SUM(rate_point) image_rate_points
					FROM ' . GALLERY_RATES_TABLE . '
					GROUP BY rate_image_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . '
						SET image_rates = ' . $row['image_rates'] . ',
							image_rate_points = ' . $row['image_rate_points'] . ',
							image_rate_avg = ' . round($row['image_rate_avg'], 2) * 100 . '
						WHERE image_id = ' . $row['rate_image_id'];
                    $db->sql_query($sql);
                }
                $db->sql_freeresult($result);
                $body = $user->lang['CONVERTED_RESYNC_RATES'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=8");
                break;
            case 8:
                $sql = 'SELECT COUNT(comment_id) comments, MAX(comment_id) image_last_comment, comment_image_id
					FROM ' . GALLERY_COMMENTS_TABLE . "\n\t\t\t\t\tGROUP BY comment_image_id";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . ' SET image_comments = ' . $row['comments'] . ',
						image_last_comment = ' . $row['image_last_comment'] . '
						WHERE ' . $db->sql_in_set('image_id', $row['comment_image_id']);
                    $db->sql_query($sql);
                }
                $db->sql_freeresult($result);
                $num_comments = 0;
                $sql = 'SELECT SUM(image_comments) comments
					FROM ' . GALLERY_IMAGES_TABLE . '
					WHERE image_status <> ' . IMAGE_UNAPPROVED;
                $result = $db->sql_query($sql);
                $num_comments = (int) $db->sql_fetchfield('comments');
                $db->sql_freeresult($result);
                set_gallery_config('num_comments', $num_comments, true);
                $body = $user->lang['CONVERTED_RESYNC_COMMENTS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=9");
                break;
            case 9:
                // Misc updates
                // Set the lastmark to the current time of update
                $sql = 'UPDATE ' . GALLERY_USERS_TABLE . '
					SET user_lastmark = ' . time() . '
					WHERE user_lastmark = 0';
                $db->sql_query($sql);
                $body = $user->lang['CONVERTED_MISC'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=advanced&amp;convert_prefix={$convert_prefix}");
                break;
        }
        $template->assign_vars(array('BODY' => $body, 'L_SUBMIT' => $user->lang['NEXT_STEP'], 'S_HIDDEN' => '', 'U_ACTION' => $next_update_url));
    }
Exemple #8
0
				0
				)') or myerror("Unable to save post", __FILE__, __LINE__, $db->error());
            break;
            // 0: Read the message [ Inbox ]
            // 3: Saved a message [ Savebox ]
        // 0: Read the message [ Inbox ]
        // 3: Saved a message [ Savebox ]
        case 0:
        case 3:
            $ob['owner'] = $ob['privmsgs_to_userid'];
            $ob['sender'] = $ob['privmsgs_from_userid'];
            $ob['status'] = 0;
            $ob['showed'] = 1;
            break;
    }
    // Save to database
    $db->query('INSERT INTO ' . $db->prefix . 'messages
		(owner, subject, message, sender, sender_id, posted, sender_ip, smileys, status, showed) VALUES(
		' . $ob['owner'] . ',
		\'' . addslashes($ob['privmsgs_subject']) . '\',
		\'' . addslashes($ob['privmsgs_text']) . '\',
		\'' . addslashes($ob['username']) . '\',
		' . $ob['sender'] . ',
		' . $ob['privmsgs_date'] . ',
		\'' . decode_ip($ob['privmsgs_ip']) . '\',
		' . $ob['privmsgs_enable_smilies'] . ',
		' . $ob['status'] . ',
		' . $ob['showed'] . '
		)') or myerror("Unable to save post", __FILE__, __LINE__, $db->error());
}
convredirect('privmsgs_id', $_SESSION['phpnuke'] . 'privmsgs', $last_id);
 if ($select_userlist == '') {
     $select_userlist = '<option value="-1">' . $lang['No_banned_users'] . '</option>';
 }
 $select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
 $sql = "SELECT ban_id, ban_ip, ban_email\n\t\tFROM " . BANLIST_TABLE;
 if (!($result = DB()->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql);
 }
 $banlist = DB()->sql_fetchrowset($result);
 DB()->sql_freeresult($result);
 $select_iplist = '';
 $select_emaillist = '';
 for ($i = 0; $i < count($banlist); $i++) {
     $ban_id = $banlist[$i]['ban_id'];
     if (!empty($banlist[$i]['ban_ip'])) {
         $ban_ip = str_replace('255', '*', decode_ip($banlist[$i]['ban_ip']));
         $select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
         $ipban_count++;
     } else {
         if (!empty($banlist[$i]['ban_email'])) {
             $ban_email = $banlist[$i]['ban_email'];
             $select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
             $emailban_count++;
         }
     }
 }
 if ($select_iplist == '') {
     $select_iplist = '<option value="-1">' . $lang['No_banned_ip'] . '</option>';
 }
 if ($select_emaillist == '') {
     $select_emaillist = '<option value="-1">' . $lang['No_banned_email'] . '</option>';
Exemple #10
0
<?php

if ($start == 0 && $_SESSION['phpnuke'] != '') {
    echo '<script type="text/javascript">window.location="index.php?page=' . ++$_GET['page'] . '"</script>';
    exit;
}
$result = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'banlist WHERE ban_id>' . $start . ' ORDER BY ban_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
    $last_id = $ob['ban_id'];
    $username = '';
    if ($ob['ban_userid'] != 0) {
        $res = $db->query('SELECT username FROM ' . $_SESSION['pun'] . 'users WHERE id=' . $ob['ban_userid']) or myerror("Unable to get userinfo for ban", __FILE__, __LINE__, $db->error());
        list($username) = $db->fetch_row($res);
    }
    $ob['ban_ip'] == '' ? $ip = 'null' : ($ip = decode_ip($ob['ban_ip']));
    $ob['ban_email'] == '' ? $ob['ban_email'] = 'null' : null;
    // Dataarray
    $todb = array('username' => $username, 'ip' => $ip, 'email' => $ob['ban_email']);
    // Save data
    insertdata('bans', $todb, __FILE__, __LINE__);
}
convredirect('ban_id', 'banlist', $last_id);
Exemple #11
0
 function show_error($the_error, $bypass_error = FALSE, $no_connection = 0)
 {
     global $sitename, $adminmail, $cpgdebugger, $userinfo;
     $this->_backtrace();
     $the_error .= "\n\nIn: " . $this->file . " on line: " . $this->line;
     $the_error = 'On ' . (function_exists('get_uri') ? get_uri() : $_SERVER['REQUEST_URI']) . "\n" . $the_error;
     $show = $no_connection || defined('INSTALL') ? 1 : is_admin() || NEXOS_DEBUG;
     if ($show) {
         if (!defined('INSTALL') && is_object($cpgdebugger)) {
             trigger_error($the_error, E_USER_WARNING);
         } else {
             $the_error = '<html><body><center><h1>ERROR</h1><form><textarea rows="8" cols="60">' . htmlspecialchars($the_error, ENT_QUOTES, 'UTF-8') . '</textarea></form></body></html>';
             die($the_error);
         }
     } else {
         if ($adminmail && $adminmail != '') {
             $addr = decode_ip(Security::get_ip());
             $host = isset($_SERVER['REMOTE_HOST']) && $_SERVER['REMOTE_HOST'] != '' ? $_SERVER['REMOTE_HOST'] : gethostbyaddr($addr);
             $the_error .= "\r\n\r\nGuest information:\r\nUser id: " . $userinfo['user_id'] . "\r\nUsername: "******"\r\nAdmin: " . ($show ? 'Yes' : 'No') . "\r\nIP: {$addr}\r\nHost: {$host}";
             if (!send_mail($mailer_message, $the_error, 1, 'SQL Error on ' . $sitename)) {
                 echo $mailer_message;
             }
         }
     }
     if (!$bypass_error) {
         $errorpage = '<b>A database error has occurred<br /><br />';
         if (NEXOS_DEBUG) {
             $errorpage .= "</b><textarea cols='60' rows='6'>{$the_error}</textarea>";
         } else {
             $errorpage .= 'The webmaster has been notified of the error</b>';
         }
         //header("HTTP/1.0 500 Internal Server Error");
         if (function_exists('cpg_error')) {
             cpg_error($errorpage, 'Database Error');
         } else {
             require_once 'includes/nexos_page.php';
             $errorpage = nexos_header('Database Error') . $errorpage . cpg_footer();
             die($errorpage);
         }
     }
 }
Exemple #12
0
function migrate_phpbb_topic($pTopicId, &$pRootComment)
{
    global $db;
    $sql = "SELECT bbp.*, bbpt.* FROM " . POSTS_TABLE . " bbp\n\t\t\t\tINNER JOIN " . POSTS_TEXT_TABLE . " bbpt ON(bbpt.post_id=bbp.post_id)  \n\t\t\t\tINNER JOIN " . TOPICS_TABLE . " bbt ON(bbt.topic_id=bbp.topic_id)  \n\t\t\tWHERE bbp.topic_id={$pTopicId} AND bbp.post_id != bbt.topic_first_post_id\n\t\t\tORDER BY bbp.post_time ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, "Could not obtain topic/post information.", '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result)) {
        print "Migrating Post {$row['post_id']}<br/>\n";
        $commentHash = array();
        $commentHash['root_id'] = $pRootComment->getField('root_id');
        $commentHash['parent_id'] = $pRootComment->getField('content_id');
        $commentHash['anon_name'] = $row['post_username'];
        $commentHash['title'] = $row['post_subject'];
        $commentHash['edit'] = $row['post_text'];
        $commentHash['format_guid'] = 'bbcode';
        $commentHash['created'] = $row['post_time'];
        $commentHash['last_modified'] = $row['post_edit_time'];
        $commentHash['user_id'] = $row['poster_id'];
        $commentHash['modifier_user_id'] = $row['poster_id'];
        $commentHash['ip'] = decode_ip($row['poster_ip']);
        $newComment = new LibertyComment();
        if ($newComment->storeComment($commentHash)) {
            $postHash['migrate_post_id'] = $row['post_id'];
            $newPost = new BitBoardPost($newComment->mCommentId);
            $newPost->store($postHash);
        } else {
            vd($row);
            vd($commentHash);
            vd($newComment->mErrors);
            die;
        }
    }
}
Exemple #13
0
        $mods_rowset = $db->sql_fetchrowset($result_mods);
        include $phpbb_root_path . 'includes/emailer.' . $phpEx;
        while ($i < $total_mods) {
            $script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path'])) . '/viewtopic.' . $phpEx;
            $server_name = trim($board_config['server_name']);
            $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
            $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
            $emailer = new emailer($board_config['smtp_delivery']);
            $emailer->email_address($mods_rowset[$i]['user_email']);
            $email_headers = "To: \"" . $mods_rowset[$i]['username'] . "\" <" . $mods_rowset[$i]['user_email'] . ">\r\n";
            $email_headers .= "From: \"" . $board_config['sitename'] . "\" <" . $board_config['board_email'] . ">\r\n";
            $email_headers .= "Return-Path: " . ($userdata['user_email'] && $userdata['user_viewemail'] ? $userdata['user_email'] . "\r\n" : "\r\n");
            $email_headers .= "X-AntiAbuse: Board servername - " . $server_name . "\r\n";
            $email_headers .= "X-AntiAbuse: User_id - " . $userdata['user_id'] . "\r\n";
            $email_headers .= "X-AntiAbuse: Username - " . $userdata['username'] . "\r\n";
            $email_headers .= "X-AntiAbuse: User IP - " . decode_ip($user_ip) . "\r\n";
            $emailer->use_template("repport_post", file_exists($phpbb_root_path . "language/lang_" . $mods_rowset[$i]['user_lang'] . "/email/repport_post.tpl") ? $mods_rowset[$i]['user_lang'] : "");
            $i++;
            //            	$emailer->set_subject($lang['Post_repport']);
            $emailer->extra_headers($email_headers);
            $emailer->assign_vars(array('POST_URL' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'POST_SUBJECT' => $post_subject, 'FORUM_NAME' => $forum_name, 'USER' => '"' . $userdata['username'] . '"', 'NUMBER_OF_REPPORTS' => $blue_card, 'SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email']));
            $emailer->send();
            $emailer->reset();
        }
    }
    message_die(GENERAL_MESSAGE, ($total_mods ? sprintf($lang['Post_repported'], $total_mods) : $lang['Post_repported_1']) . "<br /><br />" . ($board_config['report_forum'] ? sprintf($lang['Send_message'], "<a href=\"" . append_sid("posting.{$phpEx}?mode=" . ($allready_reported ? "reply&t=" . $allready_reported : "newtopic&f=" . $board_config['report_forum']) . "&postreport=" . $post_id) . "\">", "</a>") : "") . sprintf($lang['Click_return_viewtopic'], "<a href=\"" . append_sid("viewtopic.{$phpEx}?p=" . $post_id . "#" . $post_id) . "\">", "</a>"));
} else {
    if ($mode == 'unban') {
        $no_error_ban = FALSE;
        if (!$is_auth['auth_greencard']) {
            message_die(GENERAL_ERROR, $lang['Not_Authorised']);
Exemple #14
0
    } else {
        $cpgtpl->assign_var('DL_REVIEWS', false);
    }
    $db->sql_freeresult($result);
    if (can_admin($module_name) || $row['submitter'] == $userinfo['user_id']) {
        // pagination
        $cur_page2 = isset($_GET['p_page']) && $_GET['p_page'] > 0 ? intval($_GET['p_page']) : 1;
        $limit2 = ($cur_page2 - 1) * $perpage;
        $result = $db->sql_query("SELECT r.id, r.uid, r.ip, r.title, r.comment, r.score, r.timestamp, u.username, COUNT(r.score) AS votes FROM " . $dl_prefix . "_ratings r\n\tLEFT JOIN " . $user_prefix . "_users u ON (u.user_id = r.uid)\n\tWHERE r.lid='{$global_id}' AND r.comment!='' AND active=0 \n\tGROUP BY r.id DESC, r.uid, r.ip, r.title, r.comment, r.score, r.timestamp, u.username \n\tLIMIT {$perpage} OFFSET {$limit2}");
        list($pending) = $db->sql_ufetchrow("SELECT COUNT(*) FROM " . $dl_prefix . "_ratings \n\tWHERE lid='{$global_id}' AND active=0");
        if ($db->sql_numrows($result)) {
            $cpgtpl->assign_vars(array('DL_P_REVIEW_PAGES' => ceil($pending / $perpage) > 1 ? gen_pagination($pending, $perpage, $cur_page2, '&amp;file=details&amp;id=' . $global_id, 'p_reviews', 'p_page') : false, 'DL_P_REVIEWS' => $pending));
            $i = 0;
            while (list($review_id, $review_uid, $review_ip, $review_title, $review_comment, $review_score, $review_timestamp, $review_uname, $review_votes) = $db->sql_fetchrow($result)) {
                $rating_info = get_rating($review_score, $review_votes);
                $cpgtpl->assign_block_vars('dl_p_review', array('ID' => $review_id, 'U_ID' => htmlprepare(URL::uri()) . '#r' . $review_id, 'RATING' => _DLP_REVIEW . ' #' . $review_id . ': ' . $rating_info['desc'], 'U_MEMBER' => URL::index('Your_Account&amp;profile=' . $review_uid), 'MEMBERNAME' => $review_uname, 'DATE' => generate_date($review_timestamp), 'U_DEL' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;del_review=' . $review_id) . '">[' . strtolower(_DELETE) . ']</a>' : false, 'U_APPR' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;approve_review=' . $review_id) . '">[' . strtolower(_DLP_APPROVE) . ']</a>' : false, 'TITLE' => $review_title, 'COMMENT' => decode_bb_all($review_comment), 'IP' => decode_ip($review_ip), 'IMG_RATE' => dl_image('stars/' . $rating_info['rating'] . '.png'), 'SPACER' => $i > 0));
                $i++;
            }
        } else {
            $cpgtpl->assign_var('DL_P_REVIEWS', false);
        }
        $db->sql_freeresult($result);
    } else {
        $cpgtpl->assign_var('DL_P_REVIEWS', false);
    }
}
if ($row['pick']) {
    $cpgtpl->assign_block_vars('dl_image', array('SRC' => dl_image('pick.png'), 'TITLE' => _DLP_EDPICK));
}
// custom fields: images
$result = $db->sql_query("SELECT field, img_path, img_alt FROM " . $dl_prefix . "_fields \n\tWHERE type=3 AND visible > 0");
     $sql .= " AND (link_title LIKE '%{$search_keywords}%' OR link_desc LIKE '% {$search_keywords}%') ORDER BY link_id DESC LIMIT {$start}, {$linkspp}";
 } else {
     $sql .= " ORDER BY link_id DESC LIMIT {$start}, {$linkspp}";
 }
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, "Couldn not query links list.", '', __LINE__, __FILE__, $sql);
 }
 if ($row = $db->sql_fetchrow($result)) {
     $i = 0;
     do {
         $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
         $link_id = $row['link_id'];
         $link_id .= '&sid=' . $userdata['session_id'] . '';
         $user_id = $row['user_id'];
         $username = $row['username'];
         $template->assign_block_vars("linkrow", array('ROW_CLASS' => $row_class, 'LINK_ID' => $link_id, 'LINK_TITLE' => $row['link_title'], 'LINK_URL' => $row['link_url'], 'LINK_CATEGORY' => $link_categories[$row['link_category']], 'U_LINK_USER' => $user_id != ANONYMOUS ? "<a href=\"../profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . "={$user_id}\" target=\"_blank\">{$username}</a>" : $username, 'LINK_JOINED' => create_date($lang['DATE_FORMAT'], $row['link_joined'], $board_config['board_timezone']), 'LINK_USER_IP' => decode_ip($row['user_ip']), 'LINK_DESC' => $row['link_desc'], 'LINK_ACTIVE' => '<font color="' . ($row['link_active'] ? 'green">' . $lang['ON'] : 'red">' . $lang['OFF']) . '</font>', 'LINK_HITS' => $row['link_hits']));
         $i++;
     } while ($row = $db->sql_fetchrow($result));
 }
 //
 // Pagination
 //
 $sql = "SELECT count(*) AS total\n\t\t\tFROM " . LINKS_TABLE;
 if ($search_keywords) {
     $sql .= " AND (link_title LIKE '%{$search_keywords}%' OR link_desc LIKE '%{$search_keywords} %')";
     $link_search = $lang['Search_site'] . " &raquo; " . $search_keywords;
     $template->assign_vars(array('L_SEARCH_SITE' => $link_search));
 }
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not query links number', '', __LINE__, __FILE__, $sql);
 }
Exemple #16
0
<?php

$result = $fdb->query('SELECT post.post_id, post.post_time, post.poster_id, post.poster_ip, post.topic_id, text.post_subject, text.post_text, users.username FROM ' . $_SESSION['php'] . $_SESSION['phpnuke'] . 'posts AS post, ' . $_SESSION['php'] . $_SESSION['phpnuke'] . 'posts_text AS text, ' . $_SESSION['php'] . 'users AS users WHERE post.post_id>' . $start . ' AND post.post_id=text.post_id AND users.user_id=post.poster_id ORDER BY post.post_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
    $last_id = $ob['post_id'];
    echo $ob['post_id'] . ' (' . $ob['username'] . ")<br>\n";
    flush();
    // Check for anonymous poster id problem
    if ($ob['poster_id'] == -1) {
        $ob['poster_id'] = 1;
        $ob['username'] = '******';
    }
    // Dataarray
    $todb = array('id' => $ob['post_id'], 'poster' => $ob['username'], 'poster_id' => $ob['poster_id'], 'posted' => $ob['post_time'], 'poster_ip' => decode_ip($ob['poster_ip']), 'message' => convert_posts($ob['post_text']), 'topic_id' => $ob['topic_id']);
    // Save data
    insertdata('posts', $todb, __FILE__, __LINE__);
}
convredirect('post_id', $_SESSION['phpnuke'] . 'posts', $last_id);
Exemple #17
0
 /**
  * Assembles message header.
  * @access private
  * @return string
  */
 function CreateHeader()
 {
     $result = '';
     // Set the boundaries
     $uniq_id = md5(uniqid(time()));
     $this->boundary[1] = 'b1_' . $uniq_id;
     $this->boundary[2] = 'b2_' . $uniq_id;
     $result .= $this->HeaderLine('Date', $this->RFCDate());
     if ($this->Sender == '') {
         $result .= $this->HeaderLine('Return-Path', trim($this->From));
     } else {
         $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
     }
     // To be created automatically by mail()
     if ($this->Mailer != 'mail') {
         if (count($this->to) > 0) {
             $result .= $this->AddrAppend('To', $this->to);
         } else {
             if (count($this->cc) == 0) {
                 $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
             }
         }
         if (count($this->cc) > 0) {
             $result .= $this->AddrAppend('Cc', $this->cc);
         }
     }
     $from = array();
     $from[0][0] = trim($this->From);
     $from[0][1] = $this->FromName;
     $result .= $this->AddrAppend('From', $from);
     // sendmail and mail() extract Bcc from the header before sending
     if (($this->Mailer == 'sendmail' || $this->Mailer == 'mail') && count($this->bcc) > 0) {
         $result .= $this->AddrAppend('Bcc', $this->bcc);
     }
     if (count($this->ReplyTo) > 0) {
         $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
     }
     // mail() sets the subject itself
     if ($this->Mailer != 'mail') {
         $result .= $this->HeaderLine('Subject', $this->EncodeHeader(trim($this->Subject)));
     }
     $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
     //X-MSMail-Priority: Normal
     //X-MimeOLE
     $result .= $this->HeaderLine('X-Mailer', "PHPMailer [version " . $this->Version . "]");
     $ip = Security::get_ip();
     $backtrace = debug_backtrace();
     $src = 'unknown';
     for ($i = 0; $i <= count($backtrace); ++$i) {
         if (isset($backtrace[$i]['function']) && 'send_mail' === $backtrace[$i]['function']) {
             $src = $backtrace[$i]['file'];
             $backtrace = NULL;
             break;
         }
     }
     $result .= $this->HeaderLine('X-DF-MailerSRC', $src . ' for ' . decode_ip($ip));
     if ($this->ConfirmReadingTo != '') {
         $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
     }
     // Add custom headers
     for ($index = 0; $index < count($this->CustomHeader); $index++) {
         $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
     }
     $result .= $this->HeaderLine('MIME-Version', '1.0');
     switch ($this->message_type) {
         case 'plain':
             $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
             $result .= sprintf('Content-Type: %s; charset="%s"', $this->ContentType, $this->CharSet);
             break;
         case 'attachments':
             // fall through
         // fall through
         case 'alt_attachments':
             if ($this->InlineImageExists()) {
                 $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", "multipart/related", $this->LE, $this->LE, $this->boundary[1], $this->LE);
             } else {
                 $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
                 $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
             }
             break;
         case 'alt':
             $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
             $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
             break;
     }
     if ($this->Mailer != 'mail') {
         $result .= $this->LE . $this->LE;
     }
     return $result;
 }
Exemple #18
0
 $template->assign_vars(array('L_IP_INFO' => $lang['IP_info'], 'L_THIS_POST_IP' => $lang['This_posts_IP'], 'L_OTHER_IPS' => $lang['Other_IP_this_user'], 'L_OTHER_USERS' => $lang['Users_this_IP'], 'L_LOOKUP_IP' => $lang['Lookup_IP'], 'L_SEARCH' => $lang['Search'], 'SEARCH_IMG' => $images['icon_search'], 'IP' => $ip_this_post, 'U_LOOKUP_IP' => "modcp.{$phpEx}?mode=ip&amp;" . POST_POST_URL . "={$post_id}&amp;" . POST_TOPIC_URL . "={$topic_id}&amp;rdns={$ip_this_post}&amp;sid=" . $userdata['session_id']));
 //
 // Get other IP's this user has posted under
 //
 $sql = "SELECT poster_ip, COUNT(*) AS postings \n\t\t\tFROM " . POSTS_TABLE . " \n\t\t\tWHERE poster_id = {$poster_id} \n\t\t\tGROUP BY poster_ip \n\t\t\tORDER BY " . (SQL_LAYER == 'msaccess' ? 'COUNT(*)' : 'postings') . " DESC";
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not get IP information for this user', '', __LINE__, __FILE__, $sql);
 }
 if ($row = $db->sql_fetchrow($result)) {
     $i = 0;
     do {
         if ($row['poster_ip'] == $post_row['poster_ip']) {
             $template->assign_vars(array('POSTS' => $row['postings'] . ' ' . ($row['postings'] == 1 ? $lang['Post'] : $lang['Posts'])));
             continue;
         }
         $ip = decode_ip($row['poster_ip']);
         $ip = $rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all' ? htmlspecialchars(gethostbyaddr($ip)) : $ip;
         $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2'];
         $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
         $template->assign_block_vars('iprow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'IP' => $ip, 'POSTS' => $row['postings'] . ' ' . ($row['postings'] == 1 ? $lang['Post'] : $lang['Posts']), 'U_LOOKUP_IP' => "modcp.{$phpEx}?mode=ip&amp;" . POST_POST_URL . "={$post_id}&amp;" . POST_TOPIC_URL . "={$topic_id}&amp;rdns=" . $row['poster_ip'] . "&amp;sid=" . $userdata['session_id']));
         $i++;
     } while ($row = $db->sql_fetchrow($result));
 }
 //
 // Get other users who've posted under this IP
 //
 $sql = "SELECT u.user_id, u.username, COUNT(*) as postings \n\t\t\tFROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p \n\t\t\tWHERE p.poster_id = u.user_id \n\t\t\t\tAND p.poster_ip = '" . $post_row['poster_ip'] . "'\n\t\t\tGROUP BY u.user_id, u.username\n\t\t\tORDER BY " . (SQL_LAYER == 'msaccess' ? 'COUNT(*)' : 'postings') . " DESC";
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not get posters information based on IP', '', __LINE__, __FILE__, $sql);
 }
 if ($row = $db->sql_fetchrow($result)) {
Exemple #19
0
 function alter_field($mode, $table, $field, $type = '', $null = TRUE, $default = NULL)
 {
     switch ($mode) {
         case 'add':
             if ($type == 'TEXT' || $type == 'BLOB') {
                 return $this->alter_table("{$table} ADD {$field} {$type}" . ($null ? '' : ' NOT') . ' NULL');
             } else {
                 return $this->alter_table("{$table} ADD {$field} {$type}" . ($null ? '' : ' NOT') . ' NULL DEFAULT ' . (isset($default) ? "'{$default}'" : 'NULL'));
             }
         case 'drop':
             return $this->_owner->query("ALTER TABLE {$table} DROP {$field}");
         case 'change':
             if (!is_array($field)) {
                 $field = array($field, $field);
             }
             if ($type == 'TEXT' || $type == 'BLOB') {
                 return $this->alter_table("{$table} CHANGE {$field['0']} {$field['1']} {$type}" . ($null ? '' : ' NOT') . ' NULL');
             }
             if (eregi('VARBINARY', $type)) {
                 $ret = $result = $this->_owner->query("SELECT {$field['1']} FROM {$table} GROUP BY {$field['1']}");
                 if ($ret && $this->_owner->num_rows($result) > 0) {
                     $ret = $this->_owner->query("ALTER TABLE {$table} ADD df_varbin_tmp {$type} NULL DEFAULT NULL");
                     if ($ret) {
                         $t_indexes = $this->list_indexes($table);
                         if (!isset($t_indexes[$field[1]])) {
                             $ret = $this->alter_index('index', $table, $field[1], $field[1] . '(8)');
                         }
                         $t_indexes = null;
                     }
                     if ($ret) {
                         if (!function_exists('inet_pton')) {
                             require CORE_PATH . 'functions/inet.php';
                         }
                         while ($row = $this->_owner->fetch_array($result, SQL_NUM)) {
                             $ip = inet_pton(decode_ip($row[0]));
                             $ip = empty($ip) ? 'DEFAULT' : $this->_owner->binary_safe($ip);
                             $ret = $this->_owner->query("UPDATE {$table} SET df_varbin_tmp={$ip} WHERE {$field['1']}='" . $this->_owner->escape_string($row[0]) . "'");
                             if (!$ret) {
                                 break;
                             }
                         }
                         if ($ret) {
                             $ret = $this->_owner->query("ALTER TABLE {$table} DROP {$field['1']}");
                         }
                         if ($ret) {
                             $ret = $this->_owner->query("ALTER TABLE {$table} CHANGE df_varbin_tmp {$field['1']} {$type} NULL DEFAULT NULL");
                         }
                     }
                     $this->_owner->free_result($result);
                     return $ret;
                 }
                 // rows == 0 then contine to alter the table
                 $this->_owner->free_result($result);
             }
             return $this->alter_table("{$table} CHANGE {$field['0']} {$field['1']} {$type}" . ($null ? '' : ' NOT') . ' NULL DEFAULT ' . (isset($default) ? "'{$default}'" : 'NULL'));
     }
 }
Exemple #20
0
 // Get other IP's this user has posted under
 //
 $sql = "SELECT poster_ip, COUNT(*) AS postings\n\t\tFROM " . POSTS_TABLE . "\n\t\tWHERE poster_id = '" . Fix_Quotes($poster_id) . "'\n\t\tGROUP BY poster_ip\n\t\tORDER BY " . (SQL_LAYER == 'msaccess' ? 'COUNT(*)' : 'postings') . " DESC";
 $result = $db->sql_query($sql);
 if ($row = $db->sql_fetchrow($result)) {
     $i = 0;
     do {
         if ($row['poster_ip'] == $post_row['poster_ip']) {
             $template->assign_vars(array('POSTS' => $row['postings'] . ' ' . ($row['postings'] == 1 ? $lang['Post'] : $lang['Posts'])));
             continue;
         }
         $ip = decode_ip($row['poster_ip']);
         $ip = $rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all' ? gethostbyaddr($ip) : $ip;
         $row_color = !($i % 2) ? $bgcolor2 : $bgcolor1;
         $row_class = !($i % 2) ? 'row1' : 'row2';
         $template->assign_block_vars('iprow', array('ROW_COLOR' => $row_color, 'ROW_CLASS' => $row_class, 'IP' => $ip, 'POSTS' => $row['postings'] . ' ' . ($row['postings'] == 1 ? $lang['Post'] : $lang['Posts']), 'U_LOOKUP_IP' => URL::index("&amp;file=modcp&amp;mode=ip&amp;" . POST_POST_URL . "={$post_id}&amp;" . POST_TOPIC_URL . "={$topic_id}&amp;rdns=" . decode_ip($row['poster_ip']))));
         $i++;
     } while ($row = $db->sql_fetchrow($result));
 }
 //
 // Get other users who've posted under this IP
 //
 $sql = "SELECT u.user_id, u.username, COUNT(*) as postings\n\t\tFROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p\n\t\tWHERE p.poster_id = u.user_id\n\t\t  AND p.poster_ip = '" . Fix_Quotes($post_row['poster_ip']) . "'\n\t\tGROUP BY u.user_id, u.username\n\t\tORDER BY " . (SQL_LAYER == 'msaccess' ? 'COUNT(*)' : 'postings') . " DESC";
 $result = $db->sql_query($sql);
 if ($row = $db->sql_fetchrow($result)) {
     $i = 0;
     do {
         $id = $row['user_id'];
         $username = $id == ANONYMOUS ? $lang['Guest'] : $row['username'];
         $row_color = !($i % 2) ? $bgcolor2 : $bgcolor1;
         $row_class = !($i % 2) ? 'row1' : 'row2';
Exemple #21
0
 $template->assign_vars(array('L_IP_INFO' => $lang['IP_info'], 'L_THIS_POST_IP' => $lang['This_posts_IP'], 'L_OTHER_IPS' => $lang['Other_IP_this_user'], 'L_OTHER_USERS' => $lang['Users_this_IP'], 'L_LOOKUP_IP' => $lang['Lookup_IP'], 'L_SEARCH' => $lang['Search'], 'SEARCH_IMG' => $images['icon_search'], 'IP' => $ip_this_post, 'U_LOOKUP_IP' => append_sid("shoutbox_max.{$phpEx}?mode=ip&amp;" . POST_POST_URL . "={$post_id}&amp;rdns=" . $ip_this_post)));
 //
 // Get other IP's this user has posted under
 //
 $sql = "SELECT shout_ip, COUNT(*) AS postings \r\n\t\tFROM " . SHOUTBOX_TABLE . " \r\n\t\tWHERE shout_user_id = {$poster_id} \r\n\t\tGROUP BY shout_ip \r\n\t\tORDER BY " . (SQL_LAYER == 'msaccess' ? 'COUNT(*)' : 'postings') . " DESC";
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not get IP information for this user', '', __LINE__, __FILE__, $sql);
 }
 if ($row = $db->sql_fetchrow($result)) {
     $i = 0;
     do {
         if ($row['shout_ip'] == $post_row['shout_ip']) {
             $template->assign_vars(array('POSTS' => $row['postings'] . ' ' . ($row['postings'] == 1 ? $lang['Post'] : $lang['Posts'])));
             continue;
         }
         $ip = decode_ip($row['shout_ip']);
         $ip = $rdns_ip_num == $row['shout_ip'] || $rdns_ip_num == 'all' ? gethostbyaddr($ip) : $ip;
         $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2'];
         $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
         $template->assign_block_vars('iprow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'IP' => $ip, 'POSTS' => $row['postings'] . ' ' . ($row['postings'] == 1 ? $lang['Post'] : $lang['Posts']), 'U_LOOKUP_IP' => append_sid("shoutbox_max.{$phpEx}?mode=ip&amp;" . POST_POST_URL . "={$post_id}&amp;rdns=" . $row['shout_ip'])));
         $i++;
     } while ($row = $db->sql_fetchrow($result));
 }
 //
 // Get other users who've posted under this IP
 //
 $sql = "SELECT u.user_id, u.username, COUNT(*) as postings \r\n\t\t\tFROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p \r\n\t\t\tWHERE p.poster_id = u.user_id \r\n\t\t\t\tAND p.poster_ip = '" . $shout_identifyer['shout_ip'] . "'\r\n\t\t\tGROUP BY u.user_id, u.username\r\n\t\t\tORDER BY " . (SQL_LAYER == 'msaccess' ? 'COUNT(*)' : 'postings') . " DESC";
 //-- mod : rank color system ---------------------------------------------------
 //-- add
 $sql = str_replace('SELECT ', 'SELECT u.user_level, u.user_color, u.user_group_id, ', $sql);
 //-- fin mod : rank color system -----------------------------------------------
Exemple #22
0
 $template->assign_block_vars('list', array());
 $sql = "SELECT c.*, u.username, a.character_name FROM " . ADR_CHEAT_LOG_TABLE . " c\r\n\t\tLEFT JOIN " . USERS_TABLE . " u ON ( c.cheat_user_id = u.user_id )\r\n\t\tLEFT JOIN " . ADR_CHARACTERS_TABLE . " a ON ( c.cheat_user_id = a.character_id )\r\n\t\tLIMIT {$start}, " . $board_config['posts_per_page'];
 $result = $db->sql_query($sql);
 $cheat_info = $db->sql_fetchrowset($result);
 $sql = "SELECT * FROM " . ADR_CHEAT_LOG_TABLE;
 $result = $db->sql_query($sql);
 $total = $db->sql_numrows($result);
 $cheat_count = count($cheat_info);
 $pagination = generate_pagination($phpbb_root_path . "admin/admin_adr_cheat_log.{$phpEx}?mode=", $total, $board_config['posts_per_page'], $start) . '&nbsp;';
 $page_number = sprintf($lang['Page_of'], floor($start / $board_config['posts_per_page']) + 1, ceil($total / $board_config['posts_per_page']));
 if (!$total) {
     $message = $lang['Adr_Npc_character_no_cheat_message'] . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.{$phpEx}?pane=right") . "\">", "</a>");
     message_die(GENERAL_MESSAGE, $message);
 }
 for ($a = 0; $a < $cheat_count; $a++) {
     $cheat_ip = decode_ip($cheat_info[$a]['cheat_ip']);
     $cheat_type = $cheat_info[$a]['cheat_reason'];
     switch ($cheat_type) {
         case 'NPC Refresh Cheat':
             $cheat_type_no = 1;
             break;
         case 'NPC URL Insertion Cheat':
             $cheat_type_no = 2;
             break;
     }
     $cheat_date = create_date($board_config['default_dateformat'], $cheat_info[$a]['cheat_date'], $board_config['board_timezone']);
     $fix_ip = explode('.', $cheat_ip);
     $fixed_ip = '<a href="http://www.dnsstuff.com/tools/whois.ch?ip=' . $cheat_ip . '" target="_phpbbwhois">' . $cheat_ip . '</a>';
     $row_class = !($a % 2) ? $theme['td_class1'] : $theme['td_class2'];
     $cheat_punishment_array = explode('~', $cheat_info[$a]['cheat_punished']);
     $cheat_punishment = '';
Exemple #23
0
             $poster = $commentrow[$i]['comment_username'] == '' ? $lang['Guest'] : $commentrow[$i]['comment_username'];
         } else {
             $poster = '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $commentrow[$i]['user_id']) . '">' . $commentrow[$i]['username'] . '</a>';
         }
         if ($commentrow[$i]['comment_edit_count'] > 0) {
             $sql = "SELECT c.comment_id, c.comment_edit_user_id, u.user_id, u.username\n\t\t\t\t\t\tFROM " . ADS_COMMENTS_TABLE . " AS c\n\t\t\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON c.comment_edit_user_id = u.user_id\n\t\t\t\t\t\tWHERE c.comment_id = '" . $commentrow[$i]['comment_id'] . "'\n\t\t\t\t\t\tLIMIT 0,1";
             if (!($result = $db->sql_query($sql))) {
                 message_die(GENERAL_ERROR, 'Could not obtain last edit information from the database', '', __LINE__, __FILE__, $sql);
             }
             $lastedit_row = $db->sql_fetchrow($result);
             $edit_info = $commentrow[$i]['comment_edit_count'] == 1 ? $lang['Edited_time_total'] : $lang['Edited_times_total'];
             $edit_info = '<br /><br />&raquo;&nbsp;' . sprintf($edit_info, $lastedit_row['username'], create_date($board_config['default_dateformat'], $commentrow[$i]['comment_edit_time'], $board_config['board_timezone']), $commentrow[$i]['comment_edit_count']) . '<br />';
         } else {
             $edit_info = '';
         }
         $template->assign_block_vars('commentrow', array('ID' => $commentrow[$i]['comment_id'], 'POSTER' => $poster, 'TIME' => create_date($board_config['default_dateformat'], $commentrow[$i]['comment_time'], $board_config['board_timezone']), 'IP' => $userdata['user_level'] == ADMIN ? '-----------------------------------<br />' . $lang['IP_Address'] . ': <a href="http://network-tools.com/default.asp?host=' . decode_ip($commentrow[$i]['comment_user_ip']) . '" target="_blank">' . decode_ip($commentrow[$i]['comment_user_ip']) . '</a><br />' : '', 'TEXT' => nl2br($commentrow[$i]['comment_text']), 'EDIT_INFO' => $edit_info, 'EDIT' => edit_allowed($commentrow[$i]['comment_user_id'], $cat_edit_level) == TRUE ? '<a href="' . append_sid("ads_comment_edit.{$phpEx}?comment_id=" . $commentrow[$i]['comment_id']) . '">' . $lang['edit'] . '</a>' : '', 'DELETE' => delete_allowed($commentrow[$i]['comment_user_id'], $cat_delete_level) == TRUE ? '<a href="' . append_sid("ads_comment_delete.{$phpEx}?comment_id=" . $commentrow[$i]['comment_id']) . '">' . $lang['delete'] . '</a>' : ''));
     }
     $template->assign_block_vars('switch_comment', array());
     $template->assign_vars(array('PAGINATION' => generate_pagination(append_sid("ads_comment.{$phpEx}?ad_id={$ad_id}&amp;sort_order={$sort_order}"), $total_comments, $comments_per_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $comments_per_page) + 1, ceil($total_comments / $comments_per_page))));
 }
 //
 // Start output of page
 //
 $page_title = $lang['comments'];
 include $phpbb_root_path . 'includes/page_header.' . $phpEx;
 $template->set_filenames(array('body' => 'ads_comment_body.tpl'));
 if ($user_id == ADS_GUEST or $username == '') {
     $poster = $username == '' ? $lang['Guest'] : $username;
 } else {
     $poster = '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $user_id) . '">' . $username . '</a>';
 }
     }
     $row_color = $i % 2 == 0 ? "row1" : "row2";
     $firstvisit = create_date($board_config['default_dateformat'], $refererrow[$i]['referer_firstvisit'], $board_config['board_timezone']);
     if ($refererrow[$i]['referer_lastvisit'] != 0) {
         $lastvisit = create_date($board_config['default_dateformat'], $refererrow[$i]['referer_lastvisit'], $board_config['board_timezone']);
     } else {
         $lastvisit = '';
     }
     if ($mode == "showurls") {
         $l_ip = $refererrow[$i]['referer_ip'];
         if ($l_ip == $rdns_ip_num) {
             $u_ip = append_sid("admin_referers.{$phpEx}?mode=showurls");
             $l_ip = gethostbyaddr(decode_ip($l_ip));
         } else {
             $u_ip = append_sid("admin_referers.{$phpEx}?mode=showurls&amp;rdns={$l_ip}");
             $l_ip = decode_ip($l_ip);
         }
         $u_ip .= "&amp;sort={$sort_method}&amp;order={$sort_order}";
         $referer_url = substr($refererrow[$i]['referer_url'], strpos($refererrow[$i]['referer_url'], "/", strpos($refererrow[$i]['referer_url'], "//") + 2));
         $referer_url_title = '';
         if (strlen($referer_url) > 48) {
             $referer_url_title = ' title="' . $referer_url . '"';
             $referer_url = substr($referer_url, 0, 45) . '...';
         }
         $template->assign_block_vars('refererrow_with_ref_urls', array('COLOR' => $row_color, 'U_REFERER' => $refererrow[$i]['referer_host'] ? "http://" . $refererrow[$i]['referer_host'] : '', 'REFERER' => $refererrow[$i]['referer_host'] ? $refererrow[$i]['referer_host'] : '(empty)', 'U_URL' => htmlentities($refererrow[$i]['referer_url']), 'URL' => htmlentities($referer_url), 'URL_TITLE' => $referer_url_title, 'U_IP' => $u_ip, 'L_IP' => $l_ip, 'HITS' => $refererrow[$i]['referer_hits'], 'FIRSTVISIT' => $firstvisit, 'LASTVISIT' => $lastvisit, 'U_DELETE' => append_sid("admin_referers.{$phpEx}?mode=delete&amp;id=" . $refererrow[$i]['referer_id'])));
     } else {
         $template->assign_block_vars('refererrow', array('COLOR' => $row_color, 'U_REFERER' => $refererrow[$i]['referer_host'] ? "http://" . $refererrow[$i]['referer_host'] : '', 'REFERER' => $refererrow[$i]['referer_host'] ? $refererrow[$i]['referer_host'] : '(empty)', 'HITS' => $refererrow[$i]['referer_hits'], 'FIRSTVISIT' => $firstvisit, 'LASTVISIT' => $lastvisit, 'U_DELETE' => append_sid("admin_referers.{$phpEx}?mode=delete&amp;host=" . $refererrow[$i]['referer_host'])));
     }
 }
 // end for
 $template->assign_vars(array('PAGINATION' => generate_pagination(append_sid("admin_referers.{$phpEx}?sort={$sort_method}&amp;order={$sort_order}" . (isset($mode) ? "&amp;mode={$mode}" : "") . ($rdns_ip_num == "" ? "" : "&amp;rdns={$rdns_ip_num}")), $total_referers, $referers_per_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $referers_per_page) + 1, ceil($total_referers / $referers_per_page))));
Exemple #25
0
                     break;
                 case PAGE_FAQ:
                     $location = $lang['Viewing_FAQ'];
                     $location_url = "index.{$phpEx}?pane=right";
                     break;
                 default:
                     $location = $lang['Forum_index'];
                     $location_url = "index.{$phpEx}?pane=right";
             }
         } else {
             $location_url = append_sid("admin_forums.{$phpEx}?mode=editforum&amp;" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']);
             $location = $forum_data[$onlinerow_guest[$i]['session_page']];
         }
         $row_color = $guest_users % 2 ? $theme['td_color1'] : $theme['td_color2'];
         $row_class = $guest_users % 2 ? $theme['td_class1'] : $theme['td_class2'];
         $guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']);
         $template->assign_block_vars("guest_user_row", array("ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "USERNAME" => $lang['Guest'], "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']), "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']), "FORUM_LOCATION" => $location, "IP_ADDRESS" => $guest_ip, "U_WHOIS_IP" => "http://network-tools.com/default.asp?host={$guest_ip}", "U_FORUM_LOCATION" => append_sid($location_url)));
     }
 } else {
     $template->assign_vars(array("L_NO_GUESTS_BROWSING" => $lang['No_users_browsing']));
 }
 // Check for new version
 $current_version = explode('.', '2' . $board_config['version']);
 $minor_revision = (int) $current_version[2];
 $errno = 0;
 $errstr = $version_info = '';
 if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr, 10)) {
     @fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1\r\n");
     @fputs($fsock, "HOST: www.phpbb.com\r\n");
     @fputs($fsock, "Connection: close\r\n\r\n");
     $get_info = false;
Exemple #26
0
    $event = mysqli_real_escape_string($db, $_POST['eventname']);
    // intialize to be blank, not used
    $email = NULL;
    $confirmed = 1;
    $auth = '';
    $insert_post = mysqli_query($db, "INSERT INTO photo_comments (photoid, event, sender, email, post_time, message, ipaddress, confirmed, auth) VALUES('{$photoid}', '{$event}', '{$sender}', '{$email}', '" . time() . "', '{$message}', '{$user_ip}', '{$confirmed}', '{$auth}')");
    if (!$insert_post) {
        die(json_encode(array('error' => mysqli_error($db))));
    } else {
        $special = $userPosition == 'Webmaster' ? $client_ip : '';
        die(json_encode(array('newComment' => array('sender' => smilify(html_entity_decode($_POST['sender']), $_POST['sender']), 'message' => URL2link(smilify(nl2br(html_entity_decode($_POST['message'])), $_POST['sender'])), 'htmlDatetime' => date('c', time()), 'readableTime' => date('D, d M Y H:i:s', time()), 'niceTime' => nicetime(time()), 'special' => $special))));
    }
} else {
    if ($_POST['action'] == 'getComments') {
        $photoid = mysqli_real_escape_string($db, $_POST['photoid']);
        $event = mysqli_real_escape_string($db, $_POST['eventname']);
        $photo_comments = mysqli_query($db, "SELECT * FROM photo_comments WHERE photoid='{$photoid}' AND event='{$event}' ");
        if (mysqli_num_rows($photo_comments) == 0) {
            die(json_encode(array('empty' => 'no comments')));
        } else {
            $comments = array();
            while ($comment = mysqli_fetch_array($photo_comments, MYSQL_ASSOC)) {
                $datetime = date('G:i j/M/y', $comment['post_time']);
                $nicetime = nicetime($comment['post_time']);
                $special = $userPosition == 'Webmaster' ? decode_ip($comment['ipaddress']) : '';
                $comments[] = array('sender' => smilify(html_entity_decode($comment['sender']), $comment['sender']), 'message' => URL2link(smilify(nl2br(html_entity_decode($comment['message'])), $comment['sender'])), 'htmlDatetime' => date('c', $comment['post_time']), 'readableTime' => date('D, d M Y H:i:s', $comment['post_time']), 'niceTime' => nicetime($comment['post_time']), 'special' => $special);
            }
            die(json_encode(array('comments' => $comments)));
        }
    }
}
/**
* Reverse the encoding of wild-carded bans
*/
function decode_ban_ip($int_ip)
{
    return str_replace('255', '*', decode_ip($int_ip));
}
Exemple #28
0
}
// Retrieve peers
$peers = $compact_mode ? '' : array();
$sel_peer_id = $compact_mode || $no_peer_id_mode ? '' : ', peer_id ';
$sql = "SELECT ip, port {$sel_peer_id}\r\n\tFROM " . BT_TRACKER_TABLE . "\r\n\tWHERE torrent_id = {$torrent_id}\r\n\t\tAND expire_time > {$current_time}\r\n\tORDER BY RAND()\r\n\tLIMIT {$numwant}";
if (!($result = $db->sql_query($sql))) {
    error_exit('DB error', __FILE__, __LINE__, 'db');
}
if ($rowset = @$db->sql_fetchrowset($result)) {
    if ($compact_mode) {
        foreach ($rowset as $i => $peer) {
            $peers .= pack('Nn', ip2long(decode_ip($peer['ip'])), $peer['port']);
        }
    } else {
        if ($no_peer_id_mode) {
            foreach ($rowset as $i => $peer) {
                $peers[] = array('ip' => decode_ip($peer['ip']), 'port' => intval($peer['port']));
            }
        } else {
            foreach ($rowset as $i => $peer) {
                $peers[] = array('ip' => decode_ip($peer['ip']), 'port' => intval($peer['port']), 'peer id' => $peer['peer_id']);
            }
        }
    }
}
// Return data to client
$output['interval'] = intval($announce_interval);
//$output['private']  = intval(1);
$output['peers'] = $peers;
echo bencode($output);
send_data_to_client();
Exemple #29
0
 public function alter_field($mode, $table, $field, $type = '', $null = TRUE, $default = NULL)
 {
     $this->create_patterns();
     switch ($mode) {
         case 'add':
             if ($ret = $this->alter_table("{$table} ADD {$field} {$type}")) {
                 if (isset($default)) {
                     $query = "ALTER TABLE {$table} ALTER COLUMN {$field} SET DEFAULT '{$default}'";
                     $query = preg_replace($this->query_pattern, $this->query_replace, $query);
                     if ($ret = $this->_owner->query($query)) {
                         $query = "UPDATE {$table} SET {$field} = '{$default}'";
                         $ret = $this->_owner->query($query);
                     }
                 }
                 if ($ret && !$null) {
                     $query = "ALTER TABLE {$table} ALTER COLUMN {$field} SET NOT NULL";
                     $query = preg_replace($this->query_pattern, $this->query_replace, $query);
                     $ret = $this->_owner->query($query);
                 }
             }
             return $ret;
         case 'drop':
             $query = "ALTER TABLE {$table} DROP {$field}";
             $query = preg_replace($this->query_pattern, $this->query_replace, $query);
             return $this->_owner->query($query);
         case 'change':
             if (!is_array($field)) {
                 $field = array($field, $field);
             }
             if ($field[0] == $field[1]) {
                 $ret = true;
             } else {
                 $query = "ALTER TABLE {$table} RENAME COLUMN {$field['0']} TO {$field['1']}";
                 $query = preg_replace($this->query_pattern, $this->query_replace, $query);
                 $ret = $this->_owner->query($query);
             }
             if (false !== stripos($type, 'BYTEA')) {
                 $ret = $result = $this->_owner->query("SELECT {$field['1']} FROM {$table} GROUP BY {$field['1']}");
                 if ($ret && $this->_owner->num_rows($result) > 0) {
                     $ret = $this->_owner->query("ALTER TABLE {$table} ADD COLUMN df_varbin_tmp BYTEA NULL DEFAULT NULL");
                     if ($ret) {
                         $t_indexes = $this->list_indexes($table);
                         if (!isset($t_indexes[$field[1]])) {
                             $ret = $this->_owner->alter_index('index', $table, $field[1], $field[1]);
                         }
                         $t_indexes = null;
                     }
                     if ($ret) {
                         if (!function_exists('inet_pton')) {
                             require CORE_PATH . 'functions/inet.php';
                         }
                         while ($row = $this->_owner->fetch_array($result, SQL_NUM)) {
                             $ip = inet_pton(decode_ip($row[0]));
                             $ip = empty($ip) ? 'DEFAULT' : $this->_owner->binary_safe($ip);
                             $ret = $this->_owner->query("UPDATE {$table} SET df_varbin_tmp={$ip} WHERE {$field['1']}='" . $this->_owner->escape_string($row[0]) . "'");
                             if (!$ret) {
                                 break;
                             }
                         }
                         if ($ret) {
                             $ret = $this->_owner->query("ALTER TABLE {$table} DROP {$field['1']}");
                         }
                         if ($ret) {
                             $ret = $this->_owner->query("ALTER TABLE {$table} RENAME COLUMN df_varbin_tmp TO {$field['1']}");
                         }
                     }
                     $this->_owner->free_result($result);
                     return $ret;
                 }
                 // rows == 0 then simply alter the column
             }
             if ($ret && $type != '') {
                 $query = "ALTER TABLE {$table} ALTER COLUMN {$field['1']} TYPE {$type}";
                 $query = preg_replace($this->query_pattern, $this->query_replace, $query);
                 $ret = $this->_owner->query($query);
             }
             if ($ret && isset($default)) {
                 $query = "ALTER TABLE {$table} ALTER COLUMN {$field} SET DEFAULT '{$default}'";
                 $query = preg_replace($this->query_pattern, $this->query_replace, $query);
                 $ret = $this->_owner->query($query);
             }
             return $ret;
     }
 }
Exemple #30
0
 /**
  * Get IP address this user has posted/logged in from
  * @since Version 3.9
  * @return array
  *
  * @param \DateTime $time Find IP addresses since the provided DateTime object
  */
 public function getIPs($time = false)
 {
     $ips = array();
     /**
      * Get posts
      */
     $query = "SELECT DISTINCT poster_ip FROM nuke_bbposts WHERE poster_id = ?";
     if ($time instanceof DateTime) {
         $query .= " AND post_time >= " . $time->getTimestamp();
     }
     foreach ($this->db->fetchAll($query, $this->id) as $row) {
         $ips[] = decode_ip($row['poster_ip']);
     }
     /**
      * Get logins
      */
     $query = "SELECT DISTINCT login_ip FROM log_logins WHERE user_id = ? AND login_ip NOT IN ('" . implode("','", $ips) . "')";
     if ($time instanceof DateTime) {
         $query .= " AND login_time >= " . $time->getTimestamp();
     }
     foreach ($this->db->fetchAll($query, $this->id) as $row) {
         $ips[] = $row['login_ip'];
     }
     natsort($ips);
     $ips = array_values($ips);
     return $ips;
 }