本文整理汇总了PHP中smarty_init函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_init函数的具体用法?PHP smarty_init怎么用?PHP smarty_init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SoundFiles_Ajax
function SoundFiles_Ajax()
{
global $mysqli;
$session =& $_SESSION['SoundFilesAjax'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$data = $_REQUEST;
$response = array();
switch ($data['Action']) {
case 'RecordSound':
$UID = uniqid(time());
asterisk_RecordSound($_REQUEST['Extension'], '/usr/share/asterisk/sounds/vm-then-pound', $UID);
$response['TmpFile'] = "/tmp/{$UID}.wav";
break;
case 'PlayFile':
$PK_SoundFile = $_REQUEST['PK_SoundFile'];
$Extension = $_REQUEST['Extension'];
$query = "SELECT Filename FROM SoundFiles WHERE PK_SoundFile = {$PK_SoundFile} LIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error . $query);
$row = $result->fetch_row();
$File = pathinfo($row[0]);
asterisk_PlaySound($Extension, $File['dirname'] . '/' . $File['filename']);
break;
case 'VerifyFile':
if (file_exists($_REQUEST['File'])) {
$response['FileExists'] = 1;
} else {
$response['FileExists'] = 0;
}
break;
}
echo json_encode($response);
}
示例2: VoipProviders_List
function VoipProviders_List()
{
global $mysqli;
$session =& $_SESSION['VoipProviders_List'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
// Init sort order (Order)
if ($session['Sort'] == $_REQUEST['Sort']) {
$Order = $session['Order'] == "asc" ? "desc" : "asc";
} elseif ($session['Sort'] != $_REQUEST['Sort']) {
$Order = 'asc';
}
$session['Order'] = $Order;
// Init sort field (Sort)
if (isset($_REQUEST['Sort'])) {
$Sort = $_REQUEST['Sort'];
} else {
$Sort = 'Name';
}
$session['Sort'] = $Sort;
// Init table fields (Extensions)
$Providers = array();
$query = "\n\t\t\tSELECT\n\t\t\t\tPK_SipProvider AS _PK_,\n\t\t\t\tName AS Name,\n\t\t\t\t'SIP' AS Type,\n\t\t\t\tAccountID AS AccountID,\n\t\t\t\tHost AS Host,\n\t\t\t\tCallbackExtension AS CallbackExtension\n\t\t\tFROM\n\t\t\t\tSipProviders\n\t\tORDER BY\n\t\t\t{$Sort} {$Order}\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
while ($row = $result->fetch_assoc()) {
$Providers[] = $row;
}
$smarty->assign('Errors', $Errors);
$smarty->assign('Providers', $Providers);
$smarty->assign('Sort', $Sort);
$smarty->assign('Order', $Order);
$smarty->assign('Message', $Message);
$smarty->assign('Hilight', isset($_REQUEST['hilight']) ? $_REQUEST['hilight'] : "");
return $smarty->fetch('VoipProviders_List.tpl');
}
示例3: Extensions_DialTone_Modify
function Extensions_DialTone_Modify()
{
global $mysqli;
$session =& $_SESSION['Extensions_SimpleConf_Modify'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init message (Message)
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
if (@$_REQUEST['submit'] == 'save') {
$Extension = formdata_from_post();
$Errors = formdata_validate($Extension);
if (count($Errors) == 0) {
if ($Extension['PK_Extension'] != '') {
$msg = 'MODIFY_DIALTONE_EXTENSION';
} else {
$msg = 'ADD_DIALTONE_EXTENSION';
}
$id = formdata_save($Extension);
header("Location: Extensions_List.php?hilight={$id}&msg={$msg}");
die;
}
} elseif (@$_REQUEST['PK_Extension'] != "") {
$Extension = formdata_from_db($_REQUEST['PK_Extension']);
} else {
$Extension = formdata_from_default();
}
$smarty->assign('Extension', $Extension);
$smarty->assign('Errors', $Errors);
return $smarty->fetch('Extensions_DialTone_Modify.tpl');
}
示例4: TimeFrames_Delete
function TimeFrames_Delete()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$PK_Timeframe = $_REQUEST['PK_Timeframe'];
// In confirmed, do the actual delete
if (@$_REQUEST['submit'] == 'delete_confirm') {
// See if user is alowed to update this timeframe
$query = "\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tTimeframes\n\t\t\tWHERE\n\t\t\t\tPK_Timeframe = {$PK_Timeframe}\n\t\t\t\tAND\n\t\t\t\tFK_Extension = '" . $mysqli->real_escape_string($_SESSION['_USER']['PK_Extension']) . "'\n\t\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
if ($result->num_rows != 1) {
header('Location: TimeFrames.php?msg=DELETE_TIMEFRAME');
die;
}
$query = "DELETE FROM Timeframes WHERE PK_Timeframe = {$PK_Timeframe} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
$query = "DELETE FROM Timeframe_Intervals WHERE FK_Timeframe = {$PK_Timeframe}";
$mysqli->query($query) or die($mysqli->error);
header('Location: TimeFrames.php?msg=DELETE_TIMEFRAME');
die;
}
// Init template info (Template)
$query = "SELECT * FROM Timeframes WHERE PK_Timeframe = {$PK_Timeframe} LIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error);
$Timeframe = $result->fetch_assoc();
$smarty->assign('Timeframe', $Timeframe);
return $smarty->fetch('TimeFrames_Delete.tpl');
}
示例5: SoundLanguages_Delete
function SoundLanguages_Delete()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$PK_SoundLanguage = $_REQUEST['PK_SoundLanguage'];
if ($PK_SoundLanguage == "") {
$PK_SoundLanguage = $_REQUEST['PK'];
}
// In confirmed, do the actual delete
if (@$_REQUEST['submit'] == 'delete_confirm') {
$query = "DELETE FROM SoundLanguages WHERE PK_SoundLanguage = {$PK_SoundLanguage} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
if ($mysqli->affected_rows != 1) {
return;
}
header('Location: SoundLanguages_List.php?msg=DELETE_LANGUAGE');
die;
}
// Init extension info (Extension)
$query = "SELECT * FROM SoundLanguages WHERE PK_SoundLanguage = {$PK_SoundLanguage} LIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error);
$SoundLanguage = $result->fetch_assoc();
$smarty->assign('SoundLanguage', $SoundLanguage);
return $smarty->fetch('SoundLanguages_Delete.tpl');
}
示例6: IVR_Menus_Modify
function IVR_Menus_Modify()
{
global $mysqli;
$session =& $_SESSION['IVR_Menus_Modify'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
if (@$_REQUEST['submit'] == 'save') {
$Menu = formdata_from_post();
$Errors = formdata_validate($Action);
if (count($Errors) == 0) {
if ($Menu['PK_Menu'] != '') {
$msg = 'MODIFY_MENU';
} else {
$msg = 'ADD_MENU';
}
$id = formdata_save($Menu);
header("Location: IVR_Menus.php?PK_Menu={$id}&msg={$msg}");
die;
}
} elseif (@$_REQUEST['PK_Menu'] != "") {
$Menu = formdata_from_db($_REQUEST['PK_Menu']);
} else {
$Menu = formdata_from_default();
}
$smarty->assign('Menu', $Menu);
$smarty->assign('Errors', $Errors);
return $smarty->fetch('IVR_Menus_Modify.tpl');
}
示例7: TimeFrames
function TimeFrames()
{
global $mysqli;
$session =& $_SESSION['TimeFrames'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init Message
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
// If requested, create new timeframe
if (isset($_POST['sumbit'])) {
$data = $_POST;
if (strlen($data['Name']) < 1 || strlen($data['Name']) > 30) {
$errors['Name'] = true;
}
if (count($errors) == 0) {
$query = "INSERT INTO Timeframes(Name) VALUES('" . $mysqli->real_escape_string($_POST['Name']) . "')";
$mysqli->query($query) or die($mysqli->error . $query);
$PK_Timeframe = $mysqli->insert_id;
header("Location: TimeFrames_Modify.php?msg=CREATE_TIMEFRAME&FK_Timeframe={$PK_Timeframe}");
die;
}
}
// Init table fields (Timeframes)
$Timeframes = array();
$query = "\n\t\tSELECT\n\t\t\tPK_Timeframe AS _PK_,\n\t\t\tName AS Name\n\t\tFROM\n\t\t\tTimeframes\n\t\tWHERE\n\t\t\tFK_Extension = 0\n\t\tORDER BY Name\n\t";
$result = $mysqli->query($query) or die($mysqli->error);
while ($row = $result->fetch_assoc()) {
$Timeframes[] = $row;
}
$smarty->assign('Timeframes', $Timeframes);
$smarty->assign('Errors', $errors);
$smarty->assign('Message', $Message);
return $smarty->fetch('TimeFrames.tpl');
}
示例8: Groups_Popup_Create
function Groups_Popup_Create()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init form data (Group, Errors)
if (@$_REQUEST['submit'] == 'save') {
$Group = formdata_from_post();
$Errors = formdata_validate($Group);
if (count($Errors) == 0) {
$id = formdata_save($Group);
return '
<script type="text/javascript" src="../script/jquery.selectboxes.js"></script>
<script>
$("#Groups", opener.document).addOption("' . $id . '", "' . $Group['Name'] . '");
window.close();
</script>
';
}
} else {
if ($_REQUEST['PK_Group'] != "") {
$Group = formdata_from_db($_REQUEST['PK_Group']);
}
}
// Init Availabe Extensions
$query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension AS PK_Extension,\n\t\t\tExtension,\n\t\t\tName\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tType IN ('Virtual','SipPhone')\n\t\tORDER BY\n\t\t\tExtension ASC\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
$Extensions = array();
while ($row = $result->fetch_assoc()) {
$Extensions[] = $row;
}
$smarty->assign('Errors', $Errors);
$smarty->assign('Group', $Group);
$smarty->assign('Extensions', $Extensions);
return $smarty->fetch('Groups_Popup_Create.tpl');
}
示例9: Groups_Delete
function Groups_Delete()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$PK_Group = $_REQUEST['PK_Group'];
// In confirmed, do the actual delete
if (@$_REQUEST['submit'] == 'delete_confirm') {
$query = "DELETE FROM Groups WHERE PK_Group = {$PK_Group} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
header('Location: Groups_List.php?msg=DELETE_GROUP');
die;
}
// Init template info (Group)
$query = "\n\t\tSELECT\n\t\t\tPK_Group,\n\t\t\tName\n\t\tFROM\n\t\t\tGroups\n\t\tWHERE\n\t\t\tPK_Group = {$PK_Group}\n\t\tLIMIT 1\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
$Group = $result->fetch_assoc();
$query = "\n\t\tSELECT\n\t\t\tExtension,\n\t\t\tExtensions.PK_Extension,\n\t\t\tName\n\t\tFROM\n\t\t\tExtension_Groups\n\t\t\tINNER JOIN Extensions ON Extensions.PK_Extension = FK_Extension\n\t\tWHERE\n\t\t\tFK_Group = {$PK_Group}\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
$Group['Extensions'] = array();
while ($row = $result->fetch_assoc()) {
$Group['Extensions'][] = $row;
}
$smarty->assign('Group', $Group);
return $smarty->fetch('Groups_Delete.tpl');
}
示例10: MOH_Groups_List
function MOH_Groups_List()
{
global $mysqli;
$session =& $_SESSION['Groups'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init message (Message)
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
// Init sort order (Order)
if ($session['Sort'] == $_REQUEST['Sort']) {
$Order = $session['Order'] == "asc" ? "desc" : "asc";
} elseif ($session['Sort'] != $_REQUEST['Sort']) {
$Order = 'asc';
}
$session['Order'] = $Order;
// Init sort field (Sort)
if (isset($_REQUEST['Sort'])) {
$Sort = $_REQUEST['Sort'];
} else {
$Sort = 'Name';
}
$session['Sort'] = $Sort;
// Init table fields (Groups)
$Groups = array();
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tMoh_Groups\n\t\tORDER BY \n\t\t\t`{$Sort}` {$Order}\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
while ($row = $result->fetch_assoc()) {
$Groups[] = $row;
}
$smarty->assign('Groups', $Groups);
$smarty->assign('Sort', $Sort);
$smarty->assign('Order', $Order);
$smarty->assign('Message', $Message);
$smarty->assign('Hilight', isset($_REQUEST['hilight']) ? $_REQUEST['hilight'] : "");
return $smarty->fetch('MOH_Groups_List.tpl');
}
示例11: MOH_Groups_Modify
function MOH_Groups_Modify()
{
global $mysqli;
$session =& $_SESSION['MOH_Groups_Modify'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init message (Message)
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
if (@$_REQUEST['submit'] == 'save') {
$Group = formdata_from_post();
$Errors = formdata_validate($Group);
if (count($Errors) == 0) {
if ($Group['PK_Group'] != '') {
$msg = 'MODIFY_MOH_GROUP';
} else {
$msg = 'ADD_MOH_GROUP';
}
$id = formdata_save($Group);
asterisk_UpdateConf('musiconhold.conf');
asterisk_Reload();
header("Location: MOH_Groups_List.php?hilight={$id}&msg={$msg}");
die;
}
} elseif (@$_REQUEST['PK_Group'] != "") {
$Group = formdata_from_db($_REQUEST['PK_Group']);
} else {
$Group = formdata_from_default();
}
$smarty->assign('Group', $Group);
$smarty->assign('Errors', $Errors);
return $smarty->fetch('MOH_Groups_Modify.tpl');
}
示例12: Account_Modify
function Account_Modify()
{
$session =& $_SESSION['Account_Modify'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init message (Message)
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
// Init form data (Extension)
if (@$_REQUEST['submit'] == 'save') {
$Extension = formdata_from_post();
$Errors = formdata_validate($Extension);
if (count($Errors) == 0) {
$id = formdata_save($Extension);
asterisk_UpdateConf('sip.conf');
asterisk_UpdateConf('voicemail.conf');
asterisk_Reload();
header("Location: Account_Modify.php?msg=MODIFY_EXTENSION&hilight={$id}");
die;
}
} else {
$Extension = formdata_from_db($_SESSION['_USER']['PK_Extension']);
}
$smarty->assign('Extension', $Extension);
$smarty->assign('Message', $Message);
$smarty->assign('Errors', $Errors);
return $smarty->fetch('Account_Modify.tpl');
}
示例13: OutgoingCalls
function OutgoingCalls()
{
global $mysqli;
$session =& $_SESSION['OutgoingCalls'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init message (Message)
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
if (isset($_REQUEST['submit']) && ($_REQUEST['submit'] == 'add_cid_rule' || $_REQUEST['submit'] == 'add_cids_rule')) {
$query = "\n\t\t\tINSERT INTO\n\t\t\t\tOutgoingCIDRules\n\t\t\tSET\n\n\t\t\t\tType = '" . ($_REQUEST['submit'] == 'add_cid_rule' ? 'Single' : 'Multiple') . "',\n\t\t\t\tExtensionStart = 0,\n\t\t\t\tExtensionEnd = 0,\n\t\t\t\tFK_OutgoingRule = 0,\n\t\t\t\t`Add` = 0,\n\t\t\t\tPrependDigits = '',\n\t\t\t\tName = '',\n\t\t\t\tNumber = ''\n\t\t";
$mysqli->query($query) or die($mysqli->error . $query);
$HiligthRule = $mysqli->insert_id;
}
// Outgoing Rules (OutgoingRules)
$OutgoingRules = array();
$query = "\n\t\t(SELECT\n\t\t\tPK_OutgoingRule,\n\t\t\tRuleOrder,\n\t\t\tBeginWith,\n\t\t\tOutgoingRules.Name,\n\t\t\tRestBetweenHigh,\n\t\t\tRestBetweenLow,\n\t\t\t'VoIP' AS ProviderType,\n\t\t\tProtected,\n\t\t\tSipProviders.Name AS ProviderName\n\t\tFROM\n\t\t\tOutgoingRules\n LEFT JOIN SipProviders ON PK_SipProvider = ProviderID\n WHERE ProviderType = 'SIP'\n )\n UNION\n\t\t(SELECT\n\t\t\tPK_OutgoingRule,\n\t\t\tRuleOrder,\n\t\t\tBeginWith,\n\t\t\tOutgoingRules.Name,\n\t\t\tRestBetweenHigh,\n\t\t\tRestBetweenLow,\n\t\t\t'3G Dongle' AS ProviderType,\n\t\t\tProtected,\n\t\t\tDongles.Name AS ProviderName\n\t\tFROM\n\t\t\tOutgoingRules\n LEFT JOIN Dongles ON PK_Dongle = ProviderID\n WHERE ProviderType = 'DONGLE'\n )\n UNION\n\t\t(SELECT\n\t\t\tPK_OutgoingRule,\n\t\t\tRuleOrder,\n\t\t\tBeginWith,\n\t\t\tOutgoingRules.Name,\n\t\t\tRestBetweenHigh,\n\t\t\tRestBetweenLow,\n\t\t\t'internal' AS ProviderType,\n\t\t\tProtected,\n\t\t\t'' AS ProviderName\n\t\tFROM\n\t\t\tOutgoingRules\n WHERE ProviderType = 'INTERNAL'\n )\n \n\t\tORDER BY\n\t\t\tRuleOrder ASC\n\t";
$result = $mysqli->query($query) or die($mysqli->error);
while ($row = $result->fetch_assoc()) {
$OutgoingRules[] = $row;
}
// Outgoing Rules (OutgoingCIDRules)
$OutgoingCIDRules = array();
$query = "\n\t\tSELECT\n\t\t\t\t*\n\t\tFROM\n\t\t\tOutgoingCIDRules\n\t\tORDER BY\n\t\t\tType\n\t";
$result = $mysqli->query($query) or die($mysqli->error);
while ($row = $result->fetch_assoc()) {
$OutgoingCIDRules[] = $row;
}
$smarty->assign('OutgoingRules', $OutgoingRules);
$smarty->assign('OutgoingCIDRules', $OutgoingCIDRules);
$smarty->assign('Message', $Message);
$smarty->assign('Hilight', isset($_REQUEST['hilight']) ? $_REQUEST['hilight'] : "");
return $smarty->fetch('OutgoingCalls.tpl');
}
示例14: Groups_List
function Groups_List()
{
global $mysqli;
$session =& $_SESSION['Groups'];
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init message (Message)
$Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
// Init sort order (Order)
if ($session['Sort'] == $_REQUEST['Sort']) {
$Order = $session['Order'] == "asc" ? "desc" : "asc";
} elseif ($session['Sort'] != $_REQUEST['Sort']) {
$Order = 'asc';
}
$session['Order'] = $Order;
// Init sort field (Sort)
if (isset($_REQUEST['Sort'])) {
$Sort = $_REQUEST['Sort'];
} else {
$Sort = 'Name';
}
$session['Sort'] = $Sort;
// Init table fields (Groups)
$Groups = array();
$query = "\n\t\tSELECT\n\t\t\tPK_Group \t\t AS _PK_,\n\t\t\tName AS Name,\n\t\t\tCount(FK_Extension) AS Members,\n\t\t\tDATE_FORMAT(DateCreated,'%m/%d/%y, %h:%i %p') AS DateCreated\n\t\tFROM\n\t\t\tGroups\n\t\t\tLEFT JOIN Extension_Groups ON FK_Group = PK_Group\n\t\tGROUP BY\n\t\t\tPK_Group\n\t\tORDER BY \n\t\t\t{$Sort} {$Order}\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
while ($row = $result->fetch_assoc()) {
$Groups[] = $row;
}
$smarty->assign('Groups', $Groups);
$smarty->assign('Sort', $Sort);
$smarty->assign('Order', $Order);
$smarty->assign('Message', $Message);
$smarty->assign('Hilight', isset($_REQUEST['hilight']) ? $_REQUEST['hilight'] : "");
return $smarty->fetch('Groups_List.tpl');
}
示例15: Groups_Modify
function Groups_Modify()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
// Init form data (Group, Errors)
if (@$_REQUEST['submit'] == 'save') {
$Group = formdata_from_post();
$Errors = formdata_validate($Group);
if (count($Errors) == 0) {
$id = formdata_save($Group);
header("Location: Groups_List.php?msg=MODIFY_GROUP&hilight={$id}");
die;
}
} else {
if ($_REQUEST['PK_Group'] != "") {
$Group = formdata_from_db($_REQUEST['PK_Group']);
}
}
// Init Availabe Extensions
$query = "\n\t\tSELECT\n\t\t\tExtensions.PK_Extension AS PK_Extension,\n\t\t\tExtension,\n Name\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tType IN ('Virtual','SipPhone')\n\t\tORDER BY\n\t\t\tExtension ASC\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
$Extensions = array();
while ($row = $result->fetch_assoc()) {
$Extensions[] = $row;
}
$smarty->assign('Errors', $Errors);
$smarty->assign('Group', $Group);
$smarty->assign('Extensions', $Extensions);
return $smarty->fetch('Groups_Modify.tpl');
}