Ejemplo n.º 1
0
function add_ajax_attachment_xml(&$xml, $contenttypeid, $posthash, $poststarttime, $values)
{
    global $vbulletin, $vbphrase;
    require_once DIR . '/includes/functions_file.php';
    $xml->add_tag('contenttypeid', $contenttypeid);
    $xml->add_tag('auth_type', (empty($_SERVER['AUTH_USER']) and empty($_SERVER['REMOTE_USER'])) ? 0 : 1);
    $xml->add_tag('asset_enable', $vbulletin->userinfo['vbasset_enable'] ? $vbulletin->options['vbasset_enable'] : 0);
    $xml->add_tag('userid', $vbulletin->userinfo['userid']);
    $xml->add_tag('max_file_size', fetch_max_upload_size());
    $xml->add_tag('attachlimit', $vbulletin->options['attachlimit']);
    $xml->add_tag('posthash', $posthash);
    $xml->add_tag('poststarttime', $poststarttime);
    if (!empty($values)) {
        $xml->add_group('values');
        foreach ($values as $key => $value) {
            $xml->add_tag($key, $value);
        }
        $xml->close_group('values');
    }
    $xml->add_group('phrases');
    $xml->add_tag('upload_failed', $vbphrase['upload_failed']);
    $xml->add_tag('file_is_too_large', $vbphrase['file_is_too_large']);
    $xml->add_tag('invalid_file', $vbphrase['invalid_file']);
    $xml->add_tag('maximum_number_of_attachments_reached', $vbphrase['maximum_number_of_attachments_reached']);
    $xml->add_tag('unable_to_parse_attachmentid_from_image', $vbphrase['unable_to_parse_attachmentid_from_image']);
    $xml->add_tag('saving_of_settings_failed', $vbphrase['saving_of_settings_failed']);
    $xml->close_group('phrases');
}
Ejemplo n.º 2
0
function fetch_attachmentinfo($posthash, $poststarttime, $contenttypeid, $values = array())
{
	global $vbulletin;

	return array(
		'auth_type'     => (
												empty($_SERVER['AUTH_USER'])
													AND
												empty($_SERVER['REMOTE_USER'])
											) ? 0 : 1,

		'asset_enable'  => ($vbulletin->userinfo['vbasset_enable'] ? $vbulletin->options['vbasset_enable'] : 0),

		'posthash'      => $posthash,
		'poststarttime' => $poststarttime,
		'userid'        => $vbulletin->userinfo['userid'],
		'contenttypeid' => $contenttypeid,
		'max_file_size' => fetch_max_upload_size(),
		'values'        => $values,
	);

}
Ejemplo n.º 3
0
     $remainingcolumns = 0;
     $remaining = sizeof($bits);
     if ($remaining) {
         $remainingcolumns = $cols - $remaining;
         $avatarcells = implode('', $bits);
         eval('$avatarlist .= "' . fetch_template('help_avatars_row') . '";');
         exec_switch_bg();
     }
     $show['forumavatars'] = true;
 } else {
     $show['forumavatars'] = false;
 }
 // end code for predefined avatars
 // ############### DISPLAY CUSTOM AVATAR CONTROLS ###############
 require_once DIR . '/includes/functions_file.php';
 $inimaxattach = fetch_max_upload_size();
 if ($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar']) {
     $show['customavatar'] = true;
     $show['customavatar_url'] = (ini_get('allow_url_fopen') != 0 or function_exists('curl_init'));
     $permissions['avatarmaxsize'] = vb_number_format($permissions['avatarmaxsize'], 1, true);
     $maxnote = '';
     if ($permissions['avatarmaxsize'] and ($permissions['avatarmaxwidth'] or $permissions['avatarmaxheight'])) {
         $maxnote = construct_phrase($vbphrase['note_maximum_size_x_y_or_z'], $permissions['avatarmaxwidth'], $permissions['avatarmaxheight'], $permissions['avatarmaxsize']);
     } else {
         if ($permissions['avatarmaxsize']) {
             $maxnote = construct_phrase($vbphrase['note_maximum_size_x'], $permissions['avatarmaxsize']);
         } else {
             if ($permissions['avatarmaxwidth'] or $permissions['avatarmaxheight']) {
                 $maxnote = construct_phrase($vbphrase['note_maximum_size_x_y_pixels'], $permissions['avatarmaxwidth'], $permissions['avatarmaxheight']);
             }
         }
Ejemplo n.º 4
0
if (empty($_REQUEST['do'])) {
    $_REQUEST['do'] = 'list';
}
// ###################### Start upload test #######################
if ($_POST['do'] == 'doupload') {
    // additional checks should be added with testing on other OS's (Windows doesn't handle safe_mode the same as Linux).
    $vbulletin->input->clean_array_gpc('f', array('attachfile' => TYPE_FILE));
    print_form_header('', '');
    print_table_header($vbphrase['pertinent_php_settings']);
    $file_uploads = ini_get('file_uploads');
    print_label_row('file_uploads:', $file_uploads == 1 ? $vbphrase['on'] : $vbphrase['off']);
    print_label_row('open_basedir:', iif($open_basedir = ini_get('open_basedir'), $open_basedir, '<i>' . $vbphrase['none'] . '</i>'));
    print_label_row('safe_mode:', SAFEMODE ? $vbphrase['on'] : $vbphrase['off']);
    print_label_row('upload_tmp_dir:', iif($upload_tmp_dir = ini_get('upload_tmp_dir'), $upload_tmp_dir, '<i>' . $vbphrase['none'] . '</i>'));
    require_once DIR . '/includes/functions_file.php';
    print_label_row('upload_max_filesize:', vb_number_format(fetch_max_upload_size(), 1, true));
    print_table_footer();
    if ($vbulletin->superglobal_size['_FILES'] == 0) {
        if ($file_uploads === 0) {
            // don't match NULL
            print_diagnostic_test_result(0, $vbphrase['file_upload_setting_off']);
        } else {
            print_diagnostic_test_result(0, $vbphrase['unknown_error']);
        }
    }
    if (empty($vbulletin->GPC['attachfile']['tmp_name'])) {
        print_diagnostic_test_result(0, construct_phrase($vbphrase['no_file_uploaded_and_no_local_file_found'], $vbphrase['test_cannot_continue']));
    }
    if (!is_uploaded_file($vbulletin->GPC['attachfile']['tmp_name'])) {
        print_diagnostic_test_result(0, construct_phrase($vbphrase['unable_to_find_attached_file'], $vbulletin->GPC['attachfile']['tmp_name'], $vbphrase['test_cannot_continue']));
    }
Ejemplo n.º 5
0
 $startasset = $totalassets ? $start + 1 : 0;
 $endasset = $start + $perpage > $totalassets ? $totalassets : $start + $perpage;
 $totalpages = ceil($totalassets / $perpage);
 $xml->add_tag('totalassets', $totalassets);
 $xml->add_tag('startasset', $startasset);
 $xml->add_tag('endasset', $endasset);
 $xml->add_tag('pagenumber', $_pagenumber);
 $xml->add_tag('totalpages', $totalpages);
 $xml->add_tag('currentpage', construct_phrase($vbphrase['page_x_of_y'], $_pagenumber, $totalpages));
 $xml->add_tag('pagestats', construct_phrase($vbphrase['assets_x_to_y_of_z'], $startasset, $endasset, $totalassets));
 // Defaults used by program init
 if ($vbulletin->GPC['categoryid'] == 0 and $vbulletin->GPC['init']) {
     $xml->add_tag('attachboxcount', $vbulletin->options['attachboxcount']);
     $xml->add_tag('attachurlcount', $vbulletin->options['attachurlcount']);
     $xml->add_tag('attachlimit', $attachlimit);
     $xml->add_tag('max_file_size', fetch_max_upload_size());
     $xml->add_group('phrases');
     $xml->add_tag('rename', $vbphrase['rename']);
     $xml->add_tag('delete', $vbphrase['delete']);
     $xml->add_tag('add_folder_to_x', $vbphrase['add_folder_to_x']);
     $xml->add_tag('are_you_sure_delete_asset', $vbphrase['are_you_sure_delete_asset']);
     $xml->add_tag('are_you_sure_delete_assets', $vbphrase['are_you_sure_delete_assets']);
     $xml->add_tag('upload_failed', $vbphrase['upload_failed']);
     $xml->add_tag('asset_already_attached', $vbphrase['asset_already_attached']);
     $xml->add_tag('are_you_sure_delete_folder_x', $vbphrase['are_you_sure_delete_folder_x']);
     $xml->add_tag('enter_title', $vbphrase['enter_title']);
     $xml->add_tag('add_folder_to_home', $vbphrase['add_folder_to_home']);
     $xml->add_tag('the_following_errors_occurred', $vbphrase['the_following_errors_occurred']);
     $xml->add_tag('file_is_too_large', $vbphrase['file_is_too_large']);
     $xml->add_tag('invalid_file', $vbphrase['invalid_file']);
     $xml->add_tag('all_files', $vbphrase['all_files']);
Ejemplo n.º 6
0
	/**
	* Fetches a list of attachments for display on edit or preview
	*
	* @param	string	Posthash of this edit/add
	* @param	integer	Start time of this edit/add
	* @param	array		Combined existing and new attachments belonging to this content
	* @param	integer id of attachments owner
	* @param	string	Content specific values that need to be passed on to the attachment form
	* @param	string	$editorid of the message editor on the page that launched the asset manager
	* @param	integer	Number of fetched attachments, set by this function
	* @param	mixed		Who can view an attachment with no contentid (in progress), other than vbulletin->userinfo
	*
	* @return	string
	*/
	public function fetch_edit_attachments(&$posthash, &$poststarttime, &$postattach, $contentid, $values, $editorid, &$attachcount, $users = null)
	{
		global $show;

		require_once(DIR . '/includes/functions_file.php');
		$inimaxattach = fetch_max_upload_size();
		$maxattachsize = vb_number_format($inimaxattach, 1, true);
		$attachcount = 0;
		$attachment_js = '';

		if (!$posthash OR !$poststarttime)
		{
			$poststarttime = TIMENOW;
			$posthash = md5($poststarttime . $this->registry->userinfo['userid'] . $this->registry->userinfo['salt']);
		}

		if (empty($postattach))
		{
			$postattach = $this->fetch_postattach($posthash, $contentid, $users);
		}

		if (!empty($postattach))
		{
			$attachdisplaylib =& vB_Attachment_Upload_Displaybit_Library::fetch_library($this->registry, $this->contenttypeid);
			foreach($postattach AS $attachmentid => $attach)
			{
				$attachcount++;
				$attach['html'] = $attachdisplaylib->process_display_template($attach, $values);
				$attachments .= $attach['html'];
				$show['attachmentlist'] = true;
				$attachment_js .= $attachdisplaylib->construct_attachment_add_js($attach);
			}
		}

		$templater = vB_Template::create('newpost_attachment');
			$templater->register('attachments', $attachments);
			$templater->register('attachment_js', $attachment_js);
			$templater->register('editorid', $editorid);
			$templater->register('posthash', $posthash);
			$templater->register('contentid', $contentid);
			$templater->register('poststarttime', $poststarttime);
			$templater->register('attachuserid', $this->registry->userinfo['userid']);
			$templater->register('contenttypeid', $this->contenttypeid);
			$templater->register('values', $values);
		return $templater->render();
	}