/** * Create sitemap link * * @param string $input * @param string $updated * @param string $type */ private function _sitemap_link($input, $updated = false, $type = false) { $updated = !$updated ? time() : $updated; $store_url = CC_SSL ? $GLOBALS['config']->get('config', 'ssl_url') : $GLOBALS['config']->get('config', 'standard_url'); if (!isset($input['url']) && !empty($type)) { $input['url'] = $store_url . '/' . $this->generatePath($input['id'], $type, '', false, true); } $this->_sitemap_xml->startElement('url'); $this->_sitemap_xml->setElement('loc', htmlspecialchars($input['url']), false, false); $this->_sitemap_xml->setElement('lastmod', date('c', $updated), false, false); $this->_sitemap_xml->endElement(); }
/** * Create sitemap link * * @param string $input * @param string $updated * @param string $type */ private function _sitemap_link($input, $updated = false, $type = false) { $updated = !$updated || "0000-00-00" == substr($updated, 0, 10) ? 'NOW' : $updated; $dateTime = new DateTime($updated); $updated = $dateTime->format(DateTime::W3C); $store_url = CC_SSL ? $GLOBALS['config']->get('config', 'ssl_url') : $GLOBALS['config']->get('config', 'standard_url'); if (!isset($input['url']) && !empty($type)) { $input['url'] = $store_url . '/' . $this->generatePath($input['id'], $type, '', false, true); } $this->_sitemap_xml->startElement('url'); $this->_sitemap_xml->setElement('loc', htmlspecialchars($input['url']), false, false); $this->_sitemap_xml->setElement('lastmod', $updated, false, false); $this->_sitemap_xml->endElement(); }
/** * 循环生成xml节点 * * @param handle $doc xml实例句柄 * @param handle $top 当前父节点 * @param array $info_arr 需要解析的数组 * @param boolean $have_item 是否是数据数组,是则需要在每条数据上加item父节点 * */ function create_tree($doc, $top, $info_arr, $have_item = false) { if (is_array($info_arr)) { foreach ($info_arr as $key => $val) { if (is_array($val)) { if ($have_item == false) { $data_info = $doc->createElement('data_info'); $top->appendChild($data_info); create_tree($doc, $data_info, $val, true); } else { $item = $doc->createElement('item'); $top->appendChild($item); $key_code = $doc->createAttribute('key'); $item->appendChild($key_code); $key_code->appendChild($doc->createTextNode($key)); create_tree($doc, $item, $val); } } else { $text_code = $doc->createElement($key); $top->appendChild($text_code); if (is_string($val)) { $text_code->appendChild($doc->createCDATASection($val)); } else { $text_code->appendChild($doc->createTextNode($val)); } } } } else { $top->appendChild($doc->createCDATASection($info_arr)); } }
public function dosome(handle $handle, $a, $b) { return $handle->action($a, $b); }
/** * Construct the WHERE part of the sophisticated keyword search * * @param handle $dbh Database handle * @param boolean $namedesc Search name and description fields * * @return string WHERE part of the SQL clause */ function construct_keyword_search($dbh, $namedesc) { $count = 0; $where_part = ""; $q_keywords = ""; $op = ""; foreach (str_getcsv($_GET['K'], ' ') as $term) { if ($term == "") { continue; } if ($count > 0 && strtolower($term) == "and") { $op = "AND "; continue; } if ($count > 0 && strtolower($term) == "or") { $op = "OR "; continue; } if ($count > 0 && strtolower($term) == "not") { $op .= "NOT "; continue; } $term = "%" . addcslashes($term, '%_') . "%"; $q_keywords .= $op . " ("; if ($namedesc) { $q_keywords .= "Packages.Name LIKE " . $dbh->quote($term) . " OR "; $q_keywords .= "Description LIKE " . $dbh->quote($term) . " OR "; } $q_keywords .= "EXISTS (SELECT * FROM PackageKeywords WHERE "; $q_keywords .= "PackageKeywords.PackageBaseID = Packages.PackageBaseID AND "; $q_keywords .= "PackageKeywords.Keyword LIKE " . $dbh->quote($term) . ")) "; $count++; if ($count >= 20) { break; } $op = "AND "; } if (!empty($q_keywords)) { $where_part = "AND (" . $q_keywords . ") "; } return $where_part; }
/** @brief Sorts the user result into this object data structure. @param handle $Result The result from sthe user Query @retval boolean/string Returns the retval of the called function, and an error message on failure. */ private function FetchUserResult($Result) { // resultat holen $Row = $Result->fetchRow(); //echo "<pre>"; var_dump($Row); echo "</pre>"; $this->UserId = $Row['user_id']; $this->GroupId = $Row['group_id']; $this->GroupIds = $Row['groups_id']; $this->Active = $Row['active']; $this->UserName = $Row['username']; $this->Password = $Row['password']; $this->RememberKey = $Row['remember_key']; $this->LastReset = $Row['last_reset']; $this->DisplayName = $Row['display_name']; $this->Email = $Row['email']; $this->TimeZone = $Row['timezone']; $this->DateFormat = $Row['date_format']; $this->TimeFormat = $Row['time_format']; $this->Language = $Row['language']; $this->HomeFolder = $Row['home_folder']; $this->LoginWhen = $Row['login_when']; $this->LoginIp = $Row['login_ip']; return false; }