/**
  * Upload file to dropbox
  * @param  init $comment_id
  * @param  init $project_id
  * @param  array $commentdata
  * @return void
  */
 function upload_file_dropbox($post_id = 0, $attachment_id)
 {
     require_once MDROP_PATH . '/lib/dropbox/autoload.php';
     $accesstoken = mdrop_get_token(get_current_user_id());
     //'v1FIiYf35K4AAAAAAAADPLhrp-T8miNShTgeuJ5zrDmyb39gf411tgDJx22_ILSK'; //$this->dropbox_accesstoken;
     $dbxClient = new dbx\Client($accesstoken, "PHP-Example/1.0");
     $accountInfo = $dbxClient->getAccountInfo();
     $post = get_post($post_id);
     $files = get_attached_file($attachment_id);
     $file_name = basename(get_attached_file($attachment_id));
     $drop_path = '/EmailAttachment/' . $post->post_title . '/' . $file_name;
     $shareableLink = $dbxClient->createShareableLink($drop_path);
     if (!empty($shareableLink)) {
         return;
     }
     $f = fopen($files, "rb");
     $uploaded_file = $dbxClient->uploadFile($drop_path, dbx\WriteMode::add(), $f);
     fclose($f);
     $dropbox_file_path = $uploaded_file['path'];
     $shareableLink = $dbxClient->createShareableLink($drop_path);
     $this->update_dropbox_shareablelink($attachment_id, $shareableLink);
     $this->update_dropbox_filepath($attachment_id, $dropbox_file_path);
 }
    _e('<strong>Please enable fileinfo</strong><br>', 'mdrop');
    _e('Open <em style="background: #eee;">php.ini</em> uncomment the following:
		<em style="background: #eee;">extension=php_fileinfo.dll</em>', 'mdrop');
    echo '</p></div>';
    return;
}
$header_path = dirname(__FILE__) . '/header.php';
$header_path = apply_filters('mdrop_header_path', $header_path, 'settings');
if (file_exists($header_path)) {
    require_once $header_path;
}
$user_id = get_current_user_id();
$mail_server = mdrop_get_server($user_id);
$email = mdrop_get_email($user_id);
$password = mdrop_get_password($user_id);
$drop_token = mdrop_get_token($user_id);
?>

<div class="postbox">
	<h3 class="mdrop-h3-title"><?php 
_e('Settings', 'mdrop');
?>
</h3>
	<div class="mdrop-settings-content">
		<div id="mdrop-read-me-wrap" style="display: none; margin-bottom: 35px;">
			
			<p>
				<strong><?php 
_e('For Gmail', 'mdrop');
?>
</strong><br>