XPressME Integration Kit

Trac

Changeset 96


Ignore:
Timestamp:
Mar 6, 2009, 5:16:22 PM (15 years ago)
Author:
toemon
Message:

途中経過でインストール、アップデートできなくなってしまっていたバグ修正
イベント通知の部分をFix、(ゲストのモジュールアクセス権限がないと通知できないのは直らない)
ブロックのキャッシュを見直し、キャッシュがない場合と、ブロックオプションが変更された場合にリフレッシュする機能を追加
ブロックキャッシュの更新にてポスト削除時のイベントをDB削除前にとっていたバグを修正。

Location:
trunk
Files:
1 added
2 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/oninstall.php

    r89 r96  
    5151        wp_cache_flush(); 
    5252        make_db_current_silent(); 
     53        $ret[] = "The data base of wordpress was made by prefix $table_prefix."; 
    5354         
    5455        $option_desc = __('WordPress web address'); 
     
    6768        update_option("home", $site_url); 
    6869        update_option("siteurl", $site_url); 
     70        update_option("what_to_show", "posts"); 
     71        update_option('default_pingback_flag', 0); 
     72        $ret[] = 'The initial data was written in the data base of wordpress.'; 
     73         
    6974        update_option("template", "xpress_default"); 
    7075        update_option("stylesheet", "xpress_default"); 
    71         update_option("what_to_show", "posts"); 
    72  
     76        $ret[] = 'The default theme of wordpress was set to xpress_default.'; 
    7377        /* add new option for uploads */ 
    7478//      update_option('uploads_use_yearmonth_folders', 1); 
    7579//      update_option('upload_path', $module->getVar("dirname")); 
    7680         
     81                 
     82// Admin User Data write 
     83        // Change uid field 
     84        $wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'"); 
     85        $user_name = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uname"):'admin'; 
     86        $email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com'; 
     87        $pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):''; 
     88         
     89        $user_id = username_exists($user_name); 
     90        if ( !$user_id ) { 
     91                $random_password = 'admin'; 
     92                $user_id = wp_create_user($user_name, $random_password, $email); 
     93        } else { 
     94                $random_password = __('User already exists.  Password inherited.'); 
     95        } 
     96 
     97        $user = new WP_User($user_id); 
     98        $user->set_role('administrator'); 
     99        'User ' . $user_name . ' of the administrator was made.'; 
     100        // over write xoops md5 password  
     101        $sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id"; 
     102        $wpdb->query($sql); 
     103        $ret[] = 'The password of XOOPS was copied.'; 
     104        // Set Default data 
     105        wp_install_defaults($user_id); 
     106        $ret[] = 'The first sample post & comment was written.'; 
     107//          generate_page_uri_index(); 
     108 
    77109        /* activate the XPressME plugin */ 
    78110        $plugin_current = "xpressme/xpressme.php"; 
     
    80112        include_once(dirname(__FILE__) . '/../wp-content/plugins/'.$plugin_current); 
    81113        do_action('activate_'.$plugin_current); 
    82                  
    83 // Admin User Data write 
    84         // Change uid field 
    85         $wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'"); 
    86         $ID = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uid"):1; 
    87 //      require_once($mydirpath . '/include/user_sync.php'); 
    88         $sync_messg = ''; 
    89 //      user_sync_to_wordpress($ID,$sync_messg);                //this function in XPressME plugin  
    90  
    91         // Set Default data 
    92                 wp_install_defaults($ID); 
    93 //          generate_page_uri_index(); 
    94  
    95                  
     114        $ret[] = 'The xpressme plug-in was activated.'; 
     115         
    96116        // create views table 
    97117        $xp_prefix = $mydirname; 
     
    115135 
    116136        dbDelta($views_queries); 
     137        $ret[] = "$views_table table of XPressME was made."; 
     138 
    117139         
    118140        $d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ; 
     
    124146                )$charset_collate;"; 
    125147        dbDelta($views_queries); 
     148        $ret[] = "$d3forum_link table of XPressME was made."; 
    126149         
    127150        $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ; 
     
    136159                )$charset_collate;"; 
    137160        dbDelta($views_queries); 
     161        $ret[] = "$group_role table of XPressME was made."; 
     162 
    138163        $sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')"; 
    139164        $wpdb->query($sql); 
  • trunk/include/onupdate.php

    r89 r96  
    4646                }                                
    4747        } 
     48 
    4849        /* activate the tag plugin */ 
    4950        $plugin_current = "xpressme/xpressme.php"; 
  • trunk/include/request_url.php

    r95 r96  
    1313 */ 
    1414function check_page_call($check_file =''){ 
    15         global $xoops_config; 
     15        global $xoops_config;   // not object at install 
    1616        if (empty($check_file)) return false; 
    17         $xpress_page =  $xoops_config->module_name . '/' . $check_file; 
     17        $xpress_page =  basename(dirname(dirname(__FILE__))) . '/' . $check_file; 
    1818        $php_script_name = $_SERVER['SCRIPT_NAME']; 
    1919        $php_query_string = $_SERVER['QUERY_STRING']; 
     
    4949        return $ret; 
    5050} 
     51 
     52function is_xpress_install_call(){ 
     53        $action = 'action=ModuleInstall&dirname='; 
     54        $php_script_name = $_SERVER['SCRIPT_NAME']; 
     55        $php_query_string = $_SERVER['QUERY_STRING']; 
     56        if (strstr($php_query_string,$action) !== false) return true; 
     57        return false; 
     58} 
    5159?> 
  • trunk/include/xpress_block_render.php

    r95 r96  
    9999        } 
    100100         
     101    function xpress_block_cache_found($mydirname,$block_name) 
     102    { 
     103        global $xoops_config; 
     104        if(defined('XOOPS_ROOT_PATH')){ 
     105                $cache_dir = XOOPS_ROOT_PATH . '/cache/'; 
     106        } else { 
     107                $cache_dir = $xoops_config->xoops_root_path . '/cache/'; 
     108        } 
     109        $xml_name = $block_name . '.xml'; 
     110 
     111        $filename = $cache_dir .$mydirname . '_' . $xml_name; 
     112                $cache_time = 0; 
     113//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { 
     114        if (file_exists($filename)) { 
     115            return true; 
     116       } else { 
     117                        return false; 
     118                } 
     119    }  
     120         
    101121        function xpress_block_render($mydirname,$block_function_name,$options) 
    102122        { 
     
    108128                $blockID =get_block_id($mydirname,$func_file,$options);          
    109129 
    110                 if (!is_null($wpdb)){ 
     130                $this_url = '/modules/'. $mydirname; 
     131                $call_url = $_SERVER['REQUEST_URI']; 
     132                if (strstr($call_url,$this_url)){ 
    111133                        xpress_block_css_set($mydirname); 
    112134                         
     
    114136                        require_once $block_theme_file; 
    115137                        $block = $call_theme_function_name($options);           //The block name and the called function name should be assumed to be the same name.  
    116  
    117 // Not Cache Write Now.  Becose Cache Write On WordPress Event                   
    118 //                      xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);   
    119138                } else { 
    120                         $xml = xpress_block_cache_read($mydirname,$cache_title. $blockID); 
    121                         $block = $xml['block']; 
     139                        if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){ 
     140                                $xml = xpress_block_cache_read($mydirname,$cache_title. $blockID); 
     141                                $block = $xml['block']; 
     142                        } else { 
     143                                $block['err_message'] = sprintf(_MB_XPRESS_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname .'</a>'); 
     144                        } 
    122145                } 
    123146 
  • trunk/include/xpress_cache.php

    r95 r96  
    11<?php 
    22         
     3if(!function_exists("xpress_cache_found")): 
     4    function xpress_cache_found($filename) 
     5    { 
     6                $cache_time = 0; 
     7//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { 
     8        if (file_exists($filename)) { 
     9            return true; 
     10       } else { 
     11                        return false; 
     12                } 
     13    }  
     14endif; 
     15 
    316if(!function_exists("xpress_cache_read")): 
    417    function xpress_cache_read($mydirname,$collation_key) 
    518    { 
    619        global $xoops_config; 
    7                 $cache_dir = $xoops_config->xoops_root_path . '/cache/'; 
    8                 $cache_time = 0; 
     20        if(defined('XOOPS_ROOT_PATH')){ 
     21                $cache_dir = XOOPS_ROOT_PATH . '/cache/'; 
     22        } else { 
     23                $cache_dir = $xoops_config->xoops_root_path . '/cache/'; 
     24        } 
    925        $filename = $cache_dir .$mydirname . '_' . $collation_key; 
    10 //        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { 
    11         if (file_exists($filename)) { 
     26        if (xpress_cache_found($filename)) { 
    1227            return file_get_contents($filename); 
    1328       } else { 
  • trunk/include/xpress_debug_log.php

    r95 r96  
    5757    } 
    5858} 
     59 
     60function xpress_error_handler($errno,$errstr,$errfile,$errline,$errcontext) { 
     61        $module_dirpath = dirname(dirname(__FILE__)); 
     62        $root_path = dirname(dirname(dirname(dirname(__FILE__)))); 
     63         
     64        $show_backtrace = true; 
     65 
     66        // Time stamp of error entry 
     67        $dt = date("Y-m-d H:i:s (T)"); 
     68 
     69        // define an assoc array of error string 
     70        // in reality the only entries we should 
     71        // consider are E_WARNING, E_NOTICE, E_USER_ERROR, 
     72        // E_USER_WARNING and E_USER_NOTICE 
     73        $errortype = array ( 
     74                E_ERROR          => "Error", 
     75                E_WARNING        => "Warning", 
     76                E_PARSE          => "Parsing Error", 
     77                E_NOTICE          => "Notice", 
     78                E_CORE_ERROR      => "Core Error", 
     79                E_CORE_WARNING    => "Core Warning", 
     80                E_COMPILE_ERROR  => "Compile Error", 
     81                E_COMPILE_WARNING => "Compile Warning", 
     82                E_USER_ERROR      => "User Error", 
     83                E_USER_WARNING    => "User Warning", 
     84                E_USER_NOTICE    => "User Notice", 
     85                E_STRICT          => "Runtime Notice" 
     86        ); 
     87        if (strstr($errstr, 'Use of undefined constant xpress_debug_message - assumed') !== false) return; 
     88        // set of errors for which a var trace will be saved 
     89        $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE); 
     90 
     91        $err = "<errorentry>\n"; 
     92        $err .= "\t<datetime>" . $dt . "</datetime>\n"; 
     93        $err .= "\t<errornum>" . $errno . "</errornum>\n"; 
     94        $err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n"; 
     95        $err .= "\t<errormsg>" . $errstr . "</errormsg>\n"; 
     96        $err .= "\t<scriptname>" . $errfile . "</scriptname>\n"; 
     97        $err .= "\t<scriptlinenum>" . $errline . "</scriptlinenum>\n"; 
     98        $err .= "\t<errcontext>" . $errcontext . "</errcontext>\n"; 
     99 
     100        if (in_array($errno, $user_errors)) { 
     101                $err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n"; 
     102        } 
     103        $err .= "</errorentry>\n\n"; 
     104 
     105        $err_trace = ''; 
     106        if ($show_backtrace){    
     107                $backtraces = array_reverse(debug_backtrace()); 
     108                $err_trace .= "BACK TRACE\n"; 
     109                foreach($backtraces as $backtrace){ 
     110                        $trace = @$backtrace['file']. "\tLINE(" . @$backtrace['line'] . ")\t" . @$backtrace['function']  . "()\n"; 
     111                        $trace = str_replace($root_path,"",$trace); 
     112                        $trace = str_replace("\\","/",$trace); 
     113                        $trace = str_replace($root_path,"",$trace); 
     114                        $trace = "\t" . $trace; 
     115                        $err_trace .= $trace; 
     116                } 
     117        } 
     118        $head = "\n***** XPressME ERROR LOG ****************************************************************************************************\n"; 
     119        $message = $head . $err . $err_trace; 
     120        $_debug_file = $module_dirpath . '/wp-content/xpress_error.log'; 
     121        if ($errno != E_STRICT) { 
     122                $_fp = fopen($_debug_file, 'a'); 
     123                fwrite($_fp, $message);  
     124                fclose($_fp); 
     125        } 
     126} 
    59127?> 
  • trunk/include/xpress_render.php

    r61 r96  
    1010        $pattern = "<style[^>]*?>(.*)<\/style>"; 
    1111        preg_match("/".$pattern."/s",  $head_str, $style_matches); 
    12         $style = $style_matches[0]; 
     12        if (empty($style_matches[0])) 
     13                $style = ''; 
     14        else 
     15                $style = $style_matches[0]; 
    1316  
    1417        $pattern = "<link(.*)>"; 
     
    9598//rendering for the module header and the body 
    9699function xpress_render($contents){ 
    97         global $xoopsTpl; 
    98         include XOOPS_ROOT_PATH."/header.php"; 
    99         $page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('&raquo;', false);    
     100        global $xoops_config , $xoopsTpl; 
     101        include $xoops_config->xoops_root_path ."/header.php"; 
     102        $page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('&raquo;', false); 
    100103        $xoopsTpl->assign('xoops_module_header', get_xpress_module_header($contents)); 
    101104        $xoopsTpl->assign('xoops_pagetitle', $page_title); 
    102105        $xoopsTpl->assign('xpress_body_contents', get_body($contents)); 
    103106        echo get_body($contents); 
     107        require_once( ABSPATH .'/include/xpress_breadcrumbs.php' ); 
     108        include $xoops_config->xoops_root_path . '/footer.php'; 
    104109} 
    105110 
  • trunk/language/ja_utf8/blocks.php

    r54 r96  
    1616        define("_MB_XPRESS_CATS_SELECT","カテゴリー選択"); 
    1717        define("_MB_XPRESS_TAGS_SELECT","タグ選択(複数ある場合はカンマ区切りで入力"); 
     18         
     19        define("_MB_XPRESS_BLOCK_CACHE_ERR","キャッシュが存在しません。<br />最初に%sモジュールにアクセスしてください。"); 
    1820 
    1921} 
  • trunk/templates/source/recent_comments_block.html

    r89 r96  
    2323 
    2424<div id="xpress_recent_comments"> 
     25        <{$block.err_message}> 
    2526        <{$block.data_count}> 
    2627        <{foreach from=$block.contents item=content}> 
  • trunk/templates/source/recent_posts_content_block.html

    r89 r96  
    2121 
    2222<ul class="xpress_recent_comments"> 
     23        <{$block.err_message}> 
    2324        <{$block.data_count}> 
    2425        <{foreach from=$block.contents item=content}> 
  • trunk/wp-config.php

    r95 r96  
    55require_once dirname( __FILE__ ).'/include/set_cash_cookie_path.php' ; 
    66 
     7/** 
     8 * mb_language() sets language. If language  is omitted, it returns current language as string. 
     9 * language setting is used for encoding e-mail messages.  
     10 * Valid languages are "Japanese", "ja","English","en" and "uni" (UTF-8).  
     11 * mb_send_mail() uses this setting to encode e-mail. 
     12 * Language and its setting is ISO-2022-JP/Base64 for Japanese, UTF-8/Base64 for uni, ISO-8859-1/quoted printable for English.  
     13 */ 
     14 if (function_exists("mb_language")) mb_language('uni'); 
    715 
    8 if (function_exists("mb_language")) mb_language('Japanese'); 
    9 // The setting of mb_internal_encoding might be unnecessary.  
    10 // Because mb_internal_encoding setting wp-setting.php line 484 
    11 if (function_exists("mb_internal_encoding")) mb_internal_encoding('UTF-8'); 
    1216 
    13 // ** MySQL settings ** // 
    14 define('DB_NAME', $xoops_config->xoops_db_name);    // The name of the database 
    15 define('DB_USER', $xoops_config->xoops_db_user);     // Your MySQL username 
    16 define('DB_PASSWORD', $xoops_config->xoops_db_pass); // ...and password 
    17 define('DB_HOST', $xoops_config->xoops_db_host);    // 99% chance you won't need to change this value 
     17// ** MySQL settings - You can get this info from your web host ** // 
     18// Do not change  'DB_NAME','DB_USER','DB_PASSWORD' & 'DB_HOST' 
     19// because copies a set value of XOOPS.  
     20 
     21/** Do not change. The name of the database for WordPress */ 
     22define('DB_NAME', $xoops_config->xoops_db_name); 
     23 
     24/** Do not change. MySQL database username */ 
     25define('DB_USER', $xoops_config->xoops_db_user); 
     26 
     27/** Do not change. MySQL database password */ 
     28define('DB_PASSWORD', $xoops_config->xoops_db_pass); 
     29 
     30/** Do not change. MySQL hostname */ 
     31define('DB_HOST', $xoops_config->xoops_db_host); 
     32         
     33/** Database Charset to use in creating database tables. */ 
    1834define('DB_CHARSET', 'utf8'); 
     35 
     36/** The Database Collate type. Don't change this if in doubt. */ 
    1937define('DB_COLLATE', ''); 
    2038 
    2139//define('WP_DEBUG' ,true); 
    2240 
    23 // Change each KEY to a different unique phrase.  You won't have to remember the phrases later, 
    24 // so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/ 
    25 // to get keys generated for you, or just make something up.  Each key should have a different phrase. 
    26 define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase. 
    27 define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase. 
    28 define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase. 
     41/**#@+ 
     42 * Authentication Unique Keys. 
     43 * 
     44 * Change these to different unique phrases! 
     45 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service} 
     46 * 
     47 * @since 2.6.0 
     48 */ 
     49define('AUTH_KEY', 'put your unique phrase here'); 
     50define('SECURE_AUTH_KEY', 'put your unique phrase here'); 
     51define('LOGGED_IN_KEY', 'put your unique phrase here'); 
     52define('NONCE_KEY', 'put your unique phrase here'); 
    2953 
    30 // You can have multiple installations in one database if you give each a unique prefix 
    31 $table_prefix  = $xoops_config->module_db_prefix;   // Only numbers, letters, and underscores please! 
     54/** 
     55 * WordPress Database Table prefix. 
     56 * 
     57 * You can have multiple installations in one database if you give each a unique 
     58 * prefix. Only numbers, letters, and underscores please! 
     59 */ 
     60// Do not change. $table_prefix is generated from XOOPS DB Priefix and the module directory name.  
     61$table_prefix  = $xoops_config->module_db_prefix; 
    3262 
    33 // Change this to localize WordPress.  A corresponding MO file for the 
    34 // chosen language must be installed to wp-content/languages. 
    35 // For example, install de.mo to wp-content/languages and set WPLANG to 'de' 
    36 // to enable German language support. 
    37 define ('WPLANG', 'ja'); 
     63/** 
     64 * WordPress Localized Language, defaults to Japanese. 
     65 * 
     66 * Change this to localize WordPress.  A corresponding MO file for the chosen 
     67 * language must be installed to wp-content/languages. For example, install 
     68 * de.mo to wp-content/languages and set WPLANG to 'de' to enable German 
     69 * language support. 
     70 * 
     71 * Example: 
     72 * define ('WPLANG', '');               // language support to English 
     73 */ 
     74define ('WPLANG', 'ja');                // language support to Japanese 
    3875 
    3976/* That's all, stop editing! Happy blogging. */ 
    4077 
     78/** WordPress absolute path to the Wordpress directory. */ 
    4179if ( !defined('ABSPATH') ) 
    4280        define('ABSPATH', dirname(__FILE__).'/'); 
    4381 
    44 require_once dirname( __FILE__ ).'/include/request_url.php' ; 
    45 if (!is_xpress_index_page_call()){ 
    46 //      if ( is_wp_cron_page_call()){ 
    47 //              if ( !defined("XOOPS_ROOT_PATH") ) { 
    48 //                      require_once $xoops_config->xoops_mainfile_path; 
    49 //              } 
    50 //      } 
     82require_once( ABSPATH .'/include/request_url.php'); 
     83if (is_xpress_index_page_call()){ 
     84        require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.  
    5185        require_once(ABSPATH.'wp-settings.php'); 
    52 } else { 
    53         // If $xoops_config->xoops_mainfile_path is not executed before wp-settings.php is executed, log in cannot be done.  
    54         require_once $xoops_config->xoops_mainfile_path; 
    55         require_once(ABSPATH.'wp-settings.php'); 
    56         // The return to wp-blog-header.php is stolen here 
    5786        wp(); 
    5887        ob_start();      
     
    6291        require_once( ABSPATH .'/include/xpress_render.php' ); 
    6392        xpress_render($wp_output); 
    64         require_once( ABSPATH .'/include/xpress_breadcrumbs.php' ); 
    65         include $xoops_config->xoops_root_path . '/footer.php'; 
    66         exit(); 
     93         
     94        //When there is no block cache, and an optional block is different, cache is refreshed.  
     95        //When adding, and changing and deleting Post & Comment, block cache is refreshed by add_action at any time.  
     96        // This Function in xpressme plugin 
     97        if (!is_block_cache_normal()) block_cache_refresh(); 
     98        exit();         // The return to wp-blog-header.php is stolen here 
    6799} 
     100require_once(ABSPATH.'wp-settings.php'); 
    68101?> 
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r95 r96  
    33function xpress_credit($show = false) 
    44{ 
    5         global $xoopsModule,$wp_version; 
    6          
    7         $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xoopsModule->getInfo('version'),$xoopsModule->getInfo('codename')) .'</a>'; 
     5        global $wp_version , $modversion; 
     6         
     7        $xpress_version = $modversion['version']; 
     8        $xpress_codename = $modversion['codename']; 
     9        $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>'; 
    810        if (strstr($wp_version,'ME')){ 
    911                $ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)'; 
     
    192194// Set post views given a post ID or post object.  
    193195function post_views_counting($post_id = 0) { 
     196        global $xoops_db,$wpdb; 
    194197        global $table_prefix; 
    195198        static $views; 
     
    201204 
    202205 
    203         $views_db = $table_prefix . "views"; 
     206        $views_db = get_wp_prefix() . 'views'; 
    204207 
    205208        if($post_id==0 || !empty($views[$post_id])) return null; 
     
    212215 
    213216    $sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id"; 
    214     $exist = false; 
    215     if ($result = $GLOBALS["xoopsDB"]->query($sql)) { 
    216         while($row = $GLOBALS["xoopsDB"]->fetchArray($result)){ 
    217                 $exist = true; 
    218                 break; 
    219         } 
    220         } 
    221         if($exist){ 
     217        $post_views_found = $xoops_db->get_var($sql); 
     218        if($post_views_found){ 
    222219        $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id"; 
    223220    }else{ 
    224221        $sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)"; 
    225222    } 
    226     if ($result = $GLOBALS["xoopsDB"]->queryF($sql)) { 
    227         $views[$post_id] = 1; 
    228     } 
    229      
     223    $xoops_db->query($sql); 
    230224        return true; 
    231225} 
  • trunk/wp-content/plugins/xpressme/include/notify_functions.php

    r95 r96  
    4848                $_SERVER['REQUEST_METHOD'] = 'POST'; 
    4949        } 
    50          
    51         include_once $xoops_config->xoops_mainfile_path;        // load XOOPS System 
    52         include_once $xoops_config->xoops_root_path . '/include/notification_functions.php' ; 
     50//      set_error_handler("xpress_error_handler"); 
     51        require $xoops_config->xoops_mainfile_path;     // load XOOPS System 
    5352        $module_id = get_xpress_modid() ; 
    5453        $notification_handler =& xoops_gethandler( 'notification' ) ; 
     
    5857function do_CommentWaiting($commentID, $comment_post_ID) 
    5958{ 
    60 //      global $xoops_config; 
    61 //      require_once $xoops_config->xoops_mainfile_path; 
    62 //      xoops_mainfile_path; 
    6359//      require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ; 
    6460//      $notification_handler =& xoops_gethandler( 'notification' ) ; 
     
    120116{ 
    121117        global $xoops_config, $xoops_db; 
    122         xpress_debug(); 
    123118         
    124119 
  • trunk/wp-content/plugins/xpressme/include/pluggable-override.php

    r87 r96  
    5656endif; 
    5757 
     58if ( !function_exists('xpress_login') ) : 
    5859function xpress_login(){ 
    5960        global $current_user; 
     
    8182        return 0;        
    8283} 
     84endif; 
    8385 
     86if ( !function_exists('check_xpress_auth_cookie') ) : 
    8487function check_xpress_auth_cookie() {           // for wp2.5 
    8588        if ( empty($_COOKIE[AUTH_COOKIE]) ){ 
     
    112115        return false; 
    113116} 
     117endif; 
    114118 
    115119if ( !function_exists('wp_check_password') ) : 
  • trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php

    r95 r96  
    4949} 
    5050 
     51function is_block_cache_found($block_name) 
     52{ 
     53        global $xoops_config; 
     54        $mydirname = get_xpress_dir_name(); 
     55 
     56        if(defined('XOOPS_ROOT_PATH')){ 
     57                $cache_dir = XOOPS_ROOT_PATH . '/cache/'; 
     58        } else { 
     59                $cache_dir = $xoops_config->xoops_root_path . '/cache/'; 
     60        } 
     61        $xml_name = $block_name . '.xml'; 
     62 
     63    $filename = $cache_dir .$mydirname . '_' . $xml_name; 
     64        $cache_time = 0; 
     65//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { 
     66    if (file_exists($filename)) { 
     67        return true; 
     68        } else { 
     69                return false; 
     70        } 
     71} 
     72 
     73 
     74//When there is no block cash, and an optional block is different, false is returned. 
     75function is_block_cache_normal() 
     76{ 
     77        global $xoops_config; 
     78        global $xoops_db; 
     79        $mid = get_xpress_modid(); 
     80        $sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid "; 
     81        $blocks = $xoops_db->get_results($sql); 
     82        $mydirname = get_xpress_dir_name(); 
     83        require_once get_xpress_dir_path() . '/include/xpress_block_render.php'; 
     84 
     85        foreach($blocks as $block){ 
     86                $func_file = $block->func_file; 
     87                $call_theme_function_name = str_replace(".php", "", $func_file); 
     88                $inc_theme_file_name = str_replace(".php", "", $func_file) . '_theme.php'; 
     89                $cache_title = str_replace(".php", "", $func_file); 
     90                $blockID = $block->bid; 
     91                $options = explode("|", $block->options); 
     92                 
     93                if (!is_block_cache_found($cache_title . $blockID)) return false; 
     94                $xml = xpress_block_cache_read($mydirname,$cache_title. $blockID); 
     95                $options = ''; 
     96                $options = @$xml['block']['options']; 
     97                if( strcmp($options,$block->options) != 0 ) return false; 
     98        } 
     99        return true; 
     100} 
     101 
     102 
    51103function block_cache_refresh() 
    52104{ 
     
    71123                $block_render = $call_theme_function_name($options);            //The block name and the called function name should be assumed to be the same name.                     
    72124                $xml['block'] = $block_render; 
     125                $xml['block']['options'] = $block->options; 
    73126                xpress_block_cache_write($mydirname,$cache_title. $blockID, $xml); 
    74127        } 
  • trunk/wp-content/plugins/xpressme/xpressme.php

    r95 r96  
    2727        remove_action( 'pre_post_update', 'wp_save_post_revision' );                    // Not Save Post Revision 
    2828} 
     29 
     30//XOOPS Bloack Cache Refresh 
    2931add_action("comment_post",      "block_cache_refresh"); 
    3032add_action("edit_comment",      "block_cache_refresh"); 
    31 add_action("delete_comment","block_cache_refresh"); 
    32 add_action("delete_post",       "block_cache_refresh"); 
     33add_action("wp_set_comment_status","block_cache_refresh"); //wp_delete_comment() at deleted 
     34add_action("deleted_post",      "block_cache_refresh"); 
    3335add_action("publish_post",      "block_cache_refresh"); 
    3436add_action("edit_post",         "block_cache_refresh"); 
    3537add_action("private_to_published",      "block_cache_refresh"); 
    36 add_action("wp_set_comment_status" , "block_cache_refresh"); 
     38add_action("transition_post_status", "block_cache_refresh"); 
    3739 
    3840add_action("the_content",       "set_post_views_count"); 
  • trunk/wp-content/themes/xpress_default/index.php

    r64 r96  
    3333                                </div> 
    3434 
    35                                 <p class="postmetadata"><!-- Post author start --><?php/* _e('Posted:', 'xpress'); echo '&nbsp;'; the_author_posts_link(); echo '<br />' ; */?><!-- Post author end --><?php if(function_exists('the_tags')) : ?><?php the_tags(__('Tags:', 'xpress') . ' ', ', ', '<br />'); ?><?php endif; ?><?php printf(__('Posted in %s', 'xpress'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'xpress'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'xpress'), __('1 Comment &#187;', 'xpress'), __('% Comments &#187;', 'xpress'), '', __('Comments Closed', 'xpress') ); ?></p> 
    36                                 <?php xpress_post_views_count($post->id,__('Views :%d', 'xpress'),true) ?> 
     35                                <p class="postmetadata"><!-- Post author start --> 
     36                                <!-- Post author end --> 
     37                                <?php 
     38                                        if(function_exists('the_tags')) 
     39                                                echo the_tags(__('Tags:', 'xpress') . ' ', ', ', '<br />'); 
     40                                        printf(__('Posted in %s', 'xpress'), get_the_category_list(', ')); 
     41                                        echo ' | '; 
     42                                        edit_post_link(__('Edit', 'xpress'), '', ' | '); 
     43                                        comments_popup_link(__('No Comments &#187;', 'xpress'), __('1 Comment &#187;', 'xpress'), __('% Comments &#187;', 'xpress'), '', __('Comments Closed', 'xpress') ); 
     44                                ?> 
     45                                </p> 
     46                                <?php xpress_post_views_count($post->ID,__('Views :%d', 'xpress'),true) ?> 
    3747 
    3848                                </div> 
  • trunk/wp-content/themes/xpress_default/searchform.php

    r64 r96  
    11<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/"> 
    22<label class="hidden" for="s"><?php _e('Search for:', 'xpress'); ?></label> 
    3 <div><input type="text" value="<?php if(function_exists('the_serch_query')) : ?><?php the_search_query(); ?><?php else : ?><?php echo attribute_escape($s); ?><?php endif; ?>" name="s" id="s" /> 
     3<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" /> 
    44<input type="submit" id="searchsubmit" value="<?php _e('Search', 'xpress'); ?>" /> 
    55</div> 
  • trunk/xoops_version.php

    r95 r96  
    3131$modversion['name'] = ucfirst($mydirname) . ' ' . constant('_MI_XPRESS_NAME') ; 
    3232$modversion['description'] = constant( '_MI_XPRESS_DESC'); 
    33 $modversion['version'] = "0.04"; 
     33$modversion['version'] = "0.05"; 
    3434$modversion['credits'] = "Wordpress DEV (http://wordpress.org/) XPressME DEV Toemon) (http://www.toemon.com) ;"; 
    3535$modversion['author'] = "toemon (http://www.toemon.com)"; 
     
    4040 
    4141// status 
    42 $modversion['codename'] = "r48"; 
     42$modversion['codename'] = "fix notify"; 
    4343 
    4444// onInstall, onUpdate, onUninstall 
Note: See TracChangeset for help on using the changeset viewer.