</td>
        <td><?php 
echo getCell(1, 1);
?>
</td>
        <td><?php 
echo getCell(1, 2);
?>
</td>
      </tr>
      <tr>
        <td><?php 
echo getCell(2, 0);
?>
</td>
        <td><?php 
echo getCell(2, 1);
?>
</td>
        <td><?php 
echo getCell(2, 2);
?>
</td>
      </tr>
    </table>
  </form>
  <?php 
/*= debug($board); */
?>
  </body>
  </html>
Beispiel #2
0
    }
    return array('traversable' => true, 'tileset' => 'tree.jpg');
    throw new Exception('Cell not found: ' . $row . ':' . $column . ' in ' . print_r($cells, true));
}
$cells = $result->fetchAll();
echo "<div style = 'float:left;'><fieldset><legend>";
echo $quadrent . " quadrent";
echo "</legend><table class = \"map\">\n";
$location = explode(".", $user->getData('location'));
$row_loop = 1;
$column_loop = 1;
while ($row_loop <= 4 && $column_loop <= 4) {
    if ($column_loop == 1) {
        echo "<tr>\n";
    }
    $row_result = getCell($row_loop, $column_loop);
    // get cell contents
    // output cell
    if ($location[0] == $row_loop && $location[1] == $column_loop) {
        echo "\t<td class = map_box_here>\n";
    } else {
        if ($row_result['traversable'] == 'yes') {
            echo "\t<td class = 'map_box_traversable'>\n";
        } else {
            echo "\t<td class = 'map_box'>\n";
        }
    }
    if ($result->numRows() == 0) {
        if (inAdminMode()) {
            popup("no map data", "admin_modify_tileset.php?quadrent={$quadrent}&row={$row_loop}&column={$column_loop}");
        } else {
Beispiel #3
0
function sendInvitationMail($blogid, $userid, $name, $comment, $senderName, $senderEmail)
{
    $ctx = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    if (empty($blogid)) {
        $pool->reset('BlogSettings');
        $blogid = $pool->getCell('max(blogid)');
        // If no blogid, get the latest created blogid.
    }
    $email = User::getEmail($userid);
    $pool->reset('Users');
    $pool->setQualifier('userid', 'eq', $userid);
    $password = getCell('password');
    $authtoken = getAuthToken($userid);
    $blogName = getBlogName($blogid);
    if (empty($email)) {
        return 1;
    }
    if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
        return 2;
    }
    if (empty($name)) {
        $name = User::getName($userid);
    }
    if (strcmp($email, Utils_Unicode::lessenAsEncoding($email, 64)) != 0) {
        return 11;
    }
    //$loginid = POD::escapeString(Utils_Unicode::lessenAsEncoding($email, 64));
    $name = POD::escapeString(Utils_Unicode::lessenAsEncoding($name, 32));
    //$headers = 'From: ' . encodeMail($senderName) . '<' . $senderEmail . ">\n" . 'X-Mailer: ' . TEXTCUBE_NAME . "\n" . "MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n";
    if (empty($name)) {
        $subject = _textf('귀하를 %1님이 초대합니다', $senderName);
    } else {
        $subject = _textf('%1님을 %2님이 초대합니다', $name, $senderName);
    }
    $message = file_get_contents(ROOT . "/resources/style/letter/letter.html");
    $message = str_replace('[##_title_##]', _text('초대장'), $message);
    $message = str_replace('[##_content_##]', $comment, $message);
    $message = str_replace('[##_images_##]', $ctx->getProperty('uri.service') . "/resources/style/letter", $message);
    $message = str_replace('[##_link_##]', getInvitationLink(getBlogURL($blogName), $email, $password, $authtoken), $message);
    $message = str_replace('[##_go_blog_##]', getBlogURL($blogName), $message);
    $message = str_replace('[##_link_title_##]', _text('블로그 바로가기'), $message);
    if (empty($name)) {
        $message = str_replace('[##_to_##]', '', $message);
    } else {
        $message = str_replace('[##_to_##]', _text('받는 사람') . ': ' . $name, $message);
    }
    $message = str_replace('[##_sender_##]', _text('보내는 사람') . ': ' . $senderName, $message);
    $ret = sendEmail($senderName, $senderEmail, $name, $email, $subject, $message);
    if ($ret !== true) {
        return array(14, $ret[1]);
    }
    return true;
}
    global $db;
    // get info about cell
    $sql = 'SELECT * FROM `map` WHERE `quadrent` = :quadrant AND row = :row AND col = :col LIMIT 1';
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':quadrant', $quadrant);
    $stmt->bindValue(':row', $row);
    $stmt->bindValue(':col', $col);
    $stmt->execute();
    $cell = $stmt->fetchRow();
    if (empty($cell)) {
        return array('tileset' => null, 'traversable' => false, 'exit' => null, 'exit_quadrent' => null, 'newCell' => true);
    } else {
        return $cell;
    }
}
$cell = getCell($quadrent, $row, $col);
$tileset = $cell['tileset'];
$exit = $cell['exit'];
$exit_to = $cell['exit_quadrent'];
$traversable = $cell['traversable'];
if (isset($_REQUEST['submit'])) {
    if (isset($cell['newCell'])) {
        $sql = "INSERT INTO `map` (row, col, `quadrent`, `tileset`, `exit`, `exit_quadrent` ) VALUES (:row, :col, '{$quadrent}', '{$tileset}', '{$exit}', '{$exit_to}' )";
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':row', $row);
        $stmt->bindValue(':col', $col);
        $stmt->execute();
        die("done insert");
    } else {
        $sql = "UPDATE `map` SET `exit_quadrent` = '{$exit_to}', `exit` = '{$exit}', `tileset` = '" . $tileset . "', `traversable` = '" . $traversable . "' WHERE `quadrent` = '" . $quadrent . "' AND `row` = '" . $row . "' AND col = '" . $col . "' LIMIT 1";
        $result = $db->query($sql);