function kdmail($f)
 {
     $this->load('lib/phpmailer/class.phpmailer');
     $mail = new PHPMailer();
     //$body             = $mail->getFile(ROOT.'index.php');
     //$body             = eregi_replace("[\]",'',$body);
     $mail->IsSendmail();
     // telling the class to use SendMail transport
     $mail->From = $f["from"];
     $mail->FromName = either($f["fromname"], "noticer");
     $mail->Subject = either($f["subject"], "hello");
     //$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
     $mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
     // optional, comment out and test
     if ($f["embedimg"]) {
         foreach ($f["embedimg"] as $i) {
             //$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
             $mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
         }
     }
     if ($f["msgfile"]) {
         $body = $mail->getFile($f["msgfile"]);
         $body = eregi_replace("[\\]", '', $body);
         if ($f["type"] == "text") {
             $mail->IsHTML(false);
             $mail->Body = $body;
         } else {
             $mail->MsgHTML($body);
             //."<br><img src= \"cid:logo\">");
         }
     } else {
         if ($f["type"] == "text") {
             $mail->IsHTML(false);
             $mail->Body = $f["msg"];
         } else {
             $mail->MsgHTML($f["msg"]);
             //."<br><img src= \"cid:logo\">");
         }
     }
     if (preg_match('/\\,/', $f["to"])) {
         $emails = explode(",", $f["to"]);
         foreach ($emails as $i) {
             $mail->AddAddress($i, $f["toname"]);
         }
     } else {
         $mail->AddAddress($f["to"], $f["toname"]);
     }
     $mail->AddBCC($this->config["site"]["mail"], "bcc");
     if ($f["files"]) {
         foreach ($f["files"] as $i) {
             $mail->AddAttachment($i);
             // attachment
         }
     }
     if (!$mail->Send()) {
         return "Mailer Error: " . $mail->ErrorInfo;
     } else {
         return "Message sent!";
     }
 }
function makeURL($URL)
{
    $URL = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:\\+.~#?&//=]+)', '<a href=\\1>\\1</a>', $URL);
    $URL = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:\\+.~#?&//=]+)', '<a href=\\1>\\1</a>', $URL);
    $URL = eregi_replace('([_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3})', '<a href=\\1>\\1</a>', $URL);
    return $URL;
}
Beispiel #3
0
function CLT($text)
{
    //convertir url en titre le plus proche
    $text = trim(Str_ireplace(array('c.html', '/Q.', 'p.html', '.sh', "frontalier74", "frontaliers", "creditimmo", "a74", "s74", "xzxzx", "index", "2007", "_vd", "z/", "y/", "http://", ".fr/"), '', $text), '&? ');
    $text = Preg_replace("~\\.(shtml|html|php|php5)\$~is", '', $text);
    $text = Preg_replace("~^/?s\\.~is", '', $text);
    $text = trim(Preg_Replace("~\\.((ch|co|com|fr|org|biz|info)/?|(shtml|html|htm|php|fla|jpg|bg|K)\$)~", ' ', $text));
    $text = Str_ireplace(array('%E0', "%e0", 'à'), 'a', $text);
    #,"f.","a."
    $text = Str_ireplace(array("1rachat-credit", "portail-patrimoine"), 'rachat de credit', $text);
    $text = eregi_replace("(c|p)?.html", '', $text);
    $text = ereg_replace("_([0-9]+)|^([0-9]+)-|-([0-9]+)|\\.([0-9]+)|\\/([0-9]+)|htm.\$", "", $text);
    //Les nombes en trop en paramètres ..
    $text = ucfirst(trim(str_replace(array("%20", "-", "_", "/", ".", ",", '|'), " ", $text)));
    #ore processing factory
    $pos = strpos($text, '?', 0);
    if ($pos > 0) {
        Preg_match_all("~=([^&]+)~is", $text, $t);
        $text = substr($text, 0, $pos);
        if ($t) {
            $t = $t[1];
            $text .= implode(' ', $t);
        }
    }
    return $text;
    //Supprimer le Get de merde, non, en aucun cas, on le conserve
}
Beispiel #4
0
 /** returnes true if $p_tag is a "<open tag>"
 		@param 	$p_tag - tag string
                 $p_array - tag array;
         @return true/false
 	*/
 function OpenTag($p_tag, $p_array)
 {
     $aTAGS =& $this->aTAGS;
     $aHREF =& $this->aHREF;
     $maxElem =& $this->iTagMaxElem;
     if (!eregi("^<([a-zA-Z1-9]{1,{$maxElem}}) *(.*)>\$", $p_tag, $reg)) {
         return false;
     }
     $p_tag = $reg[1];
     $sHREF = array();
     if (isset($reg[2])) {
         preg_match_all("|([^ ]*)=[\"'](.*)[\"']|U", $reg[2], $out, PREG_PATTERN_ORDER);
         for ($i = 0; $i < count($out[0]); $i++) {
             $out[2][$i] = eregi_replace("(\"|')", "", $out[2][$i]);
             array_push($sHREF, array($out[1][$i], $out[2][$i]));
         }
     }
     if (in_array($p_tag, $aTAGS)) {
         return false;
     }
     //tag already opened
     if (in_array("</{$p_tag}>", $p_array)) {
         array_push($aTAGS, $p_tag);
         array_push($aHREF, $sHREF);
         return true;
     }
     return false;
 }
Beispiel #5
0
 function encode_blast_email($htmlmessage = NULL, $textmessage = NULL, $message_ID, $fields = NULL)
 {
     if ($this->type != 'Email-Admin') {
         if ($htmlmessage) {
             $htmlmessage = eregi_replace("\\[USERID\\]", $message_ID, $htmlmessage);
             if ($fields) {
                 $htmlmessage = merge_fields_email($htmlmessage, $message_ID, $fields);
             }
             $htmlmessage .= '<img src="' . $Web_Site . 'http://localhost/amp/ut.php?m=' . $message_ID . '" width="1" height="1" border="0">';
             $htmlmessage .= '<br><p align="center"> To unsubscribe please click <a href="' . $Web_Site . 'http://localhost/amp/unsubscribe.php?m=' . $message_ID . '">here</a></p>';
             $htmlmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $htmlmessage);
         }
         if ($textmessage) {
             //$textmessage = eregi_replace("\[USERID\]",$message_ID,$textmessage,$fields=NULL);
             if ($fields) {
                 $textmessage = $this->merge_fields_email($textmessage, $message_ID, $fields);
             }
             $textmessage .= '\\n_____________________________________________________\\n To unsubscribe go to:\\n ' . $Web_Site . '/unsubscribe.php?m=' . $message_ID;
             $textmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $textmessage);
         }
     } else {
         if ($htmlmessage) {
             if ($fields) {
                 $htmlmessage = merge_fields_email($htmlmessage, $message_ID, $fields);
             }
             $htmlmessage .= '<img src="' . AMP_SITE_URL . '/ut.php?m=' . $message_ID . '" width="1" height="1" border="0">';
             $htmlmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $htmlmessage);
         }
     }
     $message = array('html' => $htmlmessage, 'text' => $textmessage);
     return $message;
 }
Beispiel #6
0
Datei: db.php Projekt: demental/m
 public function postProcessForm(&$v, &$fb, &$obj)
 {
     $defs = $obj->_getPluginsDef();
     $field = $obj->fb_elementNamePrefix . 'filename' . $obj->fb_elementNamePostfix;
     if (!$_FILES[$field]['tmp_name']) {
         return;
     }
     $filename = $obj->getImageName();
     if (!$filename) {
         $filename = $obj->getOwner()->tableName() . '_' . substr(md5(time() + rand(0, 100)), 0, 10);
     }
     $obj->filename = $this->_upFile($obj, $obj->fb_elementNamePrefix . 'filename' . $obj->fb_elementNamePostfix, $defs['otfimage']['path'], $filename);
     $obj->update();
     /**
      * Clearing cache for this image
      **/
     $filename = eregi_replace('(\\.[^\\.]+)$', '', basename($obj->filename));
     $cachefolder = APP_ROOT . 'public/' . $defs['otfimage']['cache'] . '/' . $filename . '/';
     foreach (FileUtils::getAllFiles($cachefolder) as $file) {
         @unlink($file);
     }
     /**
      * Setting as main if none exist
      */
     $main = $obj->getOwner();
     $mainImg = $main->getMainImage();
     if (!$obj->ismain && !$mainImg->pk()) {
         $obj->setAsMain();
     }
 }
function get_news()
{
    global $DISABLE_NEWS_GETTER;
    if ($DISABLE_NEWS_GETTER == 1) {
        return "nonews";
    }
    $news = @file("http://x7chat.com/rss/x7cu.rss");
    $news = @implode("", $news);
    $news = preg_split("/<news>/", $news);
    @array_shift($news);
    $newsnum = 0;
    $return = array();
    foreach ($news as $Key => $val) {
        $i++;
        $val = eregi_replace("_;", "&#59", $val);
        $val = explode(";", $val);
        $return[$newsnum]['title'] = $val[0];
        $return[$newsnum]['author'] = $val[1];
        $return[$newsnum]['date'] = $val[2];
        $return[$newsnum]['icon'] = $val[3];
        $return[$newsnum]['body'] = $val[4];
        if ($i > 2) {
            break;
        }
        $newsnum++;
    }
    if (count($return) == 0) {
        $return = "nonews";
    }
    return $return;
}
Beispiel #8
0
function formatUrlsInText($text)
{
    //$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
    $reg_exUrl = "(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)";
    if (preg_match_all($reg_exUrl, $text, $matches)) {
        preg_match_all($reg_exUrl, $text, $matches);
        $usedPatterns = array();
        foreach ($matches[0] as $pattern) {
            if (!array_key_exists($pattern, $usedPatterns)) {
                $usedPatterns[$pattern] = true;
                //$text = str_replace($pattern, "<a class=userContent href='".$pattern."' target='_blank'>".$pattern."</a>", $text);
                $text = eregi_replace($pattern, "<a class=userContent href='" . $pattern . "' target='_blank'>" . $pattern . "</a>", $text);
            }
        }
        echo nl2br($text);
        //return $text;
    } else {
        $reg_exUrl = "/(^|[^\\/])([a-zA-Z0-9\\-\\_]+\\.[\\S]+(\\b|\$))/";
        preg_match_all($reg_exUrl, $text, $matches);
        $usedPatterns = array();
        foreach ($matches[0] as $pattern) {
            if (!array_key_exists($pattern, $usedPatterns)) {
                $usedPatterns[$pattern] = true;
                $text = str_replace($pattern, "<a class=userContent href='http:\\/\\/" . $pattern . "' target=_blank>" . $pattern . "</a>", $text);
            }
        }
        echo nl2br($text);
        //return $text;
    }
}
function generateKML($kml_id, $resdir, $getmapurl, $wmsversion, $layername, $layertitle, $north, $south, $east, $west)
{
    $getmapurl = eregi_replace("&", "&amp;", $getmapurl);
    //$kml_id=md5(uniqid(rand(), true));
    if ($h = fopen($resdir . "/" . $kml_id . ".kml", "w+")) {
        //					$content = $text .chr(13).chr(10); //example for linefeeds
        $kml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . chr(13) . chr(10);
        $kml .= "<kml xmlns=\"http://earth.google.com/kml/2.2\">" . chr(13) . chr(10);
        $kml .= "<GroundOverlay>" . chr(13) . chr(10);
        $kml .= "<name>" . $layertitle . " - www.geoportal.rlp.de</name>" . chr(13) . chr(10);
        $kml .= "<Icon>" . chr(13) . chr(10);
        $kml .= "<href>" . $getmapurl . "VERSION=" . $wmsversion . "&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;WIDTH=512&amp;HEIGHT=512&amp;LAYERS=" . $layername . "&amp;STYLES=&amp;TRANSPARENT=TRUE&amp;BGCOLOR=0xffffff&amp;FORMAT=image/png&amp;</href>" . chr(13) . chr(10);
        //http://www.geoportal.rlp.de/owsproxy/3acc4cc90d02c754c531a9d5fa1b1545/5d38dd28a830f2c4ab97a506225d0a9b?VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;WIDTH=512&amp;HEIGHT=512&amp;LAYERS=boriweCD01&amp;TRANSPARENT=TRUE&amp;FORMAT=image/jpeg&amp;</href>
        $kml .= "<RefreshMode>onExpire</RefreshMode>" . chr(13) . chr(10);
        $kml .= "<viewRefreshMode>onStop</viewRefreshMode>" . chr(13) . chr(10);
        $kml .= "<viewRefreshTime>1</viewRefreshTime>" . chr(13) . chr(10);
        $kml .= "<viewBoundScale>0.87</viewBoundScale>" . chr(13) . chr(10);
        $kml .= "</Icon>" . chr(13) . chr(10);
        $kml .= "<LatLonBox>" . chr(13) . chr(10);
        $kml .= "<north>" . $north . "</north>" . chr(13) . chr(10);
        $kml .= "<south>" . $south . "</south>" . chr(13) . chr(10);
        $kml .= "<east>" . $east . "</east>" . chr(13) . chr(10);
        $kml .= "<west>" . $west . "</west>" . chr(13) . chr(10);
        $kml .= "</LatLonBox>" . chr(13) . chr(10);
        $kml .= "</GroundOverlay>" . chr(13) . chr(10);
        $kml .= "</kml>" . chr(13) . chr(10);
        if (!fwrite($h, $kml)) {
            #exit;
        }
        fclose($h);
    }
}
 function FormatPropertiesForDatabaseInput()
 {
     $this->Label = FormatStringForDatabaseInput($this->Label);
     $this->Contents = FormatStringForDatabaseInput($this->Contents);
     $this->Contents = eregi_replace("&lt;textarea&gt;", "<textarea>", $this->Contents);
     $this->Contents = eregi_replace("&lt;//textarea&gt;", "</textarea>", $this->Contents);
 }
Beispiel #11
0
function CCIJavaBabble($myoutput)
{
    global $mycrypto, $myalpha2, $javaencrypt, $preservehead;
    $s = $myoutput;
    $s = ereg_replace("\n", "", $s);
    if ($preservehead) {
        eregi("(^.+<body[^>]*>)", $s, $chunks);
        $outputstring = $chunks[1];
        eregi_replace($headpart, "", $s);
        eregi("(</body[^>]*>.*)", $s, $chunks);
        $outputend = $chunks[1];
        eregi_replace($footpart, "", $s);
    } else {
        $outputstring = "";
        $outputend = "";
    }
    if ($javaencrypt) {
        $s = strtr($s, $myalpha2, $mycrypto);
        $s = rawurlencode($s);
        $outputstring .= "<script>var cc=unescape('{$s}'); ";
        $outputstring .= "var index = document.cookie.indexOf('" . md5($_SERVER["REMOTE_ADDR"] . $_SERVER["SERVER_ADDR"]) . "='); " . "var aa = '{$myalpha2}'; " . "if (index > -1) { " . "  index = document.cookie.indexOf('=', index) + 1; " . "  var endstr = document.cookie.indexOf(';', index); " . "  if (endstr == -1) endstr = document.cookie.length; " . "  var bb = unescape(document.cookie.substring(index, endstr)); " . "} " . "cc = cc.replace(/[{$myalpha2}]/g,function(str) { return aa.substr(bb.indexOf(str),1) }); document.write(cc);";
    } else {
        $outputstring .= "<script>document.write(unescape('" . rawurlencode($s) . "'));";
    }
    $outputstring .= "</script><noscript>You must enable Javascript in order to view this webpage.</noscript>" . $outputend;
    return $outputstring;
}
 function PreLoad()
 {
     global $totalresult, $pageno;
     if (empty($pageno) || ereg("[^0-9]", $pageno)) {
         $pageno = 1;
     }
     if (empty($totalresult) || ereg("[^0-9]", $totalresult)) {
         $totalresult = 0;
     }
     $this->pageNO = $pageno;
     $this->totalResult = $totalresult;
     if (isset($this->tpl->tpCfgs['pagesize'])) {
         $this->pageSize = $this->tpl->tpCfgs['pagesize'];
     }
     $this->totalPage = ceil($this->totalResult / $this->pageSize);
     if ($this->totalResult == 0) {
         //$this->isQuery = true;
         //$this->dsql->Execute('mbdl',$this->sourceSql);
         //$this->totalResult = $this->dsql->GetTotalRow('mbdl');
         $countQuery = eregi_replace("select[ \r\n\t](.*)[ \r\n\t]from", "Select count(*) as dd From", $this->sourceSql);
         $row = $this->dsql->GetOne($countQuery);
         $this->totalResult = $row['dd'];
         $this->sourceSql .= " limit 0," . $this->pageSize;
     } else {
         $this->sourceSql .= " limit " . ($this->pageNO - 1) * $this->pageSize . "," . $this->pageSize;
     }
 }
function SQL语句解析函数_应用于消息中心($sql, $操作记录编号)
{
    global $db, $MetaTables;
    //判断自定义表是否存在,如果不存在直接返回
    //判断是否是联合全操作,是否有子查询,是否用left
    //如果有,则表示为手写SQL代码,不是系统生成,则直接返回,不进行过滤
    $sql = trim($sql);
    //转成小写
    $sqllower = strtolower($sqllower);
    //缩进空格
    $sql = eregi_replace("  ", " ", $sql);
    $sql = eregi_replace("  ", " ", $sql);
    if (substr($sqllower, 0, strlen("insert into")) == "insert into") {
        $sqlArray = explode('insert into', $sql);
        $sqlArray = explode('values', $sqlArray[1]);
        $sqlArray = explode('(', $sqlArray[0]);
        $Tablename = $sqlArray[0];
        开始处理消息中心('INSERT', $Tablename, $数据字段, $操作记录编号);
    }
    if (substr($sqllower, 0, strlen("update")) == "update") {
        $sqlArray = explode('update', $sql);
        $sqlArray = explode('set', $sqlArray[1]);
        $Tablename = TRIM($sqlArray[0]);
    }
    if (substr($sqllower, 0, strlen("delete from")) == "delete from") {
        $sqlArray = explode('delete from', $sql);
        $sqlArray = explode(' ', $sqlArray[1]);
        $Tablename = TRIM($sqlArray[0]);
        开始处理消息中心('DELETE', $Tablename, $数据字段, $操作记录编号);
    }
}
Beispiel #14
0
function ss_clean($usertext)
{
    //  if ( eregi ("\"", $tabletext) )  { echo  "<p>Yesss!</p>"; }
    //  print  "<p>Test: ".eregi ( "<script", $tabletext )." (should give ereg output)</p>";
    //What about cases where multiple classes?
    $pattern = 'spreadsheetCellActive';
    $replacement = '';
    $usertext = eregi_replace($pattern, $replacement, $usertext);
    //remove any auto_locked rows or columns
    $pattern = 'auto_locked';
    $replacement = '';
    $usertext = eregi_replace($pattern, $replacement, $usertext);
    //remove any empty class statements
    $pattern = 'class="([[:space:]]*)"';
    $replacement = '';
    $usertext = eregi_replace($pattern, $replacement, $usertext);
    //debug regex -- leave here
    //echo "pattern: $pattern  ".htmlspecialchars(($usertext), ENT_QUOTES);
    //die;
    // Disable any attempt inject a script into the database
    $usertext = eregi_replace("<script", "<DISABLEDscript", $usertext);
    // Disable any attempt inject php into the database (ajaxed, but be sure)
    $usertext = eregi_replace("<[\\?]", "<DISABLED?", $usertext);
    return $usertext;
}
Beispiel #15
0
 function makeClickableLinks($text)
 {
     $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text);
     $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text);
     $text = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text);
     return $text;
 }
Beispiel #16
0
function ft_split($str)
{
    $str = eregi_replace("[ ]+", " ", $str);
    $tab = explode(" ", $str);
    sort($tab, SORT_STRING);
    return $tab;
}
function xmlParse($data, $bList = "")
{
    $bArray = array();
    // if any attributes were passed to the function, add them to the array
    if (strlen($bList) > 0) {
        $bArray = explode(",", $bList);
    }
    // by: waldo@wh-e.com - trim space around tags not within
    $data = eregi_replace(">" . "[[:space:]]+" . "<", "><", $data);
    // XML functions
    $p = xml_parser_create();
    // by: anony@mous.com - meets XML 1.0 specification
    xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0);
    xml_parse_into_struct($p, $data, $vals, $index);
    xml_parser_free($p);
    for ($x = 0; $x < count($vals); $x++) {
        if (array_key_exists("attributes", $vals[$x])) {
            foreach ($vals[$x]["attributes"] as $thiskey => $thisvalue) {
                // if the attribute name exists in the "bList" then re-cast the string to a boolean
                if (is_string($thisvalue) && array_search($thiskey, $bArray) !== false && (strtolower($thisvalue) == "true" || strtolower($thisvalue) == "false")) {
                    $vals[$x]["attributes"][$thiskey] = strtolower($thisvalue) == "true";
                }
            }
        }
    }
    $i = 0;
    $tree["xmlChildren"] = array();
    $tree["xmlChildren"][] = array('xmlName' => $vals[$i]['tag'], 'xmlAttributes' => getAttributes($vals, $i), 'xmlValue' => getValue($vals, $i), 'xmlChildren' => GetChildren($vals, $i));
    return $tree;
}
 function get_term_from_file($current_file)
 {
     include "fse_config.php";
     $post_text = implode(" ", file($current_file));
     $post_text = eregi_replace("[^_0-9a-z-]", " ", strtolower($post_text));
     //explode by blank to generate token list
     $local_termlist = explode(" ", $post_text);
     for ($i = 0; $i < count($local_termlist); $i++) {
         //further striping
         $local_termlist[$i] = trim($local_termlist[$i]);
         //trim leading and tailing "-", "_"
         while (substr($local_termlist[$i], 0, 1) == "-" || substr($local_termlist[$i], 0, 1) == "_") {
             $local_termlist[$i] = substr($local_termlist[$i], 1);
         }
         while (substr($local_termlist[$i], -1) == "-" || substr($local_termlist[$i], -1) == "_") {
             $local_termlist[$i] = substr($local_termlist[$i], 0, strlen($local_termlist[$i]) - 1);
         }
         //if exclude digits, but the term concludes digit(s), then discard
         //if the term does not contain any a-z character discard
         if ($fse_exclude_digit && eregi("[0-9]", $local_termlist[$i])) {
             continue;
         }
         if (eregi("[a-z]", $local_termlist[$i]) && strlen($local_termlist[$i]) >= $fse_min_len) {
             $term_list[] = $local_termlist[$i];
         }
     }
     sort($term_list);
     return $term_list;
 }
Beispiel #19
0
 /**
  * 方法重载函数
  *
  * @access public
  * @param  string $function
  * @param  string $args
  * @return void
  */
 function __call($func, $args)
 {
     //获取类名
     $sDtoClass = get_class($args[0]);
     $sDmoClass = eregi_replace("DTO", "DMO", $sDtoClass);
     //echo $sDmoClass."::<br>";
     /*
     if(substr($sDmoClass, 0,3) != substr($this->childClass, 0,3))
     {
     	//echo "没有操作权限";
     	return false;
     }
     */
     if (!in_array($func, get_class_methods($sDmoClass))) {
         //echo "类方法不存在";
         return false;
     }
     //include_once(CLASS_DIR."/Module/src/_".$sClassName.".class.php");
     //include_once(CLASS_DIR."/Module/dev/".$sClassName.".class.php");
     $oDMOClass = new $sDmoClass();
     if ($args[1]) {
         return $oDMOClass->{$func}($args[0], $args[1]);
     } else {
         return $oDMOClass->{$func}($args[0]);
     }
 }
 /**
  * Convert links and emails in a text in html tags
  *
  * @return string Converted text
  */
 function html_activate_links(&$str)
 {
     $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)', '<a href="\\1" target="_blank">\\1</a>', $str);
     $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\\+.~#?&//=]+)', '\\1<a href="http://\\2" target="_blank">\\2</a>', $str);
     $str = eregi_replace('([_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $str);
     return $str;
 }
function cleanhex($hex)
{
    $hex = eregi_replace("[^a-fA-F0-9]", "", $hex);
    $hex = strtoupper($hex);
    $hex = ltrim($hex, '0');
    return $hex;
}
Beispiel #22
0
 public function matchAndReplaceText($keyword, $string, $condition = NULL)
 {
     /*/if the search Keyword is empty then return with the string  , do not go any further */
     if (empty($keyword)) {
         return $string;
     }
     /*/omit any html tags if present other wise it will create conflict.*/
     $string = strip_tags($string);
     /*/ to check if the search keyword contains space ,it breaks into the words and search for each words.*/
     $keyword = $this->getArrayofStringWithNoSpace($keyword);
     /*/ above function return string either in array or string. */
     if (is_array($keyword)) {
         /*/ replaces the main string with the all the words return by the array of the above functions .*/
         foreach ($keyword as $text) {
             if (eregi($text, $string)) {
                 $string = eregi_replace($text, "<span class='foundText'>" . $text . "</span>", $string);
             }
         }
         return $string;
     } else {
         if (eregi($keyword, $string) and !empty($keyword)) {
             return eregi_replace($keyword, "<span class='foundText'>" . $keyword . "</span>", $string);
         } else {
             return $string;
         }
     }
 }
 public function sendMail($address, $send_user, $from, $title, $message)
 {
     vendor('mail.mail');
     $message = eregi_replace("[\\]", '', $message);
     // preg_replace('/\\\\/','', $message);
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // 设置PHPMailer使用SMTP服务器发送Email
     $mail->CharSet = 'UTF-8';
     // 设置邮件的字符编码,若不指定,则为'UTF-8'
     $mail->Port = $this->setting['mail_port'];
     //端口号
     $mail->AddAddress($address);
     // 添加收件人地址,可以多次使用来添加多个收件人
     //$mail->Body=$message;     // 设置邮件正文
     $mail->MsgHTML($message);
     //$mail->From=$this->setting['mail_username'];    // 设置邮件头的From字段。
     $mail->From = $from;
     // 设置邮件头的From字段。
     $mail->FromName = $this->setting['mail_fromname'];
     // 设置发件人名字
     $mail->Subject = $title;
     // 设置邮件标题
     $mail->Host = $this->setting['mail_smtp'];
     // 设置SMTP服务器。
     $mail->SMTPAuth = true;
     // 设置为“需要验证”
     //$mail->Username=$this->setting['mail_username'];     // 设置用户名和密码。
     $mail->Username = $send_user;
     // 设置用户名和密码。
     $mail->Password = $this->setting['mail_password'];
     // 发送邮件。
     return $mail->Send();
 }
 /**
  * A parsing function that accepts an json decoded object and 
  * returns a HTML string of the tweets.
  * @param object $tweetObjects
  * @return string
  */
 public function parseObject($tweetObjects)
 {
     $tweets = '';
     date_default_timezone_set('UTC');
     foreach ($tweetObjects as $tweet) {
         // Assign Relative formatted time
         $tweet->relative_time = $this->distance_of_time_in_words(strtotime($tweet->created_at)) . ' ago';
         // Turn links into links
         $tweet->parsed_text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)', '<a href="\\1" target="_blank">\\1</a>', $tweet->text);
         // Turn twitter @username into links to the users Twitter page
         $tweet->parsed_text = preg_replace('/(^|\\s)@(\\w+)/', '\\1<a href="http://www.twitter.com/\\2">@\\2</a>', $tweet->parsed_text);
         // Turn #hashtags into searches
         $tweet->parsed_text = preg_replace('/(^|\\s)#(\\w+)/', '\\1<a href="http://search.twitter.com/search?q=%23\\2">#\\2</a>', $tweet->parsed_text);
         // Link to actual Tweet
         $tweet->tweet_link = 'http://twitter.com/' . $tweet->user->screen_name . '/status/' . $tweet->id;
         // Get all the tags in the format string
         // Nested keys are denoted via parent->child->childofchild etc.
         preg_match_all('/\\[@(\\w+[->\\w+]*)\\]/i', $this->_tweetFormat, $result);
         $tweetOutput = $this->_tweetFormat;
         foreach ($result[1] as $foundkey) {
             $keys = explode('->', $foundkey);
             $value = $tweet;
             //copy tweet object for nested lookup
             foreach ($keys as $key) {
                 $value = $value->{$key};
                 //Variable variable
             }
             $tweetOutput = str_replace("[@{$foundkey}]", $value, $tweetOutput);
         }
         $tweets .= $tweetOutput;
     }
     return str_replace('[@tweets]', $tweets, $this->_listFormat);
 }
Beispiel #25
0
	  public function DbNumber($x)
	  {
	  $x=eregi_replace("[^0-9\.,-]","",$x);
	  $x=str_replace(".","",$x);
	  $x=str_replace(",",".",$x);
	  return $x;
	  }
 function clickableurls($text)
 {
     $text = eregi_replace('(((f|ht){1}tp(s?)://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)', '<a href="\\1" target="_blank">\\1</a>', $text);
     $text = eregi_replace("(^|[ \n\r\t])(www\\.([a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+)(/[^/ \n\r]*)*)", '\\1<a href="http://\\2" target="_blank">\\2</a>', $text);
     $text = eregi_replace("(^|[ \n\r\t])([_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4})", '\\1<a href="mailto:\\2" target="_blank">\\2</a>', $text);
     return $text;
 }
Beispiel #27
0
function bold_it($i, $name)
{
    $i = eregi_replace("{$name}", "<b>{$name}</b>", $i);
    $i = strtoupper($i);
    $i = stripslashes($i);
    return $i;
}
function show_copyright()
{
    global $author_name, $author_user_email, $author_homepage, $license, $download_location, $module_version, $module_description;
    if ($author_name == "") {
        $author_name = "N/A";
    }
    if ($author_user_email == "") {
        $author_user_email = "N/A";
    }
    if ($author_homepage == "") {
        $author_homepage = "N/A";
    }
    if ($license == "") {
        $license = "N/A";
    }
    if ($download_location == "") {
        $download_location = "N/A";
    }
    if ($module_version == "") {
        $module_version = "N/A";
    }
    if ($module_description == "") {
        $module_description = "N/A";
    }
    $module_name = basename(dirname(__FILE__));
    $module_name = eregi_replace("_", " ", $module_name);
    echo "<html>\n" . "<body bgcolor=\"#F6F6EB\" link=\"#363636\" alink=\"#363636\" vlink=\"#363636\">\n" . "<title>{$module_name}: Copyright Information</title>\n" . "<font size=\"2\" color=\"#363636\" face=\"Verdana, Helvetica\">\n" . "<center><b>Module Copyright &copy; Information</b><br>" . "{$module_name} module for <a href=\"http://phpnuke.org\" target=\"new\">PHP-Nuke</a><br><br></center>\n" . "<img src=\"../../images/arrow.gif\" border=\"0\">&nbsp;<b>Module's Name:</b> {$module_name}<br>\n" . "<img src=\"../../images/arrow.gif\" border=\"0\">&nbsp;<b>Module's Version:</b> {$module_version}<br>\n" . "<img src=\"../../images/arrow.gif\" border=\"0\">&nbsp;<b>Module's Description:</b> {$module_description}<br>\n" . "<img src=\"../../images/arrow.gif\" border=\"0\">&nbsp;<b>License:</b> {$license}<br>\n" . "<img src=\"../../images/arrow.gif\" border=\"0\">&nbsp;<b>Author's Name:</b> {$author_name}<br>\n" . "<img src=\"../../images/arrow.gif\" border=\"0\">&nbsp;<b>Author's Email:</b> {$author_user_email}<br><br>\n" . "<center>[ <a href=\"{$author_homepage}\" target=\"new\">Author's HomePage</a> | <a href=\"{$download_location}\" target=\"new\">Module's Download</a> | <a href=\"javascript:void(0)\" onClick=javascript:self.close()>Close</a> ]</center>\n" . "</font>\n" . "</body>\n" . "</html>";
}
Beispiel #29
0
 public function podarNome()
 {
     $nome = $this->getNome();
     $nome = eregi_replace('^(estado da |estado de |estado do |estado del |departamento de |departamento del |state of |province of |província de |província da |província do |provincia de |provincia da |provincia do |provincia del )|( department| province)$', '', $nome);
     $nome = eregi_replace('^(município |município de |cidade de )|( county| condado)$', '', $nome);
     $this->setNome($nome);
 }
 public function pregstring($data)
 {
     $str = trim($data);
     $str = preg_replace("/\\s+/", " ", $str);
     //去掉多余回车
     $str = preg_replace('/<(li.*?)>(.*?)"/si', "", $str);
     $str = preg_replace('/<(span class="director".*?)>(.*?)<(\\/span.*?)>/si', "", $str);
     $str = preg_replace('/<(span class="starts".*?)>(.*?)<(\\/span.*?)>/si', "", $str);
     $str = preg_replace('/<(span class="showtimes".*?)>(.*?)<(\\/span.*?)>/si', "", $str);
     $str = eregi_replace("</*[^<>]*>", '', $str);
     //去掉html格式符号
     $str = str_replace("&nbsp;", '', $str);
     //去掉空格替换换行符
     $str = str_replace("&yen;", '', $str);
     //去掉空格替换换行
     $str = str_replace(">", "\n", $str);
     //去掉多余回车
     $str = str_replace("2D", "", $str);
     //去掉多余回车
     $str = str_replace("3D", "", $str);
     //去掉多余回车
     $str = str_replace("4D", "", $str);
     //去掉多余回车
     return $str;
 }