コード例 #1
0
        // Add a "Log out of Google Drive" button.
        $C .= '<a class="btn" title="Disconnect your Pika CMS account from Google Drive." href="' . $base_url . '/pm.php/google_drive_connector/auth.php?action=unauthorize&username='******'username']);
        $C .= '" target="_blank">Disconnect Drive</a>';
        /* TODO:  Use this button once Pika CMS is using a version of Bootstrap 
        		that includes Font Awesome <i class="icon-signout"></i>
        		*/
        $C .= '
		</div>
	</div>
	</form>';
    } else {
        $clean_username = htmlspecialchars($auth_row['username']);
        $C .= '<p>To upload and view case-related files, you need to connect your Pika CMS account to your Google account. To do so, <a class=""';
        $C .= ' onClick=\'window.open("' . $base_url . '/pm.php/google_drive_connector/auth.php?action=authenticate", "Request for Authorization", "width=450, height=500, scrollbars=yes");\'';
        $C .= '><strong>click here to log into Google Drive</strong></a>.</p>';
        $C .= '<p><em>Please reload or refresh this page once you have logged in</em>.</p>';
    }
    // End Drive Upload Form
    require_once getcwd() . '-custom/extensions/google_drive_connector/file_list.php';
    $a['file_list'] = file_list($case1->google_drive_folder_id, null, $case1->google_drive_folder_id);
    $template = new pikaTempLib('subtemplates/case-drive.html', $a);
    $C .= $template->draw();
    // Handle Drive uploads
    // TODO Move this elsewhere
    if (array_key_exists('file_upload', $_FILES)) {
        $rest = new PikaDrive($auth_row['username']);
        $y = $rest->uploadFile($_FILES['file_upload']['tmp_name'], $_FILES['file_upload']['name'], htmlspecialchars($_POST['folder_id']));
        // $_POST['title'], $_POST['folder_id'])
    }
}