public function Load_Options_Page() { # Check if the user trys to delete a template if (isset($_GET['delete']) && $this->core->Get_Template_Properties($_GET['delete'])) { # You can only delete Fancy Gallery Templates! Unlink($_GET['delete']); WP_Redirect($this->Get_Options_Page_Url(array('template_deleted' => 'true'))); } elseif (isset($_GET['delete'])) { WP_Die($this->t('Error while deleting: ' . $_GET['delete'])); } # If the Request was redirected from a "Save Options"-Post if (isset($_REQUEST['options_saved'])) { Flush_Rewrite_Rules(); } # If this is a Post request to save the options $options_saved = $this->Save_Options(); $template_installed = $this->core->Install_Template(); if ($options_saved && $template_installed) { WP_Redirect($this->Get_Options_Page_Url(array('options_saved' => 'true', 'template_installed' => 'true'))); } elseif ($options_saved) { WP_Redirect($this->Get_Options_Page_Url(array('options_saved' => 'true'))); } elseif ($template_installed) { WP_Redirect($this->Get_Options_Page_Url(array('template_installed' => 'true'))); } WP_Enqueue_Script('dashboard'); WP_Enqueue_Style('dashboard'); WP_Enqueue_Script('fancy-gallery-options-page', $this->core->base_url . '/options-page/options-page.js', array('jquery'), $this->core->version, True); WP_Enqueue_Style('fancy-gallery-options-page', $this->core->base_url . '/options-page/options-page.css'); # Remove incompatible JS Libs WP_Dequeue_Script('post'); }
function delete_folder($directory) { foreach ((array) $this->get_subfolder($directory) as $folder) { $this->delete_folder($folder); } foreach ((array) $this->get_files($directory) as $file) { Unlink($file); } RmDir($directory); }
/** * Constructor of the object. * Generates the table for ANSEL to Unicode mapping. * @param String $conversionFile The name of the mapping file made by Heiner Eichmann. * The file can be downloaded FROM this URL: * http://www.heiner-eichmann.de/gedcom/ans2uni.con.zip */ public function __construct($conversion_file = 'ans2uni.con') { $temp_ini_file = 'mappings.ini'; // Name of temporary ini file if (File_exists($conversion_file)) { // Load file contents, convert into well-formed ini file for later parsing. // This is done because the original mapping file cannot be parsed by the // PHP function parse_ini_file. $file_contents = File_get_contents($conversion_file, 'FILE_BINARY'); // Load contents $file_contents = $this->strip_comments($file_contents, '#'); // Strip comments File_put_contents($temp_ini_file, $file_contents); // Save contents // Get ini contents $map = Parse_ini_file($temp_ini_file); // Parse ini file // Go through map to split up the mappings that contain more characters in the key, // so that mappings with one character goes into $this->mapping[1], those with two // characters goes to $this->mapping[2] etc. foreach ($map as $key => $value) { $characters = explode('+', $key); // Split string where '+' occurrs $num_chars = count($characters); // count number of characters $this->_mapping[$num_chars][Strtolower($key)] = $value; // Put mapping in right place } // Delete temporary ini file efterwards if exists if (File_exists($temp_ini_file)) { Unlink($temp_ini_file); } } else { echo '<p>No mapping file with name ' . $conversion_file . ' exists. Download this file ' . 'from <a href="http://www.heiner-eichmann.de/gedcom/ans2uni.con.zip">here</a>.'; } }
if ($icon!="" && file_exists($icon) && (!$delete_icon)) { $filename=strtolower(basename($icon_name)); $ext=strtolower(end(explode(".",basename($icon_name)))); if ( (filesize($icon)<=(0*1024) || 0==0) && (Is_Integer(strpos('gif jpg png', $ext))) ) { $filename=$rec["ID"]."_icon_".time().".".$ext; if ($rec["ICON"]!='') { @Unlink(ROOT.'./cms/calendar/'.$rec["ICON"]); } Copy($icon, ROOT.'./cms/calendar/'.$filename); $rec["ICON"]=$filename; SQLUpdate($table_name, $rec); } } elseif ($delete_icon) { @Unlink(ROOT.'./cms/calendar/'.$rec["ICON"]); $rec["ICON"]=''; SQLUpdate($table_name, $rec); } $out['OK']=1; } else { $out['ERR']=1; } } if (is_array($rec)) { foreach($rec as $k=>$v) { if (!is_array($v)) { $rec[$k]=htmlspecialchars($v); } } }
global $mib_file_name; global $delete_mib_file; if ($mib_file != "" && file_exists($mib_file) && !$delete_mib_file) { $filename = strtolower(basename($mib_file_name)); $ext = strtolower(end(explode(".", basename($mib_file_name)))); if (filesize($mib_file) <= 0 * 1024 || 0 == 0) { $filename = $rec["ID"] . "_mib_file_" . time() . "." . $ext; if ($rec["MIB_FILE"] != '') { @Unlink(ROOT . './cms/snmpdevices/' . $rec["MIB_FILE"]); } Copy($mib_file, ROOT . './cms/snmpdevices/' . $filename); $rec["MIB_FILE"] = $filename; SQLUpdate($table_name, $rec); } } elseif ($delete_mib_file) { @Unlink(ROOT . './cms/snmpdevices/' . $rec["MIB_FILE"]); $rec["MIB_FILE"] = ''; SQLUpdate($table_name, $rec); } if ($rec['ID']) { $properties = SQLSelect("SELECT * FROM snmpproperties WHERE DEVICE_ID='" . $rec['ID'] . "'"); $total = count($properties); for ($i = 0; $i < $total; $i++) { global ${'oid_' . $properties[$i]['ID']}; global ${'type_' . $properties[$i]['ID']}; global ${'ptitle_' . $properties[$i]['ID']}; global ${'pvalue_' . $properties[$i]['ID']}; global ${'pinterval_' . $properties[$i]['ID']}; global ${'linked_object_' . $properties[$i]['ID']}; global ${'linked_property_' . $properties[$i]['ID']}; if (!${'oid_' . $properties[$i]['ID']}) {
<?php Unlink("json/home.json"); echo "กำลังประมวลผลใหม่อีกครั้ง";
global $image_name; global $delete_image; if ($image != "" && file_exists($image) && !$delete_image) { $filename = strtolower(basename($image_name)); $ext = strtolower(end(explode(".", basename($image_name)))); if ((filesize($image) <= 0 * 1024 || 0 == 0) && Is_Integer(strpos('gif jpg png', $ext))) { $filename = $rec["ID"] . "_image_" . time() . "." . $ext; if ($rec["IMAGE"] != '') { @Unlink(ROOT . './cms/products//' . $rec["IMAGE"]); } Copy($image, ROOT . './cms/products//' . $filename); $rec["IMAGE"] = $filename; SQLUpdate($table_name, $rec); } } elseif ($delete_image) { @Unlink(ROOT . './cms/products//' . $rec["IMAGE"]); $rec["IMAGE"] = ''; SQLUpdate($table_name, $rec); } $out['OK'] = 1; } else { $out['ERR'] = 1; } } // step: default if ($this->tab == '') { //options for 'Category' (select) $tmp = SQLSelect("SELECT ID, TITLE FROM product_categories ORDER BY TITLE"); $categories_total = count($tmp); for ($categories_i = 0; $categories_i < $categories_total; $categories_i++) { $category_id_opt[$tmp[$categories_i]['ID']] = $tmp[$categories_i]['TITLE'];
function Img($Image, $Dw = 200, $Dh = 300, $Type = 2) { if (!File_Exists($Image)) { return False; } #如果需要生成缩略图,则将原图拷贝一下重新给$Image赋值 // IF($Type!=1){ Copy($Image, Str_Replace(".", "_x.", $Image)); $Image = Str_Replace(".", "_x.", $Image); // } var_dump($Image); #取得文件的类型,根据不同的类型建立不同的对象 $ImgInfo = GetImageSize($Image); var_dump($ImgInfo); switch ($ImgInfo[2]) { case 1: $Img = @ImageCreateFromGIF($Image); break; case 2: $Img = @ImageCreateFromJPEG($Image); break; case 3: $Img = @ImageCreateFromPNG($Image); break; } #如果对象没有创建成功,则说明非图片文件 if (empty($Img)) { #如果是生成缩略图的时候出错,则需要删掉已经复制的文件 if ($Type != 1) { Unlink($Image); } return False; } #如果是执行调整尺寸操作则 if ($Type == 1) { $w = ImagesX($Img); $h = ImagesY($Img); $width = $w; $height = $h; if ($width > $Dw) { $Par = $Dw / $width; $width = $Dw; $height = $height * $Par; if ($height > $Dh) { $Par = $Dh / $height; $height = $Dh; $width = $width * $Par; } } elseif ($height > $Dh) { $Par = $Dh / $height; $height = $Dh; $width = $width * $Par; if ($width > $Dw) { $Par = $Dw / $width; $width = $Dw; $height = $height * $Par; } } else { $width = $width; $height = $height; } $nImg = ImageCreateTrueColor($width, $height); #新建一个真彩色画布 ImageCopyReSampled($nImg, $Img, 0, 0, 0, 0, $width, $height, $w, $h); #重采样拷贝部分图像并调整大小 ImageJpeg($nImg, $Image); #以JPEG格式将图像输出到浏览器或文件 return True; #如果是执行生成缩略图操作则 } else { $w = ImagesX($Img); $h = ImagesY($Img); $width = $w; $height = $h; $nImg = ImageCreateTrueColor($Dw, $Dh); if ($h / $w > $Dh / $Dw) { #高比较大 $width = $Dw; $height = $h * $Dw / $w; $IntNH = $height - $Dh; ImageCopyReSampled($nImg, $Img, 0, -$IntNH / 1.8, 0, 0, $Dw, $height, $w, $h); } else { #宽比较大 $height = $Dh; $width = $w * $Dh / $h; $IntNW = $width - $Dw; ImageCopyReSampled($nImg, $Img, -$IntNW / 1.8, 0, 0, 0, $width, $Dh, $w, $h); } ImageJpeg($nImg, $Image); return True; } }
function UnikData($data = '', $db = 'titre', $size = 10) { $res = ''; $sup = $_ENV['ksup']; $s[] = "origindata:" . $data; if (RS == 404) { return; } if (!isgoodurl() or preg_match("~url.data:|image/png;|base64|/(adtech|iframeproxy)~", U) or e(',badurl', 1)) { return; } static $trig; if (!$trig) { Gt('unikdata:start'); $trig = 1; } #Returns only unique Array Data ! For Titles + descriptions (1Mo + 13ms) if (strpos(u3, '.jpg')) { return; } $rev = 1342976292; Gt('udata'); $u = $db . ':' . hu3; #Maj if ($y = param($data, '&')) { extract($y); } #extraction paramètres ...? $origin = Rem($data, CLT(surl)); $data = trim(str_replace(array('»', 'Â', '£', 'N%253BO=D'), ' ', $data), '!?»,. '); if (!$_ENV['auth']) { $u = Preg_Replace("~(#|\\?|&).*~", '', $u); } else { $u = Preg_Replace("~[#|\\?|&][^(&|\\?)" . $_ENV['auth'] . "]+~", '', $u); } #!genius!really nice syntax-"~(#|\?|&)[^(".$_ENV['auth'].")].*~" while (strlen($data) < $size && $sup) { $next = Array_shift($sup); if (!stripos($data, $next)) { $data .= ' ' . $next; } } #push ksup inside if (strpos(SURL, '?', 0)) { Preg_match_all("~=([^&]+)~is", SURL, $t); if ($t) { $t = $t[1]; $data .= ' ' . implode(' ', $t); } } #si titre similaire, pusher le query string $ret = $data; #av("data:$data db:$db ret:$ret".pre($s)); ###Si pas de résultats : invalider le record en placant un "1" dessus if (1 or H == 'a74.fr') { $arg = 'no=1,bd=' . sip; $prev = array(); #previously db -> comes to mysql unikdata:id,url,db,data,score #CREATE TABLE `unikdata`(`id` INT(8) NOT NULL AUTO_INCREMENT PRIMARY KEY,`url` VARCHAR(255) NOT NULL,`data` TEXT NOT NULL,`score` INT(5) NOT NULL) ENGINE = MYISAM;#`db` VARCHAR(25) NOT NULL, $s[] = "select sql_cache data from " . DB . ".unikdata where url=\"{$u}\""; $x = sql5(['cache' => 1, 'sql' => end($s)], "bd=" . sip) or $noexist = 1; #if(strpos(U,'webcam.php')){print_r(compact('y','s','u','x'));die;} $s[] = "result:" . count($x) . "/" . $x . "/data:" . $data; if ($x == $data) { return $data; } else { #on défini le score puis On recherche si des correspondances existent déjà if (!Q && e('tprio,forcetitre', 1)) { $score[$u] = 0; } else { $score[$u] = substr_count(u, '/') * 20 + substr_count(u, '?') * 10 + substr_count(u, '&') * 10 + strlen(u); } /*Score de lui même*/ $datas[$u] = $data; $s[] = "select sql_cache url,score from " . DB . ".unikdata where data=\"{$data}\" and url<>\"{$u}\" and left(url,6) rlike'{$db}:" . H . ".*' order by score asc"; $y = sql5(['cache' => 1, 'sql' => end($s)], $arg); /* select * from ben.unikdata where url='titre:a74.fr/z/webcam.php'; select sql_cache url,score from ben.unikdata where data="Webcams Ski Haute Savoie" and url<>"titre:a74.fr/z/webcam.php" and left(url,6) rlike'titre:a74.fr.*' order by score asc insert into ben.unikdata(url,data,score)VALUES("titre:a74.fr/z/webcam.php","Webcams Ski Haute Savoie","32") */ #Si une ou plusieurs Pages have the same results if ($y) { if (!is_array($y)) { $y = [$y]; } foreach ($y as $t) { $score[$t['url']] = $t['score']; $datas[$t['url']] = $data; } } if (count($score) == 1) { if ($noexist) { return $data; $s[] = "insert ignore into " . DB . ".unikdata(url,data,score)VALUES(\"{$u}\",\"{$data}\",\"{$score[$u]}\")"; sql5(end($s), $arg); } else { return $data; $s[] = "update " . DB . ".unikdata set data=\"{$data}\",score=\"{$score[$u]}\" where url=\"{$u}\""; $x = sql5(end($s), $arg); } #Non car le score est unique ! #if($db=='titre')DbM('unikdata',surl."<li>db?$db / ".hu3."->$data<li>noexist?$noexist<li>sql:".pre($s)."<li>score:".pre($score)."<li>datas:".pre($datas)."<li>res:".pre($res)."<li>GT:".pre($_ENV['dbt']),1); return $data; } else { #si plusieurs résultats pour mêmes données, il peut exister des similarités .. $s[] = "select sql_cache url,data,score from " . DB . ".unikdata where data rlike(\"{$data}*\") and url rlike'{$db}:" . H . ".*' and url<>\"{$u}\" order by score asc"; $y = sql5(['cache' => 1, 'sql' => end($s)], $arg); #les autres résultats proches, on s'en tape ! if ($y) { foreach ($y as $t) { $score[$t['url']] = $t['score']; $datas[$t['url']] = $t['data']; } } Asort($score); foreach ($score as $url => $v) { #calcul des doublons et population de la matrice des résultats $n = 0; $t2 = $temp = $datas[$url]; while (in_Array(accents(strtolower($t2)), $prev) && $n < 20) { #déjà un doublon de score inférieur - 20 opérations maximum if ($trig != 'chiffres' && Preg_match_all("~([0-9]+)~", u, $m)) { $n++; $i = implode('', $m[1]); $t2 = $temp . " {$i}"; $trig = 'chiffres'; continue; } $i++; $t2 = $temp . " {$i}"; #sinon on incrémente } $res[$url] = $t2; $prev[] = accents(strtolower($t2)); #les scores les plus pourris ramassent la merde if ($url == $u) { $ret = $t2; } #calcule le retour pour l'url courante } foreach ($res as $url => $v) { if ($noexist && $url == $u) { $s[] = "insert into " . DB . ".unikdata(url,data,score)VALUES(\"{$u}\",\"{$v}\",\"{$score[$u]}\")"; sql5(end($s), $arg); continue; } $s[] = "update " . DB . ".unikdata set data=\"{$v}\" where url=\"{$url}\""; sql5(end($s), $arg); #Il est possible que l'url courante n'aie pas d'enregistrements !!! } } if ($db == 'titre') { DbM('unikdata', surl . "<li>db?{$db} / " . hu3 . "->{$data}<li>noexist?{$noexist}<li>sql:" . pre($s) . "<li>score:" . pre($score) . "<li>datas:" . pre($datas) . "<li>res:" . pre($res) . "<li>GT:" . pre($_ENV['dbt']), 1); } return $ret; } } else { $u = u3; #local db mode if ($db == 'titre' && filemtime(DR . $db . '.db') < $rev) { Unlink(DR . $db . '.db'); } #Unlink the whole file #if(!strpos(u3,'=')&&$_ENV['soloQ'])$u=Preg_replace("~\?(?!({$_ENV['soloQ']})).*~is",'',u3);#déjà calculée dans autoappend #Determine unique Array 1 while (strlen($data) < $size && $_ENV['ksup']) { $next = Array_shift($_ENV['ksup']); if (!stripos($data, $next)) { $data .= ' ' . $next; } } #push ksup inside Rem($key, $u, 'index'); $x = FGC(DR . $db . '.db'); #if(J9)die(pre($x)); if ($x[$key] && now > $_ENV['rev'] && !strpos($_ENV['args'], 'forcetitre')) { return $x[$key]; } #Si la clé date d'avant la dernière révision on la retourne if ($x[$key] != $data) { #différente ou non définie $score[$key] = substr_count(u, '/') * 20 + substr_count(u, '?') * 10 + substr_count(u, '&') * 10 + strlen(u); #Score de lui même if (strpos($_ENV['args'], ',tprio')) { $score[$key] = 0; } if (strpos(surl, '?', 0)) { Preg_match_all("~=([^&]+)~is", surl, $t); if ($t) { $t = $t[1]; $data .= ' ' . implode(' ', $t); } #si titre similaire, ajouter le query string } #Cas 1 : il y a un chiffre dans l'url et il est différent des titres des autres, s'il y a déjà un chiffre, on remplace ce dernier par 156 if (is_Array($x)) { null; } else { dbM("x is not array-no f*****g way:{$x[$key]}§" . pre($x)); } #elseif(!$x){dbM("uniktitre:x is null ?? wtf ??");return;} $y = Array_map('strtolower', $x); $e = print_r(error_get_last(), 1); #if(stripos($e,'array given'))dBM("uniktitre:$db:{$x[$key]}\n<br>err:".pre($e)."\n<Br>y:".pre($y)."<Br>x:".pre($x)); $found = array_keys($y, strtolower($data)); #Arrive très souvent..; if (count($found) && Preg_match_all("~([0-9]+)~", u, $m)) { #avec des chiffres à injecter dans le titre $i = implode('', $m[1]); $data = $origin . " {$i}"; $found = array_keys($y, strtolower($data)); #last verif if (count($found) < 1) { FAP("tx=1&file=" . DR . $db . '.db', array($u => $data)); db('found:numbers injected in title'); return $data; } #Ok si aucun doublon } if (count($found)) { #des doublons de titres ont été trouvés foreach ($found as $k2) { #si les scores sont égaux, on ne pourra la comparer à un autre numéro.. $score[$k2] = substr_count($k2, '/') * 20 + substr_count($k2, '?') * 10 + substr_count($k2, '&') * 10 + strlen($k2); if ($k2 == 'index') { $score[$k2] = 0; } #raz page 0 } Asort($score); $os = $score; foreach ($score as $k => $v) { #Remplacer le score par les valeurs titre while (in_array($data, $score) && $n < 10) { $n++; $i++; $data = $origin . " {$i}"; } if ($n > 10) { Dbm("{$db} n:{$n}; data:" . pre($data) . "score:" . pre($score)); } $score[$k] = $data; GT('whilescore'); #crée autant } #if($score[0]==$score[self])Best=1;swap titles #if(count($score)<2)$score=end($score); FAP("tx=2,{$key}&file=" . dr . $db . '.db', $score); #DbM('unikdata',surl."<li>data:$data<li>x[key]:".print_r($x[$key],1)."<li>found:".print_r($found,1)."<li>score:".print_r($os,1)."<li>res:".print_r($score,1)); return $score[$key]; } if ($x[$key] && now > $_ENV['rev'] && !strpos($_ENV['args'], 'forcetitre')) { return $x[$key]; } } #swap those values pour url prioritaire!!! if ($x[$key] && now > $_ENV['rev'] && !strpos($_ENV['args'], 'forcetitre')) { return $x[$key]; } #ajouter ici les valeurs des query strings ! if ($data && $key) { FAP("tx=3,{$key}&file=" . dr . $db . '.db', $key, $data); gt('l' . __LINE__); return $data; } DB(surl . ':notitle found:' . count($found) . 'x[key]' . $x[$key] . 'data:' . $data . 'origin:' . $origin); } }
<?php Unlink("json/report1.json"); Unlink("json/report2.json"); echo "กำลังประมวลผลใหม่อีกครั้ง";
static function Unlink($pszFilename) { return Unlink($pszFilename); }
function clean_cache() { // Clean Cache files - This point will only be passed if there was a new cache file written! foreach (Glob($this->cache_dir_path . '*') as $file) { // Delete Files which were not used the last 23 days if (FileATime($file) < Time() - 23 * 24 * 3600) { Unlink($file); } } }