private function contribution_actions(DownloadFile $downloadfile, $id)
 {
     if ($downloadfile->get_id() === null) {
         if ($this->is_contributor_member()) {
             $contribution = new Contribution();
             $contribution->set_id_in_module($id);
             $contribution->set_description(stripslashes($this->form->get_value('contribution_description')));
             $contribution->set_entitled($downloadfile->get_name());
             $contribution->set_fixing_url(DownloadUrlBuilder::edit($id)->relative());
             $contribution->set_poster_id(AppContext::get_current_user()->get_id());
             $contribution->set_module('download');
             $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(DownloadService::get_categories_manager()->get_heritated_authorizations($downloadfile->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT));
             ContributionService::save_contribution($contribution);
         }
     } else {
         $corresponding_contributions = ContributionService::find_by_criteria('download', $id);
         if (count($corresponding_contributions) > 0) {
             $downloadfile_contribution = $corresponding_contributions[0];
             $downloadfile_contribution->set_status(Event::EVENT_STATUS_PROCESSED);
             ContributionService::save_contribution($downloadfile_contribution);
         }
     }
     $downloadfile->set_id($id);
 }
Exemple #2
0
 function Del_alert_topic($id_alert)
 {
     PersistenceContext::get_querier()->delete(PREFIX . 'forum_alerts', 'WHERE id=:id', array('id' => $id_alert));
     //Si la contribution associée n'est pas réglée, on la règle
     $corresponding_contributions = ContributionService::find_by_criteria('forum', $id_alert, 'alert');
     if (count($corresponding_contributions) > 0) {
         $file_contribution = $corresponding_contributions[0];
         //We delete the contribution
         ContributionService::delete_contribution($file_contribution);
     }
     //Insertion de l'action dans l'historique.
     forum_history_collector(H_DEL_ALERT);
 }
Exemple #3
0
 function Del_alert_topic($id_alert)
 {
     global $Sql;
     $Sql->query_inject("DELETE FROM " . PREFIX . "forum_alerts WHERE id = '" . $id_alert . "'", __LINE__, __FILE__);
     import('events/contribution');
     import('events/contribution_service');
     $corresponding_contributions = ContributionService::find_by_criteria('forum', $id_alert, 'alert');
     if (count($corresponding_contributions) > 0) {
         $file_contribution = $corresponding_contributions[0];
         ContributionService::delete_contribution($file_contribution);
     }
     forum_history_collector(H_DEL_ALERT);
 }
Exemple #4
0
         }
     } elseif (($url_parsed = parse_url($media['url'])) && in_array($url_parsed['host'], $host_ok) && in_array('application/x-shockwave-flash', $mime_type)) {
         $media['mime_type'] = 'application/x-shockwave-flash';
     } else {
         $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $LANG['e_mime_unknow_media']);
         DispatchManager::redirect($controller);
     }
 } else {
     $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $LANG['e_link_empty_media']);
     DispatchManager::redirect($controller);
 }
 // Édition
 if ($media['idedit'] && MediaAuthorizationsService::check_authorizations($media['idcat'])->moderation()) {
     PersistenceContext::get_querier()->update(PREFIX . "media", array('idcat' => $media['idcat'], 'name' => $media['name'], 'url' => $media['url'], 'contents' => $media['contents'], 'infos' => MediaAuthorizationsService::check_authorizations($media['idcat'])->write() ? MEDIA_STATUS_APROBED : 0, 'width' => $media['width'], 'height' => $media['height']), 'WHERE id = :id', array('id' => $media['idedit']));
     if ($media['approved']) {
         $corresponding_contributions = ContributionService::find_by_criteria('media', $media['idedit']);
         if (count($corresponding_contributions) > 0) {
             $media_contribution = $corresponding_contributions[0];
             $media_contribution->set_status(Event::EVENT_STATUS_PROCESSED);
             ContributionService::save_contribution($media_contribution);
         }
     }
     // Feeds Regeneration
     Feed::clear_cache('media');
     AppContext::get_response()->redirect('media' . url('.php?id=' . $media['idedit']));
 } elseif (!$media['idedit'] && (($auth_write = MediaAuthorizationsService::check_authorizations($media['idcat'])->write()) || MediaAuthorizationsService::check_authorizations($media['idcat'])->contribution())) {
     $result = PersistenceContext::get_querier()->insert(PREFIX . "media", array('idcat' => $media['idcat'], 'iduser' => AppContext::get_current_user()->get_id(), 'timestamp' => time(), 'name' => $media['name'], 'contents' => FormatingHelper::strparse($media['contents']), 'url' => $media['url'], 'mime_type' => $media['mime_type'], 'infos' => MediaAuthorizationsService::check_authorizations($media['idcat'])->write() ? MEDIA_STATUS_APROBED : 0, 'width' => $media['width'], 'height' => $media['height']));
     $new_id_media = $result->get_last_inserted_id();
     // Feeds Regeneration
     Feed::clear_cache('media');
     if (!$auth_write) {
Exemple #5
0
         list($start_timestamp, $end_timestamp) = array(0, 0);
         break;
     default:
         list($visible, $start_timestamp, $end_timestamp) = array(0, 0, 0);
 }
 $file_properties = $Sql->query_array(PREFIX . "download", "visible", "approved", "WHERE id = '" . $edit_file_id . "'", __LINE__, __FILE__);
 import('util/url');
 $file_relative_url = new Url($file_url);
 $Sql->query_inject("UPDATE " . PREFIX . "download SET title = '" . $file_title . "', idcat = '" . $file_cat_id . "', url = '" . $file_relative_url->relative() . "', " . "size = '" . $file_size . "', count = '" . $file_hits . "', force_download = '" . ($file_download_method == 'force_download' ? DOWNLOAD_FORCE_DL : DOWNLOAD_REDIRECT) . "', contents = '" . strparse($file_contents) . "', short_contents = '" . strparse($file_short_contents) . "', " . "image = '" . $file_image . "', timestamp = '" . $file_creation_date->get_timestamp() . "', release_timestamp = '" . ($ignore_release_date ? 0 : $file_release_date->get_timestamp()) . "', " . "start = '" . $start_timestamp . "', end = '" . $end_timestamp . "', visible = '" . $visible . "', approved = " . (int) $file_approved . " " . "WHERE id = '" . $edit_file_id . "'", __LINE__, __FILE__);
 if ($file_cat_id != $file_infos['idcat'] || (int) $file_properties['visible'] != $visible || (int) $file_properties['approved'] != $file_approved) {
     $download_categories->Recount_sub_files();
 }
 if ($file_approved && !$file_properties['approved']) {
     import('events/contribution');
     import('events/contribution_service');
     $corresponding_contributions = ContributionService::find_by_criteria('download', $edit_file_id);
     if (count($corresponding_contributions) > 0) {
         $file_contribution = $corresponding_contributions[0];
         $file_contribution->set_status(EVENT_STATUS_PROCESSED);
         ContributionService::save_contribution($file_contribution);
     }
 }
 import('content/syndication/feed');
 Feed::clear_cache('download');
 if (!$visible || !$file_approved) {
     if (${$file_cat_id} > 0) {
         redirect(HOST . DIR . '/download/' . url('download.php?cat=' . $file_cat_id, 'category-' . $file_cat_id . '+' . url_encode_rewrite($DOWNLOAD_CATS[$file_cat_id]['name']) . '.php'));
     } else {
         redirect(HOST . DIR . '/download/' . url('download.php'));
     }
 } else {