ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Looking for people to give feedback on Community Auth

March 14, 2012 10:42pm

Subscribe [20]
  • #16 / Mar 19, 2012 3:24pm

    skunkbad

    1326 posts

    Why not just a config option for the path with a default value so the user can change it if they need to?  If you hardwire too much in it becomes less flexible to the users potential needs.

    Right now the developer does have the option of changing the config in config/upload_manager.php.

    Line 17 is this:
    $config[‘upload_dir’] = ‘upload_directory’;

    I’m pretty sure that a simple change to:
    $config[‘upload_dir’] = ‘***/upload_directory’;

    where *** is their sub directory would make it work for people having their codeigniter install in a sub directory. The problem is, I don’t have a WAMP install or environment where I can test this out.

    So the upload directory is not exactly hardwired into the uploader. I’m just not sure I can come up with a solution that works for everyone. If you browse through the forum and look at people having issues related to the standard uploader, there are issues related to the the ‘upload_path’ config item that make it difficult for my uploader to work “out of the box” for everyone. It’s really a CI issue. I’ll try to make some changes to make it easier for everyone to configure, and add some documentation to clarify usage.

    As I mentioned above, I’m going to try to see if I can use the FCPATH constant to fix things. Since the upload class config item ‘upload_path’ can be an absolute path, I don’t see why I couldn’t use that in the _set_upload_location() and _make_directories() methods in MY_Upload. I’ll give it a shot, and hopefully I can get people to confirm that it works or doesn’t work.

  • #17 / Mar 19, 2012 5:12pm

    skunkbad

    1326 posts

    I made some changes to the repo, and hopefully these changes are all that is necessary for the uploader to work for everyone. I basically am hand crafting a upload path using FCPATH, which is absolute. I tested it here (Windows/XAMPP) and on community-auth.com (Linux/Litespeed), and all is well. If you guys can do some testing with the new code, I’d appreciate it. Let me know how it goes.

  • #18 / Mar 20, 2012 3:08am

    JuangaCovas

    3 posts

    Hey Brian,

    Merged your new code, upload stuff is clearer, but I think we’re confusing things!

    For example, I have your app setup under a local, htdocs subdirectory, exactly under: /projects/sandbox/auth

    If I change ...application/config/uploads_manager.php as you said:

    $config['upload_dir'] = '/projects/sandbox/auth/upload_directory';

    That makes the upload to fail, error given is ‘callback failed’ on JS alert message.

    Change again to:

    $config['upload_dir'] = 'upload_directory';

    So, ok, your comment on $config[‘upload_dir’] is “Upload_dir must be a single public root level directory”, BUT the fact is the file is correctly uploaded to the correct subdirectory, under /projects/sandbox/auth/upload_directory <—- so the upload is CORRECT, no JS alert, the problem is for some reason you’re writing an absolute path to the database: table user_profiles, field profile_image, it gets: /upload_directory/profile_images… instead of the correct location of the file, that landed on /projects/sandbox/auth/upload_directory

    And so the div id=“profile_image” gets populated with an img src=”/upload_directory/profile_images”... which is not found 😉

    Upload is working, it’s just a matter of database/showing the image problem.

    Hope that helps!

     

  • #19 / Mar 20, 2012 4:41am

    skunkbad

    1326 posts

    OK, I fixed it. Please use a single public root level directory for upload_dir. It won’t work without doing that.

    I created a installation of Community Auth in a sub-directory with the same location as yours:

    /projects/sandbox/auth

    I put this in my httpd-vhosts.conf:

    <VirtualHost *:80>
     ServerName localhost.projects
     DocumentRoot "C:\xampp\htdocs\projects"
    </VirtualHost>
    <VirtualHost *:443> 
     DocumentRoot "C:\xampp\htdocs\projects"
     ServerName localhost.projects
     SSLEngine on 
     SSLCertificateFile conf/ssl.crt/server.crt 
     SSLCertificateKeyFile conf/ssl.key/server.key 
    </VirtualHost>

    I changed the RewriteBase in my .htaccess to this:

    RewriteBase /sandbox/auth/

    So at this point, I probably have the exact same thing as you.

    1) I went in and fixed the references to images in the style.css file.

    2) I changed the file_url() method in MY_Upload to this:

    public function file_url( $full_path )
    {
     // Get all URI segments of the file upload location
     $path_parts = explode('/', $full_path);
    
     // Initialize variable to track if upload_dir has been reached when looping through $path_parts
     $target_dir = FALSE;
    
     // Initialize variable to hold our image path to pass to base_url()
     $file_url = '';
    
     // Loop through $path_parts
     for( $x=0; $x <= count( $path_parts ) - 1; $x++ )
     {
      // If this parth part is the upload_dir, or if the upload_dir has already been reached
      if( $path_parts[$x] == $this->upload_dir OR $target_dir === TRUE )
      {
       // Build on to the path to pass to base_url()
       $file_url .= ( $target_dir ) ? '/' . $path_parts[$x] : $path_parts[$x];
    
       $target_dir = TRUE;
      }
     }
    
     // Return the URL to the image
     return base_url( $file_url );
    }

    Now it works. Changes are also in the repo.

  • #20 / Mar 20, 2012 6:08am

    JuangaCovas

    3 posts

    Aha, merged and now works. Don’t worry too much, that should be enough for those of us expecting it to work under subdirectories 😉

    Just two notes:

    1) I don’t understand when you say “Please use a single public root level directory for upload_dir. It won’t work without doing that.”

    The image is indeed created into /projects/sandbox/auth/upload_directory, there is no ‘upload_directory’ dir at my webroot. Promise.

    2) When I was trying that, I manually erased my profile image file from the upload_directory under ‘sandbox/auth/upload_directory’, just to see it’s being created there. After doing that, upload failed every time with an error about ‘token’ (your csfr protection). Refreshing page or logout/login again didn’t help. I figured out to manually set blank the profile_image field under user_profiles table on database and then upload worked again. Just to let you know.

    Sorry for the excessive feedback and issues :D

    Juanga

  • #21 / Mar 20, 2012 10:53am

    skunkbad

    1326 posts

    The reason why the upload dir needs to be a single dir is the file url ( shown above ) method is looking for it to match a segment of the upload path after exploding the path. It would never match if a slash appears in the upload dir.

    Next, the uploader doesnt work after deleting the image from the filesystem because the token is instantly used by the 404 created by the missing image. The image would never be missing under normal circumstances.

    It did not matter f you had created the upload dir because mkdir() is doing recursive making of dirs, hence the third parameter of mkdir().

    Hope everyone now has a good uploader experience. Thanks for testing. I would have never known about this problem, or have been able to fix it, without this feedback.

  • #22 / Mar 21, 2012 5:47pm

    Shawller

    5 posts

    Thanks Brian,

    The profile picture works perfectly ok. Thanks for fixing the error, like I said I will always recommend community auth to people. 😊

  • #23 / Mar 22, 2012 12:13am

    skunkbad

    1326 posts

    Thanks Brian,

    The profile picture works perfectly ok. Thanks for fixing the error, like I said I will always recommend community auth to people. 😊

    Prince, glad to hear it’s working for you.

  • #24 / Apr 01, 2012 2:33am

    skunkbad

    1326 posts

    I just added a custom uploader to Community Auth, and could use some testers. The uploader controls allow for drag and drop re-ordering of images, and drag to trash deleting of images. It uses jQuery UI sortable, droppable, draggable, etc. This uploader not in the isolated downloads yet, only the tip. Anyways, let me know how it goes if you have the time to test it out.

  • #25 / Apr 09, 2012 2:48pm

    leatherback

    6 posts

    Hi,

    After some trouble with the download link, I eventually did get to download without the site giving a 404. Now on the dowload site I downloaded and set up the module. However, as I am a near virging in CI, I have serious troubvle getting it set up. In your manual you state it is so symple to install, a manual is not needed. I do disagree. I keep getting 404 errors when trying to get to http://localhost/vraagje/index.php/init

    My CI install sits under http://localhost/vraagje/

    The logs show an error when it comes to sessions:
    DEBUG - 2012-04-09 11:32:52—> Config Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Hooks Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Utf8 Class Initialized
    DEBUG - 2012-04-09 11:32:52—> UTF-8 Support Enabled
    DEBUG - 2012-04-09 11:32:52—> URI Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Router Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Output Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Security Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Input Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Global POST and COOKIE data sanitized
    DEBUG - 2012-04-09 11:32:52—> Language Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Loader Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Config file loaded: application/config/db_tables.php
    DEBUG - 2012-04-09 11:32:52—> Config file loaded: application/config/authentication.php
    DEBUG - 2012-04-09 11:32:52—> Helper loaded: html_helper
    DEBUG - 2012-04-09 11:32:52—> Helper loaded: url_helper
    DEBUG - 2012-04-09 11:32:52—> Database Driver Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Session Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Helper loaded: string_helper
    DEBUG - 2012-04-09 11:32:52—> Encrypt Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Session routines successfully run
    DEBUG - 2012-04-09 11:32:52—> Model Class Initialized
    DEBUG - 2012-04-09 11:32:52—> Model Class Initialized
    DEBUG - 2012-04-09 11:32:53—> Controller Class Initialized
    DEBUG - 2012-04-09 11:32:53—> Model Class Initialized
    DEBUG - 2012-04-09 11:32:53—> Helper loaded: form_helper
    DEBUG - 2012-04-09 11:32:53—> Session class already loaded. Second attempt ignored.
    ERROR - 2012-04-09 11:32:53—> 404 Page Not Found—>
    ERROR - 2012-04-09 11:32:53—> Severity: Warning —> file_get_contents(http://localhost/custom_error_page/error_404?heading=404+Page+Not+Found&message=The+page+you+requested+was+not+found.) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
    C:\xampp\htdocs\vraagje\application\errors\error_404.php 17

    Any suggestions?

  • #26 / Apr 09, 2012 3:37pm

    skunkbad

    1326 posts

    There is documentation, and if followed installation is easy, especially if you already have experience with CI. I don’t know what the problem with bitbucket is today, but it sounds like you may have got a corrupt download, because the php error is claiming that a file does not exist. I can send you a zip if you private message me your email address.

  • #27 / Apr 09, 2012 5:12pm

    leatherback

    6 posts

    Hi Brian,

    Thanks for the help so far, here and over the email.

    In case someone else runs into trouble: Check the .htaccess. My problems were based in a htacces file: It assumed CI is in the root of the server. If you install it in a separate directory, the .htaccess file needs adjustment. Sight. Should-have thought of that myzelf!

  • #28 / Apr 09, 2012 7:08pm

    skunkbad

    1326 posts

    Hi Brian,

    Thanks for the help so far, here and over the email.

    In case someone else runs into trouble: Check the .htaccess. My problems were based in a htacces file: It assumed CI is in the root of the server. If you install it in a separate directory, the .htaccess file needs adjustment. Sight. Should-have thought of that myzelf!

    I’m going to make this more clear in the documentation. The documentation needs to be reviewed because it’s a couple of weeks old. Thanks for your feedback.

    Edit: I just updated the documentation.

  • #29 / Apr 11, 2012 6:36pm

    CI_Monkey

    6 posts

    First, thank you for the Community Auth code!! 

    I’m just starting to work through it, and am a newbie with CI.  I have a question regarding how to integrate Community Auth with an existing CI installation?  I’ve tried cherry picking the files and folders that looked different, and merging code that was different between other files, but this seems like an insane approach (especially since I’m only about a week into CI coding), and I’m trying to do this with other tools similar to yours (ex. CarboGrid).  Seems like an approach that is destined to failure, so again, as a newbie, I’m thinking I’m approaching this the wrong way.  I realize this is a more generic question (I apologize for that), but I’m dying to get the Community Auth stuff working, as it looks to be exactly what I’ve been looking for, and one of the reasons I’ve started working with the whole CI framework.

    Thank you.

  • #30 / Apr 11, 2012 11:45pm

    skunkbad

    1326 posts

    Monkey, just download the newest ‘isolated” version on the downloads page. That version is not pre-installed in CI. The only thing to watch out for is when you have a file that is the same as one in the download, like one of the config files. You just want to see what I put in mine vs yours so you can do whatever it takes to make it work ya know.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases