Jump to content

rjcfan4ever

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Posts posted by rjcfan4ever

  1. CREATE TABLE IF NOT EXISTS `users` (

      `ID` int(11) NOT NULL AUTO_INCREMENT,

      `username` varchar(22) NOT NULL,

      `password` varchar(40) NOT NULL,

      `api` varchar(16) NOT NULL,

      `salt` char(5) NOT NULL,

      `avatar` varchar(32) DEFAULT NULL,

      `language` varchar(5) DEFAULT NULL,

      `theme` varchar(255) NOT NULL,

      `realname` varchar(64) DEFAULT NULL,

      `email` varchar(64) NOT NULL,

      `jabber` varchar(64) DEFAULT NULL,

      `location` varchar(64) DEFAULT NULL,

      `invitations` int(11) DEFAULT NULL,

      `status` enum('ok','nc','banned') NOT NULL DEFAULT 'ok',

      `since` int(10) NOT NULL,

      `last_seen` int(10) NOT NULL,

      `last_follow` int(10) NOT NULL,

      `ip` varchar(16) NOT NULL,

      `jabber_notifications` int(1) NOT NULL DEFAULT '1',

      `notification_level` int(1) NOT NULL DEFAULT '2',

      `ignored` text,

      `last_note` int(10) NOT NULL,

      `shorter_service` varchar(255) NOT NULL DEFAULT 'a:3:{s:7:"service";s:7:"default";s:4:"data";s:0:"";s:7:"preview";b:0;}',

      `gravatar` int(1) NOT NULL DEFAULT '0',

      `openid` varchar(255) DEFAULT NULL,

      `facebook` varchar(255) DEFAULT NULL,

      `twitter` text,

      `extras` text,

      `profile` text,

      `customize` text,

      `privacy` text,

      PRIMARY KEY (`ID`),

      UNIQUE KEY `username` (`username`),

      UNIQUE KEY `openid` (`openid`),

      UNIQUE KEY `facebook` (`facebook`),

      KEY `api` (`api`),

      KEY `email` (`email`),

      KEY `since` (`since`),

      KEY `jabber` (`jabber`),

      KEY `last_change` (`last_follow`),

      KEY `last_note` (`last_note`)

    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

  2. So if I change the user his data to banned or something he don't change

    Here is the part of the code:

    $userInfo = $db->getuserInfo($_GET['id']);
    				if ($userInfo) {
    					echo '<form action="'.coreLink('admin', 'users').'" method="post"><input type="hidden" name="userID" value="'.$userInfo['ID'].'"><ul class="inputs">
    					<li>
    						<div style="float:right"><input type="text" name="username" class="input" value="'.$userInfo['username'].'"></div>
    					'.__('Username').'<br /><small>'.__('Nickname of the user').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="pass" class="input" value=""></div>
    					'.__('Change password').'<br /><small>'.__("Fill this input if you want to change it's password").'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="email" class="input" value="'.$userInfo['email'].'"></div>
    						'.__('Email').'<br /><small>'.__('Email of the user').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="api" class="input" value="'.$userInfo['api'].'"></div>
    						'.__('API Code').'<br /><small>'.__('Used to access through the API').'</small>
    					</li>
    					<li>
    						<div style="float:right"><select class="input" name="status" style="width:311px">';
    					foreach (array('ok'=>__('Active'), 'nc'=>__('Not confirmed'), 'banned'=>__('Banned')) as $key=>$long) {
    						echo '<option value="'.$key.'"';
    						if ($key == $userInfo['status']) echo ' selected';
    						echo '>'.$long.'</option>';
    					}
    					echo '</select>
    						</div>
    						'.__('Status').'<br /><small>'.__('It can be active, banned..').'</small>
    					</li>
    					<li>
    						<fieldset id="shorters" style="border: 1px solid #ddd;-moz-border-radius:2px;-webkit-border-radius:2px"><legend>'.__('Profile').'</legend><br /><div style="padding-left:40px;margin-bottom:20px;width:110px">';
    					$avatar = getAvatar($userInfo['ID'], '48');
    					if (!$userInfo['gravatar'] && ($avatar != $jk->base."static/img/avatar/default_note.png")) echo '<div style="float:right;font-size:.8em"><input type="checkbox" name="avatar"> <img src="'.$jk->base.'static/img/trash.gif"></div>';
    					echo '<img src="'.getAvatar($userInfo['ID'], '48').'" style="border: 1px solid #ddd"></div>
    						<ul>
    						<li>
    							<div style="float:right"><input type="text" name="profile_name" class="input" value="'.$userInfo['realname'].'"></div>
    							'.__('Name').'<br /><small>'.__('Real name of the user').'</small>
    						</li>
    						<li>
    							<div style="float:right"><input type="text" name="profile_web" class="input" value="'.$userInfo['profile']['url'].'"></div>
    							'.__('Website').'<br /><small>'.__('Website of the user').'</small>
    						</li>
    						<li>
    							<div style="float:right"><input type="text" name="profile_location" class="input" value="'.$userInfo['location'].'"></div>
    							'.__('Location').'<br /><small>'.__('Location of the user').'</small>
    						</li>
    						<li>
    							<div style="float:right"><input type="text" name="profile_bio" class="input" value="'.$userInfo['profile']['bio'].'"></div>
    							'.__('Bio').'<br /><small>'.__('Description of the user').'</small>
    						</li>
    						</ul></fieldset>
    					</li>
    					<li>
    						<div style="float:right"><select class="input" name="language" style="width:311px">';
    					foreach (return_languages() as $short=>$lang) {
    						echo '<option value="'.$short.'"';
    						if ($short == $userInfo['language']) echo ' selected';
    						echo '>'.$lang.'</option>';
    					}
    					echo '</select>
    						</div>
    						'.__('Language').'<br /><small>'.__('Language of the user').'</small>
    					</li>
    					<li>
    						<div style="float:right"><select class="input" name="theme" style="width:311px">';
    					foreach ($jk->allowed_themes as $theme) {
    						echo '<option value="'.$theme.'"';
    						if ($theme == $userInfo['theme']) echo ' selected';
    						echo '>'.$theme.'</option>';
    					}
    					echo '</select>
    						</div>
    						'.__('Theme').'<br /><small>'.__('Skin of Jisko').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="invitations" class="input" value="'.$userInfo['invitations'].'"></div>
    						'.__('Number of invitations').'<br /><small>'.__('Number of invitations that the user has').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="openid" class="input" value="'.$userInfo['openid'].'"></div>
    						'.__('OpenID').'<br /><small>'.__('Used to access Jisko trough an OpenID account').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="facebook" class="input" value="'.$userInfo['facebook'].'"></div>
    						'.__('Facebook ID').'<br /><small>'.__('Used to access Jisko trough a Facebook account').'</small>
    					</li>
    					</ul>
    					<br /><input type="submit" value="'.__('Save').'"><br /><br /></form>';
    				}
    				else header('Location: '.coreLink('admin', 'users'));
    			}

  3. Warning: session_start() [function.session-start]: open(/home/a3443899/temporary/sessions/sess_3abc47bbd2f073e35734d72fe89ac33a, O_RDWR) failed: No such file or directory (2) in /home/a3443899/public_html/include/config.php on line 17

     

     

     

    Warning: require_once(/home/a3443899/smarty/libs/Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/a3443899/public_html/include/config.php on line 32

     

     

     

    Fatal error: require_once() [function.require]: Failed opening required '/home/a3443899/smarty/libs/Smarty.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a3443899/public_html/include/config.php on line 32

     

     

     

    Warning: Unknown: open(/home/a3443899/temporary/sessions/sess_3abc47bbd2f073e35734d72fe89ac33a, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

     

     

     

    Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/a3443899/temporary/sessions) in Unknown on line 0

     

     

  4. I had some errors in my script but I solved the most of them except two:

     

    Warning: require_once(/home/a3443899/smarty/libs/Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/a3443899/public_html/include/config.php on line 32

     

    Fatal error: require_once() [function.require]: Failed opening required '/home/a3443899/smarty/libs/Smarty.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a3443899/public_html/include/config.php on line 32

     

    And I checked the map what he couldn't open the map names are just good

    Here is the config.php script:

    <?
    $config = array();
    
    // Begin Configuration
    // This Template was Downloaded From GrabTemplates.com
    $config['basedir']     =  'something';
    $config['baseurl']     =  'something';
    
    $DBTYPE = 'mysql';
    $DBHOST = 'my host';
    $DBUSER = 'my username';
    $DBPASSWORD = 'my pass';
    $DBNAME = 'my dbname';
    // End Configuration
    
    ini_set('session.save_path', $config['basedir']. '/temporary/sessions');
    session_start;
    
    $config['adminurl']      =  $config[baseurl].'/administrator';
    $config['cssurl']      =  $config[baseurl].'/css';
    $config['imagedir']      =  $config[basedir].'/images';
    $config['imageurl']      =  $config[baseurl].'/images';
    $config['picdir']      =  $config[basedir].'/pics';
    $config['picurl']      =  $config[baseurl].'/pics';
    $config['tpicdir']      =  $config[basedir].'/pics/thumbs';
    $config['tpicurl']      =  $config[baseurl].'/pics/thumbs';
    $config['membersprofilepicdir']      =  $config[imagedir].'/membersprofilepic';
    $config['membersprofilepicurl']      =  $config[imageurl].'/membersprofilepic';
    $config['mbgdir']      =  $config[imagedir].'/mbg';
    $config['mbgurl']      =  $config[imageurl].'/mbg';
    
    require_once($config[basedir].'/smarty/libs/Smarty.class.php');
    require_once($config[basedir].'/libraries/mysmarty.class.php');
    require_once($config[basedir].'/libraries/SConfig.php');
    require_once($config[basedir].'/libraries/SError.php');
    require_once($config[basedir].'/libraries/adodb/adodb.inc.php');
    require_once($config[basedir].'/libraries/phpmailer/class.phpmailer.php');
    require_once($config[basedir].'/libraries/SEmail.php');
    
    function strip_mq_gpc($arg)
    {
      if (get_magic_quotes_gpc())
      {
      	$arg = str_replace('"',"'",$arg);
      	$arg = stripslashes($arg);
        return $arg;
      } 
      else
      {
        $arg = str_replace('"',"'",$arg);
        return $arg;
      }
    }
    
    $conn = &ADONewConnection($DBTYPE);
    $conn->PConnect($DBHOST, $DBUSER, $DBPASSWORD, $DBNAME);
    @mysql_query("SET NAMES 'UTF8'");
    $sql = "SELECT * from config";
    $rsc = $conn->Execute($sql);
    
    if($rsc){while(!$rsc->EOF)
    {
    $field = $rsc->fields['setting'];
    $config[$field] = $rsc->fields['value'];
    STemplate::assign($field, strip_mq_gpc($config[$field]));
    @$rsc->MoveNext();
    }}
    
    if ($_REQUEST['language'] != "")
    {
    if ($_REQUEST['language'] == "english")
    {
    	SESSION_REGISTER("language");
    	$_SESSION[language] = "english";
    }
    elseif ($_REQUEST['language'] == "spanish")
    {
    	SESSION_REGISTER("language");
    	$_SESSION[language] = "spanish";
    }
    elseif ($_REQUEST['language'] == "french")
    {
    	SESSION_REGISTER("language");
    	$_SESSION[language] = "french";
    }
    }
    
    if ($_SESSION['language'] == "")
    {
    SESSION_REGISTER("language");
    $_SESSION[language] = "english";
    }
    
    if ($_SESSION['language'] == "english")
    {
    include("lang/english.php");
    }
    elseif ($_SESSION['language'] == "spanish")
    {
    include("lang/spanish.php");
    }
    elseif ($_SESSION['language'] == "french")
    {
    include("lang/french.php");
    }
    else
    {
    include("lang/english.php");
    }
    
    for ($i=0; $i<count($lang)+1; $i++)
    {
    STemplate::assign('lang'.$i, $lang[$i]);
    }
    
    STemplate::assign('baseurl',       $config['baseurl']);
    STemplate::assign('basedir',       $config['basedir']);
    STemplate::assign('adminurl',       $config['adminurl']);
    STemplate::assign('cssurl',       $config['cssurl']);
    STemplate::assign('imagedir',        $config['imagedir']);
    STemplate::assign('imageurl',        $config['imageurl']);
    STemplate::assign('picdir',        $config['picdir']);
    STemplate::assign('picurl',        $config['picurl']);
    STemplate::assign('tpicdir',        $config['tpicdir']);
    STemplate::assign('tpicurl',        $config['tpicurl']);
    STemplate::assign('membersprofilepicdir',        $config['membersprofilepicdir']);
    STemplate::assign('membersprofilepicurl',        $config['membersprofilepicurl']);
    STemplate::assign('mbgdir',        $config['mbgdir']);
    STemplate::assign('mbgurl',        $config['mbgurl']);
    STemplate::setCompileDir($config['basedir']."/temporary");
    STemplate::setTplDir($config['basedir']."/themes");
    
    ?>

  5. Hi, I am making a website where I would like to add titles in it.

    Such as if you posted 100 message you get the title <<Enthousiast>> (Such as this forum haves)

     

    Where can I find a script like that?

  6. I earlier posted a topic about this, But I got a mail.php file now.

    I have a problem with the valiadation email because it doesn't send.

    Here is the code:

    <?php
    // Jisko: An open-source microblogging application
    // Copyright (C) 2008-10 Rubén Díaz <outime@gmail.com>
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as
    // published by the Free Software Foundation, either version 3 of the
    // License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    class mailing
    {
    var $email;
    var $headers;
    var $subject;
    var $text;
    
    function sendMail($email, $subject, $html_subject, $text, $notifications = false, $admin = false, $language = false)
    {
    	global $jk;
    
    	$headers = "MIME-Version: 1.0\r\n";
    	$headers .= "Content-type: text/html; charset=UTF-8\r\n";
    	$headers .= "From: ".$jk->name." <".$jk->admin_mail.">";
    
    	$text = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /></head><body><style type="text/css"> .footer a{color:#B9B7D0}</style><div id="contenedor"><a href="'.$jk->base.'"><img src="'.$jk->base.'static/img/logos/'.$jk->logo.'" style="border:0px;padding-left:30px;" alt="'.$jk->name.'" /></a><br /><br />
    <div class="title" style="padding:5px;padding-left:30px;padding-right:30px;font-family:Georgia,Tahoma;color:#08004D;height:40px"><h3 style="font-style:italic;font-size:20px">'.$html_subject.'</h3></div><div class="content" style="font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 17px;background:url(../themes/transparency/img/web_bg.png);border:1px solid #ddd;border-radius:4px;-moz-border-radius:4px;color:black;padding:5px;padding-left:30px;padding-right:30px;"> '.$text.'</div></div>';
    
    	$text .= $this->bottomMail($notifications, $admin, $language);
    
    	$text .= '</body></html>';
    
    	mail($email, $jk->name.' // '.$subject, $text, $headers);
    }
    
    function bottomMail($notifications = false, $admin = false, $language = false)
    {
    	global $gettext_tables;
    	global $jk;
    
    	$return = '<div class="footer" style="padding-top:5px;font-size:11px;color:#B9B7C0;font-family:"Lucida Grande",Arial,serif"><div style="float:right">Powered by <a href="http://www.jisko.org">Jisko</a></div>';
    
    	if ($language != false) {
    		if (file_exists(PATH.'locale/'.deflang($language).'/LC_MESSAGES/messages.mo')) {
    			$gettext_tables = new gettext_reader(
    				new CachedFileReader(PATH.'locale/'.deflang($language).'/LC_MESSAGES/messages.mo')
    			);
    			$gettext_tables->load_tables();
    		}
    	}
    
    	if ($admin == false) {
    		if ($notifications) $return .= sprintf(__('Turn off this notifications at %s'), '<a href="'.coreLink('settings', 'config').'">'.coreLink('settings', 'config').'</a>')."<br />";
    
    		$return .= sprintf(__('Have you got any problem? Contact the administrator at %s'), '<a href="'.coreLink('contact').'">'.coreLink('contact').'</a>').'<br />';
    		if ($jk->tos == true) $return .= '<br />'.sprintf(__('Since you got registered on %s, you agree with the Terms of Service (TOS) placed in %s'), $jk->name, '<a href="'.coreLink('tos').'">'.coreLink('tos').'</a>').'<br />';
    	}
    
    	if ($language != false) {
    		if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    			$gettext_tables = new gettext_reader(
    				new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    			);
    			$gettext_tables->load_tables();
    		}
    	}
    
    	return $return.'</div>';
    }
    
    function forgottenPassword($email, $uid, $token)
    {
    	global $gettext_tables;
    	global $db;
    
    	$userInfo = $db->getUserOptions($uid, array('username', 'language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%username', '<a href="'.coreLink($userInfo['username']).'">'.$userInfo['username'].'</a>', __("Someone (probably you) has just requested a password reset for the account with %username as the username. Because we need to confirm the request, please click the link placed below in order to continue the process:")).'<br /><br /><a href="'.coreLink(array('uid='.$uid, 'key='.$token), 'trouble_login').'">'.coreLink(array('uid='.$uid, 'key='.$token), 'trouble_login').'</a><br /><br />'.__("Please remember that this link will expire in 24h, so if you didn't request a password change, simply ignore this email");
    
    	$this->sendMail($email, __('Password reset instructions'), __('Password reset'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function resetPassword($email, $new_password, $userID)
    {
    	global $gettext_tables;
    	global $db;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = __("We have received your request for changing your password and here is your new password:").'<br /><br />';
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">'.$new_password.'</div><br />';
    	$text .= sprintf(__('Remember that you can change your password at %s'), '<a href="'.coreLink('settings', 'config').'">'.coreLink('settings', 'config').'</a>');
    
    	$this->sendMail($email, __('Your new password'), __('Your new password'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function newFollower($userID, $content)
    {
    	global $gettext_tables;
    	global $_USER;
    	global $db;
    
    	$userInfo = $db->getUserOptions($userID, array('language', 'email'));
    
    	if (file_exists(PATH.'locale/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'locale/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$notes = $db->countNotes('archive', $_USER['ID']);
    	$followers = $db->countFollowers($_USER['ID']);
    	$following = $db->countFollowing($_USER['ID']);
    
    	$subject = __("%real_or_username is now following you");
    	$text = str_replace('%real_or_username', '<a href="'.coreLink($_USER['username']).'">'.utf8_htmlentities($content).'</a>', str_replace('%name', $jk->name, __("%real_or_username is now following your updates on %name"))).'<br /><br />';
    
    	$text .= '<div style="padding: 10px;padding-bottom:20px;background-color:#D9D9D9"><div style="float:right;width:90%;margin-bottom:5px">'.$notes.' '.__('notes').'<br />'.$followers.' '.__('followers').'<br />'.sprintf(__('following %s users'), $following).'</div><img src="'.getAvatar($_USER['ID'], 48).'" height="48" width="48"></div><br /><br />'.sprintf(__('You can check his/her profile at %s'), coreLink($_USER['username']));
    
    	$subject = str_replace('%real_or_username', $content, $subject);
    	$text = str_replace('%name', $jk->name, $text);
    
    	$this->sendMail($userInfo['email'], $subject, __('New follower'), $text, true, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function newPrivateNote($userInfo, $note, $USER, $attached_file = false, $id = false)
    {
    	global $gettext_tables;
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$subject = __("Private message from %real_or_username");
    
    	if ($USER['realname']) $content = $USER['realname'].' ('.$USER['username'].')';
    	else $content = $USER['username'];
    
    	$text = str_replace('%real_or_username', '<a href="'.coreLink($_USER['username']).'">'.$content.'</a>', __('%real_or_username has sent you a private message:'))."<br /><br />";
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities($note).'</div><br />';
    	if ($attached_file) {
    		$text .= sprintf(__('With the following attachment: %s'), coreLink('download', $id, $attached_file))."<br /><br />";
    	}
    	$text .= str_replace('%username', $USER['username'], str_replace('%base', coreLink('notes', 'private'), __("You can reply to this message by sending a note with \"!%username <your message>\" or through the web interface at %base")));
    
    	$subject = str_replace('%real_or_username', $content, $subject);
    
    	$this->sendMail($userInfo['email'], $subject, __('New private message'), $text, true, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function newReplyNote($userInfo, $note, $note1, $note2 = false, $attached_file = false)
    {
    	global $gettext_tables;
    	global $db;
    	global $_USER;
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	if ($_USER['realname']) $content = $_USER['realname'].' ('.$_USER['username'].')';
    	else $content = $_USER['username'];
    
    	$subject = str_replace('%real_or_username', $content, __("Reply from %real_or_username"));
    
    	$text = str_replace('%real_or_username', $content, __('%real_or_username has replied or mentioned you in the following note:'))."<br /><br />";
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities(stripslashes($note)).'</div><br />';
    	if ($attached_file) $text .= sprintf(__('With the following attachment: %s'), coreLink('download', $note1, $attached_file))."<br /><br />";
    	$text .= __('Permalink:').' <a href="'.coreLink($_USER['username'], $note1).'">'.coreLink($_USER['username'], $note1).'</a>';
    	if ($note2) {
    		$noteInfo = $db->getTextFromNoteID($note2);
    		$text .= '<br /><br />'.__("This note was replying to:").'<br /><br /><div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities(stripslashes($db->getTextFromNoteID($note2))).'</div><br />'.__('Permalink:').' <a href="'.coreLink($userInfo['username'], $note2).'">'.coreLink($userInfo['username'], $note2).'</a>';
    	}
    
    	$this->sendMail($userInfo['email'], $subject, $subject, $text, true, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function confirmRegistration($email, $user_id, $token)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($user_id, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$subject = str_replace('%name', $jk->name, __('Confirmation for %name account'));
    
    	$text = __('Someone (probably you) has requested an account in %name. However, we need to know if you are the owner of this mail account.');
    	$text .= '<br />'.__('To confirm it, please click in the link placed below:').'<br /><br /><a href="'.coreLink(array('uid='.$user_id, 'key='.$token), 'register').'">'.coreLink(array('uid='.$user_id, 'key='.$token), 'register').'</a><br /><br />';
    	$text .= __("If you didn't request an account at %name, ignore this mail and apologies for the inconvenience.");
    
    	$text = str_replace('%name', $jk->name, $text);
    
    	$this->sendMail($email, $subject, __('Account confirmation'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function emailChange($email, $user_id, $new_email, $token)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserInfo($user_id);
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%name', $jk->name, __("Someone (probably you) has requested a change of the email assigned to your account in %name. Your new email will be:")).'<br /><br /><div style="padding: 10px;background-color:#D9D9D9">'.$new_email.'</div><br /><br />'.__('If you requested this change, then confirm it by clicking the link placed below:').'<br /><br/><a href="'.coreLink(array('confirm', 'key='.$token), 'settings', 'config').'">'.coreLink(array('confirm', 'key='.$token), 'settings', 'config').'</a><br /><br />'.__("Otherwise, if you didn't request this change, then simply ignore this message, because this link will expire in 24h");
    
    	$this->sendMail($email, __('Confirm email change'), __('Email change'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function registrationSuccess($email, $username)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = __("Welcome to %name").'<br /><br />';
    	$text .= str_replace('%p_url', '<a href="'.coreLink('settings', 'profile').'">'.coreLink('settings', 'profile').'</a>', __('You have just confirmed your account in %name, so now you can start personalizing your profile at %p_url!'));
    	$text .= '<br /><br />'.__('%name is based on Jisko, an open-source microblogging platform. You can find more information about Jisko at http://www.jisko.org').'<br /><br />'.__('Thank you very much for signing up in %name and for giving us a try!');
    
    	$text = str_replace('%name', $jk->name, $text);
    
    	$this->sendMail($email, __('Welcome!'), __('Welcome!'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function alertNewUser($username)
    {
    	global $jk;
    
    	$subject = __("There's a new user on %name");
    
    	$text = __("A new user called %username has joined %name.").'<br /><br />'.__("It should be empty, but if you want, you can check his profile at %url");
    
    	$subject = str_replace('%name', $jk->name, $subject);
    	$text = str_replace('%username', '<span style="text-decoration:underline">'.$username.'</span>', str_replace('%name', $jk->name, $text));
    	$text = str_replace('%url', '<a href="'.coreLink($username).'">'.coreLink($username).'</a>', $text);
    
    	$this->sendMail($jk->admin_mail, $subject, __('New account'), $text, false, true);
    }
    
    function alertDelUser($uid)
    {
    	global $db;
    	global $jk;
    
    	$uinfo = $db->getUserOptions($uid, array('username', 'email'));
    
    	$subject = __("The user %username has deleted his account from %name");
    
    	$text = __("The user %username has deleted his account from %name.").'<br /><br/>'.__("If you want to contact him, his email is %email");
    
    	$subject = str_replace('%name', $jk->name, str_replace('%username', $uinfo['username'], $subject));
    	$text = str_replace('%username', '<span style="text-decoration:underline">'.$username.'</span>', str_replace('%name', $jk->name, $text));
    	$text = str_replace('%email', $uinfo['email'], $text);
    
    	$this->sendMail($jk->admin_mail, $subject, __('Deleted account'), $text, false, true);
    }
    
    function newInvitation($email, $token)
    {
    	global $gettext_tables;
    	global $_USER, $jk;
    
    	$subject = __('%username has invited you to %name!');
    
    	$text = __("Hey!").'<br /><br />'.__("%username just sent you an invitation for using %name! %name is a microblogging portal where you can share your own experiences and your feelings about everything.").'<br/><br />'.__("Why don't you give %name a try and register?").'<br/><br />'.__('Click on the following link in order to use your invitation to %name').'<br /><br /><div style="padding: 10px;background-color:#D9D9D9"><a href="'.coreLink(array('token='.$token), 'register').'">'.coreLink(array('token='.$token), 'register').'</a></div><br /><br />'.__('Thank you and have fun on %name!');
    
    	$subject = str_replace('%username', $_USER['username'], str_replace('%name', $jk->name, $subject));
    	$text = str_replace('%username', '<a href="'.coreLink($_USER['username']).'">'.$_USER['username'].'</a>', str_replace('%name', $jk->name, $text));
    
    	$this->sendMail($email, $subject, sprintf(__('Invitation to %s'), $jk->name), $text);
    }
    
    function passwordChange($email, $userID, $ip)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%name', $jk->name, __("We send this mail to tell you that your password on %name has been changed.")).'<br /><br />';
    	$text .= str_replace('%ip', $ip, str_replace('%contact_page', '<a href="'.coreLink('contact').'">'.coreLink('contact').'</a>', __('This change was requested from the ip %ip. If you were not the user who changed your password, please contact the administrator at %contact_page')));
    
    	$this->sendMail($email, __('Your password has been changed'), __('Your password has been changed'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function confirmDrop($email, $username, $userID, $token)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%name', $jk->name, str_replace('%contact_page', coreLink('contact'), __("Are you sure you want to delete your %name account? If you are having problems with %name, remember that you can contact us through %contact_page and we will take notes about your issues/suggestions.")));
    	$text .= '<br /><br />'.__("If you're are completely sure of your decision (remember, this is NOT REVERSIBLE), please click the link placed below:");
    	$text .= str_replace('%drop_url', '<a href="'.coreLink(array('key='.$token, 'confirm'), 'drop_account').'">'.coreLink(array('key='.$token, 'confirm'), 'drop_account').'</a>', '<br /><br />%drop_url<br /><br />').__('You must be logged in order to delete your account and remember that this request will expire in 24h.').'<br /><br />'.__('We will miss you!');
    
    	$this->sendMail($email, __('Delete account confirmation'), __('Delete account confirmation'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function sendMessage($email, $message, $ip, $username = false, $copy = false)
    {
    	global $gettext_tables;
    	global $jk;
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	if (!$username) $subject = __('Someone has sent you a message through the Contact page');
    	else $subject = sprintf(__('%s has sent you a message through the Contact page'), $username);
    
    	$text = __('Someone has decided to contact you through the contact page of your Jisko installation. Here are the details:')."<br /><br />";
    	if ($username) $text .= sprintf('Username: %s', '<a href="'.coreLink($username).'">'.$username.'</a>')." - ";
    	$text .= sprintf('IP: %s', '<a href="http://www.geoip.co.uk/?IP='.$ip.'">'.$ip.'</a>')." - ";
    	$text .= sprintf('Email: %s', $email);
    
    	$text .= '<br /><br /><div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities($message).'</div><br />';
    	$text .= __("Please remember that you can only reply this message through the email provided. Otherwise, he won't see your answer");
    
    	$this->sendMail($jk->admin_mail, $subject, __('New message received'), $text, false, true);
    	if ($copy) $this->sendMail($email, $subject, __('New message received'), $text, false, true);
    }
    
    function reportAbuse($user_id, $reported_username, $ip)
    {
    	global $gettext_tables;
    	global $db;
    	global $_USER;
    	global $jk;
    
    	$subject = str_replace('%username', $_USER['username'], str_replace('%r_username', $reported_username, __("%username reported the user %r_username")));
    
    	$text = __("The user %username (ID: %id) from the IP %ip reported the user %r_username (ID: %r_id).");
    
    	$text = str_replace('%username', '<a href="'.coreLink($_USER['username']).'">'.$_USER['username'].'</a>', str_replace('%r_username', '<a href="'.coreLink($reported_username).'">'.$reported_username.'</a>', $text));
    	$text = str_replace('%id', $_USER['ID'], str_replace('%ip', '<a href="http://www.geoip.co.uk/?IP='.$ip.'">'.$ip.'</a>', $text));
    	$text = str_replace('%r_id', $user_id, $text);
    
    	$this->sendMail($jk->abuse_mail, $subject, __('New abuse report'), $text, false, true);
    }
    
    function reportAbuseNote($result, $ip)
    {
    	global $gettext_tables;
    	global $db;
    	global $_USER;
    	global $jk;
    
    	$subject = __("%username reported the note %r_note");
    
    	$text = __("The user %username (ID: %id) from the IP %ip reported the note %r_note made by %r_username (ID: %r_id).")."<br /><br />";
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">%content</div><br /><br />'.__('Permalink:').' %link';
    
    	$subject = str_replace('%username', $_USER['username'], str_replace('%r_note', '#'.$result['ID'], $subject));
    	$text = str_replace('%username', '<a href="'.coreLink($_USER['username']).'">'.$_USER['username'].'</a>', str_replace('%id', $_USER['ID'], $text));
    	$text = str_replace('%ip', '<a href="http://www.geoip.co.uk/?IP='.$ip.'">'.$ip.'</a>', str_replace('%r_note', '<a href="'.coreLink($result['username'], $result['ID']).'">#'.$result['ID'].'</a>', $text));
    	$text = str_replace('%r_id', $result['ID'], str_replace('%r_username', '<a href="'.coreLink($result['username']).'">'.$result['username'].'</a>', $text));
    	$text = str_replace('%content', utf8_htmlentities(put_smileys($result['note'])), str_replace('%link', coreLink($result['username'], $result['ID']), $text));
    
    	$this->sendMail($jk->abuse_mail, $subject, __('New abuse report'), $text, false, true);
    }
    }
    
    ?>

  7. Try to add flaggs with the languages on your website and then link a flag to the frontpage with the differend language.  :D

    And PS this is not PHP coding, so please post it on a HTML coding forum.

    I don't know if this is the solution because I don't really get you  :-\

  8. Hi, I have a problem with my email validation.

    It doesn't send people the mail to active their account, but I didn't found a glitch in it  :-\

    Here is the registration code:

    <?php
    // Jisko: An open-source microblogging application
    // Copyright (C) 2008-10 Rubén Díaz <outime@gmail.com>
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as
    // published by the Free Software Foundation, either version 3 of the
    // License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    global $db;
    global $_USER;
    global $mailing, $jk;
    
    if ($_USER) header('Location: '.$jk->base);
    else {
    global $allowed, $sidebar;
    $sidebar = 'login';
    
    $allowed = check_invitation($_REQUEST['token']);
    
    if (!$_POST) {
    	$jk->title = __('Register');
    
    	$jk->load('functions');
    	$jk->load('header');
    
    	if ($_GET) {
    		if (isset($_GET['ok'])) {
    			if (!isEmailConfirmationEnabled()) {
    				echo showStatus(__('Check your email (including SPAM) to activate your account'), 'ok');
    			}
    			else echo showStatus(__('You can access now with your account, thank you!'), 'ok');
    		}
    		elseif (($_GET['key']) and ($_GET['uid'])) {
    			$result = $db->checkRegKey($_GET['key'], $_GET['uid']);
    			if ($result) {
    				echo showStatus(__('You can access now with your account, thank you!'), 'ok');
    				$db->updateUserOptions($_GET['uid'], array('status' => 'ok'));
    				$db->deleteKey($_GET['key'], $_GET['uid']);
    				$userInfo = $db->getUserInfo($_GET['uid']);
    				$mailing->registrationSuccess($userInfo['email'], $userInfo['ID']);
    				if ($jk->alert_on_newuser == true) $mailing->alertNewUser($userInfo['username']);
    			} else {
    				echo showStatus(__('Invalid confirmation code!'), 'error');
    			}
    		}
    	}
    	if ($_GET['error']) {
    		$error = $_GET['error'];
    
    		switch ($error) {
    			case 'invalidtoken':
    				$error = __('You need a valid token to register an account!');
    				break;
    			case 'invalidmail':
    				$error = __('Sorry! The provided email is invalid');
    				break;
    			case 'tos':
    				$error = __('You must accept the Terms of Service (TOS)');
    				break;
    			case 'takenuser':
    				$error = __('Taken username, please choose another!');
    				break;
    			case 'takenmail':
    				$error = __('Email is taken, please choose another!');
    				break;
    			case 'pass':
    				$error = __("Passwords don't match!");
    				break;
    			case 'recaptcha':
    				$error = __('Incorrect reCAPTCHA code!');
    				break;
    			case 'user':
    				$error = __("Sorry! Your choosen username appears to be invalid");
    				break;
    			case 'create':
    				$error = __('There was a problem while trying to create your user');
    				break;
    		}
    
    		if ($error) echo showStatus($error, 'error');
    	}
    
    	$jk->load('register');
    	$jk->load('sidebar');
    	$jk->load('footer');
    }
    else {
    	if ($allowed) {
    		global $mailing;
    
    		if (recaptcha_enabled()) import('recaptchalib');
    		$token = $_POST['token'];
    
    		if (!check_invitation($token)) header('Location: '.coreLink(array('error=invalidtoken'), 'register'));
    		else {
    			if (!$_POST['legal'] && ($jk->tos == true)) header('Location: '.coreLink(array('error=tos'), 'register'));
    			else {
    				$username = $_POST['username'];
    				$email = $_POST['email'];
    				$salt = substr(md5(rand()), 0, 5);
    				$api = substr(md5($_POST['username'].rand()), 0, 16);
    				$password = md5(md5($_POST['password']).md5($salt));
    				$password2 = md5(md5($_POST['password2']).md5($salt));
    				$ip = $_SERVER['REMOTE_ADDR'];
    				$language = $_POST['language'];
    
    				if ($_POST['openid']) {
    					if (filter_var($_POST['openid'], FILTER_VALIDATE_URL)) {
    						if (!$db->checkOpenID($_POST['openid'])) {
    							import('openid/functions');
    							import('openid/class.dopeopenid');
    							$openid = new Dope_OpenID($_POST['openid']);
    							$openid->setReturnURL($jk->base);
    							$openid->SetTrustRoot($jk->base);
    							$openid->setOptionalInfo(array('nickname', 'language', 'email'));
    							$endpoint_url = $openid->getOpenIDEndpoint();
    							if ($endpoint_url) $openidz = $openid->getIdentity();
    							else $openidz = false;
    						}
    					}
    					else $openidz = false;
    				}
    				else $openidz = false;
    				if ($_POST['fbid']) {
    					if (!empty($_POST['fbid'])) {
    						if (!$db->checkFacebook($_POST['fbid'])) $fbidz = $_POST['fbid'];
    						else $fbidz = false;
    					}
    					else $fbidz = false;
    				}
    				else $fbidz = false;
    
    				if (!isEmailConfirmationEnabled()) $noc = false; else $noc = true;
    				if (recaptcha_enabled()) $human = recaptcha_check_answer($jk->recaptcha_privatekey, $ip, $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
    
    				$validUsr = validUsername($username, true);
    
    				if ($validUsr != 'valid') {
    					if ($validUsr == 'busy') header('Location: '.coreLink(array('error=takenuser'), 'register'));
    					elseif ($validUsr == 'invalid') header('Location: '.coreLink(array('error=user'), 'register'));
    				}
    				else {
    					if ($db->checkEmail($email)) header('Location: '.coreLink(array('error=takenmail'), 'register'));
    					else {
    						if (!$fbidz && !$openidz && ($password != $password2)) header('Location: '.coreLink(array('error=pass'), 'register'));
    						else {
    							if (recaptcha_enabled() && !$human->is_valid) header('Location: '.coreLink(array('error=recaptcha'), 'register'));
    							else {
    								if (!filter_var($email, FILTER_VALIDATE_EMAIL)) header('Location: '.coreLink(array('error=invalidmail'), 'register'));
    								else {
    									if (!mkdir(PATH."users_files/$username", 0777) || (!mkdir(PATH."users_files/$username/img", 0777) || (!mkdir(PATH."users_files/$username/img/avatar", 0777) || (!mkdir(PATH."users_files/$username/img/background", 0777) || (!mkdir(PATH."users_files/$username/files", 0777)))))) {
    										header('Location: '.coreLink(array('error=create'), 'register'));
    									}
    									else {
    										$tmpKey = substr(md5(rand()), 0, 6);
    
    										if ($fbidz || ($openidz)) $password = '';
    
    										$newUser = $db->newUser(
    											$username,
    											$password,
    											$api,
    											$salt,
    											$language,
    											$jk->default_theme,
    											$email,
    											$ip,
    											$tmpKey,
    											$noc,
    											$openidz,
    											$fbidz
    										);
    
    										if (!empty($token)) $db->deleteToken($token);
    
    										if ($noc == false) {
    											$mailing->confirmRegistration($email, $newUser, $tmpKey);
    										}
    
    										header('Location: '.coreLink(array('ok'), 'register'));
    									}
    								}
    							}
    						}
    					}
    				}
    			}
    		}
    	}
    	else {
    		header('Location: '.coreLink(array('error=invalidtoken'), 'register'));
    	}
    }
    }
    
    ?>

  9. Hi, if I want to ban a user or change the data of the user he doesn't save it, I searched the whole script on a glitch but I don't found anything. I hope you can help me  :D

    Here is the code:

    <?php
    // Jisko: An open-source microblogging application
    // Copyright (C) 2008-10 Rubén Díaz <outime@gmail.com>
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as
    // published by the Free Software Foundation, either version 3 of the
    // License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    global $db;
    global $_USER;
    global $jk;
    global $globals;
    
    if ($_USER) {
    if (checkAdminPermissions($_USER['ID'], 'can_panel')) {
    	if ($_POST) {
    		switch (PARAMS) {
    		case 'misc':
    			if (get_magic_quotes_gpc()) {
    				$_POST['tos'] = stripslashes(nl2br($_POST['tos']));
    				$_POST['homepage'] = stripslashes(nl2br($_POST['homepage']));
    				$_POST['faq'] = stripslashes(nl2br($_POST['faq']));
    			}
    
    			foreach (array('tos', 'homepage', 'faq') as $a) $_POST[$a] = mysql_real_escape_string(str_replace("\r\n", '', str_replace("\r", '', str_replace("\n", '', nl2br($_POST[$a])))));
    
    			$db->updateJiskoSettings(array(
    					'tos_content' => $_POST['tos'],
    					'homepage_content' => $_POST['homepage'],
    					'faq_content' => $_POST['faq']
    				));
    			header('Location: '.coreLink(array('ok'), 'admin', 'misc'));
    			break;
    		case 'themes':
    			if ($jk->default_theme != $_POST['default']) $return['default_theme'] = mysql_real_escape_string($_POST['default']);
    			if ($jk->allowed_themes != $_POST['allowed']) $return['allowed_themes'] = mysql_real_escape_string(serialize($_POST['allowed']));
    
    			if (count($return) > 0) $db->updateJiskoSettings($return);
    			header('Location: '.coreLink(array('ok'), 'admin', 'themes'));
    			break;
    		case 'general':
    			if ($jk->name != trim($_POST['name'])) {
    				if (!empty($_POST['name'])) $return['name'] = trim($_POST['name']);
    			}
    			if ($jk->separator != $_POST['separator']) $return['separator'] = $_POST['separator'];
    			if ($jk->base != trim($_POST['baseURL'])) {
    				if (filter_var($_POST['baseURL'], FILTER_VALIDATE_URL)) $return['base_url'] = trim($_POST['baseURL']);
    			}
    			if ($jk->admin_mail != trim($_POST['admin_mail'])) {
    				if (filter_var($_POST['admin_mail'], FILTER_VALIDATE_EMAIL)) $return['admin_mail'] = trim($_POST['admin_mail']);
    			}
    			if ($jk->abuse_mail != trim($_POST['abuse_mail'])) {
    				if (filter_var($_POST['abuse_mail'], FILTER_VALIDATE_EMAIL)) $return['abuse_mail'] = trim($_POST['abuse_mail']);
    			}
    			if ($jk->cron_password != trim($_POST['cron_pw'])) {
    				if (!empty($_POST['cron_pw'])) $return['cron_pw'] = $_POST['cron_pw'];
    			}
    			$clean_urls = ($_POST['cleanURLs'] == 'on' ? true : false);
    			$enable_mbstring = ($_POST['enable_mbstring'] == 'on' ? true : false);
    			$is_debug = ($_POST['is_debug'] == 'on' ? true : false);
    
    			if ($jk->cleanUrls != $clean_urls) $return['clean_urls'] = $clean_urls;
    			if ($jk->enable_mbstring != $enable_mbstring) $return['enable_mbstring'] = $enable_mbstring;
    			if ($jk->is_debug != $is_debug) $return['is_debug'] = $is_debug;
    
    			$denied_ext = explode(',', str_replace(' ', '', $_POST['denied_ext']));
    			if ($jk->denied_extensions != $denied_ext) $return['denied_extensions'] = serialize($denied_ext);
    
    			if (!empty($_FILES['logo']['tmp_name'])) {
    				$extension = strtolower(pathinfo($_FILES['logo']['name'], PATHINFO_EXTENSION));
    				if (in_array($extension, $globals['allowed_extensions'])) {
    					if ($_FILES['logo']['error'] == 0) {
    						$lname = 'logo_'.substr(md5(rand()), 0, 6).'.'.$extension;
    						if (copy($_FILES['logo']['tmp_name'], PATH.'static/img/logos/'.$lname)) {
    							$return['logo'] = $lname;
    						}
    					}
    				}
    			}
    
    			if ($jk->meta_keywords != $_POST['meta_keywords']) $return['meta_keywords'] = $_POST['meta_keywords'];
    			if ($jk->meta_description != $_POST['meta_description']) $return['meta_description'] = $_POST['meta_description'];
    			if ($jk->meta_robots != $_POST['meta_robots']) $return['meta_robots'] = $_POST['meta_robots'];
    			if ($jk->maintenance != $_POST['maintenance']) $return['maintenance'] = $_POST['maintenance'];
    
    			if (count($return) > 0) $db->updateJiskoSettings($return);
    			header('Location: '.coreLink(array('ok'), 'admin', 'general'));
    			break;
    		case 'environment':
    			if ($jk->wait_until_repost != trim($_POST['wait_repost'])) {
    				if (is_numeric($_POST['wait_repost'])) $return['wait_until_repost'] = (int)$_POST['wait_repost'];
    			}
    			if ($jk->wait_until_refollow != trim($_POST['wait_refollow'])) {
    				if (is_numeric($_POST['wait_refollow'])) $return['wait_until_refollow'] = (int)$_POST['wait_refollow'];
    			}
    			if ($jk->notes_per_page != trim($_POST['notes_per_page'])) {
    				if (is_numeric($_POST['notes_per_page'])) $return['notes_per_page'] = (int)$_POST['notes_per_page'];
    			}
    			if ($jk->ajax_refresh != trim($_POST['ajax_refresh'])) {
    				if (is_numeric($_POST['ajax_refresh'])) $return['ajax_refresh'] = (int)$_POST['ajax_refresh'];
    			}
    			if ($jk->default_lang != $_POST['language']) $return['language'] = $_POST['language'];
    			if ($jk->recaptcha_publickey != $_POST['recaptcha_public']) $return['recaptcha_publickey'] = $_POST['recaptcha_public'];
    			if ($jk->recaptcha_privatekey != $_POST['recaptcha_secret']) $return['recaptcha_secretkey'] = $_POST['recaptcha_secret'];
    			if ($jk->home_page != trim($_POST['home_page'])) $return['home_page'] = trim($_POST['home_page']);
    			if ($jk->fb_apikey != $_POST['fb_apikey']) $return['fb_apikey'] = $_POST['fb_apikey'];
    			if ($jk->fb_secretkey != $_POST['fb_secretkey']) $return['fb_secretkey'] = $_POST['fb_secretkey'];
    			if ($jk->tw_consumerkey != $_POST['tw_consumerkey']) $return['tw_consumerkey'] = $_POST['tw_consumerkey'];
    			if ($jk->tw_secretkey != $_POST['tw_secretkey']) $return['tw_secretkey'] = $_POST['tw_secretkey'];
    
    			$new_user = ($_POST['new_user'] == 'on' ? true : false);
    			$del_user = ($_POST['del_user'] == 'on' ? true : false);
    			$confirm_email = ($_POST['confirm_email'] == 'on' ? false : true);
    			$tos = ($_POST['tos'] == 'on' ? true : false);
    
    			if ($jk->use_invitations != $use_invitations) $return['use_invitations'] = $use_invitations;
    			if ($jk->alert_on_newuser != $new_user) $return['alert_on_newuser'] = $new_user;
    			if ($jk->alert_on_deluser != $del_user) $return['alert_on_deluser'] = $del_user;
    			if ($jk->no_confirmation_email != $confirm_email) $return['no_confirmation_email'] = $confirm_email;
    			if ($jk->tos != $tos) $return['tos'] = $tos;
    
    			if (count($return) > 0) $db->updateJiskoSettings($return);
    			header('Location: '.coreLink(array('ok'), 'admin', 'environment'));
    			break;
    		case 'users':
    			if ($_POST['userID']) {
    				$userInfo = $db->getUserInfo((int)$_POST['userID']);
    				if ($userInfo) {
    					if ($_POST['username'] != $userInfo['username']) $return['username'] = $_POST['username'];
    					if (!empty($_POST['password'])) {
    						global $mailing;
    						$salt = substr(md5(mt_rand()), 0, 5);
    						$new_password = md5(md5($_POST['password']).md5($salt));
    						$mailing->passwordChange($userInfo['email'], $userInfo['ID'], $_SERVER['REMOTE_ADDR']);
    						$return['salt'] = $salt;
    						$return['password'] = $new_password;
    					}
    					if ($_POST['email'] != $userInfo['email']) $return['email'] = $_POST['email'];
    					if ($_POST['api'] != $userInfo['api']) $return['api'] = $_POST['api'];
    					if ($_POST['status'] != $userInfo['status']) $return['status'] = $_POST['status'];
    					if ($_POST['profile_name'] != $userInfo['realname']) $return['realname'] = $_POST['profile_name'];
    					if ($_POST['profile_web'] != $userInfo['profile']['web']) $profile['url'] = $_POST['profile_web'];
    					if ($_POST['profile_location'] != $userInfo['location']) $return['location'] = $_POST['profile_location'];
    					if ($_POST['profile_bio'] != $userInfo['profile']['bio']) $profile['bio'] = $_POST['profile_bio'];
    					if ($_POST['language'] != $userInfo['language']) $return['language'] = $_POST['language'];
    					if ($_POST['theme'] != $userInfo['theme']) $return['theme'] = $_POST['theme'];
    					if ($_POST['invitations'] != $userInfo['invitations']) $return['invitations'] = (int) $_POST['invitations'];
    					if ($_POST['openid'] !== $userInfo['openid']) $return['openid'] = $_POST['openid'];
    					if ($_POST['facebook'] !== $userInfo['facebook']) $return['facebook'] = $_POST['facebook'];
    
    					if (count($profile) > 0) $db->updateProfile((int)$_POST['userID'], $profile);
    					if (count($return) > 0) $db->updateUserOptions((int)$_POST['userID'], $return);
    				}
    			}
    
    			header('Location: '.coreLink(array('id='.$_POST['userID']), 'admin', 'users'));
    			break;
    		case 'shorter_urls':
    			if ($jk->allowed_shorter_service != $_POST['url_shorter']) $return['allowed_url_shorters'] = serialize($_POST['url_shorter']);
    			if ($jk->default_shorter_service != $_POST['default']) $return['default_url_shorter'] = $_POST['default'];
    			if ($jk->threely_apicode != $_POST['3ly']) $return['threely_apicode'] = $_POST['3ly'];
    			if ($jk->bitly_login != $_POST['bitly_login']) $return['bitly_login'] = $_POST['bitly_login'];
    			if ($jk->bitly_apicode != $_POST['bitly_apicode']) $return['bitly_apicode'] = $_POST['bitly_apicode'];
    
    			if (count($return) > 0) $db->updateJiskoSettings($return);
    			header('Location: '.coreLink(array('ok'), 'admin', 'shorter_urls'));
    			break;
    		default:
    			header('Location: '.coreLink('admin'));
    		}
    	}
    	else {
    		switch (PARAMS) {
    		case 'misc':
    			showAdminHeader(__('Miscellaneous'));
    
    			$tos_content = $db->getJiskoSettings(array('tos_content'));
    			$faq_content = $db->getJiskoSettings(array('faq_content'));
    			$hom_content = $db->getJiskoSettings(array('homepage_content'));
    
    			if (isset($_GET['ok'])) echo '<div class="ok">'.__('Settings updated!').'</div>';
    
    			echo '<form action="'.coreLink('admin', 'misc').'" method="post"><ul class="inputs" style="width:600px">
    			<li style="height:300px">
    				<div style="float:right"><textarea name="tos" rows="18" cols="44" style="padding:5px;border:1px solid #ddd">'.stripslashes(str_replace('<br>', "\n", str_replace('<br />', "\n", $tos_content['tos_content']))).'</textarea></div>
    				'.__('ToS Content').'<br /><small>'.__('Text that will be displayed when checking Terms of Service. HTML allowed').'</small>
    			</li>
    			<li style="height:300px">
    				<div style="float:right"><textarea name="faq" rows="18" cols="44" style="padding:5px;border:1px solid #ddd">'.stripslashes(str_replace('<br>', "\n", str_replace('<br />', "\n", $faq_content['faq_content']))).'</textarea></div>
    				'.__('FAQ Content').'<br /><small>'.__('Text that will be displayed when checking the FAQ. HTML allowed').'</small>
    			</li>
    			<li style="height:300px">
    				<div style="float:right"><textarea name="homepage" rows="18" cols="44" style="padding:5px;border:1px solid #ddd">'.stripslashes(str_replace('<br>', "\n", str_replace('<br />', "\n", $hom_content['homepage_content']))).'</textarea></div>
    				'.__('Homepage content').'<br /><small>'.__('Text that will be displayed when checking the default homepage. HTML allowed').'</small>
    			</li>
    			</ul><br /><input type="submit" value="'.__('Save').'"><br /><br /></form>';
    
    			showAdminFooter();
    			break;
    		case 'themes':
    			showAdminHeader(__('Themes'));
    
    			if (isset($_GET['ok'])) echo '<div class="ok">'.__('Settings updated!').'</div>';
    
    			$dir = PATH.'themes/';
    			if (is_dir($dir)) {
    				if ($dirfd = opendir($dir)) {
    					while (($file = readdir($dirfd)) !== false) {
    						if (is_dir($dir.$file)) {
    							if (is_file($dir.$file.'/info.xml')) {
    								$fd = fopen($dir.$file.'/info.xml', 'r');
    								$content = fread($fd, filesize($dir.$file.'/info.xml'));
    
    								$xml = new SimpleXMLElement($content);
    								if ($xml) {
    									$them = array(
    										'id' => $file,
    										'name' => $xml->name,
    										'license' => $xml->license
    									);
    									foreach ($xml->author as $author) {
    										$them['author'][] = array(
    											'name' => $author->name,
    											'website' => $author->website,
    											'email' => $author->email
    										);
    									}
    									$themes[] = $them;
    								}
    							}
    						}
    					}
    				}
    				else echo __('There was an error while trying to open the themes folder');
    			}
    			else echo __('There is no themes folder');
    
    			echo '<form action="'.coreLink('admin', 'themes').'" method="post">
    			<ul class="inputs">';
    
    			foreach ($themes as $theme) {
    				echo '
    				<li>
    					<div style="float:right"><input type="radio" name="default" value="'.$theme['id'].'"';
    				if ($jk->default_theme == $theme['id']) echo ' checked="checked"';
    				echo '"><span style="font-size:.8em">'.__('Default theme').'</span> </div>
    					'.$theme['name'].'<br /><small>';
    				for ($i=0;$i <= (count($theme['author'])-1);$i++) {
    					if ($theme['author'][$i]['email']) $email = '(<a href="mailto:'.$theme['author'][$i]['email'].'">'.$theme['author'][$i]['email'].'</a>)';
    					else $email = '';
    					if ($theme['author'][$i]['website']) $name = '<a href="'.$theme['author'][$i]['website'].'">'.$theme['author'][$i]['name'].'</a>';
    					else $name = $theme['author'][$i]['name'];
    
    
    					if ($i == 0) echo sprintf(__('by %s'), $name.' '.$email).'<br />';
    					else echo sprintf(__('and %s'), $name.' '.$email).'<br />';
    				}
    				echo '</small>
    				</li>
    				';
    			}
    			echo '<li>';
    			$allowed = $jk->allowed_themes;
    			if (!$allowed) $allowed = array();
    			echo '<fieldset id="shorters" style="border: 1px solid #ddd;-moz-border-radius:2px;-webkit-border-radius:2px"><legend>'.__('Allowed themes').'</legend><br /><ul>';
    			$i = 0;
    
    			$count = count($themes);
    
    			foreach ($themes as $theme) {
    				echo '<li';
    				if (($count > 1) && ($i%2 == 0)) echo ' style="float:right;width:250px"';
    				echo '><input type="checkbox" name="allowed[]" value="'.$theme['id'].'"';
    				if (in_array($theme['id'], $allowed)) echo ' checked';
    				echo '> '.$theme['name'].'</li>';
    				$i++;
    			}
    			echo '</ul></fieldset>
    			</li>
    			</ul><br /><input type="submit" value="'.__('Save').'"><br /><br /></form>';
    
    			showAdminFooter();
    			break;
    		case 'users':
    			showAdminHeader(__('Users'));
    
    			if (isset($_GET['ok'])) echo '<div class="ok">'.__('Settings updated!').'</div>';
    
    			if (!$_GET['id']) {
    				$i = 0;
    				$array = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
    
    				if (!$_GET['filter'] || (!in_array($_GET['filter'], $array))) $filter = 'a'; else $filter = $_GET['filter'];
    
    				$query = $db->send('SELECT `ID`, `username` FROM `users` WHERE `username` LIKE \''.$filter.'%\'');
    
    				echo '<ul class="filter">';
    				foreach ($array as $letter) {
    					echo '<li><a href="'.coreLink(array('filter='.$letter), 'admin', 'users').'"';
    					if ($letter == $filter) echo ' style="color:red"';
    					echo '>'.$letter.'</a></li>';
    				}
    				echo '</ul>
    				<ul class="inputs">';
    
    				$count = mysql_num_rows($query);
    				while ($row = mysql_fetch_row($query)) {
    					echo '<li';
    					if (($count > 1) && ($i%2 == 0)) echo ' style="float:right;width:250px"';
    					echo '><a href="'.coreLink(array('id='.$row[0]), 'admin', 'users').'">@'.$row[1].'</a></li>';
    					$i++;
    				}
    				echo '</ul>';
    			}
    			else {
    				$userInfo = $db->getUserInfo($_GET['id']);
    				if ($userInfo) {
    					echo '<form action="'.coreLink('admin', 'users').'" method="post"><input type="hidden" name="userID" value="'.$userInfo['ID'].'"><ul class="inputs">
    					<li>
    						<div style="float:right"><input type="text" name="username" class="input" value="'.$userInfo['username'].'"></div>
    					'.__('Username').'<br /><small>'.__('Nickname of the user').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="pass" class="input" value=""></div>
    					'.__('Change password').'<br /><small>'.__("Fill this input if you want to change it's password").'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="email" class="input" value="'.$userInfo['email'].'"></div>
    						'.__('Email').'<br /><small>'.__('Email of the user').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="api" class="input" value="'.$userInfo['api'].'"></div>
    						'.__('API Code').'<br /><small>'.__('Used to access through the API').'</small>
    					</li>
    					<li>
    						<div style="float:right"><select class="input" name="status" style="width:311px">';
    					foreach (array('ok'=>__('Active'), 'nc'=>__('Not confirmed'), 'banned'=>__('Banned')) as $key=>$long) {
    						echo '<option value="'.$key.'"';
    						if ($key == $userInfo['status']) echo ' selected';
    						echo '>'.$long.'</option>';
    					}
    					echo '</select>
    						</div>
    						'.__('Status').'<br /><small>'.__('It can be active, banned..').'</small>
    					</li>
    					<li>
    						<fieldset id="shorters" style="border: 1px solid #ddd;-moz-border-radius:2px;-webkit-border-radius:2px"><legend>'.__('Profile').'</legend><br /><div style="padding-left:40px;margin-bottom:20px;width:110px">';
    					$avatar = getAvatar($userInfo['ID'], '48');
    					if (!$userInfo['gravatar'] && ($avatar != $jk->base."static/img/avatar/default_note.png")) echo '<div style="float:right;font-size:.8em"><input type="checkbox" name="avatar"> <img src="'.$jk->base.'static/img/trash.gif"></div>';
    					echo '<img src="'.getAvatar($userInfo['ID'], '48').'" style="border: 1px solid #ddd"></div>
    						<ul>
    						<li>
    							<div style="float:right"><input type="text" name="profile_name" class="input" value="'.$userInfo['realname'].'"></div>
    							'.__('Name').'<br /><small>'.__('Real name of the user').'</small>
    						</li>
    						<li>
    							<div style="float:right"><input type="text" name="profile_web" class="input" value="'.$userInfo['profile']['url'].'"></div>
    							'.__('Website').'<br /><small>'.__('Website of the user').'</small>
    						</li>
    						<li>
    							<div style="float:right"><input type="text" name="profile_location" class="input" value="'.$userInfo['location'].'"></div>
    							'.__('Location').'<br /><small>'.__('Location of the user').'</small>
    						</li>
    						<li>
    							<div style="float:right"><input type="text" name="profile_bio" class="input" value="'.$userInfo['profile']['bio'].'"></div>
    							'.__('Bio').'<br /><small>'.__('Description of the user').'</small>
    						</li>
    						</ul></fieldset>
    					</li>
    					<li>
    						<div style="float:right"><select class="input" name="language" style="width:311px">';
    					foreach (return_languages() as $short=>$lang) {
    						echo '<option value="'.$short.'"';
    						if ($short == $userInfo['language']) echo ' selected';
    						echo '>'.$lang.'</option>';
    					}
    					echo '</select>
    						</div>
    						'.__('Language').'<br /><small>'.__('Language of the user').'</small>
    					</li>
    					<li>
    						<div style="float:right"><select class="input" name="theme" style="width:311px">';
    					foreach ($jk->allowed_themes as $theme) {
    						echo '<option value="'.$theme.'"';
    						if ($theme == $userInfo['theme']) echo ' selected';
    						echo '>'.$theme.'</option>';
    					}
    					echo '</select>
    						</div>
    						'.__('Theme').'<br /><small>'.__('Skin of Jisko').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="invitations" class="input" value="'.$userInfo['invitations'].'"></div>
    						'.__('Number of invitations').'<br /><small>'.__('Number of invitations that the user has').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="openid" class="input" value="'.$userInfo['openid'].'"></div>
    						'.__('OpenID').'<br /><small>'.__('Used to access Jisko trough an OpenID account').'</small>
    					</li>
    					<li>
    						<div style="float:right"><input type="text" name="facebook" class="input" value="'.$userInfo['facebook'].'"></div>
    						'.__('Facebook ID').'<br /><small>'.__('Used to access Jisko trough a Facebook account').'</small>
    					</li>
    					</ul>
    					<br /><input type="submit" value="'.__('Save').'"><br /><br /></form>';
    				}
    				else header('Location: '.coreLink('admin', 'users'));
    			}
    
    			showAdminFooter();
    			break;
    		case 'shorter_urls':
    			showAdminHeader(__('URL Shortening'));
    
    			if (isset($_GET['ok'])) echo '<div class="ok">'.__('Settings updated!').'</div>';
    
    			echo '<form action="'.coreLink('admin', 'shorter_urls').'" method="post">
    			<ul class="inputs">
    				<li>
    					<div style="float:right"><select class="input" name="default" style="width:311px">';
    			foreach (availableShorterServices() as $short=>$lang) {
    				echo '<option value="'.$short.'"';
    				if ($short == $jk->default_shorter_service) echo ' selected';
    				echo '>'.$lang.'</option>';
    			}
    			echo '</select>
    					</div>
    					'.__('Default').'<br /><small>'.__('The default URL shortening service').'</small>
    				</li>
    				<li>';
    			$allowed = load_url_shorters();
    			echo '<fieldset id="shorters" style="border: 1px solid #ddd;-moz-border-radius:2px;-webkit-border-radius:2px"><legend>'.__('Allowed URL Shortening services').'</legend><br /><ul>';
    			$i = 0;
    			$sh_services = availableShorterServices();
    			$count = count($sh_services);
    
    			foreach ($sh_services as $short=>$lang) {
    				echo '<li';
    				if (($count > 1) && ($i%2 == 0)) echo ' style="float:right;width:250px"';
    				echo '><input type="checkbox" name="url_shorter[]" value="'.$short.'"';
    				if (array_key_exists($short, $allowed)) echo ' checked';
    				echo '> '.$lang.'</li>';
    				$i++;
    			}
    			echo '</ul></fieldset>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="3ly" value="'.$jk->threely_apicode.'"></div>
    					'.__('3.ly API Code').'<br /><small>'.sprintf(__('Required to use 3.ly. More info at %s'), '<a href="http://3.ly">http://3.ly</a>').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="bitly_login" value="'.$jk->bitly_login.'"></div>
    					'.__('bit.ly/j.mp login').'<br /><small>'.__('Required to use bit.ly or j.mp').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="bitly_apicode" value="'.$jk->bitly_apicode.'"></div>
    					'.__('bit.ly/j.mp API Code').'<br /><small>'.__('Required to use bit.ly or j.mp').'</small>
    				</li>
    			</ul>
    			<br /><input type="submit" value="'.__('Save').'"><br /><br />
    			</form>';
    
    			showAdminFooter();
    			break;
    		case 'environment':
    			showAdminHeader(__('Environment'));
    
    			if (isset($_GET['ok'])) echo '<div class="ok">'.__('Settings updated!').'</div>';
    
    			echo '<form action="'.coreLink('admin', 'environment').'" method="post">
    			<ul class="inputs">
    				<li>
    					<div style="float:right"><select class="input" name="language" style="width:311px">';
    			foreach (return_languages() as $short=>$lang) {
    				echo '<option value="'.$short.'"';
    				if ($short == $jk->default_lang) echo ' selected';
    				echo '>'.$lang.'</option>';
    			}
    			echo '</select>
    					</div>
    					'.__('Language').'<br /><small>'.__('The default language of your Jisko installation').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="home_page" value="'.$jk->home_page.'"></div>
    					'.__('Default home page').'<br /><small>'.__('For the default home page type: home_page').'</small>
    				</li>
    				<li>';
    			if ($jk->use_invitations == true) echo '<div style="float:right"><input type="checkbox" class="input" name="use_invitations" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="use_invitations"></div>';
    			echo __('Use invitations').'<br /><small>'.__('Users will need an invitation in order to register on Jisko').'</small>
    				</li>
    				<li>';
    			if ($jk->alert_on_newuser == true) echo '<div style="float:right"><input type="checkbox" class="input" name="new_user" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="new_user"></div>';
    			echo __('Email when new user').'<br /><small>'.__('Send me an email when a user registers on Jisko').'</small>
    				</li>
    				<li>';
    			if ($jk->alert_on_deluser == true) echo '<div style="float:right"><input type="checkbox" class="input" name="del_user" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="del_user"></div>';
    			echo __('Email when deleted user').'<br /><small>'.__('Send me an email when a user deletes their account on Jisko').'</small>
    				</li>
    				<li>';
    			if ($jk->no_confirmation_email == false) echo '<div style="float:right"><input type="checkbox" class="input" name="confirm_email" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="confirm_email"></div>';
    			echo __('Confirm email').'<br /><small>'.__('Confirm email when an user registers on Jisko').'</small>
    				</li>
    				<li>';
    			if ($jk->tos == true) echo '<div style="float:right"><input type="checkbox" class="input" name="tos" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="tos"></div>';
    			echo __('Enable ToS').'<br /><small>'.__('Users will be prompted to accept the Terms of Service').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="wait_repost" value="'.$jk->wait_until_repost.'"></div>
    					'.__('Seconds until another post').'<br /><small>'.__('Recommended is 10 seconds').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="wait_refollow" value="'.$jk->wait_until_refollow.'"></div>
    					'.__('Seconds until another follow').'<br /><small>'.__('Recommended is 25 seconds').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="ajax_refresh" value="'.$jk->ajax_refresh.'" ></div>
    					'.__('Seconds until AJAX refresh').'<br /><small>'.__('Recommended is 25 seconds').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="notes_per_page" value="'.$jk->notes_per_page.'"></div>
    					'.__('Notes per page').'<br /><small>'.__('Amount of notes shown in each section of Jisko').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="recaptcha_public" value="'.$jk->recaptcha_publickey.'"></div>
    					'.__('reCAPTCHA public Key').'<br /><small>'.sprintf(__('More info at %s'), '<a href="http://recaptcha.com">http://recaptcha.com</a>').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="recaptcha_secret" value="'.$jk->recaptcha_privatekey.'"></div>
    					'.__('reCAPTCHA secret Key').'<br /><small>'.sprintf(__('More info at %s'), '<a href="http://recaptcha.com">http://recaptcha.com</a>').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="fb_apikey" value="'.$jk->fb_apikey.'"></div>
    					'.__('Facebook API Key').'<br /><small>'.sprintf(__('If you want to support Facebook connect. More info at %s'), '<a href="http://developers.facebook.com/connect.php">http://developers.facebook.com/connect.php</a>').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="fb_secretkey" value="'.$jk->fb_secretkey.'"></div>
    					'.__('Facebook secret Key').'<br /><small>'.sprintf(__('If you want to support Facebook connect. More info at %s'), '<a href="http://developers.facebook.com/connect.php">http://developers.facebook.com/connect.php</a>').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="tw_consumerkey" value="'.$jk->tw_consumerkey.'"></div>
    					'.__('Twitter consumer Key').'<br /><small>'.sprintf(__('If you want to support Twitter integration. More info at %s'), '<a href="http://dev.twitter.com">http://dev.twitter.com</a>').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="tw_secretkey" value="'.$jk->tw_secretkey.'"></div>
    					'.__('Twitter consumer secret Key').'<br /><small>'.sprintf(__('If you want to support Twitter integration. More info at %s'), '<a href="http://dev.twitter.com">http://dev.twitter.com</a>').'</small>
    				</li>
    			</ul>
    			<br /><input type="submit" value="'.__('Save').'"><br /><br />
    			</form>';
    
    			showAdminFooter();
    			break;
    		case 'general':
    		default:
    			showAdminHeader(__('General'));
    
    			if (isset($_GET['ok'])) echo '<div class="ok">'.__('Settings updated!').'</div>';
    
    			echo '
    			<script>
    				$(document).ready(function() {
    					$.getJSON(\'http://app.jisko.org/update.php?v=1&ver='.INTER_VERSION.'&callback=?\', function(data) {
    						if (!data.error) {
    							$("#update").html(\''.__('There is a new update available! Find more information about Jisko %version at  %url').'\'.replace(\'%version\', \'<strong>\'+data.name+\'</strong>\').replace(\'%url\', \'<a href="\'+data.url+\'">\'+data.url+\'</a>\'));
    							$("#update").fadeIn();
    						}
    					});
    				});
    			</script>
    			<form action="'.coreLink('admin', 'general').'" method="post" enctype="multipart/form-data">
    			<ul class="inputs">
    				<li>
    					<div style="float:right"><input type="text" class="input" name="name" value="'.$jk->name.'"></div>
    					'.__('Name').'<br /><small>'.__('Name of your Jisko installation').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="separator" value="'.$jk->separator.'"></div>
    					'.__('Separator').'<br /><small>'.__('The symbol which separes the title and the name of Jisko').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="baseURL" value="'.str_replace('http://', '', str_replace('https://', '', substr($jk->base, 0, -1))).'" ></div>
    					'.__('Base URL of Jisko').'<br /><small>'.__('The URL where Jisko is located. Without http://').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="file" class="input" name="logo"></div>
    					'.__('Logo').'<br /><small>'.__('Logo of Jisko').'</small>
    				</li>
    				<li>';
    			if ($jk->cleanUrls == true) echo '<div style="float:right"><input type="checkbox" class="input" name="cleanURLs" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="cleanURLs"></div>';
    
    			echo __('Clean URLs').'<br /><small>'.__('Not supported by every server').'</small>
    				</li>
    				<li>';
    			if ($jk->enable_mbstring == true) echo '<div style="float:right"><input type="checkbox" class="input" name="enable_mbstring" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="enable_mbstring"></div>';
    
    			echo __('Enable MBString').'<br /><small>'.__('Fixes some problems when counting unicode characters').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="admin_mail" value="'.$jk->admin_mail.'"></div>
    					'.__('Admin mail').'<br /><small>'.__('Used for the contact page...').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="abuse_mail" value="'.$jk->abuse_mail.'"></div>
    					'.__('Abuse mail').'<br /><small>'.__('Used for abuse reports...').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="meta_keywords" value="'.$jk->meta_keywords.'"></div>
    					'.__('Meta keywords').'<br /><small>'.__('Keywords that describe your website').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="meta_description" value="'.$jk->meta_description.'"></div>
    					'.__('Meta description').'<br /><small>'.__('Description of your website').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="meta_robots" value="'.$jk->meta_robots.'"></div>
    					'.__('Meta robots').'<br /><small>'.__('Actions for search robots on your website').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="cron_pw" value="'.$jk->cron_password.'"></div>
    					'.__('Cron password').'<br /><small>'.__('The password to execute the cron script').'</small>
    				</li>
    				<li>';
    			if ($jk->is_debug == true) echo '<div style="float:right"><input type="checkbox" class="input" name="is_debug" checked></div>';
    			else echo '<div style="float:right"><input type="checkbox" class="input" name="is_debug"></div>';
    			echo __('MySQL Debug').'<br /><small>'.__('Log MySQL Errors in debug.log').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="denied_ext" value="'.implode(',', $jk->denied_extensions).'"></div>
    					'.__('Upload denied extensions').'<br /><small>'.__('Separated by commas').'</small>
    				</li>
    				<li>
    					<div style="float:right"><input type="text" class="input" name="maintenance" value="'.$jk->maintenance.'"></div>
    					'.__('Maintenance mode').'<br /><small>'.__('To enable it, fill the input with any text. To disable it, just clear the input').'</small>
    				</li>
    			</ul>
    			<br /><input type="submit" value="'.__('Save').'"><br /><br />
    			</form>';
    
    			showAdminFooter();
    		}
    	}
    
    }
    else header('Location: '.$jk->base);
    }
    else header('Location: '.$jk->base);
    
    ?>

  10. I got an problem with the valiadation mail.

    But what is weird when I made an account named test he sended me the mail and I tried again some later with the name test2 but I didn't got an email.

    Is this a problem of the webhosting or my code?

    Here is the code:

    <?php
    // Jisko: An open-source microblogging application
    // Copyright (C) 2008-10 Rubén Díaz <outime@gmail.com>
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as
    // published by the Free Software Foundation, either version 3 of the
    // License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    class mailing
    {
    var $email;
    var $headers;
    var $subject;
    var $text;
    
    function sendMail($email, $subject, $html_subject, $text, $notifications = false, $admin = false, $language = false)
    {
    	global $jk;
    
    	$headers = "MIME-Version: 1.0\r\n";
    	$headers .= "Content-type: text/html; charset=UTF-8\r\n";
    	$headers .= "From: ".$jk->name." <".$jk->admin_mail.">";
    
    	$text = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /></head><body><style type="text/css"> .footer a{color:#B9B7D0}</style><div id="contenedor"><a href="'.$jk->base.'"><img src="'.$jk->base.'static/img/logos/'.$jk->logo.'" style="border:0px;padding-left:30px;" alt="'.$jk->name.'" /></a><br /><br />
    <div class="title" style="padding:5px;padding-left:30px;padding-right:30px;font-family:Georgia,Tahoma;color:#08004D;height:40px"><h3 style="font-style:italic;font-size:20px">'.$html_subject.'</h3></div><div class="content" style="font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 17px;background:url(../themes/transparency/img/web_bg.png);border:1px solid #ddd;border-radius:4px;-moz-border-radius:4px;color:black;padding:5px;padding-left:30px;padding-right:30px;"> '.$text.'</div></div>';
    
    	$text .= $this->bottomMail($notifications, $admin, $language);
    
    	$text .= '</body></html>';
    
    	mail($email, $jk->name.' // '.$subject, $text, $headers);
    }
    
    function bottomMail($notifications = false, $admin = false, $language = false)
    {
    	global $gettext_tables;
    	global $jk;
    
    	$return = '<div class="footer" style="padding-top:5px;font-size:11px;color:#B9B7C0;font-family:"Lucida Grande",Arial,serif"><div style="float:right">Powered by <a href="http://www.jisko.org">Jisko</a></div>';
    
    	if ($language != false) {
    		if (file_exists(PATH.'locale/'.deflang($language).'/LC_MESSAGES/messages.mo')) {
    			$gettext_tables = new gettext_reader(
    				new CachedFileReader(PATH.'locale/'.deflang($language).'/LC_MESSAGES/messages.mo')
    			);
    			$gettext_tables->load_tables();
    		}
    	}
    
    	if ($admin == false) {
    		if ($notifications) $return .= sprintf(__('Turn off this notifications at %s'), '<a href="'.coreLink('settings', 'config').'">'.coreLink('settings', 'config').'</a>')."<br />";
    
    		$return .= sprintf(__('Have you got any problem? Contact the administrator at %s'), '<a href="'.coreLink('contact').'">'.coreLink('contact').'</a>').'<br />';
    		if ($jk->tos == true) $return .= '<br />'.sprintf(__('Since you got registered on %s, you agree with the Terms of Service (TOS) placed in %s'), $jk->name, '<a href="'.coreLink('tos').'">'.coreLink('tos').'</a>').'<br />';
    	}
    
    	if ($language != false) {
    		if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    			$gettext_tables = new gettext_reader(
    				new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    			);
    			$gettext_tables->load_tables();
    		}
    	}
    
    	return $return.'</div>';
    }
    
    function forgottenPassword($email, $uid, $token)
    {
    	global $gettext_tables;
    	global $db;
    
    	$userInfo = $db->getUserOptions($uid, array('username', 'language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%username', '<a href="'.coreLink($userInfo['username']).'">'.$userInfo['username'].'</a>', __("Someone (probably you) has just requested a password reset for the account with %username as the username. Because we need to confirm the request, please click the link placed below in order to continue the process:")).'<br /><br /><a href="'.coreLink(array('uid='.$uid, 'key='.$token), 'trouble_login').'">'.coreLink(array('uid='.$uid, 'key='.$token), 'trouble_login').'</a><br /><br />'.__("Please remember that this link will expire in 24h, so if you didn't request a password change, simply ignore this email");
    
    	$this->sendMail($email, __('Password reset instructions'), __('Password reset'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function resetPassword($email, $new_password, $userID)
    {
    	global $gettext_tables;
    	global $db;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = __("We have received your request for changing your password and here is your new password:").'<br /><br />';
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">'.$new_password.'</div><br />';
    	$text .= sprintf(__('Remember that you can change your password at %s'), '<a href="'.coreLink('settings', 'config').'">'.coreLink('settings', 'config').'</a>');
    
    	$this->sendMail($email, __('Your new password'), __('Your new password'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function newFollower($userID, $content)
    {
    	global $gettext_tables;
    	global $_USER;
    	global $db;
    
    	$userInfo = $db->getUserOptions($userID, array('language', 'email'));
    
    	if (file_exists(PATH.'locale/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'locale/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$notes = $db->countNotes('archive', $_USER['ID']);
    	$followers = $db->countFollowers($_USER['ID']);
    	$following = $db->countFollowing($_USER['ID']);
    
    	$subject = __("%real_or_username is now following you");
    	$text = str_replace('%real_or_username', '<a href="'.coreLink($_USER['username']).'">'.utf8_htmlentities($content).'</a>', str_replace('%name', $jk->name, __("%real_or_username is now following your updates on %name"))).'<br /><br />';
    
    	$text .= '<div style="padding: 10px;padding-bottom:20px;background-color:#D9D9D9"><div style="float:right;width:90%;margin-bottom:5px">'.$notes.' '.__('notes').'<br />'.$followers.' '.__('followers').'<br />'.sprintf(__('following %s users'), $following).'</div><img src="'.getAvatar($_USER['ID'], 48).'" height="48" width="48"></div><br /><br />'.sprintf(__('You can check his/her profile at %s'), coreLink($_USER['username']));
    
    	$subject = str_replace('%real_or_username', $content, $subject);
    	$text = str_replace('%name', $jk->name, $text);
    
    	$this->sendMail($userInfo['email'], $subject, __('New follower'), $text, true, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function newPrivateNote($userInfo, $note, $USER, $attached_file = false, $id = false)
    {
    	global $gettext_tables;
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$subject = __("Private message from %real_or_username");
    
    	if ($USER['realname']) $content = $USER['realname'].' ('.$USER['username'].')';
    	else $content = $USER['username'];
    
    	$text = str_replace('%real_or_username', '<a href="'.coreLink($_USER['username']).'">'.$content.'</a>', __('%real_or_username has sent you a private message:'))."<br /><br />";
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities($note).'</div><br />';
    	if ($attached_file) {
    		$text .= sprintf(__('With the following attachment: %s'), coreLink('download', $id, $attached_file))."<br /><br />";
    	}
    	$text .= str_replace('%username', $USER['username'], str_replace('%base', coreLink('notes', 'private'), __("You can reply to this message by sending a note with \"!%username <your message>\" or through the web interface at %base")));
    
    	$subject = str_replace('%real_or_username', $content, $subject);
    
    	$this->sendMail($userInfo['email'], $subject, __('New private message'), $text, true, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function newReplyNote($userInfo, $note, $note1, $note2 = false, $attached_file = false)
    {
    	global $gettext_tables;
    	global $db;
    	global $_USER;
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	if ($_USER['realname']) $content = $_USER['realname'].' ('.$_USER['username'].')';
    	else $content = $_USER['username'];
    
    	$subject = str_replace('%real_or_username', $content, __("Reply from %real_or_username"));
    
    	$text = str_replace('%real_or_username', $content, __('%real_or_username has replied or mentioned you in the following note:'))."<br /><br />";
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities(stripslashes($note)).'</div><br />';
    	if ($attached_file) $text .= sprintf(__('With the following attachment: %s'), coreLink('download', $note1, $attached_file))."<br /><br />";
    	$text .= __('Permalink:').' <a href="'.coreLink($_USER['username'], $note1).'">'.coreLink($_USER['username'], $note1).'</a>';
    	if ($note2) {
    		$noteInfo = $db->getTextFromNoteID($note2);
    		$text .= '<br /><br />'.__("This note was replying to:").'<br /><br /><div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities(stripslashes($db->getTextFromNoteID($note2))).'</div><br />'.__('Permalink:').' <a href="'.coreLink($userInfo['username'], $note2).'">'.coreLink($userInfo['username'], $note2).'</a>';
    	}
    
    	$this->sendMail($userInfo['email'], $subject, $subject, $text, true, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function confirmRegistration($email, $user_id, $token)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($user_id, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$subject = str_replace('%name', $jk->name, __('Confirmation for %name account'));
    
    	$text = __('Someone (probably you) has requested an account in %name. However, we need to know if you are the owner of this mail account.');
    	$text .= '<br />'.__('To confirm it, please click in the link placed below:').'<br /><br /><a href="'.coreLink(array('uid='.$user_id, 'key='.$token), 'register').'">'.coreLink(array('uid='.$user_id, 'key='.$token), 'register').'</a><br /><br />';
    	$text .= __("If you didn't request an account at %name, ignore this mail and apologies for the inconvenience.");
    
    	$text = str_replace('%name', $jk->name, $text);
    
    	$this->sendMail($email, $subject, __('Account confirmation'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function emailChange($email, $user_id, $new_email, $token)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserInfo($user_id);
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%name', $jk->name, __("Someone (probably you) has requested a change of the email assigned to your account in %name. Your new email will be:")).'<br /><br /><div style="padding: 10px;background-color:#D9D9D9">'.$new_email.'</div><br /><br />'.__('If you requested this change, then confirm it by clicking the link placed below:').'<br /><br/><a href="'.coreLink(array('confirm', 'key='.$token), 'settings', 'config').'">'.coreLink(array('confirm', 'key='.$token), 'settings', 'config').'</a><br /><br />'.__("Otherwise, if you didn't request this change, then simply ignore this message, because this link will expire in 24h");
    
    	$this->sendMail($email, __('Confirm email change'), __('Email change'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function registrationSuccess($email, $username)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = __("Welcome to %name").'<br /><br />';
    	$text .= str_replace('%p_url', '<a href="'.coreLink('settings', 'profile').'">'.coreLink('settings', 'profile').'</a>', __('You have just confirmed your account in %name, so now you can start personalizing your profile at %p_url!'));
    	$text .= '<br /><br />'.__('%name is based on Jisko, an open-source microblogging platform. You can find more information about Jisko at http://www.jisko.org').'<br /><br />'.__('Thank you very much for signing up in %name and for giving us a try!');
    
    	$text = str_replace('%name', $jk->name, $text);
    
    	$this->sendMail($email, __('Welcome!'), __('Welcome!'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function alertNewUser($username)
    {
    	global $jk;
    
    	$subject = __("There's a new user on %name");
    
    	$text = __("A new user called %username has joined %name.").'<br /><br />'.__("It should be empty, but if you want, you can check his profile at %url");
    
    	$subject = str_replace('%name', $jk->name, $subject);
    	$text = str_replace('%username', '<span style="text-decoration:underline">'.$username.'</span>', str_replace('%name', $jk->name, $text));
    	$text = str_replace('%url', '<a href="'.coreLink($username).'">'.coreLink($username).'</a>', $text);
    
    	$this->sendMail($jk->admin_mail, $subject, __('New account'), $text, false, true);
    }
    
    function alertDelUser($uid)
    {
    	global $db;
    	global $jk;
    
    	$uinfo = $db->getUserOptions($uid, array('username', 'email'));
    
    	$subject = __("The user %username has deleted his account from %name");
    
    	$text = __("The user %username has deleted his account from %name.").'<br /><br/>'.__("If you want to contact him, his email is %email");
    
    	$subject = str_replace('%name', $jk->name, str_replace('%username', $uinfo['username'], $subject));
    	$text = str_replace('%username', '<span style="text-decoration:underline">'.$username.'</span>', str_replace('%name', $jk->name, $text));
    	$text = str_replace('%email', $uinfo['email'], $text);
    
    	$this->sendMail($jk->admin_mail, $subject, __('Deleted account'), $text, false, true);
    }
    
    function newInvitation($email, $token)
    {
    	global $gettext_tables;
    	global $_USER, $jk;
    
    	$subject = __('%username has invited you to %name!');
    
    	$text = __("Hey!").'<br /><br />'.__("%username just sent you an invitation for using %name! %name is a microblogging portal where you can share your own experiences and your feelings about everything.").'<br/><br />'.__("Why don't you give %name a try and register?").'<br/><br />'.__('Click on the following link in order to use your invitation to %name').'<br /><br /><div style="padding: 10px;background-color:#D9D9D9"><a href="'.coreLink(array('token='.$token), 'register').'">'.coreLink(array('token='.$token), 'register').'</a></div><br /><br />'.__('Thank you and have fun on %name!');
    
    	$subject = str_replace('%username', $_USER['username'], str_replace('%name', $jk->name, $subject));
    	$text = str_replace('%username', '<a href="'.coreLink($_USER['username']).'">'.$_USER['username'].'</a>', str_replace('%name', $jk->name, $text));
    
    	$this->sendMail($email, $subject, sprintf(__('Invitation to %s'), $jk->name), $text);
    }
    
    function passwordChange($email, $userID, $ip)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%name', $jk->name, __("We send this mail to tell you that your password on %name has been changed.")).'<br /><br />';
    	$text .= str_replace('%ip', $ip, str_replace('%contact_page', '<a href="'.coreLink('contact').'">'.coreLink('contact').'</a>', __('This change was requested from the ip %ip. If you were not the user who changed your password, please contact the administrator at %contact_page')));
    
    	$this->sendMail($email, __('Your password has been changed'), __('Your password has been changed'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function confirmDrop($email, $username, $userID, $token)
    {
    	global $gettext_tables;
    	global $db, $jk;
    
    	$userInfo = $db->getUserOptions($userID, array('language'));
    
    	if (file_exists(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang($userInfo['language']).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	$text = str_replace('%name', $jk->name, str_replace('%contact_page', coreLink('contact'), __("Are you sure you want to delete your %name account? If you are having problems with %name, remember that you can contact us through %contact_page and we will take notes about your issues/suggestions.")));
    	$text .= '<br /><br />'.__("If you're are completely sure of your decision (remember, this is NOT REVERSIBLE), please click the link placed below:");
    	$text .= str_replace('%drop_url', '<a href="'.coreLink(array('key='.$token, 'confirm'), 'drop_account').'">'.coreLink(array('key='.$token, 'confirm'), 'drop_account').'</a>', '<br /><br />%drop_url<br /><br />').__('You must be logged in order to delete your account and remember that this request will expire in 24h.').'<br /><br />'.__('We will miss you!');
    
    	$this->sendMail($email, __('Delete account confirmation'), __('Delete account confirmation'), $text, false, false, $userInfo['language']);
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    }
    
    function sendMessage($email, $message, $ip, $username = false, $copy = false)
    {
    	global $gettext_tables;
    	global $jk;
    
    	if (file_exists(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')) {
    		$gettext_tables = new gettext_reader(
    			new CachedFileReader(PATH.'includes/languages/'.deflang(LANG).'/LC_MESSAGES/messages.mo')
    		);
    		$gettext_tables->load_tables();
    	}
    
    	if (!$username) $subject = __('Someone has sent you a message through the Contact page');
    	else $subject = sprintf(__('%s has sent you a message through the Contact page'), $username);
    
    	$text = __('Someone has decided to contact you through the contact page of your Jisko installation. Here are the details:')."<br /><br />";
    	if ($username) $text .= sprintf('Username: %s', '<a href="'.coreLink($username).'">'.$username.'</a>')." - ";
    	$text .= sprintf('IP: %s', '<a href="http://www.geoip.co.uk/?IP='.$ip.'">'.$ip.'</a>')." - ";
    	$text .= sprintf('Email: %s', $email);
    
    	$text .= '<br /><br /><div style="padding: 10px;background-color:#D9D9D9">'.utf8_htmlentities($message).'</div><br />';
    	$text .= __("Please remember that you can only reply this message through the email provided. Otherwise, he won't see your answer");
    
    	$this->sendMail($jk->admin_mail, $subject, __('New message received'), $text, false, true);
    	if ($copy) $this->sendMail($email, $subject, __('New message received'), $text, false, true);
    }
    
    function reportAbuse($user_id, $reported_username, $ip)
    {
    	global $gettext_tables;
    	global $db;
    	global $_USER;
    	global $jk;
    
    	$subject = str_replace('%username', $_USER['username'], str_replace('%r_username', $reported_username, __("%username reported the user %r_username")));
    
    	$text = __("The user %username (ID: %id) from the IP %ip reported the user %r_username (ID: %r_id).");
    
    	$text = str_replace('%username', '<a href="'.coreLink($_USER['username']).'">'.$_USER['username'].'</a>', str_replace('%r_username', '<a href="'.coreLink($reported_username).'">'.$reported_username.'</a>', $text));
    	$text = str_replace('%id', $_USER['ID'], str_replace('%ip', '<a href="http://www.geoip.co.uk/?IP='.$ip.'">'.$ip.'</a>', $text));
    	$text = str_replace('%r_id', $user_id, $text);
    
    	$this->sendMail($jk->abuse_mail, $subject, __('New abuse report'), $text, false, true);
    }
    
    function reportAbuseNote($result, $ip)
    {
    	global $gettext_tables;
    	global $db;
    	global $_USER;
    	global $jk;
    
    	$subject = __("%username reported the note %r_note");
    
    	$text = __("The user %username (ID: %id) from the IP %ip reported the note %r_note made by %r_username (ID: %r_id).")."<br /><br />";
    	$text .= '<div style="padding: 10px;background-color:#D9D9D9">%content</div><br /><br />'.__('Permalink:').' %link';
    
    	$subject = str_replace('%username', $_USER['username'], str_replace('%r_note', '#'.$result['ID'], $subject));
    	$text = str_replace('%username', '<a href="'.coreLink($_USER['username']).'">'.$_USER['username'].'</a>', str_replace('%id', $_USER['ID'], $text));
    	$text = str_replace('%ip', '<a href="http://www.geoip.co.uk/?IP='.$ip.'">'.$ip.'</a>', str_replace('%r_note', '<a href="'.coreLink($result['username'], $result['ID']).'">#'.$result['ID'].'</a>', $text));
    	$text = str_replace('%r_id', $result['ID'], str_replace('%r_username', '<a href="'.coreLink($result['username']).'">'.$result['username'].'</a>', $text));
    	$text = str_replace('%content', utf8_htmlentities(put_smileys($result['note'])), str_replace('%link', coreLink($result['username'], $result['ID']), $text));
    
    	$this->sendMail($jk->abuse_mail, $subject, __('New abuse report'), $text, false, true);
    }
    }
    
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.