etat="on"; foreach ($this->real_cat as $cat) { $this->etat = ((file_exists($cat.'/thumbnail/.htaccess')) and ( $this->etat=="on" )) ? "on" : "off" ; } } else { $this->etat="off"; } } function hotblock_dir($dir,$tn) { $htaccess_content ="RewriteEngine on \n"; $htaccess_content.="RewriteCond %{HTTP_REFERER} !^$ \n"; $htaccess_content.="RewriteCond %{HTTP_REFERER} !^"."http://".$_SERVER["HTTP_HOST"]."/".".*$ [NC] \n"; $htaccess_content.="RewriteRule .*\.*$ " . get_absolute_root_url(1) . "plugins/hotbloker/img/bloked.gif [NC] \n"; if ($tn) { $htaccess_content = "RewriteEngine on \n"; $htaccess_content.= "RewriteRule ^.*$ -"; } $file = fopen( $dir.'/.htaccess', 'w' ); fwrite($file, $htaccess_content ); fclose( $file ); if (!$tn) { foreach ($this->real_cat as $cat) { //hotfree_dir($cat); if (file_exists($cat.'/thumbnail')) $this->hotblock_dir($cat.'/thumbnail',1); } } } function hotfree_dir($dir,$tn) { if (file_exists($dir.'/.htaccess')) { unlink($dir.'/.htaccess'); } if (!$tn) { foreach ($this->real_cat as $cat) { $this->hotfree_dir($cat.'/thumbnail',1); } } } function plugin_admin_menu($menu) { array_push($menu, array( 'NAME' => 'HotBlocker', 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/hb_admin.php') ) ); return $menu; } function list_path_of_real_cat() { $list="";$real_cat=array(); $query = 'SELECT `id` FROM '.CATEGORIES_TABLE.' WHERE `dir` != \'NULL\';'; $cat = pwg_query($query); if (empty($cat)) return null; while ($row=mysql_fetch_row($cat)) { array_push($real_cat,$row[0]); } $this->real_cat = get_fulldirs($real_cat); } } $obj = new HB(); add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') ); set_plugin_data($plugin['id'], $obj) ?>