[Customisation Database Commits] r845 - /trunk/titania/authors/create.php

Nathan Guse exreaction at phpbb.com
Tue Mar 23 16:58:54 GMT 2010


Author: exreaction
Date: Tue Mar 23 16:58:53 2010
New Revision: 845

Log:
Screenshots when creating a contribution

Modified:
    trunk/titania/authors/create.php

Modified: trunk/titania/authors/create.php
==============================================================================
*** trunk/titania/authors/create.php (original)
--- trunk/titania/authors/create.php Tue Mar 23 16:58:53 2010
***************
*** 34,39 ****
--- 34,46 ----
  titania::$contrib->author = new titania_author(phpbb::$user->data['user_id']);
  titania::$contrib->author->load();
  
+ // Set some main vars up
+ $submit = (isset($_POST['submit'])) ? true : false;
+ $contrib_categories = request_var('contrib_category', array(0));
+ $active_coauthors = $active_coauthors_list = utf8_normalize_nfc(request_var('active_coauthors', '', true));
+ $nonactive_coauthors = $nonactive_coauthors_list = utf8_normalize_nfc(request_var('nonactive_coauthors', '', true));
+ $error = array();
+ 
  // Load the message object
  $message = new titania_message(titania::$contrib);
  $message->set_auth(array(
***************
*** 46,58 ****
  	'subject_name'		=> 'name',
  ));
  
! $submit = (isset($_POST['submit'])) ? true : false;
! 
! $contrib_categories = request_var('contrib_category', array(0));
! $active_coauthors = $active_coauthors_list = utf8_normalize_nfc(request_var('active_coauthors', '', true));
! $nonactive_coauthors = $nonactive_coauthors_list = utf8_normalize_nfc(request_var('nonactive_coauthors', '', true));
  
! if (isset($_POST['preview']))
  {
  	titania::$contrib->post_data($message);
  	titania::$contrib->__set_array(array(
--- 53,65 ----
  	'subject_name'		=> 'name',
  ));
  
! // Screenshots
! $screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
! $screenshot->load_attachments();
! $screenshot->upload(TITANIA_ATTACH_EXT_SCREENSHOTS, 175);
! $error = array_merge($error, $screenshot->error);
  
! if ($screenshot->uploaded || isset($_POST['preview']) || $submit)
  {
  	titania::$contrib->post_data($message);
  	titania::$contrib->__set_array(array(
***************
*** 60,78 ****
  		'contrib_name_clean'	=> utf8_normalize_nfc(request_var('permalink', '', true)),
  		'contrib_visible'		=> 1,
  	));
  
  	$message->preview();
  }
  else if ($submit)
  {
! 	titania::$contrib->post_data($message);
! 	titania::$contrib->__set_array(array(
! 		'contrib_type'			=> request_var('contrib_type', 0),
! 		'contrib_name_clean'	=> utf8_normalize_nfc(request_var('permalink', '', true)),
! 		'contrib_visible'		=> 1,
! 	));
! 
! 	$error = titania::$contrib->validate($contrib_categories);
  
  	if (($validate_form_key = $message->validate_form_key()) !== false)
  	{
--- 67,81 ----
  		'contrib_name_clean'	=> utf8_normalize_nfc(request_var('permalink', '', true)),
  		'contrib_visible'		=> 1,
  	));
+ }
  
+ if (isset($_POST['preview']))
+ {
  	$message->preview();
  }
  else if ($submit)
  {
! 	$error = array_merge($error, titania::$contrib->validate($contrib_categories));
  
  	if (($validate_form_key = $message->validate_form_key()) !== false)
  	{
***************
*** 99,104 ****
--- 102,111 ----
  	{
  		titania::$contrib->submit();
  
+ 		// Submit screenshots
+ 		$screenshot->object_id = titania::$contrib->contrib_id;
+ 		$screenshot->submit();
+ 
  		titania::$contrib->set_coauthors($active_coauthors_list, $nonactive_coauthors_list, true);
  
  		// Create relations
***************
*** 118,123 ****
--- 125,131 ----
  	'S_POST_ACTION'			=> titania_url::build_url('author/' . phpbb::$user->data['username_clean'] . '/create'),
  	'S_CREATE'				=> true,
  
+ 	'SCREENSHOT_UPLOADER'	=> $screenshot->parse_uploader('posting/attachments/simple.html'),
  	'CONTRIB_PERMALINK'		=> utf8_normalize_nfc(request_var('permalink', '', true)),
  	'ERROR_MSG'				=> ($submit && sizeof($error)) ? implode('<br />', $error) : false,
  	'ACTIVE_COAUTHORS'		=> $active_coauthors,




More information about the customisationdb-commits mailing list