Exemplo n.º 1
0
 private function getPropertyValue(umiObject $obj, $propName)
 {
     if ($prop = $obj->getPropByName($propName)) {
         switch ($prop->getDataType()) {
             case 'date':
                 if (($date = $prop->getValue()) instanceof umiDate) {
                     return $date->getFormattedDate();
                 }
                 return '';
             case 'relation':
                 $result = array();
                 $ids = $prop->getValue();
                 if (!is_array($ids)) {
                     $ids = array($ids);
                 }
                 foreach ($ids as $id) {
                     if ($value = umiObjectsCollection::getInstance()->getObject($id)) {
                         $result[] = $value->getName();
                     }
                 }
                 return empty($result) ? '' : implode(', ', $result);
             case 'boolean':
                 $langs = cmsController::getInstance()->langs;
                 $value = $prop->getValue();
                 return $value ? $langs['boolean_true'] : $langs['boolean_false'];
             default:
                 return $prop->getValue();
         }
     }
     return '';
 }
Exemplo n.º 2
0
 public static function create(discount $discount, umiObject $ruleTypeObject)
 {
     $objects = umiObjectsCollection::getInstance();
     $ruleTypeId = null;
     if (strlen($ruleTypeObject->rule_type_guid)) {
         $ruleTypeId = umiObjectTypesCollection::getInstance()->getTypeIdByGUID($ruleTypeObject->rule_type_guid);
     } else {
         $ruleTypeId = $ruleTypeObject->rule_type_id;
     }
     $objectId = $objects->addObject('', $ruleTypeId);
     $object = $objects->getObject($objectId);
     if ($object instanceof umiObject) {
         $object->setValue('rule_type_id', $ruleTypeObject->getId());
         $object->commit();
         return self::get($objectId, $discount);
     } else {
         return false;
     }
 }
Exemplo n.º 3
0
 public static final function create(umiObject $deliveryTypeObject)
 {
     $objects = umiObjectsCollection::getInstance();
     $deliveryTypeId = null;
     if (strlen($deliveryTypeObject->delivery_type_guid)) {
         $deliveryTypeId = umiObjectTypesCollection::getInstance()->getTypeIdByGUID($deliveryTypeObject->delivery_type_guid);
     } else {
         $deliveryTypeId = $deliveryTypeObject->delivery_type_id;
     }
     $objectId = $objects->addObject('', $deliveryTypeId);
     $object = $objects->getObject($objectId);
     if ($object instanceof umiObject) {
         $object->setValue('delivery_type_id', $deliveryTypeObject->getId());
         $object->commit();
         return self::get($objectId);
     } else {
         return false;
     }
 }
Exemplo n.º 4
0
 protected function mergeBasket(umiObject $guestBasket)
 {
     $orderItems = $guestBasket->order_items;
     if (is_array($orderItems)) {
         $userBasket = __emarket_purchasing::getBasketOrder(false);
         if ($userBasket) {
             foreach ($orderItems as $orderItemId) {
                 $orderItem = orderItem::get($orderItemId);
                 if ($orderItem) {
                     $userBasket->appendItem($orderItem);
                 }
             }
             $userBasket->commit();
         }
     }
     $guestBasket->delete();
 }
Exemplo n.º 5
0
 public function __construct($vb80bb7740288fda1f201890375a60c8f = false)
 {
     $this->store_type = 'subscriber';
     $vd82f268d5a82fc66260ad083d1a2e5b4 = umiObjectsCollection::getInstance()->getObject($vb80bb7740288fda1f201890375a60c8f);
     if ($vd82f268d5a82fc66260ad083d1a2e5b4 instanceof umiObject) {
         $v963cecbdfa91757f2c7a4a9e794f3da7 = $vd82f268d5a82fc66260ad083d1a2e5b4->getTypeId();
         $v784813455c14b4e16d7014624f797310 = umiObjectTypesCollection::getInstance()->getType($v963cecbdfa91757f2c7a4a9e794f3da7);
         $vc4b174241b773d2a96dfb1503c713026 = umiHierarchyTypesCollection::getInstance()->getType($v784813455c14b4e16d7014624f797310->getHierarchyTypeId());
         if ($vc4b174241b773d2a96dfb1503c713026->getName() === "dispatches" && $vc4b174241b773d2a96dfb1503c713026->getExt() === "subscriber") {
             $vb08692690504d9f125f2db62c3351173 = $vd82f268d5a82fc66260ad083d1a2e5b4->getValue('uid');
             $this->o_user = umiObjectsCollection::getInstance()->getObject($vb08692690504d9f125f2db62c3351173);
         } elseif ($vc4b174241b773d2a96dfb1503c713026->getName() === "users" && $vc4b174241b773d2a96dfb1503c713026->getExt() === "user") {
             $this->o_user = $vd82f268d5a82fc66260ad083d1a2e5b4;
             $vb80bb7740288fda1f201890375a60c8f = $this->getSubscriberByUserId($vb80bb7740288fda1f201890375a60c8f);
         }
     }
     parent::__construct($vb80bb7740288fda1f201890375a60c8f);
 }
 public function setObject(umiObject $va8cfde6331bd59eb2ac96f8911c4b666, $vac2a04437278cf6e6e597b1b9295b193 = true)
 {
     $this->object = $va8cfde6331bd59eb2ac96f8911c4b666;
     $this->object_id = $va8cfde6331bd59eb2ac96f8911c4b666->getId();
     if ($vac2a04437278cf6e6e597b1b9295b193) {
         $this->setIsUpdated();
     }
 }
    protected function parseValues(umiObject $va8cfde6331bd59eb2ac96f8911c4b666, umiField $v06e3d36fa30cea095545139854ad1fb9)
    {
        $v519504d7d4beb745dac24ccfb6c1d7c9 = $v06e3d36fa30cea095545139854ad1fb9->getFieldType();
        $v5c4e252909242b24243818048235620d = (int) $v519504d7d4beb745dac24ccfb6c1d7c9->getIsMultiple();
        $v983560f49ede87197144b22c810a5087 = (string) $v519504d7d4beb745dac24ccfb6c1d7c9->getDataType();
        $vf09cc7ee3a9a93273f4b80601cafb00c = $va8cfde6331bd59eb2ac96f8911c4b666->getValue($v06e3d36fa30cea095545139854ad1fb9->getName());
        $vf09cc7ee3a9a93273f4b80601cafb00c = is_array($vf09cc7ee3a9a93273f4b80601cafb00c) ? $vf09cc7ee3a9a93273f4b80601cafb00c : array($vf09cc7ee3a9a93273f4b80601cafb00c);
        switch ($v983560f49ede87197144b22c810a5087) {
            case "img_file":
                $vde5b1cd11c4544e7f3fe792f2e0d8b8b = array();
                foreach ($vf09cc7ee3a9a93273f4b80601cafb00c as $vf19e92e810d08b6cf2d0265b779064d9) {
                    if (!$vf19e92e810d08b6cf2d0265b779064d9) {
                        continue;
                    }
                    $vde5b1cd11c4544e7f3fe792f2e0d8b8b[] = array("value" => $vf19e92e810d08b6cf2d0265b779064d9->getFilePath());
                }
                break;
            case "relation":
                $vde5b1cd11c4544e7f3fe792f2e0d8b8b = array();
                foreach ($vf09cc7ee3a9a93273f4b80601cafb00c as $vf19e92e810d08b6cf2d0265b779064d9) {
                    $vf19e92e810d08b6cf2d0265b779064d9 = umiObjectsCollection::getInstance()->getObject($vf19e92e810d08b6cf2d0265b779064d9);
                    if (!$vf19e92e810d08b6cf2d0265b779064d9) {
                        continue;
                    }
                    $v818ad5ef6588e140ecb9f81e810c028a = $vf19e92e810d08b6cf2d0265b779064d9->getId();
                    if (!in_array($v818ad5ef6588e140ecb9f81e810c028a, $this->objects)) {
                        $this->objects[] = $v818ad5ef6588e140ecb9f81e810c028a;
                    }
                    $vde5b1cd11c4544e7f3fe792f2e0d8b8b[] = array("value" => $vf19e92e810d08b6cf2d0265b779064d9->getName(), "id" => $vf19e92e810d08b6cf2d0265b779064d9->getId());
                }
                break;
            case "symlink":
                $vde5b1cd11c4544e7f3fe792f2e0d8b8b = array();
                foreach ($vf09cc7ee3a9a93273f4b80601cafb00c as $vf19e92e810d08b6cf2d0265b779064d9) {
                    if (!$vf19e92e810d08b6cf2d0265b779064d9) {
                        continue;
                    }
                    $vde5b1cd11c4544e7f3fe792f2e0d8b8b[] = array("value" => $vf19e92e810d08b6cf2d0265b779064d9->getName(), "id" => $vf19e92e810d08b6cf2d0265b779064d9->getId(), "link" => $this->getDomainPath() . umiHierarchy::getInstance()->getPathById($vf19e92e810d08b6cf2d0265b779064d9->getId()));
                }
                break;
            case "date":
                $vde5b1cd11c4544e7f3fe792f2e0d8b8b = array();
                foreach ($vf09cc7ee3a9a93273f4b80601cafb00c as $vf19e92e810d08b6cf2d0265b779064d9) {
                    if (!$vf19e92e810d08b6cf2d0265b779064d9) {
                        continue;
                    }
                    $vde5b1cd11c4544e7f3fe792f2e0d8b8b[] = array("timestamp" => $vf19e92e810d08b6cf2d0265b779064d9->getFormattedDate("U"), "RFC" => $vf19e92e810d08b6cf2d0265b779064d9->getFormattedDate("r"), "UTC" => $vf19e92e810d08b6cf2d0265b779064d9->getFormattedDate(DATE_ATOM));
                }
                break;
            default:
                $vde5b1cd11c4544e7f3fe792f2e0d8b8b = array();
                foreach ($vf09cc7ee3a9a93273f4b80601cafb00c as $vf19e92e810d08b6cf2d0265b779064d9) {
                    $vde5b1cd11c4544e7f3fe792f2e0d8b8b[] = array("value" => $vf19e92e810d08b6cf2d0265b779064d9, "id" => NULL);
                }
                break;
        }
        $vf09cc7ee3a9a93273f4b80601cafb00c = "";
        foreach ($vde5b1cd11c4544e7f3fe792f2e0d8b8b as $v3a6d0284e743dc4a9b86f97d6dd1a3bf) {
            if (array_key_exists('value', $v3a6d0284e743dc4a9b86f97d6dd1a3bf)) {
                $v2063c1608d6e0baf80249c42e2be5804 = $v3a6d0284e743dc4a9b86f97d6dd1a3bf['value'];
            }
            if (array_key_exists('id', $v3a6d0284e743dc4a9b86f97d6dd1a3bf)) {
                if (array_key_exists('timestamp', $v3a6d0284e743dc4a9b86f97d6dd1a3bf)) {
                    $vf09cc7ee3a9a93273f4b80601cafb00c .= <<<END
\t\t\t\t\t\t\t<value>
\t\t\t\t\t\t\t\t<timestamp><![CDATA[{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['timestamp']}]]></timestamp>
\t\t\t\t\t\t\t\t<RFC><![CDATA[{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['RFC']}]]></RFC>
\t\t\t\t\t\t\t\t<UTC><![CDATA[{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['UTC']}]]></UTC>
\t\t\t\t\t\t\t</value>

END;
                } else {
                    $v7ffc4d510260a8544e5550e62ec56bc1 = !is_null($v3a6d0284e743dc4a9b86f97d6dd1a3bf['id']) ? ' id="' . $v3a6d0284e743dc4a9b86f97d6dd1a3bf['id'] . '"' : '';
                    $vf09cc7ee3a9a93273f4b80601cafb00c .= <<<END
\t\t\t\t\t\t\t<value{$v7ffc4d510260a8544e5550e62ec56bc1}><![CDATA[{$v2063c1608d6e0baf80249c42e2be5804}]]></value>

END;
                }
            } else {
                if (array_key_exists('timestamp', $v3a6d0284e743dc4a9b86f97d6dd1a3bf)) {
                    $vf09cc7ee3a9a93273f4b80601cafb00c .= <<<END
\t\t\t\t\t\t\t<value>
\t\t\t\t\t\t\t\t<timestamp><![CDATA[{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['timestamp']}]]></timestamp>
\t\t\t\t\t\t\t\t<RFC><![CDATA[{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['RFC']}]]></RFC>
\t\t\t\t\t\t\t\t<UTC><![CDATA[{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['UTC']}]]></UTC>
\t\t\t\t\t\t\t</value>

END;
                } else {
                    $vf09cc7ee3a9a93273f4b80601cafb00c .= <<<END
\t\t\t\t\t\t\t<value><![CDATA[{$v2063c1608d6e0baf80249c42e2be5804}]]></value>

END;
                }
                if (!array_key_exists('value', $v3a6d0284e743dc4a9b86f97d6dd1a3bf)) {
                    continue;
                }
                if (array_key_exists('timestamp', $v3a6d0284e743dc4a9b86f97d6dd1a3bf)) {
                    $vb80bb7740288fda1f201890375a60c8f = $v3a6d0284e743dc4a9b86f97d6dd1a3bf['id'];
                    $v2a304a1348456ccd2234cd71a81bd338 = array_key_exists("link", $v3a6d0284e743dc4a9b86f97d6dd1a3bf) ? " link=\"{$v3a6d0284e743dc4a9b86f97d6dd1a3bf['link']}\"" : "";
                    $vf09cc7ee3a9a93273f4b80601cafb00c .= <<<END
\t\t\t\t\t\t\t<value id="{$vb80bb7740288fda1f201890375a60c8f}"{$v2a304a1348456ccd2234cd71a81bd338}><![CDATA[{$v2063c1608d6e0baf80249c42e2be5804}]]></value>
END;
                }
            }
        }
        unset($vde5b1cd11c4544e7f3fe792f2e0d8b8b);
        return $vf09cc7ee3a9a93273f4b80601cafb00c;
    }
 protected function storeObjectData(umiObject $va8cfde6331bd59eb2ac96f8911c4b666)
 {
     $v8d777f385d3dfec8815d20f7496026dc = array(array("int", $va8cfde6331bd59eb2ac96f8911c4b666->getId()), array("string", $va8cfde6331bd59eb2ac96f8911c4b666->getName()));
     foreach ($this->fields as $v972bf3f05d14ffbdb817bef60638ff00) {
         $v23a5b8ab834cb5140fa6665622eb6417 = $va8cfde6331bd59eb2ac96f8911c4b666->getPropByName($v972bf3f05d14ffbdb817bef60638ff00);
         if ($v23a5b8ab834cb5140fa6665622eb6417 instanceof umiObjectProperty) {
             $v870b60148237c1452dfb337fdd19c314 = $v23a5b8ab834cb5140fa6665622eb6417->getDataType();
             $v2063c1608d6e0baf80249c42e2be5804 = $va8cfde6331bd59eb2ac96f8911c4b666->getValue($v972bf3f05d14ffbdb817bef60638ff00);
             $v8d777f385d3dfec8815d20f7496026dc[$v972bf3f05d14ffbdb817bef60638ff00] = array($v870b60148237c1452dfb337fdd19c314, $v2063c1608d6e0baf80249c42e2be5804);
             if (!in_array($v972bf3f05d14ffbdb817bef60638ff00, $this->foundFields)) {
                 $this->foundFields[] = $v972bf3f05d14ffbdb817bef60638ff00;
             }
         } else {
             $v8d777f385d3dfec8815d20f7496026dc[$v972bf3f05d14ffbdb817bef60638ff00] = NULL;
         }
     }
     return $v8d777f385d3dfec8815d20f7496026dc;
 }
 public function addObject($vb068931cc450442b63f5b3d276ea4297, $v94757cae63fd3e398c0811a976dd6bbe, $v1945c9a2a5e2ba6133f1db6757a35fcb = false)
 {
     $this->disableCache();
     $v94757cae63fd3e398c0811a976dd6bbe = (int) $v94757cae63fd3e398c0811a976dd6bbe;
     if (!$v94757cae63fd3e398c0811a976dd6bbe) {
         throw new coreException("Can't create object without object type id (null given)");
     }
     $vac5c74b64b4b8352ef2f181affb5ac2a = "INSERT INTO cms3_objects (type_id) VALUES('{$v94757cae63fd3e398c0811a976dd6bbe}')";
     l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a);
     if ($v56bd7107802ebe56c6918992f0608ec6 = l_mysql_error()) {
         throw new coreException($v56bd7107802ebe56c6918992f0608ec6);
         return false;
     }
     $vaf31437ce61345f416579830a98c91e5 = l_mysql_insert_id();
     $va8cfde6331bd59eb2ac96f8911c4b666 = new umiObject($vaf31437ce61345f416579830a98c91e5);
     $va8cfde6331bd59eb2ac96f8911c4b666->setName($vb068931cc450442b63f5b3d276ea4297);
     $va8cfde6331bd59eb2ac96f8911c4b666->setIsLocked($v1945c9a2a5e2ba6133f1db6757a35fcb);
     if ($v5571898aeb5505ee9a9111ddd83598f7 = cmsController::getInstance()->getModule("users")) {
         if ($v5571898aeb5505ee9a9111ddd83598f7->is_auth()) {
             $ve8701ad48ba05a91604e480dd60899a3 = cmsController::getInstance()->getModule("users")->user_id;
             $va8cfde6331bd59eb2ac96f8911c4b666->setOwnerId($ve8701ad48ba05a91604e480dd60899a3);
         }
     } else {
         $va8cfde6331bd59eb2ac96f8911c4b666->setOwnerId(NULL);
     }
     $this->resetObjectProperties($vaf31437ce61345f416579830a98c91e5);
     $va8cfde6331bd59eb2ac96f8911c4b666->commit();
     $this->objects[$vaf31437ce61345f416579830a98c91e5] = $va8cfde6331bd59eb2ac96f8911c4b666;
     return $vaf31437ce61345f416579830a98c91e5;
 }