| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | Class MvBlog_common { |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | public $db; |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | public $version = "%%VERSION%%"; |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | public $plugins = array(); |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | public $authors = array(); |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | public $users = array(); |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | public $categories = array(); |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | public $dossiers = array(); |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | public $settings = array(); |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | public $menuitems = array(); |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | public $webroot = ""; |
|---|
| 132 | public $plugman; |
|---|
| 133 | public $active_plugins = array(); |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | public function __construct($plugindir="plugins/", $adminmode=0, $upgrade=0) { |
|---|
| 149 | |
|---|
| 150 | if (session_id() == "") |
|---|
| 151 | session_start(); |
|---|
| 152 | ob_start(); |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | $this->_handle_php_bugs(); |
|---|
| 156 | |
|---|
| 157 | |
|---|
| 158 | $this->_handle_magic_quotes(); |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | if (array_key_exists("config", $GLOBALS)) |
|---|
| 162 | $inisettings = $GLOBALS["config"]->getSettings(); |
|---|
| 163 | else |
|---|
| 164 | $inisettings = array(); |
|---|
| 165 | |
|---|
| 166 | if (!array_key_exists("database", $inisettings)) |
|---|
| 167 | $inisettings["database"] = ""; |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | $this->_init_db($inisettings["database"]); |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | $this->_get_settings(); |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | putenv("LANG=".$this->lang); |
|---|
| 177 | setlocale(LC_ALL, $this->lang); |
|---|
| 178 | $domain = 'messages'; |
|---|
| 179 | if ($adminmode) |
|---|
| 180 | bindtextdomain($domain, "../locale"); |
|---|
| 181 | else |
|---|
| 182 | bindtextdomain($domain, "locale"); |
|---|
| 183 | textdomain($domain); |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | if (function_exists("date_default_timezone_get") && function_exists("date_default_timezone_set")) { |
|---|
| 187 | $tz = @date_default_timezone_get(); |
|---|
| 188 | date_default_timezone_set($tz); |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | $this->_get_webroot(); |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | $this->_get_active_plugins(); |
|---|
| 196 | |
|---|
| 197 | if (!$upgrade) { |
|---|
| 198 | |
|---|
| 199 | $this->_get_authors(); |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | $this->_get_users(); |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | $this->_get_categories(); |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | $this->_get_dossiers(); |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | $this->_get_menuitems(); |
|---|
| 212 | } |
|---|
| 213 | |
|---|
| 214 | |
|---|
| 215 | require_once("plugins.php"); |
|---|
| 216 | $plugman = new MvBlog_pluginmgr($plugindir, $this); |
|---|
| 217 | $plugman->set_active_plugins($this->active_plugins); |
|---|
| 218 | $this->plugman = $plugman; |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | protected function _handle_php_bugs() { |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | if (isset($HTTP_POST_VARS['GLOBALS']) || isset($_POST['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($_FILES['GLOBALS']) || |
|---|
| 237 | isset($HTTP_GET_VARS['GLOBALS']) || isset($_GET['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS']) || isset($_COOKIE['GLOBALS'])) |
|---|
| 238 | die("GLOBAL GPC hacking attemt!"); |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | if (ini_get("register_globals")) { |
|---|
| 247 | foreach ($_GET as $key => $value) |
|---|
| 248 | if (preg_match("/^([a-z]|_){1}([a-z0-9]|_)*$/si", $key)) |
|---|
| 249 | unset($GLOBALS[$key]); |
|---|
| 250 | |
|---|
| 251 | foreach ($_POST as $key => $value) |
|---|
| 252 | if (preg_match('/^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$/', $key)) |
|---|
| 253 | unset($GLOBALS[$key]); |
|---|
| 254 | |
|---|
| 255 | foreach ($_COOKIE as $key => $value) |
|---|
| 256 | if (preg_match('/^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$/', $key)) |
|---|
| 257 | unset($GLOBALS[$key]); |
|---|
| 258 | |
|---|
| 259 | foreach ($_FILES as $key => $value) |
|---|
| 260 | if (preg_match('/^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$/', $key)) |
|---|
| 261 | unset($GLOBALS[$key]); |
|---|
| 262 | |
|---|
| 263 | foreach ($_REQUEST as $key => $value) |
|---|
| 264 | if (preg_match('/^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$/', $key)) |
|---|
| 265 | unset($GLOBALS[$key]); |
|---|
| 266 | } |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | protected function _handle_magic_quotes() { |
|---|
| 275 | |
|---|
| 276 | set_magic_quotes_runtime(0); |
|---|
| 277 | if(get_magic_quotes_gpc() || ini_get("magic_quotes_sybase")) { |
|---|
| 278 | $_GET = $this->_magic_quotes_strip($_GET); |
|---|
| 279 | $_POST = $this->_magic_quotes_strip($_POST); |
|---|
| 280 | $_COOKIE = $this->_magic_quotes_strip($_COOKIE); |
|---|
| 281 | $_REQUEST = array_merge($_GET, $_POST, $_COOKIE); |
|---|
| 282 | $_FILES = $this->_magic_quotes_strip($_FILES); |
|---|
| 283 | $_ENV = $this->_magic_quotes_strip($_ENV); |
|---|
| 284 | $_SERVER = $this->_magic_quotes_strip($_SERVER); |
|---|
| 285 | } |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | |
|---|
| 294 | |
|---|
| 295 | protected function _magic_quotes_strip($mixed) { |
|---|
| 296 | if(is_array($mixed)) |
|---|
| 297 | return array_map(array($this, "_magic_quotes_strip"), $mixed); |
|---|
| 298 | return stripslashes($mixed); |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | |
|---|
| 302 | |
|---|
| 303 | |
|---|
| 304 | |
|---|
| 305 | protected function _init_db($settings = "") { |
|---|
| 306 | require_once("MDB2.php"); |
|---|
| 307 | |
|---|
| 308 | if ($settings["type"] == "sqlite") { |
|---|
| 309 | if (is_dir("db")) |
|---|
| 310 | $dsn = sprintf("%s:///db/%s.db?mode=0666", $settings["type"], $settings["database"]); |
|---|
| 311 | elseif (is_dir("../db")) |
|---|
| 312 | $dsn = sprintf("%s:///../db/%s.db?mode=0666", $settings["type"], $settings["database"]); |
|---|
| 313 | } else { |
|---|
| 314 | $dsn = $settings["type"]."://".$settings["username"].":".$settings["password"]."@tcp(".$settings["hostname"].")/".$settings["database"]; |
|---|
| 315 | $dsn = sprintf("%s://%s:%s@tcp(%s)/%s", |
|---|
| 316 | $settings["type"], $settings["username"], $settings["password"], |
|---|
| 317 | $settings["hostname"], $settings["database"]); |
|---|
| 318 | } |
|---|
| 319 | |
|---|
| 320 | $options = array( |
|---|
| 321 | "debug" => 2, |
|---|
| 322 | "portability" => MDB2_PORTABILITY_ALL, |
|---|
| 323 | ); |
|---|
| 324 | |
|---|
| 325 | $db =& MDB2::connect($dsn, $options); |
|---|
| 326 | if (PEAR::isError($db)) { |
|---|
| 327 | die($db->getMessage()); |
|---|
| 328 | } |
|---|
| 329 | $this->db = $db; |
|---|
| 330 | } |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | |
|---|
| 336 | |
|---|
| 337 | |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | |
|---|
| 343 | |
|---|
| 344 | |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | |
|---|
| 351 | public function _sanitize($data, $options=array()) { |
|---|
| 352 | $allowed = "a-zA-Z0-9_\-"; |
|---|
| 353 | $allowed .= preg_quote("(){}"); |
|---|
| 354 | |
|---|
| 355 | if (array_key_exists("bbcode", $options )) { $allowed .= preg_quote("![]&@=+:/.?;,'\\\"", "/"); } |
|---|
| 356 | if (array_key_exists("space", $options )) { $allowed .= "\s"; } |
|---|
| 357 | if (array_key_exists("url", $options )) { $allowed .= preg_quote("+:/.?", "/"); } |
|---|
| 358 | if (array_key_exists("email", $options )) { $allowed .= preg_quote("@."); } |
|---|
| 359 | |
|---|
| 360 | $allowed = "/[^$allowed]/s"; |
|---|
| 361 | if (is_array($data)) { |
|---|
| 362 | |
|---|
| 363 | foreach ($data as $k=>$v) { |
|---|
| 364 | |
|---|
| 365 | if (is_array($v)) |
|---|
| 366 | $v = $this->_sanitize($v, $options); |
|---|
| 367 | |
|---|
| 368 | if (!preg_match("/[^a-zA-Z0-9_-]/s", $k)) { |
|---|
| 369 | |
|---|
| 370 | $_data[$k] = preg_replace($allowed, "", $v); |
|---|
| 371 | } |
|---|
| 372 | } |
|---|
| 373 | } else { |
|---|
| 374 | |
|---|
| 375 | $_data = preg_replace($allowed, "", $data); |
|---|
| 376 | } |
|---|
| 377 | return $_data; |
|---|
| 378 | } |
|---|
| 379 | |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | public function db_quote($field) { |
|---|
| 388 | |
|---|
| 389 | $dbtype = $this->db->dbsyntax; |
|---|
| 390 | switch ($dbtype) { |
|---|
| 391 | case "mysql" : |
|---|
| 392 | $return = "`".$field."`"; |
|---|
| 393 | break; |
|---|
| 394 | case "pgsql" : |
|---|
| 395 | $return = "\"".$field."\""; |
|---|
| 396 | break; |
|---|
| 397 | default : |
|---|
| 398 | $return = $field; |
|---|
| 399 | break; |
|---|
| 400 | } |
|---|
| 401 | return $return; |
|---|
| 402 | } |
|---|
| 403 | |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | public function strip_invalid_xml($data) { |
|---|
| 412 | $data = preg_replace("/ ref=\"[^\"].*\"/si", "", $data); |
|---|
| 413 | return $data; |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | |
|---|
| 417 | |
|---|
| 418 | |
|---|
| 419 | |
|---|
| 420 | |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | |
|---|
| 430 | public function parse_body($body, $format) { |
|---|
| 431 | switch ($format) { |
|---|
| 432 | case "BBC": |
|---|
| 433 | $body = $this->parse_bbcode($body); |
|---|
| 434 | break; |
|---|
| 435 | case "MW": |
|---|
| 436 | $body = $this->parse_mediawiki($body); |
|---|
| 437 | break; |
|---|
| 438 | } |
|---|
| 439 | |
|---|
| 440 | $body = $this->strip_invalid_xml(stripslashes($body)); |
|---|
| 441 | return $body; |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | |
|---|
| 446 | |
|---|
| 447 | |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | |
|---|
| 453 | |
|---|
| 454 | |
|---|
| 455 | public function parse_bbcode($data) { |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | $string = str_replace("\r", "", $data); |
|---|
| 462 | $string = str_replace("\n", "<br />", $string); |
|---|
| 463 | |
|---|
| 464 | $patterns = array( |
|---|
| 465 | '`\[ul\](.+?)\[/ul\]`is', |
|---|
| 466 | '`\[li\](.+?)\[/li\]`is', |
|---|
| 467 | '`\[quote\](.+?)\[/quote\]`is', |
|---|
| 468 | '`\[indent](.+?)\[/indent\]`is', |
|---|
| 469 | '`\[code](.+?)\[/code\]`is', |
|---|
| 470 | '`\[b\](.+?)\[/b\]`is', |
|---|
| 471 | '`\[i\](.+?)\[/i\]`is', |
|---|
| 472 | '`\[u\](.+?)\[/u\]`is', |
|---|
| 473 | '`\[strike\](.+?)\[/strike\]`is', |
|---|
| 474 | '`\[color=#([0-9]{6})\](.+?)\[/color\]`is', |
|---|
| 475 | '`\[email\](.+?)\[/email\]`is', |
|---|
| 476 | '`\[img\](.+?)\[/img\]`is', |
|---|
| 477 | '`\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\](.*?)\[/url\]`si', |
|---|
| 478 | '`\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\[/url\]`si', |
|---|
| 479 | '`\[url\]((www|ftp)\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\[/url\]`si', |
|---|
| 480 | '`\[flash=([0-9]+),([0-9]+)\](.+?)\[/flash\]`is', |
|---|
| 481 | '`\[size=([1-6]+)\](.+?)\[/size\]`is' |
|---|
| 482 | ); |
|---|
| 483 | |
|---|
| 484 | $replaces = array( |
|---|
| 485 | '<ul>\1</ul>', |
|---|
| 486 | '<li class="noblock">\1</li>', |
|---|
| 487 | '<span class="quote">\1</span>', |
|---|
| 488 | '<pre>\\1</pre>', |
|---|
| 489 | '<pre class="code">\\1</pre>', |
|---|
| 490 | '<strong>\\1</strong>', |
|---|
| 491 | '<em>\\1</em>', |
|---|
| 492 | '<span style="border-bottom: 1px dotted">\\1</span>', |
|---|
| 493 | '<strike>\\1</strike>', |
|---|
| 494 | '<span style="color:#\1;">\2</span>', |
|---|
| 495 | '<a href="mailto:\1">\1</a>', |
|---|
| 496 | '<img src="\1" alt="" style="border:0px;" />', |
|---|
| 497 | '<a href="\1\2">\6</a>', |
|---|
| 498 | '<a href="\1\2">\1\2</a>', |
|---|
| 499 | '<a href="http://\1">\1</a>', |
|---|
| 500 | '<object width="\1" height="\2"><param name="movie" value="\3" /><embed src="\3" width="\1" height="\2"></embed></object>', |
|---|
| 501 | '<h\1>\2</h\1>' |
|---|
| 502 | ); |
|---|
| 503 | |
|---|
| 504 | $prev_string = ""; |
|---|
| 505 | while ($prev_string != $string) { |
|---|
| 506 | $prev_string = $string; |
|---|
| 507 | $string = preg_replace($patterns, $replaces , $string); |
|---|
| 508 | } |
|---|
| 509 | return(stripslashes($string)); |
|---|
| 510 | } |
|---|
| 511 | |
|---|
| 512 | |
|---|
| 513 | |
|---|
| 514 | |
|---|
| 515 | |
|---|
| 516 | |
|---|
| 517 | |
|---|
| 518 | |
|---|
| 519 | |
|---|
| 520 | |
|---|
| 521 | |
|---|
| 522 | public function parse_mediawiki($data) { |
|---|
| 523 | |
|---|
| 524 | set_include_path(get_include_path().PATH_SEPARATOR.dirname(__FILE__)."/../lib/"); |
|---|
| 525 | |
|---|
| 526 | require_once("Text/Wiki.php"); |
|---|
| 527 | |
|---|
| 528 | $wiki =& Text_Wiki::singleton("Mediawiki"); |
|---|
| 529 | $xhtml = $wiki->transform($data, "Xhtml"); |
|---|
| 530 | unset($wiki); |
|---|
| 531 | return $xhtml; |
|---|
| 532 | } |
|---|
| 533 | |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | |
|---|
| 538 | |
|---|
| 539 | protected function _get_settings() { |
|---|
| 540 | $res =& $this->db->query("SELECT settingname, settingvalue FROM settings"); |
|---|
| 541 | if (PEAR::isError($res)) { |
|---|
| 542 | die($res->getMessage()); |
|---|
| 543 | } |
|---|
| 544 | |
|---|
| 545 | |
|---|
| 546 | $settings = array(); |
|---|
| 547 | $settings["blogtitle"] = ""; |
|---|
| 548 | $settings["blogdescription"] = ""; |
|---|
| 549 | $settings["blogkeywords"] = ""; |
|---|
| 550 | $settings["postsperpage"] = 20; |
|---|
| 551 | $settings["cleanurl"] = ""; |
|---|
| 552 | $settings["allowanoncomments"] = 0; |
|---|
| 553 | $settings["dbversion"] = 0; |
|---|
| 554 | $settings["show_cat_icons"] = 0; |
|---|
| 555 | $settings["defaultpostformat"] = "HTML"; |
|---|
| 556 | $settings["wysiwyg"] = 0; |
|---|
| 557 | |
|---|
| 558 | while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { |
|---|
| 559 | $settings[$row["settingname"]] = $row["settingvalue"]; |
|---|
| 560 | } |
|---|
| 561 | if (array_key_exists("language", $settings)) |
|---|
| 562 | $this->lang = $settings["language"]; |
|---|
| 563 | $this->settings = $settings; |
|---|
| 564 | } |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | |
|---|
| 568 | |
|---|
| 569 | |
|---|
| 570 | |
|---|
| 571 | |
|---|
| 572 | protected function _get_webroot() { |
|---|
| 573 | if (array_key_exists("bloglocation", $this->settings) && !empty($this->settings["bloglocation"])) { |
|---|
| 574 | $webroot = $this->settings["bloglocation"]; |
|---|
| 575 | } else { |
|---|
| 576 | if (array_key_exists("HTTPS", $_SERVER) && strtolower($_SERVER["HTTPS"]) == "on") { |
|---|
| 577 | $webroot = "https://".strtolower($_SERVER["SERVER_NAME"]); |
|---|
| 578 | $httpsmode = 1; |
|---|
| 579 | } else { |
|---|
| 580 | $webroot = "http://".strtolower($_SERVER["SERVER_NAME"]); |
|---|
| 581 | $httpsmode = 0; |
|---|
| 582 | } |
|---|
| 583 | $webroot .= substr($_SERVER["SCRIPT_NAME"], 0, strpos($_SERVER["SCRIPT_NAME"], "index.php")); |
|---|
| 584 | } |
|---|
| 585 | |
|---|
| 586 | if (substr($webroot, -1, 1) != "/") |
|---|
| 587 | $webroot .= "/"; |
|---|
| 588 | $this->webroot = $webroot; |
|---|
| 589 | } |
|---|
| 590 | |
|---|
| 591 | |
|---|
| 592 | |
|---|
| 593 | |
|---|
| 594 | |
|---|
| 595 | public function _get_authors() { |
|---|
| 596 | |
|---|
| 597 | $authors = array( |
|---|
| 598 | 0 => array( |
|---|
| 599 | "login" => "login", |
|---|
| 600 | "password" => "", |
|---|
| 601 | "email" => "", |
|---|
| 602 | "fullname" => "", |
|---|
| 603 | "active" => 1, |
|---|
| 604 | "website" => "" |
|---|
| 605 | ) |
|---|
| 606 | ); |
|---|
| 607 | |
|---|
| 608 | $res =& $this->db->query("SELECT id,login |
|---|