コード例 #1
0
FROM
    cdr
WHERE
    (`src` = ' . $ext . ' OR `dst` = ' . $ext . ')
        AND
    (`src` LIKE "0%" OR `dst` LIKE "0%" OR `src` LIKE "+%" OR `dst` LIKE "+%")
GROUP BY `number`
ORDER BY `start` DESC
LIMIT 5;
';
$results = $cdb->query($sql);
$calls = $results->fetchAll(PDO::FETCH_ASSOC);
// Generate lookup table
$count = 0;
foreach ($calls as $call) {
    $calls_hist_json .= ($count++ > 0 ? ',' : '') . '{ "cid": "' . lookupNumber($call['number']) . '", "number": "' . $call['number'] . '", "start": "' . $call['start'] . '", "end": "' . $call['end'] . '" }';
}
function lookupNumber($number)
{
    // Inefficient! Should probably do a single DB lookup "IN (xxx,xxx,xxx)" then match within PHP.
    global $ciddb;
    if ($ciddb == null) {
        $ciddbhost = '148.251.46.243';
        $ciddbport = '3306';
        $ciddbuser = '******';
        $ciddbpass = '******';
        $ciddbschema = 'lalrorg_live_civicrm';
        $ciddb = new PDO('mysql:host=' . $ciddbhost . ';port=' . $ciddbport . ';dbname=' . $ciddbschema . ';charset=utf8', $ciddbuser, $ciddbpass);
        $ciddb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $ciddb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    }
コード例 #2
0
    echo asset_url('assets/i/ajax-loader.gif');
    ?>
" alt="..." />
            <p class="sms-to-phone hide"><?php 
    echo $message[0]['contact'];
    ?>
</p>
            <p class="from-phone hide"><?php 
    echo $phoneNumbers[0];
    ?>
</p>
          </div>
          <span class="phone-number">
              <?php 
    if ($address_book) {
        echo lookupNumber($message['caller']);
    } else {
        echo $message['caller'];
    }
    ?>
          </span>
        </td>
        <td class="message-content message-details-link" style="overflow: visible; white-space: normal">
            <?php 
    echo $message['body'];
    ?>
        </td>
        <td>
          <?php 
    if ($message['num_media'] > 0) {
        foreach ($message['media'] as $media) {
コード例 #3
0
    echo $message[0]['contact'];
    ?>
</p>
            <p class="from-phone hide"><?php 
    echo $phoneNumbers[0];
    ?>
</p>
          </div>
          <span class="phone-number">
            <a href="<?php 
    echo site_url("p/messages/?to=" . urlencode($message[0]['contact']));
    ?>
"  style="text-decoration:none" >
              <?php 
    if ($address_book) {
        echo lookupNumber($message[0]['contact']);
    } else {
        echo $message[0]['contact'];
    }
    ?>
            </a>
          </span>
        </td>
        <td class="message-content">
            <span class="transcript"><?php 
    echo $message[0]['body'];
    ?>
</span>
        </td>
        <td>
          <?php