Beispiel #1
0
 private function write()
 {
     if (!keys_exists(Vars::$post, 'title', 'url', 'comment')) {
         return $this->makeerrormessage_url('引数が足りません。');
     }
     $title = trim(Vars::$post['title']);
     $url = trim(Vars::$post['url']);
     $comment = trim(Vars::$post['comment']);
     if ($title == '') {
         $title = 'no title';
     }
     $page = Page::getinstance($this->pagename_prefix . '/' . date('Y-m-d'));
     $source[] = ':' . mb_ereg_replace(':', ':', $title) . ':' . $url;
     $source[] = mb_ereg_replace("[\r\n]+", "\n", $comment);
     $page->write($page->getsource() . "\n" . linetrim(join("\n", $source)));
     redirect($page);
 }
Beispiel #2
0
 function do_block($page, $param1, $param2)
 {
     $text = explode("\n", linetrim($param2));
     $p = explode(',', $param1);
     $num = isset($p[0]) && trim($p[0]) != '' ? trim($p[0]) : strlen(count($text));
     //桁数が指定なしの時は自動調整する
     $add = isset($p[2]) ? (int) trim($p[2]) : 1;
     //増分
     $start = isset($p[1]) ? (int) trim($p[1]) : $add;
     //初期値が指定なしの時は増分と同値
     //先頭に'0'がついている場合の書式設定
     $zero = $num[0] == 0 ? '0' : '';
     $_num = (int) $num;
     $format = "%{$zero}{$_num}d";
     for ($i = 0; $i < count($text); $i++) {
         $text[$i] = sprintf($format, $start + $add * $i) . ': ' . $text[$i];
     }
     return '<pre>' . htmlspecialchars(join("\n", $text)) . "</pre>\n";
 }
Beispiel #3
0
 public function __construct($mes = '', $hiddenmes = '', $dblink)
 {
     clearstatcache();
     if (is_writable(DATA_DIR) == false) {
         $mes = 'DATA_DIR is not writable. Please change DATA_DIR permission writable.' . $mes;
     } else {
         if (is_writable(DATA_DIR . WIKIID . '.db') == false) {
             $mes = 'Database file is not writable. Please change database permssion writable.' . $mes;
         }
     }
     $error_infos = $dblink->errorInfo();
     parent::__construct($mes, linetrim($hiddenmes . "\n") . "\n" . $error_infos[2]);
 }
Beispiel #4
0
 public function __construct($mes = '', $hiddenmes = '', $dblink)
 {
     clearstatcache();
     if (is_writable(DATA_DIR) == false) {
         $mes = 'DATA_DIRへの書き込み権限がありません。' . $mes;
     } else {
         if (is_writable(DATA_DIR . WIKIID . '.db') == false) {
             $mes = 'DBファイルへの書き込み権限がありません。' . $mes;
         }
     }
     parent::__construct($mes, linetrim($hiddenmes . "\n") . sqlite_error_string(sqlite_last_error($dblink)));
 }