Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions
+189
View File
@@ -0,0 +1,189 @@
// written by Tan Ling Wee
// last updated 20 June 2003
// email : fuushikaden@yahoo.com
//////////////////////////////////////////////////////////////////////////////////
// Layers
//////////////////////////////////////////////////////////////////////////////////
var layerQueue=new Array()
var layerIndex=-1
/* hides <select> and <applet> objects (for IE only) */
function hideElement( elmID, overDiv )
{
if( ie )
{
for( i = 0; i < document.getElementsByTagName( elmID ).length; i++ )
{
obj = document.getElementsByTagName( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}
// Find the element's offsetTop and offsetLeft relative to the BODY tag.
objLeft = obj.offsetLeft;
objTop = obj.offsetTop;
objParent = obj.offsetParent;
while( objParent.tagName.toUpperCase() != "BODY" )
{
objLeft += objParent.offsetLeft;
objTop += objParent.offsetTop;
objParent = objParent.offsetParent;
}
objHeight = obj.offsetHeight;
objWidth = obj.offsetWidth;
if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
else if( overDiv.offsetTop >= ( objTop + objHeight ));
else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
else
{
obj.style.visibility = "hidden";
}
}
}
}
/*
* unhides <select> and <applet> objects (for IE only)
*/
function showElement( elmID )
{
if( ie )
{
for( i = 0; i < document.getElementsByTagName( elmID ).length; i++ )
{
obj = document.getElementsByTagName( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}
obj.style.visibility = "";
}
}
}
function lw_createLayer (layerName, top_pos, left_pos, width, height, bgcolor, bordercolor, z_index) {
document.write("<div ONCLICK='event.cancelBubble=true' id='"+layerName+"' style='z-index:" + z_index + ";position:absolute;top:"+top_pos+";left:"+left_pos+";visibility:hidden;'><table bgcolor='"+bgcolor+"' style='border-width:1px;border-style:solid;border-color:" + bordercolor + "' cellpadding=2 cellspacing=0 width=0><tr><td valign=top width='"+width+"' height='"+height+"'><span id='"+layerName+"_content'></span></td></tr></table></div>")
}
function lw_getObj (objName) {
return (dom)?document.getElementById(objName).style:ie?eval("document.all."+objName) :eval("document."+objName)
}
function lw_showLayer (layerName) {
found=false
for (i=0;i<=layerIndex;i++)
{
if (layerQueue[i]==layerName)
{
found=true
}
}
if ((lw_getObj(layerName).visibility!="visible")&&(lw_getObj(layerName).visibility!="show"))
{
lw_getObj(layerName).visibility = (dom||ie)?"visible":"show"
layerQueue[++layerIndex] = layerName
hideElement( 'SELECT', document.getElementById(layerName) );
hideElement( 'APPLET', document.getElementById(layerName) );
}
}
function lw_hideLayer () {
showElement( 'SELECT', document.getElementById(layerQueue[layerIndex]) );
showElement( 'APPLET', document.getElementById(layerQueue[layerIndex]) );
lw_getObj(layerQueue[layerIndex--]).visibility = "hidden"
}
function lw_hideLayerName (layerName) {
var i
var tmpQueue=new Array()
var newIndex=-1
showElement( 'SELECT', document.getElementById(layerName) );
showElement( 'APPLET', document.getElementById(layerName) );
lw_getObj(layerName).visibility = "hidden"
for (i=0;i<=layerIndex;i++)
{
if ((layerQueue[i]!="")&&(layerQueue[i]!=layerName))
{
tmpQueue [++newIndex] = layerQueue[i]
hideElement( 'SELECT', document.getElementById(layerQueue[i]) );
hideElement( 'APPLET', document.getElementById(layerQueue[i]) );
}
}
layerQueue = tmpQueue
layerIndex = newIndex
}
function lw_closeAllLayers() {
while (layerIndex >= 0)
{
lw_hideLayer()
}
}
function lw_closeLastLayer() {
if (layerIndex >= 0)
{
while ((lw_getObj(layerQueue[layerIndex]).visibility!="visible") && (layerIndex>0))
{
layerIndex--;
}
lw_hideLayer()
}
}
function lw_escLayer (e) {
if (navigator.appName=="Netscape")
{
var keyCode = e.keyCode?e.keyCode:e.which?e.which:e.charCode;
if ((keyCode==27)||(keyCode==1))
{
lw_closeLastLayer()
}
}
else
if ((event.keyCode==0)||(event.keyCode==27))
{
lw_closeLastLayer()
}
}
var lw_leftpos = 0
var lw_toppos = 0
var lw_width = 0
var lw_height = 0
function lw_calcpos(obj) {
lw_leftpos=0
lw_toppos=0
lw_width = obj.offsetWidth
lw_height = obj.offsetHeight
var aTag = obj
do {
lw_leftpos += aTag.offsetLeft;
lw_toppos += aTag.offsetTop;
aTag = aTag.offsetParent;
} while(aTag.tagName!="BODY");
}
document.onkeypress = lw_escLayer;
document.onclick = lw_closeAllLayers;
+376
View File
@@ -0,0 +1,376 @@
// written by Tan Ling Wee
// last updated 20 June 2003
// email : fuushikaden@yahoo.com
var orientation=0 // 0-horizontal 1-vertical
var imgPath = "js/"
var mainItemForeground = "#000000"
var mainItemBorder = "#f0f0f0"
var mainItemBackground = "#f0f0f0"
var mainItemHoverForeground = "#000000"
var mainItemHoverBorder = "#a0a0a0"
var mainItemHoverBackground = "#d0d0d0"
var subItemForeground = "#000000"
var subItemBorder = "#ffffff"
var subItemBackground = "#ffffff"
var subItemHoverForeground = "#000000"
var subItemHoverBorder = "#a0a0a0"
var subItemHoverBackground = "#d0d0d0"
var menuFont = "verdana"
var menuSize = "11px"
/////////////////////////////////////////////////////////////////////////////
var ie=(navigator.appName=='Microsoft Internet Explorer')
var ns=(navigator.appName=='Netscape')
var dom=document.getElementById
var lw_menuId, lw_trigger, to1
var s1
/////////////////////////////////////////////////////////////////////////////
function Tmenu (id, parentId, url, description, img) {
this.id = id
this.parentId = parentId
this.url = url
this.description = description
this.numChild = 0
this.levelId = 0
this.img = img
}
/////////////////////////////////////////////////////////////////////////////
var menu = new Array()
var menuCounter = 0
var numLevel = 0
var prevMenuId = -1
var nNowAt = 0
function displayMenuItem(menuId) {
var sHTML
if (menu[menuId].parentId>0)
{
ItemForeground = subItemForeground
Border = subItemBorder
Background = subItemBackground
HoverForeground = subItemHoverForeground
HoverBorder = subItemHoverBorder
HoverBackground = subItemHoverBackground
}
else
{
ItemForeground = mainItemForeground
Border = mainItemBorder
Background = mainItemBackground
HoverForeground = mainItemHoverForeground
HoverBorder = mainItemHoverBorder
HoverBackground = mainItemHoverBackground
}
if ((orientation==1)||(menu[menuId].levelId>0))
{
sHTML += "<tr>"
}
if (menu[menuId].description!='-')
{
sHTML = "<td valign='top' id='menu_"+menuId+"' style='cursor:pointer;cursor:hand;border-style:solid;border-width:1px;background-color:"+ Background +";color=\""+ ItemForeground +"\";border-color:"+ Border +"' onmouseover='clearInterval(s1);this.style.backgroundColor=\"" + HoverBackground + "\";this.style.color=\"" + HoverForeground + "\";this.style.borderColor=\"" + HoverBorder + "\";"
if (menu[menuId].numChild!=0) {
sHTML += "showSubmenu("+menu[menuId].id+",this);hideSubmenu(menu["+menuId+"].levelId+1);"
}
else
{
sHTML += "prevMenuId = "+menuId+";hideSubmenu(menu["+menuId+"].levelId);"
}
sHTML += ";nNowAt="+menuId+";clearAll("+menu[menuId].levelId+","+menu[menuId].parentId+")' onclick='document.location.href=\""+menu[menuId].url+"\"' onmouseout='s1=setInterval(\"resetMenu();hideSubmenu(0)\",1000);'><table cellpadding=0 cellspacing=0 border=0 width='100%'><tr>"
if (menu[menuId].levelId>0)
{
sHTML += "<td valign='bottom' style='padding-left:3px' width=20><img src='"
if (menu[menuId].img=="")
{
sHTML += imgPath + "trans.gif"
}
else
{
sHTML += imgPath + menu[menuId].img
}
sHTML += "' width=16 height=16 border=0></td>"
}
if ((orientation==0) && (menu[menuId].levelId==0))
{
nArrowWidth = 0
}
else
{
nArrowWidth = 25
}
sHTML += "<td valign='bottom' style='padding-left:5px;padding-right:5px' align=left>" + menu[menuId].description.replace(" ","&nbsp;") + "</td><td style='padding-right:2px' align=right width="+nArrowWidth+">"
if (menu[menuId].numChild>0)
{
if ((orientation==0)&&(menu[menuId].levelId==0))
{
sHTML += "<img src='" + imgPath + "arrow_down.gif'>"
}
else
{
sHTML += "<img src='" + imgPath + "arrow_right.gif'>"
}
}
else
{
sHTML += "&nbsp;"
}
sHTML += "</td></tr></table></td>"
}
else
{
sHTML = "<td valign='bottom'><img src='" + imgPath + "trans.gif' height=2></td></tr><tr><td onmouseover='' bgcolor='#d0d0d0'><img src='" + imgPath + "trans.gif' height=1></td></tr><tr><td><img src='" + imgPath + "trans.gif' height=2></td>"
}
if ((orientation==1)||(menu[menuId].levelId>0))
{
sHTML += "</tr>"
}
return sHTML
}
function clearAll(levelId, parentId) {
if (levelId>0)
{
Border = subItemBorder
Background = subItemBackground
}
else
{
Border = mainItemBorder
Background = mainItemBackground
}
for (i=0;i<menuCounter;i++)
{
if (menu[i].levelId==levelId)
{
if ((i!=nNowAt) && (menu[i].parentId==parentId) && (menu[i].description!="-")) {
lw_getObj("menu_"+i).backgroundColor=Background;
lw_getObj("menu_"+i).borderColor=Border
}
}
}
}
function mapID (id) {
for (var i=0;i<menuCounter;i++)
{
if (menu[i].id==id)
{
return i
}
}
return -1
}
function showSubmenu(menuId,trigger) {
lw_menuId = menuId
lw_trigger = trigger
if (ns)
{
to1 = setTimeout("showActualSubmenu(lw_menuId,lw_trigger)",50)
}
else
{
showActualSubmenu(lw_menuId,lw_trigger)
}
}
function showActualSubmenu(menuId,trigger) {
var nLevel = 0
var leftpos = 0
var nIndex=0
if (menuId>0)
{
lw_calcpos(trigger)
for (var i=0;i<menuCounter;i++)
{
if (menu[i].id==menuId)
{
nLevel = menu[i].levelId
nIndex = i
}
}
if ((orientation==1)||(menu[nIndex].parentId>0))
{
lw_getObj("menu_level_"+nLevel).top=lw_toppos
leftpos = lw_leftpos + lw_width + 5
if (nLevel==0) {
leftpos -= 3
}
}
else {
lw_getObj("menu_level_"+nLevel).top = lw_toppos + lw_height + 2
leftpos = lw_leftpos
}
lw_getObj("menu_level_"+nLevel).left=leftpos
sHTML = "<table cellpadding=0 cellspacing=0 border=1>"
for (var i=0;i<menuCounter;i++)
{
if (menu[i].parentId==menuId)
{
sHTML += displayMenuItem (i)
}
}
sHTML += "</table>"
document.getElementById("menu_level_"+nLevel+"_content").innerHTML=sHTML
lw_showLayer('menu_level_'+nLevel)
}
}
function hideSubmenu(levelId) {
for (var cnt=levelId; cnt<numLevel; cnt++)
{
lw_hideLayerName("menu_level_"+cnt)
}
}
function DrawMenu () {
for (var i=0; i<numLevel ; i++)
{
lw_createLayer("menu_level_"+i,0,0,0,0,"#ffffff","#d0d0d0",100)
}
sHTML="<table width=100% cellpadding=2 cellspacing=0>"
for (var i=0; i<menuCounter; i++)
{
if (menu[i].parentId==0)
{
sHTML += displayMenuItem (i)
}
else if (menu[i].parentId==-1)
{
sHTML += "<tr><td valign='top'><img src='trans' height=2></td></tr><tr bgcolor='"+mainItemBackground+"'><td style='padding:5px'><b>" + menu[i].description + "</b></td></tr>"
}
}
sHTML += "</table>"
document.writeln(sHTML)
}
function getLevel (menuId) {
var pId=menuId
var nLevel=0
while (pId!=0)
{
nLevel++
for (var i=0;i<menuCounter;i++)
{
if (menu[i].id==pId)
{
pId = menu[i].parentId
}
}
}
return nLevel
}
function AddMenuItem (id, parentId, url, description, img) {
menu[menuCounter++] = new Tmenu (id, parentId, url, description, img)
if (parentId>0)
{
for (i=0;i<menuCounter;i++)
{
if (menu[i].id==parentId)
{
menu[i].numChild++
}
}
menu[menuCounter-1].levelId = getLevel(parentId)
if ( numLevel < menu[menuCounter-1].levelId)
{
numLevel = menu[menuCounter-1].levelId
}
}
else if (parentId==0)
{
menu[menuCounter-1].levelId = 0
}
else
{
menu[menuCounter-1].levelId = -1
}
}
function handleonclick() {
if (ns)
{
lw_closeAllLayers()
}
else
{
lw_closeAllLayers(event)
}
resetMenu()
}
function handlekeypress(e) {
if (ns)
{
var keyCode = e.keyCode?e.keyCode:e.which?e.which:e.charCode;
if ((keyCode==27)||(keyCode==1))
{
handleonclick()
}
}
else
if ((event.keyCode==0)||(event.keyCode==27))
{
handleonclick()
}
resetMenu()
}
function resetMenu () {
for (i=0;i<menuCounter;i++)
{
if (menu[i].levelId==0)
{
lw_getObj("menu_"+i).backgroundColor=mainItemBackground
lw_getObj("menu_"+i).borderColor=mainItemBorder
}
}
}
document.onkeypress = handlekeypress
document.onclick = handleonclick
+637
View File
@@ -0,0 +1,637 @@
// written by Tan Ling Wee on 2 Dec 2001
// last updated 20 June 2003
// email : fuushikaden@yahoo.com
var fixedX = -1 // x position (-1 if to appear below control)
var fixedY = -1 // y position (-1 if to appear below control)
var startAt = 1 // 0 - sunday ; 1 - monday
var showWeekNumber = 1 // 0 - don't show; 1 - show
var showToday = 1 // 0 - don't show; 1 - show
var imgDir = "/images/" // directory for images ... e.g. var imgDir="/img/"
var gotoString = "Go To Current Month"
var todayString = "Today is"
var weekString = "Wk"
var scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."
var scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."
var selectMonthMessage = "Click to select a month."
var selectYearMessage = "Click to select a year."
var selectDateMessage = "Select [date] as date." // do not replace [date], it will be replaced by date.
var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear
var bPageLoaded=false
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var today = new Date()
var dateNow = today.getDate()
var monthNow = today.getMonth()
var yearNow = today.getYear()
var imgsrc = new Array("caldrop.png","caldrop.png","calleft.png","calleft.png","calright.png","calright.png")
var img = new Array()
var bShow = false;
/* hides <select> and <applet> objects (for IE only) */
function hideElement( elmID, overDiv )
{
if( ie )
{
for( i = 0; i < document.all.tags( elmID ).length; i++ )
{
obj = document.all.tags( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}
// Find the element's offsetTop and offsetLeft relative to the BODY tag.
objLeft = obj.offsetLeft;
objTop = obj.offsetTop;
objParent = obj.offsetParent;
while( objParent.tagName.toUpperCase() != "BODY" )
{
objLeft += objParent.offsetLeft;
objTop += objParent.offsetTop;
objParent = objParent.offsetParent;
}
objHeight = obj.offsetHeight;
objWidth = obj.offsetWidth;
if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
else if( overDiv.offsetTop >= ( objTop + objHeight ));
else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
else
{
obj.style.visibility = "hidden";
}
}
}
}
/*
* unhides <select> and <applet> objects (for IE only)
*/
function showElement( elmID )
{
if( ie )
{
for( i = 0; i < document.all.tags( elmID ).length; i++ )
{
obj = document.all.tags( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}
obj.style.visibility = "";
}
}
}
function HolidayRec (d, m, y, desc)
{
this.d = d
this.m = m
this.y = y
this.desc = desc
}
var HolidaysCounter = 0
var Holidays = new Array()
function addHoliday (d, m, y, desc)
{
Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc )
}
if (dom)
{
for (i=0;i<imgsrc.length;i++)
{
img[i] = new Image
img[i].src = imgDir + imgsrc[i]
}
document.write ("<div onclick='bShow=true' id='calendar' style='z-index:+999;position:absolute;visibility:hidden;'><table width="+((showWeekNumber==1)?250:220)+" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#287FB5;font-family:arial; font-size:11px}' bgcolor='#FFFFFF'><tr class='calmenubar'><td valign='top'><table border='0' cellpadding='0' cellspacing='0' width='"+((showWeekNumber==1)?248:218)+"'><tr><td valign='middle' style='font-family:arial; font-size:11px;'><font color='#287FB5' class='menubartxt'><B><span id='caption'></span></B></font></td><td align=right valign='middle'><input type='button' class='btn' onclick='javascript:hideCalendar();' name='x' value='x'></td></tr></table></td></tr><tr><td style='padding:0px' bgcolor=#ffffff><span id='content'></span></td></tr>")
//document.write ("<div onclick='bShow=true' id='calendar' style='z-index:+999;position:absolute;visibility:hidden;'><table width="+((showWeekNumber==1)?250:220)+" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#a0a0a0;font-family:arial; font-size:11px}' bgcolor='#ffffff'><tr bgcolor='#FF00aa' class='calmenubar'><td valign='top'><table cellpadding='0' cellspacing='0' width='"+((showWeekNumber==1)?248:218)+"'><tr><td style='padding:1px;font-family:arial; font-size:11px;'><font color='#ffffff' class='menubartxt'><B><span id='caption'></span></B></font></td><td align=right><a href='javascript:hideCalendar()'><IMG SRC='"+imgDir+"close.gif' WIDTH='10' HEIGHT='10' BORDER='0' ALT='Close the Calendar'></a></td></tr></table></td></tr><tr><td style='padding:0px' bgcolor=#ffffff><span id='content'></span></td></tr>")
if (showToday==1)
{
//bottom background
document.write ("<tr bgcolor=#f0f0f0><td style='padding:5px' align=center><span id='lblToday'></span></td></tr>")
}
document.write ("</table></div><div id='selectMonth' style='z-index:+999;position:absolute;visibility:hidden;'></div><div id='selectYear' style='z-index:+999;position:absolute;visibility:hidden;'></div>");
}
var monthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var monthName2 = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC")
if (startAt==0)
{
dayName = new Array ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
}
else
{
dayName = new Array ("Mon","Tue","Wed","Thu","Fri","Sat","Sun")
}
var styleAnchor="text-decoration:none;color:black;"
var styleLightBorder="border-style:solid;border-width:1px;border-color:#a0a0a0;"
function swapImage(srcImg, destImg){
if (ie) { document.getElementById(srcImg).setAttribute("src",imgDir + destImg) }
}
function init() {
if (!ns4)
{
if (!ie) { yearNow += 1900 }
crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar
hideCalendar()
crossMonthObj=(dom)?document.getElementById("selectMonth").style : ie? document.all.selectMonth : document.selectMonth
crossYearObj=(dom)?document.getElementById("selectYear").style : ie? document.all.selectYear : document.selectYear
monthConstructed=false;
yearConstructed=false;
if (showToday==1)
{
document.getElementById("lblToday").innerHTML = todayString + " <a onmousemove='window.status=\""+gotoString+"\"' onmouseout='window.status=\"\"' title='"+gotoString+"' style='"+styleAnchor+"' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'>"+dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)]+", " + dateNow + " " + monthName[monthNow].substring(0,3) + " " + yearNow + "</a>"
}
sHTML1="<span id='spanLeft' style='border-style:solid;border-width:0;border-color:#D3DCE4;cursor:pointer' onmouseover='swapImage(\"changeLeft\",\"calleft.png\");window.status=\""+scrollLeftMessage+"\"' onclick='javascript:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\"changeLeft\",\"calleft.png\");window.status=\"\"' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartDecMonth()\",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeLeft' SRC='"+imgDir+"calleft.png' BORDER=0>&nbsp</span>&nbsp;"
sHTML1+="<span id='spanRight' style='border-style:solid;border-width:0;border-color:#D3DCE4;cursor:pointer' onmouseover='swapImage(\"changeRight\",\"calright.png\");window.status=\""+scrollRightMessage+"\"' onmouseout='clearInterval(intervalID1);swapImage(\"changeRight\",\"calright.png\");window.status=\"\"' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartIncMonth()\",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeRight' SRC='"+imgDir+"calright.png' BORDER=0>&nbsp</span>&nbsp"
sHTML1+="<span id='spanMonth' style='border-style:solid;border-width:0;border-color:#D3DCE4;cursor:pointer' onmouseover='swapImage(\"changeMonth\",\"caldrop.png\");window.status=\""+selectMonthMessage+"\"' onmouseout='swapImage(\"changeMonth\",\"caldrop.png\");window.status=\"\"' onclick='popUpMonth()'></span>&nbsp;"
sHTML1+="<span id='spanYear' style='border-style:solid;border-width:0;border-color:#D3DCE4;cursor:pointer' onmouseover='swapImage(\"changeYear\",\"caldrop.png\");window.status=\""+selectYearMessage+"\"' onmouseout='swapImage(\"changeYear\",\"caldrop.png\");window.status=\"\"' onclick='popUpYear()'></span>&nbsp;"
document.getElementById("caption").innerHTML = sHTML1
bPageLoaded=true
}
}
function hideCalendar() {
crossobj.visibility="hidden"
if (crossMonthObj != null){crossMonthObj.visibility="hidden"}
if (crossYearObj != null){crossYearObj.visibility="hidden"}
showElement( 'SELECT' );
showElement( 'APPLET' );
}
function padZero(num) {
return (num < 10)? '0' + num : num ;
}
function constructDate(d,m,y)
{
sTmp = dateFormat
sTmp = sTmp.replace ("dd","<e>")
sTmp = sTmp.replace ("d","<d>")
sTmp = sTmp.replace ("<e>",padZero(d))
sTmp = sTmp.replace ("<d>",d)
sTmp = sTmp.replace ("mmmm","<p>")
sTmp = sTmp.replace ("mmm","<o>")
sTmp = sTmp.replace ("mm","<n>")
sTmp = sTmp.replace ("m","<m>")
sTmp = sTmp.replace ("<m>",m+1)
sTmp = sTmp.replace ("<n>",padZero(m+1))
sTmp = sTmp.replace ("<o>",monthName[m])
sTmp = sTmp.replace ("<p>",monthName2[m])
sTmp = sTmp.replace ("yyyy",y)
return sTmp.replace ("yy",padZero(y%100))
}
function closeCalendar() {
var sTmp
hideCalendar();
ctlToPlaceValue.value = constructDate(dateSelected,monthSelected,yearSelected)
}
/*** Month Pulldown ***/
function StartDecMonth()
{
intervalID1=setInterval("decMonth()",80)
}
function StartIncMonth()
{
intervalID1=setInterval("incMonth()",80)
}
function incMonth () {
monthSelected++
if (monthSelected>11) {
monthSelected=0
yearSelected++
}
constructCalendar()
}
function decMonth () {
monthSelected--
if (monthSelected<0) {
monthSelected=11
yearSelected--
}
constructCalendar()
}
function constructMonth() {
popDownYear()
if (!monthConstructed) {
sHTML = ""
for (i=0; i<12; i++) {
sName = monthName[i];
if (i==monthSelected){
sName = "<B>" + sName + "</B>"
}
sHTML += "<tr><td id='m" + i + "' onmouseover='this.style.backgroundColor=\"#D3DCE4\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='monthConstructed=false;monthSelected=" + i + ";constructCalendar();popDownMonth();event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
}
document.getElementById("selectMonth").innerHTML = "<table width=70 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#F1F4F6' cellspacing=0 onmouseover='clearTimeout(timeoutID1)' onmouseout='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"popDownMonth()\",100);event.cancelBubble=true'>" + sHTML + "</table>"
monthConstructed=true
}
}
function popUpMonth() {
constructMonth()
crossMonthObj.visibility = (dom||ie)? "visible" : "show"
crossMonthObj.left = parseInt(crossobj.left) + 50
crossMonthObj.top = parseInt(crossobj.top) + 26
hideElement( 'SELECT', document.getElementById("selectMonth") );
hideElement( 'APPLET', document.getElementById("selectMonth") );
}
function popDownMonth() {
crossMonthObj.visibility= "hidden"
}
/*** Year Pulldown ***/
function incYear() {
for (i=0; i<7; i++){
newYear = (i+nStartingYear)+1
if (newYear==yearSelected)
{ txtYear = "&nbsp;<B>" + newYear + "</B>&nbsp;" }
else
{ txtYear = "&nbsp;" + newYear + "&nbsp;" }
document.getElementById("y"+i).innerHTML = txtYear
}
nStartingYear ++;
bShow=true
}
function decYear() {
for (i=0; i<7; i++){
newYear = (i+nStartingYear)-1
if (newYear==yearSelected)
{ txtYear = "&nbsp;<B>" + newYear + "</B>&nbsp;" }
else
{ txtYear = "&nbsp;" + newYear + "&nbsp;" }
document.getElementById("y"+i).innerHTML = txtYear
}
nStartingYear --;
bShow=true
}
function selectYear(nYear) {
yearSelected=parseInt(nYear+nStartingYear);
yearConstructed=false;
constructCalendar();
popDownYear();
}
function constructYear() {
popDownMonth()
sHTML = ""
if (!yearConstructed) {
sHTML = "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#D3DCE4\"' onmouseout='clearInterval(intervalID1);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID1);intervalID1=setInterval(\"decYear()\",30)' onmouseup='clearInterval(intervalID1)'>-</td></tr>"
j = 0
nStartingYear = yearSelected-3
for (i=(yearSelected-3); i<=(yearSelected+3); i++) {
sName = i;
if (i==yearSelected){
sName = "<B>" + sName + "</B>"
}
sHTML += "<tr><td id='y" + j + "' onmouseover='this.style.backgroundColor=\"#D3DCE4\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='selectYear("+j+");event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
j ++;
}
sHTML += "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#D3DCE4\"' onmouseout='clearInterval(intervalID2);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID2);intervalID2=setInterval(\"incYear()\",30)' onmouseup='clearInterval(intervalID2)'>+</td></tr>"
document.getElementById("selectYear").innerHTML = "<table width=44 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#F1F4F6' onmouseover='clearTimeout(timeoutID2)' onmouseout='clearTimeout(timeoutID2);timeoutID2=setTimeout(\"popDownYear()\",100)' cellspacing=0>" + sHTML + "</table>"
yearConstructed = true
}
}
function popDownYear() {
clearInterval(intervalID1)
clearTimeout(timeoutID1)
clearInterval(intervalID2)
clearTimeout(timeoutID2)
crossYearObj.visibility= "hidden"
}
function popUpYear() {
var leftOffset
constructYear()
crossYearObj.visibility = (dom||ie)? "visible" : "show"
leftOffset = parseInt(crossobj.left) + document.getElementById("spanYear").offsetLeft
if (ie)
{
leftOffset += 6
}
crossYearObj.left = leftOffset
crossYearObj.top = parseInt(crossobj.top) + 26
}
/*** calendar ***/
function WeekNbr(n) {
// Algorithm used:
// From Klaus Tondering's Calendar document (The Authority/Guru)
// hhtp://www.tondering.dk/claus/calendar.html
// a = (14-month) / 12
// y = year + 4800 - a
// m = month + 12a - 3
// J = day + (153m + 2) / 5 + 365y + y / 4 - y / 100 + y / 400 - 32045
// d4 = (J + 31741 - (J mod 7)) mod 146097 mod 36524 mod 1461
// L = d4 / 1460
// d1 = ((d4 - L) mod 365) + L
// WeekNumber = d1 / 7 + 1
year = n.getFullYear();
month = n.getMonth() + 1;
if (startAt == 0) {
day = n.getDate() + 1;
}
else {
day = n.getDate();
}
a = Math.floor((14-month) / 12);
y = year + 4800 - a;
m = month + 12 * a - 3;
b = Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400);
J = day + Math.floor((153 * m + 2) / 5) + 365 * y + b - 32045;
d4 = (((J + 31741 - (J % 7)) % 146097) % 36524) % 1461;
L = Math.floor(d4 / 1460);
d1 = ((d4 - L) % 365) + L;
week = Math.floor(d1/7) + 1;
return week;
}
function constructCalendar () {
var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)
var dateMessage
var startDate = new Date (yearSelected,monthSelected,1)
var endDate
if (monthSelected==1)
{
endDate = new Date (yearSelected,monthSelected+1,1);
endDate = new Date (endDate - (24*60*60*1000));
numDaysInMonth = endDate.getDate()
}
else
{
numDaysInMonth = aNumDays[monthSelected];
}
datePointer = 0
dayPointer = startDate.getDay() - startAt
if (dayPointer<0)
{
dayPointer = 6
}
sHTML = "<table border=0 style='font-family:verdana;font-size:10px;'><tr>"
if (showWeekNumber==1)
{
sHTML += "<td width=27><b>" + weekString + "</b></td><td width=1 rowspan=7 bgcolor='#d0d0d0' style='padding:0px'><img src='"+imgDir+"divider.gif' width=1></td>"
}
for (i=0; i<7; i++) {
sHTML += "<td width='27' align='right'><B>"+ dayName[i]+"</B></td>"
}
sHTML +="</tr><tr>"
if (showWeekNumber==1)
{
sHTML += "<td align=right>" + WeekNbr(startDate) + "&nbsp;</td>"
}
for ( var i=1; i<=dayPointer;i++ )
{
sHTML += "<td>&nbsp;</td>"
}
for ( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )
{
dayPointer++;
sHTML += "<td align=right>"
sStyle=styleAnchor
if ((datePointer==odateSelected) && (monthSelected==omonthSelected) && (yearSelected==oyearSelected))
{ sStyle+=styleLightBorder }
sHint = ""
for (k=0;k<HolidaysCounter;k++)
{
if ((parseInt(Holidays[k].d)==datePointer)&&(parseInt(Holidays[k].m)==(monthSelected+1)))
{
if ((parseInt(Holidays[k].y)==0)||((parseInt(Holidays[k].y)==yearSelected)&&(parseInt(Holidays[k].y)!=0)))
{
sStyle+="background-color:#FFDDDD;"
sHint+=sHint==""?Holidays[k].desc:"\n"+Holidays[k].desc
}
}
}
var regexp= /\"/g
sHint=sHint.replace(regexp,"&quot;")
dateMessage = "onmousemove='window.status=\""+selectDateMessage.replace("[date]",constructDate(datePointer,monthSelected,yearSelected))+"\"' onmouseout='window.status=\"\"' "
if ((datePointer==dateNow)&&(monthSelected==monthNow)&&(yearSelected==yearNow))
{ sHTML += "<b><a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer+";closeCalendar();'><font color=#ff0000>&nbsp;" + datePointer + "</font>&nbsp;</a></b>"}
else if (dayPointer % 7 == (startAt * -1)+1)
{ sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;</a>" }
else
{ sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;" + datePointer + "&nbsp;</a>" }
sHTML += ""
if ((dayPointer+startAt) % 7 == startAt) {
sHTML += "</tr><tr>"
if ((showWeekNumber==1)&&(datePointer<numDaysInMonth))
{
sHTML += "<td align=right>" + (WeekNbr(new Date(yearSelected,monthSelected,datePointer+1))) + "&nbsp;</td>"
}
}
}
document.getElementById("content").innerHTML = sHTML
document.getElementById("spanMonth").innerHTML = "&nbsp;" + monthName[monthSelected] + "&nbsp;<IMG id='changeMonth' SRC='"+imgDir+"caldrop.png' BORDER=0>"
document.getElementById("spanYear").innerHTML = "&nbsp;" + yearSelected + "&nbsp;<IMG id='changeYear' SRC='"+imgDir+"caldrop.png' BORDER=0>"
}
function popUpCalendar(ctl, ctl2, format) {
var leftpos=0
var toppos=0
if (bPageLoaded)
{
if ( crossobj.visibility == "hidden" ) {
ctlToPlaceValue = ctl2
dateFormat=format;
formatChar = " "
aFormat = dateFormat.split(formatChar)
if (aFormat.length<3)
{
formatChar = "/"
aFormat = dateFormat.split(formatChar)
if (aFormat.length<3)
{
formatChar = "."
aFormat = dateFormat.split(formatChar)
if (aFormat.length<3)
{
formatChar = "-"
aFormat = dateFormat.split(formatChar)
if (aFormat.length<3)
{
// invalid date format
formatChar=""
}
}
}
}
tokensChanged = 0
if ( formatChar != "" )
{
// use user's date
aData = ctl2.value.split(formatChar)
for (i=0;i<3;i++)
{
if ((aFormat[i]=="d") || (aFormat[i]=="dd"))
{
dateSelected = parseInt(aData[i], 10)
tokensChanged ++
}
else if ((aFormat[i]=="m") || (aFormat[i]=="mm"))
{
monthSelected = parseInt(aData[i], 10) - 1
tokensChanged ++
}
else if (aFormat[i]=="yyyy")
{
yearSelected = parseInt(aData[i], 10)
tokensChanged ++
}
else if (aFormat[i]=="mmm")
{
for (j=0; j<12; j++)
{
if (aData[i]==monthName[j])
{
monthSelected=j
tokensChanged ++
}
}
}
else if (aFormat[i]=="mmmm")
{
for (j=0; j<12; j++)
{
if (aData[i]==monthName2[j])
{
monthSelected=j
tokensChanged ++
}
}
}
}
}
if ((tokensChanged!=3)||isNaN(dateSelected)||isNaN(monthSelected)||isNaN(yearSelected))
{
dateSelected = dateNow
monthSelected = monthNow
yearSelected = yearNow
}
odateSelected=dateSelected
omonthSelected=monthSelected
oyearSelected=yearSelected
aTag = ctl
do {
aTag = aTag.offsetParent;
leftpos += aTag.offsetLeft;
toppos += aTag.offsetTop;
} while(aTag.tagName!="BODY");
crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos : fixedX
crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 : fixedY
constructCalendar (1, monthSelected, yearSelected);
crossobj.visibility=(dom||ie)? "visible" : "show"
hideElement( 'SELECT', document.getElementById("calendar") );
hideElement( 'APPLET', document.getElementById("calendar") );
bShow = true;
}
else
{
hideCalendar()
if (ctlNow!=ctl) {popUpCalendar(ctl, ctl2, format)}
}
ctlNow = ctl
}
}
document.onkeypress = function hidecal1 () {
if (event.keyCode==27)
{
hideCalendar()
}
}
document.onclick = function hidecal2 () {
if (!bShow)
{
hideCalendar()
}
bShow = false
}
if(ie)
{
init()
}
else
{
window.onload=init
}
+108
View File
@@ -0,0 +1,108 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
$pathtofonts = "/captcha/fonts/"; //path from the root of the website
/*
//How to use this Captcha
//Option1: add this to the html form
<table width='100%' border='0' cellpadding="3" cellspacing="0">
<tr>
<td colspan='2'>Please type the code you see from the image into the text box below.</td>
</tr>
<tr>
<td align='right'><img src='/captcha/img.php'></td>
<td align='right'><input type="text" name="captcha" size="15"></td>
</tr>
</table>
//Option2: or add this to the html form
<br>
<script language="JavaScript" type="text/javascript">
function genNewCaptcha(imgObj) {
var randnum = Math.floor((1-1000)*Math.random()+1000);
imgObj.src='/captcha/img.php?x=' + randnum;
}
</script>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="center" colspan="2" style="font-size: 11px;">Please enter the text you see from the image below...</td>
</tr>
<tr>
<td align="center" valign="bottom" width="50%"><img id="captchaimg" src="/captcha/img.php" onclick="genNewCaptcha(this); document.getElementById('captcha').focus();" onmouseover="this.style.cursor='hand';" alt="Click for a new image."></td>
<td align="center" valign="bottom" width="50%"><input type="text" class="txt" style="text-align: center;" name="captcha" id="captcha" size="15" style="margin-top: 15px;"></td>
</tr>
<td align="center" colspan="2" style="font-size: 9px;"><br>Can't read the image text? Click the image for a new one.</td>
</table>
<br>
//add this to the top of the page where the form is submitted to
//--- begin captcha verification ---------------------
//session_start(); //make sure sessions are started
if (strtolower($_SESSION["captcha"]) != strtolower($_REQUEST["captcha"]) || strlen($_SESSION["captcha"]) == 0) {
echo " <span class=\"h2\">Sorry!</span>\n";
//echo " <br><br>\n";
//echo "\n";
//echo " <b>Your e-mail was NOT sent.</b>\n";
echo " <br><br>\n";
echo " <b>Error: <span style=\"color: red;\">Captcha Image Verification Failed</span></b><br>\n";
echo " <img src=\"/images/spacer.gif\" width=\"325\" height=\"1\" border=\"0\">\n";
echo " <br><br>\n";
echo " <a href=\"contact.php\">Try Again?</a>";
exit;
}
else {
//echo "verified";
}
//--- end captcha verification -----------------------
//notes
A diverse collection of unique fonts can improve the captcha.
If bots get past the captcha try changing fonts.
Ideas that may be implemented in the future...
1. randomize the background with texture, color and/or gradient
2. distort the image
3. rotate the characters with different rotations.
4. use audio, svg, or flash
//additional fonts can be obtained from
http://simplythebest.net/fonts/
http://www.1001freefonts.com/afonts.htm
//Usefull Links
http://sam.zoy.org/pwntcha/
http://en.wikipedia.org/wiki/Captcha
*/
?>
Binary file not shown.
Binary file not shown.
Binary file not shown.
+123
View File
@@ -0,0 +1,123 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "config.php";
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
session_start();
// Captcha verification image -----------------------
// Description this page is used to verify the captcha
$_SESSION["captcha"] = substr(md5(date('r')), 0, 6);
$text = $_SESSION["captcha"];
//echo $text;
exit;
function isfile($filename) {
if (@filesize($filename) > 0) { return true; } else { return false; }
}
function dircontents($dir) {
clearstatcache();
$htmldirlist = '';
$htmlfilelist = '';
$dirlist = opendir($dir);
while ($file = readdir ($dirlist)) {
if ($file != '.' && $file != '..') {
$newpath = $dir.'/'.$file;
$level = explode('/',$newpath);
if (is_dir($newpath)) {
//do nothing
}
else {
$mod_array[] = end($level);
}
}
}
closedir($dirlist);
return $mod_array;
}
$fontarray = dircontents($pathtofonts);
//print_r($fontarray);
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$random = (rand()%count($fontarray));
$font = $pathtofonts.$fontarray[$random];
//echo $font;
//echo phpinfo();
//exit;
$fontsize = 16;
if(@$_GET['fontsize']) {
$fontsize = $_GET['fontsize'];
}
//picked up from a note at http://www.php.net/imagettfbbox
function imagettfbbox_custom($size, $angle, $font, $text) {
$dummy = imagecreate(1, 1);
$black = imagecolorallocate($dummy, 0, 0, 0);
$bbox = imagettftext($dummy, $size, $angle, 0, 0, $black, $font, $text);
imagedestroy($dummy);
return $bbox;
}
// Create the image
$size = imagettfbbox_custom($fontsize, 0, $font, $text);
$width = $size[2] + $size[0] + 8;
$height = abs($size[1]) + abs($size[7]);
//$width = 200;
//$height = 200;
$im = imagecreate($width, $height);
$colourBlack = imagecolorallocate($im, 255, 255, 255);
imagecolortransparent($im, $colourBlack);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// Add the text
imagefttext($im, $fontsize, 0, 0, abs($size[5]), $black, $font, $text);
// Set the content-type
header("Content-type: image/png");
// Using imagepng() results in clearer text compared with
imagepng($im);
imagedestroy($im);
?>
+48
View File
@@ -0,0 +1,48 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
define('PROJECT_PATH', '/fusionpbx');
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
define('PROJECT_PATH', '');
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>
+159
View File
@@ -0,0 +1,159 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "includes/require.php";
session_start();
//if the username session is not set the check username and password
if (strlen($_SESSION["username"]) == 0) {
//clear the menu
$_SESSION["menu"] = "";
//clear the template only if the template has not been assigned by the superadmin
if (strlen($_SESSION['domain']['template']['name']) == 0) {
$_SESSION["template_content"] = '';
}
//if the username from the form is not provided then send to login.php
if (strlen(check_str($_REQUEST["username"])) == 0) {
$php_self = $_SERVER["PHP_SELF"];
$msg = "username required";
header("Location: ".PROJECT_PATH."/login.php?path=".urlencode($php_self)."&msg=".urlencode($msg));
exit;
}
//check the username and password if they don't match then redirect to the login
$sql = "select * from v_users ";
$sql .= "where domain_uuid=:domain_uuid ";
$sql .= "and username=:username ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':domain_uuid', $domain_uuid);
$prep_statement->bindParam(':username', check_str($_REQUEST["username"]));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
$auth_failed = true;
}
else {
foreach ($result as &$row) {
//get the salt from the database
$salt = $row["salt"];
//if salt is not defined then use the default salt for backwards compatibility
if (strlen($salt) == 0) {
$salt = 'e3.7d.12';
}
//compare the password provided by the user with the one in the database
if (md5($salt.check_str($_REQUEST["password"])) != $row["password"]) {
$auth_failed = true;
}
//end the loop
break;
}
}
if ($auth_failed) {
//log the failed auth attempt to the system, to be available for fail2ban.
openlog('FusionPBX', LOG_NDELAY, LOG_AUTH);
syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] authentication failed for ".$_REQUEST["username"]);
closelog();
//redirect the user to the login page
$php_self = $_SERVER["PHP_SELF"];
$msg = "incorrect account information";
header("Location: ".PROJECT_PATH."/login.php?path=".urlencode($php_self)."&msg=".urlencode($msg));
exit;
}
$_SESSION["username"] = check_str($_REQUEST["username"]);
foreach ($result as &$row) {
//allow the user to choose a template only if the template has not been assigned by the superadmin
if (strlen($_SESSION['domain']['template']['name']) == 0) {
$_SESSION['domain']['template']['name'] = $row["user_template_name"];
}
$_SESSION["time_zone"]["user"] = '';
if (strlen($row["user_time_zone"]) > 0) {
//user defined time zone
$_SESSION["time_zone"]["user"] = $row["user_time_zone"];
}
// add the user_uuid to the session
$_SESSION['user_uuid'] = $row['user_uuid'];
break;
}
//echo "username: ".$_SESSION["username"]." and password are correct";
//get the groups assigned to the user and then set the groups in $_SESSION["groups"]
$sql = "SELECT * FROM v_group_users ";
$sql .= "where domain_uuid=:domain_uuid ";
$sql .= "and user_uuid=:user_uuid ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':domain_uuid', $domain_uuid);
$prep_statement->bindParam(':user_uuid', $_SESSION["user_uuid"]);
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$_SESSION["groups"] = $result;
unset($sql, $row_count, $prep_statement);
//get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions']
$x = 0;
$sql = "select distinct(permission_name) from v_group_permissions ";
foreach($_SESSION["groups"] as $field) {
if (strlen($field['group_name']) > 0) {
if ($x == 0) {
$sql .= "where (domain_uuid = '".$domain_uuid."' and group_name = '".$field['group_name']."') ";
}
else {
$sql .= "or (domain_uuid = '".$domain_uuid."' and group_name = '".$field['group_name']."') ";
}
$x++;
}
}
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$_SESSION['permissions'] = $prep_statement_sub->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement_sub);
//redirect the user
if (check_str($_REQUEST["rdr"]) !== 'n'){
$path = check_str($_POST["path"]);
if(isset($path) && !empty($path) && $path!="index2.php" && $path!="/install.php") {
header("Location: ".$path);
exit();
}
}
}
//set the time zone
if (strlen($_SESSION["time_zone"]["user"]) == 0) {
//set the domain time zone as the default time zone
date_default_timezone_set($_SESSION['domain']['time_zone']['name']);
}
else {
//set the user defined time zone
date_default_timezone_set($_SESSION["time_zone"]["user"]);
}
//hide the path unless logged in as a superadmin.
if (!if_group("superadmin")) {
$v_path_show = false;
}
?>
+30
View File
@@ -0,0 +1,30 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
function check_string($str) {
$str = str_replace ("\'", "''", $str); //escape the single quote
return $str;
}
?>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+198
View File
@@ -0,0 +1,198 @@
<?php
/*
* Filename.......: class_vcard.php
* Author.........: Troy Wolf [troy@troywolf.com]
* Last Modified..: 2005/07/14 13:30:00
* Description....: A class to generate vCards for contact data.
*/
class vcard {
var $log;
var $data; //array of this vcard's contact data
var $filename; //filename for download file naming
var $class; //PUBLIC, PRIVATE, CONFIDENTIAL
var $revision_date;
var $card;
/*
The class constructor. You can set some defaults here if desired.
*/
function vcard() {
$this->log = "New vcard() called<br />";
$this->data = array(
"display_name"=>null
,"first_name"=>null
,"last_name"=>null
,"additional_name"=>null
,"name_prefix"=>null
,"name_suffix"=>null
,"nickname"=>null
,"title"=>null
,"role"=>null
,"department"=>null
,"company"=>null
,"work_po_box"=>null
,"work_extended_address"=>null
,"work_address"=>null
,"work_city"=>null
,"work_state"=>null
,"work_postal_code"=>null
,"work_country"=>null
,"home_po_box"=>null
,"home_extended_address"=>null
,"home_address"=>null
,"home_city"=>null
,"home_state"=>null
,"home_postal_code"=>null
,"home_country"=>null
,"office_tel"=>null
,"home_tel"=>null
,"cell_tel"=>null
,"fax_tel"=>null
,"pager_tel"=>null
,"email1"=>null
,"email2"=>null
,"url"=>null
,"photo"=>null
,"birthday"=>null
,"timezone"=>null
,"sort_string"=>null
,"note"=>null
);
return true;
}
/*
build() method checks all the values, builds appropriate defaults for
missing values, generates the vcard data string.
*/
function build() {
$this->log .= "vcard build() called<br />";
/*
For many of the values, if they are not passed in, we set defaults or
build them based on other values.
*/
if (!$this->class) { $this->class = "PUBLIC"; }
if (!$this->data['display_name']) {
$this->data['display_name'] = trim($this->data['first_name']." ".$this->data['last_name']);
}
if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['last_name']; }
if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['company']; }
if (!$this->data['timezone']) { $this->data['timezone'] = date("O"); }
if (!$this->revision_date) { $this->revision_date = date('Y-m-d H:i:s'); }
$this->card = "BEGIN:VCARD\r\n";
$this->card .= "VERSION:3.0\r\n";
//$this->card .= "CLASS:".$this->class."\r\n";
//$this->card .= "PRODID:-//class_vcard from TroyWolf.com//NONSGML Version 1//EN\r\n";
$this->card .= "REV:".$this->revision_date."\r\n";
$this->card .= "FN:".$this->data['display_name']."\r\n";
$this->card .= "N:";
$this->card .= $this->data['last_name'].";";
$this->card .= $this->data['first_name'].";";
if (strlen($this->data['additional_name']) > 0) {
$this->card .= $this->data['additional_name'].";";
}
if (strlen($this->data['name_prefix']) > 0) {
$this->card .= $this->data['name_prefix'].";";
}
if (strlen($this->data['name_suffix']) > 0) {
$this->card .= $this->data['name_suffix']."\r\n";
}
if ($this->data['nickname']) { $this->card .= "NICKNAME:".$this->data['contact_nickname']."\r\n"; }
if ($this->data['title']) { $this->card .= "TITLE:".$this->data['title']."\r\n"; }
if ($this->data['company']) { $this->card .= "ORG:".$this->data['company']; }
if ($this->data['department']) { $this->card .= ";".$this->data['department']; }
$this->card .= "\r\n";
if ($this->data['work_po_box']
|| $this->data['work_extended_address']
|| $this->data['work_address']
|| $this->data['work_city']
|| $this->data['work_state']
|| $this->data['work_postal_code']
|| $this->data['work_country']) {
$this->card .= "ADR;TYPE=work:";
if (strlen($this->data['work_po_box']) > 0) {
$this->card .= $this->data['work_po_box'].";";
}
if (strlen($this->data['work_extended_address']) > 0) {
$this->card .= $this->data['work_extended_address'].";";
}
if (strlen($this->data['work_address']) > 0) {
$this->card .= $this->data['work_address'].";";
}
if (strlen($this->data['work_city']) > 0) {
$this->card .= $this->data['work_city'].";";
}
if (strlen($this->data['work_state']) > 0) {
$this->card .= $this->data['work_state'].";";
}
if (strlen($this->data['work_postal_code']) > 0) {
$this->card .= $this->data['work_postal_code'].";";
}
if (strlen($this->data['work_country']) > 0) {
$this->card .= $this->data['work_country']."";
}
$this->card .= "\r\n";
}
if ($this->data['home_po_box']
|| $this->data['home_extended_address']
|| $this->data['home_address']
|| $this->data['home_city']
|| $this->data['home_state']
|| $this->data['home_postal_code']
|| $this->data['home_country']) {
$this->card .= "ADR;TYPE=home:";
if (strlen($this->data['home_po_box']) > 0) {
$this->card .= $this->data['home_po_box'].";";
}
if (strlen($this->data['home_extended_address']) > 0) {
$this->card .= $this->data['home_extended_address'].";";
}
if (strlen($this->data['home_address']) > 0) {
$this->card .= $this->data['home_address'].";";
}
if (strlen($this->data['home_city']) > 0) {
$this->card .= $this->data['home_city'].";";
}
if (strlen($this->data['home_state']) > 0) {
$this->card .= $this->data['home_state']."";
}
if (strlen($this->data['home_postal_code']) > 0) {
$this->card .= $this->data['home_postal_code'].";";
}
if (strlen($this->data['home_country']) > 0) {
$this->card .= $this->data['home_country'];
}
$this->card .= "\r\n";
}
if ($this->data['email1']) { $this->card .= "EMAIL;TYPE=internet,pref:".$this->data['email1']."\r\n"; }
if ($this->data['email2']) { $this->card .= "EMAIL;TYPE=internet:".$this->data['email2']."\r\n"; }
if ($this->data['office_tel']) { $this->card .= "TEL;TYPE=work,voice:".$this->data['office_tel']."\r\n"; }
if ($this->data['home_tel']) { $this->card .= "TEL;TYPE=home,voice:".$this->data['home_tel']."\r\n"; }
if ($this->data['cell_tel']) { $this->card .= "TEL;TYPE=cell,voice:".$this->data['cell_tel']."\r\n"; }
if ($this->data['fax_tel']) { $this->card .= "TEL;TYPE=work,fax:".$this->data['fax_tel']."\r\n"; }
if ($this->data['pager_tel']) { $this->card .= "TEL;TYPE=work,pager:".$this->data['pager_tel']."\r\n"; }
if ($this->data['url']) { $this->card .= "URL;TYPE=work:".$this->data['url']."\r\n"; }
if ($this->data['birthday']) { $this->card .= "BDAY:".$this->data['birthday']."\r\n"; }
if ($this->data['role']) { $this->card .= "ROLE:".$this->data['role']."\r\n"; }
if ($this->data['note']) { $this->card .= "NOTE:".$this->data['note']."\r\n"; }
$this->card .= "TZ:".$this->data['timezone']."\r\n";
$this->card .= "END:VCARD\r\n";
}
/*
download() method streams the vcard to the browser client.
*/
function download() {
$this->log .= "vcard download() called<br />";
if (!$this->card) { $this->build(); }
if (!$this->filename) { $this->filename = trim($this->data['display_name']); }
$this->filename = str_replace(" ", "_", $this->filename);
header("Content-type: text/directory");
header("Content-Disposition: attachment; filename=".$this->filename.".vcf");
header("Pragma: public");
echo $this->card;
return true;
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
class array_order {
var $sort_fields;
var $backwards = false;
var $numeric = false;
function sort() {
$args = func_get_args();
$array = $args[0];
if (!$array) return array();
$this->sort_fields = array_slice($args, 1);
if (!$this->sort_fields) return $array();
if ($this->numeric) {
usort($array, array($this, 'numericCompare'));
} else {
usort($array, array($this, 'stringCompare'));
}
return $array;
}
function numericCompare($a, $b) {
foreach($this->sort_fields as $sort_field) {
if ($a[$sort_field] == $b[$sort_field]) {
continue;
}
return ($a[$sort_field] < $b[$sort_field]) ? ($this->backwards ? 1 : -1) : ($this->backwards ? -1 : 1);
}
return 0;
}
function stringCompare($a, $b) {
foreach($this->sort_fields as $sort_field) {
$cmp_result = strcasecmp($a[$sort_field], $b[$sort_field]);
if ($cmp_result == 0) continue;
return ($this->backwards ? -$cmp_result : $cmp_result);
}
return 0;
}
}
//$order = new array_order();
//$registrations = $order->sort($registrations, 'domain', 'user');
?>
+195
View File
@@ -0,0 +1,195 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the call_forward class
class call_forward {
public $domain_uuid;
public $db_type;
public $call_forward_uuid;
public $extension;
public $call_forward_enabled;
public $call_forward_number;
public function call_forward_add() {
global $db;
$hunt_group_extension = $this->extension;
$huntgroup_name = 'call_forward_'.$this->extension;
$hunt_group_type = 'call_forward';
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
$hunt_group_cid_name_prefix = '';
$hunt_group_pin = '';
$huntgroup_caller_announce = 'false';
$hunt_group_user_list = '';
$hunt_group_enabled = $this->call_forward_enabled;
$hunt_group_description = 'call forward '.$this->extension;
$sql = "insert into v_hunt_groups ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "hunt_group_extension, ";
$sql .= "hunt_group_name, ";
$sql .= "hunt_group_type, ";
$sql .= "hunt_group_context, ";
$sql .= "hunt_group_timeout, ";
$sql .= "hunt_group_timeout_destination, ";
$sql .= "hunt_group_timeout_type, ";
$sql .= "hunt_group_ringback, ";
$sql .= "hunt_group_cid_name_prefix, ";
$sql .= "hunt_group_pin, ";
$sql .= "hunt_group_call_prompt, ";
$sql .= "hunt_group_caller_announce, ";
$sql .= "hunt_group_user_list, ";
$sql .= "hunt_group_enabled, ";
$sql .= "hunt_group_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$this->domain_uuid', ";
$sql .= "'".$this->call_forward_uuid."', ";
$sql .= "'$hunt_group_extension', ";
$sql .= "'$huntgroup_name', ";
$sql .= "'$hunt_group_type', ";
$sql .= "'$hunt_group_context', ";
$sql .= "'$hunt_group_timeout', ";
$sql .= "'$hunt_group_timeout_destination', ";
$sql .= "'$hunt_group_timeout_type', ";
$sql .= "'$hunt_group_ring_back', ";
$sql .= "'$hunt_group_cid_name_prefix', ";
$sql .= "'$hunt_group_pin', ";
$sql .= "'$hunt_group_call_prompt', ";
$sql .= "'$huntgroup_caller_announce', ";
$sql .= "'$hunt_group_user_list', ";
$sql .= "'$hunt_group_enabled', ";
$sql .= "'$hunt_group_description' ";
$sql .= ")";
if ($v_debug) {
echo "add: ".$sql."<br />";
}
$db->exec(check_sql($sql));
unset($sql);
$this->call_forward_destination();
}
public function call_forward_update() {
global $db;
$hunt_group_extension = $this->extension;
$huntgroup_name = 'call_forward_'.$this->extension;
$hunt_group_type = 'call_forward';
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
$hunt_group_cid_name_prefix = '';
$hunt_group_pin = '';
$huntgroup_caller_announce = 'false';
$hunt_group_user_list = '';
$hunt_group_enabled = $this->call_forward_enabled;
$hunt_group_description = 'call forward '.$this->extension;
$sql = "update v_hunt_groups set ";
$sql .= "hunt_group_extension = '$hunt_group_extension', ";
$sql .= "hunt_group_name = '$huntgroup_name', ";
$sql .= "hunt_group_type = '$hunt_group_type', ";
$sql .= "hunt_group_context = '$hunt_group_context', ";
$sql .= "hunt_group_timeout = '$hunt_group_timeout', ";
$sql .= "hunt_group_timeout_destination = '$hunt_group_timeout_destination', ";
$sql .= "hunt_group_timeout_type = '$hunt_group_timeout_type', ";
$sql .= "hunt_group_ringback = '$hunt_group_ring_back', ";
$sql .= "hunt_group_cid_name_prefix = '$hunt_group_cid_name_prefix', ";
$sql .= "hunt_group_pin = '$hunt_group_pin', ";
$sql .= "hunt_group_call_prompt = '$hunt_group_call_prompt', ";
$sql .= "hunt_group_caller_announce = '$huntgroup_caller_announce', ";
$sql .= "hunt_group_user_list = '$hunt_group_user_list', ";
$sql .= "hunt_group_enabled = '$hunt_group_enabled', ";
$sql .= "hunt_group_description = '$hunt_group_description' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and hunt_group_uuid = '$this->call_forward_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
$this->call_forward_destination();
} //end function
public function call_forward_destination() {
global $db;
//delete related v_hunt_group_destinations
$sql = "delete from v_hunt_group_destinations where hunt_group_uuid = '$this->call_forward_uuid' ";
$db->exec(check_sql($sql));
//check whether the number is an extension or external number
if (strlen($this->call_forward_number) > 7) {
$destination_type = 'sip uri';
$destination_profile = '';
}
else {
$destination_type = 'extension';
$destination_profile = 'internal';
}
//prepare the variables
$destination_data = $this->call_forward_number;
$destination_timeout = '';
$destination_order = '1';
$destination_enabled = 'true';
$destination_description = 'call forward';
//add the hunt group destination
if ($this->call_forward_uuid) {
$sql = "insert into v_hunt_group_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->call_forward_uuid', ";
$sql .= "'$destination_data', ";
$sql .= "'$destination_type', ";
$sql .= "'$destination_profile', ";
$sql .= "'$destination_timeout', ";
$sql .= "'$destination_order', ";
$sql .= "'$destination_enabled', ";
$sql .= "'$destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
} //end function
}
?>
+469
View File
@@ -0,0 +1,469 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the database class
if (!class_exists('database')) {
class database {
public $db;
public $result;
public $type;
public $table;
public $where; //array
public $order_by; //array
public $order_type;
public $limit;
public $offset;
public $fields;
public $count;
public $sql;
public function connect() {
//include config.php
include "root.php";
include "includes/config.php";
//set defaults
if (isset($db_type) > 0) { $this->db_type = $db_type; }
if (isset($db_host) > 0) { $this->db_host = $db_host; }
if (isset($db_port) > 0) { $this->db_port = $db_port; }
if (isset($db_name) > 0) { $this->db_name = $db_name; }
if (isset($db_username) > 0) { $this->db_username = $db_username; }
if (isset($db_password) > 0) { $this->db_password = $db_password; }
if (isset($db_path) > 0) { $this->db_path = $db_path; }
if (isset($db_name) > 0) { $this->db_name = $db_name; }
//backwards compatibility
if (isset($dbtype) > 0) { $db_type = $dbtype; }
if (isset($dbhost) > 0) { $db_host = $dbhost; }
if (isset($dbport) > 0) { $db_port = $dbport; }
if (isset($dbname) > 0) { $db_name = $dbname; }
if (isset($dbusername) > 0) { $db_username = $dbusername; }
if (isset($dbpassword) > 0) { $db_password = $dbpassword; }
if (isset($dbfilepath) > 0) { $db_path = $db_file_path; }
if (isset($dbfilename) > 0) { $db_name = $dbfilename; }
if ($this->db_type == "sqlite") {
if (strlen($this->db_name) == 0) {
$server_name = $_SERVER["SERVER_NAME"];
$server_name = str_replace ("www.", "", $server_name);
$db_name_short = $server_name;
$this->db_name = $server_name.'.db';
}
else {
$db_name_short = $this->db_name;
}
$this->db_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure';
$this->db_path = realpath($this->db_path);
if (file_exists($this->db_path.'/'.$this->db_name)) {
//echo "main file exists<br>";
}
else {
$file_name = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/sqlite.sql';
$file_contents = file_get_contents($file_name);
try {
//$db = new PDO('sqlite2:example.db'); //sqlite 2
//$db = new PDO('sqlite::memory:'); //sqlite 3
$db = new PDO('sqlite:'.$this->db_path.'/'.$this->db_name); //sqlite 3
$db->beginTransaction();
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
//loop line by line through all the lines of sql code
$stringarray = explode("\n", $file_contents);
$x = 0;
foreach($stringarray as $sql) {
try {
$db->query($sql);
}
catch (PDOException $error) {
echo "error: " . $error->getMessage() . " sql: $sql<br/>";
}
$x++;
}
unset ($file_contents, $sql);
$db->commit();
if (is_writable($this->db_path.'/'.$this->db_name)) {
//is writable - use database in current location
}
else {
//not writable
echo "The database ".$this->db_path."/".$this->db_name." is not writeable.";
exit;
}
}
try {
//$db = new PDO('sqlite2:example.db'); //sqlite 2
//$db = new PDO('sqlite::memory:'); //sqlite 3
$this->db = new PDO('sqlite:'.$this->db_path.'/'.$this->db_name); //sqlite 3
//add additional functions to SQLite so that they are accessible inside SQL
//bool PDO::sqliteCreateFunction ( string function_name, callback callback [, int num_args] )
$this->db->sqliteCreateFunction('md5', 'php_md5', 1);
$this->db->sqliteCreateFunction('unix_timestamp', 'php_unix_time_stamp', 1);
$this->db->sqliteCreateFunction('now', 'php_now', 0);
$this->db->sqliteCreateFunction('str_left', 'php_left', 2);
$this->db->sqliteCreateFunction('str_right', 'php_right', 2);
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
}
if ($this->db_type == "mysql") {
try {
//required for mysql_real_escape_string
if (function_exists(mysql_connect)) {
$mysql_connection = mysql_connect($this->db_host, $this->db_username, $this->db_password);
}
//mysql pdo connection
if (strlen($this->db_host) == 0 && strlen($this->db_port) == 0) {
//if both host and port are empty use the unix socket
$this->db = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;dbname=$this->db_name", $this->db_username, $this->db_password);
}
else {
if (strlen($this->db_port) == 0) {
//leave out port if it is empty
$this->db = new PDO("mysql:host=$this->db_host;dbname=$this->db_name;", $this->db_username, $this->db_password, array(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
));
}
else {
$this->db = new PDO("mysql:host=$this->db_host;port=$this->db_port;dbname=$this->db_name;", $this->db_username, $this->db_password, array(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
));
}
}
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
}
if ($this->db_type == "pgsql") {
//database connection
try {
if (strlen($this->db_host) > 0) {
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
$this->db = new PDO("pgsql:host=$this->db_host port=$this->db_port dbname=$this->db_name user=$this->db_username password=$this->db_password");
}
else {
$this->db = new PDO("pgsql:dbname=$this->db_name user=$this->db_username password=$this->db_password");
}
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
}
}
//public function disconnect() {
// return null;
//}
public function find() {
//connect;
//table;
//where;
//order_by;
//limit;
//offset;
//connect to the database if needed
if (!$this->db) {
$this->connect();
}
//get data from the database
$sql = "";
$sql .= " select * from ".$this->table." ";
if ($this->where) {
$i = 0;
foreach($this->where as $row) {
if ($i == 0) {
$sql .= 'where '.$row['name']." ".$row['operator']." '".$row['value']."' ";
}
else {
$sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
}
$i++;
}
}
if ($this->order_by) {
$sql .= "order by ";
$i = 1;
foreach($this->order_by as $row) {
if (count($this->order_by) == $i) {
$sql .= $row['name']." ";
}
else {
$sql .= $row['name'].", ";
}
$i++;
}
if ($this->order_type) {
$sql .= $this->order_type." ";
}
}
if ($this->limit) {
$sql .= " limit ".$this->limit." offset ".$this->offset." ";
}
//echo $sql;
$prep_statement = $this->db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
return $prep_statement->fetchAll(PDO::FETCH_ASSOC);
}
else {
return false;
}
}
public function add(){
//connect to the database if needed
if (!$this->db) {
$this->connect();
}
//add data to the database
$sql = "insert into ".$this->table;
$sql .= "(";
$i = 1;
foreach($this->fields as $name => $value) {
if (count($this->fields) == $i) {
$sql .= $name." ";
}
else {
$sql .= $name.", ";
}
$i++;
}
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$i = 1;
foreach($this->fields as $name => $value) {
if (count($this->fields) == $i) {
if (strlen($value) > 0) {
$sql .= "'".$value."' ";
}
else {
$sql .= "'".$value."' ";
}
}
else {
if (strlen($value) > 0) {
$sql .= "'".$value."', ";
}
else {
$sql .= "null, ";
}
}
$i++;
}
$sql .= ")";
$this->sql = $sql;
$this->db->exec($sql);
unset($this->fields);
unset($sql);
}
public function update() {
//connect to the database if needed
if (!$this->db) {
$this->connect();
}
//udate the database
$sql = "update ".$this->table." set ";
$i = 1;
foreach($this->fields as $name => $value) {
if (count($this->fields) == $i) {
if (strlen($name) > 0 && $value == null) {
$sql .= $name." = null ";
}
else {
$sql .= $name." = '".$value."' ";
}
}
else {
if (strlen($name) > 0 && $value == null) {
$sql .= $name." = null, ";
}
else {
$sql .= $name." = '".$value."', ";
}
}
$i++;
}
$i = 0;
foreach($this->where as $row) {
if ($i == 0) {
$sql .= 'where '.$row['name']." ".$row['operator']." '".$row['value']."' ";
}
else {
$sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
}
$i++;
}
$this->db->exec(check_sql($sql));
unset($this->fields);
unset($this->where);
unset($sql);
}
public function delete(){
//connect to the database if needed
if (!$this->db) {
$this->connect();
}
//delete from the database
$sql = "delete from ".$this->table." ";
if ($this->where) {
$i = 0;
foreach($this->where as $row) {
if ($i == 0) {
$sql .= "where ".$row['name']." ".$row['operator']." '".$row['value']."' ";
}
else {
$sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
}
$i++;
}
}
//echo $sql."<br>\n";
$prep_statement = $this->db->prepare($sql);
$prep_statement->execute();
unset($sql);
unset($this->where);
}
public function count() {
//connect to the database if needed
if (!$this->db) {
$this->connect();
}
//get the number of rows
$sql = " select count(*) as num_rows from ".$this->table;
if ($this->where) {
$i = 0;
foreach($this->where as $row) {
if ($i == 0) {
$sql .= "where ".$row['name']." ".$row['operator']." '".$row['value']."' ";
}
else {
$sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
}
$i++;
}
}
unset($this->where);
$prep_statement = $this->db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$this->result = $row['num_rows'];
}
else {
$this->result = 0;
}
}
unset($prep_statement);
}
}
}
if (!function_exists('php_md5')) {
function php_md5($string) {
return md5($string);
}
}
if (!function_exists('php_unix_time_stamp')) {
function php_unix_time_stamp($string) {
return strtotime($string);
}
}
if (!function_exists('php_now')) {
function php_now() {
return date("Y-m-d H:i:s");
}
}
if (!function_exists('php_left')) {
function php_left($string, $num) {
return substr($string, 0, $num);
}
}
if (!function_exists('php_right')) {
function php_right($string, $num) {
return substr($string, (strlen($string)-$num), strlen($string));
}
}
//example usage
/*
//find
require_once "includes/classes/database.php";
$database = new database;
$database->domain_uuid = $_SESSION["domain_uuid"];
$database->type = $db_type;
$database->table = "v_extensions";
$where[0]['name'] = 'domain_uuid';
$where[0]['value'] = $_SESSION["domain_uuid"];
$where[0]['operator'] = '=';
$database->where = $where;
$order_by[0]['name'] = 'extension';
$database->order_by = $order_by;
$database->order_type = 'desc';
$database->limit = '2';
$database->offset = '0';
$database->find();
print_r($database->result);
//insert
require_once "includes/classes/database.php";
$database = new database;
$database->domain_uuid = $_SESSION["domain_uuid"];
$database->type = $db_type;
$database->table = "v_ivr_menus";
$fields[0]['name'] = 'domain_uuid';
$fields[0]['value'] = $_SESSION["domain_uuid"];
$database->add();
print_r($database->result);
*/
?>
+343
View File
@@ -0,0 +1,343 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the dialplan class
if (!class_exists('dialplan')) {
class dialplan {
//variables
public $result;
public $domain_uuid;
public $dialplan_uuid;
public $xml;
public $json;
public $display_type;
//dialplans
public $dialplan_name;
public $dialplan_continue;
public $dialplan_order;
public $dialplan_context;
public $dialplan_enabled;
public $dialplan_description;
//dialplan_details
public $dialplan_detail_tag;
public $dialplan_detail_order;
public $dialplan_detail_type;
public $dialplan_detail_data;
public $dialplan_detail_break;
public $dialplan_detail_inline;
public $dialplan_detail_group;
public function dialplan_add() {
global $db;
$sql = "insert into v_dialplans ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "app_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "dialplan_name, ";
$sql .= "dialplan_continue, ";
$sql .= "dialplan_order, ";
$sql .= "dialplan_context, ";
$sql .= "dialplan_enabled, ";
$sql .= "dialplan_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".check_str($this->domain_uuid)."', ";
$sql .= "'".check_str($this->app_uuid)."', ";
$sql .= "'".check_str($this->dialplan_uuid)."', ";
$sql .= "'".check_str($this->dialplan_name)."', ";
$sql .= "'".check_str($this->dialplan_continue)."', ";
$sql .= "'".check_str($this->dialplan_order)."', ";
$sql .= "'".check_str($this->dialplan_context)."', ";
$sql .= "'".check_str($this->dialplan_enabled)."', ";
$sql .= "'".check_str($this->dialplan_description)."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //end function
public function dialplan_update() {
global $db;
$sql = "update v_dialplans set ";
$sql .= "dialplan_name = '".check_str($this->dialplan_name)."', ";
if (strlen($this->dialplan_continue) > 0) {
$sql .= "dialplan_continue = '".check_str($this->dialplan_continue)."', ";
}
$sql .= "dialplan_order = '".check_str($this->dialplan_order)."', ";
$sql .= "dialplan_context = '".check_str($this->dialplan_context)."', ";
$sql .= "dialplan_enabled = '".check_str($this->dialplan_enabled)."', ";
$sql .= "dialplan_description = '".check_str($this->dialplan_description)."' ";
$sql .= "where domain_uuid = '".check_str($this->domain_uuid)."' ";
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
//echo "sql: ".$sql."<br />";
$db->query($sql);
unset($sql);
}
public function dialplan_detail_add() {
global $db;
$dialplan_detail_uuid = uuid();
$sql = "insert into v_dialplan_details ";
$sql .= "(";
$sql .= "dialplan_detail_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "dialplan_detail_tag, ";
$sql .= "dialplan_detail_order, ";
$sql .= "dialplan_detail_type, ";
$sql .= "dialplan_detail_data, ";
$sql .= "dialplan_detail_break, ";
$sql .= "dialplan_detail_inline, ";
$sql .= "dialplan_detail_group ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$dialplan_detail_uuid."', ";
$sql .= "'".check_str($this->domain_uuid)."', ";
$sql .= "'".check_str($this->dialplan_uuid)."', ";
$sql .= "'".check_str($this->dialplan_detail_tag)."', ";
$sql .= "'".check_str($this->dialplan_detail_order)."', ";
$sql .= "'".check_str($this->dialplan_detail_type)."', ";
$sql .= "'".check_str($this->dialplan_detail_data)."', ";
if (strlen($this->dialplan_detail_break) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'".check_str($this->dialplan_detail_break)."', ";
}
if (strlen($this->dialplan_detail_inline) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'".check_str($this->dialplan_detail_inline)."', ";
}
if (strlen($this->dialplan_detail_group) == 0) {
$sql .= "null ";
}
else {
$sql .= "'".check_str($this->dialplan_detail_group)."' ";
}
$sql .= ")";
//echo $sql."\n\n";
$db->exec(check_sql($sql));
unset($sql);
} //end function
public function dialplan_detail_update() {
global $db;
$sql = "update v_dialplans set ";
$sql .= "dialplan_detail_order = '".check_str($this->dialplan_detail_order)."', ";
$sql .= "dialplan_detail_type = '".check_str($this->dialplan_detail_type)."', ";
$sql .= "dialplan_detail_data = '".check_str($this->dialplan_detail_data)."', ";
if (strlen($this->dialplan_detail_break) > 0) {
$sql .= "dialplan_detail_break = '".check_str($this->dialplan_detail_break)."', ";
}
if (strlen($this->dialplan_detail_inline) > 0) {
$sql .= "dialplan_detail_inline = '".check_str($this->dialplan_detail_inline)."', ";
}
if (strlen($this->dialplan_detail_group) > 0) {
$sql .= "dialplan_detail_group = '".check_str($this->dialplan_detail_group)."', ";
}
$sql .= "dialplan_detail_tag = '".check_str($this->dialplan_detail_tag)."' ";
$sql .= "where domain_uuid = '".check_str($this->domain_uuid)."' ";
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
//echo "sql: ".$sql."<br />";
$db->query($sql);
unset($sql);
} //end function
public function restore_advanced_xml() {
$switch_dialplan_dir = $this->switch_dialplan_dir;
if (is_dir($switch_dialplan_dir)) {
//get the contents of the dialplan/default.xml
$file_default_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/templates/conf/dialplan/default.xml';
$file_default_contents = file_get_contents($file_default_path);
//prepare the file contents and the path
if (count($_SESSION['domains']) < 2) {
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$file_default_contents = str_replace("{v_domain}", 'default', $file_default_contents);
//set the file path
$file_path = $switch_dialplan_dir.'/default.xml';
}
else {
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$file_default_contents = str_replace("{v_domain}", $_SESSION['domain_name'], $file_default_contents);
//set the file path
$file_path = $switch_dialplan_dir.'/'.$_SESSION['domain_name'].'.xml';
}
//write the default dialplan
$fh = fopen($file_path,'w') or die('Unable to write to '.$file_path.'. Make sure the path exists and permissons are set correctly.');
fwrite($fh, $file_default_contents);
fclose($fh);
//set the message
$this->result['dialplan']['restore']['msg'] = "Default Restored";
}
}
private function app_uuid_exists() {
global $db;
$sql = "select count(*) as num_rows from v_dialplans ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and app_uuid = '".$this->app_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
return true;
}
else {
return false;
}
}
unset($prep_statement, $result);
}
public function import() {
if (strlen($this->xml) > 0) {
//convert the xml string to an xml object
$xml = simplexml_load_string($this->xml);
//convert to json
$json = json_encode($xml);
//convert to an array
$dialplan = json_decode($json, true);
}
if (strlen($this->json) > 0) {
//convert to an array
$dialplan = json_decode($json, true);
}
//ensure the condition array uniform
if (!is_array($dialplan['condition'][0])) {
$tmp = $dialplan['condition'];
unset($dialplan['condition']);
$dialplan['condition'][0] = $tmp;
}
//check if the dialplan app uuid exists
$this->app_uuid = $dialplan['@attributes']['app_uuid'];
if ($this->app_uuid_exists()) {
//dialplan entry already exists do nothing
}
else {
//get the attributes
$this->dialplan_uuid = uuid();
$this->dialplan_name = $dialplan['@attributes']['name'];
if ($this->display_type == "text") {
echo " ".$this->dialplan_name.": added\n";
}
if (strlen($dialplan['@attributes']['continue']) > 0) {
$this->dialplan_continue = $dialplan['@attributes']['continue'];
}
if (strlen($dialplan['@attributes']['enabled']) > 0) {
$this->dialplan_enabled = $dialplan['@attributes']['enabled'];
}
else {
$this->dialplan_enabled = "true";
}
$this->dialplan_description = '';
$this->dialplan_add();
//loop through the condition array
$x = 0;
$group = 0;
$order = 5;
foreach ($dialplan['condition'] as &$row) {
unset($this->dialplan_detail_break);
unset($this->dialplan_detail_inline);
$this->dialplan_detail_tag = 'condition';
$this->dialplan_detail_type = $row['@attributes']['field'];
$this->dialplan_detail_data = $row['@attributes']['expression'];
$this->dialplan_detail_group = $group;
$this->dialplan_detail_order = $order;
if (strlen($row['@attributes']['break']) > 0) {
$this->dialplan_detail_break = $row['@attributes']['break'];
}
$this->dialplan_detail_add();
if (is_array($row['action']) || is_array($row['anti-action'])) {
$condition_self_closing_tag = false;
if (!is_array($row['action'][0])) {
if ($row['action']['@attributes']['application']) {
$tmp = $row['action'];
unset($row['action']);
$row['action'][0] = $tmp;
}
}
if (!is_array($row['anti-action'][0])) {
if ($row['anti-action']['@attributes']['application']) {
$tmp = $row['anti-action'];
unset($row['anti-action']);
$row['anti-action'][0] = $tmp;
}
}
$order = $order + 5;
unset($this->dialplan_detail_break);
unset($this->dialplan_detail_inline);
foreach ($row['action'] as &$row2) {
$this->dialplan_detail_tag = 'action';
$this->dialplan_detail_type = $row2['@attributes']['application'];
$this->dialplan_detail_data = $row2['@attributes']['data'];
$this->dialplan_detail_data = str_replace("{v_pin_number}", generate_password(8, 1), $this->dialplan_detail_data);
$this->dialplan_detail_data = str_replace("{v_context}", $this->dialplan_context, $this->dialplan_detail_data);
$this->dialplan_detail_data = str_replace("{v_switch_recordings_dir}", $_SESSION['switch']['recordings']['dir'], $this->dialplan_detail_data);
if (strlen($row2['@attributes']['inline']) > 0) {
$this->dialplan_detail_inline = $row2['@attributes']['inline'];
}
$this->dialplan_detail_group = $group;
$this->dialplan_detail_order = $order;
$this->dialplan_detail_add();
$order = $order + 5;
}
foreach ($row['anti-action'] as &$row2) {
$this->dialplan_detail_tag = 'anti-action';
$this->dialplan_detail_type = $row2['@attributes']['application'];
$this->dialplan_detail_data = $row2['@attributes']['data'];
$this->dialplan_detail_data = str_replace("{v_pin_number}", generate_password(8, 1), $this->dialplan_detail_data);
$this->dialplan_detail_data = str_replace("{v_context}", $this->dialplan_context, $this->dialplan_detail_data);
$this->dialplan_detail_data = str_replace("{v_switch_recordings_dir}", $_SESSION['switch']['recordings']['dir'], $this->dialplan_detail_data);
$this->dialplan_detail_group = $group;
$this->dialplan_detail_order = $order;
$this->dialplan_detail_add();
$order = $order + 5;
}
}
else {
$condition_self_closing_tag = true;
}
//if not a self closing tag then increment the group
if (!$condition_self_closing_tag) {
$group++;
}
$row['group'] = $group;
$order = $order + 5;
$x++;
}
}
}
}
}
?>
+169
View File
@@ -0,0 +1,169 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the dnd class
class do_not_disturb {
public $domain_uuid;
public $dnd_uuid;
public $domain_name;
public $extension;
public $dnd_enabled;
//update the user_status
public function dnd_status() {
global $db;
if ($this->dnd_enabled == "true") {
//update the call center status
$user_status = "Logged Out";
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd .= "callcenter_config agent set status ".$_SESSION['username']."@".$domain_name." '".$user_status."'";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//update the database user_status
$user_status = "Do Not Disturb";
$sql = "update v_users set ";
$sql .= "user_status = '$user_status' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$_SESSION['username']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
}
} //function
public function dnd_add() {
global $db;
$hunt_group_extension = $this->extension;
$huntgroup_name = 'dnd_'.$this->extension;
$hunt_group_type = 'dnd';
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout = '1';
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
//$hunt_group_cid_name_prefix = '';
//$hunt_group_pin = '';
//$hunt_group_call_prompt = 'false';
$huntgroup_caller_announce = 'false';
//$hunt_group_user_list = '';
$hunt_group_enabled = $this->dnd_enabled;
$hunt_group_description = 'dnd '.$this->extension;
$sql = "insert into v_hunt_groups ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "hunt_group_extension, ";
$sql .= "hunt_group_name, ";
$sql .= "hunt_group_type, ";
$sql .= "hunt_group_context, ";
$sql .= "hunt_group_timeout, ";
$sql .= "hunt_group_timeout_destination, ";
$sql .= "hunt_group_timeout_type, ";
$sql .= "hunt_group_ringback, ";
//$sql .= "hunt_group_cid_name_prefix, ";
//$sql .= "hunt_group_pin, ";
$sql .= "hunt_group_call_prompt, ";
$sql .= "hunt_group_caller_announce, ";
//$sql .= "hunt_group_user_list, ";
$sql .= "hunt_group_enabled, ";
$sql .= "hunt_group_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->dnd_uuid', ";
$sql .= "'$hunt_group_extension', ";
$sql .= "'$huntgroup_name', ";
$sql .= "'$hunt_group_type', ";
$sql .= "'$hunt_group_context', ";
$sql .= "'$hunt_group_timeout', ";
$sql .= "'$hunt_group_timeout_destination', ";
$sql .= "'$hunt_group_timeout_type', ";
$sql .= "'$hunt_group_ring_back', ";
//$sql .= "'$hunt_group_cid_name_prefix', ";
//$sql .= "'$hunt_group_pin', ";
$sql .= "'$hunt_group_call_prompt', ";
$sql .= "'$huntgroup_caller_announce', ";
//$sql .= "'$hunt_group_user_list', ";
$sql .= "'$hunt_group_enabled', ";
$sql .= "'$hunt_group_description' ";
$sql .= ")";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec(check_sql($sql));
unset($sql);
} //function
public function dnd_update() {
global $db;
$hunt_group_extension = $this->extension;
$huntgroup_name = 'dnd_'.$this->extension;
$hunt_group_type = 'dnd';
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout = '1';
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
//$hunt_group_cid_name_prefix = '';
//$hunt_group_pin = '';
//$hunt_group_call_prompt = 'false';
$huntgroup_caller_announce = 'false';
//$hunt_group_user_list = '';
$hunt_group_enabled = $this->dnd_enabled;
$hunt_group_description = 'dnd '.$this->extension;
$sql = "update v_hunt_groups set ";
$sql .= "hunt_group_extension = '$hunt_group_extension', ";
$sql .= "hunt_group_name = '$huntgroup_name', ";
$sql .= "hunt_group_type = '$hunt_group_type', ";
$sql .= "hunt_group_context = '$hunt_group_context', ";
$sql .= "hunt_group_timeout = '$hunt_group_timeout', ";
$sql .= "hunt_group_timeout_destination = '$hunt_group_timeout_destination', ";
$sql .= "hunt_group_timeout_type = '$hunt_group_timeout_type', ";
$sql .= "hunt_group_ringback = '$hunt_group_ring_back', ";
//$sql .= "hunt_group_cid_name_prefix = '$hunt_group_cid_name_prefix', ";
//$sql .= "hunt_group_pin = '$hunt_group_pin', ";
$sql .= "hunt_group_call_prompt = '$hunt_group_call_prompt', ";
$sql .= "hunt_group_caller_announce = 'false', ";
//$sql .= "hunt_group_user_list = '$hunt_group_user_list', ";
$sql .= "hunt_group_enabled = '$hunt_group_enabled', ";
$sql .= "hunt_group_description = '$hunt_group_description' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and hunt_group_uuid = '$this->dnd_uuid' ";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec(check_sql($sql));
unset($sql);
} //function
} //class
?>
+338
View File
@@ -0,0 +1,338 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the follow me class
class follow_me {
public $domain_uuid;
public $db_type;
public $follow_me_uuid;
public $extension;
public $follow_me_enabled;
public $follow_me_type;
public $hunt_group_call_prompt;
public $hunt_group_timeout;
public $destination_data_1;
public $destination_type_1;
public $destination_timeout_1;
public $destination_data_2;
public $destination_type_2;
public $destination_timeout_2;
public $destination_data_3;
public $destination_type_3;
public $destination_timeout_3;
public $destination_data_4;
public $destination_type_4;
public $destination_timeout_4;
public $destination_data_5;
public $destination_type_5;
public $destination_timeout_5;
public $destination_profile = 'internal';
public $destination_timeout = '';
public $destination_order = 1;
public $destination_enabled = 'true';
public $destination_description = 'follow me';
public function follow_me_add() {
global $db;
$hunt_group_extension = $this->extension;
$hunt_group_name = 'follow_me_'.$this->extension;
$hunt_group_type = $this->follow_me_type;
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout = $this->hunt_group_timeout;
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
//$hunt_group_cid_name_prefix = '';
//$hunt_group_pin = '';
$huntgroup_caller_announce = 'false';
//$hunt_group_user_list = '';
$hunt_group_enabled = $this->follow_me_enabled;
$hunt_group_description = 'follow me '.$this->extension;
$sql = "insert into v_hunt_groups ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "hunt_group_extension, ";
$sql .= "hunt_group_name, ";
$sql .= "hunt_group_type, ";
$sql .= "hunt_group_context, ";
$sql .= "hunt_group_timeout, ";
$sql .= "hunt_group_timeout_destination, ";
$sql .= "hunt_group_timeout_type, ";
$sql .= "hunt_group_ringback, ";
$sql .= "hunt_group_cid_name_prefix, ";
$sql .= "hunt_group_pin, ";
$sql .= "hunt_group_call_prompt, ";
$sql .= "hunt_group_caller_announce, ";
$sql .= "hunt_group_user_list, ";
$sql .= "hunt_group_enabled, ";
$sql .= "hunt_group_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$hunt_group_extension', ";
$sql .= "'$hunt_group_name', ";
$sql .= "'$hunt_group_type', ";
$sql .= "'$hunt_group_context', ";
$sql .= "'$hunt_group_timeout', ";
$sql .= "'$hunt_group_timeout_destination', ";
$sql .= "'$hunt_group_timeout_type', ";
$sql .= "'$hunt_group_ring_back', ";
$sql .= "'$hunt_group_cid_name_prefix', ";
$sql .= "'$hunt_group_pin', ";
$sql .= "'$hunt_group_call_prompt', ";
$sql .= "'$huntgroup_caller_announce', ";
$sql .= "'$hunt_group_user_list', ";
$sql .= "'$hunt_group_enabled', ";
$sql .= "'$hunt_group_description' ";
$sql .= ")";
if ($v_debug) {
echo $sql."<br />";
}
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
} //end function
public function follow_me_update() {
global $db;
$hunt_group_extension = $this->extension;
$hunt_group_name = 'follow_me_'.$this->extension;
$hunt_group_type = $this->follow_me_type;
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout = $this->hunt_group_timeout;
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
//$hunt_group_cid_name_prefix = '';
//$hunt_group_pin = '';
$huntgroup_caller_announce = 'false';
//$hunt_group_user_list = '';
$hunt_group_enabled = $this->follow_me_enabled;
$hunt_group_description = 'follow me '.$this->extension;
$sql = "update v_hunt_groups set ";
$sql .= "hunt_group_extension = '$hunt_group_extension', ";
$sql .= "hunt_group_name = '$hunt_group_name', ";
$sql .= "hunt_group_type = '$hunt_group_type', ";
$sql .= "hunt_group_context = '$hunt_group_context', ";
$sql .= "hunt_group_timeout = '$hunt_group_timeout', ";
$sql .= "hunt_group_timeout_destination = '$hunt_group_timeout_destination', ";
$sql .= "hunt_group_timeout_type = '$hunt_group_timeout_type', ";
$sql .= "hunt_group_ringback = '$hunt_group_ring_back', ";
$sql .= "hunt_group_cid_name_prefix = '$hunt_group_cid_name_prefix', ";
$sql .= "hunt_group_pin = '$hunt_group_pin', ";
$sql .= "hunt_group_call_prompt = '$this->hunt_group_call_prompt', ";
$sql .= "hunt_group_caller_announce = '$huntgroup_caller_announce', ";
$sql .= "hunt_group_user_list = '$hunt_group_user_list', ";
$sql .= "hunt_group_enabled = '$hunt_group_enabled', ";
$sql .= "hunt_group_description = '$hunt_group_description' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and hunt_group_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
} //end function
public function follow_me_destinations() {
global $db;
//delete related v_hunt_group_destinations
$sql = "delete from v_hunt_group_destinations where hunt_group_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
//insert the v_hunt_group_destinations set destination_data_1
if (strlen($this->destination_data_1) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_1', ";
$sql .= "'$this->destination_type_1', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_1', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_2) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_2', ";
$sql .= "'$this->destination_type_2', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_2', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_3) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_3', ";
$sql .= "'$this->destination_type_3', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_3', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_4) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_4', ";
$sql .= "'$this->destination_type_4', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_4', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_5) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_5', ";
$sql .= "'$this->destination_type_5', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_5', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
} //function
} //class
?>
+217
View File
@@ -0,0 +1,217 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the install class
class install {
var $result;
var $domain_uuid;
var $domain;
var $switch_conf_dir;
var $switch_scripts_dir;
var $switch_sounds_dir;
function recursive_copy($src, $dst) {
$dir = opendir($src);
if (!$dir) {
if (!mkdir($src, 0755, true)) {
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
}
if (!is_dir($dst)) {
if (!mkdir($dst, 0755, true)) {
//throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
}
}
while(false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src.'/'.$file)) {
$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
}
else {
if (!file_exists($dst.'/'.$file)) {
//echo "copy(".$src."/".$file.", ".$dst."/".$file.");<br />\n";
copy($src.'/'.$file, $dst.'/'.$file);
}
}
}
}
closedir($dir);
}
function recursive_delete($dir) {
if (strlen($dir) > 0) {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
$this->recursive_delete("$file/*");
rmdir($file);
//echo "rm dir: ".$file."\n";
} else {
//echo "delete file: ".$file."\n";
unlink($file);
}
}
}
clearstatcache();
}
function copy() {
$this->copy_scripts();
$this->copy_sounds();
$this->copy_swf();
$this->copy_phrases();
}
function copy_conf() {
clearstatcache();
$src_dir = $this->switch_conf_dir;
$dst_dir = $this->switch_conf_dir.'.orig';
if ($src_dir != "/conf") {
mkdir($src_dir, 0755, true);
}
if (is_readable($src_dir)) {
//make a backup copy of the conf directory
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$this->recursive_copy($src_dir, $dst_dir);
$this->recursive_delete($this->switch_conf_dir);
}
else {
exec ('mv '.$src_dir.' '.$dst_dir);
//exec ('cp -RLp '.$src_dir.' '.$dst_dir);
}
//make sure the conf directory exists
if (!mkdir($this->switch_conf_dir, 0755, true)) {
//throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. ");
}
}
}
function copy_scripts() {
clearstatcache();
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/scripts';
$dst_dir = $this->switch_scripts_dir;
if (is_readable($this->switch_scripts_dir)) {
if ($handle = opendir($src_dir)) {
$i = 0;
$files = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_file($src_dir.'/'.$file)) {
if (!file_exists($dst_dir.'/'.$file) ) {
//copy the file if it does not exist in the destination directory
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
$this->result['copy']['scripts'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
else {
$this->result['copy']['scripts'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
}
}
}
}
unset($src_dir, $dst_dir);
}
}
function copy_sounds() {
clearstatcache();
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sounds/en/us/callie/custom/8000';
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/8000';
if (is_readable($this->switch_sounds_dir)) {
if ($handle = opendir($src_dir)) {
$i = 0;
$files = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_file($src_dir.'/'.$file)) {
if (!file_exists($dst_dir.'/'.$file) ) {
//copy the file if it does not exist in the destination directory
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
$this->result['copy']['sounds']['8000'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
else {
$this->result['copy']['sounds']['8000'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
}
}
}
}
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sounds/en/us/callie/custom/16000';
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/16000';
if ($handle = opendir($src_dir)) {
$i = 0;
$files = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_file($src_dir.'/'.$file)) {
if (!file_exists($dst_dir.'/'.$file) ) {
//copy the file if it does not exist in the destination directory
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
$this->result['copy']['sounds']['16000'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
else {
$this->result['copy']['sounds']['16000'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
}
}
}
}
}
}
function copy_swf() {
clearstatcache();
$file = "slim.swf";
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/htdocs';
$dst_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/recordings';
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
$this->result['copy']['swf'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
else {
$this->result['copy']['swf'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
}
}
function copy_phrases() {
clearstatcache();
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/conf/lang";
$dst_dir = $this->switch_conf_dir."/lang";
if (is_readable($this->switch_conf_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
}
}
}
//how to use the class
//include "includes/classes/install.php";
//$install = new install;
//$install->domain_uuid = $domain_uuid;
//$install->switch_conf_dir = $switch_conf_dir;
//$install->switch_scripts_dir = $switch_scripts_dir;
//$install->switch_sounds_dir = $switch_sounds_dir;
//$install->copy();
//print_r($install->result);
?>
+340
View File
@@ -0,0 +1,340 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//define the follow me class
class menu {
public $menu_uuid;
//delete items in the menu that are not protected
function delete() {
//set the variable
$db = $this->db;
//remove the old menu
$sql = "delete from v_menu_items ";
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
$sql .= "and (menu_item_protected <> 'true' ";
$sql .= "or menu_item_protected is null); ";
$db->exec(check_sql($sql));
}
//restore the menu
function restore() {
//set the variables
$db = $this->db;
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$x=0;
foreach ($config_list as &$config_path) {
include($config_path);
$x++;
}
//use the app array to restore the default menu
//$db->beginTransaction();
foreach ($apps as $row) {
foreach ($row['menu'] as $menu) {
//set the variables
$menu_item_title = $menu['title']['en'];
$menu_item_language = 'en';
$menu_item_uuid = $menu['uuid'];
$menu_item_parent_uuid = $menu['parent_uuid'];
$menu_item_category = $menu['category'];
$menu_item_path = $menu['path'];
$menu_item_order = $menu['order'];
$menu_item_description = $menu['desc'];
//if the item uuid is not currently in the db then add it
$sql = "select * from v_menu_items ";
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if (count($result) == 0) {
//insert the default menu into the database
$sql = "insert into v_menu_items ";
$sql .= "(";
$sql .= "menu_item_uuid, ";
$sql .= "menu_uuid, ";
//$sql .= "menu_item_language, ";
$sql .= "menu_item_title, ";
$sql .= "menu_item_link, ";
$sql .= "menu_item_category, ";
if (strlen($menu_item_order) > 0) {
$sql .= "menu_item_order, ";
}
if (strlen($menu_item_parent_uuid) > 0) {
$sql .= "menu_item_parent_uuid, ";
}
$sql .= "menu_item_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$menu_item_uuid."', ";
$sql .= "'".$this->menu_uuid."', ";
//$sql .= "'$menu_item_language', ";
$sql .= "'$menu_item_title', ";
$sql .= "'$menu_item_path', ";
$sql .= "'$menu_item_category', ";
if (strlen($menu_item_order) > 0) {
$sql .= "'$menu_item_order', ";
}
if (strlen($menu_item_parent_uuid) > 0) {
$sql .= "'$menu_item_parent_uuid', ";
}
$sql .= "'$menu_item_description' ";
$sql .= ")";
if ($menu_item_uuid == $menu_item_parent_uuid) {
//echo $sql."<br />\n";
}
else {
$db->exec(check_sql($sql));
}
unset($sql);
}
}
}
}
//if there are no groups listed in v_menu_item_groups under menu_uuid then add the default groups
$sql = "select count(*) as count from v_menu_item_groups ";
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement);
if ($sub_result['count'] == 0) {
//no menu item groups found add the defaults
foreach($apps as $app) {
foreach ($app['menu'] as $sub_row) {
foreach ($sub_row['groups'] as $group) {
//add the record
$sql = "insert into v_menu_item_groups ";
$sql .= "(";
$sql .= "menu_uuid, ";
$sql .= "menu_item_uuid, ";
$sql .= "group_name ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$this->menu_uuid."', ";
$sql .= "'".$sub_row['uuid']."', ";
$sql .= "'".$group."' ";
$sql .= ")";
$db->exec($sql);
unset($sql);
}
}
}
}
//save the changes to the database
//$db->commit();
} //end function
//create the menu
function build_html($sql, $menu_item_level) {
$db = $this->db;
$db_menu_full = '';
if (!isset($_SESSION['groups'])) {
$_SESSION['groups'][0]['group_name'] = 'public';
}
if (strlen($sql) == 0) { //default sql for base of the menu
$sql = "select * from v_menu_items ";
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
$sql .= "and menu_item_parent_uuid is null ";
$sql .= "and menu_item_uuid in ";
$sql .= "(select menu_item_uuid from v_menu_item_groups where menu_uuid = '".$this->menu_uuid."' ";
$sql .= "and ( ";
if (!isset($_SESSION['groups'])) {
$sql .= "group_name = 'public' ";
}
else {
$x = 0;
foreach($_SESSION['groups'] as $row) {
if ($x == 0) {
$sql .= "group_name = '".$row['group_name']."' ";
}
else {
$sql .= "or group_name = '".$row['group_name']."' ";
}
$x++;
}
}
$sql .= ") ";
$sql .= "and menu_item_uuid is not null ";
$sql .= ") ";
$sql .= "order by menu_item_order asc ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $field) {
$menu_tags = '';
switch ($field['menu_item_category']) {
case "internal":
$menu_tags = "href='".PROJECT_PATH.$field['menu_item_link']."'";
break;
case "external":
if (substr($field['menu_item_link'], 0,1) == "/") {
$field['menu_item_link'] = PROJECT_PATH . $field['menu_item_link'];
}
$menu_tags = "href='".$field['menu_item_link']."' target='_blank'";
break;
case "email":
$menu_tags = "href='mailto:".$field['menu_item_link']."'";
break;
}
if ($menu_item_level == "main") {
$db_menu = "<ul class='menu_main'>\n";
$db_menu .= "<li>\n";
if (!isset($_SESSION["username"])) {
$_SESSION["username"] = '';
}
if (strlen($_SESSION["username"]) == 0) {
$db_menu .= "<a $menu_tags style='padding: 0px 0px; border-style: none; background: none;'><h2 align='center' style=''>".$field['menu_item_title']."</h2></a>\n";
}
else {
if ($field['menu_item_link'] == "/login.php" || $field['menu_item_link'] == "/users/signup.php") {
//hide login and sign-up when the user is logged in
}
else {
$db_menu .= "<a ".$menu_tags." style='padding: 0px 0px; border-style: none; background: none;'><h2 align='center' style=''>".$field['menu_item_title']."</h2></a>\n";
}
}
}
$menu_item_level = 0;
if (strlen($field['menu_item_uuid']) > 0) {
$db_menu .= $this->build_child_html($menu_item_level, $field['menu_item_uuid']);
}
if ($menu_item_level == "main") {
$db_menu .= "</li>\n";
$db_menu .= "</ul>\n\n";
}
$db_menu_full .= $db_menu;
} //end for each
unset($prep_statement, $sql, $result);
return $db_menu_full;
}
//create the sub menus
function build_child_html($menu_item_level, $menu_item_uuid) {
$db = $this->db;
$menu_item_level = $menu_item_level+1;
if (count($_SESSION['groups']) == 0) {
$_SESSION['groups'][0]['group_name'] = 'public';
}
$sql = "select * from v_menu_items ";
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
$sql .= "and menu_item_parent_uuid = '$menu_item_uuid' ";
$sql .= "and menu_item_uuid in ";
$sql .= "(select menu_item_uuid from v_menu_item_groups where menu_uuid = '".$this->menu_uuid."' ";
$sql .= "and ( ";
if (count($_SESSION['groups']) == 0) {
$sql .= "group_name = 'public' ";
}
else {
$x = 0;
foreach($_SESSION['groups'] as $row) {
if ($x == 0) {
$sql .= "group_name = '".$row['group_name']."' ";
}
else {
$sql .= "or group_name = '".$row['group_name']."' ";
}
$x++;
}
}
$sql .= ") ";
$sql .= ") ";
$sql .= "order by menu_item_order, menu_item_title asc ";
$prep_statement_2 = $db->prepare($sql);
$prep_statement_2->execute();
$result_2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
if (count($result_2) > 0) {
//child menu found
$db_menu_sub = "<ul class='menu_sub'>\n";
foreach($result_2 as $row) {
$menu_item_link = $row['menu_item_link'];
$menu_item_category = $row['menu_item_category'];
$menu_item_uuid = $row['menu_item_uuid'];
$menu_item_parent_uuid = $row['menu_item_parent_uuid'];
switch ($menu_item_category) {
case "internal":
$menu_tags = "href='".PROJECT_PATH.$menu_item_link."'";
break;
case "external":
if (substr($menu_item_link, 0,1) == "/") {
$menu_item_link = PROJECT_PATH . $menu_item_link;
}
$menu_tags = "href='".$menu_item_link."' target='_blank'";
break;
case "email":
$menu_tags = "href='mailto:".$menu_item_link."'";
break;
}
$db_menu_sub .= "<li>";
//get sub menu for children
if (strlen($menu_item_uuid) > 0) {
$str_child_menu = $this->build_child_html($menu_item_level, $menu_item_uuid);
}
if (strlen($str_child_menu) > 1) {
$db_menu_sub .= "<a ".$menu_tags.">".$row['menu_item_title']."</a>";
$db_menu_sub .= $str_child_menu;
unset($str_child_menu);
}
else {
$db_menu_sub .= "<a ".$menu_tags.">".$row['menu_item_title']."</a>";
}
$db_menu_sub .= "</li>\n";
}
unset($sql, $result_2);
$db_menu_sub .="</ul>\n";
return $db_menu_sub;
}
unset($prep_statement_2, $sql);
}
}
?>
+50
View File
@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>
+121
View File
@@ -0,0 +1,121 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the follow me class
class schema {
public $db;
public $apps;
public $db_type;
public $result;
//get the list of installed apps from the core and mod directories
public function __construct() {
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$x=0;
foreach ($config_list as &$config_path) {
include($config_path);
$x++;
}
$this->apps = $apps;
}
//create the database schema
public function sql() {
$sql = '';
$sql_schema = '';
foreach ($this->apps as $app) {
if (count($app['db'])) {
foreach ($app['db'] as $row) {
//create the sql string
$table_name = $row['table'];
$sql = "CREATE TABLE " . $row['table'] . " (\n";
$field_count = 0;
foreach ($row['fields'] as $field) {
if ($field['deprecated'] == "true") {
//skip this field
}
else {
if ($field_count > 0 ) { $sql .= ",\n"; }
if (is_array($field['name'])) {
$sql .= $field['name']['text']." ";
}
else {
$sql .= $field['name']." ";
}
if (is_array($field['type'])) {
$sql .= $field['type'][$this->db_type];
}
else {
$sql .= $field['type'];
}
if ($field['key']['type'] == "primary") {
$sql .= " PRIMARY KEY";
}
if ($field['key']['type'] == "foreign") {
if ($this->db_type == "pgsql") {
//$sql .= " references ".$field['key']['reference']['table']."(".$field['key']['reference']['field'].")";
}
if ($this->db_type == "sqlite") {
//$sql .= " references ".$field['key']['reference']['table']."(".$field['key']['reference']['field'].")";
}
if ($this->db_type == "mysql") {
//$sql .= " references ".$field['key']['reference']['table']."(".$field['key']['reference']['field'].")";
}
}
$field_count++;
}
}
if ($this->db_type == "mysql") {
$sql .= ") ENGINE=INNODB;";
}
else {
$sql .= ");";
}
$this->result['sql'][] = $sql;
unset($sql);
}
}
}
}
//create the database schema
public function exec() {
foreach ($this->result['sql'] as $sql) {
//start the sql transaction
$this->db->beginTransaction();
//execute the sql query
try {
$this->db->query($sql);
}
catch (PDOException $error) {
echo "error: " . $error->getMessage() . " sql: $sql<br/>";
}
//complete the transaction
$this->db->commit();
}
}
}
+694
View File
@@ -0,0 +1,694 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the directory class
class switch_directory {
public $domain_uuid;
public $domain_name;
public $db_type;
public $extension;
public $number_alias;
public $password;
public $vm_password;
public $accountcode;
public $effective_caller_id_name;
public $effective_caller_id_number;
public $outbound_caller_id_name;
public $outbound_caller_id_number;
public $limit_max=5;
public $limit_destination;
public $vm_enabled=1;
public $vm_mailto;
public $vm_attach_file;
public $vm_keep_local_after_email;
public $user_context;
public $range;
public $autogen_users;
public $toll_allow;
public $call_group;
public $hold_music;
public $auth_acl;
public $cidr;
public $sip_force_contact;
public $sip_force_expires;
public $nibble_account;
public $mwi_account;
public $sip_bypass_media;
public $enabled;
public $description;
public $cidr;
public $number_alias;
// get domain_uuid
public function get_domain_uuid() {
return $this->domain_uuid;
}
// set domain_uuid
public function set_domain_uuid($domain_uuid){
$this->domain_uuid = $domain_uuid;
}
// get domain_name
public function get_domain_name() {
return $this->domain_name;
}
// set domain_name
public function set_domain_name($domain_name){
$this->domain_name = $domain_name;
}
// get db_type
public function get_db_type() {
return $this->db_type;
}
// set db_type
public function set_db_type($db_type){
$this->db_type = $db_type;
}
// get extension
public function get_extension() {
return $this->extension;
}
// set extension
public function set_extension($extension){
$this->extension = $extension;
}
public function add() {
global $db;
$domain_uuid = $this->domain_uuid;
$domain_name = $this->domain_name;
$extension = $this->extension;
$number_alias = $this->number_alias;
$password = $this->password;
$autogen_users = $this->autogen_users;
$provisioning_list = $this->provisioning_list;
$vm_password = $this->vm_password;
$accountcode = $this->accountcode;
$effective_caller_id_name = $this->effective_caller_id_name;
$effective_caller_id_number = $this->effective_caller_id_number;
$outbound_caller_id_name = $this->outbound_caller_id_name;
$outbound_caller_id_number = $this->outbound_caller_id_number;
$limit_max = $this->limit_max;
$limit_destination = $this->limit_destination;
$vm_enabled = $this->vm_enabled;
$vm_mailto = $this->vm_mailto;
$vm_attach_file = $this->vm_attach_file;
$vm_keep_local_after_email = $this->vm_keep_local_after_email;
$user_context = $this->user_context;
$toll_allow = $this->toll_allow;
$call_group = $this->call_group;
$hold_music = $this->hold_music;
$auth_acl = $this->auth_acl;
$cidr = $this->cidr;
$sip_force_contact = $this->sip_force_contact;
$sip_force_expires = $this->sip_force_expires;
$nibble_account = $this->nibble_account;
$mwi_account = $this->mwi_account;
$sip_bypass_media = $this->sip_bypass_media;
$enabled = $this->enabled;
$description = $this->description;
$db->beginTransaction();
for ($i=1; $i<=$range; $i++) {
if (extension_exists($extension)) {
//extension exists
}
else {
//extension does not exist add it
$password = generate_password();
$sql = "insert into v_extensions ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "extension_uuid, ";
$sql .= "extension, ";
$sql .= "number_alias, ";
$sql .= "password, ";
$sql .= "provisioning_list, ";
$sql .= "vm_password, ";
$sql .= "accountcode, ";
$sql .= "effective_caller_id_name, ";
$sql .= "effective_caller_id_number, ";
$sql .= "outbound_caller_id_name, ";
$sql .= "outbound_caller_id_number, ";
$sql .= "limit_max, ";
$sql .= "limit_destination, ";
$sql .= "vm_enabled, ";
$sql .= "vm_mailto, ";
$sql .= "vm_attach_file, ";
$sql .= "vm_keep_local_after_email, ";
$sql .= "user_context, ";
$sql .= "toll_allow, ";
$sql .= "call_group, ";
$sql .= "hold_music, ";
$sql .= "auth_acl, ";
$sql .= "cidr, ";
$sql .= "sip_force_contact, ";
if (strlen($sip_force_expires) > 0) {
$sql .= "sip_force_expires, ";
}
if (strlen($nibble_account) > 0) {
$sql .= "nibble_account, ";
}
if (strlen($mwi_account) > 0) {
$sql .= "mwi_account, ";
}
$sql .= "sip_bypass_media, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$extension_uuid', ";
$sql .= "'$extension', ";
$sql .= "'$number_alias', ";
$sql .= "'$password', ";
$sql .= "'$provisioning_list', ";
$sql .= "'user-choose', ";
$sql .= "'$accountcode', ";
$sql .= "'$effective_caller_id_name', ";
$sql .= "'$effective_caller_id_number', ";
$sql .= "'$outbound_caller_id_name', ";
$sql .= "'$outbound_caller_id_number', ";
$sql .= "'$limit_max', ";
$sql .= "'$limit_destination', ";
$sql .= "'$vm_enabled', ";
$sql .= "'$vm_mailto', ";
$sql .= "'$vm_attach_file', ";
$sql .= "'$vm_keep_local_after_email', ";
$sql .= "'$user_context', ";
$sql .= "'$toll_allow', ";
$sql .= "'$call_group', ";
$sql .= "'$hold_music', ";
$sql .= "'$auth_acl', ";
$sql .= "'$cidr', ";
$sql .= "'$sip_force_contact', ";
if (strlen($sip_force_expires) > 0) {
$sql .= "'$sip_force_expires', ";
}
if (strlen($nibble_account) > 0) {
$sql .= "'$nibble_account', ";
}
if (strlen($mwi_account) > 0) {
if (strpos($mwi_account, '@') === false) {
if (count($_SESSION["domains"]) > 1) {
$mwi_account .= "@".$domain_name;
}
else {
$mwi_account .= "@\$\${domain}";
}
}
$sql .= "'$mwi_account', ";
}
$sql .= "'$sip_bypass_media', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
$extension++;
}
$db->commit();
}
public function update() {
global $db;
$domain_uuid = $this->domain_uuid;
$domain_name = $this->domain_name;
$extension = $this->extension;
$number_alias = $this->number_alias;
$password = $this->password;
$autogen_users = $this->autogen_users;
$provisioning_list = $this->provisioning_list;
$vm_password = $this->vm_password;
$accountcode = $this->accountcode;
$effective_caller_id_name = $this->effective_caller_id_name;
$effective_caller_id_number = $this->effective_caller_id_number;
$outbound_caller_id_name = $this->outbound_caller_id_name;
$outbound_caller_id_number = $this->outbound_caller_id_number;
$limit_max = $this->limit_max;
$limit_destination = $this->limit_destination;
$vm_enabled = $this->vm_enabled;
$vm_mailto = $this->vm_mailto;
$vm_attach_file = $this->vm_attach_file;
$vm_keep_local_after_email = $this->vm_keep_local_after_email;
$user_context = $this->user_context;
$toll_allow = $this->toll_allow;
$call_group = $this->call_group;
$hold_music = $this->hold_music;
$auth_acl = $this->auth_acl;
$cidr = $this->cidr;
$sip_force_contact = $this->sip_force_contact;
$sip_force_expires = $this->sip_force_expires;
$nibble_account = $this->nibble_account;
$mwi_account = $this->mwi_account;
$sip_bypass_media = $this->sip_bypass_media;
$enabled = $this->enabled;
$description = $this->description;
//$user_list_array = explode("|", $user_list);
//foreach($user_list_array as $tmp_user){
// $user_password = generate_password();
// if (strlen($tmp_user) > 0) {
// user_add($tmp_user, $user_password, $user_email);
// }
//}
//unset($tmp_user);
if (strlen($password) == 0) {
$password = generate_password();
}
$sql = "update v_extensions set ";
$sql .= "extension = '$extension', ";
$sql .= "number_alias = '$number_alias', ";
$sql .= "password = '$password', ";
$sql .= "provisioning_list = '$provisioning_list', ";
if (strlen($vm_password) > 0) {
$sql .= "vm_password = '$vm_password', ";
}
else {
$sql .= "vm_password = 'user-choose', ";
}
$sql .= "accountcode = '$accountcode', ";
$sql .= "effective_caller_id_name = '$effective_caller_id_name', ";
$sql .= "effective_caller_id_number = '$effective_caller_id_number', ";
$sql .= "outbound_caller_id_name = '$outbound_caller_id_name', ";
$sql .= "outbound_caller_id_number = '$outbound_caller_id_number', ";
$sql .= "limit_max = '$limit_max', ";
$sql .= "limit_destination = '$limit_destination', ";
$sql .= "vm_enabled = '$vm_enabled', ";
$sql .= "vm_mailto = '$vm_mailto', ";
$sql .= "vm_attach_file = '$vm_attach_file', ";
$sql .= "vm_keep_local_after_email = '$vm_keep_local_after_email', ";
$sql .= "user_context = '$user_context', ";
$sql .= "toll_allow = '$toll_allow', ";
$sql .= "call_group = '$call_group', ";
$sql .= "hold_music = '$hold_music', ";
$sql .= "auth_acl = '$auth_acl', ";
$sql .= "cidr = '$cidr', ";
$sql .= "sip_force_contact = '$sip_force_contact', ";
if (strlen($sip_force_expires) == 0) {
$sql .= "sip_force_expires = null, ";
}
else {
$sql .= "sip_force_expires = '$sip_force_expires', ";
}
if (strlen($nibble_account) == 0) {
$sql .= "nibble_account = null, ";
}
else {
$sql .= "nibble_account = '$nibble_account', ";
}
if (strlen($mwi_account) > 0) {
if (strpos($mwi_account, '@') === false) {
if (count($_SESSION["domains"]) > 1) {
$mwi_account .= "@".$domain_name;
}
else {
$mwi_account .= "@\$\${domain}";
}
}
}
$sql .= "mwi_account = '$mwi_account', ";
$sql .= "sip_bypass_media = '$sip_bypass_media', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
$db->exec(check_sql($sql));
unset($sql);
}
function delete() {
global $db;
$domain_uuid = $this->domain_uuid;
$extension_uuid = $this->extension_uuid;
if (strlen($extension_uuid)>0) {
$sql = "";
$sql .= "delete from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
}
function import_sql($data){
$count=count($data);
$keys=$values=SplFixedArray($count);
$keys=array_keys($data);
$values=array_values($data);
for($i=0;$i<$count;$i++){
$keys[$i]= str_replace("-", "_", $keys[$i]);
$this->{$keys[$i]}=$values[$i];
}
}
function set_bool(&$var,$default=null){
$var=strtolower($var);
if ($var==="true") return;
elseif ($var==="false") return;
elseif ($var==true) $var="true";
elseif ($var==false) $var="false";
elseif(!is_null($default)) {
$var=$default;
$this->set_bool($var);
}
}
function generate_xml($single=1){
//switch_account_code!! How should we be passing this??
if ($this->enabled== "false" || !$this->enabled) {
return false;//This the best way??
}
$this->vm_password = str_replace("#", "", $this->vm_password); //preserves leading zeros//**Generic Validation!
/*if(!in_array($this->vm_enabled,array("false","true"))) {//**Generic Validation!
$this->vm_enabled = "true";
}
if(!in_array($this->vm_attach_file,array("false","true"))) {//**Generic Validation!
$this->vm_attach_file = "true";
}
if(!in_array($this->vm_keep_local_after_email,array("false","true"))) {//**Generic Validation!
$this->vm_keep_local_after_email = "true";
}
*/
$this->set_bool($this->vm_enabled,1);
$this->set_bool($this->vm_attach_file,1);
$this->set_bool($this->vm_keep_local_after_email,1);
//remove invalid characters from the file names //**Generic Validation!
$this->extension = str_replace(" ", "_", $this->extension);
$this->extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $this->extension);
/*if (!$extension_xml_condensed) { <--- what do I do with this??
$fout = fopen($_SESSION['switch']['extensions']['dir']."/v_".$extension.".xml","w");
$tmp_xml .= "<include>\n";
}*/
if (strlen($this->cidr)) {
$this->cidr = " cidr=\"" . $this->cidr . "\"";
}
if (strlen($this->number_alias)) {
$this->number_alias = " number-alias=\"".$this->number_alias."\"";
}
if($single) $tmp_xml = "<include>\n";
else $tmp_xml = "";
$tmp_xml .= " <user id=\"".$this->extension."\"".$this->cidr."".$this->number_alias.">\n";
$tmp_xml .= " <params>\n";
$tmp_xml .= " <param name=\"password\" value=\"" . $this->password . "\"/>\n";
$tmp_xml .= " <param name=\"vm-enabled\" value=\"".$this->vm_enabled."\"/>\n";
if ($this->vm_enabled=="true"){
$tmp_xml .= " <param name=\"vm-password\" value=\"" . $this->vm_password . "\"/>\n";
if(strlen($this->vm_mailto)) {
$tmp_xml .= " <param name=\"vm-email-all-messages\" value=\"true\"/>\n";
$tmp_xml .= " <param name=\"vm-attach-file\" value=\"".$this->vm_attach_file."\"/>\n";
$tmp_xml .= " <param name=\"vm-keep-local-after-email\" value=\"".$this->vm_keep_local_after_email."\"/>\n";
$tmp_xml .= " <param name=\"vm-mailto\" value=\"" . $this->vm_mailto . "\"/>\n";
}
}
if (strlen($this->mwi_account)) {
$tmp_xml .= " <param name=\"MWI-Account\" value=\"" . $this->mwi_account . "\"/>\n";
}
if (strlen($this->auth_acl)) {
$tmp_xml .= " <param name=\"auth-acl\" value=\"" . $this->auth_acl . "\"/>\n";
}
$tmp_xml .= " </params>\n";
$tmp_xml .= " <variables>\n";
if (strlen($this->hold_music)) {
$tmp_xml .= " <variable name=\"hold_music\" value=\"" . $this->hold_music . "\"/>\n";
}
if (strlen($this->toll_allow)){
$tmp_xml .= " <variable name=\"toll_allow\" value=\"" . $this->toll_allow . "\"/>\n";
}
if (strlen($this->accountcode)){
$tmp_xml .= " <variable name=\"accountcode\" value=\"" . $this->accountcode . "\"/>\n";
}
$tmp_xml .= " <variable name=\"user_context\" value=\"" . $this->user_context . "\"/>\n";
if (strlen($this->effective_caller_id_name)) {
$tmp_xml .= " <variable name=\"effective_caller_id_name\" value=\"" . $this->effective_caller_id_name . "\"/>\n";
}
if (strlen($this->outbound_caller_id_number)) {
$tmp_xml .= " <variable name=\"effective_caller_id_number\" value=\"" . $this->effective_caller_id_number . "\"/>\n";
}
if (strlen($this->outbound_caller_id_name)) {
$tmp_xml .= " <variable name=\"outbound_caller_id_name\" value=\"" . $this->outbound_caller_id_name . "\"/>\n";
}
if (strlen($this->outbound_caller_id_number)) {
$tmp_xml .= " <variable name=\"outbound_caller_id_number\" value=\"" . $this->outbound_caller_id_number . "\"/>\n";
}
if (!strlen($this->limit_max)) {//**validation
$this->limit_max=5;
}
$tmp_xml .= " <variable name=\"limit_max\" value=\"" . $this->limit_max . "\"/>\n";
if (strlen($this->limit_destination)) {
$tmp_xml .= " <variable name=\"limit_destination\" value=\"" . $this->limit_destination . "\"/>\n";
}
if (strlen($this->sip_force_contact)) {
$tmp_xml .= " <variable name=\"sip-force-contact\" value=\"" . $this->sip_force_contact . "\"/>\n";
}
if (strlen($this->sip_force_expires)) {
$tmp_xml .= " <variable name=\"sip-force-expires\" value=\"" . $this->sip_force_expires . "\"/>\n";
}
if (strlen($this->nibble_account)) {
$tmp_xml .= " <variable name=\"nibble_account\" value=\"" . $this->nibble_account . "\"/>\n";
}
switch ($this->sip_bypass_media) {
case "bypass-media":
$tmp_xml .= " <variable name=\"bypass_media\" value=\"true\"/>\n";
break;
case "bypass-media-after-bridge":
$tmp_xml .= " <variable name=\"bypass_media_after_bridge\" value=\"true\"/>\n";
break;
case "proxy-media":
$tmp_xml .= " <variable name=\"proxy_media\" value=\"true\"/>\n";
break;
}
$tmp_xml .= " </variables>\n";
$tmp_xml .= " </user>\n";
if($single) { $tmp_xml .= "</include>\n"; }
return $tmp_xml;
}
function xml_save_all() {
global $db, $config;
$domain_uuid = $this->domain_uuid;
$domain_name = $this->domain_name;
//get the system settings paths and set them as variables
$settings_array = v_settings();
foreach($settings_array as $name => $value) {
$$name = $value;
}
//determine the extensions parent directory
$extension_parent_dir = realpath($_SESSION['switch']['extensions']['dir']."/..");
// delete all old extensions to prepare for new ones
if($dh = opendir($_SESSION['switch']['extensions']['dir'])) {
$files = Array();
while($file = readdir($dh)) {
if($file != "." && $file != ".." && $file[0] != '.') {
if(is_dir($dir . "/" . $file)) {
//this is a directory do nothing
} else {
//check if file is an extension; verify the file numeric and the extension is xml
if (substr($file,0,2) == 'v_' && substr($file,-4) == '.xml') {
unlink($_SESSION['switch']['extensions']['dir']."/".$file);
}
}
}
}
closedir($dh);
}
$sql = "";
$sql .= "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by call_group asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$i = 0;
$extension_xml_condensed = false;
if ($extension_xml_condensed) {
$fout = fopen($_SESSION['switch']['extensions']['dir']."/v_extensions.xml","w");
$tmp_xml = "<include>\n";
}
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$call_group = $row['call_group'];
$call_group = str_replace(";", ",", $call_group);
$tmp_array = explode(",", $call_group);
foreach ($tmp_array as &$tmp_call_group) {
if (strlen($tmp_call_group) > 0) {
if (strlen($call_group_array[$tmp_call_group]) == 0) {
$call_group_array[$tmp_call_group] = $row['extension'];
}
else {
$call_group_array[$tmp_call_group] = $call_group_array[$tmp_call_group].','.$row['extension'];
}
}
$i++;
}
if ($row['enabled'] != "false") {
//$this->import_sql($row);//Do I need to be worried about ghost values? Maybe I should make a new object?
//if (strlen($switch_account_code)) $this->accountcode=$switch_account_code;
//$tmp_xml.=$this->generate_xml(1);
$one_row=new fs_directory;
$one_row->import_sql($row);//make a new object to flush ghost rows. And we can call this as static.
if (strlen($switch_account_code)) $one_row->accountcode=$switch_account_code;
$tmp_xml.=$one_row->generate_xml(false);
if (!$extension_xml_condensed) {
$tmp_xml .= "</include>\n";
fwrite($fout, $tmp_xml);
unset($tmp_xml);
fclose($fout);
}
}
}
unset ($prep_statement);
if ($extension_xml_condensed) {
$tmp_xml .= "</include>\n";
fwrite($fout, $tmp_xml);
unset($tmp_xml);
fclose($fout);
}
//define the group members
$tmp_xml = "<!--\n";
$tmp_xml .= " NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE\n";
$tmp_xml .= "\n";
$tmp_xml .= " FreeSWITCH works off the concept of users and domains just like email.\n";
$tmp_xml .= " You have users that are in domains for example 1000@domain.com.\n";
$tmp_xml .= "\n";
$tmp_xml .= " When freeswitch gets a register packet it looks for the user in the directory\n";
$tmp_xml .= " based on the from or to domain in the packet depending on how your sofia profile\n";
$tmp_xml .= " is configured. Out of the box the default domain will be the IP address of the\n";
$tmp_xml .= " machine running FreeSWITCH. This IP can be found by typing \"sofia status\" at the\n";
$tmp_xml .= " CLI. You will register your phones to the IP and not the hostname by default.\n";
$tmp_xml .= " If you wish to register using the domain please open vars.xml in the root conf\n";
$tmp_xml .= " directory and set the default domain to the hostname you desire. Then you would\n";
$tmp_xml .= " use the domain name in the client instead of the IP address to register\n";
$tmp_xml .= " with FreeSWITCH.\n";
$tmp_xml .= "\n";
$tmp_xml .= " NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE\n";
$tmp_xml .= "-->\n";
$tmp_xml .= "\n";
$tmp_xml .= "<include>\n";
$tmp_xml .= " <!--the domain or ip (the right hand side of the @ in the addr-->\n";
if ($extension_dir_name == "default") {
$tmp_xml .= " <domain name=\"\$\${domain}\">\n";
}
else {
$tmp_xml .= " <domain name=\"".$extension_dir_name."\">\n";
}
$tmp_xml .= " <params>\n";
$tmp_xml .= " <param name=\"dial-string\" value=\"{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${dialed_domain}}\${sofia_contact(\${dialed_user}@\${dialed_domain})}\"/>\n";
$tmp_xml .= " </params>\n";
$tmp_xml .= "\n";
$tmp_xml .= " <variables>\n";
$tmp_xml .= " <variable name=\"record_stereo\" value=\"true\"/>\n";
$tmp_xml .= " <variable name=\"default_gateway\" value=\"\$\${default_provider}\"/>\n";
$tmp_xml .= " <variable name=\"default_areacode\" value=\"\$\${default_areacode}\"/>\n";
$tmp_xml .= " <variable name=\"transfer_fallback_extension\" value=\"operator\"/>\n";
$tmp_xml .= " <variable name=\"export_vars\" value=\"domain_name\"/>\n";
$tmp_xml .= " </variables>\n";
$tmp_xml .= "\n";
$tmp_xml .= " <groups>\n";
$tmp_xml .= " <group name=\"".$extension_dir_name."\">\n";
$tmp_xml .= " <users>\n";
$tmp_xml .= " <X-PRE-PROCESS cmd=\"include\" data=\"".$extension_dir_name."/*.xml\"/>\n";
$tmp_xml .= " </users>\n";
$tmp_xml .= " </group>\n";
$tmp_xml .= "\n";
$previous_call_group = "";
foreach ($call_group_array as $key => $value) {
$call_group = $key;
$extension_list = $value;
if (strlen($call_group) > 0) {
if ($previous_call_group != $call_group) {
$tmp_xml .= " <group name=\"$call_group\">\n";
$tmp_xml .= " <users>\n";
$tmp_xml .= " <!--\n";
$tmp_xml .= " type=\"pointer\" is a pointer so you can have the\n";
$tmp_xml .= " same user in multiple groups. It basically means\n";
$tmp_xml .= " to keep searching for the user in the directory.\n";
$tmp_xml .= " -->\n";
$extension_array = explode(",", $extension_list);
foreach ($extension_array as &$tmp_extension) {
$tmp_xml .= " <user id=\"$tmp_extension\" type=\"pointer\"/>\n";
}
$tmp_xml .= " </users>\n";
$tmp_xml .= " </group>\n";
$tmp_xml .= "\n";
}
$previous_call_group = $call_group;
}
unset($call_group);
}
$tmp_xml .= " </groups>\n";
$tmp_xml .= "\n";
$tmp_xml .= " </domain>\n";
$tmp_xml .= "</include>";
//remove invalid characters from the file names
$extension_dir_name = str_replace(" ", "_", $extension_dir_name);
$extension_dir_name = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension_dir_name);
//write the xml file
$fout = fopen($extension_parent_dir."/".$extension_dir_name.".xml","w");
fwrite($fout, $tmp_xml);
unset($tmp_xml);
fclose($fout);
//syncrhonize the phone directory
sync_directory();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//call reloadxml direct
//$cmd = "api reloadxml";
//event_socket_request_cmd($cmd);
//unset($cmd);
} //end function
} //class
?>
+530
View File
@@ -0,0 +1,530 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the directory class
class switch_fax {
public $db;
public $domain_uuid;
public $domain_name;
public $dialplan_uuid;
public $context;
public $fax_uuid;
public $fax_name;
public $fax_extension;
public $fax_email;
public $fax_pin_number;
public $fax_caller_id_name;
public $fax_caller_id_number;
public $fax_forward_number;
public $fax_user_list;
public $fax_description;
public function __construct() {
require_once "includes/classes/database.php";
$this->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
}
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
public function count() {
$database = new database;
$database->domain_uuid = $this->domain_uuid;
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
return $database->count();
}
public function find() {
$database = new database;
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
if ($this->fax_uuid) {
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
}
if ($this->order_by) {
$database->order_by = $this->order_by;
}
if ($this->order_type) {
$database->order_type = $this->order_type;
}
return $database->find();
}
public function add() {
//add the fax
if (strlen($this->fax_extension) > 0) {
//add the dialplan
$database = new database;
$database->table = "v_dialplans";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_name'] = $this->fax_name;
$database->fields['dialplan_order'] = '333';
$database->fields['dialplan_context'] = $this->context;
$database->fields['dialplan_enabled'] = $this->fax_enabled;
$database->fields['dialplan_description'] = $this->fax_description;
$database->fields['app_uuid'] = $this->app_uuid;
$database->add();
//add the dialplan details
$detail_data = '^'.$this->fax_extension.'$';
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'condition'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'destination_number';
$database->fields['dialplan_detail_data'] = $detail_data;
$database->fields['dialplan_detail_order'] = '005';
$database->add();
if (file_exists(PHP_BINDIR."/php")) { define(PHP_BIN, 'php'); }
if (file_exists(PHP_BINDIR."/php.exe")) { define(PHP_BIN, 'php.exe'); }
$dialplan_detail_data = "api_hangup_hook=system ".PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php ";
$dialplan_detail_data .= "email=".$this->fax_email." ";
$dialplan_detail_data .= "extension=".$this->fax_extension." ";
$dialplan_detail_data .= "name=\\\\\\\${last_fax} ";
$dialplan_detail_data .= "messages='result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}' ";
$dialplan_detail_data .= "domain=".$domain_name." ";
$dialplan_detail_data .= "caller_id_name='\\\\\\\${caller_id_name}' ";
$dialplan_detail_data .= "caller_id_number=\\\\\\\${caller_id_number} ";
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '010';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'answer';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '015';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'fax_enable_t38=true';
$database->fields['dialplan_detail_order'] = '020';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'fax_enable_t38_request=true';
$database->fields['dialplan_detail_order'] = '025';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'playback';
$database->fields['dialplan_detail_data'] = 'silence_stream://2000';
$database->fields['dialplan_detail_order'] = '030';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}';
$database->fields['dialplan_detail_order'] = '035';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'rxfax';
if (count($_SESSION["domains"]) > 1) {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
else {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '040';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'hangup';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '045';
$database->add();
}
//add the fax
$fax_uuid = uuid();
$database = new database;
$database->table = "v_fax";
$database->fields['domain_uuid'] = $this->domain_uuid;
if (strlen($this->fax_extension) > 0) {
$database->fields['fax_extension'] = $this->fax_extension;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
}
$database->fields['fax_uuid'] = $this->fax_uuid;
$database->fields['fax_name'] = $this->fax_name;
$database->fields['fax_email'] = $this->fax_email;
$database->fields['fax_pin_number'] = $this->fax_pin_number;
$database->fields['fax_caller_id_name'] = $this->fax_caller_id_name;
$database->fields['fax_caller_id_number'] = $this->fax_caller_id_number;
$database->fields['fax_forward_number'] = $this->fax_forward_number;
$database->fields['fax_user_list'] = $this->fax_user_list;
$database->fields['fax_description'] = $this->fax_description;
$database->add();
}
public function update() {
//udate the fax
//get the dialplan uuid
$database = new database;
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
}
//if the extension number is empty and the dialplan exists then delete the dialplan
if (strlen($this->fax_extension) == 0) {
if (strlen($this->dialplan_uuid) > 0) {
//delete dialplan entry
$database = new database;
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the child dialplan information
$database = new database;
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//update the table to remove the dialplan_uuid
$this->dialplan_uuid = '';
}
}
//update the fax
$fax_uuid = uuid();
$database = new database;
$database->table = "v_fax";
$database->fields['fax_uuid'] = $this->fax_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['fax_name'] = $this->fax_name;
$database->fields['fax_extension'] = $this->fax_extension;
$database->fields['fax_email'] = $this->fax_email;
$database->fields['fax_pin_number'] = $this->fax_pin_number;
$database->fields['fax_caller_id_name'] = $this->fax_caller_id_name;
$database->fields['fax_caller_id_number'] = $this->fax_caller_id_number;
$database->fields['fax_forward_number'] = $this->fax_forward_number;
$database->fields['fax_user_list'] = $this->fax_user_list;
$database->fields['fax_description'] = $this->fax_description;
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$database->update();
if (strlen($this->fax_extension) > 0) {
//update the dialplan
$database = new database;
$database->table = "v_dialplans";
$database->fields['dialplan_name'] = $this->fax_name;
$database->fields['dialplan_order'] = '333';
$database->fields['dialplan_context'] = $this->context;
$database->fields['dialplan_enabled'] = $this->fax_enabled;
$database->fields['dialplan_description'] = $this->dialplan_description;
$database->fields['app_uuid'] = $this->app_uuid;
if ($this->dialplan_uuid) {
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->update();
}
else {
// $this->dialplan_uuid = uuid();
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->add();
}
//delete the old dialplan details to prepare for new details
$database = new database;
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//add the dialplan details
$detail_data = '^'.$this->fax_extension.'$';
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'condition'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'destination_number';
$database->fields['dialplan_detail_data'] = $detail_data;
$database->fields['dialplan_detail_order'] = '005';
$database->add();
if (file_exists(PHP_BINDIR."/php")) { define(PHP_BIN, 'php'); }
if (file_exists(PHP_BINDIR."/php.exe")) { define(PHP_BIN, 'php.exe'); }
$dialplan_detail_data = "api_hangup_hook=system ".PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php ";
$dialplan_detail_data .= "email=".$this->fax_email." ";
$dialplan_detail_data .= "extension=".$this->fax_extension." ";
$dialplan_detail_data .= "name=\\\\\\\${last_fax} ";
$dialplan_detail_data .= "messages='result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}' ";
$dialplan_detail_data .= "domain=".$domain_name." ";
$dialplan_detail_data .= "caller_id_name='\\\\\\\${caller_id_name}' ";
$dialplan_detail_data .= "caller_id_number=\\\\\\\${caller_id_number} ";
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '010';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'answer';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '015';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'fax_enable_t38=true';
$database->fields['dialplan_detail_order'] = '020';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'fax_enable_t38_request=true';
$database->fields['dialplan_detail_order'] = '025';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'playback';
$database->fields['dialplan_detail_data'] = 'silence_stream://2000';
$database->fields['dialplan_detail_order'] = '030';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}';
$database->fields['dialplan_detail_order'] = '035';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'rxfax';
if (count($_SESSION["domains"]) > 1) {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
else {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '040';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'hangup';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '045';
$database->add();
}
}
function delete() {
//create the database object
$database = new database;
//start the transaction
//$count = $database->db->exec("BEGIN;");
//delete the fax
if (strlen($this->fax_uuid) > 0) {
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
unset($this->fax_uuid);
}
//delete the fax
if (strlen($this->fax_uuid) == 0) {
//select the dialplan entries
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
//delete the child dialplan information
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the dialplan information
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
}
//delete the fax
if (strlen($this->fax_uuid) > 0) {
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
unset($this->fax_uuid);
}
//commit the transaction
//$count = $database->db->exec("COMMIT;");
}
}
}
/*
require_once "includes/classes/database.php";
require_once "includes/classes/switch_fax.php";
$fax = new switch_fax;
$fax->domain_uuid = $_SESSION["domain_uuid"];
print_r($fax->find());
*/
?>
+621
View File
@@ -0,0 +1,621 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the directory class
class switch_ivr_menu {
public $db;
public $domain_uuid;
public $domain_name;
public $dialplan_uuid;
public $ivr_menu_uuid;
public $ivr_menu_name;
public $ivr_menu_extension;
public $ivr_menu_greet_long;
public $ivr_menu_greet_short;
public $ivr_menu_invalid_sound;
public $ivr_menu_exit_sound;
public $ivr_menu_confirm_macro;
public $ivr_menu_confirm_key;
public $ivr_menu_tts_engine;
public $ivr_menu_tts_voice;
public $ivr_menu_confirm_attempts;
public $ivr_menu_timeout;
public $ivr_menu_exit_app;
public $ivr_menu_exit_data;
public $ivr_menu_inter_digit_timeout;
public $ivr_menu_max_failures;
public $ivr_menu_max_timeouts;
public $ivr_menu_digit_len;
public $ivr_menu_direct_dial;
public $ivr_menu_enabled;
public $ivr_menu_description;
public $ivr_menu_option_uuid;
public $ivr_menu_option_digits;
public $ivr_menu_option_action;
public $ivr_menu_option_param;
public $ivr_menu_option_order;
public $ivr_menu_option_description;
public function __construct() {
require_once "includes/classes/database.php";
$this->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab';
}
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
public function get_domain_uuid() {
return $this->domain_uuid;
}
public function set_domain_uuid($domain_uuid){
$this->domain_uuid = $domain_uuid;
}
public function get_fields($table) {
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$x=0;
foreach ($config_list as &$config_path) {
include($config_path);
$x++;
}
//update the app db array add exists true or false
$sql = '';
foreach ($apps as $x => &$app) {
foreach ($app['db'] as $y => &$row) {
if ($row['table'] == $table) {
//check if the column exists
foreach ($row['fields'] as $z => $field) {
if ($field['deprecated'] == "true") {
//skip this field
}
else {
if (is_array($field['name'])) {
$field_name = $field['name']['text'];
}
else {
$field_name = $field['name'];
}
if (strlen(field_name) > 0) {
$fields[$z]['name'] = $field_name;
}
unset($field_name);
}
}
}
}
}
return $fields;
}
public function count() {
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
$database->domain_uuid = $this->domain_uuid;
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
return $database->count();
}
public function find() {
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
if (isset($this->ivr_menu_uuid)) {
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
}
if (isset($this->ivr_menu_option_uuid)) {
$database->where[2]['name'] = 'ivr_menu_uuid';
$database->where[2]['value'] = $this->ivr_menu_uuid;
$database->where[2]['operator'] = '=';
}
if (isset($this->order_by)) {
$database->order_by = $this->order_by;
}
if (isset($this->order_type)) {
$database->order_type = $this->order_type;
}
return $database->find();
}
public function add() {
//add the ivr menu
if (strlen($this->ivr_menu_option_action) == 0) {
if (strlen($this->ivr_menu_extension) > 0) {
//add the dialplan
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
$database->table = "v_dialplans";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_name'] = $this->ivr_menu_name;
$database->fields['dialplan_order'] = '333';
$database->fields['dialplan_context'] = $_SESSION['context'];
$database->fields['dialplan_enabled'] = $this->ivr_menu_enabled;
$database->fields['dialplan_description'] = $this->ivr_menu_description;
$database->fields['app_uuid'] = $this->app_uuid;
$database->add();
//add the dialplan details
$detail_data = '^'.$this->ivr_menu_extension.'$';
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'condition'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'destination_number';
$database->fields['dialplan_detail_data'] = $detail_data;
$database->fields['dialplan_detail_order'] = '005';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'answer';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '010';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'sleep';
$database->fields['dialplan_detail_data'] = '1000';
$database->fields['dialplan_detail_order'] = '015';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'hangup_after_bridge=true';
$database->fields['dialplan_detail_order'] = '020';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'ivr';
if (count($_SESSION["domains"]) > 1) {
$database->fields['dialplan_detail_data'] = $_SESSION['domain_name'].'-'.$this->ivr_menu_name;
}
else {
$database->fields['dialplan_detail_data'] = $this->ivr_menu_name;
}
$database->fields['dialplan_detail_order'] = '025';
$database->add();
if (strlen($this->ivr_menu_exit_app) > 0) {
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = $this->ivr_menu_exit_app;
$database->fields['dialplan_detail_data'] = $this->ivr_menu_exit_data;
$database->fields['dialplan_detail_order'] = '030';
$database->add();
}
}
//add the ivr menu
$ivr_menu_uuid = uuid();
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
$database->table = "v_ivr_menus";
$database->fields['domain_uuid'] = $this->domain_uuid;
if (strlen($this->ivr_menu_extension) > 0) {
$database->fields['ivr_menu_extension'] = $this->ivr_menu_extension;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
}
$database->fields['ivr_menu_uuid'] = $this->ivr_menu_uuid;
$database->fields['ivr_menu_name'] = $this->ivr_menu_name;
$database->fields['ivr_menu_greet_long'] = $this->ivr_menu_greet_long;
$database->fields['ivr_menu_greet_short'] = $this->ivr_menu_greet_short;
$database->fields['ivr_menu_invalid_sound'] = $this->ivr_menu_invalid_sound;
$database->fields['ivr_menu_exit_sound'] = $this->ivr_menu_exit_sound;
$database->fields['ivr_menu_confirm_macro'] = $this->ivr_menu_confirm_macro;
$database->fields['ivr_menu_confirm_key'] = $this->ivr_menu_confirm_key;
$database->fields['ivr_menu_tts_engine'] = $this->ivr_menu_tts_engine;
$database->fields['ivr_menu_tts_voice'] = $this->ivr_menu_tts_voice;
$database->fields['ivr_menu_confirm_attempts'] = $this->ivr_menu_confirm_attempts;
$database->fields['ivr_menu_timeout'] = $this->ivr_menu_timeout;
$database->fields['ivr_menu_exit_app'] = $this->ivr_menu_exit_app;
$database->fields['ivr_menu_exit_data'] = $this->ivr_menu_exit_data;
$database->fields['ivr_menu_inter_digit_timeout'] = $this->ivr_menu_inter_digit_timeout;
$database->fields['ivr_menu_max_failures'] = $this->ivr_menu_max_failures;
$database->fields['ivr_menu_max_timeouts'] = $this->ivr_menu_max_timeouts;
$database->fields['ivr_menu_max_timeouts'] = $this->ivr_menu_max_timeouts;
$database->fields['ivr_menu_digit_len'] = $this->ivr_menu_digit_len;
$database->fields['ivr_menu_digit_len'] = $this->ivr_menu_digit_len;
$database->fields['ivr_menu_direct_dial'] = $this->ivr_menu_direct_dial;
$database->fields['ivr_menu_direct_dial'] = $this->ivr_menu_direct_dial;
$database->fields['ivr_menu_enabled'] = $this->ivr_menu_enabled;
$database->fields['ivr_menu_description'] = $this->ivr_menu_description;
$database->add();
}
//add the ivr menu option
if (strlen($this->ivr_menu_option_action) > 0) {
$ivr_menu_uuid = uuid();
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
$database->table = "v_ivr_menu_options";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['ivr_menu_uuid'] = $this->ivr_menu_uuid;
$database->fields['ivr_menu_option_uuid'] = $this->ivr_menu_option_uuid;
$database->fields['ivr_menu_option_digits'] = $this->ivr_menu_option_digits;
$database->fields['ivr_menu_option_action'] = $this->ivr_menu_option_action;
$database->fields['ivr_menu_option_param'] = $this->ivr_menu_option_param;
$database->fields['ivr_menu_option_order'] = $this->ivr_menu_option_order;
$database->fields['ivr_menu_option_description'] = $this->ivr_menu_option_description;
$database->add();
}
}
public function update() {
//udate the ivr menu
if (strlen($this->ivr_menu_option_action) == 0) {
//get the dialplan uuid
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
}
//if the extension number is empty and the dialplan exists then delete the dialplan
if (strlen($this->ivr_menu_extension) == 0) {
if (strlen($this->dialplan_uuid) > 0) {
//delete dialplan entry
$database = new database;
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the child dialplan information
$database = new database;
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//update the table to remove the dialplan_uuid
$this->dialplan_uuid = '';
}
}
//update the ivr menu
$ivr_menu_uuid = uuid();
$database = new database;
$database->table = "v_ivr_menus";
$database->fields['ivr_menu_uuid'] = $this->ivr_menu_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['ivr_menu_name'] = $this->ivr_menu_name;
$database->fields['ivr_menu_extension'] = $this->ivr_menu_extension;
$database->fields['ivr_menu_greet_long'] = $this->ivr_menu_greet_long;
$database->fields['ivr_menu_greet_short'] = $this->ivr_menu_greet_short;
$database->fields['ivr_menu_invalid_sound'] = $this->ivr_menu_invalid_sound;
$database->fields['ivr_menu_exit_sound'] = $this->ivr_menu_exit_sound;
$database->fields['ivr_menu_confirm_macro'] = $this->ivr_menu_confirm_macro;
$database->fields['ivr_menu_confirm_key'] = $this->ivr_menu_confirm_key;
$database->fields['ivr_menu_tts_engine'] = $this->ivr_menu_tts_engine;
$database->fields['ivr_menu_tts_voice'] = $this->ivr_menu_tts_voice;
$database->fields['ivr_menu_confirm_attempts'] = $this->ivr_menu_confirm_attempts;
$database->fields['ivr_menu_timeout'] = $this->ivr_menu_timeout;
$database->fields['ivr_menu_exit_app'] = $this->ivr_menu_exit_app;
$database->fields['ivr_menu_exit_data'] = $this->ivr_menu_exit_data;
$database->fields['ivr_menu_inter_digit_timeout'] = $this->ivr_menu_inter_digit_timeout;
$database->fields['ivr_menu_max_failures'] = $this->ivr_menu_max_failures;
$database->fields['ivr_menu_max_timeouts'] = $this->ivr_menu_max_timeouts;
$database->fields['ivr_menu_max_timeouts'] = $this->ivr_menu_max_timeouts;
$database->fields['ivr_menu_digit_len'] = $this->ivr_menu_digit_len;
$database->fields['ivr_menu_digit_len'] = $this->ivr_menu_digit_len;
$database->fields['ivr_menu_direct_dial'] = $this->ivr_menu_direct_dial;
$database->fields['ivr_menu_direct_dial'] = $this->ivr_menu_direct_dial;
$database->fields['ivr_menu_enabled'] = $this->ivr_menu_enabled;
$database->fields['ivr_menu_description'] = $this->ivr_menu_description;
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->update();
if (strlen($this->ivr_menu_extension) > 0) {
//update the dialplan
$database = new database;
$database->table = "v_dialplans";
$database->fields['dialplan_name'] = $this->ivr_menu_name;
$database->fields['dialplan_order'] = '333';
$database->fields['dialplan_context'] = $_SESSION['context'];
$database->fields['dialplan_enabled'] = $this->ivr_menu_enabled;
$database->fields['dialplan_description'] = $this->ivr_menu_description;
$database->fields['app_uuid'] = $this->app_uuid;
if ($this->dialplan_uuid) {
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->update();
}
else {
$this->dialplan_uuid = uuid();
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->add();
}
//delete the old dialplan details to prepare for new details
$database = new database;
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//add the dialplan details
$detail_data = '^'.$this->ivr_menu_extension.'$';
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'condition'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'destination_number';
$database->fields['dialplan_detail_data'] = $detail_data;
$database->fields['dialplan_detail_order'] = '005';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'answer';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '010';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'sleep';
$database->fields['dialplan_detail_data'] = '1000';
$database->fields['dialplan_detail_order'] = '015';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'hangup_after_bridge=true';
$database->fields['dialplan_detail_order'] = '020';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'ivr';
if (count($_SESSION["domains"]) > 1) {
$database->fields['dialplan_detail_data'] = $_SESSION['domain_name'].'-'.$this->ivr_menu_name;
}
else {
$database->fields['dialplan_detail_data'] = $this->ivr_menu_name;
}
$database->fields['dialplan_detail_order'] = '025';
$database->add();
if (strlen($this->ivr_menu_exit_app) > 0) {
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = $this->ivr_menu_exit_app;
$database->fields['dialplan_detail_data'] = $this->ivr_menu_exit_data;
$database->fields['dialplan_detail_order'] = '030';
$database->add();
}
}
}
//update the ivr menu option
if (strlen($this->ivr_menu_option_action) > 0) {
$database = new database;
$database->table = "v_ivr_menu_options";
$database->fields['ivr_menu_option_digits'] = $this->ivr_menu_option_digits;
$database->fields['ivr_menu_option_action'] = $this->ivr_menu_option_action;
$database->fields['ivr_menu_option_param'] = $this->ivr_menu_option_param;
$database->fields['ivr_menu_option_order'] = $this->ivr_menu_option_order;
$database->fields['ivr_menu_option_description'] = $this->ivr_menu_option_description;
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->where[2]['name'] = 'ivr_menu_option_uuid';
$database->where[2]['value'] = $this->ivr_menu_option_uuid;
$database->where[2]['operator'] = '=';
$database->update();
}
}
function delete() {
//create the database object
$database = new database;
if ($this->db) {
$database->db = $this->db;
}
//start the transaction
//$count = $database->db->exec("BEGIN;");
//delete the ivr menu option
if (strlen($this->ivr_menu_option_uuid) > 0) {
$database->table = "v_ivr_menu_options";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_option_uuid';
$database->where[1]['value'] = $this->ivr_menu_option_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
unset($this->ivr_menu_option_uuid);
}
//delete the ivr menu
if (strlen($this->ivr_menu_option_uuid) == 0) {
//select the dialplan entries
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
//delete the child dialplan information
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the dialplan information
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
}
//delete child data
$database->table = "v_ivr_menu_options";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete parent data
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//commit the transaction
//$count = $database->db->exec("COMMIT;");
}
}
function get_xml(){
return $xml;
}
function save_xml($xml){
return $xml;
}
function xml_save_all() {
}
}
?>
+766
View File
@@ -0,0 +1,766 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//add the database structure
/*
require_once "includes/classes/modules.php";
$mod = new switch_modules;
$mod->dir = $_SESSION['switch']['mod']['dir'];
echo $mod->dir."\n";
//database connection object
$mod->db = $db;
//get modules from the database
$mod->get_modules();
//module exists
if ($mod->exists("mod_lua")) {
echo "exists true\n";
}
else {
echo "exists false\n";
}
//module active
if ($mod->active("mod_lua")) {
echo "active true\n";
}
else {
echo "active false\n";
}
//synch
$mod->synch();
echo $mod->msg;
//show module info
$result = $mod->info("mod_lua");
echo "<pre>\n";
print_r($result);
echo "</pre>\n";
//list modules
//$result = $mod->modules
//echo "<pre>\n";
//print_r($result);
//echo "</pre>\n";
*/
//define the directory class
class switch_modules {
public $db;
public $dir;
public $fp;
public $modules;
public $msg;
// get the additional information about a specific module
public function info($name) {
$module_label = substr($name, 4);
$module_label = ucwords(str_replace("_", " ", $module_label));
$mod['module_label'] = $module_label;
$mod['module_name'] = $name;
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
$mod['module_description'] = '';
switch ($name) {
case "mod_amr":
$mod['module_label'] = 'AMR';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'AMR codec.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_avmd":
$mod['module_label'] = 'AVMD';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Advanced voicemail beep detection.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_blacklist":
$mod['module_label'] = 'Blacklist';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Blacklist.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_bv":
$mod['module_label'] = 'BV';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'BroadVoice16 and BroadVoice32 audio codecs.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_cdr_csv":
$mod['module_label'] = 'CDR CSV';
$mod['module_category'] = 'Event Handlers';
$mod['module_description'] = 'CSV call detail record handler.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_cdr_sqlite":
$mod['module_label'] = 'CDR SQLite';
$mod['module_category'] = 'Event Handlers';
$mod['module_description'] = 'SQLite call detail record handler.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_callcenter":
$mod['module_label'] = 'Call Center';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Call queuing with agents and tiers for call centers.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_cepstral":
$mod['module_label'] = 'Cepstral';
$mod['module_category'] = 'Speech Recognition / Text to Speech';
$mod['module_description'] = 'Text to Speech engine.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_cidlookup":
$mod['module_label'] = 'CID Lookup';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Lookup caller id info.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_cluechoo":
$mod['module_label'] = 'Cluechoo';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'A framework demo module.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_commands":
$mod['module_label'] = 'Commands';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'API interface commands.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_conference":
$mod['module_label'] = 'Conference';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Conference room module.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_console":
$mod['module_label'] = 'Console';
$mod['module_category'] = 'Loggers';
$mod['module_description'] = 'Send logs to the console.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_curl":
$mod['module_label'] = 'CURL';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Allows scripts to make HTTP requests and return responses in plain text or JSON.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_db":
$mod['module_label'] = 'DB';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Database key / value storage functionality, dialing and limit backend.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_dialplan_asterisk":
$mod['module_label'] = 'Dialplan Asterisk';
$mod['module_category'] = 'Dialplan Interfaces';
$mod['module_description'] = 'Allows Asterisk dialplans.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_dialplan_xml":
$mod['module_label'] = 'Dialplan XML';
$mod['module_category'] = 'Dialplan Interfaces';
$mod['module_description'] = 'Provides dialplan functionality in XML.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_directory":
$mod['module_label'] = 'Directory';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Dial by name directory.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_distributor":
$mod['module_label'] = 'Distributor';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Round robin call distribution.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_dptools":
$mod['module_label'] = 'Dialplan Plan Tools';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Provides a number of apps and utilities for the dialplan.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_enum":
$mod['module_label'] = 'ENUM';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Route PSTN numbers over internet according to ENUM servers, such as e164.org.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_esf":
$mod['module_label'] = 'ESF';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Holds the multi cast paging application for SIP.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_event_socket":
$mod['module_label'] = 'Event Socket';
$mod['module_category'] = 'Event Handlers';
$mod['module_description'] = 'Sends events via a single socket.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_expr":
$mod['module_label'] = 'Expr';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Expression evaluation library.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_fifo":
$mod['module_label'] = 'FIFO';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'FIFO provides custom call queues including call park.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_flite":
$mod['module_label'] = 'Flite';
$mod['module_category'] = 'Speech Recognition / Text to Speech';
$mod['module_description'] = 'Text to Speech engine.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_fsv":
$mod['module_label'] = 'FSV';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Video application (Recording and playback).';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_g723_1":
$mod['module_label'] = 'G.723.1';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'G.723.1 codec.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_g729":
$mod['module_label'] = 'G.729';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'G729 codec supports passthrough mode';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_h26x":
$mod['module_label'] = 'H26x';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'Video codecs';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_hash":
$mod['module_label'] = 'Hash';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Resource limitation.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_httapi":
$mod['module_label'] = 'HT-TAPI';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'HT-TAPI Hypertext Telephony API';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_http_cache":
$mod['module_label'] = 'HTTP Cache';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'HTTP GET with caching';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_ilbc":
$mod['module_label'] = 'iLBC';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'iLBC codec.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_ladspa":
$mod['module_label'] = 'Ladspa';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Auto-tune calls.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_lcr":
$mod['module_label'] = 'LCR';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Least cost routing.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_local_stream":
$mod['module_label'] = 'Local Stream';
$mod['module_category'] = 'Streams / Files';
$mod['module_description'] = 'For local streams (play all the files in a directory).';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_logfile":
$mod['module_label'] = 'Log File';
$mod['module_category'] = 'Loggers';
$mod['module_description'] = 'Send logs to the local file system.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_loopback":
$mod['module_label'] = 'Loopback';
$mod['module_category'] = 'Endpoints';
$mod['module_description'] = 'A loopback channel driver to make an outbound call as an inbound call.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_lua":
$mod['module_label'] = 'Lua';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'Lua script.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_memcache":
$mod['module_label'] = 'Memcached';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'API for memcached.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_native_file":
$mod['module_label'] = 'Native File';
$mod['module_category'] = 'File Format Interfaces';
$mod['module_description'] = 'File interface for codec specific file formats.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_nibblebill":
$mod['module_label'] = 'Nibblebill';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Billing module.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_opus":
$mod['module_label'] = 'Opus';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'OPUS ultra-low delay audio codec';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_park":
$mod['module_label'] = 'Park';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Park Calls.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_pocketsphinx":
$mod['module_label'] = 'PocketSphinx';
$mod['module_category'] = 'Speech Recognition / Text to Speech';
$mod['module_description'] = 'Speech Recognition.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_rtmp":
$mod['module_label'] = 'RTMP';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Real Time Media Protocol';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_de":
$mod['module_label'] = 'German';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_en":
$mod['module_label'] = 'English';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_es":
$mod['module_label'] = 'Spanish';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_fr":
$mod['module_label'] = 'French';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_he":
$mod['module_label'] = 'Hebrew';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_hu":
$mod['module_label'] = 'Hungarian';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_it":
$mod['module_label'] = 'Italian';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_nl":
$mod['module_label'] = 'Dutch';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_pt":
$mod['module_label'] = 'Portuguese';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_ru":
$mod['module_label'] = 'Russian';
$mod['module_category'] = 'Say';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_th":
$mod['module_label'] = 'Thai';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_say_zh":
$mod['module_label'] = 'Chinese';
$mod['module_category'] = 'Say';
$mod['module_description'] = '';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_shout":
$mod['module_label'] = 'Shout';
$mod['module_category'] = 'Streams / Files';
$mod['module_description'] = 'MP3 files and shoutcast streams.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_siren":
$mod['module_label'] = 'Siren';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'Siren codec';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_sms":
$mod['module_label'] = 'SMS';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Chat messages';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_sndfile":
$mod['module_label'] = 'Sound File';
$mod['module_category'] = 'File Format Interfaces';
$mod['module_description'] = 'Multi-format file format transcoder (WAV, etc).';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_sofia":
$mod['module_label'] = 'Sofia';
$mod['module_category'] = 'Endpoints';
$mod['module_description'] = 'SIP module.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_spandsp":
$mod['module_label'] = 'SpanDSP';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'FAX provides fax send and receive.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_speex":
$mod['module_label'] = 'Speex';
$mod['module_category'] = 'Codecs';
$mod['module_description'] = 'Speex codec.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_spidermonkey":
$mod['module_label'] = 'SpiderMonkey';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'JavaScript support.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_spidermonkey_core_db":
$mod['module_label'] = 'SpiderMonkey Core DB';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'Javascript support for SQLite.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_spidermonkey_curl":
$mod['module_label'] = 'SpiderMonkey Curl';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'Javascript curl support.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_spidermonkey_socket":
$mod['module_label'] = 'SpiderMonkey Socket';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'Javascript socket support.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_spidermonkey_teletone":
$mod['module_label'] = 'SpiderMonkey Teletone';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'Javascript teletone support.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_syslog":
$mod['module_label'] = 'Syslog';
$mod['module_category'] = 'Loggers';
$mod['module_description'] = 'Send logs to a remote syslog server.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_tone_stream":
$mod['module_label'] = 'Tone Stream';
$mod['module_category'] = 'Streams / Files';
$mod['module_description'] = 'Generate tone streams.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_tts_commandline":
$mod['module_label'] = 'TTS Commandline';
$mod['module_category'] = 'Speech Recognition / Text to Speech';
$mod['module_description'] = 'Commandline text to speech engine.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_unimrcp":
$mod['module_label'] = 'MRCP';
$mod['module_category'] = 'Speech Recognition / Text to Speech';
$mod['module_description'] = 'Media Resource Control Protocol.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_valet_parking":
$mod['module_label'] = 'Valet Parking';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Call parking';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_voicemail":
$mod['module_label'] = 'Voicemail';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Full featured voicemail module.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_voicemail_ivr":
$mod['module_label'] = 'Voicemail IVR';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'Voicemail IVR interface.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_xml_cdr":
$mod['module_label'] = 'XML CDR';
$mod['module_category'] = 'XML Interfaces';
$mod['module_description'] = 'XML based call detail record handler.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
case "mod_xml_curl":
$mod['module_label'] = 'XML Curl';
$mod['module_category'] = 'XML Interfaces';
$mod['module_description'] = 'Request XML config files dynamically.';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
break;
case "mod_xml_rpc":
$mod['module_label'] = 'XML RPC';
$mod['module_category'] = 'XML Interfaces';
$mod['module_description'] = 'XML Remote Procedure Calls. Issue commands from your web application.';
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
default:
$mod['module_category'] = 'Auto';
$mod['module_enabled'] = 'false';
$mod['module_default_enabled'] = 'false';
}
return $mod;
}
//check to see if the module exists in the array
public function exists($name) {
//set the default
$result = false;
//look for the module
foreach ($this->modules as &$row) {
if ($row['module_name'] == $name) {
$result = true;
break;
}
}
//return the result
return $result;
}
//check the status of the module
public function active($name) {
if (!$this->fp) {
$this->fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
if ($this->fp) {
$cmd = "api module_exists ".$name;
$response = trim(event_socket_request($this->fp, $cmd));
if ($response == "true") {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
//get the list of modules
public function get_modules() {
$sql = " select * from v_modules ";
$sql .= "order by module_category, module_label";
$prep_statement = $this->db->prepare($sql);
$prep_statement->execute();
$this->modules = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
unset ($prep_statement, $sql);
}
//add missing modules for more module info see http://wiki.freeswitch.com/wiki/Modules
public function synch() {
if ($handle = opendir($this->dir)) {
$modules_new = '';
$module_found = false;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (substr($file, -3) == ".so" || substr($file, -4) == ".dll") {
if (substr($file, -3) == ".so") {
$name = substr($file, 0, -3);
}
if (substr($file, -4) == ".dll") {
$name = substr($file, 0, -4);
}
if (!$this->exists($name)) {
//set module found to true
$module_found = true;
//get the module array
$mod = $this->info($name);
//append the module label
$modules_new .= "<li>".$mod['module_label']."</li>\n";
//insert the data
$module_uuid = uuid();
$sql = "insert into v_modules ";
$sql .= "(";
$sql .= "module_uuid, ";
$sql .= "module_label, ";
$sql .= "module_name, ";
$sql .= "module_description, ";
$sql .= "module_category, ";
$sql .= "module_enabled, ";
$sql .= "module_default_enabled ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$module_uuid."', ";
$sql .= "'".$mod['module_label']."', ";
$sql .= "'".$mod['module_name']."', ";
$sql .= "'".$mod['module_description']."', ";
$sql .= "'".$mod['module_category']."', ";
$sql .= "'".$mod['module_enabled']."', ";
$sql .= "'".$mod['module_default_enabled']."' ";
$sql .= ")";
$this->db->exec($sql);
unset($sql);
}
}
}
}
closedir($handle);
if ($module_found) {
//save_module_xml();
$msg = "<strong>Added New Modules:</strong><br />\n";
$msg .= "<ul>\n";
$msg .= $modules_new;
$msg .= "</ul>\n";
$this->msg = $msg;
}
}
}
} //class
?>
+53
View File
@@ -0,0 +1,53 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
$cmd = $_GET['cmd'];
$rdr = $_GET['rdr'];
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$response = event_socket_request($fp, $cmd);
fclose($fp);
}
if ($rdr == "false") {
//redirect false
echo $response;
}
else {
header("Location: v_status.php?savemsg=".urlencode($response));
}
?>
+62
View File
@@ -0,0 +1,62 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//-----------------------------------------------------
// settings:
//-----------------------------------------------------
//set the database type
$db_type = 'sqlite'; //sqlite, mysql, pgsql, others with a manually created PDO connection
//sqlite: the dbfilename and db_file_path are automatically assigned however the values can be overidden by setting the values here.
$dbfilename = 'fusionpbx.db'; //host name/ip address + '.db' is the default database filename
$db_file_path = '\fusionpbx\Program\www\localhost\fusionpbx\secure'; //the path is determined by a php variable
//mysql: database connection information
//$db_host = '';
//$db_port = '';
//$db_name = '';
//$db_username = '';
//$db_password = '';
//pgsql: database connection information
//$db_host = ''; //set the host only if the database is not local
//$db_port = '';
//$db_name = '';
//$db_username = '';
//$db_password = '';
//set the host ip or name that the will be used to communicate with the phone system
$host = '127.0.0.1';
//show errors
ini_set('display_errors', '1');
//error_reporting (E_ALL); // Report everything
//error_reporting (E_ALL ^ E_NOTICE); // Report everything
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
?>
+278
View File
@@ -0,0 +1,278 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (!function_exists('phone_letter_to_number')) {
function phone_letter_to_number($tmp) {
if ($tmp == "a" | $tmp == "b" | $tmp == "c") { return 2; }
if ($tmp == "d" | $tmp == "e" | $tmp == "f") { return 3; }
if ($tmp == "g" | $tmp == "h" | $tmp == "i") { return 4; }
if ($tmp == "j" | $tmp == "k" | $tmp == "l") { return 5; }
if ($tmp == "m" | $tmp == "n" | $tmp == "o") { return 6; }
if ($tmp == "p" | $tmp == "q" | $tmp == "r" | $tmp == "s") { return 7; }
if ($tmp == "t" | $tmp == "u" | $tmp == "v") { return 8; }
if ($tmp == "w" | $tmp == "x" | $tmp == "y" | $tmp == "z") { return 9; }
}
}
if (!function_exists('sync_directory')) {
function sync_directory() {
global $domain_uuid, $db;
$settings_array = v_settings();
foreach($settings_array as $name => $value) {
$$name = $value;
}
$tmp = "include(\"config.js\");\n";
$tmp .= "//var sounds_dir\n";
$tmp .= "var admin_pin = \"\";\n";
$tmp .= "var search_type = \"\";\n";
$tmp .= "//var tmp_dir\n";
$tmp .= "var digitmaxlength = 0;\n";
$tmp .= "var timeoutpin = 5000;\n";
$tmp .= "var timeouttransfer = 5000;\n";
$tmp .= "\n";
$tmp .= "var dtmf = new Object( );\n";
$tmp .= "dtmf.digits = \"\";\n";
$tmp .= "\n";
$tmp .= "function mycb( session, type, obj, arg ) {\n";
$tmp .= " try {\n";
$tmp .= " if ( type == \"dtmf\" ) {\n";
$tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n";
$tmp .= " if ( obj.digit == \"#\" ) {\n";
$tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
$tmp .= " exit = true;\n";
$tmp .= " return( false );\n";
$tmp .= " }\n";
$tmp .= " if ( obj.digit == \"*\" ) {\n";
$tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
$tmp .= " exit = true;\n";
$tmp .= " return( false );\n";
$tmp .= " }\n";
$tmp .= " dtmf.digits += obj.digit;\n";
$tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n";
$tmp .= " exit = true;\n";
$tmp .= " return( false );\n";
$tmp .= " }\n";
$tmp .= " }\n";
$tmp .= " } catch (e) {\n";
$tmp .= " console_log( \"err\", e+\"\\n\" );\n";
$tmp .= " }\n";
$tmp .= " return( true );\n";
$tmp .= "} //end function mycb\n";
$tmp .= "\n";
$tmp .= "function directory_search(search_type) {\n";
$tmp .= "\n";
$tmp .= " digitmaxlength = 3;\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-enter_person.wav\");\n";
$tmp .= " if (search_type == \"last_name\") {\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-last_name.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-to_search_by.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-first_name.wav\", mycb, \"dtmf\");\n";
$tmp .= " }\n";
$tmp .= " if (search_type == \"first_name\") {\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-first_name.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-to_search_by.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-last_name.wav\", mycb, \"dtmf\");\n";
$tmp .= " }\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-press.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.execute(\"say\", \"en name_spelled iterated 1\");\n";
$tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n";
$tmp .= " var dtmf_search = dtmf.digits;\n";
$tmp .= " //console_log( \"info\", \"--\" + dtmf.digits + \"--\\n\" );\n";
$tmp .= " if (dtmf_search == \"1\") {\n";
$tmp .= " //console_log( \"info\", \"press 1 detected: \" + dtmf.digits + \"\\n\" );\n";
$tmp .= " //console_log( \"info\", \"press 1 detected: \" + search_type + \"\\n\" );\n";
$tmp .= " if (search_type == \"last_name\") {\n";
$tmp .= " //console_log( \"info\", \"press 1 detected last_name: \" + search_type + \"\\n\" );\n";
$tmp .= " search_type = \"first_name\";\n";
$tmp .= " }\n";
$tmp .= " else {\n";
$tmp .= " //console_log( \"info\", \"press 1 detected first_name: \" + search_type + \"\\n\" );\n";
$tmp .= " search_type = \"last_name\";\n";
$tmp .= " }\n";
$tmp .= " dtmf_search = \"\";\n";
$tmp .= " dtmf.digits = \"\";\n";
$tmp .= " directory_search(search_type);\n";
$tmp .= " return;\n";
$tmp .= " }\n";
$tmp .= " console_log( \"info\", \"first 3 letters of first or last name: \" + dtmf.digits + \"\\n\" );\n";
$tmp .= "\n";
$tmp .= " //session.execute(\"say\", \"en name_spelled pronounced mark\");\n";
$tmp .= " //<action application=\"say\" data=\"en name_spelled iterated \${destination_number}\"/>\n";
$tmp .= " //session.execute(\"say\", \"en number iterated 12345\");\n";
$tmp .= " //session.execute(\"say\", \"en number pronounced 1001\");\n";
$tmp .= " //session.execute(\"say\", \"en short_date_time pronounced [timestamp]\");\n";
$tmp .= " //session.execute(\"say\", \"en CURRENT_TIME pronounced CURRENT_TIME\");\n";
$tmp .= " //session.execute(\"say\", \"en CURRENT_DATE pronounced CURRENT_DATE\");\n";
$tmp .= " //session.execute(\"say\", \"en CURRENT_DATE_TIME pronounced CURRENT_DATE_TIME\");\n";
$tmp .= "\n";
$tmp .= "\n";
$tmp .= " //take each name and convert it to the equivalent number in php when this file is generated\n";
$tmp .= " //then test each number see if it matches the user dtmf search keys\n";
$tmp .= "\n";
$tmp .= " var result_array = new Array();\n";
$tmp .= " var x = 0;\n";
//get a list of extensions and the users assigned to them
$sql = "";
$sql .= " select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
//print_r($row);
$extension = $row["extension"];
$effective_caller_id_name = $row["effective_caller_id_name"];
//$user_list = $row["user_list"];
//$user_list = trim($user_list, "|");
//echo $user_list."<br />\n";
//$username_array = explode ("|", $user_list);
//print_r($username_array);
foreach ($username_array as &$username) {
if (strlen($username) > 0) {
$sql = "";
$sql .= "select * from v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '$username' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$tmp_result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($tmp_result as &$row_tmp) {
$user_first_name = $row_tmp["user_first_name"];
$user_last_name = $row_tmp["user_last_name"];
if ($user_first_name == "na") { $user_first_name = ""; }
if ($user_last_name == "na") { $user_last_name = ""; }
if (strlen($user_first_name.$user_last_name) == 0) {
$name_array = explode (" ", $effective_caller_id_name);
$user_first_name = $name_array[0];
if (count($name_array) > 1) {
$user_last_name = $name_array[1];
}
}
break; //limit to 1 row
}
$f1 = phone_letter_to_number(substr($user_first_name, 0,1));
$f2 = phone_letter_to_number(substr($user_first_name, 1,1));
$f3 = phone_letter_to_number(substr($user_first_name, 2,1));
$l1 = phone_letter_to_number(substr($user_last_name, 0,1));
$l2 = phone_letter_to_number(substr($user_last_name, 1,1));
$l3 = phone_letter_to_number(substr($user_last_name, 2,1));
//echo $sql." extension: $extension firstname $user_first_name lastname $user_last_name $tmp<br />";
$tmp .= " if (search_type == \"first_name\" && dtmf_search == \"".$f1.$f2.$f3."\" || search_type == \"last_name\" && dtmf_search == \"".$l1.$l2.$l3."\") {\n";
$tmp .= " result_array[x]=new Array()\n";
$tmp .= " result_array[x]['first_name'] =\"".$user_first_name."\";\n";
$tmp .= " result_array[x]['last_name'] =\"".$user_last_name."\";\n";
$tmp .= " result_array[x]['extension'] = \"".$extension."\";\n";
$tmp .= " //console_log( \"info\", \"found: ".$user_first_name." ".$user_last_name."\\n\" );\n";
$tmp .= " x++;\n";
$tmp .= " }\n";
}
}
}
unset ($prep_statement);
$tmp .= "\n";
$tmp .= "\n";
$tmp .= " //say the number of results that matched\n";
$tmp .= " \$result_count = result_array.length;\n";
$tmp .= " session.execute(\"say\", \"en number iterated \"+\$result_count);\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-result_match.wav\", mycb, \"dtmf\");\n";
$tmp .= "\n";
$tmp .= " //clear values\n";
$tmp .= " dtmf_search = 0;\n";
$tmp .= " dtmf.digits = '';\n";
$tmp .= "\n";
$tmp .= " if (\$result_count == 0) {\n";
$tmp .= " //session.execute(\"transfer\", \"*347 XML default\");\n";
$tmp .= " directory_search(search_type);\n";
$tmp .= " return;\n";
$tmp .= " }\n";
$tmp .= "\n";
$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
$tmp .= " session.execute(\"set\", \"tts_voice=rms\"); //rms //kal //awb //slt\n";
$tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
$tmp .= " //session.speak(\"flite\",\"kal\",\"Thanks for.. calling\");\n";
$tmp .= "\n";
$tmp .= " i=1;\n";
$tmp .= " for ( i in result_array ) {\n";
$tmp .= "\n";
$tmp .= " //say first name and last name is at extension 1001\n";
$tmp .= " //session.execute(\"speak\", result_array[i]['first_name']);\n";
$tmp .= " //session.execute(\"speak\", result_array[i]['last_name']);\n";
$tmp .= " session.execute(\"say\", \"en name_spelled pronounced \"+result_array[i]['first_name']);\n";
$tmp .= " session.execute(\"sleep\", \"500\");\n";
$tmp .= " session.execute(\"say\", \"en name_spelled pronounced \"+result_array[i]['last_name']);\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-at_extension.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.execute(\"say\", \"en number pronounced \"+result_array[i]['extension']);\n";
$tmp .= "\n";
$tmp .= " //to select this entry press 1\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-to_select_entry.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.streamFile( sounds_dir+\"/en/us/callie/directory/48000/dir-press.wav\", mycb, \"dtmf\");\n";
$tmp .= " session.execute(\"say\", \"en number iterated 1\");\n";
$tmp .= "\n";
$tmp .= " //console_log( \"info\", \"first name: \" + result_array[i]['first_name'] + \"\\n\" );\n";
$tmp .= " //console_log( \"info\", \"last name: \" + result_array[i]['last_name'] + \"\\n\" );\n";
$tmp .= " //console_log( \"info\", \"extension: \" + result_array[i]['extension'] + \"\\n\" );\n";
$tmp .= "\n";
$tmp .= " //if 1 is pressed then transfer the call\n";
$tmp .= " dtmf.digits = session.getDigits(1, \"#\", 3000);\n";
$tmp .= " if (dtmf.digits == \"1\") {\n";
$tmp .= " console_log( \"info\", \"directory: call transfered to: \" + result_array[i]['extension'] + \"\\n\" );\n";
$tmp .= " session.execute(\"transfer\", result_array[i]['extension']+\" XML default\");\n";
$tmp .= " }\n";
$tmp .= "\n";
$tmp .= " }\n";
$tmp .= "}\n";
$tmp .= "\n";
$tmp .= "\n";
$tmp .= "if ( session.ready() ) {\n";
$tmp .= " session.answer();\n";
$tmp .= " search_type = \"last_name\";\n";
$tmp .= " directory_search(search_type);\n";
$tmp .= " session.hangup(\"NORMAL_CLEARING\");\n";
$tmp .= "}\n";
$tmp .= "";
//write the file
$fout = fopen($_SESSION['switch']['scripts']['dir']."/directory.js","w");
fwrite($fout, $tmp);
fclose($fout);
} //end sync_directory
} //end if function exists
sync_directory();
?>
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
//require_once "includes/checkauth.php";
$file = $_GET["f"];
require_once "includes/securedownload.php";
//echo $file;
DownloadFile($file_dir.$file);
?>
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

+73
View File
@@ -0,0 +1,73 @@
/*
* Bulgarian translation
* Author: Valentin Hristov
* Company: SOFTKIT Bulgarian
* Site: http://www.softkit-bg.com
*/
editAreaLoader.lang["bg"]={
new_document: "нов документ",
search_button: "търсене и замяна",
search_command: "търси следващия / отвори прозорец с търсачка",
search: "търсене",
replace: "замяна",
replace_command: "замяна / отвори прозорец с търсачка",
find_next: "намери следващия",
replace_all: "замени всички",
reg_exp: "реголярни изрази",
match_case: "чуствителен към регистъра",
not_found: "няма резултат.",
occurrence_replaced: "замяната е осъществена.",
search_field_empty: "Полето за търсене е празно",
restart_search_at_begin: "До края на документа. Почни с началото.",
move_popup: "премести прозореца с търсачката",
font_size: "--Размер на шрифта--",
go_to_line: "премени към реда",
go_to_line_prompt: "премени към номера на реда:",
undo: "отмени",
redo: "върни",
change_smooth_selection: "включи/изключи някой от функциите за преглед (по красиво, но повече натоварва)",
highlight: "превключване на оцветяване на синтаксиса включена/изключена",
reset_highlight: "въстанови оцветяване на синтаксиса (ако не е синхронизиран с текста)",
word_wrap: "режим на пренасяне на дълги редове",
help: "за програмата",
save: "съхрани",
load: "зареди",
line_abbr: "Стр",
char_abbr: "Стлб",
position: "Позиция",
total: "Всичко",
close_popup: "затвори прозореца",
shortcuts: "Бързи клавиши",
add_tab: "добави табулация в текста",
remove_tab: "премахни табулацията в текста",
about_notice: "Внимание: използвайте функцията оцветяване на синтаксиса само за малки текстове",
toggle: "Превключи редактор",
accesskey: "Бърз клавиш",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Зареждане...",
fullscreen: "на цял екран",
syntax_selection: "--Синтаксис--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "PHP",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "XML",
syntax_c: "C",
syntax_cpp: "C++",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Затвори файла"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["cs"]={
new_document: "Nový dokument",
search_button: "Najdi a nahraď",
search_command: "Hledej další / otevři vyhledávací pole",
search: "Hledej",
replace: "Nahraď",
replace_command: "Nahraď / otevři vyhledávací pole",
find_next: "Najdi další",
replace_all: "Nahraď vše",
reg_exp: "platné výrazy",
match_case: "vyhodnocené výrazy",
not_found: "nenalezené.",
occurrence_replaced: "výskyty nahrazené.",
search_field_empty: "Pole vyhledávání je prázdné",
restart_search_at_begin: "Dosažen konec souboru, začínám od začátku.",
move_popup: "Přesuň vyhledávací okno",
font_size: "--Velikost textu--",
go_to_line: "Přejdi na řádek",
go_to_line_prompt: "Přejdi na řádek:",
undo: "krok zpět",
redo: "znovu",
change_smooth_selection: "Povolit nebo zakázat některé ze zobrazených funkcí (účelnější zobrazení požaduje větší zatížení procesoru)",
highlight: "Zvýrazňování syntaxe zap./vyp.",
reset_highlight: "Obnovit zvýraznění (v případě nesrovnalostí)",
word_wrap: "toggle word wrapping mode",
help: "O programu",
save: "Uložit",
load: "Otevřít",
line_abbr: "Ř.",
char_abbr: "S.",
position: "Pozice",
total: "Celkem",
close_popup: "Zavřít okno",
shortcuts: "Zkratky",
add_tab: "Přidat tabulování textu",
remove_tab: "Odtsranit tabulování textu",
about_notice: "Upozornění! Funkce zvýrazňování textu je k dispozici pouze pro malý text",
toggle: "Přepnout editor",
accesskey: "Přístupová klávesa",
tab: "Záložka",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Zpracovávám ...",
fullscreen: "Celá obrazovka",
syntax_selection: "--vyber zvýrazňovač--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["de"]={
new_document: "Neues Dokument",
search_button: "Suchen und Ersetzen",
search_command: "Weitersuchen / &ouml;ffne Suchfeld",
search: "Suchen",
replace: "Ersetzen",
replace_command: "Ersetzen / &ouml;ffne Suchfeld",
find_next: "Weitersuchen",
replace_all: "Ersetze alle Treffer",
reg_exp: "regul&auml;re Ausdr&uuml;cke",
match_case: "passt auf den Begriff<br />",
not_found: "Nicht gefunden.",
occurrence_replaced: "Die Vorkommen wurden ersetzt.",
search_field_empty: "Leeres Suchfeld",
restart_search_at_begin: "Ende des zu durchsuchenden Bereiches erreicht. Es wird die Suche von Anfang an fortgesetzt.", //find a shorter translation
move_popup: "Suchfenster bewegen",
font_size: "--Schriftgr&ouml;&szlig;e--",
go_to_line: "Gehe zu Zeile",
go_to_line_prompt: "Gehe zu Zeilennummmer:",
undo: "R&uuml;ckg&auml;ngig",
redo: "Wiederherstellen",
change_smooth_selection: "Aktiviere/Deaktiviere einige Features (weniger Bildschirmnutzung aber mehr CPU-Belastung)",
highlight: "Syntax Highlighting an- und ausschalten",
reset_highlight: "Highlighting zur&uuml;cksetzen (falls mit Text nicht konform)",
word_wrap: "Toggle word wrapping mode",
help: "Info",
save: "Speichern",
load: "&Ouml;ffnen",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Position",
total: "Gesamt",
close_popup: "Popup schlie&szlig;en",
shortcuts: "Shortcuts",
add_tab: "Tab zum Text hinzuf&uuml;gen",
remove_tab: "Tab aus Text entfernen",
about_notice: "Bemerkung: Syntax Highlighting ist nur f&uuml;r kurze Texte",
toggle: "Editor an- und ausschalten",
accesskey: "Accesskey",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "In Bearbeitung...",
fullscreen: "Full-Screen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["dk"]={
new_document: "nyt tomt dokument",
search_button: "s&oslash;g og erstat",
search_command: "find n&aelig;ste / &aring;ben s&oslash;gefelt",
search: "s&oslash;g",
replace: "erstat",
replace_command: "erstat / &aring;ben s&oslash;gefelt",
find_next: "find n&aelig;ste",
replace_all: "erstat alle",
reg_exp: "regular expressions",
match_case: "forskel på store/sm&aring; bogstaver<br />",
not_found: "not found.",
occurrence_replaced: "occurences replaced.",
search_field_empty: "Search field empty",
restart_search_at_begin: "End of area reached. Restart at begin.",
move_popup: "flyt søgepopup",
font_size: "--Skriftstørrelse--",
go_to_line: "g&aring; til linie",
go_to_line_prompt: "gå til linienummer:",
undo: "fortryd",
redo: "gentag",
change_smooth_selection: "sl&aring; display funktioner til/fra (smartere display men mere CPU kr&aelig;vende)",
highlight: "sl&aring; syntax highlight til/fra",
reset_highlight: "nulstil highlight (hvis den er desynkroniseret fra teksten)",
word_wrap: "toggle word wrapping mode",
help: "om",
save: "gem",
load: "hent",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Position",
total: "Total",
close_popup: "luk popup",
shortcuts: "Genveje",
add_tab: "tilf&oslash;j tabulation til tekst",
remove_tab: "fjern tabulation fra tekst",
about_notice: "Husk: syntax highlight funktionen b&oslash;r kun bruge til sm&aring; tekster",
toggle: "Sl&aring; editor til / fra",
accesskey: "Accesskey",
tab: "Tab",
shift: "Skift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Processing...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["en"]={
new_document: "new empty document",
search_button: "search and replace",
search_command: "search next / open search area",
search: "search",
replace: "replace",
replace_command: "replace / open search area",
find_next: "find next",
replace_all: "replace all",
reg_exp: "regular expressions",
match_case: "match case",
not_found: "not found.",
occurrence_replaced: "occurences replaced.",
search_field_empty: "Search field empty",
restart_search_at_begin: "End of area reached. Restart at begin.",
move_popup: "move search popup",
font_size: "--Font size--",
go_to_line: "go to line",
go_to_line_prompt: "go to line number:",
undo: "undo",
redo: "redo",
change_smooth_selection: "enable/disable some display features (smarter display but more CPU charge)",
highlight: "toggle syntax highlight on/off",
reset_highlight: "reset highlight (if desyncronized from text)",
word_wrap: "toggle word wrapping mode",
help: "about",
save: "save",
load: "load",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Position",
total: "Total",
close_popup: "close popup",
shortcuts: "Shortcuts",
add_tab: "add tabulation to text",
remove_tab: "remove tabulation to text",
about_notice: "Notice: syntax highlight function is only for small text",
toggle: "Toggle editor",
accesskey: "Accesskey",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Processing...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["eo"]={
new_document: "nova dokumento (vakigas la enhavon)",
search_button: "ser&#265;i / anstata&#365;igi",
search_command: "pluser&#265;i / malfermi la ser&#265;o-fenestron",
search: "ser&#265;i",
replace: "anstata&#365;igi",
replace_command: "anstata&#365;igi / malfermi la ser&#265;o-fenestron",
find_next: "ser&#265;i",
replace_all: "anstata&#365;igi &#265;ion",
reg_exp: "regula esprimo",
match_case: "respekti la usklecon",
not_found: "ne trovita.",
occurrence_replaced: "anstata&#365;igoj plenumitaj.",
search_field_empty: "La kampo estas malplena.",
restart_search_at_begin: "Fino de teksto &#285;isrirata, &#265;u da&#365;rigi el la komenco?",
move_popup: "movi la ser&#265;o-fenestron",
font_size: "--Tipara grando--",
go_to_line: "iri al la linio",
go_to_line_prompt: "iri al la linio numero:",
undo: "rezigni",
redo: "refari",
change_smooth_selection: "ebligi/malebligi la funkcioj de vidigo (pli bona vidigo, sed pli da &#349;ar&#285;o de la &#265;eforgano)",
highlight: "ebligi/malebligi la sintaksan kolorigon",
reset_highlight: "repravalorizi la sintaksan kolorigon (se malsinkronigon de la teksto)",
word_wrap: "toggle word wrapping mode",
help: "pri",
save: "registri",
load: "&#349;ar&#285;i",
line_abbr: "Ln",
char_abbr: "Sg",
position: "Pozicio",
total: "Sumo",
close_popup: "fermi la &#349;prucfenestron",
shortcuts: "Fulmoklavo",
add_tab: "aldoni tabon en la tekston",
remove_tab: "forigi tablon el la teksto",
about_notice: "Noto: la sintaksa kolorigo estas nur prikalkulita por mallongaj tekstoj.",
toggle: "baskuligi la redaktilon",
accesskey: "Fulmoklavo",
tab: "Tab",
shift: "Maj",
ctrl: "Ktrl",
esc: "Esk",
processing: "&#349;argante...",
fullscreen: "plenekrane",
syntax_selection: "--Sintakso--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Pitono",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Fermi la dosieron"
};
+64
View File
@@ -0,0 +1,64 @@
editAreaLoader.lang["es"]={
new_document: "nuevo documento vacío",
search_button: "buscar y reemplazar",
search_command: "buscar siguiente / abrir área de búsqueda",
search: "buscar",
replace: "reemplazar",
replace_command: "reemplazar / abrir área de búsqueda",
find_next: "encontrar siguiente",
replace_all: "reemplazar todos",
reg_exp: "expresiones regulares",
match_case: "coincidir capitalización",
not_found: "no encontrado.",
occurrence_replaced: "ocurrencias reemplazadas.",
search_field_empty: "Campo de búsqueda vacío",
restart_search_at_begin: "Se ha llegado al final del área. Se va a seguir desde el principio.",
move_popup: "mover la ventana de búsqueda",
font_size: "--Tamaño de la fuente--",
go_to_line: "ir a la línea",
go_to_line_prompt: "ir a la línea número:",
undo: "deshacer",
redo: "rehacer",
change_smooth_selection: "activar/desactivar algunas características de visualización (visualización más inteligente pero más carga de CPU)",
highlight: "intercambiar resaltado de sintaxis",
reset_highlight: "reinicializar resaltado (si no esta sincronizado con el texto)",
word_wrap: "toggle word wrapping mode",
help: "acerca",
save: "guardar",
load: "cargar",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Posición",
total: "Total",
close_popup: "recuadro de cierre",
shortcuts: "Atajos",
add_tab: "añadir tabulado al texto",
remove_tab: "borrar tabulado del texto",
about_notice: "Aviso: el resaltado de sintaxis sólo funciona para texto pequeño",
toggle: "Cambiar editor",
accesskey: "Tecla de acceso",
tab: "Tab",
shift: "Mayúsc",
ctrl: "Ctrl",
esc: "Esc",
processing: "Procesando...",
fullscreen: "pantalla completa",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["fi"]={
new_document: "uusi tyhjä dokumentti",
search_button: "etsi ja korvaa",
search_command: "etsi seuraava / avaa etsintävalikko",
search: "etsi",
replace: "korvaa",
replace_command: "korvaa / avaa etsintävalikko",
find_next: "etsi seuraava",
replace_all: "korvaa kaikki",
reg_exp: "säännölliset lausekkeet",
match_case: "täsmää kirjainkokoon",
not_found: "ei löytynyt.",
occurrence_replaced: "esiintymää korvattu.",
search_field_empty: "Haettava merkkijono on tyhjä",
restart_search_at_begin: "Alueen loppu saavutettiin. Aloitetaan alusta.",
move_popup: "siirrä etsintävalikkoa",
font_size: "--Fontin koko--",
go_to_line: "siirry riville",
go_to_line_prompt: "mene riville:",
undo: "peruuta",
redo: "tee uudelleen",
change_smooth_selection: "kytke/sammuta joitakin näyttötoimintoja (Älykkäämpi toiminta, mutta suurempi CPU kuormitus)",
highlight: "kytke syntaksikorostus päälle/pois",
reset_highlight: "resetoi syntaksikorostus (jos teksti ei ole synkassa korostuksen kanssa)",
word_wrap: "toggle word wrapping mode",
help: "tietoja",
save: "tallenna",
load: "lataa",
line_abbr: "Rv",
char_abbr: "Pos",
position: "Paikka",
total: "Yhteensä",
close_popup: "sulje valikko",
shortcuts: "Pikatoiminnot",
add_tab: "lisää sisennys tekstiin",
remove_tab: "poista sisennys tekstistä",
about_notice: "Huomautus: syntaksinkorostus toimii vain pienelle tekstille",
toggle: "Kytke editori",
accesskey: "Pikanäppäin",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Odota...",
fullscreen: "koko ruutu",
syntax_selection: "--Syntaksi--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Sulje tiedosto"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["fr"]={
new_document: "nouveau document (efface le contenu)",
search_button: "rechercher / remplacer",
search_command: "rechercher suivant / ouvrir la fen&ecirc;tre de recherche",
search: "rechercher",
replace: "remplacer",
replace_command: "remplacer / ouvrir la fen&ecirc;tre de recherche",
find_next: "rechercher",
replace_all: "tout remplacer",
reg_exp: "expr. r&eacute;guli&egrave;re",
match_case: "respecter la casse",
not_found: "pas trouv&eacute;.",
occurrence_replaced: "remplacements &eacute;ffectu&eacute;s.",
search_field_empty: "Le champ de recherche est vide.",
restart_search_at_begin: "Fin du texte atteint, poursuite au d&eacute;but.",
move_popup: "d&eacute;placer la fen&ecirc;tre de recherche",
font_size: "--Taille police--",
go_to_line: "aller &agrave; la ligne",
go_to_line_prompt: "aller a la ligne numero:",
undo: "annuler",
redo: "refaire",
change_smooth_selection: "activer/d&eacute;sactiver des fonctions d'affichage (meilleur affichage mais plus de charge processeur)",
highlight: "activer/d&eacute;sactiver la coloration syntaxique",
reset_highlight: "r&eacute;initialiser la coloration syntaxique (si d&eacute;syncronis&eacute;e du texte)",
word_wrap: "activer/d&eacute;sactiver les retours &agrave; la ligne automatiques",
help: "&agrave; propos",
save: "sauvegarder",
load: "charger",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Position",
total: "Total",
close_popup: "fermer le popup",
shortcuts: "Racourcis clavier",
add_tab: "ajouter une tabulation dans le texte",
remove_tab: "retirer une tabulation dans le texte",
about_notice: "Note: la coloration syntaxique n'est pr&eacute;vue que pour de courts textes.",
toggle: "basculer l'&eacute;diteur",
accesskey: "Accesskey",
tab: "Tab",
shift: "Maj",
ctrl: "Ctrl",
esc: "Esc",
processing: "chargement...",
fullscreen: "plein &eacute;cran",
syntax_selection: "--Syntaxe--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Fermer le fichier"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["hr"]={
new_document: "Novi dokument",
search_button: "Traži i izmijeni",
search_command: "Traži dalje / Otvori prozor za traženje",
search: "Traži",
replace: "Izmijeni",
replace_command: "Izmijeni / Otvori prozor za traženje",
find_next: "Traži dalje",
replace_all: "Izmjeni sve",
reg_exp: "Regularni izrazi",
match_case: "Bitna vel. slova",
not_found: "nije naðeno.",
occurrence_replaced: "izmjenjenih.",
search_field_empty: "Prazno polje za traženje!",
restart_search_at_begin: "Došao do kraja. Poèeo od poèetka.",
move_popup: "Pomakni prozor",
font_size: "--Velièina teksta--",
go_to_line: "Odi na redak",
go_to_line_prompt: "Odi na redak:",
undo: "Vrati natrag",
redo: "Napravi ponovo",
change_smooth_selection: "Ukljuèi/iskljuèi neke moguænosti prikaza (pametniji prikaz, ali zagušeniji CPU)",
highlight: "Ukljuèi/iskljuèi bojanje sintakse",
reset_highlight: "Ponovi kolorizaciju (ako je nesinkronizirana s tekstom)",
word_wrap: "toggle word wrapping mode",
help: "O edit_area",
save: "Spremi",
load: "Uèitaj",
line_abbr: "Ln",
char_abbr: "Zn",
position: "Pozicija",
total: "Ukupno",
close_popup: "Zatvori prozor",
shortcuts: "Kratice",
add_tab: "Dodaj tabulaciju",
remove_tab: "Makni tabulaciju",
about_notice: "Napomena: koloriziranje sintakse je samo za kratke kodove",
toggle: "Prebaci naèin ureðivanja",
accesskey: "Accesskey",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Procesiram...",
fullscreen: "Cijeli prozor",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["it"]={
new_document: "nuovo documento vuoto",
search_button: "cerca e sostituisci",
search_command: "trova successivo / apri finestra di ricerca",
search: "cerca",
replace: "sostituisci",
replace_command: "sostituisci / apri finestra di ricerca",
find_next: "trova successivo",
replace_all: "sostituisci tutti",
reg_exp: "espressioni regolari",
match_case: "confronta maiuscole/minuscole<br />",
not_found: "non trovato.",
occurrence_replaced: "occorrenze sostituite.",
search_field_empty: "Campo ricerca vuoto",
restart_search_at_begin: "Fine del testo raggiunta. Ricomincio dall'inizio.",
move_popup: "sposta popup di ricerca",
font_size: "-- Dimensione --",
go_to_line: "vai alla linea",
go_to_line_prompt: "vai alla linea numero:",
undo: "annulla",
redo: "ripeti",
change_smooth_selection: "abilita/disabilita alcune caratteristiche della visualizzazione",
highlight: "abilita/disabilita colorazione della sintassi",
reset_highlight: "aggiorna colorazione (se non sincronizzata)",
word_wrap: "toggle word wrapping mode",
help: "informazioni su...",
save: "salva",
load: "carica",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Posizione",
total: "Totale",
close_popup: "chiudi popup",
shortcuts: "Scorciatoie",
add_tab: "aggiungi tabulazione",
remove_tab: "rimuovi tabulazione",
about_notice: "Avviso: la colorazione della sintassi vale solo con testo piccolo",
toggle: "Abilita/disabilita editor",
accesskey: "Accesskey",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "In corso...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["ja"]={
new_document: "新規作成",
search_button: "検索・置換",
search_command: "次を検索 / 検索窓を表示",
search: "検索",
replace: "置換",
replace_command: "置換 / 置換窓を表示",
find_next: "次を検索",
replace_all: "全置換",
reg_exp: "正規表現",
match_case: "大文字小文字の区別",
not_found: "見つかりません。",
occurrence_replaced: "置換しました。",
search_field_empty: "検索対象文字列が空です。",
restart_search_at_begin: "終端に達しました、始めに戻ります",
move_popup: "検索窓を移動",
font_size: "--フォントサイズ--",
go_to_line: "指定行へ移動",
go_to_line_prompt: "指定行へ移動します:",
undo: "元に戻す",
redo: "やり直し",
change_smooth_selection: "スムース表示の切り替え(CPUを使います)",
highlight: "構文強調表示の切り替え",
reset_highlight: "構文強調表示のリセット",
word_wrap: "toggle word wrapping mode",
help: "ヘルプを表示",
save: "保存",
load: "読み込み",
line_abbr: "行",
char_abbr: "文字",
position: "位置",
total: "合計",
close_popup: "ポップアップを閉じる",
shortcuts: "ショートカット",
add_tab: "タブを挿入する",
remove_tab: "タブを削除する",
about_notice: "注意:構文強調表示は短いテキストでしか有効に機能しません。",
toggle: "テキストエリアとeditAreaの切り替え",
accesskey: "アクセスキー",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "処理中です...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["mk"]={
new_document: "Нов документ",
search_button: "Најди и замени",
search_command: "Барај следно / Отвори нов прозорец за пребарување",
search: "Барај",
replace: "Замени",
replace_command: "Замени / Отвори прозорец за пребарување",
find_next: "најди следно",
replace_all: "Замени ги сите",
reg_exp: "Регуларни изрази",
match_case: "Битна е големината на буквите",
not_found: "не е пронајдено.",
occurrence_replaced: "замени.",
search_field_empty: "Полето за пребарување е празно",
restart_search_at_begin: "Крај на областа. Стартувај од почеток.",
move_popup: "Помести го прозорецот",
font_size: "--Големина на текстот--",
go_to_line: "Оди на линија",
go_to_line_prompt: "Оди на линија со број:",
undo: "Врати",
redo: "Повтори",
change_smooth_selection: "Вклучи/исклучи некои карактеристики за приказ (попаметен приказ, но поголемо оптеретување за процесорот)",
highlight: "Вклучи/исклучи осветлување на синтакса",
reset_highlight: "Ресетирај го осветлувањето на синтакса (доколку е десинхронизиранo со текстот)",
word_wrap: "toggle word wrapping mode",
help: "За",
save: "Зачувај",
load: "Вчитај",
line_abbr: "Лн",
char_abbr: "Зн",
position: "Позиција",
total: "Вкупно",
close_popup: "Затвори го прозорецот",
shortcuts: "Кратенки",
add_tab: "Додај табулација на текстот",
remove_tab: "Отстрани ја табулацијата",
about_notice: "Напомена: Осветлувањето на синтанса е само за краток текст",
toggle: "Смени начин на уредување",
accesskey: "Accesskey",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Обработувам...",
fullscreen: "Цел прозорец",
syntax_selection: "--Синтакса--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Избери датотека"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["nl"]={
new_document: "nieuw leeg document",
search_button: "zoek en vervang",
search_command: "zoek volgende / zoekscherm openen",
search: "zoek",
replace: "vervang",
replace_command: "vervang / zoekscherm openen",
find_next: "volgende vinden",
replace_all: "alles vervangen",
reg_exp: "reguliere expressies",
match_case: "hoofdletter gevoelig",
not_found: "niet gevonden.",
occurrence_replaced: "object vervangen.",
search_field_empty: "Zoek veld leeg",
restart_search_at_begin: "Niet meer instanties gevonden, begin opnieuw",
move_popup: "versleep zoek scherm",
font_size: "--Letter grootte--",
go_to_line: "Ga naar regel",
go_to_line_prompt: "Ga naar regel nummer:",
undo: "Ongedaan maken",
redo: "Opnieuw doen",
change_smooth_selection: "zet wat schermopties aan/uit (kan langzamer zijn)",
highlight: "zet syntax highlight aan/uit",
reset_highlight: "reset highlight (indien gedesynchronizeerd)",
word_wrap: "toggle word wrapping mode",
help: "informatie",
save: "opslaan",
load: "laden",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Positie",
total: "Totaal",
close_popup: "Popup sluiten",
shortcuts: "Snelkoppelingen",
add_tab: "voeg tabs toe in tekst",
remove_tab: "verwijder tabs uit tekst",
about_notice: "Notitie: syntax highlight functie is alleen voor kleine tekst",
toggle: "geavanceerde bewerkingsopties",
accesskey: "Accessknop",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Verwerken...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["pl"]={
new_document: "nowy dokument",
search_button: "znajdź i zamień",
search_command: "znajdź następny",
search: "znajdź",
replace: "zamień",
replace_command: "zamień",
find_next: "następny",
replace_all: "zamień wszystko",
reg_exp: "wyrażenie regularne",
match_case: "uwzględnij wielkość liter<br />",
not_found: "nie znaleziono.",
occurrence_replaced: "wystąpień zamieniono.",
search_field_empty: "Nie wprowadzono tekstu",
restart_search_at_begin: "Koniec dokumentu. Wyszukiwanie od początku.",
move_popup: "przesuń okienko wyszukiwania",
font_size: "Rozmiar",
go_to_line: "idź do linii",
go_to_line_prompt: "numer linii:",
undo: "cofnij",
redo: "przywróć",
change_smooth_selection: "włącz/wyłącz niektóre opcje wyglądu (zaawansowane opcje wyglądu obciążają procesor)",
highlight: "włącz/wyłącz podświetlanie składni",
reset_highlight: "odśwież podświetlanie składni (jeśli rozsynchronizowało się z tekstem)",
word_wrap: "toggle word wrapping mode",
help: "o programie",
save: "zapisz",
load: "otwórz",
line_abbr: "Ln",
char_abbr: "Zn",
position: "Pozycja",
total: "W sumie",
close_popup: "zamknij okienko",
shortcuts: "Skróty klawiaturowe",
add_tab: "dodaj wcięcie do zaznaczonego tekstu",
remove_tab: "usuń wcięcie",
about_notice: "Uwaga: podświetlanie składni nie jest zalecane dla długich tekstów",
toggle: "Włącz/wyłącz edytor",
accesskey: "Alt+",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Przetwarzanie...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["pt"]={
new_document: "Novo documento",
search_button: "Localizar e substituir",
search_command: "Localizar próximo",
search: "Localizar",
replace: "Substituir",
replace_command: "Substituir",
find_next: "Localizar",
replace_all: "Subst. tudo",
reg_exp: "Expressões regulares",
match_case: "Diferenciar maiúsculas e minúsculas",
not_found: "Não encontrado.",
occurrence_replaced: "Ocorrências substituidas",
search_field_empty: "Campo localizar vazio.",
restart_search_at_begin: "Fim das ocorrências. Recomeçar do inicio.",
move_popup: "Mover janela",
font_size: "--Tamanho da fonte--",
go_to_line: "Ir para linha",
go_to_line_prompt: "Ir para a linha:",
undo: "Desfazer",
redo: "Refazer",
change_smooth_selection: "Opções visuais",
highlight: "Cores de sintaxe",
reset_highlight: "Resetar cores (se não sincronizado)",
word_wrap: "toggle word wrapping mode",
help: "Sobre",
save: "Salvar",
load: "Carregar",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Posição",
total: "Total",
close_popup: "Fechar",
shortcuts: "Shortcuts",
add_tab: "Adicionar tabulação",
remove_tab: "Remover tabulação",
about_notice: "Atenção: Cores de sintaxe são indicados somente para textos pequenos",
toggle: "Exibir editor",
accesskey: "Accesskey",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Processando...",
fullscreen: "fullscreen",
syntax_selection: "--Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["ru"]={
new_document: "новый пустой документ",
search_button: "поиск и замена",
search_command: "искать следующий / открыть панель поиска",
search: "поиск",
replace: "замена",
replace_command: "заменить / открыть панель поиска",
find_next: "найти следующее",
replace_all: "заменить все",
reg_exp: "регулярное выражение",
match_case: "учитывать регистр",
not_found: "не найдено.",
occurrence_replaced: "вхождение заменено.",
search_field_empty: "Поле поиска пустое",
restart_search_at_begin: "Достигнут конец документа. Начинаю с начала.",
move_popup: "переместить окно поиска",
font_size: "--Размер шрифта--",
go_to_line: "перейти к строке",
go_to_line_prompt: "перейти к строке номер:",
undo: "отменить",
redo: "вернуть",
change_smooth_selection: "включить/отключить некоторые функции просмотра (более красиво, но больше использует процессор)",
highlight: "переключить подсветку синтаксиса включена/выключена",
reset_highlight: "восстановить подсветку (если разсинхронизирована от текста)",
word_wrap: "toggle word wrapping mode",
help: "о программе",
save: "сохранить",
load: "загрузить",
line_abbr: "Стр",
char_abbr: "Стлб",
position: "Позиция",
total: "Всего",
close_popup: "закрыть всплывающее окно",
shortcuts: "Горячие клавиши",
add_tab: "добавить табуляцию в текст",
remove_tab: "убрать табуляцию из текста",
about_notice: "Внимание: функция подсветки синтаксиса только для небольших текстов",
toggle: "Переключить редактор",
accesskey: "Горячая клавиша",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Обработка...",
fullscreen: "полный экран",
syntax_selection: "--Синтакс--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Закрыть файл"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["sk"]={
new_document: "nový prázdy dokument",
search_button: "vyhľadaj a nahraď",
search_command: "hľadaj ďalsšie / otvor vyhľadávacie pole",
search: "hľadaj",
replace: "nahraď",
replace_command: "nahraď / otvor vyhľadávacie pole",
find_next: "nájdi ďalšie",
replace_all: "nahraď všetko",
reg_exp: "platné výrazy",
match_case: "zhodujúce sa výrazy",
not_found: "nenájdené.",
occurrence_replaced: "výskyty nahradené.",
search_field_empty: "Pole vyhľadávanie je prádzne",
restart_search_at_begin: "End of area reached. Restart at begin.",
move_popup: "presuň vyhľadávacie okno",
font_size: "--Veľkosť textu--",
go_to_line: "prejdi na riadok",
go_to_line_prompt: "prejdi na riadok:",
undo: "krok späť",
redo: "prepracovať",
change_smooth_selection: "povoliť/zamietnúť niektoré zo zobrazených funkcií (účelnejšie zobrazenie vyžaduje väčšie zaťaženie procesora CPU)",
highlight: "prepnúť zvýrazňovanie syntaxe zap/vyp",
reset_highlight: "zrušiť zvýrazňovanie (ak je nesynchronizované s textom)",
word_wrap: "toggle word wrapping mode",
help: "o programe",
save: "uložiť",
load: "načítať",
line_abbr: "Ln",
char_abbr: "Ch",
position: "Pozícia",
total: "Spolu",
close_popup: "zavrieť okno",
shortcuts: "Skratky",
add_tab: "pridať tabulovanie textu",
remove_tab: "odstrániť tabulovanie textu",
about_notice: "Upozornenie: funkcia zvýrazňovania syntaxe je dostupná iba pre malý text",
toggle: "Prepnúť editor",
accesskey: "Accesskey",
tab: "Záložka",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "Spracúvam...",
fullscreen: "cel=a obrazovka",
syntax_selection: "--Vyber Syntax--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "Close file"
};
+67
View File
@@ -0,0 +1,67 @@
editAreaLoader.lang["zh"]={
new_document: "新建空白文档",
search_button: "查找与替换",
search_command: "查找下一个 / 打开查找框",
search: "查找",
replace: "替换",
replace_command: "替换 / 打开查找框",
find_next: "查找下一个",
replace_all: "全部替换",
reg_exp: "正则表达式",
match_case: "匹配大小写",
not_found: "未找到.",
occurrence_replaced: "处被替换.",
search_field_empty: "查找框没有内容",
restart_search_at_begin: "已到到文档末尾. 从头重新查找.",
move_popup: "移动查找对话框",
font_size: "--字体大小--",
go_to_line: "转到行",
go_to_line_prompt: "转到行:",
undo: "恢复",
redo: "重做",
change_smooth_selection: "启用/禁止一些显示特性(更好看但更耗费资源)",
highlight: "启用/禁止语法高亮",
reset_highlight: "重置语法高亮(当文本显示不同步时)",
word_wrap: "toggle word wrapping mode",
help: "关于",
save: "保存",
load: "加载",
line_abbr: "行",
char_abbr: "字符",
position: "位置",
total: "总计",
close_popup: "关闭对话框",
shortcuts: "快捷键",
add_tab: "添加制表符(Tab)",
remove_tab: "移除制表符(Tab)",
about_notice: "注意:语法高亮功能仅用于较少内容的文本(文件内容太大会导致浏览器反应慢)",
toggle: "切换编辑器",
accesskey: "快捷键",
tab: "Tab",
shift: "Shift",
ctrl: "Ctrl",
esc: "Esc",
processing: "正在处理中...",
fullscreen: "全屏编辑",
syntax_selection: "--语法--",
syntax_css: "CSS",
syntax_html: "HTML",
syntax_js: "Javascript",
syntax_php: "Php",
syntax_python: "Python",
syntax_vb: "Visual Basic",
syntax_xml: "Xml",
syntax_c: "C",
syntax_cpp: "CPP",
syntax_basic: "Basic",
syntax_pas: "Pascal",
syntax_brainfuck: "Brainfuck",
syntax_sql: "SQL",
syntax_ruby: "Ruby",
syntax_robotstxt: "Robots txt",
syntax_tsql: "T-SQL",
syntax_perl: "Perl",
syntax_coldfusion: "Coldfusion",
syntax_java: "Java",
close_tab: "关闭文件"
};
@@ -0,0 +1,90 @@
/**
* Charmap plugin
* by Christophe Dolivet
* v0.1 (2006/09/22)
*
*
* This plugin allow to use a visual keyboard allowing to insert any UTF-8 characters in the text.
*
* - plugin name to add to the plugin list: "charmap"
* - plugin name to add to the toolbar list: "charmap"
* - possible parameters to add to EditAreaLoader.init():
* "charmap_default": (String) define the name of the default character range displayed on popup display
* (default: "arrows")
*
*
*/
var EditArea_charmap= {
/**
* Get called once this file is loaded (editArea still not initialized)
*
* @return nothing
*/
init: function(){
this.default_language="Arrows";
}
/**
* Returns the HTML code for a specific control string or false if this plugin doesn't have that control.
* A control can be a button, select list or any other HTML item to present in the EditArea user interface.
* Language variables such as {$lang_somekey} will also be replaced with contents from
* the language packs.
*
* @param {string} ctrl_name: the name of the control to add
* @return HTML code for a specific control or false.
* @type string or boolean
*/
,get_control_html: function(ctrl_name){
switch(ctrl_name){
case "charmap":
// Control id, button img, command
return parent.editAreaLoader.get_button_html('charmap_but', 'charmap.gif', 'charmap_press', false, this.baseURL);
}
return false;
}
/**
* Get called once EditArea is fully loaded and initialised
*
* @return nothing
*/
,onload: function(){
if(editArea.settings["charmap_default"] && editArea.settings["charmap_default"].length>0)
this.default_language= editArea.settings["charmap_default"];
}
/**
* Is called each time the user touch a keyboard key.
*
* @param (event) e: the keydown event
* @return true - pass to next handler in chain, false - stop chain execution
* @type boolean
*/
,onkeydown: function(e){
}
/**
* Executes a specific command, this function handles plugin commands.
*
* @param {string} cmd: the name of the command being executed
* @param {unknown} param: the parameter of the command
* @return true - pass to next handler in chain, false - stop chain execution
* @type boolean
*/
,execCommand: function(cmd, param){
// Handle commands
switch(cmd){
case "charmap_press":
win= window.open(this.baseURL+"popup.html", "charmap", "width=500,height=270,scrollbars=yes,resizable=yes");
win.focus();
return false;
}
// Pass to next handler in chain
return true;
}
};
// Adds the plugin class to the list of available EditArea plugins
editArea.add_plugin("charmap", EditArea_charmap);
@@ -0,0 +1,64 @@
body{
background-color: #F0F0EE;
font: 12px monospace, sans-serif;
}
select{
background-color: #F9F9F9;
border: solid 1px #888888;
}
h1, h2, h3, h4, h5, h6{
margin: 0;
padding: 0;
color: #2B6FB6;
}
h1{
font-size: 1.5em;
}
div#char_list{
height: 200px;
overflow: auto;
padding: 1px;
border: 1px solid #0A246A;
background-color: #F9F9F9;
clear: both;
margin-top: 5px;
}
a.char{
display: block;
float: left;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px;
border: solid 1px #888888;
text-align: center;
cursor: pointer;
}
a.char:hover{
background-color: #CCCCCC;
}
.preview{
border: solid 1px #888888;
width: 50px;
padding: 2px 5px;
height: 35px;
line-height: 35px;
text-align:center;
background-color: #CCCCCC;
font-size: 2em;
float: right;
font-weight: bold;
margin: 0 0 5px 5px;
}
#preview_code{
font-size: 1.1em;
width: 70px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

@@ -0,0 +1,373 @@
var editArea;
/**
* UTF-8 list taken from http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=dec
*/
/*
var char_range_list={
"Basic Latin":"0021,007F",
"Latin-1 Supplement":"0080,00FF",
"Latin Extended-A":"0100,017F",
"Latin Extended-B":"0180,024F",
"IPA Extensions":"0250,02AF",
"Spacing Modifier Letters":"02B0,02FF",
"Combining Diacritical Marks":"0300,036F",
"Greek and Coptic":"0370,03FF",
"Cyrillic":"0400,04FF",
"Cyrillic Supplement":"0500,052F",
"Armenian":"0530,058F",
"Hebrew":"0590,05FF",
"Arabic":"0600,06FF",
"Syriac":"0700,074F",
"Arabic Supplement":"0750,077F",
"Thaana":"0780,07BF",
"Devanagari":"0900,097F",
"Bengali":"0980,09FF",
"Gurmukhi":"0A00,0A7F",
"Gujarati":"0A80,0AFF",
"Oriya":"0B00,0B7F",
"Tamil":"0B80,0BFF",
"Telugu":"0C00,0C7F",
"Kannada":"0C80,0CFF",
"Malayalam":"0D00,0D7F",
"Sinhala":"0D80,0DFF",
"Thai":"0E00,0E7F",
"Lao":"0E80,0EFF",
"Tibetan":"0F00,0FFF",
"Myanmar":"1000,109F",
"Georgian":"10A0,10FF",
"Hangul Jamo":"1100,11FF",
"Ethiopic":"1200,137F",
"Ethiopic Supplement":"1380,139F",
"Cherokee":"13A0,13FF",
"Unified Canadian Aboriginal Syllabics":"1400,167F",
"Ogham":"1680,169F",
"Runic":"16A0,16FF",
"Tagalog":"1700,171F",
"Hanunoo":"1720,173F",
"Buhid":"1740,175F",
"Tagbanwa":"1760,177F",
"Khmer":"1780,17FF",
"Mongolian":"1800,18AF",
"Limbu":"1900,194F",
"Tai Le":"1950,197F",
"New Tai Lue":"1980,19DF",
"Khmer Symbols":"19E0,19FF",
"Buginese":"1A00,1A1F",
"Phonetic Extensions":"1D00,1D7F",
"Phonetic Extensions Supplement":"1D80,1DBF",
"Combining Diacritical Marks Supplement":"1DC0,1DFF",
"Latin Extended Additional":"1E00,1EFF",
"Greek Extended":"1F00,1FFF",
"General Punctuation":"2000,206F",
"Superscripts and Subscripts":"2070,209F",
"Currency Symbols":"20A0,20CF",
"Combining Diacritical Marks for Symbols":"20D0,20FF",
"Letterlike Symbols":"2100,214F",
"Number Forms":"2150,218F",
"Arrows":"2190,21FF",
"Mathematical Operators":"2200,22FF",
"Miscellaneous Technical":"2300,23FF",
"Control Pictures":"2400,243F",
"Optical Character Recognition":"2440,245F",
"Enclosed Alphanumerics":"2460,24FF",
"Box Drawing":"2500,257F",
"Block Elements":"2580,259F",
"Geometric Shapes":"25A0,25FF",
"Miscellaneous Symbols":"2600,26FF",
"Dingbats":"2700,27BF",
"Miscellaneous Mathematical Symbols-A":"27C0,27EF",
"Supplemental Arrows-A":"27F0,27FF",
"Braille Patterns":"2800,28FF",
"Supplemental Arrows-B":"2900,297F",
"Miscellaneous Mathematical Symbols-B":"2980,29FF",
"Supplemental Mathematical Operators":"2A00,2AFF",
"Miscellaneous Symbols and Arrows":"2B00,2BFF",
"Glagolitic":"2C00,2C5F",
"Coptic":"2C80,2CFF",
"Georgian Supplement":"2D00,2D2F",
"Tifinagh":"2D30,2D7F",
"Ethiopic Extended":"2D80,2DDF",
"Supplemental Punctuation":"2E00,2E7F",
"CJK Radicals Supplement":"2E80,2EFF",
"Kangxi Radicals":"2F00,2FDF",
"Ideographic Description Characters":"2FF0,2FFF",
"CJK Symbols and Punctuation":"3000,303F",
"Hiragana":"3040,309F",
"Katakana":"30A0,30FF",
"Bopomofo":"3100,312F",
"Hangul Compatibility Jamo":"3130,318F",
"Kanbun":"3190,319F",
"Bopomofo Extended":"31A0,31BF",
"CJK Strokes":"31C0,31EF",
"Katakana Phonetic Extensions":"31F0,31FF",
"Enclosed CJK Letters and Months":"3200,32FF",
"CJK Compatibility":"3300,33FF",
"CJK Unified Ideographs Extension A":"3400,4DBF",
"Yijing Hexagram Symbols":"4DC0,4DFF",
"CJK Unified Ideographs":"4E00,9FFF",
"Yi Syllables":"A000,A48F",
"Yi Radicals":"A490,A4CF",
"Modifier Tone Letters":"A700,A71F",
"Syloti Nagri":"A800,A82F",
"Hangul Syllables":"AC00,D7AF",
"High Surrogates":"D800,DB7F",
"High Private Use Surrogates":"DB80,DBFF",
"Low Surrogates":"DC00,DFFF",
"Private Use Area":"E000,F8FF",
"CJK Compatibility Ideographs":"F900,FAFF",
"Alphabetic Presentation Forms":"FB00,FB4F",
"Arabic Presentation Forms-A":"FB50,FDFF",
"Variation Selectors":"FE00,FE0F",
"Vertical Forms":"FE10,FE1F",
"Combining Half Marks":"FE20,FE2F",
"CJK Compatibility Forms":"FE30,FE4F",
"Small Form Variants":"FE50,FE6F",
"Arabic Presentation Forms-B":"FE70,FEFF",
"Halfwidth and Fullwidth Forms":"FF00,FFEF",
"Specials":"FFF0,FFFF",
"Linear B Syllabary":"10000,1007F",
"Linear B Ideograms":"10080,100FF",
"Aegean Numbers":"10100,1013F",
"Ancient Greek Numbers":"10140,1018F",
"Old Italic":"10300,1032F",
"Gothic":"10330,1034F",
"Ugaritic":"10380,1039F",
"Old Persian":"103A0,103DF",
"Deseret":"10400,1044F",
"Shavian":"10450,1047F",
"Osmanya":"10480,104AF",
"Cypriot Syllabary":"10800,1083F",
"Kharoshthi":"10A00,10A5F",
"Byzantine Musical Symbols":"1D000,1D0FF",
"Musical Symbols":"1D100,1D1FF",
"Ancient Greek Musical Notation":"1D200,1D24F",
"Tai Xuan Jing Symbols":"1D300,1D35F",
"Mathematical Alphanumeric Symbols":"1D400,1D7FF",
"CJK Unified Ideographs Extension B":"20000,2A6DF",
"CJK Compatibility Ideographs Supplement":"2F800,2FA1F",
"Tags":"E0000,E007F",
"Variation Selectors Supplement":"E0100,E01EF"
};
*/
var char_range_list={
"Aegean Numbers":"10100,1013F",
"Alphabetic Presentation Forms":"FB00,FB4F",
"Ancient Greek Musical Notation":"1D200,1D24F",
"Ancient Greek Numbers":"10140,1018F",
"Arabic":"0600,06FF",
"Arabic Presentation Forms-A":"FB50,FDFF",
"Arabic Presentation Forms-B":"FE70,FEFF",
"Arabic Supplement":"0750,077F",
"Armenian":"0530,058F",
"Arrows":"2190,21FF",
"Basic Latin":"0020,007F",
"Bengali":"0980,09FF",
"Block Elements":"2580,259F",
"Bopomofo Extended":"31A0,31BF",
"Bopomofo":"3100,312F",
"Box Drawing":"2500,257F",
"Braille Patterns":"2800,28FF",
"Buginese":"1A00,1A1F",
"Buhid":"1740,175F",
"Byzantine Musical Symbols":"1D000,1D0FF",
"CJK Compatibility Forms":"FE30,FE4F",
"CJK Compatibility Ideographs Supplement":"2F800,2FA1F",
"CJK Compatibility Ideographs":"F900,FAFF",
"CJK Compatibility":"3300,33FF",
"CJK Radicals Supplement":"2E80,2EFF",
"CJK Strokes":"31C0,31EF",
"CJK Symbols and Punctuation":"3000,303F",
"CJK Unified Ideographs Extension A":"3400,4DBF",
"CJK Unified Ideographs Extension B":"20000,2A6DF",
"CJK Unified Ideographs":"4E00,9FFF",
"Cherokee":"13A0,13FF",
"Combining Diacritical Marks Supplement":"1DC0,1DFF",
"Combining Diacritical Marks for Symbols":"20D0,20FF",
"Combining Diacritical Marks":"0300,036F",
"Combining Half Marks":"FE20,FE2F",
"Control Pictures":"2400,243F",
"Coptic":"2C80,2CFF",
"Currency Symbols":"20A0,20CF",
"Cypriot Syllabary":"10800,1083F",
"Cyrillic Supplement":"0500,052F",
"Cyrillic":"0400,04FF",
"Deseret":"10400,1044F",
"Devanagari":"0900,097F",
"Dingbats":"2700,27BF",
"Enclosed Alphanumerics":"2460,24FF",
"Enclosed CJK Letters and Months":"3200,32FF",
"Ethiopic Extended":"2D80,2DDF",
"Ethiopic Supplement":"1380,139F",
"Ethiopic":"1200,137F",
"General Punctuation":"2000,206F",
"Geometric Shapes":"25A0,25FF",
"Georgian Supplement":"2D00,2D2F",
"Georgian":"10A0,10FF",
"Glagolitic":"2C00,2C5F",
"Gothic":"10330,1034F",
"Greek Extended":"1F00,1FFF",
"Greek and Coptic":"0370,03FF",
"Gujarati":"0A80,0AFF",
"Gurmukhi":"0A00,0A7F",
"Halfwidth and Fullwidth Forms":"FF00,FFEF",
"Hangul Compatibility Jamo":"3130,318F",
"Hangul Jamo":"1100,11FF",
"Hangul Syllables":"AC00,D7AF",
"Hanunoo":"1720,173F",
"Hebrew":"0590,05FF",
"High Private Use Surrogates":"DB80,DBFF",
"High Surrogates":"D800,DB7F",
"Hiragana":"3040,309F",
"IPA Extensions":"0250,02AF",
"Ideographic Description Characters":"2FF0,2FFF",
"Kanbun":"3190,319F",
"Kangxi Radicals":"2F00,2FDF",
"Kannada":"0C80,0CFF",
"Katakana Phonetic Extensions":"31F0,31FF",
"Katakana":"30A0,30FF",
"Kharoshthi":"10A00,10A5F",
"Khmer Symbols":"19E0,19FF",
"Khmer":"1780,17FF",
"Lao":"0E80,0EFF",
"Latin Extended Additional":"1E00,1EFF",
"Latin Extended-A":"0100,017F",
"Latin Extended-B":"0180,024F",
"Latin-1 Supplement":"0080,00FF",
"Letterlike Symbols":"2100,214F",
"Limbu":"1900,194F",
"Linear B Ideograms":"10080,100FF",
"Linear B Syllabary":"10000,1007F",
"Low Surrogates":"DC00,DFFF",
"Malayalam":"0D00,0D7F",
"Mathematical Alphanumeric Symbols":"1D400,1D7FF",
"Mathematical Operators":"2200,22FF",
"Miscellaneous Mathematical Symbols-A":"27C0,27EF",
"Miscellaneous Mathematical Symbols-B":"2980,29FF",
"Miscellaneous Symbols and Arrows":"2B00,2BFF",
"Miscellaneous Symbols":"2600,26FF",
"Miscellaneous Technical":"2300,23FF",
"Modifier Tone Letters":"A700,A71F",
"Mongolian":"1800,18AF",
"Musical Symbols":"1D100,1D1FF",
"Myanmar":"1000,109F",
"New Tai Lue":"1980,19DF",
"Number Forms":"2150,218F",
"Ogham":"1680,169F",
"Old Italic":"10300,1032F",
"Old Persian":"103A0,103DF",
"Optical Character Recognition":"2440,245F",
"Oriya":"0B00,0B7F",
"Osmanya":"10480,104AF",
"Phonetic Extensions Supplement":"1D80,1DBF",
"Phonetic Extensions":"1D00,1D7F",
"Private Use Area":"E000,F8FF",
"Runic":"16A0,16FF",
"Shavian":"10450,1047F",
"Sinhala":"0D80,0DFF",
"Small Form Variants":"FE50,FE6F",
"Spacing Modifier Letters":"02B0,02FF",
"Specials":"FFF0,FFFF",
"Superscripts and Subscripts":"2070,209F",
"Supplemental Arrows-A":"27F0,27FF",
"Supplemental Arrows-B":"2900,297F",
"Supplemental Mathematical Operators":"2A00,2AFF",
"Supplemental Punctuation":"2E00,2E7F",
"Syloti Nagri":"A800,A82F",
"Syriac":"0700,074F",
"Tagalog":"1700,171F",
"Tagbanwa":"1760,177F",
"Tags":"E0000,E007F",
"Tai Le":"1950,197F",
"Tai Xuan Jing Symbols":"1D300,1D35F",
"Tamil":"0B80,0BFF",
"Telugu":"0C00,0C7F",
"Thaana":"0780,07BF",
"Thai":"0E00,0E7F",
"Tibetan":"0F00,0FFF",
"Tifinagh":"2D30,2D7F",
"Ugaritic":"10380,1039F",
"Unified Canadian Aboriginal Syllabics":"1400,167F",
"Variation Selectors Supplement":"E0100,E01EF",
"Variation Selectors":"FE00,FE0F",
"Vertical Forms":"FE10,FE1F",
"Yi Radicals":"A490,A4CF",
"Yi Syllables":"A000,A48F",
"Yijing Hexagram Symbols":"4DC0,4DFF"
};
var insert="charmap_insert";
function map_load(){
editArea=opener.editArea;
// translate the document
insert= editArea.get_translation(insert, "word");
//alert(document.title);
document.title= editArea.get_translation(document.title, "template");
document.body.innerHTML= editArea.get_translation(document.body.innerHTML, "template");
//document.title= editArea.get_translation(document.getElementBytitle, "template");
var selected_lang=opener.EditArea_charmap.default_language.toLowerCase();
var selected=0;
var select= document.getElementById("select_range")
for(var i in char_range_list){
if(i.toLowerCase()==selected_lang)
selected=select.options.length;
select.options[select.options.length]=new Option(i, char_range_list[i]);
}
select.options[selected].selected=true;
/* start=0;
end=127;
content="";
for(var i=start; i<end; i++){
content+="&#"+i+"; ";
}
document.getElementById("char_list").innerHTML=content;*/
renderCharMapHTML();
}
function renderCharMapHTML() {
range= document.getElementById("select_range").value.split(",");
start= parseInt(range[0],16);
end= parseInt(range[1],16);
var charsPerRow = 20, tdWidth=20, tdHeight=20;
html="";
for (var i=start; i<end; i++) {
html+="<a class='char' onmouseover='previewChar(\""+ i + "\");' onclick='insertChar(\""+ i + "\");' title='"+ insert +"'>"+ String.fromCharCode(i) +"</a>";
}
document.getElementById("char_list").innerHTML= html;
document.getElementById("preview_char").innerHTML="";
}
function previewChar(i){
document.getElementById("preview_char").innerHTML= String.fromCharCode(i);
document.getElementById("preview_code").innerHTML= "&amp;#"+ i +";";
}
function insertChar(i){
opener.parent.editAreaLoader.setSelectedText(editArea.id, String.fromCharCode( i));
range= opener.parent.editAreaLoader.getSelectionRange(editArea.id);
opener.parent.editAreaLoader.setSelectionRange(editArea.id, range["end"], range["end"]);
window.focus();
}
@@ -0,0 +1,12 @@
/*
* Bulgarian translation
* Author: Valentin Hristov
* Company: SOFTKIT Bulgarian
* Site: http://www.softkit-bg.com
*/
editArea.add_lang("bg",{
charmap_but: "Виртуална клавиатура",
charmap_title: "Виртуална клавиатура",
charmap_choose_block: "избери езиков блок",
charmap_insert:"постави този символ"
});
@@ -0,0 +1,6 @@
editArea.add_lang("cs",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("de",{
charmap_but: "Sonderzeichen",
charmap_title: "Sonderzeichen",
charmap_choose_block: "Bereich ausw&auml;hlen",
charmap_insert: "dieses Zeichen einf&uuml;gen"
});
@@ -0,0 +1,6 @@
editArea.add_lang("dk",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("en",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("eo",{
charmap_but: "Ekranklavaro",
charmap_title: "Ekranklavaro",
charmap_choose_block: "Elekto de lingvo",
charmap_insert:"enmeti tiun signaron"
});
@@ -0,0 +1,6 @@
editArea.add_lang("es",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("fr",{
charmap_but: "Clavier visuel",
charmap_title: "Clavier visuel",
charmap_choose_block: "choix du language",
charmap_insert:"ins&eacute;rer ce caract&egrave;re"
});
@@ -0,0 +1,6 @@
editArea.add_lang("hr",{
charmap_but: "Virtualna tipkovnica",
charmap_title: "Virtualna tipkovnica",
charmap_choose_block: "Odaberi blok s jezikom",
charmap_insert:"Ubaci taj znak"
});
@@ -0,0 +1,6 @@
editArea.add_lang("it",{
charmap_but: "Tastiera visuale",
charmap_title: "Tastiera visuale",
charmap_choose_block: "seleziona blocco",
charmap_insert:"inserisci questo carattere"
});
@@ -0,0 +1,6 @@
editArea.add_lang("ja",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("mkn",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("nl",{
charmap_but: "Visueel toetsenbord",
charmap_title: "Visueel toetsenbord",
charmap_choose_block: "Kies een taal blok",
charmap_insert:"Voeg dit symbool in"
});
@@ -0,0 +1,6 @@
editArea.add_lang("pl",{
charmap_but: "Klawiatura ekranowa",
charmap_title: "Klawiatura ekranowa",
charmap_choose_block: "wybierz grupę znaków",
charmap_insert:"wstaw ten znak"
});
@@ -0,0 +1,6 @@
editArea.add_lang("pt",{
charmap_but: "Visual keyboard",
charmap_title: "Visual keyboard",
charmap_choose_block: "select language block",
charmap_insert:"insert this character"
});
@@ -0,0 +1,6 @@
editArea.add_lang("ru",{
charmap_but: "Визуальная клавиатура",
charmap_title: "Визуальная клавиатура",
charmap_choose_block: "выбрать языковой блок",
charmap_insert:"вставить этот символ"
});
@@ -0,0 +1,6 @@
editArea.add_lang("sk",{
charmap_but: "Vizuálna klávesnica",
charmap_title: "Vizuálna klávesnica",
charmap_choose_block: "vyber jazykový blok",
charmap_insert: "vlož tento znak"
});
@@ -0,0 +1,6 @@
editArea.add_lang("zh",{
charmap_but: "软键盘",
charmap_title: "软键盘",
charmap_choose_block: "选择一个语言块",
charmap_insert:"插入此字符"
});
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>{$charmap_title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/charmap.css" />
<script language="Javascript" type="text/javascript" src="jscripts/map.js">
</script>
</head>
<body onload='map_load()'>
<div id='preview_code' class='preview'></div>
<div id='preview_char' class='preview'></div>
<h1>{$charmap_title}:</h1>
<select id='select_range' onchange='renderCharMapHTML()' title='{$charmap_choose_block}'>
</select>
<div id='char_list'>
</div>
</body>
</html>
@@ -0,0 +1,3 @@
select#test_select{
background-color: #FF0000;
}
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

@@ -0,0 +1,10 @@
/*
* Bulgarian translation
* Author: Valentin Hristov
* Company: SOFTKIT Bulgarian
* Site: http://www.softkit-bg.com
*/
editArea.add_lang("bg",{
test_select: "избери таг",
test_but: "тествай копието"
});

Some files were not shown because too many files have changed in this diff Show More