예제 #1
0
파일: acp.php 프로젝트: Ssmur/appaddict.org
    die;
} elseif ($action == 'news') {
    $API->auth(array('manage_news' => 1));
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $to_news['title'] = htmlspecialchars($API->getval('title'));
        $to_news['text'] = $API->cleanhtml($API->getval('text'));
        if (!$id) {
            $to_news['added'] = $CONFIG['TIME'];
            $API->DB->query("INSERT INTO news " . $API->DB->build_insert_query($to_news));
            $newid = $API->DB->mysql_insert_id();
            $API->write_log("{$API->account['name']} created news with title {$to_news['title']}", 'admincp_news', $newid);
            $link = $API->SEO->make_link('news', 'id', $newid);
            $link = generate_short_link($link);
            send_push_safari("Hot news!", $to_news['title'], $link, '', 'news');
            send_push("Hot news: {$to_news['title']}", 1, json_encode(array('id' => $newid)), '', 0, 'news');
            send_twitter("RT Hot News: {$to_news['title']} " . $link);
        } else {
            $before = $API->DB->query_row("SELECT title,text FROM news WHERE id={$id}");
            if ($before != $to_news) {
                $API->write_log("{$API->account['name']} editen news with title {$to_news['title']}", 'admincp_news', $id);
            }
            $API->DB->query("UPDATE news SET " . $API->DB->build_update_query($to_news) . " WHERE id={$id}");
        }
        $API->CACHE->clearGroupCache('news');
        $API->TPL->assign('message', 'News successfully edited/added. You wil be redirected in 1 second.');
        $API->safe_redirect($API->SEO->make_link('acp', 'action', 'news'), 1);
        $API->TPL->display('message.tpl');
        die;
    }
    if ($id) {
        $news = $API->DB->query_row("SELECT * FROM news WHERE id={$id}");
예제 #2
0
     $to_links[] = array('link' => $magnet, 'uploader_id' => $API->account['id'], 'cracker' => $data['cracker'], 'added' => TIME, 'version' => $data['version'], 'state' => $API->account['upload_auto_moderate'] ? 'accepted' : 'pending', 'trackid' => $trackid);
 }
 if ($to_links) {
     foreach ($to_links as $l) {
         $API->DB->query("INSERT INTO links {$API->DB->build_insert_query($l)} ON DUPLICATE KEY UPDATE trackid={$trackid},state='pending',state_reason='Resubmission',editor_id={$API->account['id']}");
     }
     // update app added time if link accepted automatically
     if ($API->account['upload_auto_moderate']) {
         $linkscountversion = $API->DB->get_row_count("links", "WHERE trackid={$trackid} AND version={$API->DB->sqlesc($data['version'])} AND state='accepted'");
         // check need to update twitter or not
         $linkscountarchive = $API->DB->get_row_count("links", "WHERE trackid={$trackid} AND state='archived'");
         $appdata = $API->DB->query_row("SELECT * FROM apps WHERE trackid={$trackid}");
         if (!$linkscountversion) {
             send_twitter("New App/Book {$data['name']} only on AppAddict " . generate_short_link($API->SEO->make_link('view', 'trackid', $trackid)), 'updates');
         } elseif ($linkscountarchive) {
             send_twitter("App/Book {$data['name']} has been updated to {$data['version']} " . generate_short_link($API->SEO->make_link('view', 'trackid', $trackid)), 'updates');
             send_tracks($appdata);
         }
         $API->DB->query("UPDATE apps SET added=" . TIME . " WHERE trackid={$trackid}");
         $API->CACHE->clearGroupCache('lists_caches');
     }
 }
 $API->TPL->assign('message', $API->LANG->_('APP_UPLOADED_NOTICE'));
 if ($magnet) {
     //$torrent->save($torrentfname);
     $warning = $API->LANG->_('TORRENT_UPLOADED_NOTICE', $magnet);
 } else {
     $warning = '';
 }
 if ($live_used) {
     $warning .= $API->LANG->_('CONTENT_FROM_DB_NOTICE') . "<br/>";