Changeset 1524 in ExiteCMS


Ignore:
Timestamp:
07/05/08 12:58:33 (4 years ago)
Author:
hverton
Message:

added code coloring for [code] bbcode sections, and an option to download the code
fixed a bug with pm read timestamps
registration now sends a pm to the webmaster when new user activation is set to admin-approval
user activation has been extended to work with both manual approvals and with email verification

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/activation.php

    r1287 r1524  
    3030// activate a newly registered user 
    3131if ($step == "activate") { 
    32     $usercode = stripinput($_GET['user_code']); 
    33     $result = dbquery("SELECT * FROM ".$db_prefix."new_users WHERE user_code = '$usercode'"); 
    34     if (dbrows($result)) { 
    35         $data = dbarray($result); 
    36         $data = array_merge($data, unserialize($data['user_info'])); 
    37         $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_fullname, user_password, user_email, user_hide_email, user_offset, user_posts, user_joined, user_level, user_ip, user_status) VALUES('".$data['user_name']."', '".$data['user_fullname']."', md5(md5('".$data['user_password']."')), '".$data['user_email']."', '".$data['user_hide_email']."', '".$data['user_offset']."', '0', '".time()."', '101', '".$data['user_ip']."', '0')"); 
    38         $result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code = '$usercode'"); 
     32    // check which kind of activation is needed 
     33    if (isset($_GET['user_code'])) { 
     34        $usercode = stripinput($_GET['user_code']); 
     35        $result = dbquery("SELECT * FROM ".$db_prefix."new_users WHERE user_code = '$usercode'"); 
     36        if (dbrows($result)) { 
     37            $data = dbarray($result); 
     38            $data = array_merge($data, unserialize($data['user_info'])); 
     39            $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_fullname, user_password, user_email, user_hide_email, user_offset, user_posts, user_joined, user_level, user_ip, user_status) VALUES('".$data['user_name']."', '".$data['user_fullname']."', md5(md5('".$data['user_password']."')), '".$data['user_email']."', '".$data['user_hide_email']."', '".$data['user_offset']."', '0', '".time()."', '101', '".$data['user_ip']."', '0')"); 
     40            $result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code = '$usercode'"); 
     41        } 
     42    } elseif (isset($_GET['user_id'])) { 
     43        $user_id = stripinput($_GET['user_id']); 
     44        if (isNum($user_id)) { 
     45            $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id = '$user_id'"); 
     46            if (dbrows($result)) { 
     47                $result = dbquery("UPDATE ".$db_prefix."users SET user_status = '0' WHERE user_id = '$user_id'"); 
     48            } 
     49        } 
    3950    } 
    4051} 
     
    4960$variables['newusers'] = array(); 
    5061 
    51 $result = dbquery("SELECT * FROM ".$db_prefix."new_users ORDER BY user_datestamp"); 
    52 while ($data = dbarray($result)) { 
    53     $variables['newusers'][] = array_merge($data, unserialize($data['user_info'])); 
     62// when using email verification... 
     63if ($settings['email_verification'] == '1') { 
     64    // get the users from the new_users table 
     65    $result = dbquery("SELECT * FROM ".$db_prefix."new_users ORDER BY user_datestamp"); 
     66    while ($data = dbarray($result)) { 
     67        $variables['newusers'][] = array_merge($data, unserialize($data['user_info'])); 
     68    } 
     69} else { 
     70    // otherwise they are in the users tabel with a user_status of 2 
     71    $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_status = '2' ORDER BY user_joined"); 
     72    while ($data = dbarray($result)) { 
     73        $variables['newusers'][] = $data; 
     74    } 
    5475} 
    5576 
  • trunk/administration/tools/language_pack_English.php

    r1520 r1524  
    29932993        $localestrings['507'] = "The registration system is currently disabled."; 
    29942994        $localestrings['508'] = "New code"; 
     2995        $localestrings['509'] = "New user awaiting activation"; 
     2996        $localestrings['510'] = "The user '%s' has registered, please go the the user administration section to activate the new account"; 
    29952997        $localestrings['550'] = "Please specify a user name."; 
    29962998        $localestrings['551'] = "Please specify a password."; 
  • trunk/administration/tools/language_pack_Nederlands.php

    r1520 r1524  
    29932993        $localestrings['507'] = "Het registratie systeem is momenteel uitgeschakeld."; 
    29942994        $localestrings['508'] = "Nieuwe code"; 
     2995        $localestrings['509'] = "Nieuwe gebruiker wacht op activatie"; 
     2996        $localestrings['510'] = "De gebruiker '%s' heeft zich geregistreerd, ga a.u.b. naar de gebruikers administratie en activeer deze nieuwe gebruiker."; 
    29952997        $localestrings['550'] = "Voer a.u.b. een gebruikersnaam in."; 
    29962998        $localestrings['551'] = "Voer a.u.b. een wachtwoord in."; 
  • trunk/files/locales/en.main.global.php

    r1520 r1524  
    33// locale       : English 
    44// locale name  : main.global 
    5 // generated on : Thu Jul 3 2008, 16:01:33 CEST 
     5// generated on : Sat Jul 5 2008, 12:21:41 CEST 
    66// translators  : ExiteCMS team,WanWizard 
    77// ---------------------------------------------------------- 
  • trunk/forum/post.php

    r1477 r1524  
    415415                $preview['post_message'] = $locale['421']; 
    416416            } 
    417             $preview['post_message'] = parsemessage($preview['post_message'], $preview['post_smileys']); 
     417            $preview['post_message'] = parsemessage($preview); 
    418418            $preview['post_reply_id'] = $reply_id; 
    419419            if ($reply_id != 0) { 
     
    447447            // add information about the current user 
    448448            $preview = array_merge($preview, $userdata); 
    449             $preview['user_sig'] = parsemessage($preview['user_sig'], $preview['post_smileys']); 
     449            $_x = $preview['user_message']; 
     450            $preview['user_message'] = $preview['user_sig']; 
     451            $preview['user_sig'] = parsemessage($preview); 
     452            $preview['user_message'] = $_x; 
    450453            // process attachments 
    451454            if ($settings['attachments'] == "1" && $fdata['forum_attach'] == "1") { 
  • trunk/forum/viewthread.php

    r1513 r1524  
    419419        if (!file_exists(PATH_IMAGES."avatars/".$data['user_avatar'])) $data['user_avatar'] = "imagenotfound.jpg"; 
    420420        // prepare the message text for display 
    421         $data['post_message'] = parsemessage($data['post_message'], $data['post_smileys']); 
     421        $data['post_message'] = parsemessage($data); 
    422422 
    423423        // prepare the users signature 
  • trunk/getfile.php

    r1435 r1524  
    262262        case "cc": 
    263263        case "c": 
     264        case "c++": 
    264265        case "hh": 
    265266        case "php": 
     
    310311 
    311312// parameter validation 
    312 if (!isset($file_id) || !isNum($file_id)) { 
    313     terminate("<b>Invalid or missing file ID.</b>"); 
    314 } 
    315313if (!isset($type)) { 
    316314    terminate("<b>Missing file type.</b>"); 
     315} 
     316switch ($type) { 
     317    case "fc": 
     318        if (!isset($forum_id) || !isNum($forum_id) || !isset($thread_id) || !isNum($thread_id) || !isset($post_id) || !isNum($post_id) || !isset($id) || !isNum($id)) { 
     319            terminate("<b>Invalid or missing message ID.</b>"); 
     320        } 
     321        break; 
     322    default: 
     323        if (!isset($file_id) || !isNum($file_id)) { 
     324            terminate("<b>Invalid or missing file ID.</b>"); 
     325        } 
    317326} 
    318327 
     
    353362        $result = dbquery("UPDATE ".$db_prefix."forum_attachments SET attach_count=attach_count+1 WHERE attach_id='$file_id'"); 
    354363        // define the required parameters for the download 
     364        $source = "file"; 
    355365        $filename = $attachment['attach_name']; 
    356366        $filepath = PATH_ATTACHMENTS; 
    357367        $downloadname = $attachment['attach_realname'] == "" ? $attachment['attach_name'] : $attachment['attach_realname']; 
     368        break; 
     369 
     370    case "fc":  // forum code blocks 
     371        // check if the requester has read access to the forum 
     372        $forum = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id = '".$forum_id."'")); 
     373        if (!is_array($forum)) { 
     374            terminate("<b>Invalid or missing message ID.</b>"); 
     375        } 
     376        // if logged in, check if the user has access to this file. if not, print an error and give up 
     377        if (iMEMBER && !getfilegroup($forum['forum_access'], $userdata['user_level'])) { 
     378            terminate("<b>You don't have access to the requested file ID.</b>"); 
     379        } 
     380        // if not logged in, and authorisation required, check if userid and password is given and valid 
     381        if (!iMEMBER && $forum['forum_access'] != 0) { 
     382            // Not public, authentication is required 
     383            auth_BasicAuthentication(); 
     384        } 
     385        // check if the requested message exists, if so retrieve the information 
     386        $message = dbarray(dbquery("SELECT * FROM ".$db_prefix."posts WHERE forum_id='$forum_id' AND thread_id='$thread_id' AND post_id='$post_id'")); 
     387        if (!is_array($message)) { 
     388            terminate("<b>Invalid or missing message ID.</b>"); 
     389        } 
     390        // get the code blocks from the message body 
     391        require PATH_INCLUDES."forum_functions_include.php"; 
     392        // strip CODE bbcode, optionally perform Geshi color coding 
     393        $codeblocks = array(); 
     394        $raw_color_blocks = true; 
     395        $message = preg_replace_callback('#\[code(=.*?)?\](.*?)([\r\n]*)\[/code\]#si', '_parseubb_codeblock', $message['post_message']); 
     396        // do we have the requested code block? 
     397        if (!isset($codeblocks[$id])) { 
     398            terminate("<b>Invalid or missing message ID.</b>"); 
     399        } 
     400        $source = "var"; 
     401        $downloadname = "file.".($codeblocks[$id][1]==""?"txt":$codeblocks[$id][1]); 
     402        $downloaddata = _unhtmlentities($codeblocks[$id][0]); 
    358403        break; 
    359404 
     
    375420        } 
    376421        // define the required parameters for the download 
     422        $source = "file"; 
    377423        $filename = $attachment['pmattach_name']; 
    378424        $filepath = PATH_PM_ATTACHMENTS; 
     
    395441// define the download parameters and start the download 
    396442$object = new httpdownload; 
    397 $object->set_mime(setmime($filename)); 
    398 $object->set_byfile($filepath.$filename); 
    399 $object->set_filename($downloadname); 
    400 $object->use_resume = false; 
     443 
     444switch($source) { 
     445    case "file": 
     446        $object->set_mime(setmime($filename)); 
     447        $object->set_byfile($filepath.$filename); 
     448        $object->set_filename($downloadname); 
     449        $object->use_resume = false; 
     450        break; 
     451    case "var": 
     452        $object->set_mime(setmime($downloadname)); 
     453        $object->set_bydata($downloaddata); 
     454        $object->set_filename($downloadname); 
     455        $object->use_resume = false; 
     456        break; 
     457} 
     458 
    401459$object->download(); 
    402460?> 
  • trunk/includes/forum_functions_include.php

    r1491 r1524  
    1414+----------------------------------------------------*/ 
    1515if (eregi("forum_functions_include.php", $_SERVER['PHP_SELF']) || !defined('INIT_CMS_OK')) die(); 
     16 
     17$current_message = array(); 
     18$codeblocks = array(); 
     19$urlblocks = array(); 
     20$blockcount = 0; 
     21$raw_color_blocks = false; 
    1622 
    1723// add a poll vote to the database 
     
    313319} 
    314320 
    315 // parse the [code] sections in a post 
    316 function parsemessage($rawmsg, $smileys=true) { 
    317  
    318     global $settings, $db_prefix; 
    319      
    320     // temp message storage 
    321     $message = ""; 
     321function _unhtmlentities($string) { 
     322 
     323    $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); 
     324    $string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string); 
     325    // replace literal entities 
     326    $trans_tbl = get_html_translation_table(HTML_ENTITIES); 
     327    $trans_tbl = array_flip($trans_tbl); 
     328    return strtr($string, $trans_tbl); 
     329} 
     330 
     331function _parseubb_codeblock($matches) { 
     332    global $codeblocks, $blockcount, $current_message, $raw_color_blocks; 
     333 
     334    // empty code block? 
     335    if (trim($matches[2]) == "") { 
     336        // remove the code block entirely 
     337        return ""; 
     338    } 
     339    // trim the values passed 
     340    $matches[1] = trim(substr($matches[1],1)); 
     341 
     342    if ($raw_color_blocks == false) { 
     343        require_once PATH_GESHI."/geshi.php"; 
     344        $geshi =& new GeSHi("", ""); 
     345        // colorize the code 
     346        $geshi->set_language($matches[1]); 
     347        $geshi->set_header_type(GESHI_HEADER_DIV); 
     348        $geshi->set_tab_width(4); 
     349        $geshi->set_source(_unhtmlentities($matches[2])); 
     350        $matches[2] = $geshi->parse_code(); 
     351    } 
     352 
     353    if ($raw_color_blocks) { 
     354        $codeblocks[] = array($matches[2], $matches[1]); 
     355        return true; 
     356    } 
     357 
     358    // generate the linenumbers 
     359    $ln = ""; 
     360    $cnt = substr_count($matches[2], "\n")+1; 
     361    for ($i=1;$i<=$cnt;$i++) { 
     362        $ln .= $i."<br />"; 
     363    } 
     364    $id = count($codeblocks); 
     365    ++$blockcount; 
     366    $link = "<img src='".THEME."images/panel_on.gif' alt='' title='Toggle full code view' name='b_code_".$id."' onclick=\"javascript:flipOverflow('code_".$id."')\" />"; 
     367    $link .= "<div class='side' style='display:inline;'> <a href='".BASEDIR."getfile.php?type=fc&amp;forum_id=".$current_message['forum_id']."&amp;thread_id=".$current_message['thread_id']."&amp;post_id=".$current_message['post_id']."&amp;id=".$id."' title='download this ".$matches[1]." code'>download</a> </div>"; 
     368    $codeblocks[] = array(" 
     369    <div id='box_code_".$id."' class='codecontainer'> 
     370    <table class='codeblock' cellpadding='0' cellspacing='0'> 
     371        <tr style='padding:0px;margin:0px;'> 
     372            <td class='codenr'>".$ln."</td> 
     373            <td class='code'>".$matches[2]."</td> 
     374        </tr> 
     375    </table> 
     376    </div>".$link." 
     377    ", $matches[1]); 
     378    return "{**@".($id)."@**}"; 
     379} 
     380 
     381function _parseubb_urlblock($matches) { 
     382    global $urlblocks; 
     383 
     384    $urlblocks[] = array($matches[1]=="="?$matches[2]:substr($matches[1],1), $matches[2]); 
     385    return "{@@*".(count($urlblocks)-1)."*@@}"; 
     386} 
     387 
     388// message parser, strip [code] and [url] sections, parse for BBcode and smiley's, then insert the sections again 
     389function parsemessage($msg_array) { 
     390    global $settings, $db_prefix, $codeblocks, $urlblocks, $current_message; 
     391 
     392    // validate the parameters 
     393    if (!is_array($msg_array) || !isset($msg_array['post_message']) || !isset($msg_array['post_smileys'])) { 
     394        return ""; 
     395    } 
     396 
     397    $current_message = $msg_array; 
     398    $rawmsg = $msg_array['post_message']; 
     399    $smileys = $msg_array['post_smileys']; 
     400 
     401    // make sure these are empty! 
    322402    $codeblocks = array(); 
    323  
    324     // Split off the [code] blocks to exclude them from BBcode parsing 
    325      
    326     // find the code [code] occurence 
    327     $i = strpos($rawmsg, "[code]"); 
    328  
    329     // loop through the message until all are found and processed 
    330     while ($i !== false) { 
    331         // strip the bit before the [code] BBcode, and add a placeholder 
    332         $message .= substr($rawmsg, 0, $i+6)."{**@@**}"; 
    333         // strip the processed bit 
    334         $rawmsg = substr($rawmsg, $i+6); 
    335         // find the end of the [code] block 
    336         $j = strpos($rawmsg, "[/code]"); 
    337         // if not found, add the remaining bit, a forced [/code], and stop processing 
    338         if ($j === false) { 
    339             $message = str_replace("{**@@**}", $rawmsg, $message); 
    340             break; 
    341         } 
    342         // store this code block (convert the & to prevent entity replacement upon display) 
    343         $codeblocks[] = substr($rawmsg, 0, $j); 
    344         // strip the processed bit 
    345         $rawmsg = substr($rawmsg, $j); 
    346         // check if there are more code segments 
    347         $i = strpos($rawmsg, "[code]"); 
    348     } 
    349  
    350     // any text left? 
    351     if (strlen($rawmsg)) $message .= $rawmsg; 
    352  
    353     // Split off the [url] blocks to exclude them from url parsing 
    354     $rawmsg = $message; 
    355     $message = ""; 
    356403    $urlblocks = array(); 
    357404 
    358     // find the code [url] occurence 
    359     $i = strpos($rawmsg, "[url"); 
    360  
    361     // loop through the message until all are found and processed 
    362     while ($i !== false) { 
    363         // strip the bit before the [url] BBcode, and add a placeholder 
    364         $message .= substr($rawmsg, 0, $i+4)."{@@**@@}"; 
    365         // strip the processed bit 
    366         $rawmsg = substr($rawmsg, $i+4); 
    367         // find the end of the [url] block 
    368         $j = strpos($rawmsg, "[/url]"); 
    369         // if not found, add the remaining bit, a forced [/url], and stop processing 
    370         if ($j === false) { 
    371             $message = str_replace("{@@**@@}", $rawmsg, $message); 
    372             break; 
    373         } 
    374         // store this url block 
    375         $urlblocks[] = substr($rawmsg, 0, $j); 
    376         // strip the processed bit 
    377         $rawmsg = substr($rawmsg, $j); 
    378         // check if there are more code segments 
    379         $i = strpos($rawmsg, "[url"); 
    380     } 
    381  
    382     // any text left? 
    383     if (strlen($rawmsg)) $message .= $rawmsg; 
     405    // strip CODE bbcode, optionally perform Geshi color coding 
     406    $rawmsg = preg_replace_callback('#\[code(=.*?)?\](.*?)([\r\n]*)\[/code\]#si', '_parseubb_codeblock', $rawmsg); 
     407 
     408    // strip URL bbcode 
     409    $rawmsg = preg_replace_callback('#\[url(=.*?)\](.*?)([\r\n]*)\[/url\]#si', '_parseubb_urlblock', $rawmsg); 
    384410 
    385411    // detect and convert wikitags to wiki bbcodes if needed 
     
    393419            $replace[] = "\\1[wiki]\\2[/wiki]\\3"; 
    394420        } 
    395         $message = preg_replace($search, $replace, $message); 
    396     } 
    397  
    398     // find remaining URL's in the text, and convert them to a href as well 
    399     $pattern = '#(^|[^\"=]{1})(https?://|ftp://|mailto:|news:)([^(,\s<>\[\]\)]+)([,\s\n<>\)]|$)#sme'; 
    400     $message = preg_replace($pattern,"'$1<a href=\'$2$3\' target=\'_blank\'>'.shortenlink('$2$3',83).'</a>$4'",$message); 
     421        $rawmsg = preg_replace($search, $replace, $rawmsg); 
     422    } 
     423 
     424    // parse the smileys in the message 
     425    if ($smileys) $rawmsg = parsesmileys($rawmsg); 
     426    // parse all ubbcode 
     427    $rawmsg = parseubb($rawmsg); 
     428    // convert any newlines to html <br> 
     429    $rawmsg = nl2br($rawmsg); 
     430 
     431    // re-insert the saved code blocks 
     432    foreach($codeblocks as $key => $codeblock) { 
     433        $rawmsg = str_replace("{**@".$key."@**}", $codeblock[0], $rawmsg); 
     434    } 
     435 
    401436    // re-insert the saved url blocks 
    402     foreach($urlblocks as $urlblock) { 
    403         // find the first placeholder 
    404         $i = strpos($message, "{@@**@@}"); 
    405         $message = substr($message, 0, $i).$urlblock.substr($message, $i+8); 
    406     } 
    407  
    408     // parse the smileys in the message 
    409     if ($smileys) $message = parsesmileys($message); 
    410     // page all ubbcode 
    411     $message = parseubb($message); 
    412     // convert any newlines to html <br> 
    413     $message = nl2br($message); 
    414  
    415     // re-insert the saved code blocks 
    416     foreach($codeblocks as $codeblock) { 
    417         // split the codeblock to add linenumbers 
    418         $lines = explode("\n", stripinput($codeblock)); 
    419         // get rid of empty lines at the beginning and the end of the block 
    420         while (count($lines)>0 && trim($lines[0]) == "") { 
    421             array_shift($lines); 
    422         } 
    423         while (count($lines)>0 && trim($lines[count($lines)-1]) == "") { 
    424             array_pop($lines); 
    425         } 
    426         // only create a code block if there's code to display 
    427         if (count($lines) > 0) { 
    428             // check how wide the number column should be 
    429             $w = strlen(count($lines)); 
    430             // embedded div with the linenumbers 
    431             $codeblock = "<div><pre class='codenr'>"; 
    432             for($i=0;$i<count($lines);$i++) { 
    433                 $codeblock .= str_replace("*", "&nbsp;", str_pad($i+1, $w, "*", STR_PAD_LEFT))."\n"; 
     437    foreach($urlblocks as $key => $urlblock) { 
     438        if (isURL($urlblock[0])) { 
     439            // check if the URL is prefixed. If not, assume http:// 
     440            if (!eregi("^((https?|s?ftp|mailto|svn|cvs|callto|mms|skype)\:\/\/){1}", $urlblock[0])) { 
     441                $urlblock[0] = "http://".$urlblock[0]; 
    434442            } 
    435             $codeblock .= "</pre></div><pre class='code'>"; 
    436             // add the lines back to the code div 
    437             foreach($lines as $nr => $line) { 
    438                 $codeblock .= $line; 
    439             } 
    440             $codeblock .= "</pre>"; 
    441             // find the first placeholder 
    442             $i = strpos($message, "{**@@**}"); 
    443             $message = substr($message, 0, $i).$codeblock.substr($message, $i+8); 
     443            // convert it into a link 
     444            $rawmsg = str_replace("{@@*".$key."*@@}", "<a href='".$urlblock[0]."' alt='' target='_blank'>".$urlblock[1]."</a>", $rawmsg); 
    444445        } else { 
    445             // no code, remove the code block entirely 
    446             $i = strpos($message, "{**@@**}"); 
    447             $message = substr($message, 0, $i-6).substr($message, $i+15); 
    448         } 
    449     }    
    450     // return the parsed message body 
    451     return $message; 
     446            // make the URL harmless 
     447            $rawmsg = str_replace("{@@*".$key."*@@}", "[url=".stripinput($urlblock[0])."]".stripinput($urlblock[1])."[/url]", $rawmsg); 
     448        } 
     449    } 
     450 
     451    return $rawmsg; 
    452452} 
    453453?> 
  • trunk/includes/jscripts/core_functions.js

    r799 r1524  
    179179    } 
    180180} 
     181 
     182function whichBrowser() { 
     183    //test for Firefox/x.x or Firefox x.x (ignoring remaining digits); 
     184    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { 
     185        var ffversion=new Number(RegExp.$1); // capture x.x portion and store as a number 
     186        if (ffversion>=3) 
     187            return "FF 3"; 
     188        else if (ffversion>=2) 
     189            return "FF 2"; 
     190        else if (ffversion>=1) 
     191            return "FF 1"; 
     192    } else { 
     193        //test for MSIE x.x; 
     194        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 
     195            var ieversion=new Number(RegExp.$1); // capture x.x portion and store as a number 
     196            if (ieversion>=8) 
     197                return "IE 8"; 
     198            else if (ieversion>=7) 
     199                return "IE 7"; 
     200            else if (ieversion>=6) 
     201                return "IE 6"; 
     202            else if (ieversion>=5) 
     203                return "IE 5"; 
     204        } else { 
     205            //test for Opera/x.x or Opera x.x (ignoring remaining decimal places); 
     206            if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { 
     207                var oprversion=new Number(RegExp.$1); // capture x.x portion and store as a number 
     208                if (oprversion>=10) 
     209                    return "OP 10"; 
     210                else if (oprversion>=9) 
     211                    return "OP 9"; 
     212                else if (oprversion>=8) 
     213                    return "OP 8"; 
     214                else if (oprversion>=7) 
     215                    return "OP 7"; 
     216                else 
     217                    document.write("n/a"); 
     218            } else { 
     219                document.write("n/a"); 
     220            } 
     221        } 
     222    } 
     223} 
  • trunk/includes/templates/admin.activation.tpl

    r1173 r1524  
    4545            </td> 
    4646            <td class='{cycle values='tbl1,tbl2'}' style='text-align:center;width:1%;white-space:nowrap;'> 
    47                 {imagelink link=$smarty.const.FUSION_SELF|cat:$aidlink|cat:"&amp;step=activate&amp;user_code="|cat:$newusers[id].user_code image="page_green.gif" alt="$locale.406 title=$locale.406}&nbsp; 
    48                 {imagelink link=$smarty.const.FUSION_SELF|cat:$aidlink|cat:"&amp;step=delete&amp;user_code="|cat:$newusers[id].user_code image="page_delete.gif" alt="$locale.407 title=$locale.407} 
     47                {if $settings.email_activation == 1} 
     48                    {imagelink link=$smarty.const.FUSION_SELF|cat:$aidlink|cat:"&amp;step=activate&amp;user_code="|cat:$newusers[id].user_code image="page_green.gif" alt="$locale.406 title=$locale.406}&nbsp; 
     49                    {imagelink link=$smarty.const.FUSION_SELF|cat:$aidlink|cat:"&amp;step=delete&amp;user_code="|cat:$newusers[id].user_code image="page_delete.gif" alt="$locale.407 title=$locale.407} 
     50                {else} 
     51                    {imagelink link=$smarty.const.FUSION_SELF|cat:$aidlink|cat:"&amp;step=activate&amp;user_id="|cat:$newusers[id].user_id image="page_green.gif" alt="$locale.406 title=$locale.406}&nbsp; 
     52                    {imagelink link=$smarty.const.FUSION_SELF|cat:$aidlink|cat:"&amp;step=delete&amp;user_id="|cat:$newusers[id].user_id image="page_delete.gif" alt="$locale.407 title=$locale.407} 
     53                {/if} 
    4954            </td> 
    5055        </tr> 
  • trunk/includes/templates/forum.viewthread.tpl

    r1195 r1524  
    1515{*                                                                         *} 
    1616{***************************************************************************} 
     17<script type='text/javascript'> 
     18function jumpForum(forumid) {ldelim} 
     19    document.location.href='{$smarty.const.FORUM}viewforum.php?forum_id='+forumid; 
     20{rdelim} 
     21{literal} 
     22function flipOverflow(who) { 
     23    var tmp; 
     24    var status; 
     25    if (document.images['b_' + who].src.indexOf('_on') == -1) {  
     26        tmp = document.images['b_' + who].src.replace('_off', '_on'); 
     27        document.getElementById('box_' + who).style.overflowX = 'hidden'; 
     28        document.getElementById('box_' + who).style.overflow = 'hidden'; 
     29    } else {  
     30        tmp = document.images['b_' + who].src.replace('_on', '_off'); 
     31        var browser = whichBrowser(); 
     32        if (browser == 'IE 6' || browser == 'IE 7') { 
     33            document.getElementById('box_' + who).style.overflowX = 'scroll'; 
     34        } else { 
     35            document.getElementById('box_' + who).style.overflow = 'visible'; 
     36        } 
     37    } 
     38    document.images['b_' + who].src = tmp; 
     39    return false; 
     40}{/literal} 
     41</script> 
    1742{include file="_opentable.tpl" name=$_name title=$locale.500 state=$_state style=$_style} 
    1843<table cellspacing='0' cellpadding='0' width='100%'> 
     
    221246{include file="_closetable.tpl"} 
    222247{/if} 
    223 <script type='text/javascript'> 
    224 function jumpForum(forumid) {ldelim} 
    225     document.location.href='{$smarty.const.FORUM}viewforum.php?forum_id='+forumid; 
    226 {rdelim} 
    227 </script> 
    228248{***************************************************************************} 
    229249{* End of template                                                         *} 
  • trunk/includes/templates/main.pm.renderpm.tpl

    r1352 r1524  
    4040            </span> 
    4141        </td> 
    42         <td class='tbl_top_mid' style='text-align:right;white-space:nowrap'> 
     42        <td class='tbl_top_mid' style='text-align:right;'> 
    4343            {if !$is_preview} 
    4444                {buttonlink name=$locale.423 link=$smarty.const.FUSION_SELF|cat:"?folder="|cat:$folder|cat:"&amp;action=forward&amp;msg_id="|cat:$messages[id].pmindex_id}&nbsp; 
  • trunk/includes/templates/main.pm.tpl

    r1352 r1524  
    152152                    {section name=rc loop=$messages[id].readstatus} 
    153153                        {if $smarty.section.rc.first} 
    154                             <br />{$locale.542} 
     154                            {$locale.542}:<br /> 
    155155                        {/if} 
    156                         <a href='{$smarty.const.BASEDIR}profile.php?lookup={$messages[id].readstatus[rc].user_id}'>{$messages[id].readstatus[rc].user_name}</a> 
    157                         {$locale.543} {$messages[id].readstatus[rc].datestamp|date_format:"forumdate"} 
     156                        <a href='{$smarty.const.BASEDIR}profile.php?lookup={$messages[id].readstatus[rc].user_id}'>{$messages[id].readstatus[rc].user_name}</a>: 
     157                        {if $messages[id].readstatus[rc].read} 
     158                            {$messages[id].readstatus[rc].datestamp|date_format:"forumdate"} 
     159                        {else} 
     160                            {$locale.543} 
     161                        {/if} 
    158162                        {if !$smarty.section.rc.last},{/if} 
    159163                    {/section} 
  • trunk/pm.php

    r1352 r1524  
    133133 
    134134    // parse the messsage body 
    135     $msgrec['pm_message'] = parsemessage($msgrec['pm_message'], $msgrec['pm_smileys']==0); 
     135    $_s = $msgrec['pm_smileys']; 
     136    $msgrec['post_smileys'] = $msgrec['pm_smileys']==0; 
     137    $msgrec['post_message'] = $msgrec['pm_message']; 
     138    $msgrec['pm_message'] = parsemessage($msgrec); 
     139    $msgrec['pm_smileys'] = $_s; 
    136140     
    137141    // check if the users avatar exists 
  • trunk/register.php

    r1449 r1524  
    1717require_once PATH_INCLUDES."dns_functions.php"; 
    1818 
     19// do we want extensive email checks? 
     20define('CHECK_EMAIL', true); 
     21 
    1922// temp storage for template variables 
    2023$variables = array(); 
     
    3841            $user_info = unserialize($data['user_info']); 
    3942            $activation = $settings['admin_activation'] == "1" ? "2" : "0"; 
    40             $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_fullname, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status, user_newsletters) VALUES('".$user_info['user_name']."', '".$user_info['user_fullname']."', '".md5(md5($user_info['user_password']))."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', 'Default', '".$user_info['user_offset']."', '', '', '0', '".time()."', '".time()."', '".USER_IP."', '', '', '101', '$activation', '1')"); 
     43            $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_fullname, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_locale, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status, user_newsletters) VALUES('".$user_info['user_name']."', '".$user_info['user_fullname']."', '".md5(md5($user_info['user_password']))."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', '".$settings['locale']."', 'Default', '".$user_info['user_offset']."', '', '', '0', '".time()."', '".time()."', '".USER_IP."', '', '', '101', '$activation', '1')"); 
    4144            $result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'");    
    4245            if ($settings['admin_activation'] == "1") { 
     
    7477        } 
    7578         
    76         $email_domain = substr(strrchr($email, "@"), 1); 
    77         if (CMS_getmxrr($email_domain, $mxhosts)) { 
    78             // Get the hostname the MX record points to 
    79             $mailhost = $mxhosts[0]; 
    80         } else { 
    81             // No MX record for this domain. Might be a hostname that accepts email 
    82             $mailhost = $email_domain; 
    83         } 
    84         $mailhost_ip = gethostbyname($mailhost); 
    85         if ($mailhost != $mailhost_ip) { 
    86             // found the mailserver for this email address. Check if the address exists 
    87             require_once PATH_INCLUDES.'smtp_include.php'; 
    88             $mail = new SMTP(); 
    89             if (!$mail->Connect($mailhost_ip, 0, 60)) {     // default SMTP port, 60sec timeout 
    90                 // mail server doesn't respond 
    91                 $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    92             } else { 
    93                 if (!$mail->Hello(substr(strrchr($settings['siteemail'], "@"), 1))) { 
    94                     // mail server doesn't respond to HELLO message 
     79        if (CHECK_EMAIL) { 
     80            $email_domain = substr(strrchr($email, "@"), 1); 
     81            if (CMS_getmxrr($email_domain, $mxhosts)) { 
     82                // Get the hostname the MX record points to 
     83                $mailhost = $mxhosts[0]; 
     84            } else { 
     85                // No MX record for this domain. Might be a hostname that accepts email 
     86                $mailhost = $email_domain; 
     87            } 
     88            $mailhost_ip = gethostbyname($mailhost); 
     89            if ($mailhost != $mailhost_ip) { 
     90                // found the mailserver for this email address. Check if the address exists 
     91                require_once PATH_INCLUDES.'smtp_include.php'; 
     92                $mail = new SMTP(); 
     93                if (!$mail->Connect($mailhost_ip, 0, 60)) {     // default SMTP port, 60sec timeout 
     94                    // mail server doesn't respond 
    9595                    $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    9696                } else { 
    97                     if (!$mail->Mail('address-validation'.strrchr($settings['siteemail'], "@"))) { 
    98                         // mail server doesn't respond to MAIL FROM message 
     97                    if (!$mail->Hello(substr(strrchr($settings['siteemail'], "@"), 1))) { 
     98                        // mail server doesn't respond to HELLO message 
    9999                        $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    100100                    } else { 
    101                         if (!$mail->CheckRecipient($email)) { 
    102                             // mail server doesn't respond to RCPT TO message 
    103                             $error .= sprintf($locale['414'], $email, $mailhost)."<br /><br />\n"; 
     101                        if (!$mail->Mail('address-validation'.strrchr($settings['siteemail'], "@"))) { 
     102                            // mail server doesn't respond to MAIL FROM message 
     103                            $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    104104                        } else { 
    105                             // email address is accepted 
     105                            if (!$mail->CheckRecipient($email)) { 
     106                                // mail server doesn't respond to RCPT TO message 
     107                                $error .= sprintf($locale['414'], $email, $mailhost)."<br /><br />\n"; 
     108                            } else { 
     109                                // email address is accepted 
     110                            } 
    106111                        } 
    107112                    } 
     113                    $mail->Quit(); 
    108114                } 
    109                 $mail->Quit(); 
    110             } 
    111         } else { 
    112             $error .= sprintf($locale['412'], $email_domain)."<br /><br />\n"; 
    113         } 
    114      
     115            } else { 
     116                $error .= sprintf($locale['412'], $email_domain)."<br /><br />\n"; 
     117            } 
     118        } 
     119 
    115120        $result = dbquery("SELECT * FROM ".$db_prefix."blacklist WHERE blacklist_email='".$email."' OR blacklist_email='$email_domain'"); 
    116121        if (dbrows($result) != 0) $error .= $locale['411']."<br /><br />\n"; 
     
    161166            $user_sig = isset($_POST['user_sig']) ? stripinput(trim($_POST['user_sig'])) : ""; 
    162167        } 
     168        error_reporting(E_ALL); 
    163169        if ($error == "") { 
    164170            if ($settings['email_verification'] == "1") { 
     
    193199            } else { 
    194200                $activation = $settings['admin_activation'] == "1" ? "2" : "0"; 
    195                 $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('$username', md5(md5('".$password1."')), '".$email."', '$user_hide_email', '$user_location', '$user_birthdate', '$user_aim', '$user_icq', '$user_msn', '$user_yahoo', '$user_web', '$user_theme', '$user_offset', '', '$user_sig', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')"); 
     201                $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_locale, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('$username', md5(md5('".$password1."')), '".$email."', '$user_hide_email', '$user_location', '$user_birthdate', '$user_aim', '$user_icq', '$user_msn', '$user_yahoo', '$user_web', '$user_theme', '".$settings['locale']."', '$user_offset', '', '$user_sig', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')"); 
    196202                if ($settings['admin_activation'] == "1") { 
    197203                    $variables['message'] = $locale['453']; 
     204                    // send the webmaster a PM that an account needs to be activated 
     205                    $result = dbquery("INSERT INTO ".$db_prefix."pm (pm_subject, pm_message, pm_recipients, pm_size, pm_datestamp) VALUES ('".$locale['509']."', '".mysql_escape_string(sprintf($locale['510'], $username))."', '1', '100', '".time()."')"); 
     206                    if ($result) { 
     207                        $pm_id = mysql_insert_id(); 
     208                        $result = dbquery("INSERT INTO ".$db_prefix."pm_index (pm_id, pmindex_user_id, pmindex_from_id, pmindex_to_id, pmindex_folder) VALUES ('".$pm_id."', '1', '1', '1', '0')"); 
     209                    } 
    198210                } else { 
    199211                    $variables['message'] = $locale['452']; 
  • trunk/themes/ExiteCMS/templates/templates/_stylesheets.tpl

    r1484 r1524  
    4949 
    5050                        /* buttons */ 
    51 .button                 { font-size:90%; font-weight:normal; width:auto; overflow:visible; font-weight: bold; color:#ffffff; background-color:#666; border-top:1px #bbb solid; border-left:1px #bbb solid; border-bottom:1px #000 solid; border-right:1px #000 solid; cursor:pointer; margin:2px 0px 2px 0px; padding:0px; } 
     51.button                 { font-size:0.8em; font-weight:normal; width:auto; overflow:visible; font-weight: bold; color:#ffffff; background-color:#666; border-top:1px #bbb solid; border-left:1px #bbb solid; border-bottom:1px #000 solid; border-right:1px #000 solid; cursor:pointer; margin:2px 0px 2px 0px; padding:0px; } 
    5252.button:hover           { color:#666; background-color:#ddd; border-top:1px #999 solid; border-left:1px #999 solid; border-bottom:1px #fff solid; border-right:1px #fff solid; } 
    5353 
     
    5858 
    5959                        /* page body (normal/user mode + maintenance/webmaster mode) */ 
    60 body                    { font-size:1em; font-family:Verdana,"Bitstream Vera Sans","Deja Vu Sans",Arial,Sans-Serif; margin:4px 10px 5px 10px; } 
     60body                    { font-size:1em; font-family:Verdana,"Bitstream Vera Sans","Deja Vu Sans",Arial,Sans-Serif; margin:4px 10px 5px 10px; width:100%; } 
    6161.body                   { color:#444; background-color:#aaa; } 
    6262.body-maint             { color:#444; background-color:{/literal}{$settings.maintenance_color}{literal}; } 
     
    176176.quote                  { color:#333; background-color:#ddd; padding:4px; margin:5px 10px 5px 10px; border:1px #444 solid; } 
    177177 
    178                         /* code sections within the message body */ 
    179 .codeblock              { font-family: courier, monospace; font-size:110%; margin:5px 20px 5px 20px; overflow-x:auto; white-space: nowrap} 
    180 .code                   { margin:0px; padding:0 0 0 5px; border:1px #bbb solid; background-color:#fff; overflow-x:hidden} 
    181 .codenr                 { margin:0px; padding:0px 3px 0px 3px; border:1px #bbb solid; background-color:#ddd; float:left; } 
     178.codecontainer          { width:480px; background-color:#ffffef; border:1px #bbb solid; overflow:hidden; position:relative; z-index:1; } 
     179.codeblock              { } 
     180.codenr                 { font-family:monospace; font-size:1em; background-color:#fffef; padding: 0px 5px 0px 5px; vertical-align:top; } 
     181.code                   { font-family:monospace; background-color:#ffffef; white-space:nowrap; } 
    182182 
    183183                        /* thumbnail caption in the message body */ 
Note: See TracChangeset for help on using the changeset viewer.