ajax.php
changeset 32 4d87aad3c4c0
parent 29 e5484a9e0818
child 33 143d3ee32f3c
equal deleted inserted replaced
31:dc8741857bde 32:4d87aad3c4c0
    28       break;
    28       break;
    29     case "getpage":
    29     case "getpage":
    30       // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
    30       // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
    31       $revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
    31       $revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
    32       $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
    32       $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
       
    33       
       
    34       $pagepass = ( isset($_REQUEST['pagepass']) ) ? $_REQUEST['pagepass'] : '';
       
    35       $page->password = $pagepass;
       
    36             
    33       $page->send();
    37       $page->send();
    34       break;
    38       break;
    35     case "savepage":
    39     case "savepage":
    36       $summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
    40       $summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
    37       $minor = isset($_POST['minor']);
    41       $minor = isset($_POST['minor']);
   104       $html = str_replace('src="/Special', 'src="http://www.enanocms.org/Special', $html);
   108       $html = str_replace('src="/Special', 'src="http://www.enanocms.org/Special', $html);
   105       echo '<div class="contentDiv"><h2>Wiki formatting guide</h2>'.$html.'</div>';
   109       echo '<div class="contentDiv"><h2>Wiki formatting guide</h2>'.$html.'</div>';
   106       break;
   110       break;
   107     case "fillusername":
   111     case "fillusername":
   108       $name = (isset($_GET['name'])) ? $db->escape($_GET['name']) : false;
   112       $name = (isset($_GET['name'])) ? $db->escape($_GET['name']) : false;
   109       if(!$name) die('userlist = new Array(); errorstring=\'Invalid URI\'');
   113       if ( !$name ) 
   110       $q = $db->sql_query('SELECT username,user_id FROM '.table_prefix.'users WHERE username LIKE \'%'.$name.'%\';');
   114       {
   111       if(!$q) die('userlist = new Array(); errorstring=\'MySQL error selecting username data: '.addslashes(mysql_error()).'\'');
   115         die('userlist = new Array(); errorstring=\'Invalid URI\'');
   112       if($db->numrows() < 1) die('userlist = new Array(); errorstring=\'No usernames found.\'');
   116       }
       
   117       $q = $db->sql_query('SELECT username,user_id FROM '.table_prefix.'users WHERE lcase(username) LIKE lcase(\'%'.$name.'%\');');
       
   118       if ( !$q )
       
   119       {
       
   120         die('userlist = new Array(); errorstring=\'MySQL error selecting username data: '.addslashes(mysql_error()).'\'');
       
   121       }
       
   122       if($db->numrows() < 1)
       
   123       {
       
   124         die('userlist = new Array(); errorstring=\'No usernames found\';');
       
   125       }
   113       echo 'var errorstring = false; userlist = new Array();';
   126       echo 'var errorstring = false; userlist = new Array();';
   114       $i=0;
   127       $i = 0;
   115       while($r = $db->fetchrow())
   128       while($r = $db->fetchrow())
   116       {
   129       {
   117         echo "userlist[$i] = '".addslashes($r['username'])."'; ";
   130         echo "userlist[$i] = '".addslashes($r['username'])."'; ";
   118         $i++;
   131         $i++;
   119       }
   132       }