The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to US and in need of some help
#3

.php   AltLangEngine.php (Size: 17.62 KB / Downloads: 0)
.php   it-test.mo.php (Size: 23.22 KB / Downloads: 0)
.php   it-test.po.php (Size: 23.3 KB / Downloads: 0)

Hi Dan...

Maybe I did not explain properly what I meant...

As I said, I installed US without big problems, thanks to your install procedure.

The first thing that I had to consider was the fact that I installed it on an already existing project.

I already had an existing index.php on my main page.

So I had two choices: either copy the content of my index into yours or not use yours. I chose the latter.

I hope this was not the origin of my troubles.

When I navigate to pages that are not protected there are no problems, since the site is acting as it was before installing US.

But when I tried to navigate to a "protected" page, I got into the current problem.

Please do consider that I can manage MySQL sufficiently and I have some little experience with PHP but, nevertheless, I am unable to follow the intricacies of your code. (or any other code that appears complex to me, for what it counts).

This is what I want to achieve and I was hoping to do it with the three lines of code that you suggest putting on top of each protected page.

My assumptions are that when you navigate to a protected page, US checks if you are logged and, if not, prompts you to login.

It will then ascertain what kind of clearance you have and according to that will allow you to view that page or redirect you somewhere else, unless you are an Admin in which case you are presented with the dashboard. (talking of which, it seems that only English is available for such page).

Is there a way to change the last of the three lines  required with something that says, in pseudo English, the following?

IF
you are an Adim, get to the Dashboard
ELSE
IF 
logged and authorised to view the page, proceed.
ELSE
Redirect to a page of mu choice

Such redirection should be or might be different for each protected page.

In other words, I would like to be able to indicate for each protected page a destination page of my choice according to my desire.

Is this feasible?
And if yes, what kind of code should I put on top of each protected page?

Because this

[font=Consolas, monospace]require_once '../users/init.php';  //make sure this path is correct!
[/font]

require_once $abs_us_root.$us_url_root.'users/includes/template/prep.php';
[font=Consolas, monospace]if (!securePage($_SERVER['PHP_SELF'])){die();}[/font]

does not do that, unless the lack of the initial index.php were not the real problem.

Is my question now any clearer? Please consider that I am not native English so my choice of words may be somehow inappropriate to descrive the situation.

Back to the Dashboard.

To me is not a big problem: I can manage fine the English descriptions that are there with ease.

Bur I was wondering about that, for non English speakers or for anyone who is more familiar with his own language.

I sort of thought of a solution but, before venturing into the code, I would love to get your opinion.

I thought of changing the structure of the pages where language is involved with the following (an example):

//User Settings
$lang = array_merge($lang,array(
"SET_PIN" => _("Reset PIN"),
"SET_WHY" => _("Why can't I change this?"),
"SET_PW_MATCH" => _("Must match the New Password"),

At that point, adding a simple .po .mo files in the appropriate folder as required by PHP's gettext function, should do the trick.

Once the .po file is created, you may add all the other sentences that need translation in any US pages, by simply changing the sentence to be translated with something like (as an example)

BEFORE
<!-- Force Password Reset -->
                  <div class="form-group">
                    <label for="force_pr">Original sentence in English <a href="#!" tabindex="-1" title="Note" data-trigger="focus" class="nounderline" data-toggle="popover" data-content="When a user is created from the admin panel, force their password to be reset upon login, this will also send them a password reset link on manual creation no matter what password you enter on the form. If you enable this, the force_pr value in your users database for this user will be 1 when created. Default: No."><i class="fa fa-question-circle"></i></a></label>

AFTER
<!-- Force Password Reset -->
                  <div class="form-group">
                    <label for="force_pr"><? echo _("Original sentence in English") ?><a href="#!" tabindex="-1" title="Note" data-trigger="focus" class="nounderline" data-toggle="popover" data-content="When a user is created from the admin panel, force their password to be reset upon login, this will also send them a password reset link on manual creation no matter what password you enter on the form. If you enable this, the force_pr value in your users database for this user will be 1 when created. Default: No."><i class="fa fa-question-circle"></i></a></label>

Thus getting the translation in your chosen language for each and every instance in US, working on a single .po file (one for each language provided).

Naturally all this will require some extra general settings like a couple of lines of code for the environmental changes required, but that should be a walk in the park...

If you think that the above is feasible, I can dedicate my time to operate the required changes in the html sections and provide you with the resulting code for your view and tests. If it works as I expect, you can use it freely.

Let me know, if you please, the solution to my needs if it is not meaning for you too much effort and what do you think about the "language" solution.

Thank you in advance for your time and assistance.

Best,

Carlo

P.S. I attached some files for Italian as an example (which I doubt you will need). I had to add a false .php extension to upload the .mo and .po files. I hope this is not against the Forum rules.
  Reply


Messages In This Thread
New to US and in need of some help - by Carlo - 05-11-2019, 04:13 PM
RE: New to US and in need of some help - by Carlo - 05-14-2019, 07:21 PM
RE: New to US and in need of some help - by Carlo - 05-16-2019, 03:45 AM
RE: New to US and in need of some help - by Carlo - 05-17-2019, 10:40 AM
RE: New to US and in need of some help - by Carlo - 05-17-2019, 04:00 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)