Advertisement
Guest User

Untitled

a guest
Feb 11th, 2017
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1.             //If title is set and not empty
  2.             if (isset($array['source'][0])) {
  3.                 //If source isn't set to default
  4.                 if ($array['source'] !== 'default') {
  5.                     //If the ID isset
  6.                     if (isset($array['id'][0])) {
  7.                         //If the ID is numeric
  8.                          if (is_numeric($array['id'])) {
  9.                             //Set title limiting characters to 154
  10.                             $offers[$i]["offersource"] = substr($array['source'], 0, 154);
  11.                             //Also se the ID, limiting to 11 characters
  12.                             $offers[$i]["offerid"] = substr($array['id'], 0, 11);
  13.                         //If ID not numeric throw error
  14.                         } else {
  15.                             $message = array("error" => 1, "message" => "Incorrect format on row " . ($i + 1) . ", the ID must be a numerical value.");
  16.                             return $message;
  17.                         }
  18.                     //If ID not set, throw error
  19.                     } else {
  20.                         $message = array("error" => 1, "message" => "In order to set the nework of an offer on row " . ($i + 1) . ", the ID must also be set.");
  21.                         return $message;
  22.                     }
  23.                 //If source is default
  24.                 } else {
  25.                     $message = array("error" => 1, "message" => "You cannot set source to default on row " . ($i + 1) . ". If you would like it as default please leave source blank.");
  26.                     return $message;
  27.                 }
  28.             //If not set
  29.             } else {
  30.                 $offers[$i]["source"] = 'default';
  31.                 //source set to default, if the ID is set throw error
  32.                 if (isset($array['id'][0])) {
  33.                     $message = array("error" => 1, "message" => "Incorrect format on row " . ($i + 1) . ", to set ID the and source must also be set.");
  34.                     return $message;
  35.                 }
  36.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement