本文整理汇总了PHP中article类的典型用法代码示例。如果您正苦于以下问题:PHP article类的具体用法?PHP article怎么用?PHP article使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了article类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module_sheet
function module_sheet()
{
global $global, $smarty;
$cat = get_global('cat');
$page = get_global('page');
$prefix = 'data/mod-sheet';
if ($cat) {
$prefix = $prefix . '/cat-' . $cat;
}
$url = S_SERVER_URL . '?/data/cat-' . $cat . '/page-' . $page . '/index.html';
$str = file_get_contents($url);
$result = json_decode(rawurldecode($str), true);
if (is_array($result)) {
$server_cat_list = $result['cat_list'];
$sheet = $result['sheet'];
for ($i = 0; $i < count($sheet); $i++) {
$obj = new article();
$obj->set_where("art_title = '" . $sheet[$i]['art_title'] . "'");
if ($obj->get_count()) {
$sheet[$i]['is_exist'] = 1;
} else {
$sheet[$i]['is_exist'] = 0;
}
}
$smarty->assign('page_sum', $result['page_sum']);
$smarty->assign('prefix', $prefix);
} else {
$server_cat_list = array();
$sheet = array();
}
$smarty->assign('article', $sheet);
$cat_list = get_local_cat();
if (count($cat_list) < count($server_cat_list)) {
for ($i = 0; $i < count($server_cat_list); $i++) {
$flag = false;
for ($j = 0; $j < count($cat_list); $j++) {
if ($server_cat_list[$i]['cat_id'] == $cat_list[$j]['server_id']) {
$flag = true;
if ($server_cat_list[$i]['cat_name'] != $cat_list[$j]['server_name']) {
$val = $server_cat_list[$i]['cat_id'] . '|' . $server_cat_list[$i]['cat_name'] . '|' . $cat_list[$i]['channel_id'] . '|' . $cat_list[$i]['cat_id'];
$obj = new varia();
$obj->set_value('var_value', $val);
$obj->set_where('var_id = ' . $cat_list[$i]['varia_id']);
$obj->edit();
}
break;
}
}
if (!$flag) {
$val = $server_cat_list[$i]['cat_id'] . '|' . $server_cat_list[$i]['cat_name'] . '|0|0';
$obj = new varia();
$obj->set_value('var_name', 'data_cat');
$obj->set_value('var_value', $val);
$obj->add();
}
}
$cat_list = get_local_cat();
}
$smarty->assign('cat_list', $cat_list);
}
示例2: rex_generateArticle
function rex_generateArticle($id, $refresh = 0)
{
global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
// artikel generieren
// vorraussetzung: articel steht schon in der datenbank
//
// -> infos schreiben -> abhaengig von clang
// --> artikel infos / einzelartikel metadaten
// --> artikel content / einzelartikel content
// --> listen generieren // wenn startpage = 1
// ---> artikel liste
// ---> category liste
// --> cache loeschen
// --------------------------------------------------- generiere generated/articles/xx.article
$CL = $REX[CLANG];
reset($CL);
for ($i = 0; $i < count($CL); $i++) {
$clang = key($CL);
$REX[RC] = true;
// keine Ausgabe als eval(CONTENT) sondern nur speichern in datei
$CONT = new article();
$CONT->setCLang($clang);
$CONT->setArticleId($id);
$article_content = "?>" . $CONT->getArticle();
// --------------------------------------------------- Artikelparameter speichern
$article = "<?\n" . "\n\$REX[ART][{$id}][article_id][{$clang}] = \"{$id}\";" . "\n\$REX[ART][{$id}][re_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX[ART][{$id}][name][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][catname][{$clang}] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX[ART][{$id}][cattype][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][alias][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][description][{$clang}] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX[ART][{$id}][attribute][{$clang}] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX[ART][{$id}][file][{$clang}] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX[ART][{$id}][type_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX[ART][{$id}][teaser][{$clang}] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX[ART][{$id}][startpage][{$clang}] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX[ART][{$id}][prior][{$clang}] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX[ART][{$id}][path][{$clang}] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX[ART][{$id}][status][{$clang}] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX[ART][{$id}][online_from][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX[ART][{$id}][online_to][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX[ART][{$id}][createdate][{$clang}] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX[ART][{$id}][updatedate][{$clang}] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX[ART][{$id}][keywords][{$clang}] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX[ART][{$id}][template_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX[ART][{$id}][createuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX[ART][{$id}][updateuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX[ART][{$id}][last_update_stamp][{$clang}] = \"" . time() . "\";" . "\n?>";
if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", "w")) {
fputs($fp, $article);
fclose($fp);
@chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", 0777);
} else {
$MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
}
// --------------------------------------------------- Artikelcontent speichern
if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", "w")) {
fputs($fp, $article_content);
fclose($fp);
@chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", 0777);
} else {
$MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
}
if ($MSG != "") {
echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>";
}
$REX[RC] = false;
// --------------------------------------------------- Listen generieren
if ($CONT->getValue("startpage") == 1) {
rex_generateLists($id);
rex_generateLists($CONT->getValue("re_id"));
} else {
rex_generateLists($CONT->getValue("re_id"));
}
next($CL);
}
// --------------------------------------------------- recache all
$Cache = new Cache();
$Cache->removeAllCacheFiles();
}
示例3: get_champs
public function get_champs()
{
$obj_article = new article("champ");
$obj_article->fields = "id,titre,filtre1";
$result = $obj_article->query();
foreach ($result as $row) {
$this->list_champs[$row["id"]] = $row["titre"];
if ($row["filtre1"] == "1") {
$this->list_champ_crypte[] = $row["id"];
}
}
}
示例4: req_article
public function req_article($name)
{
$obj_article = new article($name);
$obj_article->fields = "id,titre";
$obj_article->orderby = "titre ASC";
if (isset($this->id)) {
$obj_article->where = "id=" . $this->id;
} else {
$obj_article->limit = "1";
}
$this->result = $obj_article->query();
}
示例5: module_new_article
function module_new_article()
{
global $smarty;
$obj = new article();
$obj->set_field('art_id,art_channel_id,art_title,art_add_time');
$obj->set_page_size(10);
$list = $obj->get_list();
for ($i = 0; $i < count($list); $i++) {
$list[$i]['channel'] = get_data('channel', $list[$i]['art_channel_id'], 'cha_code');
$list[$i]['short_title'] = cut_str($list[$i]['art_title'], 16);
}
$smarty->assign('new_article', $list);
}
示例6: module_tailor_sheet
function module_tailor_sheet()
{
global $global, $smarty;
$obj = new varia();
$obj->set_where("var_name = 'tailor_data_cat'");
$list = $obj->get_list();
if (count($list)) {
for ($i = 0; $i < count($list); $i++) {
$arr = explode('|', $list[$i]['var_value']);
$cat_list[$i]['server_id'] = $arr[0];
$cat_list[$i]['server_name'] = $arr[1];
}
} else {
$cat_list = array();
}
$smarty->assign('cat_list', $cat_list);
$data_username = rawurlencode(get_varia('data_username'));
$data_password = rawurlencode(get_varia('data_password'));
$cat = get_global('cat');
$page = get_global('page');
$prefix = 'data/mod-tailor_sheet';
$page_sum = 1;
$sheet = array();
if ($cat) {
$prefix = $prefix . '/cat-' . $cat;
}
$url = S_SERVER_URL . 'tailor.php?/tailor/cat-' . $cat . '/page-' . $page . '/data_username-' . $data_username . '/data_password-' . $data_password . '/index.html';
$str = file_get_contents($url);
$result = json_decode(rawurldecode($str), true);
if (is_array($result)) {
if ($result['error'] == 'no') {
$sheet = $result['sheet'];
for ($i = 0; $i < count($sheet); $i++) {
$obj = new article();
$obj->set_where("art_title = '" . $sheet[$i]['art_title'] . "'");
if ($obj->get_count()) {
$sheet[$i]['is_exist'] = 1;
} else {
$sheet[$i]['is_exist'] = 0;
}
}
$page_sum = $result['page_sum'];
}
}
$smarty->assign('page_sum', $page_sum);
$smarty->assign('prefix', $prefix);
$smarty->assign('article', $sheet);
}
示例7: actionSystemmain
/**
* 后台主页信息
*/
public function actionSystemmain()
{
$SYS = array('PHP版本:' => $_SERVER['SERVER_SOFTWARE'], '当前系统类型:' => php_uname('s'), 'PHP运行方式:' => php_sapi_name(), '服务器域名:' => $_SERVER['SERVER_NAME'], '服务器端口:' => $_SERVER['SERVER_PORT'], '北京时间:' => date('Y年m月d日 H:i:s', time()));
$count = array('会员总数:' => Account::model()->count('id!=:ID', array(':ID' => 0)), '文章总数:' => article::model()->count('id!=:ID', array(':ID' => 0)), '评论总数:' => Comments::model()->count('id!=:ID', array(':ID' => 0)));
$Role = Role::model()->find('id=:ID', array(':ID' => Yii::app()->session['USER_ACCOUNT']['roleId']));
$basic = array('权限级别:' => $Role->name);
$this->render('Systemmain', array('SYS' => $SYS, 'Info' => $count, 'basic' => $basic));
}
示例8: getTexte
function getTexte($id)
{
global $thisSite;
// $mySelect = new mySelect(__FILE__);
// $mySelect->tables=$thisSite->PREFIXE_TBL_GEN . "textes";
// $mySelect->fields="texte";
// $mySelect->where="id=:id AND lg=:lg";
// $mySelect->whereValue["id"]=array($id,PDO::PARAM_STR);
// $mySelect->whereValue["lg"]=array($thisSite->current_lang,PDO::PARAM_STR);
// $result=$mySelect->query();
// $row = current($result);
// return stripslashes($row["texte"]);
$obj_article = new article("textes");
$obj_article->where = "id=" . $id . " AND lg='" . $thisSite->current_lang . "'";
$result = $obj_article->query();
$row = current($result);
return $row;
}
示例9: module_edit
function module_edit()
{
global $global, $smarty;
$obj = new article();
$obj->set_where('art_id = ' . $global['id']);
$one = $obj->get_one();
$smarty->assign('article', $one);
$smarty->assign('editor_text', $one['art_text']);
$list = array();
$obj = new cat_art();
$obj->set_where('cat_channel_id = ' . $global['channel_id']);
$arr = $obj->get_list();
if (count($arr) > 0) {
$list = $obj->set_cat_order($arr);
}
$smarty->assign('cat_list', $list);
$smarty->assign('upl_date', date('Ymd'));
}
示例10: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$article = article::findorfail($id);
$tags = $article->gettags;
$tagName = null;
foreach ($tags as $tag) {
$tagName .= $tag->name . ',';
}
return view('articles.edit', compact('article', 'tagName'));
}
示例11: checkEditPermissions
/**
* Führt Prüfung durch, ob Artikel bearbeitet werden kann
* @param \fpcm\model\articles\article $article
* @return boolean
*/
public function checkEditPermissions(article &$article)
{
if ($this->permissions === false) {
return true;
}
$isAdmin = \fpcm\classes\baseconfig::$fpcmSession->getCurrentUser()->isAdmin();
$permEditAll = $this->permissions->check(array('article' => 'editall'));
$permEditOwn = $this->permissions->check(array('article' => 'edit'));
if ($isAdmin || $permEditAll) {
$article->setEditPermission(true);
return true;
}
if (!$isAdmin && !$permEditAll && $permEditOwn && $article->getCreateuser() == \fpcm\classes\baseconfig::$fpcmSession->getUserId()) {
$article->setEditPermission(true);
return true;
}
$article->setEditPermission(false);
return true;
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(User $user)
{
$article = article::with('ArticleCategories')->where('user_id', $user->id)->get();
$checkArticle = $article->isEmpty();
//dd($article);
if (\Auth::check()) {
$url = str_contains($this->checkloginpage($user->name), \Auth::user()->name);
} else {
$url = false;
}
return view('userArticle.index', compact('user', 'article', 'url', 'checkArticle'));
}
示例13: module_article_list
function module_article_list()
{
global $smarty;
$obj = new cat_art();
$obj->set_where('cat_best = 1');
$best_cat = $obj->get_list();
$art_list = array();
if (count($best_cat) > 0) {
$smarty->assign('show_all_art', 0);
$list_len = get_varia('index_art_list_len');
for ($i = 0; $i < count($best_cat); $i++) {
$cat_id = $best_cat[$i]['cat_id'];
$best_cat[$i]['channel'] = get_data('channel', $best_cat[$i]['cat_channel_id'], 'cha_code');
$family = implode(',', get_cat_family('cat_art', $cat_id));
$obj = new article();
$obj->set_field('art_id,art_title,art_add_time');
$obj->set_where("art_cat_id in ({$family})");
$obj->set_page_size($list_len ? $list_len : 5);
$list = $obj->get_list();
for ($j = 0; $j < count($list); $j++) {
$list[$j]['short_title'] = cut_str($list[$j]['art_title'], 22);
}
$art_list[$cat_id] = $list;
unset($obj);
}
$smarty->assign('best_art_cat', $best_cat);
$smarty->assign('art_list', $art_list);
} else {
$smarty->assign('show_all_art', 1);
}
}
示例14: module_search_main
function module_search_main()
{
global $global, $smarty;
$global['key'] = url_decode($global['key']);
$list_len = get_varia('art_list_len');
$obj = new article();
$obj->set_field('art_id,art_channel_id,art_title,art_add_time');
$obj->set_where("art_title like '%" . $global['key'] . "%'");
$obj->set_page_size($list_len ? $list_len : 20);
$obj->set_page_num($global['page']);
$sheet = $obj->get_sheet();
for ($i = 0; $i < count($sheet); $i++) {
$sheet[$i]['channel'] = get_data('channel', $sheet[$i]['art_channel_id'], 'cha_code');
$sheet[$i]['short_title'] = cut_str($sheet[$i]['art_title'], 42);
}
set_link($obj->get_page_sum());
$smarty->assign('search', $sheet);
}
示例15: addPage
function addPage()
{
system::setParam("page", "addPage");
article::getAllCats();
$fill = array();
$doRedirect = false;
if (!empty($_POST["slug"])) {
$fill["slug"] = core::generateSlug($_POST["slug"]);
} else {
if (!empty($_POST["title"])) {
$fill["slug"] = core::generateSlug($_POST["title"]);
}
}
$fill += $_POST;
if (isset($_POST["picRealUpload"])) {
$uploadedPics = blog::uploadOnePicture($fill["slug"]);
}
$fill["poster"] = "";
if (isset($_FILES["poster"]) && $_FILES["poster"]["error"] == 0) {
$uploadedPics = blog::uploadOnePicture($fill["slug"], "articleImages");
if (isset($uploadedPics["poster"]) && $uploadedPics["poster"]) {
$fill["poster"] = serialize($uploadedPics["poster"]);
}
}
if (isset($_POST["savePost"])) {
$savedPost = blog::writePost($fill, "article");
if ($savedPost) {
$doRedirect = true;
}
}
blog::showAttachedPics($fill);
$this->smarty->assign("fill", $fill);
if ($doRedirect) {
system::redirect(system::param("urlBase") . "listPage");
}
}