[CWB] Two issues regarding CQPweb revision 316

Ray Wu liangpingwu at 126.com
Tue May 22 08:12:33 CEST 2012


Hi Andrew,

I edited the two php files in my /usr/local/apache2/htdocs/cqp/lib directory and here is the output after pressing the button "Creat user account" under the banner of "Create new user (or reset user password)":

-->$<--
string(9) "anonymous"

-->$<--
string(9) "anonymous"

-->$<--
object(apache_htaccess)#2 (8) {
  ["AuthName:private"]=>
  string(6) "CQPweb"
  ["path_to_apache_password_utility_directory:private"]=>
  string(22) "/usr/local/apache2/bin"
  ["path_to_groups_file:private"]=>
  string(43) "/usr/local/apache2/cqpweb_aux/user/.htgroup"
  ["path_to_password_file:private"]=>
  string(44) "/usr/local/apache2/cqpweb_aux/user/.htpasswd"
  ["path_to_web_directory:private"]=>
  string(6) "nopath"
  ["permitted_users:private"]=>
  NULL
  ["permitted_groups:private"]=>
  NULL
  ["extra_directives:private"]=>
  NULL
}

-->$<--
string(36) "Calling new user, printing retval..."

-->$<--
int(0)

About to run the following MySQL query:

SELECT * from user_settings WHERE username = 'anonymous'


The query ran successfully in 0 seconds.


About to run the following MySQL query:

INSERT INTO user_settings (
        username,
        realname,
        conc_kwicview,
        conc_corpus_order,
        cqp_syntax,
        context_with_tags,
        use_tooltips,
        thin_default_reproducible,
        coll_statistic,
        coll_freqtogether,
        coll_freqalone,
        coll_from,
        coll_to,
        max_dbsize,
        linefeed
        )
        VALUES
        (
        'anonymous',
        'unknown person',
        1,
        1,
        0,
        0,
        1,
        1,
        6,
        5,
        5,
        -3,
        3,
        1000000,
        'au')

The query ran successfully in 0 seconds.

About to run the following MySQL query:

SELECT * from user_settings WHERE username = 'anonymous'

The query ran successfully in 0 seconds.

-->$<--
string(17) "The profile is..."

-->$<--
object(stdClass)#3 (17) {
  ["username"]=>
  string(9) "anonymous"
  ["password"]=>
  NULL
  ["realname"]=>
  string(14) "unknown person"
  ["email"]=>
  NULL
  ["conc_kwicview"]=>
  string(1) "1"
  ["conc_corpus_order"]=>
  string(1) "1"
  ["cqp_syntax"]=>
  string(1) "0"
  ["context_with_tags"]=>
  string(1) "0"
  ["use_tooltips"]=>
  string(1) "1"
  ["thin_default_reproducible"]=>
  string(1) "1"
  ["coll_statistic"]=>
  string(1) "6"
  ["coll_freqtogether"]=>
  string(1) "5"
  ["coll_freqalone"]=>
  string(1) "5"
  ["coll_from"]=>
  string(2) "-3"
  ["coll_to"]=>
  string(1) "3"
  ["max_dbsize"]=>
  string(7) "1000000"
  ["linefeed"]=>
  string(2) "au"
}

-->$password_more_security<--
bool(false)

About to run the following MySQL query:

UPDATE user_settings SET password = 'anonymous' WHERE username = 'anonymous'


The query ran successfully in 0 seconds.


-->$<--
string(16) "Email to update?"

-->$<--
string(0) ""

About to run the following MySQL query:

UPDATE user_settings SET email = '' WHERE username = 'anonymous'

The query ran successfully in 0 seconds.

Best,
Ray


At 2012-05-22 04:17:28,"Hardie, Andrew" <a.hardie at lancaster.ac.uk> wrote:


Hi Ray,

 

I am still a bit stumped; I cannot reproduce this bug. So I need you to hack your code again! Can I suggest that you try the following.

 

(1)  replace the complete function add_new_user() { ...    } (lines 179-203) as follows:

 

function add_new_user($username, $password, $email = NULL)

      {

              $apache = get_apache_object('nopath');

             

              $username = preg_replace('/\W/', '', $username);

              $password = preg_replace('/\W/', '', $password);

 

            $vv="Initialisation variables:";

 

            show_var($username); show_var($password);show_var($apache);

             

              if ($username === '' || $password === '')

                      exiterror_fullpage("Usernames and passwords can only contain letters, numbers and underscores.",

                              __FILE__, __LINE__);

             

            $vv = "Calling new user, printing retval..."; show_var($vv);

              $dd = $apache->new_user($username, $password); show_var($dd);

     

              /* start by creating a blank entry for the user (or, retrieving an existing entry) */

              $profile = get_all_user_settings($username);

            $vv = "The profile is...";show_var($vv);show_var($profile);

             

              /* then, overwrite the password as stored in the database */

              global $password_more_security;

            show_var($password_more_security);

              $db_password = ($password_more_security ? $apache->get_user_hashword($username) : $password);

              update_user_setting($username, 'password', $db_password);

 

            $vv = "Email to update?";show_var($vv);          

 

              /* and if email has been passed into the function, likewise overwrite it */

              if (isset($email))

            {

                  show_var($email);

                      update_user_setting($username, 'email', mysql_real_escape_string($email));

                 

            }

      }

     

      ?>

 

(2)  add the following line to your config.inc.php file.

 

$print_debug_messages = true;

 

(3)  Try again to create a user.

(4)  Send me the resulting text output.

 

Hopefully this time we’ll nail it.

 

best

 

Andrew.

 

From:cwb-bounces at sslmit.unibo.it [mailto:cwb-bounces at sslmit.unibo.it] On Behalf Of Ray Wu
Sent: 21 May 2012 01:49
To: Open source development of the Corpus WorkBench
Subject: Re:RE: [CWB] Two issues regarding CQPweb revision 316

 

Hi Andrew,

I tried your update and here is my report.

Re: OK, I have solved the freq table issue I think – it was a bug due to me supplying the wrong argument format to the PHP function is_writable(). Update to svn commit 318 and you should be good to go on that front.
You are a genius! It rocks!

Re: For the user creation issue: can I suggest you temporarily change line 190 of admin-lib.inc.php as follows: from
$apache->new_user($username, $password); to
$dd = $apache->new_user($username, $password); show_var($dd);
and try creating a user to see what happens?

Pressing "Creat user account", yields -->$<--int(0) ;
Pressing "Create a batch of user accounts" yields no output.
Newly created users appear in "Delete a user account" but not in "Set user's maximum database size"

Best,
Ray



 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20120522/0d2fe06f/attachment-0001.htm


More information about the CWB mailing list