示例#1
0
文件: news.php 项目: 4otaku/4otaku
 protected function area($data)
 {
     $this->writer->set_redirect();
     if (empty($data['sure'])) {
         $this->writer->set_message('Галочку ставить не забываем, она тут для защиты от случайных кликов.');
         return;
     }
     // TODO: перемести input__common::transfer в Model_Common
     input__common::transfer(array('sure' => 1, 'do' => array('news', 'transfer'), 'where' => $data['area'], 'id' => $this->model->get_id()));
 }
示例#2
0
文件: order.php 项目: 4otaku/4otaku
	function action($action,$id) {
		if ($id) {
			if ($action == 'prolong') {
				$data = obj::db()->sql('select email,spam from orders where id='.$id,1);
				$action = new input__common();
				if ($data['spam']) $action->set_events($id,$data['email']);
				else $action->set_events($id);
				$this->add_res('Заказ успешно продлен');
			}
			elseif ($action == 'unsubscribe') {
				obj::db()->update('orders','spam',0,$id);
				obj::db()->sql('delete from misc where (type="mail_notify" and data5="'.$id.'")',0);
				$this->add_res('Вы отписались от уведомлений по заказу <a href="/order/'.$id.'/">http://4otaku.org/order/'.$id.'/</a>');
			}
		}
		else {
			$this->add_res('Ошибка, неправильный URL', true);
		}
	}
示例#3
0
文件: post.php 项目: 4otaku/4otaku
 public function main()
 {
     $post = $this->correct_main_data($this->reader->get_data());
     if (!$post['title'] || !$post['link'] && !$post['torrent']) {
         $this->writer->set_message('Не все обязательные поля заполнены.')->set_error(Error_Create::MISSING_INPUT);
         return;
     }
     if ($post['author'] != def::user('name') && $post['author']) {
         $cookie = new dynamic__cookie();
         $cookie->inner_set('user.name', $post['author']);
     }
     $worker = new Transform_Meta();
     $parsed_tags = $worker->parse_array($post['tag']);
     $tags = $worker->add_tags($parsed_tags);
     $category = $worker->category($post['category']);
     $language = $worker->language($post['language']);
     $parsed_author = $worker->parse($post['author'], def::user('author'));
     $author = $worker->author($parsed_author);
     $text = Transform_Text::format($post['text']);
     $links = Transform_Link::parse($post['link']);
     $extras = Transform_Link::parse($post['bonus_link']);
     $images = $post['image'];
     $torrents = $post['torrent'];
     $files = $post['file'];
     $item = new Model_Post();
     $item->set_array(array('title' => $post['title'], 'text' => $text, 'pretty_text' => undo_safety($post['text']), 'author' => $author, 'category' => $category, 'language' => $language, 'tag' => $tags));
     foreach ($images as $image) {
         $image = explode('.', $image);
         $image = new Model_Post_Image(array('file' => $image[0], 'extension' => $image[1]));
         $item->add_image($image);
     }
     foreach ($links as $link) {
         $link = new Model_Post_Link($link);
         $item->add_link($link);
     }
     foreach ($torrents as $torrent) {
         $torrent = new Model_Post_Torrent($torrent);
         $item->add_torrent($torrent);
     }
     foreach ($extras as $extra) {
         $extra = new Model_Post_Extra($extra);
         $item->add_extra($extra);
     }
     foreach ($files as $file) {
         $file = new Model_Post_File($file);
         $item->add_file($file);
     }
     $item->insert();
     // TODO: перемести input__common::transfer в Model_Common
     if (!empty($post['transfer_to'])) {
         input__common::transfer(array('sure' => 1, 'do' => array('post', 'transfer'), 'where' => $post['transfer_to'], 'id' => $item->get_id()));
     }
     $this->writer->set_success()->set_message('Ваша запись успешно добавлена, и доступна по адресу ' . '<a href="/post/' . $item->get_id() . '/">http://4otaku.org/post/' . $item->get_id() . '/</a> или в ' . '<a href="/post/' . def::area(1) . '/">мастерской</a>.')->set_param('id', $item->get_id());
 }
示例#4
0
文件: art.php 项目: 4otaku/4otaku
 public function main()
 {
     $post = $this->correct_main_data($this->reader->get_data());
     if (!is_array($post['images'])) {
         $this->writer->set_message('Не все обязательные поля заполнены.')->set_error(Error_Create::MISSING_INPUT);
         return;
     }
     if (query::$url[2] == 'pool' && is_numeric(query::$url[3])) {
         $pool = new Model_Art_Pool(query::$url[3]);
         if (!$pool->correct_password($post['password'])) {
             $this->writer->set_message('Неправильный пароль от группы.')->set_error(Error_Create::INCORRECT_INPUT);
             return;
         }
     } else {
         $pool = false;
     }
     $worker = new Transform_Meta();
     $parsed_tags = $worker->parse_array($post['tag']);
     $tags = $worker->add_tags($parsed_tags);
     $category = $worker->category($post['category']);
     $parsed_author = $worker->parse($post['author'], def::user('author'));
     $author = $worker->author($parsed_author);
     $similar = $this->check_similar($post['images']);
     foreach ($post['images'] as $image_key => $image) {
         if (empty($image['tags'])) {
             $local_tags = $tags;
         } else {
             $parsed_tags = $worker->parse_array($image['tags']);
             $local_tags = $worker->add_tags($parsed_tags);
         }
         $art = new Model_Art();
         $art->set_array(array('md5' => $image['md5'], 'thumb' => $image['thumb'], 'extension' => $image['extension'], 'resized' => $image['resized'], 'animated' => (int) $image['animated'], 'author' => $author, 'category' => $category, 'tag' => $local_tags, 'source' => $post['source']));
         $art->insert();
         if (!empty($similar[$image_key])) {
             foreach ($similar[$image_key] as $item) {
                 $art->add_similar($item);
             }
         }
         if (!empty($pool)) {
             $pool->add_art($art);
         }
         // TODO: перемести input__common::transfer в Model_Common
         if (!empty($post['transfer_to'])) {
             input__common::transfer(array('sure' => 1, 'do' => array('art', 'transfer'), 'where' => $post['transfer_to'], 'id' => $art->get_id()));
         }
     }
     $this->writer->set_success();
     if (count($post['images']) > 1) {
         $this->writer->set_message('Ваши изображения успешно добавлены, и доступны в ' . '<a href="/art/' . def::area(1) . '/">очереди на премодерацию</a>.');
     } else {
         $this->writer->set_message('Ваше изображение успешно добавлено, и доступно по адресу ' . '<a href="/art/' . $art->get_id() . '/">http://4otaku.org/art/' . $art->get_id() . '/</a> или в ' . '<a href="/art/' . def::area(1) . '/">очереди на премодерацию</a>.')->set_param('id', $art->get_id());
     }
 }
示例#5
0
文件: video.php 项目: 4otaku/4otaku
 public function main()
 {
     $post = $this->correct_main_data($this->reader->get_data());
     if (!$post['title']) {
         $this->writer->set_message('Вы забыли указать заголовок для видео.')->set_error(Error_Create::MISSING_INPUT);
         return;
     }
     if (!$post['link']) {
         $this->writer->set_message('Вы не предоставили ссылки, или же ссылка почему-то битая.')->set_error(Error_Create::MISSING_INPUT);
         return;
     }
     $test = new Transform_Video($post['link']);
     if (!$test->enable_nico()->get_html()) {
         $this->writer->set_message('Ссылка не ведет на видео, либо этот видеохостинг не поддерживается')->set_error(Error_Create::INCORRECT_INPUT);
         return;
     }
     $already_have = Database::get_field('video', 'id', 'link = ?', $post['link']);
     if ($already_have) {
         $error = 'Это видео уже у нас есть, оно находится по адресу <a href="/video/' . $already_have . '/">http://4otaku.org/video/' . $already_have . '/</a>.';
         $this->writer->set_message($error)->set_error(Error_Create::ALREADY_EXISTS);
         return;
     }
     if ($post['author'] != def::user('name') && $post['author']) {
         $cookie = new dynamic__cookie();
         $cookie->inner_set('user.name', $post['author']);
     }
     $worker = new Transform_Meta();
     $parsed_tags = $worker->parse_array($post['tag']);
     $tags = $worker->add_tags($parsed_tags);
     $category = $worker->category($post['category']);
     $parsed_author = $worker->parse($post['author'], def::user('author'));
     $author = $worker->author($parsed_author);
     $text = Transform_Text::format($post['text']);
     $item = new Model_Video();
     $item->set_array(array('title' => $post['title'], 'link' => $post['link'], 'text' => $text, 'pretty_text' => undo_safety($post['text']), 'author' => $author, 'category' => $category, 'tag' => $tags));
     $item->insert();
     // TODO: перемести input__common::transfer в Model_Common
     if (!empty($post['transfer_to'])) {
         input__common::transfer(array('sure' => 1, 'do' => array('video', 'transfer'), 'where' => $post['transfer_to'], 'id' => $item->get_id()));
     }
     $this->writer->set_success()->set_message('Ваша видео успешно добавлено, и доступно по адресу ' . '<a href="/video/' . $item->get_id() . '/">http://4otaku.org/video/' . $item->get_id() . '/</a> или в ' . '<a href="/video/' . def::area(1) . '/">очереди на премодерацию</a>.')->set_param('id', $item->get_id());
 }
示例#6
0
    if (!is_array($data)) {
        unset($all_tags[$tag]);
    } else {
        foreach ($data as $art) {
            @($arts[$art][] = $tag);
        }
    }
}
foreach ($arts as $art => $tags) {
    ?>
		<a href="/art/<?php 
    echo $art;
    ?>
">Арт №<?php 
    echo $art;
    ?>
</a>, теги
		 <?php 
    echo implode(', ', $tags);
    ?>
 <br />
	<?php 
    if (query::$get['fix'] == 1) {
        query::$post['id'] = $art;
        query::$post['type'] = 'art';
        query::$post['tags'] = urldecode(str_replace('|', ' ', $db_arts[$art]));
        $check = new Check();
        $worker = new input__common();
        $worker->edit_tag();
    }
}
示例#7
0
文件: art.php 项目: 4otaku/4otaku
	function transfer($area,$id) {
		global $add_res;

		Check::rights();

		query::$post = array('id' => $id, 'sure' => 1, 'do' => array('art','transfer'), 'where' => $area);
		include_once('libs/input/common.php');
		$result = input__common::transfer(query::$post, false);
		if (!empty($result)) {
			$add_res['meta_error'] = $result;
		}
	}