Example #1
0
/**
 * Returns the comments for the specified post.
 * @param integer $postId
 * @return array
 */
function getCommentsForPost($postId)
{
    $pdo = getPDO();
    $stmt = $pdo->prepare('SELECT id, name, text, created_at, website FROM comment WHERE post_id = :post_id');
    $stmt->execute(array('post_id' => $postId));
    return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
function testInit()
{
    $pdo = getPDO('test');
    $pdo->beginTransaction();
    $pdo->query('DELETE FROM CheckinLogs');
    $pdo->commit();
}
Example #3
0
function getPageByRoute($route) : array
{
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT title, content FROM pages WHERE route = :route");
    $stmt->bindParam(":route", $route);
    $stmt->execute();
    return $stmt->fetch();
}
function renderPage($route)
{
    $page = empty($route) ? 'home' : $route;
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT titulo, conteudo FROM Paginas WHERE rota = :route");
    $stmt->bindParam(":route", $route);
    $stmt->execute();
    $pagina = $stmt->fetch();
    require_once __DIR__ . "/Pages/{$page}.php";
}
Example #5
0
/**
 * Query all the ID of organisms.
 * @return Array
 */
function queryOgID()
{
    $pdo = getPDO();
    try {
        $sql = 'select organismid from reference';
        $ps = $pdo->prepare($sql);
        $ps->execute();
        $ps->setFetchMode(PDO::FETCH_ASSOC);
        $result = $ps->fetchAll();
    } catch (Exception $ex) {
        $error = 'An Error has occurred in data accessing.';
        exit;
    }
    return $result;
}
Example #6
0
<?php

session_start();
if (!isset($_SESSION["USERID"])) {
    header("Location: logout.php");
    exit;
}
// require_once(dirname(__file__) . '/functions.php');
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$threadSha = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($threadSha["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
updeateToDeleatFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_THREAD_DELEATE_FLAG"]);
updeateToDeleatFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_RES_DELEATE_FLAG"]);
$jsonData = json_encode($threadSha);
header("Content-Type: text/html; X-Content-Type-Options: nosniff; charset=utf-8");
echo $jsonData;
die;
Example #7
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
$queryList = getSQLQuery(getPDO());
$menuList = getMenuListForProcOrder(getPDO(), $queryList["SELECT_MENU_FOR_PROCORDER"]);
$menuData = getProced(getPDO(), $menuList);
$threadList = getThreadListUrl($menuData["menu_url"], getDiFix(getPDO(), "threadListUrlSuffix", $menuData["kind"], $queryList["SELECT_DIFIX"]));
var_dump($menuData);
var_dump(getUa(getPDO(), $queryList["SELECT_UA"]));
var_dump(getHost($menuData["menu_url"]));
$html = threadSteal(getPDO(), "133.130.96.221", "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
var_dump($html);
 static function setUpBeforeClass()
 {
     $pdo = self::$pdo = getPDO('test');
 }
Example #9
0
 /**
  * Deletes a user setting domain
  *
  * @param string $userId
  *           User ID
  * @param string $domain
  *           Specific domain of settings i.e. workspace or the settings for a
  *           specific module
  * @throws PDOException
  * @return array array of Properties objects
  */
 public function deleteUserSettingsForDomain($userId, $domain)
 {
     try {
         // Had NotORM issues with this, not sure why so just used PDO (mattg)
         $pdo = getPDO();
         $sql = "DELETE FROM user_settings WHERE `userId` = :userId AND `domain` = :domain";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':userId', $userId, PDO::PARAM_STR);
         $stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #10
0
            $resData = getResArray(getDiRegex(getPDO(), "resStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, $value["thread_sha"]);
            if (!$resData) {
                continue;
            }
            $ankaerLinkProced = resBodyAnkaerLinkProc($resData, getDiRegex(getPDO(), "resBodyAnkaerLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]));
            if ($menuData["kind"] === "open2ch.net") {
                $imgLinkProced = resBodyImgLinkProcO(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
            } else {
                $imgLinkProced = resBodyImgLinkProc(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
            }
            $censoredProced = censorShipForRes($imgLinkProced, $censorList);
            // $net_or_sc_kind = kindChecher($censoredProced[0]["res_id"]);
            $net_or_sc_kind = "null";
            $resDataArray = resDataReArray($censoredProced, $net_or_sc_kind, $menuData["kind"]);
            resInsert(getPDO(), $resDataArray, $menuData["kind"], $queryList["INSERT_RES"]);
            threadUpdateTonet_or_sc(getPDO(), $net_or_sc_kind, $value["thread_sha"], $queryList["UPDATE_THREAD_NET_OR_SC"]);
            $countOfResDataArray = count($resDataArray);
            //MAX RES number.
            threadUpdateToRes_end(getPDO(), $value["thread_sha"], $countOfResDataArray, $queryList["UPDATE_THREAD_RES_END"]);
            unset($isoldLog, $resData, $resDataArray, $censoredProced, $imgLinkProced, $ankaerLinkProced, $encodiedResBaseHtml, $resStealBool, $countOfResDataArray, $net_or_sc_kind);
            $i++;
        }
        unset($value, $threadData);
    }
}
memoryPeakUse("end");
timeTest("ProcEnd");
$proc_time = timeView();
procRecode(getPDO(), $menuData["id"], $menuData["menu_title"], $proc_time, $menuData["kind"], $tags["end"], $queryList["INSERT_PROC_RECODE"]);
procUnLocking(getPDO());
Example #11
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
// $encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/l50", $queryList["INSERT_IP_ACCESS"]);
// var_dump($encodiedResBaseHtml);
$encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/", $queryList["INSERT_IP_ACCESS"]);
// $encodiedResBaseHtml = file_get_contents("./imghtml.html");
$resData = getResArray(getDiRegex(getPDO(), "resStealRegex", "open2ch.net", $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, "000000000000000");
$data = resBodyImgLinkProc(getPDO(), $resData, $threadSha, $regexList["ExresBodyImgLinkStealRegex"], $queryList["SELECT_RES"], $fixedList["imgSavePath"], "open2ch.net");
var_dump($data);
// $html = file_get_contents("http://hayabusa.open2ch.net/test/read.cgi/livejupiter/1449141846/l50");
// $regexBase = "/<?[div\sclass=\"imgur]*>?<a.+><img.*data-original=\"(.+)\"\s.+>[<br.>]*<\/a><?[\/div\n]*>?/u";
// $regexImg = "/<img.+data-original=\"(.+)\"\s.+>/u";
// preg_match_all($regexBase, $html, $match, PREG_SET_ORDER);
// $splitArray = [];
//
// foreach ($match as $value) {
//     $splitArray[] = preg_replace("/<\/div>/", "</div>\n", $value);
// }
//
// $imgAllay = [];
// foreach ($splitArray as $value) {
//     preg_match_all($regexBase, $value[0], $imgUrl, PREG_SET_ORDER);
//     $imgAllay[] = $imgUrl;
// }
Example #12
0
}
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$request = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($request["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
$resData = getResData(getPDO(), $request["thread_sha"], $queryList["SELECT_RES"]);
$sortedResData = sortResByAnkaer($resData);
$threadData = getThreadDataBySha(getPDO(), $request["thread_sha"], $queryList["SELECT_THREAD_BY_THREADSHA"]);
$menuData = getMenuDefaultName(getPDO(), $threadData["menu_id"], $queryList["SELECT_MENU_FOR_MENUID"]);
$html = "";
$resSha = null;
$name = $menuData ? $menuData : "名無しさん";
$countOfSortedResData = count($sortedResData);
for ($k = 0; $k < $countOfSortedResData; $k++) {
    $resMasterID = $sortedResData[0]["res_id"];
    $resSha[] = $sortedResData[$k]["res_sha"];
    $html .= "<span class=\"{$sortedResData[$k]["thread_sha"]} {$sortedResData[$k]["res_sha"]} rename\">";
    $html .= "<span>{$sortedResData[$k]["res_no"]} : </span>";
    $html .= "<span><input type=\"text\" name={$sortedResData[$k]["res_sha"]} size=40 value=\"{$name}\"> : </span>";
    $html .= "<span>{$sortedResData[$k]["res_date"]}</span>";
    $html .= "<span>{$sortedResData[$k]["res_clock"]}</span>";
    if ($sortedResData[$k]["res_id"] === $resMasterID) {
        $html .= "<span class=\"resmaster\">{$sortedResData[$k]["res_id"]}</span>";
    } else {
Example #13
0
 public function popTopicEvents($userId, $topic)
 {
     try {
         $events = AppUtils::dbToArray($this->db->event_queue()->where("userId=? AND topic=?", $userId, $topic));
         $pdo = getPDO();
         $sql = "DELETE FROM event_queue WHERE `userId` = :userId AND `topic` = :topic";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':userId', $userId, PDO::PARAM_STR);
         $stmt->bindParam(':topic', $topic, PDO::PARAM_STR);
         $stmt->execute();
         return $events;
     } catch (PDOException $e) {
         throw $e;
     }
 }
Example #14
0
 /**
  * Delete a setting with specified domain name and setting key
  *
  * @param string $domain
  *           Domain name
  * @throws Exception
  */
 public function deleteAllDomain($domain)
 {
     try {
         $pdo = getPDO();
         $sql = "DELETE FROM system_setting WHERE `domain` = :domainId";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':domainId', $domain, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #15
0
<?php

session_start();
require 'config.php';
require 'password.php';
require 'functions/area.fn.php';
require 'functions/areaPriority.fn.php';
require 'functions/brand.fn.php';
require 'functions/database.fn.php';
require 'functions/priority.fn.php';
require 'functions/priorityTheme.fn.php';
require 'functions/theme.fn.php';
require 'functions/user.fn.php';
$db = getPDO($database);
Example #16
0
/**
 * Query all of data which belong to one gene cluster in ceg_base table.
 * @param type String $accessNum
 * @return Array
 */
function queryCegBaseByAccessNum($accessNum)
{
    $pdo = getPDO();
    try {
        $sql = "select * from ceg_base where access_num = :access_num";
        $ps = $pdo->prepare($sql);
        $ps->bindValue(":access_num", $accessNum);
        $ps->execute();
        $ps->setFetchMode(PDO::FETCH_ASSOC);
        $result = $ps->fetchAll();
    } catch (Exception $ex) {
        $error = "An Error has occurred in data accessing.";
        exit;
    }
    return $result;
}
Example #17
0
<?php

session_start();
if (!isset($_SESSION["USERID"])) {
    header("Location: logout.php");
    exit;
}
// require_once(dirname(__file__) . '/functions.php');
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$threadSha = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($threadSha["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
updeateToSuspendFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_THREAD_SUSPEND_FLAG"]);
$jsonData = json_encode($threadSha);
header("Content-Type: text/html; X-Content-Type-Options: nosniff; charset=utf-8");
echo $jsonData;
die;
 /**
  * Returns the forum posting overviews that are used on the overview
  * screen of the UI.
  * The key additions to the forum list in the
  * method is that there is an isMember flag added so that it can be
  * determined if
  * join requests links will be displayed. Also forums that do not have any
  * posts will not be returned depending on whether a LEFT JOIN is used.
  *
  * Summary is
  * Number of posts, posting day range, summary of most recent post.
  *
  * @throws PDOException
  * @return mixed The post summary object
  */
 public function getPostOverviews($userId)
 {
     // NOTE: If you want all the the forum not just the ones with posts
     // USE 'LEFT JOIN forum_post p' instead of 'JOIN forum_post p'
     $sql = "SELECT f.*, NOT(ISNULL(u.userId)) as isMember,\n      DATEDIFF(max(p.postDate),min(p.postDate))+1 AS numDays,\n      count(p.title) as numPosts\n      FROM forum f\n      LEFT JOIN forum_user u\n      ON (f.id = u.forumId AND u.userId = :userId)\n      JOIN forum_post p\n      ON (f.id = p.forumId)\n      GROUP BY f.id";
     try {
         $db = getPDO();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("userId", $userId);
         $stmt->execute();
         $forums = (array) $stmt->fetchAll(PDO::FETCH_ASSOC);
         //          $sql2 = "SELECT * FROM forum_post
         //                      WHERE forumId = :forumId
         //                      AND postDate = (SELECT MAX(fp2.postDate)
         //                      FROM forum_post fp2 WHERE fp2.forumId = :forumId2)";
         $sql2 = "SELECT * FROM forum_post\n                     WHERE forumId = :forumId\n                     ORDER BY postDate DESC";
         $stmt2 = $db->prepare($sql2);
         foreach ($forums as &$forum) {
             $isFirstPost = true;
             $forum['otherPosts'] = [];
             $stmt2->bindParam("forumId", $forum['id']);
             $stmt2->execute();
             $posts = (array) $stmt2->fetchAll(PDO::FETCH_ASSOC);
             foreach ($posts as &$post) {
                 $post['truncated'] = false;
                 if ($isFirstPost) {
                     $isFirstPost = false;
                     if (strlen($post['content']) > SELF::OVERVIEW_MAXLEN) {
                         $post['content'] = substr($post['content'], 0, SELF::OVERVIEW_MAXLEN);
                         $post['content'] = $post['content'] . ' .....';
                         $post['truncated'] = true;
                     }
                     $forum['mostRecentPost'] = $post;
                 } else {
                     unset($post['content']);
                     $forum['otherPosts'][] = $post;
                 }
             }
             /*
                         $recentSql = "SELECT * FROM forum_post
                                  WHERE forumId = :forumId
                                  AND postDate = (SELECT MAX(fp2.postDate)
                                  FROM forum_post fp2 WHERE fp2.forumId = :forumId2)";
                         
                         $stmt2 = $db->prepare($recentSql);
                         $stmt2->bindParam("forumId", $forums[$i]['id']);
                         $stmt2->bindParam("forumId2", $forums[$i]['id']);
                         $stmt2->execute();
                         $recent = (array) $stmt2->fetchAll(PDO::FETCH_ASSOC);
                         if (isset($recent) && count($recent) > 0)
                         {
                            $post = $recent[0];
                            $post['truncated'] = false;
                             
                            if (strlen($post['content']) > SELF::OVERVIEW_MAXLEN)
                            {
                               $post['content'] = substr($post['content'], 0, 
                                  SELF::OVERVIEW_MAXLEN);
                               $post['content'] = $post['content'] . ' .....';
                               $post['truncated'] = true;
                            }
                            // AppUtils::logDebug($post);
                            
                            $forums[$i]['mostRecentPost'] = $post;
                         }
             */
         }
         return $forums;
     } catch (PDOException $e) {
         throw $e;
     }
 }
Example #19
0
<?php

require "header.php";
require "navbar.php";
?>
<div class="container">
	<h1> Name consists of buildings: </h1>

		<?php 
require "./database.php";
$connection = getPDO();
$statement = $connection->prepare("SELECT * FROM buildings");
$statement->execute();
$datarow = array();
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
    $datarow[] = $row;
}
//echo "<pre>";
//print_r($datarow);
//echo "</pre>";
?>
<table class="table table-hover">
	
	<tr>
		<th>Name</th>
		<th>Height</th>
		<th>Color</th>
		<th> </th>	
	</tr>
	<?php 
foreach ($datarow as $element) {
Example #20
0
 /**
  * Returns rejected invitations for the specified user
  *
  * @param
  *           string userId
  *           User ID
  * @throws PDOException
  * @return array Array of object contatining all fields from forum_user,
  *         user_account, and forumName, updateFirstName, updateLastName
  */
 public function getRejections($userId)
 {
     $sql = "SELECT forum_user.*,forum.*\n               FROM forum_user, forum\n               WHERE enrollmentStatus = 'R'\n               AND forum_user.userId = :userId\n               AND forum_user.forumId = forum.id";
     try {
         $db = getPDO();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("userId", $userId);
         $stmt->execute();
         $rows = (array) $stmt->fetchAll(PDO::FETCH_NAMED);
         return $this->createEnrollmentObj($rows, false);
     } catch (PDOException $e) {
         throw $e;
     }
 }
Example #21
0
            }
        }
        $body = youtube($value["res_body"]);
    }
    $html .= "<dt class=\"reshandle\">" . "<span class=\"resno\">" . $value["res_no"] . "</span>" . "<span class=\"resname\">" . $menuDefaultName . "</span>" . "<span class=\"resdate\">" . $value["res_date"] . "</span>" . "<span class=\"resclock\">" . $value["res_clock"];
    if ($value["res_id"] === $resMasterID) {
        $html .= "</span>" . "<span class=\"resid resmasterid\">" . $value["res_id"] . "</span>" . "</dt>" . "<dd class=\"resbody resmasterbody\">" . $body . "</dd>";
    } else {
        $html .= "</span>" . "<span class=\"resid\">" . $value["res_id"] . "</span>" . "</dt>" . "<dd class=\"resbody\">" . $body . "</dd>";
    }
}
$html .= "</dl>";
$html .= "<span class=\"threadurldis\">元スレ</span>";
$html .= "<span class=\"threadurl\"><a href=\"{$threadData["thread_url"]}\">{$threadData["thread_title"]}({$threadData["kind"]})</a></span>";
if ($threadData["kind"] === "open2ch.net") {
    array_push($request["category"], 150);
} else {
    if ($threadData["net_or_sc"] === "net") {
        array_push($request["category"], 152);
    } else {
        array_push($request["category"], 151);
    }
}
$date = date("Y-m-d H:i:s", strtotime('+5 minute'));
$post = array('post_content' => $html, 'post_title' => $reTitle, 'post_status' => 'publish', 'post_date' => $date, 'comment_status' => 'future', 'post_category' => $request["category"]);
threadUpdateToArticled(getPDO(), $requestThreadSha, $queryList["UPDATE_THREAD_ARTICLED"]);
wp_insert_post($post);
$html = "<h1>{$reTitle}</h1>" . $html;
header("Content-Type: text/html; X-Content-Type-Options: nosniff; charset=utf-8");
echo $html;
die;
/**
 * Get number of songs in remote library to determine if it needs to be updated
 *
 * @return int Song count
 * @throws Exception PDO error
 */
function getRemoteSongCount() : int
{
    $pdo = getPDO();
    $st = $pdo->prepare("SELECT COUNT(*) FROM `library`");
    $st->execute();
    $results = $st->fetch();
    $st = null;
    $pdo = null;
    return $results['COUNT(*)'] >= 0 ? (int) $results['COUNT(*)'] : -1;
}
Example #23
0
<?php

$rootPass = dirname(__FILE__) . '/../../';
// $rootPass = dirname(__FILE__). '/../';
require_once $rootPass . 'lib/db/dbfunctions.php';
require_once $rootPass . 'lib/db/dbFacade.php';
$pdo = getPDO($argv[1]);
// $pdo = getPDO('test');
$dbfacade = DBFacade::I($pdo);
header("Content-Type: application/json; charset=utf-8");
echo json_encode($dbfacade->getAllLog());
<?php

session_start();
if (!isset($_SESSION["USERID"])) {
    header("Location: logout.php");
    exit;
}
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
// require_once(dirname(__file__) . '/functions.php');
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$requestData = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($requestData["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
$censoredResBody = resBodyCensorProc(getPDO(), $requestData["censor_word"], $requestData["be_censor"], $requestData["res_sha"], $queryList["SELECT_RES_BODY_FOR_MANUAL"]);
resBodyManualCensorUpdert(getPDO(), $censoredResBody, $requestData["res_sha"], $queryList["UPDATE_RES_BODY_FOR_MANUAL"]);
if ((int) $requestData["is_insert"] === 1) {
    insertCensorWord(getPDO(), $requestData["censor_word"], $requestData["be_censor"], $queryList["INSERT_CENSOR"]);
}
$jsonData = json_encode($censoredResBody);
header("Content-Type: application/json; X-Content-Type-Options: nosniff; charset=utf-8");
echo $jsonData;
unset($html);
die;
Example #25
0
echo "}";
?>
</script>
</head>
<body>
<div><?php 
echo "保留";
?>
</div>
<div id="thread">
<?php 
$countThreadData = count($threadData);
foreach ($threadData as $item) {
    static $j = 1;
    //As res number.
    $resData = getResData(getPDO(), $item["thread_sha"], $queryList["SELECT_RES"]);
    $endResDate = array_pop($resData);
    echo "<div class=\"{$item["thread_sha"]} threadDiv\">";
    $kind = "{$item["kind"]} {$item["net_or_sc"]}";
    $item["is_img"] ? $isimg = "【画像あり】" : ($isimg = "");
    echo "<span class=\"kind\">{$kind} </span>";
    echo "<span class=\"threadTitle {$item["thread_sha"]}\">" . "<span>{$j} : </span><span><font style=\"font-weight:900;color:#999933;\">{$isimg}</font></span><font style=\"font-weight:900;color:#339933;\">{$item["thread_title"]}</font>" . "(" . $item["thread_now_res_no"] . ")";
    echo "</span><br>";
    echo "<span class=\"{$item["thread_sha"]} endres\">";
    $item["is_oldlog"] ? $oldlog = "【過去ログ入り】" : ($oldlog = "");
    $item["datetime"] ? $date = " 取得日時 " . $item["datetime"] : ($date = "");
    $endResDate["res_date"] ? $endDate = $endResDate["res_date"] : ($endDate = "");
    $endResDate["res_clock"] ? $endClock = $endResDate["res_clock"] : ($endClock = "");
    echo "<font style=\"font-weight:900;color:#ff3333;\">{$oldlog}</font>";
    echo "<font style=\"font-weight:900;color:#dd3366;\"> 最終レス更新 {$endDate}{$endClock}</font>";
    echo "<font style=\"font-weight:900;color:#333366;\">{$date}</font>";
Example #26
0
 /**
  * purge any sessions left around by users who had no activity
  * and did not log out.
  */
 public static function purgeExpiredSessions()
 {
     try {
         $pdo = getPDO();
         $sql = "DELETE FROM session_data WHERE UNIX_TIMESTAMP() > session_expire";
         $stmt = $pdo->prepare($sql);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
    }
}
// handle the post operation here
$errors = array();
if ($_POST) {
    // Validate these first
    $title = $_POST['post-title'];
    if (!$title) {
        $errors[] = 'The post must have a title';
    }
    $body = $_POST['post-body'];
    if (!$body) {
        $errors[] = 'The post must have a body';
    }
    if (!$errors) {
        $pdo = getPDO();
        // Decide if we are editing or adding
        if ($postId) {
            editPost($pdo, $title, $body, $postId);
        } else {
            $userId = getAuthUserId($pdo);
            $postId = addPost($pdo, $title, $body, $userId);
            if ($postId === false) {
                $errors[] = 'Post operation failed';
            }
        }
    }
    if (!$errors) {
        redirectAndExit('edit-post.php?post_id=' . $postId);
    }
}
Example #28
0
<?php

session_start();
date_default_timezone_set('Asia/Tokyo');
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
// require_once(dirname(__file__) . '/functions.php');
$logingData = getLoggingData(getPDO());
if (isset($_POST["login"])) {
    $passSha = sha1($_POST["password"]);
    if ($logingData["user"] === $_POST["user"] && sha1($_POST["password"]) === $logingData["password"]) {
        session_regenerate_id(true);
        $_SESSION["USERID"] = sha1($logingData["user"] . $logingData["password"]);
        header("Location: menu.php");
        exit;
    }
}
?>

<!doctype html>
<html>
  <head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width">
  <title>銀河英雄伝説</title>
  </head>
  <body>
  <form id="loginForm" name="loginForm" action="" method="POST">
  <fieldset>
  <input type="text" id="user" name="user" value="">
  <br>
  <input type="password" id="password" name="password" value="">
Example #29
0
<?php

$rootPass = dirname(__FILE__) . '/../../';
require_once $rootPass . 'lib/db/dbfunctions.php';
require_once $rootPass . 'lib/db/Model/User.php';
require_once $rootPass . 'lib/db/Mapper/UserMapper.php';
$pdo = getPDO($argv[2]);
$umapper = new UserMapper($pdo);
$user = $umapper->findByName($argv[1]);
$userArray = (array) $user;
foreach ($userArray as $value) {
    // オブジェクトのネストを解消(だいぶ汚いので後で直す)
    $userArray = $value;
    break;
}
header("Content-Type: application/json; charset=utf-8");
echo json_encode((array) $userArray);
// echo json_encode($result);
<?php

$rootPass = dirname(__FILE__) . '/../../';
require_once $rootPass . 'lib/db/dbfunctions.php';
require_once $rootPass . 'lib/db/Mapper/LOCALogMapper.php';
require_once $rootPass . 'lib/db/Model/LOCALog.php';
// $pdo = getPDO('test');
$pdo = getPDO($argv[4]);
$lmapper = new LOCALogMapper($pdo);
// $dbfacade = DBFacade::I($pdo);
$result = $lmapper->findAllOfMonth((int) $argv[1], (int) $argv[2], $argv[3]);
header("Content-Type: application/json; charset=utf-8");
echo json_encode($result);