Advertisement:

Author Topic: Can't add new Item - OSClass 2.0 RC5  (Read 3453 times)

stfan

  • Newbie
  • *
  • Posts: 8
Can't add new Item - OSClass 2.0 RC5
« on: March 17, 2011, 03:06:26 pm »
Hello,

I've just installed OSClass 2.0 RC5 in my server,
I couldn't manage to add a new item.
It's always saying that "Some fields were too short. Try again!"
In every field I've tried more tha 10 characters, but still the problem persists.

In addition the city field is static in one specific city, i cannot choose another city, only in region field its an activated drop down list.

I will appreciate your help.

 

china2011

  • Newbie
  • *
  • Posts: 8
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #1 on: March 17, 2011, 04:23:41 pm »
yes ,can;t add new Item any more OSClass 2.0 RC5

alex

  • Newbie
  • *
  • Posts: 4
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #2 on: March 17, 2011, 06:15:22 pm »
Same here cannot add new item. Get the same error:

"Some fields were too short. Try again!"

elias.soliman

  • Jr. Member
  • **
  • Posts: 62
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #3 on: March 18, 2011, 02:16:24 am »
the problem was in the itemAction.php file, there the complected function !preg_match can't much the array which into other array
in this file we have aItem is array and into it the title is array too
I solved it by this way:

      $adTitle        = $aItem['title'];
      $adTitle = current($adTitle);
      $adDescription  = $aItem['description'];
      $adDescription  = current($adDescription);
first I made an array from title, this I get the value from it. by this way the !preg_match function can much the text inside it

after that I used the new variable in the code

china2011

  • Newbie
  • *
  • Posts: 8
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #4 on: March 18, 2011, 04:14:01 am »
can you share the  itemAction.php that you have modify to us

HimSelf

  • Full Member
  • ***
  • Posts: 163
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #5 on: March 18, 2011, 05:11:40 am »
i got the same problem and also the same on the user creation.

no creation of user possible, registration or adidng thru back office.
no edit or deletion possible too !

elias.soliman

  • Jr. Member
  • **
  • Posts: 62
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #6 on: March 18, 2011, 05:51:23 am »
sure

fined the line 52 to 67, you will see this code

        $contactName    = $aItem['contactName'];
        $contactEmail   = $aItem['contactEmail'];
       
        // Anonymous
        if(!preg_match("/([a-z][^a-z]*){2}/i",$contactName)) {
            $contactName = __("Anonymous");
        }

        // Validate
        if ( !preg_match("/([a-z][^a-z]*){3}/i", current($aItem['title']) ) ||
            !preg_match("/([a-z][^a-z]*){8}/i", current($aItem['description']) ) ||
            !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/",$contactEmail) ||
            !preg_match("/^[0-9]+$/", $aItem['catId'] )) {
            osc_add_flash_message( _m('Some fields were too short. Try again!') );
            //osc_add_flash_message( _m('You need to insert your name and email to be able to publish a new item'));
            $success = false;

change it to this

        $contactName    = $aItem['contactName'];
        $contactEmail   = $aItem['contactEmail'];
      $adTitle        = $aItem['title'];
      $adTitle = current($adTitle);
      $adDescription  = $aItem['description'];
      $adDescription  = current($adDescription);

        // Anonymous
        if(!preg_match("/([a-z][^a-z]*){2}/i",$contactName)) {
            $contactName = __("Anonymous");
        }

        // Validate  (this give more control, and explain where the problem it was)
      // Validate the Email address
      if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/",$contactEmail)) {
   osc_add_flash_message( _m('You did not enter correct email address. Try again!') );
          $success = false;
             }
      // Validate the ads title (it should be content more than 6 chars)
      elseif (strlen($adTitle) < 6) {
   osc_add_flash_message( _m('Check the title, may it is short. Then try again!') );
            $success = false;
         }
      // Validate the description field (it should be content more than 50 chars)
         elseif (strlen($adDescription) < 50) {
osc_add_flash_message( _m('Check the description field, may it is short. Then try again!') );
            $success = false;




it's will work 100%
now I try to do some functions to make more control on the users inputs for all forms, if anybody can help it this theme too, I will be thx so much

and good luck

china2011

  • Newbie
  • *
  • Posts: 8
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #7 on: March 18, 2011, 07:03:36 am »

HimSelf

  • Full Member
  • ***
  • Posts: 163
Re: Can't add new Item - OSClass 2.0 RC5
« Reply #8 on: March 18, 2011, 04:54:38 pm »
Yes, this patch works well for items.

but we still have a similar problem for user registering.

thru bo : no user registration, edition, deletion possible.
thru fo : user registration possible, but validation mail arrives 3 hours later & the link says : "validation link no more availble" or something like that.