/** * Just gets the list of hosts from Wordpress, saves it to an array which * uses the userID as the array name, then two keys called name and roles * which contain the puretext name (string) and roles (array). * @return [type] See above. */ function getDBHosts() { include 'config.php'; $hosts = []; $hostData = fetchFromWP($baseDomain . $baseAPI . 'users?per_page=100'); foreach ($hostData as $key => $value) { $hosts[$value->id]['name'] = $value->name; // $hosts[$value->id]['roles'] = $value->roles; } asort($hosts); return $hosts; }
<?php include_once 'inc/head.php'; include_once 'config.php'; include_once 'functions.php'; /* * Grab the submitted data from the previous page into an array! */ $submittedMeta = unserialize(base64_decode($_POST['submittedMeta'])); /* * Let's push all the things we need to know about this episode's * category in there as well. */ $categoryData = fetchFromWP($baseDomain . $baseAPI . 'categories?per_page=100'); foreach ($categoryData as $key => $value) { if ($value->id == $submittedMeta['showID']) { $submittedMeta['catName'] = $value->name; $submittedMeta['catSlug'] = $value->slug; } } echo '<p>Hold on, let me ship the file over to the CDN...'; $CDNpath = '/www/' . $submittedMeta['catSlug'] . '/' . $submittedMeta['catSlug'] . $submittedMeta['episodeNumber'] . '.mp3'; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a file if (ftp_put($conn_id, $CDNpath, $baseDirectory . '/PublicationTool/uploads/' . $submittedMeta['theTrack'], FTP_BINARY)) { echo " Aaaand done!.\n"; } else { echo " Huh. There was a problem while doing the thing!\n"; } // close the connection