public function setUrl($url) { if ($url != $this->val('alias_url')) { $a = new Alias($this->db); $url = Alias::generateAliasUrl(myTrim($url)); $new_url = $url; $a->loadByUrl($new_url); $counter = 0; while ($a->is_loaded && $a->val('alias_id') != $this->val('alias_id')) { $counter += 1; $new_url = $url . '-' . $counter; $a->loadByUrl($new_url); } $this->data['alias_url'] = $new_url; } }
<?php //get unloggedin account //read the first line from a.txt and save the content as an account. //do not delete the line //export the account through javascript code header("Content-type: text/javascript"); $account = ''; function myTrim($str) { $str = trim($str); $str = strip_tags($str, ""); $str = preg_replace("{\t}", "", $str); $str = preg_replace("{\r\n}", "", $str); $str = preg_replace("{\r}", "", $str); $str = preg_replace("{\n}", "", $str); $str = preg_replace("{ }", "", $str); return $str; } $file = fopen("a.txt", "r"); if (!feof($file)) { $account = myTrim(fgets($file)); echo '$("#account").val("' . $account . '")'; if ($account == '') { echo ';$("form").hide()'; echo ';$("body").append("<h1>has no acc left</h1>")'; } } fclose($file);
$category->save(); } $stmt->close(); } */ $stmt = SqlQuery::select($cube_db, 'cubecart_inventory'); if ($stmt) { $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { $product = new Product($db); $product->loadByExtId($row['productId']); // import new product if (!$product->is_loaded) { $product->data['product_ext_id'] = $row['productId']; $product->data['product_name'] = myTrim(convertEncoding($row['name'])); $product->data['product_price'] = parseFloat($row['price']); $category = loadCategory($row['cat_id']); if (isset($category)) { $product->data['product_category_id'] = $category->ival('category_id'); } $new++; } else { $updated++; } $product->data['product_description'] = convertEncoding($row['description']); $product->data['product_image'] = $row['image']; $product->save(); } $stmt->close(); }
unlink($archive_path); } if (file_exists($xml_path)) { $xml = simplexml_load_file($xml_path); /* kategorie */ foreach ($xml->categories->category as $category) { $cat_total += 1; $zCategory = new Category($db); $zCategory->loadByExtId(intval($category->id)); if ($zCategory->is_loaded) { $cat_updated += 1; } else { $cat_inserted += 1; $zCategory->data['category_ext_id'] = intval($category->id); } $zCategory->data['category_name'] = myTrim($category->name); $zCategory->data['category_description'] = $category->desc; if (isset($category->parentid) && $category->parentid > 0) { $parent = new Category($db); $parent->loadByExtId(intval($category->parentid)); if ($parent->is_loaded) { $zCategory->data['category_parent_id'] = $parent->val('category_id'); } } $zCategory->save(); // update alias $a = new Alias($db, $zCategory->val('category_alias_id')); if (!$a->is_loaded) { $a->setUrl($zCategory->getAliasUrl()); $a->data['alias_path'] = $zCategory->getAliasPath(); $a->save();
<?php global $db, $home_dir, $custAuth; if (!$custAuth->customer->val('customer_anonymous')) { $messages->add(t('You are already registered and logged in.')); } else { $email = myTrim(strtolower(_g('register_email'))); $password = _g('register_password'); // validate email and password once again if ($custAuth->isValidEmail($email) && $custAuth->isValidPassword($password)) { // check if email exists $customer = new Customer($db); $customer->loadByEmail($email); if ($customer->is_loaded) { $messages->error(t('This email is already used. ')); } else { $custAuth->customer->data['customer_name'] = null; $custAuth->customer->data['customer_email'] = $email; $custAuth->customer->data['customer_anonymous'] = 0; $custAuth->customer->data['customer_password_hash'] = CustomerAuthentication::hashPassword($password); $custAuth->customer->save(); $custAuth->login($email, $password); if ($custAuth->isAuth()) { redirect(_g('ret', '/')); } else { $messages->add(t('Cannot log you in. Sorry')); } } } else { $messages->error(t('Invalid password or email.')); }
function combi9($x, $y) { $a = myOrd($x) + myOrd($y); $b = myParseUrl('result is: ' . $a); return asStringReturnString(myTrim($b)); }
function trimSlashes($s) { return myTrim($s, '/'); }