Example #1
0
/**
 * 菜单点击
 */
function menuCheck($outArr)
{
    global $openId;
    $openId = $outArr['UserOpenId'];
    processText(array('content' => $outArr['MenuKey']));
}
Example #2
0
function updateDatasetRow($params)
{
    $numParamsToUpdate = 0;
    // counts num of params to update.
    $sendParams = array();
    // make sure we have a content id and tablename
    if (isset($params['countryid']) && isset($params['tablename'])) {
        // gets array of fields name for 'tablename'
        $columnsArray = getTableColumns($params['tablename']);
        $sql = "UPDATE `" . $params['tablename'] . "` SET ";
        foreach ($params as $key => $value) {
            if ($key != 'action' && $key != 'countryid' && $key != 'tablename' && $key != 'tags' && $key != 'verbosity') {
                $numParamsToUpdate++;
                if (in_array($key, $columnsArray)) {
                    $sql .= "`" . $key . "` = :" . $key . ", ";
                    $sendParams[$key] = processText($value);
                } else {
                    die("Unknown field name '{$key}'.");
                }
            }
        }
        if ($numParamsToUpdate == 0) {
            //no other name/value pairs provided
            die("No name/value pairs provided to update.");
        } else {
            // remove last comma and space!
            $sql = substr($sql, 0, strlen($sql) - 2);
            $sql .= " WHERE countryid = :countryid";
            $sendParams['countryid'] = $params['countryid'];
        }
    } else {
        die("No id or tablename provided.");
    }
    if ($numParamsToUpdate > 0) {
        //echo $sql;
        //print_r($sendParams);
        if ($result = queryDatabase($sql, $sendParams)) {
            sendSuccess();
        }
    }
}
Example #3
0
}
function resetFile(&$file, &$handle)
{
    closeFile($handle);
    openFile($file, $handle);
}
openFile($file, $handle, $back);
$curPosition = ftell($handle);
while (file_exists($file)) {
    clearstatcache();
    if ($curSize == filesize($file)) {
        sleep(1);
        continue;
    }
    if (filesize($file) < $curSize) {
        resetFile($file, $handle);
    }
    fseek($handle, $curPosition);
    while (feof($handle) != true) {
        echo processText(fgets($handle));
        $curPosition = ftell($handle);
    }
    $curSize = filesize($file);
}
closeFile($handle);
# Local Variables:
# mode: php
# c-default-style: "bsd"
# indent-tabs-mode: nil
# c-basic-offset: 4
# End:
Example #4
0
function highlightText($text)
{
    global $highlight;
    $text = processText($text);
    return str_ireplace($highlight, "" . $highlight . "", $text);
}
Example #5
0
function processSlug($text)
{
    $chars = array('Š', 'Œ', 'Ž', 'š', 'œ', 'ž', 'Ÿ', '¥', 'µ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ');
    $base = array('S', 'O', 'Z', 's', 'o', 'z', 'Y', 'Y', 'u', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'o', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y');
    $accents = array();
    $i = 0;
    foreach ($chars as $c) {
        $element = array(processText($c) => $base[$i]);
        $accents = array_merge($accents, $element);
        $i++;
    }
    return strtr(processText($text), $accents);
}
Example #6
0
function read_comment()
{
    $total_comment = 0;
    $total_reply = 0;
    $cur_level = 0;
    $caller = strtolower($_POST["url"]);
    //$_SERVER['HTTP_REFERER'];
    $filename = md5($caller);
    $abs_comment_file = realpath('.') . '/' . $filename . '.xml';
    $dom_id = processText($_POST["domid"]);
    $max_reply = intval(processText($_POST["max"]));
    $comments_per_page = intval(processText($_POST["pagecount"]));
    $pageno = intval(processText($_POST["pageno"]));
    if ($comments_per_page == 0) {
        $comments_per_page = 100000;
    }
    $start = $pageno * $comments_per_page;
    $end = $start + $comments_per_page;
    //$abs_comment_file = "G:/MyProjects/Lab/easy-comment/comment.xml";
    $xml = new DomDocument('1.0', 'utf-8');
    if (file_exists($abs_comment_file)) {
        $comments = array();
        $xml->load($abs_comment_file, LIBXML_NOBLANKS);
        $xpath = new DOMXPath($xml);
        $qry = "//comments/dom-element[@domid='{$dom_id}']/comment[(@moderate='0') or (@moderate='4') or ((@moderate='1') and (@ip='" . $_SERVER["REMOTE_ADDR"] . "'))]";
        $children = $xpath->query($qry);
        $total = $children->length;
        $end = min($total, $end);
        for ($i = $end - 1; $i >= $start; $i--) {
            $last_child = $children->item($total - $i - 1);
            $cmt = getComment($last_child, $total_comment, $total_reply, false, $cur_level, $max_reply);
            $comments[] = $cmt;
        }
        echo json_encode(array("total_comment" => $total, "total_reply" => $total_reply, "comments" => $comments));
    } else {
        echo json_encode(array("total_comment" => 0, "total_reply" => 0));
    }
}
Example #7
0
function submitEmail($email_details, $course_id, $course_value, $order_expiration, $plan_name, $guru_configs)
{
    $user_details = getUserDetails($course_value["userid"]);
    $config = new JConfig();
    $from = $config->mailfrom;
    $fromname = $config->fromname;
    $db = JFactory::getDBO();
    if (isset($guru_configs["0"]["fromname"]) && trim($guru_configs["0"]["fromname"]) != "") {
        $fromname = trim($guru_configs["0"]["fromname"]);
    }
    if (isset($guru_configs["0"]["fromemail"]) && trim($guru_configs["0"]["fromemail"]) != "") {
        $from = trim($guru_configs["0"]["fromemail"]);
    }
    $recipient = array($user_details["0"]["email"]);
    $mode = true;
    $subject_procesed = processText($email_details["subject"], $config, $course_value, $user_details, $order_expiration, $course_id, $plan_name, $guru_configs);
    $body_procesed = processText($email_details["body"], $config, $course_value, $user_details, $order_expiration, $course_id, $plan_name, $guru_configs);
    JFactory::getMailer()->sendMail($from, $fromname, $recipient, $subject_procesed, $body_procesed, $mode);
    $sql = "insert into #__guru_logs (`userid`, `productid`, `emailname`, `emailid`, `to`, `subject`, `body`, `buy_date`, `send_date`, `buy_type`) values ('" . intval($user_details["0"]["id"]) . "', " . $course_id . ", '', '" . intval($email_details["id"]) . "', '" . trim($user_details["0"]["email"]) . "', '" . addslashes(trim($subject_procesed)) . "', '" . addslashes(trim($body_procesed)) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', 'new')";
    $db->setQuery($sql);
    $db->query();
}
Example #8
0
function submitEmail($email_details, $course_id, $course_value, $order_expiration, $plan_name, $guru_configs)
{
    $user_details = getUserDetails($course_value["userid"]);
    $config = new JConfig();
    $from = $config->mailfrom;
    $fromname = $config->fromname;
    if (isset($guru_configs["0"]["fromname"]) && trim($guru_configs["0"]["fromname"]) != "") {
        $fromname = trim($guru_configs["0"]["fromname"]);
    }
    if (isset($guru_configs["0"]["fromemail"]) && trim($guru_configs["0"]["fromemail"]) != "") {
        $from = trim($guru_configs["0"]["fromemail"]);
    }
    $recipient = array($user_details["0"]["email"]);
    $mode = true;
    $subject_procesed = processText($email_details["subject"], $config, $course_value, $user_details, $order_expiration, $course_id, $plan_name, $guru_configs);
    $body_procesed = processText($email_details["body"], $config, $course_value, $user_details, $order_expiration, $course_id, $plan_name, $guru_configs);
    JFactory::getMailer()->sendMail($from, $fromname, $recipient, $subject_procesed, $body_procesed, $mode);
}
Example #9
0
<?php

$date_value = time();
$author_value = processText($_POST["name"]);
$subject_value = processText($_POST["subject"]);
$msg_value = processText($_POST["message"]);
if ($author_value == "" || $subject_value == "" || $msg_value == "") {
    echo json_encode(array("state" => -1, "reason" => "This script can not be called directly from your browser"));
} else {
    $ip = $_SERVER["REMOTE_ADDR"];
    $CommentFile = realpath('.') . '/user_data/comments.xml';
    $total = addComment($CommentFile, $date_value, $author_value, $subject_value, $msg_value, $ip);
    echo json_encode(array("total" => $total, "comment" => '<li class="comment">' . '   <img src="style/comment.png" class="avatar">' . '   <span class="user-name author">' . $author_value . '</span> <br>' . '   <span class="comment-html">' . '      <strong>' . $subject_value . '</strong><br/><br/>' . $msg_value . '   </span><br>' . '   <a class="comment-time">' . ago(time() - $date_value * 1) . '</a>' . '</li>'));
}
function addComment($CommentFile, $date_value, $author_value, $subject_value, $msg_value, $ip)
{
    $xml = new DomDocument('1.0', 'utf-8');
    if (file_exists($CommentFile)) {
        $xml->load($CommentFile);
        $root = $xml->firstChild;
    } else {
        $root = $xml->appendChild($xml->createElement("comments"));
    }
    $comment = $xml->createElement("comment");
    $root->appendChild($comment);
    // Add date attribute
    $attr_date = $xml->createAttribute("timestamp");
    $comment->appendChild($attr_date);
    $value = $xml->createTextNode($date_value);
    $attr_date->appendChild($value);
    // Add author attribute