root/modules/branches/2.3/gabcast/page.gabcast.php

Revision 4538, 6.1 kB (checked in by p_lindheimer, 5 years ago)

#2070 fix bad use of <? with <?php

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to LF
Line 
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
60 <div>
61   This
62   <a class=info href="http://www.gabcast.com" target=_new>Gabcast
63     <span>
64       Gabcast is a social broadcasting
65       platform that offers virtual communities, individuals, and organizations an easy
66       way to create and distribute audio content.<br><br>Visit www.gabcast.com for more info.
67     </span>
68   </a> module allows you to:
69   <ul>
70     <li>Link extensions to Gabcast channels. It creates a feature code (which defaults to <u>*422</u> "gab" - you can change this in
71     <a href="config.php?type=setup&display=featurecodeadmin">Feature Code Admin</a>)  which allows you to log directly into your Gabcast account.  This is ideal for personal podcasting!
72    
73     <li>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!
74   </ul>
75 </div>
76
77
78 <div style=;margin-top:20px;>
79   <?php echo gabcast_player();?>
80 </div>
81 <?php
82 }
83
84 function gabcast_show($xtn, $type, $iam) {
85  
86   //get settings if editing
87   if(!empty($xtn)) {
88     $thisxtn = gabcast_get($xtn);
89     if(!is_array($thisxtn)) {
90       echo "Error: cannot retreive Gabcast info for this extension";
91       return;
92     }
93     $player = gabcast_player($thisxtn[1]);
94     $action = 'edit';
95     
96     //draw delete button
97     echo <<< End_Of_Delete
98     <form method="POST" action="{$_SERVER['PHP_SELF']}?type={$type}&display={$iam}">
99     <input type="hidden" name="action" value="delete">
100     <input type="hidden" name="ext" value="{$thisxtn[0]}">
101     <input type="submit" value="delete settings"></form><hr>
102 End_Of_Delete;
103   }
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;>You <u>must</u> have a Gabcast account & channel to use this feature.  Visit <a href="http://www.gabcast.com" target="_blank">www.gabcast.com</a> to sign up. <u>It\'s a free service</u>!</div>';
112   }
113  
114   echo <<< End_Of_Html
115
116   <form method="POST" action="{$_SERVER['PHP_SELF']}?type={$type}&display={$iam}&action={$action}">
117     <input type="hidden" name="action" value="{$action}">
118     <div>
119       Gabcast Channel Number:
120       <input size="10" type="text" name="channbr" value="{$thisxtn[1]}">
121     </div>
122     <div>
123       Gabcast Channel Password:
124       <input size="10" type="text" name="pin" value="{$thisxtn[2]}">
125     </div>
126     <div>
127       Link to Extension/User Number:
128       <input size="10" type="text" name="ext" value="{$thisxtn[0]}">
129     </div>
130     <div>
131       <input type="submit">
132     </div>
133     <div style="margin-top:20px;">
134       {$player}
135     </div>
136   </form>
137  
138 End_Of_Html;
139 }
140
141 function gabcast_sidebar($sel, $type, $iam) {
142         echo "</div><div class='rnav'>\n";
143         echo "<li><a id='".($sel==''?'current':'std')."' ";
144         echo "href='config.php?type={$type}&amp;display={$iam}&amp;action=add'>"._("Add Gabcast Channel")."</a></li>";
145         //get the list of paging groups
146         $resarr = gabcast_list();
147         if ($resarr) {
148                 foreach ($resarr as $resar) {
149                         $cursel = $resar[0];
150                         echo "<li><a id=\"".($sel==$cursel ? 'current':'std');
151                         echo "\" href=\"config.php?type=${type}&amp;display=";
152                         echo "${iam}&amp;ext=${cursel}&amp;action=edit\">";
153                         echo _("Ext")." ${cursel} -> "._("Chan")." ${resar[1]} </a></li>";
154                 }
155         }
156         echo "</div><div class='content'><h2>"._("Gabcast Configuration")."</h2>\n";
157 }
158
159 function gabcast_player($chanid = false) {
160   if ($chanid) {
161     $title = _("<h4>The latest episodes in channel #{$chanid}").":</h4>";
162     $feed = "http://www.gabcast.com/casts/{$chanid}/rss/rss.xml";
163   } else {
164     $title = _("<h4>The latest episodes across all channels").":</h4>";
165     $feed = "http://www.gabcast.com/casts/feeds/latest.xml";
166   }
167  
168   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>';
169  
170 }
171 ?>
Note: See TracBrowser for help on using the browser.