function validate_birthday($birth_date) { $age = calculate_age($birth_date); if ($age->y < 7 || $age->y > 12) { return false; } return true; }
protected function calculate_age($date, $format = 'm/d/Y') { if (defined('STRICT_TYPES') && CAMEL_CASE == '1') { return (double) self::parameters(['date' => DT::STRING, 'format' => DT::STRING])->call(__FUNCTION__)->with($date, $format)->returning(DT::FLOAT); } else { return (double) calculate_age($date, $format); } }
function edited_message($original_time, $edit_time, $edit_mod) { if ($edit_time) { echo '<p class="unimportant">(Edited ' . calculate_age($original_time, $edit_time) . ' later'; if ($edit_mod) { echo ' by a moderator'; } echo '.)</p>'; } }
<?php header('Content-Type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; echo '<response>'; include_once "commonfunctions.php"; $dob = $_GET['dateofbirth']; //Validation code starts here $validation = true; $regex = '/^(0?[1-9]|[12][0-9]|3[01])[-\\/](0?[1-9]|1[012])[-\\/](19|20)\\d\\d$/'; if (!preg_match($regex, $dob)) { print "Invalid Date Of Birth Value!"; $validation = false; } if (!$validation) { print "Validation Failed!"; return; } list($day, $month, $year) = explode("-", $dob); $age = calculate_age($year, $month, $day); print $age; echo '</response>';
while (list($fail_time, $fail_uid, $fail_reason, $fail_headline, $fail_body) = $res->FetchRow()) { if (strlen($fail_body) > 600) { $fail_body = substr($fail_body, 0, 600) . ' …'; } $tooltip = ''; if (empty($fail_headline)) { $tooltip = $fail_body; } else { if (!empty($fail_body)) { $tooltip = 'Headline: ' . $fail_headline . ' Body: ' . $fail_body; } } $fail_reasons = unserialize($fail_reason); $error_message = '<ul class="error_message'; if (!empty($tooltip)) { $error_message .= ' help'; } $error_message .= '" title="' . htmlspecialchars($tooltip) . '">'; foreach ($fail_reasons as $reason) { $error_message .= '<li>' . $reason . '</li>'; } $error_message .= '</ul>'; $values = array($error_message, '<a href="/profile/' . $fail_uid . '">' . $fail_uid . '</a>', '<span class="help" title="' . format_date($fail_time) . '">' . calculate_age($fail_time) . '</span>'); if (!$moderator && !$administrator) { array_splice($values, 1, 1); } $table->Row($values); } echo $table->Output('failed postings'); Output::$tpl->display('dashfooter.tpl.php'); require 'includes/footer.php';
<h3 style="text-align: center"><?php echo $employee['name'][0]; ?> <?php echo $employee['father_name'][0]; ?> </h3> <h6 style="text-align: center"><?php echo $employee['designation'][0] ? ucwords($employee['designation'][0]) : ''; ?> </h6> <h6 style="text-align: center;background: rgb(235, 235, 235);padding: 10px;"><strong><?php _e('At work for', 'wp-hrms'); ?> : </strong><?php echo $employee['date_of_joining'][0] ? calculate_age($employee['date_of_joining'][0]) : ''; ?> </h6> </div> <!--End Left Sidebar--> <div class="col-md-12"> <!--Profile Body--> <div class="profile-body"> <div class="row margin-bottom-20"> <!--Profile Post--> <div class="col-sm-12"> <div class="panel panel-profile no-bg"> <div class="panel-heading overflow-h"> <h2 class="panel-title heading-sm pull-left"><i class="fa fa-user"></i><?php _e('Personal Details', 'wp-hrms'); ?>
$program = get_id_from_program($i); echo <<<XYZ <tr> <th colspan="3">{$program} </th> </tr> XYZ; while ($row = mysqli_fetch_array($result)) { $imagefilePath = str_replace(" ", "_", $UPLOAD_DIR . $row['image_filename']); $child_name = $row['first_name'] . " " . $row['last_name']; $nick_name = $row['nickname']; $parent_name = $row['pfname'] . " " . $row['plname']; $primary_phone = $row['primary_phone']; $emergency_phone = $row['emergency_phone']; $emergency_name = $row['emergency_name']; $bday = $row['birthdate']; $age = calculate_age($bday)->format('%y years'); echo <<<ENDBLOCK \t\t<tr> \t\t <td rowspan ="8"> <img id="uploadImg" src={$imagefilePath}> \t\t</tr> \t\t<tr> <td>Child Name </td> <td>{$child_name} </td> </tr> \t\t<tr> <td>Child NickName </td> <td>{$nick_name} </td> </tr> \t\t\t<tr> <td>Child Age </td> <td>{$age} </td>
if ($uid == $_SESSION['UID']) { $uid = 'You!'; } else { if (isPowerUser()) { $uid = '<a href="/profile/' . $uid . '">' . $uid . '</a>'; } else { $uid = '?'; } } $bump = calculate_age($age, $_SERVER['REQUEST_TIME']); $headline = htmlspecialchars($headline); $action = $actions[$action]; // Unknown or unrecorded actions are bypassed if ($action == null) { continue; } // Repeated actions are listed as (See above) if ($action == $old_action) { $temp = '<span class="unimportant">(See above)</span>'; } else { $old_action = $action; $temp = $action; } $values = array($action, $uid, '<span class="help" title="' . format_date($age) . '">' . calculate_age($age) . '</span>'); $table->row($values); } echo $table->output(); if ($count > 100) { echo '<p class="unimportant">(There are <b>a lot</b> of people active right now. Not all are shown here.)</p>'; } require 'includes/footer.php';
if($thread==0) { $page_title=htmlentities($title); $OP=$from; } } if(!in_array($to,$participants)) $participants[]=$to; if($from==$User->ID) $from='<a href="#">You</a>'; else $from="User $from"; if($to==$User->ID) $to='<a href="#">yourself</a>'; $title=htmlentities($title); $date=calculate_age($date); $url=THISURL.'/private_messages.php/thread/'.(($thread==0)?$id:$thread).'/#pm'.$id; $body=parse($body); echo " <h3>$from sent $to "$title" $date ago.<span class=\"reply_id\"><a name=\"pm{$id}\" href=\"{$url}\">#{$id}</a></span></h3> <div class=\"body\"> {$body} </div> "; } if(!in_array($User->ID,$participants)) Output::HardError('You\'re not invited.'); ?> <form action="" method="post"> <h3><b>Reply to Private Thread:</b></h3> <div class="body">
</div> <div class="row"> <input type="submit" name="post" tabindex="4" value="Post bulletin" class="inline" /> </div> </div> </form> <? } } // We don't need to prepare it unless we're executing it multiple f*****g times (which we shouldn't be) $res=DB::Execute('SELECT id, time, author, body FROM {P}Bulletins ORDER BY id DESC LIMIT 20'); // Limit added to limit CPU load while(list($bulletin_id, $bulletin_time, $bulletin_author, $bulletin_body)=$res->FetchRow()) { ?> <h3> <?=$bulletin_author?> posted a bulletin <?=calculate_age($bulletin_time)?> ago. <span class="reply_id unimportant"> <a name="b<?=number_format($bulletin_id)?>" href="<?=THISURL?>/bulletins#b<?=number_format($bulletin_id)?>">#<?=number_format($bulletin_id)?></a> </span> </h3> <div class="body"> <?=stripslashes($bulletin_body)?> </div> <? } require('includes/footer.php');
<th class="minimal">Banned IP addresses</th> <td class="minimal"><?php echo format_number($num_ip_bans); ?> </td> <td>-</td> </tr> <tr class="odd"> <th class="minimal">Days since launch</th> <td class="minimal"><?php echo number_format($days_since_start); ?> </td> <td>Went live on <?php echo date('Y-m-d', SITE_FOUNDED) . ', ' . calculate_age(SITE_FOUNDED); ?> ago.</td> </tr> </table> <table> <tr> <th></th> <th>Amount</th> </tr> <tr class="odd"> <th class="minimal">Total posts by you</th> <td><?php echo format_number($your_posts);
$tbl->DefineColumns(array('Remove','#','Forbidden Text','Why','Punishment'),'Forbidden Text'); $tbl->SetTDClass('Remove','chkboxes'); $res=DB::Execute('SELECT filID,filText,filReason,filPunishType,filPunishDuration,filReplacement FROM {P}Filters ORDER BY filText ASC'); while(list($id,$txt,$reason,$punish,$expiry,$replacement) = $res->FetchRow()) { $puntxt=''; switch($punish) { // Replace text with "x" case PUNISH_REPLACE: $puntxt='<b>Replace text with:</b><br />'.$replacement; break; // Ban user for timespec case PUNISH_BAN: $puntxt='<b>Ban user for '.calculate_age($expiry+time(),time()).'.</b>'; break; case PUNISH_ERROR: $puntxt='<b>Display a 403 and stop posting.</b>'; break; default: $puntxt="<b>Unknown: \$punish=$punish; \$expiry=$expiry; \$replacement=$replacement;</b>"; break; } $r = array('<input type="checkbox" name="del_filter[]" value="'.$id.'" />',$id,"<code>$txt</code",$reason,$puntxt); $tbl->Row($r); } Output::Assign('tbl',$tbl); Output::Assign('Options',array( PUNISH_REPLACE => 'Replace', PUNISH_BAN => 'Ban',
$page_title = 'Your post history, page #' . number_format($current_page); } $items_per_page = ITEMS_PER_PAGE; $start_listing_at = $items_per_page * ($current_page - 1); /* TOPICS */ $res = DB::Execute('SELECT id, time, replies, visits, headline FROM {P}Topics WHERE author = ? ORDER BY id DESC LIMIT ?, ?', array($_SESSION['UID'], $start_listing_at, $items_per_page)); $topics = new TablePrinter('tblTopics'); $columns = array('Headline', 'Replies', 'Visits', 'Age ▼'); $topics->DefineColumns($columns, 'Headline'); $topics->SetTDClass('Headline', 'topic_headline'); while (list($topic_id, $topic_time, $topic_replies, $topic_visits, $topic_headline) = $res->FetchRow()) { $values = array('<a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>', replies($topic_id, $topic_replies), format_number($topic_visits), '<span class="help" title="' . format_date($topic_time) . '">' . calculate_age($topic_time) . '</span>'); $topics->Row($values); } $num_topics_fetched = $topics->num_rows_fetched; echo $topics->Output('topics'); /* REPLIES */ $res = DB::Execute('SELECT replies.id, replies.parent_id, replies.time, replies.body, topics.headline, topics.time FROM {P}Replies as replies INNER JOIN {P}Topics as topics ON replies.parent_id = topics.id WHERE replies.author = ? ORDER BY id DESC LIMIT ?, ?', array($_SESSION['UID'], $start_listing_at, $items_per_page)); $replies = new TablePrinter('tblReplies'); $columns = array('Reply snippet', 'Topic', 'Age ▼'); $replies->DefineColumns($columns, 'Topic'); $replies->SetTDClass('Topic', 'topic_headline'); $replies->SetTDClass('Reply snippet', 'reply_body_snippet'); while (list($reply_id, $parent_id, $reply_time, $reply_body, $topic_headline, $topic_time) = $res->FetchRow()) { $values = array('<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>', '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>', '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>'); $replies->Row($values); } $num_replies_fetched = $replies->num_rows_fetched; echo $replies->Output('replies'); page_navigation('history', $current_page, $num_replies_fetched); require 'includes/footer.php';
<?$reply->PrintAuthorName()?> <?php echo $reply->Action; ?> this <strong><span class="help" title="<?php echo format_date($reply->Time); ?> "><?php echo calculate_age($reply->Time); ?> ago</span></strong>, <?php echo calculate_age($reply->Time, $prevtime); ?> later<? if($c>0) echo ', ' . calculate_age($reply->Time, $this->topic->Time) . ' after the original post'; ?> <span class="reply_id unimportant"> <a href="#reply_<?php echo $reply->ID; ?> " onclick="highlightReply('<?php echo $reply->ID; ?> '); removeSnapbackLink"> #<?php echo number_format($reply->ID); ?> </a> </span>
function displayTable($onlyimgdel) { global $mysql; $delno = array(dummy); $delflag = FALSE; reset($_POST); while ($item = each($_POST)) { if ($item[1] == 'delete') { array_push($delno, $item[0]); $delflag = TRUE; } } if ($delflag) { if (!($result = $mysql->query("select * from " . SQLLOG . ""))) { echo S_SQLFAIL; } $find = FALSE; while ($row = $mysql->fetch_row($result)) { list($no, $now, $name, $email, $sub, $com, $host, $pwd, $ext, $w, $h, $tn_w, $tn_h, $tim, $time, $md5, $fsize, $fname, $sticky, $permasage, $locked, $root, $resto) = $row; if ($onlyimgdel == 'on') { delete_post($no, $pwd, 1, 1, 1, 0); } else { if (array_search($no, $delno)) { //It is empty when deleting delete_post($no, $pwd, 0, 1, 1, 0); } } } } function calculate_age($timestamp, $comparison = '') { $units = array('second' => 60, 'minute' => 60, 'hour' => 24, 'day' => 7, 'week' => 4.25, 'month' => 12); if (empty($comparison)) { $comparison = $_SERVER['REQUEST_TIME']; } $age_current_unit = abs($comparison - $timestamp); foreach ($units as $unit => $max_current_unit) { $age_next_unit = $age_current_unit / $max_current_unit; if ($age_next_unit < 1) { // are there enough of the current unit to make one of the next unit? $age_current_unit = floor($age_current_unit); $formatted_age = $age_current_unit . ' ' . $unit; return $formatted_age . ($age_current_unit == 1 ? '' : 's'); } $age_current_unit = $age_next_unit; } $age_current_unit = round($age_current_unit, 1); $formatted_age = $age_current_unit . ' year'; return $formatted_age . (floor($age_current_unit) == 1 ? '' : 's'); } // Deletion screen display $temp .= "<form action='" . PHP_ASELF . "' method='post' id='delForm'>\n <input type=hidden name=admin value=del checked>"; $temp .= "<input type=hidden name=mode value=admin>"; $temp .= "<input type=hidden name=admin value=del>"; $temp .= "<input type=hidden name=pass value='{$pass}'>"; $temp .= "<div class='managerBanner'>" . S_DELLIST . "</div>"; $temp .= "<div class='delbuttons'><input type=submit value='" . S_ITDELETES . "'>"; $temp .= "<input type=reset value='" . S_MDRESET . "'>"; $temp .= "[<input type=checkbox name=onlyimgdel value=on><!--checked-->" . S_MDONLYPIC . "]</div>"; $temp .= "<table class='postlists' style='border-collapse:collapse;' cellspacing='0' cellpadding='0'>"; $temp .= "<tr class='postTable head'>" . S_MDTABLE1; $temp .= S_MDTABLE2; $temp .= "</tr>"; if (!($result = $mysql->query("select * from " . SQLLOG . " order by no desc"))) { $temp .= S_SQLFAIL; } $j = 0; while ($row = $mysql->fetch_row($result)) { $j++; $path = realpath("./") . '/' . IMG_DIR; $img_flag = FALSE; list($no, $now, $name, $email, $sub, $com, $host, $pwd, $ext, $w, $h, $tn_w, $tn_h, $tim, $time, $md5, $fsize, $fname, $sticky, $permasage, $locked, $root, $resto) = $row; // Format /*$now = ereg_replace('.{2}/(.*)$', '\1', $now); $now = ereg_replace('\(.*\)', ' ', $now);*/ if (strlen($name) > 10) { $name = substr($name, 0, 9) . "..."; } if (strlen($sub) > 10) { $sub = substr($sub, 0, 9) . "..."; } if ($email) { $name = "<a href=\"mailto:{$email}\">{$name}</a>"; } $com = str_replace("<br />", " ", $com); $com = htmlspecialchars($com); if (strlen($com) > 20) { $trunccom = substr($com, 0, 18) . "..."; } if (strlen($fname) > 10) { $fname = substr($fname, 0, 40) . "..." . $ext; } // Link to the picture if ($ext && is_file($path . $tim . $ext)) { $img_flag = TRUE; $clip = "<a class=\"thumbnail\" target=\"_blank\" href=\"" . IMG_DIR . $tim . $ext . "\">" . $tim . $ext . "<span><img class='postimg' src=\"" . THUMB_DIR . $tim . 's.jpg' . "\" width=\"100\" height=\"100\" /></span></a><br />"; if ($fsize >= 1048576) { $size = round($fsize / 1048576, 2) . " M"; $fsize = $asize; } else { if ($fsize >= 1024) { $size = round($fsize / 1024) . " K"; $fsize = $asize; } else { $size = $fsize . " "; $fsize = $asize; } } $all += $asize; //total calculation $md5 = substr($md5, 0, 10); } else { $clip = "[No file]"; $size = 0; $md5 = ""; } $class = $j % 2 ? "row1" : "row2"; //BG color if ($resto == '0') { $resdo = '<b>OP(<a href="' . DATA_SERVER . BOARD_DIR . "/" . RES_DIR . $no . PHP_EXT . '#' . $no . '" target="_blank" />' . $no . '</a>)</b>'; } else { $resdo = '<a href="' . DATA_SERVER . BOARD_DIR . "/" . RES_DIR . $resto . PHP_EXT . '#' . $no . '" target="_blank" />' . $resto . '</a>'; } $warnSticky = ''; if ($sticky == '1') { $warnSticky = "<b><font color=\"FF101A\">(Sticky)</font></b>"; } $temp .= "<tr class={$class}><td><input type=checkbox name=\"{$no}\" value=delete>{$warnSticky}</td>"; $temp .= "<td>{$no}</td><td>{$resdo}</td><td>{$now}</td><td>{$sub}</td>"; $temp .= "<td>{$name}</b></td><td><span title='Double-click to preview full comment' ondblclick='swap(\"trunc{$no}\", \"full{$no}\")' id='trunc{$no}'>{$trunccom}</span><span ondblclick='swap(\"full{$no}\", \"trunc{$no}\")' id='full{$no}' style='display:none;'>{$com}</span></td>"; $temp .= "<td class='postimg' >{$clip}</td><td>" . calculate_age($time) . "</td><td><input type=\"button\" text-align=\"center\" onclick=\"location.href='" . PHP_ASELF_ABS . "?mode=more&no=" . $no . "';\" value=\"Post Info\" /></td>\n"; $temp .= "</tr>"; } $mysql->free_result($result); $temp .= "<link rel='stylesheet' type='text/css' href='" . CSS_PATH . "/stylesheets/img.css' />"; //foot($dat); $all = (int) ($all / 1024); $temp .= "<div align='center'/>[ " . S_IMGSPACEUSAGE . $all . "</b> KB ]</div>"; $temp .= "</body></html>"; echo $temp; }
'IP address', 'Age ▼' ); $replies->DefineColumns($columns, 'Topic'); $replies->SetTDClass('Topic', 'topic_headline'); $replies->SetTDClass('Reply snippet', 'reply_body_snippet'); while($row=$res->FetchRow()) { list($reply_id, $parent_id, $reply_time, $reply_body, $reply_ip_address, $topic_headline, $topic_time)=$row; $values = array ( '<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>', '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>', '<a href="/IP_address/' . $reply_ip_address . '">' . $reply_ip_address . '</a>', '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>' ); $replies->Row($values); } echo $replies; } if($trash = show_trash($_GET['uid'])) { echo '<h4 class="section">Trash</h4>' . $trash; } require('includes/footer.php'); ?>
$start_time = $_SERVER['REQUEST_TIME']; if (ctype_digit($_POST['start_time'])) { $start_time = Post::GetInt('start_time', true); } echo '<div>'; // Check if OP. if ($reply && !$editing) { echo '<p>You <strong>are'; if ($_SESSION['UID'] !== $topic_author) { echo ' not'; } echo '</strong> recognized as the original poster of this topic.</p>'; } // Print deadline for edit submission. if ($editing && TIME_TO_EDIT != 0 && !$moderator && !$administrator) { echo '<p>You have <strong>' . calculate_age($_SERVER['REQUEST_TIME'], $edit_data['time'] + TIME_TO_EDIT) . '</strong> left to finish editing this post.</p>'; } // Print preview. if ($_POST['preview'] && !empty($body)) { $preview_body = parse($body); $preview_body = preg_replace('/^@([0-9,]+|OP)/m', '<span class="unimportant"><a href="#">$0</a></span>', $preview_body); echo '<h3 id="preview">Preview</h3><div class="body standalone">' . $preview_body . '</div>'; } // Check if any new {P}Replies have been posted since we last viewed the topic. if ($reply && isset($visited_topics[$_GET['reply']]) && $visited_topics[$_GET['reply']] < $topic_replies) { $new_replies = $topic_replies - $visited_topics[$_GET['reply']]; echo '<p><a href="/topic/' . $_GET['reply'] . '#new"><strong>' . $new_replies . '</strong> new repl' . ($new_replies == 1 ? 'y</a> has' : 'ies</a> have') . ' been posted in this topic since you last checked!</p>'; } // Print the main form. ?>
foreach ($ignored_phrases as $ignored_phrase) { if (stripos($topic_headline, $ignored_phrase) !== false || stripos($topic_body, $ignored_phrase) !== false) { // We've encountered an ignored phrase, so skip the rest of this while() iteration. $table->num_rows_fetched++; continue 2; } } } // Decide what to use for the last seen marker and the age/last bump column. if ($topics_mode) { $order_time = $topic_time; } else { $order_time = $topic_last_post; } // Process the values for this row of our table. $values = array('<a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>', snippet($topic_body), replies($topic_id, $topic_replies), format_number($topic_visits), '<span class="help" title="' . format_date($order_time) . '">' . calculate_age($order_time) . '</span>'); if ($_COOKIE['spoiler_mode'] != 1) { array_splice($values, 1, 1); } $table->LastSeenMarker($last_seen, $order_time); $table->Row($values); } } $num_rows_fetched = $table->num_rows_fetched; echo $table->Output('topics'); // Navigate backward or forward ... $navigation_path = 'topics'; if ($_GET['bumps']) { $navigation_path = 'bumps'; } page_navigation($navigation_path, $current_page, $num_rows_fetched);
function admindel($pass) { global $path, $onlyimgdel; $delno = array(dummy); $delflag = FALSE; reset($_POST); while ($item = each($_POST)) { if ($item[1] == 'delete') { array_push($delno, $item[0]); $delflag = TRUE; } } if ($delflag) { if (!($result = mysql_call("select * from " . SQLLOG . ""))) { echo S_SQLFAIL; } $find = FALSE; while ($row = mysql_fetch_row($result)) { list($no, $now, $name, $email, $sub, $com, $host, $pwd, $ext, $w, $h, $tim, $time, $md5, $fsize, ) = $row; if ($onlyimgdel == on) { /*if ( array_search( $no, $delno ) ) { //only a picture is deleted $delfile = $path . $tim . $ext; //only a picture is deleted if ( is_file( $delfile ) ) unlink( $delfile ); //delete if ( is_file( THUMB_DIR . $tim . 's.jpg' ) ) unlink( THUMB_DIR . $tim . 's.jpg' ); //delete }*/ delete_post($no, $pwd, 1, 1, 1, 0); } else { if (array_search($no, $delno)) { //It is empty when deleting delete_post($no, $pwd, 0, 1, 1, 0); /*$find = TRUE; if ( !mysql_call( "delete from " . SQLLOG . " where no=" . $no ) ) { echo S_SQLFAIL; } //eat the baby posts too if we kill the parent (OP) post $findchildren = mysql_call( "SELECT * FROM " . SQLLOG . " where resto=" . $no ); if ( mysql_num_rows( $findchildren ) > 0 ) { $eatchildren = mysql_call( "DELETE FROM " . SQLLOG . " where resto=" . $no ); mysql_query( $eatchildren ); } $delfile = $path . $tim . $ext; //Delete file if ( is_file( $delfile ) ) unlink( $delfile ); //Delete if ( is_file( THUMB_DIR . $tim . 's.jpg' ) ) unlink( THUMB_DIR . $tim . 's.jpg' ); //Delete*/ } } } /* mysql_free_result( $result ); if ( $find ) { //log renewal }*/ } function calculate_age($timestamp, $comparison = '') { $units = array('second' => 60, 'minute' => 60, 'hour' => 24, 'day' => 7, 'week' => 4.25, 'month' => 12); if (empty($comparison)) { $comparison = $_SERVER['REQUEST_TIME']; } $age_current_unit = abs($comparison - $timestamp); foreach ($units as $unit => $max_current_unit) { $age_next_unit = $age_current_unit / $max_current_unit; if ($age_next_unit < 1) { $age_current_unit = floor($age_current_unit); $formatted_age = $age_current_unit . ' ' . $unit; return $formatted_age . ($age_current_unit == 1 ? '' : 's'); } $age_current_unit = $age_next_unit; } $age_current_unit = round($age_current_unit, 1); $formatted_age = $age_current_unit . ' year'; return $formatted_age . (floor($age_current_unit) == 1 ? '' : 's'); } // Deletion screen display echo "<input type=hidden name=mode value=admin>\n"; echo "<input type=hidden name=admin value=del>\n"; echo "<input type=hidden name=pass value=\"{$pass}\">\n"; echo "<div class=\"dellist\">" . S_DELLIST . "</div>\n"; echo "<div class=\"delbuttons\"><input type=submit value=\"" . S_ITDELETES . "\">"; echo "<input type=reset value=\"" . S_MDRESET . "\">"; echo "[<input type=checkbox name=onlyimgdel value=on><!--checked-->" . S_MDONLYPIC . "]</div>"; echo "<table class=\"postlists\">\n"; echo "<tr class=\"managehead\">" . S_MDTABLE1; echo S_MDTABLE2; echo "</tr>\n"; if (!($result = mysql_call("select * from " . SQLLOG . " order by no desc"))) { echo S_SQLFAIL; } $j = 0; while ($row = mysql_fetch_row($result)) { $j++; $img_flag = FALSE; list($no, $now, $name, $email, $sub, $com, $host, $pwd, $ext, $w, $h, $tim, $time, $md5, $fsize, $fname, $sticky, $permasage, $locked, $root, $resto) = $row; // Format $now = ereg_replace('.{2}/(.*)$', '\\1', $now); $now = ereg_replace('\\(.*\\)', ' ', $now); if (strlen($name) > 10) { $truncname = substr($name, 0, 9) . "..."; } else { $truncname = $name; } if (strlen($sub) > 10) { $truncsub = substr($sub, 0, 9) . "..."; } else { $truncsub = $sub; } if ($email) { $name = "<a href=\"mailto:{$email}\">{$name}</a>"; } $com = str_replace("<br />", " ", $com); $com = htmlspecialchars($com); if (strlen($com) > 20) { $trunccom = substr($com, 0, 18) . "..."; } else { $trunccom = $com; } if (strlen($fname) > 10) { $truncfname = substr($fname, 0, 40) . "..." . $ext; } else { $truncfname = $fname; } // Link to the picture if ($ext && is_file($path . $tim . $ext)) { $img_flag = TRUE; $clip = "<a class=\"thumbnail\" target=\"_blank\" href=\"" . IMG_DIR . $tim . $ext . "\">" . "</span></a><br />"; if ($fsize >= 1048576) { $size = round($fsize / 1048576, 2) . " M"; $fsize = $asize; } else { if ($fsize >= 1024) { $size = round($fsize / 1024) . " K"; $fsize = $asize; } else { $size = $fsize . " "; $fsize = $asize; } } $all += $asize; //total calculation $md5 = substr($md5, 0, 10); } else { $clip = ""; $size = 0; $md5 = ""; } $class = $j % 2 ? "row1" : "row2"; //BG color $resdo = ''; if ($resto == '0') { $resdo = '<b>Orig. post(<a href="' . DATA_SERVER . BOARD_DIR . "/" . RES_DIR . $no . PHP_EXT . '#' . $no . '" target="_blank" />' . $no . '</a>)</b>'; } else { $resdo = '<a href="' . DATA_SERVER . BOARD_DIR . "/" . RES_DIR . $resto . PHP_EXT . '#' . $no . '" target="_blank" />' . $resto . '</a>'; } $warnSticky = ''; if ($sticky == '1') { $warnSticky = "<b><font color=\"FF101A\">(Sticky)</font></b>"; } if (valid('janitor_board') && !valid('moderator')) { //Hide IPs from janitors $host = '###.###.###.###'; } /*echo "<tr class=$class><td><input type=checkbox name=\"$no\" value=delete>$warnSticky</td>"; echo "<td>$no</td><td>$resdo</td><td>$now</td><td>$truncsub</td>"; echo "<td>$truncname</b></td><td>$trunccom</td>"; echo "<td>$host</td><td>$clip($size)</td><td>$md5</td><td>$truncfname</td><td>" . calculate_age( $time ) . "</td>\n"; echo "</tr>\n";*/ echo "<tr class={$class}><td><input type=checkbox name=\"{$no}\" value=delete>{$warnSticky}</td>"; echo "<td>{$no}</td><td>{$resdo}</td><td>{$now}</td><td>{$truncsub}</td>"; echo "<td>{$truncname}</b></td><td>{$trunccom}</td>"; echo "<td>{$host}</td><td>" . calculate_age($time) . "</td>\n"; echo "</tr>\n"; } mysql_free_result($result); echo "</table><input type=submit value=\"" . S_ITDELETES . "{$msg}\">"; echo "<input type=reset value=\"" . S_RESET . "\"></form>"; echo "<br /><hr /><br /><form method=\"post\" action=\"" . PHP_SELF . "?mode=banish\" >\n <table><tr><th>IP</th><td><input required type='text' name='ip_to_ban' /></td></tr>\n <tr><th>Public Reason</th>\n <td><input required type='text' name='pubreason' /></td></tr>\n <tr><th>Staff Reason</th>\n <td><input required type='text' name='staffreason' /></td></tr>\n <tr><th>Length</th>\n <td><select name =\"timebannedfor\" value=\"timebannedfor\">\n <option value=\"warn\">Warn</option>\n <option value=\"3hr\">3 hours</option>\n <option value=\"3day\">3 days</option>\n <option value=\"1wk\">1 week</option>\n <option value=\"1mon\">1 month</option>\n <option value=\"perma\">Permanent</option>\n </select></td><tr><th>Ban from:</th><td><select name =\"bannedFrom\" value=\"bannedFrom\">\n <option value=\"thisBoard\">This board</option>\n <option value=\"allBoards\">All boards</option>\n </select></td></tr></table>\n <input type=hidden name=pass value=\"{$pass}\">\n <input type=\"submit\" value=\"" . S_BANS . "\"/></form>" . S_BANS_EXTRA . ""; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/img.css\" />"; $all = (int) ($all / 1024); echo "[ " . S_IMGSPACEUSAGE . $all . "</b> KB ]"; die("</body></html>"); }
foreach ($_POST['rejects'] as $reject_id) { if ($i > 0) { $sql .= ' OR '; } $sql .= '(uid = \'' . $User->UID . '\' AND topic_id = ' . intval($reject_id) . ')'; } DB::Execute($sql); $_SESSION['notice'] = 'Selected topics unwatched.'; } echo '<form name="fuck_off" action="" method="post">'; $topics = new TablePrinter('watchlist'); $topic_column = '<script type="text/javascript"> document.write(\'<input type="checkbox" name="master_checkbox" class="inline" onclick="checkOrUncheckAllCheckboxes()" title="Check/uncheck all" /> \');</script>Topic'; $columns = array($topic_column, 'Replies', 'Visits', 'Age', 'Last Post'); $db_columns = array('t.headline', 't.replies', 't.visits', 't.time', 'last_post'); $topics->DefaultSorting('last_post', SORT_DESC, $db_columns); $topics->DefineColumns($columns, $topic_column); $topics->SetTDClass($topic_column, 'topic_headline'); DB::ToggleDebug(); $res = DB::Execute('SELECT w.topic_id, t.headline, t.replies, t.visits, t.time, last_post FROM {P}Watchlists as w INNER JOIN {P}Topics as t ON w.topic_id = t.id WHERE w.uid = \'' . $User->ID . '\' ' . $topics->GetOrderSQL()); DB::ToggleDebug(); while (list($topic_id, $topic_headline, $topic_replies, $topic_visits, $topic_time, $last_post) = $res->FetchRow()) { $values = array('<input type="checkbox" name="rejects[]" value="' . $topic_id . '" class="inline" /> <a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>', replies($topic_id, $topic_replies), format_number($topic_visits), '<span class="help" title="' . format_date($topic_time) . '">' . calculate_age($topic_time) . '</span>', '<span class="help" title="' . format_date($last_post) . '">' . calculate_age($last_post) . '</span>'); $topics->Row($values); } $num_topics_fetched = $topics->num_rows_fetched; echo $topics; if ($num_topics_fetched !== 0) { echo '<div class="row"><input type="submit" value="Unwatch selected" onclick="return confirm(\'Really remove selected topic(s) from your watchlist?\');" class="inline" /></div>'; } echo '</form>'; require 'includes/footer.php';
function display($type = 0, $resource = 0) { global $mysql; function calculate_age($timestamp, $comparison = '') { $units = array('second' => 60, 'minute' => 60, 'hour' => 24, 'day' => 7, 'week' => 4.25, 'month' => 12); if (empty($comparison)) { $comparison = $_SERVER['REQUEST_TIME']; } $age_current_unit = abs($comparison - $timestamp); foreach ($units as $unit => $max_current_unit) { $age_next_unit = $age_current_unit / $max_current_unit; if ($age_next_unit < 1) { // are there enough of the current unit to make one of the next unit? $age_current_unit = floor($age_current_unit); $formatted_age = $age_current_unit . ' ' . $unit; return $formatted_age . ($age_current_unit == 1 ? '' : 's'); } $age_current_unit = $age_next_unit; } $age_current_unit = round($age_current_unit, 1); $formatted_age = $age_current_unit . ' year'; return $formatted_age . (floor($age_current_unit) == 1 ? '' : 's'); } if ($resource) { $mysql->escape_string($resource); } if ($type === 'res') { $banner = "<div class='managerBanner'>" . S_DELRES . $resource . "</div>"; $query = $mysql->query("SELECT * FROM " . SQLLOG . " WHERE resto='{$resource}' OR no='{$resource}' OR host='{$resource}' ORDER BY time ASC"); $mode = 'res'; } if ($type === 'all') { $banner = "<div class='managerBanner'>" . S_DELALL . "</div>"; $query = $mysql->query("SELECT * FROM " . SQLLOG . " ORDER BY no DESC"); $mode = 'all'; } if ($type === 'ip') { $banner = "<div class='managerBanner'>" . S_DELIP . $resource . "</div>"; $hostno = $mysql->result("SELECT host FROM " . SQLLOG . " WHERE no='{$resource}' "); $query = $mysql->query("SELECT * FROM " . SQLLOG . " WHERE host='{$hostno}' ORDER BY NO DESC"); $mode = 'ip'; } if ($type === 'ops') { $banner = "<div class='managerBanner'>" . S_DELOPS . "</div>"; $query = $mysql->query("SELECT * FROM " . SQLLOG . " WHERE resto='0' ORDER BY time DESC"); $mode = 'ops'; } // Deletion screen display $temp .= "<div class='managerBanner'>" . S_MANAMODE . "</div>" . $banner; $temp .= '<br><form action="' . PHP_ASELF . '" method="get" id="delForm"><input type="hidden" name="mode" value="res"> <input type="text" name="no" placeholder="Post # or IP" required><input type="submit" value="Search"> <input type="button" text-align="center" onclick="location.href=\'' . PHP_ASELF_ABS . '?mode=ops\';" value="Only opening posts"> <input type="button" text-align="center" onclick="location.href=\'' . PHP_ASELF_ABS . '?mode=all\';" value="View all"></form>'; $temp .= "<form action='" . PHP_ASELF . "?mode=del' method='post' id='delForm'><input type=hidden name=admin value=del checked>"; /*$temp .= "<input type=hidden name=mode value=admin>"; $temp .= "<input type=hidden name=admin value=del>"; $temp .= "<input type=hidden name=pass value='$pass'>"; $temp .= "<div class='delbuttons'><input type=submit value='" . S_ITDELETES . "'>"; $temp .= "<input type=reset value='" . S_MDRESET . "'>"; $temp .= "[<input type=checkbox name=onlyimgdel value=on>" . S_MDONLYPIC . "]</div><br>";*/ $temp .= "<br>"; $temp .= "<table cellpadding='0' cellspacing='0' class='postlists' style='border-collapse:collapse;' cellspacing='0' cellpadding='0'>"; $temp .= "<tr class='postTable head'>" . S_MDTABLE1; $temp .= S_MDTABLE2; $temp .= "</tr>"; if (!$query) { error(S_SQLFAIL); } $j = 0; while ($row = $mysql->fetch_row($query)) { $j++; $path = realpath("./") . '/' . IMG_DIR; $img_flag = FALSE; list($no, $now, $name, $email, $sub, $com, $host, $pwd, $ext, $w, $h, $tn_w, $tn_h, $tim, $time, $md5, $fsize, $fname, $sticky, $permasage, $locked, $root, $resto) = $row; // Format $now = ereg_replace('.{2}/(.*)$', '\\1', $now); $now = ereg_replace('\\(.*\\)', ' ', $now); $name = strlen($name) > 10 ? substr($name, 0, 9) . "..." : $name; $name = $email ? "<a href=\"mailto:{$email}\">{$name}</a>" : $name; $sub = strlen($sub) > 10 ? substr($sub, 0, 9) . "..." : $sub; $com = str_replace("<br />", "\n", $com); $com = htmlspecialchars_decode($com); $com = strip_tags($com); $trunccom = substr($com, 0, 18) . "..."; $fname = strlen($fname) > 10 ? substr($fname, 0, 40) : $fname; // Link to the picture if ($ext && is_file($path . $tim . $ext)) { $img_flag = TRUE; $clip = "<a class=\"thumbnail\" target=\"_blank\" href=\"" . IMG_DIR . $tim . $ext . "\">" . $tim . $ext . "<span><img class='postimg' src=\"" . THUMB_DIR . $tim . 's.jpg' . "\" width=\"100\" height=\"100\" /></span></a><br />"; if ($fsize >= 1048576) { $size = round($fsize / 1048576, 2) . " M"; $fsize = $asize; } else { if ($fsize >= 1024) { $size = round($fsize / 1024) . " K"; $fsize = $asize; } else { $size = $fsize . " "; $fsize = $asize; } } $all += $asize; //total calculation $md5 = substr($md5, 0, 10); } else { $clip = S_NOFILE; $size = 0; $md5 = ""; } if (!valid('moderator')) { $host = '###.###.###.###'; } $class = $j % 2 ? "row1" : "row2"; //BG color $altClass = $j % 2 ? "row2" : "row1"; //lol $resdo = $resto ? 'Reply to thread' : 'Opening post'; $ssno = $resto ? $resto : $no; $linknum = '<a href="' . PHP_SELF_ABS . "?res=" . $no . '" target="_blank" />' . $no . '</a>'; // : '<b><a href="' . PHP_SELF_ABS . "?res=" . $no . '" target="_blank" />' . $no . '</a></b>'; $sno = $sticky ? "<b><font color=\"FF101A\">{$linknum}</font></b>" : $linknum; $threadmode = $resto ? $resto : $no; $delim = $size ? "<td colspan='2'> </td><td colspan='1'>[<b><a href='?mode=adel&no={$no}&imgonly=1&refer={$mode}'>Delete image?</a>]</b></td><td colspan='3'> </td>" : "<td colspan='6'> </td>"; //Actual panel html //$temp .= "<tr class='$class'><td><input type=checkbox name=\"$no\" value=delete></td>"; //<input value='x' alt='Delete post' onclick=\"location.href='?mode=adel&no=$no';\" type='button'> $temp .= "<tr class='{$class}'><td><input value='x' alt='Delete post' onclick=\"location.href='?mode=adel&no={$no}&refer={$mode}';\" type='button'></td>"; $temp .= "<td colspan='1'>{$sno}</td><td>{$now}</td><td>{$sub}</td>"; $temp .= "<td>{$name}</b></td><td><span title='Double-click to preview full comment' ondblclick='swap(\"trunc{$no}\", \"full{$no}\")' id='trunc{$no}'>{$trunccom}</span><span ondblclick='swap(\"full{$no}\", \"trunc{$no}\")' id='full{$no}' style='display:none;'>{$com}</span></td>"; $temp .= "<td class='postimg' >{$clip}</td><td>{$host}</td><td>" . calculate_age($time) . "</td><td><input type='button' value='More' onclick='more(\"" . $no . "a\",\"" . $no . "b\");'></td>"; $temp .= "</tr><tr id='" . $no . "a' class='{$class}' style='display:none;'><td colspan='2'> </td><td colspan='2' align='left'><b>{$resdo}</b></td>{$delim}"; $temp .= "</tr><tr id='" . $no . "b' class='{$class}' style='display:none;'><td colspan='2'> </td>\n <td colspan='2'><a href='" . PHP_SELF_ABS . "?res={$ssno}'>{$ssno}</a><td colspan='2'> </td></td>\n <td colspan='4' align='center'><input value='View all by this IP' onclick=\"location.href='?mode=ip&no={$no}';\" type='button'> <input value='View in threadmode' onclick=\"location.href='?mode=res&no={$threadmode}';\" type='button'> <input value='Delete everything by this IP' onclick=\"popup('admin=delall&no={$no}');\" type='button'> <input value='Ban user' onclick=\"popup('admin=ban&no={$no}');\" type='button'> <input type='button' onclick=\"location.href='" . PHP_ASELF_ABS . "?mode=more&no=" . $no . "';\" value=\"More info\" /></td>"; } // //$mysql->free_result($result); $temp .= "<link rel='stylesheet' type='text/css' href='" . CSS_PATH . "/stylesheets/img.css' />"; $all = (int) ($all / 1024); //$temp .= "<div align='center'/>[ " . S_IMGSPACEUSAGE . $all . "</b> KB ]</div>"; $temp .= "</body></html>"; echo $temp; }