public static function cache() { Tool::logger(__METHOD__, __LINE__, "Cache content data", _LOG_INFOR); $query = new DocFile(_QUERY_ALL); $query->inModule = "company"; self::$cache = self::query($query); }
public static function files($fileKey) { try { if (empty($fileKey)) { throw new Exception("fileKey为空"); } $query = new DocFile(_QUERY_ALL); $query->fileKey = $fileKey; $query->inModule = "company"; return DocFile::query($query); } catch (Exception $e) { throw $e; } }
$cusNavCount = 0; //自定义导航栏个数 if (!empty($brands)) { $cusNavCount = count($brands); foreach ($brands as $brand) { $navHtml .= sprintf("\n <span class='n_menu'>\n\t\t\t\t\t<a title='%s' target='_blank' style='width: 105px;' href='%s'>%s</a>\n </span>\n\t\t\t\t", $brand->subject, $brand->content, $brand->subject); $proMapHtml .= sprintf("<li><a target='_blank' href='%s'>%s</a></li>", $brand->content, $brand->subject); } } ?> <?php //二维码 if (empty($barcode)) { $files = Company::files("company_barcode"); $barcode = empty($files) ? DocFile::noimg() : $files[0]; } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--header start--> <div id="header_box"> <!--欢迎_分享连接 开始--> <div class="header_top"> <div class="welcome f_left"><?php echo Company::content("site_notice", false); ?> </div> <div class=" share_btn f_right"> <a href="javascript:void(0);" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href));return false;" title="分享到QQ空间"> <img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/app_share/qz_logo.png" alt="分享到QQ空间" />
/** * Send a real live email reminder * * @todo This would probably be better as two or more sep functions * * @param string $type type of reminder * @param mixed $object Confirm_address or Invitation object * @param string $subject subjct of the email reminder * @param string $title title of the email reminder * @return boolean true if the email subsystem doesn't explode */ static function sendReminderEmail($type, $object, $subject, $title = null) { $sitename = common_config('site', 'name'); $recipients = array($object->address); $inviter = null; $inviterurl = null; if ($type == UserInviteReminderHandler::INVITE_REMINDER) { $user = User::getKV($object->user_id); if (!empty($user)) { $profile = $user->getProfile(); $inviter = $profile->getBestName(); $inviterUrl = $profile->profileurl; } } $headers['From'] = mail_notify_from(); $headers['To'] = trim($object->address); // TRANS: Subject for confirmation e-mail. // TRANS: %s is the StatusNet sitename. $headers['Subject'] = $subject; $headers['Content-Type'] = 'text/html; charset=UTF-8'; $confirmUrl = common_local_url('register', array('code' => $object->code)); $template = DocFile::forTitle($title, DocFile::mailPaths()); $blankfillers = array('confirmurl' => $confirmUrl); if ($type == UserInviteReminderHandler::INVITE_REMINDER) { $blankfillers['inviter'] = $inviter; $blankfillers['inviterurl'] = $inviterUrl; // @todo private invitation message? } $body = $template->toHTML($blankfillers); return mail_send($recipients, $headers, $body); }
function loadDoc() { if (Event::handle('StartLoadDoc', array(&$this->title, &$this->output))) { $paths = DocFile::defaultPaths(); $docfile = DocFile::forTitle($this->title, $paths); if (empty($docfile)) { // TRANS: Client exception thrown when requesting a document from the documentation that does not exist. // TRANS: %s is the non-existing document. throw new ClientException(sprintf(_('No such document "%s".'), $this->title), 404); } $this->output = $docfile->toHTML(); Event::handle('EndLoadDoc', array($this->title, &$this->output)); } }
function filesDelete() { $pid = isset($_GET['pid']) ? addslashes($_GET['pid']) : 0; if ($pid == 0) { die('No ID'); } $car = new DocFile(); $car->delete($pid); $gw = new GalleryWeb(); //delete di server unlink($gw->uploadDir . $car->file_filename); //unlink($gw->uploadDirThumb.$car->file_filename); }
<?php $bannerHtml = ""; $bannerBtn = ""; $query = new DocFile(_QUERY_ALL); $query->fileKey = $showHomeBanner ? "company_banner" : "company_banner2"; $query->inModule = "company"; $banners = DocFile::query($query); if (empty($banners)) { $banner = new DocFile(_NONE); $banner->savedPath = "images/banner.png"; $banners = array($banner); } if ($showHomeBanner) { //首页Banner foreach ($banners as $i => $banner) { $bannerHtml .= sprintf("<li class='%s'><a href='%s'><img src='%s' alt='%s' class='home_banner_img'></a></li>", $bannerHtml == "" ? "" : "hidden", empty($banner->fileUrl) ? "index.php" : $banner->fileUrl, str_replace("../", "", $banner->savedPath), empty($banner->fileDesc) ? Company::content("site_desc", false) : $banner->fileDesc); $bannerBtn .= sprintf("<li %s>%u</li>", $i == 0 ? "class='selected'" : "", $i + 1); } $bannerHtml = sprintf("<ul>%s</ul>", $bannerHtml); $bannerBtn = sprintf("<ul>%s</ul>", $bannerBtn); } else { //内页Banner $banner = $banners[0]; $bannerHtml = sprintf("<a href='%s'><img src='%s' alt='%s' class='inner_banner_img'></a>", empty($banner->fileUrl) ? "index.php" : $banner->fileUrl, str_replace("../", "", $banner->savedPath), empty($banner->fileDesc) ? Company::content("site_desc", false) : $banner->fileDesc); } $hot_search = ""; $query = new Company(_QUERY_ALL); $query->companyKey = "hot_search"; $hots = Company::query($query); if (!empty($hots)) {
if (!empty($data)) { foreach ($data as $file) { if (is_file("../" . $file->savedPath)) { @unlink("../" . $file->savedPath); } DocFile::delete($file); } } } $docFile->showedName = $oldName; $docFile->extName = $extName; $docFile->savedPath = $upload_dir . $fileName; $docFile->fileDesc = $fileDesc; $docFile->fileUrl = $fileUrl; $docFile->fileSort = $fileSort; DocFile::insert($docFile); $result = $upload_dir . $fileName; //上传成功 Tool::logger(__METHOD__, __LINE__, sprintf("上传文档[%s]成功", $result), _LOG_INFOR); } } catch (Exception $e) { Tool::logger(__METHOD__, __LINE__, sprintf("上传文档失败:%s", $e->{$getMessage}()), _LOG_ERROR); } } else { $is_upload = false; $result = "文件上传失败"; Tool::logger(__METHOD__, __LINE__, "文件上传失败", _LOG_ERROR); } } } if (empty($formId)) {
<!-- bottom start --> <?php /*require_once("Util.php"); require_once("../admin/include/common.php"); //静态化 if(is_file("foot.html") && !isset($_GET["sp"])){ //存在静态页面,并且不是执行静态化处理 //header("Location: foot.html"); require_once("../head.html"); exit; }*/ //读取友情连接 $links = DocFile::get("company_links"); $linkTemp = "<p><a href=\"%s\" title=\"%s\"><img src=\"%s\" width=\"88\" height=\"31\" alt=\"%s\" /></a></p>"; $linkStr = ""; if (!empty($links)) { foreach ($links as $link) { $linkStr .= sprintf($linkTemp, $link->fileUrl, $link->fileDesc, str_replace("../", "", $link->savedPath), $link->fileDesc); } } //联系方式 $contacts = sprintf("<p>电话:%s</p><p>传真:%s</p><p>手机:%s</p><p>联系人:%s</p><p>Q Q:%s</p><p>旺旺:%s</p><p>邮箱:%s</p><p>官网:%s</p><p>旺铺:%s</p><p>地址:%s</p><p>%s</p>", Company::content("company_phone"), Company::content("company_fax"), Company::content("mobile_phone"), Company::content("contact_person"), Company::content("company_qq"), Company::content("ali_wangwang"), Company::content("company_email"), Company::content("official_site"), Company::content("ali_store"), Company::content("company_addr"), Company::content("other_contact")); //读取常见问题 $pro_problems = ""; $query = new Company(_QUERY_ALL); $query->companyKey = "product_problem"; $problems = Company::query($query); if (!empty($problems)) { foreach ($problems as $problem) { $pro_problems .= sprintf("<li><a target='_blank' href='%s' title='%s'>%s</a></li>", $problem->content, $problem->subject, $problem->subject); }
function sendInvitation($email, $user, $personal) { $profile = $user->getProfile(); $bestname = $profile->getBestName(); $sitename = common_config('site', 'name'); $invite = new Invitation(); $invite->address = $email; $invite->address_type = 'email'; $invite->code = common_confirmation_code(128); $invite->user_id = $user->id; $invite->created = common_sql_now(); if (!$invite->insert()) { common_log_db_error($invite, 'INSERT', __FILE__); return false; } $confirmUrl = common_local_url('register', array('code' => $invite->code)); $recipients = array($email); $headers['From'] = mail_notify_from(); $headers['To'] = trim($email); $headers['Content-Type'] = 'text/html; charset=UTF-8'; // TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral // TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is // TRANS: the StatusNet sitename. $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); $title = empty($personal) ? 'invite' : 'invitepersonal'; // @todo FIXME: i18n issue. $inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths()); $body = $inviteTemplate->toHTML(array('inviter' => $bestname, 'inviterurl' => $profile->profileurl, 'confirmurl' => $confirmUrl, 'personal' => $personal)); common_debug('Confirm URL is ' . common_local_url('register', array('code' => $invite->code))); mail_send($recipients, $headers, $body); }
static function sendConfirmEmail($confirm, $title = null) { $sitename = common_config('site', 'name'); $recipients = array($confirm->address); $headers['From'] = mail_notify_from(); $headers['To'] = trim($confirm->address); // TRANS: Subject for confirmation e-mail. // TRANS: %s is the StatusNet sitename. $headers['Subject'] = sprintf(_m('Welcome to %s'), $sitename); $headers['Content-Type'] = 'text/html; charset=UTF-8'; $confirmUrl = common_local_url('register', array('code' => $confirm->code)); if (empty($title)) { $title = 'confirmemailreg'; } $confirmTemplate = DocFile::forTitle($title, DocFile::mailPaths()); $body = $confirmTemplate->toHTML(array('confirmurl' => $confirmUrl)); mail_send($recipients, $headers, $body); }
$content->content = isset($_REQUEST["content"]) ? $_REQUEST["content"] : $content->content; $content->mImage = isset($_REQUEST["mImage"]) ? $_REQUEST["mImage"] : $content->mImage; $content->contentType = $module; $content->contentKey = $module; if ($action == "insert") { $newId = Content::insert2($content); } else { if ($action == "update") { Content::update2($content); } else { if ($action == "delete") { Content::delete2($content); $docFile = new DocFile(_NONE); if (!empty($content->mImage)) { $docFile->fileUrl = $content->mImage; DocFile::delete($docFile); } } } } } catch (Exception $e) { $result = $e->getMessage(); Tool::logger(__METHOD__, __LINE__, sprintf("数据保存失败: %s", $e->getMessage()), _LOG_ERROR); } } else { if ($dataType == "detail" && $module == "sort") { try { Tool::logger(__METHOD__, __LINE__, sprintf("action: %s", $action), _LOG_DEBUG); $sort = new Sort(_NONE); $sort->sortId = isset($_REQUEST["sortId"]) ? $_REQUEST["sortId"] : _NONE; if ($sort->sortId > 0) {
$query->fileKey = $fileKey; if (!empty($savedPath)) { $query->savedPath = $savedPath; } $query->isPaging = $isPaging; $query->curPage = $curPage; $listJson = "[]"; if ($dataType == "file") { $data = DocFile::query($query); if (!empty($data)) { $listJson = json_encode($data, JSON_UNESCAPED_UNICODE); } Tool::logger(__METHOD__, __LINE__, sprintf("查询文件Json: %s", $listJson), _LOG_INFOR); } else { if ($dataType == "file_count") { $listJson = DocFile::rcount($query); Tool::logger(__METHOD__, __LINE__, sprintf("查询文件总数: %s", $listJson), _LOG_INFOR); } } echo "{\"status\":\"true\", \"data\": " . $listJson . "}"; } catch (Exception $e) { echo "{\"status\":\"false\", \"data\": \"" . $e->getMessage() . "\"}"; Tool::logger(__METHOD__, __LINE__, sprintf("数据查询失败: %s", $e->getMessage()), _LOG_ERROR); } exit; } //用户 if ($module == "user") { $user = new User(_NONE); if ($dataType == "login") { $loginName = isset($_REQUEST["loginName"]) ? $_REQUEST["loginName"] : "";