Ejemplo n.º 1
0
function generateUserNewPwd($ID)
{
    $sPwd = genRndPwd();
    $sSalt = genRndSalt();
    $sQuery = "\n        UPDATE `Profiles`\n        SET\n            `Password` = '" . encryptUserPwd($sPwd, $sSalt) . "',\n            `Salt` = '{$sSalt}'\n        WHERE\n            `ID`='{$ID}'\n    ";
    db_res($sQuery);
    createUserDataFile($ID);
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
    $oZ = new BxDolAlerts('profile', 'edit', $ID);
    $oZ->alert();
    return $sPwd;
}
Ejemplo n.º 2
0
/**
 * page code function
 */
function PageCompPageMainCode($iLoggedID)
{
    $member['ID'] = (int) $iLoggedID;
    $p_arr = getProfileInfo($member['ID']);
    if ($_POST['CHANGE_STATUS']) {
        $sStatus = "";
        switch ($_POST['CHANGE_STATUS']) {
            case 'SUSPEND':
                if ($p_arr['Status'] == 'Active') {
                    $sStatus = "Suspended";
                }
                break;
            case 'ACTIVATE':
                if ($p_arr['Status'] == 'Suspended') {
                    $sStatus = "Active";
                }
                break;
        }
        if (mb_strlen($sStatus) > 0) {
            db_res("UPDATE `Profiles` SET `Status` = '{$sStatus}' WHERE `ID` = {$member['ID']}");
        }
        createUserDataFile($p_arr['ID']);
        reparseObjTags('profile', $member['ID']);
        $p_arr = getProfileInfo($member['ID']);
    }
    $aData = array('profile_status_caption' => _t("_Profile status"), 'status' => $p_arr['Status'], 'status_lang_key' => _t('__' . $p_arr['Status']));
    $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'change_status.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('status' => array('type' => 'hidden', 'name' => 'CHANGE_STATUS', 'value' => ''), 'subscribe' => array('type' => 'submit', 'name' => 'subscribe', 'value' => '')));
    switch ($p_arr['Status']) {
        case 'Active':
            $aForm['inputs']['status']['value'] = 'SUSPEND';
            $aForm['inputs']['subscribe']['value'] = _t('_Suspend account');
            $oForm = new BxTemplFormView($aForm);
            $aData['form'] = $oForm->getCode();
            $aData['message'] = _t("_PROFILE_CAN_SUSPEND");
            break;
        case 'Suspended':
            $aForm['inputs']['status']['value'] = 'ACTIVATE';
            $aForm['inputs']['subscribe']['value'] = _t('_Activate account');
            $oForm = new BxTemplFormView($aForm);
            $aData['form'] = $oForm->getCode();
            $aData['message'] = _t("_PROFILE_CAN_ACTIVATE");
            break;
        default:
            $aData['message'] = _t("_PROFILE_CANT_ACTIVATE/SUSPEND");
            $aData['form'] = '';
            break;
    }
    return $GLOBALS['oSysTemplate']->parseHtmlByName('change_status.html', $aData);
}
Ejemplo n.º 3
0
 function _saveCatAdminPassword(&$aData)
 {
     $iId = (int) $_COOKIE['memberID'];
     $aAdmin = $this->_oDb->getRow("SELECT `Password`, `Salt` FROM `Profiles` WHERE `ID`= ?", [$iId]);
     if (encryptUserPwd($aData['pwd_old'], $aAdmin['Salt']) != $aAdmin['Password']) {
         return MsgBox(_t('_adm_txt_settings_wrong_old_pasword'), $this->_iResultTimer);
     }
     $iLength = strlen($aData['pwd_new']);
     if ($iLength < 3) {
         return MsgBox(_t('_adm_txt_settings_wrong_new_pasword'), $this->_iResultTimer);
     }
     if ($aData['pwd_new'] != $aData['pwd_conf']) {
         return MsgBox(_t('_adm_txt_settings_wrong_conf_pasword'), $this->_iResultTimer);
     }
     $this->_oDb->query("UPDATE `Profiles` SET `Password`='" . encryptUserPwd($aData['pwd_new'], $aAdmin['Salt']) . "' WHERE `ID`='{$iId}'");
     createUserDataFile($iId);
     return true;
 }
/**
 * 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;
}
function getProfileInfo($iProfileID, $checkActiveStatus = false, $forceCache = false)
{
    global $aUser;
    global $dir;
    global $date_format;
    $iProfileID = (int) $iProfileID;
    if (!$iProfileID) {
        return false;
    }
    if (!isset($aUser[$iProfileID]) || !is_array($aUser[$iProfileID]) || $forceCache) {
        $sCacheFile = $dir['cache'] . 'user' . $iProfileID . '.php';
        if (!file_exists($sCacheFile) || $forceCache) {
            if (!createUserDataFile($iProfileID)) {
                return false;
            }
        }
        @(include $sCacheFile);
    }
    if ($checkActiveStatus and $aUser[$iProfileID]['Status'] != 'Active') {
        return false;
    }
    return $aUser[$iProfileID];
}
Ejemplo n.º 6
0
 function onEventDeleted($iEntryId, $aDataEntry = array())
 {
     createUserDataFile($this->_iProfileId);
     // arise alert
     $oAlert = new BxDolAlerts('bx_avatar', 'delete', $iEntryId, $this->_iProfileId);
     $oAlert->alert();
 }
 function makePrimPhoto($iPhotoID, $bCouple = false)
 {
     if ($bCouple > 0) {
         $aMember = getProfileInfo($this->iProfileID);
         $sDestID = $aMember['Couple'];
     } else {
         $sDestID = $this->iProfileID;
     }
     if ($sDestID > 0) {
         $this->oMediaQuery->setPrimaryPhoto($sDestID, $iPhotoID);
     }
     createUserDataFile($sDestID);
 }
Ejemplo n.º 8
0
function setLangCookie($sLang)
{
    $iProfileId = getLoggedId();
    if ($iProfileId) {
        $iLangID = db_value("SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = '" . process_db_input($sLang) . "'");
        if (!$iLangID) {
            $iLangID = 0;
        }
        db_res('UPDATE `Profiles` SET `LangID` = ' . (int) $iLangID . ' WHERE `ID` = ' . (int) $_COOKIE['memberID']);
        // recompile profile cache ;
        createUserDataFile($iProfileId);
    }
    setcookie('lang', '', time() - 60 * 60 * 24, '/');
    setcookie('lang', $sLang, time() + 60 * 60 * 24 * 365, '/');
}
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $dir;
    $member['ID'] = (int) $_COOKIE['memberID'];
    ob_start();
    $p_arr = getProfileInfo($member['ID']);
    if ($_POST['CHANGE_STATUS']) {
        switch ($_POST['CHANGE_STATUS']) {
            case 'SUSPEND':
                if ($p_arr['Status'] == 'Active') {
                    db_res("UPDATE `Profiles` SET `Status` = 'Suspended' WHERE `ID` = '{$member['ID']}';");
                    modules_block($p_arr['ID']);
                }
                break;
            case 'ACTIVATE':
                if ($p_arr['Status'] == 'Suspended') {
                    db_res("UPDATE `Profiles` SET `Status` = 'Active' WHERE `ID` = {$member['ID']}");
                    // call modules to add user to modules
                    $check_res = checkAction($member['ID'], ACTION_ID_USE_CHAT);
                    if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                        modules_unblock($p_arr['ID'], 'chat');
                    }
                    $check_res = checkAction($member['ID'], ACTION_ID_USE_FORUM);
                    if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                        modules_unblock($p_arr['ID'], 'forum');
                    }
                }
                break;
        }
        createUserDataFile($p_arr['ID']);
        reparseObjTags('profile', $member['ID']);
        $p_arr = getProfileInfo($member['ID']);
    }
    echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
    echo _t("_Profile status");
    ?>
: <b><font class=prof_stat_<?php 
    echo $p_arr['Status'];
    ?>
>&nbsp;<?php 
    echo _t("__{$p_arr['Status']}");
    ?>
&nbsp;</font></b><br />
<?php 
    switch ($p_arr['Status']) {
        case 'Active':
            echo _t("_PROFILE_CAN_SUSPEND");
            ?>
<br /><br /><form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
" method=post>
<input type=hidden name=CHANGE_STATUS value=SUSPEND>
<center><input class=no type=submit value="<?php 
            echo _t("_Suspend account");
            ?>
"></center>
</form>
<?php 
            break;
        case 'Suspended':
            echo _t("_PROFILE_CAN_ACTIVATE");
            ?>
<br /><br /><form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
" method=post>
<input type=hidden name=CHANGE_STATUS value=ACTIVATE>
<center><input class=no type=submit value="<?php 
            echo _t("_Activate account");
            ?>
"></center>
</form>
<?php 
            break;
        default:
            echo _t("_PROFILE_CANT_ACTIVATE/SUSPEND");
            break;
    }
    echo "</td></table>";
    $ret = ob_get_contents();
    ob_end_clean();
    return $ret;
}
Ejemplo n.º 10
0
 function setDefaultGroup($iGroupId)
 {
     $this->_oDb->setDefaultGroup($this->_iOwnerId, $iGroupId);
     createUserDataFile($this->_iOwnerId);
 }
Ejemplo n.º 11
0
/**
 * Perform change of featured status with clearing profile(s) cache
 * @param  int       $iProfileId - profile id
 * @param  boolean   $bFeature   - mark as featured / unfeatured
 * @return boolean               - TRUE on success / FALSE on failure
 */
function bx_admin_profile_featured_control($iProfileId, $bFeature = TRUE)
{
    $iProfileId = (int) $iProfileId;
    $iFeatured = $bFeature ? 1 : 0;
    if ($GLOBALS['MySQL']->query("UPDATE `Profiles` SET `Featured` = {$iFeatured} WHERE `ID` = {$iProfileId}")) {
        createUserDataFile($iProfileId);
        return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 12
0
function setLangCookie($sLang)
{
    $iProfileId = getLoggedId();
    if ($iProfileId) {
        $iLangID = getLangIdByName($sLang);
        if (!$iLangID) {
            $iLangID = 0;
        }
        db_res('UPDATE `Profiles` SET `LangID` = ' . (int) $iLangID . ' WHERE `ID` = ' . (int) $_COOKIE['memberID']);
        // recompile profile cache ;
        createUserDataFile($iProfileId);
    }
    setcookie('lang', '', time() - 60 * 60 * 24, '/');
    setcookie('lang', $sLang, time() + 60 * 60 * 24 * 365, '/');
}
Ejemplo n.º 13
0
 /**
  * Function update new dolphin's profiles table;
  *
  * @return : (string) - error message or empty;
  */
 function _updateNewProfiles()
 {
     // define the last profile Id from old Db;
     $sQuery = "SELECT `ID` FROM `Profiles` ORDER BY `ID` DESC LIMIT 1";
     $rResult = mysql_query($sQuery, $this->rOldDb);
     $aRow = mysql_fetch_assoc($rResult);
     $iLastProfileId = (int) $aRow['ID'];
     $iLastProfileId++;
     // update current profiles table;
     $sQuery = "SELECT `ID` FROM `Profiles`";
     $aProfiles = $this->oMigrationModule->_oDb->getAll($sQuery);
     if ($aProfiles) {
         foreach ($aProfiles as $iKey => $aItems) {
             $sQuery = "UPDATE `Profiles` SET `ID` = '{$iLastProfileId}' WHERE `ID` = '{$aItems['ID']}'";
             $this->oMigrationModule->_oDb->query($sQuery);
             createUserDataFile($iLastProfileId);
             $iLastProfileId++;
         }
     }
 }
Ejemplo n.º 14
0
/**
 * Change profile status
 *
 * @param $iProfileId integer
 * @param $sStatus text
 * @return text
 */
function ActionChangeStatus($iProfileId, $sStatus = '')
{
    $iProfileId = (int) $iProfileId;
    $sOutputCode = '';
    $oUserStatus = new BxDolUserStatusView();
    if ($oUserStatus->getRegisteredStatus($sStatus)) {
        //process status
        $sStatus = process_db_input($sStatus, BX_TAGS_STRIP, BX_SLASHES_AUTO);
        $sQuery = "UPDATE `Profiles` SET `UserStatus`='{$sStatus}', `DateLastNav` = NOW()\n            WHERE `ID` = '{$iProfileId}'";
        if (db_res($sQuery, 0)) {
            // send system event
            bx_import('BxDolAlerts');
            $oZ = new BxDolAlerts('profile', 'edit_status', $iProfileId, $iProfileId);
            $oZ->alert();
            bx_import('BxTemplMemberMenu');
            $oMemberMenu = new BxTemplMemberMenu();
            $oMemberMenu->deleteMemberMenuKeyFile($iProfileId);
            createUserDataFile($iProfileId);
            $sOutputCode = $oUserStatus->getStatusIcon($iProfileId);
        }
    }
    return $sOutputCode;
}
Ejemplo n.º 15
0
    foreach ($_POST['members'] as $iId) {
        createUserDataFile((int) $iId);
        reparseObjTags('profile', (int) $iId);
        $aProfile = getProfileInfo($iId);
        $aMail = $oEmailTemplate->parseTemplate('t_Activation', array(), $iId);
        sendMail($aProfile['Email'], $aMail['subject'], $aMail['body'], $iId, array(), 'html', false, true);
        $oAlert = new BxDolAlerts('profile', 'change_status', (int) $iId, 0, array('status' => 'Active'));
        $oAlert->alert();
    }
    echo "<script>window.parent." . BX_DOL_ADM_MP_JS_NAME . ".reload();</script>";
    exit;
} else {
    if (isset($_POST['adm-mp-deactivate']) && (bool) $_POST['members']) {
        $GLOBALS['MySQL']->query("UPDATE `Profiles` SET `Status`='Approval' WHERE `ID` IN ('" . implode("','", $_POST['members']) . "')");
        foreach ($_POST['members'] as $iId) {
            createUserDataFile((int) $iId);
            reparseObjTags('profile', (int) $iId);
            $oAlert = new BxDolAlerts('profile', 'change_status', (int) $iId, 0, array('status' => 'Approval'));
            $oAlert->alert();
        }
        echo "<script>window.parent." . BX_DOL_ADM_MP_JS_NAME . ".reload();</script>";
        exit;
    } else {
        if (isset($_POST['adm-mp-ban']) && (bool) $_POST['members']) {
            foreach ($_POST['members'] as $iId) {
                $GLOBALS['MySQL']->query("REPLACE INTO `sys_admin_ban_list` SET `ProfID`='" . $iId . "', `Time`='0',  `DateTime`=NOW()");
            }
            echo "<script>window.parent." . BX_DOL_ADM_MP_JS_NAME . ".reload();</script>";
            exit;
        } else {
            if (isset($_POST['adm-mp-unban']) && (bool) $_POST['members']) {
Ejemplo n.º 16
0
function generateNewPwd($ID)
{
    $sCode = base64_encode(substr(base64_encode(substr(microtime(), 2, 8)), 2, 6));
    $sQuery = "UPDATE `Profiles` SET `Password` = '{$sCode}' WHERE `ID`='{$ID}'";
    db_res($sQuery);
    createUserDataFile($ID);
}
Ejemplo n.º 17
0
function updateOnline($sId = "", $sStatus = "", $bOnline = true)
{
    $sOnlineUpdate = $bOnline ? "NOW()" : "(NOW()-" . getParam("member_online_time") * 120 . ")";
    $sStatusUpdate = empty($sStatus) ? "" : ", `UserStatus`='" . $sStatus . "'";
    getResult("UPDATE `Profiles` SET `DateLastNav`=" . $sOnlineUpdate . $sStatusUpdate . " WHERE `ID`='" . $sId . "'");
    if (!empty($sStatusUpdate)) {
        createUserDataFile($sId);
    }
}
Ejemplo n.º 18
0
 function registerMember()
 {
     $bEnAff = getParam('en_aff') == 'on';
     $oPC = new BxDolProfilesController();
     //convert to profile
     $aProfile = $this->oPF->getProfileFromValues($this->aValues[0]);
     //create it
     list($iMemID, $sStatus) = $oPC->createProfile($aProfile);
     if (!$iMemID) {
         return array(false, 'Fail');
     }
     if ($this->bCouple) {
         //convert
         $aProfile = $this->oPF->getProfileFromValues($this->aValues[1]);
         //create
         list($iMem1ID, $sStatus1) = $oPC->createProfile($aProfile, false, $iMemID);
         if (!$iMem1ID) {
             $oPC->deleteProfile($iMemID);
             return array(false, 'Fail');
         }
     }
     //send new user notification
     if (getParam('newusernotify') == 'on') {
         $oPC->sendNewUserNotify($iMemID);
     }
     // Affiliate and friend checking
     if ($bEnAff && $_COOKIE['idAff']) {
         $vRes = db_res("SELECT `ID` FROM `aff` WHERE `ID` = {$_COOKIE['idAff']} AND `Status` = 'active'");
         if (mysql_num_rows($vRes)) {
             $vRes = db_res("INSERT INTO `aff_members` (`idAff`,`idProfile`) VALUES ('{$_COOKIE['idAff']}', '{$iMemID}')");
         }
     }
     if ($bEnAff && $_COOKIE['idFriend']) {
         $iFriendID = getID($_COOKIE['idFriend']);
         if ($iFriendID) {
             $vRes = db_res("UPDATE `Profiles` SET `aff_num` = `aff_num` + 1 WHERE `ID` = '{$iFriendID}'");
             createUserDataFile($iFriendID);
         }
     }
     reparseObjTags('profile', $iMemID);
     return array($iMemID, $sStatus);
 }
Ejemplo n.º 19
0
function bx_login($iId, $bRememberMe = false, $bAlert = true)
{
    $sPassword = getPassword($iId);
    $aUrl = parse_url($GLOBALS['site']['url']);
    $sPath = isset($aUrl['path']) && !empty($aUrl['path']) ? $aUrl['path'] : '/';
    $sHost = '';
    $iCookieTime = $bRememberMe ? time() + 24 * 60 * 60 * 30 : 0;
    setcookie("memberID", $iId, $iCookieTime, $sPath, $sHost);
    $_COOKIE['memberID'] = $iId;
    setcookie("memberPassword", $sPassword, $iCookieTime, $sPath, $sHost, false, true);
    $_COOKIE['memberPassword'] = $sPassword;
    db_res("UPDATE `Profiles` SET `DateLastLogin`=NOW(), `DateLastNav`=NOW() WHERE `ID`='" . $iId . "'");
    createUserDataFile($iId);
    if ($bAlert) {
        require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
        $oZ = new BxDolAlerts('profile', 'login', $iId);
        $oZ->alert();
    }
    return getProfileInfo($iId);
}
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $ID;
    global $ConfCode;
    global $site;
    global $newusernotify;
    global $dir;
    $autoApproval_ifJoin = isAutoApproval('join');
    $p_arr = getProfileInfo($ID);
    if (!$p_arr) {
        $_page['header'] = _t("_Error");
        $_page['header_text'] = _t("_Profile Not found");
        $ret = "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
        $ret .= _t('_Profile Not found Ex');
        $ret .= "</td></table>";
        return $ret;
    }
    ob_start();
    echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
    if ($p_arr['Status'] == 'Unconfirmed') {
        $ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], "secret_confirmation_string")));
        if (strcmp($ConfCode, $ConfCodeReal) != 0) {
            ?>
<b><?php 
            echo _t("_Profile activation failed");
            ?>
</b><br /><br />
<?php 
            echo _t("_EMAIL_CONF_FAILED_EX");
            ?>
<br />
<center><form action="<?php 
            echo $_SERVER[PHP_SELF];
            ?>
" method=get>
<input type=hidden name="ConfID" value="<?php 
            echo $ID;
            ?>
">
<table class=text>
    <td><b><?php 
            echo _t("_Confirmation code");
            ?>
:</b> </td>
    <td><input class=no name="ConfCode"></td>
    <td>&nbsp;</td>
    <td><input class=no type="submit" value=" <?php 
            echo _t("_Submit");
            ?>
 "></td>
</table>
</form></center>
<?php 
        } else {
            if ($autoApproval_ifJoin) {
                $status = 'Active';
                $message = getParam("t_Activation");
                $subject = getParam('t_Activation_subject');
                sendMail($p_arr['Email'], $subject, $message, $p_arr['ID']);
            } else {
                $status = 'Approval';
            }
            $update = db_res("UPDATE `Profiles` SET `Status` = '{$status}' WHERE `ID` = '{$ID}';");
            createUserDataFile($ID);
            reparseObjTags('profile', $ID);
            // Promotional membership
            if (getParam('enable_promotion_membership') == 'on') {
                $memership_days = getParam('promotion_membership_days');
                setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
            }
            echo _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
            ?>
<br /><br />
<center><a href="member.php"><b><?php 
            echo _t("_Continue");
            ?>
 &gt;&gt;</b></a></center>
<?php 
            if ($newusernotify) {
                $message = "New user {$p_arr['NickName']} with email {$p_arr['Email']} has been confirmed,\nhis/her ID is {$p_arr['ID']}.\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 {
        echo _t('_ALREADY_ACTIVATED');
    }
    echo "</td></table>";
    $ret = ob_get_contents();
    ob_end_clean();
    return $ret;
}
Ejemplo n.º 21
0
     profile_delete($val);
     break;
 case "Confirm Email":
     activation_mail($val, 0);
     break;
 case "Send Message":
     profile_send_message($val, $_POST['Message']);
     break;
 case 'Activate':
     db_res("UPDATE `Profiles` SET `Status` = 'Active' WHERE `ID` = '" . (int) $val . "'");
     createUserDataFile((int) $val);
     reparseObjTags('profile', (int) $val);
     break;
 case 'Approval':
     db_res("UPDATE `Profiles` SET `Status` = 'Approval' WHERE `ID` = '" . (int) $val . "'");
     createUserDataFile((int) $val);
     reparseObjTags('profile', (int) $val);
     break;
 case 'Ban':
     if ((int) $val > 0 && (int) $_REQUEST['time_hrs'] > 0) {
         $iBanTime = (int) $_REQUEST['time_hrs'] * 3600;
         $sCheckBanSQL = "SELECT * FROM `AdminBanList` WHERE `ProfID`='{$val}' LIMIT 1";
         db_res($sCheckBanSQL);
         if (mysql_affected_rows() == 1) {
             $sBamSQL = "UPDATE `AdminBanList` SET `Time`='{$iBanTime}', `DateTime`=NOW() WHERE `ProfID`='{$val}'";
         } else {
             $sBamSQL = "INSERT INTO `AdminBanList` SET `Time`='{$iBanTime}', `DateTime`=NOW(), `ProfID`='{$val}'";
         }
         db_res($sBamSQL);
     }
     break;
Ejemplo n.º 22
0
 function getBlockCode_Privacy()
 {
     $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
     $this->aFormPrivacy = array('form_attrs' => array('id' => 'profile_edit_privacy', 'name' => 'profile_edit_privacy', 'action' => BX_DOL_URL_ROOT . 'pedit.php?ID=' . $this->iProfileID, 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'save_privacy')), 'inputs' => array('profile_id' => array('type' => 'hidden', 'name' => 'profile_id', 'value' => $this->iProfileID), 'allow_view_to' => $oPrivacy->getGroupChooser(getLoggedId(), 'profile', 'view'), 'save_privacy' => array('type' => 'submit', 'name' => 'save_privacy', 'value' => _t('_edit_profile_privacy_save'))));
     $aProfileInfo = getProfileInfo($this->iProfileID);
     $this->aFormPrivacy['inputs']['allow_view_to']['value'] = $aProfileInfo['allow_view_to'];
     $oForm = new BxTemplFormView($this->aFormPrivacy);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iProfileId = (int) $_POST['profile_id'];
         $iAllowViewTo = (int) $_POST['allow_view_to'];
         $aProfileInfo = getProfileInfo($iProfileId);
         if ((int) db_res("UPDATE `Profiles` SET `allow_view_to`='" . $iAllowViewTo . "' WHERE `ID`='" . $iProfileId . "' LIMIT 1") > 0) {
             $sStatusText = '_Save profile successful';
             createUserDataFile($iProfileId);
             if (BxDolModule::getInstance('BxWmapModule')) {
                 BxDolService::call('wmap', 'response_entry_change', array('profiles', $iProfileId));
             }
             // create system event
             bx_import('BxDolAlerts');
             $oZ = new BxDolAlerts('profile', 'edit', $iProfileId, 0, array('OldProfileInfo' => $aProfileInfo, 'privacy' => $iAllowViewTo));
             $oZ->alert();
         }
     }
     if ($sStatusText) {
         $sStatusText = MsgBox(_t($sStatusText), 3);
     }
     return array($sStatusText . $oForm->getCode(), array(), array(), false);
 }
Ejemplo n.º 23
0
} else {
    if (!$_POST['ID'] && !$_POST['Password']) {
        // this is dynamic page -  send headers to do not cache this page
        send_headers_page_changed();
        login_form();
    } else {
        $member['ID'] = getID($member['ID']);
        // Check if ID and Password are correct (addslashes already inside)
        if (check_login($member['ID'], $member['Password'])) {
            setcookie("memberID", $_COOKIE['memberID'], time() - 3600, '/');
            setcookie("memberPassword", $_COOKIE['memberPassword'], time() - 3600, '/');
            setcookie("memberID", $member['ID'], 0, '/');
            setcookie("memberPassword", $member['Password'], 0, '/');
            //setcookie( 'userArray', 'aUser' . $member['ID'] );
            $update_res = db_res("UPDATE `Profiles` SET `LastLoggedIn` = NOW() WHERE `ID` = {$member['ID']}");
            createUserDataFile($member['ID']);
            $p_arr = getProfileInfo($member['ID']);
            //db_arr( "SELECT `NickName` From `Profiles` WHERE `ID` = {$member['ID']}" );
            if (!($sUrlRelocate = $_POST['relocate']) or basename($_POST['relocate']) == 'index.php' or basename($_POST['relocate']) == 'join_form.php') {
                $sUrlRelocate = $_SERVER['PHP_SELF'];
            }
            $_page['name_index'] = 150;
            $_page['css_name'] = '';
            $_ni = $_page['name_index'];
            $_page_cont[$_ni]['page_main_code'] = MsgBox(_t('_Please Wait'));
            $_page_cont[$_ni]['url_relocate'] = $sUrlRelocate;
            PageCode();
        }
        exit;
    }
}
Ejemplo n.º 24
0
/**
 * page code function
 */
function PageCompPageMainCode($iID, $sConfCode)
{
    global $site;
    $ID = (int) $iID;
    $ConfCode = clear_xss($sConfCode);
    $p_arr = getProfileInfo($ID);
    if (!$p_arr) {
        $_page['header'] = _t("_Error");
        $_page['header_text'] = _t("_Profile Not found");
        return MsgBox(_t('_Profile Not found Ex'));
    }
    $aCode = array('message_status' => '', 'message_info' => '', 'bx_if:form' => array('condition' => false, 'content' => array('form' => '')), 'bx_if:next' => array('condtion' => false, 'content' => array('next_url' => '')));
    if ($p_arr['Status'] == 'Unconfirmed') {
        $ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se")));
        if (strcmp($ConfCode, $ConfCodeReal) != 0) {
            $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'profile_activate.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('conf_id' => array('type' => 'hidden', 'name' => 'ConfID', 'value' => $ID), 'conf_code' => array('type' => 'text', 'name' => 'ConfCode', 'value' => '', 'caption' => _t("_Confirmation code")), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Submit"))));
            $oForm = new BxTemplFormView($aForm);
            $aCode['message_status'] = _t("_Profile activation failed");
            $aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX");
            $aCode['bx_if:form']['condition'] = true;
            $aCode['bx_if:form']['content']['form'] = $oForm->getCode();
        } else {
            $aCode['bx_if:next']['condition'] = true;
            $aCode['bx_if:next']['content']['next_url'] = BX_DOL_URL_ROOT . 'member.php';
            if (isAutoApproval('join')) {
                $status = 'Active';
                $rEmailTemplate = new BxDolEmailTemplates();
                $aTemplate = $rEmailTemplate->getTemplate('t_Activation');
                sendMail($p_arr['Email'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
                $aCode['message_info'] = _t("_PROFILE_CONFIRM");
            } else {
                $status = 'Approval';
                $aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
            }
            $update = db_res("UPDATE `Profiles` SET `Status` = '{$status}' WHERE `ID` = '{$ID}';");
            createUserDataFile($ID);
            reparseObjTags('profile', $ID);
            // Promotional membership
            if (getParam('enable_promotion_membership') == 'on') {
                $memership_days = getParam('promotion_membership_days');
                setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
            }
            // check couple profile;
            if ($p_arr['Couple']) {
                $update = db_res("UPDATE `Profiles` SET `Status` = '{$status}' WHERE `ID` = '{$p_arr['Couple']}';");
                createUserDataFile($p_arr['Couple']);
                reparseObjTags('profile', $p_arr['Couple']);
                //Promotional membership
                if (getParam('enable_promotion_membership') == 'on') {
                    $memership_days = getParam('promotion_membership_days');
                    setMembership($p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
                }
            }
            if (getParam('newusernotify')) {
                $oEmailTemplates = new BxDolEmailTemplates();
                $aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed');
                sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
            }
        }
    } else {
        $aCode['message_info'] = _t('_ALREADY_ACTIVATED');
    }
    return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode);
}
 function createProfileCache($iMemID)
 {
     createUserDataFile($iMemID);
 }
         $IDnormal = mysql_insert_id($MySQL->link);
         createUserDataFile($IDnormal);
         $result_text .= _t_action("_New profile created") . " ID: <a href='profile_edit.php?ID={$IDnormal}'>{$IDnormal}</a>.";
     } else {
         createUserDataFile($ID);
         if ('Unconfirmed' == $STATUS_CHANGE_TO) {
             // Send confirmation request to the user.
             activation_mail($ID);
         }
         $result_text .= _t_action('_MODIFICATIONS_APPLIED');
     }
 }
 if ($ADMIN) {
     $Featured = $_POST['Featured'] == "on" ? 1 : 0;
     db_res("UPDATE `Profiles` SET `Featured` = '{$Featured}' WHERE `ID` = {$ID};");
     createUserDataFile($ID);
 }
 if ($MEMBER) {
     setcookie("memberPassword", $p_arr_new['Password1'], 0, "/");
 }
 if ($send_cupid_mail_id) {
     cupid_email($send_cupid_mail_id);
 }
 //
 // MODULES [ BEGIN ]
 //
 if (!strlen($p_arr_new['Sex']) && (int) $p_arr_new['Sex'] == 0) {
     $p_arr_new['Sex'] = $p_arr['Sex'];
 }
 if ($ADMIN) {
     if ($_POST[NewProfile] == 'YES' && !$ID) {
Ejemplo n.º 27
0
 function performPhotoUpload($sTmpFile, $aFileInfo, $bAutoAssign2Profile = false, $isMoveUploadedFile = true, $iChangingPhotoID = 0, $iAuthorId = 0)
 {
     global $dir;
     $iLastID = -1;
     if (!$iAuthorId) {
         $iAuthorId = $this->_iOwnerId;
     }
     $this->oModule = BxDolModule::getInstance('BxPhotosModule');
     // checker for flash uploader
     if (!$this->oModule->_iProfileId) {
         $this->oModule->_iProfileId = $this->_iOwnerId;
     }
     if (!$iAuthorId || file_exists($sTmpFile) == false || !$this->oModule->isAllowedAdd(FALSE, FALSE, FALSE)) {
         return false;
     }
     $sMediaDir = $this->oModule->_oConfig->getFilesPath();
     if (!$sMediaDir) {
         @unlink($sTmpFile);
         return false;
     }
     $sTempFileName = $sMediaDir . $iAuthorId . '_temp';
     @unlink($sTempFileName);
     if ($isMoveUploadedFile && is_uploaded_file($sTmpFile) || !$isMoveUploadedFile) {
         if ($isMoveUploadedFile) {
             move_uploaded_file($sTmpFile, $sTempFileName);
             @unlink($sTmpFile);
         } else {
             $sTempFileName = $sTmpFile;
         }
         @chmod($sTempFileName, 0644);
         if (file_exists($sTempFileName) && filesize($sTempFileName) > 0) {
             $aSize = getimagesize($sTempFileName);
             if (!$aSize) {
                 @unlink($sTempFileName);
                 return false;
             }
             switch ($aSize[2]) {
                 case IMAGETYPE_JPEG:
                     $sExtension = '.jpg';
                     break;
                 case IMAGETYPE_GIF:
                     $sExtension = '.gif';
                     break;
                 case IMAGETYPE_PNG:
                     $sExtension = '.png';
                     break;
                 default:
                     @unlink($sTempFileName);
                     return false;
             }
             $sStatus = 'processing';
             $iImgWidth = (int) $aSize[0];
             $iImgHeight = (int) $aSize[1];
             $sDimension = $iImgWidth . 'x' . $iImgHeight;
             $sFileSize = sprintf("%u", filesize($sTempFileName) / 1024);
             if ($iChangingPhotoID == 0) {
                 if (is_array($aFileInfo) && count($aFileInfo) > 0) {
                     $aFileInfo['dimension'] = $sDimension;
                     $iLastID = $this->insertSharedMediaToDb($sExtension, $aFileInfo, $iAuthorId);
                 } else {
                     $sExtDb = trim($sExtension, '.');
                     $sMedUri = $sCurTime = time();
                     $sTitleDescTemp = $this->sTempFilename != '' ? $this->sTempFilename : $iAuthorId . '_temp';
                     if (getParam('bx_photos_activation') == 'on') {
                         $bAutoActivate = true;
                         $sStatus = 'approved';
                     } else {
                         $bAutoActivate = false;
                         $sStatus = 'pending';
                     }
                     $sAlbum = $_POST['extra_param_album'];
                     $aAlbumParams = isset($_POST['extra_param_albumPrivacy']) ? array('privacy' => (int) $_POST['extra_param_albumPrivacy']) : array();
                     $iLastID = $this->oModule->_oDb->insertData(array('medProfId' => $iAuthorId, 'medExt' => $sExtDb, 'medTitle' => $sTitleDescTemp, 'medUri' => $sMedUri, 'medDesc' => $sTitleDescTemp, 'medTags' => '', 'Categories' => PROFILE_PHOTO_CATEGORY, 'medSize' => $sDimension, 'Approved' => $sStatus, 'medDate' => $sCurTime));
                     $this->addObjectToAlbum($this->oModule->oAlbums, $sAlbum, $iLastID, $bAutoActivate, $iAuthorId, $aAlbumParams);
                     $this->oModule->isAllowedAdd(true, true);
                 }
             } else {
                 $iLastID = $iChangingPhotoID;
                 $this->updateMediaShared($iLastID, $aFileInfo);
             }
             $sFunc = $isMoveUploadedFile ? 'rename' : 'copy';
             if (!$sFunc($sTempFileName, $sMediaDir . $iLastID . $sExtension)) {
                 @unlink($sTempFileName);
                 return false;
             }
             $this->sSendFileInfoFormCaption = $iLastID . $sExtension . " ({$sDimension}) ({$sFileSize}kb)";
             $sFile = $sMediaDir . $iLastID . $sExtension;
             // watermark postprocessing
             if (getParam('enable_watermark') == 'on') {
                 $iTransparent = getParam('transparent1');
                 $sWaterMark = $dir['profileImage'] . getParam('Water_Mark');
                 if (strlen(getParam('Water_Mark')) && file_exists($sWaterMark)) {
                     applyWatermark($sFile, $sFile, $sWaterMark, $iTransparent);
                 }
             }
             // generate present pics
             foreach ($this->oModule->_oConfig->aFilesConfig as $sKey => $aValue) {
                 if (!isset($aValue['size_def'])) {
                     continue;
                 }
                 $iWidth = (int) $this->oModule->_oConfig->getGlParam($sKey . '_width');
                 $iHeight = (int) $this->oModule->_oConfig->getGlParam($sKey . '_height');
                 if ($iWidth == 0) {
                     $iWidth = $aValue['size_def'];
                 }
                 if ($iHeight == 0) {
                     $iHeight = $aValue['size_def'];
                 }
                 $sNewFilePath = $sMediaDir . $iLastID . $aValue['postfix'];
                 $iRes = imageResize($sFile, $sNewFilePath, $iWidth, $iHeight, true, isset($aValue['square']) && $aValue['square']);
                 if ($iRes != 0) {
                     return false;
                 }
                 //resizing was failed
                 @chmod($sNewFilePath, 0644);
             }
             $aOwnerInfo = getProfileInfo($iAuthorId);
             $bAutoAssign2Profile = $aOwnerInfo['Avatar'] == 0 ? true : $bAutoAssign2Profile;
             if ($bAutoAssign2Profile && $iLastID > 0) {
                 $this->setPrimarySharedPhoto($iLastID, $iAuthorId);
                 createUserDataFile($iAuthorId);
             }
             if (is_array($aFileInfo) && count($aFileInfo) > 0) {
                 $this->alertAdd($iLastID, true);
             }
         }
     }
     return $iLastID;
 }
 function insertMediaToDb($sFileName)
 {
     $sMediaType = process_db_input($this->sMediaType);
     $sFileName = process_db_input($sFileName);
     $sFileTitle = process_db_input($_POST['title']);
     $sStatus = getParam("autoApproval_Photo") == 'on' ? 'active' : 'passive';
     $iResult = $this->oMediaQuery->insertMedia($this->iProfileID, $sMediaType, $sFileName, $sFileTitle, $sStatus);
     if (0 < $iResult) {
         if (getParam("autoApproval_ifPhoto") != 'on') {
             $sqlQuery = "UPDATE `Profiles` set `Status`='Approval' WHERE `ID`={$this->iProfileID}";
             db_res($sqlQuery);
             createUserDataFile($this->iProfileID);
             reparseObjTags('profile', $this->iProfileID);
         }
         return true;
     } else {
         return false;
     }
 }