changeset 832 | 7152ca0a0ce9 |
parent 825 | 9d5c04c1414f |
child 898 | c75754f5b1da |
831:45e887f23282 | 832:7152ca0a0ce9 |
---|---|
48 */ |
48 */ |
49 |
49 |
50 public static function getsource($page, $password = false) |
50 public static function getsource($page, $password = false) |
51 { |
51 { |
52 global $db, $session, $paths, $template, $plugins; // Common objects |
52 global $db, $session, $paths, $template, $plugins; // Common objects |
53 if(!isset($paths->pages[$page])) |
53 if(!isPage($page)) |
54 { |
54 { |
55 return ''; |
55 return ''; |
56 } |
56 } |
57 |
57 |
58 if(strlen($paths->pages[$page]['password']) == 40) |
58 if(strlen($paths->pages[$page]['password']) == 40) |
115 $pname = $paths->nslist[$namespace] . $page_id; |
115 $pname = $paths->nslist[$namespace] . $page_id; |
116 |
116 |
117 if(!$session->get_permissions('edit_page')) |
117 if(!$session->get_permissions('edit_page')) |
118 return 'Access to edit pages is denied.'; |
118 return 'Access to edit pages is denied.'; |
119 |
119 |
120 if(!isset($paths->pages[$pname])) |
120 if(!isPage($pname)) |
121 { |
121 { |
122 $create = PageUtils::createPage($page_id, $namespace); |
122 $create = PageUtils::createPage($page_id, $namespace); |
123 if ( $create != 'good' ) |
123 if ( $create != 'good' ) |
124 return 'The page did not exist, and I was not able to create it. The reported error was: ' . $create; |
124 return 'The page did not exist, and I was not able to create it. The reported error was: ' . $create; |
125 $paths->page_exists = true; |
125 $paths->page_exists = true; |
193 // echo '<b>Notice:</b> PageUtils::createPage: Couldn\'t look up the namespace<br />'; |
193 // echo '<b>Notice:</b> PageUtils::createPage: Couldn\'t look up the namespace<br />'; |
194 return 'Couldn\'t look up the namespace'; |
194 return 'Couldn\'t look up the namespace'; |
195 } |
195 } |
196 |
196 |
197 $pname = $paths->nslist[$namespace] . $page_id; |
197 $pname = $paths->nslist[$namespace] . $page_id; |
198 if(isset($paths->pages[$pname])) |
198 if(isPage($pname)) |
199 { |
199 { |
200 // echo '<b>Notice:</b> PageUtils::createPage: Page already exists<br />'; |
200 // echo '<b>Notice:</b> PageUtils::createPage: Page already exists<br />'; |
201 return 'Page already exists'; |
201 return 'Page already exists'; |
202 } |
202 } |
203 |
203 |
344 if ( !isPage($pname) ) |
344 if ( !isPage($pname) ) |
345 { |
345 { |
346 return 'DNE'; |
346 return 'DNE'; |
347 } |
347 } |
348 |
348 |
349 if ( isset($paths->pages[$pname]['password']) ) |
349 if ( isPage($pname['password']) ) |
350 { |
350 { |
351 $password_exists = ( !empty($paths->pages[$pname]['password']) && $paths->pages[$pname]['password'] !== sha1('') ); |
351 $password_exists = ( !empty($paths->pages[$pname]['password']) && $paths->pages[$pname]['password'] !== sha1('') ); |
352 if ( $password_exists && $password !== $paths->pages[$pname]['password'] ) |
352 if ( $password_exists && $password !== $paths->pages[$pname]['password'] ) |
353 { |
353 { |
354 return '<p>' . $lang->get('history_err_wrong_password') . '</p>'; |
354 return '<p>' . $lang->get('history_err_wrong_password') . '</p>'; |
570 if(strtolower($captcha_code) != strtolower($result)) _die('The confirmation code you entered was incorrect.'); |
570 if(strtolower($captcha_code) != strtolower($result)) _die('The confirmation code you entered was incorrect.'); |
571 } |
571 } |
572 $text = RenderMan::preprocess_text($text); |
572 $text = RenderMan::preprocess_text($text); |
573 $name = $session->user_logged_in ? RenderMan::preprocess_text($session->username) : RenderMan::preprocess_text($name); |
573 $name = $session->user_logged_in ? RenderMan::preprocess_text($session->username) : RenderMan::preprocess_text($name); |
574 $subj = RenderMan::preprocess_text($subject); |
574 $subj = RenderMan::preprocess_text($subject); |
575 if(getConfig('approve_comments')=='1') $appr = '0'; else $appr = '1'; |
575 if(getConfig('approve_comments', '0')=='1') $appr = '0'; else $appr = '1'; |
576 $q = 'INSERT INTO ' . table_prefix.'comments(page_id,namespace,subject,comment_data,name,user_id,approved,time) VALUES(\'' . $page_id . '\',\'' . $namespace . '\',\'' . $subj . '\',\'' . $text . '\',\'' . $name . '\',' . $session->user_id . ',' . $appr . ','.time().')'; |
576 $q = 'INSERT INTO ' . table_prefix.'comments(page_id,namespace,subject,comment_data,name,user_id,approved,time) VALUES(\'' . $page_id . '\',\'' . $namespace . '\',\'' . $subj . '\',\'' . $text . '\',\'' . $name . '\',' . $session->user_id . ',' . $appr . ','.time().')'; |
577 $e = $db->sql_query($q); |
577 $e = $db->sql_query($q); |
578 if(!$e) die('alert(unescape(\''.rawurlencode('Error inserting comment data: '.$db->get_error().'\n\nQuery:\n' . $q) . '\'))'); |
578 if(!$e) die('alert(unescape(\''.rawurlencode('Error inserting comment data: '.$db->get_error().'\n\nQuery:\n' . $q) . '\'))'); |
579 else $_ob .= '<div class="info-box">Your comment has been posted.</div>'; |
579 else $_ob .= '<div class="info-box">Your comment has been posted.</div>'; |
580 return PageUtils::comments($page_id, $namespace, false, Array(), $_ob); |
580 return PageUtils::comments($page_id, $namespace, false, Array(), $_ob); |
799 { |
799 { |
800 if($session->get_permissions('post_comments')) |
800 if($session->get_permissions('post_comments')) |
801 { |
801 { |
802 $_ob .= '<h3>' . $lang->get('comment_postform_title') . '</h3>'; |
802 $_ob .= '<h3>' . $lang->get('comment_postform_title') . '</h3>'; |
803 $_ob .= $lang->get('comment_postform_blurb'); |
803 $_ob .= $lang->get('comment_postform_blurb'); |
804 if(getConfig('approve_comments')=='1') $_ob .= ' ' . $lang->get('comment_postform_blurb_unapp'); |
804 if(getConfig('approve_comments', '0')=='1') $_ob .= ' ' . $lang->get('comment_postform_blurb_unapp'); |
805 if(getConfig('comments_need_login') == '1' && !$session->user_logged_in) |
805 if(getConfig('comments_need_login') == '1' && !$session->user_logged_in) |
806 { |
806 { |
807 $_ob .= ' ' . $lang->get('comment_postform_blurb_captcha'); |
807 $_ob .= ' ' . $lang->get('comment_postform_blurb_captcha'); |
808 } |
808 } |
809 $sn = $session->user_logged_in ? $session->username . '<input name="name" id="mdgScreenName" type="hidden" value="' . $session->username . '" />' : '<input name="name" id="mdgScreenName" type="text" size="35" />'; |
809 $sn = $session->user_logged_in ? $session->username . '<input name="name" id="mdgScreenName" type="hidden" value="' . $session->username . '" />' : '<input name="name" id="mdgScreenName" type="text" size="35" />'; |
1190 return 'Special pages and system messages can\'t be voted for deletion.'; |
1190 return 'Special pages and system messages can\'t be voted for deletion.'; |
1191 } |
1191 } |
1192 |
1192 |
1193 $pname = $paths->nslist[$namespace] . sanitize_page_id($page_id); |
1193 $pname = $paths->nslist[$namespace] . sanitize_page_id($page_id); |
1194 |
1194 |
1195 if ( !isset($paths->pages[$pname]) ) |
1195 if ( !isPage($pname) ) |
1196 { |
1196 { |
1197 return 'The page does not exist.'; |
1197 return 'The page does not exist.'; |
1198 } |
1198 } |
1199 |
1199 |
1200 $cv =& $paths->pages[$pname]['delvotes']; |
1200 $cv =& $paths->pages[$pname]['delvotes']; |