Beispiel #1
0
// HERE YOUR TOKEN
// You will need a file called quotes (without extension)
// from there it will take the quotes and send them to your subscribers :)
$tg = new telegramBot($token);
$offset = 0;
$response = $tg->pollUpdates($offset, 60);
$response = json_decode($response, true);
if ($response['ok']) {
    foreach ($response['result'] as $data) {
        $chatID = $data['message']['chat']['id'];
        switch ($data['message']['text']) {
            case '/start':
                addContact($chatID);
                break;
            case '/remove':
                deleteContact($chatID);
                break;
        }
    }
    $offset = $response['result'][count($response['result']) - 1]['update_id'] + 1;
}
$chats = allChats();
$quotes = readQuotes();
$i = 0;
for ($i; $i < count($chats); $i++) {
    $tg->sendMessage($chats[$i]['chat_id'], $quotes[$chats[$i]['init']]);
    updateInit($chats[$i]['chat_id']);
    if ($chats[$i]['init'] == count($quotes) - 1) {
        resetInit($chats[$i]['chat_id']);
    }
}
Beispiel #2
0
function _moduleContent(&$smarty, $module_name)
{
    //include elastix framework
    include_once "libs/paloSantoGrid.class.php";
    include_once "libs/paloSantoValidar.class.php";
    include_once "libs/paloSantoConfig.class.php";
    include_once "libs/misc.lib.php";
    include_once "libs/paloSantoForm.class.php";
    include_once "libs/paloSantoACL.class.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoAdressBook.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    $smarty->assign('MODULE_NAME', $module_name);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrConfig = $pConfig->leer_configuracion(false);
    $dsn_agi_manager['password'] = $arrConfig['AMPMGRPASS']['valor'];
    $dsn_agi_manager['host'] = $arrConfig['AMPDBHOST']['valor'];
    $dsn_agi_manager['user'] = '******';
    //solo para obtener los devices (extensiones) creadas.
    $dsnAsterisk = generarDSNSistema('asteriskuser', 'call_center');
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    // address_book
    $pDB_2 = new paloDB($arrConf['dsn_conn_database2']);
    // acl
    $pDB_customer = new paloDB($arrConf['cadena_dsn']);
    // address_book
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new":
            $content = new_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "cancel":
            header("Location: ?menu={$module_name}");
            break;
        case "commit":
            $content = save_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk, true);
            break;
        case "edit":
            $content = view_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk, true);
            break;
        case "show":
            $content = view_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "save":
            $content = save_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "delete":
            $content = deleteContact($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "call2phone":
            $content = call2phone($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "transfer_call":
            $content = transferCALL($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        default:
            $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
    }
    return $content;
}
if ($action == "add") {
    // Get the post variables for the new contact
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    // Save the new contact
    saveContact($name, $phone);
    $output['msg'] = $name . " has been saved.";
    // Reload the contacts
    $output['contacts'] = getContacts();
    echo json_encode($output);
} else {
    if ($action == "delete") {
        // Collect the ID we wish to delete
        $id = $_POST['id'];
        //delete contact with that ID
        deleteContact($id);
        $output['msg'] = "Contact deleted.";
        // Reload the contacts
        $output['contacts'] = getContacts();
        echo json_encode($output);
    } else {
        if ($action == "editName") {
            // Collect the ID we wish to edit
            $id = $_POST['pk'];
            // Get the post variables for the edited name
            $name = $_POST['value'];
            // Update name in database
            editName($name, $id);
            $output['msg'] = "Contact name updated.";
            echo json_encode($output);
        } else {
Beispiel #4
0
<!DOCTYPE html>
<html lang="fr">
<?php 
include $_SERVER["DOCUMENT_ROOT"] . 'cgates/pages/includes/inc_head.php';
include $_SERVER["DOCUMENT_ROOT"] . 'cgates/pages/bdd/bdd_connexion.php';
include $_SERVER["DOCUMENT_ROOT"] . 'cgates/pages/bdd/functions.php';
?>
<div id="wrapper">
    <?php 
$phrase = '';
if (isset($_POST['delete'])) {
    $retour = deleteContact($bdd, $_POST['delete']);
    if ($retour == 1) {
        $phrase = $retour[0] . ' ' . $retour[1] . ' (' . $retour[2] . ')';
    }
}
if (isset($_POST['modif'])) {
    //ID user
    $retour = modifContact($bdd, $_POST['modif'], $_POST['nom'], $_POST['prenom'], $_POST['dateNaissance'], $_POST['region'], $_POST['numTel']);
    //Si enregistrement en base réussi
    if ($retour != 1) {
        $phrase = $retour;
    }
}
include $_SERVER["DOCUMENT_ROOT"] . 'cgates/pages/includes/inc_menu.php';
$listeContact = getContactByClient($bdd, $_SESSION['id']);
?>
    <div id="page-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div>
Beispiel #5
0
     $results = maintContact();
     $message .= $results[1];
     // If there is redirect information
     // redirect to that page
     if ($results[0] == 'contactmaint') {
         // pass on new messages
         if ($results[1]) {
             $_SESSION['message'] = $results[1];
         }
         header("Location: index.php?content=contactmaint&id={$results['2']}");
         exit;
     }
     break;
 case 'contact.delete':
     // process the delete
     $results = deleteContact();
     $message .= $results[1];
     // If there is redirect information
     // redirect to that page
     if ($results[0] == 'contactdelete') {
         // pass on new messages
         if ($results[1]) {
             $_SESSION['message'] = $results[1];
         }
         header("Location: index.php?content=contactdelete&id={$results['2']}");
         exit;
     }
     break;
 case 'category.maint':
     // process the maint
     $results = maintCategory();
#
# Please ensure that we have your correct banking details.
require "../settings.php";
// store the post vars in get vars, so that both vars can be accessed at once
// it is done this was around, so post vars get's higher priority and overwrites duplicated in get vars
if (isset($_POST)) {
    foreach ($_POST as $arr => $arrval) {
        $_GET[$arr] = $arrval;
    }
}
// see what to do
if (isset($_GET["key"])) {
    switch ($_GET["key"]) {
        case "delete":
        case "confirm_delete":
            $OUTPUT = deleteContact();
            break;
        default:
            $OUTPUT = viewContact();
    }
} else {
    $OUTPUT = viewContact();
}
# display output
require "gw-tmpl.php";
# enter new data
function viewContact()
{
    global $_GET;
    global $user_admin;
    extract($_GET);
Beispiel #7
0
 */
$app->put("/contacts/:id", function ($id) use($app) {
    $body = $app->request->getBody();
    $body = json_decode($body, true);
    $response = updateContactInfo($body, $id);
    header('Content-Type: application/json');
    $app->response->setStatus(200);
    echo json_encode($response);
});
/**
 * Delete: the contact in the database;
 */
$app->delete('/contacts/:id', function ($id) use($app) {
    $body = $app->request->getBody();
    $body = json_decode($body, true);
    $response = deleteContact($body, $id);
    header('Content-Type: application/json');
    $app->response->setStatus(200);
    echo json_encode($response);
});
/**
 *      Functions For Communicating to the database
 */
function updateContactInfo($body, $id)
{
    require '../db_connect.php';
    $name = $body['name'];
    $email = $body['email'];
    $phone = $body['phone'];
    $id = $body['id'];
    $query = "\n        UPDATE `contacts`\n        SET name = :name, email = :email, phone = :phone\n        WHERE id = :id;\n    ";