The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/portal.php 39 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!

Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 1,007
» Latest member: kavitasinghji
» Forum threads: 1,324
» Forum posts: 7,788

Full Statistics

Online Users
There are currently 498 online users.
» 0 Member(s) | 496 Guest(s)
Bing, Google

Latest Threads
UserSpice Alpha Testing a...
Forum: News Center
Last Post: ivinsons
11-08-2024, 06:13 PM
» Replies: 13
» Views: 42,475
UserSpice 4.4 Development
Forum: News Center
Last Post: Amelie12
09-21-2024, 12:23 PM
» Replies: 4
» Views: 15,199
Welcome to the new UserSp...
Forum: News Center
Last Post: ivinsons
08-25-2024, 07:39 AM
» Replies: 2
» Views: 27,918
How to use hasPerm
Forum: UserSpice 4.4
Last Post: mudmin
07-20-2019, 02:45 PM
» Replies: 1
» Views: 13,755
Session issue? What I sho...
Forum: UserSpice 4.4
Last Post: Parth
07-17-2019, 05:06 PM
» Replies: 4
» Views: 14,502
Email Error
Forum: UserSpice 4.4
Last Post: Brandin
07-17-2019, 04:47 PM
» Replies: 1
» Views: 6,623
{ Missing Text } after up...
Forum: UserSpice 4.4
Last Post: Brandin
07-16-2019, 04:23 PM
» Replies: 22
» Views: 53,638
Best Practice Info
Forum: New to UserSpice?
Last Post: Brandin
07-16-2019, 11:55 AM
» Replies: 1
» Views: 13,490
Force to use 2FA -always-
Forum: UserSpice 4.4
Last Post: Brandin
07-12-2019, 12:43 PM
» Replies: 1
» Views: 6,636
e-mail not verifying
Forum: UserSpice 4.4
Last Post: LBC
07-10-2019, 11:34 AM
» Replies: 31
» Views: 76,232

 
  Install is trying to kill me
Posted by: Lazarus - 05-17-2017, 04:05 PM - Forum: New to UserSpice? - Replies (5)

Hi, using your product on a test site and it is trying to kill me I am sure of it /s

So most everything is working but the email function I cannot get it to email out because of the error

" Could not instantiate mail function. " there is nothing on this or other sites and I feel that I am missing something simple

HELP Please.

Thanks


  file uploader
Posted by: firestorm - 05-17-2017, 12:10 PM - Forum: Modifications and Hackery - Replies (1)

hey, thought i'd implement a file uploader, mainly for images but other files too, form uploads image to directory on server, in my case users/uploads/avatar . you can then either save the filename or full file path to the database, in my case i added a row to the

Code:
profiles
table called avatar. here it goes:

the files we need are:

patch-4.2.6-uploads.php - place somewhere so you can navigate to it in the browser within userspice, maybe root
class.upload.php - place in users/classes/
uploads.php - place in users/includes/

patch-4.2.6-uploads.php: navigate to this in browser, it will magically add the required db row to table
Code:
profiles
https://pastebin.com/RXJ9BxTp

class.upload.php: best left untouched
https://pastebin.com/DpKmdXex

uploads.php: adapt to your needs-change things like image types, locations, db insertion etc
https://pastebin.com/iLKrM1J8

Next we need the form: adapt to your needs
https://pastebin.com/ZJ353CHa

heres how the form looks:
https://pasteboard.co/7nRsmlvAa.png

you could go one step further and upload without page refresh using ajax as snippet below, just need a way to refresh the image preview otherwise page refresh is required.
https://pastebin.com/BjDfdare


  UserSpice and the Internet of Things
Posted by: mudmin - 05-14-2017, 11:47 AM - Forum: Modifications and Hackery - No Replies

I've been doing a lot of IOT things lately. I'm building an "escape room" that has about 15 arduinos and 6 raspberry pi's. It all talks to an MQTT server.

I'm thinking about rolling my IOT integrations into userspice. Thoughts? They would stay out of the way, but essentially you would be able to do something like

mqtt("lights","on");

to turn on all your lights. I have a ton of video demos. In fact. Now that I think about it, here is a video of UserSpice and MQTT working together. Note that this was a building that was about to be turned down, so I turned it into a bank that had been under attack. Still in the early stages.

https://www.youtube.com/watch?v=7J6Mi59sBd0


  jQuery cdn fallback
Posted by: firestorm - 05-14-2017, 07:45 AM - Forum: UserSpice 4.3 and Below - Replies (2)

some countries don't allow cdn or cdn goes down for some reason, or your working in localhost with no outside connection then fallback should be added to account for this, I've added to my pull request on github the following, which is added to users/includes/header.php.

<pre>

Code:
<!-- jQuery Fallback -->
<script type="text/javascript">
    if (typeof jQuery == 'undefined') {
        document.write(unescape("{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3Cscript src='<?=$us_url_root?>users/js/jquery.js' type='text/javascript'{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3E{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3C/script{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3E"));
    }
</script>
</pre>


  Using UserSpice permissions in my own code
Posted by: grumpy-gnome - 05-10-2017, 11:33 AM - Forum: UserSpice 4.3 and Below - Replies (7)

I have a hierarcy of roles determined by the permission group: USER -> SUPERVISOR -> SUPERUSER -> ADMIN

An individual user can only be within one role. Users can not self-register so I define their role when I manually create their account.

Multiple roles can access individual pages - for example, page1.php can be used by USER & SUPERVISOR; page2.php is only accessible by SUPERUSER role...

I wanted to control certain privileges within my PHP by referencing the role that the logged on person currently has - a USER role being able to update less columns than a person in a SUPERVISOR role for example. If I check the "permissions" attribute of the user data though ($user->data()->permissions) this seems to be always set to 1. I was expecting it to reflect the role of the user as defined when it was created.

Is there anyway I can get to the role the user account is actually created as?

Sorry if I have completely missed the logic around permissions Sad


  4.2.6 Installation Issues
Posted by: faguss - 05-08-2017, 01:33 PM - Forum: UserSpice 4.3 and Below - Replies (3)

  • #1 - Setting:File Uploads Recommended:ON Actual:OFF


I'd like to have some information displayed about this because I didn't know what that meant. After some digging I found out that allow_url_fopen is disabled by my host for security reasons. However, there's CURL so I took a function from here:

<pre>
Code:
function url_get_contents ($Url) {
    if (!function_exists('curl_init')){
        die('CURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
};
</pre>




And added it to recaptcha.config.php:

Code:
$response = url_get_contents($path . $req);

and to check_updates.php:

Code:
$remoteVersion=trim(url_get_contents(REMOTE_VERSION));

I find it inconvenient that replacing by usersc requires dependent files so I needed to copy all these:

check_updates.php
init.php
includes/user_spice_ver.php
includes/recaptcha.config.php
login.php

Also added page permission for usersc/check_updates.php in the Admin Dashboard.

Could you automatically detect CURL during installation and use it in place of file_get_contents?
  • #2 - Error performing query '/*!40101 SET NAMES utf8mb4 */; ':


I replaced utf8mb4 with utf8 in the installation sql.

  • #3 - Timezone selection not saved


Timezone is reverted to the first option when you press "Test Settings" button.

  • #4 - Parse error: syntax error in init.php on line 45


My copyright message has an apostrophe. Please add slashes to the user input.


  Admininstrator permission redirect error
Posted by: Jeff - 05-04-2017, 04:52 PM - Forum: UserSpice 4.3 and Below - No Replies

The default sql file creates two users:

User with id = 1 has a default administrator permission.
User with id = 2 has a default user permission.

This also corresponds with the default init.php setting for $master_account:

//adding more ids to this array allows people to access everything, whether offline or not. Use caution.
$master_account = [1];


Administrator status appears to be checked using two different methods:

'in_array($user->data()->id, $master_account)' : if user id is in the master_account array give administrator permission.

'(checkMenu(2,$user->data()->id))' using the checkMenu function : if userid has a permission level = 2 give administrator permission.

Problems occur when you give a userid permission = 2 (administrator) without also including the same userid in the master_account array.

For example:

For the default user with id = 2, add administrator permission AND delete user permission. This user now has administrator role in the permission table but does not have administrator permission in the master_account array.
When you try to login as user I/you get a page redirect error.

A quick fix for this error is to make this change to us_helpers.php

from:

//Check if user's permission levels allow access to page
if (checkPermission($pagePermissions)){
return true;

}elseif (in_array($user->data()->id, $master_account)){ //Grant access if master user
return true;

}else {
if (!$homepage = Config::get('homepage'))
$homepage = 'index.php';
$fields = array(
'user' => $user->data()->id,
'page' => $pageID,
'ip' => $ip,
);
$db->insert('audit',$fields);
require_once $abs_us_root.$us_url_root.'usersc/scripts/did_not_have_permission.php';
Redirect::to($homepage);
return false;
}



to:

//Check if user's permission levels allow access to page
if (checkPermission($pagePermissions)){
return true;

///////////////////////////////////////////////////////////////////////////////////////////
}elseif (checkMenu(2,$user->data()->id)){ //Grant access admin
return true;
///////////////////////////////////////////////////////////////////////////////////////////


}elseif (in_array($user->data()->id, $master_account)){ //Grant access if master user
return true;

}else {
if (!$homepage = Config::get('homepage'))
$homepage = 'index.php';
$fields = array(
'user' => $user->data()->id,
'page' => $pageID,
'ip' => $ip,
);
$db->insert('audit',$fields);
require_once $abs_us_root.$us_url_root.'usersc/scripts/did_not_have_permission.php';
Redirect::to($homepage);
return false;
}



However, I don't think this is the best fix.

What I think should happen is when you add administrator permission to a user, their userid should be added to the master_account array.

eg $master_account[] = 'userid'

and, when administrator permission is deleted from a user, the userid should be deleted from the master_account array.

eg $pos = array_search('userid', $master_account);
unset($master_account[$pos]);

However, this cannot be done since the master_account array is automatically reset to the default value in the init.php file '$master_account = [1];' when the program loads.


  A patching question..
Posted by: wickey312 - 05-02-2017, 07:40 PM - Forum: Modifications and Hackery - Replies (8)

Hi, so I'm relatively new to user spice but firstly thank goodness for this - my life is truly easier.

I am currently editing user profiles, changing columns etc. etc. For example, my users dont need to specify a first/last name, so effectively want to delete the cols. How does this work in userspice from a general point of view (does it break anything?) and does it effect the next patches - am I going to run into problems by deleting/modifying the default columns?

Thanks in advance


  Upgrade UserCake to UserSpice (still same?)
Posted by: gaiusjaugustus - 05-01-2017, 08:48 PM - Forum: UserSpice 4.3 and Below - Replies (1)

Hi,
I just want to check and be sure that I can still follow the steps laid out here in order to upgrade from UserCake. Glad I found UserSpice and hoping to try it out!

Gaius


  users/helpers/us_helpers.php ...hasPerm needs global $master_account;
Posted by: Johnny - 04-30-2017, 07:17 PM - Forum: UserSpice 4.3 and Below - Replies (1)

Hi Was trying to implement the following:
on a json output php page::
if(!hasPerm([4],$user->data()->id)){
//echo ('2,3,4');
die("NO RIGHTS TO SEE THIS");
}

I noticed through testing access to the page that the $master_account was NULL when used by the hasPerm function on line 767

so I added global $master_account; just under global $user;

Seems to work now Smile