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


PHP LogException函数代码示例

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


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

示例1: index

 /**
  * Default search functionality.
  *
  * @since 2.0.0
  * @access public
  * @param int $Page Page number.
  */
 public function index($Page = '')
 {
     $this->addJsFile('search.js');
     $this->title(t('Search'));
     saveToConfig('Garden.Format.EmbedSize', '160x90', false);
     Gdn_Theme::section('SearchResults');
     list($Offset, $Limit) = offsetLimit($Page, c('Garden.Search.PerPage', 20));
     $this->setData('_Limit', $Limit);
     $Search = $this->Form->getFormValue('Search');
     $Mode = $this->Form->getFormValue('Mode');
     if ($Mode) {
         $this->SearchModel->ForceSearchMode = $Mode;
     }
     try {
         $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
     } catch (Gdn_UserException $Ex) {
         $this->Form->addError($Ex);
         $ResultSet = array();
     } catch (Exception $Ex) {
         LogException($Ex);
         $this->Form->addError($Ex);
         $ResultSet = array();
     }
     Gdn::userModel()->joinUsers($ResultSet, array('UserID'));
     // Fix up the summaries.
     $SearchTerms = explode(' ', Gdn_Format::text($Search));
     foreach ($ResultSet as &$Row) {
         $Row['Summary'] = SearchExcerpt(Gdn_Format::plainText($Row['Summary'], $Row['Format']), $SearchTerms);
         $Row['Summary'] = Emoji::instance()->translateToHtml($Row['Summary']);
         $Row['Format'] = 'Html';
     }
     $this->setData('SearchResults', $ResultSet, true);
     $this->setData('SearchTerm', Gdn_Format::text($Search), true);
     if ($ResultSet) {
         $NumResults = count($ResultSet);
     } else {
         $NumResults = 0;
     }
     if ($NumResults == $Offset + $Limit) {
         $NumResults++;
     }
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->Pager = $PagerFactory->GetPager('MorePager', $this);
     $this->Pager->MoreCode = 'More Results';
     $this->Pager->LessCode = 'Previous Results';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->configure($Offset, $Limit, $NumResults, 'dashboard/search/%1$s/%2$s/?Search=' . Gdn_Format::url($Search));
     //		if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
     //         $this->setJson('LessRow', $this->Pager->toString('less'));
     //         $this->setJson('MoreRow', $this->Pager->toString('more'));
     //         $this->View = 'results';
     //      }
     $this->canonicalUrl(url('search', true));
     $this->render();
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:63,代码来源:class.searchcontroller.php

示例2: index

 /**
  * Default search functionality.
  *
  * @since 2.0.0
  * @access public
  * @param int $Page Page number.
  */
 public function index($Page = '')
 {
     $this->addJsFile('search.js');
     $this->title(t('Search'));
     saveToConfig('Garden.Format.EmbedSize', '160x90', false);
     Gdn_Theme::section('SearchResults');
     list($Offset, $Limit) = offsetLimit($Page, c('Garden.Search.PerPage', 20));
     $this->setData('_Limit', $Limit);
     $Search = $this->Form->getFormValue('Search');
     $Mode = $this->Form->getFormValue('Mode');
     if ($Mode) {
         $this->SearchModel->ForceSearchMode = $Mode;
     }
     try {
         $ResultSet = $this->SearchModel->search($Search, $Offset, $Limit);
     } catch (Gdn_UserException $Ex) {
         $this->Form->addError($Ex);
         $ResultSet = array();
     } catch (Exception $Ex) {
         LogException($Ex);
         $this->Form->addError($Ex);
         $ResultSet = array();
     }
     Gdn::userModel()->joinUsers($ResultSet, array('UserID'));
     // Fix up the summaries.
     $SearchTerms = explode(' ', Gdn_Format::text($Search));
     foreach ($ResultSet as &$Row) {
         $Row['Summary'] = searchExcerpt(htmlspecialchars(Gdn_Format::plainText($Row['Summary'], $Row['Format'])), $SearchTerms);
         $Row['Summary'] = Emoji::instance()->translateToHtml($Row['Summary']);
         $Row['Format'] = 'Html';
     }
     $this->setData('SearchResults', $ResultSet, true);
     $this->setData('SearchTerm', Gdn_Format::text($Search), true);
     $this->setData('_CurrentRecords', count($ResultSet));
     $this->canonicalUrl(url('search', true));
     $this->render();
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:44,代码来源:class.searchcontroller.php

示例3: ExceptionHandler

 public static function ExceptionHandler($Exception)
 {
     $Message = $Exception->GetMessage();
     $File = $Exception->GetFile();
     $Line = $Exception->GetLine();
     echo "Error: {$Message}\n";
     echo $Exception->GetTraceAsString() . "\n";
     echo "{$File}\n";
     $FileArray = file($File);
     array_unshift($FileArray, '');
     for ($LengthAfter = $Line + 3, $i = $Line - 2; $i < $LengthAfter; $i++) {
         $FileLine =& $FileArray[$i];
         if ($FileLine !== Null) {
             $Px = '    ';
             if ($i == $Line) {
                 $FileLine = substr($FileLine, 0, -1) . " // <-- HERE!\n";
                 $Px = '>>> ';
             }
             echo "{$Px}{$i}: {$FileLine}";
         }
     }
     LogException($Exception);
     die;
 }
开发者ID:unlight,项目名称:UsefulFunctions,代码行数:24,代码来源:class.console.php

示例4: str_replace

    $text = $_POST['text'];
    $text = str_replace('[[br]]', "\n", $text);
    // convert marked newlines to real newlines
    $text = trim($text);
    // trim whitespace
    if ($text == "") {
        exit('empty');
    }
    // error if empty
    $text = htmlspecialchars($text);
    // escape html chars
    $text = nl2br($text, false);
    // convert newlines to html
    if (strlen($text) > $MAXCHARS || substr_count($text, "<br>") > $MAXLINES) {
        // too many lines or too many characters.
        exit('toolong');
    }
    $sql = GetSQL();
    $text = $sql->real_escape_string($text);
    $sql->safequery("\n\t\t\tUPDATE Topics SET state=" . TopicStates::Live . ",\n\t\t\tcontent='{$text}', time=" . time() . " WHERE id=" . $g_account->page . "\n\t\t\tAND state=" . TopicStates::Composing);
    //$sql->safequery( "UPDATE Accounts SET serial=serial+1 WHERE id=". $g_account->id );
    if ($sql->affected_rows == 0) {
        // their composition slot was deleted because
        // they took too long.
        exit('expired');
    }
    exit('okay.');
} catch (Exception $e) {
    LogException("compose", $e);
}
exit('error');
开发者ID:mukunda-,项目名称:button,代码行数:31,代码来源:compose.php

示例5: hourOffset

 /**
  * Return the timezone hour difference between the user and utc.
  * @return int The hour offset.
  */
 public function hourOffset()
 {
     static $GuestHourOffset;
     if ($this->UserID > 0) {
         return $this->User->HourOffset;
     } else {
         if (!isset($GuestHourOffset)) {
             $GuestTimeZone = c('Garden.GuestTimeZone');
             if ($GuestTimeZone) {
                 try {
                     $TimeZone = new DateTimeZone($GuestTimeZone);
                     $Offset = $TimeZone->getOffset(new DateTime('now', new DateTimeZone('UTC')));
                     $GuestHourOffset = floor($Offset / 3600);
                 } catch (Exception $Ex) {
                     $GuestHourOffset = 0;
                     LogException($Ex);
                 }
             }
         }
         return $GuestHourOffset;
     }
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:26,代码来源:class.session.php

示例6: Gdn_ExceptionHandler


//.........这里部分代码省略.........
                    if (file_exists($MasterViewPaths[$i])) {
                        $MasterViewPath = $MasterViewPaths[$i];
                        break;
                    }
                }
                if ($MasterViewPath !== FALSE) {
                    include $MasterViewPath;
                    $Master = TRUE;
                }
            }
        }
        if ($DeliveryType != DELIVERY_TYPE_ALL) {
            // This is an ajax request, so dump an error that is more eye-friendly in the debugger
            echo '<h1>FATAL ERROR IN: ', $SenderObject, '.', $SenderMethod, "();</h1>\n<div class=\"AjaxError\">\"" . $SenderMessage . "\"\n";
            if ($SenderCode != '') {
                echo htmlentities($SenderCode, ENT_COMPAT, 'UTF-8') . "\n";
            }
            if (is_array($ErrorLines) && $Line > -1) {
                echo "LOCATION: ", $File, "\n";
            }
            $LineCount = count($ErrorLines);
            $Padding = strlen($Line + 5);
            for ($i = 0; $i < $LineCount; ++$i) {
                if ($i > $Line - 6 && $i < $Line + 4) {
                    if ($i == $Line - 1) {
                        echo '>>';
                    }
                    echo '> ' . str_pad($i + 1, $Padding, " ", STR_PAD_LEFT), ': ', str_replace(array("\n", "\r"), array('', ''), $ErrorLines[$i]), "\n";
                }
            }
            if (is_array($Backtrace)) {
                echo "BACKTRACE:\n";
                $BacktraceCount = count($Backtrace);
                for ($i = 0; $i < $BacktraceCount; ++$i) {
                    if (array_key_exists('file', $Backtrace[$i])) {
                        $File = $Backtrace[$i]['file'] . ' ' . $Backtrace[$i]['line'];
                    }
                    echo '[' . $File . ']', ' ', array_key_exists('class', $Backtrace[$i]) ? $Backtrace[$i]['class'] : 'PHP', array_key_exists('type', $Backtrace[$i]) ? $Backtrace[$i]['type'] : '::', $Backtrace[$i]['function'], '();', "\n";
                }
            }
            echo '</div>';
        } else {
            // If the master view wasn't found, assume a panic state and dump the error.
            if ($Master === FALSE) {
                echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-ca">
   <head>
      <title>Fatal Error</title>
   </head>
   <body>
      <h1>Fatal Error in ', $SenderObject, '.', $SenderMethod, '();</h1>
      <h2>', $SenderMessage, "</h2>\n";
                if ($SenderCode != '') {
                    echo '<code>', htmlentities($SenderCode, ENT_COMPAT, 'UTF-8'), "</code>\n";
                }
                if (is_array($ErrorLines) && $Line > -1) {
                    echo '<h3><strong>The error occurred on or near:</strong> ', $File, '</h3>
         <pre>';
                    $LineCount = count($ErrorLines);
                    $Padding = strlen($Line + 4);
                    for ($i = 0; $i < $LineCount; ++$i) {
                        if ($i > $Line - 6 && $i < $Line + 4) {
                            echo str_pad($i, $Padding, " ", STR_PAD_LEFT), ': ', htmlentities($ErrorLines[$i], ENT_COMPAT, 'UTF-8');
                        }
                    }
                    echo "</pre>\n";
                }
                echo '<h2>Need Help?</h2>
      <p>If you are a user of this website, you can report this message to a website administrator.</p>
      <p>If you are an administrator of this website, you can get help at the <a href="http://vanillaforums.org/discussions/" target="_blank">Vanilla Community Forums</a>.</p>
      <h2>Additional information for support personnel:</h2>
      <ul>
         <li><strong>Application:</strong> ', APPLICATION, '</li>
         <li><strong>Application Version:</strong> ', APPLICATION_VERSION, '</li>
         <li><strong>PHP Version:</strong> ', PHP_VERSION, '</li>
         <li><strong>Operating System:</strong> ', PHP_OS, "</li>\n";
                if (array_key_exists('SERVER_SOFTWARE', $_SERVER)) {
                    echo '<li><strong>Server Software:</strong> ', $_SERVER['SERVER_SOFTWARE'], "</li>\n";
                }
                if (array_key_exists('HTTP_REFERER', $_SERVER)) {
                    echo '<li><strong>Referer:</strong> ', $_SERVER['HTTP_REFERER'], "</li>\n";
                }
                if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
                    echo '<li><strong>User Agent:</strong> ', $_SERVER['HTTP_USER_AGENT'], "</li>\n";
                }
                if (array_key_exists('REQUEST_URI', $_SERVER)) {
                    echo '<li><strong>Request Uri:</strong> ', $_SERVER['REQUEST_URI'], "</li>\n";
                }
                echo '</ul>
   </body>
   </html>';
            }
        }
        // Attempt to log an error message no matter what.
        LogException($Exception);
    } catch (Exception $e) {
        print get_class($e) . " thrown within the exception handler.<br/>Message: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine();
        exit;
    }
}
开发者ID:rnovino,项目名称:Garden,代码行数:101,代码来源:functions.error.php

示例7: ToTimezone

 /**
  * Formats a timestamp to the current user's timezone.
  *
  * @param int $Timestamp The timestamp in gmt.
  * @return int The timestamp according to the user's timezone.
  */
 public static function ToTimezone($Timestamp)
 {
     static $GuestHourOffset;
     $Now = time();
     // Alter the timestamp based on the user's hour offset
     $Session = Gdn::Session();
     $HourOffset = 0;
     if ($Session->UserID > 0) {
         $HourOffset = $Session->User->HourOffset;
     } elseif (class_exists('DateTimeZone')) {
         if (!isset($GuestHourOffset)) {
             $GuestTimeZone = C('Garden.GuestTimeZone');
             if ($GuestTimeZone) {
                 try {
                     $TimeZone = new DateTimeZone($GuestTimeZone);
                     $Offset = $TimeZone->getOffset(new DateTime('now', new DateTimeZone('UTC')));
                     $GuestHourOffset = floor($Offset / 3600);
                 } catch (Exception $Ex) {
                     $GuestHourOffset = 0;
                     LogException($Ex);
                 }
             }
         }
         $HourOffset = $GuestHourOffset;
     }
     if ($HourOffset != 0) {
         $SecondsOffset = $HourOffset * 3600;
         $Timestamp += $SecondsOffset;
         $Now += $SecondsOffset;
     }
     return $Timestamp;
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:38,代码来源:class.format.php

示例8: Index

 /**
  * Default search functionality.
  *
  * @since 2.0.0
  * @access public
  * @param int $Page Page number.
  */
 public function Index($Page = '')
 {
     $this->AddJsFile('jquery.gardenmorepager.js');
     $this->AddJsFile('search.js');
     $this->Title(T('Search'));
     SaveToConfig('Garden.Format.EmbedSize', '160x90', FALSE);
     list($Offset, $Limit) = OffsetLimit($Page, C('Garden.Search.PerPage', 20));
     $this->SetData('_Limit', $Limit);
     $Search = $this->Form->GetFormValue('Search');
     $Mode = $this->Form->GetFormValue('Mode');
     if ($Mode) {
         $this->SearchModel->ForceSearchMode = $Mode;
     }
     try {
         $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
     } catch (Gdn_UserException $Ex) {
         $this->Form->AddError($Ex);
         $ResultSet = array();
     } catch (Exception $Ex) {
         LogException($Ex);
         $this->Form->AddError($Ex);
         $ResultSet = array();
     }
     Gdn::UserModel()->JoinUsers($ResultSet, array('UserID'));
     $this->SetData('SearchResults', $ResultSet, TRUE);
     $this->SetData('SearchTerm', Gdn_Format::Text($Search), TRUE);
     if ($ResultSet) {
         $NumResults = count($ResultSet);
     } else {
         $NumResults = 0;
     }
     if ($NumResults == $Offset + $Limit) {
         $NumResults++;
     }
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->Pager = $PagerFactory->GetPager('MorePager', $this);
     $this->Pager->MoreCode = 'More Results';
     $this->Pager->LessCode = 'Previous Results';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Offset, $Limit, $NumResults, 'dashboard/search/%1$s/%2$s/?Search=' . Gdn_Format::Url($Search));
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'results';
     }
     $this->CanonicalUrl(Url('search', TRUE));
     $this->Render();
 }
开发者ID:rnovino,项目名称:Garden,代码行数:56,代码来源:class.searchcontroller.php

示例9: LogException

}
$appBuilderFactory = new \Conpago\AppBuilderFactory();
/** @var AppBuilder $appBuilder */
$appBuilder = $appBuilderFactory->createAppBuilder("Web", "..");
if ($c['devel']['debug'] == true) {
    $appBuilder->buildApp();
} else {
    $appBuilder->readPersistedApp();
}
/**
 * @param AppBuilder $appBuilder
 * @param Exception $e
 * @param $is_debug
 *
 * @throws Exception
 */
function LogException(AppBuilder $appBuilder, \Exception $e, $is_debug)
{
    try {
        $appBuilder->getLogger()->addCritical('Exception caught', ['exception' => $e]);
    } finally {
        if ($is_debug == true) {
            throw $e;
        }
    }
}
try {
    $appBuilder->getApp()->run();
} catch (\Exception $e) {
    LogException($appBuilder, $e, $is_debug);
}
开发者ID:bartoszgolek,项目名称:PHPers,代码行数:31,代码来源:index.php

示例10: ProcessException

function ProcessException($ex)
{
    global $DEBUG;
    global $RSS;
    global $sid;
    global $pageTitle;
    global $body;
    $log =& LogException($ex);
    $pageTitle = GetCap('capError');
    if ($DEBUG) {
        print "<br>Exception:<br>" . $log->ToString(1);
        Dump();
    } else {
        ob_end_clean();
        $id = $log->ID();
        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
            <head>
                <title><?php 
        echo $pageTitle;
        ?>
</title>
            </head>
            <body <?php 
        echo $body;
        ?>
>
                <center>
                    <p>
                        <?php 
        echo GetCap('capProblemEncountered');
        ?>
<br/>
                        <?php 
        echo GetCap('capItWasRecordedAndItWillBeFixed');
        ?>
<br/>
                        <?php 
        echo GetCap('capProblemID') . ': ' . $id;
        ?>
<br/>
                    </p>
                </center>
            </body>
        </html>
        <?php 
    }
    exit;
}
开发者ID:jhogan,项目名称:nplay,代码行数:50,代码来源:header.php

示例11: exit

<?php

require_once "sql.php";
require_once "config.php";
require_once "util.php";
try {
    if (!isset($_POST['page'])) {
        exit('error');
    }
    $g_account = LogIn();
    if ($g_account->page != $_POST['page']) {
        exit('wrongpage');
    }
    $sql = GetSQL();
    $sql->safequery('UPDATE Accounts SET page=0 WHERE id=' . $g_account->id);
    exit('okay.');
} catch (Exception $e) {
    LogException("closeold", $e);
}
exit('error');
开发者ID:mukunda-,项目名称:button,代码行数:20,代码来源:closeold.php

示例12: GetScore

            $score = GetScore($value['goods'], $value['bads']);
            if ($score < $GLOBALS['COMMENT_BURY_SCORE']) {
                // filter out shit scores.
                unset($output[$key]);
            } else {
                // translate goods,bads into final score
                $output[$key]['score'] = $score;
                unset($output[$key]['goods']);
                unset($output[$key]['bads']);
            }
        }
        // sort by score
        usort($output, "ScoreCmp2");
    } else {
        if ($state == TopicStates::Live) {
            // filter out downvoted comments
            foreach ($output as $key => $value) {
                if ($value['vote'] === FALSE) {
                    unset($output[$key]);
                }
            }
            // sort randomly
            shuffle($output);
        }
    }
    echo json_encode($output);
    exit;
} catch (Exception $e) {
    LogException("liverefresh", $e);
}
exit('error');
开发者ID:mukunda-,项目名称:button,代码行数:31,代码来源:liverefresh.php

示例13: exit

    if ($row[0] != TopicStates::Live) {
        $sql->safequery('UNLOCK TABLES');
        exit('error');
        // topic is invalid.
    }
    $sql->safequery('INSERT IGNORE INTO TopicVotes ( topicid, account, vote ) 
		VALUES ( ' . $g_account->page . ', ' . $g_account->id . ", {$voteval} )");
    if ($sql->affected_rows == 0) {
        $sql->safequery('UNLOCK TABLES');
        exit('error');
        // user already voted.
    }
    if ($voteval == '1') {
        $sql->safequery('UPDATE Topics SET goods=goods+1 WHERE id=' . $g_account->page);
    } else {
        if ($voteval == '0') {
            $sql->safequery('UPDATE Topics SET bads=bads+1 WHERE id=' . $g_account->page);
        }
    }
    $sql->safequery('UNLOCK TABLES');
    if ($voteval == '1') {
        exit('good');
    } else {
        if ($voteval == '0') {
            exit('cancer');
        }
    }
} catch (Exception $e) {
    LogException("topicvote", $e);
}
exit('error');
开发者ID:mukunda-,项目名称:button,代码行数:31,代码来源:topicvote.php

示例14: ShowTopic

function ShowTopic()
{
    global $g_account, $g_get_page;
    $page = $g_get_page ? $g_get_page : $g_account->page;
    echo '<script>';
    echo 'matbox.SetPage( ' . $page . ', "none");';
    echo '</script>';
    if ($page == 0) {
        ?>
			<script>matbox.SetPage( 0, "nonew" );</script>
			<div class="topic nothing" id="topic">
				no new matter.
			</div>
			<div class="panel">
				<div class="button" onclick="matbox.GotoRandom()">archive</div> 
				<div class="button" onclick="matbox.Loader.RefreshContent()">check again</div>
			</div>
		<?php 
        return false;
    }
    try {
        $topic = new Topic($page, $g_account);
    } catch (Exception $e) {
        ?>
			<div class="topic nothing clickable" id="topic" onclick="matbox.Loader.RefreshContent()">
				something messed up.
			</div>
		<?php 
        LogException("readtopic", $e);
        die;
    }
    if (!$topic->valid) {
        ?>
			<div class="topic nothing clickable" id="topic" onclick="matbox.Loader.RefreshContent()">
				that sample doesn't exist
			</div>
		<?php 
        return false;
    }
    if ($topic->state == TopicStates::Deleted) {
        ?>
			<div class="topic nothing clickable" id="topic" onclick="matbox.Loader.RefreshContent()">
				this matter was buried.
			</div>
		<?php 
        return false;
    }
    if ($topic->state == TopicStates::Composing) {
        echo '<div class="topic composing" id="topic">
				<div class="compose" contenteditable="true" id="composition"></div>
			  </div>';
        echo '<div class="submit" onclick="matbox.SubmitComposition()" id="submit">analyze</div>';
        ?>
		
		<script>
			$("#composition").keydown( function() {
				if( matbox.Loader.IsLoading() ) return false;
				setTimeout( matbox.CompositionKeyPressed, 0 );
			});
		</script>
		
		<?php 
        return true;
    }
    $badstring = mt_rand(0, 25) == 0 ? "cancer" : "bad";
    echo '<div class="topic" id="topic">';
    // replace embed tags
    $content = ReplaceEmbeds($topic->content);
    echo $content;
    if ($topic->state == TopicStates::Live) {
        echo '<script>matbox.SetPage( ' . $topic->id . ', "live")</script>';
        if ($topic->vote === true) {
            echo '<div class="good" id="goodbutton"><div class="speshul_table"><div><img src="star.png" title="good"></div></div></div>';
            echo '<div class="bad" id="badbutton"><div class="speshul_table"><div><img src="notbad.png" title="' . $badstring . '"></div></div></div>';
        } else {
            if ($topic->vote === false) {
                echo '<div class="good" id="goodbutton"><div class="speshul_table"><div><img src="unstar.png" title="good"></div></div></div>';
                echo '<div class="bad" id="badbutton"><div class="speshul_table"><div><img src="bad.png" title="' . $badstring . '"></div></div></div>';
            } else {
                echo '<div class="good clickable" id="goodbutton" ><div class="speshul_table"><div><img src="unstar.png" title="good" onclick="matbox.VoteTopicGood()"></div></div></div>';
                echo '<div class="bad clickable" id="badbutton" ><div class="speshul_table"><div><img src="notbad.png" title="' . $badstring . '" onclick="matbox.VoteTopicBad()"></div></div></div>';
            }
        }
    } else {
        if ($topic->state == TopicStates::Old) {
            echo '<script>matbox.SetPage( ' . $topic->id . ',"old" )</script>';
            // print score
            $score = GetScore($topic->goods, $topic->bads);
            echo '<div class="score ' . ScoreRank($score) . '" id="scorediv" title="' . ScoreRankName($score) . '"><div class="speshul_table"><div>' . $score . '</div></div></div>';
            /*echo '<div class="new" id="newbutton" onclick="matbox.CloseOld()"></div>';*/
        }
    }
    echo '</div>';
    echo '<div class="replies" id="replies">';
    echo '<div class="replylist" id="replylist">';
    echo '</div>';
    // replylist
    if ($topic->state == TopicStates::Live) {
        echo '<div class="reply" id="replyinputbox">
				 <div class="replyinput init" id="replyinput" contenteditable="true"></div>
//.........这里部分代码省略.........
开发者ID:mukunda-,项目名称:button,代码行数:101,代码来源:content.php

示例15: LogIn

    $g_account = LogIn();
    if ($g_account->page != $_POST['page']) {
        exit('error');
    }
    $sql = GetSQL();
    $sql->safequery('LOCK TABLES Topics READ, Comments READ, CommentVotes WRITE');
    $result = $sql->safequery('SELECT 1 FROM Topics
		WHERE id=' . $g_account->page . ' 
		AND state=' . TopicStates::Live);
    if ($result->num_rows == 0) {
        $sql->safequery('UNLOCK TABLES');
        exit('error');
        // topic is closed or invalid.
    }
    $result = $sql->safequery("SELECT 1 FROM Comments WHERE id={$comment} AND topic=" . $g_account->page);
    if ($result->num_rows == 0) {
        $sql->safequery('UNLOCK TABLES');
        exit('error');
        // comment doesn't exist.
    }
    $sql->safequery("INSERT INTO CommentVotes ( commentid, account, vote )\n\t\tVALUES ( {$comment}, " . $g_account->id . ", {$voteval} )\n\t\tON DUPLICATE KEY UPDATE vote={$voteval}");
    if ($sql->affected_rows == 0) {
        $sql->safequery('UNLOCK TABLES');
        exit('error');
    }
    $sql->safequery('UNLOCK TABLES');
    exit('okay.');
} catch (Exception $e) {
    LogException("commentvote", $e);
}
exit("error");
开发者ID:mukunda-,项目名称:button,代码行数:31,代码来源:commentvote.php


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