Changeset 1453

Show
Ignore:
Timestamp:
12/13/07 22:34:55 (10 months ago)
Author:
misja
Message:

Misja Hoebe <misja@curverider.co.uk> Merge r1447, r1448, r1449, r1450, r1451 into 0.9 branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • releases/0.9/htaccess-dist

    r1390 r1453  
    101101ReWriteRule ^register$ mod/invite/register.php 
    102102RewriteRule ^forgottenpassword$ mod/invite/forgotten_password.php 
    103 RewriteRule ^newpassword\/([A-Za-z0-9]+)$ mod/invite/forgotten_password.php?passwordcode=$1 
     103RewriteRule ^newpassword\/([A-Za-z0-9]+)$ mod/invite/new_password.php?passwordcode=$1 
    104104 
    105105RewriteRule ^([A-Za-z0-9]+)(\/)?$ profile/index.php?profile_name=$1 
  • releases/0.9/includes.php

    r1414 r1453  
    4040 
    4141    // Check if should go to install 
    42         if (empty($CFG->dbuser) || empty($CFG->dbpass)) { 
     42        if (empty($CFG->dbname) || empty($CFG->dbuser)) { 
    4343            header('Location: install.php'); 
    4444            exit(); 
  • releases/0.9/index.php

    r1378 r1453  
    33    global $CFG; 
    44 
     5    define('context', 'external'); 
    56    require_once(dirname(__FILE__)."/includes.php"); 
    67 
  • releases/0.9/install.php

    r1446 r1453  
    44 * @author Rolando Espinoza La Fuente <rho@prosoftpeople.com> 
    55 */ 
    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'); 
    912 
    1013    global $db, $CFG; 
     
    1619 
    1720    // 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()) { 
    1922        $config_ready = true; 
    2023        $messages[] = __gettext('You have already configured Elgg and can safely remove the file <code>install.php</code> from your installation.'); 
     
    404407                    // 
    405408                    // reload config 
    406                     include('./config.php'); 
     409                    include($CFG->dirroot.'config.php'); 
    407410                    // setup database 
    408                     require_once('./lib/adodb/adodb.inc.php'); 
     411                    require_once($CFG->dirroot.'lib/adodb/adodb.inc.php'); 
    409412 
    410413                    $db = &ADONewConnection($CFG->dbtype); 
     
    431434                    $CFG->debug = 8; 
    432435 
    433                     require_once('./lib/cache/lib.php'); 
    434                     require_once('./lib/constants.php'); 
    435                     require_once('./lib/elgglib.php'); // already included 
    436                     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'); 
    439442                } 
    440443?> 
     
    534537 
    535538    // reload config 
    536     include('./config.php'); 
     539    include($CFG->dirroot.'config.php'); 
    537540    // setup database 
    538     require_once('./lib/adodb/adodb.inc.php'); 
     541    require_once($CFG->dirroot.'lib/adodb/adodb.inc.php'); 
    539542 
    540543    $db = &ADONewConnection($CFG->dbtype); 
  • releases/0.9/lib/setup.php

    r1420 r1453  
    177177    $CFG->debug = 7; 
    178178} 
    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 
     186set_error_handler('elgg_error_handler'); 
    180187 
    181188/// File permissions on created directories in the $CFG->dataroot 
     
    193200if (!is_writable($CFG->dataroot)) { 
    194201    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 systems 
    202     @ini_set('display_errors', '0'); 
    203 } 
    204  
    205 if ($CFG->debug > 7) { 
    206     @ini_set('display_errors', '1'); 
    207202} 
    208203 
     
    515510} 
    516511 
     512/** 
     513 * Basic error handler 
     514 */ 
     515function 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 
    517569?> 
  • releases/0.9/lib/templates.php

    r1446 r1453  
    7070                                   'html' => templates_draw(array( 'context' => 'submenuitem', 
    7171                                                                   'name' => __gettext("Change theme"), 
    72                                                                    'location' => url . '_templates/'))); 
     72                                                                   'location' => url . 'mod/template/'))); 
    7373    } 
    7474 
     
    727727            $name .=" /> "; 
    728728            $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>"; 
    730730            $panel .=templates_draw(array( 
    731731                                                        'context' => 'adminTable', 
     
    759759                    $name .=" /> "; 
    760760                    $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&amp;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&amp;delete_template_id=".$template->ident."\"  onclick=\"return confirm('" . __gettext("Are you sure you want to permanently remove this template?") . "')\">" . __gettext("Delete") . "</a>"; 
    765765                    $panel .=templates_draw(array( 
    766766                                                        'context' => 'adminTable', 
     
    12261226                // TODO: check again if is readable? 
    12271227                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); 
    12291230                    //print_object('Loaded: ' . $tpl); 
    12301231                } else { 
  • releases/0.9/mod/blog/lib.php

    r1438 r1453  
    347347                $anyComments = __gettext("comment(s)"); 
    348348           
    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>'; 
    350350                $body .= $postedby . ' ' . $username . ' (' . $date . ')<br><br>'; 
    351351                $body .= $post->body . '<br>'; 
     
    357357                } 
    358358                $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>"; 
    360360         
    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); 
    368367 
    369368} 
  • releases/0.9/mod/commentwall/do_action.php

    r1218 r1453  
    2828                         
    2929                // Store the rating 
    30                $success = commentwall_addcomment($wallowner, $comment_owner, $text); 
     30        $success = (empty($text)) ? false : commentwall_addcomment($wallowner, $comment_owner, $text); 
    3131 
    3232                // Message 
  • releases/0.9/mod/community/lib.php

    r1422 r1453  
    306306            // members have access to upload files or create directories 
    307307            if (run('community:membership:check', array($_SESSION['userid'], $object_owner))) { 
    308                 return true; 
     308                $result = true; 
    309309            } 
    310310            break; 
     
    312312            // community owner can edit all files 
    313313            if (record_exists('users', 'ident', $object_owner, 'owner', $_SESSION['userid'])) { 
    314                 return true; 
     314                $result = true; 
    315315            } 
    316316            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; 
    318323    } 
    319324 
  • releases/0.9/mod/elggadmin/lib/elggadmin.inc.php

    r1420 r1453  
    204204    $page = new StdClass; 
    205205    $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)')); 
    207207    $page->body .= elggadmin_tpltextarea('frontpage_loggedin', __gettext('Front page (when logged in)')); 
    208208    $page->body .= pages_html_input('hidden', array('name'=>'action','value'=>'elggadmin:frontpage')); 
  • releases/0.9/mod/pages/index.php

    r1376 r1453  
    88 */ 
    99 
    10 define('context', 'pages'); 
    1110 
    1211include(dirname(dirname(dirname(__FILE__))) . '/includes.php'); 
    1312require(dirname(__FILE__) . '/lib/pages.inc.php'); 
     13 
     14if (page_owner() > 0) { 
     15    define('context', 'pages'); 
     16} else { 
     17    define('context', 'external'); 
     18} 
    1419 
    1520// pages init 
  • releases/0.9/mod/pages/lib.php

    r1420 r1453  
    451451    } 
    452452 
    453     if (!empty($content)) { 
     453    if (isset($content)) { 
    454454        $result = "<{$tag}{$extra}>{$content}</{$tag}>\n"; 
    455455    } else { 
  • releases/0.9/mod/template/lib.php

    r1301 r1453  
    1212        if ($page_owner == $_SESSION['userid'] && $page_owner != -1) { 
    1313            $PAGE->menu_sub[] = array( 'name' => 'template:change', 
    14                                        'html' => a_href( "{$CFG->wwwroot}_templates/", 
     14                                       'html' => a_href( "{$CFG->wwwroot}mod/template/", 
    1515                                                          __gettext("Change theme")));   
    1616        } 
  • releases/0.9/mod/template/lib/templates_preview.php

    r1301 r1453  
    1313        $body = <<< END 
    1414         
    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" /> 
    1616    <h1>$heading1</h1> 
    1717    <p>Paragraph text</p>