当前位置: 首页>>代码示例>>PHP>>正文


PHP TimeDiff函数代码示例

本文整理汇总了PHP中TimeDiff函数的典型用法代码示例。如果您正苦于以下问题:PHP TimeDiff函数的具体用法?PHP TimeDiff怎么用?PHP TimeDiff使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TimeDiff函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: NextMailFile

function NextMailFile()
{
    $dir = scandir(substr(BOUNCEBACK_PATH, 0, -1), SCANDIR_SORT_ASCENDING);
    $lockFail = false;
    $gotFile = false;
    foreach ($dir as $fileName) {
        if (preg_match('/^(\\d+)\\./', $fileName, $res)) {
            if (($handle = fopen(BOUNCEBACK_PATH . $fileName, 'rb')) === false) {
                continue;
            }
            if (!flock($handle, LOCK_EX | LOCK_NB)) {
                $lockFail = true;
                fclose($handle);
                continue;
            }
            if (feof($handle)) {
                fclose($handle);
                unlink(BOUNCEBACK_PATH . $fileName);
                continue;
            }
            $ts = intval($res[1], 10);
            $gotFile = $fileName;
            break;
        }
    }
    unset($dir);
    if (!$gotFile) {
        if ($lockFail) {
            sleep(3);
            return true;
        }
        return false;
    }
    DebugMessage('Found message received at ' . date('Y-m-d H:i:s', $ts) . ', ' . TimeDiff($ts));
    $message = fread($handle, min(filesize(BOUNCEBACK_PATH . $fileName), 4194304));
    ftruncate($handle, 0);
    fclose($handle);
    unlink(BOUNCEBACK_PATH . $fileName);
    $mailId = false;
    if (preg_match('/X-Undermine-MailID:\\s*([a-zA-Z0-9_-]{27})/', $message, $res)) {
        $mailId = $res[1];
    } elseif (preg_match('/[Mm]essage ID: ([a-zA-Z0-9_-]{27})/', $message, $res)) {
        $mailId = $res[1];
    }
    if (!$mailId) {
        DebugMessage('Could not find message ID, forwarding to editor');
        NewsstandMail('editor@theunderminejournal.com', 'The Editor', 'Unparsed notification reply', $message);
    } else {
        $address = GetAddressByMailID($mailId);
        if (!$address) {
            DebugMessage('Could not find address for mail ID ' . $mailId);
        } else {
            $cnt = DisableEmailAddress($address['address']);
            DebugMessage('Address ' . $address['address'] . ' removed from ' . $cnt . ' account' . ($cnt == 1 ? '' : 's') . '.');
        }
    }
    return true;
}
开发者ID:erorus,项目名称:newsstand,代码行数:58,代码来源:bouncebacks.php

示例2: SetList_Process_Expire

 function SetList_Process_Expire(&$SetList)
 {
     $elements =& $SetList->DelegateParameters['Form']['elements'];
     // Throw an error if DaysOld is not a number.
     if (!is_numeric($elements['DaysOld']['value'])) {
         $Error = str_replace('//1', $elements['DaysOld']['label'], $SetList->Context->GetDefinition('Expire.Error.DaysOldNaN'));
         $SetList->Context->WarningCollector->Add($Error);
     }
     // Check for expired discussions whenever settings are saved.
     if ($SetList->Context->WarningCollector->Iif()) {
         $SetList->Context->Configuration['Expire.DaysOld'] = $elements['DaysOld']['value'];
         $SetList->Context->Configuration['Expire.Action'] = $elements['Action']['value'];
         $SetList->Context->Configuration['Expire.IgnoreWhispers'] = $elements['IgnoreWhispers']['value'];
         Expire_Old_Discussions($SetList->Context);
         $elements['ExpireOptions']['description'] = str_replace('//1', TimeDiff($SetList->Context, 1, 1), $SetList->Context->GetDefinition('Expire.ExpireOptions.description'));
     }
 }
开发者ID:laiello,项目名称:lussumo-vanilla,代码行数:17,代码来源:default.php

示例3: GetDiscussion

function GetDiscussion(&$Context, $Discussion, $FirstRow = "0")
{
    // Prefix the discussion name with the whispered-to username if this is a whisper
    if ($Discussion->WhisperUserID > 0) {
        $Discussion->Name = @$Discussion->WhisperUsername . ": " . $Discussion->Name;
    }
    $UnreadQS = $Context->Session->User->Settings['comments_order'] == 'asc' ? GetUnreadQuerystring($Discussion) : '';
    $LastQS = $Context->Session->User->Settings['comments_order'] == 'asc' ? GetLastCommentQuerystring($Discussion) : '';
    $sReturn = "<dl class=\"Discussion" . $Discussion->Status . ($FirstRow ? " FirstDiscussion" : "") . ($Discussion->CountComments == 1 ? " NoReplies" : "") . (agUSE_CATEGORIES ? " Category_" . $Discussion->CategoryID : "") . "\">\r\n\t\t<dt class=\"DataItemLabel DiscussionTopicLabel\">" . $Context->GetDefinition("DiscussionTopic") . "</dt>\r\n\t\t<dd class=\"DataItem DiscussionTopic\">" . DiscussionPrefix($Discussion) . "<a href=\"comments.php?DiscussionID=" . $Discussion->DiscussionID . ($Context->Session->User->Setting("JumpToLastReadComment", 1) ? $UnreadQS : "") . "\">" . $Discussion->Name . "</a></dd>";
    if (agUSE_CATEGORIES) {
        $sReturn .= "\r\n\t\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel DiscussionCategoryLabel\">" . $Context->GetDefinition("Category") . "</dt>\r\n\t\t\t<dd class=\"MetaItem DiscussionInformation DiscussionCategory\"><a href=\"./?CategoryID=" . $Discussion->CategoryID . "\">" . $Discussion->Category . "</a></dd>\r\n\t\t\t";
    }
    $sReturn .= "<dt class=\"MetaItemLabel DiscussionInformationLabel StarterLabel\"><a href=\"./comments.php?DiscussionID=" . $Discussion->DiscussionID . "#Item_1\">" . $Context->GetDefinition("StartedBy") . "</a></dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation Starter\"><a href=\"./account.php?u=" . $Discussion->AuthUserID . "\">" . $Discussion->AuthUsername . "</a></dd>\r\n\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel CommentCountLabel\">" . $Context->GetDefinition("Comments") . "</dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation CommentCount\">" . $Discussion->CountComments . "</dd>\r\n\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel LastReplierLabel\"><a href=\"./comments.php?DiscussionID=" . $Discussion->DiscussionID . $LastQS . "\">" . $Context->GetDefinition("LastCommentBy") . "</a></dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation LastReplier\"><a href=\"./account.php?u=" . $Discussion->LastUserID . "\">" . $Discussion->LastUsername . "</a></dd>\r\n\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel LastActiveLabel\"><a href=\"./comments.php?DiscussionID=" . $Discussion->DiscussionID . $LastQS . "\">" . $Context->GetDefinition("LastActive") . "</a></dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation LastActive\">" . TimeDiff($Discussion->DateLastActive, mktime()) . "</dd>";
    if ($Context->Session->UserID > 0) {
        $sReturn .= "<dt class=\"MetaItemLabel DiscussionInformationLabel NewCommentCountLabel" . ($Discussion->NewComments > 0 ? " NewCommentsPresentLabel" : "") . "\"><a href=\"comments.php?DiscussionID=" . $Discussion->DiscussionID . $UnreadQS . "\">" . $Context->GetDefinition("New") . "</a></dt>\r\n\t\t\t<dd class=\"MetaItem DiscussionInformation NewCommentCount" . ($Discussion->NewComments > 0 ? " NewCommentsPresent" : "") . "\"><a href=\"comments.php?DiscussionID=" . $Discussion->DiscussionID . $UnreadQS . "\">" . $Discussion->NewComments . "</a></dd>";
    }
    $sReturn .= "</dl>\n";
    return $sReturn;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:19,代码来源:Vanilla.Functions.php

示例4: elseif

            if ($Comment->WhisperUserID == $this->Context->Session->UserID && $Comment->AuthUserID == $this->Context->Session->UserID) {
                $CommentList .= $this->Context->GetDefinition('ToYourself');
            } elseif ($Comment->WhisperUserID == $this->Context->Session->UserID) {
                $CommentList .= $this->Context->GetDefinition('ToYou');
            } else {
                $CommentList .= str_replace('//1', $Comment->WhisperUsername, $this->Context->GetDefinition('ToX'));
            }
        }
        $CommentList .= '</li>
					<li>
						<span>' . $this->Context->GetDefinition('CommentTime') . '</span>' . TimeDiff($this->Context, $Comment->DateCreated);
        if ($Comment->DateEdited != '') {
            $CommentList .= ' <em>' . $this->Context->GetDefinition('Edited') . '</em>';
        }
        if ($Comment->Deleted) {
            $CommentList .= ' <i>' . str_replace(array('//1', '//2'), array(TimeDiff($this->Context, $Comment->DateDeleted), $Comment->DeleteUsername), $this->Context->GetDefinition('CommentHiddenOnXByY')) . '</i>';
        }
        // Whisper back button
        if (!$this->Discussion->Closed && $Comment->WhisperUserID > 0 && $Comment->WhisperUserID == $this->Context->Session->UserID) {
            $CommentList .= '<a class="WhisperBack" onclick="' . "WhisperBack('" . $Comment->DiscussionID . "', '" . str_replace("'", "\\'", $CommentAuthUsername) . "', '" . $this->Context->Configuration['BASE_URL'] . "');" . '">' . $this->Context->GetDefinition('WhisperBack') . '</a>';
        }
        $CommentList .= '</li>
				</ul>
				<span>
					&nbsp;';
        // Set up comment options
        $this->DelegateParameters['Comment'] =& $Comment;
        $this->DelegateParameters['CommentList'] =& $CommentList;
        $this->DelegateParameters['RowNumber'] =& $RowNumber;
        $CommentList .= $this->CallDelegate('PreCommentOptionsRender');
        if ($this->Context->Session->UserID > 0) {
开发者ID:avital,项目名称:vanilla-thewe,代码行数:31,代码来源:comments.php

示例5: Prefix

 function Prefix()
 {
     if ($this->Context->WarningCollector->Count() > 0) {
         $sReturn = "<div class=\"ErrorContainer\">\r\n\t\t\t\t<div class=\"ErrorTitle\">" . $this->Context->GetDefinition("ErrorTitle") . "</div>" . $this->Context->WarningCollector->GetMessages() . "</div>";
     } else {
         $PageDetails = $this->pl->GetPageDetails($this->Context);
         $PageList = $this->pl->GetNumericList();
         // Format the discussion information
         $this->Discussion->ForceNameSpaces();
         $sReturn = "<a class=\"PageJump Bottom\" href=\"#pgbottom\">" . $this->Context->GetDefinition("BottomOfPage") . "</a>" . "<div class=\"Title\">";
         if (agUSE_CATEGORIES) {
             $sReturn .= "<a href=\"./?CategoryID=" . $this->Discussion->CategoryID . "\">" . $this->Discussion->Category . "</a>:<br/> ";
         }
         $sReturn .= DiscussionPrefix($this->Discussion) . " ";
         if ($this->Discussion->WhisperUserID > 0) {
             $sReturn .= $this->Discussion->WhisperUsername . ": ";
         }
         $sReturn .= $this->Discussion->Name . "</div>" . $PageList . "<div class=\"PageDetails\">" . $PageDetails . "</div>";
         $Comment = $this->Context->ObjectFactory->NewObject($Context, "Comment");
         $RowNumber = 0;
         $CommentID = 0;
         if ($this->Context->Session->User->Settings['comments_order'] == 'desc') {
             $LastViewCountComments = $this->CommentDataCount - $this->Discussion->LastViewCountComments;
         } else {
             $LastViewCountComments = $this->Discussion->LastViewCountComments;
         }
         echo '<!-- $LastViewCountComments is: ' . $LastViewCountComments . ',' . $this->Context->Session->User->Settings['comments_order'] . '-->';
         $sReturn .= "<div class=\"CommentGrid\" id=\"CommentGrid\">\n";
         while ($Row = $this->Context->Database->GetRow($this->CommentData)) {
             $RowNumber++;
             $Comment->Clear();
             $Comment->GetPropertiesFromDataSet($Row, $this->Context->Session->UserID);
             $ShowHtml = $Comment->FormatPropertiesForDisplay($this->Context);
             $sReturn .= "<a name=\"Comment_" . $Comment->CommentID . "\"></a>\r\n\t\t\t\t\t\t<a name=\"Item_" . $RowNumber . "\"></a>\r\n\t\t\t\t\t\t<div class=\"Comment " . $Comment->Status . ($RowNumber == 1 ? " FirstComment" : "") . "\">";
             $sReturn .= "<div class=\"CommentHeader\">\n";
             if ($Comment->Deleted) {
                 $sReturn .= "<div class=\"ErrorContainer CommentHidden\">\r\n\t\t\t\t\t\t\t\t<div class=\"Error\">" . $this->Context->GetDefinition("CommentHiddenOn") . " " . date("F jS Y \\a\\t g:ia", $Comment->DateDeleted) . " " . $this->Context->GetDefinition("By") . " " . $Comment->DeleteUsername . ".</div>\r\n\t\t\t\t\t\t\t</div>";
             }
             $ShowIcon = 0;
             if ($this->Context->Session->User->Setting("HtmlOn", 1)) {
                 $ShowIcon = 1;
             }
             $sReturn .= "<div onclick=\"toggleCommentBody('" . $Comment->CommentID . "')\" class=\"ShowHide\" id=\"CommBodySwitcher_" . $Comment->CommentID . "\">";
             if ($this->Context->Session->User->Settings['comments_order'] == 'asc') {
                 $sReturn .= ($RowNumber >= $LastViewCountComments ? "Hide" : "Show") . "</div>\n";
             } else {
                 $sReturn .= ($RowNumber <= $LastViewCountComments ? "Hide" : "Show") . "</div>\n";
             }
             $sReturn .= "<div class=\"CommentAuthor" . ($ShowIcon ? " CommentAuthorWithIcon" : "") . "\">";
             if ($ShowIcon) {
                 $sReturn .= "<span class=\"CommentIcon\" style=\"background-image:url('" . ($Comment->AuthIcon !== "" ? $Comment->AuthIcon : "images/def_icon.png") . "')\"></span>";
             }
             // 						echo "<!-- icon is: [".$Comment->AuthIcon."]-->";
             $sReturn .= "<a href=\"account.php?u=" . $Comment->AuthUserID . "\">" . $Comment->AuthFullName . "</a></div>";
             if ($Comment->WhisperUserID > 0) {
                 $sReturn .= "<div class=\"CommentWhisper\">" . $this->Context->GetDefinition("To") . " ";
                 if ($Comment->WhisperUserID == $this->Context->Session->UserID && $Comment->AuthUserID == $this->Context->Session->UserID) {
                     $sReturn .= $this->Context->GetDefinition("Yourself");
                 } elseif ($Comment->WhisperUserID == $this->Context->Session->UserID) {
                     $sReturn .= $this->Context->GetDefinition("You");
                 } else {
                     $this->Context->UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "UserManager");
                     $WhisperUser = $this->Context->UserManager->GetUserById($Comment->WhisperUserID);
                     $sReturn .= $WhisperUser->FullName;
                 }
                 $sReturn .= "</div>\n";
             }
             $sReturn .= "<div class=\"CommentTime\">#" . $Comment->CommentID . " " . TimeDiff($Comment->DateCreated);
             if ($Comment->DateEdited != "") {
                 $sReturn .= " <em>" . $this->Context->GetDefinition("Edited") . "</em>\n";
             }
             $sReturn .= "</div>\r\n\t\t\t\t\t<div class=\"CommentOptions\">";
             if ($this->Context->Session->UserID > 0) {
                 if ($this->Context->Session->User->CanViewIps) {
                     $sReturn .= "<div class=\"CommentIp\">" . $this->Context->GetDefinition("CommentPostedFrom") . " " . $Comment->RemoteIp . "</div>\n";
                 }
                 if ($Comment->AuthUserID == $this->Context->Session->UserID || $this->Context->Session->User->AdminCategories) {
                     if (!$this->Discussion->Closed && $this->Discussion->Active || $this->Context->Session->User->AdminCategories) {
                         $sReturn .= "<div class=\"CommentEdit\"><a href=\"post.php?CommentID=" . $Comment->CommentID . "\">" . $this->Context->GetDefinition("Edit") . "</a></div>\n";
                     }
                     if ($this->Context->Session->User->AdminCategories) {
                         $sReturn .= "<div class=\"CommentHide\"><a href=\"javascript:ManageComment('" . ($Comment->Deleted ? "0" : "1") . "', '" . $this->Discussion->DiscussionID . "', '" . $Comment->CommentID . "', '" . $this->Context->GetDefinition("ShowConfirm") . "', '" . $this->Context->GetDefinition("HideConfirm") . "');\">" . $this->Context->GetDefinition($Comment->Deleted ? "Show" : "Hide") . "</a></div>\n";
                     }
                 }
             }
             $sReturn .= "</div>";
             if ($Comment->AuthRoleDesc != "") {
                 $sReturn .= "<div class=\"CommentNotice\">" . $Comment->AuthRoleDesc . "</div>";
             }
             $sReturn .= "</div><div class=\"";
             if ($this->Context->Session->User->Settings['comments_order'] == 'asc') {
                 $sReturn .= ($RowNumber >= $LastViewCountComments ? "CommentBody" : "CommentBodyHidden") . "\" id=\"CommentBody_" . $Comment->CommentID . "\">";
             } else {
                 $sReturn .= ($RowNumber <= $LastViewCountComments ? "CommentBody" : "CommentBodyHidden") . "\" id=\"CommentBody_" . $Comment->CommentID . "\">";
             }
             if ($this->Context->Session->User->Settings['comments_order'] == 'asc') {
                 $sReturn .= $RowNumber >= $LastViewCountComments ? $Comment->Body . "<p><input type=\"button\"  onclick=\"addQuoteToCommentBody(" . $Comment->CommentID . ")\" class=\"Button QuoteButton\" id=\"CommentQuote_" . $Comment->CommentID . "\" value=\"" . $this->Context->GetDefinition("Quote") . "\" /></p>" : "";
             } else {
                 $sReturn .= $RowNumber <= $LastViewCountComments ? $Comment->Body . "<p><input type=\"button\"  onclick=\"addQuoteToCommentBody(" . $Comment->CommentID . ")\" class=\"Button QuoteButton\" id=\"CommentQuote_" . $Comment->CommentID . "\" value=\"" . $this->Context->GetDefinition("Quote") . "\" /></p>" : "";
             }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:101,代码来源:comments.php

示例6: dateFormat

        ?>
</td>
			<td><?php 
        echo $rowIDLETIMEHISTORY['idle_name'];
        ?>
</td>
			<td align="center"><?php 
        echo dateFormat($rowIDLETIMEHISTORY['time_start'], "h:i");
        ?>
</td>
			<td align="center"><?php 
        echo dateFormat($rowIDLETIMEHISTORY['time_end'], "h:i");
        ?>
</td>
			<?php 
        $difference = TimeDiff($rowIDLETIMEHISTORY['time_start'], $rowIDLETIMEHISTORY['time_end']) / 60 . " minutes";
        $totalidletime += $difference;
        ?>
			<td align="right"><?php 
        echo $difference;
        ?>
</td>
			<td><?php 
        echo $rowIDLETIMEHISTORY['remarks'];
        ?>
</td>
		</tr>
		<?php 
    }
    ?>
		<tr>
开发者ID:alladinxApp,项目名称:qsms,代码行数:31,代码来源:jobclock_idle.php

示例7: FullComment

 function FullComment($CommentID)
 {
     $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, "CommentManager");
     $Comment = $cm->GetCommentById($CommentID, "0");
     $sReturn = "<a name=\"Comment_" . $Comment->CommentID . "\"></a>\n  <a name=\"Item_\"></a>\n  <div class=\"Comment \">";
     $sReturn .= "<div class=\"CommentHeader\">\n";
     if ($Comment->Deleted) {
         $sReturn .= "<div class=\"ErrorContainer CommentHidden\">\n                    <div class=\"Error\">" . $this->Context->GetDefinition("CommentHiddenOn") . " " . date("F jS Y \\a\\t g:ia", $Comment->DateDeleted) . " " . $this->Context->GetDefinition("By") . " " . $Comment->DeleteUsername . ".</div>\n                    </div>";
     }
     $ShowIcon = 0;
     if ($this->Context->Session->User->Setting("HtmlOn", 1)) {
         $ShowIcon = 1;
     }
     $sReturn .= "<div onclick=\"toggleCommentBody('" . $CommentID . "')\" class=\"ShowHide\" id=\"CommBodySwitcher_" . $Comment->CommentID . "\">" . "Hide" . "</div>\n";
     $sReturn .= "<div class=\"CommentAuthor" . ($ShowIcon ? " CommentAuthorWithIcon" : "") . "\">";
     if ($ShowIcon) {
         $sReturn .= "<span class=\"CommentIcon\" style=\"background-image:url('" . ($Comment->AuthIcon !== "" ? $Comment->AuthIcon : "images/def_icon.png") . "')\"></span>";
     }
     $sReturn .= "<a href=\"account.php?u=" . $Comment->AuthUserID . "\">" . $Comment->AuthFullName . "</a></div>";
     if ($Comment->WhisperUserID > 0) {
         $sReturn .= "<div class=\"CommentWhisper\">" . $this->Context->GetDefinition("To") . " ";
         if ($Comment->WhisperUserID == $this->Context->Session->UserID && $Comment->AuthUserID == $this->Context->Session->UserID) {
             $sReturn .= $this->Context->GetDefinition("Yourself");
         } elseif ($Comment->WhisperUserID == $this->Context->Session->UserID) {
             $sReturn .= $this->Context->GetDefinition("You");
         } else {
             $this->Context->UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "UserManager");
             $WhisperUser = $this->Context->UserManager->GetUserById($Comment->WhisperUserID);
             $sReturn .= $WhisperUser->FullName;
         }
         $sReturn .= "</div>\n";
     }
     $sReturn .= "<div class=\"CommentTime\">#" . $Comment->CommentID . " " . TimeDiff($Comment->DateCreated);
     if ($Comment->DateEdited != "") {
         $sReturn .= " <em>" . $this->Context->GetDefinition("Edited") . "</em>\n";
     }
     $sReturn .= "</div>\n              <div class=\"CommentOptions\">";
     if ($this->Context->Session->UserID > 0) {
         if ($this->Context->Session->User->CanViewIps) {
             $sReturn .= "<div class=\"CommentIp\">" . $this->Context->GetDefinition("CommentPostedFrom") . " " . $Comment->RemoteIp . "</div>\n";
         }
         if ($Comment->AuthUserID == $this->Context->Session->UserID || $this->Context->Session->User->AdminCategories) {
             $sReturn .= "<div class=\"CommentEdit\"><a href=\"post.php?CommentID=" . $Comment->CommentID . "\">" . $this->Context->GetDefinition("Edit") . "</a></div>\n";
             if ($this->Context->Session->User->AdminCategories) {
                 $sReturn .= "<div class=\"CommentHide\"><a href=\"javascript:ManageComment('" . ($Comment->Deleted ? "0" : "1") . "', '" . $this->Discussion->DiscussionID . "', '" . $Comment->CommentID . "', '" . $this->Context->GetDefinition("ShowConfirm") . "','" . $this->Context->GetDefinition("HideConfirm") . "');\">" . $this->Context->GetDefinition($Comment->Deleted ? "Show" : "Hide") . "</a></div>\n";
             }
         }
     }
     $sReturn .= "</div>";
     if ($Comment->AuthRoleDesc != "") {
         $sReturn .= "<div class=\"CommentNotice\">" . $Comment->AuthRoleDesc . "</div>";
     }
     $sReturn .= "</div><div class=\"CommentBody\" id=\"CommentBody_" . $Comment->CommentID . "\">" . $Comment->Body . "</div>";
     $sReturn .= "<input type=\"button\"  onclick=\"addQuoteToCommentBody(" . $Comment->CommentID . ")\" class=\"Button QuoteButton\" id=\"CommentQuote_" . $Comment->CommentID . "\" value=\"" . $this->Context->GetDefinition("Quote") . "\" />";
     if ($Comment->WhisperUserID > 0 && $Comment->WhisperUserID == $this->Context->Session->UserID) {
         $sReturn .= "<div class=\"WhisperBack\"><a href=\"Javascript:WhisperBack('" . $Comment->DiscussionID . "', '" . str_replace("'", "\\'", $Comment->AuthUsername) . "');\">" . $this->Context->GetDefinition("WhisperBack") . "</a></div>";
     }
     $sReturn .= "</div>";
     return $sReturn;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:60,代码来源:comment.php

示例8: RunMeNTimes

require_once '../incl/heartbeat.incl.php';
RunMeNTimes(1);
CatchKill();
ini_set('memory_limit', '256M');
if (!DBConnect()) {
    DebugMessage('Cannot connect to db!', E_USER_ERROR);
}
$db->query('set session transaction isolation level read uncommitted');
$luaQuoteChange = ["\r" => '\\r', "\n" => '\\n', chr(26) => '\\026'];
heartbeat();
file_put_contents('../addon/GetDetailedItemLevelInfo.lua', BuildGetDetailedItemLevelInfo());
file_put_contents('../addon/BonusSets.lua', BuildBonusSets());
file_put_contents('../addon/MarketData-US.lua', BuildAddonData('US'));
file_put_contents('../addon/MarketData-EU.lua', BuildAddonData('EU'));
MakeZip($zipPath);
DebugMessage('Done! Started ' . TimeDiff($startTime));
function BuildGetDetailedItemLevelInfo()
{
    global $db;
    $lua = <<<'EOF'
--[[

GetDetailedItemLevelInfo Polyfill, v 1.0
by Erorus for The Undermine Journal
https://theunderminejournal.com/

Based on these "specs" for a GetDetailedItemLevelInfo function coming in 7.1
https://www.reddit.com/r/woweconomy/comments/50hp5d/warning_be_careful_flipping/d74olsy

Pass in an itemstring/link to GetDetailedItemLevelInfo
Returns effectiveItemLevel, previewItemLevel, baseItemLevel
开发者ID:erorus,项目名称:newsstand,代码行数:31,代码来源:buildaddon.php

示例9: JSNow

$file = [];
$file['note'] = 'Brought to you by https://does.theapi.work/';
$file['started'] = JSNow();
foreach (['us', 'eu'] as $region) {
    $file['regions'][$region] = FetchRegionData($region);
    if ($caughtKill) {
        break;
    }
}
$file['finished'] = JSNow();
if (!$caughtKill) {
    $fn = isset($argv[1]) ? $argv[1] : __DIR__ . '/../theapi.work/times.json';
    AtomicFilePutContents($fn, json_encode($file, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE));
}
DebugMessage("Opened {$connectionTracking['created']} connections to service {$connectionTracking['requests']} requests.");
DebugMessage('Done! Started ' . TimeDiff($startTime, ['precision' => 'second']));
function JSNow()
{
    return floor(microtime(true) * 1000);
}
function FetchRegionData($region)
{
    global $caughtKill;
    $region = trim(strtolower($region));
    $results = [];
    DebugMessage("Fetching realms for {$region}");
    $url = GetBattleNetURL($region, 'wow/realm/status');
    $jsonString = HTTP::Get($url);
    $json = json_decode($jsonString, true);
    if (json_last_error() != JSON_ERROR_NONE) {
        DebugMessage("Error decoding " . strlen($jsonString) . " length JSON string for {$region}: " . json_last_error_msg(), E_USER_WARNING);
开发者ID:erorus,项目名称:newsstand,代码行数:31,代码来源:doestheapiwork.php

示例10: while

		' . $this->Get_PostBackForm('frmApplicants') . '
		<p>' . $this->Context->GetDefinition('ApplicantsNotes') . '</p>

		<ul>';
if ($this->Context->Database->RowCount($this->ApplicantData) > 0) {
    echo '<li class="CheckController"><p>' . $this->Context->GetDefinition('Check') . " <a href=\"./\" onclick=\"CheckAll('ApplicantID'); return false;\">" . $this->Context->GetDefinition('All') . '</a>, ' . " <a href=\"./\" onclick=\"CheckNone('ApplicantID'); return false;\">" . $this->Context->GetDefinition('None') . '</a></p></li>';
    $ApplicantList = '';
    $Applicant = $this->Context->ObjectFactory->NewContextObject($this->Context, 'User');
    while ($Row = $this->Context->Database->GetRow($this->ApplicantData)) {
        $Applicant->Clear();
        $Applicant->GetPropertiesFromDataSet($Row);
        $Applicant->FormatPropertiesForDisplay();
        $ApplicantList .= '<li class="Enabled">
						<h3>
							' . GetDynamicCheckBox('ApplicantID[]', $Applicant->UserID, 0, '', $Applicant->Name, '', 'ApplicantID' . $Applicant->UserID) . '
							<span class="Applied"><a href="' . GetUrl($this->Context->Configuration, 'account.php', '', 'u', $Applicant->UserID) . '">' . TimeDiff($this->Context, $Applicant->DateFirstVisit, mktime()) . '</a></span>
							<span class="EmailAddress">' . FormatHyperlink('mailto:' . $Applicant->Email) . '</span>';
        $this->DelegateParameters['Applicant'] =& $Applicant;
        $this->DelegateParameters['ApplicantList'] =& $ApplicantList;
        $this->CallDelegate('PostEmailAddress');
        $ApplicantList .= '</h3>
						<p>' . $Applicant->Discovery . '</p>
					</li>';
    }
    echo $ApplicantList;
} else {
    echo '<li class="NoApplicants"><p>' . $this->Context->GetDefinition('NoApplicants') . '</p></li>';
}
echo '</ul>';
if ($this->Context->Database->RowCount($this->ApplicantData) > 0) {
    echo '<div class="Approve">
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:31,代码来源:settings_applicants_form.php

示例11: ShowRealms

function ShowRealms()
{
    echo '<h1>Realms</h1>';
    global $db;
    $sql = <<<EOF
SELECT r.house, r.region, r.canonical, sch.nextcheck scheduled, hc.nextcheck delayednext, sch.lastupdate, sch.mindelta, sch.avgdelta, sch.maxdelta
FROM tblRealm r
left join tblHouseCheck hc on hc.house = r.house
left join (
        select deltas.house, timestampadd(second, least(ifnull(min(delta)+15-120, 45*60), 150*60), max(deltas.updated)) nextcheck, max(deltas.updated) lastupdate, min(delta) mindelta, round(avg(delta)) avgdelta, max(delta) maxdelta
        from (
            select sn.updated,
            if(@prevhouse = sn.house and sn.updated > timestampadd(hour, -72, now()), unix_timestamp(sn.updated) - @prevdate, null) delta,
            @prevdate := unix_timestamp(sn.updated) updated_ts,
            @prevhouse := sn.house house
            from (select @prevhouse := null, @prevdate := null) setup, tblSnapshot sn
            order by sn.house, sn.updated) deltas
        group by deltas.house
        ) sch on sch.house = r.house
where r.canonical is not null
order by unix_timestamp(ifnull(delayednext, scheduled)) - unix_timestamp(scheduled) desc, ifnull(delayednext, scheduled), sch.lastupdate, region, canonical
EOF;
    $stmt = $db->prepare($sql);
    $stmt->execute();
    $result = $stmt->get_result();
    $rows = DBMapArray($result, null);
    echo '<table cellspacing="0"><tr><th>House</th><th>Region</th><th>Canonical</th><th>Updated</th><th>Scheduled</th><th>Min</th><th>Avg</th><th>Max</th></tr>';
    foreach ($rows as &$row) {
        echo '<tr><td class="r">' . $row['house'] . '</td>';
        echo '<td>' . $row['region'] . '</td>';
        echo '<td><a href="?bnetget=' . $row['region'] . '-' . $row['canonical'] . '">' . $row['canonical'] . '</a></td>';
        if (is_null($row['lastupdate'])) {
            echo '<td>&nbsp;</td>';
        } else {
            $css = '';
            $updateDelta = time() - strtotime($row['lastupdate']);
            if ($updateDelta > $row['maxdelta'] + 180) {
                $css = 'color: red';
            } elseif ($updateDelta > $row['avgdelta'] + 60) {
                $css = 'color: #999900';
            }
            echo '<td style="' . $css . '" class="r">' . TimeDiff(strtotime($row['lastupdate'])) . '</td>';
        }
        if (is_null($row['scheduled'])) {
            echo '<td>&nbsp;</td>';
        } elseif (is_null($row['delayednext'])) {
            echo '<td style="color: green" class="r">' . TimeDiff(strtotime($row['scheduled'])) . '</td>';
        } else {
            echo '<td style="color: #999900" class="r">' . TimeDiff(strtotime($row['delayednext'])) . '</td>';
        }
        echo '<td class="r">' . round(intval($row['mindelta'], 10) / 60) . ' min</td>';
        echo '<td class="r">' . round(intval($row['avgdelta'], 10) / 60) . ' min</td>';
        echo '<td class="r">' . round(intval($row['maxdelta'], 10) / 60) . ' min</td>';
        echo '</tr>';
    }
    unset($row);
    echo '</table>';
}
开发者ID:erorus,项目名称:newsstand,代码行数:58,代码来源:realmstatus.php

示例12: APIMaintenance

function APIMaintenance($when = -1, $expire = false)
{
    if (!function_exists('MCGet')) {
        DebugMessage('Tried to test for APIMaintenance without memcache loaded!', E_USER_ERROR);
    }
    $cacheKey = 'APIMaintenance';
    if ($when == -1) {
        return MCGet($cacheKey);
    }
    if ($when === false) {
        $when = 0;
    }
    if (!is_numeric($when)) {
        $when = strtotime($when);
    }
    if ($when) {
        if ($expire == false) {
            $expire = $when + 72 * 60 * 60;
        } elseif (!is_numeric($expire)) {
            $expire = strtotime($expire);
        }
        DebugMessage('Setting API maintenance mode, expected to end ' . TimeDiff($when) . ', maximum ' . TimeDiff($expire));
        MCSet($cacheKey, $when, $expire);
    } else {
        DebugMessage('Ending API maintenance mode.');
        MCDelete($cacheKey);
    }
    return $when;
}
开发者ID:erorus,项目名称:newsstand,代码行数:29,代码来源:incl.php

示例13: BuildDataIntervalsTable

function BuildDataIntervalsTable(&$rows)
{
    $tr = <<<EOF
<table border="1" cellspacing="0" cellpadding="5">
<tr>
    <th>Region</th>
    <th>Realms</th>
    <th>Minimum Delay</th>
    <th>Usual Delay</th>
    <th>Average Delay</th>
    <th>Maximum Delay</th>
    <th>Last Update</th>
</tr>
EOF;
    foreach ($rows as $row) {
        $tr .= '<tr>';
        $tr .= '<td>' . $row['region'] . '</td>';
        $tr .= '<td>' . $row['nms'] . '</td>';
        $tr .= '<td align="right">' . (is_null($row['mindelta']) ? '' : DeltaToMinutes($row['mindelta'])) . '</td>';
        $tr .= '<td align="right">' . (is_null($row['modedelta']) ? '' : DeltaToMinutes($row['modedelta'])) . '</td>';
        $tr .= '<td align="right">' . (is_null($row['avgdelta']) ? '' : DeltaToMinutes($row['avgdelta'])) . '</td>';
        $tr .= '<td align="right">' . (is_null($row['maxdelta']) ? '' : DeltaToMinutes($row['maxdelta'])) . '</td>';
        $tr .= '<td align="right">' . TimeDiff(strtotime($row['lastupdate'])) . '</td>';
        $tr .= '</tr>';
    }
    $tr .= '</table>';
    return $tr;
}
开发者ID:erorus,项目名称:newsstand,代码行数:28,代码来源:dataintervals.php

示例14: MCHouseLock

function MCHouseLock($house, $waitSeconds = 30)
{
    global $MCHousesLocked;
    static $registeredShutdown = false;
    if (isset($MCHousesLocked[$house])) {
        return true;
    }
    $giveUpAt = microtime(true) + $waitSeconds;
    $me = ['pid' => getmypid(), 'script' => $_SERVER["SCRIPT_FILENAME"], 'when' => time()];
    do {
        if (MCAdd('mchouselock_' . $house, $me, 30 * 60)) {
            $MCHousesLocked[$house] = true;
            if (!$registeredShutdown) {
                $registeredShutdown = true;
                register_shutdown_function('MCHouseUnlock');
            }
            return true;
        }
        usleep(500000);
    } while ($giveUpAt > microtime(true));
    $currentLock = MCGet('mchouselock_' . $house);
    DebugMessage("Could not get house lock for {$house}, owned by " . $currentLock['pid'] . ' ' . $currentLock['script'] . ' ' . TimeDiff($currentLock['when']));
    return false;
}
开发者ID:erorus,项目名称:newsstand,代码行数:24,代码来源:memcache.incl.php

示例15: mysql_fetch_row

	$sumtime=0;
	while(list($hn,$time_opd,$time_dc) = mysql_fetch_row($result)){
		
		// $sql = "Select count(hn)  From opcard_now where hn = '".$hn."' limit 1 ";
		// list($rows) = mysql_fetch_row(mysql_query($sql));

		// if($rows > 0){

			$sql = "Select vn, hn , ptname, time1_1, time2_1   From opday_now where hn = '".$hn."' limit 1 ";
			$result_opday_now = mysql_query($sql);
			list($vn, $hn, $ptname,$time_reg,$time_freg) = mysql_fetch_row($result_opday_now);

			// $sql = "Select time_format(stkcutdate,'%H:%i') From dphardep_now where tvn = '".$vn."' limit 1 ";
			// list($time_drug) = mysql_fetch_row(mysql_query($sql));

$totaltime= TimeDiff($time_reg,$time_opd);	
	if(!empty($hn) && 	!empty($time_reg) && !empty($time_opd) && ($time_reg < $time_opd) && ($totaltime >=5 && $totaltime<=30)){
	$i++;
	echo "
	<TR>
		<TD>".$i.".</TD>
		<TD>".$hn."</TD>
		<TD>".$ptname."</TD>
		<TD>".$time_reg."</TD>
		<TD>".$time_opd."</TD>
		<TD>".$totaltime."</TD>
	</TR>";
		$sumtime=$sumtime+$totaltime;
		}  //close if
		// }  //close if
	 }  //close while
开发者ID:robocon,项目名称:shs,代码行数:31,代码来源:opd_between_month_test.php


注:本文中的TimeDiff函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。