27 בדצמ׳ 2023, 18:50

קוד עבור מודול לאיפוס רשימות תפוצה בצורה שקטה/עם הודעה בסיום

ההגדרות בשלוחה:

type=api
api_link=https://yemot.abaye.co/
api_hangup_send=no
api_add_0=password=12345
api_add_1=templateId=434423
api_add_2=messageAfterReset=הודעה לאחר האיפוס להשאיר ריק אם לא רוצים להשמיע כלום
api_end_goto=/

בהגדרה templateId ניתן לשרשר מספר רשימות באמצעות הפרדה עם פסיק כך 1133,6547,6588.
בהגדרה password יש להכניס את סיסמת המערכת (סיסמה שגויה תגדרום לשרת שלכם להיחסם)
ובהגדרה messageAfterReset ניתן להכניס הודעה שתושמע בסיום, או להשאיר ריק לשקט, (בכל מקרה של שגיאה תושמע הודעת שגיאה עם מספר הרשימה שבה אירעה השגיאה)

קוד הphp:

<?php

/*
* Developed by abaye ©
* 📃 ResetListTemplate v2.0.2 12/12/2023			
* https://ko-fi.com/abaye
* email: cs@abaye.co
*/

$user = isset($_GET['ApiDID']) ? htmlspecialchars($_GET['ApiDID']) : '';
$pass = isset($_GET['password']) ? htmlspecialchars($_GET['password']) : '';
$templateId = isset($_GET['templateId']) ? htmlspecialchars($_GET['templateId']) : '';
$messageAfterReset = isset($_GET['messageAfterReset']) ? htmlspecialchars($_GET['messageAfterReset']) : '';

if (empty($user) || empty($pass) || empty($templateId)) {
    die("id_list_message=t-חלק מהפרמטרים חסרים או לא תקינים");
}

$templateArray = explode(',', $templateId);
foreach ($templateArray as $id) {

    $link = "https://www.call2all.co.il/ym/api/ClearTemplateEntries?token={$user}:{$pass}&templateId={$id}";

    $response = file_get_contents($link);

    $httpStatus = $http_response_header[0];
    if (strpos($httpStatus, '200 OK') !== false) {
        $responseData = json_decode($response, true);

        if ($responseData !== null) {
            if (isset($responseData['responseStatus']) && $responseData['responseStatus'] === 'OK') {
                echo "id_list_message=t-{$messageAfterReset} &";
            } else {
                echo "id_list_message=t-אירעה שגיאה בעת איפוס רשימת התפוצה {$id} &";
            }
        } else {
            echo "id_list_message=t-אירעה שגיאה בעת איפוס רשימת התפוצה {$id} &";
        }
    } else {
        echo "id_list_message=t-שגיאה תגובת שרת לא תקינה &";
    }
}

?>

מי שמעוניין להשתמש בזה ואין לו היכן לשים את הקוד יכול לפנות אלי בפרטי ואתן לו כתובת פעילה, אני לא מפרסם את זה כאן כי אני לא רוצה שיגיעו בקשות עם סיסמאות שגויות, וכמובן שבמקרה כזה השימוש במודול הוא על אחריות המשתמש על כל המשתמע מכך