Changeset 488 for branches/XPressMU/xpressme_integration_kit
- Timestamp:
- Dec 15, 2009, 4:52:57 PM (15 years ago)
- Location:
- branches/XPressMU/xpressme_integration_kit
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/XPressMU/xpressme_integration_kit/admin/menu.php
r300 r488 58 58 $adminmenu[$i++]['link'] = "index.php"; 59 59 60 $adminmenu[$i]['title'] = _MI_XP2_TO_UPDATE ; 61 $adminmenu[$i++]['link'] = "admin/update.php"; 60 62 61 63 ?> -
branches/XPressMU/xpressme_integration_kit/blocks/archives_block.php
r232 r488 28 28 29 29 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 30 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";30 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 31 31 $form .= "<br />"; 32 32 $a_month = _MB_XP2_ARC_MONTH ; … … 62 62 $form .= "</select><br/>"; 63 63 64 $form .= "<br />" . _MB_XP2_COUNT_ZERO_ALL . " <input type='text' name='options[3]' value='" . $limit . "' />";64 $form .= "<br />" . _MB_XP2_COUNT_ZERO_ALL . " <input type='text' size='3' name='options[3]' value='" . $limit . "' />"; 65 65 $form .= "<br />" . yes_no_radio_option('options[4]', _MB_XP2_SHOW_NUM_OF_POST , $show_post_count); 66 66 $form .= "<br />" . yes_no_radio_option('options[5]', _MB_XP2_SHOW_DROP_DOWN , $drop_down); -
branches/XPressMU/xpressme_integration_kit/blocks/authors_block.php
r232 r488 28 28 29 29 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 30 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";30 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 31 31 $form .= "<br />"; 32 32 $form .= yes_no_radio_option('options[2]', _MB_XP2_SHOW_NUM_OF_POST , $optioncount); -
branches/XPressMU/xpressme_integration_kit/blocks/block_common.php
r451 r488 103 103 104 104 $option = "<option value=\"0\" "; 105 if ($isAll) $ form.= " selected=\"selected\"";105 if ($isAll) $option .= " selected=\"selected\""; 106 106 $option .= ">"._MB_XP2_ALL ."</option>"; 107 107 … … 146 146 endif; 147 147 148 if(!function_exists("block_template_setting")): 149 function block_template_setting($mydirname,$option_name = '',$value='') 150 { 151 $temp_parm = explode(':' , $value); 152 if (empty($temp_parm[1])) { 153 $filename=$temp_parm[0]; 154 $temp_type = 'db'; 155 } else { 156 $filename=$temp_parm[1]; 157 $temp_type = $temp_parm[0]; 158 } 159 160 $none_prefix_filename = ''; 161 $pattern = '^' . $mydirname . '_(.*).html'; 162 if (preg_match('/' . $pattern . '/' , $filename, $match)){ // file prefix check 163 $none_prefix_filename = $match[1]; 164 } 165 166 $output = _MB_XP2_THISTEMPLATE . "\n"; 167 $output .= '<input type="hidden" size="50" name="' . $option_name . '" value="' . $value .'"/>' . "\n"; 168 $output .= ' <select name="template_type" onclick="Template_Make()">' ."\n"; 169 switch ($temp_type){ 170 case 'db': 171 case 'DB': 172 $output .= '<option value="0" selected="selected">db</option>'; 173 $output .= '<option value="1">file</option>'; 174 break; 175 default: 176 $output .= '<option value="0">db</option>'; 177 $output .= '<option value="1" selected="selected">file</option>'; 178 } 179 $output .= '</select>'; 180 $output .= '<b>:'.$mydirname . '_</b>'; 181 $output .= '<input type="text" size="30" name="none_prefix_file" value="'. $none_prefix_filename. '" onChange="Template_Make()"/><b>.html</b><br />'; 182 $output .= ' 183 <script type="text/javascript"> 184 function Template_Make(){ 185 var type_element = document.getElementsByName("template_type").item(0); 186 var name_element = document.getElementsByName("none_prefix_file").item(0); 187 var real_element = document.getElementsByName("' .$option_name . '").item(0); 188 189 var file_name = "' . $mydirname . '_" + name_element.value + ".html"; 190 if (type_element.value ==0) var tmp_type = "db:"; else var tmp_type = "file:"; 191 real_element.value = tmp_type + file_name; 192 } 193 </script> 194 '; 195 196 return $output; 197 198 } 199 endif; 148 200 149 201 ?> -
branches/XPressMU/xpressme_integration_kit/blocks/calender_block.php
r232 r488 26 26 27 27 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 28 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";28 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 29 29 $form .= "<br />"; 30 30 $form .= _MB_XP2_SUN_COLOR .": <input type='text' name='options[2]' value='" . $sun_color . "' /><br />\n"; -
branches/XPressMU/xpressme_integration_kit/blocks/category_block.php
r232 r488 34 34 require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php'); 35 35 36 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /> ";37 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";36 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 37 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 38 38 $form .= "<br />"; 39 39 $form .= _MB_XP2_CAT_ALL_STR . " <input type='text' name='options[2]' value='" . $show_option_all . "' /><br />"; -
branches/XPressMU/xpressme_integration_kit/blocks/enhanced_block.php
r232 r488 19 19 $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 20 20 $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_enhanced_block.html' : trim( $options[1] ); 21 $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 21 22 $include_file = empty( $options[2] ) ? '' : $options[2] ; 22 23 24 require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php'); 23 25 24 26 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 25 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";27 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 26 28 $form .= "<br />"; 27 29 $form .= _MB_XP2_ENHACED_FILE .":<br />\n"; 28 $form .= ' ' . _MB_XP2_FILE_NAME . ": my_<input type='text' name='options[2]' value='" . $include_file . "' />_block.php<br>\n";30 $form .= ' ' . _MB_XP2_FILE_NAME . ": <b>my_</b><input type='text' name='options[2]' value='" . $include_file . "' /><b>_block.php</b><br>\n"; 29 31 $form .= ' ' . _MB_XP2_MAKE_ENHACED_FILE . "<br>\n"; 30 32 return $form; -
branches/XPressMU/xpressme_integration_kit/blocks/meta_block.php
r232 r488 31 31 32 32 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 33 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";33 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 34 34 $form .= "<br />"; 35 35 $form .= yes_no_radio_option('options[2]', _MB_XP2_META_WP_LINK , $wp_link) . "<br />\n"; -
branches/XPressMU/xpressme_integration_kit/blocks/page_block.php
r386 r488 35 35 36 36 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 37 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";37 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 38 38 $form .= "<br />"; 39 39 $form .= _MB_XP2_PAGE_ORDERBY .": "; -
branches/XPressMU/xpressme_integration_kit/blocks/popular_posts_block.php
r451 r488 28 28 29 29 require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php'); 30 31 30 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 32 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />\n";31 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 33 32 $form .= "<br />\n"; 34 33 $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n"; -
branches/XPressMU/xpressme_integration_kit/blocks/recent_comments_block.php
r451 r488 30 30 31 31 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 32 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />\n";32 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 33 33 $form .= "<br />"; 34 $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n";35 $form .= _MB_XP2_LENGTH .": <input type='text' name='options[3]' value='" . $disp_length . "' /><br />\n";34 $form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n"; 35 $form .= _MB_XP2_LENGTH .": <input type='text' size='3' name='options[3]' value='" . $disp_length . "' /><br />\n"; 36 36 $form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[4]' value='" . $date_format . "' /><br />\n"; 37 37 $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[5]' value='" . $time_format . "' /><br />\n"; -
branches/XPressMU/xpressme_integration_kit/blocks/recent_posts_content_block.php
r451 r488 34 34 35 35 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 36 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 37 $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n"; 36 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 37 $form .= "<br />"; 38 $form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n"; 38 39 $form .= yes_no_radio_option('options[3]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n"; 39 40 $form .= _MB_XP2_P_EXCERPT_SIZE .": <input type='text' name='options[4]' value='" . $excerpt_size . "' /><br />\n"; -
branches/XPressMU/xpressme_integration_kit/blocks/recent_posts_list_block.php
r451 r488 31 31 32 32 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 33 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />\n";33 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 34 34 $form .= "<br />\n"; 35 $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n";36 $form .= _MB_XP2_REDNEW_DAYS .": <input type='text' name='options[3]' value='" . $disp_red . "' /><br />\n";37 $form .= _MB_XP2_GREENNEW_DAYS .": <input type='text' name='options[4]' value='" . $disp_green . "' /><br />\n";35 $form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n"; 36 $form .= _MB_XP2_REDNEW_DAYS .": <input type='text' size='3' name='options[3]' value='" . $disp_red . "' /><br />\n"; 37 $form .= _MB_XP2_GREENNEW_DAYS .": <input type='text' size='3' name='options[4]' value='" . $disp_green . "' /><br />\n"; 38 38 $form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[5]' value='" . $date_format . "' /><br />\n"; 39 39 $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[6]' value='" . $time_format . "' /><br />\n"; -
branches/XPressMU/xpressme_integration_kit/blocks/search_block.php
r232 r488 25 25 26 26 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 27 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";27 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 28 28 $form .= "<br />"; 29 $form .= _MB_XP2_SEARCH_LENGTH .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />";29 $form .= _MB_XP2_SEARCH_LENGTH .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />"; 30 30 // $form .="<br /><input type='text' size='60' name='options[2]' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />"; 31 31 -
branches/XPressMU/xpressme_integration_kit/blocks/tag_cloud_block.php
r232 r488 32 32 33 33 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 34 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";34 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 35 35 $form .= "<br />"; 36 36 $form .= _MB_XP2_CLOUD_SMALLEST .": <input type='text' size='4' name='options[2]' value='" . $smallest . "' /><br />"; -
branches/XPressMU/xpressme_integration_kit/blocks/widget_block.php
r451 r488 46 46 47 47 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 48 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";48 $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 49 49 $form .= "<br />" . yes_no_radio_option('options[2]', _MB_XP2_WIDGET_TITLE_SHOW , $title_show); 50 50 $form .= "<br />"; -
branches/XPressMU/xpressme_integration_kit/include/add_xpress_process.php
r451 r488 7 7 } 8 8 9 function safe_site_url(){ 10 global $xoops_config; 11 12 if (is_xpress_index_page_call()){ 13 $siteurl = get_option('siteurl'); 14 $home = get_option('home'); 15 $module_url = $xoops_config->module_url; 16 $module_name = $xoops_config->module_name; 17 $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; 18 $guess_url = preg_replace('|/' . $module_name . '/.*|i', '/' . $module_name, $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); 19 20 if(strcmp($siteurl,$module_url) !== 0) { 21 if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){ 22 update_option('siteurl' , $module_url); 23 } 24 } 25 26 if(strcmp($guess_ur,$home) !== 0) { 27 if (@fclose(@fopen($guess_url . '/xoops_version.php', "r"))){ 28 update_option('home' , $guess_url); 29 } 30 } 31 } 32 } 33 9 34 require_once( dirname( __FILE__ ).'/request_url.php'); 10 35 if (is_xpress_index_page_call()){ 36 //$_SERVER['REQUEST_METHOD'] = 'POST' is 11 37 //When notifying by a private message, Notification_reserve_send(); 12 38 //it is evaded that the data base becomes read-only as a result of the check on the referrer and the method. 39 $request_method = (isset($_SERVER['REQUEST_METHOD'])) ? $_SERVER['REQUEST_METHOD'] : ''; 13 40 $_SERVER['REQUEST_METHOD'] = 'POST'; 41 require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php. 42 $_SERVER['REQUEST_METHOD'] = $request_method; 43 44 unset($offset); //This Trap is provides the case where $offset is defined on the XOOPS side. 45 require_once(ABSPATH.'wp-settings.php'); 46 47 //When it is not possible to connect it correctly at site home URL on the WordPress side, 48 //URL is corrected based on accessed URL. 49 safe_site_url(); 14 50 15 require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.16 unset($offset);17 require_once(ABSPATH.'wp-settings.php');18 51 if (!is_object($xoopsUser)){ // before login auth cookie clear 19 52 wp_logout(); -
branches/XPressMU/xpressme_integration_kit/include/general_functions.php
r423 r488 126 126 $table_list = array(); 127 127 $ret = array(); 128 $pattern = $wp_prefix . $table_name . '|' . $wp_prefix . '[0-9]*_' . $table_name; 129 128 130 if (!empty($wp_prefix) && !empty($table_name)){ 129 131 $sql = "SHOW TABLES LIKE '" . $wp_prefix . '%' . $table_name . "'"; … … 132 134 if($result = $xoopsDB->queryF($sql)){ 133 135 while($row = $xoopsDB->fetchRow($result)){ 134 $table_list[] = $row[0]; 136 if(preg_match('/' . $pattern . '/' , $row[0])){ 137 $table_list[] = $row[0]; 138 } 135 139 } 136 140 } … … 138 142 $rows = $xoops_db->get_results($sql, ARRAY_N); 139 143 foreach ($rows as $row){ 140 $table_list[] = $row[0]; 144 if(preg_match('/' . $pattern . '/' , $row[0])){ 145 $table_list[] = $row[0]; 146 } 141 147 } 142 148 } -
branches/XPressMU/xpressme_integration_kit/include/oninstall.php
r428 r488 45 45 46 46 //xpress 47 global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles, $wp_query ;47 global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles, $wp_query,$wp_embed; 48 48 global $xoops_config; 49 49 -
branches/XPressMU/xpressme_integration_kit/include/onupdate.php
r428 r488 42 42 $site_url= XOOPS_URL."/modules/".$mydirname; 43 43 xpress_put_siteurl($mydirname,$site_url); 44 xpress_put_home($mydirname,$site_url); 45 44 $home = get_xpress_option($mydirname,'home'); 45 $home_check = 'home option is right'; 46 if (strcmp($site_url,$home) !== 0 ){ 47 if (!@fclose(@fopen($home . '/xoops_version.php', "r"))){ 48 xpress_put_home($mydirname,$site_url); 49 $home_check = 'Change home option $home to $site_url'; 50 } 51 } 52 $msgs[] = $home_check; 46 53 // XPressME orignal table update 47 54 $t_mess = xpress_table_make($module , $mydirname); … … 50 57 // make templates 51 58 include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ; 59 $mod_version = $module->getVar('version') ; 60 61 $t_mess = xpress_clean_templates_file($mydirname,$mod_version); 62 $msgs = array_merge($msgs,$t_mess); 63 52 64 $t_mess = xpress_templates_make($mid,$mydirname); 53 54 65 $msgs = array_merge($msgs,$t_mess); 55 66 … … 97 108 endif; 98 109 110 if( ! function_exists( 'get_xpress_option' ) ) { 111 function get_xpress_option($mydirname,$option_name){ 112 global $xoopsModule; 113 $wp_prefix = $mydirname; 114 if ($wp_prefix == 'wordpress'){ 115 $wp_prefix = 'wp'; 116 } 117 $xoopsDB =& Database::getInstance(); 118 $option_table = $xoopsDB->prefix($wp_prefix . '_options'); 119 120 $sql = "SELECT option_value FROM $option_table WHERE option_name = '" . $option_name . "'"; 121 122 $result = $xoopsDB->query($sql, 0, 0); 123 if ($xoopsDB->getRowsNum($result) > 0){ 124 $row = $xoopsDB->fetchArray($result); 125 return $row['option_value']; 126 } 127 return 0; 128 } 129 } 99 130 100 131 if( ! function_exists( 'xpress_message_append_onupdate' ) ) : … … 190 221 $db->queryF( $queries ) ; 191 222 $msgs[] = "$views_table ADD blog_id ."; 223 } 224 225 // The table is repaired. 226 $non_blogid_sql ="SELECT * FROM $views_table WHERE blog_id IS NULL OR blog_id < 1"; 227 $non_blogid_res = $db->query($non_blogid_sql, 0, 0); 228 while($row = $db->fetchArray($non_blogid_res)){ 229 $total_view = $row['post_views']; 230 $post_id = $row['post_id']; 231 $new_blogid_sql ="SELECT SUM(post_views) as post_views_sum FROM $views_table WHERE post_id = $post_id AND blog_id = 1 GROUP BY post_id"; 232 $new_blogid_res = $db->query($new_blogid_sql, 0, 0); 233 if ($db->getRowsNum($new_blogid_res) > 0){ 234 $new_row = $db->fetchArray($new_blogid_res); 235 $total_view = $total_view + $new_row['post_views_sum']; 236 $del_sql = "DELETE FROM $views_table WHERE post_id = $post_id AND blog_id = 1"; 237 $db->queryF( $del_sql ) ; 238 } 239 $update_sql = "UPDATE $views_table SET post_views = $total_view , blog_id = 1 WHERE post_id = $post_id AND (blog_id IS NULL OR blog_id < 1)"; 240 $db->queryF( $update_sql ) ; 192 241 } 193 242 } -
branches/XPressMU/xpressme_integration_kit/include/set_cash_cookie_path.php
r232 r488 8 8 */ 9 9 if ( !defined('USER_COOKIE') ) 10 define('USER_COOKIE', $modname . 'user_' . $hash);10 define('USER_COOKIE', 'wordpress_' . $modname . '_user_' . $hash); 11 11 12 12 /** … … 15 15 */ 16 16 if ( !defined('PASS_COOKIE') ) 17 define('PASS_COOKIE', $modname . 'pass_' . $hash);17 define('PASS_COOKIE', 'wordpress_' . $modname . '_pass_' . $hash); 18 18 19 19 /** … … 22 22 */ 23 23 if ( !defined('AUTH_COOKIE') ) 24 define('AUTH_COOKIE', $modname . '_auth_' . $hash);24 define('AUTH_COOKIE', 'wordpress_' . $modname . '_auth_' . $hash); 25 25 26 26 /** … … 29 29 */ 30 30 if ( !defined('SECURE_AUTH_COOKIE') ) 31 define('SECURE_AUTH_COOKIE', $modname . '_sec_' . $hash);31 define('SECURE_AUTH_COOKIE', 'wordpress_' . $modname . '_sec_' . $hash); 32 32 33 33 /** … … 36 36 */ 37 37 if ( !defined('LOGGED_IN_COOKIE') ) 38 define('LOGGED_IN_COOKIE', $modname . '_logged_in_' . $hash);38 define('LOGGED_IN_COOKIE', 'wordpress_' . $modname . '_logged_in_' . $hash); 39 39 40 40 /** … … 43 43 */ 44 44 if ( !defined('TEST_COOKIE') ) 45 define('TEST_COOKIE', $modname . '_test_cookie');45 define('TEST_COOKIE', 'wordpress_' . $modname . '_test_cookie'); 46 46 47 47 /** -
branches/XPressMU/xpressme_integration_kit/include/xpress_block_render.php
r451 r488 29 29 $ret = @xpress_XML_unserialize($xml_data); 30 30 if (strstr($xml_data, '<?xml version="1.0" encoding="EUC-JP" ?>') !== false){ 31 $ans = mb_convert_variables('EUC-JP' , 'UTF-8', &$ret); 31 if (version_compare(PHP_VERSION, '5.0.0', '>')) { 32 $ans = mb_convert_variables('EUC-JP' , 'UTF-8', &$ret); //xpress_XML_unserialize() Return UTF-8 at PHP5 33 } 32 34 } 33 35 return $ret; … … 52 54 } 53 55 return $block_id; 56 } 57 58 function get_block_mid($mydirname) 59 { 60 $xoopsDB =& Database::getInstance(); 61 $modules_tbl = $xoopsDB->prefix('modules'); 62 63 $sql = "SELECT mid FROM $modules_tbl WHERE dirname = '$mydirname'"; 64 $result = $xoopsDB->query($sql, 0, 0); 65 if ($xoopsDB->getRowsNum($result) > 0){ 66 $row = $xoopsDB->fetchArray($result); 67 $mid = $row['mid']; 68 } 69 return $mid; 54 70 } 55 71 … … 160 176 function xpress_block_render($mydirname,$block_function_name,$options) 161 177 { 162 global $wpdb ;178 global $wpdb,$xoops_config; 163 179 $func_file = $block_function_name; 164 180 $call_theme_function_name = str_replace(".php", "", $block_function_name); … … 167 183 $blockID =get_block_id($mydirname,$func_file,$options); 168 184 169 $this_ url = '/modules/'. $mydirname;185 $this_block_url = '/' . $mydirname . '/'; 170 186 $call_url = $_SERVER['REQUEST_URI']; 171 187 172 188 xpress_block_css_set($mydirname); 173 if (strstr($call_url ,$this_url)){189 if (strstr($call_url , $this_block_url) !== false){ 174 190 $block_theme_file = get_block_file_path($mydirname,$inc_theme_file_name); 175 191 require_once $block_theme_file['file_path']; … … 185 201 } 186 202 } 187 188 $templates_file = 'db:'.$mydirname. '_' . str_replace(".php", ".html", $block_function_name); 203 $temp_option = explode(':' , $options[1]); 204 205 if (isset($temp_option[1])) { 206 $templates_file = $temp_option[1]; 207 } else { 208 $templates_file = 'db:'.$mydirname. '_' . str_replace(".php", ".html", $block_function_name); 209 } 210 189 211 $tpl =& new XoopsTpl() ; 212 $tpl->template_dir = $xoops_config->module_path . '/templates'; 213 if (!$tpl->template_exists($templates_file)){ 214 $src_file_path = $xoops_config->module_path . '/templates/' .$mydirname. '_' . str_replace(".php", ".html", $block_function_name); 215 $templates_file = add_xpress_tpl($mydirname,$templates_file,$src_file_path); 216 } 190 217 $tpl->assign( 'block' , $block ) ; 191 218 $ret['content'] = $tpl->fetch( $templates_file ) ; 192 219 return $ret ; 220 } 221 222 function add_xpress_tpl($mydirname,$templates='',$src_file_path){ 223 global $wpdb,$xoops_config , $xoops_db; 224 225 $mid = get_block_mid($mydirname); 226 227 $temp_parm = explode(':' , $templates); 228 if (empty($temp_parm[1])) { 229 $filename=$temp_parm[0]; 230 $type = 'db'; 231 } else { 232 $filename=$temp_parm[1]; 233 $type = $temp_parm[0]; 234 } 235 $temp_file_path = $xoops_config->module_path . '/templates/'. $filename; 236 $pattern = '^' . $mydirname . '_'; 237 if (preg_match('/' . $pattern . '/' , $filename, $match)){ // file prefix check 238 if (!file_exists($temp_file_path)){ // Repetition check 239 if (file_exists($src_file_path)){ // source file check 240 $rcd = copy($src_file_path, $temp_file_path); 241 } 242 } 243 return 'file:' . $filename; 244 } 245 return $templates; 193 246 } 194 247 … … 243 296 { 244 297 global $xoops_db,$xoops_config; 298 245 299 $mid = get_xpress_modid(); 246 300 $sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid AND visible = 1"; … … 260 314 if ($dh = opendir($cache_dir)) { 261 315 while (($file = readdir($dh)) !== false) { 262 if (preg_match('/^' . preg_quote($mydirname) . ' /', $file)) {316 if (preg_match('/^' . preg_quote($mydirname) . '_/', $file)) { 263 317 if(! preg_match('/' . $pattern . '/', $file)) { 264 318 unlink($cache_dir.$file); … … 287 341 return $xu_row['conf_value']; 288 342 } 289 } 290 343 } 291 344 } 292 345 ?> -
branches/XPressMU/xpressme_integration_kit/include/xpress_templates_make.php
r384 r488 7 7 $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; 8 8 $tpl_path = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/templates' ; 9 10 //copy template file from source 9 11 if( $handler = @opendir( $tpl_path . '/source/' ) ) { 10 12 while( ( $file = readdir( $handler ) ) !== false ) { … … 26 28 $msgs[] = '<span style="color:#ff0000;">ERROR: Could not copy template <b>'.htmlspecialchars($target_file_name).'</b> from ' . htmlspecialchars($file). '(check templates directory permision (777))</span><br />'; 27 29 } 28 $tplfile =& $tplfile_handler->create() ; 29 if ($rcd) { 30 $mtime = intval( @filemtime( $target_file_path ) ) ; 31 $tplfile->setVar( 'tpl_source' , file_get_contents( $target_file_path ) , true ) ; 32 } else { 33 $mtime = intval( @filemtime( $file_path ) ) ; 34 $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; 35 } 36 37 $tplfile->setVar( 'tpl_refid' , $mid ) ; 38 $tplfile->setVar( 'tpl_tplset' , 'default' ) ; 39 $tplfile->setVar( 'tpl_file' , $target_file_name ) ; 40 $tplfile->setVar( 'tpl_desc' , '' , true ) ; 41 $tplfile->setVar( 'tpl_module' , $mydirname ) ; 42 $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; 43 $tplfile->setVar( 'tpl_lastimported' , 0 ) ; 44 $tplfile->setVar( 'tpl_type' , 'module' ) ; 45 if( ! $tplfile_handler->insert( $tplfile ) ) { 46 $msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($target_file_name).'</b> to the database.</span><br />'; 47 } else { 48 $tplid = $tplfile->getVar( 'tpl_id' ) ; 49 $msgs[] = 'Template <b>'.htmlspecialchars($target_file_name) .'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />'; 50 // generate compiled file 51 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 52 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 53 if( ! xoops_template_touch( $tplid ) ) { 54 $msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($target_file_name).'</b>.</span><br />'; 55 } else { 56 $msgs[] = 'Template <b>'.htmlspecialchars($target_file_name).'</b> compiled.</span><br />'; 57 } 30 } 31 } 32 closedir( $handler ) ; 33 } 34 35 // template added to the database. 36 if( $handler = @opendir( $tpl_path . '/' ) ) { 37 while( ( $file = readdir( $handler ) ) !== false ) { 38 if( substr( $file , 0 , 1 ) == '.' ) continue ; 39 $file_path = $tpl_path . '/' . $file ; 40 $file_name = $file ; 41 $pattern = '^' . $mydirname . '_'; 42 if (preg_match('/' . $pattern . '/' , $file_name, $match)){ 43 if( is_file( $file_path ) ) { 44 $msgs[] = xpress_create_db_template($file_name,$file_path,$mydirname,$mid); 58 45 } 59 46 } … … 61 48 closedir( $handler ) ; 62 49 } 50 63 51 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 64 52 include_once XOOPS_ROOT_PATH.'/class/template.php' ; … … 68 56 } 69 57 58 function xpress_create_db_template($file_name,$file_path,$mydirname,$mid){ 59 if( is_file( $file_path ) ) { 60 $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; 61 $tplfile =& $tplfile_handler->create() ; 62 $mtime = intval( @filemtime( $file_path ) ) ; 63 $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; 64 $tplfile->setVar( 'tpl_refid' , $mid ) ; 65 $tplfile->setVar( 'tpl_tplset' , 'default' ) ; 66 $tplfile->setVar( 'tpl_file' , $file_name ) ; 67 $tplfile->setVar( 'tpl_desc' , '' , true ) ; 68 $tplfile->setVar( 'tpl_module' , $mydirname ) ; 69 $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; 70 $tplfile->setVar( 'tpl_lastimported' , 0 ) ; 71 $tplfile->setVar( 'tpl_type' , 'module' ) ; 72 if( ! $tplfile_handler->insert( $tplfile ) ) { 73 $msg = '<span style="color:#ff0000;">ERROR: Template Could not added to the database. <b>'.htmlspecialchars($file_name).'</b> to the database.</span><br />'; 74 } else { 75 $tplid = $tplfile->getVar( 'tpl_id' ) ; 76 $msg = 'Template <b>'.htmlspecialchars($file_name) .'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />'; 77 // generate compiled file 78 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 79 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 80 if( ! xoops_template_touch( $tplid ) ) { 81 $msg = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($file_name).'</b>.</span><br />'; 82 } else { 83 $msg = 'Template <b>'.htmlspecialchars($file_name).'</b> compiled.</span><br />'; 84 } 85 } 86 } 87 return $msg; 88 } 70 89 71 90 function is_template($file_name){ … … 96 115 } 97 116 117 function xpress_clean_templates_file($mydirname,$mod_version) 118 { 119 $tpl_path = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/templates/' ; 120 $msgs = array(); 121 if( $handler = @opendir( $tpl_path) ) { 122 while( ( $file = readdir( $handler ) ) !== false ) { 123 if( substr( $file , 0 , 1 ) == '.' ) continue ; 124 if ( strcmp($file,'source')==0 ) continue ; 125 if ( strcmp($file,'index.html')==0 ) continue ; 126 $target_file_path = $tpl_path . $file; 127 if (is_dir($target_file_path)){ 128 rmDirectory($target_file_path); 129 $msgs[] = 'Template <b>'.htmlspecialchars($file).'</b> directory deleted.</span><br />'; 130 } else { 131 if ($mod_version >= 200){ 132 $pattern = '^' . $mydirname . '_'; 133 if (preg_match('/' . $pattern . '/' , $file, $match)) continue ; 134 } 135 $rcd = @unlink($target_file_path); 136 $msgs[] = 'Template <b>'.htmlspecialchars($file).'</b> file deleted.</span><br />'; 137 } 138 } 139 closedir( $handler ) ; 140 } 141 return $msgs; 142 } 143 144 function rmDirectory($dir){ 145 if ($handle = opendir("$dir")){ 146 while (false !== ($item = readdir($handle))){ 147 if ($item != "." && $item != ".."){ 148 if (is_dir("$dir/$item")){ 149 rmDirectory("$dir/$item"); 150 }else{ 151 unlink("$dir/$item"); 152 } 153 } 154 } 155 closedir($handle); 156 rmdir($dir); 157 } 158 } 98 159 99 160 ?> -
branches/XPressMU/xpressme_integration_kit/language/english/blocks.php
r451 r488 26 26 define("_MB_XP2_LIST","List"); 27 27 define("_MB_XP2_FILE_NAME","Files Name"); 28 define("_MB_XP2_THISTEMPLATE","Template"); 28 29 29 30 // recent comment block … … 107 108 108 109 // Categorie 109 define("_MB_XP2_CAT_ALL_STR","All categories link Display Title. (blank is not display j");110 define("_MB_XP2_CAT_ALL_STR","All categories link Display Title. (blank is not display)"); 110 111 define("_MB_XP2_CAT_ORDERBY","Order of the categories"); 111 112 define("_MB_XP2_CAT_NAME","name"); -
branches/XPressMU/xpressme_integration_kit/language/english/modinfo.php
r387 r488 22 22 define("_MI_XP2_MENU_XPRESS","XPressME Setting"); 23 23 define("_MI_XP2_MENU_TO_MODULE","to Modules"); 24 define("_MI_XP2_TO_UPDATE","Update"); 24 25 25 26 // Module Config -
branches/XPressMU/xpressme_integration_kit/language/ja_utf8/blocks.php
r451 r488 26 26 define("_MB_XP2_LIST","リスト"); 27 27 define("_MB_XP2_FILE_NAME","ファイル名"); 28 define("_MB_XP2_THISTEMPLATE","このブロックのテンプレート"); 28 29 29 30 // recent comment block -
branches/XPressMU/xpressme_integration_kit/language/ja_utf8/modinfo.php
r387 r488 22 22 define("_MI_XP2_MENU_XPRESS","XPressME設定"); 23 23 define("_MI_XP2_MENU_TO_MODULE","モジュールへ"); 24 define("_MI_XP2_TO_UPDATE","アップデート"); 24 25 25 26 // Module Config -
branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
r451 r488 95 95 96 96 $output = ''; 97 $author_cookie = get_xpress_dir_name() . "_select_author" ;97 $author_cookie = 'select_' . get_xpress_dir_name() . "_author" ; 98 98 if (!empty($_COOKIE[$author_cookie])){ 99 99 $uid = intval($_COOKIE[$author_cookie]); … … 115 115 extract( $r ); 116 116 $output = ''; 117 $author_cookie = get_xpress_dir_name() . "_select_author" ;117 $author_cookie = 'select_' . get_xpress_dir_name() . "_author" ; 118 118 if (!empty($_COOKIE[$author_cookie])){ 119 119 $output = intval($_COOKIE[$author_cookie]); … … 161 161 $xpress_codename = $xoops_config->module_codename; 162 162 if ($no_link){ 163 $output = 'XPressMU Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename);164 163 if ($xoops_config->is_wpmu) { 164 $output = 'XPressMU Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename); 165 165 $output .= '(included WordPress MU ' . $wpmu_version. ')'; 166 166 } else { 167 $output = 'XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename); 167 168 if (strstr($wp_version,'ME')){ 168 169 $output .= '(included WordPress ' . $wp_version . ')'; … … 172 173 } 173 174 } else { 174 $output = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressMU Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>';175 175 if ($xoops_config->is_wpmu) { 176 $output = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressMU Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>'; 176 177 $output .= '(included <a href="http://mu.wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress MU ' . $wpmu_version . '</a>)'; 177 178 } else { 179 $output = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>'; 178 180 if (strstr($wp_version,'ME')){ 179 181 $output .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)'; … … 467 469 } 468 470 469 function set_post_views_count( &$content) {471 function set_post_views_count($content) { 470 472 if ( empty($_GET["feed"]) && empty($GLOBALS["feed"]) && empty($GLOBALS["doing_trackback"]) && empty($GLOBALS["doing_rss"]) && empty($_POST) && is_single() ){ 471 473 post_views_counting(); -
branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp_old.php
r378 r488 190 190 191 191 endif; // Under WP2.5 192 193 // Under WP2.7 194 if (version_compare($xoops_config->wp_version,'2.6', '<')) : 195 /** 196 * Guess the URL for the site. 197 * 198 * Will remove wp-admin links to retrieve only return URLs not in the wp-admin 199 * directory. 200 * 201 * @since 2.6.0 202 * 203 * @return string 204 */ 205 function wp_guess_url() { 206 if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { 207 $url = WP_SITEURL; 208 } else { 209 $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; 210 $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 211 } 212 return $url; 213 } 214 endif; // Under WP2.6 192 215 193 216 // Under WP2.7 -
branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php
r452 r488 242 242 if (is_admin()) return $query_vars; 243 243 244 $author_cookie = get_xpress_dir_name() . "_select_author" ;244 $author_cookie = 'select_' . get_xpress_dir_name() . "_author" ; 245 245 if(xpress_is_multi_user()){ 246 246 if (!empty($_GET)){ … … 290 290 } 291 291 292 function xpress_query_filter( &$query)292 function xpress_query_filter($query) 293 293 { 294 294 if (is_admin()) return $query; 295 295 296 $author_cookie = get_xpress_dir_name() . "_select_author" ;296 $author_cookie = 'select_' . get_xpress_dir_name() . "_author" ; 297 297 298 298 if (strpos($query,'SELECT') === false) return $query; … … 357 357 } 358 358 359 function safe_site_url_filter($site_url){360 global $xoops_config;361 if (!$xoops_config->is_wpmu){362 if ($site_url != get_xpress_url()) $site_url = get_xpress_url();363 }364 return $site_url;365 }366 367 359 function get_block_file_path($mydirname,$file_name) 368 360 { -
branches/XPressMU/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php
r451 r488 71 71 } 72 72 add_action("wp_meta" , "wp_meta_add_xpress_menu"); // add xpress menu in wp_meta 73 74 //Site URL check75 add_filter('option_home', "safe_site_url_filter");76 add_filter('option_siteurl', "safe_site_url_filter");77 78 73 79 74 //XOOPS Bloack Cache Refresh … … 301 296 302 297 include_once dirname( __FILE__ ).'/include/dashboard_feed.php' ; 303 304 include_once dirname( __FILE__ ).'/xpressme_widget_class.php' ;305 298 if(xpress_is_wp_version('>=','2.8')){ 299 include_once dirname( __FILE__ ).'/xpressme_widget_class.php' ; 300 } 306 301 ?> -
branches/XPressMU/xpressme_integration_kit/xoops_version.php
r451 r488 47 47 48 48 // status 49 $modversion['codename'] = " RC1";49 $modversion['codename'] = ""; 50 50 51 51 // onInstall, onUpdate, onUninstall
Note: See TracChangeset
for help on using the changeset viewer.