mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
Run formatter on all PHP code; should not change behaviour in any way
This commit is contained in:
parent
2ce6eba811
commit
7289aba68d
199 changed files with 136135 additions and 155831 deletions
|
@ -25,16 +25,16 @@ $adminid = $query->fetch()['user'];
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Admin Settings</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -44,7 +44,8 @@ $adminid = $query->fetch()['user'];
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -52,14 +53,14 @@ $adminid = $query->fetch()['user'];
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<?php
|
||||
|
@ -91,8 +92,10 @@ $adminid = $query->fetch()['user'];
|
|||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs nav-line" role="tablist" style="text-align: center;">
|
||||
<li role="presentation" class="active"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
|
||||
<li role="presentation"><a href="#logs" aria-controls="logs" role="tab" data-toggle="tab">Login History</a></li>
|
||||
<li role="presentation" class="active"><a href="#settings" aria-controls="settings"
|
||||
role="tab" data-toggle="tab">Settings</a></li>
|
||||
<li role="presentation"><a href="#logs" aria-controls="logs" role="tab"
|
||||
data-toggle="tab">Login History</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
|
@ -100,14 +103,17 @@ $adminid = $query->fetch()['user'];
|
|||
<div role="tabpanel" class="tab-pane active" id="settings">
|
||||
<div class="login-form" style="padding:0;">
|
||||
<?php if (isset($msg)) echo $msg; ?>
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" class="form-area" method="POST">
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" class="form-area"
|
||||
method="POST">
|
||||
<div class="form-area">
|
||||
<div class="group">
|
||||
<input type="text" id="adminid" name="adminid" class="form-control" placeholder="Username" value="<?php echo $adminid; ?>">
|
||||
<input type="text" id="adminid" name="adminid" class="form-control"
|
||||
placeholder="Username" value="<?php echo $adminid; ?>">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="group">
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Password">
|
||||
<input type="password" id="password" name="password"
|
||||
class="form-control" placeholder="Password">
|
||||
<i class="fa fa-key"></i>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default btn-block">Save</button>
|
||||
|
@ -156,22 +162,23 @@ $adminid = $query->fetch()['user'];
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<php
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
|
||||
header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z");
|
||||
die();
|
||||
?>
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
|
||||
header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z");
|
||||
die();
|
||||
?>
|
|
@ -44,16 +44,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Ads</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -63,7 +63,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -71,14 +72,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
<!-- Start Ads -->
|
||||
<div class="row">
|
||||
|
@ -91,20 +92,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
<div class="control-group">
|
||||
<label class="control-label" for="text_ads">Text Ads</label>
|
||||
<div class="controls">
|
||||
<textarea placeholder="Ad code" name="text_ads" rows="3" class="span6"><?php echo $text_ads; ?></textarea>
|
||||
<textarea placeholder="Ad code" name="text_ads" rows="3"
|
||||
class="span6"><?php echo $text_ads; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="ads_1">Image Ad - (Sidebar)</label>
|
||||
<div class="controls">
|
||||
<textarea placeholder="Ad code" name="ads_1" id="ads_1" rows="3" class="span6"><?php echo $ads_1; ?></textarea>
|
||||
<textarea placeholder="Ad code" name="ads_1" id="ads_1" rows="3"
|
||||
class="span6"><?php echo $ads_1; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="ads_2">Image Ad (Footer)</label>
|
||||
<div class="controls">
|
||||
<textarea placeholder="Ad code" name="ads_2" id="ads_2" rows="3" class="span6"><?php echo $ads_2; ?></textarea>
|
||||
<textarea placeholder="Ad code" name="ads_2" id="ads_2" rows="3"
|
||||
class="span6"><?php echo $ads_2; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Save</button>
|
||||
|
@ -120,17 +124,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -29,20 +29,20 @@ $primaryKey = 'id';
|
|||
// parameter represents the DataTables column identifier. In this case simple
|
||||
// indexes
|
||||
$columns = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'member', 'dt' => 1 ),
|
||||
array( 'db' => 'ip', 'dt' => 2 ),
|
||||
array( 'db' => 'visible', 'dt' => 3 )
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'member', 'dt' => 1),
|
||||
array('db' => 'ip', 'dt' => 2),
|
||||
array('db' => 'visible', 'dt' => 3)
|
||||
);
|
||||
|
||||
$columns2 = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'member', 'dt' => 1 ),
|
||||
array( 'db' => 'ip', 'dt' => 2 ),
|
||||
array( 'db' => 'visible', 'dt' => 3 ),
|
||||
array( 'db' => 'details', 'dt' => 4 ),
|
||||
array( 'db' => 'view', 'dt' => 5 ),
|
||||
array( 'db' => 'delete', 'dt' => 6)
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'member', 'dt' => 1),
|
||||
array('db' => 'ip', 'dt' => 2),
|
||||
array('db' => 'visible', 'dt' => 3),
|
||||
array('db' => 'details', 'dt' => 4),
|
||||
array('db' => 'view', 'dt' => 5),
|
||||
array('db' => 'delete', 'dt' => 6)
|
||||
);
|
||||
|
||||
|
||||
|
@ -60,9 +60,9 @@ $sql_details = array(
|
|||
* server-side, there is no need to edit below this line.
|
||||
*/
|
||||
|
||||
require( 'ssp.pastes.php' );
|
||||
require('ssp.pastes.php');
|
||||
|
||||
echo json_encode(
|
||||
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2)
|
||||
);
|
||||
?>
|
|
@ -29,20 +29,20 @@ $primaryKey = 'id';
|
|||
// parameter represents the DataTables column identifier. In this case simple
|
||||
// indexes
|
||||
$columns = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'm_report', 'dt' => 1 ),
|
||||
array( 'db' => 'p_report', 'dt' => 2 ),
|
||||
array( 'db' => 't_report', 'dt' => 3 )
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'm_report', 'dt' => 1),
|
||||
array('db' => 'p_report', 'dt' => 2),
|
||||
array('db' => 't_report', 'dt' => 3)
|
||||
);
|
||||
|
||||
$columns2 = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'm_report', 'dt' => 1 ),
|
||||
array( 'db' => 'p_report', 'dt' => 2 ),
|
||||
array( 'db' => 't_report', 'dt' => 3 ),
|
||||
array( 'db' => 'details', 'dt' => 4 ),
|
||||
array( 'db' => 'view', 'dt' => 5 ),
|
||||
array( 'db' => 'delete', 'dt' => 6)
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'm_report', 'dt' => 1),
|
||||
array('db' => 'p_report', 'dt' => 2),
|
||||
array('db' => 't_report', 'dt' => 3),
|
||||
array('db' => 'details', 'dt' => 4),
|
||||
array('db' => 'view', 'dt' => 5),
|
||||
array('db' => 'delete', 'dt' => 6)
|
||||
);
|
||||
|
||||
|
||||
|
@ -60,9 +60,9 @@ $sql_details = array(
|
|||
* server-side, there is no need to edit below this line.
|
||||
*/
|
||||
|
||||
require( 'ssp.reports.php' );
|
||||
require('ssp.reports.php');
|
||||
|
||||
echo json_encode(
|
||||
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2)
|
||||
);
|
||||
?>
|
|
@ -11,24 +11,24 @@ $primaryKey = 'id';
|
|||
// parameter represents the DataTables column identifier. In this case simple
|
||||
// indexes
|
||||
$columns = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'username', 'dt' => 1 ),
|
||||
array( 'db' => 'email_id', 'dt' => 2 ),
|
||||
array( 'db' => 'date', 'dt' => 3 ),
|
||||
array( 'db' => 'platform', 'dt' => 4 ),
|
||||
array( 'db' => 'id', 'dt' => 5 ),
|
||||
array( 'db' => 'verified', 'dt' => 7 )
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'username', 'dt' => 1),
|
||||
array('db' => 'email_id', 'dt' => 2),
|
||||
array('db' => 'date', 'dt' => 3),
|
||||
array('db' => 'platform', 'dt' => 4),
|
||||
array('db' => 'id', 'dt' => 5),
|
||||
array('db' => 'verified', 'dt' => 7)
|
||||
);
|
||||
|
||||
$columns2 = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'username', 'dt' => 1 ),
|
||||
array( 'db' => 'email_id', 'dt' => 2 ),
|
||||
array( 'db' => 'date', 'dt' => 3),
|
||||
array( 'db' => 'platform', 'dt' => 4 ),
|
||||
array( 'db' => 'ban', 'dt' => 5 ),
|
||||
array( 'db' => 'view', 'dt' => 6 ),
|
||||
array( 'db' => 'delete', 'dt' => 7)
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'username', 'dt' => 1),
|
||||
array('db' => 'email_id', 'dt' => 2),
|
||||
array('db' => 'date', 'dt' => 3),
|
||||
array('db' => 'platform', 'dt' => 4),
|
||||
array('db' => 'ban', 'dt' => 5),
|
||||
array('db' => 'view', 'dt' => 6),
|
||||
array('db' => 'delete', 'dt' => 7)
|
||||
);
|
||||
|
||||
|
||||
|
@ -46,13 +46,13 @@ $sql_details = array(
|
|||
* server-side, there is no need to edit below this line.
|
||||
*/
|
||||
|
||||
require( 'ssp.users.php' );
|
||||
require('ssp.users.php');
|
||||
|
||||
echo json_encode(
|
||||
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2)
|
||||
);
|
||||
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
|
||||
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
|
||||
header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z");
|
||||
die();
|
||||
}
|
||||
|
|
|
@ -148,16 +148,16 @@ if (isset($_POST['smtp_code'])) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Configuration</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -167,7 +167,8 @@ if (isset($_POST['smtp_code'])) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -175,14 +176,14 @@ if (isset($_POST['smtp_code'])) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<!-- Start Configuration Panel -->
|
||||
|
@ -195,28 +196,38 @@ if (isset($_POST['smtp_code'])) {
|
|||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs nav-line" role="tablist" style="text-align: center;">
|
||||
<li role="presentation" class="active"><a href="#siteinfo" aria-controls="siteinfo" role="tab" data-toggle="tab">Site Info</a></li>
|
||||
<li role="presentation"><a href="#permissions" aria-controls="permissions" role="tab" data-toggle="tab">Permissions</a></li>
|
||||
<li role="presentation"><a href="#captcha" aria-controls="captcha" role="tab" data-toggle="tab">Captcha Settings</a></li>
|
||||
<li role="presentation"><a href="#mail" aria-controls="mail" role="tab" data-toggle="tab">Mail Settings</a></li>
|
||||
<li role="presentation" class="active"><a href="#siteinfo" aria-controls="siteinfo"
|
||||
role="tab" data-toggle="tab">Site Info</a>
|
||||
</li>
|
||||
<li role="presentation"><a href="#permissions" aria-controls="permissions" role="tab"
|
||||
data-toggle="tab">Permissions</a></li>
|
||||
<li role="presentation"><a href="#captcha" aria-controls="captcha" role="tab"
|
||||
data-toggle="tab">Captcha Settings</a></li>
|
||||
<li role="presentation"><a href="#mail" aria-controls="mail" role="tab"
|
||||
data-toggle="tab">Mail Settings</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="siteinfo">
|
||||
<form class="form-horizontal" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<form class="form-horizontal" method="POST"
|
||||
action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Site Name</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="site_name" placeholder="The name of your site" value="<?php echo (isset($_POST['site_name']))?$_POST['site_name']:$site_name; // Prevent special characters on $_POST ?>">
|
||||
<input type="text" class="form-control" name="site_name"
|
||||
placeholder="The name of your site"
|
||||
value="<?php echo (isset($_POST['site_name'])) ? $_POST['site_name'] : $site_name; // Prevent special characters on $_POST ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Site Title</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="title" placeholder="Site title tag" value="<?php echo (isset($_POST['title']))?$_POST['title']:$title; // Prevent special characters on $_POST ?>">
|
||||
<input type="text" class="form-control" name="title"
|
||||
placeholder="Site title tag"
|
||||
value="<?php echo (isset($_POST['title'])) ? $_POST['title'] : $title; // Prevent special characters on $_POST ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -228,71 +239,85 @@ if (isset($_POST['smtp_code'])) {
|
|||
echo "https://";
|
||||
} else {
|
||||
echo "http://";
|
||||
}?>
|
||||
} ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="baseurl" placeholder="eg: pastethis.in (no trailing slash)" value="<?php echo (isset($_POST['baseurl']))?$_POST['baseurl']:$baseurl; // Prevent special characters on $_POST ?>">
|
||||
<input type="text" class="form-control" name="baseurl"
|
||||
placeholder="eg: pastethis.in (no trailing slash)"
|
||||
value="<?php echo (isset($_POST['baseurl'])) ? $_POST['baseurl'] : $baseurl; // Prevent special characters on $_POST ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Site Description</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="des" placeholder="Site description" value="<?php echo (isset($_POST['des']))?$_POST['des']:$des; // Prevent special characters on $_POST ?>">
|
||||
<input type="text" class="form-control" name="des"
|
||||
placeholder="Site description"
|
||||
value="<?php echo (isset($_POST['des'])) ? $_POST['des'] : $des; // Prevent special characters on $_POST ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Site Keywords</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="keyword" placeholder="Keywords (separated by a comma)" value="<?php echo $keyword; ?>">
|
||||
<input type="text" class="form-control" name="keyword"
|
||||
placeholder="Keywords (separated by a comma)"
|
||||
value="<?php echo $keyword; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Google Analytics</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="ga" placeholder="Google Analytics ID" value="<?php echo $ga; ?>">
|
||||
<input type="text" class="form-control" name="ga"
|
||||
placeholder="Google Analytics ID" value="<?php echo $ga; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Admin Email</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="email" placeholder="Email" value="<?php echo (isset($_POST['email']))?$_POST['email']:$email; // Prevent special characters on $_POST ?>">
|
||||
<input type="text" class="form-control" name="email" placeholder="Email"
|
||||
value="<?php echo (isset($_POST['email'])) ? $_POST['email'] : $email; // Prevent special characters on $_POST ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Facebook URL</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="face" placeholder="Facebook URL" value="<?php echo $face; ?>">
|
||||
<input type="text" class="form-control" name="face"
|
||||
placeholder="Facebook URL" value="<?php echo $face; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Twitter URL</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="twit" placeholder="Twitter URL" value="<?php echo $twit; ?>">
|
||||
<input type="text" class="form-control" name="twit"
|
||||
placeholder="Twitter URL" value="<?php echo $twit; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Google+ URL</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="gplus" placeholder="Google+ URL" value="<?php echo $gplus; ?>">
|
||||
<input type="text" class="form-control" name="gplus"
|
||||
placeholder="Google+ URL" value="<?php echo $gplus; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">Additional Site Scripts</label>
|
||||
<label class="col-sm-2 control-label form-label">Additional Site
|
||||
Scripts</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" id="additional_scripts" name="additional_scripts" rows="8"><?php echo (isset($_POST['additional_scripts']))?$_POST['additional_scripts']:$additional_scripts; // Prevent special characters on $_POST ?></textarea>
|
||||
<textarea class="form-control" id="additional_scripts"
|
||||
name="additional_scripts"
|
||||
rows="8"><?php echo (isset($_POST['additional_scripts'])) ? $_POST['additional_scripts'] : $additional_scripts; // Prevent special characters on $_POST ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="manage" value="manage" />
|
||||
<input type="hidden" name="manage" value="manage"/>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
@ -305,25 +330,28 @@ if (isset($_POST['smtp_code'])) {
|
|||
<!-- Permissions -->
|
||||
|
||||
<div role="tabpanel" class="tab-pane" id="permissions">
|
||||
<form class="form-horizontal" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<form class="form-horizontal" method="POST"
|
||||
action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input <?php if ($disableguest == "on") echo 'checked="true"'; ?> type="checkbox" name="disableguest" id="disableguest">
|
||||
<input <?php if ($disableguest == "on") echo 'checked="true"'; ?>
|
||||
type="checkbox" name="disableguest" id="disableguest">
|
||||
<label for="disableguest">
|
||||
Only allow registered users to paste
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input <?php if ($siteprivate == "on") echo 'checked="true"'; ?> type="checkbox" name="siteprivate" id="siteprivate">
|
||||
<input <?php if ($siteprivate == "on") echo 'checked="true"'; ?>
|
||||
type="checkbox" name="siteprivate" id="siteprivate">
|
||||
<label for="siteprivate">
|
||||
Make site private (no Recent Pastes or Archives)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br/>
|
||||
|
||||
<input type="hidden" name="permissions" value="permissions" />
|
||||
<input type="hidden" name="permissions" value="permissions"/>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
@ -336,34 +364,37 @@ if (isset($_POST['smtp_code'])) {
|
|||
<!-- Captcha pane -->
|
||||
|
||||
<div role="tabpanel" class="tab-pane" id="captcha">
|
||||
<form class="form-horizontal" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<form class="form-horizontal" method="POST"
|
||||
action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input <?php if ( $cap_e == "on" ) echo 'checked="true"'; ?> type="checkbox" name="cap_e" id="cap_e">
|
||||
<input <?php if ($cap_e == "on") echo 'checked="true"'; ?> type="checkbox"
|
||||
name="cap_e"
|
||||
id="cap_e">
|
||||
<label for="cap_e">Enable Captcha</label>
|
||||
</div>
|
||||
<br />
|
||||
<br/>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="mode" class="col-sm-1 col-form-label">Captcha Type</label>
|
||||
<select class="selectpicker" name="mode">
|
||||
<?php
|
||||
if ( $mode == "reCAPTCHA" ) {
|
||||
if ($mode == "reCAPTCHA") {
|
||||
echo '<option selected="">reCAPTCHA</option>';
|
||||
} else {
|
||||
echo '<option>reCAPTCHA</option>';
|
||||
}
|
||||
if ( $mode == "Easy" ) {
|
||||
if ($mode == "Easy") {
|
||||
echo '<option selected="">Easy</option>';
|
||||
} else {
|
||||
echo '<option>Easy</option>';
|
||||
}
|
||||
if ( $mode == "Normal" ) {
|
||||
if ($mode == "Normal") {
|
||||
echo '<option selected="">Normal</option>';
|
||||
} else {
|
||||
echo '<option>Normal</option>';
|
||||
}
|
||||
if ( $mode == "Tough" ) {
|
||||
if ($mode == "Tough") {
|
||||
echo '<option selected="">Tough</option>';
|
||||
} else {
|
||||
echo '<option>Tough</option>';
|
||||
|
@ -372,48 +403,59 @@ if (isset($_POST['smtp_code'])) {
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<hr/>
|
||||
<div class="panel-title">
|
||||
Internal Captcha Settings:
|
||||
</div>
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input <?php if ( $mul == "on" ) echo 'checked="true"'; ?> type="checkbox" name="mul" id="mul">
|
||||
<input <?php if ($mul == "on") echo 'checked="true"'; ?> type="checkbox"
|
||||
name="mul"
|
||||
id="mul">
|
||||
<label for="mul">Enable multiple backgrounds</label>
|
||||
</div>
|
||||
<br />
|
||||
<br/>
|
||||
<div class="form-group row">
|
||||
<label for="allowed" class="col-sm-1 col-form-label">Captcha Characters</label>
|
||||
<label for="allowed" class="col-sm-1 col-form-label">Captcha
|
||||
Characters</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="allowed" name="allowed" placeholder="Allowed Characters" value="<?php echo $allowed; ?>">
|
||||
<input type="text" id="allowed" name="allowed"
|
||||
placeholder="Allowed Characters" value="<?php echo $allowed; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="color" class="col-sm-1 col-form-label">Captcha Text Colour</label>
|
||||
<label for="color" class="col-sm-1 col-form-label">Captcha Text
|
||||
Colour</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="color" name="color" placeholder="Captcha Text Colour" value="<?php echo $color; ?>">
|
||||
<input type="text" id="color" name="color"
|
||||
placeholder="Captcha Text Colour" value="<?php echo $color; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<hr/>
|
||||
<div class="panel-title">
|
||||
reCAPTCHA Settings:
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="recaptcha_sitekey" class="col-sm-1 col-form-label">Site Key</label>
|
||||
<label for="recaptcha_sitekey" class="col-sm-1 col-form-label">Site
|
||||
Key</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="recaptcha_sitekey" name="recaptcha_sitekey" placeholder="Site Key" value="<?php echo $recaptcha_sitekey; ?>">
|
||||
<input type="text" id="recaptcha_sitekey" name="recaptcha_sitekey"
|
||||
placeholder="Site Key" value="<?php echo $recaptcha_sitekey; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="recaptcha_secretkey" class="col-sm-1 col-form-label">Secret Key</label>
|
||||
<label for="recaptcha_secretkey" class="col-sm-1 col-form-label">Secret
|
||||
Key</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="recaptcha_secretkey" name="recaptcha_secretkey" placeholder="Site Key" value="<?php echo $recaptcha_secretkey; ?>">
|
||||
<input type="text" id="recaptcha_secretkey" name="recaptcha_secretkey"
|
||||
placeholder="Site Key"
|
||||
value="<?php echo $recaptcha_secretkey; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="cap" value="cap" />
|
||||
<input type="hidden" name="cap" value="cap"/>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
@ -426,7 +468,8 @@ if (isset($_POST['smtp_code'])) {
|
|||
<!-- Mail Settings -->
|
||||
|
||||
<div role="tabpanel" class="tab-pane" id="mail">
|
||||
<form class="form-horizontal" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<form class="form-horizontal" method="POST"
|
||||
action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="panel-title">
|
||||
|
@ -499,34 +542,45 @@ if (isset($_POST['smtp_code'])) {
|
|||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">SMTP Host</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" placeholder="eg smtp.gmail.com" name="smtp_host" value="<?php echo $smtp_host; ?>">
|
||||
<input type="text" class="form-control" placeholder="eg smtp.gmail.com"
|
||||
name="smtp_host" value="<?php echo $smtp_host; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">SMTP Port</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="smtp_port" placeholder="eg 465 for SSL or 587 for TLS" value="<?php echo $smtp_port; ?>">
|
||||
<input type="text" class="form-control" name="smtp_port"
|
||||
placeholder="eg 465 for SSL or 587 for TLS"
|
||||
value="<?php echo $smtp_port; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">SMTP User</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="smtp_user" placeholder="eg user@gmail.com" value="<?php echo $smtp_username; ?>">
|
||||
<input type="text" class="form-control" name="smtp_user"
|
||||
placeholder="eg user@gmail.com"
|
||||
value="<?php echo $smtp_username; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">SMTP Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" id="smtp_pass" name="smtp_pass" placeholder="Email password" value="<?php echo($smtp_password); ?>">
|
||||
<input type="password" class="form-control" id="smtp_pass"
|
||||
name="smtp_pass" placeholder="Email password"
|
||||
value="<?php echo($smtp_password); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button style="margin-bottom: 2%;" id="smtppasstoggle" type="button" class="btn btn-default" onclick="if (smtp_pass.type == 'text') {smtp_pass.type = 'password';} else {smtp_pass.type = 'text';}">Toggle password</button>
|
||||
<button style="margin-bottom: 2%;" id="smtppasstoggle" type="button"
|
||||
class="btn btn-default"
|
||||
onclick="if (smtp_pass.type == 'text') {smtp_pass.type = 'password';} else {smtp_pass.type = 'text';}">
|
||||
Toggle password
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="smtp_code" value="smtp">
|
||||
|
@ -551,21 +605,22 @@ if (isset($_POST['smtp_code'])) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap-select.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap-select.js"></script>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
function show() {
|
||||
var smtppassword = document.getElementById('smtp_pass');
|
||||
smtppassword.setAttribute('type', 'text');
|
||||
|
@ -576,12 +631,12 @@ if (isset($_POST['smtp_code'])) {
|
|||
smtppassword.setAttribute('type', 'password');
|
||||
}
|
||||
|
||||
if($('#smtppasstoggle').is(':checked')) {
|
||||
if ($('#smtppasstoggle').is(':checked')) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -81,16 +81,16 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ponepaste - Dashboard</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -100,7 +100,8 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -108,14 +109,14 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<!-- Start Stats -->
|
||||
|
@ -300,7 +301,11 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
<?php
|
||||
$latestversion = file_get_contents('https://raw.githubusercontent.com/jordansamuel/PASTE/releases/version');
|
||||
echo "Latest version: " . $latestversion . "— Installed version: " . $currentversion;
|
||||
if ($currentversion == $latestversion) { echo '<br />You have the latest version'; } else { echo '<br />Your Paste installation is outdated. Get the latest version from <a href="https://sourceforge.net/projects/phpaste/files/latest/download">SourceForge</a>'; }
|
||||
if ($currentversion == $latestversion) {
|
||||
echo '<br />You have the latest version';
|
||||
} else {
|
||||
echo '<br />Your Paste installation is outdated. Get the latest version from <a href="https://sourceforge.net/projects/phpaste/files/latest/download">SourceForge</a>';
|
||||
}
|
||||
?>
|
||||
|
||||
</p>
|
||||
|
@ -313,7 +318,8 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
A fork of <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
|
@ -321,11 +327,11 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
</div>
|
||||
<!-- End Footer -->
|
||||
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -18,7 +18,7 @@ require_once('../includes/password.php');
|
|||
|
||||
session_start();
|
||||
|
||||
require_once ('../config.php');
|
||||
require_once('../config.php');
|
||||
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
|
@ -55,18 +55,20 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Login</title>
|
||||
<link href="css/paste.css" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
body{background: #F5F5F5;}
|
||||
body {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-form">
|
||||
<div class="login-form">
|
||||
<?php
|
||||
if (isset($msg)) {
|
||||
echo $msg;
|
||||
|
@ -82,7 +84,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="group">
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password" value="">
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password"
|
||||
value="">
|
||||
<i class="fa fa-key"></i>
|
||||
</div>
|
||||
<!-- Not yet implemented
|
||||
|
@ -94,6 +97,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
<button type="submit" class="btn btn-default btn-block">LOGIN</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -72,16 +72,16 @@ if ($last_ip == $ip) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Interface</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -91,7 +91,8 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -99,10 +100,10 @@ if ($last_ip == $ip) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
|
@ -191,8 +192,8 @@ if ($last_ip == $ip) {
|
|||
$fname = explode('.php', $files1[$loop]);
|
||||
$fname = $fname[0];
|
||||
$ffname = $files1[$loop];
|
||||
if ($ffname == "index.php") {/* we don't want index.php showing */}
|
||||
else {
|
||||
if ($ffname == "index.php") {/* we don't want index.php showing */
|
||||
} else {
|
||||
echo '<option value="' . $ffname . '">' . $fname . '</option>';
|
||||
}
|
||||
}
|
||||
|
@ -204,10 +205,10 @@ if ($last_ip == $ip) {
|
|||
<select class="selectpicker" name="theme">
|
||||
<?php
|
||||
// Find the current theme if not set from $_POST
|
||||
if ( !isset( $d_theme ) ) {
|
||||
if (!isset($d_theme)) {
|
||||
$query = "SELECT theme FROM interface WHERE id='1'";
|
||||
$result = mysqli_query( $con, $query );
|
||||
while ( $row = mysqli_fetch_array( $result ) ) {
|
||||
$result = mysqli_query($con, $query);
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$d_theme = $row['theme'];
|
||||
}
|
||||
}
|
||||
|
@ -222,8 +223,8 @@ if ($last_ip == $ip) {
|
|||
$ffname = $files1[$loop];
|
||||
echo $dir . $ffname;
|
||||
if (is_dir($dir . '/' . $ffname)) {
|
||||
$sel=( $d_theme == $fname )?'selected="selected"':'';
|
||||
echo '<option value="' . $ffname . '" '.$sel.'>' . $fname . '</option>';
|
||||
$sel = ($d_theme == $fname) ? 'selected="selected"' : '';
|
||||
echo '<option value="' . $ffname . '" ' . $sel . '>' . $fname . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -245,18 +246,19 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap-select.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap-select.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -69,26 +69,26 @@ if ($last_ip == $ip) {
|
|||
}
|
||||
|
||||
// Get IP from form or URL
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' || isset( $_GET['banip'] ) ) {
|
||||
if ( isset( $_POST['banip'] ) ) {
|
||||
$ban_ip = htmlentities( Trim( $_POST['ban_ip'] ) );
|
||||
} elseif ( isset( $_GET['banip'] ) ) {
|
||||
$ban_ip = htmlentities( Trim( $_GET['banip'] ) );
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' || isset($_GET['banip'])) {
|
||||
if (isset($_POST['banip'])) {
|
||||
$ban_ip = htmlentities(Trim($_POST['ban_ip']));
|
||||
} elseif (isset($_GET['banip'])) {
|
||||
$ban_ip = htmlentities(Trim($_GET['banip']));
|
||||
}
|
||||
// Check if IP is blank or already banned.
|
||||
if ( trim($ban_ip) == '' ) {
|
||||
if (trim($ban_ip) == '') {
|
||||
$msg = '<div class="paste-alert alert6" style="text-align: center;">Please enter an IP to ban.</div>';
|
||||
} else {
|
||||
$query = "SELECT * FROM ban_user where ip='$ban_ip'";
|
||||
$result = mysqli_query( $con, $query );
|
||||
$num_rows = mysqli_num_rows( $result );
|
||||
if ( $num_rows >= 1 ) {
|
||||
$result = mysqli_query($con, $query);
|
||||
$num_rows = mysqli_num_rows($result);
|
||||
if ($num_rows >= 1) {
|
||||
$msg = '<div class="paste-alert alert1" style="text-align: center;">' . $ban_ip . ' already banned</div>';
|
||||
} else {
|
||||
// Valid IP which is not banned. Add to database
|
||||
$query = "INSERT INTO ban_user (last_date,ip) VALUES ('$date','$ban_ip')";
|
||||
mysqli_query( $con, $query );
|
||||
if ( mysqli_errno( $con ) ) {
|
||||
mysqli_query($con, $query);
|
||||
if (mysqli_errno($con)) {
|
||||
$msg = '<div class="paste-alert alert6" style="text-align: center;">' . mysqli_error($con) . '</div>';
|
||||
} else {
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">' . $ban_ip . ' added to the banlist</div>';
|
||||
|
@ -117,16 +117,16 @@ if (isset($_GET{'delete'})) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - IP Bans</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -136,7 +136,8 @@ if (isset($_GET{'delete'})) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -144,10 +145,10 @@ if (isset($_GET{'delete'})) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
|
@ -205,7 +206,7 @@ if (isset($_GET{'delete'})) {
|
|||
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="ban_ip" placeholder="Enter an IP address">
|
||||
<input type="hidden" name="banip" value="banip" />
|
||||
<input type="hidden" name="banip" value="banip"/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Add</button>
|
||||
</form>
|
||||
|
@ -236,7 +237,6 @@ if (isset($_GET{'delete'})) {
|
|||
$rec_count = Trim($row[0]);
|
||||
|
||||
|
||||
|
||||
if (isset($_GET{'page'})) { // Current page
|
||||
$page = $_GET{'page'} + 1;
|
||||
$offset = $rec_limit * $page;
|
||||
|
@ -272,9 +272,9 @@ if (isset($_GET{'delete'})) {
|
|||
} else {
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$last\">Previous</a></li>";
|
||||
}
|
||||
} else if ($page == 0) {
|
||||
} elseif ($page == 0) {
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$page\">Next</a></li>";
|
||||
} else if ($page > 0) {
|
||||
} elseif ($page > 0) {
|
||||
$last = $page - 2;
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$last\">Previous</a></li> ";
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$page\">Next</a></li>";
|
||||
|
@ -293,17 +293,18 @@ if (isset($_GET{'delete'})) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -12,45 +12,49 @@ For licensing, see LICENSE.md or http://ckeditor.com/license
|
|||
<link rel="stylesheet" href="sample.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
<h1 class="samples">
|
||||
CKEditor — Posted Data
|
||||
</h1>
|
||||
<table border="1" cellspacing="0" id="outputSample">
|
||||
<colgroup><col width="120"></colgroup>
|
||||
</h1>
|
||||
<table border="1" cellspacing="0" id="outputSample">
|
||||
<colgroup>
|
||||
<col width="120">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
if (!empty($_POST))
|
||||
{
|
||||
foreach ( $_POST as $key => $value )
|
||||
{
|
||||
if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
|
||||
if (!empty($_POST)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
if ((!is_string($value) && !is_numeric($value)) || !is_string($key))
|
||||
continue;
|
||||
|
||||
$value = htmlspecialchars( (string)$value );
|
||||
?>
|
||||
$value = htmlspecialchars((string)$value);
|
||||
?>
|
||||
<tr>
|
||||
<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
|
||||
<td><pre class="samples"><?php echo $value; ?></pre></td>
|
||||
<th style="vertical-align: top"><?php echo htmlspecialchars((string)$key); ?></th>
|
||||
<td>
|
||||
<pre class="samples"><?php echo $value; ?></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<div id="footer">
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<div id="footer">
|
||||
<hr>
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
CKEditor - The text editor for the Internet - <a class="samples"
|
||||
href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
|
||||
Copyright © 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All
|
||||
rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,4 +13,5 @@
|
|||
For licensing, see LICENSE.md or <a href="http://ckeditor.com/license">http://ckeditor.com/license</a>
|
||||
-------------------------------------------------------------------------------------------
|
||||
|
||||
</pre><div style="display:none"></body> */ include "assets/posteddata.php"; ?>
|
||||
</pre><div style="display:none"></body> */
|
||||
include "assets/posteddata.php"; ?>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="panel quick-menu clearfix">
|
||||
<li class="col-xs-3 col-sm-2 col-md-1 menu-active">
|
||||
|
@ -39,4 +39,4 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -56,15 +56,15 @@ if (isset($_GET{'edit'})) {
|
|||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Pages</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -78,7 +78,8 @@ if (isset($_GET{'edit'})) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -93,7 +94,7 @@ if (isset($_GET{'edit'})) {
|
|||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<!-- Start Pages -->
|
||||
|
@ -104,24 +105,28 @@ if (isset($_GET{'edit'})) {
|
|||
<div class="panel-title">Add a Page</a></div>
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" class="form-horizontal" method="post">
|
||||
<div class="control-group">
|
||||
<label for="page_name">Page name (No spaces, e.g. terms_of_service)</label> <input class="span6" id=
|
||||
<label for="page_name">Page name (No spaces, e.g. terms_of_service)</label> <input
|
||||
class="span6" id=
|
||||
"page_name" name="page_name" placeholder="Enter page name"
|
||||
type="text" value="<?php echo isset($page_name); ?>">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label for="page_title">Page title</label> <input class=
|
||||
"span6" id="page_title" name="page_title" placeholder=
|
||||
"Enter page title" type="text" value=
|
||||
"span6" id="page_title"
|
||||
name="page_title" placeholder=
|
||||
"Enter page title" type="text"
|
||||
value=
|
||||
"<?php echo isset($page_title); ?>">
|
||||
</div>
|
||||
<br />
|
||||
<br/>
|
||||
<?php
|
||||
if (isset($_GET{'edit'})) {
|
||||
echo '<input type="hidden" value=' . $_GET['edit'] . 'id="editme" name="editme" />';
|
||||
}
|
||||
?>
|
||||
<div class='control-group'>
|
||||
<textarea class="span6" cols="80" id="editor1" name="data" rows="10"><?php echo isset($page_content); ?></textarea><br>
|
||||
<textarea class="span6" cols="80" id="editor1" name="data"
|
||||
rows="10"><?php echo isset($page_content); ?></textarea><br>
|
||||
</div>
|
||||
<button class="btn btn-default btn-sm">Save</button>
|
||||
</form>
|
||||
|
@ -170,7 +175,6 @@ if (isset($_GET{'edit'})) {
|
|||
$rec_count = Trim($row[0]);
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['page'])) { // Get the current page
|
||||
$page = $_GET['page'] + 1;
|
||||
$offset = $rec_limit * $page;
|
||||
|
@ -209,9 +213,9 @@ if (isset($_GET{'edit'})) {
|
|||
} else {
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$last\">Previous</a></li>";
|
||||
}
|
||||
} else if ($page == 0) {
|
||||
} elseif ($page == 0) {
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$page\">Next</a></li>";
|
||||
} else if ($page > 0) {
|
||||
} elseif ($page > 0) {
|
||||
$last = $page - 2;
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$last\">Previous</a></li> ";
|
||||
echo @"<li><a href=\"$_PHP_SELF?page=$page\">Next</a></li>";
|
||||
|
@ -229,7 +233,8 @@ if (isset($_GET{'edit'})) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
|
@ -249,10 +254,10 @@ if (isset($_GET{'edit'})) {
|
|||
<script src="js/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(function () {
|
||||
CKEDITOR.replace('editor1');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
<?php mysqli_close($con); ?>
|
|
@ -20,17 +20,17 @@ updateAdminHistory($conn);
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Pastes</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/datatables.min.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/datatables.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -40,7 +40,8 @@ updateAdminHistory($conn);
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -48,14 +49,14 @@ updateAdminHistory($conn);
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<?php
|
||||
|
@ -139,47 +140,47 @@ updateAdminHistory($conn);
|
|||
<table class="table display dataTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> Username </td>
|
||||
<td> Username</td>
|
||||
<td> <?php echo $p_member; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Paste Title </td>
|
||||
<td> Paste Title</td>
|
||||
<td> <?php echo $p_title; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Visibility </td>
|
||||
<td> Visibility</td>
|
||||
<td> <?php echo $visible; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Password </td>
|
||||
<td> Password</td>
|
||||
<td> <?php echo $pass; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Views </td>
|
||||
<td> Views</td>
|
||||
<td> <?php echo $p_views; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> IP </td>
|
||||
<td> IP</td>
|
||||
<td> <?php echo $p_ip; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Syntax Highlighting </td>
|
||||
<td> Syntax Highlighting</td>
|
||||
<td> <?php echo $p_code; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Expiration </td>
|
||||
<td> Expiration</td>
|
||||
<td> <?php echo $expiry; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Encrypted Paste </td>
|
||||
<td> Encrypted Paste</td>
|
||||
<td> <?php echo $encrypt; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -195,7 +196,8 @@ updateAdminHistory($conn);
|
|||
|
||||
<?php if (isset($msg)) echo $msg; ?>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="pastesTable">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
|
||||
id="pastesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -223,7 +225,8 @@ updateAdminHistory($conn);
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
|
@ -231,20 +234,20 @@ updateAdminHistory($conn);
|
|||
</div>
|
||||
<!-- End Footer -->
|
||||
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" language="javascript" class="init">
|
||||
$(document).ready(function() {
|
||||
$('#pastesTable').dataTable( {
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" language="javascript" class="init">
|
||||
$(document).ready(function () {
|
||||
$('#pastesTable').dataTable({
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"ajax": "ajax_pastes.php"
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -73,17 +73,17 @@ if ($last_ip == $ip) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Pastes</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/datatables.min.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/datatables.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -93,7 +93,8 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -101,14 +102,14 @@ if ($last_ip == $ip) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<?php
|
||||
|
@ -208,47 +209,47 @@ if ($last_ip == $ip) {
|
|||
<table class="table display dataTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> Username </td>
|
||||
<td> Username</td>
|
||||
<td> <?php echo $p_member; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Paste Title </td>
|
||||
<td> Paste Title</td>
|
||||
<td> <?php echo $p_title; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Visibility </td>
|
||||
<td> Visibility</td>
|
||||
<td> <?php echo $visible; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Password </td>
|
||||
<td> Password</td>
|
||||
<td> <?php echo $pass; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Views </td>
|
||||
<td> Views</td>
|
||||
<td> <?php echo $p_views; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> IP </td>
|
||||
<td> IP</td>
|
||||
<td> <?php echo $p_ip; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Syntax Highlighting </td>
|
||||
<td> Syntax Highlighting</td>
|
||||
<td> <?php echo $p_code; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Expiration </td>
|
||||
<td> Expiration</td>
|
||||
<td> <?php echo $expiry; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Encrypted Paste </td>
|
||||
<td> Encrypted Paste</td>
|
||||
<td> <?php echo $encrypt; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -264,7 +265,8 @@ if ($last_ip == $ip) {
|
|||
|
||||
<?php if (isset($msg)) echo $msg; ?>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="pastesTable">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
|
||||
id="pastesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -292,7 +294,8 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
|
@ -300,20 +303,20 @@ if ($last_ip == $ip) {
|
|||
</div>
|
||||
<!-- End Footer -->
|
||||
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" language="javascript" class="init">
|
||||
$(document).ready(function() {
|
||||
$('#pastesTable').dataTable( {
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" language="javascript" class="init">
|
||||
$(document).ready(function () {
|
||||
$('#pastesTable').dataTable({
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"ajax": "ajax_reports.php"
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -80,16 +80,16 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Sitemap</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -99,7 +99,8 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -107,14 +108,14 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<?php
|
||||
|
@ -148,23 +149,29 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
<form method="POST" action="sitemap.php">
|
||||
<div class="form-group">
|
||||
<label for="changefreq">Change Frequency</label>
|
||||
<input type="text" placeholder="Enter frequency range" name="changefreq" id="changefreq" value="<?php echo $changefreq; ?>" class="form-control">
|
||||
<input type="text" placeholder="Enter frequency range" name="changefreq" id="changefreq"
|
||||
value="<?php echo $changefreq; ?>" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="priority">Priority Level</label>
|
||||
<input type="text" placeholder="Enter priority..." id="priority" name="priority" value="<?php echo $priority; ?>" class="form-control">
|
||||
<input type="text" placeholder="Enter priority..." id="priority" name="priority"
|
||||
value="<?php echo $priority; ?>" class="form-control">
|
||||
</div>
|
||||
|
||||
<button class="btn btn-default" type="submit">Submit</button>
|
||||
</form>
|
||||
<br />
|
||||
<br/>
|
||||
<?php
|
||||
if (isset($_GET['re'])) {
|
||||
unlink('../sitemap.xml');
|
||||
// which protocol are we on
|
||||
$protocol = paste_protocol();
|
||||
// level up, dirty but meh
|
||||
$x=2;$path = dirname($_SERVER['PHP_SELF']); while(max(0, --$x)) { $levelup = dirname($path); }
|
||||
$x = 2;
|
||||
$path = dirname($_SERVER['PHP_SELF']);
|
||||
while (max(0, --$x)) {
|
||||
$levelup = dirname($path);
|
||||
}
|
||||
$c_date = date('Y-m-d');
|
||||
$data = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
@ -223,7 +230,8 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
}
|
||||
?>
|
||||
<form method="GET" action="sitemap.php">
|
||||
<button class="btn btn-default" name="re" id="re" type="submit">Generate sitemap.xml</button>
|
||||
<button class="btn btn-default" name="re" id="re" type="submit">Generate sitemap.xml
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -236,17 +244,18 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -8,22 +8,20 @@ class SSP {
|
|||
* @param array $data Data from the SQL get
|
||||
* @return array Formatted data in a row based format
|
||||
*/
|
||||
static function data_output ( $columns, $data )
|
||||
{
|
||||
static function data_output($columns, $data) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
|
||||
$row = array();
|
||||
|
||||
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
|
||||
for ($j = 0, $jen = count($columns); $j < $jen; $j++) {
|
||||
$column = $columns[$j];
|
||||
|
||||
// Is there a formatter?
|
||||
if ( isset( $column['formatter'] ) ) {
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
}
|
||||
else {
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
if (isset($column['formatter'])) {
|
||||
$row[$column['dt']] = $column['formatter']($data[$i][$column['db']], $data[$i]);
|
||||
} else {
|
||||
$row[$column['dt']] = $data[$i][$columns[$j]['db']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,12 +41,11 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL limit clause
|
||||
*/
|
||||
static function limit ( $request, $columns )
|
||||
{
|
||||
static function limit($request, $columns) {
|
||||
$limit = '';
|
||||
|
||||
if ( isset($request['start']) && $request['length'] != -1 ) {
|
||||
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
|
||||
if (isset($request['start']) && $request['length'] != -1) {
|
||||
$limit = "LIMIT " . intval($request['start']) . ", " . intval($request['length']);
|
||||
}
|
||||
|
||||
return $limit;
|
||||
|
@ -64,32 +61,31 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL order by clause
|
||||
*/
|
||||
static function order ( $request, $columns )
|
||||
{
|
||||
static function order($request, $columns) {
|
||||
$order = '';
|
||||
|
||||
if ( isset($request['order']) && count($request['order']) ) {
|
||||
if (isset($request['order']) && count($request['order'])) {
|
||||
$orderBy = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
for ( $i=0, $ien=count($request['order']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['order']); $i < $ien; $i++) {
|
||||
// Convert the column index into the column data property
|
||||
$columnIdx = intval($request['order'][$i]['column']);
|
||||
$requestColumn = $request['columns'][$columnIdx];
|
||||
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['orderable'] == 'true' ) {
|
||||
if ($requestColumn['orderable'] == 'true') {
|
||||
$dir = $request['order'][$i]['dir'] === 'DESC' ?
|
||||
'ASC' :
|
||||
'DESC';
|
||||
|
||||
$orderBy[] = '`'.$column['db'].'` '.$dir;
|
||||
$orderBy[] = '`' . $column['db'] . '` ' . $dir;
|
||||
}
|
||||
}
|
||||
|
||||
$order = 'ORDER BY '.implode(', ', $orderBy);
|
||||
$order = 'ORDER BY ' . implode(', ', $orderBy);
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
@ -111,57 +107,56 @@ class SSP {
|
|||
* sql_exec() function
|
||||
* @return string SQL where clause
|
||||
*/
|
||||
static function filter ( $request, $columns, &$bindings )
|
||||
{
|
||||
static function filter($request, $columns, &$bindings) {
|
||||
$globalSearch = array();
|
||||
$columnSearch = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
if ( isset($request['search']) && $request['search']['value'] != '' ) {
|
||||
if (isset($request['search']) && $request['search']['value'] != '') {
|
||||
$str = $request['search']['value'];
|
||||
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$globalSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Individual column filtering
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
$str = $requestColumn['search']['value'];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' &&
|
||||
$str != '' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true' &&
|
||||
$str != '') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$columnSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the filters into a single string
|
||||
$where = '';
|
||||
|
||||
if ( count( $globalSearch ) ) {
|
||||
$where = '('.implode(' OR ', $globalSearch).')';
|
||||
if (count($globalSearch)) {
|
||||
$where = '(' . implode(' OR ', $globalSearch) . ')';
|
||||
}
|
||||
|
||||
if ( count( $columnSearch ) ) {
|
||||
if (count($columnSearch)) {
|
||||
$where = $where === '' ?
|
||||
implode(' AND ', $columnSearch) :
|
||||
$where .' AND '. implode(' AND ', $columnSearch);
|
||||
$where . ' AND ' . implode(' AND ', $columnSearch);
|
||||
}
|
||||
|
||||
if ( $where !== '' ) {
|
||||
$where = 'WHERE '.$where;
|
||||
if ($where !== '') {
|
||||
$where = 'WHERE ' . $where;
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
@ -182,19 +177,18 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return array Server-side processing response array
|
||||
*/
|
||||
static function simple ( $request, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
{
|
||||
static function simple($request, $sql_details, $table, $primaryKey, $columns, $columns2) {
|
||||
$bindings = array();
|
||||
$db = self::sql_connect( $sql_details );
|
||||
$db = self::sql_connect($sql_details);
|
||||
|
||||
// Build the SQL query string from the request
|
||||
$limit = self::limit( $request, $columns );
|
||||
$order = self::order( $request, $columns );
|
||||
$where = self::filter( $request, $columns, $bindings );
|
||||
$limit = self::limit($request, $columns);
|
||||
$order = self::order($request, $columns);
|
||||
$where = self::filter($request, $columns, $bindings);
|
||||
|
||||
// Main query to actually get the data
|
||||
$data = self::Ssql_exec($db, $bindings,
|
||||
"SELECT SQL_CALC_FOUND_ROWS `".implode("`, `", self::pluck($columns, 'db'))."`
|
||||
"SELECT SQL_CALC_FOUND_ROWS `" . implode("`, `", self::pluck($columns, 'db')) . "`
|
||||
FROM `$table`
|
||||
$where
|
||||
$order
|
||||
|
@ -202,12 +196,12 @@ class SSP {
|
|||
);
|
||||
|
||||
// Data set length after filtering
|
||||
$resFilterLength = self::sql_exec( $db,
|
||||
$resFilterLength = self::sql_exec($db,
|
||||
"SELECT FOUND_ROWS()"
|
||||
);
|
||||
$recordsFiltered = $resFilterLength[0][0];
|
||||
// Total data set length
|
||||
$resTotalLength = self::sql_exec( $db,
|
||||
$resTotalLength = self::sql_exec($db,
|
||||
"SELECT COUNT(`{$primaryKey}`)
|
||||
FROM `$table`"
|
||||
);
|
||||
|
@ -217,10 +211,10 @@ class SSP {
|
|||
* Output
|
||||
*/
|
||||
return array(
|
||||
"draw" => intval( $request['draw'] ),
|
||||
"recordsTotal" => intval( $recordsTotal ),
|
||||
"recordsFiltered" => intval( $recordsFiltered ),
|
||||
"data" => self::data_output( $columns2, $data )
|
||||
"draw" => intval($request['draw']),
|
||||
"recordsTotal" => intval($recordsTotal),
|
||||
"recordsFiltered" => intval($recordsFiltered),
|
||||
"data" => self::data_output($columns2, $data)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -236,20 +230,18 @@ class SSP {
|
|||
* * pass - user password
|
||||
* @return resource Database connection handle
|
||||
*/
|
||||
static function sql_connect ( $sql_details )
|
||||
{
|
||||
static function sql_connect($sql_details) {
|
||||
try {
|
||||
$db = @new PDO(
|
||||
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
|
||||
$sql_details['user'],
|
||||
$sql_details['pass'],
|
||||
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
);
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
} catch (PDOException $e) {
|
||||
self::fatal(
|
||||
"An error occurred while connecting to the database. ".
|
||||
"The error reported by the server was: ".$e->getMessage()
|
||||
"An error occurred while connecting to the database. " .
|
||||
"The error reported by the server was: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -267,83 +259,74 @@ class SSP {
|
|||
* @param string $sql SQL query to execute.
|
||||
* @return array Result from the query (all rows)
|
||||
*/
|
||||
static function sql_exec ( $db, $bindings, $sql=null )
|
||||
{
|
||||
static function sql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
//echo $sql;
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
}
|
||||
$result= $stmt->fetchAll();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function Ssql_exec ($db, $bindings, $sql=null )
|
||||
{
|
||||
static function Ssql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
$loop = '0';
|
||||
|
||||
while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[$loop]['id']= $arr['id'];
|
||||
$result[$loop]['member']= $arr['member'];
|
||||
$result[$loop]['ip']= $arr['ip'];
|
||||
$result[$loop]['id'] = $arr['id'];
|
||||
$result[$loop]['member'] = $arr['member'];
|
||||
$result[$loop]['ip'] = $arr['ip'];
|
||||
$vis = Trim($arr['visible']);
|
||||
if ($vis == '0')
|
||||
{
|
||||
if ($vis == '0') {
|
||||
$result[$loop]['visible'] = "Public";
|
||||
}
|
||||
elseif ($vis == '1')
|
||||
{
|
||||
} elseif ($vis == '1') {
|
||||
$result[$loop]['visible'] = "Unlisted";
|
||||
}
|
||||
elseif ($vis == '2')
|
||||
{
|
||||
} elseif ($vis == '2') {
|
||||
$result[$loop]['visible'] = "Private";
|
||||
}
|
||||
$myid = $arr['id'];
|
||||
$result[$loop]['details'] ="<a class='btn btn-default btn-sm' href=pastes.php?details=".$myid."> Details </a>";
|
||||
$result[$loop]['view'] = "<a class='btn btn-success btn-sm' href=../paste.php?id=".$myid."> View </a>";
|
||||
$result[$loop]['delete'] ="<a class='btn btn-danger btn-sm' href=pastes.php?delete=".$myid."> Delete </a> <a class='btn btn-link btn-sm' href=ipbans.php?banip=".$arr['ip']."> Ban IP </a>";
|
||||
$loop = $loop +1;
|
||||
$result[$loop]['details'] = "<a class='btn btn-default btn-sm' href=pastes.php?details=" . $myid . "> Details </a>";
|
||||
$result[$loop]['view'] = "<a class='btn btn-success btn-sm' href=../paste.php?id=" . $myid . "> View </a>";
|
||||
$result[$loop]['delete'] = "<a class='btn btn-danger btn-sm' href=pastes.php?delete=" . $myid . "> Delete </a> <a class='btn btn-link btn-sm' href=ipbans.php?banip=" . $arr['ip'] . "> Ban IP </a>";
|
||||
$loop = $loop + 1;
|
||||
}
|
||||
// Return all
|
||||
return $result;
|
||||
|
@ -361,11 +344,10 @@ class SSP {
|
|||
*
|
||||
* @param string $msg Message to send to the client
|
||||
*/
|
||||
static function fatal ( $msg )
|
||||
{
|
||||
echo json_encode( array(
|
||||
static function fatal($msg) {
|
||||
echo json_encode(array(
|
||||
"error" => $msg
|
||||
) );
|
||||
));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -380,9 +362,8 @@ class SSP {
|
|||
* @return string Bound key to be used in the SQL where this parameter
|
||||
* would be used.
|
||||
*/
|
||||
static function bind ( &$a, $val, $type )
|
||||
{
|
||||
$key = ':binding_'.count( $a );
|
||||
static function bind(&$a, $val, $type) {
|
||||
$key = ':binding_' . count($a);
|
||||
|
||||
$a[] = array(
|
||||
'key' => $key,
|
||||
|
@ -402,11 +383,10 @@ class SSP {
|
|||
* @param string $prop Property to read
|
||||
* @return array Array of property values
|
||||
*/
|
||||
static function pluck ( $a, $prop )
|
||||
{
|
||||
static function pluck($a, $prop) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
|
||||
for ($i = 0, $len = count($a); $i < $len; $i++) {
|
||||
$out[] = $a[$i][$prop];
|
||||
}
|
||||
|
||||
|
|
|
@ -8,22 +8,20 @@ class SSP {
|
|||
* @param array $data Data from the SQL get
|
||||
* @return array Formatted data in a row based format
|
||||
*/
|
||||
static function data_output ( $columns, $data )
|
||||
{
|
||||
static function data_output($columns, $data) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
|
||||
$row = array();
|
||||
|
||||
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
|
||||
for ($j = 0, $jen = count($columns); $j < $jen; $j++) {
|
||||
$column = $columns[$j];
|
||||
|
||||
// Is there a formatter?
|
||||
if ( isset( $column['formatter'] ) ) {
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
}
|
||||
else {
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
if (isset($column['formatter'])) {
|
||||
$row[$column['dt']] = $column['formatter']($data[$i][$column['db']], $data[$i]);
|
||||
} else {
|
||||
$row[$column['dt']] = $data[$i][$columns[$j]['db']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,12 +41,11 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL limit clause
|
||||
*/
|
||||
static function limit ( $request, $columns )
|
||||
{
|
||||
static function limit($request, $columns) {
|
||||
$limit = '';
|
||||
|
||||
if ( isset($request['start']) && $request['length'] != -1 ) {
|
||||
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
|
||||
if (isset($request['start']) && $request['length'] != -1) {
|
||||
$limit = "LIMIT " . intval($request['start']) . ", " . intval($request['length']);
|
||||
}
|
||||
|
||||
return $limit;
|
||||
|
@ -64,32 +61,31 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL order by clause
|
||||
*/
|
||||
static function order ( $request, $columns )
|
||||
{
|
||||
static function order($request, $columns) {
|
||||
$order = '';
|
||||
|
||||
if ( isset($request['order']) && count($request['order']) ) {
|
||||
if (isset($request['order']) && count($request['order'])) {
|
||||
$orderBy = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
for ( $i=0, $ien=count($request['order']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['order']); $i < $ien; $i++) {
|
||||
// Convert the column index into the column data property
|
||||
$columnIdx = intval($request['order'][$i]['column']);
|
||||
$requestColumn = $request['columns'][$columnIdx];
|
||||
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['orderable'] == 'true' ) {
|
||||
if ($requestColumn['orderable'] == 'true') {
|
||||
$dir = $request['order'][$i]['dir'] === 'DESC' ?
|
||||
'ASC' :
|
||||
'DESC';
|
||||
|
||||
$orderBy[] = '`'.$column['db'].'` '.$dir;
|
||||
$orderBy[] = '`' . $column['db'] . '` ' . $dir;
|
||||
}
|
||||
}
|
||||
|
||||
$order = 'ORDER BY '.implode(', ', $orderBy);
|
||||
$order = 'ORDER BY ' . implode(', ', $orderBy);
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
@ -111,57 +107,56 @@ class SSP {
|
|||
* sql_exec() function
|
||||
* @return string SQL where clause
|
||||
*/
|
||||
static function filter ( $request, $columns, &$bindings )
|
||||
{
|
||||
static function filter($request, $columns, &$bindings) {
|
||||
$globalSearch = array();
|
||||
$columnSearch = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
if ( isset($request['search']) && $request['search']['value'] != '' ) {
|
||||
if (isset($request['search']) && $request['search']['value'] != '') {
|
||||
$str = $request['search']['value'];
|
||||
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$globalSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Individual column filtering
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
$str = $requestColumn['search']['value'];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' &&
|
||||
$str != '' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true' &&
|
||||
$str != '') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$columnSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the filters into a single string
|
||||
$where = '';
|
||||
|
||||
if ( count( $globalSearch ) ) {
|
||||
$where = '('.implode(' OR ', $globalSearch).')';
|
||||
if (count($globalSearch)) {
|
||||
$where = '(' . implode(' OR ', $globalSearch) . ')';
|
||||
}
|
||||
|
||||
if ( count( $columnSearch ) ) {
|
||||
if (count($columnSearch)) {
|
||||
$where = $where === '' ?
|
||||
implode(' AND ', $columnSearch) :
|
||||
$where .' AND '. implode(' AND ', $columnSearch);
|
||||
$where . ' AND ' . implode(' AND ', $columnSearch);
|
||||
}
|
||||
|
||||
if ( $where !== '' ) {
|
||||
$where = 'WHERE '.$where;
|
||||
if ($where !== '') {
|
||||
$where = 'WHERE ' . $where;
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
@ -182,19 +177,18 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return array Server-side processing response array
|
||||
*/
|
||||
static function simple ( $request, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
{
|
||||
static function simple($request, $sql_details, $table, $primaryKey, $columns, $columns2) {
|
||||
$bindings = array();
|
||||
$db = self::sql_connect( $sql_details );
|
||||
$db = self::sql_connect($sql_details);
|
||||
|
||||
// Build the SQL query string from the request
|
||||
$limit = self::limit( $request, $columns );
|
||||
$order = self::order( $request, $columns );
|
||||
$where = self::filter( $request, $columns, $bindings );
|
||||
$limit = self::limit($request, $columns);
|
||||
$order = self::order($request, $columns);
|
||||
$where = self::filter($request, $columns, $bindings);
|
||||
|
||||
// Main query to actually get the data
|
||||
$data = self::Ssql_exec($db, $bindings,
|
||||
"SELECT SQL_CALC_FOUND_ROWS `".implode("`, `", self::pluck($columns, 'db'))."`
|
||||
"SELECT SQL_CALC_FOUND_ROWS `" . implode("`, `", self::pluck($columns, 'db')) . "`
|
||||
FROM `$table`
|
||||
$where
|
||||
$order
|
||||
|
@ -202,12 +196,12 @@ class SSP {
|
|||
);
|
||||
|
||||
// Data set length after filtering
|
||||
$resFilterLength = self::sql_exec( $db,
|
||||
$resFilterLength = self::sql_exec($db,
|
||||
"SELECT FOUND_ROWS()"
|
||||
);
|
||||
$recordsFiltered = $resFilterLength[0][0];
|
||||
// Total data set length
|
||||
$resTotalLength = self::sql_exec( $db,
|
||||
$resTotalLength = self::sql_exec($db,
|
||||
"SELECT COUNT(`{$primaryKey}`)
|
||||
FROM `$table`"
|
||||
);
|
||||
|
@ -217,10 +211,10 @@ class SSP {
|
|||
* Output
|
||||
*/
|
||||
return array(
|
||||
"draw" => intval( $request['draw'] ),
|
||||
"recordsTotal" => intval( $recordsTotal ),
|
||||
"recordsFiltered" => intval( $recordsFiltered ),
|
||||
"data" => self::data_output( $columns2, $data )
|
||||
"draw" => intval($request['draw']),
|
||||
"recordsTotal" => intval($recordsTotal),
|
||||
"recordsFiltered" => intval($recordsFiltered),
|
||||
"data" => self::data_output($columns2, $data)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -236,20 +230,18 @@ class SSP {
|
|||
* * pass - user password
|
||||
* @return resource Database connection handle
|
||||
*/
|
||||
static function sql_connect ( $sql_details )
|
||||
{
|
||||
static function sql_connect($sql_details) {
|
||||
try {
|
||||
$db = @new PDO(
|
||||
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
|
||||
$sql_details['user'],
|
||||
$sql_details['pass'],
|
||||
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
);
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
} catch (PDOException $e) {
|
||||
self::fatal(
|
||||
"An error occurred while connecting to the database. ".
|
||||
"The error reported by the server was: ".$e->getMessage()
|
||||
"An error occurred while connecting to the database. " .
|
||||
"The error reported by the server was: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -267,84 +259,75 @@ class SSP {
|
|||
* @param string $sql SQL query to execute.
|
||||
* @return array Result from the query (all rows)
|
||||
*/
|
||||
static function sql_exec ( $db, $bindings, $sql=null )
|
||||
{
|
||||
static function sql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
//echo $sql;
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
}
|
||||
$result= $stmt->fetchAll();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function Ssql_exec ($db, $bindings, $sql=null )
|
||||
{
|
||||
static function Ssql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
$loop = '0';
|
||||
|
||||
while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[$loop]['id']= $arr['id'];
|
||||
$result[$loop]['m_report']= $arr['m_report'];
|
||||
$result[$loop]['p_report']= $arr['p_report'];
|
||||
$result[$loop]['id'] = $arr['id'];
|
||||
$result[$loop]['m_report'] = $arr['m_report'];
|
||||
$result[$loop]['p_report'] = $arr['p_report'];
|
||||
$vis = Trim($arr['rep_reason']);
|
||||
if ($vis == '0')
|
||||
{
|
||||
if ($vis == '0') {
|
||||
$result[$loop]['rep_reason'] = "Public";
|
||||
}
|
||||
elseif ($vis == '1')
|
||||
{
|
||||
} elseif ($vis == '1') {
|
||||
$result[$loop]['rep_reason'] = "Unlisted";
|
||||
}
|
||||
elseif ($vis == '2')
|
||||
{
|
||||
} elseif ($vis == '2') {
|
||||
$result[$loop]['rep_reason'] = "Private";
|
||||
}
|
||||
$rid = $arr['p_report'];
|
||||
$result[$loop]['details'] ="<a class='btn btn-default btn-sm' href=pastes.php?details=".$rid."> Details </a>";
|
||||
$result[$loop]['view'] = "<a class='btn btn-success btn-sm' href=../paste.php?id=".$rid."> View </a>";
|
||||
$result[$loop]['delete'] ="<a class='btn btn-danger btn-sm' href=pastes.php?delete=".$rid."> Remove </a>";
|
||||
$result[$loop]['delete'] ="<a class='btn btn-danger btn-sm' href=pastes.php?delete=".$rid."> Delete </a>";
|
||||
$loop = $loop +1;
|
||||
$result[$loop]['details'] = "<a class='btn btn-default btn-sm' href=pastes.php?details=" . $rid . "> Details </a>";
|
||||
$result[$loop]['view'] = "<a class='btn btn-success btn-sm' href=../paste.php?id=" . $rid . "> View </a>";
|
||||
$result[$loop]['delete'] = "<a class='btn btn-danger btn-sm' href=pastes.php?delete=" . $rid . "> Remove </a>";
|
||||
$result[$loop]['delete'] = "<a class='btn btn-danger btn-sm' href=pastes.php?delete=" . $rid . "> Delete </a>";
|
||||
$loop = $loop + 1;
|
||||
}
|
||||
// Return all
|
||||
return $result;
|
||||
|
@ -362,11 +345,10 @@ class SSP {
|
|||
*
|
||||
* @param string $msg Message to send to the client
|
||||
*/
|
||||
static function fatal ( $msg )
|
||||
{
|
||||
echo json_encode( array(
|
||||
static function fatal($msg) {
|
||||
echo json_encode(array(
|
||||
"error" => $msg
|
||||
) );
|
||||
));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -381,9 +363,8 @@ class SSP {
|
|||
* @return string Bound key to be used in the SQL where this parameter
|
||||
* would be used.
|
||||
*/
|
||||
static function bind ( &$a, $val, $type )
|
||||
{
|
||||
$key = ':binding_'.count( $a );
|
||||
static function bind(&$a, $val, $type) {
|
||||
$key = ':binding_' . count($a);
|
||||
|
||||
$a[] = array(
|
||||
'key' => $key,
|
||||
|
@ -403,11 +384,10 @@ class SSP {
|
|||
* @param string $prop Property to read
|
||||
* @return array Array of property values
|
||||
*/
|
||||
static function pluck ( $a, $prop )
|
||||
{
|
||||
static function pluck($a, $prop) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
|
||||
for ($i = 0, $len = count($a); $i < $len; $i++) {
|
||||
$out[] = $a[$i][$prop];
|
||||
}
|
||||
|
||||
|
|
|
@ -8,22 +8,20 @@ class SSP {
|
|||
* @param array $data Data from the SQL get
|
||||
* @return array Formatted data in a row based format
|
||||
*/
|
||||
static function data_output ( $columns, $data )
|
||||
{
|
||||
static function data_output($columns, $data) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
|
||||
$row = array();
|
||||
|
||||
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
|
||||
for ($j = 0, $jen = count($columns); $j < $jen; $j++) {
|
||||
$column = $columns[$j];
|
||||
|
||||
// Is there a formatter?
|
||||
if ( isset( $column['formatter'] ) ) {
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
}
|
||||
else {
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
if (isset($column['formatter'])) {
|
||||
$row[$column['dt']] = $column['formatter']($data[$i][$column['db']], $data[$i]);
|
||||
} else {
|
||||
$row[$column['dt']] = $data[$i][$columns[$j]['db']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,12 +41,11 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL limit clause
|
||||
*/
|
||||
static function limit ( $request, $columns )
|
||||
{
|
||||
static function limit($request, $columns) {
|
||||
$limit = '';
|
||||
|
||||
if ( isset($request['start']) && $request['length'] != -1 ) {
|
||||
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
|
||||
if (isset($request['start']) && $request['length'] != -1) {
|
||||
$limit = "LIMIT " . intval($request['start']) . ", " . intval($request['length']);
|
||||
}
|
||||
|
||||
return $limit;
|
||||
|
@ -64,32 +61,31 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL order by clause
|
||||
*/
|
||||
static function order ( $request, $columns )
|
||||
{
|
||||
static function order($request, $columns) {
|
||||
$order = '';
|
||||
|
||||
if ( isset($request['order']) && count($request['order']) ) {
|
||||
if (isset($request['order']) && count($request['order'])) {
|
||||
$orderBy = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
for ( $i=0, $ien=count($request['order']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['order']); $i < $ien; $i++) {
|
||||
// Convert the column index into the column data property
|
||||
$columnIdx = intval($request['order'][$i]['column']);
|
||||
$requestColumn = $request['columns'][$columnIdx];
|
||||
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['orderable'] == 'true' ) {
|
||||
if ($requestColumn['orderable'] == 'true') {
|
||||
$dir = $request['order'][$i]['dir'] === 'asc' ?
|
||||
'ASC' :
|
||||
'DESC';
|
||||
|
||||
$orderBy[] = '`'.$column['db'].'` '.$dir;
|
||||
$orderBy[] = '`' . $column['db'] . '` ' . $dir;
|
||||
}
|
||||
}
|
||||
|
||||
$order = 'ORDER BY '.implode(', ', $orderBy);
|
||||
$order = 'ORDER BY ' . implode(', ', $orderBy);
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
@ -111,57 +107,56 @@ class SSP {
|
|||
* sql_exec() function
|
||||
* @return string SQL where clause
|
||||
*/
|
||||
static function filter ( $request, $columns, &$bindings )
|
||||
{
|
||||
static function filter($request, $columns, &$bindings) {
|
||||
$globalSearch = array();
|
||||
$columnSearch = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
if ( isset($request['search']) && $request['search']['value'] != '' ) {
|
||||
if (isset($request['search']) && $request['search']['value'] != '') {
|
||||
$str = $request['search']['value'];
|
||||
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$globalSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Individual column filtering
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
$str = $requestColumn['search']['value'];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' &&
|
||||
$str != '' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true' &&
|
||||
$str != '') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$columnSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the filters into a single string
|
||||
$where = '';
|
||||
|
||||
if ( count( $globalSearch ) ) {
|
||||
$where = '('.implode(' OR ', $globalSearch).')';
|
||||
if (count($globalSearch)) {
|
||||
$where = '(' . implode(' OR ', $globalSearch) . ')';
|
||||
}
|
||||
|
||||
if ( count( $columnSearch ) ) {
|
||||
if (count($columnSearch)) {
|
||||
$where = $where === '' ?
|
||||
implode(' AND ', $columnSearch) :
|
||||
$where .' AND '. implode(' AND ', $columnSearch);
|
||||
$where . ' AND ' . implode(' AND ', $columnSearch);
|
||||
}
|
||||
|
||||
if ( $where !== '' ) {
|
||||
$where = 'WHERE '.$where;
|
||||
if ($where !== '') {
|
||||
$where = 'WHERE ' . $where;
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
@ -182,19 +177,18 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return array Server-side processing response array
|
||||
*/
|
||||
static function simple ( $request, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
{
|
||||
static function simple($request, $sql_details, $table, $primaryKey, $columns, $columns2) {
|
||||
$bindings = array();
|
||||
$db = self::sql_connect( $sql_details );
|
||||
$db = self::sql_connect($sql_details);
|
||||
|
||||
// Build the SQL query string from the request
|
||||
$limit = self::limit( $request, $columns );
|
||||
$order = self::order( $request, $columns );
|
||||
$where = self::filter( $request, $columns, $bindings );
|
||||
$limit = self::limit($request, $columns);
|
||||
$order = self::order($request, $columns);
|
||||
$where = self::filter($request, $columns, $bindings);
|
||||
|
||||
// Main query to actually get the data
|
||||
$data = self::Ssql_exec($db, $bindings,
|
||||
"SELECT SQL_CALC_FOUND_ROWS `".implode("`, `", self::pluck($columns, 'db'))."`
|
||||
"SELECT SQL_CALC_FOUND_ROWS `" . implode("`, `", self::pluck($columns, 'db')) . "`
|
||||
FROM `$table`
|
||||
$where
|
||||
$order
|
||||
|
@ -202,12 +196,12 @@ class SSP {
|
|||
);
|
||||
|
||||
// Data set length after filtering
|
||||
$resFilterLength = self::sql_exec( $db,
|
||||
$resFilterLength = self::sql_exec($db,
|
||||
"SELECT FOUND_ROWS()"
|
||||
);
|
||||
$recordsFiltered = $resFilterLength[0][0];
|
||||
// Total data set length
|
||||
$resTotalLength = self::sql_exec( $db,
|
||||
$resTotalLength = self::sql_exec($db,
|
||||
"SELECT COUNT(`{$primaryKey}`)
|
||||
FROM `$table`"
|
||||
);
|
||||
|
@ -217,10 +211,10 @@ class SSP {
|
|||
* Output
|
||||
*/
|
||||
return array(
|
||||
"draw" => intval( $request['draw'] ),
|
||||
"recordsTotal" => intval( $recordsTotal ),
|
||||
"recordsFiltered" => intval( $recordsFiltered ),
|
||||
"data" => self::data_output( $columns2, $data )
|
||||
"draw" => intval($request['draw']),
|
||||
"recordsTotal" => intval($recordsTotal),
|
||||
"recordsFiltered" => intval($recordsFiltered),
|
||||
"data" => self::data_output($columns2, $data)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -236,20 +230,18 @@ class SSP {
|
|||
* * pass - user password
|
||||
* @return resource Database connection handle
|
||||
*/
|
||||
static function sql_connect ( $sql_details )
|
||||
{
|
||||
static function sql_connect($sql_details) {
|
||||
try {
|
||||
$db = @new PDO(
|
||||
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
|
||||
$sql_details['user'],
|
||||
$sql_details['pass'],
|
||||
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
);
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
} catch (PDOException $e) {
|
||||
self::fatal(
|
||||
"An error occurred while connecting to the database. ".
|
||||
"The error reported by the server was: ".$e->getMessage()
|
||||
"An error occurred while connecting to the database. " .
|
||||
"The error reported by the server was: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -267,85 +259,76 @@ class SSP {
|
|||
* @param string $sql SQL query to execute.
|
||||
* @return array Result from the query (all rows)
|
||||
*/
|
||||
static function sql_exec ( $db, $bindings, $sql=null )
|
||||
{
|
||||
static function sql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
//echo $sql;
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
}
|
||||
$result= $stmt->fetchAll();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function Ssql_exec ($db, $bindings, $sql=null )
|
||||
{
|
||||
static function Ssql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
$loop = '0';
|
||||
|
||||
while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[$loop]['id']= $arr['id'];
|
||||
$result[$loop]['username']= $arr['username'];
|
||||
$result[$loop]['platform']= $arr['platform'];
|
||||
$result[$loop]['date']= $arr['date'];
|
||||
$result[$loop]['email_id']= $arr['email_id'];
|
||||
$result[$loop]['id'] = $arr['id'];
|
||||
$result[$loop]['username'] = $arr['username'];
|
||||
$result[$loop]['platform'] = $arr['platform'];
|
||||
$result[$loop]['date'] = $arr['date'];
|
||||
$result[$loop]['email_id'] = $arr['email_id'];
|
||||
$ver = $arr['verified'];
|
||||
|
||||
$myid = $arr['id'];
|
||||
if ($ver == '0')
|
||||
{
|
||||
$result[$loop]['ban'] ="<span class='bg-red'>User unverified</span>";
|
||||
if ($ver == '0') {
|
||||
$result[$loop]['ban'] = "<span class='bg-red'>User unverified</span>";
|
||||
} elseif ($ver == '1') {
|
||||
$result[$loop]['ban'] = "<a class='btn btn-danger btn-sm' href=users.php?ban=" . $myid . "> Ban </a>";
|
||||
} elseif ($ver == '2') {
|
||||
$result[$loop]['ban'] = "<a class='btn btn-success btn-sm' href=users.php?unban=" . $myid . "> Unban </a>";
|
||||
}
|
||||
elseif ($ver == '1')
|
||||
{
|
||||
$result[$loop]['ban'] ="<a class='btn btn-danger btn-sm' href=users.php?ban=".$myid."> Ban </a>";
|
||||
}
|
||||
elseif ($ver == '2')
|
||||
{
|
||||
$result[$loop]['ban'] ="<a class='btn btn-success btn-sm' href=users.php?unban=".$myid."> Unban </a>";
|
||||
}
|
||||
$result[$loop]['view'] = "<a class='btn btn-default btn-sm' href=users.php?details=".$myid."> Details </a>";
|
||||
$result[$loop]['delete'] ="<a class='btn btn-danger btn-sm' href=users.php?delete=".$myid."> Delete </a>";
|
||||
$loop = $loop +1;
|
||||
$result[$loop]['view'] = "<a class='btn btn-default btn-sm' href=users.php?details=" . $myid . "> Details </a>";
|
||||
$result[$loop]['delete'] = "<a class='btn btn-danger btn-sm' href=users.php?delete=" . $myid . "> Delete </a>";
|
||||
$loop = $loop + 1;
|
||||
}
|
||||
// Return all
|
||||
return $result;
|
||||
|
@ -363,11 +346,10 @@ class SSP {
|
|||
*
|
||||
* @param string $msg Message to send to the client
|
||||
*/
|
||||
static function fatal ( $msg )
|
||||
{
|
||||
echo json_encode( array(
|
||||
static function fatal($msg) {
|
||||
echo json_encode(array(
|
||||
"error" => $msg
|
||||
) );
|
||||
));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -382,9 +364,8 @@ class SSP {
|
|||
* @return string Bound key to be used in the SQL where this parameter
|
||||
* would be used.
|
||||
*/
|
||||
static function bind ( &$a, $val, $type )
|
||||
{
|
||||
$key = ':binding_'.count( $a );
|
||||
static function bind(&$a, $val, $type) {
|
||||
$key = ':binding_' . count($a);
|
||||
|
||||
$a[] = array(
|
||||
'key' => $key,
|
||||
|
@ -404,18 +385,18 @@ class SSP {
|
|||
* @param string $prop Property to read
|
||||
* @return array Array of property values
|
||||
*/
|
||||
static function pluck ( $a, $prop )
|
||||
{
|
||||
static function pluck($a, $prop) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
|
||||
for ($i = 0, $len = count($a); $i < $len; $i++) {
|
||||
$out[] = $a[$i][$prop];
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
|
||||
|
||||
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
|
||||
header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z");
|
||||
die();
|
||||
}
|
||||
|
|
|
@ -71,16 +71,16 @@ if ($last_ip == $ip) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Statistics</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -90,7 +90,8 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -98,14 +99,14 @@ if ($last_ip == $ip) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<!-- Start Statistics -->
|
||||
|
@ -330,17 +331,18 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -71,16 +71,16 @@ if ($last_ip == $ip) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Tasks</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -90,7 +90,8 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -98,10 +99,10 @@ if ($last_ip == $ip) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<!-- Start Menu -->
|
||||
|
@ -237,11 +238,11 @@ if ($last_ip == $ip) {
|
|||
<div class="panel-title">Maintenance tasks</a></div>
|
||||
<?php if (isset($msg)) echo $msg; ?>
|
||||
<a href="?expired" class="btn btn-default btn-block">Delete all expired pastes</a>
|
||||
<br />
|
||||
<br/>
|
||||
<a href="?admin_history" class="btn btn-info btn-block">Clear admin history</a>
|
||||
<br />
|
||||
<br/>
|
||||
<a href="?not_verfied" class="btn btn-warning btn-block">Delete unverified accounts</a>
|
||||
<br />
|
||||
<br/>
|
||||
<a href="?all_pastes" class="btn btn-danger btn-block">Delete all pastes</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -254,17 +255,18 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -71,17 +71,17 @@ if ($last_ip == $ip) {
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Paste - Users</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/datatables.min.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<link href="css/paste.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/datatables.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="top" class="clearfix">
|
||||
<div id="top" class="clearfix">
|
||||
<!-- Start App Logo -->
|
||||
<div class="applogo">
|
||||
<a href="../" class="logo">Paste</a>
|
||||
|
@ -91,7 +91,8 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Top Right -->
|
||||
<ul class="top-right">
|
||||
<li class="dropdown link">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span class="caret"></span></a>
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle profilebox"><b>Admin</b><span
|
||||
class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-list dropdown-menu-right">
|
||||
<li><a href="admin.php">Settings</a></li>
|
||||
<li><a href="?logout">Logout</a></li>
|
||||
|
@ -99,13 +100,13 @@ if ($last_ip == $ip) {
|
|||
</li>
|
||||
</ul>
|
||||
<!-- End Top Right -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
</div>
|
||||
<!-- END TOP -->
|
||||
|
||||
<div class="content">
|
||||
<div class="content">
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-widget">
|
||||
<?php include 'menu.php';?>
|
||||
<?php include 'menu.php'; ?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<?php
|
||||
|
@ -193,42 +194,42 @@ if ($last_ip == $ip) {
|
|||
<table class="table table-striped table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> Username </td>
|
||||
<td> Username</td>
|
||||
<td> <?php echo $user_username; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Email ID </td>
|
||||
<td> <?php echo $user_email_id;?> </td>
|
||||
<td> Email ID</td>
|
||||
<td> <?php echo $user_email_id; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Platform </td>
|
||||
<td> Platform</td>
|
||||
<td> <?php echo $user_platform; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> OAUTH ID </td>
|
||||
<td> OAUTH ID</td>
|
||||
<td> <?php echo $user_oauth_uid; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Status </td>
|
||||
<td> Status</td>
|
||||
<td> <?php echo $user_verified; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> User IP </td>
|
||||
<td> User IP</td>
|
||||
<td> <?php echo $user_ip; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Date Registered </td>
|
||||
<td> Date Registered</td>
|
||||
<td> <?php echo $user_date; ?> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> Full Name </td>
|
||||
<td> Full Name</td>
|
||||
<td> <?php echo $user_full_name; ?> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -243,7 +244,8 @@ if ($last_ip == $ip) {
|
|||
|
||||
<?php if (isset($msg)) echo $msg; ?>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="usersTable">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
|
||||
id="usersTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -272,28 +274,29 @@ if ($last_ip == $ip) {
|
|||
<!-- Start Footer -->
|
||||
<div class="row footer">
|
||||
<div class="col-md-6 text-left">
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
<a href="https://github.com/jordansamuel/PASTE" target="_blank">Updates</a> — <a
|
||||
href="https://github.com/jordansamuel/PASTE/issues" target="_blank">Bugs</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
Powered by <a href="https://phpaste.sourceforge.io" target="_blank">Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Footer -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
</div>
|
||||
<!-- End content -->
|
||||
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" language="javascript" class="init">
|
||||
$(document).ready(function() {
|
||||
$('#usersTable').dataTable( {
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" language="javascript" class="init">
|
||||
$(document).ready(function () {
|
||||
$('#usersTable').dataTable({
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"ajax": "ajax_users.php",
|
||||
"order": [[0, "desc"]]
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -11,17 +11,17 @@ $primaryKey = 'id';
|
|||
// parameter represents the DataTables column identifier. In this case simple
|
||||
// indexes
|
||||
$columns = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'title', 'dt' => 1 ),
|
||||
array( 'db' => 'member', 'dt' => 2 ),
|
||||
array( 'db' => 'tagsys', 'dt' => 3 ),
|
||||
array( 'db' => 'visible', 'dt' => 4 ),
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'title', 'dt' => 1),
|
||||
array('db' => 'member', 'dt' => 2),
|
||||
array('db' => 'tagsys', 'dt' => 3),
|
||||
array('db' => 'visible', 'dt' => 4),
|
||||
);
|
||||
|
||||
$columns2 = array(
|
||||
array( 'db' => 'title', 'dt' => 0 ),
|
||||
array( 'db' => 'member', 'dt' => 1 ),
|
||||
array( 'db' => 'tagsys', 'dt' => 2 ),
|
||||
array('db' => 'title', 'dt' => 0),
|
||||
array('db' => 'member', 'dt' => 1),
|
||||
array('db' => 'tagsys', 'dt' => 2),
|
||||
);
|
||||
|
||||
|
||||
|
@ -39,8 +39,8 @@ $sql_details = array(
|
|||
* server-side, there is no need to edit below this line.
|
||||
*/
|
||||
|
||||
require( 'ssp.pastes.php' );
|
||||
require('ssp.pastes.php');
|
||||
echo json_encode(
|
||||
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2)
|
||||
);
|
||||
?>
|
|
@ -13,22 +13,22 @@ $primaryKey = 'id';
|
|||
// parameter represents the DataTables column identifier. In this case simple
|
||||
// indexes
|
||||
$columns = array(
|
||||
array( 'db' => 'id', 'dt' => 0 ),
|
||||
array( 'db' => 'title', 'dt' => 1 ),
|
||||
array( 'db' => 'member', 'dt' => 2 ),
|
||||
array( 'db' => 'tagsys', 'dt' => 3 ),
|
||||
array( 'db' => 'visible', 'dt' => 4 ),
|
||||
array( 'db' => 'date', 'dt' => 5 ),
|
||||
array( 'db' => 'now_time', 'dt' => 6 ),
|
||||
array('db' => 'id', 'dt' => 0),
|
||||
array('db' => 'title', 'dt' => 1),
|
||||
array('db' => 'member', 'dt' => 2),
|
||||
array('db' => 'tagsys', 'dt' => 3),
|
||||
array('db' => 'visible', 'dt' => 4),
|
||||
array('db' => 'date', 'dt' => 5),
|
||||
array('db' => 'now_time', 'dt' => 6),
|
||||
);
|
||||
|
||||
$columns2 = array(
|
||||
array( 'db' => 'id', 'dt' => "ID" ),
|
||||
array( 'db' => 'title', 'dt' => "Title" ),
|
||||
array( 'db' => 'member', 'dt' => "Author" ),
|
||||
array( 'db' => 'tagsys', 'dt' => "Tags" ),
|
||||
array( 'db' => 'date', 'dt' => "Post Date" ),
|
||||
array( 'db' => 'now_time', 'dt' => "Modified Date" ),
|
||||
array('db' => 'id', 'dt' => "ID"),
|
||||
array('db' => 'title', 'dt' => "Title"),
|
||||
array('db' => 'member', 'dt' => "Author"),
|
||||
array('db' => 'tagsys', 'dt' => "Tags"),
|
||||
array('db' => 'date', 'dt' => "Post Date"),
|
||||
array('db' => 'now_time', 'dt' => "Modified Date"),
|
||||
);
|
||||
|
||||
|
||||
|
@ -46,9 +46,9 @@ $sql_details = array(
|
|||
* server-side, there is no need to edit below this line.
|
||||
*/
|
||||
|
||||
require( 'public.pastes.php' );
|
||||
require('public.pastes.php');
|
||||
|
||||
echo json_encode(
|
||||
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $columns2), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
mysqli_close('$con');
|
||||
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
mysqli_close('$con');
|
||||
?>
|
|
@ -8,22 +8,20 @@ class SSP {
|
|||
* @param array $data Data from the SQL get
|
||||
* @return array Formatted data in a row based format
|
||||
*/
|
||||
static function data_output ( $columns, $data )
|
||||
{
|
||||
static function data_output($columns, $data) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
|
||||
$row = array();
|
||||
|
||||
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
|
||||
for ($j = 0, $jen = count($columns); $j < $jen; $j++) {
|
||||
$column = $columns[$j];
|
||||
|
||||
// Is there a formatter?
|
||||
if ( isset( $column['formatter'] ) ) {
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
}
|
||||
else {
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
if (isset($column['formatter'])) {
|
||||
$row[$column['dt']] = $column['formatter']($data[$i][$column['db']], $data[$i]);
|
||||
} else {
|
||||
$row[$column['dt']] = $data[$i][$columns[$j]['db']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,12 +41,11 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL limit clause
|
||||
*/
|
||||
static function limit ( $request, $columns )
|
||||
{
|
||||
static function limit($request, $columns) {
|
||||
$limit = '';
|
||||
|
||||
if ( isset($request['start']) && $request['length'] != -1 ) {
|
||||
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
|
||||
if (isset($request['start']) && $request['length'] != -1) {
|
||||
$limit = "LIMIT " . intval($request['start']) . ", " . intval($request['length']);
|
||||
}
|
||||
|
||||
return $limit;
|
||||
|
@ -64,32 +61,31 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL order by clause
|
||||
*/
|
||||
static function order ( $request, $columns )
|
||||
{
|
||||
static function order($request, $columns) {
|
||||
$order = '';
|
||||
|
||||
if ( isset($request['order']) && count($request['order']) ) {
|
||||
if (isset($request['order']) && count($request['order'])) {
|
||||
$orderBy = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
for ( $i=0, $ien=count($request['order']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['order']); $i < $ien; $i++) {
|
||||
// Convert the column index into the column data property
|
||||
$columnIdx = intval($request['order'][$i]['column']);
|
||||
$requestColumn = $request['columns'][$columnIdx];
|
||||
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['orderable'] == 'true' ) {
|
||||
if ($requestColumn['orderable'] == 'true') {
|
||||
$dir = $request['order'][$i]['dir'] === 'DESC' ?
|
||||
'ASC' :
|
||||
'DESC';
|
||||
|
||||
$orderBy[] = '`'.$column['db'].'` '.$dir;
|
||||
$orderBy[] = '`' . $column['db'] . '` ' . $dir;
|
||||
}
|
||||
}
|
||||
|
||||
$order = 'ORDER BY '.implode(', ', $orderBy);
|
||||
$order = 'ORDER BY ' . implode(', ', $orderBy);
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
@ -111,57 +107,56 @@ class SSP {
|
|||
* sql_exec() function
|
||||
* @return string SQL where clause
|
||||
*/
|
||||
static function filter ( $request, $columns, &$bindings )
|
||||
{
|
||||
static function filter($request, $columns, &$bindings) {
|
||||
$globalSearch = array();
|
||||
$columnSearch = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
if ( isset($request['search']) && $request['search']['value'] != '' ) {
|
||||
if (isset($request['search']) && $request['search']['value'] != '') {
|
||||
$str = $request['search']['value'];
|
||||
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$globalSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Individual column filtering
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
$str = $requestColumn['search']['value'];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' &&
|
||||
$str != '' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true' &&
|
||||
$str != '') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$columnSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the filters into a single string
|
||||
$where = '';
|
||||
|
||||
if ( count( $globalSearch ) ) {
|
||||
$where = '('.implode(' OR ', $globalSearch).')';
|
||||
if (count($globalSearch)) {
|
||||
$where = '(' . implode(' OR ', $globalSearch) . ')';
|
||||
}
|
||||
|
||||
if ( count( $columnSearch ) ) {
|
||||
if (count($columnSearch)) {
|
||||
$where = $where === '' ?
|
||||
implode(' AND ', $columnSearch) :
|
||||
$where .' AND '. implode(' AND ', $columnSearch);
|
||||
$where . ' AND ' . implode(' AND ', $columnSearch);
|
||||
}
|
||||
|
||||
if ( $where !== '' ) {
|
||||
$where = 'WHERE '.$where;
|
||||
if ($where !== '') {
|
||||
$where = 'WHERE ' . $where;
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
@ -182,31 +177,30 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return array Server-side processing response array
|
||||
*/
|
||||
static function simple ( $request, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
{
|
||||
static function simple($request, $sql_details, $table, $primaryKey, $columns, $columns2) {
|
||||
$bindings = array();
|
||||
$db = self::sql_connect( $sql_details );
|
||||
$db = self::sql_connect($sql_details);
|
||||
|
||||
// Build the SQL query string from the request
|
||||
$limit = self::limit( $request, $columns );
|
||||
$order = self::order( $request, $columns );
|
||||
$where = self::filter( $request, $columns, $bindings );
|
||||
$limit = self::limit($request, $columns);
|
||||
$order = self::order($request, $columns);
|
||||
$where = self::filter($request, $columns, $bindings);
|
||||
|
||||
// Main query to actually get the data
|
||||
$data = self::Ssql_exec($db, $bindings,
|
||||
"SELECT SQL_CALC_FOUND_ROWS `".implode("`, `", self::pluck($columns, 'db'))."`
|
||||
"SELECT SQL_CALC_FOUND_ROWS `" . implode("`, `", self::pluck($columns, 'db')) . "`
|
||||
FROM `$table` WHERE visible='0' AND tagsys IS NOT NULL AND NOT title LIKE ''
|
||||
$order
|
||||
$limit"
|
||||
);
|
||||
|
||||
// Data set length after filtering
|
||||
$resFilterLength = self::sql_exec( $db,
|
||||
$resFilterLength = self::sql_exec($db,
|
||||
"SELECT FOUND_ROWS()"
|
||||
);
|
||||
$recordsFiltered = $resFilterLength[0][0];
|
||||
// Total data set length
|
||||
$resTotalLength = self::sql_exec( $db,
|
||||
$resTotalLength = self::sql_exec($db,
|
||||
"SELECT COUNT(`{$primaryKey}`)
|
||||
FROM `$table`"
|
||||
);
|
||||
|
@ -216,10 +210,10 @@ class SSP {
|
|||
* Output
|
||||
*/
|
||||
return array(
|
||||
"draw" => intval( $request['draw'] ),
|
||||
"recordsTotal" => intval( $recordsTotal ),
|
||||
"recordsFiltered" => intval( $recordsFiltered ),
|
||||
"data" => self::data_output( $columns2, $data )
|
||||
"draw" => intval($request['draw']),
|
||||
"recordsTotal" => intval($recordsTotal),
|
||||
"recordsFiltered" => intval($recordsFiltered),
|
||||
"data" => self::data_output($columns2, $data)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -235,20 +229,18 @@ class SSP {
|
|||
* * pass - user password
|
||||
* @return resource Database connection handle
|
||||
*/
|
||||
static function sql_connect ( $sql_details )
|
||||
{
|
||||
static function sql_connect($sql_details) {
|
||||
try {
|
||||
$db = @new PDO(
|
||||
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
|
||||
$sql_details['user'],
|
||||
$sql_details['pass'],
|
||||
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
);
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
} catch (PDOException $e) {
|
||||
self::fatal(
|
||||
"An error occurred while connecting to the database. ".
|
||||
"The error reported by the server was: ".$e->getMessage()
|
||||
"An error occurred while connecting to the database. " .
|
||||
"The error reported by the server was: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -266,73 +258,69 @@ class SSP {
|
|||
* @param string $sql SQL query to execute.
|
||||
* @return array Result from the query (all rows)
|
||||
*/
|
||||
static function sql_exec ( $db, $bindings, $sql=null )
|
||||
{
|
||||
static function sql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
//echo $sql;
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
}
|
||||
$result= $stmt->fetchAll();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function Ssql_exec ($db, $bindings, $sql=null )
|
||||
{
|
||||
static function Ssql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
$loop = '0';
|
||||
|
||||
while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[$loop]['id']= $arr['id'];
|
||||
$result[$loop]['title']= html_entity_decode($arr['title']);
|
||||
$result[$loop]['member']= $arr['member'];
|
||||
$result[$loop]['tagsys']= $arr['tagsys'];
|
||||
$result[$loop]['id'] = $arr['id'];
|
||||
$result[$loop]['title'] = html_entity_decode($arr['title']);
|
||||
$result[$loop]['member'] = $arr['member'];
|
||||
$result[$loop]['tagsys'] = $arr['tagsys'];
|
||||
$date_time = strtotime($arr['date']);
|
||||
$result[$loop]['date']= date(DATE_ISO8601, $date_time);
|
||||
$result[$loop]['date'] = date(DATE_ISO8601, $date_time);
|
||||
$myupdate = $arr['now_time'];
|
||||
$result[$loop]['now_time']= date(DATE_ISO8601, $myupdate);
|
||||
$result[$loop]['now_time'] = date(DATE_ISO8601, $myupdate);
|
||||
|
||||
|
||||
$loop = $loop +1;
|
||||
$loop = $loop + 1;
|
||||
}
|
||||
|
||||
// Return all
|
||||
|
@ -351,11 +339,10 @@ class SSP {
|
|||
*
|
||||
* @param string $msg Message to send to the client
|
||||
*/
|
||||
static function fatal ( $msg )
|
||||
{
|
||||
echo json_encode( array(
|
||||
static function fatal($msg) {
|
||||
echo json_encode(array(
|
||||
"error" => $msg
|
||||
) );
|
||||
));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -370,9 +357,8 @@ class SSP {
|
|||
* @return string Bound key to be used in the SQL where this parameter
|
||||
* would be used.
|
||||
*/
|
||||
static function bind ( &$a, $val, $type )
|
||||
{
|
||||
$key = ':binding_'.count( $a );
|
||||
static function bind(&$a, $val, $type) {
|
||||
$key = ':binding_' . count($a);
|
||||
|
||||
$a[] = array(
|
||||
'key' => $key,
|
||||
|
@ -392,11 +378,10 @@ class SSP {
|
|||
* @param string $prop Property to read
|
||||
* @return array Array of property values
|
||||
*/
|
||||
static function pluck ( $a, $prop )
|
||||
{
|
||||
static function pluck($a, $prop) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
|
||||
for ($i = 0, $len = count($a); $i < $len; $i++) {
|
||||
$out[] = $a[$i][$prop];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,31 +4,28 @@
|
|||
?>
|
||||
<?php
|
||||
|
||||
function sandwitch($str){
|
||||
function sandwitch($str) {
|
||||
$output = "";
|
||||
$arr = explode(",", $str);
|
||||
foreach ($arr as $word){
|
||||
foreach ($arr as $word) {
|
||||
$word = ucfirst($word);
|
||||
if (stripos($word, 'nsfw') !== false) {
|
||||
$word = strtoupper($word);
|
||||
$tagcolor = "tag is-danger";
|
||||
}
|
||||
elseif (stripos($word, 'SAFE') !== false) {
|
||||
} elseif (stripos($word, 'SAFE') !== false) {
|
||||
$word = strtoupper($word);
|
||||
$tagcolor = "tag is-success";
|
||||
}
|
||||
elseif (strstr($word, '/')){
|
||||
} elseif (strstr($word, '/')) {
|
||||
$tagcolor = "tag is-primary";
|
||||
}else{
|
||||
} else {
|
||||
$tagcolor = "tag is-info";
|
||||
}
|
||||
$output .= '<a href="/archive?q='.trim($word).'"><span class="' . $tagcolor . '">'.trim($word).'</span>';
|
||||
$output .= '<a href="/archive?q=' . trim($word) . '"><span class="' . $tagcolor . '">' . trim($word) . '</span>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class SSP {
|
||||
/**
|
||||
* Create the data output array for the DataTables rows
|
||||
|
@ -37,22 +34,20 @@ class SSP {
|
|||
* @param array $data Data from the SQL get
|
||||
* @return array Formatted data in a row based format
|
||||
*/
|
||||
static function data_output ( $columns, $data )
|
||||
{
|
||||
static function data_output($columns, $data) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
|
||||
$row = array();
|
||||
|
||||
for ( $j=0, $jen=count($columns) ; $j<$jen ; $j++ ) {
|
||||
for ($j = 0, $jen = count($columns); $j < $jen; $j++) {
|
||||
$column = $columns[$j];
|
||||
|
||||
// Is there a formatter?
|
||||
if ( isset( $column['formatter'] ) ) {
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
}
|
||||
else {
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
if (isset($column['formatter'])) {
|
||||
$row[$column['dt']] = $column['formatter']($data[$i][$column['db']], $data[$i]);
|
||||
} else {
|
||||
$row[$column['dt']] = $data[$i][$columns[$j]['db']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,12 +67,11 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL limit clause
|
||||
*/
|
||||
static function limit ( $request, $columns )
|
||||
{
|
||||
static function limit($request, $columns) {
|
||||
$limit = '';
|
||||
|
||||
if ( isset($request['start']) && $request['length'] != -1 ) {
|
||||
$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
|
||||
if (isset($request['start']) && $request['length'] != -1) {
|
||||
$limit = "LIMIT " . intval($request['start']) . ", " . intval($request['length']);
|
||||
}
|
||||
|
||||
return $limit;
|
||||
|
@ -93,32 +87,31 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return string SQL order by clause
|
||||
*/
|
||||
static function order ( $request, $columns )
|
||||
{
|
||||
static function order($request, $columns) {
|
||||
$order = '';
|
||||
|
||||
if ( isset($request['order']) && count($request['order']) ) {
|
||||
if (isset($request['order']) && count($request['order'])) {
|
||||
$orderBy = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
for ( $i=0, $ien=count($request['order']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['order']); $i < $ien; $i++) {
|
||||
// Convert the column index into the column data property
|
||||
$columnIdx = intval($request['order'][$i]['column']);
|
||||
$requestColumn = $request['columns'][$columnIdx];
|
||||
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['orderable'] == 'true' ) {
|
||||
if ($requestColumn['orderable'] == 'true') {
|
||||
$dir = $request['order'][$i]['dir'] === 'DESC' ?
|
||||
'ASC' :
|
||||
'DESC';
|
||||
|
||||
$orderBy[] = '`'.$column['db'].'` '.$dir;
|
||||
$orderBy[] = '`' . $column['db'] . '` ' . $dir;
|
||||
}
|
||||
}
|
||||
|
||||
$order = 'ORDER BY '.implode(', ', $orderBy);
|
||||
$order = 'ORDER BY ' . implode(', ', $orderBy);
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
@ -140,57 +133,56 @@ class SSP {
|
|||
* sql_exec() function
|
||||
* @return string SQL where clause
|
||||
*/
|
||||
static function filter ( $request, $columns, &$bindings )
|
||||
{
|
||||
static function filter($request, $columns, &$bindings) {
|
||||
$globalSearch = array();
|
||||
$columnSearch = array();
|
||||
$dtColumns = self::pluck( $columns, 'dt' );
|
||||
$dtColumns = self::pluck($columns, 'dt');
|
||||
|
||||
if ( isset($request['search']) && $request['search']['value'] != '' ) {
|
||||
if (isset($request['search']) && $request['search']['value'] != '') {
|
||||
$str = $request['search']['value'];
|
||||
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$globalSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Individual column filtering
|
||||
for ( $i=0, $ien=count($request['columns']) ; $i<$ien ; $i++ ) {
|
||||
for ($i = 0, $ien = count($request['columns']); $i < $ien; $i++) {
|
||||
$requestColumn = $request['columns'][$i];
|
||||
$columnIdx = array_search( $requestColumn['data'], $dtColumns );
|
||||
$column = $columns[ $columnIdx ];
|
||||
$columnIdx = array_search($requestColumn['data'], $dtColumns);
|
||||
$column = $columns[$columnIdx];
|
||||
|
||||
$str = $requestColumn['search']['value'];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' &&
|
||||
$str != '' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if ($requestColumn['searchable'] == 'true' &&
|
||||
$str != '') {
|
||||
$binding = self::bind($bindings, '%' . $str . '%', PDO::PARAM_STR);
|
||||
$columnSearch[] = "`" . $column['db'] . "` LIKE " . $binding;
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the filters into a single string
|
||||
$where = '';
|
||||
|
||||
if ( count( $globalSearch ) ) {
|
||||
$where = '('.implode(' OR ', $globalSearch).')';
|
||||
if (count($globalSearch)) {
|
||||
$where = '(' . implode(' OR ', $globalSearch) . ')';
|
||||
}
|
||||
|
||||
if ( count( $columnSearch ) ) {
|
||||
if (count($columnSearch)) {
|
||||
$where = $where === '' ?
|
||||
implode(' AND ', $columnSearch) :
|
||||
$where .' AND '. implode(' AND ', $columnSearch);
|
||||
$where . ' AND ' . implode(' AND ', $columnSearch);
|
||||
}
|
||||
|
||||
if ( $where !== '' ) {
|
||||
$where = 'WHERE '.$where;
|
||||
if ($where !== '') {
|
||||
$where = 'WHERE ' . $where;
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
@ -211,31 +203,30 @@ class SSP {
|
|||
* @param array $columns Column information array
|
||||
* @return array Server-side processing response array
|
||||
*/
|
||||
static function simple ( $request, $sql_details, $table, $primaryKey, $columns, $columns2 )
|
||||
{
|
||||
static function simple($request, $sql_details, $table, $primaryKey, $columns, $columns2) {
|
||||
$bindings = array();
|
||||
$db = self::sql_connect( $sql_details );
|
||||
$db = self::sql_connect($sql_details);
|
||||
|
||||
// Build the SQL query string from the request
|
||||
$limit = self::limit( $request, $columns );
|
||||
$order = self::order( $request, $columns );
|
||||
$limit = self::limit($request, $columns);
|
||||
$order = self::order($request, $columns);
|
||||
//$where = self::filter( $request, $columns, $bindings );
|
||||
|
||||
// Main query to actually get the data
|
||||
$data = self::Ssql_exec($db, $bindings,
|
||||
"SELECT SQL_CALC_FOUND_ROWS `".implode("`, `", self::pluck($columns, 'db'))."`
|
||||
"SELECT SQL_CALC_FOUND_ROWS `" . implode("`, `", self::pluck($columns, 'db')) . "`
|
||||
FROM `$table` WHERE visible='0' AND tagsys IS NOT NULL AND NOT title LIKE ''
|
||||
$order
|
||||
$limit"
|
||||
);
|
||||
|
||||
// Data set length after filtering
|
||||
$resFilterLength = self::sql_exec( $db,
|
||||
$resFilterLength = self::sql_exec($db,
|
||||
"SELECT FOUND_ROWS()"
|
||||
);
|
||||
$recordsFiltered = $resFilterLength[0][0];
|
||||
// Total data set length
|
||||
$resTotalLength = self::sql_exec( $db,
|
||||
$resTotalLength = self::sql_exec($db,
|
||||
"SELECT COUNT(`{$primaryKey}`)
|
||||
FROM `$table`"
|
||||
);
|
||||
|
@ -245,10 +236,10 @@ class SSP {
|
|||
* Output
|
||||
*/
|
||||
return array(
|
||||
"draw" => isset($request['draw']) ? intval( $request['draw'] ) : 0,
|
||||
"recordsTotal" => intval( $recordsTotal ),
|
||||
"recordsFiltered" => intval( $recordsFiltered ),
|
||||
"data" => self::data_output( $columns2, $data )
|
||||
"draw" => isset($request['draw']) ? intval($request['draw']) : 0,
|
||||
"recordsTotal" => intval($recordsTotal),
|
||||
"recordsFiltered" => intval($recordsFiltered),
|
||||
"data" => self::data_output($columns2, $data)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -264,20 +255,18 @@ class SSP {
|
|||
* * pass - user password
|
||||
* @return PDO Database connection handle
|
||||
*/
|
||||
static function sql_connect ( $sql_details )
|
||||
{
|
||||
static function sql_connect($sql_details) {
|
||||
try {
|
||||
$db = @new PDO(
|
||||
"mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
|
||||
$sql_details['user'],
|
||||
$sql_details['pass'],
|
||||
array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
);
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
} catch (PDOException $e) {
|
||||
self::fatal(
|
||||
"An error occurred while connecting to the database. ".
|
||||
"The error reported by the server was: ".$e->getMessage()
|
||||
"An error occurred while connecting to the database. " .
|
||||
"The error reported by the server was: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -295,74 +284,70 @@ class SSP {
|
|||
* @param string $sql SQL query to execute.
|
||||
* @return array Result from the query (all rows)
|
||||
*/
|
||||
static function sql_exec ( $db, $bindings, $sql=null )
|
||||
{
|
||||
static function sql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
//echo $sql;
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
}
|
||||
$result= $stmt->fetchAll();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function Ssql_exec ($db, $bindings, $sql=null )
|
||||
{
|
||||
static function Ssql_exec($db, $bindings, $sql = null) {
|
||||
// Argument shifting
|
||||
if ( $sql === null ) {
|
||||
if ($sql === null) {
|
||||
$sql = $bindings;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare( $sql );
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
// Bind parameters
|
||||
if ( is_array( $bindings ) ) {
|
||||
for ( $i=0, $ien=count($bindings) ; $i<$ien ; $i++ ) {
|
||||
if (is_array($bindings)) {
|
||||
for ($i = 0, $ien = count($bindings); $i < $ien; $i++) {
|
||||
$binding = $bindings[$i];
|
||||
$stmt->bindValue( $binding['key'], $binding['val'], $binding['type'] );
|
||||
$stmt->bindValue($binding['key'], $binding['val'], $binding['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
try {
|
||||
$stmt->execute();
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
self::fatal( "An SQL error occurred: ".$e->getMessage() );
|
||||
} catch (PDOException $e) {
|
||||
self::fatal("An SQL error occurred: " . $e->getMessage());
|
||||
}
|
||||
$loop = '0';
|
||||
|
||||
|
||||
while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[$loop]['id']= $arr['id'];
|
||||
$result[$loop]['member']= $arr['member'];
|
||||
$result[$loop]['tagsys']= sandwitch( $arr['tagsys']);
|
||||
$result[$loop]['id'] = $arr['id'];
|
||||
$result[$loop]['member'] = $arr['member'];
|
||||
$result[$loop]['tagsys'] = sandwitch($arr['tagsys']);
|
||||
$date_time = strtotime(isset($arr['date']) ? $arr['date'] : '0');
|
||||
$result[$loop]['date']= date("d F Y", $date_time);
|
||||
$result[$loop]['date'] = date("d F Y", $date_time);
|
||||
$myid = $arr['id'];
|
||||
$mytitle = $arr['title'];
|
||||
$mymember = $arr['member'];
|
||||
$result[$loop]['title'] ="<a href=/" . $myid . ">" . $mytitle . "</a>";
|
||||
$result[$loop]['member'] ="<a href=/user/" . $mymember . ">" . $mymember . "</a>";
|
||||
$loop = $loop +1;
|
||||
$result[$loop]['title'] = "<a href=/" . $myid . ">" . $mytitle . "</a>";
|
||||
$result[$loop]['member'] = "<a href=/user/" . $mymember . ">" . $mymember . "</a>";
|
||||
$loop = $loop + 1;
|
||||
}
|
||||
|
||||
// Return all
|
||||
|
@ -381,11 +366,10 @@ class SSP {
|
|||
*
|
||||
* @param string $msg Message to send to the client
|
||||
*/
|
||||
static function fatal ( $msg )
|
||||
{
|
||||
echo json_encode( array(
|
||||
static function fatal($msg) {
|
||||
echo json_encode(array(
|
||||
"error" => $msg
|
||||
) );
|
||||
));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -400,9 +384,8 @@ class SSP {
|
|||
* @return string Bound key to be used in the SQL where this parameter
|
||||
* would be used.
|
||||
*/
|
||||
static function bind ( &$a, $val, $type )
|
||||
{
|
||||
$key = ':binding_'.count( $a );
|
||||
static function bind(&$a, $val, $type) {
|
||||
$key = ':binding_' . count($a);
|
||||
|
||||
$a[] = array(
|
||||
'key' => $key,
|
||||
|
@ -422,11 +405,10 @@ class SSP {
|
|||
* @param string $prop Property to read
|
||||
* @return array Array of property values
|
||||
*/
|
||||
static function pluck ( $a, $prop )
|
||||
{
|
||||
static function pluck($a, $prop) {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
|
||||
for ($i = 0, $len = count($a); $i < $len; $i++) {
|
||||
$out[] = $a[$i][$prop];
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ $db_opts = [
|
|||
|
||||
// Secret key for paste encryption
|
||||
$sec_key = "8ac67343e7980b16b31e8311d4377bbb";
|
||||
define('SECRET',md5($sec_key));
|
||||
define('SECRET', md5($sec_key));
|
||||
|
||||
// Set to 1 to enable Apache's mod_rewrite
|
||||
$mod_rewrite = "1";
|
||||
|
|
44
fav.php
44
fav.php
|
@ -44,7 +44,7 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
require_once("langs/$default_lang");
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($con, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
if (is_banned($con, $ip)) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
|
@ -56,34 +56,34 @@ if (isset($_GET['logout'])) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
//Fav paste
|
||||
if (isset($_POST['fid'])) {
|
||||
if (isset($_SESSION['token'])) {
|
||||
$f_user = htmlspecialchars($_SESSION['username']);
|
||||
$f_pasteid = Trim(htmlspecialchars($_POST['fid']));
|
||||
$f_pasteid = preg_replace( '/[^0-9]/', '', $f_pasteid );
|
||||
$f_pasteid = (int) filter_var($f_pasteid, FILTER_SANITIZE_NUMBER_INT);
|
||||
$f_time = gmmktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y"));
|
||||
if (isset($_SESSION['token'])) {
|
||||
$f_user = htmlspecialchars($_SESSION['username']);
|
||||
$f_pasteid = Trim(htmlspecialchars($_POST['fid']));
|
||||
$f_pasteid = preg_replace('/[^0-9]/', '', $f_pasteid);
|
||||
$f_pasteid = (int)filter_var($f_pasteid, FILTER_SANITIZE_NUMBER_INT);
|
||||
$f_time = gmmktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y"));
|
||||
//Sec
|
||||
$f_user = mysqli_real_escape_string($con, $f_user);
|
||||
$f_pasteid = mysqli_real_escape_string($con,$f_pasteid);
|
||||
$f_time = mysqli_real_escape_string($con,$f_time);
|
||||
$fav_check = "SELECT COUNT(fid) FROM pins WHERE f_paste='$f_pasteid' AND m_fav='$f_user'";
|
||||
$result = mysqli_query($con, $fav_check);
|
||||
$count = mysqli_fetch_row($result)[0];
|
||||
if($count == 0 ){
|
||||
$faved = "INSERT INTO pins (m_fav,f_paste,f_time) VALUES
|
||||
$f_user = mysqli_real_escape_string($con, $f_user);
|
||||
$f_pasteid = mysqli_real_escape_string($con, $f_pasteid);
|
||||
$f_time = mysqli_real_escape_string($con, $f_time);
|
||||
$fav_check = "SELECT COUNT(fid) FROM pins WHERE f_paste='$f_pasteid' AND m_fav='$f_user'";
|
||||
$result = mysqli_query($con, $fav_check);
|
||||
$count = mysqli_fetch_row($result)[0];
|
||||
if ($count == 0) {
|
||||
$faved = "INSERT INTO pins (m_fav,f_paste,f_time) VALUES
|
||||
('$f_user','$f_pasteid ','$f_time')";
|
||||
}else{
|
||||
$faved = "DELETE FROM pins WHERE f_paste='$f_pasteid' and m_fav='$f_user'";
|
||||
}
|
||||
if ($con->query($faved) === TRUE) {
|
||||
} else {
|
||||
$faved = "DELETE FROM pins WHERE f_paste='$f_pasteid' and m_fav='$f_user'";
|
||||
}
|
||||
if ($con->query($faved) === true) {
|
||||
$error = "Paste has been Favorited.";
|
||||
} else {
|
||||
} else {
|
||||
$error = "Fav failed";
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
// Theme
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
<?php
|
||||
$servername = "localhost";
|
||||
$username = "root";
|
||||
$password = "";
|
||||
$dbname = "lab";
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
$servername = "localhost";
|
||||
$username = "root";
|
||||
$password = "";
|
||||
$dbname = "lab";
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
}
|
||||
|
||||
$method = $_GET['method'];
|
||||
$user_id = $_GET['user_id'];
|
||||
$director_id = $_GET['director_id'];
|
||||
$method = $_GET['method'];
|
||||
$user_id = $_GET['user_id'];
|
||||
$director_id = $_GET['director_id'];
|
||||
|
||||
if ($method == "Like") {
|
||||
mysqli_query($conn,"INSERT INTO favs (user_id, director_id) VALUES ('$user_id', '$director_id')");
|
||||
}
|
||||
else {
|
||||
mysqli_query($conn,"DELETE FROM favs WHERE user_id = '$user_id' AND director_id = '$director_id'");
|
||||
}
|
||||
if ($method == "Like") {
|
||||
mysqli_query($conn, "INSERT INTO favs (user_id, director_id) VALUES ('$user_id', '$director_id')");
|
||||
} else {
|
||||
mysqli_query($conn, "DELETE FROM favs WHERE user_id = '$user_id' AND director_id = '$director_id'");
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<head>
|
||||
<script src="jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.button').on('click', function(e){
|
||||
jQuery(document).ready(function ($) {
|
||||
$('.button').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var user_id = $(this).attr('user_id'); // Get the parameter user_id from the button
|
||||
var director_id = $(this).attr('director_id'); // Get the parameter director_id from the button
|
||||
|
@ -20,50 +20,50 @@
|
|||
type: 'GET',
|
||||
data: {user_id: user_id, director_id: director_id, method: method},
|
||||
cache: false,
|
||||
success: function(data){
|
||||
success: function (data) {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
$servername = "localhost";
|
||||
$username = "P0nedbAcc0unt";
|
||||
$password = "1NWO6Tp17IFz9lbl";
|
||||
$dbname = "p0nepast3s";
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
<body>
|
||||
<?php
|
||||
$servername = "localhost";
|
||||
$username = "P0nedbAcc0unt";
|
||||
$password = "1NWO6Tp17IFz9lbl";
|
||||
$dbname = "p0nepast3s";
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFavorite($user_id, $director_id, $conn) {
|
||||
$result = $conn->query("SELECT * FROM favs WHERE user_id = '". $user_id."' AND director_id = '". $director_id."'");
|
||||
function checkFavorite($user_id, $director_id, $conn) {
|
||||
$result = $conn->query("SELECT * FROM favs WHERE user_id = '" . $user_id . "' AND director_id = '" . $director_id . "'");
|
||||
$numrows = $result->num_rows;
|
||||
if ($numrows == 0) {
|
||||
echo "<div class = 'button' method = 'Like' user_id = ".$user_id." director_id = ".$director_id."> <img id=".$director_id." src='favoff.png'> </div>";
|
||||
echo "<div class = 'button' method = 'Like' user_id = " . $user_id . " director_id = " . $director_id . "> <img id=" . $director_id . " src='favoff.png'> </div>";
|
||||
} else {
|
||||
echo "<div class = 'button' method = 'Unlike' user_id = " . $user_id . " director_id = " . $director_id . "> <img id=" . $director_id . " src='favon.jpg'> </div>";
|
||||
}
|
||||
else {
|
||||
echo "<div class = 'button' method = 'Unlike' user_id = ".$user_id." director_id = ".$director_id."> <img id=".$director_id." src='favon.jpg'> </div>";
|
||||
}
|
||||
}
|
||||
// Query to get the user_id
|
||||
$result = $conn->query("SELECT * FROM user WHERE name = 'Henrique'");
|
||||
$row = $result->fetch_assoc();
|
||||
$user_id = $row['id'];
|
||||
}
|
||||
|
||||
// Query to Get the Director ID
|
||||
$result = $conn->query("SELECT * FROM director WHERE name = 'Donal'");
|
||||
$row = $result->fetch_assoc();
|
||||
$director_id = $row['id'];
|
||||
// Query to get the user_id
|
||||
$result = $conn->query("SELECT * FROM user WHERE name = 'Henrique'");
|
||||
$row = $result->fetch_assoc();
|
||||
$user_id = $row['id'];
|
||||
|
||||
echo "<p>Director: ".$row['name']."</p> ";
|
||||
$fav_image = checkFavorite($user_id, $director_id, $conn);
|
||||
echo "Favorite? : ".$fav_image."";
|
||||
?>
|
||||
</body>
|
||||
// Query to Get the Director ID
|
||||
$result = $conn->query("SELECT * FROM director WHERE name = 'Donal'");
|
||||
$row = $result->fetch_assoc();
|
||||
$director_id = $row['id'];
|
||||
|
||||
echo "<p>Director: " . $row['name'] . "</p> ";
|
||||
$fav_image = checkFavorite($user_id, $director_id, $conn);
|
||||
echo "Favorite? : " . $fav_image . "";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -20,19 +20,16 @@ namespace ArdiSSoebrata\BeamParsedown;
|
|||
|
||||
use ParsedownExtra;
|
||||
|
||||
class BeamParsedown extends ParsedownExtra
|
||||
{
|
||||
class BeamParsedown extends ParsedownExtra {
|
||||
const version = '0.0.1';
|
||||
protected $isUrlRegex = "/(https?|ftp)\:\/\//i";
|
||||
protected $regexAttribute = '(?:([#.][\w-]+\s*)|([\w-]+=[\w-]+\s*))+';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if (version_compare(parent::version, '0.8.1') < 0)
|
||||
{
|
||||
if (version_compare(parent::version, '0.8.1') < 0) {
|
||||
throw new Exception('BeamParsedown requires a later version of ParsedownExtra');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@ -53,18 +50,15 @@ class BeamParsedown extends ParsedownExtra
|
|||
|
||||
protected $basePath = '';
|
||||
|
||||
public function setBasePath($url)
|
||||
{
|
||||
public function setBasePath($url) {
|
||||
$this->basePath = preg_replace('{/$}', '', $url) . '/';
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function inlineImage($excerpt)
|
||||
{
|
||||
protected function inlineImage($excerpt) {
|
||||
$image = parent::inlineImage($excerpt);
|
||||
|
||||
if ( ! isset($image))
|
||||
{
|
||||
if (!isset($image)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -79,11 +73,10 @@ class BeamParsedown extends ParsedownExtra
|
|||
|
||||
// Heading id & attributes.
|
||||
|
||||
protected function blockHeader($Line)
|
||||
{
|
||||
protected function blockHeader($Line) {
|
||||
$Block = parent::blockHeader($Line);
|
||||
|
||||
if (! isset($Block)) {
|
||||
if (!isset($Block)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -96,8 +89,7 @@ class BeamParsedown extends ParsedownExtra
|
|||
return $Block;
|
||||
}
|
||||
|
||||
protected function blockSetextHeader($Line, array $Block = null)
|
||||
{
|
||||
protected function blockSetextHeader($Line, array $Block = null) {
|
||||
$Block = parent::blockSetextHeader($Line, $Block);
|
||||
|
||||
if (isset($Block['element']) && !isset($Block['element']['attributes']['id'])) {
|
||||
|
@ -109,38 +101,29 @@ class BeamParsedown extends ParsedownExtra
|
|||
return $Block;
|
||||
}
|
||||
|
||||
protected function parseAttributeData($attributeString)
|
||||
{
|
||||
protected function parseAttributeData($attributeString) {
|
||||
$Data = array();
|
||||
|
||||
$attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY);
|
||||
$attributes = preg_split('/[ ]+/', $attributeString, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach ($attributes as $attribute)
|
||||
{
|
||||
if ($attribute[0] === '#')
|
||||
{
|
||||
foreach ($attributes as $attribute) {
|
||||
if ($attribute[0] === '#') {
|
||||
$Data['id'] = substr($attribute, 1);
|
||||
}
|
||||
elseif ($attribute[0] === '.')
|
||||
{
|
||||
$classes []= substr($attribute, 1);
|
||||
}
|
||||
elseif (preg_match('/([\w-]+)=([\w-]+)/', $attribute, $match))
|
||||
{
|
||||
} elseif ($attribute[0] === '.') {
|
||||
$classes [] = substr($attribute, 1);
|
||||
} elseif (preg_match('/([\w-]+)=([\w-]+)/', $attribute, $match)) {
|
||||
$Data[$match[1]] = $match[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($classes))
|
||||
{
|
||||
if (isset($classes)) {
|
||||
$Data['class'] = implode(' ', $classes);
|
||||
}
|
||||
|
||||
return $Data;
|
||||
}
|
||||
|
||||
public static function slugify($text)
|
||||
{
|
||||
public static function slugify($text) {
|
||||
// replace non letter or digits by -
|
||||
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
|
||||
|
||||
|
@ -168,10 +151,8 @@ class BeamParsedown extends ParsedownExtra
|
|||
|
||||
// Icon
|
||||
|
||||
protected function InlineIcon($excerpt)
|
||||
{
|
||||
if (preg_match('/\[icon:(.+?)\]/', $excerpt['text'], $matches))
|
||||
{
|
||||
protected function InlineIcon($excerpt) {
|
||||
if (preg_match('/\[icon:(.+?)\]/', $excerpt['text'], $matches)) {
|
||||
return array(
|
||||
// How many characters to advance the Parsedown's
|
||||
// cursor after being done processing this tag.
|
||||
|
@ -189,10 +170,8 @@ class BeamParsedown extends ParsedownExtra
|
|||
|
||||
// Audio
|
||||
|
||||
protected function InlineAudio($excerpt)
|
||||
{
|
||||
if (preg_match('/\[audio:(.+?)\]/', $excerpt['text'], $matches))
|
||||
{
|
||||
protected function InlineAudio($excerpt) {
|
||||
if (preg_match('/\[audio:(.+?)\]/', $excerpt['text'], $matches)) {
|
||||
// Add basePath if src is relative.
|
||||
$src = trim($matches[1]);
|
||||
if (!preg_match($this->isUrlRegex, $src, $urlmatch)) {
|
||||
|
@ -223,10 +202,8 @@ class BeamParsedown extends ParsedownExtra
|
|||
|
||||
// Youtube
|
||||
|
||||
protected function BlockYoutube($excerpt)
|
||||
{
|
||||
if (preg_match('/\[youtube:\s*https\:\/\/youtu\.be\/(.+?)\]/', $excerpt['text'], $matches))
|
||||
{
|
||||
protected function BlockYoutube($excerpt) {
|
||||
if (preg_match('/\[youtube:\s*https\:\/\/youtu\.be\/(.+?)\]/', $excerpt['text'], $matches)) {
|
||||
$video_id = trim($matches[1]);
|
||||
return array(
|
||||
// How many characters to advance the Parsedown's
|
||||
|
@ -270,11 +247,9 @@ class BeamParsedown extends ParsedownExtra
|
|||
)
|
||||
);
|
||||
|
||||
protected function BlockAlert($line, $block)
|
||||
{
|
||||
protected function BlockAlert($line, $block) {
|
||||
$types = implode('|', array_keys($this->alert_types));
|
||||
if (preg_match('/^:::(' . $types . ')/', $line['text'], $matches))
|
||||
{
|
||||
if (preg_match('/^:::(' . $types . ')/', $line['text'], $matches)) {
|
||||
$type = trim($matches[1]);
|
||||
return array(
|
||||
'char' => $line['text'][0],
|
||||
|
@ -314,22 +289,18 @@ class BeamParsedown extends ParsedownExtra
|
|||
}
|
||||
}
|
||||
|
||||
protected function BlockAlertContinue($line, $block)
|
||||
{
|
||||
if (isset($block['complete']))
|
||||
{
|
||||
protected function BlockAlertContinue($line, $block) {
|
||||
if (isset($block['complete'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A blank newline has occurred.
|
||||
if (isset($block['interrupted']))
|
||||
{
|
||||
if (isset($block['interrupted'])) {
|
||||
unset($block['interrupted']);
|
||||
}
|
||||
|
||||
// Check for end of the block.
|
||||
if (preg_match('/^:::/', $line['text']))
|
||||
{
|
||||
if (preg_match('/^:::/', $line['text'])) {
|
||||
$block['complete'] = true;
|
||||
return $block;
|
||||
}
|
||||
|
@ -339,17 +310,14 @@ class BeamParsedown extends ParsedownExtra
|
|||
return $block;
|
||||
}
|
||||
|
||||
protected function BlockAlertComplete($block)
|
||||
{
|
||||
protected function BlockAlertComplete($block) {
|
||||
return $block;
|
||||
}
|
||||
|
||||
// draw.io
|
||||
|
||||
protected function BlockDrawio($excerpt)
|
||||
{
|
||||
if (preg_match('/\[drawio:\s*(.+?)\]/', $excerpt['text'], $matches))
|
||||
{
|
||||
protected function BlockDrawio($excerpt) {
|
||||
if (preg_match('/\[drawio:\s*(.+?)\]/', $excerpt['text'], $matches)) {
|
||||
$file = trim($matches[1]);
|
||||
if (!preg_match($this->isUrlRegex, $file, $urlmatch)) {
|
||||
$file = $this->basePath . $file;
|
||||
|
@ -393,10 +361,8 @@ class BeamParsedown extends ParsedownExtra
|
|||
|
||||
// Mermaid
|
||||
|
||||
protected function BlockMermaid($line, $block)
|
||||
{
|
||||
if (preg_match('/^:::\s*mermaid/', $line['text'], $matches))
|
||||
{
|
||||
protected function BlockMermaid($line, $block) {
|
||||
if (preg_match('/^:::\s*mermaid/', $line['text'], $matches)) {
|
||||
return array(
|
||||
'char' => $line['text'][0],
|
||||
'element' => array(
|
||||
|
@ -410,22 +376,18 @@ class BeamParsedown extends ParsedownExtra
|
|||
}
|
||||
}
|
||||
|
||||
protected function BlockMermaidContinue($line, $block)
|
||||
{
|
||||
if (isset($block['complete']))
|
||||
{
|
||||
protected function BlockMermaidContinue($line, $block) {
|
||||
if (isset($block['complete'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A blank newline has occurred.
|
||||
if (isset($block['interrupted']))
|
||||
{
|
||||
if (isset($block['interrupted'])) {
|
||||
unset($block['interrupted']);
|
||||
}
|
||||
|
||||
// Check for end of the block.
|
||||
if (preg_match('/^:::/', $line['text']))
|
||||
{
|
||||
if (preg_match('/^:::/', $line['text'])) {
|
||||
$block['complete'] = true;
|
||||
return $block;
|
||||
}
|
||||
|
@ -435,17 +397,14 @@ class BeamParsedown extends ParsedownExtra
|
|||
return $block;
|
||||
}
|
||||
|
||||
protected function BlockMermaidComplete($block)
|
||||
{
|
||||
protected function BlockMermaidComplete($block) {
|
||||
return $block;
|
||||
}
|
||||
|
||||
// Chart JS
|
||||
|
||||
protected function BlockChart($line, $block)
|
||||
{
|
||||
if (preg_match('/^:::\s*chart/', $line['text'], $matches))
|
||||
{
|
||||
protected function BlockChart($line, $block) {
|
||||
if (preg_match('/^:::\s*chart/', $line['text'], $matches)) {
|
||||
return array(
|
||||
'char' => $line['text'][0],
|
||||
'element' => array(
|
||||
|
@ -459,22 +418,18 @@ class BeamParsedown extends ParsedownExtra
|
|||
}
|
||||
}
|
||||
|
||||
protected function BlockChartContinue($line, $block)
|
||||
{
|
||||
if (isset($block['complete']))
|
||||
{
|
||||
protected function BlockChartContinue($line, $block) {
|
||||
if (isset($block['complete'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A blank newline has occurred.
|
||||
if (isset($block['interrupted']))
|
||||
{
|
||||
if (isset($block['interrupted'])) {
|
||||
unset($block['interrupted']);
|
||||
}
|
||||
|
||||
// Check for end of the block.
|
||||
if (preg_match('/^:::/', $line['text']))
|
||||
{
|
||||
if (preg_match('/^:::/', $line['text'])) {
|
||||
$block['complete'] = true;
|
||||
return $block;
|
||||
}
|
||||
|
@ -484,8 +439,7 @@ class BeamParsedown extends ParsedownExtra
|
|||
return $block;
|
||||
}
|
||||
|
||||
protected function BlockChartComplete($block)
|
||||
{
|
||||
protected function BlockChartComplete($block) {
|
||||
return $block;
|
||||
}
|
||||
}
|
|
@ -4,15 +4,13 @@ namespace ArdiSSoebrata\BeamParsedown;
|
|||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BeamParsedownServiceProvider extends ServiceProvider
|
||||
{
|
||||
class BeamParsedownServiceProvider extends ServiceProvider {
|
||||
/**
|
||||
* Perform post-registration booting of services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
public function boot() : void {
|
||||
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', ':lc:vendor');
|
||||
// $this->loadViewsFrom(__DIR__.'/../resources/views', ':lc:vendor');
|
||||
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
|
||||
|
@ -29,9 +27,8 @@ class BeamParsedownServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/../config/beam-parsedown.php', 'beam-parsedown');
|
||||
public function register() : void {
|
||||
$this->mergeConfigFrom(__DIR__ . '/../config/beam-parsedown.php', 'beam-parsedown');
|
||||
|
||||
// Register the service the package provides.
|
||||
$this->app->singleton('beam-parsedown', function ($app) {
|
||||
|
@ -52,8 +49,7 @@ class BeamParsedownServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
public function provides() {
|
||||
// @codeCoverageIgnoreStart
|
||||
return ['beam-parsedown'];
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@ -64,11 +60,10 @@ class BeamParsedownServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function bootForConsole(): void
|
||||
{
|
||||
protected function bootForConsole() : void {
|
||||
// Publishing the configuration file.
|
||||
$this->publishes([
|
||||
__DIR__.'/../config/beam-parsedown.php' => config_path('beam-parsedown.php'),
|
||||
__DIR__ . '/../config/beam-parsedown.php' => config_path('beam-parsedown.php'),
|
||||
], 'beam-parsedown.config');
|
||||
|
||||
// Publishing the views.
|
||||
|
|
|
@ -4,15 +4,13 @@ namespace ArdiSSoebrata\BeamParsedown\Facades;
|
|||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class BeamParsedown extends Facade
|
||||
{
|
||||
class BeamParsedown extends Facade {
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
protected static function getFacadeAccessor() : string {
|
||||
return 'beam-parsedown';
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -13,23 +13,20 @@
|
|||
#
|
||||
#
|
||||
|
||||
class ParsedownExtra extends Parsedown
|
||||
{
|
||||
class ParsedownExtra extends Parsedown {
|
||||
# ~
|
||||
|
||||
const version = '0.8.0';
|
||||
|
||||
# ~
|
||||
|
||||
function __construct()
|
||||
{
|
||||
if (version_compare(parent::version, '1.7.1') < 0)
|
||||
{
|
||||
function __construct() {
|
||||
if (version_compare(parent::version, '1.7.1') < 0) {
|
||||
throw new Exception('ParsedownExtra requires a later version of Parsedown');
|
||||
}
|
||||
|
||||
$this->BlockTypes[':'] []= 'DefinitionList';
|
||||
$this->BlockTypes['*'] []= 'Abbreviation';
|
||||
$this->BlockTypes[':'] [] = 'DefinitionList';
|
||||
$this->BlockTypes['*'] [] = 'Abbreviation';
|
||||
|
||||
# identify footnote definitions before reference definitions
|
||||
array_unshift($this->BlockTypes['['], 'Footnote');
|
||||
|
@ -41,8 +38,7 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# ~
|
||||
|
||||
function text($text)
|
||||
{
|
||||
function text($text) {
|
||||
$Elements = $this->textElements($text);
|
||||
|
||||
# convert to markup
|
||||
|
@ -57,8 +53,7 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
# add footnotes
|
||||
|
||||
if (isset($this->DefinitionData['Footnote']))
|
||||
{
|
||||
if (isset($this->DefinitionData['Footnote'])) {
|
||||
$Element = $this->buildFootnoteElement();
|
||||
|
||||
$markup .= "\n" . $this->element($Element);
|
||||
|
@ -74,10 +69,8 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Abbreviation
|
||||
|
||||
protected function blockAbbreviation($Line)
|
||||
{
|
||||
if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches))
|
||||
{
|
||||
protected function blockAbbreviation($Line) {
|
||||
if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches)) {
|
||||
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
|
||||
|
||||
$Block = array(
|
||||
|
@ -91,10 +84,8 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Footnote
|
||||
|
||||
protected function blockFootnote($Line)
|
||||
{
|
||||
if (preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
|
||||
{
|
||||
protected function blockFootnote($Line) {
|
||||
if (preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches)) {
|
||||
$Block = array(
|
||||
'label' => $matches[1],
|
||||
'text' => $matches[2],
|
||||
|
@ -105,32 +96,25 @@ class ParsedownExtra extends Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function blockFootnoteContinue($Line, $Block)
|
||||
{
|
||||
if ($Line['text'][0] === '[' and preg_match('/^\[\^(.+?)\]:/', $Line['text']))
|
||||
{
|
||||
protected function blockFootnoteContinue($Line, $Block) {
|
||||
if ($Line['text'][0] === '[' and preg_match('/^\[\^(.+?)\]:/', $Line['text'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($Block['interrupted']))
|
||||
{
|
||||
if ($Line['indent'] >= 4)
|
||||
{
|
||||
if (isset($Block['interrupted'])) {
|
||||
if ($Line['indent'] >= 4) {
|
||||
$Block['text'] .= "\n\n" . $Line['text'];
|
||||
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$Block['text'] .= "\n" . $Line['text'];
|
||||
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
|
||||
protected function blockFootnoteComplete($Block)
|
||||
{
|
||||
protected function blockFootnoteComplete($Block) {
|
||||
$this->DefinitionData['Footnote'][$Block['label']] = array(
|
||||
'text' => $Block['text'],
|
||||
'count' => null,
|
||||
|
@ -143,10 +127,8 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Definition List
|
||||
|
||||
protected function blockDefinitionList($Line, $Block)
|
||||
{
|
||||
if ( ! isset($Block) or $Block['type'] !== 'Paragraph')
|
||||
{
|
||||
protected function blockDefinitionList($Line, $Block) {
|
||||
if (!isset($Block) or $Block['type'] !== 'Paragraph') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -157,9 +139,8 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
$terms = explode("\n", $Block['element']['handler']['argument']);
|
||||
|
||||
foreach ($terms as $term)
|
||||
{
|
||||
$Element['elements'] []= array(
|
||||
foreach ($terms as $term) {
|
||||
$Element['elements'] [] = array(
|
||||
'name' => 'dt',
|
||||
'handler' => array(
|
||||
'function' => 'lineElements',
|
||||
|
@ -176,23 +157,17 @@ class ParsedownExtra extends Parsedown
|
|||
return $Block;
|
||||
}
|
||||
|
||||
protected function blockDefinitionListContinue($Line, array $Block)
|
||||
{
|
||||
if ($Line['text'][0] === ':')
|
||||
{
|
||||
protected function blockDefinitionListContinue($Line, array $Block) {
|
||||
if ($Line['text'][0] === ':') {
|
||||
$Block = $this->addDdElement($Line, $Block);
|
||||
|
||||
return $Block;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($Block['interrupted']) and $Line['indent'] === 0)
|
||||
{
|
||||
} else {
|
||||
if (isset($Block['interrupted']) and $Line['indent'] === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($Block['interrupted']))
|
||||
{
|
||||
if (isset($Block['interrupted'])) {
|
||||
$Block['dd']['handler']['function'] = 'textElements';
|
||||
$Block['dd']['handler']['argument'] .= "\n\n";
|
||||
|
||||
|
@ -212,12 +187,10 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Header
|
||||
|
||||
protected function blockHeader($Line)
|
||||
{
|
||||
protected function blockHeader($Line) {
|
||||
$Block = parent::blockHeader($Line);
|
||||
|
||||
if ($Block !== null && preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
if ($Block !== null && preg_match('/[ #]*{(' . $this->regexAttribute . '+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE)) {
|
||||
$attributeString = $matches[1][0];
|
||||
|
||||
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
|
||||
|
@ -231,19 +204,15 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Markup
|
||||
|
||||
protected function blockMarkup($Line)
|
||||
{
|
||||
if ($this->markupEscaped or $this->safeMode)
|
||||
{
|
||||
protected function blockMarkup($Line) {
|
||||
if ($this->markupEscaped or $this->safeMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
|
||||
{
|
||||
if (preg_match('/^<(\w[\w-]*)(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*(\/)?>/', $Line['text'], $matches)) {
|
||||
$element = strtolower($matches[1]);
|
||||
|
||||
if (in_array($element, $this->textLevelElements))
|
||||
{
|
||||
if (in_array($element, $this->textLevelElements)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -259,22 +228,16 @@ class ParsedownExtra extends Parsedown
|
|||
$length = strlen($matches[0]);
|
||||
$remainder = substr($Line['text'], $length);
|
||||
|
||||
if (trim($remainder) === '')
|
||||
{
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
|
||||
{
|
||||
if (trim($remainder) === '') {
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) {
|
||||
$Block['closed'] = true;
|
||||
$Block['void'] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
|
||||
{
|
||||
} else {
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) {
|
||||
return;
|
||||
}
|
||||
if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder))
|
||||
{
|
||||
if (preg_match('/<\/' . $matches[1] . '>[ ]*$/i', $remainder)) {
|
||||
$Block['closed'] = true;
|
||||
}
|
||||
}
|
||||
|
@ -283,45 +246,37 @@ class ParsedownExtra extends Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function blockMarkupContinue($Line, array $Block)
|
||||
{
|
||||
if (isset($Block['closed']))
|
||||
{
|
||||
protected function blockMarkupContinue($Line, array $Block) {
|
||||
if (isset($Block['closed'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open
|
||||
if (preg_match('/^<' . $Block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $Line['text'])) # open
|
||||
{
|
||||
$Block['depth'] ++;
|
||||
$Block['depth']++;
|
||||
}
|
||||
|
||||
if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close
|
||||
{
|
||||
if ($Block['depth'] > 0)
|
||||
{
|
||||
$Block['depth'] --;
|
||||
}
|
||||
else
|
||||
if (preg_match('/(.*?)<\/' . $Block['name'] . '>[ ]*$/i', $Line['text'], $matches)) # close
|
||||
{
|
||||
if ($Block['depth'] > 0) {
|
||||
$Block['depth']--;
|
||||
} else {
|
||||
$Block['closed'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($Block['interrupted']))
|
||||
{
|
||||
if (isset($Block['interrupted'])) {
|
||||
$Block['element']['rawHtml'] .= "\n";
|
||||
unset($Block['interrupted']);
|
||||
}
|
||||
|
||||
$Block['element']['rawHtml'] .= "\n".$Line['body'];
|
||||
$Block['element']['rawHtml'] .= "\n" . $Line['body'];
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
protected function blockMarkupComplete($Block)
|
||||
{
|
||||
if ( ! isset($Block['void']))
|
||||
{
|
||||
protected function blockMarkupComplete($Block) {
|
||||
if (!isset($Block['void'])) {
|
||||
$Block['element']['rawHtml'] = $this->processTag($Block['element']['rawHtml']);
|
||||
}
|
||||
|
||||
|
@ -331,12 +286,10 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Setext
|
||||
|
||||
protected function blockSetextHeader($Line, array $Block = null)
|
||||
{
|
||||
protected function blockSetextHeader($Line, array $Block = null) {
|
||||
$Block = parent::blockSetextHeader($Line, $Block);
|
||||
|
||||
if ($Block !== null && preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
if ($Block !== null && preg_match('/[ ]*{(' . $this->regexAttribute . '+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE)) {
|
||||
$attributeString = $matches[1][0];
|
||||
|
||||
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
|
||||
|
@ -354,30 +307,26 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Footnote Marker
|
||||
|
||||
protected function inlineFootnoteMarker($Excerpt)
|
||||
{
|
||||
if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches))
|
||||
{
|
||||
protected function inlineFootnoteMarker($Excerpt) {
|
||||
if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches)) {
|
||||
$name = $matches[1];
|
||||
|
||||
if ( ! isset($this->DefinitionData['Footnote'][$name]))
|
||||
{
|
||||
if (!isset($this->DefinitionData['Footnote'][$name])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->DefinitionData['Footnote'][$name]['count'] ++;
|
||||
$this->DefinitionData['Footnote'][$name]['count']++;
|
||||
|
||||
if ( ! isset($this->DefinitionData['Footnote'][$name]['number']))
|
||||
{
|
||||
$this->DefinitionData['Footnote'][$name]['number'] = ++ $this->footnoteCount; # » &
|
||||
if (!isset($this->DefinitionData['Footnote'][$name]['number'])) {
|
||||
$this->DefinitionData['Footnote'][$name]['number'] = ++$this->footnoteCount; # » &
|
||||
}
|
||||
|
||||
$Element = array(
|
||||
'name' => 'sup',
|
||||
'attributes' => array('id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name),
|
||||
'attributes' => array('id' => 'fnref' . $this->DefinitionData['Footnote'][$name]['count'] . ':' . $name),
|
||||
'element' => array(
|
||||
'name' => 'a',
|
||||
'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'),
|
||||
'attributes' => array('href' => '#fn:' . $name, 'class' => 'footnote-ref'),
|
||||
'text' => $this->DefinitionData['Footnote'][$name]['number'],
|
||||
),
|
||||
);
|
||||
|
@ -394,14 +343,12 @@ class ParsedownExtra extends Parsedown
|
|||
#
|
||||
# Link
|
||||
|
||||
protected function inlineLink($Excerpt)
|
||||
{
|
||||
protected function inlineLink($Excerpt) {
|
||||
$Link = parent::inlineLink($Excerpt);
|
||||
|
||||
$remainder = $Link !== null ? substr($Excerpt['text'], $Link['extent']) : '';
|
||||
|
||||
if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches))
|
||||
{
|
||||
if (preg_match('/^[ ]*{(' . $this->regexAttribute . '+)}/', $remainder, $matches)) {
|
||||
$Link['element']['attributes'] += $this->parseAttributeData($matches[1]);
|
||||
|
||||
$Link['extent'] += strlen($matches[0]);
|
||||
|
@ -417,12 +364,10 @@ class ParsedownExtra extends Parsedown
|
|||
private $currentAbreviation;
|
||||
private $currentMeaning;
|
||||
|
||||
protected function insertAbreviation(array $Element)
|
||||
{
|
||||
if (isset($Element['text']))
|
||||
{
|
||||
protected function insertAbreviation(array $Element) {
|
||||
if (isset($Element['text'])) {
|
||||
$Element['elements'] = self::pregReplaceElements(
|
||||
'/\b'.preg_quote($this->currentAbreviation, '/').'\b/',
|
||||
'/\b' . preg_quote($this->currentAbreviation, '/') . '\b/',
|
||||
array(
|
||||
array(
|
||||
'name' => 'abbr',
|
||||
|
@ -441,14 +386,11 @@ class ParsedownExtra extends Parsedown
|
|||
return $Element;
|
||||
}
|
||||
|
||||
protected function inlineText($text)
|
||||
{
|
||||
protected function inlineText($text) {
|
||||
$Inline = parent::inlineText($text);
|
||||
|
||||
if (isset($this->DefinitionData['Abbreviation']))
|
||||
{
|
||||
foreach ($this->DefinitionData['Abbreviation'] as $abbreviation => $meaning)
|
||||
{
|
||||
if (isset($this->DefinitionData['Abbreviation'])) {
|
||||
foreach ($this->DefinitionData['Abbreviation'] as $abbreviation => $meaning) {
|
||||
$this->currentAbreviation = $abbreviation;
|
||||
$this->currentMeaning = $meaning;
|
||||
|
||||
|
@ -466,8 +408,7 @@ class ParsedownExtra extends Parsedown
|
|||
# Util Methods
|
||||
#
|
||||
|
||||
protected function addDdElement(array $Line, array $Block)
|
||||
{
|
||||
protected function addDdElement(array $Line, array $Block) {
|
||||
$text = substr($Line['text'], 1);
|
||||
$text = trim($text);
|
||||
|
||||
|
@ -482,20 +423,18 @@ class ParsedownExtra extends Parsedown
|
|||
),
|
||||
);
|
||||
|
||||
if (isset($Block['interrupted']))
|
||||
{
|
||||
if (isset($Block['interrupted'])) {
|
||||
$Block['dd']['handler']['function'] = 'textElements';
|
||||
|
||||
unset($Block['interrupted']);
|
||||
}
|
||||
|
||||
$Block['element']['elements'] []= & $Block['dd'];
|
||||
$Block['element']['elements'] [] = &$Block['dd'];
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
protected function buildFootnoteElement()
|
||||
{
|
||||
protected function buildFootnoteElement() {
|
||||
$Element = array(
|
||||
'name' => 'div',
|
||||
'attributes' => array('class' => 'footnotes'),
|
||||
|
@ -510,10 +449,8 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
|
||||
|
||||
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData)
|
||||
{
|
||||
if ( ! isset($DefinitionData['number']))
|
||||
{
|
||||
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData) {
|
||||
if (!isset($DefinitionData['number'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -525,8 +462,7 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
$backLinkElements = array();
|
||||
|
||||
foreach ($numbers as $number)
|
||||
{
|
||||
foreach ($numbers as $number) {
|
||||
$backLinkElements[] = array('text' => ' ');
|
||||
$backLinkElements[] = array(
|
||||
'name' => 'a',
|
||||
|
@ -543,10 +479,9 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
unset($backLinkElements[0]);
|
||||
|
||||
$n = count($textElements) -1;
|
||||
$n = count($textElements) - 1;
|
||||
|
||||
if ($textElements[$n]['name'] === 'p')
|
||||
{
|
||||
if ($textElements[$n]['name'] === 'p') {
|
||||
$backLinkElements = array_merge(
|
||||
array(
|
||||
array(
|
||||
|
@ -566,18 +501,16 @@ class ParsedownExtra extends Parsedown
|
|||
$backLinkElements
|
||||
),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$textElements[] = array(
|
||||
'name' => 'p',
|
||||
'elements' => $backLinkElements
|
||||
);
|
||||
}
|
||||
|
||||
$Element['elements'][1]['elements'] []= array(
|
||||
$Element['elements'][1]['elements'] [] = array(
|
||||
'name' => 'li',
|
||||
'attributes' => array('id' => 'fn:'.$definitionId),
|
||||
'attributes' => array('id' => 'fn:' . $definitionId),
|
||||
'elements' => array_merge(
|
||||
$textElements
|
||||
),
|
||||
|
@ -589,26 +522,21 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
# ~
|
||||
|
||||
protected function parseAttributeData($attributeString)
|
||||
{
|
||||
protected function parseAttributeData($attributeString) {
|
||||
$Data = array();
|
||||
|
||||
$attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY);
|
||||
$attributes = preg_split('/[ ]+/', $attributeString, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach ($attributes as $attribute)
|
||||
{
|
||||
if ($attribute[0] === '#')
|
||||
{
|
||||
foreach ($attributes as $attribute) {
|
||||
if ($attribute[0] === '#') {
|
||||
$Data['id'] = substr($attribute, 1);
|
||||
}
|
||||
else # "."
|
||||
} else # "."
|
||||
{
|
||||
$classes []= substr($attribute, 1);
|
||||
$classes [] = substr($attribute, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($classes))
|
||||
{
|
||||
if (isset($classes)) {
|
||||
$Data['class'] = implode(' ', $classes);
|
||||
}
|
||||
|
||||
|
@ -634,29 +562,21 @@ class ParsedownExtra extends Parsedown
|
|||
|
||||
$elementText = '';
|
||||
|
||||
if ($DOMDocument->documentElement->getAttribute('markdown') === '1')
|
||||
{
|
||||
foreach ($DOMDocument->documentElement->childNodes as $Node)
|
||||
{
|
||||
if ($DOMDocument->documentElement->getAttribute('markdown') === '1') {
|
||||
foreach ($DOMDocument->documentElement->childNodes as $Node) {
|
||||
$elementText .= $DOMDocument->saveHTML($Node);
|
||||
}
|
||||
|
||||
$DOMDocument->documentElement->removeAttribute('markdown');
|
||||
|
||||
$elementText = "\n".$this->text($elementText)."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($DOMDocument->documentElement->childNodes as $Node)
|
||||
{
|
||||
$elementText = "\n" . $this->text($elementText) . "\n";
|
||||
} else {
|
||||
foreach ($DOMDocument->documentElement->childNodes as $Node) {
|
||||
$nodeMarkup = $DOMDocument->saveHTML($Node);
|
||||
|
||||
if ($Node instanceof DOMElement and ! in_array($Node->nodeName, $this->textLevelElements))
|
||||
{
|
||||
if ($Node instanceof DOMElement and !in_array($Node->nodeName, $this->textLevelElements)) {
|
||||
$elementText .= $this->processTag($nodeMarkup);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$elementText .= $nodeMarkup;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
|
||||
namespace Aidantwoods\SecureParsedown;
|
||||
|
||||
class SecureParsedown extends \Parsedown
|
||||
{
|
||||
class SecureParsedown extends \Parsedown {
|
||||
const version = '1.0.1';
|
||||
|
||||
function setSafeMode($safeMode)
|
||||
{
|
||||
$this->safeMode = (bool) $safeMode;
|
||||
function setSafeMode($safeMode) {
|
||||
$this->safeMode = (bool)$safeMode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -32,8 +30,7 @@ class SecureParsedown extends \Parsedown
|
|||
'steam:',
|
||||
);
|
||||
|
||||
protected function blockCodeComplete($Block)
|
||||
{
|
||||
protected function blockCodeComplete($Block) {
|
||||
$text = $Block['element']['text']['text'];
|
||||
|
||||
$Block['element']['text']['text'] = $text;
|
||||
|
@ -41,21 +38,17 @@ class SecureParsedown extends \Parsedown
|
|||
return $Block;
|
||||
}
|
||||
|
||||
protected function blockComment($Line)
|
||||
{
|
||||
if ($this->markupEscaped or $this->safeMode)
|
||||
{
|
||||
protected function blockComment($Line) {
|
||||
if ($this->markupEscaped or $this->safeMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!')
|
||||
{
|
||||
if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') {
|
||||
$Block = array(
|
||||
'markup' => $Line['body'],
|
||||
);
|
||||
|
||||
if (preg_match('/-->$/', $Line['text']))
|
||||
{
|
||||
if (preg_match('/-->$/', $Line['text'])) {
|
||||
$Block['closed'] = true;
|
||||
}
|
||||
|
||||
|
@ -63,8 +56,7 @@ class SecureParsedown extends \Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function blockFencedCodeComplete($Block)
|
||||
{
|
||||
protected function blockFencedCodeComplete($Block) {
|
||||
$text = $Block['element']['text']['text'];
|
||||
|
||||
$Block['element']['text']['text'] = $text;
|
||||
|
@ -72,19 +64,15 @@ class SecureParsedown extends \Parsedown
|
|||
return $Block;
|
||||
}
|
||||
|
||||
protected function blockMarkup($Line)
|
||||
{
|
||||
if ($this->markupEscaped or $this->safeMode)
|
||||
{
|
||||
protected function blockMarkup($Line) {
|
||||
if ($this->markupEscaped or $this->safeMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^<(\w*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
|
||||
{
|
||||
if (preg_match('/^<(\w*)(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*(\/)?>/', $Line['text'], $matches)) {
|
||||
$element = strtolower($matches[1]);
|
||||
|
||||
if (in_array($element, $this->textLevelElements))
|
||||
{
|
||||
if (in_array($element, $this->textLevelElements)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -98,24 +86,18 @@ class SecureParsedown extends \Parsedown
|
|||
|
||||
$remainder = substr($Line['text'], $length);
|
||||
|
||||
if (trim($remainder) === '')
|
||||
{
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
|
||||
{
|
||||
if (trim($remainder) === '') {
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) {
|
||||
$Block['closed'] = true;
|
||||
|
||||
$Block['void'] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
|
||||
{
|
||||
} else {
|
||||
if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder))
|
||||
{
|
||||
if (preg_match('/<\/' . $matches[1] . '>[ ]*$/i', $remainder)) {
|
||||
$Block['closed'] = true;
|
||||
}
|
||||
}
|
||||
|
@ -124,12 +106,10 @@ class SecureParsedown extends \Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function inlineCode($Excerpt)
|
||||
{
|
||||
protected function inlineCode($Excerpt) {
|
||||
$marker = $Excerpt['text'][0];
|
||||
|
||||
if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(?<!'.$marker.')\1(?!'.$marker.')/s', $Excerpt['text'], $matches))
|
||||
{
|
||||
if (preg_match('/^(' . $marker . '+)[ ]*(.+?)[ ]*(?<!' . $marker . ')\1(?!' . $marker . ')/s', $Excerpt['text'], $matches)) {
|
||||
$text = $matches[2];
|
||||
$text = preg_replace("/[ ]*\n/", ' ', $text);
|
||||
|
||||
|
@ -143,8 +123,7 @@ class SecureParsedown extends \Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function inlineLink($Excerpt)
|
||||
{
|
||||
protected function inlineLink($Excerpt) {
|
||||
$Element = array(
|
||||
'name' => 'a',
|
||||
'handler' => 'line',
|
||||
|
@ -159,46 +138,35 @@ class SecureParsedown extends \Parsedown
|
|||
|
||||
$remainder = $Excerpt['text'];
|
||||
|
||||
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
|
||||
{
|
||||
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) {
|
||||
$Element['text'] = $matches[1];
|
||||
|
||||
$extent += strlen($matches[0]);
|
||||
|
||||
$remainder = substr($remainder, $extent);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches))
|
||||
{
|
||||
if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches)) {
|
||||
$Element['attributes']['href'] = $matches[1];
|
||||
|
||||
if (isset($matches[2]))
|
||||
{
|
||||
$Element['attributes']['title'] = substr($matches[2], 1, - 1);
|
||||
if (isset($matches[2])) {
|
||||
$Element['attributes']['title'] = substr($matches[2], 1, -1);
|
||||
}
|
||||
|
||||
$extent += strlen($matches[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
|
||||
{
|
||||
} else {
|
||||
if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) {
|
||||
$definition = strlen($matches[1]) ? $matches[1] : $Element['text'];
|
||||
$definition = strtolower($definition);
|
||||
|
||||
$extent += strlen($matches[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$definition = strtolower($Element['text']);
|
||||
}
|
||||
|
||||
if ( ! isset($this->DefinitionData['Reference'][$definition]))
|
||||
{
|
||||
if (!isset($this->DefinitionData['Reference'][$definition])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -214,31 +182,26 @@ class SecureParsedown extends \Parsedown
|
|||
);
|
||||
}
|
||||
|
||||
protected function inlineMarkup($Excerpt)
|
||||
{
|
||||
if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false)
|
||||
{
|
||||
protected function inlineMarkup($Excerpt) {
|
||||
if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $Excerpt['text'], $matches))
|
||||
{
|
||||
if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $Excerpt['text'], $matches)) {
|
||||
return array(
|
||||
'markup' => $matches[0],
|
||||
'extent' => strlen($matches[0]),
|
||||
);
|
||||
}
|
||||
|
||||
if ($Excerpt['text'][1] === '!' and preg_match('/^<!---?[^>-](?:-?[^-])*-->/s', $Excerpt['text'], $matches))
|
||||
{
|
||||
if ($Excerpt['text'][1] === '!' and preg_match('/^<!---?[^>-](?:-?[^-])*-->/s', $Excerpt['text'], $matches)) {
|
||||
return array(
|
||||
'markup' => $matches[0],
|
||||
'extent' => strlen($matches[0]),
|
||||
);
|
||||
}
|
||||
|
||||
if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches))
|
||||
{
|
||||
if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w*(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*\/?>/s', $Excerpt['text'], $matches)) {
|
||||
return array(
|
||||
'markup' => $matches[0],
|
||||
'extent' => strlen($matches[0]),
|
||||
|
@ -246,15 +209,12 @@ class SecureParsedown extends \Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function inlineUrl($Excerpt)
|
||||
{
|
||||
if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')
|
||||
{
|
||||
protected function inlineUrl($Excerpt) {
|
||||
if ($this->urlsLinked !== true or !isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) {
|
||||
$url = $matches[0][0];
|
||||
|
||||
$Inline = array(
|
||||
|
@ -273,10 +233,8 @@ class SecureParsedown extends \Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function inlineUrlTag($Excerpt)
|
||||
{
|
||||
if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches))
|
||||
{
|
||||
protected function inlineUrlTag($Excerpt) {
|
||||
if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches)) {
|
||||
$url = $matches[1];
|
||||
|
||||
return array(
|
||||
|
@ -292,76 +250,58 @@ class SecureParsedown extends \Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
protected function element(array $Element)
|
||||
{
|
||||
if ($this->safeMode)
|
||||
{
|
||||
protected function element(array $Element) {
|
||||
if ($this->safeMode) {
|
||||
$Element = $this->sanitiseElement($Element);
|
||||
}
|
||||
|
||||
$markup = '<'.$Element['name'];
|
||||
$markup = '<' . $Element['name'];
|
||||
|
||||
if (isset($Element['attributes']))
|
||||
{
|
||||
foreach ($Element['attributes'] as $name => $value)
|
||||
{
|
||||
if ($value === null)
|
||||
{
|
||||
if (isset($Element['attributes'])) {
|
||||
foreach ($Element['attributes'] as $name => $value) {
|
||||
if ($value === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$markup .= ' '.$name.'="'.self::escape($value).'"';
|
||||
$markup .= ' ' . $name . '="' . self::escape($value) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($Element['text']))
|
||||
{
|
||||
if (isset($Element['text'])) {
|
||||
$markup .= '>';
|
||||
|
||||
if (isset($Element['handler']))
|
||||
{
|
||||
if (isset($Element['handler'])) {
|
||||
$markup .= $this->{$Element['handler']}($Element['text']);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$markup .= self::escape($Element['text'], true);
|
||||
}
|
||||
|
||||
$markup .= '</'.$Element['name'].'>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$markup .= '</' . $Element['name'] . '>';
|
||||
} else {
|
||||
$markup .= ' />';
|
||||
}
|
||||
|
||||
return $markup;
|
||||
}
|
||||
|
||||
protected function sanitiseElement(array $Element)
|
||||
{
|
||||
protected function sanitiseElement(array $Element) {
|
||||
static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/';
|
||||
static $safeUrlNameToAtt = array(
|
||||
'a' => 'href',
|
||||
'img' => 'src',
|
||||
);
|
||||
|
||||
if (isset($safeUrlNameToAtt[$Element['name']]))
|
||||
{
|
||||
if (isset($safeUrlNameToAtt[$Element['name']])) {
|
||||
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
|
||||
}
|
||||
|
||||
if ( ! empty($Element['attributes']))
|
||||
{
|
||||
foreach ($Element['attributes'] as $att => $val)
|
||||
{
|
||||
if (!empty($Element['attributes'])) {
|
||||
foreach ($Element['attributes'] as $att => $val) {
|
||||
# filter out badly parsed attribute
|
||||
if ( ! preg_match($goodAttribute, $att))
|
||||
{
|
||||
if (!preg_match($goodAttribute, $att)) {
|
||||
unset($Element['attributes'][$att]);
|
||||
}
|
||||
# dump onevent attribute
|
||||
elseif (self::striAtStart($att, 'on'))
|
||||
{
|
||||
} # dump onevent attribute
|
||||
elseif (self::striAtStart($att, 'on')) {
|
||||
unset($Element['attributes'][$att]);
|
||||
}
|
||||
}
|
||||
|
@ -370,12 +310,9 @@ class SecureParsedown extends \Parsedown
|
|||
return $Element;
|
||||
}
|
||||
|
||||
protected function filterUnsafeUrlInAttribute(array $Element, $attribute)
|
||||
{
|
||||
foreach ($this->safeLinksWhitelist as $scheme)
|
||||
{
|
||||
if (self::striAtStart($Element['attributes'][$attribute], $scheme))
|
||||
{
|
||||
protected function filterUnsafeUrlInAttribute(array $Element, $attribute) {
|
||||
foreach ($this->safeLinksWhitelist as $scheme) {
|
||||
if (self::striAtStart($Element['attributes'][$attribute], $scheme)) {
|
||||
return $Element;
|
||||
}
|
||||
}
|
||||
|
@ -385,21 +322,16 @@ class SecureParsedown extends \Parsedown
|
|||
return $Element;
|
||||
}
|
||||
|
||||
protected static function escape($text, $allowQuotes = false)
|
||||
{
|
||||
protected static function escape($text, $allowQuotes = false) {
|
||||
return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
protected static function striAtStart($string, $needle)
|
||||
{
|
||||
protected static function striAtStart($string, $needle) {
|
||||
$len = strlen($needle);
|
||||
|
||||
if ($len > strlen($string))
|
||||
{
|
||||
if ($len > strlen($string)) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return strtolower(substr($string, 0, $len)) === strtolower($needle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
function captcha($color, $mode, $mul, $allowed)
|
||||
{
|
||||
function captcha($color, $mode, $mul, $allowed) {
|
||||
|
||||
$bg_path = dirname(__FILE__) . '/captchabg/';
|
||||
$font_path = dirname(__FILE__) . '/fonts/';
|
||||
|
@ -109,8 +108,7 @@ function captcha($color, $mode, $mul, $allowed)
|
|||
}
|
||||
|
||||
if (!function_exists('hex2rgb')) {
|
||||
function hex2rgb($hex_str, $return_string = false, $separator = ',')
|
||||
{
|
||||
function hex2rgb($hex_str, $return_string = false, $separator = ',') {
|
||||
$hex_str = preg_replace("/[^0-9A-Fa-f]/", '', $hex_str); // Gets a proper hex string
|
||||
$rgb_array = array();
|
||||
if (strlen($hex_str) == 6) {
|
||||
|
|
|
@ -19,16 +19,18 @@ function getSitePermissions(PDO $conn) : array {
|
|||
return $conn->query('SELECT * FROM site_permissions LIMIT 1')->fetch();
|
||||
}
|
||||
|
||||
function getSiteAds(PDO $conn) : array | bool {
|
||||
function getSiteAds(PDO $conn) : array|bool {
|
||||
return $conn->query('SELECT text_ads, ads_1, ads_2 FROM ads LIMIT 1')->fetch();
|
||||
}
|
||||
|
||||
function getSiteTotalPastes(PDO $conn) : int {
|
||||
return intval($conn->query('SELECT COUNT(*) FROM pastes')->fetch(PDO::FETCH_NUM)[0]);
|
||||
}
|
||||
|
||||
function getSiteTotalviews(PDO $conn) : int {
|
||||
return intval($conn->query('SELECT tpage FROM page_view ORDER BY id DESC LIMIT 1')->fetch(PDO::FETCH_NUM)[0]);
|
||||
}
|
||||
|
||||
function getSiteTotal_unique_views(PDO $conn) : int {
|
||||
return intval($conn->query('SELECT tvisit FROM page_view ORDER BY id DESC LIMIT 1')->fetch(PDO::FETCH_NUM)[0]);
|
||||
}
|
||||
|
@ -132,7 +134,7 @@ if (in_array($default_lang, scandir('langs/'))) {
|
|||
|
||||
// Check if IP is banned
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
if (is_banned($conn, $ip)) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
|
@ -147,4 +149,4 @@ if (isset($_GET['logout'])) {
|
|||
$site_ads = getSiteAds($conn);
|
||||
$total_pastes = getSiteTotalPastes($conn);
|
||||
$total_page_views = getSiteTotalviews($conn);
|
||||
$total_unique_views= getSiteTotal_unique_views($conn);
|
||||
$total_unique_views = getSiteTotal_unique_views($conn);
|
|
@ -14,31 +14,25 @@
|
|||
*/
|
||||
|
||||
|
||||
function timer()
|
||||
{
|
||||
function timer() {
|
||||
static $start;
|
||||
|
||||
if (is_null($start))
|
||||
{
|
||||
if (is_null($start)) {
|
||||
$start = microtime(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$diff = round((microtime(true) - $start), 4);
|
||||
$start = null;
|
||||
return $diff;
|
||||
}
|
||||
}
|
||||
|
||||
function getUserFavs($conn, $username)
|
||||
{
|
||||
function getUserFavs($conn, $username) {
|
||||
$query = $conn->prepare("SELECT pins.f_time, pins.m_fav, pins.f_paste, pastes.id, pastes.title, pastes.now_time, pastes.tagsys FROM pins, pastes WHERE pins.f_paste = pastes.id AND pins.m_fav=?'");
|
||||
$query->execute([$username]);
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function CountPasteFavs($conn, $fav_id)
|
||||
{
|
||||
function CountPasteFavs($conn, $fav_id) {
|
||||
$query = $conn->prepare("SELECT COUNT(f_paste) FROM pins WHERE f_paste=?");
|
||||
$query->execute([$fav_id]);
|
||||
return $query->fetchAll();
|
||||
|
@ -46,15 +40,14 @@ function CountPasteFavs($conn, $fav_id)
|
|||
|
||||
|
||||
function checkFavorite($paste_id, $user_id, $conn) {
|
||||
$result = $conn->query("SELECT * FROM pins WHERE m_fav = '". $user_id."' AND f_paste = '". $paste_id."'");
|
||||
$result = $conn->query("SELECT * FROM pins WHERE m_fav = '" . $user_id . "' AND f_paste = '" . $paste_id . "'");
|
||||
$numrows = $result->num_rows;
|
||||
if ($numrows == 0) {
|
||||
echo "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='". $paste_id."'><i class='far fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
}
|
||||
else {
|
||||
echo "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='". $paste_id."'><i class='fas fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
}
|
||||
echo "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='" . $paste_id . "'><i class='far fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
} else {
|
||||
echo "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='" . $paste_id . "'><i class='fas fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
}
|
||||
}
|
||||
|
||||
function getreports($conn, $count = 10) {
|
||||
$query = $conn->prepare('SELECT * FROM user_reports LIMIT ?');
|
||||
|
@ -63,40 +56,36 @@ function getreports($conn, $count = 10) {
|
|||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function sandwitch($str){
|
||||
function sandwitch($str) {
|
||||
$output = "";
|
||||
$arr = explode(",", $str);
|
||||
foreach ($arr as $word){
|
||||
foreach ($arr as $word) {
|
||||
$word = ucfirst($word);
|
||||
if (stripos($word, 'nsfw') !== false) {
|
||||
$word = strtoupper($word);
|
||||
$tagcolor = "tag is-danger";
|
||||
}
|
||||
elseif (stripos($word, 'SAFE') !== false) {
|
||||
} elseif (stripos($word, 'SAFE') !== false) {
|
||||
$word = strtoupper($word);
|
||||
$tagcolor = "tag is-success";
|
||||
}
|
||||
elseif (strstr($word, '/')){
|
||||
} elseif (strstr($word, '/')) {
|
||||
$tagcolor = "tag is-primary";
|
||||
}else{
|
||||
} else {
|
||||
$tagcolor = "tag is-info";
|
||||
}
|
||||
$output .= '<a href="/archive?q='.trim($word).'"><span class="' . $tagcolor . '">'.trim($word).'</span>';
|
||||
$output .= '<a href="/archive?q=' . trim($word) . '"><span class="' . $tagcolor . '">' . trim($word) . '</span>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function getevent($conn, $event_name, $count)
|
||||
{
|
||||
function getevent($conn, $event_name, $count) {
|
||||
$query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member, tagsys FROM pastes WHERE visible='1' AND tagsys LIKE '%?%'
|
||||
ORDER BY RAND () LIMIT 0, ?");
|
||||
$query->execute([$event_name,$count]);
|
||||
$query->execute([$event_name, $count]);
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function linkify($value, $protocols = array('http', 'mail'), array $attributes = array())
|
||||
{
|
||||
function linkify($value, $protocols = array('http', 'mail'), array $attributes = array()) {
|
||||
// Link attributes
|
||||
$attr = '';
|
||||
foreach ($attributes as $key => $val) {
|
||||
|
@ -106,25 +95,37 @@ function linkify($value, $protocols = array('http', 'mail'), array $attributes =
|
|||
$links = array();
|
||||
|
||||
// Extract existing links and tags
|
||||
$value = preg_replace_callback('~(<a .*?>.*?</a>|<.*?>)~i', function ($match) use (&$links) { return '<' . array_push($links, $match[1]) . '>'; }, $value);
|
||||
$value = preg_replace_callback('~(<a .*?>.*?</a>|<.*?>)~i', function ($match) use (&$links) {
|
||||
return '<' . array_push($links, $match[1]) . '>';
|
||||
}, $value);
|
||||
|
||||
// Extract text links for each protocol
|
||||
foreach ((array)$protocols as $protocol) {
|
||||
switch ($protocol) {
|
||||
case 'http':
|
||||
case 'https': $value = preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) { if ($match[1]) $protocol = $match[1]; $link = $match[2] ?: $match[3]; return '<' . array_push($links, "<a $attr href=\"$protocol://$link\">$protocol://$link</a>") . '>'; }, $value); break;
|
||||
default: $value = preg_replace_callback('~' . preg_quote($protocol, '~') . '://([^\s<]+?)(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) { return '<' . array_push($links, "<a $attr href=\"$protocol://{$match[1]}\">$protocol://{$match[1]}</a>") . '>'; }, $value); break;
|
||||
case 'https':
|
||||
$value = preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) {
|
||||
if ($match[1]) $protocol = $match[1];
|
||||
$link = $match[2] ?: $match[3];
|
||||
return '<' . array_push($links, "<a $attr href=\"$protocol://$link\">$protocol://$link</a>") . '>';
|
||||
}, $value);
|
||||
break;
|
||||
default:
|
||||
$value = preg_replace_callback('~' . preg_quote($protocol, '~') . '://([^\s<]+?)(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) {
|
||||
return '<' . array_push($links, "<a $attr href=\"$protocol://{$match[1]}\">$protocol://{$match[1]}</a>") . '>';
|
||||
}, $value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert all link
|
||||
return preg_replace_callback('/<(\d+)>/', function ($match) use (&$links) { return $links[$match[1] - 1]; }, $value);
|
||||
}
|
||||
return preg_replace_callback('/<(\d+)>/', function ($match) use (&$links) {
|
||||
return $links[$match[1] - 1];
|
||||
}, $value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getRecentreport($conn, $count)
|
||||
{
|
||||
function getRecentreport($conn, $count) {
|
||||
$query = $conn->prepare("SELECT id, m_report, p_report, rep_reason, t_report FROM user_reports
|
||||
ORDER BY id DESC
|
||||
LIMIT 0 , ?");
|
||||
|
@ -133,8 +134,7 @@ function getRecentreport($conn, $count)
|
|||
}
|
||||
|
||||
|
||||
function getUserRecom($conn,$p_member)
|
||||
{
|
||||
function getUserRecom($conn, $p_member) {
|
||||
$query = $conn->prepare("SELECT id, member, title, visible
|
||||
FROM pastes where member= ? AND visible = '0'
|
||||
ORDER BY id DESC
|
||||
|
@ -154,7 +154,7 @@ function recentupdate($conn, $count) {
|
|||
function monthpop($conn, $count) {
|
||||
$p_month = date('F');
|
||||
$query = $conn->prepare("SELECT s_date, views, title, id, now_time, visible, tagsys, member FROM pastes WHERE s_date LIKE ? AND visible = '0' ORDER BY views + 0 DESC LIMIT 10, ?");
|
||||
$query->execute([$p_month,$count]);
|
||||
$query->execute([$p_month, $count]);
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
|
@ -163,16 +163,15 @@ function isValidEmail($email) {
|
|||
return filter_var($email, FILTER_VALIDATE_EMAIL)
|
||||
&& preg_match('/@.+\./', $email);
|
||||
}
|
||||
function formatBytes($size, $precision = 2)
|
||||
{
|
||||
|
||||
function formatBytes($size, $precision = 2) {
|
||||
$base = log($size, 1024);
|
||||
$suffixes = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||
|
||||
return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
|
||||
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)];
|
||||
}
|
||||
|
||||
function str_conntains($haystack, $needle, $ignoreCase = false)
|
||||
{
|
||||
function str_conntains($haystack, $needle, $ignoreCase = false) {
|
||||
if ($ignoreCase) {
|
||||
$haystack = strtolower($haystack);
|
||||
$needle = strtolower($needle);
|
||||
|
@ -181,29 +180,25 @@ function str_conntains($haystack, $needle, $ignoreCase = false)
|
|||
return ($needlePos === false ? false : ($needlePos + 1));
|
||||
}
|
||||
|
||||
function encrypt($value)
|
||||
{
|
||||
function encrypt($value) {
|
||||
$salt = $sec_key;
|
||||
$encrypted_string=openssl_encrypt($value,"AES-256-CBC",$salt);
|
||||
$encrypted_string = openssl_encrypt($value, "AES-256-CBC", $salt);
|
||||
return $encrypted_string;
|
||||
}
|
||||
|
||||
function decrypt($value)
|
||||
{
|
||||
function decrypt($value) {
|
||||
$salt = $sec_key;
|
||||
$decrypted_string=openssl_decrypt($value,"AES-256-CBC",$salt);
|
||||
$decrypted_string = openssl_decrypt($value, "AES-256-CBC", $salt);
|
||||
return $decrypted_string;
|
||||
}
|
||||
|
||||
function deleteMyPaste($conn, $paste_id)
|
||||
{
|
||||
function deleteMyPaste($conn, $paste_id) {
|
||||
$query = "DELETE FROM pastes where id='$paste_id'";
|
||||
$result = mysqli_query($conn, $query);
|
||||
}
|
||||
|
||||
|
||||
function getRecent($conn, $count)
|
||||
{
|
||||
function getRecent($conn, $count) {
|
||||
$query = $conn->prepare("SELECT id, visible, title, date, now_time, member, tagsys
|
||||
FROM pastes where visible='0'
|
||||
ORDER BY id DESC
|
||||
|
@ -212,16 +207,15 @@ LIMIT ?");
|
|||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function getRecentadmin($conn, $count = 5)
|
||||
{
|
||||
function getRecentadmin($conn, $count = 5) {
|
||||
$query = $conn->prepare('SELECT id, ip title, date, now_time, s_date, views, member FROM pastes ORDER BY id DESC LIMIT 0, ?');
|
||||
$query->execute([$count]);
|
||||
|
||||
return $query->fetchAll();
|
||||
}
|
||||
function getpopular($conn, $count)
|
||||
{
|
||||
$query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member, tagsys
|
||||
|
||||
function getpopular($conn, $count) {
|
||||
$query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member, tagsys
|
||||
FROM pastes WHERE visible='0'
|
||||
ORDER BY views + 0 DESC
|
||||
LIMIT 0, ?");
|
||||
|
@ -229,8 +223,7 @@ LIMIT 0, ?");
|
|||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function getrandom($conn, $count)
|
||||
{
|
||||
function getrandom($conn, $count) {
|
||||
$query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member, tagsys
|
||||
FROM pastes where visible='0'
|
||||
ORDER BY RAND()
|
||||
|
@ -239,26 +232,23 @@ LIMIT ?");
|
|||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function getUserRecent($conn, $count, $username)
|
||||
{
|
||||
$query = $conn->prepare("SELECT id, member, title, date, now_time
|
||||
function getUserRecent($conn, $count, $username) {
|
||||
$query = $conn->prepare("SELECT id, member, title, date, now_time
|
||||
FROM pastes where member=?
|
||||
ORDER BY id DESC
|
||||
LIMIT 0 , ?");
|
||||
$query->execute([$username,$count]);
|
||||
$query->execute([$username, $count]);
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
function getUserPastes($conn, $username)
|
||||
{
|
||||
function getUserPastes($conn, $username) {
|
||||
$query = $conn->prepare("SELECT id, title, code, views, s_date, now_time, visible, date, tagsys, member FROM pastes where member=? ORDER by id DESC");
|
||||
$query->execute([$username]);
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function jsonView($paste_id, $p_title, $p_conntent, $p_code)
|
||||
{
|
||||
function jsonView($paste_id, $p_title, $p_conntent, $p_code) {
|
||||
$stats = false;
|
||||
if ($p_code) {
|
||||
// Raw
|
||||
|
@ -273,9 +263,7 @@ function jsonView($paste_id, $p_title, $p_conntent, $p_code)
|
|||
}
|
||||
|
||||
|
||||
|
||||
function getTotalPastes($conn, $username)
|
||||
{
|
||||
function getTotalPastes($conn, $username) {
|
||||
$count = 0;
|
||||
$query = $conn->prepare("SELECT member FROM pastes WHERE member=?");
|
||||
$query->execute([$username]);
|
||||
|
@ -293,11 +281,10 @@ function existingUser(PDO $conn, string $username) : bool {
|
|||
$query = $conn->prepare('SELECT 1 FROM users WHERE username = ?');
|
||||
$query->execute([$username]);
|
||||
|
||||
return (bool) $query->fetch();
|
||||
return (bool)$query->fetch();
|
||||
}
|
||||
|
||||
function updateMyView($conn, $paste_id)
|
||||
{
|
||||
function updateMyView($conn, $paste_id) {
|
||||
$query = $conn->prepare("SELECT views, id FROM pastes WHERE id= ?");
|
||||
$query->execute([$paste_id]);
|
||||
if ($row = $query->fetch()) {
|
||||
|
@ -344,8 +331,7 @@ function conTime($secs) {
|
|||
return $val;
|
||||
}
|
||||
|
||||
function truncate($input, $maxWords, $maxChars)
|
||||
{
|
||||
function truncate($input, $maxWords, $maxChars) {
|
||||
$words = preg_split('/\s+/', $input);
|
||||
$words = array_slice($words, 0, $maxWords);
|
||||
$words = array_reverse($words);
|
||||
|
@ -367,8 +353,9 @@ function truncate($input, $maxWords, $maxChars)
|
|||
|
||||
return $result . ($input == $result ? '' : '[...]');
|
||||
}
|
||||
function truncatetag($input, $maxWords, $maxChars)
|
||||
{$str = $input;
|
||||
|
||||
function truncatetag($input, $maxWords, $maxChars) {
|
||||
$str = $input;
|
||||
$pattern = '/,/i';
|
||||
$words = preg_replace($pattern, ' ', $str);
|
||||
$words = preg_split('/\s+/', $input);
|
||||
|
@ -392,8 +379,8 @@ function truncatetag($input, $maxWords, $maxChars)
|
|||
|
||||
return $result . ($input == $result ? '' : '...');
|
||||
}
|
||||
function doDownload($paste_id, $p_title, $p_member, $p_conntent, $p_code)
|
||||
{
|
||||
|
||||
function doDownload($paste_id, $p_title, $p_member, $p_conntent, $p_code) {
|
||||
$stats = false;
|
||||
if ($p_code) {
|
||||
// Figure out extensions.
|
||||
|
@ -417,8 +404,7 @@ function doDownload($paste_id, $p_title, $p_member, $p_conntent, $p_code)
|
|||
return $stats;
|
||||
}
|
||||
|
||||
function rawView($paste_id, $p_title, $p_conntent, $p_code)
|
||||
{
|
||||
function rawView($paste_id, $p_title, $p_conntent, $p_code) {
|
||||
$stats = false;
|
||||
if ($p_code) {
|
||||
// Raw
|
||||
|
@ -433,10 +419,9 @@ function rawView($paste_id, $p_title, $p_conntent, $p_code)
|
|||
}
|
||||
|
||||
|
||||
|
||||
function embedView( $paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl, $ges_style, $lang ) {
|
||||
function embedView($paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl, $ges_style, $lang) {
|
||||
$stats = false;
|
||||
if ( $p_conntent ) {
|
||||
if ($p_conntent) {
|
||||
// Build the output
|
||||
$output = "<div class='paste_embed_conntainer'>";
|
||||
$output .= "<style>"; // Add our own styles
|
||||
|
@ -487,24 +472,23 @@ function embedView( $paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl,
|
|||
$output .= "$ges_style"; // Dynamic GeSHI Style
|
||||
$output .= $p_conntent; // Paste conntent
|
||||
$output .= "<div class='paste_embed_footer'>";
|
||||
$output .= "<a href='https://ponepaste.org/$paste_id'>$p_title</a> " . $lang['embed-hosted-by'] . " <a href='https://ponepaste.org'>$title</a> | <a href='https://ponepaste.org/raw/$paste_id'>" . strtolower( $lang['view-raw'] ) . "</a>";
|
||||
$output .= "<a href='https://ponepaste.org/$paste_id'>$p_title</a> " . $lang['embed-hosted-by'] . " <a href='https://ponepaste.org'>$title</a> | <a href='https://ponepaste.org/raw/$paste_id'>" . strtolower($lang['view-raw']) . "</a>";
|
||||
$output .= "</div>";
|
||||
$output .= "</div>";
|
||||
|
||||
// Display embed conntent using json_encode since that escapes
|
||||
// characters well enough to satisfy javascript. http://stackoverflow.com/a/169035
|
||||
header( 'conntent-type: text/javascript; charset=utf-8;' );
|
||||
echo 'document.write(' . json_encode( $output ) . ')';
|
||||
header('conntent-type: text/javascript; charset=utf-8;');
|
||||
echo 'document.write(' . json_encode($output) . ')';
|
||||
$stats = true;
|
||||
} else {
|
||||
// 404
|
||||
header( 'HTTP/1.1 404 Not Found' );
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
}
|
||||
return $stats;
|
||||
}
|
||||
|
||||
function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite)
|
||||
{
|
||||
function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite) {
|
||||
$c_date = date('Y-m-d');
|
||||
$site_data = file_get_contents("sitemap.xml");
|
||||
$site_data = str_replace("</urlset>", "", $site_data);
|
||||
|
@ -518,7 +502,7 @@ function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite)
|
|||
}
|
||||
|
||||
$c_sitemap =
|
||||
' <url>
|
||||
' <url>
|
||||
<loc>' . $server_name . '</loc>
|
||||
<priority>' . $priority . '</priority>
|
||||
<changefreq>' . $changefreq . '</changefreq>
|
||||
|
@ -529,9 +513,10 @@ function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite)
|
|||
$full_map = $site_data . $c_sitemap;
|
||||
file_put_contents("sitemap.xml", $full_map);
|
||||
}
|
||||
|
||||
function paste_protocol() {
|
||||
|
||||
$protocol = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == "on" ) ? 'https://' : 'http://';
|
||||
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
|
||||
|
||||
return $protocol;
|
||||
}
|
||||
|
@ -540,6 +525,7 @@ function is_banned($conn, $ip) {
|
|||
$query = $conn->prepare('SELECT 1 FROM ban_user WHERE ip = ?');
|
||||
$query->execute([$ip]);
|
||||
|
||||
return (bool) $query->fetch();
|
||||
return (bool)$query->fetch();
|
||||
}
|
||||
|
||||
?>
|
|
@ -52,7 +52,8 @@ if (!defined('GESHI_ROOT')) {
|
|||
define('GESHI_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
/** The language file directory for GeSHi
|
||||
@access private */
|
||||
* @access private
|
||||
*/
|
||||
define('GESHI_LANG_ROOT', GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR);
|
||||
|
||||
// Define if GeSHi should be paranoid about security
|
||||
|
@ -126,7 +127,7 @@ define('GESHI_END_IMPORTANT', '<END GeSHi>');
|
|||
/** Strict mode never applies (this is the most common) */
|
||||
define('GESHI_NEVER', 0);
|
||||
/** Strict mode *might* apply, and can be enabled or
|
||||
disabled by {@link GeSHi->enable_strict_mode()} */
|
||||
* disabled by {@link GeSHi->enable_strict_mode()} */
|
||||
define('GESHI_MAYBE', 1);
|
||||
/** Strict mode always applies */
|
||||
define('GESHI_ALWAYS', 2);
|
||||
|
@ -135,32 +136,32 @@ define('GESHI_ALWAYS', 2);
|
|||
/** The key of the regex array defining what to search for */
|
||||
define('GESHI_SEARCH', 0);
|
||||
/** The key of the regex array defining what bracket group in a
|
||||
matched search to use as a replacement */
|
||||
* matched search to use as a replacement */
|
||||
define('GESHI_REPLACE', 1);
|
||||
/** The key of the regex array defining any modifiers to the regular expression */
|
||||
define('GESHI_MODIFIERS', 2);
|
||||
/** The key of the regex array defining what bracket group in a
|
||||
matched search to put before the replacement */
|
||||
* matched search to put before the replacement */
|
||||
define('GESHI_BEFORE', 3);
|
||||
/** The key of the regex array defining what bracket group in a
|
||||
matched search to put after the replacement */
|
||||
* matched search to put after the replacement */
|
||||
define('GESHI_AFTER', 4);
|
||||
/** The key of the regex array defining a custom keyword to use
|
||||
for this regexp's html tag class */
|
||||
* for this regexp's html tag class */
|
||||
define('GESHI_CLASS', 5);
|
||||
|
||||
/** Used in language files to mark comments */
|
||||
define('GESHI_COMMENTS', 0);
|
||||
|
||||
/** some old PHP / PCRE subpatterns only support up to xxx subpatterns in
|
||||
regular expressions. Set this to false if your PCRE lib is up to date
|
||||
@see GeSHi->optimize_regexp_list()
|
||||
* regular expressions. Set this to false if your PCRE lib is up to date
|
||||
* @see GeSHi->optimize_regexp_list()
|
||||
**/
|
||||
define('GESHI_MAX_PCRE_SUBPATTERNS', 500);
|
||||
/** it's also important not to generate too long regular expressions
|
||||
be generous here... but keep in mind, that when reaching this limit we
|
||||
still have to close open patterns. 12k should do just fine on a 16k limit.
|
||||
@see GeSHi->optimize_regexp_list()
|
||||
* be generous here... but keep in mind, that when reaching this limit we
|
||||
* still have to close open patterns. 12k should do just fine on a 16k limit.
|
||||
* @see GeSHi->optimize_regexp_list()
|
||||
**/
|
||||
define('GESHI_MAX_PCRE_LENGTH', 12288);
|
||||
|
||||
|
@ -562,10 +563,10 @@ class GeSHi {
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($source = '', $language = '', $path = '') {
|
||||
if ( is_string($source) && ($source !== '') ) {
|
||||
if (is_string($source) && ($source !== '')) {
|
||||
$this->set_source($source);
|
||||
}
|
||||
if ( is_string($language) && ($language !== '') ) {
|
||||
if (is_string($language) && ($language !== '')) {
|
||||
$this->set_language($language);
|
||||
}
|
||||
|
||||
|
@ -578,8 +579,7 @@ class GeSHi {
|
|||
* @return string
|
||||
* @since 1.0.8.11
|
||||
*/
|
||||
public function get_version()
|
||||
{
|
||||
public function get_version() {
|
||||
return GESHI_VERSION;
|
||||
}
|
||||
|
||||
|
@ -687,25 +687,25 @@ class GeSHi {
|
|||
* so this method will disappear in 1.2.0.
|
||||
*/
|
||||
public function set_language_path($path) {
|
||||
if(strpos($path,':')) {
|
||||
if (strpos($path, ':')) {
|
||||
//Security Fix to prevent external directories using fopen wrappers.
|
||||
if(DIRECTORY_SEPARATOR == "\\") {
|
||||
if(!preg_match('#^[a-zA-Z]:#', $path) || false !== strpos($path, ':', 2)) {
|
||||
if (DIRECTORY_SEPARATOR == "\\") {
|
||||
if (!preg_match('#^[a-zA-Z]:#', $path) || false !== strpos($path, ':', 2)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(preg_match('#[^/a-zA-Z0-9_\.\-\\\s:]#', $path)) {
|
||||
if (preg_match('#[^/a-zA-Z0-9_\.\-\\\s:]#', $path)) {
|
||||
//Security Fix to prevent external directories using fopen wrappers.
|
||||
return;
|
||||
}
|
||||
if(GESHI_SECURITY_PARANOID && false !== strpos($path, '/.')) {
|
||||
if (GESHI_SECURITY_PARANOID && false !== strpos($path, '/.')) {
|
||||
//Security Fix to prevent external directories using fopen wrappers.
|
||||
return;
|
||||
}
|
||||
if(GESHI_SECURITY_PARANOID && false !== strpos($path, '..')) {
|
||||
if (GESHI_SECURITY_PARANOID && false !== strpos($path, '..')) {
|
||||
//Security Fix to prevent external directories using fopen wrappers.
|
||||
return;
|
||||
}
|
||||
|
@ -720,8 +720,7 @@ class GeSHi {
|
|||
* @param boolean $full_names
|
||||
* @return array
|
||||
*/
|
||||
public function get_supported_languages($full_names=false)
|
||||
{
|
||||
public function get_supported_languages($full_names = false) {
|
||||
// return array
|
||||
$back = array();
|
||||
|
||||
|
@ -729,9 +728,8 @@ class GeSHi {
|
|||
$dir = dir($this->language_path);
|
||||
|
||||
// foreach entry
|
||||
while (false !== ($entry = $dir->read()))
|
||||
{
|
||||
$full_path = $this->language_path.$entry;
|
||||
while (false !== ($entry = $dir->read())) {
|
||||
$full_path = $this->language_path . $entry;
|
||||
|
||||
// Skip all dirs
|
||||
if (is_dir($full_path)) {
|
||||
|
@ -747,15 +745,11 @@ class GeSHi {
|
|||
$langname = $matches[1];
|
||||
|
||||
// We want the fullname too?
|
||||
if ($full_names === true)
|
||||
{
|
||||
if (false !== ($fullname = $this->get_language_fullname($langname)))
|
||||
{
|
||||
if ($full_names === true) {
|
||||
if (false !== ($fullname = $this->get_language_fullname($langname))) {
|
||||
$back[$langname] = $fullname; // we go associative
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// just store raw langname
|
||||
$back[] = $langname;
|
||||
}
|
||||
|
@ -771,15 +765,14 @@ class GeSHi {
|
|||
* @param string $language short langname (html4strict for example)
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_language_fullname($language)
|
||||
{
|
||||
public function get_language_fullname($language) {
|
||||
//Clean up the language name to prevent malicious code injection
|
||||
$language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);
|
||||
|
||||
$language = strtolower($language);
|
||||
|
||||
// get fullpath-filename for a langname
|
||||
$fullpath = $this->language_path.$language.'.php';
|
||||
$fullpath = $this->language_path . $language . '.php';
|
||||
|
||||
// we need to get contents :S
|
||||
if (false === ($data = file_get_contents($fullpath))) {
|
||||
|
@ -962,14 +955,14 @@ class GeSHi {
|
|||
* @since 1.0.7.22
|
||||
*/
|
||||
public function enable_multiline_span($flag) {
|
||||
$this->allow_multiline_span = (bool) $flag;
|
||||
$this->allow_multiline_span = (bool)$flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current setting for multiline spans, see GeSHi->enable_multiline_span().
|
||||
*
|
||||
* @see enable_multiline_span
|
||||
* @return bool
|
||||
* @see enable_multiline_span
|
||||
*/
|
||||
public function get_multiline_span() {
|
||||
return $this->allow_multiline_span;
|
||||
|
@ -988,8 +981,8 @@ class GeSHi {
|
|||
*/
|
||||
public function set_keyword_group_style($key, $style, $preserve_defaults = false) {
|
||||
//Set the style for this keyword group
|
||||
if('*' == $key) {
|
||||
foreach($this->language_data['STYLES']['KEYWORDS'] as $_key => $_value) {
|
||||
if ('*' == $key) {
|
||||
foreach ($this->language_data['STYLES']['KEYWORDS'] as $_key => $_value) {
|
||||
if (!$preserve_defaults) {
|
||||
$this->language_data['STYLES']['KEYWORDS'][$_key] = $style;
|
||||
} else {
|
||||
|
@ -1033,8 +1026,8 @@ class GeSHi {
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public function set_comments_style($key, $style, $preserve_defaults = false) {
|
||||
if('*' == $key) {
|
||||
foreach($this->language_data['STYLES']['COMMENTS'] as $_key => $_value) {
|
||||
if ('*' == $key) {
|
||||
foreach ($this->language_data['STYLES']['COMMENTS'] as $_key => $_value) {
|
||||
if (!$preserve_defaults) {
|
||||
$this->language_data['STYLES']['COMMENTS'][$_key] = $style;
|
||||
} else {
|
||||
|
@ -1147,7 +1140,7 @@ class GeSHi {
|
|||
|
||||
// For backward compatibility
|
||||
if (0 == $group) {
|
||||
$this->set_brackets_style ($style, $preserve_defaults);
|
||||
$this->set_brackets_style($style, $preserve_defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1155,7 @@ class GeSHi {
|
|||
$this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false;
|
||||
|
||||
// For backward compatibility
|
||||
$this->set_brackets_highlighting ($flag);
|
||||
$this->set_brackets_highlighting($flag);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1358,7 +1351,7 @@ class GeSHi {
|
|||
* @since 1.0.7.20
|
||||
*/
|
||||
public function set_use_language_tab_width($use) {
|
||||
$this->use_language_tab_width = (bool) $use;
|
||||
$this->use_language_tab_width = (bool)$use;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1408,8 +1401,8 @@ class GeSHi {
|
|||
* The optional flag parameter was added in version 1.0.7.21 and can be used
|
||||
* to enable (true) or disable (false) all highlighting.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param boolean $flag A flag specifying whether to enable or disable all highlighting
|
||||
* @since 1.0.0
|
||||
* @todo Rewrite with array traversal
|
||||
*/
|
||||
public function enable_highlighting($flag = true) {
|
||||
|
@ -1434,20 +1427,20 @@ class GeSHi {
|
|||
*
|
||||
* @param string $extension The extension to get a language name for
|
||||
* @param array $lookup A lookup array to use instead of the default one
|
||||
* @since 1.0.5
|
||||
* @return int|string
|
||||
* @todo Re-think about how this method works (maybe make it private and/or make it
|
||||
* a extension->lang lookup?)
|
||||
* @return int|string
|
||||
* @since 1.0.5
|
||||
*/
|
||||
public static function get_language_name_from_extension( $extension, $lookup = array() ) {
|
||||
public static function get_language_name_from_extension($extension, $lookup = array()) {
|
||||
$extension = strtolower($extension);
|
||||
|
||||
if ( !is_array($lookup) || empty($lookup)) {
|
||||
if (!is_array($lookup) || empty($lookup)) {
|
||||
$lookup = array(
|
||||
'6502acme' => array( 'a', 's', 'asm', 'inc' ),
|
||||
'6502tasm' => array( 'a', 's', 'asm', 'inc' ),
|
||||
'6502kickass' => array( 'a', 's', 'asm', 'inc' ),
|
||||
'68000devpac' => array( 'a', 's', 'asm', 'inc' ),
|
||||
'6502acme' => array('a', 's', 'asm', 'inc'),
|
||||
'6502tasm' => array('a', 's', 'asm', 'inc'),
|
||||
'6502kickass' => array('a', 's', 'asm', 'inc'),
|
||||
'68000devpac' => array('a', 's', 'asm', 'inc'),
|
||||
'abap' => array('abap'),
|
||||
'actionscript' => array('as'),
|
||||
'ada' => array('a', 'ada', 'adb', 'ads'),
|
||||
|
@ -1609,11 +1602,11 @@ class GeSHi {
|
|||
* @param string $styles The styles for the keyword group
|
||||
* @param boolean $case_sensitive Whether the keyword group is case sensitive ornot
|
||||
* @param array $words The words to use for the keyword group
|
||||
* @since 1.0.0
|
||||
* @return bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) {
|
||||
$words = (array) $words;
|
||||
$words = (array)$words;
|
||||
if (empty($words)) {
|
||||
// empty word lists mess up highlighting
|
||||
return false;
|
||||
|
@ -1638,7 +1631,7 @@ class GeSHi {
|
|||
* @param int $key The key of the keyword group to remove
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function remove_keyword_group ($key) {
|
||||
public function remove_keyword_group($key) {
|
||||
//Remove the keyword group internally
|
||||
unset($this->language_data['KEYWORDS'][$key]);
|
||||
unset($this->lexic_permissions['KEYWORDS'][$key]);
|
||||
|
@ -1659,20 +1652,20 @@ class GeSHi {
|
|||
$this->language_data['CACHED_KEYWORD_LISTS'][$key] =
|
||||
$this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]);
|
||||
$space_as_whitespace = false;
|
||||
if(isset($this->language_data['PARSER_CONTROL'])) {
|
||||
if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
|
||||
if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) {
|
||||
if (isset($this->language_data['PARSER_CONTROL'])) {
|
||||
if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
|
||||
if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) {
|
||||
$space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'];
|
||||
}
|
||||
if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
|
||||
if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
|
||||
if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
|
||||
if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
|
||||
$space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($space_as_whitespace) {
|
||||
foreach($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) {
|
||||
if ($space_as_whitespace) {
|
||||
foreach ($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) {
|
||||
$this->language_data['CACHED_KEYWORD_LISTS'][$key][$rxk] =
|
||||
str_replace(" ", "\\s+", $rxv);
|
||||
}
|
||||
|
@ -1788,7 +1781,7 @@ class GeSHi {
|
|||
* @since 1.0.2
|
||||
*/
|
||||
public function enable_important_blocks($flag) {
|
||||
$this->enable_important_blocks = ( $flag ) ? true : false;
|
||||
$this->enable_important_blocks = ($flag) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1902,7 +1895,7 @@ class GeSHi {
|
|||
* @since 1.0.2
|
||||
*/
|
||||
public function enable_keyword_links($enable = true) {
|
||||
$this->keyword_links = (bool) $enable;
|
||||
$this->keyword_links = (bool)$enable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1915,38 +1908,38 @@ class GeSHi {
|
|||
*/
|
||||
protected function build_style_cache() {
|
||||
//Build the style cache needed to highlight numbers appropriate
|
||||
if($this->lexic_permissions['NUMBERS']) {
|
||||
if ($this->lexic_permissions['NUMBERS']) {
|
||||
//First check what way highlighting information for numbers are given
|
||||
if(!isset($this->language_data['NUMBERS'])) {
|
||||
if (!isset($this->language_data['NUMBERS'])) {
|
||||
$this->language_data['NUMBERS'] = 0;
|
||||
}
|
||||
|
||||
if(is_array($this->language_data['NUMBERS'])) {
|
||||
if (is_array($this->language_data['NUMBERS'])) {
|
||||
$this->language_data['NUMBERS_CACHE'] = $this->language_data['NUMBERS'];
|
||||
} else {
|
||||
$this->language_data['NUMBERS_CACHE'] = array();
|
||||
if(!$this->language_data['NUMBERS']) {
|
||||
if (!$this->language_data['NUMBERS']) {
|
||||
$this->language_data['NUMBERS'] =
|
||||
GESHI_NUMBER_INT_BASIC |
|
||||
GESHI_NUMBER_FLT_NONSCI;
|
||||
}
|
||||
|
||||
for($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j>>=1) {
|
||||
for ($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j >>= 1) {
|
||||
//Rearrange style indices if required ...
|
||||
if(isset($this->language_data['STYLES']['NUMBERS'][1<<$i])) {
|
||||
if (isset($this->language_data['STYLES']['NUMBERS'][1 << $i])) {
|
||||
$this->language_data['STYLES']['NUMBERS'][$i] =
|
||||
$this->language_data['STYLES']['NUMBERS'][1<<$i];
|
||||
unset($this->language_data['STYLES']['NUMBERS'][1<<$i]);
|
||||
$this->language_data['STYLES']['NUMBERS'][1 << $i];
|
||||
unset($this->language_data['STYLES']['NUMBERS'][1 << $i]);
|
||||
}
|
||||
|
||||
//Check if this bit is set for highlighting
|
||||
if($j&1) {
|
||||
if ($j & 1) {
|
||||
//So this bit is set ...
|
||||
//Check if it belongs to group 0 or the actual stylegroup
|
||||
if(isset($this->language_data['STYLES']['NUMBERS'][$i])) {
|
||||
if (isset($this->language_data['STYLES']['NUMBERS'][$i])) {
|
||||
$this->language_data['NUMBERS_CACHE'][$i] = 1 << $i;
|
||||
} else {
|
||||
if(!isset($this->language_data['NUMBERS_CACHE'][0])) {
|
||||
if (!isset($this->language_data['NUMBERS_CACHE'][0])) {
|
||||
$this->language_data['NUMBERS_CACHE'][0] = 0;
|
||||
}
|
||||
$this->language_data['NUMBERS_CACHE'][0] |= 1 << $i;
|
||||
|
@ -2047,8 +2040,7 @@ class GeSHi {
|
|||
'<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">{|>',
|
||||
'<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">}|>',
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->language_data['CACHE_BRACKET_REPLACE'] = array(
|
||||
'<| class="br0">[|>',
|
||||
'<| class="br0">]|>',
|
||||
|
@ -2061,10 +2053,10 @@ class GeSHi {
|
|||
}
|
||||
|
||||
//Build the parse cache needed to highlight numbers appropriate
|
||||
if($this->lexic_permissions['NUMBERS']) {
|
||||
if ($this->lexic_permissions['NUMBERS']) {
|
||||
//Check if the style rearrangements have been processed ...
|
||||
//This also does some preprocessing to check which style groups are useable ...
|
||||
if(!isset($this->language_data['NUMBERS_CACHE'])) {
|
||||
if (!isset($this->language_data['NUMBERS_CACHE'])) {
|
||||
$this->build_style_cache();
|
||||
}
|
||||
|
||||
|
@ -2108,15 +2100,15 @@ class GeSHi {
|
|||
//At this step we have an associative array with flag groups for a
|
||||
//specific style or an string denoting a regexp given its index.
|
||||
$this->language_data['NUMBERS_RXCACHE'] = array();
|
||||
foreach($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) {
|
||||
if(is_string($rxdata)) {
|
||||
foreach ($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) {
|
||||
if (is_string($rxdata)) {
|
||||
$regexp = $rxdata;
|
||||
} else {
|
||||
//This is a bitfield of number flags to highlight:
|
||||
//Build an array, implode them together and make this the actual RX
|
||||
$rxuse = array();
|
||||
for($i = 1; $i <= $rxdata; $i<<=1) {
|
||||
if($rxdata & $i) {
|
||||
for ($i = 1; $i <= $rxdata; $i <<= 1) {
|
||||
if ($rxdata & $i) {
|
||||
$rxuse[] = $numbers_format[$i];
|
||||
}
|
||||
}
|
||||
|
@ -2127,7 +2119,7 @@ class GeSHi {
|
|||
"/(?<!<\|\/)(?<!<\|!REG3XP)(?<!<\|\/NUM!)(?<!\d\/>)($regexp)(?!(?:<DOT>|(?>[^\<]))+>)(?![^<]*>)(?!\|>)(?!\/>)/i";
|
||||
}
|
||||
|
||||
if(!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) {
|
||||
if (!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) {
|
||||
$this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'] = '#\d#';
|
||||
}
|
||||
}
|
||||
|
@ -2145,7 +2137,7 @@ class GeSHi {
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function parse_code () {
|
||||
public function parse_code() {
|
||||
// Start the timer
|
||||
$start_time = microtime();
|
||||
|
||||
|
@ -2198,7 +2190,7 @@ class GeSHi {
|
|||
while ($i < $length) {
|
||||
$next_match_pos = $length + 1; // never true
|
||||
foreach ($delim_copy as $dk => $delimiters) {
|
||||
if(is_array($delimiters)) {
|
||||
if (is_array($delimiters)) {
|
||||
foreach ($delimiters as $open => $close) {
|
||||
// make sure the cache is setup properly
|
||||
if (!isset($matches[$dk][$open])) {
|
||||
|
@ -2227,7 +2219,7 @@ class GeSHi {
|
|||
if ($matches[$dk][$open]['next_match'] < $next_match_pos) {
|
||||
//So we got a new match, update the close_pos
|
||||
$matches[$dk][$open]['close_pos'] =
|
||||
strpos($code, $close, $matches[$dk][$open]['next_match']+1);
|
||||
strpos($code, $close, $matches[$dk][$open]['next_match'] + 1);
|
||||
|
||||
$next_match_pointer =& $matches[$dk][$open];
|
||||
$next_match_pos = $matches[$dk][$open]['next_match'];
|
||||
|
@ -2241,10 +2233,9 @@ class GeSHi {
|
|||
* - Group 1 is the opener
|
||||
* - Group 2 is the closer
|
||||
*/
|
||||
if(preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) {
|
||||
if (preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) {
|
||||
//We got a match ...
|
||||
if(isset($matches_rx['start']) && isset($matches_rx['end']))
|
||||
{
|
||||
if (isset($matches_rx['start']) && isset($matches_rx['end'])) {
|
||||
$matches[$dk] = array(
|
||||
'next_match' => $matches_rx['start'][1],
|
||||
'dk' => $dk,
|
||||
|
@ -2289,7 +2280,7 @@ class GeSHi {
|
|||
$parts[$k][0] = $next_match_pointer['dk'];
|
||||
|
||||
//Only combine for non-rx script blocks
|
||||
if(is_array($delim_copy[$next_match_pointer['dk']])) {
|
||||
if (is_array($delim_copy[$next_match_pointer['dk']])) {
|
||||
// group adjacent script blocks, e.g. <foobar><asdf> should be one block, not three!
|
||||
$i = $next_match_pos + $next_match_pointer['open_strlen'];
|
||||
while (true) {
|
||||
|
@ -2555,7 +2546,7 @@ class GeSHi {
|
|||
if (!$this->use_classes) {
|
||||
$string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS'][$string_key] . '"';
|
||||
} else {
|
||||
$string_attributes = ' class="st'.$string_key.'"';
|
||||
$string_attributes = ' class="st' . $string_key . '"';
|
||||
}
|
||||
|
||||
// now handle the string
|
||||
|
@ -2563,18 +2554,18 @@ class GeSHi {
|
|||
$start = $i + $char_len;
|
||||
$string_open = true;
|
||||
|
||||
if(empty($this->language_data['ESCAPE_REGEXP'])) {
|
||||
if (empty($this->language_data['ESCAPE_REGEXP'])) {
|
||||
$next_escape_regexp_pos = $length;
|
||||
}
|
||||
|
||||
do {
|
||||
//Get the regular ending pos ...
|
||||
$close_pos = strpos($part, $char, $start);
|
||||
if(false === $close_pos) {
|
||||
if (false === $close_pos) {
|
||||
$close_pos = $length;
|
||||
}
|
||||
|
||||
if($this->lexic_permissions['ESCAPE_CHAR']) {
|
||||
if ($this->lexic_permissions['ESCAPE_CHAR']) {
|
||||
// update escape regexp cache if needed
|
||||
if (isset($this->language_data['ESCAPE_REGEXP']) && $next_escape_regexp_pos < $start) {
|
||||
$next_escape_regexp_pos = $length;
|
||||
|
@ -2613,9 +2604,9 @@ class GeSHi {
|
|||
}
|
||||
|
||||
//Find the next simple escape position
|
||||
if('' != $this->language_data['ESCAPE_CHAR']) {
|
||||
if ('' != $this->language_data['ESCAPE_CHAR']) {
|
||||
$simple_escape = strpos($part, $this->language_data['ESCAPE_CHAR'], $start);
|
||||
if(false === $simple_escape) {
|
||||
if (false === $simple_escape) {
|
||||
$simple_escape = $length;
|
||||
}
|
||||
} else {
|
||||
|
@ -2626,7 +2617,7 @@ class GeSHi {
|
|||
$simple_escape = $length;
|
||||
}
|
||||
|
||||
if($simple_escape < $next_escape_regexp_pos &&
|
||||
if ($simple_escape < $next_escape_regexp_pos &&
|
||||
$simple_escape < $length &&
|
||||
$simple_escape < $close_pos) {
|
||||
//The nexxt escape sequence is a simple one ...
|
||||
|
@ -2655,16 +2646,16 @@ class GeSHi {
|
|||
} elseif (ord($es_char) >= 128) {
|
||||
//This is an non-ASCII char (UTF8 or single byte)
|
||||
//This code tries to work around SF#2037598 ...
|
||||
if(function_exists('mb_substr')) {
|
||||
$es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding);
|
||||
if (function_exists('mb_substr')) {
|
||||
$es_char_m = mb_substr(substr($part, $es_pos + 1, 16), 0, 1, $this->encoding);
|
||||
$string .= $es_char_m . '</span>';
|
||||
} elseif ('utf-8' == $this->encoding) {
|
||||
if(preg_match("/[\xC2-\xDF][\x80-\xBF]".
|
||||
"|\xE0[\xA0-\xBF][\x80-\xBF]".
|
||||
"|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}".
|
||||
"|\xED[\x80-\x9F][\x80-\xBF]".
|
||||
"|\xF0[\x90-\xBF][\x80-\xBF]{2}".
|
||||
"|[\xF1-\xF3][\x80-\xBF]{3}".
|
||||
if (preg_match("/[\xC2-\xDF][\x80-\xBF]" .
|
||||
"|\xE0[\xA0-\xBF][\x80-\xBF]" .
|
||||
"|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}" .
|
||||
"|\xED[\x80-\x9F][\x80-\xBF]" .
|
||||
"|\xF0[\x90-\xBF][\x80-\xBF]{2}" .
|
||||
"|[\xF1-\xF3][\x80-\xBF]{3}" .
|
||||
"|\xF4[\x80-\x8F][\x80-\xBF]{2}/s",
|
||||
$part, $es_char_m, null, $es_pos + 1)) {
|
||||
$es_char_m = $es_char_m[0];
|
||||
|
@ -2709,7 +2700,7 @@ class GeSHi {
|
|||
$start = $close_pos + $char_len;
|
||||
$string_open = false;
|
||||
}
|
||||
} while($string_open);
|
||||
} while ($string_open);
|
||||
|
||||
if ($check_linenumbers) {
|
||||
// Are line numbers used? If, we should end the string before
|
||||
|
@ -2929,7 +2920,7 @@ class GeSHi {
|
|||
$test_str = $this->hsc($open);
|
||||
}
|
||||
|
||||
$close_pos = strpos( $part, $close, $i + $open_strlen );
|
||||
$close_pos = strpos($part, $close, $i + $open_strlen);
|
||||
|
||||
if ($close_pos === false) {
|
||||
$close_pos = $length;
|
||||
|
@ -3008,10 +2999,9 @@ class GeSHi {
|
|||
// This check will find special variables like $# in bash
|
||||
// or compiler directives of Delphi beginning {$
|
||||
if ((empty($sc_disallowed_before) || ($i == 0) ||
|
||||
(false === strpos($sc_disallowed_before, $part[$i-1]))) &&
|
||||
(false === strpos($sc_disallowed_before, $part[$i - 1]))) &&
|
||||
(empty($sc_disallowed_after) || ($length <= $i + $com_len) ||
|
||||
(false === strpos($sc_disallowed_after, $part[$i + $com_len]))))
|
||||
{
|
||||
(false === strpos($sc_disallowed_after, $part[$i + $com_len])))) {
|
||||
// this is a valid comment
|
||||
$COMMENT_MATCHED = true;
|
||||
if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
|
||||
|
@ -3144,7 +3134,7 @@ class GeSHi {
|
|||
if (false === $posi) {
|
||||
++$pos;
|
||||
} else {
|
||||
$pos -= $posi+2;
|
||||
$pos -= $posi + 2;
|
||||
}
|
||||
$lines[$key] .= $char;
|
||||
} elseif ("\t" == $char) {
|
||||
|
@ -3159,7 +3149,7 @@ class GeSHi {
|
|||
if (($pos & 1) || 1 == $tab_end_width) {
|
||||
$str .= substr($tab_string, 6, $tab_end_width);
|
||||
} else {
|
||||
$str .= substr($tab_string, 0, $tab_end_width+5);
|
||||
$str .= substr($tab_string, 0, $tab_end_width + 5);
|
||||
}
|
||||
$lines[$key] .= $str;
|
||||
$pos += $tab_end_width;
|
||||
|
@ -3270,7 +3260,7 @@ class GeSHi {
|
|||
}
|
||||
}
|
||||
|
||||
return $before . '<|/'. $k .'/>' . $this->change_case($keyword) . '|>' . $after;
|
||||
return $before . '<|/' . $k . '/>' . $this->change_case($keyword) . '|>' . $after;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3284,7 +3274,7 @@ class GeSHi {
|
|||
*/
|
||||
protected function handle_regexps_callback($matches) {
|
||||
// before: "' style=\"' . call_user_func(\"$func\", '\\1') . '\"\\1|>'",
|
||||
return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"'. $matches[1] . '|>';
|
||||
return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"' . $matches[1] . '|>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3314,7 +3304,7 @@ class GeSHi {
|
|||
$replace = $matches[0];
|
||||
}
|
||||
return $before
|
||||
. '<|!REG3XP' . $this->_hmr_key .'!>'
|
||||
. '<|!REG3XP' . $this->_hmr_key . '!>'
|
||||
. str_replace("\n", "|>\n<|!REG3XP" . $this->_hmr_key . '!>', $replace)
|
||||
. '|>'
|
||||
. $after;
|
||||
|
@ -3325,9 +3315,9 @@ class GeSHi {
|
|||
* stuff like keywords, numbers and methods.
|
||||
*
|
||||
* @param string $stuff_to_parse The string to parse for keyword, numbers etc.
|
||||
* @since 1.0.0
|
||||
* @todo BUGGY! Why? Why not build string and return?
|
||||
* @return string
|
||||
* @todo BUGGY! Why? Why not build string and return?
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected function parse_non_string_part($stuff_to_parse) {
|
||||
$stuff_to_parse = ' ' . $this->hsc($stuff_to_parse);
|
||||
|
@ -3419,18 +3409,18 @@ class GeSHi {
|
|||
} else {
|
||||
$stuff_to_parse = preg_replace(
|
||||
'/' . $regexp[GESHI_SEARCH] . '/' . $regexp[GESHI_MODIFIERS],
|
||||
$regexp[GESHI_BEFORE] . '<|!REG3XP'. $key .'!>' . $regexp[GESHI_REPLACE] . '|>' . $regexp[GESHI_AFTER],
|
||||
$regexp[GESHI_BEFORE] . '<|!REG3XP' . $key . '!>' . $regexp[GESHI_REPLACE] . '|>' . $regexp[GESHI_AFTER],
|
||||
$stuff_to_parse);
|
||||
}
|
||||
} else {
|
||||
if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
|
||||
// produce valid HTML when we match multiple lines
|
||||
$this->_hmr_key = $key;
|
||||
$stuff_to_parse = preg_replace_callback( "/(" . $regexp . ")/",
|
||||
$stuff_to_parse = preg_replace_callback("/(" . $regexp . ")/",
|
||||
array($this, 'handle_multiline_regexps'), $stuff_to_parse);
|
||||
$this->_hmr_key = '';
|
||||
} else {
|
||||
$stuff_to_parse = preg_replace( "/(" . $regexp . ")/", "<|!REG3XP$key!>\\1|>", $stuff_to_parse);
|
||||
$stuff_to_parse = preg_replace("/(" . $regexp . ")/", "<|!REG3XP$key!>\\1|>", $stuff_to_parse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3439,11 +3429,11 @@ class GeSHi {
|
|||
// Highlight numbers. As of 1.0.8 we support different types of numbers
|
||||
$numbers_found = false;
|
||||
|
||||
if ($this->lexic_permissions['NUMBERS'] && preg_match($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'], $stuff_to_parse )) {
|
||||
if ($this->lexic_permissions['NUMBERS'] && preg_match($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'], $stuff_to_parse)) {
|
||||
$numbers_found = true;
|
||||
|
||||
//For each of the formats ...
|
||||
foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
|
||||
foreach ($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
|
||||
//Check if it should be highlighted ...
|
||||
$stuff_to_parse = preg_replace($regexp, "<|/NUM!$id/>\\1|>", $stuff_to_parse);
|
||||
}
|
||||
|
@ -3465,7 +3455,7 @@ class GeSHi {
|
|||
|
||||
if ($numbers_found) {
|
||||
// Put number styles in
|
||||
foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
|
||||
foreach ($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
|
||||
//Commented out for now, as this needs some review ...
|
||||
// if ($numbers_permissions & $id) {
|
||||
//Get the appropriate style ...
|
||||
|
@ -3473,7 +3463,7 @@ class GeSHi {
|
|||
if (!$this->use_classes) {
|
||||
$attributes = ' style="' . $this->language_data['STYLES']['NUMBERS'][$id] . '"';
|
||||
} else {
|
||||
$attributes = ' class="nu'.$id.'"';
|
||||
$attributes = ' class="nu' . $id . '"';
|
||||
}
|
||||
|
||||
//Set in the correct styles ...
|
||||
|
@ -3520,8 +3510,8 @@ class GeSHi {
|
|||
// be highlighting regardless
|
||||
//
|
||||
if ($this->lexic_permissions['BRACKETS']) {
|
||||
$stuff_to_parse = str_replace( $this->language_data['CACHE_BRACKET_MATCH'],
|
||||
$this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse );
|
||||
$stuff_to_parse = str_replace($this->language_data['CACHE_BRACKET_MATCH'],
|
||||
$this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3536,7 +3526,7 @@ class GeSHi {
|
|||
// already highlighted blocks _must_ include either < or >
|
||||
// so if this conditional applies, we have to skip this match
|
||||
// BenBE: UNLESS the block contains <SEMI> or <PIPE>
|
||||
if(strpos($symbol_match, '<SEMI>') === false &&
|
||||
if (strpos($symbol_match, '<SEMI>') === false &&
|
||||
strpos($symbol_match, '<PIPE>') === false) {
|
||||
continue;
|
||||
}
|
||||
|
@ -3638,7 +3628,7 @@ class GeSHi {
|
|||
//
|
||||
|
||||
$stuff_to_parse = str_replace('<|', '<span', $stuff_to_parse);
|
||||
$stuff_to_parse = str_replace ( '|>', '</span>', $stuff_to_parse );
|
||||
$stuff_to_parse = str_replace('|>', '</span>', $stuff_to_parse);
|
||||
return substr($stuff_to_parse, 1);
|
||||
}
|
||||
|
||||
|
@ -3676,10 +3666,10 @@ class GeSHi {
|
|||
|
||||
// check arguments
|
||||
// comment out if more performance is necessary (in this case the foreach loop will trigger a warning if the argument is not an array)
|
||||
for ($i = 0; $i < $narrays; $i ++) {
|
||||
for ($i = 0; $i < $narrays; $i++) {
|
||||
if (!is_array($arrays[$i])) {
|
||||
// also array_merge_recursive returns nothing in this case
|
||||
trigger_error('Argument #' . ($i+1) . ' is not an array - trying to merge array with scalar! Returning false!', E_USER_WARNING);
|
||||
trigger_error('Argument #' . ($i + 1) . ' is not an array - trying to merge array with scalar! Returning false!', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3688,7 +3678,7 @@ class GeSHi {
|
|||
$ret = $arrays[0];
|
||||
|
||||
// merege $ret with the remaining arrays
|
||||
for ($i = 1; $i < $narrays; $i ++) {
|
||||
for ($i = 1; $i < $narrays; $i++) {
|
||||
foreach ($arrays[$i] as $key => $value) {
|
||||
if (is_array($value) && isset($ret[$key])) {
|
||||
// if $ret[$key] is not an array you try to merge an scalar value with an array - the result is not defined (incompatible arrays)
|
||||
|
@ -3780,7 +3770,7 @@ class GeSHi {
|
|||
|
||||
//Fix: Problem where hardescapes weren't handled if no ESCAPE_CHAR was given
|
||||
//You need to set one for HARDESCAPES only in this case.
|
||||
if(!isset($this->language_data['HARDCHAR'])) {
|
||||
if (!isset($this->language_data['HARDCHAR'])) {
|
||||
$this->language_data['HARDCHAR'] = $this->language_data['ESCAPE_CHAR'];
|
||||
}
|
||||
|
||||
|
@ -3929,18 +3919,18 @@ class GeSHi {
|
|||
if ($this->use_classes) {
|
||||
$attributes = ' class="de1"';
|
||||
} else {
|
||||
$attributes = ' style="'. $this->code_style .'"';
|
||||
$attributes = ' style="' . $this->code_style . '"';
|
||||
}
|
||||
if ($this->header_type == GESHI_HEADER_PRE_VALID) {
|
||||
$parsed_code .= '<pre'. $attributes .'>';
|
||||
$parsed_code .= '<pre' . $attributes . '>';
|
||||
} elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
|
||||
if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
|
||||
if ($this->use_classes) {
|
||||
$attrs = ' class="ln"';
|
||||
} else {
|
||||
$attrs = ' style="'. $this->table_linenumber_style .'"';
|
||||
$attrs = ' style="' . $this->table_linenumber_style . '"';
|
||||
}
|
||||
$parsed_code .= '<td'.$attrs.'><pre'.$attributes.'>';
|
||||
$parsed_code .= '<td' . $attrs . '><pre' . $attributes . '>';
|
||||
// get linenumbers
|
||||
// we don't merge it with the for below, since it should be better for
|
||||
// memory consumption this way
|
||||
|
@ -3959,7 +3949,7 @@ class GeSHi {
|
|||
// so that styles applied to special lines don't apply to the actual
|
||||
// code on that line
|
||||
$parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
|
||||
.'<span style="' . $this->code_style .'">';
|
||||
. '<span style="' . $this->code_style . '">';
|
||||
}
|
||||
$close += 2;
|
||||
}
|
||||
|
@ -3983,9 +3973,9 @@ class GeSHi {
|
|||
$parsed_code .= "\n";
|
||||
}
|
||||
}
|
||||
$parsed_code .= '</pre></td><td'.$attributes.'>';
|
||||
$parsed_code .= '</pre></td><td' . $attributes . '>';
|
||||
}
|
||||
$parsed_code .= '<pre'. $attributes .'>';
|
||||
$parsed_code .= '<pre' . $attributes . '>';
|
||||
}
|
||||
// No line numbers, but still need to handle highlighting lines extra.
|
||||
// Have to use divs so the full width of the code is highlighted
|
||||
|
@ -4007,7 +3997,7 @@ class GeSHi {
|
|||
// so that styles applied to special lines don't apply to the actual
|
||||
// code on that line
|
||||
$parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
|
||||
.'<span style="' . $this->code_style .'">';
|
||||
. '<span style="' . $this->code_style . '">';
|
||||
}
|
||||
$close += 2;
|
||||
}
|
||||
|
@ -4030,8 +4020,7 @@ class GeSHi {
|
|||
if ($close) {
|
||||
$parsed_code .= str_repeat('</span>', $close);
|
||||
$close = 0;
|
||||
}
|
||||
elseif ($i + 1 < $n) {
|
||||
} elseif ($i + 1 < $n) {
|
||||
$parsed_code .= "\n";
|
||||
}
|
||||
unset($code[$i]);
|
||||
|
@ -4062,7 +4051,7 @@ class GeSHi {
|
|||
*/
|
||||
$attributes = ' class="' . $this->_genCSSName($this->language);
|
||||
if ($this->overall_class != '') {
|
||||
$attributes .= " ".$this->_genCSSName($this->overall_class);
|
||||
$attributes .= " " . $this->_genCSSName($this->overall_class);
|
||||
}
|
||||
$attributes .= '"';
|
||||
|
||||
|
@ -4163,15 +4152,13 @@ class GeSHi {
|
|||
}
|
||||
return ($this->force_code_block ? '</div>' : '') .
|
||||
"$footer</div>";
|
||||
}
|
||||
elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
|
||||
} elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
|
||||
if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
|
||||
return "</tr></tbody>$footer</table>";
|
||||
}
|
||||
return ($this->force_code_block ? '</div>' : '') .
|
||||
"$footer</div>";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
|
||||
return "</ol>$footer</pre>";
|
||||
}
|
||||
|
@ -4334,7 +4321,7 @@ class GeSHi {
|
|||
|
||||
//Check if the style rearrangements have been processed ...
|
||||
//This also does some preprocessing to check which style groups are useable ...
|
||||
if(!isset($this->language_data['NUMBERS_CACHE'])) {
|
||||
if (!isset($this->language_data['NUMBERS_CACHE'])) {
|
||||
$this->build_style_cache();
|
||||
}
|
||||
|
||||
|
@ -4353,19 +4340,19 @@ class GeSHi {
|
|||
|
||||
// Header of the stylesheet
|
||||
if (!$economy_mode) {
|
||||
$stylesheet = "/**\n".
|
||||
" * GeSHi Dynamically Generated Stylesheet\n".
|
||||
" * --------------------------------------\n".
|
||||
" * Dynamically generated stylesheet for {$this->language}\n".
|
||||
" * CSS class: {$this->overall_class}, CSS id: {$this->overall_id}\n".
|
||||
$stylesheet = "/**\n" .
|
||||
" * GeSHi Dynamically Generated Stylesheet\n" .
|
||||
" * --------------------------------------\n" .
|
||||
" * Dynamically generated stylesheet for {$this->language}\n" .
|
||||
" * CSS class: {$this->overall_class}, CSS id: {$this->overall_id}\n" .
|
||||
" * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2014 Benny Baumann\n" .
|
||||
" * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
|
||||
" * --------------------------------------\n".
|
||||
" * (http://qbnz.com/highlighter/ and http://geshi.org/)\n" .
|
||||
" * --------------------------------------\n" .
|
||||
" */\n";
|
||||
} else {
|
||||
$stylesheet = "/**\n".
|
||||
$stylesheet = "/**\n" .
|
||||
" * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2014 Benny Baumann\n" .
|
||||
" * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
|
||||
" * (http://qbnz.com/highlighter/ and http://geshi.org/)\n" .
|
||||
" */\n";
|
||||
}
|
||||
|
||||
|
@ -4513,7 +4500,7 @@ class GeSHi {
|
|||
}
|
||||
}
|
||||
// Styles for lines being highlighted extra
|
||||
if (!$economy_mode || (count($this->highlight_extra_lines)!=count($this->highlight_extra_lines_styles))) {
|
||||
if (!$economy_mode || (count($this->highlight_extra_lines) != count($this->highlight_extra_lines_styles))) {
|
||||
$stylesheet .= "{$selector}.ln-xtra, {$selector}li.ln-xtra, {$selector}div.ln-xtra {{$this->highlight_extra_lines_style}}\n";
|
||||
}
|
||||
$stylesheet .= "{$selector}span.xtra { display:block; }\n";
|
||||
|
@ -4577,7 +4564,7 @@ class GeSHi {
|
|||
$cur_len = 0;
|
||||
}
|
||||
$level = 0;
|
||||
$entry = preg_quote((string) $list[$i], $regexp_delimiter);
|
||||
$entry = preg_quote((string)$list[$i], $regexp_delimiter);
|
||||
$pointer = &$tokens;
|
||||
// properly assign the new entry to the correct position in the token array
|
||||
// possibly generate smaller common denominator keys
|
||||
|
@ -4655,7 +4642,7 @@ class GeSHi {
|
|||
// make sure the last tokens get converted as well
|
||||
$new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
|
||||
if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + substr_count($new_entry, '(?:') > GESHI_MAX_PCRE_SUBPATTERNS) {
|
||||
if ( !empty($regexp_list[$list_key]) ) {
|
||||
if (!empty($regexp_list[$list_key])) {
|
||||
++$list_key;
|
||||
}
|
||||
$regexp_list[$list_key] = $new_entry;
|
||||
|
@ -4670,11 +4657,11 @@ class GeSHi {
|
|||
|
||||
/**
|
||||
* this function creates the appropriate regexp string of an token array
|
||||
* you should not call this function directly, @see $this->optimize_regexp_list().
|
||||
*
|
||||
* @param array $tokens array of tokens
|
||||
* you should not call this function directly, @param array $tokens array of tokens
|
||||
* @param bool $recursed to know wether we recursed or not
|
||||
* @return string
|
||||
* @see $this->optimize_regexp_list().
|
||||
*
|
||||
* @author Milian Wolff <mail@milianw.de>
|
||||
* @since 1.0.8
|
||||
*/
|
||||
|
@ -4703,7 +4690,7 @@ class GeSHi {
|
|||
$list = preg_replace('#\(\?\:(.)\)\?#', '\1?', $list);
|
||||
// (?:a|b|c|d|...)? => [abcd...]?
|
||||
// TODO: a|bb|c => [ac]|bb
|
||||
$list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', function($matches) {
|
||||
$list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', function ($matches) {
|
||||
return "[" . str_replace("|", "", $matches[1]) . "]";
|
||||
}, $list);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'HTML5',
|
||||
'COMMENT_SINGLE' => array(),
|
||||
'COMMENT_MULTI' => array(),
|
||||
|
@ -135,8 +135,7 @@ $language_data = array (
|
|||
2 => 'color: #000000; font-weight: bold;',
|
||||
3 => 'color: #000066;'
|
||||
),
|
||||
'COMMENTS' => array(
|
||||
),
|
||||
'COMMENTS' => array(),
|
||||
'ESCAPE_CHAR' => array(
|
||||
0 => 'color: #000099; font-weight: bold;'
|
||||
),
|
||||
|
@ -149,8 +148,7 @@ $language_data = array (
|
|||
'NUMBERS' => array(
|
||||
0 => 'color: #cc66cc;'
|
||||
),
|
||||
'METHODS' => array(
|
||||
),
|
||||
'METHODS' => array(),
|
||||
'SYMBOLS' => array(
|
||||
0 => 'color: #66cc66;'
|
||||
),
|
||||
|
@ -161,18 +159,15 @@ $language_data = array (
|
|||
1 => 'color: #ddbb00;',
|
||||
2 => 'color: #009900;'
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
)
|
||||
'REGEXPS' => array()
|
||||
),
|
||||
'URLS' => array(
|
||||
2 => 'http://december.com/html/4/element/{FNAMEL}.html',
|
||||
3 => ''
|
||||
),
|
||||
'OOLANG' => false,
|
||||
'OBJECT_SPLITTERS' => array(
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'OBJECT_SPLITTERS' => array(),
|
||||
'REGEXPS' => array(),
|
||||
'STRICT_MODE_APPLIES' => GESHI_ALWAYS,
|
||||
'SCRIPT_DELIMITERS' => array(
|
||||
-2 => array(
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'Java',
|
||||
'COMMENT_SINGLE' => array(1 => '//'),
|
||||
'COMMENT_MULTI' => array('/*' => '*/'),
|
||||
|
@ -955,10 +955,8 @@ $language_data = array (
|
|||
'SYMBOLS' => array(
|
||||
0 => 'color: #339933;'
|
||||
),
|
||||
'SCRIPT' => array(
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
)
|
||||
'SCRIPT' => array(),
|
||||
'REGEXPS' => array()
|
||||
),
|
||||
'URLS' => array(
|
||||
1 => '',
|
||||
|
@ -970,11 +968,8 @@ $language_data = array (
|
|||
'OBJECT_SPLITTERS' => array(
|
||||
1 => '.'
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'REGEXPS' => array(),
|
||||
'STRICT_MODE_APPLIES' => GESHI_NEVER,
|
||||
'SCRIPT_DELIMITERS' => array(
|
||||
),
|
||||
'HIGHLIGHT_STRICT_BLOCK' => array(
|
||||
)
|
||||
'SCRIPT_DELIMITERS' => array(),
|
||||
'HIGHLIGHT_STRICT_BLOCK' => array()
|
||||
);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'Javascript',
|
||||
'COMMENT_SINGLE' => array(1 => '//'),
|
||||
'COMMENT_MULTI' => array('/*' => '*/'),
|
||||
|
@ -57,26 +57,26 @@ $language_data = array (
|
|||
'KEYWORDS' => array(
|
||||
1 => array(
|
||||
//reserved/keywords; also some non-reserved keywords
|
||||
'break','case','catch','const','continue',
|
||||
'default','delete','do',
|
||||
'break', 'case', 'catch', 'const', 'continue',
|
||||
'default', 'delete', 'do',
|
||||
'else',
|
||||
'finally','for','function',
|
||||
'get','goto',
|
||||
'if','in','instanceof',
|
||||
'finally', 'for', 'function',
|
||||
'get', 'goto',
|
||||
'if', 'in', 'instanceof',
|
||||
'new',
|
||||
'prototype',
|
||||
'return',
|
||||
'set','static','switch',
|
||||
'this','throw','try','typeof',
|
||||
'var','void'
|
||||
'set', 'static', 'switch',
|
||||
'this', 'throw', 'try', 'typeof',
|
||||
'var', 'void'
|
||||
),
|
||||
2 => array(
|
||||
//reserved/non-keywords; metaconstants
|
||||
'false','null','true','undefined','NaN','Infinity'
|
||||
'false', 'null', 'true', 'undefined', 'NaN', 'Infinity'
|
||||
),
|
||||
3 => array(
|
||||
//magic properties/functions
|
||||
'__proto__','__defineGetter__','__defineSetter__','hasOwnProperty','hasProperty'
|
||||
'__proto__', '__defineGetter__', '__defineSetter__', 'hasOwnProperty', 'hasProperty'
|
||||
),
|
||||
4 => array(
|
||||
//type constructors
|
||||
|
@ -84,9 +84,9 @@ $language_data = array (
|
|||
),
|
||||
5 => array(
|
||||
//reserved, but invalid in language
|
||||
'abstract','boolean','byte','char','class','debugger','double','enum','export','extends',
|
||||
'final','float','implements','import','int','interface','long','native',
|
||||
'short','super','synchronized','throws','transient','volatile'
|
||||
'abstract', 'boolean', 'byte', 'char', 'class', 'debugger', 'double', 'enum', 'export', 'extends',
|
||||
'final', 'float', 'implements', 'import', 'int', 'interface', 'long', 'native',
|
||||
'short', 'super', 'synchronized', 'throws', 'transient', 'volatile'
|
||||
),
|
||||
),
|
||||
'SYMBOLS' => array(
|
||||
|
@ -134,8 +134,7 @@ $language_data = array (
|
|||
'SYMBOLS' => array(
|
||||
0 => 'color: #339933;'
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'REGEXPS' => array(),
|
||||
'SCRIPT' => array(
|
||||
0 => '',
|
||||
1 => '',
|
||||
|
@ -154,8 +153,7 @@ $language_data = array (
|
|||
'OBJECT_SPLITTERS' => array(
|
||||
1 => '.'
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'REGEXPS' => array(),
|
||||
'STRICT_MODE_APPLIES' => GESHI_MAYBE,
|
||||
'SCRIPT_DELIMITERS' => array(
|
||||
0 => array(
|
||||
|
|
|
@ -30,14 +30,14 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
/sx';
|
||||
|
||||
function hasShebang($code) {
|
||||
if(preg_match($this->shebang, $code, $m)) {
|
||||
if (preg_match($this->shebang, $code, $m)) {
|
||||
return $m;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _doCodeBlocks_callback($matches) {
|
||||
if($m = $this->hasShebang($matches[1])) {
|
||||
if ($m = $this->hasShebang($matches[1])) {
|
||||
return $this->_doGeshi($m);
|
||||
} else {
|
||||
return parent::_doCodeBlocks_callback($matches);
|
||||
|
@ -45,7 +45,7 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
}
|
||||
|
||||
function _doFencedCodeBlocks_callback($matches) {
|
||||
if($m = $this->hasShebang($matches[2])) {
|
||||
if ($m = $this->hasShebang($matches[2])) {
|
||||
return $this->_doGeshi($m);
|
||||
} else {
|
||||
return parent::_doFencedCodeBlocks_callback($matches);
|
||||
|
@ -54,17 +54,17 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
|
||||
function _doGeshi($shebangMatch) {
|
||||
$language = $shebangMatch['lang'];
|
||||
$line = (int) (($shebangMatch['linenumber'] > 1) ? $shebangMatch['linenumber'] : 0);
|
||||
$line = (int)(($shebangMatch['linenumber'] > 1) ? $shebangMatch['linenumber'] : 0);
|
||||
$codeblock = $shebangMatch['code'];
|
||||
|
||||
$highlighter = new GeSHi($this->outdent(trim($codeblock)), $language);
|
||||
$highlighted = $highlighter->parse_code();
|
||||
if($line) {
|
||||
if ($line) {
|
||||
preg_match('!^(\s*<pre[^>]+>)(.*)(</pre>)!s', $highlighted, $m);
|
||||
|
||||
$ret = '<ol';
|
||||
if($line) {
|
||||
$ret .= ' start="' . $line .'"';
|
||||
if ($line) {
|
||||
$ret .= ' start="' . $line . '"';
|
||||
}
|
||||
$ret .= '>';
|
||||
$ret .= preg_replace(
|
||||
|
@ -78,7 +78,7 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
} else {
|
||||
$ret = $highlighted;
|
||||
}
|
||||
if($shebangMatch['params']) {
|
||||
if ($shebangMatch['params']) {
|
||||
$ret = $this->_processGeshiParams($ret, $shebangMatch['params']);
|
||||
}
|
||||
|
||||
|
@ -87,18 +87,17 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
|
||||
|
||||
function _processGeshiParams($highlighted, $params) {
|
||||
foreach(explode(',', $params) as $keyValuePair) {
|
||||
foreach (explode(',', $params) as $keyValuePair) {
|
||||
@list($key, $value) = array_map('trim', explode('=', $keyValuePair));
|
||||
if($key && $value) {
|
||||
switch($key) {
|
||||
if ($key && $value) {
|
||||
switch ($key) {
|
||||
case 'gist':
|
||||
$highlighted =
|
||||
sprintf(
|
||||
'<cite class="gist">(GIST: <a href="https://gist.github.com/%1$d" target="_blank">%1$d</a>)</cite>',
|
||||
$value
|
||||
)
|
||||
. $highlighted
|
||||
;
|
||||
. $highlighted;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'MySQL',
|
||||
//'COMMENT_SINGLE' => array(1 =>'--', 2 => '#'), // '--' MUST be folowed by whitespace,not necessarily a space
|
||||
'COMMENT_SINGLE' => array(
|
||||
1 =>'-- ',
|
||||
1 => '-- ',
|
||||
2 => '#'
|
||||
),
|
||||
'COMMENT_REGEXP' => array(
|
||||
|
@ -72,38 +72,38 @@ $language_data = array (
|
|||
1 => array(
|
||||
// Mix: statement keywords and keywords that don't fit in any other
|
||||
// category, or have multiple usage/meanings
|
||||
'ACTION','ADD','AFTER','ALGORITHM','ALL','ALTER','ANALYZE','ANY',
|
||||
'ASC','AS','BDB','BEGIN','BERKELEYDB','BINARY','BTREE','CALL',
|
||||
'CASCADED','CASCADE','CHAIN','CHANGE','CHECK','COLUMNS','COLUMN',
|
||||
'COMMENT','COMMIT','COMMITTED','CONSTRAINT','CONTAINS SQL',
|
||||
'CONSISTENT','CONVERT','CREATE','CROSS','DATA','DATABASES',
|
||||
'DECLARE','DEFINER','DELAYED','DELETE','DESCRIBE','DESC',
|
||||
'DETERMINISTIC','DISABLE','DISCARD','DISTINCTROW','DISTINCT','DO',
|
||||
'DROP','DUMPFILE','DUPLICATE KEY','ENABLE','ENCLOSED BY','ENGINE',
|
||||
'ERRORS','ESCAPED BY','EXISTS','EXPLAIN','EXTENDED','FIELDS',
|
||||
'FIRST','FOR EACH ROW','FORCE','FOREIGN KEY','FROM','FULL',
|
||||
'FUNCTION','GLOBAL','GRANT','GROUP BY','HANDLER','HASH','HAVING',
|
||||
'HELP','HIGH_PRIORITY','IF NOT EXISTS','IGNORE','IMPORT','INDEX',
|
||||
'INFILE','INNER','INNODB','INOUT','INTO','INVOKER',
|
||||
'ISOLATION LEVEL','JOIN','KEYS','KEY','KILL','LANGUAGE SQL','LAST',
|
||||
'LIMIT','LINES','LOAD','LOCAL','LOCK','LOW_PRIORITY',
|
||||
'MASTER_SERVER_ID','MATCH','MERGE','MIDDLEINT','MODIFIES SQL DATA',
|
||||
'MODIFY','MRG_MYISAM','NATURAL','NEXT','NO SQL','NO','ON',
|
||||
'OPTIMIZE','OPTIONALLY','OPTION','ORDER BY','OUTER','OUTFILE','OUT',
|
||||
'PARTIAL','PARTITION','PREV','PRIMARY KEY','PRIVILEGES','PROCEDURE',
|
||||
'PURGE','QUICK','READS SQL DATA','READ','REFERENCES','RELEASE',
|
||||
'RENAME','REORGANIZE','REPEATABLE','REQUIRE','RESTRICT','RETURNS',
|
||||
'REVOKE','ROLLBACK','ROUTINE','RTREE','SAVEPOINT','SELECT',
|
||||
'SERIALIZABLE','SESSION','SET','SHARE MODE','SHOW','SIMPLE',
|
||||
'SNAPSHOT','SOME','SONAME','SQL SECURITY','SQL_BIG_RESULT',
|
||||
'SQL_BUFFER_RESULT','SQL_CACHE','SQL_CALC_FOUND_ROWS',
|
||||
'SQL_NO_CACHE','SQL_SMALL_RESULT','SSL','START','STARTING BY',
|
||||
'STATUS','STRAIGHT_JOIN','STRIPED','TABLESPACE','TABLES','TABLE',
|
||||
'TEMPORARY','TEMPTABLE','TERMINATED BY','TO','TRANSACTIONS',
|
||||
'TRANSACTION','TRIGGER','TYPES','TYPE','UNCOMMITTED','UNDEFINED',
|
||||
'UNION','UNLOCK_TABLES','UPDATE','USAGE','USE','USER_RESOURCES',
|
||||
'USING','VALUES','VALUE','VIEW','WARNINGS','WHERE','WITH ROLLUP',
|
||||
'WITH','WORK','WRITE',
|
||||
'ACTION', 'ADD', 'AFTER', 'ALGORITHM', 'ALL', 'ALTER', 'ANALYZE', 'ANY',
|
||||
'ASC', 'AS', 'BDB', 'BEGIN', 'BERKELEYDB', 'BINARY', 'BTREE', 'CALL',
|
||||
'CASCADED', 'CASCADE', 'CHAIN', 'CHANGE', 'CHECK', 'COLUMNS', 'COLUMN',
|
||||
'COMMENT', 'COMMIT', 'COMMITTED', 'CONSTRAINT', 'CONTAINS SQL',
|
||||
'CONSISTENT', 'CONVERT', 'CREATE', 'CROSS', 'DATA', 'DATABASES',
|
||||
'DECLARE', 'DEFINER', 'DELAYED', 'DELETE', 'DESCRIBE', 'DESC',
|
||||
'DETERMINISTIC', 'DISABLE', 'DISCARD', 'DISTINCTROW', 'DISTINCT', 'DO',
|
||||
'DROP', 'DUMPFILE', 'DUPLICATE KEY', 'ENABLE', 'ENCLOSED BY', 'ENGINE',
|
||||
'ERRORS', 'ESCAPED BY', 'EXISTS', 'EXPLAIN', 'EXTENDED', 'FIELDS',
|
||||
'FIRST', 'FOR EACH ROW', 'FORCE', 'FOREIGN KEY', 'FROM', 'FULL',
|
||||
'FUNCTION', 'GLOBAL', 'GRANT', 'GROUP BY', 'HANDLER', 'HASH', 'HAVING',
|
||||
'HELP', 'HIGH_PRIORITY', 'IF NOT EXISTS', 'IGNORE', 'IMPORT', 'INDEX',
|
||||
'INFILE', 'INNER', 'INNODB', 'INOUT', 'INTO', 'INVOKER',
|
||||
'ISOLATION LEVEL', 'JOIN', 'KEYS', 'KEY', 'KILL', 'LANGUAGE SQL', 'LAST',
|
||||
'LIMIT', 'LINES', 'LOAD', 'LOCAL', 'LOCK', 'LOW_PRIORITY',
|
||||
'MASTER_SERVER_ID', 'MATCH', 'MERGE', 'MIDDLEINT', 'MODIFIES SQL DATA',
|
||||
'MODIFY', 'MRG_MYISAM', 'NATURAL', 'NEXT', 'NO SQL', 'NO', 'ON',
|
||||
'OPTIMIZE', 'OPTIONALLY', 'OPTION', 'ORDER BY', 'OUTER', 'OUTFILE', 'OUT',
|
||||
'PARTIAL', 'PARTITION', 'PREV', 'PRIMARY KEY', 'PRIVILEGES', 'PROCEDURE',
|
||||
'PURGE', 'QUICK', 'READS SQL DATA', 'READ', 'REFERENCES', 'RELEASE',
|
||||
'RENAME', 'REORGANIZE', 'REPEATABLE', 'REQUIRE', 'RESTRICT', 'RETURNS',
|
||||
'REVOKE', 'ROLLBACK', 'ROUTINE', 'RTREE', 'SAVEPOINT', 'SELECT',
|
||||
'SERIALIZABLE', 'SESSION', 'SET', 'SHARE MODE', 'SHOW', 'SIMPLE',
|
||||
'SNAPSHOT', 'SOME', 'SONAME', 'SQL SECURITY', 'SQL_BIG_RESULT',
|
||||
'SQL_BUFFER_RESULT', 'SQL_CACHE', 'SQL_CALC_FOUND_ROWS',
|
||||
'SQL_NO_CACHE', 'SQL_SMALL_RESULT', 'SSL', 'START', 'STARTING BY',
|
||||
'STATUS', 'STRAIGHT_JOIN', 'STRIPED', 'TABLESPACE', 'TABLES', 'TABLE',
|
||||
'TEMPORARY', 'TEMPTABLE', 'TERMINATED BY', 'TO', 'TRANSACTIONS',
|
||||
'TRANSACTION', 'TRIGGER', 'TYPES', 'TYPE', 'UNCOMMITTED', 'UNDEFINED',
|
||||
'UNION', 'UNLOCK_TABLES', 'UPDATE', 'USAGE', 'USE', 'USER_RESOURCES',
|
||||
'USING', 'VALUES', 'VALUE', 'VIEW', 'WARNINGS', 'WHERE', 'WITH ROLLUP',
|
||||
'WITH', 'WORK', 'WRITE',
|
||||
),
|
||||
2 => array( //No ( must follow
|
||||
// Mix: statement keywords distinguished from functions by the same name
|
||||
|
@ -111,20 +111,20 @@ $language_data = array (
|
|||
),
|
||||
3 => array(
|
||||
// Values (Constants)
|
||||
'FALSE','NULL','TRUE',
|
||||
'FALSE', 'NULL', 'TRUE',
|
||||
),
|
||||
4 => array(
|
||||
// Column Data Types
|
||||
'BIGINT','BIT','BLOB','BOOLEAN','BOOL','CHARACTER VARYING',
|
||||
'CHAR VARYING','DATETIME','DECIMAL','DEC','DOUBLE PRECISION',
|
||||
'DOUBLE','ENUM','FIXED','FLOAT','GEOMETRYCOLLECTION','GEOMETRY',
|
||||
'INTEGER','INT','LINESTRING','LONGBLOB','LONGTEXT','MEDIUMBLOB',
|
||||
'MEDIUMINT','MEDIUMTEXT','MULTIPOINT','MULTILINESTRING',
|
||||
'MULTIPOLYGON','NATIONAL CHARACTER','NATIONAL CHARACTER VARYING',
|
||||
'NATIONAL CHAR VARYING','NATIONAL VARCHAR','NCHAR VARCHAR','NCHAR',
|
||||
'NUMERIC','POINT','POLYGON','REAL','SERIAL',
|
||||
'SMALLINT','TEXT','TIMESTAMP','TINYBLOB','TINYINT',
|
||||
'TINYTEXT','VARBINARY','VARCHARACTER','VARCHAR',
|
||||
'BIGINT', 'BIT', 'BLOB', 'BOOLEAN', 'BOOL', 'CHARACTER VARYING',
|
||||
'CHAR VARYING', 'DATETIME', 'DECIMAL', 'DEC', 'DOUBLE PRECISION',
|
||||
'DOUBLE', 'ENUM', 'FIXED', 'FLOAT', 'GEOMETRYCOLLECTION', 'GEOMETRY',
|
||||
'INTEGER', 'INT', 'LINESTRING', 'LONGBLOB', 'LONGTEXT', 'MEDIUMBLOB',
|
||||
'MEDIUMINT', 'MEDIUMTEXT', 'MULTIPOINT', 'MULTILINESTRING',
|
||||
'MULTIPOLYGON', 'NATIONAL CHARACTER', 'NATIONAL CHARACTER VARYING',
|
||||
'NATIONAL CHAR VARYING', 'NATIONAL VARCHAR', 'NCHAR VARCHAR', 'NCHAR',
|
||||
'NUMERIC', 'POINT', 'POLYGON', 'REAL', 'SERIAL',
|
||||
'SMALLINT', 'TEXT', 'TIMESTAMP', 'TINYBLOB', 'TINYINT',
|
||||
'TINYTEXT', 'VARBINARY', 'VARCHARACTER', 'VARCHAR',
|
||||
),
|
||||
5 => array( //No ( must follow
|
||||
// Column data types distinguished from functions by the same name
|
||||
|
@ -132,11 +132,11 @@ $language_data = array (
|
|||
),
|
||||
6 => array(
|
||||
// Table, Column & Index Attributes
|
||||
'AUTO_INCREMENT','AVG_ROW_LENGTH','BOTH','CHECKSUM','CONNECTION',
|
||||
'DATA DIRECTORY','DEFAULT NULL','DELAY_KEY_WRITE','FULLTEXT',
|
||||
'INDEX DIRECTORY','INSERT_METHOD','LEADING','MAX_ROWS','MIN_ROWS',
|
||||
'NOT NULL','PACK_KEYS','ROW_FORMAT','SERIAL DEFAULT VALUE','SIGNED',
|
||||
'SPATIAL','TRAILING','UNIQUE','UNSIGNED','ZEROFILL'
|
||||
'AUTO_INCREMENT', 'AVG_ROW_LENGTH', 'BOTH', 'CHECKSUM', 'CONNECTION',
|
||||
'DATA DIRECTORY', 'DEFAULT NULL', 'DELAY_KEY_WRITE', 'FULLTEXT',
|
||||
'INDEX DIRECTORY', 'INSERT_METHOD', 'LEADING', 'MAX_ROWS', 'MIN_ROWS',
|
||||
'NOT NULL', 'PACK_KEYS', 'ROW_FORMAT', 'SERIAL DEFAULT VALUE', 'SIGNED',
|
||||
'SPATIAL', 'TRAILING', 'UNIQUE', 'UNSIGNED', 'ZEROFILL'
|
||||
),
|
||||
7 => array( //No ( must follow
|
||||
// Column attribute distinguished from function by the same name
|
||||
|
@ -144,10 +144,10 @@ $language_data = array (
|
|||
),
|
||||
8 => array(
|
||||
// Date and Time Unit Specifiers
|
||||
'DAY_HOUR','DAY_MICROSECOND','DAY_MINUTE','DAY_SECOND',
|
||||
'HOUR_MICROSECOND','HOUR_MINUTE','HOUR_SECOND',
|
||||
'MINUTE_MICROSECOND','MINUTE_SECOND',
|
||||
'SECOND_MICROSECOND','YEAR_MONTH'
|
||||
'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND',
|
||||
'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND',
|
||||
'MINUTE_MICROSECOND', 'MINUTE_SECOND',
|
||||
'SECOND_MICROSECOND', 'YEAR_MONTH'
|
||||
),
|
||||
9 => array( //No ( must follow
|
||||
// Date-time unit specifiers distinguished from functions by the same name
|
||||
|
@ -155,9 +155,9 @@ $language_data = array (
|
|||
),
|
||||
10 => array(
|
||||
// Operators (see also Symbols)
|
||||
'AND','BETWEEN','CHARACTER SET','COLLATE','DIV','IS NOT NULL',
|
||||
'IS NOT','IS NULL','IS','LIKE','NOT','OFFSET','OR','REGEXP','RLIKE',
|
||||
'SOUNDS LIKE','XOR'
|
||||
'AND', 'BETWEEN', 'CHARACTER SET', 'COLLATE', 'DIV', 'IS NOT NULL',
|
||||
'IS NOT', 'IS NULL', 'IS', 'LIKE', 'NOT', 'OFFSET', 'OR', 'REGEXP', 'RLIKE',
|
||||
'SOUNDS LIKE', 'XOR'
|
||||
),
|
||||
11 => array( //No ( must follow
|
||||
// Operator distinghuished from function by the same name
|
||||
|
@ -165,17 +165,17 @@ $language_data = array (
|
|||
),
|
||||
12 => array(
|
||||
// Control Flow (functions)
|
||||
'CASE','ELSE','END','IFNULL','IF','NULLIF','THEN','WHEN',
|
||||
'CASE', 'ELSE', 'END', 'IFNULL', 'IF', 'NULLIF', 'THEN', 'WHEN',
|
||||
),
|
||||
13 => array(
|
||||
// String Functions
|
||||
'ASCII','BIN','BIT_LENGTH','CHAR_LENGTH','CHARACTER_LENGTH',
|
||||
'CONCAT_WS','CONCAT','ELT','EXPORT_SET','FIELD',
|
||||
'FIND_IN_SET','FORMAT','HEX','INSTR','LCASE','LEFT','LENGTH',
|
||||
'LOAD_FILE','LOCATE','LOWER','LPAD','LTRIM','MAKE_SET','MID',
|
||||
'OCTET_LENGTH','ORD','POSITION','QUOTE','REPEAT','REVERSE',
|
||||
'RIGHT','RPAD','RTRIM','SOUNDEX','SPACE','STRCMP','SUBSTRING_INDEX',
|
||||
'SUBSTRING','TRIM','UCASE','UNHEX','UPPER',
|
||||
'ASCII', 'BIN', 'BIT_LENGTH', 'CHAR_LENGTH', 'CHARACTER_LENGTH',
|
||||
'CONCAT_WS', 'CONCAT', 'ELT', 'EXPORT_SET', 'FIELD',
|
||||
'FIND_IN_SET', 'FORMAT', 'HEX', 'INSTR', 'LCASE', 'LEFT', 'LENGTH',
|
||||
'LOAD_FILE', 'LOCATE', 'LOWER', 'LPAD', 'LTRIM', 'MAKE_SET', 'MID',
|
||||
'OCTET_LENGTH', 'ORD', 'POSITION', 'QUOTE', 'REPEAT', 'REVERSE',
|
||||
'RIGHT', 'RPAD', 'RTRIM', 'SOUNDEX', 'SPACE', 'STRCMP', 'SUBSTRING_INDEX',
|
||||
'SUBSTRING', 'TRIM', 'UCASE', 'UNHEX', 'UPPER',
|
||||
),
|
||||
14 => array( //A ( must follow
|
||||
// String functions distinguished from other keywords by the same name
|
||||
|
@ -183,10 +183,10 @@ $language_data = array (
|
|||
),
|
||||
15 => array(
|
||||
// Numeric Functions
|
||||
'ABS','ACOS','ASIN','ATAN2','ATAN','CEILING','CEIL',
|
||||
'CONV','COS','COT','CRC32','DEGREES','EXP','FLOOR','LN','LOG10',
|
||||
'LOG2','LOG','MOD','OCT','PI','POWER','POW','RADIANS','RAND',
|
||||
'ROUND','SIGN','SIN','SQRT','TAN',
|
||||
'ABS', 'ACOS', 'ASIN', 'ATAN2', 'ATAN', 'CEILING', 'CEIL',
|
||||
'CONV', 'COS', 'COT', 'CRC32', 'DEGREES', 'EXP', 'FLOOR', 'LN', 'LOG10',
|
||||
'LOG2', 'LOG', 'MOD', 'OCT', 'PI', 'POWER', 'POW', 'RADIANS', 'RAND',
|
||||
'ROUND', 'SIGN', 'SIN', 'SQRT', 'TAN',
|
||||
),
|
||||
16 => array( //A ( must follow
|
||||
// Numeric function distinguished from other keyword by the same name
|
||||
|
@ -194,17 +194,17 @@ $language_data = array (
|
|||
),
|
||||
17 => array(
|
||||
// Date and Time Functions
|
||||
'ADDDATE','ADDTIME','CONVERT_TZ','CURDATE','CURRENT_DATE',
|
||||
'CURRENT_TIME','CURRENT_TIMESTAMP','CURTIME','DATE_ADD',
|
||||
'DATE_FORMAT','DATE_SUB','DATEDIFF','DAYNAME','DAYOFMONTH',
|
||||
'DAYOFWEEK','DAYOFYEAR','EXTRACT','FROM_DAYS','FROM_UNIXTIME',
|
||||
'GET_FORMAT','LAST_DAY','LOCALTIME','LOCALTIMESTAMP','MAKEDATE',
|
||||
'MAKETIME','MONTHNAME','NOW','PERIOD_ADD',
|
||||
'PERIOD_DIFF','SEC_TO_TIME','STR_TO_DATE','SUBDATE','SUBTIME',
|
||||
'SYSDATE','TIME_FORMAT','TIME_TO_SEC',
|
||||
'TIMESTAMPADD','TIMESTAMPDIFF','TO_DAYS',
|
||||
'UNIX_TIMESTAMP','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','WEEKDAY',
|
||||
'WEEKOFYEAR','YEARWEEK',
|
||||
'ADDDATE', 'ADDTIME', 'CONVERT_TZ', 'CURDATE', 'CURRENT_DATE',
|
||||
'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURTIME', 'DATE_ADD',
|
||||
'DATE_FORMAT', 'DATE_SUB', 'DATEDIFF', 'DAYNAME', 'DAYOFMONTH',
|
||||
'DAYOFWEEK', 'DAYOFYEAR', 'EXTRACT', 'FROM_DAYS', 'FROM_UNIXTIME',
|
||||
'GET_FORMAT', 'LAST_DAY', 'LOCALTIME', 'LOCALTIMESTAMP', 'MAKEDATE',
|
||||
'MAKETIME', 'MONTHNAME', 'NOW', 'PERIOD_ADD',
|
||||
'PERIOD_DIFF', 'SEC_TO_TIME', 'STR_TO_DATE', 'SUBDATE', 'SUBTIME',
|
||||
'SYSDATE', 'TIME_FORMAT', 'TIME_TO_SEC',
|
||||
'TIMESTAMPADD', 'TIMESTAMPDIFF', 'TO_DAYS',
|
||||
'UNIX_TIMESTAMP', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'WEEKDAY',
|
||||
'WEEKOFYEAR', 'YEARWEEK',
|
||||
),
|
||||
18 => array( //A ( must follow
|
||||
// Date-time functions distinguished from other keywords by the same name
|
||||
|
@ -213,7 +213,7 @@ $language_data = array (
|
|||
),
|
||||
19 => array(
|
||||
// Comparison Functions
|
||||
'COALESCE','GREATEST','ISNULL','LEAST',
|
||||
'COALESCE', 'GREATEST', 'ISNULL', 'LEAST',
|
||||
),
|
||||
20 => array( //A ( must follow
|
||||
// Comparison functions distinguished from other keywords by the same name
|
||||
|
@ -221,21 +221,21 @@ $language_data = array (
|
|||
),
|
||||
21 => array(
|
||||
// Encryption and Compression Functions
|
||||
'AES_DECRYPT','AES_ENCRYPT','COMPRESS','DECODE','DES_DECRYPT',
|
||||
'DES_ENCRYPT','ENCODE','ENCRYPT','MD5','OLD_PASSWORD','PASSWORD',
|
||||
'SHA1','SHA','UNCOMPRESS','UNCOMPRESSED_LENGTH',
|
||||
'AES_DECRYPT', 'AES_ENCRYPT', 'COMPRESS', 'DECODE', 'DES_DECRYPT',
|
||||
'DES_ENCRYPT', 'ENCODE', 'ENCRYPT', 'MD5', 'OLD_PASSWORD', 'PASSWORD',
|
||||
'SHA1', 'SHA', 'UNCOMPRESS', 'UNCOMPRESSED_LENGTH',
|
||||
),
|
||||
22 => array(
|
||||
// GROUP BY (aggregate) Functions
|
||||
'AVG','BIT_AND','BIT_OR','BIT_XOR','COUNT','GROUP_CONCAT',
|
||||
'MAX','MIN','STDDEV_POP','STDDEV_SAMP','STDDEV','STD','SUM',
|
||||
'VAR_POP','VAR_SAMP','VARIANCE',
|
||||
'AVG', 'BIT_AND', 'BIT_OR', 'BIT_XOR', 'COUNT', 'GROUP_CONCAT',
|
||||
'MAX', 'MIN', 'STDDEV_POP', 'STDDEV_SAMP', 'STDDEV', 'STD', 'SUM',
|
||||
'VAR_POP', 'VAR_SAMP', 'VARIANCE',
|
||||
),
|
||||
23 => array(
|
||||
// Information Functions
|
||||
'BENCHMARK','COERCIBILITY','COLLATION','CONNECTION_ID',
|
||||
'FOUND_ROWS','LAST_INSERT_ID','ROW_COUNT',
|
||||
'SESSION_USER','SYSTEM_USER','USER','VERSION',
|
||||
'BENCHMARK', 'COERCIBILITY', 'COLLATION', 'CONNECTION_ID',
|
||||
'FOUND_ROWS', 'LAST_INSERT_ID', 'ROW_COUNT',
|
||||
'SESSION_USER', 'SYSTEM_USER', 'USER', 'VERSION',
|
||||
),
|
||||
24 => array( //A ( must follow
|
||||
// Information functions distinguished from other keywords by the same name
|
||||
|
@ -243,9 +243,9 @@ $language_data = array (
|
|||
),
|
||||
25 => array(
|
||||
// Miscellaneous Functions
|
||||
'ExtractValue','BIT_COUNT','GET_LOCK','INET_ATON','INET_NTOA',
|
||||
'IS_FREE_LOCK','IS_USED_LOCK','MASTER_POS_WAIT','NAME_CONST',
|
||||
'RELEASE_LOCK','SLEEP','UpdateXML','UUID',
|
||||
'ExtractValue', 'BIT_COUNT', 'GET_LOCK', 'INET_ATON', 'INET_NTOA',
|
||||
'IS_FREE_LOCK', 'IS_USED_LOCK', 'MASTER_POS_WAIT', 'NAME_CONST',
|
||||
'RELEASE_LOCK', 'SLEEP', 'UpdateXML', 'UUID',
|
||||
),
|
||||
26 => array( //A ( must follow
|
||||
// Miscellaneous function distinguished from other keyword by the same name
|
||||
|
@ -253,29 +253,29 @@ $language_data = array (
|
|||
),
|
||||
27 => array(
|
||||
// Geometry Functions
|
||||
'Area','AsBinary','AsText','AsWKB','AsWKT','Boundary','Buffer',
|
||||
'Centroid','Contains','ConvexHull','Crosses',
|
||||
'Difference','Dimension','Disjoint','Distance',
|
||||
'EndPoint','Envelope','Equals','ExteriorRing',
|
||||
'GLength','GeomCollFromText','GeomCollFromWKB','GeomFromText',
|
||||
'GeomFromWKB','GeometryCollectionFromText',
|
||||
'GeometryCollectionFromWKB','GeometryFromText','GeometryFromWKB',
|
||||
'GeometryN','GeometryType',
|
||||
'InteriorRingN','Intersection','Intersects','IsClosed','IsEmpty',
|
||||
'IsRing','IsSimple',
|
||||
'LineFromText','LineFromWKB','LineStringFromText',
|
||||
'Area', 'AsBinary', 'AsText', 'AsWKB', 'AsWKT', 'Boundary', 'Buffer',
|
||||
'Centroid', 'Contains', 'ConvexHull', 'Crosses',
|
||||
'Difference', 'Dimension', 'Disjoint', 'Distance',
|
||||
'EndPoint', 'Envelope', 'Equals', 'ExteriorRing',
|
||||
'GLength', 'GeomCollFromText', 'GeomCollFromWKB', 'GeomFromText',
|
||||
'GeomFromWKB', 'GeometryCollectionFromText',
|
||||
'GeometryCollectionFromWKB', 'GeometryFromText', 'GeometryFromWKB',
|
||||
'GeometryN', 'GeometryType',
|
||||
'InteriorRingN', 'Intersection', 'Intersects', 'IsClosed', 'IsEmpty',
|
||||
'IsRing', 'IsSimple',
|
||||
'LineFromText', 'LineFromWKB', 'LineStringFromText',
|
||||
'LineStringFromWKB',
|
||||
'MBRContains','MBRDisjoint','MBREqual','MBRIntersects',
|
||||
'MBROverlaps','MBRTouches','MBRWithin','MLineFromText',
|
||||
'MLineFromWKB','MPointFromText','MPointFromWKB','MPolyFromText',
|
||||
'MPolyFromWKB','MultiLineStringFromText','MultiLineStringFromWKB',
|
||||
'MultiPointFromText','MultiPointFromWKB','MultiPolygonFromText',
|
||||
'MBRContains', 'MBRDisjoint', 'MBREqual', 'MBRIntersects',
|
||||
'MBROverlaps', 'MBRTouches', 'MBRWithin', 'MLineFromText',
|
||||
'MLineFromWKB', 'MPointFromText', 'MPointFromWKB', 'MPolyFromText',
|
||||
'MPolyFromWKB', 'MultiLineStringFromText', 'MultiLineStringFromWKB',
|
||||
'MultiPointFromText', 'MultiPointFromWKB', 'MultiPolygonFromText',
|
||||
'MultiPolygonFromWKB',
|
||||
'NumGeometries','NumInteriorRings','NumPoints',
|
||||
'NumGeometries', 'NumInteriorRings', 'NumPoints',
|
||||
'Overlaps',
|
||||
'PointFromText','PointFromWKB','PointN','PointOnSurface',
|
||||
'PolyFromText','PolyFromWKB','PolygonFromText','PolygonFromWKB',
|
||||
'Related','SRID','StartPoint','SymDifference',
|
||||
'PointFromText', 'PointFromWKB', 'PointN', 'PointOnSurface',
|
||||
'PolyFromText', 'PolyFromWKB', 'PolygonFromText', 'PolygonFromWKB',
|
||||
'Related', 'SRID', 'StartPoint', 'SymDifference',
|
||||
'Touches',
|
||||
'Union',
|
||||
'Within',
|
||||
|
@ -378,16 +378,13 @@ $language_data = array (
|
|||
'NUMBERS' => array(
|
||||
0 => 'color: #008080;'
|
||||
),
|
||||
'METHODS' => array(
|
||||
),
|
||||
'METHODS' => array(),
|
||||
'SYMBOLS' => array(
|
||||
1 => 'color: #CC0099;', // operators
|
||||
2 => 'color: #000033;', // syntax
|
||||
),
|
||||
'SCRIPT' => array(
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
)
|
||||
'SCRIPT' => array(),
|
||||
'REGEXPS' => array()
|
||||
),
|
||||
'URLS' => array(
|
||||
1 => 'http://search.oracle.com/search/search?group=MySQL&q={FNAME}',
|
||||
|
@ -421,15 +418,11 @@ $language_data = array (
|
|||
27 => 'http://dev.mysql.com/doc/refman/%35%2E%31/en/analysing-spatial-information.html',
|
||||
),
|
||||
'OOLANG' => false,
|
||||
'OBJECT_SPLITTERS' => array(
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'OBJECT_SPLITTERS' => array(),
|
||||
'REGEXPS' => array(),
|
||||
'STRICT_MODE_APPLIES' => GESHI_NEVER,
|
||||
'SCRIPT_DELIMITERS' => array(
|
||||
),
|
||||
'HIGHLIGHT_STRICT_BLOCK' => array(
|
||||
),
|
||||
'SCRIPT_DELIMITERS' => array(),
|
||||
'HIGHLIGHT_STRICT_BLOCK' => array(),
|
||||
'TAB_WIDTH' => 4,
|
||||
'PARSER_CONTROL' => array(
|
||||
'KEYWORDS' => array(
|
||||
|
|
|
@ -30,14 +30,14 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
/sx';
|
||||
|
||||
function hasShebang($code) {
|
||||
if(preg_match($this->shebang, $code, $m)) {
|
||||
if (preg_match($this->shebang, $code, $m)) {
|
||||
return $m;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _doCodeBlocks_callback($matches) {
|
||||
if($m = $this->hasShebang($matches[1])) {
|
||||
if ($m = $this->hasShebang($matches[1])) {
|
||||
return $this->_doGeshi($m);
|
||||
} else {
|
||||
return parent::_doCodeBlocks_callback($matches);
|
||||
|
@ -45,7 +45,7 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
}
|
||||
|
||||
function _doFencedCodeBlocks_callback($matches) {
|
||||
if($m = $this->hasShebang($matches[2])) {
|
||||
if ($m = $this->hasShebang($matches[2])) {
|
||||
return $this->_doGeshi($m);
|
||||
} else {
|
||||
return parent::_doFencedCodeBlocks_callback($matches);
|
||||
|
@ -54,17 +54,17 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
|
||||
function _doGeshi($shebangMatch) {
|
||||
$language = $shebangMatch['lang'];
|
||||
$line = (int) (($shebangMatch['linenumber'] > 1) ? $shebangMatch['linenumber'] : 0);
|
||||
$line = (int)(($shebangMatch['linenumber'] > 1) ? $shebangMatch['linenumber'] : 0);
|
||||
$codeblock = $shebangMatch['code'];
|
||||
|
||||
$highlighter = new GeSHi($this->outdent(trim($codeblock)), $language);
|
||||
$highlighted = $highlighter->parse_code();
|
||||
if($line) {
|
||||
if ($line) {
|
||||
preg_match('!^(\s*<pre[^>]+>)(.*)(</pre>)!s', $highlighted, $m);
|
||||
|
||||
$ret = '<ol';
|
||||
if($line) {
|
||||
$ret .= ' start="' . $line .'"';
|
||||
if ($line) {
|
||||
$ret .= ' start="' . $line . '"';
|
||||
}
|
||||
$ret .= '>';
|
||||
$ret .= preg_replace(
|
||||
|
@ -78,7 +78,7 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
} else {
|
||||
$ret = $highlighted;
|
||||
}
|
||||
if($shebangMatch['params']) {
|
||||
if ($shebangMatch['params']) {
|
||||
$ret = $this->_processGeshiParams($ret, $shebangMatch['params']);
|
||||
}
|
||||
|
||||
|
@ -87,18 +87,17 @@ class MarkdownGeshi_Parser extends MarkdownExtra_Parser {
|
|||
|
||||
|
||||
function _processGeshiParams($highlighted, $params) {
|
||||
foreach(explode(',', $params) as $keyValuePair) {
|
||||
foreach (explode(',', $params) as $keyValuePair) {
|
||||
@list($key, $value) = array_map('trim', explode('=', $keyValuePair));
|
||||
if($key && $value) {
|
||||
switch($key) {
|
||||
if ($key && $value) {
|
||||
switch ($key) {
|
||||
case 'gist':
|
||||
$highlighted =
|
||||
sprintf(
|
||||
'<cite class="gist">(GIST: <a href="https://gist.github.com/%1$d" target="_blank">%1$d</a>)</cite>',
|
||||
$value
|
||||
)
|
||||
. $highlighted
|
||||
;
|
||||
. $highlighted;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -43,7 +43,7 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'Text',
|
||||
'COMMENT_SINGLE' => array(),
|
||||
'COMMENT_MULTI' => array(),
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'Python',
|
||||
'COMMENT_SINGLE' => array(1 => '#'),
|
||||
'COMMENT_MULTI' => array(),
|
||||
|
@ -166,14 +166,14 @@ $language_data = array (
|
|||
'__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__',
|
||||
'__getslice__', '__setslice__', '__delslice__',
|
||||
// Numeric types: http://python.org/doc/current/ref/numeric-types.html
|
||||
'__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__',
|
||||
'__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__',
|
||||
'__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__',
|
||||
'__long__','__lshift__',
|
||||
'__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__',
|
||||
'__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__',
|
||||
'__rshift__','__rsub__','__rmul__','__rand__','__rxor__','__ror__',
|
||||
'__sub__','__xor__'
|
||||
'__abs__', '__add__', '__and__', '__coerce__', '__div__', '__divmod__', '__float__',
|
||||
'__hex__', '__iadd__', '__isub__', '__imod__', '__idiv__', '__ipow__', '__iand__',
|
||||
'__ior__', '__ixor__', '__ilshift__', '__irshift__', '__invert__', '__int__',
|
||||
'__long__', '__lshift__',
|
||||
'__mod__', '__mul__', '__neg__', '__oct__', '__or__', '__pos__', '__pow__',
|
||||
'__radd__', '__rdiv__', '__rdivmod__', '__rmod__', '__rpow__', '__rlshift__', '__rrshift__',
|
||||
'__rshift__', '__rsub__', '__rmul__', '__rand__', '__rxor__', '__ror__',
|
||||
'__sub__', '__xor__'
|
||||
)
|
||||
),
|
||||
'SYMBOLS' => array(
|
||||
|
@ -217,10 +217,8 @@ $language_data = array (
|
|||
'SYMBOLS' => array(
|
||||
0 => 'color: #66cc66;'
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'SCRIPT' => array(
|
||||
)
|
||||
'REGEXPS' => array(),
|
||||
'SCRIPT' => array()
|
||||
),
|
||||
'URLS' => array(
|
||||
1 => '',
|
||||
|
@ -232,11 +230,8 @@ $language_data = array (
|
|||
'OBJECT_SPLITTERS' => array(
|
||||
1 => '.'
|
||||
),
|
||||
'REGEXPS' => array(
|
||||
),
|
||||
'REGEXPS' => array(),
|
||||
'STRICT_MODE_APPLIES' => GESHI_NEVER,
|
||||
'SCRIPT_DELIMITERS' => array(
|
||||
),
|
||||
'HIGHLIGHT_STRICT_BLOCK' => array(
|
||||
)
|
||||
'SCRIPT_DELIMITERS' => array(),
|
||||
'HIGHLIGHT_STRICT_BLOCK' => array()
|
||||
);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
$language_data = array(
|
||||
'LANG_NAME' => 'Text',
|
||||
'COMMENT_SINGLE' => array(),
|
||||
'COMMENT_MULTI' => array(),
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace {
|
|||
return null;
|
||||
}
|
||||
if (is_null($password) || is_int($password)) {
|
||||
$password = (string) $password;
|
||||
$password = (string)$password;
|
||||
}
|
||||
if (!is_string($password)) {
|
||||
trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
|
||||
|
@ -53,7 +53,7 @@ namespace {
|
|||
case PASSWORD_BCRYPT:
|
||||
$cost = PASSWORD_BCRYPT_DEFAULT_COST;
|
||||
if (isset($options['cost'])) {
|
||||
$cost = (int) $options['cost'];
|
||||
$cost = (int)$options['cost'];
|
||||
if ($cost < 4 || $cost > 31) {
|
||||
trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
|
||||
return null;
|
||||
|
@ -79,11 +79,11 @@ namespace {
|
|||
case 'integer':
|
||||
case 'double':
|
||||
case 'string':
|
||||
$salt = (string) $options['salt'];
|
||||
$salt = (string)$options['salt'];
|
||||
break;
|
||||
case 'object':
|
||||
if (method_exists($options['salt'], '__tostring')) {
|
||||
$salt = (string) $options['salt'];
|
||||
$salt = (string)$options['salt'];
|
||||
break;
|
||||
}
|
||||
case 'array':
|
||||
|
@ -173,7 +173,7 @@ namespace {
|
|||
*
|
||||
* @return boolean If the password matches the hash
|
||||
*/
|
||||
function password_verify(string $password, string $hash): bool {
|
||||
function password_verify(string $password, string $hash) : bool {
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
||||
return false;
|
||||
|
@ -207,8 +207,8 @@ namespace PasswordCompat\binary {
|
|||
*
|
||||
* @param string $binary_string The input string
|
||||
*
|
||||
* @internal
|
||||
* @return int The number of bytes
|
||||
* @internal
|
||||
*/
|
||||
function _strlen($binary_string) {
|
||||
if (function_exists('mb_strlen')) {
|
||||
|
@ -220,14 +220,14 @@ namespace PasswordCompat\binary {
|
|||
/**
|
||||
* Get a substring based on byte limits
|
||||
*
|
||||
* @see _strlen()
|
||||
*
|
||||
* @param string $binary_string The input string
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
*
|
||||
* @internal
|
||||
* @return string The substring
|
||||
* @internal
|
||||
* @see _strlen()
|
||||
*
|
||||
*/
|
||||
function _substr($binary_string, $start, $length) {
|
||||
if (function_exists('mb_substr')) {
|
||||
|
@ -242,7 +242,7 @@ namespace PasswordCompat\binary {
|
|||
* @return boolean the check result
|
||||
*/
|
||||
function check() {
|
||||
static $pass = NULL;
|
||||
static $pass = null;
|
||||
|
||||
if (is_null($pass)) {
|
||||
if (function_exists('crypt')) {
|
||||
|
|
11
index.php
11
index.php
|
@ -1,4 +1,3 @@
|
|||
|
||||
<?php
|
||||
/*
|
||||
* Paste <https://github.com/jordansamuel/PASTE>
|
||||
|
@ -28,7 +27,7 @@ require_once('includes/captcha.php');
|
|||
require_once('includes/functions.php');
|
||||
require_once('includes/password.php');
|
||||
|
||||
function verifyCaptcha() : string | bool {
|
||||
function verifyCaptcha() : string|bool {
|
||||
global $cap_e;
|
||||
global $mode;
|
||||
global $recaptcha_secretkey;
|
||||
|
@ -36,7 +35,7 @@ function verifyCaptcha() : string | bool {
|
|||
|
||||
if ($cap_e == "on" && !isset($_SESSION['username'])) {
|
||||
if ($mode == "reCAPTCHA") {
|
||||
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secretkey."&response=".$_POST['g-recaptcha-response']);
|
||||
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secretkey . "&response=" . $_POST['g-recaptcha-response']);
|
||||
$response = json_decode($response, true);
|
||||
if ($response["success"] == false) {
|
||||
// reCAPTCHA Errors
|
||||
|
@ -80,13 +79,13 @@ function calculatePasteExpiry(string $expiry) {
|
|||
: null;
|
||||
}
|
||||
|
||||
function validatePasteFields() : string | null {
|
||||
function validatePasteFields() : string|null {
|
||||
global $lang;
|
||||
global $pastelimit;
|
||||
|
||||
if (empty($_POST["paste_data"]) || trim($_POST['paste_data'] === '')) { /* Empty paste input */
|
||||
return $lang['empty_paste'];
|
||||
} elseif(!isset($_POST['title'])) { /* No paste title POSTed */
|
||||
} elseif (!isset($_POST['title'])) { /* No paste title POSTed */
|
||||
return $lang['error'];
|
||||
} elseif (empty($_POST["tags"])) { /* No tags provided */
|
||||
return $lang['notags'];
|
||||
|
@ -221,7 +220,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
"INSERT INTO pastes (title, content, visible, code, expiry, password, encrypt, member, date, ip, now_time, views, s_date, tagsys) VALUES
|
||||
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '0', ?, ?)"
|
||||
);
|
||||
$statement->execute([$p_title,$p_content,$p_visible,$p_code,$expires,$p_password,$p_encrypt,$p_member,$p_date,$ip,$now_time,$date,$p_tagsys]);
|
||||
$statement->execute([$p_title, $p_content, $p_visible, $p_code, $expires, $p_password, $p_encrypt, $p_member, $p_date, $ip, $now_time, $date, $p_tagsys]);
|
||||
$paste_id = intval($conn->lastInsertId()); /* returns the last inserted ID as per the query above */
|
||||
if ($p_visible == '0') {
|
||||
addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite);
|
||||
|
|
|
@ -56,7 +56,7 @@ $lang ['notfound'] = "No encontrado";
|
|||
$lang ['wrongpwd'] = "Contraseña incorrecta. Vuelva a intentarlo.";
|
||||
$lang ['myprofile'] = "Mi perfil";
|
||||
$lang ['profileerror'] = "No se puede actualizar la información del perfil";
|
||||
$lang ['profileupdated']= "Se ha actualizado la información de tu perfil";
|
||||
$lang ['profileupdated'] = "Se ha actualizado la información de tu perfil";
|
||||
$lang ['oldpasswrong'] = "Su contraseña antigua es incorrecta.";
|
||||
$lang ['archives'] = "Archivos de pegado";
|
||||
$lang ['archivestitle'] = "Esta página contiene los 100 pegados publicados más recientemente.";
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,8 +27,7 @@
|
|||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
class POP3 {
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
* @var string
|
||||
|
@ -162,8 +161,7 @@ class POP3
|
|||
* @param integer $debug_level
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) {
|
||||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if (false === $port) {
|
||||
|
@ -204,8 +202,7 @@ class POP3
|
|||
* @param integer $tval
|
||||
* @return boolean
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
public function connect($host, $port = false, $tval = 30) {
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
|
@ -263,8 +260,7 @@ class POP3
|
|||
* @param string $password
|
||||
* @return boolean
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
public function login($username = '', $password = '') {
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
}
|
||||
|
@ -293,8 +289,7 @@ class POP3
|
|||
* Disconnect from the POP3 server.
|
||||
* @access public
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
public function disconnect() {
|
||||
$this->sendString('QUIT');
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
|
@ -312,8 +307,7 @@ class POP3
|
|||
* @return string
|
||||
* @access protected
|
||||
*/
|
||||
protected function getResponse($size = 128)
|
||||
{
|
||||
protected function getResponse($size = 128) {
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= 1) {
|
||||
echo "Server -> Client: $response";
|
||||
|
@ -327,8 +321,7 @@ class POP3
|
|||
* @return integer
|
||||
* @access protected
|
||||
*/
|
||||
protected function sendString($string)
|
||||
{
|
||||
protected function sendString($string) {
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
||||
echo "Client -> Server: $string";
|
||||
|
@ -345,8 +338,7 @@ class POP3
|
|||
* @return boolean
|
||||
* @access protected
|
||||
*/
|
||||
protected function checkResponse($string)
|
||||
{
|
||||
protected function checkResponse($string) {
|
||||
if (substr($string, 0, 3) !== '+OK') {
|
||||
$this->setError(array(
|
||||
'error' => "Server reported an error: $string",
|
||||
|
@ -365,8 +357,7 @@ class POP3
|
|||
* @param $error
|
||||
* @access protected
|
||||
*/
|
||||
protected function setError($error)
|
||||
{
|
||||
protected function setError($error) {
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= 1) {
|
||||
echo '<pre>';
|
||||
|
@ -381,8 +372,7 @@ class POP3
|
|||
* Get an array of error messages, if any.
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
public function getErrors() {
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
|
@ -394,8 +384,7 @@ class POP3
|
|||
* @param integer $errline
|
||||
* @access protected
|
||||
*/
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline) {
|
||||
$this->setError(array(
|
||||
'error' => "Connecting to the POP3 server raised a PHP warning: ",
|
||||
'errno' => $errno,
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
* @author Chris Ryan
|
||||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class SMTP
|
||||
{
|
||||
class SMTP {
|
||||
/**
|
||||
* The PHPMailer SMTP version number.
|
||||
* @var string
|
||||
|
@ -204,14 +203,13 @@ class SMTP
|
|||
|
||||
/**
|
||||
* Output debugging info via a user-selected method.
|
||||
* @see SMTP::$Debugoutput
|
||||
* @see SMTP::$do_debug
|
||||
* @param string $str Debug string to output
|
||||
* @param integer $level The debug level of this message; see DEBUG_* constants
|
||||
* @return void
|
||||
* @see SMTP::$do_debug
|
||||
* @see SMTP::$Debugoutput
|
||||
*/
|
||||
protected function edebug($str, $level = 0)
|
||||
{
|
||||
protected function edebug($str, $level = 0) {
|
||||
if ($level > $this->do_debug) {
|
||||
return;
|
||||
}
|
||||
|
@ -242,7 +240,7 @@ class SMTP
|
|||
"\n",
|
||||
"\n \t ",
|
||||
trim($str)
|
||||
)."\n";
|
||||
) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,8 +253,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function connect($host, $port = null, $timeout = 30, $options = array())
|
||||
{
|
||||
public function connect($host, $port = null, $timeout = 30, $options = array()) {
|
||||
static $streamok;
|
||||
//This is enabled by default since 5.0.0 but some providers disable it
|
||||
//Check this once and cache the result
|
||||
|
@ -276,7 +273,7 @@ class SMTP
|
|||
}
|
||||
// Connect to the SMTP server
|
||||
$this->edebug(
|
||||
"Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true),
|
||||
"Connection: opening to $host:$port, timeout=$timeout, options=" . var_export($options, true),
|
||||
self::DEBUG_CONNECTION
|
||||
);
|
||||
$errno = 0;
|
||||
|
@ -345,8 +342,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function startTLS()
|
||||
{
|
||||
public function startTLS() {
|
||||
if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -375,7 +371,6 @@ class SMTP
|
|||
/**
|
||||
* Perform SMTP authentication.
|
||||
* Must be run after hello().
|
||||
* @see hello()
|
||||
* @param string $username The user name
|
||||
* @param string $password The password
|
||||
* @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2)
|
||||
|
@ -383,6 +378,7 @@ class SMTP
|
|||
* @param string $workstation The auth workstation for NTLM
|
||||
* @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
|
||||
* @return bool True if successfully authenticated.* @access public
|
||||
* @see hello()
|
||||
*/
|
||||
public function authenticate(
|
||||
$username,
|
||||
|
@ -424,7 +420,7 @@ class SMTP
|
|||
$this->setError('No supported authentication methods found');
|
||||
return false;
|
||||
}
|
||||
self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
|
||||
self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
|
||||
}
|
||||
|
||||
if (!in_array($authtype, $this->server_caps['AUTH'])) {
|
||||
|
@ -554,8 +550,7 @@ class SMTP
|
|||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function hmac($data, $key)
|
||||
{
|
||||
protected function hmac($data, $key) {
|
||||
if (function_exists('hash_hmac')) {
|
||||
return hash_hmac('md5', $data, $key);
|
||||
}
|
||||
|
@ -586,8 +581,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean True if connected.
|
||||
*/
|
||||
public function connected()
|
||||
{
|
||||
public function connected() {
|
||||
if (is_resource($this->smtp_conn)) {
|
||||
$sock_status = stream_get_meta_data($this->smtp_conn);
|
||||
if ($sock_status['eof']) {
|
||||
|
@ -607,12 +601,11 @@ class SMTP
|
|||
/**
|
||||
* Close the socket and clean up the state of the class.
|
||||
* Don't use this function without first trying to use QUIT.
|
||||
* @return void
|
||||
* @see quit()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
public function close() {
|
||||
$this->setError('');
|
||||
$this->server_caps = null;
|
||||
$this->helo_rply = null;
|
||||
|
@ -636,8 +629,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function data($msg_data)
|
||||
{
|
||||
public function data($msg_data) {
|
||||
//This will use the standard timelimit
|
||||
if (!$this->sendCommand('DATA', 'DATA', 354)) {
|
||||
return false;
|
||||
|
@ -725,8 +717,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function hello($host = '')
|
||||
{
|
||||
public function hello($host = '') {
|
||||
//Try extended hello first (RFC 2821)
|
||||
return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
|
||||
}
|
||||
|
@ -734,14 +725,13 @@ class SMTP
|
|||
/**
|
||||
* Send an SMTP HELO or EHLO command.
|
||||
* Low-level implementation used by hello()
|
||||
* @see hello()
|
||||
* @param string $hello The HELO string
|
||||
* @param string $host The hostname to say we are
|
||||
* @access protected
|
||||
* @return boolean
|
||||
* @see hello()
|
||||
*/
|
||||
protected function sendHello($hello, $host)
|
||||
{
|
||||
protected function sendHello($hello, $host) {
|
||||
$noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
|
||||
$this->helo_rply = $this->last_reply;
|
||||
if ($noerror) {
|
||||
|
@ -758,8 +748,7 @@ class SMTP
|
|||
* @access protected
|
||||
* @param string $type - 'HELO' or 'EHLO'
|
||||
*/
|
||||
protected function parseHelloFields($type)
|
||||
{
|
||||
protected function parseHelloFields($type) {
|
||||
$this->server_caps = array();
|
||||
$lines = explode("\n", $this->helo_rply);
|
||||
|
||||
|
@ -805,8 +794,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function mail($from)
|
||||
{
|
||||
public function mail($from) {
|
||||
$useVerp = ($this->do_verp ? ' XVERP' : '');
|
||||
return $this->sendCommand(
|
||||
'MAIL FROM',
|
||||
|
@ -823,8 +811,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function quit($close_on_error = true)
|
||||
{
|
||||
public function quit($close_on_error = true) {
|
||||
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
|
||||
$err = $this->error; //Save any error
|
||||
if ($noerror or $close_on_error) {
|
||||
|
@ -843,8 +830,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function recipient($address)
|
||||
{
|
||||
public function recipient($address) {
|
||||
return $this->sendCommand(
|
||||
'RCPT TO',
|
||||
'RCPT TO:<' . $address . '>',
|
||||
|
@ -859,8 +845,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
public function reset() {
|
||||
return $this->sendCommand('RSET', 'RSET', 250);
|
||||
}
|
||||
|
||||
|
@ -872,8 +857,7 @@ class SMTP
|
|||
* @access protected
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
protected function sendCommand($command, $commandstring, $expect)
|
||||
{
|
||||
protected function sendCommand($command, $commandstring, $expect) {
|
||||
if (!$this->connected()) {
|
||||
$this->setError("Called $command without being connected");
|
||||
return false;
|
||||
|
@ -893,7 +877,7 @@ class SMTP
|
|||
$code_ex = (count($matches) > 2 ? $matches[2] : null);
|
||||
// Cut off error code from each response line
|
||||
$detail = preg_replace(
|
||||
"/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
|
||||
"/{$code}[ -]" . ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . "/m",
|
||||
'',
|
||||
$this->last_reply
|
||||
);
|
||||
|
@ -937,8 +921,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function sendAndMail($from)
|
||||
{
|
||||
public function sendAndMail($from) {
|
||||
return $this->sendCommand('SAML', "SAML FROM:$from", 250);
|
||||
}
|
||||
|
||||
|
@ -948,8 +931,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function verify($name)
|
||||
{
|
||||
public function verify($name) {
|
||||
return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
|
||||
}
|
||||
|
||||
|
@ -959,8 +941,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function noop()
|
||||
{
|
||||
public function noop() {
|
||||
return $this->sendCommand('NOOP', 'NOOP', 250);
|
||||
}
|
||||
|
||||
|
@ -973,8 +954,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function turn()
|
||||
{
|
||||
public function turn() {
|
||||
$this->setError('The SMTP TURN command is not implemented');
|
||||
$this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
|
||||
return false;
|
||||
|
@ -986,8 +966,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return integer|boolean The number of bytes sent to the server or false on error
|
||||
*/
|
||||
public function client_send($data)
|
||||
{
|
||||
public function client_send($data) {
|
||||
$this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
|
||||
return fwrite($this->smtp_conn, $data);
|
||||
}
|
||||
|
@ -997,8 +976,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
public function getError() {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
|
@ -1007,8 +985,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return array|null
|
||||
*/
|
||||
public function getServerExtList()
|
||||
{
|
||||
public function getServerExtList() {
|
||||
return $this->server_caps;
|
||||
}
|
||||
|
||||
|
@ -1031,8 +1008,7 @@ class SMTP
|
|||
* @param string $name Name of SMTP extension or 'HELO'|'EHLO'
|
||||
* @return mixed
|
||||
*/
|
||||
public function getServerExt($name)
|
||||
{
|
||||
public function getServerExt($name) {
|
||||
if (!$this->server_caps) {
|
||||
$this->setError('No HELO/EHLO was sent');
|
||||
return null;
|
||||
|
@ -1058,8 +1034,7 @@ class SMTP
|
|||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getLastReply()
|
||||
{
|
||||
public function getLastReply() {
|
||||
return $this->last_reply;
|
||||
}
|
||||
|
||||
|
@ -1072,8 +1047,7 @@ class SMTP
|
|||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function get_lines()
|
||||
{
|
||||
protected function get_lines() {
|
||||
// If the connection is bad, give up straight away
|
||||
if (!is_resource($this->smtp_conn)) {
|
||||
return '';
|
||||
|
@ -1105,7 +1079,7 @@ class SMTP
|
|||
// Now check if reads took too long
|
||||
if ($endtime and time() > $endtime) {
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): timelimit reached ('.
|
||||
'SMTP -> get_lines(): timelimit reached (' .
|
||||
$this->Timelimit . ' sec)',
|
||||
self::DEBUG_LOWLEVEL
|
||||
);
|
||||
|
@ -1119,8 +1093,7 @@ class SMTP
|
|||
* Enable or disable VERP address generation.
|
||||
* @param boolean $enabled
|
||||
*/
|
||||
public function setVerp($enabled = false)
|
||||
{
|
||||
public function setVerp($enabled = false) {
|
||||
$this->do_verp = $enabled;
|
||||
}
|
||||
|
||||
|
@ -1128,8 +1101,7 @@ class SMTP
|
|||
* Get VERP address generation mode.
|
||||
* @return boolean
|
||||
*/
|
||||
public function getVerp()
|
||||
{
|
||||
public function getVerp() {
|
||||
return $this->do_verp;
|
||||
}
|
||||
|
||||
|
@ -1140,8 +1112,7 @@ class SMTP
|
|||
* @param string $smtp_code An associated SMTP error code
|
||||
* @param string $smtp_code_ex Extended SMTP code
|
||||
*/
|
||||
protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')
|
||||
{
|
||||
protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') {
|
||||
$this->error = array(
|
||||
'error' => $message,
|
||||
'detail' => $detail,
|
||||
|
@ -1154,8 +1125,7 @@ class SMTP
|
|||
* Set debug output method.
|
||||
* @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
|
||||
*/
|
||||
public function setDebugOutput($method = 'echo')
|
||||
{
|
||||
public function setDebugOutput($method = 'echo') {
|
||||
$this->Debugoutput = $method;
|
||||
}
|
||||
|
||||
|
@ -1163,8 +1133,7 @@ class SMTP
|
|||
* Get debug output method.
|
||||
* @return string
|
||||
*/
|
||||
public function getDebugOutput()
|
||||
{
|
||||
public function getDebugOutput() {
|
||||
return $this->Debugoutput;
|
||||
}
|
||||
|
||||
|
@ -1172,8 +1141,7 @@ class SMTP
|
|||
* Set debug output level.
|
||||
* @param integer $level
|
||||
*/
|
||||
public function setDebugLevel($level = 0)
|
||||
{
|
||||
public function setDebugLevel($level = 0) {
|
||||
$this->do_debug = $level;
|
||||
}
|
||||
|
||||
|
@ -1181,8 +1149,7 @@ class SMTP
|
|||
* Get debug output level.
|
||||
* @return integer
|
||||
*/
|
||||
public function getDebugLevel()
|
||||
{
|
||||
public function getDebugLevel() {
|
||||
return $this->do_debug;
|
||||
}
|
||||
|
||||
|
@ -1190,8 +1157,7 @@ class SMTP
|
|||
* Set SMTP timeout.
|
||||
* @param integer $timeout
|
||||
*/
|
||||
public function setTimeout($timeout = 0)
|
||||
{
|
||||
public function setTimeout($timeout = 0) {
|
||||
$this->Timeout = $timeout;
|
||||
}
|
||||
|
||||
|
@ -1199,8 +1165,7 @@ class SMTP
|
|||
* Get SMTP timeout.
|
||||
* @return integer
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
public function getTimeout() {
|
||||
return $this->Timeout;
|
||||
}
|
||||
|
||||
|
@ -1209,8 +1174,7 @@ class SMTP
|
|||
* @param integer $errno The error number returned by PHP.
|
||||
* @param string $errmsg The error message returned by PHP.
|
||||
*/
|
||||
protected function errorHandler($errno, $errmsg)
|
||||
{
|
||||
protected function errorHandler($errno, $errmsg) {
|
||||
$notice = 'Connection: Failed to connect to server.';
|
||||
$this->setError(
|
||||
$notice,
|
||||
|
@ -1230,16 +1194,15 @@ class SMTP
|
|||
* If no pattern has been matched, it will return false.
|
||||
* @return bool|null|string
|
||||
*/
|
||||
public function getLastTransactionID()
|
||||
{
|
||||
public function getLastTransactionID() {
|
||||
$reply = $this->getLastReply();
|
||||
|
||||
if (empty($reply)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
|
||||
if(preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
|
||||
foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
|
||||
if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,14 +14,13 @@
|
|||
*/
|
||||
error_reporting(1);
|
||||
|
||||
function default_mail($admin_mail, $admin_name, $sent_mail, $subject, $body)
|
||||
{
|
||||
function default_mail($admin_mail, $admin_name, $sent_mail, $subject, $body) {
|
||||
// Functions
|
||||
require_once('class.phpmailer.php');
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = stripslashes ($body);
|
||||
$body = stripslashes($body);
|
||||
|
||||
$mail->AddReplyTo($admin_mail, $admin_name);
|
||||
|
||||
|
@ -48,8 +47,7 @@ function default_mail($admin_mail, $admin_name, $sent_mail, $subject, $body)
|
|||
|
||||
}
|
||||
|
||||
function smtp_mail($smtp_host, $smtp_port = 587, $smtp_auth, $smtp_user, $smtp_pass, $smtp_sec = 'tls', $admin_mail, $admin_name, $sent_mail, $subject, $body)
|
||||
{
|
||||
function smtp_mail($smtp_host, $smtp_port = 587, $smtp_auth, $smtp_user, $smtp_pass, $smtp_sec = 'tls', $admin_mail, $admin_name, $sent_mail, $subject, $body) {
|
||||
require_once('class.phpmailer.php');
|
||||
require_once('class.smtp.php');
|
||||
$mail = new PHPMailer;
|
||||
|
@ -78,4 +76,5 @@ function smtp_mail($smtp_host, $smtp_port = 587, $smtp_auth, $smtp_user, $smtp_p
|
|||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -21,8 +21,7 @@ require_once "Google/Http/Request.php";
|
|||
* @author Chris Chabot <chabotc@google.com>
|
||||
*
|
||||
*/
|
||||
abstract class Google_Auth_Abstract
|
||||
{
|
||||
abstract class Google_Auth_Abstract {
|
||||
/**
|
||||
* An utility function that first calls $this->auth->sign($request) and then
|
||||
* executes makeRequest() on that signed request. Used for when a request
|
||||
|
@ -31,5 +30,6 @@ abstract class Google_Auth_Abstract
|
|||
* @return Google_Http_Request $request
|
||||
*/
|
||||
abstract public function authenticatedRequest(Google_Http_Request $request);
|
||||
|
||||
abstract public function sign(Google_Http_Request $request);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* which is 5.3 and above only, so if you include this in a PHP 5.2
|
||||
* setup or one without 5.3 things will blow up.
|
||||
*/
|
||||
|
||||
use google\appengine\api\app_identity\AppIdentityService;
|
||||
|
||||
require_once "Google/Auth/Abstract.php";
|
||||
|
@ -28,8 +29,7 @@ require_once "Google/Http/Request.php";
|
|||
/**
|
||||
* Authentication via the Google App Engine App Identity service.
|
||||
*/
|
||||
class Google_Auth_AppIdentity extends Google_Auth_Abstract
|
||||
{
|
||||
class Google_Auth_AppIdentity extends Google_Auth_Abstract {
|
||||
const CACHE_PREFIX = "Google_Auth_AppIdentity::";
|
||||
const CACHE_LIFETIME = 1500;
|
||||
private $key = null;
|
||||
|
@ -37,16 +37,14 @@ class Google_Auth_AppIdentity extends Google_Auth_Abstract
|
|||
private $token = false;
|
||||
private $tokenScopes = false;
|
||||
|
||||
public function __construct(Google_Client $client, $config = null)
|
||||
{
|
||||
public function __construct(Google_Client $client, $config = null) {
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an access token for the scopes supplied.
|
||||
*/
|
||||
public function authenticateForScope($scopes)
|
||||
{
|
||||
public function authenticateForScope($scopes) {
|
||||
if ($this->token && $this->tokenScopes == $scopes) {
|
||||
return $this->token;
|
||||
}
|
||||
|
@ -58,7 +56,7 @@ class Google_Auth_AppIdentity extends Google_Auth_Abstract
|
|||
$memcache_key = self::CACHE_PREFIX;
|
||||
if (is_string($scopes)) {
|
||||
$memcache_key .= $scopes;
|
||||
} else if (is_array($scopes)) {
|
||||
} elseif (is_array($scopes)) {
|
||||
$memcache_key .= implode(":", $scopes);
|
||||
}
|
||||
$memcache->set($memcache_key, $this->token, self::CACHE_LIFETIME);
|
||||
|
@ -78,14 +76,12 @@ class Google_Auth_AppIdentity extends Google_Auth_Abstract
|
|||
* @return Google_Http_Request The resulting HTTP response including the
|
||||
* responseHttpCode, responseHeaders and responseBody.
|
||||
*/
|
||||
public function authenticatedRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function authenticatedRequest(Google_Http_Request $request) {
|
||||
$request = $this->sign($request);
|
||||
return $this->io->makeRequest($request);
|
||||
}
|
||||
|
||||
public function sign(Google_Http_Request $request)
|
||||
{
|
||||
public function sign(Google_Http_Request $request) {
|
||||
if (!$this->token) {
|
||||
// No token, so nothing to do.
|
||||
return $request;
|
||||
|
|
|
@ -24,8 +24,7 @@ require_once "Google/Utils.php";
|
|||
*
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Auth_AssertionCredentials
|
||||
{
|
||||
class Google_Auth_AssertionCredentials {
|
||||
const MAX_TOKEN_LIFETIME_SECS = 3600;
|
||||
|
||||
public $serviceAccountName;
|
||||
|
@ -75,8 +74,7 @@ class Google_Auth_AssertionCredentials
|
|||
* Generate a unique key to represent this credential.
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheKey()
|
||||
{
|
||||
public function getCacheKey() {
|
||||
if (!$this->useCache) {
|
||||
return false;
|
||||
}
|
||||
|
@ -88,8 +86,7 @@ class Google_Auth_AssertionCredentials
|
|||
return md5($h);
|
||||
}
|
||||
|
||||
public function generateAssertion()
|
||||
{
|
||||
public function generateAssertion() {
|
||||
$now = time();
|
||||
|
||||
$jwtParams = array(
|
||||
|
@ -102,7 +99,7 @@ class Google_Auth_AssertionCredentials
|
|||
|
||||
if ($this->sub !== false) {
|
||||
$jwtParams['sub'] = $this->sub;
|
||||
} else if ($this->prn !== false) {
|
||||
} elseif ($this->prn !== false) {
|
||||
$jwtParams['prn'] = $this->prn;
|
||||
}
|
||||
|
||||
|
@ -114,8 +111,7 @@ class Google_Auth_AssertionCredentials
|
|||
* @param array $payload
|
||||
* @return string The signed JWT.
|
||||
*/
|
||||
private function makeSignedJwt($payload)
|
||||
{
|
||||
private function makeSignedJwt($payload) {
|
||||
$header = array('typ' => 'JWT', 'alg' => 'RS256');
|
||||
|
||||
$payload = json_encode($payload);
|
||||
|
|
|
@ -17,6 +17,5 @@
|
|||
|
||||
require_once "Google/Exception.php";
|
||||
|
||||
class Google_Auth_Exception extends Google_Exception
|
||||
{
|
||||
class Google_Auth_Exception extends Google_Exception {
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ require_once "Google/Auth/Exception.php";
|
|||
*
|
||||
* @author Brian Eaton <beaton@google.com>
|
||||
*/
|
||||
class Google_Auth_LoginTicket
|
||||
{
|
||||
class Google_Auth_LoginTicket {
|
||||
const USER_ATTR = "sub";
|
||||
|
||||
// Information from id token envelope.
|
||||
|
@ -38,19 +37,17 @@ class Google_Auth_LoginTicket
|
|||
* @param string $envelope Header from a verified authentication token.
|
||||
* @param string $payload Information from a verified authentication token.
|
||||
*/
|
||||
public function __construct($envelope, $payload)
|
||||
{
|
||||
public function __construct($envelope, $payload) {
|
||||
$this->envelope = $envelope;
|
||||
$this->payload = $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric identifier for the user.
|
||||
* @throws Google_Auth_Exception
|
||||
* @return
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
public function getUserId() {
|
||||
if (array_key_exists(self::USER_ATTR, $this->payload)) {
|
||||
return $this->payload[self::USER_ATTR];
|
||||
}
|
||||
|
@ -62,8 +59,7 @@ class Google_Auth_LoginTicket
|
|||
* various information about the user session.
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
public function getAttributes() {
|
||||
return array("envelope" => $this->envelope, "payload" => $this->payload);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,7 @@ require_once "Google/Verifier/Pem.php";
|
|||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
||||
{
|
||||
class Google_Auth_OAuth2 extends Google_Auth_Abstract {
|
||||
const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
|
||||
const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
|
||||
const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
|
||||
|
@ -63,8 +62,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* Instantiates the class, but does not initiate the login flow, leaving it
|
||||
* to the discretion of the caller.
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
|
@ -78,19 +76,17 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @return Google_Http_Request The resulting HTTP response including the
|
||||
* responseHttpCode, responseHeaders and responseBody.
|
||||
*/
|
||||
public function authenticatedRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function authenticatedRequest(Google_Http_Request $request) {
|
||||
$request = $this->sign($request);
|
||||
return $this->client->getIo()->makeRequest($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @throws Google_Auth_Exception
|
||||
* @return string
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function authenticate($code)
|
||||
{
|
||||
public function authenticate($code) {
|
||||
if (strlen($code) == 0) {
|
||||
throw new Google_Auth_Exception("Invalid code");
|
||||
}
|
||||
|
@ -138,8 +134,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @param string $scope The scope is expressed as a list of space-delimited strings.
|
||||
* @return string
|
||||
*/
|
||||
public function createAuthUrl($scope)
|
||||
{
|
||||
public function createAuthUrl($scope) {
|
||||
$params = array(
|
||||
'response_type' => 'code',
|
||||
'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'),
|
||||
|
@ -172,30 +167,26 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @param string $token
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function setAccessToken($token)
|
||||
{
|
||||
public function setAccessToken($token) {
|
||||
$token = json_decode($token, true);
|
||||
if ($token == null) {
|
||||
throw new Google_Auth_Exception('Could not json decode the token');
|
||||
}
|
||||
if (! isset($token['access_token'])) {
|
||||
if (!isset($token['access_token'])) {
|
||||
throw new Google_Auth_Exception("Invalid token format");
|
||||
}
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function getAccessToken()
|
||||
{
|
||||
public function getAccessToken() {
|
||||
return json_encode($this->token);
|
||||
}
|
||||
|
||||
public function setState($state)
|
||||
{
|
||||
public function setState($state) {
|
||||
$this->state = $state;
|
||||
}
|
||||
|
||||
public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
|
||||
{
|
||||
public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds) {
|
||||
$this->assertionCredentials = $creds;
|
||||
}
|
||||
|
||||
|
@ -205,8 +196,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @return Google_Http_Request
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function sign(Google_Http_Request $request)
|
||||
{
|
||||
public function sign(Google_Http_Request $request) {
|
||||
// add the developer key to the request before signing it
|
||||
if ($this->client->getClassConfig($this, 'developer_key')) {
|
||||
$request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
|
||||
|
@ -223,11 +213,11 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
if ($this->assertionCredentials) {
|
||||
$this->refreshTokenWithAssertion();
|
||||
} else {
|
||||
if (! array_key_exists('refresh_token', $this->token)) {
|
||||
if (!array_key_exists('refresh_token', $this->token)) {
|
||||
throw new Google_Auth_Exception(
|
||||
"The OAuth 2.0 access token has expired,"
|
||||
." and a refresh token is not available. Refresh tokens"
|
||||
." are not returned for responses that were auto-approved."
|
||||
. " and a refresh token is not available. Refresh tokens"
|
||||
. " are not returned for responses that were auto-approved."
|
||||
);
|
||||
}
|
||||
$this->refreshToken($this->token['refresh_token']);
|
||||
|
@ -247,8 +237,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @param string $refreshToken
|
||||
* @return void
|
||||
*/
|
||||
public function refreshToken($refreshToken)
|
||||
{
|
||||
public function refreshToken($refreshToken) {
|
||||
$this->refreshTokenRequest(
|
||||
array(
|
||||
'client_id' => $this->client->getClassConfig($this, 'client_id'),
|
||||
|
@ -264,8 +253,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @param Google_Auth_AssertionCredentials $assertionCredentials optional.
|
||||
* @return void
|
||||
*/
|
||||
public function refreshTokenWithAssertion($assertionCredentials = null)
|
||||
{
|
||||
public function refreshTokenWithAssertion($assertionCredentials = null) {
|
||||
if (!$assertionCredentials) {
|
||||
$assertionCredentials = $this->assertionCredentials;
|
||||
}
|
||||
|
@ -302,8 +290,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
}
|
||||
}
|
||||
|
||||
private function refreshTokenRequest($params)
|
||||
{
|
||||
private function refreshTokenRequest($params) {
|
||||
$http = new Google_Http_Request(
|
||||
self::OAUTH2_TOKEN_URI,
|
||||
'POST',
|
||||
|
@ -321,7 +308,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
throw new Google_Auth_Exception("Could not json decode the access token");
|
||||
}
|
||||
|
||||
if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
|
||||
if (!isset($token['access_token']) || !isset($token['expires_in'])) {
|
||||
throw new Google_Auth_Exception("Invalid token format");
|
||||
}
|
||||
|
||||
|
@ -339,12 +326,11 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
/**
|
||||
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
||||
* token, if a token isn't provided.
|
||||
* @throws Google_Auth_Exception
|
||||
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
||||
* @return boolean Returns True if the revocation was successful, otherwise False.
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function revokeToken($token = null)
|
||||
{
|
||||
public function revokeToken($token = null) {
|
||||
if (!$token) {
|
||||
if (!$this->token) {
|
||||
// Not initialized, no token to actually revoke
|
||||
|
@ -376,8 +362,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* Returns if the access_token is expired.
|
||||
* @return bool Returns True if the access_token is expired.
|
||||
*/
|
||||
public function isAccessTokenExpired()
|
||||
{
|
||||
public function isAccessTokenExpired() {
|
||||
if (!$this->token || !isset($this->token['created'])) {
|
||||
return true;
|
||||
}
|
||||
|
@ -392,8 +377,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
// Gets federated sign-on certificates to use for verifying identity tokens.
|
||||
// Returns certs as array structure, where keys are key ids, and values
|
||||
// are PEM encoded certificates.
|
||||
private function getFederatedSignOnCerts()
|
||||
{
|
||||
private function getFederatedSignOnCerts() {
|
||||
return $this->retrieveCertsFromLocation(
|
||||
$this->client->getClassConfig($this, 'federated_signon_certs_url')
|
||||
);
|
||||
|
@ -404,8 +388,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @param $url location
|
||||
* @return array certificates
|
||||
*/
|
||||
public function retrieveCertsFromLocation($url)
|
||||
{
|
||||
public function retrieveCertsFromLocation($url) {
|
||||
// If we're retrieving a local file, just grab it.
|
||||
if ("http" != substr($url, 0, 4)) {
|
||||
$file = file_get_contents($url);
|
||||
|
@ -448,8 +431,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|||
* @param $audience
|
||||
* @return Google_Auth_LoginTicket
|
||||
*/
|
||||
public function verifyIdToken($id_token = null, $audience = null)
|
||||
{
|
||||
public function verifyIdToken($id_token = null, $audience = null) {
|
||||
if (!$id_token) {
|
||||
$id_token = $this->token['id_token'];
|
||||
}
|
||||
|
|
|
@ -25,13 +25,11 @@ require_once "Google/Http/Request.php";
|
|||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Auth_Simple extends Google_Auth_Abstract
|
||||
{
|
||||
class Google_Auth_Simple extends Google_Auth_Abstract {
|
||||
private $key = null;
|
||||
private $client;
|
||||
|
||||
public function __construct(Google_Client $client, $config = null)
|
||||
{
|
||||
public function __construct(Google_Client $client, $config = null) {
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
|
@ -45,14 +43,12 @@ class Google_Auth_Simple extends Google_Auth_Abstract
|
|||
* @return Google_Http_Request The resulting HTTP response including the
|
||||
* responseHttpCode, responseHeaders and responseBody.
|
||||
*/
|
||||
public function authenticatedRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function authenticatedRequest(Google_Http_Request $request) {
|
||||
$request = $this->sign($request);
|
||||
return $this->io->makeRequest($request);
|
||||
}
|
||||
|
||||
public function sign(Google_Http_Request $request)
|
||||
{
|
||||
public function sign(Google_Http_Request $request) {
|
||||
$key = $this->client->getClassConfig($this, 'developer_key');
|
||||
if ($key) {
|
||||
$request->setQueryParam('key', $key);
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
abstract class Google_Cache_Abstract
|
||||
{
|
||||
abstract class Google_Cache_Abstract {
|
||||
|
||||
abstract public function __construct(Google_Client $client);
|
||||
|
||||
|
|
|
@ -26,11 +26,9 @@ require_once "Google/Cache/Exception.php";
|
|||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
class Google_Cache_Apc extends Google_Cache_Abstract
|
||||
{
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
if (! function_exists('apc_add') ) {
|
||||
class Google_Cache_Apc extends Google_Cache_Abstract {
|
||||
public function __construct(Google_Client $client) {
|
||||
if (!function_exists('apc_add')) {
|
||||
throw new Google_Cache_Exception("Apc functions not available");
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +36,7 @@ class Google_Cache_Apc extends Google_Cache_Abstract
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get($key, $expiration = false)
|
||||
{
|
||||
public function get($key, $expiration = false) {
|
||||
$ret = apc_fetch($key);
|
||||
if ($ret === false) {
|
||||
return false;
|
||||
|
@ -54,8 +51,7 @@ class Google_Cache_Apc extends Google_Cache_Abstract
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
public function set($key, $value) {
|
||||
$rc = apc_store($key, array('time' => time(), 'data' => $value));
|
||||
if ($rc == false) {
|
||||
throw new Google_Cache_Exception("Couldn't store data");
|
||||
|
@ -66,8 +62,7 @@ class Google_Cache_Apc extends Google_Cache_Abstract
|
|||
* @inheritDoc
|
||||
* @param String $key
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
public function delete($key) {
|
||||
apc_delete($key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,5 @@
|
|||
*/
|
||||
require_once "Google/Exception.php";
|
||||
|
||||
class Google_Cache_Exception extends Google_Exception
|
||||
{
|
||||
class Google_Cache_Exception extends Google_Exception {
|
||||
}
|
||||
|
|
|
@ -26,19 +26,17 @@ require_once "Google/Cache/Exception.php";
|
|||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
class Google_Cache_File extends Google_Cache_Abstract
|
||||
{
|
||||
|
||||
class Google_Cache_File extends Google_Cache_Abstract {
|
||||
const MAX_LOCK_RETRIES = 10;
|
||||
private $path;
|
||||
private $fh;
|
||||
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
$this->path = $client->getClassConfig($this, 'directory');
|
||||
}
|
||||
|
||||
public function get($key, $expiration = false)
|
||||
{
|
||||
public function get($key, $expiration = false) {
|
||||
$storageFile = $this->getCacheFile($key);
|
||||
$data = false;
|
||||
|
||||
|
@ -63,8 +61,7 @@ class Google_Cache_File extends Google_Cache_Abstract
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function set($key, $value)
|
||||
{
|
||||
public function set($key, $value) {
|
||||
$storageFile = $this->getWriteableCacheFile($key);
|
||||
if ($this->acquireWriteLock($storageFile)) {
|
||||
// We serialize the whole request object, since we don't only want the
|
||||
|
@ -75,45 +72,39 @@ class Google_Cache_File extends Google_Cache_Abstract
|
|||
}
|
||||
}
|
||||
|
||||
public function delete($key)
|
||||
{
|
||||
public function delete($key) {
|
||||
$file = $this->getCacheFile($key);
|
||||
if (file_exists($file) && !unlink($file)) {
|
||||
throw new Google_Cache_Exception("Cache file could not be deleted");
|
||||
}
|
||||
}
|
||||
|
||||
private function getWriteableCacheFile($file)
|
||||
{
|
||||
private function getWriteableCacheFile($file) {
|
||||
return $this->getCacheFile($file, true);
|
||||
}
|
||||
|
||||
private function getCacheFile($file, $forWrite = false)
|
||||
{
|
||||
private function getCacheFile($file, $forWrite = false) {
|
||||
return $this->getCacheDir($file, $forWrite) . '/' . md5($file);
|
||||
}
|
||||
|
||||
private function getCacheDir($file, $forWrite)
|
||||
{
|
||||
private function getCacheDir($file, $forWrite) {
|
||||
// use the first 2 characters of the hash as a directory prefix
|
||||
// this should prevent slowdowns due to huge directory listings
|
||||
// and thus give some basic amount of scalability
|
||||
$storageDir = $this->path . '/' . substr(md5($file), 0, 2);
|
||||
if ($forWrite && ! is_dir($storageDir)) {
|
||||
if (! mkdir($storageDir, 0755, true)) {
|
||||
if ($forWrite && !is_dir($storageDir)) {
|
||||
if (!mkdir($storageDir, 0755, true)) {
|
||||
throw new Google_Cache_Exception("Could not create storage directory: $storageDir");
|
||||
}
|
||||
}
|
||||
return $storageDir;
|
||||
}
|
||||
|
||||
private function acquireReadLock($storageFile)
|
||||
{
|
||||
private function acquireReadLock($storageFile) {
|
||||
return $this->acquireLock(LOCK_SH, $storageFile);
|
||||
}
|
||||
|
||||
private function acquireWriteLock($storageFile)
|
||||
{
|
||||
private function acquireWriteLock($storageFile) {
|
||||
$rc = $this->acquireLock(LOCK_EX, $storageFile);
|
||||
if (!$rc) {
|
||||
$this->delete($storageFile);
|
||||
|
@ -121,8 +112,7 @@ class Google_Cache_File extends Google_Cache_Abstract
|
|||
return $rc;
|
||||
}
|
||||
|
||||
private function acquireLock($type, $storageFile)
|
||||
{
|
||||
private function acquireLock($type, $storageFile) {
|
||||
$mode = $type == LOCK_EX ? "w" : "r";
|
||||
$this->fh = fopen($storageFile, $mode);
|
||||
$count = 0;
|
||||
|
@ -136,8 +126,7 @@ class Google_Cache_File extends Google_Cache_Abstract
|
|||
return true;
|
||||
}
|
||||
|
||||
public function unlock($storageFile)
|
||||
{
|
||||
public function unlock($storageFile) {
|
||||
if ($this->fh) {
|
||||
flock($this->fh, LOCK_UN);
|
||||
}
|
||||
|
|
|
@ -28,15 +28,13 @@ require_once "Google/Cache/Exception.php";
|
|||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
class Google_Cache_Memcache extends Google_Cache_Abstract
|
||||
{
|
||||
class Google_Cache_Memcache extends Google_Cache_Abstract {
|
||||
private $connection = false;
|
||||
private $mc = false;
|
||||
private $host;
|
||||
private $port;
|
||||
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
|
||||
throw new Google_Cache_Exception("Memcache functions not available");
|
||||
}
|
||||
|
@ -56,8 +54,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get($key, $expiration = false)
|
||||
{
|
||||
public function get($key, $expiration = false) {
|
||||
$this->connect();
|
||||
$ret = false;
|
||||
if ($this->mc) {
|
||||
|
@ -81,8 +78,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|||
* @param string $value
|
||||
* @throws Google_Cache_Exception
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
public function set($key, $value) {
|
||||
$this->connect();
|
||||
// we store it with the cache_time default expiration so objects will at
|
||||
// least get cleaned eventually.
|
||||
|
@ -102,8 +98,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|||
* @inheritDoc
|
||||
* @param String $key
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
public function delete($key) {
|
||||
$this->connect();
|
||||
if ($this->mc) {
|
||||
$this->mc->delete($key, 0);
|
||||
|
@ -116,8 +111,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|||
* Lazy initialiser for memcache connection. Uses pconnect for to take
|
||||
* advantage of the persistence pool where possible.
|
||||
*/
|
||||
private function connect()
|
||||
{
|
||||
private function connect() {
|
||||
if ($this->connection) {
|
||||
return;
|
||||
}
|
||||
|
@ -130,7 +124,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|||
$this->connection = memcache_pconnect($this->host, $this->port);
|
||||
}
|
||||
|
||||
if (! $this->connection) {
|
||||
if (!$this->connection) {
|
||||
throw new Google_Cache_Exception("Couldn't connect to memcache server");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,26 +22,22 @@ require_once "Google/Cache/Exception.php";
|
|||
* A blank storage class, for cases where caching is not
|
||||
* required.
|
||||
*/
|
||||
class Google_Cache_Null extends Google_Cache_Abstract
|
||||
{
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
class Google_Cache_Null extends Google_Cache_Abstract {
|
||||
public function __construct(Google_Client $client) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get($key, $expiration = false)
|
||||
{
|
||||
public function get($key, $expiration = false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
public function set($key, $value) {
|
||||
// Nop.
|
||||
}
|
||||
|
||||
|
@ -49,8 +45,7 @@ class Google_Cache_Null extends Google_Cache_Abstract
|
|||
* @inheritDoc
|
||||
* @param String $key
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
public function delete($key) {
|
||||
// Nop.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,7 @@ require_once 'Google/Service/Resource.php';
|
|||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Client
|
||||
{
|
||||
class Google_Client {
|
||||
const LIBVER = "1.0.5-beta";
|
||||
const USER_AGENT_SUFFIX = "google-api-php-client/";
|
||||
/**
|
||||
|
@ -78,11 +77,10 @@ class Google_Client
|
|||
*
|
||||
* @param $config Google_Config or string for the ini file to load
|
||||
*/
|
||||
public function __construct($config = null)
|
||||
{
|
||||
public function __construct($config = null) {
|
||||
if (is_string($config) && strlen($config)) {
|
||||
$config = new Google_Config($config);
|
||||
} else if ( !($config instanceof Google_Config)) {
|
||||
} elseif (!($config instanceof Google_Config)) {
|
||||
$config = new Google_Config();
|
||||
|
||||
if ($this->isAppEngine()) {
|
||||
|
@ -112,8 +110,7 @@ class Google_Client
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLibraryVersion()
|
||||
{
|
||||
public function getLibraryVersion() {
|
||||
return self::LIBVER;
|
||||
}
|
||||
|
||||
|
@ -124,8 +121,7 @@ class Google_Client
|
|||
* @param $code string code from accounts.google.com
|
||||
* @return string token
|
||||
*/
|
||||
public function authenticate($code)
|
||||
{
|
||||
public function authenticate($code) {
|
||||
$this->authenticated = true;
|
||||
return $this->getAuth()->authenticate($code);
|
||||
}
|
||||
|
@ -137,8 +133,7 @@ class Google_Client
|
|||
* Console.
|
||||
* @param string $json the configuration json
|
||||
*/
|
||||
public function setAuthConfig($json)
|
||||
{
|
||||
public function setAuthConfig($json) {
|
||||
$data = json_decode($json);
|
||||
$key = isset($data->installed) ? 'installed' : 'web';
|
||||
if (!isset($data->$key)) {
|
||||
|
@ -158,8 +153,7 @@ class Google_Client
|
|||
* Console.
|
||||
* @param string $file the file location of the client json
|
||||
*/
|
||||
public function setAuthConfigFile($file)
|
||||
{
|
||||
public function setAuthConfigFile($file) {
|
||||
$this->setAuthConfig(file_get_contents($file));
|
||||
}
|
||||
|
||||
|
@ -167,8 +161,7 @@ class Google_Client
|
|||
* @return array
|
||||
* @visible For Testing
|
||||
*/
|
||||
public function prepareScopes()
|
||||
{
|
||||
public function prepareScopes() {
|
||||
if (empty($this->requestedScopes)) {
|
||||
throw new Google_Auth_Exception("No scopes specified");
|
||||
}
|
||||
|
@ -183,8 +176,7 @@ class Google_Client
|
|||
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
|
||||
* "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
|
||||
*/
|
||||
public function setAccessToken($accessToken)
|
||||
{
|
||||
public function setAccessToken($accessToken) {
|
||||
if ($accessToken == 'null') {
|
||||
$accessToken = null;
|
||||
}
|
||||
|
@ -192,13 +184,11 @@ class Google_Client
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the authenticator object
|
||||
* @param Google_Auth_Abstract $auth
|
||||
*/
|
||||
public function setAuth(Google_Auth_Abstract $auth)
|
||||
{
|
||||
public function setAuth(Google_Auth_Abstract $auth) {
|
||||
$this->config->setAuthClass(get_class($auth));
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
@ -207,8 +197,7 @@ class Google_Client
|
|||
* Set the IO object
|
||||
* @param Google_Io_Abstract $auth
|
||||
*/
|
||||
public function setIo(Google_Io_Abstract $io)
|
||||
{
|
||||
public function setIo(Google_Io_Abstract $io) {
|
||||
$this->config->setIoClass(get_class($io));
|
||||
$this->io = $io;
|
||||
}
|
||||
|
@ -217,8 +206,7 @@ class Google_Client
|
|||
* Set the Cache object
|
||||
* @param Google_Cache_Abstract $auth
|
||||
*/
|
||||
public function setCache(Google_Cache_Abstract $cache)
|
||||
{
|
||||
public function setCache(Google_Cache_Abstract $cache) {
|
||||
$this->config->setCacheClass(get_class($cache));
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
@ -227,8 +215,7 @@ class Google_Client
|
|||
* Construct the OAuth 2.0 authorization request URI.
|
||||
* @return string
|
||||
*/
|
||||
public function createAuthUrl()
|
||||
{
|
||||
public function createAuthUrl() {
|
||||
$scopes = $this->prepareScopes();
|
||||
return $this->getAuth()->createAuthUrl($scopes);
|
||||
}
|
||||
|
@ -239,8 +226,7 @@ class Google_Client
|
|||
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
|
||||
* "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
public function getAccessToken() {
|
||||
$token = $this->getAuth()->getAccessToken();
|
||||
// The response is json encoded, so could be the string null.
|
||||
// It is arguable whether this check should be here or lower
|
||||
|
@ -252,8 +238,7 @@ class Google_Client
|
|||
* Returns if the access_token is expired.
|
||||
* @return bool Returns True if the access_token is expired.
|
||||
*/
|
||||
public function isAccessTokenExpired()
|
||||
{
|
||||
public function isAccessTokenExpired() {
|
||||
return $this->getAuth()->isAccessTokenExpired();
|
||||
}
|
||||
|
||||
|
@ -262,8 +247,7 @@ class Google_Client
|
|||
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
|
||||
* @param string $state
|
||||
*/
|
||||
public function setState($state)
|
||||
{
|
||||
public function setState($state) {
|
||||
$this->getAuth()->setState($state);
|
||||
}
|
||||
|
||||
|
@ -272,8 +256,7 @@ class Google_Client
|
|||
* {@code "offline"} to request offline access from the user.
|
||||
* {@code "online"} to request online access from the user.
|
||||
*/
|
||||
public function setAccessType($accessType)
|
||||
{
|
||||
public function setAccessType($accessType) {
|
||||
$this->config->setAccessType($accessType);
|
||||
}
|
||||
|
||||
|
@ -282,8 +265,7 @@ class Google_Client
|
|||
* {@code "force"} to force the approval UI to appear. (This is the default value)
|
||||
* {@code "auto"} to request auto-approval when possible.
|
||||
*/
|
||||
public function setApprovalPrompt($approvalPrompt)
|
||||
{
|
||||
public function setApprovalPrompt($approvalPrompt) {
|
||||
$this->config->setApprovalPrompt($approvalPrompt);
|
||||
}
|
||||
|
||||
|
@ -291,8 +273,7 @@ class Google_Client
|
|||
* Set the login hint, email address or sub id.
|
||||
* @param string $loginHint
|
||||
*/
|
||||
public function setLoginHint($loginHint)
|
||||
{
|
||||
public function setLoginHint($loginHint) {
|
||||
$this->config->setLoginHint($loginHint);
|
||||
}
|
||||
|
||||
|
@ -300,8 +281,7 @@ class Google_Client
|
|||
* Set the application name, this is included in the User-Agent HTTP header.
|
||||
* @param string $applicationName
|
||||
*/
|
||||
public function setApplicationName($applicationName)
|
||||
{
|
||||
public function setApplicationName($applicationName) {
|
||||
$this->config->setApplicationName($applicationName);
|
||||
}
|
||||
|
||||
|
@ -309,8 +289,7 @@ class Google_Client
|
|||
* Set the OAuth 2.0 Client ID.
|
||||
* @param string $clientId
|
||||
*/
|
||||
public function setClientId($clientId)
|
||||
{
|
||||
public function setClientId($clientId) {
|
||||
$this->config->setClientId($clientId);
|
||||
}
|
||||
|
||||
|
@ -318,8 +297,7 @@ class Google_Client
|
|||
* Set the OAuth 2.0 Client Secret.
|
||||
* @param string $clientSecret
|
||||
*/
|
||||
public function setClientSecret($clientSecret)
|
||||
{
|
||||
public function setClientSecret($clientSecret) {
|
||||
$this->config->setClientSecret($clientSecret);
|
||||
}
|
||||
|
||||
|
@ -327,8 +305,7 @@ class Google_Client
|
|||
* Set the OAuth 2.0 Redirect URI.
|
||||
* @param string $redirectUri
|
||||
*/
|
||||
public function setRedirectUri($redirectUri)
|
||||
{
|
||||
public function setRedirectUri($redirectUri) {
|
||||
$this->config->setRedirectUri($redirectUri);
|
||||
}
|
||||
|
||||
|
@ -340,8 +317,7 @@ class Google_Client
|
|||
*
|
||||
* @param array $requestVisibleActions Array of app activity types
|
||||
*/
|
||||
public function setRequestVisibleActions($requestVisibleActions)
|
||||
{
|
||||
public function setRequestVisibleActions($requestVisibleActions) {
|
||||
if (is_array($requestVisibleActions)) {
|
||||
$requestVisibleActions = join(" ", $requestVisibleActions);
|
||||
}
|
||||
|
@ -353,8 +329,7 @@ class Google_Client
|
|||
* @see http://code.google.com/apis/console-help/#generatingdevkeys
|
||||
* @param string $developerKey
|
||||
*/
|
||||
public function setDeveloperKey($developerKey)
|
||||
{
|
||||
public function setDeveloperKey($developerKey) {
|
||||
$this->config->setDeveloperKey($developerKey);
|
||||
}
|
||||
|
||||
|
@ -363,33 +338,30 @@ class Google_Client
|
|||
* @param string $refreshToken
|
||||
* @return void
|
||||
*/
|
||||
public function refreshToken($refreshToken)
|
||||
{
|
||||
public function refreshToken($refreshToken) {
|
||||
return $this->getAuth()->refreshToken($refreshToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
||||
* token, if a token isn't provided.
|
||||
* @throws Google_Auth_Exception
|
||||
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
||||
* @return boolean Returns True if the revocation was successful, otherwise False.
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function revokeToken($token = null)
|
||||
{
|
||||
public function revokeToken($token = null) {
|
||||
return $this->getAuth()->revokeToken($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify an id_token. This method will verify the current id_token, if one
|
||||
* isn't provided.
|
||||
* @throws Google_Auth_Exception
|
||||
* @param string|null $token The token (id_token) that should be verified.
|
||||
* @return Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
|
||||
* successful.
|
||||
* @throws Google_Auth_Exception
|
||||
*/
|
||||
public function verifyIdToken($token = null)
|
||||
{
|
||||
public function verifyIdToken($token = null) {
|
||||
return $this->getAuth()->verifyIdToken($token);
|
||||
}
|
||||
|
||||
|
@ -403,8 +375,7 @@ class Google_Client
|
|||
* @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
|
||||
* @return token information if valid, false if not
|
||||
*/
|
||||
public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
|
||||
{
|
||||
public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null) {
|
||||
$auth = new Google_Auth_OAuth2($this);
|
||||
$certs = $auth->retrieveCertsFromLocation($cert_location);
|
||||
return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
|
||||
|
@ -414,19 +385,17 @@ class Google_Client
|
|||
* @param Google_Auth_AssertionCredentials $creds
|
||||
* @return void
|
||||
*/
|
||||
public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
|
||||
{
|
||||
public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds) {
|
||||
$this->getAuth()->setAssertionCredentials($creds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the scopes to be requested. Must be called before createAuthUrl().
|
||||
* Will remove any previously configured scopes.
|
||||
* @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login',
|
||||
* @param array $scopes , ie: array('https://www.googleapis.com/auth/plus.login',
|
||||
* 'https://www.googleapis.com/auth/moderator')
|
||||
*/
|
||||
public function setScopes($scopes)
|
||||
{
|
||||
public function setScopes($scopes) {
|
||||
$this->requestedScopes = array();
|
||||
$this->addScope($scopes);
|
||||
}
|
||||
|
@ -438,11 +407,10 @@ class Google_Client
|
|||
* will each be appended.
|
||||
* @param $scope_or_scopes string|array e.g. "profile"
|
||||
*/
|
||||
public function addScope($scope_or_scopes)
|
||||
{
|
||||
public function addScope($scope_or_scopes) {
|
||||
if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
|
||||
$this->requestedScopes[] = $scope_or_scopes;
|
||||
} else if (is_array($scope_or_scopes)) {
|
||||
} elseif (is_array($scope_or_scopes)) {
|
||||
foreach ($scope_or_scopes as $scope) {
|
||||
$this->addScope($scope);
|
||||
}
|
||||
|
@ -454,8 +422,7 @@ class Google_Client
|
|||
* @return array the list of scopes
|
||||
*
|
||||
*/
|
||||
public function getScopes()
|
||||
{
|
||||
public function getScopes() {
|
||||
return $this->requestedScopes;
|
||||
}
|
||||
|
||||
|
@ -466,8 +433,7 @@ class Google_Client
|
|||
* @param boolean $useBatch True if the batch support should
|
||||
* be enabled. Defaults to False.
|
||||
*/
|
||||
public function setUseBatch($useBatch)
|
||||
{
|
||||
public function setUseBatch($useBatch) {
|
||||
// This is actually an alias for setDefer.
|
||||
$this->setDefer($useBatch);
|
||||
}
|
||||
|
@ -478,8 +444,7 @@ class Google_Client
|
|||
*
|
||||
* @param boolean $defer True if calls should not be executed right away.
|
||||
*/
|
||||
public function setDefer($defer)
|
||||
{
|
||||
public function setDefer($defer) {
|
||||
$this->deferExecution = $defer;
|
||||
}
|
||||
|
||||
|
@ -488,8 +453,7 @@ class Google_Client
|
|||
*
|
||||
* @returns object of the type of the expected class or array.
|
||||
*/
|
||||
public function execute($request)
|
||||
{
|
||||
public function execute($request) {
|
||||
if ($request instanceof Google_Http_Request) {
|
||||
$request->setUserAgent(
|
||||
$this->getApplicationName()
|
||||
|
@ -501,7 +465,7 @@ class Google_Client
|
|||
}
|
||||
$request->maybeMoveParametersToBody();
|
||||
return Google_Http_REST::execute($this, $request);
|
||||
} else if ($request instanceof Google_Http_Batch) {
|
||||
} elseif ($request instanceof Google_Http_Batch) {
|
||||
return $request->execute();
|
||||
} else {
|
||||
throw new Google_Exception("Do not know how to execute this type of object.");
|
||||
|
@ -512,16 +476,14 @@ class Google_Client
|
|||
* Whether or not to return raw requests
|
||||
* @return boolean
|
||||
*/
|
||||
public function shouldDefer()
|
||||
{
|
||||
public function shouldDefer() {
|
||||
return $this->deferExecution;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Google_Auth_Abstract Authentication implementation
|
||||
*/
|
||||
public function getAuth()
|
||||
{
|
||||
public function getAuth() {
|
||||
if (!isset($this->auth)) {
|
||||
$class = $this->config->getAuthClass();
|
||||
$this->auth = new $class($this);
|
||||
|
@ -532,8 +494,7 @@ class Google_Client
|
|||
/**
|
||||
* @return Google_IO_Abstract IO implementation
|
||||
*/
|
||||
public function getIo()
|
||||
{
|
||||
public function getIo() {
|
||||
if (!isset($this->io)) {
|
||||
$class = $this->config->getIoClass();
|
||||
$this->io = new $class($this);
|
||||
|
@ -544,8 +505,7 @@ class Google_Client
|
|||
/**
|
||||
* @return Google_Cache_Abstract Cache implementation
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
public function getCache() {
|
||||
if (!isset($this->cache)) {
|
||||
$class = $this->config->getCacheClass();
|
||||
$this->cache = new $class($this);
|
||||
|
@ -558,8 +518,7 @@ class Google_Client
|
|||
* @param $class string|object - class or instance of class to retrieve
|
||||
* @param $key string optional - key to retrieve
|
||||
*/
|
||||
public function getClassConfig($class, $key = null)
|
||||
{
|
||||
public function getClassConfig($class, $key = null) {
|
||||
if (!is_string($class)) {
|
||||
$class = get_class($class);
|
||||
}
|
||||
|
@ -575,8 +534,7 @@ class Google_Client
|
|||
* @param $value optional - if $config is a key, the value
|
||||
*
|
||||
*/
|
||||
public function setClassConfig($class, $config, $value = null)
|
||||
{
|
||||
public function setClassConfig($class, $config, $value = null) {
|
||||
if (!is_string($class)) {
|
||||
$class = get_class($class);
|
||||
}
|
||||
|
@ -587,16 +545,14 @@ class Google_Client
|
|||
/**
|
||||
* @return string the base URL to use for calls to the APIs
|
||||
*/
|
||||
public function getBasePath()
|
||||
{
|
||||
public function getBasePath() {
|
||||
return $this->config->getBasePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the application
|
||||
*/
|
||||
public function getApplicationName()
|
||||
{
|
||||
public function getApplicationName() {
|
||||
return $this->config->getApplicationName();
|
||||
}
|
||||
|
||||
|
@ -604,8 +560,7 @@ class Google_Client
|
|||
* Are we running in Google AppEngine?
|
||||
* return bool
|
||||
*/
|
||||
public function isAppEngine()
|
||||
{
|
||||
public function isAppEngine() {
|
||||
return (isset($_SERVER['SERVER_SOFTWARE']) &&
|
||||
strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
|
||||
}
|
||||
|
|
|
@ -7,60 +7,51 @@ require_once "Google/Model.php";
|
|||
* exposes the items array for iteration, so you can just
|
||||
* iterate over the object rather than a reference inside.
|
||||
*/
|
||||
class Google_Collection extends Google_Model implements Iterator, Countable
|
||||
{
|
||||
class Google_Collection extends Google_Model implements Iterator, Countable {
|
||||
protected $collection_key = 'items';
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
public function rewind() {
|
||||
if (isset($this->modelData[$this->collection_key])
|
||||
&& is_array($this->modelData[$this->collection_key])) {
|
||||
reset($this->modelData[$this->collection_key]);
|
||||
}
|
||||
}
|
||||
|
||||
public function current()
|
||||
{
|
||||
public function current() {
|
||||
$this->coerceType($this->key());
|
||||
if (is_array($this->modelData[$this->collection_key])) {
|
||||
return current($this->modelData[$this->collection_key]);
|
||||
}
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
public function key() {
|
||||
if (isset($this->modelData[$this->collection_key])
|
||||
&& is_array($this->modelData[$this->collection_key])) {
|
||||
return key($this->modelData[$this->collection_key]);
|
||||
}
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
public function next() {
|
||||
return next($this->modelData[$this->collection_key]);
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
public function valid() {
|
||||
$key = $this->key();
|
||||
return $key !== null && $key !== false;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
public function count() {
|
||||
return count($this->modelData[$this->collection_key]);
|
||||
}
|
||||
|
||||
public function offsetExists ($offset)
|
||||
{
|
||||
public function offsetExists($offset) {
|
||||
if (!is_numeric($offset)) {
|
||||
return parent::offsetExists($offset);
|
||||
}
|
||||
return isset($this->modelData[$this->collection_key][$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
public function offsetGet($offset) {
|
||||
if (!is_numeric($offset)) {
|
||||
return parent::offsetGet($offset);
|
||||
}
|
||||
|
@ -68,24 +59,21 @@ class Google_Collection extends Google_Model implements Iterator, Countable
|
|||
return $this->modelData[$this->collection_key][$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
public function offsetSet($offset, $value) {
|
||||
if (!is_numeric($offset)) {
|
||||
return parent::offsetSet($offset, $value);
|
||||
}
|
||||
$this->modelData[$this->collection_key][$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
public function offsetUnset($offset) {
|
||||
if (!is_numeric($offset)) {
|
||||
return parent::offsetUnset($offset);
|
||||
}
|
||||
unset($this->modelData[$this->collection_key][$offset]);
|
||||
}
|
||||
|
||||
private function coerceType($offset)
|
||||
{
|
||||
private function coerceType($offset) {
|
||||
$typeKey = $this->keyType($this->collection_key);
|
||||
if (isset($this->$typeKey) && !is_object($this->modelData[$this->collection_key][$offset])) {
|
||||
$type = $this->$typeKey;
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
/**
|
||||
* A class to contain the library configuration for the Google API client.
|
||||
*/
|
||||
class Google_Config
|
||||
{
|
||||
class Google_Config {
|
||||
const GZIP_DISABLED = true;
|
||||
const GZIP_ENABLED = false;
|
||||
const GZIP_UPLOADS_ENABLED = true;
|
||||
|
@ -34,8 +33,7 @@ class Google_Config
|
|||
*
|
||||
* @param [$ini_file_location] - optional - The location of the ini file to load
|
||||
*/
|
||||
public function __construct($ini_file_location = null)
|
||||
{
|
||||
public function __construct($ini_file_location = null) {
|
||||
require_once('../config.php');
|
||||
|
||||
$this->configuration = array(
|
||||
|
@ -94,8 +92,7 @@ class Google_Config
|
|||
|
||||
// Definition of service specific values like scopes, oauth token URLs,
|
||||
// etc. Example:
|
||||
'services' => array(
|
||||
),
|
||||
'services' => array(),
|
||||
);
|
||||
if ($ini_file_location) {
|
||||
$ini = parse_ini_file($ini_file_location, true);
|
||||
|
@ -113,8 +110,7 @@ class Google_Config
|
|||
* @param $config string key or an array of configuration values
|
||||
* @param $value optional - if $config is a key, the value
|
||||
*/
|
||||
public function setClassConfig($class, $config, $value = null)
|
||||
{
|
||||
public function setClassConfig($class, $config, $value = null) {
|
||||
if (!is_array($config)) {
|
||||
if (!isset($this->configuration['classes'][$class])) {
|
||||
$this->configuration['classes'][$class] = array();
|
||||
|
@ -125,8 +121,7 @@ class Google_Config
|
|||
}
|
||||
}
|
||||
|
||||
public function getClassConfig($class, $key = null)
|
||||
{
|
||||
public function getClassConfig($class, $key = null) {
|
||||
if (!isset($this->configuration['classes'][$class])) {
|
||||
return null;
|
||||
}
|
||||
|
@ -141,8 +136,7 @@ class Google_Config
|
|||
* Return the configured cache class.
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheClass()
|
||||
{
|
||||
public function getCacheClass() {
|
||||
return $this->configuration['cache_class'];
|
||||
}
|
||||
|
||||
|
@ -150,8 +144,7 @@ class Google_Config
|
|||
* Return the configured Auth class.
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthClass()
|
||||
{
|
||||
public function getAuthClass() {
|
||||
return $this->configuration['auth_class'];
|
||||
}
|
||||
|
||||
|
@ -160,8 +153,7 @@ class Google_Config
|
|||
*
|
||||
* @param $class the class name to set
|
||||
*/
|
||||
public function setAuthClass($class)
|
||||
{
|
||||
public function setAuthClass($class) {
|
||||
$prev = $this->configuration['auth_class'];
|
||||
if (!isset($this->configuration['classes'][$class]) &&
|
||||
isset($this->configuration['classes'][$prev])) {
|
||||
|
@ -176,8 +168,7 @@ class Google_Config
|
|||
*
|
||||
* @param $class the class name to set
|
||||
*/
|
||||
public function setIoClass($class)
|
||||
{
|
||||
public function setIoClass($class) {
|
||||
$prev = $this->configuration['io_class'];
|
||||
if (!isset($this->configuration['classes'][$class]) &&
|
||||
isset($this->configuration['classes'][$prev])) {
|
||||
|
@ -192,8 +183,7 @@ class Google_Config
|
|||
*
|
||||
* @param $class the class name to set
|
||||
*/
|
||||
public function setCacheClass($class)
|
||||
{
|
||||
public function setCacheClass($class) {
|
||||
$prev = $this->configuration['cache_class'];
|
||||
if (!isset($this->configuration['classes'][$class]) &&
|
||||
isset($this->configuration['classes'][$prev])) {
|
||||
|
@ -207,8 +197,7 @@ class Google_Config
|
|||
* Return the configured IO class.
|
||||
* @return string
|
||||
*/
|
||||
public function getIoClass()
|
||||
{
|
||||
public function getIoClass() {
|
||||
return $this->configuration['io_class'];
|
||||
}
|
||||
|
||||
|
@ -216,16 +205,14 @@ class Google_Config
|
|||
* Set the application name, this is included in the User-Agent HTTP header.
|
||||
* @param string $name
|
||||
*/
|
||||
public function setApplicationName($name)
|
||||
{
|
||||
public function setApplicationName($name) {
|
||||
$this->configuration['application_name'] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the application
|
||||
*/
|
||||
public function getApplicationName()
|
||||
{
|
||||
public function getApplicationName() {
|
||||
return $this->configuration['application_name'];
|
||||
}
|
||||
|
||||
|
@ -233,8 +220,7 @@ class Google_Config
|
|||
* Set the client ID for the auth class.
|
||||
* @param $key string - the API console client ID
|
||||
*/
|
||||
public function setClientId($clientId)
|
||||
{
|
||||
public function setClientId($clientId) {
|
||||
$this->setAuthConfig('client_id', $clientId);
|
||||
}
|
||||
|
||||
|
@ -242,8 +228,7 @@ class Google_Config
|
|||
* Set the client secret for the auth class.
|
||||
* @param $key string - the API console client secret
|
||||
*/
|
||||
public function setClientSecret($secret)
|
||||
{
|
||||
public function setClientSecret($secret) {
|
||||
$this->setAuthConfig('client_secret', $secret);
|
||||
}
|
||||
|
||||
|
@ -252,8 +237,7 @@ class Google_Config
|
|||
* Javascript based sign in flow, this should be the string 'postmessage'.
|
||||
* @param $key string - the URI that users should be redirected to
|
||||
*/
|
||||
public function setRedirectUri($uri)
|
||||
{
|
||||
public function setRedirectUri($uri) {
|
||||
$this->setAuthConfig('redirect_uri', $uri);
|
||||
}
|
||||
|
||||
|
@ -261,8 +245,7 @@ class Google_Config
|
|||
* Set the app activities for the auth class.
|
||||
* @param $rva string a space separated list of app activity types
|
||||
*/
|
||||
public function setRequestVisibleActions($rva)
|
||||
{
|
||||
public function setRequestVisibleActions($rva) {
|
||||
$this->setAuthConfig('request_visible_actions', $rva);
|
||||
}
|
||||
|
||||
|
@ -270,8 +253,7 @@ class Google_Config
|
|||
* Set the the access type requested (offline or online.)
|
||||
* @param $access string - the access type
|
||||
*/
|
||||
public function setAccessType($access)
|
||||
{
|
||||
public function setAccessType($access) {
|
||||
$this->setAuthConfig('access_type', $access);
|
||||
}
|
||||
|
||||
|
@ -279,8 +261,7 @@ class Google_Config
|
|||
* Set when to show the approval prompt (auto or force)
|
||||
* @param $approval string - the approval request
|
||||
*/
|
||||
public function setApprovalPrompt($approval)
|
||||
{
|
||||
public function setApprovalPrompt($approval) {
|
||||
$this->setAuthConfig('approval_prompt', $approval);
|
||||
}
|
||||
|
||||
|
@ -288,8 +269,7 @@ class Google_Config
|
|||
* Set the login hint (email address or sub identifier)
|
||||
* @param $hint string
|
||||
*/
|
||||
public function setLoginHint($hint)
|
||||
{
|
||||
public function setLoginHint($hint) {
|
||||
$this->setAuthConfig('login_hint', $hint);
|
||||
}
|
||||
|
||||
|
@ -298,16 +278,14 @@ class Google_Config
|
|||
* from the client ID - if it looks like a URL, its a client ID!
|
||||
* @param $key string - the API console developer key
|
||||
*/
|
||||
public function setDeveloperKey($key)
|
||||
{
|
||||
public function setDeveloperKey($key) {
|
||||
$this->setAuthConfig('developer_key', $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the base URL to use for API calls
|
||||
*/
|
||||
public function getBasePath()
|
||||
{
|
||||
public function getBasePath() {
|
||||
return $this->configuration['base_path'];
|
||||
}
|
||||
|
||||
|
@ -316,8 +294,7 @@ class Google_Config
|
|||
* @param $key - the key to set
|
||||
* @param $value - the parameter value
|
||||
*/
|
||||
private function setAuthConfig($key, $value)
|
||||
{
|
||||
private function setAuthConfig($key, $value) {
|
||||
if (!isset($this->configuration['classes'][$this->getAuthClass()])) {
|
||||
$this->configuration['classes'][$this->getAuthClass()] = array();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class Google_Exception extends Exception
|
||||
{
|
||||
class Google_Exception extends Exception {
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ require_once 'Google/Http/REST.php';
|
|||
/**
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Http_Batch
|
||||
{
|
||||
class Google_Http_Batch {
|
||||
/** @var string Multipart Boundary. */
|
||||
private $boundary;
|
||||
|
||||
|
@ -37,8 +36,7 @@ class Google_Http_Batch
|
|||
|
||||
private $base_path;
|
||||
|
||||
public function __construct(Google_Client $client, $boundary = false)
|
||||
{
|
||||
public function __construct(Google_Client $client, $boundary = false) {
|
||||
$this->client = $client;
|
||||
$this->base_path = $this->client->getBasePath();
|
||||
$this->expected_classes = array();
|
||||
|
@ -46,8 +44,7 @@ class Google_Http_Batch
|
|||
$this->boundary = str_replace('"', '', $boundary);
|
||||
}
|
||||
|
||||
public function add(Google_Http_Request $request, $key = false)
|
||||
{
|
||||
public function add(Google_Http_Request $request, $key = false) {
|
||||
if (false == $key) {
|
||||
$key = mt_rand();
|
||||
}
|
||||
|
@ -55,8 +52,7 @@ class Google_Http_Batch
|
|||
$this->requests[$key] = $request;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
public function execute() {
|
||||
$body = '';
|
||||
|
||||
/** @var Google_Http_Request $req */
|
||||
|
@ -81,8 +77,7 @@ class Google_Http_Batch
|
|||
return $this->parseResponse($response);
|
||||
}
|
||||
|
||||
public function parseResponse(Google_Http_Request $response)
|
||||
{
|
||||
public function parseResponse(Google_Http_Request $response) {
|
||||
$contentType = $response->getResponseHeader('content-type');
|
||||
$contentType = explode(';', $contentType);
|
||||
$boundary = false;
|
||||
|
|
|
@ -22,8 +22,7 @@ require_once 'Google/Http/Request.php';
|
|||
* implementation is guided by the guidance offered in rfc2616-sec13.
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Http_CacheParser
|
||||
{
|
||||
class Google_Http_CacheParser {
|
||||
public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
|
||||
public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
|
||||
|
||||
|
@ -35,10 +34,9 @@ class Google_Http_CacheParser
|
|||
* @return bool True if the request is cacheable.
|
||||
* False if the request is uncacheable.
|
||||
*/
|
||||
public static function isRequestCacheable(Google_Http_Request $resp)
|
||||
{
|
||||
public static function isRequestCacheable(Google_Http_Request $resp) {
|
||||
$method = $resp->getRequestMethod();
|
||||
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
|
||||
if (!in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,8 +59,7 @@ class Google_Http_CacheParser
|
|||
* @return bool True if the response is cacheable.
|
||||
* False if the response is un-cacheable.
|
||||
*/
|
||||
public static function isResponseCacheable(Google_Http_Request $resp)
|
||||
{
|
||||
public static function isResponseCacheable(Google_Http_Request $resp) {
|
||||
// First, check if the HTTP request was cacheable before inspecting the
|
||||
// HTTP response.
|
||||
if (false == self::isRequestCacheable($resp)) {
|
||||
|
@ -70,7 +67,7 @@ class Google_Http_CacheParser
|
|||
}
|
||||
|
||||
$code = $resp->getResponseHttpCode();
|
||||
if (! in_array($code, self::$CACHEABLE_STATUS_CODES)) {
|
||||
if (!in_array($code, self::$CACHEABLE_STATUS_CODES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -113,8 +110,7 @@ class Google_Http_CacheParser
|
|||
* @return bool True if the HTTP response is considered to be expired.
|
||||
* False if it is considered to be fresh.
|
||||
*/
|
||||
public static function isExpired(Google_Http_Request $resp)
|
||||
{
|
||||
public static function isExpired(Google_Http_Request $resp) {
|
||||
// HTTP/1.1 clients and caches MUST treat other invalid date formats,
|
||||
// especially including the value “0”, as in the past.
|
||||
$parsedExpires = false;
|
||||
|
@ -174,8 +170,7 @@ class Google_Http_CacheParser
|
|||
* @param Google_Http_Request $response
|
||||
* @return bool True if the entry is expired, else return false.
|
||||
*/
|
||||
public static function mustRevalidate(Google_Http_Request $response)
|
||||
{
|
||||
public static function mustRevalidate(Google_Http_Request $response) {
|
||||
// [13.3] When a cache has a stale entry that it would like to use as a
|
||||
// response to a client's request, it first has to check with the origin
|
||||
// server to see if its cached entry is still usable.
|
||||
|
|
|
@ -25,8 +25,7 @@ require_once 'Google/Utils.php';
|
|||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
class Google_Http_MediaFileUpload
|
||||
{
|
||||
class Google_Http_MediaFileUpload {
|
||||
const UPLOAD_MEDIA_TYPE = 'media';
|
||||
const UPLOAD_MULTIPART_TYPE = 'multipart';
|
||||
const UPLOAD_RESUMABLE_TYPE = 'resumable';
|
||||
|
@ -104,8 +103,7 @@ class Google_Http_MediaFileUpload
|
|||
* Set the size of the file that is being uploaded.
|
||||
* @param $size - int file size in bytes
|
||||
*/
|
||||
public function setFileSize($size)
|
||||
{
|
||||
public function setFileSize($size) {
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
|
@ -113,8 +111,7 @@ class Google_Http_MediaFileUpload
|
|||
* Return the progress on the upload
|
||||
* @return int progress in bytes uploaded.
|
||||
*/
|
||||
public function getProgress()
|
||||
{
|
||||
public function getProgress() {
|
||||
return $this->progress;
|
||||
}
|
||||
|
||||
|
@ -122,8 +119,7 @@ class Google_Http_MediaFileUpload
|
|||
* Return the HTTP result code from the last call made.
|
||||
* @return int code
|
||||
*/
|
||||
public function getHttpResultCode()
|
||||
{
|
||||
public function getHttpResultCode() {
|
||||
return $this->httpResultCode;
|
||||
}
|
||||
|
||||
|
@ -132,8 +128,7 @@ class Google_Http_MediaFileUpload
|
|||
* @param [$chunk] the next set of bytes to send. If false will used $data passed
|
||||
* at construct time.
|
||||
*/
|
||||
public function nextChunk($chunk = false)
|
||||
{
|
||||
public function nextChunk($chunk = false) {
|
||||
if (false == $this->resumeUri) {
|
||||
$this->resumeUri = $this->getResumeUri();
|
||||
}
|
||||
|
@ -192,8 +187,7 @@ class Google_Http_MediaFileUpload
|
|||
* @return array|bool
|
||||
* @visible for testing
|
||||
*/
|
||||
private function process()
|
||||
{
|
||||
private function process() {
|
||||
$postBody = false;
|
||||
$contentType = false;
|
||||
|
||||
|
@ -210,10 +204,10 @@ class Google_Http_MediaFileUpload
|
|||
if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
|
||||
$contentType = $mimeType;
|
||||
$postBody = is_string($meta) ? $meta : json_encode($meta);
|
||||
} else if (self::UPLOAD_MEDIA_TYPE == $uploadType) {
|
||||
} elseif (self::UPLOAD_MEDIA_TYPE == $uploadType) {
|
||||
$contentType = $mimeType;
|
||||
$postBody = $this->data;
|
||||
} else if (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
|
||||
} elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
|
||||
// This is a multipart/related upload.
|
||||
$boundary = $this->boundary ? $this->boundary : mt_rand();
|
||||
$boundary = str_replace('"', '', $boundary);
|
||||
|
@ -237,8 +231,7 @@ class Google_Http_MediaFileUpload
|
|||
}
|
||||
}
|
||||
|
||||
private function transformToUploadUrl()
|
||||
{
|
||||
private function transformToUploadUrl() {
|
||||
$base = $this->request->getBaseComponent();
|
||||
$this->request->setBaseComponent($base . '/upload');
|
||||
}
|
||||
|
@ -252,8 +245,7 @@ class Google_Http_MediaFileUpload
|
|||
* @return string
|
||||
* @visible for testing
|
||||
*/
|
||||
public function getUploadType($meta)
|
||||
{
|
||||
public function getUploadType($meta) {
|
||||
if ($this->resumable) {
|
||||
return self::UPLOAD_RESUMABLE_TYPE;
|
||||
}
|
||||
|
@ -265,8 +257,7 @@ class Google_Http_MediaFileUpload
|
|||
return self::UPLOAD_MULTIPART_TYPE;
|
||||
}
|
||||
|
||||
private function getResumeUri()
|
||||
{
|
||||
private function getResumeUri() {
|
||||
$result = null;
|
||||
$body = $this->request->getPostBody();
|
||||
if ($body) {
|
||||
|
|
|
@ -26,8 +26,7 @@ require_once 'Google/Utils/URITemplate.php';
|
|||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Http_REST
|
||||
{
|
||||
class Google_Http_REST {
|
||||
/**
|
||||
* Executes a Google_Http_Request
|
||||
*
|
||||
|
@ -37,8 +36,7 @@ class Google_Http_REST
|
|||
* @throws Google_Service_Exception on server side error (ie: not authenticated,
|
||||
* invalid or malformed post body, invalid url)
|
||||
*/
|
||||
public static function execute(Google_Client $client, Google_Http_Request $req)
|
||||
{
|
||||
public static function execute(Google_Client $client, Google_Http_Request $req) {
|
||||
$httpRequest = $client->getIo()->makeRequest($req);
|
||||
$httpRequest->setExpectedClass($req->getExpectedClass());
|
||||
return self::decodeHttpResponse($httpRequest);
|
||||
|
@ -47,12 +45,11 @@ class Google_Http_REST
|
|||
/**
|
||||
* Decode an HTTP Response.
|
||||
* @static
|
||||
* @throws Google_Service_Exception
|
||||
* @param Google_Http_Request $response The http response to be decoded.
|
||||
* @return mixed|null
|
||||
* @throws Google_Service_Exception
|
||||
*/
|
||||
public static function decodeHttpResponse($response)
|
||||
{
|
||||
public static function decodeHttpResponse($response) {
|
||||
$code = $response->getResponseHttpCode();
|
||||
$body = $response->getResponseBody();
|
||||
$decoded = null;
|
||||
|
@ -103,8 +100,7 @@ class Google_Http_REST
|
|||
* @param array $params
|
||||
* @return string $requestUrl
|
||||
*/
|
||||
public static function createRequestUri($servicePath, $restPath, $params)
|
||||
{
|
||||
public static function createRequestUri($servicePath, $restPath, $params) {
|
||||
$requestUrl = $servicePath . $restPath;
|
||||
$uriTemplateVars = array();
|
||||
$queryVars = array();
|
||||
|
@ -114,7 +110,7 @@ class Google_Http_REST
|
|||
}
|
||||
if ($paramSpec['location'] == 'path') {
|
||||
$uriTemplateVars[$paramName] = $paramSpec['value'];
|
||||
} else if ($paramSpec['location'] == 'query') {
|
||||
} elseif ($paramSpec['location'] == 'query') {
|
||||
if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
|
||||
foreach ($paramSpec['value'] as $value) {
|
||||
$queryVars[] = $paramName . '=' . rawurlencode($value);
|
||||
|
|
|
@ -25,8 +25,7 @@ require_once 'Google/Utils.php';
|
|||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
class Google_Http_Request
|
||||
{
|
||||
class Google_Http_Request {
|
||||
const GZIP_UA = " (gzip)";
|
||||
|
||||
private $batchHeaders = array(
|
||||
|
@ -69,8 +68,7 @@ class Google_Http_Request
|
|||
* used by the OAuth signing class to calculate the base string
|
||||
* @return string The base url component of the $url.
|
||||
*/
|
||||
public function getBaseComponent()
|
||||
{
|
||||
public function getBaseComponent() {
|
||||
return $this->baseComponent;
|
||||
}
|
||||
|
||||
|
@ -78,16 +76,14 @@ class Google_Http_Request
|
|||
* Set the base URL that path and query parameters will be added to.
|
||||
* @param $baseComponent string
|
||||
*/
|
||||
public function setBaseComponent($baseComponent)
|
||||
{
|
||||
public function setBaseComponent($baseComponent) {
|
||||
$this->baseComponent = $baseComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable support for gzipped responses with this request.
|
||||
*/
|
||||
public function enableGzip()
|
||||
{
|
||||
public function enableGzip() {
|
||||
$this->setRequestHeaders(array("Accept-Encoding" => "gzip"));
|
||||
$this->canGzip = true;
|
||||
$this->setUserAgent($this->userAgent);
|
||||
|
@ -96,8 +92,7 @@ class Google_Http_Request
|
|||
/**
|
||||
* Disable support for gzip responses with this request.
|
||||
*/
|
||||
public function disableGzip()
|
||||
{
|
||||
public function disableGzip() {
|
||||
if (
|
||||
isset($this->requestHeaders['accept-encoding']) &&
|
||||
$this->requestHeaders['accept-encoding'] == "gzip"
|
||||
|
@ -112,8 +107,7 @@ class Google_Http_Request
|
|||
* Can this request accept a gzip response?
|
||||
* @return bool
|
||||
*/
|
||||
public function canGzip()
|
||||
{
|
||||
public function canGzip() {
|
||||
return $this->canGzip;
|
||||
}
|
||||
|
||||
|
@ -122,8 +116,7 @@ class Google_Http_Request
|
|||
* url used by the OAuth signing class to calculate the signature
|
||||
* @return array Query parameters in the query string.
|
||||
*/
|
||||
public function getQueryParams()
|
||||
{
|
||||
public function getQueryParams() {
|
||||
return $this->queryParams;
|
||||
}
|
||||
|
||||
|
@ -132,40 +125,35 @@ class Google_Http_Request
|
|||
* @param $key - string to set, does not need to be URL encoded
|
||||
* @param $value - string to set, does not need to be URL encoded
|
||||
*/
|
||||
public function setQueryParam($key, $value)
|
||||
{
|
||||
public function setQueryParam($key, $value) {
|
||||
$this->queryParams[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string HTTP Response Code.
|
||||
*/
|
||||
public function getResponseHttpCode()
|
||||
{
|
||||
return (int) $this->responseHttpCode;
|
||||
public function getResponseHttpCode() {
|
||||
return (int)$this->responseHttpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $responseHttpCode HTTP Response Code.
|
||||
*/
|
||||
public function setResponseHttpCode($responseHttpCode)
|
||||
{
|
||||
public function setResponseHttpCode($responseHttpCode) {
|
||||
$this->responseHttpCode = $responseHttpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $responseHeaders (array) HTTP Response Headers.
|
||||
*/
|
||||
public function getResponseHeaders()
|
||||
{
|
||||
public function getResponseHeaders() {
|
||||
return $this->responseHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string HTTP Response Body
|
||||
*/
|
||||
public function getResponseBody()
|
||||
{
|
||||
public function getResponseBody() {
|
||||
return $this->responseBody;
|
||||
}
|
||||
|
||||
|
@ -174,8 +162,7 @@ class Google_Http_Request
|
|||
*
|
||||
* @param $class string the class name
|
||||
*/
|
||||
public function setExpectedClass($class)
|
||||
{
|
||||
public function setExpectedClass($class) {
|
||||
$this->expectedClass = $class;
|
||||
}
|
||||
|
||||
|
@ -183,8 +170,7 @@ class Google_Http_Request
|
|||
* Retrieve the expected class the response should expect.
|
||||
* @return string class name
|
||||
*/
|
||||
public function getExpectedClass()
|
||||
{
|
||||
public function getExpectedClass() {
|
||||
return $this->expectedClass;
|
||||
}
|
||||
|
||||
|
@ -192,8 +178,7 @@ class Google_Http_Request
|
|||
* @param array $headers The HTTP response headers
|
||||
* to be normalized.
|
||||
*/
|
||||
public function setResponseHeaders($headers)
|
||||
{
|
||||
public function setResponseHeaders($headers) {
|
||||
$headers = Google_Utils::normalize($headers);
|
||||
if ($this->responseHeaders) {
|
||||
$headers = array_merge($this->responseHeaders, $headers);
|
||||
|
@ -207,8 +192,7 @@ class Google_Http_Request
|
|||
* @return array|boolean Returns the requested HTTP header or
|
||||
* false if unavailable.
|
||||
*/
|
||||
public function getResponseHeader($key)
|
||||
{
|
||||
public function getResponseHeader($key) {
|
||||
return isset($this->responseHeaders[$key])
|
||||
? $this->responseHeaders[$key]
|
||||
: false;
|
||||
|
@ -217,16 +201,14 @@ class Google_Http_Request
|
|||
/**
|
||||
* @param string $responseBody The HTTP response body.
|
||||
*/
|
||||
public function setResponseBody($responseBody)
|
||||
{
|
||||
public function setResponseBody($responseBody) {
|
||||
$this->responseBody = $responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string $url The request URL.
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
public function getUrl() {
|
||||
return $this->baseComponent . $this->path .
|
||||
(count($this->queryParams) ?
|
||||
"?" . $this->buildQuery($this->queryParams) :
|
||||
|
@ -236,16 +218,14 @@ class Google_Http_Request
|
|||
/**
|
||||
* @return string $method HTTP Request Method.
|
||||
*/
|
||||
public function getRequestMethod()
|
||||
{
|
||||
public function getRequestMethod() {
|
||||
return $this->requestMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array $headers HTTP Request Headers.
|
||||
*/
|
||||
public function getRequestHeaders()
|
||||
{
|
||||
public function getRequestHeaders() {
|
||||
return $this->requestHeaders;
|
||||
}
|
||||
|
||||
|
@ -254,8 +234,7 @@ class Google_Http_Request
|
|||
* @return array|boolean Returns the requested HTTP header or
|
||||
* false if unavailable.
|
||||
*/
|
||||
public function getRequestHeader($key)
|
||||
{
|
||||
public function getRequestHeader($key) {
|
||||
return isset($this->requestHeaders[$key])
|
||||
? $this->requestHeaders[$key]
|
||||
: false;
|
||||
|
@ -264,16 +243,14 @@ class Google_Http_Request
|
|||
/**
|
||||
* @return string $postBody HTTP Request Body.
|
||||
*/
|
||||
public function getPostBody()
|
||||
{
|
||||
public function getPostBody() {
|
||||
return $this->postBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url the url to set
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
public function setUrl($url) {
|
||||
if (substr($url, 0, 4) != 'http') {
|
||||
// Force the path become relative.
|
||||
if (substr($url, 0, 1) !== '/') {
|
||||
|
@ -301,8 +278,7 @@ class Google_Http_Request
|
|||
* it to upper-case, as required by HTTP.
|
||||
*
|
||||
*/
|
||||
public function setRequestMethod($method)
|
||||
{
|
||||
public function setRequestMethod($method) {
|
||||
$this->requestMethod = strtoupper($method);
|
||||
}
|
||||
|
||||
|
@ -310,8 +286,7 @@ class Google_Http_Request
|
|||
* @param array $headers The HTTP request headers
|
||||
* to be set and normalized.
|
||||
*/
|
||||
public function setRequestHeaders($headers)
|
||||
{
|
||||
public function setRequestHeaders($headers) {
|
||||
$headers = Google_Utils::normalize($headers);
|
||||
if ($this->requestHeaders) {
|
||||
$headers = array_merge($this->requestHeaders, $headers);
|
||||
|
@ -322,8 +297,7 @@ class Google_Http_Request
|
|||
/**
|
||||
* @param string $postBody the postBody to set
|
||||
*/
|
||||
public function setPostBody($postBody)
|
||||
{
|
||||
public function setPostBody($postBody) {
|
||||
$this->postBody = $postBody;
|
||||
}
|
||||
|
||||
|
@ -331,8 +305,7 @@ class Google_Http_Request
|
|||
* Set the User-Agent Header.
|
||||
* @param string $userAgent The User-Agent.
|
||||
*/
|
||||
public function setUserAgent($userAgent)
|
||||
{
|
||||
public function setUserAgent($userAgent) {
|
||||
$this->userAgent = $userAgent;
|
||||
if ($this->canGzip) {
|
||||
$this->userAgent = $userAgent . self::GZIP_UA;
|
||||
|
@ -342,8 +315,7 @@ class Google_Http_Request
|
|||
/**
|
||||
* @return string The User-Agent.
|
||||
*/
|
||||
public function getUserAgent()
|
||||
{
|
||||
public function getUserAgent() {
|
||||
return $this->userAgent;
|
||||
}
|
||||
|
||||
|
@ -353,8 +325,7 @@ class Google_Http_Request
|
|||
* cache key unique per authenticated user, else use the plain request url
|
||||
* @return string The md5 hash of the request cache key.
|
||||
*/
|
||||
public function getCacheKey()
|
||||
{
|
||||
public function getCacheKey() {
|
||||
$key = $this->getUrl();
|
||||
|
||||
if (isset($this->accessKey)) {
|
||||
|
@ -368,8 +339,7 @@ class Google_Http_Request
|
|||
return md5($key);
|
||||
}
|
||||
|
||||
public function getParsedCacheControl()
|
||||
{
|
||||
public function getParsedCacheControl() {
|
||||
$parsed = array();
|
||||
$rawCacheControl = $this->getResponseHeader('cache-control');
|
||||
if ($rawCacheControl) {
|
||||
|
@ -384,8 +354,7 @@ class Google_Http_Request
|
|||
* @param string $id
|
||||
* @return string A string representation of the HTTP Request.
|
||||
*/
|
||||
public function toBatchString($id)
|
||||
{
|
||||
public function toBatchString($id) {
|
||||
$str = '';
|
||||
$path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" .
|
||||
http_build_query($this->queryParams);
|
||||
|
@ -416,8 +385,7 @@ class Google_Http_Request
|
|||
* with the same name.
|
||||
* @param $string - the query string to parse
|
||||
*/
|
||||
private function parseQuery($string)
|
||||
{
|
||||
private function parseQuery($string) {
|
||||
$return = array();
|
||||
$parts = explode("&", $string);
|
||||
foreach ($parts as $part) {
|
||||
|
@ -440,8 +408,7 @@ class Google_Http_Request
|
|||
* duplicate keys.
|
||||
* @param $parts array of key value pairs
|
||||
*/
|
||||
private function buildQuery($parts)
|
||||
{
|
||||
private function buildQuery($parts) {
|
||||
$return = array();
|
||||
foreach ($parts as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
|
@ -460,8 +427,7 @@ class Google_Http_Request
|
|||
* parameters in there, which avoids length issues with longer query
|
||||
* params.
|
||||
*/
|
||||
public function maybeMoveParametersToBody()
|
||||
{
|
||||
public function maybeMoveParametersToBody() {
|
||||
if ($this->getRequestMethod() == "POST" && empty($this->postBody)) {
|
||||
$this->setRequestHeaders(
|
||||
array(
|
||||
|
|
|
@ -24,8 +24,7 @@ require_once 'Google/IO/Exception.php';
|
|||
require_once 'Google/Http/CacheParser.php';
|
||||
require_once 'Google/Http/Request.php';
|
||||
|
||||
abstract class Google_IO_Abstract
|
||||
{
|
||||
abstract class Google_IO_Abstract {
|
||||
const UNKNOWN_CODE = 0;
|
||||
const FORM_URLENCODED = 'application/x-www-form-urlencoded';
|
||||
private static $CONNECTION_ESTABLISHED_HEADERS = array(
|
||||
|
@ -37,8 +36,7 @@ abstract class Google_IO_Abstract
|
|||
/** @var Google_Client */
|
||||
protected $client;
|
||||
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
$this->client = $client;
|
||||
$timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
|
||||
if ($timeout > 0) {
|
||||
|
@ -89,8 +87,7 @@ abstract class Google_IO_Abstract
|
|||
* @return bool Returns true if the insertion was successful.
|
||||
* Otherwise, return false.
|
||||
*/
|
||||
public function setCachedRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function setCachedRequest(Google_Http_Request $request) {
|
||||
// Determine if the request is cacheable.
|
||||
if (Google_Http_CacheParser::isResponseCacheable($request)) {
|
||||
$this->client->getCache()->set($request->getCacheKey(), $request);
|
||||
|
@ -108,8 +105,7 @@ abstract class Google_IO_Abstract
|
|||
* response headers and response body filled in
|
||||
* @throws Google_IO_Exception on curl or IO error
|
||||
*/
|
||||
public function makeRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function makeRequest(Google_Http_Request $request) {
|
||||
// First, check to see if we have a valid cached version.
|
||||
$cached = $this->getCachedRequest($request);
|
||||
if ($cached !== false && $cached instanceof Google_Http_Request) {
|
||||
|
@ -149,8 +145,7 @@ abstract class Google_IO_Abstract
|
|||
* @return Google_Http_Request|bool Returns the cached object or
|
||||
* false if the operation was unsuccessful.
|
||||
*/
|
||||
public function getCachedRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function getCachedRequest(Google_Http_Request $request) {
|
||||
if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -164,8 +159,7 @@ abstract class Google_IO_Abstract
|
|||
* @param Google_Http_Request $request
|
||||
* @return Google_Http_Request Processed request with the enclosed entity.
|
||||
*/
|
||||
public function processEntityRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function processEntityRequest(Google_Http_Request $request) {
|
||||
$postBody = $request->getPostBody();
|
||||
$contentType = $request->getRequestHeader("content-type");
|
||||
|
||||
|
@ -198,8 +192,7 @@ abstract class Google_IO_Abstract
|
|||
* return bool If the cached object needs to be revalidated, false if it is
|
||||
* still current and can be re-used.
|
||||
*/
|
||||
protected function checkMustRevalidateCachedRequest($cached, $request)
|
||||
{
|
||||
protected function checkMustRevalidateCachedRequest($cached, $request) {
|
||||
if (Google_Http_CacheParser::mustRevalidate($cached)) {
|
||||
$addHeaders = array();
|
||||
if ($cached->getResponseHeader('etag')) {
|
||||
|
@ -222,8 +215,7 @@ abstract class Google_IO_Abstract
|
|||
* @param Google_HttpRequest $cached A previously cached response.
|
||||
* @param mixed Associative array of response headers from the last request.
|
||||
*/
|
||||
protected function updateCachedRequest($cached, $responseHeaders)
|
||||
{
|
||||
protected function updateCachedRequest($cached, $responseHeaders) {
|
||||
if (isset($responseHeaders['connection'])) {
|
||||
$hopByHop = array_merge(
|
||||
self::$HOP_BY_HOP,
|
||||
|
@ -250,8 +242,7 @@ abstract class Google_IO_Abstract
|
|||
* @param $headerSize
|
||||
* @return array
|
||||
*/
|
||||
public function parseHttpResponse($respData, $headerSize)
|
||||
{
|
||||
public function parseHttpResponse($respData, $headerSize) {
|
||||
// check proxy header
|
||||
foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
|
||||
if (stripos($respData, $established_header) !== false) {
|
||||
|
@ -283,8 +274,7 @@ abstract class Google_IO_Abstract
|
|||
* @param rawHeaders array or string
|
||||
* @return array
|
||||
*/
|
||||
public function getHttpResponseHeaders($rawHeaders)
|
||||
{
|
||||
public function getHttpResponseHeaders($rawHeaders) {
|
||||
if (is_array($rawHeaders)) {
|
||||
return $this->parseArrayHeaders($rawHeaders);
|
||||
} else {
|
||||
|
@ -292,8 +282,7 @@ abstract class Google_IO_Abstract
|
|||
}
|
||||
}
|
||||
|
||||
private function parseStringHeaders($rawHeaders)
|
||||
{
|
||||
private function parseStringHeaders($rawHeaders) {
|
||||
$headers = array();
|
||||
$responseHeaderLines = explode("\r\n", $rawHeaders);
|
||||
foreach ($responseHeaderLines as $headerLine) {
|
||||
|
@ -310,8 +299,7 @@ abstract class Google_IO_Abstract
|
|||
return $headers;
|
||||
}
|
||||
|
||||
private function parseArrayHeaders($rawHeaders)
|
||||
{
|
||||
private function parseArrayHeaders($rawHeaders) {
|
||||
$header_count = count($rawHeaders);
|
||||
$headers = array();
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
require_once 'Google/IO/Abstract.php';
|
||||
|
||||
class Google_IO_Curl extends Google_IO_Abstract
|
||||
{
|
||||
class Google_IO_Curl extends Google_IO_Abstract {
|
||||
// cURL hex representation of version 7.30.0
|
||||
const NO_QUIRK_VERSION = 0x071E00;
|
||||
|
||||
private $options = array();
|
||||
|
||||
/**
|
||||
* Execute an HTTP Request
|
||||
*
|
||||
|
@ -37,8 +37,7 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|||
* response headers and response body filled in
|
||||
* @throws Google_IO_Exception on curl or IO error
|
||||
*/
|
||||
public function executeRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function executeRequest(Google_Http_Request $request) {
|
||||
$curl = curl_init();
|
||||
|
||||
if ($request->getPostBody()) {
|
||||
|
@ -93,8 +92,7 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|||
* Set options that update the transport implementation's behavior.
|
||||
* @param $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
public function setOptions($options) {
|
||||
$this->options = $options + $this->options;
|
||||
}
|
||||
|
||||
|
@ -102,8 +100,7 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|||
* Set the maximum request time in seconds.
|
||||
* @param $timeout in seconds
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
public function setTimeout($timeout) {
|
||||
// Since this timeout is really for putting a bound on the time
|
||||
// we'll set them both to the same. If you need to specify a longer
|
||||
// CURLOPT_TIMEOUT, or a tigher CONNECTTIMEOUT, the best thing to
|
||||
|
@ -116,8 +113,7 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|||
* Get the maximum request time in seconds.
|
||||
* @return timeout in seconds
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
public function getTimeout() {
|
||||
return $this->options[CURLOPT_TIMEOUT];
|
||||
}
|
||||
|
||||
|
@ -128,8 +124,7 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function needsQuirk()
|
||||
{
|
||||
protected function needsQuirk() {
|
||||
$ver = curl_version();
|
||||
$versionNum = $ver['version_number'];
|
||||
return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
|
||||
|
|
|
@ -17,6 +17,5 @@
|
|||
|
||||
require_once 'Google/Exception.php';
|
||||
|
||||
class Google_IO_Exception extends Google_Exception
|
||||
{
|
||||
class Google_IO_Exception extends Google_Exception {
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
require_once 'Google/IO/Abstract.php';
|
||||
|
||||
class Google_IO_Stream extends Google_IO_Abstract
|
||||
{
|
||||
class Google_IO_Stream extends Google_IO_Abstract {
|
||||
const TIMEOUT = "timeout";
|
||||
const ZLIB = "compress.zlib://";
|
||||
private $options = array();
|
||||
|
@ -48,8 +47,7 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|||
* response headers and response body filled in
|
||||
* @throws Google_IO_Exception on curl or IO error
|
||||
*/
|
||||
public function executeRequest(Google_Http_Request $request)
|
||||
{
|
||||
public function executeRequest(Google_Http_Request $request) {
|
||||
$default_options = stream_context_get_options(stream_context_get_default());
|
||||
|
||||
$requestHttpContext = array_key_exists('http', $default_options) ?
|
||||
|
@ -150,8 +148,7 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|||
* Set options that update the transport implementation's behavior.
|
||||
* @param $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
public function setOptions($options) {
|
||||
$this->options = $options + $this->options;
|
||||
}
|
||||
|
||||
|
@ -159,8 +156,7 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|||
* Method to handle errors, used for error handling around
|
||||
* stream connection methods.
|
||||
*/
|
||||
public function trapError($errno, $errstr)
|
||||
{
|
||||
public function trapError($errno, $errstr) {
|
||||
$this->trappedErrorNumber = $errno;
|
||||
$this->trappedErrorString = $errstr;
|
||||
}
|
||||
|
@ -169,8 +165,7 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|||
* Set the maximum request time in seconds.
|
||||
* @param $timeout in seconds
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
public function setTimeout($timeout) {
|
||||
$this->options[self::TIMEOUT] = $timeout;
|
||||
}
|
||||
|
||||
|
@ -178,8 +173,7 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|||
* Get the maximum request time in seconds.
|
||||
* @return timeout in seconds
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
public function getTimeout() {
|
||||
return $this->options[self::TIMEOUT];
|
||||
}
|
||||
|
||||
|
@ -190,13 +184,11 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function needsQuirk()
|
||||
{
|
||||
protected function needsQuirk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getHttpResponseCode($response_headers)
|
||||
{
|
||||
protected function getHttpResponseCode($response_headers) {
|
||||
$header_count = count($response_headers);
|
||||
|
||||
for ($i = 0; $i < $header_count; $i++) {
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
class Google_Model implements ArrayAccess
|
||||
{
|
||||
class Google_Model implements ArrayAccess {
|
||||
protected $modelData = array();
|
||||
protected $processed = array();
|
||||
|
||||
|
@ -32,8 +31,7 @@ class Google_Model implements ArrayAccess
|
|||
* Polymorphic - accepts a variable number of arguments dependent
|
||||
* on the type of the model subclass.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct() {
|
||||
if (func_num_args() == 1 && is_array(func_get_arg(0))) {
|
||||
// Initialize the model with the array's contents.
|
||||
$array = func_get_arg(0);
|
||||
|
@ -41,14 +39,13 @@ class Google_Model implements ArrayAccess
|
|||
}
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
public function __get($key) {
|
||||
$keyTypeName = $this->keyType($key);
|
||||
$keyDataType = $this->dataType($key);
|
||||
if (isset($this->$keyTypeName) && !isset($this->processed[$key])) {
|
||||
if (isset($this->modelData[$key])) {
|
||||
$val = $this->modelData[$key];
|
||||
} else if (isset($this->$keyDataType) &&
|
||||
} elseif (isset($this->$keyDataType) &&
|
||||
($this->$keyDataType == 'array' || $this->$keyDataType == 'map')) {
|
||||
$val = array();
|
||||
} else {
|
||||
|
@ -64,7 +61,7 @@ class Google_Model implements ArrayAccess
|
|||
} else {
|
||||
$this->modelData[$key] = $this->createObjectFromName($keyTypeName, $val);
|
||||
}
|
||||
} else if (is_array($val)) {
|
||||
} elseif (is_array($val)) {
|
||||
$arrayObject = array();
|
||||
foreach ($val as $arrayIndex => $arrayItem) {
|
||||
$arrayObject[$arrayIndex] =
|
||||
|
@ -84,11 +81,10 @@ class Google_Model implements ArrayAccess
|
|||
* @param array $array Used to seed this object's properties.
|
||||
* @return void
|
||||
*/
|
||||
protected function mapTypes($array)
|
||||
{
|
||||
protected function mapTypes($array) {
|
||||
// Hard initilise simple types, lazy load more complex ones.
|
||||
foreach ($array as $key => $val) {
|
||||
if ( !property_exists($this, $this->keyType($key)) &&
|
||||
if (!property_exists($this, $this->keyType($key)) &&
|
||||
property_exists($this, $key)) {
|
||||
$this->$key = $val;
|
||||
unset($array[$key]);
|
||||
|
@ -107,8 +103,7 @@ class Google_Model implements ArrayAccess
|
|||
* due to the usage of reflection, but shouldn't be called
|
||||
* a whole lot, and is the most straightforward way to filter.
|
||||
*/
|
||||
public function toSimpleObject()
|
||||
{
|
||||
public function toSimpleObject() {
|
||||
$object = new stdClass();
|
||||
|
||||
// Process all other data.
|
||||
|
@ -137,11 +132,10 @@ class Google_Model implements ArrayAccess
|
|||
* Handle different types of values, primarily
|
||||
* other objects and map and array data types.
|
||||
*/
|
||||
private function getSimpleValue($value)
|
||||
{
|
||||
private function getSimpleValue($value) {
|
||||
if ($value instanceof Google_Model) {
|
||||
return $value->toSimpleObject();
|
||||
} else if (is_array($value)) {
|
||||
} elseif (is_array($value)) {
|
||||
$return = array();
|
||||
foreach ($value as $key => $a_value) {
|
||||
$a_value = $this->getSimpleValue($a_value);
|
||||
|
@ -159,8 +153,7 @@ class Google_Model implements ArrayAccess
|
|||
* @param array $array
|
||||
* @return bool True if the array is associative.
|
||||
*/
|
||||
protected function isAssociativeArray($array)
|
||||
{
|
||||
protected function isAssociativeArray($array) {
|
||||
if (!is_array($array)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -180,8 +173,7 @@ class Google_Model implements ArrayAccess
|
|||
* @param $item
|
||||
* @return object The object from the item.
|
||||
*/
|
||||
private function createObjectFromName($name, $item)
|
||||
{
|
||||
private function createObjectFromName($name, $item) {
|
||||
$type = $this->$name;
|
||||
return new $type($item);
|
||||
}
|
||||
|
@ -192,8 +184,7 @@ class Google_Model implements ArrayAccess
|
|||
* @param array $obj Items that should be validated.
|
||||
* @param string $method Method expecting an array as an argument.
|
||||
*/
|
||||
public function assertIsArray($obj, $method)
|
||||
{
|
||||
public function assertIsArray($obj, $method) {
|
||||
if ($obj && !is_array($obj)) {
|
||||
throw new Google_Exception(
|
||||
"Incorrect parameter type passed to $method(). Expected an array."
|
||||
|
@ -201,20 +192,17 @@ class Google_Model implements ArrayAccess
|
|||
}
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset) || isset($this->modelData[$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
public function offsetGet($offset) {
|
||||
return isset($this->$offset) ?
|
||||
$this->$offset :
|
||||
$this->__get($offset);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
public function offsetSet($offset, $value) {
|
||||
if (property_exists($this, $offset)) {
|
||||
$this->$offset = $value;
|
||||
} else {
|
||||
|
@ -223,28 +211,23 @@ class Google_Model implements ArrayAccess
|
|||
}
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->modelData[$offset]);
|
||||
}
|
||||
|
||||
protected function keyType($key)
|
||||
{
|
||||
protected function keyType($key) {
|
||||
return $key . "Type";
|
||||
}
|
||||
|
||||
protected function dataType($key)
|
||||
{
|
||||
protected function dataType($key) {
|
||||
return $key . "DataType";
|
||||
}
|
||||
|
||||
public function __isset($key)
|
||||
{
|
||||
public function __isset($key) {
|
||||
return isset($this->modelData[$key]);
|
||||
}
|
||||
|
||||
public function __unset($key)
|
||||
{
|
||||
public function __unset($key) {
|
||||
unset($this->modelData[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class Google_Service
|
||||
{
|
||||
class Google_Service {
|
||||
public $version;
|
||||
public $servicePath;
|
||||
public $availableScopes;
|
||||
public $resource;
|
||||
private $client;
|
||||
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
|
@ -32,8 +30,7 @@ class Google_Service
|
|||
* Return the associated Google_Client class.
|
||||
* @return Google_Client
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
public function getClient() {
|
||||
return $this->client;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -29,8 +29,7 @@
|
|||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Admin extends Google_Service
|
||||
{
|
||||
class Google_Service_Admin extends Google_Service {
|
||||
/** Manage email messages of users on your domain. */
|
||||
const EMAIL_MIGRATION = "https://www.googleapis.com/auth/email.migration";
|
||||
|
||||
|
@ -42,8 +41,7 @@ class Google_Service_Admin extends Google_Service
|
|||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'email/v2/users/';
|
||||
$this->version = 'email_migration_v2';
|
||||
|
@ -81,8 +79,7 @@ class Google_Service_Admin extends Google_Service
|
|||
* $mail = $adminService->mail;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Admin_Mail_Resource extends Google_Service_Resource
|
||||
{
|
||||
class Google_Service_Admin_Mail_Resource extends Google_Service_Resource {
|
||||
|
||||
/**
|
||||
* Insert Mail into Google's Gmail backends (mail.insert)
|
||||
|
@ -92,8 +89,7 @@ class Google_Service_Admin_Mail_Resource extends Google_Service_Resource
|
|||
* @param Google_MailItem $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function insert($userKey, Google_Service_Admin_MailItem $postBody, $optParams = array())
|
||||
{
|
||||
public function insert($userKey, Google_Service_Admin_MailItem $postBody, $optParams = array()) {
|
||||
$params = array('userKey' => $userKey, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params));
|
||||
|
@ -101,10 +97,7 @@ class Google_Service_Admin_Mail_Resource extends Google_Service_Resource
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Admin_MailItem extends Google_Collection
|
||||
{
|
||||
class Google_Service_Admin_MailItem extends Google_Collection {
|
||||
public $isDeleted;
|
||||
public $isDraft;
|
||||
public $isInbox;
|
||||
|
@ -115,93 +108,75 @@ class Google_Service_Admin_MailItem extends Google_Collection
|
|||
public $kind;
|
||||
public $labels;
|
||||
|
||||
public function setIsDeleted($isDeleted)
|
||||
{
|
||||
public function setIsDeleted($isDeleted) {
|
||||
$this->isDeleted = $isDeleted;
|
||||
}
|
||||
|
||||
public function getIsDeleted()
|
||||
{
|
||||
public function getIsDeleted() {
|
||||
return $this->isDeleted;
|
||||
}
|
||||
|
||||
public function setIsDraft($isDraft)
|
||||
{
|
||||
public function setIsDraft($isDraft) {
|
||||
$this->isDraft = $isDraft;
|
||||
}
|
||||
|
||||
public function getIsDraft()
|
||||
{
|
||||
public function getIsDraft() {
|
||||
return $this->isDraft;
|
||||
}
|
||||
|
||||
public function setIsInbox($isInbox)
|
||||
{
|
||||
public function setIsInbox($isInbox) {
|
||||
$this->isInbox = $isInbox;
|
||||
}
|
||||
|
||||
public function getIsInbox()
|
||||
{
|
||||
public function getIsInbox() {
|
||||
return $this->isInbox;
|
||||
}
|
||||
|
||||
public function setIsSent($isSent)
|
||||
{
|
||||
public function setIsSent($isSent) {
|
||||
$this->isSent = $isSent;
|
||||
}
|
||||
|
||||
public function getIsSent()
|
||||
{
|
||||
public function getIsSent() {
|
||||
return $this->isSent;
|
||||
}
|
||||
|
||||
public function setIsStarred($isStarred)
|
||||
{
|
||||
public function setIsStarred($isStarred) {
|
||||
$this->isStarred = $isStarred;
|
||||
}
|
||||
|
||||
public function getIsStarred()
|
||||
{
|
||||
public function getIsStarred() {
|
||||
return $this->isStarred;
|
||||
}
|
||||
|
||||
public function setIsTrash($isTrash)
|
||||
{
|
||||
public function setIsTrash($isTrash) {
|
||||
$this->isTrash = $isTrash;
|
||||
}
|
||||
|
||||
public function getIsTrash()
|
||||
{
|
||||
public function getIsTrash() {
|
||||
return $this->isTrash;
|
||||
}
|
||||
|
||||
public function setIsUnread($isUnread)
|
||||
{
|
||||
public function setIsUnread($isUnread) {
|
||||
$this->isUnread = $isUnread;
|
||||
}
|
||||
|
||||
public function getIsUnread()
|
||||
{
|
||||
public function getIsUnread() {
|
||||
return $this->isUnread;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setLabels($labels)
|
||||
{
|
||||
public function setLabels($labels) {
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
public function getLabels()
|
||||
{
|
||||
public function getLabels() {
|
||||
return $this->labels;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -29,8 +29,7 @@
|
|||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_AppState extends Google_Service
|
||||
{
|
||||
class Google_Service_AppState extends Google_Service {
|
||||
/** View and manage your data for this application. */
|
||||
const APPSTATE = "https://www.googleapis.com/auth/appstate";
|
||||
|
||||
|
@ -42,8 +41,7 @@ class Google_Service_AppState extends Google_Service
|
|||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'appstate/v1/';
|
||||
$this->version = 'v1';
|
||||
|
@ -69,7 +67,7 @@ class Google_Service_AppState extends Google_Service
|
|||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
), 'delete' => array(
|
||||
'path' => 'states/{stateKey}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
|
@ -79,7 +77,7 @@ class Google_Service_AppState extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
), 'get' => array(
|
||||
'path' => 'states/{stateKey}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
|
@ -89,7 +87,7 @@ class Google_Service_AppState extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
), 'list' => array(
|
||||
'path' => 'states',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
|
@ -98,7 +96,7 @@ class Google_Service_AppState extends Google_Service
|
|||
'type' => 'boolean',
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
), 'update' => array(
|
||||
'path' => 'states/{stateKey}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
|
@ -128,8 +126,7 @@ class Google_Service_AppState extends Google_Service
|
|||
* $states = $appstateService->states;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
||||
{
|
||||
class Google_Service_AppState_States_Resource extends Google_Service_Resource {
|
||||
|
||||
/**
|
||||
* Clears (sets to empty) the data for the passed key if and only if the passed
|
||||
|
@ -144,12 +141,12 @@ class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
|||
* The version of the data to be cleared. Version strings are returned by the server.
|
||||
* @return Google_Service_AppState_WriteResult
|
||||
*/
|
||||
public function clear($stateKey, $optParams = array())
|
||||
{
|
||||
public function clear($stateKey, $optParams = array()) {
|
||||
$params = array('stateKey' => $stateKey);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('clear', array($params), "Google_Service_AppState_WriteResult");
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a key and the data associated with it. The key is removed and no
|
||||
* longer counts against the key quota. Note that since this method is not safe
|
||||
|
@ -161,12 +158,12 @@ class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
|||
* The key for the data to be retrieved.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($stateKey, $optParams = array())
|
||||
{
|
||||
public function delete($stateKey, $optParams = array()) {
|
||||
$params = array('stateKey' => $stateKey);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data corresponding to the passed key. If the key does not exist
|
||||
* on the server, an HTTP 404 will be returned. (states.get)
|
||||
|
@ -176,12 +173,12 @@ class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_AppState_GetResponse
|
||||
*/
|
||||
public function get($stateKey, $optParams = array())
|
||||
{
|
||||
public function get($stateKey, $optParams = array()) {
|
||||
$params = array('stateKey' => $stateKey);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_AppState_GetResponse");
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all the states keys, and optionally the state data. (states.listStates)
|
||||
*
|
||||
|
@ -191,12 +188,12 @@ class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
|||
* Whether to include the full data in addition to the version number
|
||||
* @return Google_Service_AppState_ListResponse
|
||||
*/
|
||||
public function listStates($optParams = array())
|
||||
{
|
||||
public function listStates($optParams = array()) {
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_AppState_ListResponse");
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the data associated with the input key if and only if the passed
|
||||
* version matches the currently stored version. This method is safe in the face
|
||||
|
@ -213,8 +210,7 @@ class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
|||
* server for this key, the update will succeed irrespective of the value of this parameter.
|
||||
* @return Google_Service_AppState_WriteResult
|
||||
*/
|
||||
public function update($stateKey, Google_Service_AppState_UpdateRequest $postBody, $optParams = array())
|
||||
{
|
||||
public function update($stateKey, Google_Service_AppState_UpdateRequest $postBody, $optParams = array()) {
|
||||
$params = array('stateKey' => $stateKey, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_AppState_WriteResult");
|
||||
|
@ -222,153 +218,123 @@ class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_AppState_GetResponse extends Google_Model
|
||||
{
|
||||
class Google_Service_AppState_GetResponse extends Google_Model {
|
||||
public $currentStateVersion;
|
||||
public $data;
|
||||
public $kind;
|
||||
public $stateKey;
|
||||
|
||||
public function setCurrentStateVersion($currentStateVersion)
|
||||
{
|
||||
public function setCurrentStateVersion($currentStateVersion) {
|
||||
$this->currentStateVersion = $currentStateVersion;
|
||||
}
|
||||
|
||||
public function getCurrentStateVersion()
|
||||
{
|
||||
public function getCurrentStateVersion() {
|
||||
return $this->currentStateVersion;
|
||||
}
|
||||
|
||||
public function setData($data)
|
||||
{
|
||||
public function setData($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setStateKey($stateKey)
|
||||
{
|
||||
public function setStateKey($stateKey) {
|
||||
$this->stateKey = $stateKey;
|
||||
}
|
||||
|
||||
public function getStateKey()
|
||||
{
|
||||
public function getStateKey() {
|
||||
return $this->stateKey;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AppState_ListResponse extends Google_Collection
|
||||
{
|
||||
class Google_Service_AppState_ListResponse extends Google_Collection {
|
||||
protected $itemsType = 'Google_Service_AppState_GetResponse';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $maximumKeyCount;
|
||||
|
||||
public function setItems($items)
|
||||
{
|
||||
public function setItems($items) {
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
public function getItems() {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setMaximumKeyCount($maximumKeyCount)
|
||||
{
|
||||
public function setMaximumKeyCount($maximumKeyCount) {
|
||||
$this->maximumKeyCount = $maximumKeyCount;
|
||||
}
|
||||
|
||||
public function getMaximumKeyCount()
|
||||
{
|
||||
public function getMaximumKeyCount() {
|
||||
return $this->maximumKeyCount;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AppState_UpdateRequest extends Google_Model
|
||||
{
|
||||
class Google_Service_AppState_UpdateRequest extends Google_Model {
|
||||
public $data;
|
||||
public $kind;
|
||||
|
||||
public function setData($data)
|
||||
{
|
||||
public function setData($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AppState_WriteResult extends Google_Model
|
||||
{
|
||||
class Google_Service_AppState_WriteResult extends Google_Model {
|
||||
public $currentStateVersion;
|
||||
public $kind;
|
||||
public $stateKey;
|
||||
|
||||
public function setCurrentStateVersion($currentStateVersion)
|
||||
{
|
||||
public function setCurrentStateVersion($currentStateVersion) {
|
||||
$this->currentStateVersion = $currentStateVersion;
|
||||
}
|
||||
|
||||
public function getCurrentStateVersion()
|
||||
{
|
||||
public function getCurrentStateVersion() {
|
||||
return $this->currentStateVersion;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setStateKey($stateKey)
|
||||
{
|
||||
public function setStateKey($stateKey) {
|
||||
$this->stateKey = $stateKey;
|
||||
}
|
||||
|
||||
public function getStateKey()
|
||||
{
|
||||
public function getStateKey() {
|
||||
return $this->stateKey;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Appsactivity extends Google_Service
|
||||
{
|
||||
class Google_Service_Appsactivity extends Google_Service {
|
||||
/** View historical activity for Google services. */
|
||||
const ACTIVITY = "https://www.googleapis.com/auth/activity";
|
||||
/** View and manage the files and documents in your Google Drive. */
|
||||
|
@ -48,8 +47,7 @@ class Google_Service_Appsactivity extends Google_Service
|
|||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'appsactivity/v1/';
|
||||
$this->version = 'v1';
|
||||
|
@ -110,8 +108,7 @@ class Google_Service_Appsactivity extends Google_Service
|
|||
* $activities = $appsactivityService->activities;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Appsactivity_Activities_Resource extends Google_Service_Resource
|
||||
{
|
||||
class Google_Service_Appsactivity_Activities_Resource extends Google_Service_Resource {
|
||||
|
||||
/**
|
||||
* Returns a list of activities visible to the current logged in user. Visible
|
||||
|
@ -140,12 +137,11 @@ class Google_Service_Appsactivity_Activities_Resource extends Google_Service_Res
|
|||
* Identifies the Drive item to return activities for.
|
||||
* @opt_param string source
|
||||
* The Google service from which to return activities. Possible values of source are:
|
||||
-
|
||||
* -
|
||||
* drive.google.com
|
||||
* @return Google_Service_Appsactivity_ListActivitiesResponse
|
||||
*/
|
||||
public function listActivities($optParams = array())
|
||||
{
|
||||
public function listActivities($optParams = array()) {
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Appsactivity_ListActivitiesResponse");
|
||||
|
@ -153,38 +149,30 @@ class Google_Service_Appsactivity_Activities_Resource extends Google_Service_Res
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Appsactivity_Activity extends Google_Collection
|
||||
{
|
||||
class Google_Service_Appsactivity_Activity extends Google_Collection {
|
||||
protected $combinedEventType = 'Google_Service_Appsactivity_Event';
|
||||
protected $combinedEventDataType = '';
|
||||
protected $singleEventsType = 'Google_Service_Appsactivity_Event';
|
||||
protected $singleEventsDataType = 'array';
|
||||
|
||||
public function setCombinedEvent(Google_Service_Appsactivity_Event $combinedEvent)
|
||||
{
|
||||
public function setCombinedEvent(Google_Service_Appsactivity_Event $combinedEvent) {
|
||||
$this->combinedEvent = $combinedEvent;
|
||||
}
|
||||
|
||||
public function getCombinedEvent()
|
||||
{
|
||||
public function getCombinedEvent() {
|
||||
return $this->combinedEvent;
|
||||
}
|
||||
|
||||
public function setSingleEvents($singleEvents)
|
||||
{
|
||||
public function setSingleEvents($singleEvents) {
|
||||
$this->singleEvents = $singleEvents;
|
||||
}
|
||||
|
||||
public function getSingleEvents()
|
||||
{
|
||||
public function getSingleEvents() {
|
||||
return $this->singleEvents;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Event extends Google_Collection
|
||||
{
|
||||
class Google_Service_Appsactivity_Event extends Google_Collection {
|
||||
public $additionalEventTypes;
|
||||
public $eventTimeMillis;
|
||||
public $fromUserDeletion;
|
||||
|
@ -200,191 +188,155 @@ class Google_Service_Appsactivity_Event extends Google_Collection
|
|||
protected $userType = 'Google_Service_Appsactivity_User';
|
||||
protected $userDataType = '';
|
||||
|
||||
public function setAdditionalEventTypes($additionalEventTypes)
|
||||
{
|
||||
public function setAdditionalEventTypes($additionalEventTypes) {
|
||||
$this->additionalEventTypes = $additionalEventTypes;
|
||||
}
|
||||
|
||||
public function getAdditionalEventTypes()
|
||||
{
|
||||
public function getAdditionalEventTypes() {
|
||||
return $this->additionalEventTypes;
|
||||
}
|
||||
|
||||
public function setEventTimeMillis($eventTimeMillis)
|
||||
{
|
||||
public function setEventTimeMillis($eventTimeMillis) {
|
||||
$this->eventTimeMillis = $eventTimeMillis;
|
||||
}
|
||||
|
||||
public function getEventTimeMillis()
|
||||
{
|
||||
public function getEventTimeMillis() {
|
||||
return $this->eventTimeMillis;
|
||||
}
|
||||
|
||||
public function setFromUserDeletion($fromUserDeletion)
|
||||
{
|
||||
public function setFromUserDeletion($fromUserDeletion) {
|
||||
$this->fromUserDeletion = $fromUserDeletion;
|
||||
}
|
||||
|
||||
public function getFromUserDeletion()
|
||||
{
|
||||
public function getFromUserDeletion() {
|
||||
return $this->fromUserDeletion;
|
||||
}
|
||||
|
||||
public function setMove(Google_Service_Appsactivity_Move $move)
|
||||
{
|
||||
public function setMove(Google_Service_Appsactivity_Move $move) {
|
||||
$this->move = $move;
|
||||
}
|
||||
|
||||
public function getMove()
|
||||
{
|
||||
public function getMove() {
|
||||
return $this->move;
|
||||
}
|
||||
|
||||
public function setPermissionChanges($permissionChanges)
|
||||
{
|
||||
public function setPermissionChanges($permissionChanges) {
|
||||
$this->permissionChanges = $permissionChanges;
|
||||
}
|
||||
|
||||
public function getPermissionChanges()
|
||||
{
|
||||
public function getPermissionChanges() {
|
||||
return $this->permissionChanges;
|
||||
}
|
||||
|
||||
public function setPrimaryEventType($primaryEventType)
|
||||
{
|
||||
public function setPrimaryEventType($primaryEventType) {
|
||||
$this->primaryEventType = $primaryEventType;
|
||||
}
|
||||
|
||||
public function getPrimaryEventType()
|
||||
{
|
||||
public function getPrimaryEventType() {
|
||||
return $this->primaryEventType;
|
||||
}
|
||||
|
||||
public function setRename(Google_Service_Appsactivity_Rename $rename)
|
||||
{
|
||||
public function setRename(Google_Service_Appsactivity_Rename $rename) {
|
||||
$this->rename = $rename;
|
||||
}
|
||||
|
||||
public function getRename()
|
||||
{
|
||||
public function getRename() {
|
||||
return $this->rename;
|
||||
}
|
||||
|
||||
public function setTarget(Google_Service_Appsactivity_Target $target)
|
||||
{
|
||||
public function setTarget(Google_Service_Appsactivity_Target $target) {
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
public function getTarget()
|
||||
{
|
||||
public function getTarget() {
|
||||
return $this->target;
|
||||
}
|
||||
|
||||
public function setUser(Google_Service_Appsactivity_User $user)
|
||||
{
|
||||
public function setUser(Google_Service_Appsactivity_User $user) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_ListActivitiesResponse extends Google_Collection
|
||||
{
|
||||
class Google_Service_Appsactivity_ListActivitiesResponse extends Google_Collection {
|
||||
protected $activitiesType = 'Google_Service_Appsactivity_Activity';
|
||||
protected $activitiesDataType = 'array';
|
||||
public $nextPageToken;
|
||||
|
||||
public function setActivities($activities)
|
||||
{
|
||||
public function setActivities($activities) {
|
||||
$this->activities = $activities;
|
||||
}
|
||||
|
||||
public function getActivities()
|
||||
{
|
||||
public function getActivities() {
|
||||
return $this->activities;
|
||||
}
|
||||
|
||||
public function setNextPageToken($nextPageToken)
|
||||
{
|
||||
public function setNextPageToken($nextPageToken) {
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
public function getNextPageToken() {
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Move extends Google_Collection
|
||||
{
|
||||
class Google_Service_Appsactivity_Move extends Google_Collection {
|
||||
protected $addedParentsType = 'Google_Service_Appsactivity_Parent';
|
||||
protected $addedParentsDataType = 'array';
|
||||
protected $removedParentsType = 'Google_Service_Appsactivity_Parent';
|
||||
protected $removedParentsDataType = 'array';
|
||||
|
||||
public function setAddedParents($addedParents)
|
||||
{
|
||||
public function setAddedParents($addedParents) {
|
||||
$this->addedParents = $addedParents;
|
||||
}
|
||||
|
||||
public function getAddedParents()
|
||||
{
|
||||
public function getAddedParents() {
|
||||
return $this->addedParents;
|
||||
}
|
||||
|
||||
public function setRemovedParents($removedParents)
|
||||
{
|
||||
public function setRemovedParents($removedParents) {
|
||||
$this->removedParents = $removedParents;
|
||||
}
|
||||
|
||||
public function getRemovedParents()
|
||||
{
|
||||
public function getRemovedParents() {
|
||||
return $this->removedParents;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Parent extends Google_Model
|
||||
{
|
||||
class Google_Service_Appsactivity_Parent extends Google_Model {
|
||||
public $id;
|
||||
public $isRoot;
|
||||
public $title;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setIsRoot($isRoot)
|
||||
{
|
||||
public function setIsRoot($isRoot) {
|
||||
$this->isRoot = $isRoot;
|
||||
}
|
||||
|
||||
public function getIsRoot()
|
||||
{
|
||||
public function getIsRoot() {
|
||||
return $this->isRoot;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
public function setTitle($title) {
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
public function getTitle() {
|
||||
return $this->title;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Permission extends Google_Model
|
||||
{
|
||||
class Google_Service_Appsactivity_Permission extends Google_Model {
|
||||
public $name;
|
||||
public $permissionId;
|
||||
public $role;
|
||||
|
@ -393,196 +345,159 @@ class Google_Service_Appsactivity_Permission extends Google_Model
|
|||
protected $userDataType = '';
|
||||
public $withLink;
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setPermissionId($permissionId)
|
||||
{
|
||||
public function setPermissionId($permissionId) {
|
||||
$this->permissionId = $permissionId;
|
||||
}
|
||||
|
||||
public function getPermissionId()
|
||||
{
|
||||
public function getPermissionId() {
|
||||
return $this->permissionId;
|
||||
}
|
||||
|
||||
public function setRole($role)
|
||||
{
|
||||
public function setRole($role) {
|
||||
$this->role = $role;
|
||||
}
|
||||
|
||||
public function getRole()
|
||||
{
|
||||
public function getRole() {
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
public function setType($type) {
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
public function getType() {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setUser(Google_Service_Appsactivity_User $user)
|
||||
{
|
||||
public function setUser(Google_Service_Appsactivity_User $user) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setWithLink($withLink)
|
||||
{
|
||||
public function setWithLink($withLink) {
|
||||
$this->withLink = $withLink;
|
||||
}
|
||||
|
||||
public function getWithLink()
|
||||
{
|
||||
public function getWithLink() {
|
||||
return $this->withLink;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_PermissionChange extends Google_Collection
|
||||
{
|
||||
class Google_Service_Appsactivity_PermissionChange extends Google_Collection {
|
||||
protected $addedPermissionsType = 'Google_Service_Appsactivity_Permission';
|
||||
protected $addedPermissionsDataType = 'array';
|
||||
protected $removedPermissionsType = 'Google_Service_Appsactivity_Permission';
|
||||
protected $removedPermissionsDataType = 'array';
|
||||
|
||||
public function setAddedPermissions($addedPermissions)
|
||||
{
|
||||
public function setAddedPermissions($addedPermissions) {
|
||||
$this->addedPermissions = $addedPermissions;
|
||||
}
|
||||
|
||||
public function getAddedPermissions()
|
||||
{
|
||||
public function getAddedPermissions() {
|
||||
return $this->addedPermissions;
|
||||
}
|
||||
|
||||
public function setRemovedPermissions($removedPermissions)
|
||||
{
|
||||
public function setRemovedPermissions($removedPermissions) {
|
||||
$this->removedPermissions = $removedPermissions;
|
||||
}
|
||||
|
||||
public function getRemovedPermissions()
|
||||
{
|
||||
public function getRemovedPermissions() {
|
||||
return $this->removedPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Photo extends Google_Model
|
||||
{
|
||||
class Google_Service_Appsactivity_Photo extends Google_Model {
|
||||
public $url;
|
||||
|
||||
public function setUrl($url)
|
||||
{
|
||||
public function setUrl($url) {
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
public function getUrl() {
|
||||
return $this->url;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Rename extends Google_Model
|
||||
{
|
||||
class Google_Service_Appsactivity_Rename extends Google_Model {
|
||||
public $newTitle;
|
||||
public $oldTitle;
|
||||
|
||||
public function setNewTitle($newTitle)
|
||||
{
|
||||
public function setNewTitle($newTitle) {
|
||||
$this->newTitle = $newTitle;
|
||||
}
|
||||
|
||||
public function getNewTitle()
|
||||
{
|
||||
public function getNewTitle() {
|
||||
return $this->newTitle;
|
||||
}
|
||||
|
||||
public function setOldTitle($oldTitle)
|
||||
{
|
||||
public function setOldTitle($oldTitle) {
|
||||
$this->oldTitle = $oldTitle;
|
||||
}
|
||||
|
||||
public function getOldTitle()
|
||||
{
|
||||
public function getOldTitle() {
|
||||
return $this->oldTitle;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_Target extends Google_Model
|
||||
{
|
||||
class Google_Service_Appsactivity_Target extends Google_Model {
|
||||
public $id;
|
||||
public $mimeType;
|
||||
public $name;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setMimeType($mimeType)
|
||||
{
|
||||
public function setMimeType($mimeType) {
|
||||
$this->mimeType = $mimeType;
|
||||
}
|
||||
|
||||
public function getMimeType()
|
||||
{
|
||||
public function getMimeType() {
|
||||
return $this->mimeType;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Appsactivity_User extends Google_Model
|
||||
{
|
||||
class Google_Service_Appsactivity_User extends Google_Model {
|
||||
public $name;
|
||||
protected $photoType = 'Google_Service_Appsactivity_Photo';
|
||||
protected $photoDataType = '';
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setPhoto(Google_Service_Appsactivity_Photo $photo)
|
||||
{
|
||||
public function setPhoto(Google_Service_Appsactivity_Photo $photo) {
|
||||
$this->photo = $photo;
|
||||
}
|
||||
|
||||
public function getPhoto()
|
||||
{
|
||||
public function getPhoto() {
|
||||
return $this->photo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Audit extends Google_Service
|
||||
{
|
||||
class Google_Service_Audit extends Google_Service {
|
||||
|
||||
|
||||
public $activities;
|
||||
|
@ -41,8 +40,7 @@ class Google_Service_Audit extends Google_Service
|
|||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'apps/reporting/audit/v1/';
|
||||
$this->version = 'v1';
|
||||
|
@ -121,8 +119,7 @@ class Google_Service_Audit extends Google_Service
|
|||
* $activities = $auditService->activities;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Audit_Activities_Resource extends Google_Service_Resource
|
||||
{
|
||||
class Google_Service_Audit_Activities_Resource extends Google_Service_Resource {
|
||||
|
||||
/**
|
||||
* Retrieves a list of activities for a specific customer and application.
|
||||
|
@ -155,8 +152,7 @@ class Google_Service_Audit_Activities_Resource extends Google_Service_Resource
|
|||
* Next page URL.
|
||||
* @return Google_Service_Audit_Activities
|
||||
*/
|
||||
public function listActivities($customerId, $applicationId, $optParams = array())
|
||||
{
|
||||
public function listActivities($customerId, $applicationId, $optParams = array()) {
|
||||
$params = array('customerId' => $customerId, 'applicationId' => $applicationId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Audit_Activities");
|
||||
|
@ -164,48 +160,38 @@ class Google_Service_Audit_Activities_Resource extends Google_Service_Resource
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Audit_Activities extends Google_Collection
|
||||
{
|
||||
class Google_Service_Audit_Activities extends Google_Collection {
|
||||
protected $itemsType = 'Google_Service_Audit_Activity';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $next;
|
||||
|
||||
public function setItems($items)
|
||||
{
|
||||
public function setItems($items) {
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
public function getItems() {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setNext($next)
|
||||
{
|
||||
public function setNext($next) {
|
||||
$this->next = $next;
|
||||
}
|
||||
|
||||
public function getNext()
|
||||
{
|
||||
public function getNext() {
|
||||
return $this->next;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_Activity extends Google_Collection
|
||||
{
|
||||
class Google_Service_Audit_Activity extends Google_Collection {
|
||||
protected $actorType = 'Google_Service_Audit_ActivityActor';
|
||||
protected $actorDataType = '';
|
||||
protected $eventsType = 'Google_Service_Audit_ActivityEvents';
|
||||
|
@ -216,223 +202,181 @@ class Google_Service_Audit_Activity extends Google_Collection
|
|||
public $kind;
|
||||
public $ownerDomain;
|
||||
|
||||
public function setActor(Google_Service_Audit_ActivityActor $actor)
|
||||
{
|
||||
public function setActor(Google_Service_Audit_ActivityActor $actor) {
|
||||
$this->actor = $actor;
|
||||
}
|
||||
|
||||
public function getActor()
|
||||
{
|
||||
public function getActor() {
|
||||
return $this->actor;
|
||||
}
|
||||
|
||||
public function setEvents($events)
|
||||
{
|
||||
public function setEvents($events) {
|
||||
$this->events = $events;
|
||||
}
|
||||
|
||||
public function getEvents()
|
||||
{
|
||||
public function getEvents() {
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
public function setId(Google_Service_Audit_ActivityId $id)
|
||||
{
|
||||
public function setId(Google_Service_Audit_ActivityId $id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setIpAddress($ipAddress)
|
||||
{
|
||||
public function setIpAddress($ipAddress) {
|
||||
$this->ipAddress = $ipAddress;
|
||||
}
|
||||
|
||||
public function getIpAddress()
|
||||
{
|
||||
public function getIpAddress() {
|
||||
return $this->ipAddress;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setOwnerDomain($ownerDomain)
|
||||
{
|
||||
public function setOwnerDomain($ownerDomain) {
|
||||
$this->ownerDomain = $ownerDomain;
|
||||
}
|
||||
|
||||
public function getOwnerDomain()
|
||||
{
|
||||
public function getOwnerDomain() {
|
||||
return $this->ownerDomain;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityActor extends Google_Model
|
||||
{
|
||||
class Google_Service_Audit_ActivityActor extends Google_Model {
|
||||
public $applicationId;
|
||||
public $callerType;
|
||||
public $email;
|
||||
public $key;
|
||||
|
||||
public function setApplicationId($applicationId)
|
||||
{
|
||||
public function setApplicationId($applicationId) {
|
||||
$this->applicationId = $applicationId;
|
||||
}
|
||||
|
||||
public function getApplicationId()
|
||||
{
|
||||
public function getApplicationId() {
|
||||
return $this->applicationId;
|
||||
}
|
||||
|
||||
public function setCallerType($callerType)
|
||||
{
|
||||
public function setCallerType($callerType) {
|
||||
$this->callerType = $callerType;
|
||||
}
|
||||
|
||||
public function getCallerType()
|
||||
{
|
||||
public function getCallerType() {
|
||||
return $this->callerType;
|
||||
}
|
||||
|
||||
public function setEmail($email)
|
||||
{
|
||||
public function setEmail($email) {
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
public function getEmail() {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setKey($key)
|
||||
{
|
||||
public function setKey($key) {
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
public function getKey()
|
||||
{
|
||||
public function getKey() {
|
||||
return $this->key;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityEvents extends Google_Collection
|
||||
{
|
||||
class Google_Service_Audit_ActivityEvents extends Google_Collection {
|
||||
public $eventType;
|
||||
public $name;
|
||||
protected $parametersType = 'Google_Service_Audit_ActivityEventsParameters';
|
||||
protected $parametersDataType = 'array';
|
||||
|
||||
public function setEventType($eventType)
|
||||
{
|
||||
public function setEventType($eventType) {
|
||||
$this->eventType = $eventType;
|
||||
}
|
||||
|
||||
public function getEventType()
|
||||
{
|
||||
public function getEventType() {
|
||||
return $this->eventType;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setParameters($parameters)
|
||||
{
|
||||
public function setParameters($parameters) {
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
{
|
||||
public function getParameters() {
|
||||
return $this->parameters;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityEventsParameters extends Google_Model
|
||||
{
|
||||
class Google_Service_Audit_ActivityEventsParameters extends Google_Model {
|
||||
public $name;
|
||||
public $value;
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
public function setValue($value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityId extends Google_Model
|
||||
{
|
||||
class Google_Service_Audit_ActivityId extends Google_Model {
|
||||
public $applicationId;
|
||||
public $customerId;
|
||||
public $time;
|
||||
public $uniqQualifier;
|
||||
|
||||
public function setApplicationId($applicationId)
|
||||
{
|
||||
public function setApplicationId($applicationId) {
|
||||
$this->applicationId = $applicationId;
|
||||
}
|
||||
|
||||
public function getApplicationId()
|
||||
{
|
||||
public function getApplicationId() {
|
||||
return $this->applicationId;
|
||||
}
|
||||
|
||||
public function setCustomerId($customerId)
|
||||
{
|
||||
public function setCustomerId($customerId) {
|
||||
$this->customerId = $customerId;
|
||||
}
|
||||
|
||||
public function getCustomerId()
|
||||
{
|
||||
public function getCustomerId() {
|
||||
return $this->customerId;
|
||||
}
|
||||
|
||||
public function setTime($time)
|
||||
{
|
||||
public function setTime($time) {
|
||||
$this->time = $time;
|
||||
}
|
||||
|
||||
public function getTime()
|
||||
{
|
||||
public function getTime() {
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
public function setUniqQualifier($uniqQualifier)
|
||||
{
|
||||
public function setUniqQualifier($uniqQualifier) {
|
||||
$this->uniqQualifier = $uniqQualifier;
|
||||
}
|
||||
|
||||
public function getUniqQualifier()
|
||||
{
|
||||
public function getUniqQualifier() {
|
||||
return $this->uniqQualifier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Autoscaler extends Google_Service
|
||||
{
|
||||
class Google_Service_Autoscaler extends Google_Service {
|
||||
/** View and manage your Google Compute Engine resources. */
|
||||
const COMPUTE = "https://www.googleapis.com/auth/compute";
|
||||
/** View your Google Compute Engine resources. */
|
||||
|
@ -45,8 +44,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
public function __construct(Google_Client $client) {
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'autoscaler/v1beta2/';
|
||||
$this->version = 'v1beta2';
|
||||
|
@ -78,7 +76,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
), 'get' => array(
|
||||
'path' => 'projects/{project}/zones/{zone}/autoscalers/{autoscaler}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
|
@ -98,7 +96,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
), 'insert' => array(
|
||||
'path' => 'projects/{project}/zones/{zone}/autoscalers',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
|
@ -113,7 +111,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
), 'list' => array(
|
||||
'path' => 'projects/{project}/zones/{zone}/autoscalers',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
|
@ -140,7 +138,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
), 'patch' => array(
|
||||
'path' => 'projects/{project}/zones/{zone}/autoscalers/{autoscaler}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
|
@ -160,7 +158,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
), 'update' => array(
|
||||
'path' => 'projects/{project}/zones/{zone}/autoscalers/{autoscaler}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
|
@ -210,7 +208,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
), 'get' => array(
|
||||
'path' => '{project}/zones/{zone}/operations/{operation}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
|
@ -230,7 +228,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
), 'list' => array(
|
||||
'path' => '{project}/zones/{zone}/operations',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
|
@ -273,8 +271,7 @@ class Google_Service_Autoscaler extends Google_Service
|
|||
* $autoscalers = $autoscalerService->autoscalers;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Resource
|
||||
{
|
||||
class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Resource {
|
||||
|
||||
/**
|
||||
* Deletes the specified Autoscaler resource. (autoscalers.delete)
|
||||
|
@ -288,12 +285,12 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Autoscaler_Operation
|
||||
*/
|
||||
public function delete($project, $zone, $autoscaler, $optParams = array())
|
||||
{
|
||||
public function delete($project, $zone, $autoscaler, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'autoscaler' => $autoscaler);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params), "Google_Service_Autoscaler_Operation");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the specified Autoscaler resource. (autoscalers.get)
|
||||
*
|
||||
|
@ -306,12 +303,12 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Autoscaler_Autoscaler
|
||||
*/
|
||||
public function get($project, $zone, $autoscaler, $optParams = array())
|
||||
{
|
||||
public function get($project, $zone, $autoscaler, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'autoscaler' => $autoscaler);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Autoscaler_Autoscaler");
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new Autoscaler resource. (autoscalers.insert)
|
||||
*
|
||||
|
@ -323,12 +320,12 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Autoscaler_Operation
|
||||
*/
|
||||
public function insert($project, $zone, Google_Service_Autoscaler_Autoscaler $postBody, $optParams = array())
|
||||
{
|
||||
public function insert($project, $zone, Google_Service_Autoscaler_Autoscaler $postBody, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_Autoscaler_Operation");
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Autoscaler resources in this zone. (autoscalers.listAutoscalers)
|
||||
*
|
||||
|
@ -346,12 +343,12 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
*
|
||||
* @return Google_Service_Autoscaler_AutoscalerListResponse
|
||||
*/
|
||||
public function listAutoscalers($project, $zone, $optParams = array())
|
||||
{
|
||||
public function listAutoscalers($project, $zone, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Autoscaler_AutoscalerListResponse");
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the entire content of the Autoscaler resource. This method supports
|
||||
* patch semantics. (autoscalers.patch)
|
||||
|
@ -366,12 +363,12 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Autoscaler_Operation
|
||||
*/
|
||||
public function patch($project, $zone, $autoscaler, Google_Service_Autoscaler_Autoscaler $postBody, $optParams = array())
|
||||
{
|
||||
public function patch($project, $zone, $autoscaler, Google_Service_Autoscaler_Autoscaler $postBody, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'autoscaler' => $autoscaler, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_Autoscaler_Operation");
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the entire content of the Autoscaler resource. (autoscalers.update)
|
||||
*
|
||||
|
@ -385,8 +382,7 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Autoscaler_Operation
|
||||
*/
|
||||
public function update($project, $zone, $autoscaler, Google_Service_Autoscaler_Autoscaler $postBody, $optParams = array())
|
||||
{
|
||||
public function update($project, $zone, $autoscaler, Google_Service_Autoscaler_Autoscaler $postBody, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'autoscaler' => $autoscaler, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_Autoscaler_Operation");
|
||||
|
@ -401,8 +397,7 @@ class Google_Service_Autoscaler_Autoscalers_Resource extends Google_Service_Reso
|
|||
* $zoneOperations = $autoscalerService->zoneOperations;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Autoscaler_ZoneOperations_Resource extends Google_Service_Resource
|
||||
{
|
||||
class Google_Service_Autoscaler_ZoneOperations_Resource extends Google_Service_Resource {
|
||||
|
||||
/**
|
||||
* Deletes the specified zone-specific operation resource.
|
||||
|
@ -416,12 +411,12 @@ class Google_Service_Autoscaler_ZoneOperations_Resource extends Google_Service_R
|
|||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($project, $zone, $operation, $optParams = array())
|
||||
{
|
||||
public function delete($project, $zone, $operation, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'operation' => $operation);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the specified zone-specific operation resource.
|
||||
* (zoneOperations.get)
|
||||
|
@ -435,12 +430,12 @@ class Google_Service_Autoscaler_ZoneOperations_Resource extends Google_Service_R
|
|||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Autoscaler_Operation
|
||||
*/
|
||||
public function get($project, $zone, $operation, $optParams = array())
|
||||
{
|
||||
public function get($project, $zone, $operation, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone, 'operation' => $operation);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Autoscaler_Operation");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of operation resources contained within the specified
|
||||
* zone. (zoneOperations.listZoneOperations)
|
||||
|
@ -459,8 +454,7 @@ class Google_Service_Autoscaler_ZoneOperations_Resource extends Google_Service_R
|
|||
*
|
||||
* @return Google_Service_Autoscaler_OperationList
|
||||
*/
|
||||
public function listZoneOperations($project, $zone, $optParams = array())
|
||||
{
|
||||
public function listZoneOperations($project, $zone, $optParams = array()) {
|
||||
$params = array('project' => $project, 'zone' => $zone);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Autoscaler_OperationList");
|
||||
|
@ -468,10 +462,7 @@ class Google_Service_Autoscaler_ZoneOperations_Resource extends Google_Service_R
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Autoscaler_Autoscaler extends Google_Model
|
||||
{
|
||||
class Google_Service_Autoscaler_Autoscaler extends Google_Model {
|
||||
protected $autoscalingPolicyType = 'Google_Service_Autoscaler_AutoscalingPolicy';
|
||||
protected $autoscalingPolicyDataType = '';
|
||||
public $creationTimestamp;
|
||||
|
@ -481,106 +472,86 @@ class Google_Service_Autoscaler_Autoscaler extends Google_Model
|
|||
public $selfLink;
|
||||
public $target;
|
||||
|
||||
public function setAutoscalingPolicy(Google_Service_Autoscaler_AutoscalingPolicy $autoscalingPolicy)
|
||||
{
|
||||
public function setAutoscalingPolicy(Google_Service_Autoscaler_AutoscalingPolicy $autoscalingPolicy) {
|
||||
$this->autoscalingPolicy = $autoscalingPolicy;
|
||||
}
|
||||
|
||||
public function getAutoscalingPolicy()
|
||||
{
|
||||
public function getAutoscalingPolicy() {
|
||||
return $this->autoscalingPolicy;
|
||||
}
|
||||
|
||||
public function setCreationTimestamp($creationTimestamp)
|
||||
{
|
||||
public function setCreationTimestamp($creationTimestamp) {
|
||||
$this->creationTimestamp = $creationTimestamp;
|
||||
}
|
||||
|
||||
public function getCreationTimestamp()
|
||||
{
|
||||
public function getCreationTimestamp() {
|
||||
return $this->creationTimestamp;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
public function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setSelfLink($selfLink)
|
||||
{
|
||||
public function setSelfLink($selfLink) {
|
||||
$this->selfLink = $selfLink;
|
||||
}
|
||||
|
||||
public function getSelfLink()
|
||||
{
|
||||
public function getSelfLink() {
|
||||
return $this->selfLink;
|
||||
}
|
||||
|
||||
public function setTarget($target)
|
||||
{
|
||||
public function setTarget($target) {
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
public function getTarget()
|
||||
{
|
||||
public function getTarget() {
|
||||
return $this->target;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_AutoscalerListResponse extends Google_Collection
|
||||
{
|
||||
class Google_Service_Autoscaler_AutoscalerListResponse extends Google_Collection {
|
||||
protected $itemsType = 'Google_Service_Autoscaler_Autoscaler';
|
||||
protected $itemsDataType = 'array';
|
||||
public $nextPageToken;
|
||||
|
||||
public function setItems($items)
|
||||
{
|
||||
public function setItems($items) {
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
public function getItems() {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function setNextPageToken($nextPageToken)
|
||||
{
|
||||
public function setNextPageToken($nextPageToken) {
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
public function getNextPageToken() {
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_AutoscalingPolicy extends Google_Collection
|
||||
{
|
||||
class Google_Service_Autoscaler_AutoscalingPolicy extends Google_Collection {
|
||||
public $coolDownPeriodSec;
|
||||
protected $cpuUtilizationType = 'Google_Service_Autoscaler_AutoscalingPolicyCpuUtilization';
|
||||
protected $cpuUtilizationDataType = '';
|
||||
|
@ -591,125 +562,101 @@ class Google_Service_Autoscaler_AutoscalingPolicy extends Google_Collection
|
|||
public $maxNumReplicas;
|
||||
public $minNumReplicas;
|
||||
|
||||
public function setCoolDownPeriodSec($coolDownPeriodSec)
|
||||
{
|
||||
public function setCoolDownPeriodSec($coolDownPeriodSec) {
|
||||
$this->coolDownPeriodSec = $coolDownPeriodSec;
|
||||
}
|
||||
|
||||
public function getCoolDownPeriodSec()
|
||||
{
|
||||
public function getCoolDownPeriodSec() {
|
||||
return $this->coolDownPeriodSec;
|
||||
}
|
||||
|
||||
public function setCpuUtilization(Google_Service_Autoscaler_AutoscalingPolicyCpuUtilization $cpuUtilization)
|
||||
{
|
||||
public function setCpuUtilization(Google_Service_Autoscaler_AutoscalingPolicyCpuUtilization $cpuUtilization) {
|
||||
$this->cpuUtilization = $cpuUtilization;
|
||||
}
|
||||
|
||||
public function getCpuUtilization()
|
||||
{
|
||||
public function getCpuUtilization() {
|
||||
return $this->cpuUtilization;
|
||||
}
|
||||
|
||||
public function setCustomMetricUtilizations($customMetricUtilizations)
|
||||
{
|
||||
public function setCustomMetricUtilizations($customMetricUtilizations) {
|
||||
$this->customMetricUtilizations = $customMetricUtilizations;
|
||||
}
|
||||
|
||||
public function getCustomMetricUtilizations()
|
||||
{
|
||||
public function getCustomMetricUtilizations() {
|
||||
return $this->customMetricUtilizations;
|
||||
}
|
||||
|
||||
public function setLoadBalancingUtilization(Google_Service_Autoscaler_AutoscalingPolicyLoadBalancingUtilization $loadBalancingUtilization)
|
||||
{
|
||||
public function setLoadBalancingUtilization(Google_Service_Autoscaler_AutoscalingPolicyLoadBalancingUtilization $loadBalancingUtilization) {
|
||||
$this->loadBalancingUtilization = $loadBalancingUtilization;
|
||||
}
|
||||
|
||||
public function getLoadBalancingUtilization()
|
||||
{
|
||||
public function getLoadBalancingUtilization() {
|
||||
return $this->loadBalancingUtilization;
|
||||
}
|
||||
|
||||
public function setMaxNumReplicas($maxNumReplicas)
|
||||
{
|
||||
public function setMaxNumReplicas($maxNumReplicas) {
|
||||
$this->maxNumReplicas = $maxNumReplicas;
|
||||
}
|
||||
|
||||
public function getMaxNumReplicas()
|
||||
{
|
||||
public function getMaxNumReplicas() {
|
||||
return $this->maxNumReplicas;
|
||||
}
|
||||
|
||||
public function setMinNumReplicas($minNumReplicas)
|
||||
{
|
||||
public function setMinNumReplicas($minNumReplicas) {
|
||||
$this->minNumReplicas = $minNumReplicas;
|
||||
}
|
||||
|
||||
public function getMinNumReplicas()
|
||||
{
|
||||
public function getMinNumReplicas() {
|
||||
return $this->minNumReplicas;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_AutoscalingPolicyCpuUtilization extends Google_Model
|
||||
{
|
||||
class Google_Service_Autoscaler_AutoscalingPolicyCpuUtilization extends Google_Model {
|
||||
public $utilizationTarget;
|
||||
|
||||
public function setUtilizationTarget($utilizationTarget)
|
||||
{
|
||||
public function setUtilizationTarget($utilizationTarget) {
|
||||
$this->utilizationTarget = $utilizationTarget;
|
||||
}
|
||||
|
||||
public function getUtilizationTarget()
|
||||
{
|
||||
public function getUtilizationTarget() {
|
||||
return $this->utilizationTarget;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_AutoscalingPolicyCustomMetricUtilization extends Google_Model
|
||||
{
|
||||
class Google_Service_Autoscaler_AutoscalingPolicyCustomMetricUtilization extends Google_Model {
|
||||
public $metric;
|
||||
public $utilizationTarget;
|
||||
|
||||
public function setMetric($metric)
|
||||
{
|
||||
public function setMetric($metric) {
|
||||
$this->metric = $metric;
|
||||
}
|
||||
|
||||
public function getMetric()
|
||||
{
|
||||
public function getMetric() {
|
||||
return $this->metric;
|
||||
}
|
||||
|
||||
public function setUtilizationTarget($utilizationTarget)
|
||||
{
|
||||
public function setUtilizationTarget($utilizationTarget) {
|
||||
$this->utilizationTarget = $utilizationTarget;
|
||||
}
|
||||
|
||||
public function getUtilizationTarget()
|
||||
{
|
||||
public function getUtilizationTarget() {
|
||||
return $this->utilizationTarget;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_AutoscalingPolicyLoadBalancingUtilization extends Google_Model
|
||||
{
|
||||
class Google_Service_Autoscaler_AutoscalingPolicyLoadBalancingUtilization extends Google_Model {
|
||||
public $utilizationTarget;
|
||||
|
||||
public function setUtilizationTarget($utilizationTarget)
|
||||
{
|
||||
public function setUtilizationTarget($utilizationTarget) {
|
||||
$this->utilizationTarget = $utilizationTarget;
|
||||
}
|
||||
|
||||
public function getUtilizationTarget()
|
||||
{
|
||||
public function getUtilizationTarget() {
|
||||
return $this->utilizationTarget;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_Operation extends Google_Collection
|
||||
{
|
||||
class Google_Service_Autoscaler_Operation extends Google_Collection {
|
||||
public $clientOperationId;
|
||||
public $creationTimestamp;
|
||||
public $endTime;
|
||||
|
@ -735,282 +682,227 @@ class Google_Service_Autoscaler_Operation extends Google_Collection
|
|||
protected $warningsDataType = 'array';
|
||||
public $zone;
|
||||
|
||||
public function setClientOperationId($clientOperationId)
|
||||
{
|
||||
public function setClientOperationId($clientOperationId) {
|
||||
$this->clientOperationId = $clientOperationId;
|
||||
}
|
||||
|
||||
public function getClientOperationId()
|
||||
{
|
||||
public function getClientOperationId() {
|
||||
return $this->clientOperationId;
|
||||
}
|
||||
|
||||
public function setCreationTimestamp($creationTimestamp)
|
||||
{
|
||||
public function setCreationTimestamp($creationTimestamp) {
|
||||
$this->creationTimestamp = $creationTimestamp;
|
||||
}
|
||||
|
||||
public function getCreationTimestamp()
|
||||
{
|
||||
public function getCreationTimestamp() {
|
||||
return $this->creationTimestamp;
|
||||
}
|
||||
|
||||
public function setEndTime($endTime)
|
||||
{
|
||||
public function setEndTime($endTime) {
|
||||
$this->endTime = $endTime;
|
||||
}
|
||||
|
||||
public function getEndTime()
|
||||
{
|
||||
public function getEndTime() {
|
||||
return $this->endTime;
|
||||
}
|
||||
|
||||
public function setError(Google_Service_Autoscaler_OperationError $error)
|
||||
{
|
||||
public function setError(Google_Service_Autoscaler_OperationError $error) {
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
public function getError()
|
||||
{
|
||||
public function getError() {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
public function setHttpErrorMessage($httpErrorMessage)
|
||||
{
|
||||
public function setHttpErrorMessage($httpErrorMessage) {
|
||||
$this->httpErrorMessage = $httpErrorMessage;
|
||||
}
|
||||
|
||||
public function getHttpErrorMessage()
|
||||
{
|
||||
public function getHttpErrorMessage() {
|
||||
return $this->httpErrorMessage;
|
||||
}
|
||||
|
||||
public function setHttpErrorStatusCode($httpErrorStatusCode)
|
||||
{
|
||||
public function setHttpErrorStatusCode($httpErrorStatusCode) {
|
||||
$this->httpErrorStatusCode = $httpErrorStatusCode;
|
||||
}
|
||||
|
||||
public function getHttpErrorStatusCode()
|
||||
{
|
||||
public function getHttpErrorStatusCode() {
|
||||
return $this->httpErrorStatusCode;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setInsertTime($insertTime)
|
||||
{
|
||||
public function setInsertTime($insertTime) {
|
||||
$this->insertTime = $insertTime;
|
||||
}
|
||||
|
||||
public function getInsertTime()
|
||||
{
|
||||
public function getInsertTime() {
|
||||
return $this->insertTime;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setOperationType($operationType)
|
||||
{
|
||||
public function setOperationType($operationType) {
|
||||
$this->operationType = $operationType;
|
||||
}
|
||||
|
||||
public function getOperationType()
|
||||
{
|
||||
public function getOperationType() {
|
||||
return $this->operationType;
|
||||
}
|
||||
|
||||
public function setProgress($progress)
|
||||
{
|
||||
public function setProgress($progress) {
|
||||
$this->progress = $progress;
|
||||
}
|
||||
|
||||
public function getProgress()
|
||||
{
|
||||
public function getProgress() {
|
||||
return $this->progress;
|
||||
}
|
||||
|
||||
public function setRegion($region)
|
||||
{
|
||||
public function setRegion($region) {
|
||||
$this->region = $region;
|
||||
}
|
||||
|
||||
public function getRegion()
|
||||
{
|
||||
public function getRegion() {
|
||||
return $this->region;
|
||||
}
|
||||
|
||||
public function setSelfLink($selfLink)
|
||||
{
|
||||
public function setSelfLink($selfLink) {
|
||||
$this->selfLink = $selfLink;
|
||||
}
|
||||
|
||||
public function getSelfLink()
|
||||
{
|
||||
public function getSelfLink() {
|
||||
return $this->selfLink;
|
||||
}
|
||||
|
||||
public function setStartTime($startTime)
|
||||
{
|
||||
public function setStartTime($startTime) {
|
||||
$this->startTime = $startTime;
|
||||
}
|
||||
|
||||
public function getStartTime()
|
||||
{
|
||||
public function getStartTime() {
|
||||
return $this->startTime;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
public function setStatus($status) {
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
public function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatusMessage($statusMessage)
|
||||
{
|
||||
public function setStatusMessage($statusMessage) {
|
||||
$this->statusMessage = $statusMessage;
|
||||
}
|
||||
|
||||
public function getStatusMessage()
|
||||
{
|
||||
public function getStatusMessage() {
|
||||
return $this->statusMessage;
|
||||
}
|
||||
|
||||
public function setTargetId($targetId)
|
||||
{
|
||||
public function setTargetId($targetId) {
|
||||
$this->targetId = $targetId;
|
||||
}
|
||||
|
||||
public function getTargetId()
|
||||
{
|
||||
public function getTargetId() {
|
||||
return $this->targetId;
|
||||
}
|
||||
|
||||
public function setTargetLink($targetLink)
|
||||
{
|
||||
public function setTargetLink($targetLink) {
|
||||
$this->targetLink = $targetLink;
|
||||
}
|
||||
|
||||
public function getTargetLink()
|
||||
{
|
||||
public function getTargetLink() {
|
||||
return $this->targetLink;
|
||||
}
|
||||
|
||||
public function setUser($user)
|
||||
{
|
||||
public function setUser($user) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setWarnings($warnings)
|
||||
{
|
||||
public function setWarnings($warnings) {
|
||||
$this->warnings = $warnings;
|
||||
}
|
||||
|
||||
public function getWarnings()
|
||||
{
|
||||
public function getWarnings() {
|
||||
return $this->warnings;
|
||||
}
|
||||
|
||||
public function setZone($zone)
|
||||
{
|
||||
public function setZone($zone) {
|
||||
$this->zone = $zone;
|
||||
}
|
||||
|
||||
public function getZone()
|
||||
{
|
||||
public function getZone() {
|
||||
return $this->zone;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_OperationError extends Google_Collection
|
||||
{
|
||||
class Google_Service_Autoscaler_OperationError extends Google_Collection {
|
||||
protected $errorsType = 'Google_Service_Autoscaler_OperationErrorErrors';
|
||||
protected $errorsDataType = 'array';
|
||||
|
||||
public function setErrors($errors)
|
||||
{
|
||||
public function setErrors($errors) {
|
||||
$this->errors = $errors;
|
||||
}
|
||||
|
||||
public function getErrors()
|
||||
{
|
||||
public function getErrors() {
|
||||
return $this->errors;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_OperationErrorErrors extends Google_Model
|
||||
{
|
||||
class Google_Service_Autoscaler_OperationErrorErrors extends Google_Model {
|
||||
public $code;
|
||||
public $location;
|
||||
public $message;
|
||||
|
||||
public function setCode($code)
|
||||
{
|
||||
public function setCode($code) {
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
public function getCode()
|
||||
{
|
||||
public function getCode() {
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
public function setLocation($location)
|
||||
{
|
||||
public function setLocation($location) {
|
||||
$this->location = $location;
|
||||
}
|
||||
|
||||
public function getLocation()
|
||||
{
|
||||
public function getLocation() {
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function setMessage($message)
|
||||
{
|
||||
public function setMessage($message) {
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
public function getMessage()
|
||||
{
|
||||
public function getMessage() {
|
||||
return $this->message;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_OperationList extends Google_Collection
|
||||
{
|
||||
class Google_Service_Autoscaler_OperationList extends Google_Collection {
|
||||
public $id;
|
||||
protected $itemsType = 'Google_Service_Autoscaler_Operation';
|
||||
protected $itemsDataType = 'array';
|
||||
|
@ -1018,117 +910,95 @@ class Google_Service_Autoscaler_OperationList extends Google_Collection
|
|||
public $nextPageToken;
|
||||
public $selfLink;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setItems($items)
|
||||
{
|
||||
public function setItems($items) {
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
public function getItems() {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
public function setKind($kind) {
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
public function getKind() {
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setNextPageToken($nextPageToken)
|
||||
{
|
||||
public function setNextPageToken($nextPageToken) {
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
public function getNextPageToken() {
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
|
||||
public function setSelfLink($selfLink)
|
||||
{
|
||||
public function setSelfLink($selfLink) {
|
||||
$this->selfLink = $selfLink;
|
||||
}
|
||||
|
||||
public function getSelfLink()
|
||||
{
|
||||
public function getSelfLink() {
|
||||
return $this->selfLink;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_OperationWarnings extends Google_Collection
|
||||
{
|
||||
class Google_Service_Autoscaler_OperationWarnings extends Google_Collection {
|
||||
public $code;
|
||||
protected $dataType = 'Google_Service_Autoscaler_OperationWarningsData';
|
||||
protected $dataDataType = 'array';
|
||||
public $message;
|
||||
|
||||
public function setCode($code)
|
||||
{
|
||||
public function setCode($code) {
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
public function getCode()
|
||||
{
|
||||
public function getCode() {
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
public function setData($data)
|
||||
{
|
||||
public function setData($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setMessage($message)
|
||||
{
|
||||
public function setMessage($message) {
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
public function getMessage()
|
||||
{
|
||||
public function getMessage() {
|
||||
return $this->message;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Autoscaler_OperationWarningsData extends Google_Model
|
||||
{
|
||||
class Google_Service_Autoscaler_OperationWarningsData extends Google_Model {
|
||||
public $key;
|
||||
public $value;
|
||||
|
||||
public function setKey($key)
|
||||
{
|
||||
public function setKey($key) {
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
public function getKey()
|
||||
{
|
||||
public function getKey() {
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
public function setValue($value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue