plugins/SpecialUserFuncs.php
changeset 345 4ccdfeee9a11
parent 343 eefe9ab7fe7c
child 348 87e08a6e4fec
equal deleted inserted replaced
344:be6c5fdd9203 345:4ccdfeee9a11
   515   {
   515   {
   516     $_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
   516     $_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
   517     
   517     
   518     $captcharesult = $session->get_captcha($_POST['captchahash']);
   518     $captcharesult = $session->get_captcha($_POST['captchahash']);
   519     $session->kill_captcha();
   519     $session->kill_captcha();
   520     if($captcharesult != $_POST['captchacode'])
   520     if ( strtolower($captcharesult) != strtolower($_POST['captchacode']) )
   521     {
   521     {
   522       $s = $lang->get('user_reg_err_captcha');
   522       $s = $lang->get('user_reg_err_captcha');
   523     }
   523     }
   524     else
   524     else
   525     {
   525     {
   944       </enano:no-opt>
   944       </enano:no-opt>
   945     <?php
   945     <?php
   946   }
   946   }
   947   else
   947   else
   948   {
   948   {
   949     $year = intval( date('Y') );
   949     $year = intval( enano_date('Y') );
   950     $year = $year - 13;
   950     $year = $year - 13;
   951     $month = date('F');
   951     $month = enano_date('F');
   952     $day = date('d');
   952     $day = enano_date('d');
   953     
   953     
   954     $yo13_date = "$month $day, $year";
   954     $yo13_date = "$month $day, $year";
   955     $link_coppa_yes = makeUrlNS('Special', 'Register', 'coppa=yes', true);
   955     $link_coppa_yes = makeUrlNS('Special', 'Register', 'coppa=yes', true);
   956     $link_coppa_no  = makeUrlNS('Special', 'Register', 'coppa=no',  true);
   956     $link_coppa_no  = makeUrlNS('Special', 'Register', 'coppa=no',  true);
   957     
   957     
  1049     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  1049     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  1050     
  1050     
  1051     echo '<tr>';
  1051     echo '<tr>';
  1052     
  1052     
  1053     // date & time
  1053     // date & time
  1054     echo '  <td class="' . $cls . '">' . date('d M Y h:i a', $row['time_id']) . '</td>';
  1054     echo '  <td class="' . $cls . '">' . enano_date('d M Y h:i a', $row['time_id']) . '</td>';
  1055     
  1055     
  1056     // page & link to said page
  1056     // page & link to said page
  1057     echo '  <td class="' . $cls . '"><a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '">' . get_page_title_ns($row['page_id'], $row['namespace']) . '</a></td>';
  1057     echo '  <td class="' . $cls . '"><a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '">' . get_page_title_ns($row['page_id'], $row['namespace']) . '</a></td>';
  1058     
  1058     
  1059     switch ( $row['action'] )
  1059     switch ( $row['action'] )
  1808    */
  1808    */
  1809   
  1809   
  1810   function format_date($time)
  1810   function format_date($time)
  1811   {
  1811   {
  1812     global $lang;
  1812     global $lang;
  1813     // Our formattting string to pass to date()
  1813     // Our formattting string to pass to enano_date()
  1814     // This should not include minute/second info, only today's date in whatever format suits your fancy
  1814     // This should not include minute/second info, only today's date in whatever format suits your fancy
  1815     $formatstring = 'F j, Y';
  1815     $formatstring = 'F j, Y';
  1816     // Today's date
  1816     // Today's date
  1817     $today = date($formatstring);
  1817     $today = enano_date($formatstring);
  1818     // Yesterday's date
  1818     // Yesterday's date
  1819     $yesterday = date($formatstring, (time() - (24*60*60)));
  1819     $yesterday = enano_date($formatstring, (time() - (24*60*60)));
  1820     // Date on the input
  1820     // Date on the input
  1821     $then = date($formatstring, $time);
  1821     $then = enano_date($formatstring, $time);
  1822     // "X days ago" logic
  1822     // "X days ago" logic
  1823     for ( $i = 2; $i <= 6; $i++ )
  1823     for ( $i = 2; $i <= 6; $i++ )
  1824     {
  1824     {
  1825       // hours_in_day * minutes_in_hour * seconds_in_minute * num_days
  1825       // hours_in_day * minutes_in_hour * seconds_in_minute * num_days
  1826       $offset = 24 * 60 * 60 * $i;
  1826       $offset = 24 * 60 * 60 * $i;
  1827       $days_ago = date($formatstring, (time() - $offset));
  1827       $days_ago = enano_date($formatstring, (time() - $offset));
  1828       // so does the input timestamp match the date from $i days ago?
  1828       // so does the input timestamp match the date from $i days ago?
  1829       if ( $then == $days_ago )
  1829       if ( $then == $days_ago )
  1830       {
  1830       {
  1831         // yes, return $i
  1831         // yes, return $i
  1832         return $lang->get('userfuncs_ml_date_daysago', array('days_ago' => $i));
  1832         return $lang->get('userfuncs_ml_date_daysago', array('days_ago' => $i));
  1868     $lang_local =& $lang;
  1868     $lang_local =& $lang;
  1869   else
  1869   else
  1870     $lang_local = new Language($lang_id);
  1870     $lang_local = new Language($lang_id);
  1871   
  1871   
  1872   
  1872   
  1873   $timestamp = date('D, j M Y H:i:s T', $lang_local->lang_timestamp);
  1873   $timestamp = enano_date('D, j M Y H:i:s T', $lang_local->lang_timestamp);
  1874   header("Last-Modified: $timestamp");
  1874   header("Last-Modified: $timestamp");
  1875   header("Date: $timestamp");
  1875   header("Date: $timestamp");
  1876   header('Content-type: text/javascript');
  1876   header('Content-type: text/javascript');
  1877   
  1877   
  1878   $lang_local->fetch();
  1878   $lang_local->fetch();