<?php
require_once("{$CONF['path']}/sources/misc/classes5.php");
class 
base4 extends base5 {
    function 
newsletter() {
        global 
$CONF$DB$FORM$LNG$TIMER$MSK;
         
$MSK['email'] = $DB -> escape($FORM['email'], 1);
         if (!
preg_match('/.+\@.+\.\w+/'$MSK['email'])) {
            
$MSK['titlu'] = $LNG['php_128'] ;
             
header('Refresh:2;URL=' $_SERVER['HTTP_REFERER'] . '#newsletter');
             
$this -> error($LNG['php_128']);
             } 
        list(
$email_sql) = $DB -> fetch("SELECT email FROM {$CONF['sql_prefix']}_members WHERE email = '{$MSK['email']}' AND !username "__FILE____LINE__);
         if (
$email_sql && $email_sql == $MSK['email']) {
            
$MSK['titlu'] = $LNG['php_161'] ;
             
header('Refresh:2;URL=' $_SERVER['HTTP_REFERER'] . '#newsletter');
             
$this -> error($LNG['php_161']);
             } else {
            
$DB -> query("INSERT INTO {$CONF['sql_prefix']}_members (email, join_date, news) VALUES ('{$MSK['email']}', '" date('j M Y'time()) . "', '0')"__FILE____LINE__);
             
$MSK['mesaj'] = sprintf($LNG['php_162'], $MSK['titlu_site'], "{$MSK['list_url']}/index.php?pag=unsubscribe&amp;email={$MSK['email']}""{$MSK['list_url']}/index.php?pag=confirm&amp;email={$MSK['email']}");
             
$email = new skin('join_newsletter');
             
$email -> send_email($MSK['email'], "news@{$MSK['titlu_site']}");
             
header('Refresh:4;URL=' $_SERVER['HTTP_REFERER']);
             
$MSK['titlu'] = sprintf($LNG['php_163'], $MSK['titlu_site']);
             
$this -> error($LNG['php_164']);
             } 
        } 
    function 
confirm() {
        global 
$CONF$DB$MSK$LNG$FORM;
         
$email $DB -> escape($FORM['email'], 1);
         
$DB -> query("UPDATE {$CONF['sql_prefix']}_members SET news = 'All' WHERE email = '{$email}'"__FILE____LINE__);
         
$MSK['titlu'] = sprintf($LNG['php_165'], $MSK['titlu_site']);
         
$this -> error($LNG['php_166']);
         
header('Refresh:4;URL=' $MSK['list_url']);
         } 
    function 
unsubscribe() {
        global 
$CONF$DB$MSK$LNG$FORM;
         
$MSK['titlu'] = sprintf($LNG['php_167'], $MSK['titlu_site']);
         
$MSK['email'] = $DB -> escape($FORM['email'], 1);
         list(
$username$email) = $DB -> fetch("SELECT username, email FROM {$CONF['sql_prefix']}_members WHERE email = '{$MSK['email']}'"__FILE____LINE__);
         if (
$username)$this -> error($LNG['php_168']);
         elseif (!
$username && $email) {
            
$DB -> query("DELETE FROM {$CONF['sql_prefix']}_members WHERE  email = '{$MSK['email']}'"__FILE____LINE__);
             
$this -> error($LNG['php_169']);
             } else
$this -> error($LNG['php_170']);
         
header('Refresh:4;URL=' $_SERVER['HTTP_REFERER']);
         } 
    function 
add_alert() {
        global 
$CONF$DB$FORM$LNG$MSK;
         if (!isset(
$_COOKIE['mascka_member']) && !isset($_COOKIE['mascka_developer'])) {
            
$MSK['message'] = sprintf($LNG['php_126_b'], $MSK['titlu_site']);
             
$MSK['continut'] = $this -> do_skin('form_login');
             } else {
            
$numar $DB -> escape($FORM['b'], 1);
             list(
$MSK['numar'], $MSK['p_name'], $MSK['name_str'], $MSK['p_vers'], $MSK['os'], $MSK['cat_str'], $MSK['subcat_str']) = $DB -> fetch("SELECT numar, p_name, name_str, p_vers, os, cat_str, subcat_str FROM {$CONF['sql_prefix']}_prog WHERE numar = '{$numar}'"__FILE____LINE__);
             if (
$CONF['text_link'])$MSK['link_name'] = $this -> get_text_link($MSK['p_name']);
             
$this -> rewrite_links();
             
header('Refresh:1;URL=' html_entity_decode($MSK['prog_det_link']));
             if (!isset(
$_COOKIE['mascka_developer'])) {
                list(
$MSK['tracked_numar']) = $DB -> fetch("SELECT tracked_numar FROM {$CONF['sql_prefix']}_members WHERE username = '{$MSK['username']}'"__FILE____LINE__);
                 
$tracked_numbers unserialize($MSK['tracked_numar']);
                 if (!@
in_array($MSK['numar'], $tracked_numbers)) {
                    ((
is_array($tracked_numbers)) ? array_push($tracked_numbers$MSK['numar']) : $tracked_numbers = array($MSK['numar']));
                     
$insert_tracked_numar serialize($tracked_numbers);
                     
$DB -> query("UPDATE {$CONF['sql_prefix']}_members SET tracked_numar = '{$insert_tracked_numar}' WHERE username='{$MSK['username']}'"__FILE____LINE__);
                     
$this -> error($LNG['php_525']);
                     } else 
$this -> error($LNG['php_524']);
                 } else {
                
$this -> error($LNG['php_526']);
                 } 
            } 
        } 
    function 
send_friend() {
        global 
$CONF$DB$FORM$LNG$MSK;
         
$MSK['titlu'] = $LNG['php_124'] ;
         
$MSK['where'] = $LNG['php_125'];
         if (!isset(
$_COOKIE['mascka_member']) && !isset($_COOKIE['mascka_developer']) && !isset($_COOKIE['mascka_editor']) && !isset($_COOKIE['mascka_admin'])) {
            
$MSK['message'] = sprintf($LNG['php_126'], $MSK['titlu_site']);
             
$MSK['referer'] = $_SERVER['REQUEST_URI'];
             
$MSK['continut'] = $this -> do_skin('form_login');
             } else {
            
$numar $DB -> escape($FORM['b'], 1);
             if (isset(
$FORM['news'])) list($MSK['id'], $MSK['p_name'], $MSK['name_str'], $MSK['news_cat']) = $DB -> fetch("SELECT id, news_title, name_str, news_cat FROM {$CONF['sql_prefix']}_news WHERE id = '{$numar}'"__FILE____LINE__);
             else list(
$MSK['numar'], $MSK['p_name'], $MSK['name_str'], $MSK['p_vers'], $MSK['os'], $MSK['cat_str'], $MSK['subcat_str']) = $DB -> fetch("SELECT numar, p_name, name_str, p_vers, os, cat_str, subcat_str FROM {$CONF['sql_prefix']}_prog WHERE numar = '{$numar}'"__FILE____LINE__);
             if (
$CONF['text_link'])$MSK['link_name'] = $this -> get_text_link($MSK['p_name']);
             
$this -> rewrite_links();
             if (!isset(
$FORM['submit']))$MSK['continut'] = $this -> do_skin('form_email_friend');
             else {
                if (isset(
$_COOKIE['mascka_member']))$cookie $_COOKIE['mascka_member'];
                 elseif (isset(
$_COOKIE['mascka_developer']))$cookie $_COOKIE['mascka_developer'];
                 list(
$MSK['nume_user'], $MSK['email_user']) = $DB -> fetch("SELECT username, email FROM {$CONF['sql_prefix']}_members members, {$CONF['sql_prefix']}_sessions sessions WHERE members.username = sessions.data AND sid = '{$cookie}'"__FILE____LINE__);
                 
$MSK['email'] = $DB -> escape($FORM['email'], 1);
                 
$emty_email null;
                 
$invalid_email null;
                 if (!
$MSK['email'])$emty_email 1;
                 if (
$MSK['email'] && !preg_match('/.+\@.+\.\w+/'$MSK['email'])) $invalid_email 1;
                 if (
$emty_email || $invalid_email) {
                    if (
$emty_email)$MSK['error_email'] = $LNG['php_127'];
                     if (
$invalid_email)$MSK['error_email'] = $LNG['php_128'];
                     
$MSK['email'] = $DB -> escape($FORM['email'], 1);
                     
$MSK['continut'] = $this -> do_skin('form_email_friend');
                     } else {
                    if (isset(
$FORM['news'])) {
                        
$MSK['suggested_link'] = '<a href="' $MSK['news_det_link'] . '">' $MSK['p_name'] . '</a>';
                         
header('Refresh:4;URL=' html_entity_decode($MSK['news_det_link']));
                         } else {
                        
$MSK['suggested_link'] = '<a href="' $MSK['prog_det_link'] . '">' $MSK['p_name'] . ' ' $MSK['p_vers'] . '</a>';
                         
header('Refresh:4;URL=' html_entity_decode($MSK['prog_det_link']));
                         } 
                    
$email = new skin('email_friend');
                     
$email -> send_email($MSK['email'], $MSK['email_user']);
                     
$this -> error($LNG['php_129']);
                     } 
                } 
            } 
        } 
    function 
report() {
        global 
$CONF$DB$FORM$LNG$MSK;
         if (!isset(
$FORM['submit'])) {
            if (!isset(
$_COOKIE['mascka_member']) && !isset($_COOKIE['mascka_developer']) && !isset($_COOKIE['mascka_editor']) && !isset($_COOKIE['mascka_admin'])) {
                
$MSK['message'] = sprintf($LNG['php_1032'], $FORM['b']);
                 
$MSK['referer'] = $_SERVER['REQUEST_URI'];
                 
$MSK['continut'] = $this -> do_skin('form_login');
                 } else {
                
$MSK['error_capcha'] = $LNG['php_131'];
                 
$MSK['referer'] = $_SERVER['HTTP_REFERER'];
                 if (isset(
$_COOKIE['mascka_developer']))$sid $_COOKIE['mascka_developer'];
                 if (isset(
$_COOKIE['mascka_member']))$sid $_COOKIE['mascka_member'];
                 if (isset(
$_COOKIE['mascka_editor']))$sid $_COOKIE['mascka_editor'];
                 if (isset(
$_COOKIE['mascka_admin']))$sid $_COOKIE['mascka_admin'];
                 if (
$sid)list($MSK['nume'], $MSK['email']) = $DB -> fetch("SELECT username, email FROM {$CONF['sql_prefix']}_members members, {$CONF['sql_prefix']}_sessions sessions WHERE members.username = sessions.data AND sid = '{$sid}'"__FILE____LINE__);
                 
$numar $DB -> escape($FORM['b'], 1);
                 if (isset(
$FORM['news'])) list($nume) = $DB -> fetch("SELECT news_title FROM {$CONF['sql_prefix']}_news WHERE id = '{$numar}'"__FILE____LINE__);
                 else list(
$nume$version) = $DB -> fetch("SELECT p_name, p_vers FROM {$CONF['sql_prefix']}_prog WHERE numar = '{$numar}'"__FILE____LINE__);
                 if (isset(
$FORM['user'])) {
                    
$MSK['readonly'] = "readonly";
                     
$MSK['titlu'] = $LNG['php_153'] = $LNG['php_153'] = sprintf($LNG['php_1033'], $FORM['b']);
                     } else {
                    if (isset(
$FORM['new'])) {
                        
$MSK['titlu'] = $MSK['subiect'] = $LNG['php_153'] = sprintf($LNG['php_132_b'], $nume ' ' $version$numar);
                         } else {
                        
$MSK['titlu'] = $MSK['subiect'] = $LNG['php_153'] = sprintf($LNG['php_132'], $nume ' ' $version$numar);
                         } 
                    } 
                
$MSK['continut'] = $this -> do_skin('form_contact');
                 } 
            } else {
            
$MSK['page_referer'] = sprintf($LNG['php_133'], $FORM['referer'], $FORM['referer']);
             
$MSK['nume'] = $DB -> escape($FORM['nume'], 1);
             
$MSK['from'] = $MSK['email'] = $DB -> escape($FORM['email'], 1);
             
$MSK['subiect'] = $DB -> escape($FORM['subiect'], 1);
             
$MSK['mesaj'] = $this -> nl2br2($FORM['mesaj'], 1);
             
$this -> validate_contact();
             } 
        } 
    
    function 
password() {
        global 
$FORM$LNG$MSK;
         if (!isset(
$FORM['username']) && !isset($FORM['sid'])) {
            
$MSK['titlu'] = $MSK['message'] = $LNG['php_134'];
             
$MSK['continut'] = $this -> do_skin('form_lost_pw');
             } elseif (isset(
$FORM['username']) && !isset($FORM['password']))$this -> pass_email();
         elseif (isset(
$FORM['sid']) && !isset($FORM['password']))$this -> pass_form();
         elseif (isset(
$FORM['sid']) && isset($FORM['password']))$this -> new_password();
         } 
    
    function 
pass_email() {
        global 
$CONF$DB$FORM$LNG$MSK;
         
$username $DB -> escape($FORM['username'], 1);
         if ((
$email != '') && (!preg_match('/.+\@.+\.\w+/'$email))) {
            
header('Refresh:2;URL=' $_SERVER['HTTP_REFERER']);
             
$this -> error($LNG['php_128']);
             } else {
            list(
$email) = $DB -> fetch("SELECT email FROM {$CONF['sql_prefix']}_members WHERE username = '{$username}'"__FILE____LINE__);
             if (
$email) {
                
header('Refresh:4;URL=' $MSK['list_url']);
                 require_once(
"{$CONF['path']}/sources/misc/session.php");
                 
$session = new session;
                 
$MSK['sid'] = $session -> create('lost_pw'$email0);
                 
$lost_pw_email = new skin('email_lost_pw');
                 
$lost_pw_email -> send_email($email"{$MSK['titlu_site']} <{$CONF['site_email']}>");
                 
$this -> error($LNG['php_135']);
                 } else {
                
header('Refresh:4;URL=' $_SERVER['HTTP_REFERER']);
                 
$this -> error($LNG['php_136']);
                 } 
            } 
        } 
    
    function 
pass_form() {
        global 
$CONF$FORM$LNG$MSK;
         
$MSK['meta_refresh'] .= "<style type=\"text/css\">@import url(\"{$MSK['list_url']}/skins/{$MSK['skin']}/css/pass_bar.css\");</style><script language=\"javascript\" src=\"{$MSK['list_url']}/js/password_strength.js\"></script>";
         require_once(
"{$CONF['path']}/sources/misc/session.php");
         
$session = new session;
         list(
$type$data) = $session -> get($FORM['sid']);
         if (
$type == 'lost_pw') {
            
$MSK['sid'] = $FORM['sid'];
             
$MSK['continut'] = $this -> do_skin('form_lost_pw_2');
             } else
$this -> error($LNG['php_137']);
         } 
    function 
new_password() {
        global 
$CONF$DB$FORM$LNG$MSK;
         require_once(
"{$CONF['path']}/sources/misc/session.php");
         
$session = new session;
         list(
$type$data) = $session -> get($FORM['sid']);
         
$MSK['email'] = $DB -> escape($data);
         
$password md5($FORM['password']);
         if (
$type == 'lost_pw') {
            
header('Refresh:4;URL=' $MSK['user_cp_link']);
             
$session -> delete($FORM['sid']);
             
$DB -> query("UPDATE {$CONF['sql_prefix']}_members SET password = '{$password}' WHERE email = '{$MSK['email']}'"__FILE____LINE__);
             
$this -> error($LNG['php_138']);
             } else
$this -> error($LNG['php_137']);
         } 
    function 
register() {
        global 
$CONF$DB$FORM$LNG$MSK;
         
$MSK['titlu'] = $LNG['php_139'];
         if (!isset(
$FORM['submit'])) {
            
$MSK['checked'] = "checked=\"checked\"";
             
$MSK['referer'] = $_SERVER['HTTP_REFERER'];
             require_once(
"{$CONF['path']}/sources/misc/session.php");
             
$session = new session;
             if (isset(
$_COOKIE['mascka_member']))list($type$data) = $session -> get($_COOKIE['mascka_member']);
             elseif (isset(
$_COOKIE['mascka_developer']))list($type$data) = $session -> get($_COOKIE['mascka_developer']);
             elseif (isset(
$_COOKIE['mascka_admin']))list($type$data) = $session -> get($_COOKIE['mascka_admin']);
             elseif (isset(
$_COOKIE['mascka_editor']))list($type$data) = $session -> get($_COOKIE['mascka_editor']);
             if (
$DB -> escape($type)) $this -> error($LNG['php_514']);
             
$MSK['continut'] = $this -> do_skin('form_register');
             } else {
            if (isset(
$_COOKIE['mascka_member'])) {
                require_once(
"{$CONF['path']}/sources/misc/session.php");
                 
$session = new session;
                 
$session -> delete($_COOKIE['mascka_member']);
                 } 
            
$MSK['referer'] = $FORM['referer'];
             
$MSK['username'] = $DB -> escape($FORM['username'], 1);
             
$MSK['password'] = $DB -> escape($FORM['password']);
             
$MSK['conf_password'] = $DB -> escape($FORM['conf_password']);
             
$MSK['email'] = $DB -> escape($FORM['email'], 1);
             
$MSK['home_page'] = $DB -> escape($FORM['home_page'], 1);
             
$emty_username null;
             
$short_username null;
             
$invalid_username null;
             
$long_username null;
             
$used_username null;
             
$emty_password null;
             
$short_password null;
             
$not_mach_password null;
             
$emty_email null;
             
$invalid_email null;
             
$used_email null;
             if (!
$MSK['username'])$emty_username 1;
             if (
$MSK['username'] && strlen($MSK['username']) < 4$short_username 1;
             if (
$MSK['username'] && is_numeric($MSK['username']))$invalid_username 1;
             if (
$MSK['username'] && strlen($MSK['username']) > 15$long_username 1;
             if (
$MSK['username'] && eregi(' '$MSK['username']))$invalid_username 1;
             list(
$username) = $DB -> fetch("SELECT username FROM {$CONF['sql_prefix']}_members WHERE username = '{$MSK['username']}'"__FILE____LINE__);
             if (
$MSK['username'] && $username)$used_username 1;
             if (!
$FORM['password'])$emty_password 1;
             if (
$FORM['password'] && strlen($FORM['password']) < 4$short_password 1;
             if (
$FORM['password'] && !preg_match("/{$FORM['password']}/"$FORM['conf_password']))$not_mach_password 1;
             if (!
$MSK['email'])$emty_email 1;
             if (
$MSK['email'] && !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$MSK['email'])) $invalid_email 1;
             list(
$old_username$email) = $DB -> fetch("SELECT username, email FROM {$CONF['sql_prefix']}_members WHERE email = '{$MSK['email']}'"__FILE____LINE__);
             if (
$MSK['email'] && $email && $old_username)$used_email 1;
             if (
$emty_username || $short_username || $invalid_username || $long_username || $used_username || $emty_password || $short_password || $not_mach_password || $emty_email || $invalid_email || $used_email) {
                if (
$emty_username)$MSK['error_username'] = $LNG['php_140'];
                 if (
$short_username)$MSK['error_username'] = $LNG['php_141'];
                 if (
$invalid_username)$MSK['error_username'] = $LNG['php_142'];
                 if (
$long_username)$MSK['error_username'] = $LNG['php_143'];
                 if (
$used_username)$MSK['error_username'] = $LNG['php_144'];
                 if (
$emty_password)$MSK['error_password'] = $LNG['php_145'];
                 if (
$short_password)$MSK['error_password'] = $LNG['php_146'];
                 if (
$not_mach_password)$MSK['error_mach_password'] = $LNG['php_147'];
                 if (
$emty_email)$MSK['error_email'] = $LNG['php_148'];
                 if (
$invalid_email)$MSK['error_email'] = $LNG['php_128'];
                 if (
$used_email)$MSK['error_email'] = $LNG['php_149'];
                 
$MSK[$FORM['type']] = " selected=\"selected\"";
                 if (isset(
$FORM['user_type']))$MSK['continut'] = $this -> do_skin('form_publisher');
                 else 
$MSK['continut'] = $this -> do_skin('form_register');
                 } else {
                
$parola md5($FORM['password']);
                 
header('Refresh:5;URL=' $FORM['referer']);
                 
$used_ips serialize(getenv('REMOTE_ADDR'));
                 if (!
$old_username && $email) {
                    
$DB -> query("UPDATE {$CONF['sql_prefix']}_members SET username ='{$MSK['username']}', password='{$parola}', home_page='{$MSK['home_page']}', join_date ='" date('j M Y'time()) . "', used_ips='{$used_ips}', type='{$FORM['type']}', status = '1' WHERE email = '{$email}'"__FILE____LINE__);
                     
$this -> error($LNG['php_150']);
                     } else {
                    
$DB -> query("INSERT INTO {$CONF['sql_prefix']}_members (username, password, email, home_page, join_date, used_ips, type) VALUES ('{$MSK['username']}', '{$parola}', '{$MSK['email']}', '{$MSK['home_page']}', '" date('d M Y'time()) . "', '{$used_ips}', '{$FORM['type']}')"__FILE____LINE__);
                     
$email = new skin('email_join');
                     
$email -> send_email($MSK['email'], $CONF['site_email']);
                     
$this -> error($LNG['php_151']);
                     } 
                } 
            } 
        } 
    function 
contact() {
        global 
$CONF$DB$FORM$LNG$MSK;
         
$MSK['titlu'] = $LNG['php_152'] . $MSK['titlu_site'];
         if (!isset(
$FORM['submit'])) {
            if (isset(
$_COOKIE['mascka_member']))list($MSK['nume'], $MSK['email']) = $DB -> fetch("SELECT username, email FROM {$CONF['sql_prefix']}_members members, {$CONF['sql_prefix']}_sessions sessions WHERE members.username = sessions.data AND sid = '{$_COOKIE['mascka_member']}'"__FILE____LINE__);
             
$MSK['referer'] = $_SERVER['HTTP_REFERER'];
             
$MSK['error_capcha'] = $LNG['php_131'];
             
$MSK['continut'] = $this -> do_skin('form_contact');
             } else {
            
$MSK['nume'] = $DB -> escape($FORM['nume'], 1);
             
$MSK['from'] = $MSK['email'] = $DB -> escape($FORM['email'], 1);
             
$MSK['subiect'] = $DB -> escape($FORM['subiect'], 1);
             
$MSK['mesaj'] = $this -> nl2br2($FORM['mesaj']);
             
$this -> validate_contact();
             } 
        } 
    function 
activate() {
        global 
$CONF$DB$MSK$LNG$FORM;
         
header('Refresh:4;URL=' $MSK['user_cp_link']);
         
$username $DB -> escape($FORM['username'], 1);
         
$row $DB -> fetch("SELECT * FROM {$CONF['sql_prefix']}_members WHERE username = '{$username}'"__FILE____LINE__);
         if (
$row) {
            
$MSK array_merge($MSK$row);
             if (
$MSK['status'] == 1) {
                
$MSK['titlu'] = $LNG['php_154'];
                 
$this -> error($LNG['php_531']);
                 } else {
                
$status 1;
                 if (
$MSK['type'] == 'user' && $CONF['email_on_join_member']) {
                    
$email = new skin('email_join_admin');
                     
$email -> send_email($CONF['site_email'], $CONF['titlu_site']);
                     } 
                if (
$MSK['type'] == 'developer' && $CONF['email_on_join_developer']) {
                    
$email = new skin('email_join_admin');
                     
$email -> send_email($CONF['site_email'], $CONF['titlu_site']);
                     } 
                if (
$MSK['type'] == 'editor') {
                    
$status 2;
                     
$email = new skin('email_join_admin');
                     
$email -> send_email($CONF['site_email'], $CONF['titlu_site']);
                     } 
                
$DB -> query("UPDATE {$CONF['sql_prefix']}_members SET status = '{$status}' WHERE username = '{$username}'"__FILE____LINE__);
                 
$MSK['titlu'] = sprintf($LNG['php_156'], $MSK['titlu_site']);
                 
$this -> error($MSK['titlu']);
                 } 
            } else 
$this -> error($LNG['php_532']);
         } 
    function 
send_dev_stat($numar$message) {
        global 
$CONF$DB$FORM$LNG$MSK;
         if (
$CONF['send_dev_stat']) {
            list(
$master$m_email) = $DB -> fetch("SELECT master, members.email FROM {$CONF['sql_prefix']}_prog prog,{$CONF['sql_prefix']}_members members WHERE master=username AND numar= '{$numar}'"__FILE____LINE__);
             
$MSK['em_title'] = sprintf($LNG['php_1019'], $MSK['titlu_site']);
             
$MSK['em_mesage'] = $message;
             if(
$m_email){
             
$email = new skin('email');
             
$email -> send_email($m_email$CONF['titlu_site']);
             } 
             }
        } 
    
    function 
resend_email() {
        global 
$CONF$DB$FORM$LNG$MSK;
         
$MSK['titlu'] = $LNG['php_157'];
         
$MSK['page_address'] .= "<a href=\"{$MSK['list_url']}\" title=\"{$MSK['titlu_site']}\">{$MSK['titlu_site']}</a> &gt;&gt; {$LNG['php_157']}";
         if (!isset(
$FORM['submit']))$MSK['continut'] = $this -> do_skin('form_resend_confirmation');
         else {
            
$MSK['username'] = $DB -> escape($FORM['username'], 1);
             
$emty_username null;
             
$short_username null;
             
$invalid_username null;
             
$long_username null;
             
$active_username null;
             
$inexist_username null;
             
$MSK['username'] = str_replace(" ""-" $MSK['username']);
             if (!
$MSK['username'])$emty_username 1;
             if (
$MSK['username'] && strlen($MSK['username']) < 4$short_username 1;
             if (
$MSK['username'] && is_numeric($MSK['username']))$invalid_username 1;
             if (
$MSK['username'] && strlen($MSK['username']) > 15$long_username 1;
             list(
$status$MSK['email']) = $DB -> fetch("SELECT status, email FROM {$CONF['sql_prefix']}_members WHERE username = '{$MSK['username']}'"__FILE____LINE__);
             if (
$MSK['username'] && $status == '1')$active_username 1;
             if (
$MSK['username'] && !$MSK['email'])$inexist_username 1;
             if (
$emty_username || $short_username || $invalid_username || $long_username || $active_username || $inexist_username) {
                if (
$emty_username)$MSK['error_username'] = $LNG['php_140'];
                 if (
$short_username)$MSK['error_username'] = $LNG['php_141'];
                 if (
$invalid_username)$MSK['error_username'] = $LNG['php_142'];
                 if (
$long_username)$MSK['error_username'] = $LNG['php_143'];
                 if (
$active_username)$MSK['error_username'] = $LNG['php_158'];
                 if (
$inexist_username)$MSK['error_username'] = $LNG['php_159'];
                 
$MSK['continut'] = $this -> do_skin('form_resend_confirmation');
                 } else {
                
header('Refresh:4;URL=' $MSK['user_cp_link']);
                 
$email = new skin('email_join');
                 
$email -> send_email($MSK['email'], $CONF['site_email']);
                 
$this -> error($LNG['php_160']);
                 } 
            } 
        } 
    function 
validate_capcha($capcha) {
        global 
$CONF$DB$MSK$LNG$FORM;
         
$MSK['error_capcha'] = null;
         list(
$sid) = $DB -> fetch("SELECT sid FROM {$CONF['sql_prefix']}_sessions WHERE type = 'captcha' AND data LIKE '{$_SERVER['REMOTE_ADDR']}|%'"__FILE____LINE__);
         require_once(
"{$CONF['path']}/sources/misc/session.php");
         
$session = new session;
         list(
$type$data) = $session -> get($sid);
         list(
$ip$hash) = explode('|'$data);
         if (
$hash != sha1($FORM['capcha']) || strlen($FORM['capcha']) != 6)$MSK['error_capcha'] = $LNG['php_117'];
         
$session -> delete($sid);
         } 
    function 
validate_contact() {
        global 
$CONF$DB$MSK$LNG$FORM;
         
$emty_nume null;
         
$invalid_nume null;
         
$emty_email null;
         
$invalid_email null;
         
$emty_subject null;
         
$emty_mesaj null;
         
$big_messaj null;
         
$error_capcha null;
         list(
$sid) = $DB -> fetch("SELECT sid FROM {$CONF['sql_prefix']}_sessions WHERE type = 'captcha' AND data LIKE '{$_SERVER['REMOTE_ADDR']}|%'"__FILE____LINE__);
         require_once(
"{$CONF['path']}/sources/misc/session.php");
         
$session = new session;
         list(
$type$data) = $session -> get($sid);
         list(
$ip$hash) = explode('|'$data);
         if (
$hash != sha1($FORM['capcha']) || strlen($FORM['capcha']) != 6)$error_capcha 1;
         
$session -> delete($sid);
         
$MSK['referer'] = $DB -> escape($FORM['referer'], 1);
         
$MSK['nume'] = $DB -> escape($FORM['nume'], 1);
         
$MSK['from'] = $MSK['email'] = $DB -> escape($FORM['email'], 1);
         
$MSK['subiect'] = $DB -> escape($FORM['subiect'], 1);
         
$MSK['mesaj'] = $this -> nl2br2($FORM['mesaj']);
         if (!
$MSK['nume'])$emty_nume 1;
         if (
$MSK['nume'] && (strlen($MSK['nume']) > 15 || is_numeric($MSK['nume']) || strlen($MSK['nume']) < 4))$invalid_nume 1;
         if (!
$MSK['email'])$emty_email 1;
         if (
$MSK['email'] && !preg_match('/.+\@.+\.\w+/'$MSK['email'])) $invalid_email 1;
         if (!
$MSK['subiect'])$emty_subject 1;
         if (!
$MSK['mesaj'])$emty_mesaj 1;
         if (
$MSK['mesaj'] && strlen($MSK['mesaj']) > 500$big_messaj 1;
         if (!
$FORM['capcha'])$error_capcha 1;
         if (
$emty_nume || $invalid_nume || $emty_email || $invalid_email || $emty_subject || $emty_mesaj || $big_messaj || $error_capcha) {
            if (
$emty_nume)$MSK['error_nume'] = $LNG['php_171'];
             if (
$invalid_nume)$MSK['error_nume'] = $LNG['php_172'];
             if (
$emty_email)$MSK['error_email'] = $LNG['php_148'];
             if (
$invalid_email)$MSK['error_email'] = $LNG['php_128'];
             if (
$emty_subject)$MSK['error_subiect'] = $LNG['php_173'];
             if (
$emty_mesaj)$MSK['error_mesaj'] = $LNG['php_174'];
             if (
$big_messaj)$MSK['error_mesaj'] = $LNG['php_175'];
             if (
$error_capcha)$MSK['error_capcha'] = $LNG['php_117'];
             
$MSK['continut'] = $this -> do_skin('form_contact');
             } else {
            
header('Refresh:4;URL=' $FORM['referer']);
             
$MSK['mesaj'] = str_replace('\"''"'$MSK['mesaj']);
             
$email = new skin('email_contact');
             
$email -> send_email($CONF['site_email'], $MSK['email']);
             
$this -> error($LNG['php_176']);
             } 
        } 
    function 
open_file($url) {
        global 
$CONF$DB$MSK$LNG$FORM;
         if (
function_exists('curl_init')) {
            
$ch curl_init();
             
curl_setopt($chCURLOPT_URL$url);
             
curl_setopt($chCURLOPT_HEADER0);
             
curl_setopt($chCURLOPT_RETURNTRANSFER1);
             
curl_setopt($chCURLOPT_USERAGENT'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
             return 
curl_exec($ch);
             
curl_close($ch);
            } else {
            return @
file_get_contents($url);
            } 
         } 
    
    function 
nl2br2($string) {
        global 
$CONF$DB$MSK$LNG$FORM;
         
$string str_replace(array("\r\n""\r""\n"), "<br>"$string);
         return 
$string;
         } 
    } 

?>