Пример #1
0
<?php

include dirname(__FILE__) . "/config.php";
include dirname(__FILE__) . "/notorm/NotORM.php";
$connection = new PDO("mysql:host={$config['host']};dbname={$config['name']};port={$config['port']}", $config['user'], $config['pass']);
$software = new NotORM($connection);
$questions = $software->questions();
?>
<html>
  <head>
    <title>
      لیست معماها
    </title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="publisher" href="https://plus.google.com/100862670780242731884"/>
    <link rel="alternate" type="application/rss+xml" title="RSS" href="http://iq.apps.rastasoft.ir/rss.php" />
    <link rel="index" title="Hafez" href="http://iq.apps.rastasoft.ir/list.php" />
    <link rel="alternate" href="http://iq.apps.rastasoft.ir" hreflang="fa-ir" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" >
    <!-- Bootstrap core CSS -->
    <link href="dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
Пример #2
0
<?php

include dirname(__FILE__) . "/config.php";
include dirname(__FILE__) . "/notorm/NotORM.php";
$connection = new PDO("mysql:host={$config['host']};dbname={$config['name']};port={$config['port']}", $config['user'], $config['pass']);
$software = new NotORM($connection);
$files = glob("files/*.t");
foreach ($files as $file) {
    $qid = pathinfo($file, PATHINFO_FILENAME);
    $title = file_get_contents($file);
    $software->questions()->insert_update(array("qid" => $qid), array("title" => $title));
}
$files = glob("files/*.q");
foreach ($files as $file) {
    $qid = pathinfo($file, PATHINFO_FILENAME);
    $question = markup_to_html(file_get_contents($file));
    $software->questions()->insert_update(array("qid" => $qid), array("question" => $question));
}
$files = glob("files/*.a");
foreach ($files as $file) {
    $qid = pathinfo($file, PATHINFO_FILENAME);
    $answer = markup_to_html(file_get_contents($file));
    $software->questions()->insert_update(array("qid" => $qid), array("answer" => $answer));
}
function markup_to_html($markup)
{
    if (preg_match_all('/\\[(.*):(.*)\\]/', $markup, $medias)) {
        foreach ($medias[0] as $index => $pattern) {
            switch ($medias[1][$index]) {
                case 'img':
                    $tag = "<img src=\"files/images/{$medias[2][$index]}\" />";
Пример #3
0
<?php

include dirname(__FILE__) . "/config.php";
include dirname(__FILE__) . "/notorm/NotORM.php";
$connection = new PDO("mysql:host={$config['host']};dbname={$config['name']};port={$config['port']}", $config['user'], $config['pass']);
$count = count(glob("files/*.q"));
$qid = isset($_GET['qid']) ? (int) $_GET['qid'] : 0;
if ($qid <= 0 || $qid > $count) {
    $qid = rand(1, $count);
}
$next = ($next = $qid + 1) <= $count ? $next : 1;
$prev = ($prev = $qid - 1) ? $prev : $count;
$software = new NotORM($connection);
$question = $software->questions("qid", $qid);
?>
<html>
  <head>
    <title>
      معما
      |
      <?php 
print strip_tags($question[0]['title']);
?>
    </title>
    <meta name="description" content="<?php 
print strip_tags($question[0]['question']);
?>
"/>
    <meta property="og:title" content="<?php 
print strip_tags($question[0]['title']);
?>