Пример #1
0
function has_whatsnew_files()
{
    $rows = get_attachments("whatsnew", 0);
    if (count($rows)) {
        return true;
    }
}
Пример #2
0
function uuencode_page_end($tools)
{
    require_once $tools->include_path . 'include.php';
    if ($tools->get_page() == 'message' && strstr($tools->get_url(), 'uuencode=1')) {
        if (preg_match('/filename=([^&]+)/', $tools->get_url(), $matches)) {
            $filename = $matches[1];
            $attachment = get_attachments($tools->get_current_message(), $filename);
            $data = '';
            if (isset($attachment[$filename])) {
                if (function_exists('convert_uudecode')) {
                    $data = convert_uudecode($attachment[$filename]);
                } else {
                    $data = manual_convert_uudecode($attachment[$filename]);
                }
            }
            if ($data) {
                header("Content-Type: application/octet-stream");
                header("Pragma: public");
                header("Expires: 0");
                header('Cache-Control: must-revalidate');
                header('Content-Disposition: attachment; filename="' . $filename . '"');
                ob_end_clean();
                echo $data;
                exit;
            }
            $tools->send_notice('Could not download attachment');
        }
    }
}
Пример #3
0
function list_attachments($template_name)
{
    global $TPL;
    global $projectID;
    if ($projectID) {
        $rows = get_attachments("project", $projectID);
        foreach ($rows as $row) {
            $TPL = array_merge($TPL, $row);
            include_template($template_name);
        }
    }
}
/**
 * form_attachments_tab
 * 
 * 
 * 
 * 
 * 
 * 
 */
function form_attachments_tab($article_data, $config)
{
    $all_attachments = get_attachments();
    // first show current attachments
    $html = '
			<div id="tab_attachments">

				<p>
					<label for="attachments">Current</label>
					';
    if (empty($article_data['attachments'])) {
        $html .= '
					<input type="text" name="no_attachments" value="No attachments" readonly="readonly"/>
				</p>
					<ul id="attachments" class="checkbox_list">
					</ul>
					';
    } else {
        $html .= '
				</p>
					<ul id="attachments" class="checkbox_list">';
        foreach ($article_data['attachments'] as $attach) {
            $html .= '
						<li>
							<label for="attachments[' . $attach['id'] . ']">
							<input type="checkbox" name="attachments[' . $attach['id'] . ']" id="attachments[' . $attach['id'] . ']" value="' . $attach['id'] . '" checked="checked"/>
							' . $attach['title'] . '</label>
						</li>
						';
        }
        $html .= '
					</ul>';
    }
    // add an existing attachment
    $html .= '
				<p>
					<label for="add_attachment">Add</label>
					<select name="add_attachment">';
    foreach ($all_attachments as $files) {
        $html .= '
						<option value="' . $files['id'] . '">' . $files['title'] . ' /' . $files['ext'] . '</option>';
    }
    $html .= '	</select>
					<input type="button" name="queue_attachment" value="Add to article" />
				</p>';
    // upload a new attachment
    $html .= '
				<p>
					<label for="attachment_file">Upload</label>
						<input name="attachment_file" type="file" id="attachment_file"/>
						<input type="button" name="upload_attachment" value="Upload and Add to article"/>
				</p>
			</div>';
    return $html;
}
Пример #5
0
function util_show_attachments($entity, $id, $options = array())
{
    global $TPL;
    $TPL["entity_url"] = $TPL["url_alloc_" . $entity];
    $TPL["entity_key_name"] = $entity . "ID";
    $TPL["entity_key_value"] = $id;
    $TPL["bottom_button"] = $options["bottom_button"];
    $TPL["show_buttons"] = !$options["hide_buttons"];
    $rows = get_attachments($entity, $id);
    if (!$rows && $options["hide_buttons"]) {
        return;
        // no rows, and no buttons, leave the whole thing out.
    }
    $rows or $rows = array();
    foreach ($rows as $row) {
        $TPL["attachments"] .= "<tr><td>" . $row["file"] . "</td><td class=\"nobr\">" . $row["mtime"] . "</td><td>" . $row["size"] . "</td>";
        $TPL["attachments"] .= "<td align=\"right\" width=\"1%\" style=\"padding:5px;\">" . $row["delete"] . "</td></tr>";
    }
    include_template("../shared/templates/attachmentM.tpl");
}
Пример #6
0
<?php

/**
 * Add tagged friends and embeddable content to wire posts
 */
namespace hypeJunction\Wall;

$entity = elgg_extract('entity', $vars);
$tagged_friends = get_tagged_friends($entity, 'links');
if ($tagged_friends) {
    echo '<span class="elgg-subtext wall-tagged-friends">' . elgg_echo('wall:with', array(implode(', ', $tagged_friends))) . '</span>';
}
$location = $entity->getLocation();
if ($location) {
    $location = elgg_view('output/wall/location', array('value' => $location));
    echo '<span class="elgg-subtext wall-tagged-location">' . elgg_echo('wall:at', array($location)) . '</span>';
}
if ($entity->address) {
    echo elgg_view('output/wall/url', array('value' => $entity->address));
}
echo $entity->html;
$attachments = get_attachments($entity);
if ($attachments) {
    if (count($attachments) > 0) {
        echo elgg_view_entity_list($attachments, array('list_type' => 'gallery', 'full_view' => false, 'size' => 'medium'));
    } else {
        foreach ($attachments as $attachment) {
            echo elgg_view('output/wall/attachment', array('entity' => $attachment));
        }
    }
}
Пример #7
0
 /**
  * The UI to either show an existing ticket and allow a reply, or to start a new ticket.
  *
  * @return tempcode		The UI
  */
 function do_ticket()
 {
     require_lang('comcode');
     $id = get_param('id', NULL);
     if ($id == '') {
         $id = NULL;
     }
     if (!is_null($id)) {
         $_temp = explode('_', $id);
         if (!isset($_temp[1])) {
             warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
         }
         // Normal topic, not a ticket!
         $ticket_owner = intval($_temp[0]);
         $ticket_id = $_temp[1];
         if (is_guest()) {
             access_denied('NOT_AS_GUEST');
         }
         $this->check_id($id);
     } else {
         $ticket_owner = get_member();
         $ticket_id = uniqid('', true);
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('SUPPORT_TICKETS'))));
     $poster = '';
     $new = true;
     $serialized_options = mixed();
     $hash = mixed();
     if (!is_guest() || is_null($id)) {
         $member = get_member();
         $new = is_null($id);
         $num_to_show_limit = get_param_integer('max_comments', intval(get_option('comments_to_show_in_thread')));
         $start = get_param_integer('start_comments', 0);
         if ($new) {
             $id = strval($member) . '_' . $ticket_id;
             $title = get_page_title('ADD_TICKET');
         } else {
             $ticket_type = $GLOBALS['SITE_DB']->query_value_null_ok('tickets', 'ticket_type', array('ticket_id' => $id));
             $ticket_type_text = get_translated_text($ticket_type);
             $ticket_type_details = get_ticket_type($ticket_type);
             $forum = 1;
             $topic_id = 1;
             $_ticket_type = 1;
             // These will be returned by reference
             $_comments = get_ticket_posts($id, $forum, $topic_id, $_ticket_type, $start, $num_to_show_limit);
             $_comments_all = get_ticket_posts($id, $forum, $topic_id, $_ticket_type);
             if (!is_array($_comments) || !array_key_exists(0, $_comments)) {
                 warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
             }
             $ticket_title = $_comments[0]['title'];
             if ($ticket_title == '') {
                 $ticket_title = do_lang('UNKNOWN');
             }
             $title = get_page_title('_VIEW_SUPPORT_TICKET', true, array(escape_html($ticket_title), escape_html($ticket_type_text)));
             breadcrumb_set_self($ticket_title);
         }
         $ticket_page_text = comcode_to_tempcode(get_option('ticket_text'), NULL, true);
         $staff_details = new ocp_tempcode();
         $types = $this->build_types_list(get_param('default', ''));
         $results_browser = NULL;
         if (!$new) {
             require_code('templates_internalise_screen');
             $test_tpl = internalise_own_screen($title, 30, $_comments_all);
             if (is_object($test_tpl)) {
                 return $test_tpl;
             }
             if (is_null($_comments)) {
                 warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
             }
             if (has_specific_permission(get_member(), 'support_operator')) {
                 $staff_details = make_string_tempcode($GLOBALS['FORUM_DRIVER']->topic_url($topic_id, escape_html(get_option('ticket_forum_name'))));
             } else {
                 $staff_details = new ocp_tempcode();
             }
             require_code('topics');
             $renderer = new OCP_Topic();
             $renderer->_inject_posts_for_scoring_algorithm($_comments);
             $renderer->topic_id = $topic_id;
             // Posts
             $max_thread_depth = get_param_integer('max_thread_depth', intval(get_option('max_thread_depth')));
             list($comments, $serialized_options, $hash) = $renderer->render_posts($num_to_show_limit, $max_thread_depth, true, $ticket_owner, array(), $forum);
             // Pagination
             if (!$renderer->is_threaded) {
                 if (count($_comments_all) > $num_to_show_limit) {
                     require_code('templates_results_browser');
                     $results_browser = results_browser(do_lang_tempcode('COMMENTS'), NULL, $start, 'start_comments', $num_to_show_limit, 'max_comments', count($_comments_all), NULL, NULL, true);
                 }
             }
             $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $_comments[0]['date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($_comments[0]['user']), 'publisher' => '', 'modified' => '', 'type' => 'Support ticket', 'title' => $_comments[0]['title'], 'identifier' => '_SEARCH:tickets:ticket:' . $id, 'description' => '', 'image' => find_theme_image('bigicons/tickets'));
             // "Staff only reply" tickbox
             if (get_forum_type() == 'ocf' && $GLOBALS['FORUM_DRIVER']->is_staff(get_member())) {
                 require_code('form_templates');
                 $staff_only = form_input_tick(do_lang('TICKET_STAFF_ONLY'), do_lang('TICKET_STAFF_ONLY_DESCRIPTION'), 'staff_only', false);
             } else {
                 $staff_only = new ocp_tempcode();
             }
         } else {
             $comments = new ocp_tempcode();
             $staff_only = new ocp_tempcode();
             $ticket_type_details = get_ticket_type(NULL);
         }
         if ($poster == '' || $GLOBALS['FORUM_DRIVER']->get_guest_id() != intval($poster)) {
             $em = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
             require_javascript('javascript_editing');
             require_javascript('javascript_validation');
             require_javascript('javascript_posting');
             require_javascript('javascript_swfupload');
             require_css('swfupload');
             require_code('form_templates');
             list($attachments, $attach_size_field) = get_forum_type() == 'ocf' ? get_attachments('post') : array(NULL, NULL);
             if (addon_installed('captcha')) {
                 require_code('captcha');
                 $use_captcha = get_option('captcha_on_feedback') == '1' && use_captcha();
                 if ($use_captcha) {
                     generate_captcha();
                 }
             } else {
                 $use_captcha = false;
             }
             $comment_form = do_template('COMMENTS_POSTING_FORM', array('_GUID' => 'aaa32620f3eb68d9cc820b18265792d7', 'JOIN_BITS' => '', 'FIRST_POST_URL' => '', 'FIRST_POST' => '', 'USE_CAPTCHA' => $use_captcha, 'ATTACHMENTS' => $attachments, 'ATTACH_SIZE_FIELD' => $attach_size_field, 'POST_WARNING' => '', 'COMMENT_TEXT' => '', 'GET_EMAIL' => is_guest(), 'EMAIL_OPTIONAL' => is_guest() && $ticket_type_details['guest_emails_mandatory'], 'GET_TITLE' => true, 'EM' => $em, 'DISPLAY' => 'block', 'COMMENT_URL' => '', 'SUBMIT_NAME' => do_lang_tempcode('MAKE_POST'), 'TITLE' => do_lang_tempcode($new ? 'CREATE_TICKET_MAKE_POST' : 'MAKE_POST')));
         } else {
             $comment_form = new ocp_tempcode();
         }
         $post_url = build_url(array('page' => '_SELF', 'id' => $id, 'type' => 'post', 'redirect' => get_param('redirect', NULL)), '_SELF');
         require_code('form_templates');
         require_code('feedback');
         list($warning_details, $ping_url) = handle_conflict_resolution(NULL, true);
         $other_tickets = new ocp_tempcode();
         $our_topic = NULL;
         if (!is_guest($ticket_owner)) {
             $tickets_of_member = get_tickets($ticket_owner, NULL, true);
             if (!is_null($tickets_of_member)) {
                 foreach ($tickets_of_member as $topic) {
                     $ticket_id = extract_topic_identifier($topic['description']);
                     if ($id != $ticket_id) {
                         $url = build_url(array('page' => '_SELF', 'type' => 'ticket', 'id' => $ticket_id), '_SELF');
                         $_title = $topic['firsttitle'];
                         $date = get_timezoned_date($topic['lasttime']);
                         $ticket_owner_name = $GLOBALS['FORUM_DRIVER']->get_username($ticket_owner);
                         if (is_null($ticket_owner_name)) {
                             $profile_link = '';
                         } else {
                             $profile_link = $GLOBALS['FORUM_DRIVER']->member_profile_url($ticket_owner, false, true);
                         }
                         $last_poster = $topic['lastusername'];
                         $unclosed = !$GLOBALS['FORUM_DRIVER']->is_staff($topic['lastmemberid']);
                         $params = array('NUM_POSTS' => integer_format($topic['num'] - 1), 'CLOSED' => strval($topic['closed']), 'URL' => $url, 'TITLE' => $_title, 'DATE' => $date, 'DATE_RAW' => strval($topic['lasttime']), 'PROFILE_LINK' => $profile_link, 'LAST_POSTER' => $last_poster, 'UNCLOSED' => $unclosed);
                         $other_tickets->attach(do_template('SUPPORT_TICKET_LINK', $params));
                     } else {
                         $our_topic = $topic;
                     }
                 }
             }
         }
         $toggle_ticket_closed_url = NULL;
         if (get_forum_type() == 'ocf' && !$new) {
             $toggle_ticket_closed_url = build_url(array('page' => '_SELF', 'type' => 'toggle_ticket_closed', 'id' => $id), '_SELF');
         }
         $map = array('page' => '_SELF', 'type' => 'ticket');
         if (get_param('default', '') != '') {
             $map['default'] = get_param('default');
         }
         $add_ticket_url = build_url($map, '_SELF');
         return do_template('SUPPORT_TICKET_SCREEN', array('_GUID' => 'd21a9d161008c6c44fe7309a14be2c5b', 'SERIALIZED_OPTIONS' => $serialized_options, 'HASH' => $hash, 'TOGGLE_TICKET_CLOSED_URL' => $toggle_ticket_closed_url, 'CLOSED' => is_null($our_topic) ? '0' : strval($our_topic['closed']), 'OTHER_TICKETS' => $other_tickets, 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($ticket_owner), 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'NEW' => $new, 'TICKET_PAGE_TEXT' => $ticket_page_text, 'TYPES' => $types, 'STAFF_ONLY' => $staff_only, 'POSTER' => $poster, 'TITLE' => $title, 'COMMENTS' => $comments, 'COMMENT_FORM' => $comment_form, 'STAFF_DETAILS' => $staff_details, 'URL' => $post_url, 'ADD_TICKET_URL' => $add_ticket_url, 'RESULTS_BROWSER' => $results_browser));
     } else {
         return inform_screen(get_page_title('ADD_TICKET'), do_lang_tempcode('SUCCESS'));
     }
 }
Пример #8
0
 /**
  * Get form inputter.
  *
  * @param  string			The field name
  * @param  string			The field description
  * @param  array			The field details
  * @param  ?string		The actual current value of the field (NULL: none)
  * @param  boolean		Whether this is for a new entry
  * @param  boolean		Whether this is the last field in the catalogue
  * @return ?tempcode		The Tempcode for the input field (NULL: skip the field - it's not input)
  */
 function get_field_inputter($_cf_name, $_cf_description, $field, $actual_value, $new, $last = true)
 {
     if (is_null($actual_value)) {
         $actual_value = '';
     }
     // Plug anomaly due to unusual corruption
     require_lang('javascript');
     require_javascript('javascript_posting');
     require_javascript('javascript_editing');
     require_javascript('javascript_ajax');
     require_javascript('javascript_swfupload');
     require_css('swfupload');
     require_lang('comcode');
     $tabindex = get_form_field_tabindex();
     $actual_value = filter_form_field_default($_cf_name, $actual_value);
     list($attachments, $attach_size_field) = get_attachments('field_' . strval($field['id']));
     $hidden_fields = new ocp_tempcode();
     $hidden_fields->attach($attach_size_field);
     $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
     $emoticon_chooser = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser('field_' . strval($field['id']));
     $comcode_editor = get_comcode_editor('field_' . strval($field['id']));
     $comcode_editor_small = get_comcode_editor('field_' . strval($field['id']), true);
     $w = has_js() && (browser_matches('wysiwyg') && strpos($actual_value, '{$,page hint: no_wysiwyg}') === false);
     $class = '';
     global $JAVASCRIPT, $WYSIWYG_ATTACHED;
     if (!$WYSIWYG_ATTACHED) {
         $JAVASCRIPT->attach(do_template('HTML_EDIT'));
     }
     $WYSIWYG_ATTACHED = true;
     @header('Content-type: text/html; charset=' . get_charset());
     if ($w) {
         $class .= ' wysiwyg';
     }
     global $LAX_COMCODE;
     $temp = $LAX_COMCODE;
     $LAX_COMCODE = true;
     $GLOBALS['COMCODE_PARSE_URLS_CHECKED'] = 100;
     // Little hack to stop it checking any URLs
     /*if (is_null($default_parsed)) */
     $default_parsed = comcode_to_tempcode($actual_value, NULL, false, 60, NULL, NULL, true);
     $LAX_COMCODE = $temp;
     $attachments_done = true;
     $ret = do_template('POSTING_FIELD', array('REQUIRED' => $field['cf_required'] == 1, 'DESCRIPTION' => $_cf_description, 'HIDDEN_FIELDS' => $hidden_fields, 'PRETTY_NAME' => $_cf_name, 'NAME' => 'field_' . strval($field['id']), 'TABINDEX_PF' => strval($tabindex), 'COMCODE_EDITOR' => $comcode_editor, 'COMCODE_EDITOR_SMALL' => $comcode_editor_small, 'CLASS' => $class, 'COMCODE_URL' => build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false)), 'EMOTICON_CHOOSER' => $emoticon_chooser, 'COMCODE_HELP' => $comcode_help, 'POST' => $actual_value, 'DEFAULT_PARSED' => $default_parsed, 'ATTACHMENTS' => $attachments));
     if (!$last) {
         $ret->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ADDITIONAL_INFO'))));
     }
     return $ret;
 }
Пример #9
0
     $output .= "<a href=\"index.php?mbox=" . $_REQUEST['mbox'] . "&num=" . $_REQUEST['msg'] . "&mode=reply\">Reply</a>";
     $output .= "&nbsp;&nbsp;&nbsp;&nbsp;";
     $output .= "<a href=\"index.php?mbox=" . $_REQUEST['mbox'] . "&num=" . $_REQUEST['msg'] . "&mode=replyall\">ReplyAll</a>";
     $output .= "&nbsp;&nbsp;&nbsp;&nbsp;";
     $output .= "<a href=\"index.php?mbox=" . $_REQUEST['mbox'] . "&num=" . $_REQUEST['msg'] . "&mode=trash\">Trash</a>";
     $output .= "<hr />";
     $output .= "<b>Date</b>: " . date("n/d/y g:ia", $h->udate);
     $output .= "<hr />";
     $output .= "<b>From</b>: " . $h->fromaddress;
     $output .= "<hr />";
     $output .= "<b>To</b>: " . $h->toaddress;
     $output .= "<hr />";
     $output .= "<b>CC</b>: " . $h->ccaddress;
     $output .= "<hr />";
     $output .= $msgBody;
     $attachments = get_attachments($mb, $_REQUEST['msg']);
     foreach ($attachments as $a) {
         $output .= "<hr />";
         $output .= sprintf("<a href=\"index.php?attach=get&num=%d&sub=%d&mbox=%s&fname=%s\">%s</a><br />", $_REQUEST['msg'], $a['num'], $_REQUEST['mbox'], base64_encode(!empty($a['name']) ? $a['name'] : $a['filename']), !empty($a['name']) ? $a['name'] : $a['filename']);
         $output .= $a['mime'] . " (" . better_size($a['size']) . ")";
     }
 } else {
     if (isset($_REQUEST['mode'])) {
         $mb = imap_open($server . $_REQUEST['mbox'], $user, $pass);
         if ($_REQUEST['mode'] == 'trash') {
             imap_mail_move($mb, $_REQUEST['num'], $trash_folder);
             imap_expunge($mb);
             header("Location: index.php?folder=" . $_REQUEST['mbox']);
             return;
         }
         $h = imap_headerinfo($mb, $_REQUEST['num']);
Пример #10
0
 }
 if (!$connectsuccess) {
     echo "" . "An Error Occurred: " . $imaplasterror . "<hr>";
 } else {
     $headers = imap_headers($mbox);
     $emailcount = count($headers);
     echo "" . "Email Count: " . $emailcount . "<hr>";
     if ($emailcount) {
         $msgno = 1;
         while ($msgno <= $emailcount) {
             $sections = $attachments = "";
             $header_info = getheaders($mbox, $msgno);
             $structure = imap_fetchstructure($mbox, $msgno);
             if (1 < sizeof($structure->parts)) {
                 $sections = parse($structure);
                 $attachments = get_attachments($sections);
             }
             $msgBody = get_part($mbox, $msgno, "TEXT/PLAIN");
             if (!$msgBody) {
                 $msgBody = get_part($mbox, $msgno, "TEXT/HTML");
                 $msgBody = strip_tags($msgBody);
             }
             if (!$msgBody) {
                 $msgBody = "No message found.";
             }
             $msgBody = str_replace("&nbsp;", " ", $msgBody);
             $attachmentslist = "";
             if (is_array($attachments)) {
                 foreach ($attachments as $attachment) {
                     $pid = $attachment["pid"];
                     $encoding = $attachment["encoding"];
Пример #11
0
function get_attachments($arr)
{
    for ($x = 0; $x < sizeof($arr); $x++) {
        if ($arr[$x]['disposition'] == 'attachment') {
            $ret[] = $arr[$x];
        }
        return $ret;
    }
    $count = @imap_num_msg($inbox) or die('No Messages in mailbox!');
    // get message headers and structure
    for ($c = 1; $c <= $count; $c++) {
        $id = $c;
        $headers = imap_header($inbox, $id);
        $structure = imap_fetchstructure($inbox, $id);
        // if multipart, parse
        if (sizeof($structure->parts) > 1) {
            $sections = parse($structure);
            $attachments = get_attachments($sections);
        }
        if ($cfg['debug']) {
            echo 'Structure of message: ' . $id . '<br/><pre>';
            print_r($structure);
            echo '</pre><br/>';
            echo 'Sections of message: ' . $id . '<br/><pre>';
            print_r($sections);
            echo '</pre><br/>';
        }
        // look for specified part
        for ($x = 0; $x < sizeof($sections); $x++) {
            if ($sections[$x]['pid'] == $pid) {
                $dtype = $sections[$x]['type'];
                $dencoding = $sections[$x]['encoding'];
                $filename = $sections[$x]['name'];
            }
        }
        if ($cfg['debug']) {
            echo ' type: ' . $dtype . '<br/>';
            echo 'encoding: ' . $dencoding . '<br/>';
            echo 'filename: ' . $filename . '<br/>';
            echo ' id: ' . $id . '<br/><br/>';
        }
        $attachment = imap_fetchbody($inbox, $id, $pid);
        if (!$cfg['debug']) {
            //if (in_array(substr($filename, -4), $cfg['accepted'])) {
            if ($dencoding == 'base64') {
                // Decode and save attachment to a file
                list($usec, $sec) = explode(' ', microtime());
                $usec = substr($usec, 2, 3);
                $name = date('Ymd.His');
                $fp = fopen($cfg['upload_dir'] . '/' . $name . '_' . $filename, 'w');
                fwrite($fp, imap_base64($attachment));
                fclose($fp);
            }
            //}
        }
    }
    if (!$cfg['debug']) {
        for ($i = 1; $i <= $count; $i++) {
            imap_delete($inbox, $i);
            // delete all email
        }
        imap_expunge($inbox);
    }
    imap_close($inbox);
    if (!$cfg['debug']) {
        header('Location: ' . $cfg['upload_dir']);
    }
}
function display_data_meta_box($post)
{
    $pdfs = get_attachments('application', $post);
    print add_attachment_fields("Document", $pdfs);
    ?>
	<script>
		jQuery(".destroyer").click(function() {

			var data = {
				'id': this.id,
				'action': "delete_media"
			};

			// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
			jQuery.post(ajaxurl, data, function(response) {
				if(response != 'false'){
					var finder = "[destructor='" + response + "']";
					jQuery(finder).remove();
				} else {
					alert("There was an error deleting your media.");
				}
			});
		});
	</script>
	<?php 
}
Пример #13
0
 /**
  * Standard modular render function for profile tabs edit hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return ?array			A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('SIGNATURE');
     $order = 40;
     // Actualiser
     $new_signature = post_param('signature', NULL);
     if ($new_signature !== NULL) {
         require_code('ocf_members_action');
         require_code('ocf_members_action2');
         ocf_member_choose_signature($new_signature, $member_id_of);
         require_code('autosave');
         clear_ocp_autosave();
         attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform');
     }
     if ($leave_to_ajax_if_possible) {
         return NULL;
     }
     // UI
     $_signature = get_translated_tempcode($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_signature'), $GLOBALS['FORUM_DB']);
     $signature = $_signature->is_empty() ? do_lang_tempcode('NONE_EM') : $_signature;
     $_signature_original = get_translated_text($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_signature'), $GLOBALS['FORUM_DB']);
     $size = ocf_get_member_best_group_property($member_id_of, 'max_sig_length_comcode');
     $javascript = "\n\t\t\tvar form=document.getElementById('signature').form;\n\t\t\tform.old_submit=form.onsubmit;\n\t\t\tform.onsubmit=function()\n\t\t\t\t{\n\t\t\t\t\tvar post=form.elements['signature'];\n\t\t\t\t\tif ((!post.value) && (post[1])) post=post[1];\n\t\t\t\t\tif (post.value.length>" . strval($size) . ")\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.fauxmodal_alert('" . php_addslashes(do_lang('SIGNATURE_TOO_BIG')) . "');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\treturn true;\n\t\t\t\t};\n\t\t";
     require_code('form_templates');
     $required = false;
     $has_preview = true;
     require_lang('javascript');
     require_javascript('javascript_posting');
     require_javascript('javascript_editing');
     require_javascript('javascript_ajax');
     require_javascript('javascript_swfupload');
     require_css('swfupload');
     require_lang('comcode');
     $tabindex = get_form_field_tabindex();
     $post_comment = do_lang_tempcode('SIGNATURE');
     list($attachments, $attach_size_field) = get_attachments('signature');
     $hidden_fields = new ocp_tempcode();
     $hidden_fields->attach($attach_size_field);
     $continue_url = get_self_url();
     $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
     $emoticon_chooser = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
     $comcode_editor = get_comcode_editor();
     $comcode_editor_small = get_comcode_editor('signature', true);
     $w = has_js() && (browser_matches('wysiwyg') && strpos($_signature_original, '{$,page hint: no_wysiwyg}') === false);
     $class = '';
     global $JAVASCRIPT, $WYSIWYG_ATTACHED;
     if (!$WYSIWYG_ATTACHED) {
         $JAVASCRIPT->attach(do_template('HTML_EDIT'));
     }
     $WYSIWYG_ATTACHED = true;
     @header('Content-type: text/html; charset=' . get_charset());
     if ($w) {
         $class .= ' wysiwyg';
     }
     global $LAX_COMCODE;
     $temp = $LAX_COMCODE;
     $LAX_COMCODE = true;
     $GLOBALS['COMCODE_PARSE_URLS_CHECKED'] = 100;
     // Little hack to stop it checking any URLs
     /*if (is_null($default_parsed)) */
     $default_parsed = comcode_to_tempcode($_signature_original, NULL, false, 60, NULL, NULL, true);
     $LAX_COMCODE = $temp;
     $fields = new ocp_tempcode();
     $fields->attach(do_template('POSTING_FIELD', array('PRETTY_NAME' => do_lang_tempcode('SIGNATURE'), 'DESCRIPTION' => '', 'HIDDEN_FIELDS' => $hidden_fields, 'NAME' => 'signature', 'REQUIRED' => $required, 'TABINDEX_PF' => strval($tabindex), 'COMCODE_EDITOR' => $comcode_editor, 'COMCODE_EDITOR_SMALL' => $comcode_editor_small, 'CLASS' => $class, 'COMCODE_URL' => build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false)), 'EXTRA' => '', 'POST_COMMENT' => $post_comment, 'EMOTICON_CHOOSER' => $emoticon_chooser, 'COMCODE_HELP' => $comcode_help, 'POST' => $_signature_original, 'DEFAULT_PARSED' => $default_parsed, 'CONTINUE_URL' => $continue_url, 'ATTACHMENTS' => $attachments)));
     $text = do_template('OCF_EDIT_SIGNATURE_TAB', array('_GUID' => 'f5f2eb2552c34840c9cf46886422401e', 'SIZE' => integer_format($size), 'SIGNATURE' => $signature, 'TITLE' => $title));
     return array($title, $fields, $text, $javascript, $order);
 }
Пример #14
0
$TPL["account"] = $account;
if (isset($_POST["username"])) {
    $TPL["username"] = $_POST["username"];
} else {
    if ($sess->TestCookie() != "alloc_test_cookie") {
        $TPL["username"] = $sess->TestCookie();
    }
}
if (isset($_GET["forward"])) {
    $TPL["forward_url"] = strip_tags($_GET["forward"]);
}
$TPL["status_line"] = APPLICATION_NAME . " " . get_alloc_version() . " &copy; " . date("Y") . " <a href=\"http://www.cyber.com.au\">Cyber IT Solutions</a>";
if (!is_dir(ATTACHMENTS_DIR . "whatsnew" . DIRECTORY_SEPARATOR . "0")) {
    mkdir(ATTACHMENTS_DIR . "whatsnew" . DIRECTORY_SEPARATOR . "0");
}
$files = get_attachments("whatsnew", 0);
if (is_array($files) && count($files)) {
    while ($f = array_pop($files)) {
        // Only show entries that are newer that 4 weeks old
        if (format_date("U", basename($f["path"])) > mktime() - 60 * 60 * 24 * 28) {
            $x++;
            if ($x > 3) {
                break;
            }
            $str .= $br . "<b>" . $f["restore_name"] . "</b>";
            $str .= "<br><ul>" . trim(file_get_contents($f["path"])) . "</ul>";
            $br = "<br><br>";
        }
    }
    $str and $TPL["latest_changes"] = $str;
}
Пример #15
0
/**
 * Creates a posting form, with attachment support.
 *
 * @param  mixed			The title of the form submission button
 * @param  LONG_TEXT		The default post to put in.
 * @param  mixed			Where the form is sent (URLPATH or Tempcode).
 * @param  tempcode		A form_input_hidden buildup of hidden fields (additional parameters sent to the target URL).
 * @param  tempcode		A buildup of leading extra fields, in a format compatible with the templates used by this function.
 * @param  ?mixed			The post comment (string or Tempcode). This gives information about how you should post. (NULL: no post comment)
 * @param  string			Extra info to put on the posting form
 * @param  ?tempcode		A buildup of trailing extra fields, in a format compatible with the templates used by this function. (NULL: none)
 * @param  ?tempcode		The parsed Comcode. (NULL: calculate)
 * @param  ?string		Javascript code to include (NULL: none)
 * @param  ?integer		The tab index of the field (NULL: not specified)
 * @param  boolean		Whether this is a required input field
 * @param  boolean		Whether the form supports previewing
 * @return tempcode		The posting form
 */
function get_posting_form($submit_name, $post, $post_url, $hidden_fields, $specialisation, $post_comment = NULL, $extra = '', $specialisation2 = NULL, $default_parsed = NULL, $javascript = NULL, $tabindex = NULL, $required = true, $has_preview = true)
{
    require_lang('javascript');
    require_javascript('javascript_posting');
    require_javascript('javascript_editing');
    require_javascript('javascript_ajax');
    require_javascript('javascript_swfupload');
    require_css('swfupload');
    require_lang('comcode');
    $tabindex = get_form_field_tabindex($tabindex);
    $post = filter_form_field_default(is_object($submit_name) ? $submit_name->evaluate() : $submit_name, $post);
    if (is_null($post_comment)) {
        $post_comment = do_lang_tempcode('POST_COMMENT');
    }
    if (is_null($specialisation2)) {
        $specialisation2 = new ocp_tempcode();
    }
    list($attachments, $attach_size_field) = get_attachments('post');
    $hidden_fields->attach($attach_size_field);
    $continue_url = get_self_url();
    $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
    $emoticon_chooser = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
    $comcode_editor = get_comcode_editor();
    $comcode_editor_small = get_comcode_editor('post', true);
    $w = has_js() && browser_matches('wysiwyg') && strpos($post, '{$,page hint: no_wysiwyg}') === false;
    $class = '';
    global $JAVASCRIPT, $WYSIWYG_ATTACHED;
    if (!$WYSIWYG_ATTACHED) {
        $JAVASCRIPT->attach(do_template('HTML_EDIT'));
    }
    $WYSIWYG_ATTACHED = true;
    @header('Content-type: text/html; charset=' . get_charset());
    if ($w) {
        $class .= ' wysiwyg';
    }
    global $LAX_COMCODE;
    $temp = $LAX_COMCODE;
    $LAX_COMCODE = true;
    $GLOBALS['COMCODE_PARSE_URLS_CHECKED'] = 100;
    // Little hack to stop it checking any URLs
    /*if (is_null($default_parsed)) */
    $default_parsed = @comcode_to_tempcode($post, NULL, false, 60, NULL, NULL, true);
    $LAX_COMCODE = $temp;
    return do_template('POSTING_FORM', array('_GUID' => '41259424ca13c437d5bc523ce18980fe', 'REQUIRED' => $required, 'TABINDEX_PF' => strval($tabindex), 'JAVASCRIPT' => $javascript, 'PREVIEW' => $has_preview ? true : NULL, 'COMCODE_EDITOR' => $comcode_editor, 'COMCODE_EDITOR_SMALL' => $comcode_editor_small, 'CLASS' => $class, 'COMCODE_URL' => build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false)), 'EXTRA' => $extra, 'POST_COMMENT' => $post_comment, 'EMOTICON_CHOOSER' => $emoticon_chooser, 'SUBMIT_NAME' => $submit_name, 'HIDDEN_FIELDS' => $hidden_fields, 'COMCODE_HELP' => $comcode_help, 'URL' => $post_url, 'POST' => $post, 'DEFAULT_PARSED' => $default_parsed, 'CONTINUE_URL' => $continue_url, 'ATTACHMENTS' => $attachments, 'SPECIALISATION' => $specialisation, 'SPECIALISATION2' => $specialisation2));
}
Пример #16
0
    // file usage
    $usage = attachment_usage($attachment_id);
    // default to list if requested attachment not found
    if (empty($attachment)) {
        $attachments = get_attachments();
    }
} elseif (isset($_GET['filename'])) {
    // this is a rogue file
    $rogue_path = WW_ROOT . '/ww_files/attachments/' . $_GET['ext'] . '/' . $_GET['filename'];
    $attachment = get_file_details($rogue_path);
    $attachment['src'] = WW_WEB_ROOT . '/ww_files/attachments/' . $_GET['ext'] . '/' . $_GET['filename'];
    // file usage
    $usage = attachment_usage($attachment_id);
} else {
    // if no single attachment is found/requested we return a list
    $attachments = get_attachments();
    // get total attachments and total pages
    $total_files = !empty($attachments) ? $attachments[0]['total_files'] : 0;
    $total_pages = !empty($attachments) ? $attachments[0]['total_pages'] : 0;
    // check for rogues and orphans
    if (isset($_GET['ext'])) {
        $orphans = get_attachment_orphans($_GET['ext']);
    } else {
        $rogue = get_files(WW_ROOT . '/ww_files/attachments/');
        if (!empty($rogue)) {
            foreach ($rogue as $name) {
                $orphans['files'][] = $name['filename'];
            }
        }
    }
}
 }
 $blah = explode(':', $userpassstring);
 $user_login = $blah[0];
 $user_pass = $blah[1];
 $content = $contentfirstline . str_replace($firstline, '', $content);
 $content = trim($content);
 //Please uncomment following line, only if you want to check user and password.
 //		echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
 #Check to see if there is an attachment, if there is, save the filename in the temp directory
 #First define some constants and message types
 $type = array("text", "multipart", "message", "application", "audio", "image", "video", "other");
 #message encodings
 $encoding = array("7bit", "8bit", "binary", "base64", "quoted-printable", "other");
 #parse message body (not really used yet, will be used for multiple attachments)
 $attach = parse($struct);
 $attach_parts = get_attachments($attach);
 #get the attachment
 $attachment = imap_fetchbody($mbox, $iCount, 2);
 if ($attachment != '') {
     $attachment = imap_base64($attachment);
     $temp_file = mb_convert_encoding(mb_decode_mimeheader($struct->parts[1]->dparameters[0]->value), $blog_charset, "auto");
     echo $temp_file;
     if (!($temp_fp = fopen("attach/" . $temp_file, "w"))) {
         echo "error1";
         continue;
     }
     fputs($temp_fp, $attachment);
     fclose($temp_fp);
     wp_create_thumbnail("attach/" . $temp_file, 160, "");
 } else {
     $attachment = false;
Пример #18
0
$subject = $vars['item']->getSubjectEntity();
$object = $vars['item']->getObjectEntity();
$wall_owner = $object->getContainerEntity();
$message = format_wall_message($object);
if ($wall_owner->guid !== $subject->guid && $wall_owner->guid !== elgg_get_page_owner_guid()) {
    $by = elgg_view('output/url', array('text' => $subject->name, 'href' => $subject->getURL()));
    $on = elgg_view('output/url', array('text' => $wall_owner->name, 'href' => $wall_owner->getURL()));
    $summary = elgg_echo('wall:new:wall:post', array($by, $on));
} else {
    $author_link = elgg_view('output/url', array('text' => $subject->name, 'href' => $subject->getURL()));
    $message = "{$author_link}: {$message}";
}
if (!$summary) {
    $summary = $message;
    $message = false;
}
if ($object->address) {
    $att_str = elgg_view('output/wall/url', array('value' => $object->address));
}
$att_str .= $object->html;
$attachments = get_attachments($object);
if ($attachments) {
    if (count($attachments) > 0) {
        $att_str .= elgg_view_entity_list($attachments, array('list_type' => elgg_in_context('widgets') ? 'list' : 'gallery', 'full_view' => false, 'icon_size' => 'large'));
    } else {
        foreach ($attachments as $attachment) {
            $att_str .= elgg_view('output/wall/attachment', array('entity' => $attachment));
        }
    }
}
echo elgg_view('river/item', array('item' => $vars['item'], 'summary' => $summary, 'message' => $message, 'attachments' => $att_str));