Forum Activity for @ultrajam

SteveX
@ultrajam
02/13/14 09:07:59AM
2,589 posts

Marketplace updates- Sometimes have to install twice


Installation and Configuration

This has just happened to me again.

I installed 4 module updates earlier today using the Update All button, it worked perfectly.

I just noticed a jrDeveloper update appear so clicked the Update All button (although there was only the one). The update appeared to install successfully, and success was reported in the modal, but when the page refreshes on closing the modal the update is still in the list of available updates.

The log reports that the update was successful as well:
Quote:02/13/14 04:57:24PM 127.0.0.1 [SteveX]: all marketplace updates successfully installed
02/13/14 04:57:23PM 127.0.0.1 [SteveX]: successfully updated module jrDeveloper from version 1.1.1 to 1.1.2
02/13/14 04:57:19PM 127.0.0.1 [SteveX]: installing all marketplace updates

I then tried emptying caches and returning to Marketplace system updates, the update still shows as unapplied. The jrDeveloper-release-1.1.2 dir has been downloaded to the site, and the alias jrDeveloper shows as updated at the time I clicked update all.

I haven't clicked the update all or the update button since, so if there is anything you want me to check out just let me know.
SteveX
@ultrajam
02/13/14 07:26:41AM
2,589 posts

Music Charts not showing properly and counter not counting accordinaly


Design and Skin Customization

Put this into your chart row template, look at it over the course of a few days, and how the chart is working will be much clearer:
{if jrUser_is_master()}
chart_count: {$item.chart_count}
chart_position: {$item.chart_position}
chart_new_entry: {$item.chart_new_entry}
chart_change: {$item.chart_change}
chart_direction: {$item.chart_direction}
{/if}

updated by @ultrajam: 02/13/14 07:27:06AM
SteveX
@ultrajam
02/13/14 05:28:38AM
2,589 posts

jrCore_validate_location_url


Jamroom Developers

I have a delete button which is not on a profile, it is in a module view.

The delete fails on jrCore_validate_location_url(); so I’ve temporarily copied that function to ujModule_validate_location_url(); whilst figuring out why. If I comment out the validate_location_url check everything works fine, but it looks like I need a check for CSRF purposes?

It fails because $_COOKIE['jr_location_url']{1} doesn’t exist. $_COOKIE looks like this:
Quote:(2014-02-13T13:09:09+00:00 0.07493000)-(mem: 9699328)-(pid: 31410)-(uri: /mymodule/section_delete/id=14)
Array
(
[sessb00dfd089f00] => d1i2n3fop8tuvg675r821qv5g7
[autob00dfd089f00] => 1-d2128387086991cc3398b8310c732a9d
)
Is jr_location_url missing because I am not on a profile?

How do I get jr_location_url into the cookie? Or should I be looking at another way around?

Thanks!


The delete function and jrCore_validate_location_url functions pasted below, but they are standard.

//------------------------------
// section_delete
//------------------------------
function view_ujModule_section_delete($_post, $_user, $_conf)
{
    // Must be logged in
    jrUser_session_require_login();
    ujModule_validate_location_url();
    jrUser_check_quota_access('ujModule');

    // Make sure we get a good id
    if (!isset($_post['id']) || !jrCore_checktype($_post['id'], 'number_nz')) {
        jrCore_notice_page('error', 'Invalid ID');
        jrCore_form_result('referrer');
    }
    $_rt = jrCore_db_get_item('ujModule', $_post['id']);
    // Make sure the calling user has permission to delete this item
    if (!jrUser_can_edit_item($_rt)) {
        jrUser_not_authorized();
    }
    jrCore_db_delete_item('ujModule', $_post['id']);
    jrProfile_reset_cache();
    jrCore_form_result('delete_referrer');
}

/**
 * Validate a window.location redirect URL has been set for CSRF purposes
 * @return bool
 */
function ujModule_validate_location_url()
{
fdebug($_COOKIE,$_SERVER);
    if (isset($_COOKIE['jr_location_url']{1})) {
        // Make sure we've come from the correct URL
        if (!strpos($_COOKIE['jr_location_url'], $_SERVER['REQUEST_URI'])) {
            // Check QUERY_STRING - normally this is not needed, but on some
            // redirects the params can get double encoded - QUERY_STRING will have it right
            // [QUERY_STRING] => _uri=networklicense/host_remove/aHR0cDovL3d3dy5wcm94aW1hY29yZS5jb20%253D
            if (isset($_SERVER['QUERY_STRING']) && strpos($_SERVER['QUERY_STRING'], '_uri=') === 0) {
                list(, $uri) = explode('=', $_SERVER['QUERY_STRING']);
                if (strpos($_COOKIE['jr_location_url'], $uri)) {
                    return true;
                }
            }
            jrCore_notice_page('error', 'invalid location redirect token received - please try again');
            return false;
        }
        return true;
    }
    jrCore_notice_page('error', 'invalid location redirect token received - please try again (2)');
    return false;
}

updated by @ultrajam: 03/19/14 02:33:05AM
SteveX
@ultrajam
02/13/14 04:23:37AM
2,589 posts

looking for a recommendation on how to implement this


Design and Skin Customization

Yes, UK time - I should be around later today.

I haven't needed to edit the htaccess file at all in JR5 (except to remove ExecCGI on servers which use ISPConfig control panel).

ujCategories will create all the pages for you if you need them within the categories section - /categories/mycat

You put the categories smarty function into a template if you need that to be jsut /mycat
SteveX
@ultrajam
02/13/14 04:02:05AM
2,589 posts

Is there a way for users to re-order their menu tabs on profile page?


Suggestions

You can do a lot with jrProfile_menu, at the moment you can check out the function in jrProfile/include.php to see the other parameters.

One thing worth noting if you are trying to get a custom module to appear is that an item_index.tpl is required in that module, otherwise it won't appear. The function also checks the requirements for the module (in it's init function) and it won't appear if the requirements are not met. And a module won't appear if the profile has no items created yet (but the owner always sees it).

"modules", "exclude_modules", "always_show", "owner_only", "require_login", "order", "targets"

I haven't figured out targets, but it looks like you provide an alternate url for the module.
SteveX
@ultrajam
02/13/14 03:41:43AM
2,589 posts

Documents module missing form designer button?


Suggestions

Thanks Brian!

I'd be very interested in doing that for sections as well if it crops up in the future.
SteveX
@ultrajam
02/13/14 03:18:27AM
2,589 posts

Sharethis Module Not Showing Icons


Installation and Configuration

This happened to me this week - in my case it was the AdBlock firefox extension which prevents the buttons from showing, so it might be worth checking that.
SteveX
@ultrajam
02/12/14 03:55:54AM
2,589 posts

looking for a recommendation on how to implement this


Design and Skin Customization

I created an invite for the beta channel so you should now be able to install ujCategories once you subscribe (invite sent). ujTogether is in the public channel so you should already have access to that.
updated by @ultrajam: 02/12/14 03:57:10AM
SteveX
@ultrajam
02/12/14 03:52:18AM
2,589 posts

Marketplace No Update Feature


Suggestions

If you are going to customise, clone the module. I do that with search and replace but I think jrAparna can do it all for you.

Then when you update your inactive jrAudio module you just compare your active myAudio module to your newly updated jrAudio module, and add the new lines of code.

So in your dev site you have jrAudio (inactive) which is always up to date, and a clone named myAudio (active) which you update at your leisure, if necessary. You can do the same with skins as well.

If it is only the templates that you are changing it's even simpler - just override the module templates in the skin directory.

You can specify requirements for modules in the init function:
function ujIpsumJam_meta()
{
    $_tmp = array(
        'name'        => 'Ipsum Jam',
        'url'         => 'ipsumjam',
        'version'     => '1.0.2',
        'requires'    => 'jrCore:5.1.0,jrEmbed',
        'developer'   => 'Ultrajam, ©' . strftime('%Y'),
        'description' => 'Gratuitous Lorem Ipsum Jamming',
        'category'    => 'tools'
    );
    return $_tmp;
}

'requires' => 'jrCore:5.1.0,jrEmbed',
That specifies at least version 5.1.0 of the core, and any version of jrEmbed. The module will install but cannot be activated if it doesn't meet the requirements.
  192