本文整理汇总了PHP中admin_run函数的典型用法代码示例。如果您正苦于以下问题:PHP admin_run函数的具体用法?PHP admin_run怎么用?PHP admin_run使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了admin_run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
if (count($errors) == 0) {
header('Location:index.php');
die;
}
}
$smarty->assign('Errors', $errors);
return $smarty->fetch('Login.tpl');
}
function formdata_from_post()
{
return $_REQUEST;
}
function formdata_validate($data)
{
global $mysqli;
$errors = array();
$enc_pw = md5($data['Password']);
// Check if there is a user with that extension
if (count($errors) == 0) {
$query = "\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM \n\t\t\t\tAdmins\n\t\t\tWHERE \n\t\t\t\tname = '" . $mysqli->real_escape_string($data['User']) . "' \n\t\t\t\tAND \n\t\t\t\tpassword = '" . $mysqli->real_escape_string($enc_pw) . "' \n\t\t\tLIMIT 1\n\t\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
if ($result->num_rows != 1) {
$errors['Wrong'] = true;
} else {
$_SESSION["_ADMIN"] = $data['User'];
}
}
return $errors;
}
admin_run('Login', 'AdminLogin.tpl', false);
示例2: array
$Order = 'asc';
$session['Order'] = $Order;
// Init sort field (Sort)
$Sort = 'Order';
$session['Sort'] = $Sort;
// Init files list (Files)
$Files = array();
$query = "\n\t\tSELECT\n\t\t\tPK_File AS `_PK_`, \n\t\t\tFilename AS `Filename`, \n\t\t\tFileext AS `Fileext`, \n\t\t\t`Order` AS `Order`, \t\t\t\n\t\t\tMoh_Files.DateCreated AS `DateCreated`,\n\t\t\tMoh_Groups.Name AS `Group`,\n\t\t\tMoh_Groups.PK_Group AS `_PK_Group_`\n\t\tFROM\n\t\t\tMoh_Files \n\t\t\tINNER JOIN Moh_Groups ON FK_Group = PK_Group\n\t\tWHERE\n\t\t\tFK_Group={$selectedGroup}\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()) {
$Files[] = $row;
}
// Init available groups (Groups)
$query = "SELECT * FROM Moh_Groups ORDER BY Name";
$result = $mysqli->query($query) or die($mysqli->error . $query);
while ($row = $result->fetch_assoc()) {
$Groups[] = $row;
}
$smarty->assign('selectedGroup', $selectedGroup);
$smarty->assign('Errors', $errors);
$smarty->assign('Link', '/admin/MOH_Files_ListGroup.php?PK_Group=' . $_REQUEST['PK_Group']);
$smarty->assign('Files', $Files);
$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_Files_ListGroup.tpl');
}
admin_run('MOH_Files_ListGroup', 'Admin.tpl');
示例3: array
$errors = array();
if ($data['PK_Extension'] == '') {
$create_new = true;
}
if ($create_new) {
// Check if extension is empty
if ($data['Extension'] == "") {
$errors['Extension']['Invalid'] = true;
// Check if Extension is numeric
} elseif (intval($data['Extension']) . "" != $data['Extension']) {
$errors['Extension']['Invalid'] = true;
// Check if extension is proper length
} elseif (strlen($data['Extension']) < 3 || strlen($data['Extension']) > 5) {
$errors['Extension']['Invalid'] = true;
// Check if extension in unique
} else {
$query = "SELECT Extension FROM Extensions WHERE Extension = '{$data['Extension']}' LIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error . $query);
if ($result->num_rows > 0) {
$errors['Extension']['Duplicate'] = true;
}
}
}
// Check if first name is proper length
if (strlen($data['Name']) < 1 || strlen($data['Name']) > 32) {
$errors['Name']['Invalid'] = true;
}
return $errors;
}
admin_run('Extensions_Virtual_Modify', 'Admin.tpl');
示例4: dirname
include_once dirname(__FILE__) . '/../include/db_utils.inc.php';
include_once dirname(__FILE__) . '/../include/smarty_utils.inc.php';
include_once dirname(__FILE__) . '/../include/admin_utils.inc.php';
function Extensions_FC_DirectedPickup_Delete()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$PK_Extension = $_REQUEST['PK_Extension'];
// In confirmed, do the actual delete
if (@$_REQUEST['submit'] == 'delete_confirm') {
$query = "DELETE FROM FC_DirectedPickup WHERE FK_Extension = {$PK_Extension} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
$query = "DELETE FROM FC_DirectedPickup_Admins WHERE FK_Extension = {$PK_Extension} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
$query = "DELETE FROM FC_DirectedPickup_Members WHERE FK_Extension = {$PK_Extension} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
$query = "DELETE FROM Extensions WHERE PK_Extension = {$PK_Extension} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
header('Location: Extensions_List.php?msg=DELETE_FC_DIRECTEDPICKUP_EXTENSION');
die;
}
// Init extension info (Extension)
$query = "\n\t\tSELECT\n\t\t\tPK_Extension,\n\t\t\tExtension\n\t\tFROM\n\t\t\tExtensions\n\t\tWHERE\n\t\t\tPK_Extension = {$PK_Extension}\n\t\tLIMIT 1\n\t";
$result = $mysqli->query($query) or die($mysqli->error . $query);
$Extension = $result->fetch_assoc();
$smarty->assign('Extension', $Extension);
return $smarty->fetch('Extensions_FC_DirectedPickup_Delete.tpl');
}
admin_run('Extensions_FC_DirectedPickup_Delete', 'Admin.tpl');
示例5: intval
}
}
$query = "\n\t\tUPDATE\n\t\t\tOutgoingRules\n\t\tSET\n\t\t\tName = '" . $mysqli->real_escape_string($data['Name']) . "',\n\t\t\tFinal = " . ($data['Final'] ? '1' : '0') . ",\n\t\t\tBeginWith = '" . $mysqli->real_escape_string($data['BeginWith']) . "',\n\t\t\tRestBetweenLow = '" . intval($data['RestBetweenLow']) . "',\n\t\t\tRestBetweenHigh = '" . intval($data['RestBetweenHigh']) . "',\n\t\t\tPrependDigits = '" . $mysqli->real_escape_string($data['PrependDigits']) . "',\n\t\t\tProviderType = '" . $mysqli->real_escape_string($data['ProviderType']) . "',\n\t\t\tTrimFront = '" . $mysqli->real_escape_string($data['TrimFront']) . "',\n\t\t\tProviderID = " . intval($data['ProviderID']["{$data['ProviderType']}"]) . "\n\t\tWHERE\n\t\t\tPK_OutgoingRule = " . $mysqli->real_escape_string($data['PK_OutgoingRule']) . "\n\t\tLIMIT 1\n\t";
$mysqli->query($query) or die($mysqli->error . $query);
return $data['PK_OutgoingRule'];
}
function formdata_validate($data)
{
$errors = array();
if ($data['Name'] == "") {
$errors['Name'] = true;
}
if (!preg_match('/^[0-9]+$/', $data['RestBetweenLow'])) {
$errors['RestBetweenLow'] = true;
}
if (!preg_match('/^[0-9]+$/', $data['RestBetweenHigh'])) {
$errors['RestBetweenHigh'] = true;
}
if (!preg_match('/^[0-9]{0,2}$/', $data['TrimFront'])) {
$errors['TrimFront'] = true;
}
if (!preg_match('/^[+]{0,1}[*#0-9]{0,20}$/', $data['PrependDigits'])) {
$errors['PrependDigits'] = true;
}
/* if (!preg_match('/^[*#(|)^0-9]{1,24}$/', $data['BeginWith'])) {
$errors['BeginWith'] = true;
} */
return $errors;
}
admin_run('OutgoingCalls_Rule_Modify', 'Admin.tpl');
示例6: formdata_from_db
return $data;
}
function formdata_from_db()
{
$variables = array('Agent_AckCall', 'Agent_MissedCalls');
foreach ($variables as $name) {
$data[$name] = pbx_var_get($name);
}
return $data;
}
function formdata_save($data)
{
$variables = array('Agent_AckCall', 'Agent_MissedCalls');
if (is_array($data)) {
foreach ($data as $name => $value) {
if (in_array($name, $variables)) {
pbx_var_set($name, $value);
}
}
}
}
function formdata_validate($data)
{
$errors = array();
if (!preg_match('/^[0-9]{1,3}$/', $data['Agent_MissedCalls'])) {
$errors['Agent_MissedCalls']['Invalid'] = true;
}
return $errors;
}
admin_run('AgentSettings', 'Admin.tpl');
示例7: dirname
<?php
include_once dirname(__FILE__) . '/../include/db_utils.inc.php';
include_once dirname(__FILE__) . '/../include/smarty_utils.inc.php';
include_once dirname(__FILE__) . '/../include/admin_utils.inc.php';
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') {
$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');
}
admin_run('TimeFrames_Delete', 'Admin.tpl');
示例8: dirname
include_once dirname(__FILE__) . '/../include/db_utils.inc.php';
include_once dirname(__FILE__) . '/../include/smarty_utils.inc.php';
include_once dirname(__FILE__) . '/../include/admin_utils.inc.php';
include_once dirname(__FILE__) . '/../include/asterisk_utils.inc.php';
function Extensions_Queue_Delete()
{
global $mysqli;
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$PK_Extension = $_REQUEST['PK_Extension'];
// In confirmed, do the actual delete
if (@$_REQUEST['submit'] == 'delete_confirm') {
$query = "DELETE FROM Extensions WHERE PK_Extension = {$PK_Extension} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
$query = "DELETE FROM Ext_Queues WHERE PK_Extension = {$PK_Extension} LIMIT 1";
$mysqli->query($query) or die($mysqli->error);
$query = "DELETE FROM Ext_Queue_Members WHERE FK_Extension = {$PK_Extension}";
$mysqli->query($query) or die($mysqli->error);
asterisk_UpdateConf('queues.conf');
asterisk_Reload();
header('Location: Extensions_List.php?msg=DELETE_QUEUE_EXTENSION');
die;
}
// Init extension info (Extension)
$query = "\n\t\tSELECT\n\t\t\tPK_Extension,\n\t\t\tName\n\t\tFROM\n\t\t\tExt_Queues\n\t\tWHERE\n\t\t\tPK_Extension = {$PK_Extension}\n\t\tLIMIT 1\n\t";
$result = $mysqli->query($query) or die($mysqli->error);
$Queue = $result->fetch_assoc();
$smarty->assign('Queue', $Queue);
return $smarty->fetch('Extensions_Queue_Delete.tpl');
}
admin_run('Extensions_Queue_Delete', 'Admin.tpl');
示例9: elseif
} elseif (count(explode(" ", $data['AccountID'])) > 1) {
$errors['AccountID']['Invalid'] = true;
}
// Check if password is 1-32 chars long
if (strlen($data['Password']) < 1 || strlen($data['Password']) > 32) {
$errors['Password']['Invalid'] = true;
}
if ($data['ApplyIncomingRules'] == 1) {
// Check if callback extension is formed of digits only
if ($data['CallbackExtension'] != "" . intval($data['CallbackExtension'])) {
$errors['CallbackExtension']['Invalid'] = true;
// Check if extension is 3-5 digits long
} elseif (strlen($data['CallbackExtension']) < 3 || strlen($data['CallbackExtension']) > 5) {
$errors['CallbackExtension']['Invalid'] = true;
// Check if extension is valid on the system
} else {
$query = "SELECT PK_Extension FROM Extensions WHERE Extension = '" . $mysqli->real_escape_string($data['CallbackExtension']) . "' LIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error . $query);
if ($result->num_rows < 1) {
$errors['CallbackExtension']['NoMatch'] = true;
}
}
}
// Check if a hostaname was supplied for this provider
if (!preg_match("/^([a-z0-9][a-z0-9-.]{0,62})\$/i", $data['Host'])) {
$errors['Host']['Invalid'] = true;
}
return $errors;
}
admin_run('VoipProviders_Modify', 'Admin.tpl');
示例10: smarty_init
$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');
}
admin_run('TimeFrames', 'Admin.tpl');
示例11: die
{
global $mysqli;
$query = "SELECT * FROM SoundLanguages WHERE PK_SoundLanguage = {$id}\tLIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error);
$data = $result->fetch_assoc();
return $data;
}
function formdata_from_post()
{
return $_POST;
}
function formdata_save($data)
{
global $mysqli;
if (empty($data['PK_SoundLanguage'])) {
$query = "INSERT INTO SoundLanguages(Type) VALUES('User')";
$mysqli->query($query) or die($mysqli->error . $query);
$data['PK_SoundLanguage'] = $mysqli->insert_id;
}
// Update 'SoundFolders'
$query = "\n\t\tUPDATE\n\t\t\tSoundLanguages\n\t\tSET\n\t\t\tName = '" . $mysqli->real_escape_string($data['Name']) . "'\n\t\tWHERE\n\t\t\tPK_SoundLanguage = " . $mysqli->real_escape_string($data['PK_SoundLanguage']) . "\n\t\tLIMIT 1\n\t";
$mysqli->query($query) or die($mysqli->error . $query);
return $data['PK_SoundLanguage'];
}
function formdata_validate($data)
{
$errors = array();
return $errors;
}
admin_run('SoundLanguages_Modify', 'Admin.tpl');
示例12: dirname
include_once dirname(__FILE__) . '/../include/config.inc.php';
include_once dirname(__FILE__) . '/../include/asterisk_utils.inc.php';
function Recordings_DeleteRule()
{
global $mysqli;
include dirname(__FILE__) . '/../include/config.inc.php';
$smarty = smarty_init(dirname(__FILE__) . '/templates');
$path = $conf['dirs']['moh'];
$PK_Rule = $_REQUEST['PK_Rule'];
// In confirmed, do the actual delete
if (@$_REQUEST['submit'] == 'delete_confirm') {
//delete files from database
$query = "DELETE FROM RecordingRules WHERE PK_Rule = {$PK_Rule}";
$mysqli->query($query) or die($mysqli->error . $query);
$query = "DELETE FROM RecordingRules_Extensions WHERE FK_Rule = {$PK_Rule}";
$mysqli->query($query) or die($mysqli->error . $query);
$query = "DELETE FROM RecordingRules_Groups WHERE FK_Rule = {$PK_Rule}";
$mysqli->query($query) or die($mysqli->error . $query);
asterisk_UpdateConf('musiconhold.conf');
asterisk_Reload();
header('Location: Recordings_List.php?msg=DELETE_REC_RULE');
} else {
$query = "SELECT * FROM RecordingRules WHERE PK_Rule = {$PK_Rule};";
$result = $mysqli->query($query) or die($mysqli->error);
$RecordingRule = $result->fetch_assoc();
$smarty->assign('RecordingRule', $RecordingRule);
return $smarty->fetch('Recordings_DeleteRule.tpl');
}
}
admin_run('Recordings_DeleteRule', 'Admin.tpl');
示例13: formdata_from_default
$data = $result->fetch_assoc();
return $data;
}
function formdata_from_default()
{
$data = array();
return $data;
}
function formdata_from_post()
{
return $_REQUEST;
}
function formdata_save($data)
{
global $mysqli;
if ($data['PK_Menu'] == "") {
$query = "INSERT INTO IVR_Menus() VALUES()";
$mysqli->query($query) or die($mysqli->error . $query);
$data['PK_Menu'] = $mysqli->insert_id;
}
$query = "\n\t\tUPDATE\n\t\t\tIVR_Menus\n\t\tSET\n\t\t\tName = '" . $mysqli->real_escape_string($data['Name']) . "',\n\t\t\tDescription = '" . $mysqli->real_escape_string($data['Description']) . "'\n\t\tWHERE\n\t\t\tPK_Menu = {$data['PK_Menu']}\n\t\tLIMIT 1\n\t";
$mysqli->query($query) or die($mysqli->error . $query);
return $data['PK_Menu'];
}
function formdata_validate($data)
{
$errors = array();
return $errors;
}
admin_run('IVR_Menus_Modify', 'Admin.tpl');
示例14: formdata_validate
}
function formdata_validate($data)
{
global $mysqli;
$errors = array();
if ($data['PK_Extension'] == '') {
$create_new = true;
}
if ($create_new) {
// Check if extension is empty
if ($data['Extension'] == "") {
$errors['Extension']['Invalid'] = true;
// Check if Extension is numeric
} elseif (intval($data['Extension']) . "" != $data['Extension']) {
$errors['Extension']['Invalid'] = true;
// Check if extension is proper length
} elseif (strlen($data['Extension']) < 3 || strlen($data['Extension']) > 5) {
$errors['Extension']['Invalid'] = true;
// Check if extension in unique
} else {
$query = "SELECT Extension FROM Extensions WHERE Extension = '{$data['Extension']}' LIMIT 1";
$result = $mysqli->query($query) or die($mysqli->error . $query);
if ($result->num_rows > 0) {
$errors['Extension']['Duplicate'] = true;
}
}
}
return $errors;
}
admin_run('Extensions_Voicemail_Modify', 'Admin.tpl');
示例15: elseif
// 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');
}
admin_run('VoipProviders_List', 'Admin.tpl');