| 1 |
<?php |
|---|
| 2 |
/* $Id:$ */ |
|---|
| 3 |
//This program is free software; you can redistribute it and/or |
|---|
| 4 |
//modify it under the terms of the GNU General Public License |
|---|
| 5 |
//as published by the Free Software Foundation; either version 2 |
|---|
| 6 |
//of the License, or (at your option) any later version. |
|---|
| 7 |
// |
|---|
| 8 |
//This program is distributed in the hope that it will be useful, |
|---|
| 9 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 |
//GNU General Public License for more details. |
|---|
| 12 |
|
|---|
| 13 |
$iam = 'gabcast'; //used for switch on config.php |
|---|
| 14 |
$type = 'tool'; |
|---|
| 15 |
|
|---|
| 16 |
// look for form post |
|---|
| 17 |
isset($_POST['action'])?$postaction = $_POST['action']:$postaction=''; |
|---|
| 18 |
|
|---|
| 19 |
switch ($postaction) { |
|---|
| 20 |
case "add": |
|---|
| 21 |
gabcast_add($_POST['ext'],$_POST['channbr'],$_POST['pin']); |
|---|
| 22 |
needreload(); |
|---|
| 23 |
redirect_standard(); |
|---|
| 24 |
break; |
|---|
| 25 |
case "delete": |
|---|
| 26 |
gabcast_del($_POST['ext']); |
|---|
| 27 |
needreload(); |
|---|
| 28 |
redirect_standard(); |
|---|
| 29 |
break; |
|---|
| 30 |
case "edit": |
|---|
| 31 |
gabcast_edit($_POST['ext'],$_POST['channbr'],$_POST['pin']); |
|---|
| 32 |
needreload(); |
|---|
| 33 |
redirect_standard('ext'); |
|---|
| 34 |
break; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
// look for get |
|---|
| 38 |
isset($_GET['action'])?$action = $_GET['action']:$action=''; |
|---|
| 39 |
isset($_GET['ext'])?$ext=$_GET['ext']:$ext=''; |
|---|
| 40 |
|
|---|
| 41 |
switch ($action) { |
|---|
| 42 |
case "add": |
|---|
| 43 |
gabcast_sidebar($ext, $type, $iam); |
|---|
| 44 |
gabcast_show(null, $type, $iam); |
|---|
| 45 |
break; |
|---|
| 46 |
case "edit": |
|---|
| 47 |
gabcast_sidebar($ext, $type, $iam); |
|---|
| 48 |
gabcast_show($ext, $type, $iam); |
|---|
| 49 |
break; |
|---|
| 50 |
default: |
|---|
| 51 |
gabcast_sidebar(null, $type, $iam); |
|---|
| 52 |
gabcast_text(); |
|---|
| 53 |
break; |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
function gabcast_text() { |
|---|
| 58 |
|
|---|
| 59 |
echo "<div>"; |
|---|
| 60 |
echo _("This "); |
|---|
| 61 |
echo "<a class=info href=\"http://www.gabcast.com\" target=_new>Gabcast<span>"; |
|---|
| 62 |
echo _("Gabcast is a social broadcasting platform that offers virtual communities, individuals, and organizations an easy way to create and distribute audio content.<br><br>Visit www.gabcast.com for more info."); |
|---|
| 63 |
echo "</span>"; |
|---|
| 64 |
echo "</a> "._("module allows you to:"); |
|---|
| 65 |
echo "<ul><li>"; |
|---|
| 66 |
echo _("Link extensions to Gabcast channels. It creates a feature code, which defaults to <u>*422</u> 'gab' - you can change this in"); |
|---|
| 67 |
echo " <a href=\"config.php?type=setup&display=featurecodeadmin\"> "._("Feature Code Admin").", </a>"; |
|---|
| 68 |
echo _("which allows you to log directly into your Gabcast account. This is ideal for personal podcasting!"); |
|---|
| 69 |
echo "<li>"; |
|---|
| 70 |
echo _("Define a Gabcast channel as a Destination for other modules. For example, you can direct a DID or IVR menu option directly to Gabcast. This is ideal for group and public podcasting!"); |
|---|
| 71 |
echo "</ul>"; |
|---|
| 72 |
echo "</div>"; |
|---|
| 73 |
echo "<div style=;margin-top:20px;>"; |
|---|
| 74 |
echo gabcast_player(); |
|---|
| 75 |
echo "</div>"; |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
function gabcast_show($xtn, $type, $iam) { |
|---|
| 79 |
|
|---|
| 80 |
//get settings if editing |
|---|
| 81 |
if(!empty($xtn)) { |
|---|
| 82 |
$thisxtn = gabcast_get($xtn); |
|---|
| 83 |
if(!is_array($thisxtn)) { |
|---|
| 84 |
echo _("Error: cannot retreive Gabcast info for this extension"); |
|---|
| 85 |
return; |
|---|
| 86 |
} |
|---|
| 87 |
$player = gabcast_player($thisxtn[1]); |
|---|
| 88 |
$action = 'edit'; |
|---|
| 89 |
|
|---|
| 90 |
?> |
|---|
| 91 |
<form method="POST" action="{$_SERVER['PHP_SELF']}?type={$type}&display={$iam}"> |
|---|
| 92 |
<input type="hidden" name="action" value="delete"> |
|---|
| 93 |
<input type="hidden" name="ext" value="{$thisxtn[0]}"> |
|---|
| 94 |
<input type="submit" value="<?php echo _('Delete settings');?>"></form> |
|---|
| 95 |
<?php |
|---|
| 96 |
} |
|---|
| 97 |
$usage_list = framework_display_destination_usage(gabcast_getdest($xtn)); |
|---|
| 98 |
if (!empty($usage_list)) { |
|---|
| 99 |
?> |
|---|
| 100 |
<a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a> |
|---|
| 101 |
<?php |
|---|
| 102 |
} |
|---|
| 103 |
echo "<hr>"; |
|---|
| 104 |
|
|---|
| 105 |
if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') { |
|---|
| 106 |
$thisxtn['ext'] = $_REQUEST['ext']; |
|---|
| 107 |
$thisxtn[0] = $_REQUEST['ext']; |
|---|
| 108 |
$player = ""; |
|---|
| 109 |
$action = 'add'; |
|---|
| 110 |
|
|---|
| 111 |
echo "<div style=margin-bottom:10px;>"; |
|---|
| 112 |
|
|---|
| 113 |
echo _("You <u>must</u> have a Gabcast account & channel to use this feature. Visit"); |
|---|
| 114 |
echo " <a href=\"http://www.gabcast.com\" target=\"_blank\">www.gabcast.com</a> "; |
|---|
| 115 |
echo _("to sign up. <u>It's a free service</u>!"); |
|---|
| 116 |
echo "</div>"; |
|---|
| 117 |
} |
|---|
| 118 |
|
|---|
| 119 |
echo "<form method=\"POST\" action=\"{$_SERVER['PHP_SELF']}?type={$type}&display={$iam}&action={$action}\">"; |
|---|
| 120 |
echo "<input type=\"hidden\" name=\"action\" value=\"{$action}\"><div>"; |
|---|
| 121 |
echo _("Gabcast Channel Number:"); |
|---|
| 122 |
echo "<input size=\"10\" type=\"text\" name=\"channbr\" value=\"{$thisxtn[1]}\"></div><dic>"; |
|---|
| 123 |
echo _("Gabcast Channel Password:"); |
|---|
| 124 |
echo "<input size=\"10\" type=\"text\" name=\"pin\" value=\"{$thisxtn[2]}\"></div><div>"; |
|---|
| 125 |
echo _("Link to Extension/User Number:"); |
|---|
| 126 |
echo "<input size=\"10\" type=\"text\" name=\"ext\" value=\"{$thisxtn[0]}\"></div><div>"; |
|---|
| 127 |
echo "<input type=\"submit\"></div><div style=\"margin-top:20px;\">"; |
|---|
| 128 |
echo "{$player}"; |
|---|
| 129 |
echo "</div></form>"; |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
function gabcast_sidebar($sel, $type, $iam) { |
|---|
| 133 |
echo "</div><div class='rnav'>\n"; |
|---|
| 134 |
echo "<ul><li><a id='".($sel==''?'current':'std')."' "; |
|---|
| 135 |
echo "href='config.php?type={$type}&display={$iam}&action=add'>"._("Add Gabcast Channel")."</a></li>"; |
|---|
| 136 |
//get the list of paging groups |
|---|
| 137 |
$resarr = gabcast_list(); |
|---|
| 138 |
if ($resarr) { |
|---|
| 139 |
foreach ($resarr as $resar) { |
|---|
| 140 |
$cursel = $resar[0]; |
|---|
| 141 |
echo "<li><a id=\"".($sel==$cursel ? 'current':'std'); |
|---|
| 142 |
echo "\" href=\"config.php?type=${type}&display="; |
|---|
| 143 |
echo "${iam}&ext=${cursel}&action=edit\">"; |
|---|
| 144 |
echo _("Ext")." ${cursel} -> "._("Chan")." ${resar[1]} </a></li>"; |
|---|
| 145 |
} |
|---|
| 146 |
} |
|---|
| 147 |
echo "</ul></div><div class='content'><h2>"._("Gabcast Configuration")."</h2>\n"; |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
function gabcast_player($chanid = false) { |
|---|
| 151 |
if ($chanid) { |
|---|
| 152 |
$title = "<h4>".sprintf(_("The latest episodes in channel #%s"),$chanid).":</h4>"; |
|---|
| 153 |
$feed = "http://www.gabcast.com/casts/{$chanid}/rss/rss.xml"; |
|---|
| 154 |
} else { |
|---|
| 155 |
$title = "<h4>"._("The latest episodes across all channels").":</h4>"; |
|---|
| 156 |
$feed = "http://www.gabcast.com/casts/feeds/latest.xml"; |
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
return $title.'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="300" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="movie" value="http://www.gabcast.com/mp3play/mp3player.swf?file='.$feed.'&config=http://www.gabcast.com/mp3play/config.php?ini=full.0.l" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always"><embed src="http://www.gabcast.com/mp3play/mp3player.swf?file='.$feed.'&config=http://www.gabcast.com/mp3play/config.php?ini=full.0.l" allowScriptAccess="always" wmode="transparent" width="300" height="300" name="mp3player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object><br><br><div>'._('Feed URL: ').'<a href="'.$feed.'" target=_blank>'.$feed.'</a></div>'; |
|---|
| 160 |
|
|---|
| 161 |
} |
|---|
| 162 |
?> |
|---|