Пример #1
0
 function execute($requests)
 {
     $url = $requests['url'];
     require_once 'OpenPNE/RSS.php';
     if (!($rss_url = OpenPNE_RSS::auto_discovery($url))) {
         admin_client_redirect('list_c_cmd_caster', 'CMDキャストURLが無効です');
     }
     $result = db_admin_insert_c_cmd_caster($rss_url);
     if ($result) {
         admin_client_redirect('list_c_cmd_caster', 'CMDキャストURLを登録しました');
     } else {
         admin_client_redirect('list_c_cmd_caster', 'CMDキャストURLを登録できませんでした');
     }
 }
Пример #2
0
 function _get_rss_feed($portal_rss_id)
 {
     $data = db_portal_portal_rss($portal_rss_id);
     if (!$data || strlen(trim($data['url'])) == 0) {
         return "";
     }
     require_once 'OpenPNE/RSS.php';
     $parser = new OpenPNE_RSS();
     $result = @$parser->fetch($data['url'], true);
     if (!$result) {
         return array();
     }
     foreach ($result[1] as $key => $content) {
         $image_url = '';
         $enc_type = $content['enclosure']->type;
         if ($enc_type == 'image/jpeg' || $enc_type == 'image/png' || $enc_type == 'image/gif') {
             $image_url = $content['enclosure']->link;
         }
         $result[1][$key]['image_url'] = $image_url;
     }
     return $result;
 }
Пример #3
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $rss = $requests['rss'];
     $is_receive_daily_news = $requests['is_receive_daily_news'];
     $is_receive_mail = $requests['is_receive_mail'];
     $ashiato_mail_num = $requests['ashiato_mail_num'];
     $c_member_id_block = $requests['c_member_id_block'];
     $public_flag_diary = util_cast_public_flag_diary($requests['public_flag_diary']);
     $is_shinobiashi = $requests['is_shinobiashi'];
     $schedule_start_day = $requests['schedule_start_day'];
     $c_password_query_id = $requests['c_password_query_id'];
     $c_password_query_answer = $requests['c_password_query_answer'];
     // ----------
     $c_member = db_member_c_member4c_member_id($u);
     $error_messages = array();
     if (OPENPNE_AUTH_MODE == 'slavepne') {
         $c_password_query_id = 0;
         $c_password_query_answer = '';
     } else {
         if (IS_PASSWORD_QUERY_ANSWER) {
             if (!strlen($requests['c_password_query_answer'])) {
                 if (!$c_member['c_password_query_id']) {
                     $c_password_query_id = 0;
                 } else {
                     if ($c_password_query_id != $c_member['c_password_query_id']) {
                         $error_messages[] = '秘密の質問の答えを入力してください。';
                     }
                 }
             }
         }
     }
     if ($rss) {
         if (!preg_match('|^https?://|', $rss)) {
             $error_messages[] = 'BlogのURLを正しく入力してください';
         } else {
             include_once 'OpenPNE/RSS.php';
             if (!($rss_url = OpenPNE_RSS::auto_discovery($rss))) {
                 $error_messages[] = 'BlogのURLが無効です';
             }
         }
     }
     $filtered_id = db_member_filter_c_access_block_id($u, $c_member_id_block);
     foreach ($c_member_id_block as $each_id) {
         if (!in_array($each_id, $filtered_id)) {
             $error_messages[] = 'アクセスブロックに無効なメンバーIDが含まれています';
             break;
         }
     }
     // error
     if ($error_messages) {
         $_REQUEST['msg'] = array_shift($error_messages);
         openpne_forward('pc', 'page', 'h_config');
         exit;
     }
     if ($rss_url) {
         if ($rss_url != $c_member['rss']) {
             //異なるBlogを登録すると過去のrssは全て削除する
             db_rss_delete_rss_cache($u);
         }
         //c_rss_cacheへ登録
         db_rss_insert_rss_cache($rss_url, $u);
     } else {
         $rss_url = '';
         db_rss_delete_rss_cache($u);
     }
     //秘密の質問使用モード = true
     //または、設定画面表示時はtrueだったけど、設定変更ボタンを押す時にはfalse
     //になっていた場合、
     //秘密の質問は登録する
     db_member_h_config_3($u, $is_receive_mail, $rss_url, $ashiato_mail_num, $is_receive_daily_news, $c_password_query_id, $c_password_query_answer, $public_flag_diary, $is_shinobiashi, $schedule_start_day);
     db_member_insert_c_access_block($u, $c_member_id_block);
     // ランクアップメール設定
     if (!util_is_unused_mail('m_pc_rank_up')) {
         db_member_update_c_member_config($u, 'SEND_RANK_UP_MAIL_PC', $requests['SEND_RANK_UP_MAIL_PC']);
     }
     openpne_redirect('pc', 'page_h_home');
 }
Пример #4
0
function db_rss_insert_rss_cache($rss_url, $c_member_id)
{
    include_once 'OpenPNE/RSS.php';
    $rss = new OpenPNE_RSS();
    if (!($items = $rss->fetch($rss_url))) {
        return false;
    }
    foreach ($items as $item) {
        // 最新のものと比較
        if (!db_rss_is_duplicated_rss_cache($c_member_id, $item['date'], $item['link']) && !db_rss_is_future_rss_item($item['date'])) {
            if ($id = db_rss_is_updated_rss_cache($c_member_id, $item['link'])) {
                // update
                db_rss_update_c_rss_cache($id, $item['title'], $item['body'], $item['date'], $item['link']);
            } else {
                // insert
                db_rss_insert_c_rss_cache($c_member_id, $item['title'], $item['body'], $item['date'], $item['link']);
            }
        }
    }
}
Пример #5
0
function db_admin_update_c_cmd4c_cmd_caster_id($c_cmd_caster_id)
{
    $sql = 'SELECT url FROM c_cmd_caster WHERE c_cmd_caster_id = ?';
    $url = db_get_one($sql, array($c_cmd_caster_id));
    require_once 'OpenPNE/RSS.php';
    $rss = new OpenPNE_RSS();
    $items = $rss->fetch($url);
    $cmd_count = 0;
    $allowed_type = array('text/javascript', 'application/javascript');
    foreach ($items as $item) {
        $enclosure = $item['enclosure'];
        if (!in_array($enclosure->type, $allowed_type)) {
            continue;
        }
        $cmd_count++;
        $name = basename($enclosure->link, '.js');
        if ($c_cmd_id = db_admin_get_c_cmd_id4name_c_cmd_caster_id($name, $c_cmd_caster_id)) {
            if (!db_admin_is_updated_c_cmd($c_cmd_id, $item['date'])) {
                continue;
            }
            $data = array('url' => $enclosure->link, 'u_datetime' => $item['date']);
            $where = array('c_cmd_id' => $c_cmd_id);
            db_update('c_cmd', $data, $where);
        } else {
            $data = array('name' => $name, 'url' => $enclosure->link, 'permit' => 127, 'c_cmd_caster_id' => $c_cmd_caster_id, 'r_datetime' => $item['date'], 'u_datetime' => $item['date']);
            db_insert('c_cmd', $data);
        }
    }
    return $cmd_count;
}