コード例 #1
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $dir;
    global $_page;
    global $p_arr;
    global $p_arr_new;
    global $db_vsbl;
    global $db_editbl;
    global $tab;
    global $autoApproval_ifProfile;
    global $ID;
    global $MEMBER;
    global $ADMIN;
    global $NEW_TO_ADD;
    global $Featured;
    global $pic;
    global $pics;
    global $pic_num;
    global $enable_audio_upload;
    global $enable_video_upload;
    global $sound_file_exist;
    global $video_file_exist;
    global $status_admin_ex;
    global $change_error_text;
    global $result_text;
    global $pictures_text;
    global $membership_message;
    global $max_thumb_height;
    global $max_thumb_width;
    global $enable_ray;
    global $enable_ray_pro;
    ob_start();
    if ($NEW_TO_ADD) {
        $_page['header'] = _t("_New Member");
        $_page['header_text'] = _t("_New Member Add Here");
    } else {
        $_page['header'] = process_line_output($p_arr['NickName']) . ": " . process_line_output(strmaxtextlen($p_arr['DescriptionMe'], 45));
        $_page['header_text'] = "<b>" . process_line_output($p_arr['NickName']) . "</b> - ";
        $_page['header_text'] .= _t('_' . $p_arr['Sex']);
        $_page['header_text'] .= ", " . _t("_y/o", age($p_arr['DateOfBirth'])) . " (ID: {$p_arr['ID']})";
    }
    echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
    if ($ADMIN && $status_admin_ex) {
        echo $status_admin_ex;
    }
    if ($change_error_text) {
        echo $change_error_text . '<br />';
    }
    global $moderator;
    if ($ADMIN && !$moderator) {
        echo "<div align=right class=text2><a href=\"{$_SERVER['PHP_SELF']}\">" . _t("_Add New Profile") . "</a></div>";
    }
    if ($result_text) {
        echo '<center>' . $result_text . '</center><br />';
    }
    if ($ADMIN && !$NEW_TO_ADD && $enable_video_upload && $enable_ray && $enable_ray_pro && file_exists($dir['root'] . "ray/modules/video/admin.php")) {
        $sRayHeaderPath = $dir['root'] . "ray/inc/header.inc.php";
        $iId = (int) $p_arr['ID'];
        $aAdmin = db_arr("SELECT `Name`, `Password` FROM `Admins` LIMIT 1");
        $sNick = $aAdmin['Name'];
        $sPassword = $aAdmin['Password'];
        echo "<tr><td><div style=\"width:179px; padding-bottom:10px; margin-left:auto; margin-right:auto;\">";
        require_once $dir['root'] . "ray/modules/video/admin.php";
        echo "</div></td></tr>";
    }
    if ($ADMIN && !$NEW_TO_ADD) {
        // Print membership information and controls
        $memberships_arr = getMemberships();
        $membership_info = getMemberMembershipInfo($ID);
        ?>
    <!-- MEMBERSHIP [BEGIN] -->

	<tr><td>
		<center><?php 
        echo $membership_message;
        ?>
</center>
		<form name="MembershipForm" action="profile_edit.php?ID=<?php 
        echo $p_arr['ID'];
        ?>
" method=post>
		<input type="hidden" name="SetMembership" value="YES">
		<table width=100% cellspacing=0 cellpadding=2 class="text2" border=0>
<?php 
        echo print_rows_set_membership(1, $memberships_arr, $membership_info, 3, "table", "panel", "25%");
        ?>
		</table>
		<center>
			<input class=no type="submit" value="Set" style="width: 50px;">
		</center>
		</form>
    <hr>
    </td></tr>

    <!-- MEMBERSHIP [ END ] -->
<?php 
    }
    ?>
	
    <form name="jform" method="post" action="profile_edit.php?ID=<?php 
    echo $p_arr['ID'];
    ?>
">
<?php 
    if ($NEW_TO_ADD) {
        ?>
		<input type="hidden" name="NewProfile" value="YES" />
	<?php 
    }
    ?>
<input type="hidden" name="SaveChanges" value="YES" />
<?php 
    if ($ADMIN) {
        ?>
	<table cellspacing="0" cellpadding="0" class="small2" align="center">
		<tr>
			<td align="right" width="75%"><?php 
        echo _t("_Mark as Featured");
        ?>
</td>
			<td align="left" width="25%">
				<input type="checkbox" name="Featured"
				  <?php 
        if ($Featured) {
            echo 'checked="checked"';
        }
        ?>
 >
			</td>
		</tr>
	</table>
	<?php 
    }
    ?>
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    	<tr>
    <td valign="top">

    <table border="0" cellspacing="1" cellpadding="0" width="100%">
    <tr><td align="center" valign="middle">
<?php 
    if ($NEW_TO_ADD) {
        echo _t("_New Member") . '<br /><br />';
    } else {
        ?>
        <table border="0" cellspacing="0" cellpadding="0" width="250">
			<tr>
				<td align="center" valign="middle" style="position:relative; display:block;width:112px;">
					<?php 
        echo get_member_thumbnail($p_arr['ID'], 'none');
        ?>
    	</td>
		<td>
	<?php 
        $yes_ph = 0;
        require_once BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php';
        $oPhoto = new ProfilePhotos($p_arr['ID']);
        $oPhoto->getMediaArray();
        $yes_ph = $oPhoto->iMediaCount;
        if ($yes_ph) {
            ?>
			<a href="<?php 
            echo $site['url'];
            ?>
photos_gallery.php?ID=<?php 
            echo $p_arr['ID'];
            ?>
" ><?php 
            echo _t("_More Photos");
            ?>
</a><br />
		<?php 
        }
        if (!$MEMBER) {
            echo "<div class=small2>" . _t("_Last logged in") . ": ";
            if (!$p_arr['LastLoggedIn'] || $p_arr['LastLoggedIn'] == "0000-00-00 00:00:00") {
                echo _t("_never");
            } else {
                echo $p_arr['LastLoggedIn'];
            }
            echo "</div>";
        } else {
            echo _t("_Profile status");
            ?>
:
		<b><font class=prof_stat_<?php 
            echo $p_arr['Status'];
            ?>
> <?php 
            echo _t("_" . $p_arr['Status']);
            ?>
 </font></b><br />
	<?php 
            if ($MEMBER) {
                switch ($p_arr['Status']) {
                    case 'Active':
                        echo '<a href="change_status.php">' . _t("_Suspend account") . '</a><br />';
                        break;
                    case 'Suspended':
                        echo '<a href="change_status.php">' . _t("_Activate account") . '</a><br />';
                        break;
                }
            }
        }
        ?>
    	</td></tr>
        </table>
	<?php 
    }
    ?>
    </td>
    <td valign="top" align="center" width="100%">

<?php 
    $free_mode = getParam("free_mode") == "on" ? 1 : 0;
    ?>
    </td>

</table>

</td></tr>
<tr><td>

<table class="profile_edit_table"><!-- Profile edit page -->
<?php 
    $first_row = 1;
    $rd = !($ADMIN || $MEMBER);
    $columns = 2;
    $respd = db_res("SELECT *, (`editable` & {$db_editbl}) AS `is_editable` FROM `ProfilesDesc` WHERE `visible` & {$db_vsbl} AND ( FIND_IN_SET('0', `show_on_page`) OR FIND_IN_SET('" . (int) $_page['name_index'] . "', show_on_page)) ORDER BY `order` ASC");
    while ($arrpd = mysql_fetch_array($respd)) {
        $fname = get_input_name($arrpd);
        if ($arrpd['get_value'] && $arrpd['to_db'] == 0) {
            $funcbody = $arrpd['get_value'];
            $func = create_function('$arg0', $funcbody);
            $p_arr[$fname] = $func($p_arr_new);
        }
        if ($arrpd['is_editable'] && isset($p_arr_new[$fname])) {
            $p_arr[$fname] = $p_arr_new[$fname];
        }
        $not_first_row = 0;
        $read_only = !$arrpd['is_editable'];
        switch ($arrpd['type']) {
            case 'set':
                // set of checkboxes
                echo print_row_set($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'rb':
                // radio buttons
                echo print_row_radio_button($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'r':
                // reference to array for combo box
                if ($fname == 'Country') {
                    $onchange = "flagImage = document.getElementById('flagImageId'); flagImage.src = '{$site['flags']}' + this.value.toLowerCase() + '.gif';";
                    if (strlen($p_arr[$fname]) == 0) {
                        $p_arr[$fname] = getParam('default_country');
                    }
                    $imagecode = '<img id="flagImageId" src="' . ($site['flags'] . strtolower($p_arr[$fname])) . '.gif" alt="flag" />';
                } else {
                    $onchange = '';
                    $imagecode = '';
                }
                echo print_row_ref($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only, $onchange, $imagecode);
                break;
            case '0':
                // divider
                echo print_row_delim($first_row, $arrpd, "panel", $columns);
                $not_first_row = 1;
                $first_row = 1;
                break;
            case 'e':
                // enum combo box. if field name is 'Sex', than this is simple text, user can not change it
                echo print_row_enum($first_row, $arrpd, $p_arr[$fname], "table", $javascript, $rd, $columns, "", $read_only);
                break;
            case 'en':
                // enum combo box with numbers
                echo print_row_enum_n($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'eny':
                // enum combo box with years
                echo print_row_enum_years($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'a':
                // text Area
                echo print_row_area($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'c':
                // input box
                echo print_row_edit($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'date':
                // date
                echo print_row_date($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only);
                break;
            case 'p':
                // input box password
                echo print_row_pwd($first_row, $arrpd, '', "table", $rd, $columns, "", $read_only);
                break;
            default:
                $not_first_row = 1;
        }
        if (!$not_first_row && $first_row == 1) {
            $first_row = 0;
        }
    }
    ?>
</table>
</td></tr>
</table>

<br />
<?php 
    if (!!($ADMIN || $MEMBER)) {
        ?>
<center><input type="submit" value="<?php 
        echo _t("_Save Changes");
        ?>
" /></center>
</form>
<br />
<?php 
        if ($MEMBER && !$NEW_TO_ADD) {
            if (!$autoApproval_ifProfile) {
                attention(_t("_PROFILE_WARNING1", $site['title']));
            }
            attention(_t("_PROFILE_WARNING2", $site['title']));
        }
    }
    echo "</td></tr></table>";
    $ret = ob_get_clean();
    return $ret;
}
コード例 #2
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $dir;
    global $tmpl;
    global $page;
    global $join_page_check_limit;
    global $join_pages_num;
    global $p_arr;
    global $_page;
    global $en_aff;
    global $oTemplConfig;
    global $newusernotify;
    $enable_security_image = getParam('enable_security_image');
    $autoApproval_ifJoin = isAutoApproval('join');
    ob_start();
    switch ($page) {
        // fill inputs with values from precede join pages
        case $page > 1:
            $hidden_vals = '';
            // inputs with POST values
            $respd = db_res("SELECT * FROM ProfilesDesc WHERE `visible` & 2 AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page['name_index'] . "',show_on_page)) {$join_page_check_limit} ORDER BY `order` ASC");
            while ($arrpd = mysql_fetch_array($respd)) {
                $fname = get_input_name($arrpd);
                switch ($arrpd['type']) {
                    case 'set':
                        // set of checkboxes
                        $vals = preg_split("/[,\\']+/", $arrpd['extra'], -1, PREG_SPLIT_NO_EMPTY);
                        $p_arr[$fname] = '';
                        foreach ($vals as $v) {
                            if (strlen(trim($v)) <= 0) {
                                continue;
                            }
                            $hidden_vals .= '<input type="hidden" name="' . ($fname . "_" . $v) . '" value="' . process_pass_data($_POST[$fname . "_" . $v]) . '">';
                            $p_arr[$fname . "_" . $v] = process_pass_data($_POST[$fname . "_" . $v]);
                            if ($_POST[$fname . "_" . $v] == 'on') {
                                if (strlen($p_arr[$fname])) {
                                    $p_arr[$fname] .= ",{$v}";
                                } else {
                                    $p_arr[$fname] .= $v;
                                }
                            }
                        }
                        break;
                    case 'date':
                        $p_arr[$fname] = sprintf("%04d-%02d-%02d", (int) $_POST[$fname . '_year'], (int) $_POST[$fname . '_month'], (int) $_POST[$fname . '_day']);
                        $hidden_vals .= '<input type="hidden" name="' . $fname . '_year"  value="' . (int) $_POST[$fname . '_year'] . '" />';
                        $hidden_vals .= '<input type="hidden" name="' . $fname . '_month" value="' . (int) $_POST[$fname . '_month'] . '" />';
                        $hidden_vals .= '<input type="hidden" name="' . $fname . '_day"   value="' . (int) $_POST[$fname . '_day'] . '">';
                        break;
                    default:
                        if ($arrpd['get_value']) {
                            $funcbody = $arrpd['get_value'];
                            $func = create_function('$arg0', $funcbody);
                            $hidden_vals .= '<input type="hidden" name="' . $fname . '" value="' . process_pass_data($_POST[$fname]) . '">';
                            $p_arr[$fname] = process_pass_data($func($_POST));
                        } else {
                            $hidden_vals .= '<input type="hidden" name="' . $fname . '" value="' . process_pass_data($_POST[$fname]) . '">';
                            $p_arr[$fname] = process_pass_data($_POST[$fname]);
                        }
                        break;
                }
            }
            // check values
            $query = "SELECT * FROM ProfilesDesc\n\t\t\t\tWHERE `visible` & 2 AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page['name_index'] . "',show_on_page)) {$join_page_check_limit}\n\t\t\t\tORDER BY `join_page` ASC";
            $respd = db_res($query);
            while ($arrpd = mysql_fetch_array($respd)) {
                if (!strlen($arrpd['check'])) {
                    continue;
                }
                $fname = get_input_name($arrpd);
                $funcbody = $arrpd[check];
                $func = create_function('$arg0', $funcbody);
                if (!$func($p_arr[$fname])) {
                    $add_on .= report_err(_t($arrpd['because'], $arrpd['min_length'], $arrpd['max_length']));
                }
            }
            $page = !$add_on ? $page : $page - 1;
            break;
            break;
        case 'done':
            // fill array with POST values
            $respd = db_res("SELECT * FROM ProfilesDesc WHERE `visible` & 2 AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page['name_index'] . "',show_on_page)) {$join_page_check_limit} ORDER BY `order` ASC");
            while ($arrpd = mysql_fetch_array($respd)) {
                $fname = get_input_name($arrpd);
                switch ($arrpd['type']) {
                    case 'set':
                        // set of checkboxes
                        $vals = preg_split("/[,\\']+/", $arrpd['extra'], -1, PREG_SPLIT_NO_EMPTY);
                        $p_arr[$fname] = '';
                        foreach ($vals as $v) {
                            if (strlen(trim($v)) <= 0) {
                                continue;
                            }
                            $hidden_vals .= '<input type="hidden" name="' . ($fname . "_" . $v) . '" value="' . process_pass_data($_POST[$fname . "_" . $v]) . '">';
                            $p_arr[$fname . "_" . $v] = process_pass_data($_POST[$fname . "_" . $v]);
                            if ($_POST[$fname . "_" . $v] == 'on') {
                                if (strlen($p_arr[$fname])) {
                                    $p_arr[$fname] .= ",{$v}";
                                } else {
                                    $p_arr[$fname] .= $v;
                                }
                            }
                        }
                        break;
                    case 'date':
                        $p_arr[$fname] = sprintf("%04d-%02d-%02d", (int) $_POST[$fname . '_year'], (int) $_POST[$fname . '_month'], (int) $_POST[$fname . '_day']);
                        $hidden_vals .= '<input type="hidden" name="' . $fname . '_year"  value="' . (int) $_POST[$fname . '_year'] . '" />';
                        $hidden_vals .= '<input type="hidden" name="' . $fname . '_month" value="' . (int) $_POST[$fname . '_month'] . '" />';
                        $hidden_vals .= '<input type="hidden" name="' . $fname . '_day"   value="' . (int) $_POST[$fname . '_day'] . '">';
                        break;
                    default:
                        if ($arrpd['get_value']) {
                            $funcbody = $arrpd['get_value'];
                            $func = create_function('$arg0', $funcbody);
                            $hidden_vals .= '<input type="hidden" name="' . $fname . '" value="' . process_pass_data($_POST[$fname]) . '">';
                            $p_arr[$fname] = process_pass_data($func($_POST));
                        } else {
                            $hidden_vals .= '<input type="hidden" name="' . $fname . '" value="' . process_pass_data($_POST[$fname]) . '">';
                            $p_arr[$fname] = process_pass_data($_POST[$fname]);
                        }
                        break;
                }
            }
            // check values
            if ($enable_security_image) {
                if (!isset($_POST['securityImageValue']) || !isset($_COOKIE['strSec']) || md5($_POST['securityImageValue']) != $_COOKIE['strSec']) {
                    $page = $join_pages_num;
                    $add_on .= report_err(_t("_SIMG_ERR"));
                }
            }
            $respd = db_res("SELECT * FROM ProfilesDesc WHERE `visible` & 2 AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page['name_index'] . "',show_on_page)) {$join_page_check_limit} AND `join_page` > 0 ORDER BY `order` ASC");
            while ($arrpd = mysql_fetch_array($respd)) {
                if (!strlen(trim($arrpd['check']))) {
                    continue;
                }
                $fname = get_input_name($arrpd);
                $funcbody = $arrpd['check'];
                $func = create_function('$arg0', $funcbody);
                if (!$func($p_arr[$fname])) {
                    $page = floor($arrpd['join_page'] / 1000);
                    $add_on .= report_err(_t($arrpd['because'], $arrpd['min_length'], $arrpd['max_length']));
                }
            }
            break;
        default:
            break;
    }
    switch ($page) {
        default:
            global $tmpl;
            if ($oTemplConfig->customize['join_page']['showPageText']) {
                $page_text = _t("_JOIN1", $page);
            }
            echo $add_on;
            break;
    }
    switch ($page) {
        case 'done':
            // new profile creation
            $cl_values = "INSERT INTO `Profiles` SET ";
            $cl_first = 0;
            $respd = db_res("SELECT * FROM ProfilesDesc WHERE `visible` & 2 AND `to_db` = 1 AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page['name_index'] . "',show_on_page)) {$join_page_check_limit} ORDER BY `order` ASC");
            while ($arrpd = mysql_fetch_array($respd)) {
                $fname = get_input_name($arrpd);
                $dbname = get_field_name($arrpd);
                $fval = $p_arr[$fname];
                if ($dbname == 'zip') {
                    $fval = strtoupper(str_replace(' ', '', $fval));
                }
                switch ($arrpd['type']) {
                    case 'set':
                        // set of checkboxes
                    // set of checkboxes
                    case 'r':
                        // reference to array for combo box
                    // reference to array for combo box
                    case 'a':
                        // text Area
                    // text Area
                    case 'c':
                        // input box
                    // input box
                    case 'rb':
                        // radio buttons
                    // radio buttons
                    case 'e':
                        // enum combo box
                    // enum combo box
                    case 'en':
                        // enum combo box with numbers
                    // enum combo box with numbers
                    case 'eny':
                        // enum combo box with numbers
                    // enum combo box with numbers
                    case 'date':
                        // date
                        $fval = process_db_input($fval, 0, 1);
                        $cl_values .= " `{$dbname}` = '{$fval}'";
                        $cl_values .= ", ";
                        break;
                    case 'p':
                        $fval = md5(process_pass_data($fval));
                        $cl_values .= " `{$dbname}` = '{$fval}'";
                        $cl_values .= ", ";
                        break;
                }
            }
            $cl_values .= " `LastReg` = NOW()";
            db_res($cl_values);
            $IDnormal = mysql_insert_id();
            $IDcrypt = crypt($IDnormal, "secret_string");
            // encrypted ID for security purposes
            setcookie("IDc", $IDcrypt, 0, "/");
            $_COOKIE['IDc'] = $IDcrypt;
            // Affiliate and friend checking
            if ($en_aff && $_COOKIE['idAff']) {
                $res = db_res("SELECT `ID` FROM `aff` WHERE `ID` = {$_COOKIE['idAff']} AND `Status` = 'active'");
                if (mysql_num_rows($res)) {
                    $res = db_res("INSERT INTO `aff_members` (`idAff`,`idProfile`) VALUES ({$_COOKIE['idAff']}, {$IDnormal})");
                }
            }
            if ($en_aff && $_COOKIE['idFriend']) {
                $idFriend = getID($_COOKIE['idFriend']);
                if ($idFriend) {
                    $res = db_res("UPDATE `Profiles` SET `aff_num` = `aff_num` + 1 WHERE `ID` = '{$idFriend}'");
                    createUserDataFile($idFriend);
                }
            }
            if (strcmp(crypt($IDnormal, 'secret_string'), $_COOKIE['IDc']) != 0) {
                ob_end_clean();
                $_page['header'] = _t("_Error");
                $ret = "<table width=\"100%\" cellpadding=4 cellspacing=4><tr><td align=center class=text2>";
                $ret .= _t("_MUST_HAVE_COOKIES");
                $ret .= "</td></tr></table>";
                return $ret;
            }
            if (getParam('autoApproval_ifNoConfEmail') == 'on') {
                if (getParam('autoApproval_ifJoin')) {
                    db_res("UPDATE `Profiles` SET `Status`='Active' WHERE `ID`='{$IDnormal}'");
                    $page_text = _t("_USER_ACTIVATION_SUCCEEDED") . $ret . $add_on;
                    $message = getParam("t_Activation");
                    $subject = getParam('t_Activation_subject');
                    sendMail($p_arr['Email'], $subject, $message, $IDnormal);
                } else {
                    db_res("UPDATE `Profiles` SET `Status`='Approval' WHERE `ID`='{$IDnormal}'");
                    $page_text = _t("_USER_CONF_SUCCEEDED") . $add_on;
                }
                if ($newusernotify) {
                    $message = "New user {$p_arr['NickName']} with email {$p_arr['Email']} has been confirmed,\nhis/her ID is {$IDnormal}.\n--\n{$site['title']} mail delivery system\n<Auto-generated e-mail, please, do not reply>\n";
                    $subject = "New user confirmed";
                    sendMail($site['email_notify'], $subject, $message);
                }
            } else {
                $page_text = _t("_JOIN3") . $add_on;
                $page_text .= activation_mail($IDnormal);
                $page_text .= "<br /><br /><br /><br /><center>" . _t("_UPLOAD_WHILE_WAITING", $site['url']) . "</center>";
            }
            modules_add($IDnormal);
            if (!$autoApproval_ifJoin) {
                modules_block($IDnormal);
            }
            createUserDataFile($IDnormal);
            // ----------------------------------------------------------
            echo "<div id=\"first_column\">";
            echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=center class=text2>";
            echo "<div align=justify>{$page_text}</div>";
            break;
        default:
            echo "<div id=\"first_column\">";
            echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=center class=text2>";
            //-----------------------------------------------------------
            do {
                $join_page_limit = 'done' == $page ? " AND join_page > '" . $join_pages_num * 1000 . "'" : " AND join_page > '" . $page * 1000 . "' AND join_page < '" . ($page + 1) * 1000 . "'";
                $query = "SELECT COUNT(*) FROM `ProfilesDesc` WHERE `visible` & 2 {$join_page_limit} AND (FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('3',show_on_page))";
                $res = db_res($query);
                $item_num = mysql_fetch_row($res);
                if ($item_num[0] <= 0 && $page < $join_pages_num) {
                    $page++;
                }
            } while ($item_num[0] <= 0 && $page < $join_pages_num);
            $join_page_limit = 'done' == $page ? " AND join_page > '" . $join_pages_num * 1000 . "'" : " AND join_page > '" . $page * 1000 . "' AND join_page < '" . ($page + 1) * 1000 . "'";
            $hidden_vals .= "<input type=\"hidden\" name=\"page\" value=\"{$page}\" />";
            //-----------------------------------------------------------
            echo "\n\t    <form name=\"jform\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\" " . ($join_pages_num == $page ? "onSubmit=\"return validateJoinForm();\">" : ">") . "\n\n\t    {$hidden_vals}\n\n\t    <input type=hidden name=\"ID\" value=\"{$IDnormal}\" />\n\n\t    <div align=justify>{$page_text}</div>\n<table width=\"100%\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\">";
            $first_row = 1;
            $respd = db_res("SELECT * FROM ProfilesDesc\n\t\t\t    WHERE `visible` & 2 AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page['name_index'] . "',show_on_page)) {$join_page_limit}\n\t\t\t    ORDER BY `join_page` ASC");
            if ($oTemplConfig->customize['join_page']['show_3rd_col']) {
                $columns = 3;
            } else {
                $columns = 2;
            }
            while ($arrpd = mysql_fetch_array($respd)) {
                $fname = get_input_name($arrpd);
                if ($arrpd['get_value'] && $arrpd['to_db'] == 0) {
                    $funcbody = $arrpd['get_value'];
                    $func = create_function('$arg0', $funcbody);
                    $p_arr[$fname] = $func($p_arr);
                }
                $not_first_row = 0;
                switch ($arrpd['type']) {
                    case 'set':
                        // set of checkboxes
                        echo print_row_set($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'rb':
                        // radio buttons
                        echo print_row_radio_button($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'r':
                        // reference to array for combo box
                        if ($fname == 'Country') {
                            $onchange = "flagImage = document.getElementById('flagImageId'); flagImage.src = '{$site['flags']}' + this.value.toLowerCase() + '.gif';";
                            if (strlen($p_arr[$fname]) == 0) {
                                $p_arr[$fname] = getParam('default_country');
                            }
                            $imagecode = '<img id="flagImageId" src="' . ($site['flags'] . strtolower($p_arr[$fname])) . '.gif" alt="flag" />';
                        } else {
                            $onchange = '';
                            $imagecode = '';
                        }
                        echo print_row_ref($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns, '', 0, $onchange, $imagecode);
                        break;
                    case '0':
                        // divider
                        echo print_row_delim($first_row, $arrpd, "panel", $columns);
                        $not_first_row = 1;
                        $first_row = 1;
                        break;
                    case 'e':
                        // enum combo box
                        echo print_row_enum($first_row, $arrpd, $p_arr[$fname], "table", $javascript, 0);
                        break;
                    case 'en':
                        // enum combo box with numbers
                        echo print_row_enum_n($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'eny':
                        // enum combo box with years
                        echo print_row_enum_years($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'date':
                        //date
                        echo print_row_date($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'a':
                        // text Area
                        echo print_row_area($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'c':
                        // input box
                        echo print_row_edit($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    case 'p':
                        // input box password
                        echo print_row_pwd($first_row, $arrpd, $p_arr[$fname], "table", 0, $columns);
                        break;
                    default:
                        $not_first_row = 1;
                        break;
                }
                if (!$not_first_row && $first_row == 1) {
                    $first_row = 0;
                }
            }
            echo "</table>";
            // show on the last page of join form
            if ($join_pages_num == $page) {
                ?>
<script language=javascript>
<!--
    function validateJoinForm()
    {
        if ( document.forms['jform'].elements['i_agree'].checked ) return true;
        alert('<?php 
                echo _t("_CLICK_AGREE");
                ?>
');
        return false;
    }
-->
</script>
<?php 
                echo "<br /><div class=\"security_image_block\"><center>\n";
                if ($enable_security_image) {
                    echo "\n\t\t    <img alt=\"Security Image\" src=\"simg/simg.php\" /><br /><br />" . _t("_Enter what you see:") . "<input name=\"securityImageValue\" type=\"text\" size=\"15\"><br /><br />";
                }
                echo "</center>";
                $ret = <<<ID
\t\t<script type="text/javascript">
\t\t\tfunction id_registration()
\t\t\t{
\t\t\t\toCheckBox = document.getElementById( "boonex_id" );
\t\t\t\tif( oCheckBox.checked )
\t\t\t\t\twindow.open( 'http://www.boonex.com/id/', '', 'width=800, height=600, menubar=yes, status=yes, resizable=yes, scrollbars=yes, toolbar=yes, location=yes')
\t\t\t}
\t\t</script>
ID;
                echo $ret;
                echo "\n\t\t    <div style=\"text-align:center;\"><input type=checkbox name=i_agree id=i_agree /><label for=i_agree>" . _t("_I AGREE", $site['url']) . "</label>&nbsp;&nbsp;</div>\n";
                // BoonEx ID implementation
                //		    <div style=\"text-align:center;\"><input type=checkbox name=\"boonex_id\" id=\"boonex_id\" /><label for=boonex_id>" . _t("_ID_CREATE", "http://www.boonex.com/id/" ) . "</label>&nbsp;&nbsp;</div>";
            }
            echo "<br /><center><input onclick=\"id_registration();\" type=\"submit\" value=\"" . _t("_Join") . "\"  /></center></form></div>";
            break;
    }
    global $memberID;
    echo "</td></tr></table>";
    echo "</div>";
    echo "<div id=\"second_column\">";
    echo "<div class=\"member_login\">";
    $action = "login";
    $text = _t('_Member Login');
    $table = "Profiles";
    $login_page = "{$site['url']}member.php";
    $join_page = "{$site['url']}join_form.php";
    $forgot_page = "{$site['url']}forgot.php";
    $template = "{$dir['root']}templates/tmpl_{$tmpl}/join_login_form.html";
    echo LoginForm($text, $action, $table, $login_page, $forgot_page, $template);
    echo "</div>";
    if (getParam('enable_get_boonex_id')) {
        echo "<div class=\"import_boonex_id\">";
        $action = "boonex";
        $text = '<div class="boonex_id">' . _t('_Import BoonEx ID') . '</div>';
        $table = "Profiles";
        $login_page = "{$site['url']}member.php";
        $join_page = "{$site['url']}join_form.php";
        $forgot_page = '';
        $template = "{$dir['root']}templates/tmpl_{$tmpl}/join_login_form.html";
        echo LoginForm($text, $action, $table, $login_page, $forgot_page, $template);
        echo "</div>";
    }
    echo "</div>";
    $ret = ob_get_clean();
    return $ret;
}
コード例 #3
0
 function showProfileFields($aFields)
 {
     global $p_arr;
     global $site;
     $rd = 1;
     $first_row = 1;
     $aRedundantFields = array();
     $ret = '';
     foreach ($aFields as $arrpd) {
         $fname = get_input_name($arrpd);
         $sRealFName = get_field_name($arrpd);
         if (!in_array($sRealFName, $aRedundantFields)) {
             if ($arrpd['get_value_db']) {
                 $funcbody = $arrpd['get_value_db'];
                 $func = create_function('$arg0', $funcbody);
                 $p_arr[$fname] = $func($p_arr);
             }
             if (!strlen($p_arr[$fname])) {
                 continue;
             }
             //if ( !strlen($p_arr[$fname]) ) $p_arr[$fname] = $p_arr[$fname];
             $not_first_row = 0;
             switch ($arrpd['type']) {
                 case 'set':
                     // set of checkboxes
                     $ret .= print_row_set($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%");
                     break;
                 case 'rb':
                     // radio buttons
                     $ret .= print_row_radio_button($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%");
                     break;
                 case 'r':
                     // reference to array for combo box
                     if ($fname == 'Country') {
                         $imagecode = '<img src="' . ($site['flags'] . strtolower($p_arr[$fname])) . '.gif" alt="flag" />';
                     } else {
                         $imagecode = '';
                     }
                     $ret .= print_row_ref($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%", 0, '', $imagecode);
                     break;
                 case '0':
                     // divider
                     $ret .= print_row_delim($first_row, $arrpd, "panel", 2);
                     $not_first_row = 1;
                     $first_row = 1;
                     break;
                 case 'e':
                     // enum combo box
                     $ret .= print_row_enum($first_row, $arrpd, $p_arr[$fname], "table", '', $rd, 2, "50%");
                     break;
                 case 'en':
                     // enum combo box with numbers
                     $ret .= print_row_enum_n($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%");
                     break;
                 case 'eny':
                     // enum combo box with years
                     $ret .= print_row_enum_years($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%", '', $sRealFName);
                     $aRedundantFields[] = $sRealFName;
                     break;
                 case 'date':
                     $ret .= print_row_date($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%", '', $sRealFName);
                     break;
                 case 'a':
                     // memo
                     $p_arr[$fname] = process_line_output($p_arr[$fname]);
                     if (strlen($p_arr[$fname])) {
                         $ret .= print_row_area($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%");
                     }
                     break;
                 case 'c':
                     // input box
                     $p_arr[$fname] = process_line_output($p_arr[$fname]);
                     if (strlen($p_arr[$fname])) {
                         if ('HomePage' == $fname) {
                             $p_arr[$fname] = '<a href="http://' . $p_arr[$fname] . '">' . $p_arr[$fname] . '</a>';
                         }
                         $ret .= print_row_edit($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%");
                     }
                     break;
                 case 'p':
                     // input box password
                     $p_arr[$fname] = process_line_output($p_arr[$fname]);
                     $ret .= print_row_pwd($first_row, $arrpd, $p_arr[$fname], "table", $rd, 2, "50%");
                     break;
                 default:
                     $not_first_row = 1;
             }
             if (!$not_first_row && $first_row == 1) {
                 $first_row = 0;
             }
         }
     }
     return $ret;
 }