@@ -15,38 +15,38 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | include "header.php"; |
| 17 | 17 | |
| 18 | -if(planet_parse_args($args_num, $args, $args_str)){ |
|
| 18 | +if (planet_parse_args($args_num, $args, $args_str)) { |
|
| 19 | 19 | $args["article"] = @$args_num[0]; |
| 20 | 20 | $args["op"] = @$args_str[0]; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -$article_id = intval( empty($_GET["article"]) ? ( empty($_POST["article"]) ? @$args["article"] : $_POST["article"] ) : $_GET["article"] ); |
|
| 23 | +$article_id = intval(empty($_GET["article"]) ? (empty($_POST["article"]) ? @$args["article"] : $_POST["article"]) : $_GET["article"]); |
|
| 24 | 24 | |
| 25 | -$op = empty($_GET["op"]) ? ( empty($_POST["op"])? @$args["op"] : $_POST["op"] ) : $_GET["op"]; |
|
| 25 | +$op = empty($_GET["op"]) ? (empty($_POST["op"]) ? @$args["op"] : $_POST["op"]) : $_GET["op"]; |
|
| 26 | 26 | $op = strtolower(trim($op)); |
| 27 | 27 | |
| 28 | -if ( empty($article_id) ) { |
|
| 29 | - if(empty($_SERVER['HTTP_REFERER'])){ |
|
| 28 | +if (empty($article_id)) { |
|
| 29 | + if (empty($_SERVER['HTTP_REFERER'])) { |
|
| 30 | 30 | include XOOPS_ROOT_PATH."/header.php"; |
| 31 | 31 | xoops_error(_NOPERM); |
| 32 | 32 | $xoopsOption['output_type'] = "plain"; |
| 33 | 33 | include XOOPS_ROOT_PATH."/footer.php"; |
| 34 | 34 | exit(); |
| 35 | - }else{ |
|
| 35 | + }else { |
|
| 36 | 36 | $ref_parser = parse_url($_SERVER['HTTP_REFERER']); |
| 37 | 37 | $uri_parser = parse_url($_SERVER['REQUEST_URI']); |
| 38 | - if( |
|
| 38 | + if ( |
|
| 39 | 39 | (!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host']) |
| 40 | 40 | || |
| 41 | 41 | ($ref_parser["path"] != $uri_parser["path"]) |
| 42 | - ){ |
|
| 42 | + ) { |
|
| 43 | 43 | include XOOPS_ROOT_PATH."/header.php"; |
| 44 | 44 | include XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php"; |
| 45 | - xoops_confirm(array(), "javascript: window.close();", sprintf(planet_constant("MD_TRANSFER_DONE"),""), _CLOSE, $_SERVER['HTTP_REFERER']); |
|
| 45 | + xoops_confirm(array(), "javascript: window.close();", sprintf(planet_constant("MD_TRANSFER_DONE"), ""), _CLOSE, $_SERVER['HTTP_REFERER']); |
|
| 46 | 46 | $xoopsOption['output_type'] = "plain"; |
| 47 | 47 | include XOOPS_ROOT_PATH."/footer.php"; |
| 48 | 48 | exit(); |
| 49 | - }else{ |
|
| 49 | + }else { |
|
| 50 | 50 | include XOOPS_ROOT_PATH."/header.php"; |
| 51 | 51 | xoops_error(_NOPERM); |
| 52 | 52 | $xoopsOption['output_type'] = "plain"; |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -$article_handler =& xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
| 60 | -$article_obj =& $article_handler->get($article_id); |
|
| 59 | +$article_handler = & xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
| 60 | +$article_obj = & $article_handler->get($article_id); |
|
| 61 | 61 | |
| 62 | 62 | // Display option form |
| 63 | -if(empty($op)){ |
|
| 64 | - $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">"; |
|
| 63 | +if (empty($op)) { |
|
| 64 | + $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">"; |
|
| 65 | 65 | include XOOPS_ROOT_PATH."/Frameworks/transfer/option.transfer.php"; |
| 66 | 66 | exit(); |
| 67 | -}else{ |
|
| 67 | +}else { |
|
| 68 | 68 | $data = array(); |
| 69 | 69 | $data["id"] = $article_id; |
| 70 | 70 | $data["title"] = $article_obj->getVar("art_title"); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $data["url"] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/view.article.php".URL_DELIMITER."".$article_obj->getVar("art_id"); |
| 75 | 75 | $data["author"] = $article_obj->getVar("art_author"); |
| 76 | 76 | |
| 77 | - switch($op){ |
|
| 77 | + switch ($op) { |
|
| 78 | 78 | |
| 79 | 79 | // Use title |
| 80 | 80 | case "bookmark"; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | case "print": |
| 84 | 84 | case "pdf": |
| 85 | - ${"{$op}_data"} =& $data; |
|
| 85 | + ${"{$op}_data"} = & $data; |
|
| 86 | 86 | ${"{$op}_data"}["date"] = $pdf_data["time"]; |
| 87 | 87 | ${"{$op}_data"}["content"] = $article_obj->getVar("art_content"); |
| 88 | 88 | break; |
@@ -28,23 +28,23 @@ discard block |
||
| 28 | 28 | * </ul> |
| 29 | 29 | */ |
| 30 | 30 | global $pdf_data; |
| 31 | -if(!empty($_POST["pdf_data"])){ |
|
| 31 | +if (!empty($_POST["pdf_data"])) { |
|
| 32 | 32 | $pdf_data = unserialize(base64_decode($_POST["pdf_data"])); |
| 33 | -}elseif(!empty($pdf_data)){ |
|
| 33 | +}elseif (!empty($pdf_data)) { |
|
| 34 | 34 | |
| 35 | -}else{ |
|
| 35 | +}else { |
|
| 36 | 36 | error_reporting(0); |
| 37 | 37 | include "header.php"; |
| 38 | 38 | error_reporting(0); |
| 39 | 39 | |
| 40 | - if(planet_parse_args($args_num, $args, $args_str)){ |
|
| 40 | + if (planet_parse_args($args_num, $args, $args_str)) { |
|
| 41 | 41 | $args["article"] = @$args_num[0]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $article_id = intval( empty($_GET["article"])?@$args["article"]:$_GET["article"] ); |
|
| 44 | + $article_id = intval(empty($_GET["article"]) ? @$args["article"] : $_GET["article"]); |
|
| 45 | 45 | |
| 46 | - $article_handler =& xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
| 47 | - $article_obj =& $article_handler->get($article_id); |
|
| 46 | + $article_handler = & xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
| 47 | + $article_obj = & $article_handler->get($article_id); |
|
| 48 | 48 | |
| 49 | 49 | $article_data = array(); |
| 50 | 50 | |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | // Build the pdf_data array |
| 69 | 69 | $pdf_data["title"] = $article_data["title"]; |
| 70 | 70 | $pdf_data["author"] = $article_data["author"]; |
| 71 | - $pdf_data["date"] = $article_data["time"]; |
|
| 72 | - $pdf_data["content"] = ""; |
|
| 73 | - if($article_data["summary"]){ |
|
| 71 | + $pdf_data["date"] = $article_data["time"]; |
|
| 72 | + $pdf_data["content"] = ""; |
|
| 73 | + if ($article_data["summary"]) { |
|
| 74 | 74 | $pdf_data["content"] .= planet_constant("MD_SUMMARY").": ".$article_data["summary"]."<br /><br />"; |
| 75 | 75 | } |
| 76 | 76 | $pdf_data["content"] .= $article_data["text"]."<br />"; |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | |
| 28 | -if (!defined("XOOPS_ROOT_PATH")){ exit(); } |
|
| 28 | +if (!defined("XOOPS_ROOT_PATH")) { exit(); } |
|
| 29 | 29 | |
| 30 | 30 | include dirname(__FILE__)."/vars.php"; |
| 31 | 31 | mod_loadFunctions("", $GLOBALS["moddirname"]); |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | |
| 28 | -if (!defined('XOOPS_ROOT_PATH')){ exit(); } |
|
| 28 | +if (!defined('XOOPS_ROOT_PATH')) { exit(); } |
|
| 29 | 29 | |
| 30 | 30 | $current_path = __FILE__; |
| 31 | -if ( DIRECTORY_SEPARATOR != '/' ) $current_path = str_replace( strpos( $current_path, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path); |
|
| 32 | -$url_arr = explode('/',strstr($current_path,'/modules/')); |
|
| 31 | +if (DIRECTORY_SEPARATOR != '/') $current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path); |
|
| 32 | +$url_arr = explode('/', strstr($current_path, '/modules/')); |
|
| 33 | 33 | $GLOBALS["moddirname"] = $url_arr[2]; |
| 34 | 34 | |
| 35 | -if(!defined("planet_FUNCTIONS")): |
|
| 36 | -define("planet_FUNCTIONS",1); |
|
| 35 | +if (!defined("planet_FUNCTIONS")): |
|
| 36 | +define("planet_FUNCTIONS", 1); |
|
| 37 | 37 | |
| 38 | 38 | require XOOPS_ROOT_PATH."/modules/".$GLOBALS["moddirname"]."/include/vars.php"; |
| 39 | 39 | include_once(XOOPS_ROOT_PATH."/class/xoopslists.php"); |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @var mixed $messages |
| 46 | 46 | */ |
| 47 | -function planet_message( $message ) |
|
| 47 | +function planet_message($message) |
|
| 48 | 48 | { |
| 49 | - return mod_message( $message ); |
|
| 49 | + return mod_message($message); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -65,30 +65,30 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function planet_parse_args(&$args_numeric, &$args, &$args_string) |
| 67 | 67 | { |
| 68 | - $args_abb=array("a"=>"article", "b"=>"blog", "c"=>"category", "l"=>"list", "o"=>"sort", "s"=>"start", "u"=>"uid"); |
|
| 68 | + $args_abb = array("a"=>"article", "b"=>"blog", "c"=>"category", "l"=>"list", "o"=>"sort", "s"=>"start", "u"=>"uid"); |
|
| 69 | 69 | $args = array(); |
| 70 | 70 | $args_numeric = array(); |
| 71 | 71 | $args_string = array(); |
| 72 | - if(preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", $_SERVER['REQUEST_URI'], $matches)){ |
|
| 72 | + if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", $_SERVER['REQUEST_URI'], $matches)) { |
|
| 73 | 73 | $vars = preg_split("/[\/|&]/", $matches[1]); |
| 74 | 74 | $vars = array_map("trim", $vars); |
| 75 | - if(count($vars)>0) { |
|
| 76 | - foreach($vars as $var){ |
|
| 77 | - if(is_numeric($var)){ |
|
| 75 | + if (count($vars)>0) { |
|
| 76 | + foreach ($vars as $var) { |
|
| 77 | + if (is_numeric($var)) { |
|
| 78 | 78 | $args_numeric[] = $var; |
| 79 | - }elseif(false === strpos($var, "=")){ |
|
| 80 | - if(is_numeric(substr($var, 1))){ |
|
| 79 | + }elseif (false === strpos($var, "=")) { |
|
| 80 | + if (is_numeric(substr($var, 1))) { |
|
| 81 | 81 | $args[$args_abb[strtolower($var{0})]] = intval(substr($var, 1)); |
| 82 | - }else{ |
|
| 82 | + }else { |
|
| 83 | 83 | $args_string[] = urldecode($var); |
| 84 | 84 | } |
| 85 | - }else{ |
|
| 85 | + }else { |
|
| 86 | 86 | parse_str($var, $args); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | - return (count($args)+count($args_numeric)+count($args_string) == 0)?null:true; |
|
| 91 | + return (count($args)+count($args_numeric)+count($args_string) == 0) ? null : true; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -100,21 +100,21 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return bool true on success |
| 102 | 102 | */ |
| 103 | -function planet_parse_class($class_string, $pattern="", $replacement="") |
|
| 103 | +function planet_parse_class($class_string, $pattern = "", $replacement = "") |
|
| 104 | 104 | { |
| 105 | - if(empty($class_string)) return; |
|
| 105 | + if (empty($class_string)) return; |
|
| 106 | 106 | $patterns = array("/\[CLASS_PREFIX\]/"); |
| 107 | 107 | $replacements = array(ucfirst(strtolower($GLOBALS["moddirname"]))); |
| 108 | - if(!empty($pattern) && !is_array($pattern) && !is_array($replacement)){ |
|
| 108 | + if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) { |
|
| 109 | 109 | $pattern = array($pattern); |
| 110 | 110 | $replacement = array($replacement); |
| 111 | 111 | } |
| 112 | - if(is_array($pattern) && count($pattern)>0){ |
|
| 112 | + if (is_array($pattern) && count($pattern)>0) { |
|
| 113 | 113 | $ii = 0; |
| 114 | - foreach($pattern as $pat){ |
|
| 115 | - if(!in_array($pat, $patterns)){ |
|
| 114 | + foreach ($pattern as $pat) { |
|
| 115 | + if (!in_array($pat, $patterns)) { |
|
| 116 | 116 | $patterns[] = $pat; |
| 117 | - $replacements[] = isset($replacement[$ii])?$replacement[$ii]:""; |
|
| 117 | + $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : ""; |
|
| 118 | 118 | } |
| 119 | 119 | $ii++; |
| 120 | 120 | } |
@@ -133,21 +133,21 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return bool true on success |
| 135 | 135 | */ |
| 136 | -function planet_parse_function($function_string, $pattern="", $replacement="") |
|
| 136 | +function planet_parse_function($function_string, $pattern = "", $replacement = "") |
|
| 137 | 137 | { |
| 138 | - if(empty($function_string)) return; |
|
| 138 | + if (empty($function_string)) return; |
|
| 139 | 139 | $patterns = array("/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"); |
| 140 | 140 | $replacements = array($GLOBALS["moddirname"], $GLOBALS["VAR_PREFIX"]); |
| 141 | - if(!empty($pattern) && !is_array($pattern) && !is_array($replacement)){ |
|
| 141 | + if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) { |
|
| 142 | 142 | $pattern = array($pattern); |
| 143 | 143 | $replacement = array($replacement); |
| 144 | 144 | } |
| 145 | - if(is_array($pattern) && count($pattern)>0){ |
|
| 145 | + if (is_array($pattern) && count($pattern)>0) { |
|
| 146 | 146 | $ii = 0; |
| 147 | - foreach($pattern as $pat){ |
|
| 148 | - if(!in_array($pat, $patterns)){ |
|
| 147 | + foreach ($pattern as $pat) { |
|
| 148 | + if (!in_array($pat, $patterns)) { |
|
| 149 | 149 | $patterns[] = $pat; |
| 150 | - $replacements[] = isset($replacement[$ii])?$replacement[$ii]:""; |
|
| 150 | + $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : ""; |
|
| 151 | 151 | } |
| 152 | 152 | $ii++; |
| 153 | 153 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function planet_formatTimestamp($time, $format = "") |
| 164 | 164 | { |
| 165 | - if(empty($time)) return ""; |
|
| 165 | + if (empty($time)) return ""; |
|
| 166 | 166 | return formatTimestamp($time, $format); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -170,9 +170,9 @@ discard block |
||
| 170 | 170 | * Function to a list of user names associated with their user IDs |
| 171 | 171 | * |
| 172 | 172 | */ |
| 173 | -function &planet_getUnameFromId( $userid, $usereal = 0, $linked = false ) |
|
| 173 | +function &planet_getUnameFromId($userid, $usereal = 0, $linked = false) |
|
| 174 | 174 | { |
| 175 | - if(!is_array($userid)) $userid = array($userid); |
|
| 175 | + if (!is_array($userid)) $userid = array($userid); |
|
| 176 | 176 | $users = mod_getUnameFromIds($userid, $usereal, $linked); |
| 177 | 177 | |
| 178 | 178 | return $users; |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | function &planet_parseLinks($text) |
| 190 | 190 | { |
| 191 | - $myts =& MyTextSanitizer::getInstance(); |
|
| 191 | + $myts = & MyTextSanitizer::getInstance(); |
|
| 192 | 192 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
| 193 | 193 | $links = array(); |
| 194 | - if(count($link_array)>0) foreach($link_array as $link){ |
|
| 195 | - @list($url, $title) = array_map("trim",preg_split("/ /", $link, 2)); |
|
| 196 | - if(empty($url)) continue; |
|
| 194 | + if (count($link_array)>0) foreach ($link_array as $link) { |
|
| 195 | + @list($url, $title) = array_map("trim", preg_split("/ /", $link, 2)); |
|
| 196 | + if (empty($url)) continue; |
|
| 197 | 197 | //if(empty($title)) $title = $url; |
| 198 | 198 | $links[] = array("url"=>$url, "title"=>$myts->htmlSpecialChars($title)); |
| 199 | 199 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | return $GLOBALS["VAR_PREFIX"]."_".$pagename.".html"; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | -function planet_adminmenu ($currentoption = -1) |
|
| 208 | +function planet_adminmenu($currentoption = -1) |
|
| 209 | 209 | { |
| 210 | 210 | loadModuleAdminMenu($currentoption, ""); |
| 211 | 211 | return; |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | function planet_com_trackback(&$article, &$comment) |
| 220 | 220 | { |
| 221 | - $blog_handler =& xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
| 222 | - $blog_obj =& $blog_handler->get($article->getVar("blog_id")); |
|
| 223 | - if(!$pattern = $blog_obj->getVar("blog_trackback")) return false; |
|
| 224 | - @list($pat, $rep) = array_map("trim",preg_split("#[\s]+#", $pattern)); |
|
| 221 | + $blog_handler = & xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
| 222 | + $blog_obj = & $blog_handler->get($article->getVar("blog_id")); |
|
| 223 | + if (!$pattern = $blog_obj->getVar("blog_trackback")) return false; |
|
| 224 | + @list($pat, $rep) = array_map("trim", preg_split("#[\s]+#", $pattern)); |
|
| 225 | 225 | $trackback_url = preg_replace("#".$pat."#", $rep, $article_obj->getVar("art_link")); |
| 226 | 226 | return planet_trackback($trackback_url, $article); |
| 227 | 227 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $title = xoops_utf8_encode($title); |
| 237 | 237 | $excerpt = xoops_utf8_encode($excerpt); |
| 238 | 238 | $blog_name = xoops_utf8_encode($blog_name); |
| 239 | - $charset="utf-8"; |
|
| 239 | + $charset = "utf-8"; |
|
| 240 | 240 | $title1 = urlencode($title); |
| 241 | 241 | $excerpt1 = urlencode($excerpt); |
| 242 | 242 | $name1 = urlencode($blog_name); |
@@ -244,34 +244,34 @@ discard block |
||
| 244 | 244 | $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
| 245 | 245 | $trackback_url = parse_url($trackback_url); |
| 246 | 246 | |
| 247 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?'.$trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
| 247 | + $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n"; |
|
| 248 | 248 | $http_request .= "Host: ".$trackback_url["host"]."\r\n"; |
| 249 | 249 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=".$charset."\r\n"; |
| 250 | 250 | $http_request .= "Content-Length: ".strlen($query_string)."\r\n"; |
| 251 | - $http_request .= "User-Agent: XOOPS Blogs/" . XOOPS_VERSION; |
|
| 251 | + $http_request .= "User-Agent: XOOPS Blogs/".XOOPS_VERSION; |
|
| 252 | 252 | $http_request .= "\r\n\r\n"; |
| 253 | 253 | $http_request .= $query_string; |
| 254 | - if ( '' == $trackback_url['port'] ){ |
|
| 254 | + if ('' == $trackback_url['port']) { |
|
| 255 | 255 | $trackback_url['port'] = 80; |
| 256 | 256 | } |
| 257 | 257 | $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
| 258 | 258 | @fputs($fs, $http_request); |
| 259 | - if($xoopsModuleConfig["do_debug"]) { |
|
| 259 | + if ($xoopsModuleConfig["do_debug"]) { |
|
| 260 | 260 | $debug_file = XOOPS_CACHE_PATH."/".$GLOBALS["moddirname"]."_trackback.log"; |
| 261 | 261 | $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
| 262 | 262 | $fr .= "CHARSET:$charset\n"; |
| 263 | 263 | $fr .= "NAME:$blog_name\n"; |
| 264 | 264 | $fr .= "TITLE:".$title."\n"; |
| 265 | 265 | $fr .= "EXCERPT:$excerpt\n\n"; |
| 266 | - while(!@feof($fs)) { |
|
| 266 | + while (!@feof($fs)) { |
|
| 267 | 267 | $fr .= @fgets($fs, 4096); |
| 268 | 268 | } |
| 269 | 269 | $fr .= "\n\n"; |
| 270 | 270 | |
| 271 | - if($fp = fopen($debug_file, "a")){ |
|
| 271 | + if ($fp = fopen($debug_file, "a")) { |
|
| 272 | 272 | fwrite($fp, $fr); |
| 273 | 273 | fclose($fp); |
| 274 | - }else{ |
|
| 274 | + }else { |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | @fclose($fs); |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | * Function to ping servers |
| 283 | 283 | */ |
| 284 | 284 | function planet_ping($server, $id) { |
| 285 | - if(is_array($server)){ |
|
| 286 | - foreach($server as $serv){ |
|
| 285 | + if (is_array($server)) { |
|
| 286 | + foreach ($server as $serv) { |
|
| 287 | 287 | planet_ping($serv, $id); |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $home = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/"; |
| 302 | 302 | $rss2_url = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/xml.php".URL_DELIMITER."rss2.0/".$id; |
| 303 | 303 | |
| 304 | - if ( !$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url ) ) // then try a normal ping |
|
| 304 | + if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) // then try a normal ping |
|
| 305 | 305 | $client->query('weblogUpdates.ping', $blogname, $home); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | echo "<message>$error_message</message>\n"; |
| 320 | 320 | echo "</response>"; |
| 321 | 321 | die(); |
| 322 | - } else { |
|
| 322 | + }else { |
|
| 323 | 323 | echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
| 324 | 324 | echo "<response>\n"; |
| 325 | 325 | echo "<error>0</error>\n"; |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | function planet_setcookie($name, $string = '', $expire = 0) |
| 336 | 336 | { |
| 337 | - if(is_array($string)) { |
|
| 337 | + if (is_array($string)) { |
|
| 338 | 338 | $value = array(); |
| 339 | - foreach ($string as $key => $val){ |
|
| 340 | - $value[]=$key."|".$val; |
|
| 339 | + foreach ($string as $key => $val) { |
|
| 340 | + $value[] = $key."|".$val; |
|
| 341 | 341 | } |
| 342 | 342 | $string = implode(",", $value); |
| 343 | 343 | } |
@@ -347,12 +347,12 @@ discard block |
||
| 347 | 347 | function planet_getcookie($name, $isArray = false) |
| 348 | 348 | { |
| 349 | 349 | $value = isset($_COOKIE[$GLOBALS["VAR_PREFIX"].$name]) ? $_COOKIE[$GLOBALS["VAR_PREFIX"].$name] : null; |
| 350 | - if($isArray) { |
|
| 351 | - $_value = ($value)?explode(",", $value):array(); |
|
| 350 | + if ($isArray) { |
|
| 351 | + $_value = ($value) ? explode(",", $value) : array(); |
|
| 352 | 352 | $value = array(); |
| 353 | - if(count($_value)>0) foreach($_value as $string){ |
|
| 354 | - $key = substr($string, 0, strpos($string,"|")); |
|
| 355 | - $val = substr($string, (strpos($string,"|")+1)); |
|
| 353 | + if (count($_value)>0) foreach ($_value as $string) { |
|
| 354 | + $key = substr($string, 0, strpos($string, "|")); |
|
| 355 | + $val = substr($string, (strpos($string, "|")+1)); |
|
| 356 | 356 | $value[$key] = $val; |
| 357 | 357 | } |
| 358 | 358 | unset($_value); |
@@ -379,9 +379,9 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | function planet_remote_content($url) |
| 381 | 381 | { |
| 382 | - if($data = planet_fetch_snoopy($url)) return $data; |
|
| 383 | - if($data = planet_fetch_CURL($url)) return $data; |
|
| 384 | - if($data = planet_fetch_fopen($url)) return $data; |
|
| 382 | + if ($data = planet_fetch_snoopy($url)) return $data; |
|
| 383 | + if ($data = planet_fetch_CURL($url)) return $data; |
|
| 384 | + if ($data = planet_fetch_fopen($url)) return $data; |
|
| 385 | 385 | return false; |
| 386 | 386 | } |
| 387 | 387 | |
@@ -390,20 +390,20 @@ discard block |
||
| 390 | 390 | require_once(XOOPS_ROOT_PATH."/class/snoopy.php"); |
| 391 | 391 | $snoopy = new Snoopy; |
| 392 | 392 | $data = ""; |
| 393 | - if (@$snoopy->fetch($url)){ |
|
| 394 | - $data = (is_array($snoopy->results))?implode("\n",$snoopy->results):$snoopy->results; |
|
| 393 | + if (@$snoopy->fetch($url)) { |
|
| 394 | + $data = (is_array($snoopy->results)) ? implode("\n", $snoopy->results) : $snoopy->results; |
|
| 395 | 395 | } |
| 396 | 396 | return $data; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | function planet_fetch_CURL($url) |
| 400 | 400 | { |
| 401 | - if (!function_exists('curl_init') ) return false; |
|
| 402 | - $ch = curl_init(); // initialize curl handle |
|
| 401 | + if (!function_exists('curl_init')) return false; |
|
| 402 | + $ch = curl_init(); // initialize curl handle |
|
| 403 | 403 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
| 404 | 404 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
| 405 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
| 406 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable |
|
| 405 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects |
|
| 406 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
|
| 407 | 407 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
| 408 | 408 | $data = curl_exec($ch); // run the whole process |
| 409 | 409 | curl_close($ch); |
@@ -412,25 +412,25 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | function planet_fetch_fopen($url) |
| 414 | 414 | { |
| 415 | - if(!$fp = @fopen ($url, 'r')) return false; |
|
| 415 | + if (!$fp = @fopen($url, 'r')) return false; |
|
| 416 | 416 | $data = ""; |
| 417 | 417 | while (!feof($fp)) { |
| 418 | - $data .= fgets ($fp, 1024); |
|
| 418 | + $data .= fgets($fp, 1024); |
|
| 419 | 419 | } |
| 420 | 420 | fclose($fp); |
| 421 | 421 | return $data; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | -function planet_strrpos($haystack, $needle, $offset = 0 ) |
|
| 424 | +function planet_strrpos($haystack, $needle, $offset = 0) |
|
| 425 | 425 | { |
| 426 | - if( substr(phpversion(),0,1) == 5 ){ |
|
| 426 | + if (substr(phpversion(), 0, 1) == 5) { |
|
| 427 | 427 | return strrpos($haystack, $needle, $offset); |
| 428 | 428 | } |
| 429 | 429 | $index = strpos(strrev($haystack), strrev($needle)); |
| 430 | - if($index === false) { |
|
| 430 | + if ($index === false) { |
|
| 431 | 431 | return false; |
| 432 | 432 | } |
| 433 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
| 433 | + $index = strlen($haystack)-strlen($needle)-$index; |
|
| 434 | 434 | return $index; |
| 435 | 435 | } |
| 436 | 436 | endif; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | exit(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if(!@include_once XOOPS_ROOT_PATH."/Frameworks/transfer/transfer.php" ) return null; |
|
| 20 | +if (!@include_once XOOPS_ROOT_PATH."/Frameworks/transfer/transfer.php") return null; |
|
| 21 | 21 | |
| 22 | 22 | // Specify the addons to skip for the module |
| 23 | 23 | $GLOBALS["addons_skip_module"] = array("pm", "email"); |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | The functions loaded on initializtion |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | -if (!defined('XOOPS_ROOT_PATH')){ exit(); } |
|
| 34 | -if (!defined('PLANET_INI')){ exit(); } |
|
| 33 | +if (!defined('XOOPS_ROOT_PATH')) { exit(); } |
|
| 34 | +if (!defined('PLANET_INI')) { exit(); } |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | -if(!defined("PLANET_FUNCTIONS_INI")): |
|
| 38 | -define("PLANET_FUNCTIONS_INI",1); |
|
| 37 | +if (!defined("PLANET_FUNCTIONS_INI")): |
|
| 38 | +define("PLANET_FUNCTIONS_INI", 1); |
|
| 39 | 39 | |
| 40 | 40 | function planet_constant($name) |
| 41 | 41 | { |
@@ -55,25 +55,25 @@ discard block |
||
| 55 | 55 | function planet_load_config() |
| 56 | 56 | { |
| 57 | 57 | static $moduleConfig; |
| 58 | - if(isset($moduleConfig)){ |
|
| 58 | + if (isset($moduleConfig)) { |
|
| 59 | 59 | return $moduleConfig; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if(is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname") == $GLOBALS["moddirname"]){ |
|
| 63 | - $moduleConfig =& $GLOBALS["xoopsModuleConfig"]; |
|
| 64 | - }else{ |
|
| 62 | + if (is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname") == $GLOBALS["moddirname"]) { |
|
| 63 | + $moduleConfig = & $GLOBALS["xoopsModuleConfig"]; |
|
| 64 | + }else { |
|
| 65 | 65 | $module_handler = &xoops_gethandler('module'); |
| 66 | 66 | $module = $module_handler->getByDirname($GLOBALS["moddirname"]); |
| 67 | 67 | |
| 68 | 68 | $config_handler = &xoops_gethandler('config'); |
| 69 | 69 | $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid'))); |
| 70 | - $configs =& $config_handler->getConfigs($criteria); |
|
| 71 | - foreach(array_keys($configs) as $i){ |
|
| 70 | + $configs = & $config_handler->getConfigs($criteria); |
|
| 71 | + foreach (array_keys($configs) as $i) { |
|
| 72 | 72 | $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
| 73 | 73 | } |
| 74 | 74 | unset($configs); |
| 75 | 75 | } |
| 76 | - if($customConfig = @include(XOOPS_ROOT_PATH."/modules/".$GLOBALS["moddirname"]."/include/plugin.php")){ |
|
| 76 | + if ($customConfig = @include(XOOPS_ROOT_PATH."/modules/".$GLOBALS["moddirname"]."/include/plugin.php")) { |
|
| 77 | 77 | $moduleConfig = array_merge($moduleConfig, $customConfig); |
| 78 | 78 | } |
| 79 | 79 | return $moduleConfig; |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | function planet_define_url_delimiter() |
| 83 | 83 | { |
| 84 | - if(defined("URL_DELIMITER")){ |
|
| 85 | - if(!in_array(URL_DELIMITER, array("?","/"))) die("Exit on security"); |
|
| 86 | - }else{ |
|
| 84 | + if (defined("URL_DELIMITER")) { |
|
| 85 | + if (!in_array(URL_DELIMITER, array("?", "/"))) die("Exit on security"); |
|
| 86 | + }else { |
|
| 87 | 87 | $moduleConfig = planet_load_config(); |
| 88 | - if(empty($moduleConfig["do_urw"])){ |
|
| 88 | + if (empty($moduleConfig["do_urw"])) { |
|
| 89 | 89 | define("URL_DELIMITER", "?"); |
| 90 | - }else{ |
|
| 90 | + }else { |
|
| 91 | 91 | define("URL_DELIMITER", "/"); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | |
| 28 | -if(!defined("PLANET_INI")) define("PLANET_INI",1); |
|
| 28 | +if (!defined("PLANET_INI")) define("PLANET_INI", 1); |
|
| 29 | 29 | |
| 30 | 30 | /* |
| 31 | 31 | * The prefix for database table name prefix |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | // include customized variables |
| 55 | -if( is_object($GLOBALS["xoopsModule"]) && $GLOBALS["moddirname"] == $GLOBALS["xoopsModule"]->getVar("dirname", "n") ) { |
|
| 55 | +if (is_object($GLOBALS["xoopsModule"]) && $GLOBALS["moddirname"] == $GLOBALS["xoopsModule"]->getVar("dirname", "n")) { |
|
| 56 | 56 | $GLOBALS["xoopsModuleConfig"] = planet_load_config(); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | if (!defined("XOOPS_ROOT_PATH")) exit(); |
| 28 | 28 | |
| 29 | -require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php"); |
|
| 30 | -$category_handler =& xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
| 29 | +require_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); |
|
| 30 | +$category_handler = & xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
| 31 | 31 | |
| 32 | 32 | $form = new XoopsThemeForm(_EDIT, "formblog", xoops_getenv('PHP_SELF'), "POST", true); |
| 33 | 33 | |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $categories_option = $category_handler->getList(); |
| 44 | 44 | natsort($categories_option); |
| 45 | -if(count($categories_option)) { |
|
| 45 | +if (count($categories_option)) { |
|
| 46 | 46 | $cat_option_tray = new XoopsFormElementTray(planet_constant("MD_CATEGORY"), "<br />"); |
| 47 | 47 | $options = array(0=>_NONE); |
| 48 | - foreach($categories_option as $id=>$title){ |
|
| 48 | + foreach ($categories_option as $id=>$title) { |
|
| 49 | 49 | $options[$id] = $title; |
| 50 | 50 | } |
| 51 | 51 | $cat_select = new XoopsFormSelect("", "categories", $categories, 3, true); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /* For admin only */ |
| 58 | -if(is_object($xoopsUser) && $xoopsUser->isAdmin()){ |
|
| 58 | +if (is_object($xoopsUser) && $xoopsUser->isAdmin()) { |
|
| 59 | 59 | $status_option_tray = new XoopsFormElementTray(planet_constant("MD_STATUS"), "<br />"); |
| 60 | 60 | $status_select = new XoopsFormSelect("", "blog_status", $blog_obj->getVar("blog_status")); |
| 61 | 61 | $status_select->addOptionArray(array("0"=>planet_constant("MD_PENDING"), "1"=>planet_constant("MD_ACTIVE"), "2"=>planet_constant("MD_FEATURED"))); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | |
| 28 | -if (!defined('XOOPS_ROOT_PATH')){ exit(); } |
|
| 28 | +if (!defined('XOOPS_ROOT_PATH')) { exit(); } |
|
| 29 | 29 | |
| 30 | 30 | include dirname(__FILE__)."/vars.php"; |
| 31 | 31 | mod_loadFunctions("", $GLOBALS["moddirname"]); |