Jump to:

1036 Posts in 810 Topics by 315 members

Forum Module

SilverStripe Forums » Forum Module » Problem with GeoIP

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3348 Views
  • Webdoc
    Avatar
    Community Member
    332 Posts

    Problem with GeoIP Link to this post

    i cand edit admin profile in admin section and also edit profile in forum section

    In admin errori is

    ERROR [Warning]: exec() has been disabled for security reasons
    IN GET /admin/security/EditForm/field/Members/item/1/edit?ajax=1
    Line 285 in /var/www/virtual/leeviland.org/htdocs/sapphire/integration/Geoip.php

    Source
    ======
    276:     *
    277:     * @param string $address The IP address to get the country of
    278:     * @param boolean $codeOnly Returns just the country code
    279:     */
    280:    static function ip2country($address, $codeOnly = false) {
    281:       // Return if in CLI, or you'll get this error: "sh: geoiplookup: command not found"
    282:       if(Director::is_cli()) return false;
    283:       
    284:       $cmd = 'geoiplookup ' . escapeshellarg($address);
    * 285:       exec($cmd, $result, $code);
    286:
    287:       // Note: At time of writing, $result is always zero for this program
    288:
    289:       if($code == 127) return false;
    290:       if($result == false) return false;
    291:       

    <ul>exec(geoiplookup '88.196.203.66',,)
    line 285 of Geoip.php

    Geoip::ip2country(88.196.203.66,1)
    line 324 of Geoip.php

    Geoip::visitor_country()
    line 13 of CountryDropdownField.php

    CountryDropdownField->__construct(Country,Country)
    line 204 of ForumRole.php

    ForumRole->updateCMSFields(FieldSet,,,,,,)
    line 777 of Object.php

    Object->extend(updateCMSFields,FieldSet)
    line 1727 of DataObject.php

    DataObject->getCMSFields()
    line 833 of Member.php

    Member->getCMSFields()
    line 474 of ComplexTableField.php

    ComplexTableField->getCustomFieldsFor(Member)
    line 514 of ComplexTableField.php

    ComplexTableField->getFieldsFor(Member)
    line 769 of ComplexTableField.php

    ComplexTableField_ItemRequest->DetailForm()

    call_user_func_array(Array,Array)
    line 408 of ViewableData.php

    ViewableData->XML_val(DetailForm,,1)
    line 20 of .cache.var.www.virtual.leeviland.org.htdocs.sapphire.templates.ComplexTableField_popup.ss

    include(/var/www/virtual/leeviland.org/htdocs/silverstripe-cache/.cache.var.www.virtual.leeviland.org.htdocs.sapphire.templates.ComplexTableField_popup.ss)
    line 354 of SSViewer.php

    SSViewer->process(MemberTableField_ItemRequest)
    line 773 of ViewableData.php

    ViewableData->renderWith(ComplexTableField_popup)
    line 730 of ComplexTableField.php

    ComplexTableField_ItemRequest->edit(HTTPRequest)
    line 129 of RequestHandler.php

    RequestHandler->handleRequest(HTTPRequest)
    line 143 of RequestHandler.php

    RequestHandler->handleRequest(HTTPRequest)
    line 143 of RequestHandler.php

    RequestHandler->handleRequest(HTTPRequest)
    line 143 of RequestHandler.php

    RequestHandler->handleRequest(HTTPRequest)
    line 122 of Controller.php

    Controller->handleRequest(HTTPRequest)
    line 277 of Director.php

    Director::handleRequest(HTTPRequest,Session)
    line 121 of Director.php

    Director::direct(/admin/security/EditForm/field/Members/item/1/edit)
    line 118 of main.php

    </ul>

    In http://www.leeviland.org/ForumMemberProfile/edit error is:

    [Warning] exec() has been disabled for security reasons
    GET /ForumMemberProfile/edit
    Line 285 in /var/www/virtual/leeviland.org/htdocs/sapphire/integration/Geoip.php

    Source
    276     *
    277     * @param string $address The IP address to get the country of
    278     * @param boolean $codeOnly Returns just the country code
    279     */
    280    static function ip2country($address, $codeOnly = false) {
    281       // Return if in CLI, or you'll get this error: "sh: geoiplookup: command not found"
    282       if(Director::is_cli()) return false;
    283       
    284       $cmd = 'geoiplookup ' . escapeshellarg($address);
    285       exec($cmd, $result, $code);
    286
    287       // Note: At time of writing, $result is always zero for this program
    288
    289       if($code == 127) return false;
    290       if($result == false) return false;
    291       
    Trace
    •exec(geoiplookup '88.196.203.66',,)
    Line 285 of Geoip.php
    •Geoip::ip2country(88.196.203.66,1)
    Line 324 of Geoip.php
    •Geoip::visitor_country()
    Line 13 of CountryDropdownField.php
    •CountryDropdownField->__construct(Country,Riik)
    Line 168 of ForumRole.php
    •ForumRole->getForumFields()

    •call_user_func_array(Array,Array)
    Line 525 of Object.php
    •Object->__call(getForumFields,Array)

    •Member->getForumFields()
    Line 471 of ForumMemberProfile.php
    •ForumMemberProfile->EditProfileForm()
    Line 449 of ForumMemberProfile.php
    •ForumMemberProfile->edit(HTTPRequest)
    Line 162 of Controller.php
    •Controller->handleAction(HTTPRequest)
    Line 129 of RequestHandler.php
    •RequestHandler->handleRequest(HTTPRequest)
    Line 122 of Controller.php
    •Controller->handleRequest(HTTPRequest)
    Line 277 of Director.php
    •Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    •Director::direct(/ForumMemberProfile/edit)
    Line 118 of main.php

    how to fix it

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Problem with GeoIP Link to this post

    See if this helps - open up that file (sapphire/integration/Geoip.php). Go down to line 285 and change it to

    $code = "";
    $result = false;
    @exec($cmd, $result, $code);

    Otherwise you can get round it by just putting a return false; at the top of that function though a nicer fallback that we can get into core like above would be good

  • tutalib
    Avatar
    Community Member
    1 Post

    Re: Problem with GeoIP Link to this post

    good answer
    __________
    tutalib

    3348 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.