Changeset 1453
- Timestamp:
- 12/13/07 22:34:55 (10 months ago)
- Files:
-
- releases/0.9/htaccess-dist (modified) (1 diff)
- releases/0.9/includes.php (modified) (1 diff)
- releases/0.9/index.php (modified) (1 diff)
- releases/0.9/install.php (modified) (5 diffs)
- releases/0.9/lib/setup.php (modified) (3 diffs)
- releases/0.9/lib/templates.php (modified) (4 diffs)
- releases/0.9/mod/blog/lib.php (modified) (2 diffs)
- releases/0.9/mod/commentwall/do_action.php (modified) (1 diff)
- releases/0.9/mod/community/lib.php (modified) (2 diffs)
- releases/0.9/mod/elggadmin/lib/elggadmin.inc.php (modified) (1 diff)
- releases/0.9/mod/pages/index.php (modified) (1 diff)
- releases/0.9/mod/pages/lib.php (modified) (1 diff)
- releases/0.9/mod/template/lib.php (modified) (1 diff)
- releases/0.9/mod/template/lib/templates_preview.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
releases/0.9/htaccess-dist
r1390 r1453 101 101 ReWriteRule ^register$ mod/invite/register.php 102 102 RewriteRule ^forgottenpassword$ mod/invite/forgotten_password.php 103 RewriteRule ^newpassword\/([A-Za-z0-9]+)$ mod/invite/ forgotten_password.php?passwordcode=$1103 RewriteRule ^newpassword\/([A-Za-z0-9]+)$ mod/invite/new_password.php?passwordcode=$1 104 104 105 105 RewriteRule ^([A-Za-z0-9]+)(\/)?$ profile/index.php?profile_name=$1 releases/0.9/includes.php
r1414 r1453 40 40 41 41 // Check if should go to install 42 if (empty($CFG->db user) || empty($CFG->dbpass)) {42 if (empty($CFG->dbname) || empty($CFG->dbuser)) { 43 43 header('Location: install.php'); 44 44 exit(); releases/0.9/index.php
r1378 r1453 3 3 global $CFG; 4 4 5 define('context', 'external'); 5 6 require_once(dirname(__FILE__)."/includes.php"); 6 7 releases/0.9/install.php
r1446 r1453 4 4 * @author Rolando Espinoza La Fuente <rho@prosoftpeople.com> 5 5 */ 6 require('./lib/config-defaults.php'); 7 require('./lib/elgglib.php'); 8 require('./mod/gettext/lib.php'); 6 global $CFG; 7 8 require(dirname(__FILE__).'/lib/config-defaults.php'); 9 10 require($CFG->dirroot.'lib/elgglib.php'); 11 require($CFG->dirroot.'mod/gettext/lib.php'); 9 12 10 13 global $db, $CFG; … … 16 19 17 20 // Prevent access on already running configuration 18 if (file_exists( './config.php') && config_check_db()) {21 if (file_exists($CFG->dirroot.'config.php') && config_check_db()) { 19 22 $config_ready = true; 20 23 $messages[] = __gettext('You have already configured Elgg and can safely remove the file <code>install.php</code> from your installation.'); … … 404 407 // 405 408 // reload config 406 include( './config.php');409 include($CFG->dirroot.'config.php'); 407 410 // setup database 408 require_once( './lib/adodb/adodb.inc.php');411 require_once($CFG->dirroot.'lib/adodb/adodb.inc.php'); 409 412 410 413 $db = &ADONewConnection($CFG->dbtype); … … 431 434 $CFG->debug = 8; 432 435 433 require_once( './lib/cache/lib.php');434 require_once( './lib/constants.php');435 require_once( './lib/elgglib.php'); // already included436 require_once( './lib/datalib.php');437 require_once( './lib/userlib.php');438 require_once( './lib/dbsetup.php');436 require_once($CFG->dirroot.'lib/cache/lib.php'); 437 require_once($CFG->dirroot.'lib/constants.php'); 438 require_once($CFG->dirroot.'lib/elgglib.php'); // already included 439 require_once($CFG->dirroot.'lib/datalib.php'); 440 require_once($CFG->dirroot.'lib/userlib.php'); 441 require_once($CFG->dirroot.'lib/dbsetup.php'); 439 442 } 440 443 ?> … … 534 537 535 538 // reload config 536 include( './config.php');539 include($CFG->dirroot.'config.php'); 537 540 // setup database 538 require_once( './lib/adodb/adodb.inc.php');541 require_once($CFG->dirroot.'lib/adodb/adodb.inc.php'); 539 542 540 543 $db = &ADONewConnection($CFG->dbtype); releases/0.9/lib/setup.php
r1420 r1453 177 177 $CFG->debug = 7; 178 178 } 179 error_reporting($CFG->debug); 179 180 // always log errors 181 @ini_set('log_errors', '1'); 182 @ini_set('error_log', $CFG->dataroot . 'errors.log'); 183 // hide error of screen, handled by error handler function 184 @ini_set('display_errors', '0'); 185 // handle errors 186 set_error_handler('elgg_error_handler'); 180 187 181 188 /// File permissions on created directories in the $CFG->dataroot … … 193 200 if (!is_writable($CFG->dataroot)) { 194 201 die("Your current dataroot directory, <strong>$CFG->dataroot</strong> is not writable by the webserver!"); 195 }196 197 if ($CFG->debug > 0) {198 @ini_set('log_errors', '1');199 @ini_set('error_log', $CFG->dataroot . 'errors.log');200 } else {201 // hide errors on production systems202 @ini_set('display_errors', '0');203 }204 205 if ($CFG->debug > 7) {206 @ini_set('display_errors', '1');207 202 } 208 203 … … 515 510 } 516 511 512 /** 513 * Basic error handler 514 */ 515 function elgg_error_handler($errno, $errmsg, $errfile, $errline, $errcontext) { 516 global $CFG; 517 518 $date = date('Y-m-d H:i:s'); 519 $fatal = "$errmsg (# $errno)"; 520 $file = "Error in line $errline of file $errfile"; 521 $script = "Script: {$_SERVER['PHP_SELF']}"; 522 523 switch ($errno) { 524 case E_USER_NOTICE: 525 case E_NOTICE: 526 if ($CFG->debug == 2047) { 527 $msg = "$date\nNotice: $fatal\n$file\n$script\n"; 528 error_log($msg); 529 } 530 break; 531 case E_USER_WARNING: 532 case E_WARNING: 533 case E_CORE_WARNING: 534 case E_COMPILE_WARNING: 535 //log errors if debug enabled 536 if ($CFG->debug >= 7) { 537 $msg = "$date\nWarning: $fatal\n$file\n$script\n"; 538 error_log($msg); 539 } 540 break; 541 case E_USER_ERROR: 542 case E_ERROR: 543 case E_PARSE: 544 case E_CORE_ERROR: 545 case E_COMPILE_ERROR: 546 $msg = "<em>$date</em>\n"; 547 $msg .= "<p><code>Error: $fatal</code></p>\n"; 548 $msg .= "<p><code>$file</code></p>\n"; 549 $msg .= "<p><code>$script</code></p>\n"; 550 551 if ($CFG->debug > 0) { 552 echo "<p><em>Disable debug mode if you do not want to display errors on screen browser</em></p>\n"; 553 echo $msg; 554 } else { 555 echo "<h2>Our apologies, the system can't complete your request</h2>\n"; 556 echo "<p><em>{$CFG->sitename} team</em><br/>"; 557 echo "<a href=\"{$CFG->wwwroot}\">{$CFG->wwwroot}</a></p>"; 558 559 } 560 error_log(strip_tags($msg)); 561 // halt 562 die; 563 break; 564 default: 565 break; 566 } 567 } 568 517 569 ?> releases/0.9/lib/templates.php
r1446 r1453 70 70 'html' => templates_draw(array( 'context' => 'submenuitem', 71 71 'name' => __gettext("Change theme"), 72 'location' => url . ' _templates/')));72 'location' => url . 'mod/template/'))); 73 73 } 74 74 … … 727 727 $name .=" /> "; 728 728 $column1 = "<b>" . $template['name'] . "</b>"; 729 $column2 = "<a href=\"".url." _templates/preview.php?template_preview=".$template['shortname']."\" target=\"preview\">" . __gettext("Preview") . "</a>";729 $column2 = "<a href=\"".url."mod/template/preview.php?template_preview=".$template['shortname']."\" target=\"preview\">" . __gettext("Preview") . "</a>"; 730 730 $panel .=templates_draw(array( 731 731 'context' => 'adminTable', … … 759 759 $name .=" /> "; 760 760 $column1 = "<b>" . $template->name . "</b>"; 761 $column2 = "<a href=\"".url." _templates/preview.php?template_preview=".$template->shortname."\" target=\"preview\">" . __gettext("Preview") . "</a>";762 763 $column2 .= " | <a href=\"".url." _templates/edit.php?id=".$template->ident."\" >". __gettext("Edit") ."</a>";764 $column2 .= " | <a href=\"".url." _templates/?action=deletetemplate&delete_template_id=".$template->ident."\" onclick=\"return confirm('" . __gettext("Are you sure you want to permanently remove this template?") . "')\">" . __gettext("Delete") . "</a>";761 $column2 = "<a href=\"".url."mod/template/preview.php?template_preview=".$template->shortname."\" target=\"preview\">" . __gettext("Preview") . "</a>"; 762 763 $column2 .= " | <a href=\"".url."mod/template/edit.php?id=".$template->ident."\" >". __gettext("Edit") ."</a>"; 764 $column2 .= " | <a href=\"".url."mod/template/?action=deletetemplate&delete_template_id=".$template->ident."\" onclick=\"return confirm('" . __gettext("Are you sure you want to permanently remove this template?") . "')\">" . __gettext("Delete") . "</a>"; 765 765 $panel .=templates_draw(array( 766 766 'context' => 'adminTable', … … 1226 1226 // TODO: check again if is readable? 1227 1227 if (is_readable($tpl)) { 1228 $template[$context] .= @file_get_contents($tpl); 1228 $content = @file_get_contents($tpl); 1229 $template[$context] = $template[$context] . @file_get_contents($tpl); 1229 1230 //print_object('Loaded: ' . $tpl); 1230 1231 } else { releases/0.9/mod/blog/lib.php
r1438 r1453 347 347 $anyComments = __gettext("comment(s)"); 348 348 349 $body .= '<h3><a href="' . $CFG->wwwroot . user_ name($post->weblog) . '/weblog/' . $post->ident . '.html">' . $post->title . '</a></h3>';349 $body .= '<h3><a href="' . $CFG->wwwroot . user_info('username', $post->weblog) . '/weblog/' . $post->ident . '.html">' . $post->title . '</a></h3>'; 350 350 $body .= $postedby . ' ' . $username . ' (' . $date . ')<br><br>'; 351 351 $body .= $post->body . '<br>'; … … 357 357 } 358 358 $numcomments = $_SESSION['comment_cache'][$post->ident]->data; 359 $comments = "<a href=\"".url.$username."/ {$post->ident}.html\">$numcomments $anyComments</a>";359 $comments = "<a href=\"".url.$username."/weblog/{$post->ident}.html\">$numcomments $anyComments</a>"; 360 360 361 $body .= $comments . '</div>'; 362 } 363 } 364 365 return array ( 366 'title' => __gettext("Weblog" 367 ), 'content' => $body); 361 $body .= $comments; 362 } 363 } 364 $body .= '</div>'; 365 366 return array ('title' => __gettext('Blog').' :: '.htmlspecialchars(user_name($blog_id), ENT_COMPAT, 'utf-8'), 'content' => $body); 368 367 369 368 } releases/0.9/mod/commentwall/do_action.php
r1218 r1453 28 28 29 29 // Store the rating 30 $success =commentwall_addcomment($wallowner, $comment_owner, $text);30 $success = (empty($text)) ? false : commentwall_addcomment($wallowner, $comment_owner, $text); 31 31 32 32 // Message releases/0.9/mod/community/lib.php
r1422 r1453 306 306 // members have access to upload files or create directories 307 307 if (run('community:membership:check', array($_SESSION['userid'], $object_owner))) { 308 returntrue;308 $result = true; 309 309 } 310 310 break; … … 312 312 // community owner can edit all files 313 313 if (record_exists('users', 'ident', $object_owner, 'owner', $_SESSION['userid'])) { 314 returntrue;314 $result = true; 315 315 } 316 316 break; 317 317 case 'profile': 318 // owner can edit profile 319 if (record_exists('users', 'ident', $object_owner, 'owner', $_SESSION['userid'])) { 320 $result = true; 321 } 322 break; 318 323 } 319 324 releases/0.9/mod/elggadmin/lib/elggadmin.inc.php
r1420 r1453 204 204 $page = new StdClass; 205 205 $page->title = __gettext('Front page'); 206 $page->body .= elggadmin_tpltextarea('frontpage_loggedout', __gettext('Front page (when logged out)'));206 $page->body = elggadmin_tpltextarea('frontpage_loggedout', __gettext('Front page (when logged out)')); 207 207 $page->body .= elggadmin_tpltextarea('frontpage_loggedin', __gettext('Front page (when logged in)')); 208 208 $page->body .= pages_html_input('hidden', array('name'=>'action','value'=>'elggadmin:frontpage')); releases/0.9/mod/pages/index.php
r1376 r1453 8 8 */ 9 9 10 define('context', 'pages');11 10 12 11 include(dirname(dirname(dirname(__FILE__))) . '/includes.php'); 13 12 require(dirname(__FILE__) . '/lib/pages.inc.php'); 13 14 if (page_owner() > 0) { 15 define('context', 'pages'); 16 } else { 17 define('context', 'external'); 18 } 14 19 15 20 // pages init releases/0.9/mod/pages/lib.php
r1420 r1453 451 451 } 452 452 453 if ( !empty($content)) {453 if (isset($content)) { 454 454 $result = "<{$tag}{$extra}>{$content}</{$tag}>\n"; 455 455 } else { releases/0.9/mod/template/lib.php
r1301 r1453 12 12 if ($page_owner == $_SESSION['userid'] && $page_owner != -1) { 13 13 $PAGE->menu_sub[] = array( 'name' => 'template:change', 14 'html' => a_href( "{$CFG->wwwroot} _templates/",14 'html' => a_href( "{$CFG->wwwroot}mod/template/", 15 15 __gettext("Change theme"))); 16 16 } releases/0.9/mod/template/lib/templates_preview.php
r1301 r1453 13 13 $body = <<< END 14 14 15 <img src="/ _templates/leaves.jpg" width="300" height="225" alt="A test image" align="right" />15 <img src="/mod/template/images/leaves.jpg" width="300" height="225" alt="A test image" align="right" /> 16 16 <h1>$heading1</h1> 17 17 <p>Paragraph text</p>
