当前位置: 首页>>代码示例>>PHP>>正文


PHP replace_accents函数代码示例

本文整理汇总了PHP中replace_accents函数的典型用法代码示例。如果您正苦于以下问题:PHP replace_accents函数的具体用法?PHP replace_accents怎么用?PHP replace_accents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了replace_accents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connexions_list

function connexions_list()
{
    if (posix_getuid() != 0) {
        $user = new usersMenus();
        if ($user->AsSystemAdministrator == false) {
            $tpl = new templates();
            echo replace_accents(html_entity_decode($tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}")));
            die;
            exit;
        }
    }
    $q = new mysql();
    if (isset($_GET["delete"])) {
        $sql = "DELETE FROM vpnclient WHERE ID='{$_GET["delete"]}'";
        $results = $q->QUERY_SQL($sql, "artica_backup");
    }
    $sql = "SELECT * FROM vpnclient ORDER BY ID DESC";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $js = "EditConnextion({$ligne["ID"]})";
        $html = "<table style='width:100%'>";
        $html = $html . "\n\t\t<tr " . CellRollOver($js) . ">\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td width=99%><strong style='font-size:12px'>{$ligne["connexion_name"]}</strong></td>\n\t\t\t<td width=99%><strong style='font-size:12px'>{$ligne["servername"]}</strong></td>\n\t\t\t<td width=1%>" . imgtootltip("ed_delete.gif", "{delete}", "DelConnexion({$ligne["ID"]})") . "</td>\n\t\t</tr>\n\t\t\n\t\t";
    }
    $html = $html . "</table>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:27,代码来源:openvpn.artica.php

示例2: js

function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t2 = time();
    $t = $_GET["t"];
    $rulefrom = $_GET["from"];
    if (is_numeric($rulefrom)) {
        $q = new mysql_squid_builder();
        $sql = "SELECT groupname FROM webfilter_rules WHERE ID={$rulefrom}";
        $results = $q->QUERY_SQL($sql);
        $ligne = mysql_fetch_array($results);
        $tmpname = $ligne["groupname"] . " (copy)";
        $tmpname = addslashes($tmpname);
        $tmpname = replace_accents($tmpname);
    }
    if (isset($_GET["default-rule"])) {
        $rulefrom = "default";
        $tmpname = $tpl->javascript_parse_text("{default} (copy)");
        $tmpname = replace_accents($tmpname);
    }
    header("content-type: application/x-javascript");
    $ask = $tpl->javascript_parse_text("{duplicate_the_ruleid_give_name}");
    $html = "\n\t\tvar x_Duplicaterule{$t2}= function (obj) {\n\t\t\tvar res=obj.responseText;\n\t\t\tif (res.length>0){alert(res);}\n\t\t\t\$('#flexRT{$t}').flexReload();\n\t\t}\n\t\n\t\n\t\tfunction Duplicaterule{$t2}(){\n\t\t\tvar rulename=prompt('{$ask} {$rulefrom}','{$tmpname}');\n\t\t\tif(!rulename){return;}\n\t\t\t var XHR = new XHRConnection();\n\t\t     XHR.appendData('duplicate-from', '{$rulefrom}');\n\t\t     var pp=encodeURIComponent(rulename);\n\t\t     XHR.appendData('duplicate-name', pp);\n\t\t     XHR.sendAndLoad('{$page}', 'POST',x_Duplicaterule{$t2}); \n\t\t\n\t\t}\n\t\t\n\t\n\tDuplicaterule{$t2}();";
    echo $html;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:26,代码来源:dansguardian2.duplicate.php

示例3: install_app

function install_app()
{
    $sock = new sockets();
    $sock->getfile("CheckDaemon");
    $sock->getfile("install_app:{$_GET["product"]}");
    $sock->DeleteCache();
    $tpl = new templates();
    $echo = "{{$_GET["product"]}}\n{installation_lauched}";
    $echo = $tpl->javascript_parse_text($echo);
    echo replace_accents($echo);
}
开发者ID:brucewu16899,项目名称:artica,代码行数:11,代码来源:setup.index.progress.php

示例4: simple

function simple($s)
{
    $s = strtolower($s);
    $s = str_replace("'", "_", $s);
    $pos = strpos($s, '(');
    if ($pos !== FALSE) {
        $s = substr($s, 0, $pos);
        $s = trim($s);
    }
    $s = str_replace(" ", "_", $s);
    $s = replace_accents($s);
    return enc($s);
}
开发者ID:ragusa87,项目名称:comp-aoc,代码行数:13,代码来源:utils.php

示例5: getDownloadImage

function getDownloadImage($type, $file, $sottoCat, $nome_brand, $nome_colore, $id)
{
    $file_path = "";
    // estensione foto
    $ext = pathinfo($file, PATHINFO_EXTENSION);
    if (strtolower($ext) == "jpg") {
        // recupero il numero della foto
        $punto = strrpos($file, ".");
        $file_new = substr($file, 0, $punto);
        // il numero dell'immagine
        $numero_img = substr($file_new, strlen($file_new) - 1, 1);
        $nome_file = replace_accents(url_slug(strtolower($sottoCat))) . "_" . replace_accents(url_slug(strtolower($nome_brand))) . "_" . replace_accents(url_slug(strtolower($nome_colore))) . "_" . replace_accents(url_slug(strtolower($id))) . "-" . $numero_img . "." . $ext;
        $import_location = "../../var/images";
        $file_source = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_imageurl', Mage::app()->getStore()) . $file;
        $file_target = $import_location . "/" . $nome_file;
        $file_source = str_replace(" ", "%20", $file_source);
        if ($file != '' and !file_exists($file_target)) {
            $rh = fopen($file_source, 'rb');
            $wh = fopen($file_target, 'wb');
            if ($rh === false || $wh === false) {
                // error reading or opening file
                $file_path = "";
            } else {
                while (!feof($rh)) {
                    if (fwrite($wh, fread($rh, 1024)) === FALSE) {
                        $file_path = $file_target;
                    }
                }
            }
            fclose($rh);
            fclose($wh);
        }
        if (file_exists($file_target)) {
            if ($type == 'category') {
                $file_path = $file;
            } else {
                $file_path = $file_target;
            }
        }
        if (filesize($file_path) > 0) {
            $img = new Imagick();
            $img->clear();
            $img->readImage($file_path);
            $img->setOption('jpeg:extent', '180kb');
            $img->writeImage($file_path);
        }
    }
    return $file_path;
}
开发者ID:technomagegithub,项目名称:colb2b,代码行数:49,代码来源:saveImage.php

示例6: perform

function perform()
{
    $dev = $_POST["dev"];
    $label = $_POST["label"];
    $label = substr($label, 0, 16);
    $label = trim($label);
    $label = replace_accents($label);
    $sock = new sockets();
    $fs_type = $_POST["fs_type"];
    //--format-b-part
    $dev = urlencode($dev);
    $label = urlencode($label);
    echo "system.internal.disks.BuildBigPartition.progress.php?dev={$dev}&label={$label}&fs_type={$fs_type}";
    return;
    $datas = base64_decode($sock->getFrameWork("cmd.php?fdisk-build-big-partitions=yes&dev={$dev}&label={$label}&fs_type={$fs_type}&MyCURLTIMEOUT=240"));
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:16,代码来源:system.internal.disks.BuildBigPartition.php

示例7: AddNewSchedule_save

function AddNewSchedule_save()
{
    $users = new usersMenus();
    $q = new mysql_meta();
    $tpl = new templates();
    $task = new system_tasks();
    $task_type = $task->tasks_array;
    $info = $tpl->javascript_parse_text($task_type[$_POST["TaskType"]]);
    $defaultdesc = replace_accents($info);
    if ($_POST["TimeDescription"] == null) {
        $_POST["TimeDescription"] = $defaultdesc . " : {$_POST["TimeText"]}";
    }
    $_POST["TimeDescription"] = mysql_escape_string2($_POST["TimeDescription"]);
    $sql = "INSERT IGNORE INTO system_schedules (TimeDescription,TimeText,TaskType,enabled,uuid) \n\tVALUES('{$_POST["TimeDescription"]}','{$_POST["TimeText"]}','{$_POST["TaskType"]}',1,'{$_POST["uuid"]}')";
    if ($_POST["ID"] > 0) {
        $sql = "UPDATE system_schedules SET \n\t\t\tTimeDescription='{$_POST["TimeDescription"]}',\n\t\t\tTimeText='{$_POST["TimeText"]}',\n\t\t\tTaskType='{$_POST["TaskType"]}' WHERE ID={$_POST["ID"]}\n\t\t\t";
    }
    if (!$q->TABLE_EXISTS("system_schedules")) {
        $q->BuildTables();
    }
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("artica.php?build-meta-schedules=yes&uuid={$_POST["uuid"]}");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:28,代码来源:artica-meta.schedules.php

示例8: mysql_settings

function mysql_settings($notitle=false){
	
	$user=new usersMenus();
	if(!$user->AsArticaAdministrator){
		if(!$user->AsSystemAdministrator){
			$tpl=new templates();
			$text=$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS} !AsSystemAdministrator');
			$text=replace_accents(html_entity_decode($text));
			echo "alert('$text');";
			exit;
	}}
	
		$artica=new artica_general();
	    $page=CurrentPageName();
		if(preg_match('#(.+?):(.*)#',$artica->MysqlAdminAccount,$re)){
			$rootm=$re[1];
			$pwd=$re[2];
		}	
		
		$servername=$artica->MysqlServerName;
		
	$html="
	
	<table style='width:100%'>
	
		<tr>
		<td align='right' nowrap class=legend>{mysqlserver}:</strong></td>
		<td align='left'>" . Field_text('mysqlserver',$servername,'width:90px;padding:3px;font-size:13px',null,null,'')."</td>
		</tr>	
		<tr>
		<td align='right' nowrap class=legend>{mysqlroot}:</strong></td>
		<td align='left'>" . Field_text('mysqlroot',$rootm,'width:90px;padding:3px;font-size:13px',null,null,'{mysqlroot_text}')."</td>
		</tr>
		<tr>
		<td align='right' nowrap class=legend>{mysqlpass}:</strong></td>
		<td align='left'>" . Field_password("mysqlpass",$pwd,"width:90px;padding:3px;font-size:13px")."</td>
		</tr>
		<tr>
			<td colspan=2 align='right'>
				<hr>". button("{apply}","Loadjs('$page?script=mysql_save_account')")."
			</td>
		</tr>	
	</table>
	";	
	
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html,"artica.settings.php");	
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:48,代码来源:mysql.index.php

示例9: getAttributes


//.........这里部分代码省略.........
                        if (is_object($decodedGet)) {
                            $decodedGet = get_object_vars($decodedGet);
                        }
                        $l = 1;
                        foreach ($decodedGet as $key => $value) {
                            $l = $l + 1;
                            $id_attributo = $key;
                            $valoreProdotti = $value;
                            $description = null;
                            $valoriAttributi = null;
                            foreach ($valoreProdotti as $key => $value) {
                                // recupero campi prodotto
                                if ($key == "description") {
                                    $nome_attributo = $value;
                                    if (is_object($nome_attributo)) {
                                        $nome_attributo = get_object_vars($nome_attributo);
                                    }
                                }
                                if ($key == "values") {
                                    $subattributes = $value;
                                    if (is_object($subattributes)) {
                                        $subattributes = get_object_vars($subattributes);
                                    }
                                }
                            }
                            // controllo esistenza dell'attributo in magento
                            $stringQuery = "select id_magento from " . $resource->getTableName('wsca_attributes') . " where id_ws='" . $id_attributo . "'";
                            $id_attributoMage = $readConnection->fetchOne($stringQuery);
                            if ($id_attributoMage == null) {
                                $model = Mage::getModel('eav/entity_setup', 'core_setup');
                                if (count($subattributes) == 0) {
                                    $input = "text";
                                    $dbInput = "testo";
                                } else {
                                    $input = "multiselect";
                                    $dbInput = "select";
                                }
                                $data = array('global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'group' => 'General', 'type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => ucfirst(strtolower(replace_accents($nome_attributo))), 'input' => $input, 'unique' => false, 'required' => false, 'is_configurable' => false, 'searchable' => false, 'visible_in_advanced_search' => false, 'comparable' => false, 'filterable' => false, 'filterable_in_search' => false, 'used_for_promo_rules' => false, 'visible_on_front' => false, 'used_in_product_listing' => false, 'used_for_sort_by' => false, 'user_defined' => true);
                                $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30);
                                $model->addAttribute('catalog_product', $nome_attributoMage, $data);
                                $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                                $optionTable = $setup->getTable('eav/attribute');
                                $id_attributoMage = getLastInsertId($optionTable, 'attribute_id');
                                $query = "insert into " . $resource->getTableName('wsca_attributes') . " (id_magento,id_ws,tipo) values('" . $id_attributoMage . "','" . $id_attributo . "','" . $dbInput . "')";
                                $writeConnection->query($query);
                            } else {
                                $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30);
                            }
                            // se l'attributo è il supercolore utilizzo anche l'attributo colore
                            if ($nome_attributo == "Supercolore") {
                            } else {
                                foreach ($subattributes as $key => $value) {
                                    $id_valoreattributo = $key;
                                    $nome_valoreattributo = $value;
                                    // controllo esistenza opzione in magento per l'attributo in questione
                                    $stringQuery = "select id_magento from " . $resource->getTableName('wsca_subattributes') . " where id_ws='" . $id_valoreattributo . "' and id_attributes='" . $id_attributo . "'";
                                    $id_valoreattributoMage = $readConnection->fetchOne($stringQuery);
                                    if ($id_valoreattributoMage == null) {
                                        if ($nome_valoreattributo == "" || $nome_valoreattributo == null) {
                                        } else {
                                            $attribute_model = Mage::getModel('eav/entity_attribute');
                                            $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                                            $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage);
                                            $attribute = $attribute_model->load($attribute_code);
                                            $attribute->setData('option', array('value' => array('option' => array(ucfirst(strtolower($nome_valoreattributo)), ucfirst(strtolower($nome_valoreattributo))))));
                                            $attribute->save();
                                            $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                                            $optionTable = $setup->getTable('eav/attribute_option');
                                            $id_valoreattributoMage = getLastInsertId($optionTable, 'option_id');
                                            $query = "insert into " . $resource->getTableName('wsca_subattributes') . " (id_magento,id_ws, id_attributes) values('" . $id_valoreattributoMage . "','" . $id_valoreattributo . "','" . $id_attributo . "')";
                                            $writeConnection->query($query);
                                        }
                                    } else {
                                        $attr = Mage::getModel('catalog/product')->getResource()->getAttribute($nome_attributoMage);
                                        if ($attr->usesSource()) {
                                            $nomeValoreAttributoMage = $attr->getSource()->getOptionText($id_valoreattributoMage);
                                            if (strtolower($nomeValoreAttributoMage) != strtolower($nome_valoreattributo)) {
                                                $attribute_model = Mage::getModel('eav/entity_attribute');
                                                $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                                                $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage);
                                                $attribute = $attribute_model->load($attribute_code);
                                                // modifica della stagione su magento (nome dell'opzione)
                                                $data = array();
                                                $values = array($id_valoreattributoMage => array(0 => ucfirst(strtolower($nome_valoreattributo)), 1 => ucfirst(strtolower($nome_valoreattributo))));
                                                $data['option']['value'] = $values;
                                                $attribute->addData($data);
                                                $attribute->save();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return true;
}
开发者ID:technomagegithub,项目名称:colb2b,代码行数:101,代码来源:import.php

示例10: array_splice

            $remove[] = $i + 1;
        }
    }
    for ($i = 0; $i < count($remove); $i++) {
        array_splice($info, $remove[$i] - $i, 1);
    }
    // Reconta o numero de senhas do vetor $info
    $numresults = count($info) - 1;
}
//print_r($info);
if (isset($submit)) {
    if ($submit == "Salvar") {
        // Se a senha validacao de senha for igual
        if ($novasenha == $novasenha2) {
            // Verifica se a variavel existe
            $descricao = replace_accents($descricao);
            if (!empty($descricao)) {
                $entry["description"][0] = $descricao;
            }
            if (!empty($grupo)) {
                $entry["description"][1] = $grupo;
            }
            if (!empty($novasenha)) {
                $entry["userpassword"][0] = "{crypt}" . crypt($novasenha);
            }
            if (!empty($novasenha)) {
                $entry["userpassword"][1] = encripta($novasenha, $key, $iv);
            }
            $uptdn = "uid=" . $info[$valor]["uid"][0] . ",ou=" . $info[$valor]["host"][0] . ",ou=people," . $dn;
            if (ldap_modify($conexao, $uptdn, $entry)) {
                // Envia email para informar alteracao
开发者ID:avelinoF0,项目名称:sistsenha,代码行数:31,代码来源:editar.php

示例11: buildconfig

function buildconfig()
{
    $vpn = new openvpn();
    $connection_name = trim(strtolower($_POST["connection_name"]));
    if ($connection_name == null) {
        $connection_name = time();
    }
    $connection_name = str_replace(" ", "-", $connection_name);
    $connection_name = replace_accents($connection_name);
    $connection_name = str_replace("/", "-", $connection_name);
    $connection_name = str_replace('\\', "-", $connection_name);
    $tools = new htmltools_inc();
    $connection_name = $tools->StripSpecialsChars($connection_name);
    $connection_name = mysql_escape_string2($connection_name);
    $q = new mysql();
    $q->QUERY_SQL("INSERT IGNORE INTO `openvpn_clients` (uid,ComputerOS) VALUES ('{$connection_name}','{$_POST["ComputerOS"]}')", "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
}
开发者ID:articatech,项目名称:artica,代码行数:21,代码来源:index.openvpn.build.client.php

示例12: group_new

function group_new()
{
    $q = new mysql();
    if (!$q->TABLE_EXISTS("haproxy_backends_groups", "artica_backup")) {
        $q->BuildTables();
    }
    $rulename = url_decode_special_tool($_POST["group-new"]);
    $servicename = trim($_POST["servicename"]);
    $rulename = str_replace(" ", "", $rulename);
    $rulename = str_replace("-", "_", $rulename);
    $rulename = str_replace("'", "", $rulename);
    $rulename = replace_accents($rulename);
    $rulename = mysql_escape_string2($rulename);
    $default = 0;
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT count(*) as tcount FROM haproxy_backends_groups WHERE servicename='{$servicename}' AND `default`=1", "artica_backup"));
    if (intval($ligne["tcount"]) == 0) {
        $default = 1;
    }
    $q->QUERY_SQL("INSERT INTO haproxy_backends_groups (groupname,servicename,`default`) VALUES ('{$rulename}','{$servicename}','{$default}')", "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
    }
}
开发者ID:articatech,项目名称:artica,代码行数:23,代码来源:haproxy.groups.php

示例13: slug_gen

function slug_gen($url) {
	// everything to lower and no spaces begin or end
	$url = replace_accents($url);
	$url = strtolower(trim($url));
 
	//replace accent characters, depends your language is needed
	//$url=replace_accents($url);
 
	// decode html maybe needed if there's html I normally don't use this
	//$url = html_entity_decode($url,ENT_QUOTES,'UTF8');
 
	// adding - for spaces and union characters
	$find = array(' ', '&', '\r\n', '\n', '+',',');
	$url = str_replace ($find, '-', $url);
 
	//delete and replace rest of special chars
	$find = array('/[^a-z0-9\-]/', '/[\-]+/', '/<[^>]*>/');
	$repl = array('', '-', '');
	$url = preg_replace ($find, $repl, $url);
 
	//return the friendly url
	return $url;
}
开发者ID:nargotik,项目名称:Cultural-Test,代码行数:23,代码来源:site_functions.php

示例14: free_categorizeSave


//.........这里部分代码省略.........
         }
         if (preg_match("#\\.php\$#", $www, $re)) {
             echo "{$www} php script...\n";
             continue;
         }
         $www = str_replace("/", "", $www);
         $www = trim($www);
         if ($ForceExt == 0) {
             if (!preg_match("#\\.([a-z0-9]+)\$#", $www, $re)) {
                 echo "`{$www}` No extension !!?? \n";
                 continue;
             }
             if (strlen($re[1]) < 2) {
                 if (!is_numeric($re[1])) {
                     echo "{$www} bad extension `.{$re[1]}` [{$ForceExt}]\n";
                     continue;
                 }
             }
         }
         $www = str_replace('"', "", $www);
         writelogs("Success pass {$www}", __FUNCTION__, __FILE__, __LINE__);
         $websitesToscan[] = $www;
     }
     while (list($num, $www) = each($websitesToscan)) {
         $cleaned[$www] = $www;
     }
     $websitesToscan = array();
     while (list($num, $www) = each($cleaned)) {
         $websitesToscan[] = $www;
     }
     while (list($num, $www) = each($websitesToscan)) {
         writelogs("Scanning {$www}", __FUNCTION__, __FILE__, __LINE__);
         $www = strtolower($www);
         $www = replace_accents($www);
         if ($www == "www") {
             continue;
         }
         if ($www == "ssl") {
             continue;
         }
         $www = str_replace("http://", "", $www);
         $www = str_replace("https://", "", $www);
         $www = str_replace("ftp://", "", $www);
         $www = str_replace("ftps://", "", $www);
         if (preg_match("#.+?@(.+)#", $www, $ri)) {
             $www = $ri[1];
         }
         if (preg_match("#^www\\.(.+?)\$#i", $www, $ri)) {
             $www = $ri[1];
         }
         if ($ForceCat == 0) {
             if ($this->already_Cats($www)) {
                 continue;
             }
         }
         if (strpos($www, '"') > 0) {
             $www = substr($www, 0, strpos($www, '"'));
         }
         if (strpos($www, "'") > 0) {
             $www = substr($www, 0, strpos($www, "'"));
         }
         if (strpos($www, ">") > 0) {
             $www = substr($www, 0, strpos($www, ">"));
         }
         if (strpos($www, "?") > 0) {
             $www = substr($www, 0, strpos($www, "?"));
开发者ID:articatech,项目名称:artica,代码行数:67,代码来源:class.mysql.squid.builder.php

示例15: TEMPLATE_ADD_SAVE

function TEMPLATE_ADD_SAVE()
{
    $users = new usersMenus();
    if (!$users->CORP_LICENSE) {
        $tpl = new templates();
        echo $tpl->javascript_parse_text("{MOD_TEMPLATE_ERROR_LICENSE}");
        return;
    }
    if ($_POST["template_uri"] != null) {
        if (!preg_match("#^http#", $_POST["template_uri"])) {
            $_POST["template_uri"] = "http://" . $_POST["template_uri"];
        }
    }
    if ($_POST["status_code"] != null) {
        if ($_POST["status_code"] > 0) {
            $_POST["template_uri"] = "{$_POST["status_code"]}:{$_POST["template_uri"]}";
        }
    }
    if ($_POST["freewebs_compliance"] == 1) {
        $_POST["template_uri"] = $_POST["template_uri"] . "%FREEWEBS%";
    }
    $tpl_name = $_POST["template_name"];
    $tpl_name = replace_accents($tpl_name);
    $tpl_name = str_replace(" ", "_", $tpl_name);
    $tpl_name = str_replace("-", "_", $tpl_name);
    $tpl_name = str_replace("/", "_", $tpl_name);
    $tpl_name = str_replace("\\", "_", $tpl_name);
    $tpl_name = str_replace(".", "_", $tpl_name);
    $tpl_name = str_replace(";", "_", $tpl_name);
    $tpl_name = str_replace(",", "_", $tpl_name);
    $tpl_name = str_replace("?", "_", $tpl_name);
    $tpl_name = str_replace("\$", "_", $tpl_name);
    $tpl_name = str_replace("%", "_", $tpl_name);
    $tpl_name = str_replace("{", "_", $tpl_name);
    $tpl_name = str_replace("}", "_", $tpl_name);
    $tpl_name = str_replace("[", "_", $tpl_name);
    $tpl_name = str_replace("]", "_", $tpl_name);
    $tpl_name = str_replace("(", "_", $tpl_name);
    $tpl_name = str_replace(")", "_", $tpl_name);
    $tpl_name = str_replace("\"", "_", $tpl_name);
    $tpl_name = str_replace("'", "_", $tpl_name);
    $tpl_name = str_replace("&", "_", $tpl_name);
    $tpl_name = strtoupper($tpl_name);
    $tpl_name = addslashes($tpl_name);
    $md5 = md5(serialize($_POST));
    $_POST["template_name"] = $tpl_name;
    $_POST["template_body"] = "<table class=\"w100 h100\"><tr><td class=\"c m\"><table style=\"margin:0 auto;border:solid 1px #560000\"><tr><td class=\"l\" style=\"padding:1px\"><div style=\"width:346px;background:#E33630\"><div style=\"padding:3px\"><div style=\"background:#BF0A0A;padding:8px;border:solid 1px #FFF;color:#FFF\"><div style=\"background:#BF0A0A;padding:8px;border:solid 1px #FFF;color:#FFF\"><h1>ERROR: The requested URL could not be retrieved</h1></div><div class=\"c\" style=\"font:bold 13px arial;text-transform:uppercase;color:#FFF;padding:8px 0\">Proxy Error</div><div style=\"background:#F7F7F7;padding:20px 28px 36px\"> <div id=\"titles\"> <h1>ERROR</h1> <h2>The requested URL could not be retrieved</h2> </div> <hr>  <div id=\"content\"> <p>The following error was encountered while trying to retrieve the URL: <a href=\"%U\">%U</a></p>  <blockquote id=\"error\"> <p><b>Access Denied.</b></p> </blockquote>  <p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>  <p>Your cache administrator is <a href=\"mailto:%w%W\">%w</a>.</p> <br> </div>  <hr> <div id=\"footer\"> <p>Generated %T by %h (%s)</p> <!-- %c --> </div> </div></div></div></td></tr></table></td></tr></table>";
    while (list($num, $line) = each($_POST)) {
        $_POST[$num] = addslashes($line);
    }
    $sql = "INSERT IGNORE INTO squidtpls (zmd5,template_name,template_title,lang,template_body,template_link,template_uri,emptytpl) \n\tVALUES ('{$md5}','{$_POST["template_name"]}','{$_POST["template_title"]}','{$_POST["lang"]}',\n\t'{$_POST["template_body"]}','{$_POST["template_link"]}','{$_POST["template_uri"]}','{$_POST["emptytpl"]}')";
    if (strlen($_POST["templateid"]) > 5) {
        $sql = "UPDATE squidtpls SET \n\t\t\t\ttemplate_name='{$_POST["template_name"]}',\n\t\t\t\ttemplate_title='{$_POST["template_title"]}',\n\t\t\t\tlang='{$_POST["lang"]}',\n\t\t\t\temptytpl='{$_POST["emptytpl"]}',\n\t\t\t\ttemplate_link='{$_POST["template_link"]}',\n\t\t\t\ttemplate_uri='{$_POST["template_uri"]}'\n\t\t\t\tWHERE zmd5='{$_POST["templateid"]}'";
    }
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $q = new mysql_squid_builder();
    if (!$q->FIELD_EXISTS("squidtpls", "emptytpl")) {
        $q->QUERY_SQL("ALTER TABLE `squidtpls` ADD `emptytpl` smallint(1)  NOT NULL");
    }
    $q->CheckTables();
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
        writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("squid.php?build-templates=yes&zmd5={$md5}");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:69,代码来源:squid.templates.php


注:本文中的replace_accents函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。