* @access public
*/
public $events = array();
+ public $image_owner;
/**
* Constructor
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events
WHERE image != '' AND image IS NOT NULL";
$results = $this->wpdb->get_results($sql, ARRAY_A);
- echo '<pre>$results: ' . print_r($results, true) . '</pre>';
- $imgUrl = 'http://is0.gaslightmedia.com/discoverkalamazoo/original/';
+ $out = '<pre>$results: ' . print_r($results, true) . '</pre>';
+ $imgUrl = 'http://is0.gaslightmedia.com/' . $this->image_owner . '/original/';
foreach ( $results as $event ) {
$imageFullUrl = $imgUrl . $event['image'];
$res = $ImageUpload->storeImage($imageFullUrl);
);
}
}
+ return $out;
}
public function importEventFiles()
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events
WHERE file1 != '' AND file1 IS NOT NULL";
$results = $this->wpdb->get_results($sql, ARRAY_A);
- //echo '<pre>$results: ' . print_r($results, true) . '</pre>';
- $fileUrl = 'http://is0.gaslightmedia.com/discoverkalamazoo/original/';
- //echo '<pre>$results: ' . print_r($results, true) . '</pre>';
+ $fileUrl = 'http://is0.gaslightmedia.com/' . $this->image_owner . '/original/';
+ $out = '<pre>$results: ' . print_r($results, true) . '</pre>';
//exit;
foreach ( $results as $event ) {
$fileFullUrl = $fileUrl . $event['image'];
chmod( GLM_MEMBERS_PLUGIN_FILES_PATH . '/' . $event['file1'], 0660 );
umask($oldUmask);
}
+ return $out;
}
/**
case 'eventImagesImport':
- $this->importEventImages();
+ $this->image_owner = filter_var($_REQUEST['img_owner_id'], FILTER_SANITIZE_STRING);
+
+ if ( $this->image_owner ) {
+ $this->importEventImages();
+ $this->importEventFiles();
+ $importResult = '<p>All images and files imported</p>';
+ } else {
+ $importResult = '<pre>Failure: Not given owner id.</pre>';
+ }
+
break;
case 'eventFilesImport':
- $this->importEventFiles();
break;
</td>
</tr>
{else}
- <tr><td><a href="{$thisUrl}?page={$thisPage}&glm_action=events&option=eventImagesImport">Import Event Images</a></td></tr>
- <tr><td><a href="{$thisUrl}?page={$thisPage}&glm_action=events&option=eventFilesImport">Import Event Files</a></td></tr>
<tr>
<td colspan="2">
<form action="{$thisUrl}">
</form>
</td>
</tr>
+ <tr>
+ <td colspan="2">
+ <form action="{$thisUrl}">
+ <input type="hidden" name="page" value="{$thisPage}">
+ <input type="hidden" name="glm_action" value="events">
+ <input type="hidden" name="option" value="eventImagesImport">
+ <div style="float:left;width: 200px;">
+ <fieldset>
+ <legend>Image Style Owner:</legend>
+ <label for="db_host">Owner Id</label>
+ <input id="img_owner_id" name="img_owner_id" />
+ <fieldset>
+
+ <input type="submit" value="Import Files" />
+ </div>
+ </form>
+ </td>
+ </tr>
{/if}
</table>