當前位置: 首頁>>代碼示例>>PHP>>正文


PHP refresh_index函數代碼示例

本文整理匯總了PHP中refresh_index函數的典型用法代碼示例。如果您正苦於以下問題:PHP refresh_index函數的具體用法?PHP refresh_index怎麽用?PHP refresh_index使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了refresh_index函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wikiplugin_addfreetag

function wikiplugin_addfreetag($data, $params)
{
	global $user;
	$object = current_object();

	if (isset($params['object']) && false !== strpos($params['object'], ':')) {
		list($object['type'], $object['object']) = explode(':', $params['object'], 2);
	}
	if ($object['type'] == 'wiki page' && !ctype_digit($object['object'])) {
		$identifier = 'wp_addfreetag_' . str_replace(array(':',' '), array('_',''), TikiLib::lib('tiki')->get_page_id_from_name($params['object']));
	} else {
		$identifier = 'wp_addfreetag_' . str_replace(array(':',' '), array('_',''), $params['object']);
	}

	if ($object['type'] == 'trackeritem') {
		$permobject = TikiLib::lib('trk')->get_tracker_for_item($object['object']);
		$permobjecttype = 'tracker';
	} else {
		$permobject = $object['object'];
		$permobjecttype = $object['type'];
	}
	if (! TikiLib::lib('tiki')->user_has_perm_on_object($user, $permobject, $permobjecttype, 'tiki_p_freetags_tag')) {
		return '';
	}
	if (!empty($_POST[$identifier])) {
		$_POST[$identifier] = '"' . str_replace('"', '', $_POST[$identifier]) . '"';
		TikiLib::lib('freetag')->tag_object($user, $object['object'], $object['type'], $_POST[$identifier]);
		if ($object['type'] == 'trackeritem') {
			// need to update tracker field as well
			$definition = Tracker_Definition::get($permobject);
			if ($field = $definition->getFreetagField()) {
				$currenttags = TikiLib::lib('freetag')->get_tags_on_object($object['object'], 'trackeritem');
				$taglist = '';	
				foreach ($currenttags['data'] as $tag) {
					if (strstr($tag['tag'], ' ')) {
						$taglist .= '"'.$tag['tag'] . '" ';
					} else {
						$taglist .= $tag['tag'] . ' ';
					}
				}
				// taglist will have slashes
				TikiLib::lib('trk')->modify_field($object['object'], $field, stripslashes($taglist));
			}
		} 
		require_once 'lib/search/refresh-functions.php';
		refresh_index($object['type'], $object['object']);
		$url = $_SERVER['REQUEST_URI'];
		header("Location: $url");
		die;
	}

	$smarty = TikiLib::lib('smarty');
	$smarty->assign('wp_addfreetag', $identifier); 
	return $smarty->fetch('wiki-plugins/wikiplugin_addfreetag.tpl');
}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:55,代碼來源:wikiplugin_addfreetag.php

示例2: flag_revision

 function flag_revision($pageName, $version, $flag, $value)
 {
     global $prefs;
     $attributelib = TikiLib::lib('attribute');
     $histlib = TikiLib::lib('hist');
     if ($version_info = $histlib->get_version($pageName, $version)) {
         $tx = TikiDb::get()->begin();
         if ($prefs['feature_actionlog'] == 'y') {
             $logslib = TikiLib::lib('logs');
             $logslib->add_action(self::ACTION, $pageName, 'wiki page', "flag={$flag}&version={$version}&value={$value}");
         }
         $attribute = $this->get_attribute_for_flag($flag);
         $attributelib->set_attribute('wiki history', $version_info['historyId'], $attribute, $value);
         require_once 'lib/search/refresh-functions.php';
         refresh_index('pages', $pageName);
         refresh_index('pages', "{$pageName}~~latest");
         $tx->commit();
         return true;
     } else {
         return false;
     }
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:22,代碼來源:flaggedrevisionlib.php

示例3: replace_tracker

 public function replace_tracker($trackerId, $name, $description, $options, $descriptionIsParsed)
 {
     $trackers = $this->trackers();
     $data = array('name' => $name, 'description' => $description, 'descriptionIsParsed' => $descriptionIsParsed, 'lastModif' => $this->now);
     $logOption = 'Updated';
     if ($trackerId) {
         $conditions = array('trackerId' => (int) $trackerId);
         if ($trackers->fetchCount($conditions)) {
             $trackers->update($data, $conditions);
         } else {
             $data['trackerId'] = (int) $trackerId;
             $data['items'] = 0;
             $data['created'] = $this->now;
             $trackers->insert($data);
             $logOption = 'Created';
         }
     } else {
         $data['created'] = $this->now;
         $trackerId = $trackers->insert($data);
     }
     $optionTable = $this->options();
     $optionTable->deleteMultiple(array('trackerId' => (int) $trackerId));
     foreach ($options as $kopt => $opt) {
         $this->replace_tracker_option((int) $trackerId, $kopt, $opt);
     }
     $definition = Tracker_Definition::get($trackerId);
     $ratingId = $definition->getRateField();
     if (isset($options['useRatings']) && $options['useRatings'] == 'y') {
         if (!$ratingId) {
             $ratingId = 0;
         }
         $ratingoptions = isset($options['ratingOptions']) ? $options['ratingOptions'] : '';
         $showratings = isset($options['showRatings']) ? $options['showRatings'] : 'n';
         $this->replace_tracker_field($trackerId, $ratingId, 'Rating', 's', '-', '-', $showratings, 'y', 'n', '-', 0, $ratingoptions);
     }
     $this->clear_tracker_cache($trackerId);
     $this->update_tracker_summary(array('trackerId' => $trackerId));
     if ($logOption) {
         $logslib = TikiLib::lib('logs');
         $logslib->add_action($logOption, $trackerId, 'tracker', array('name' => $data['name']));
     }
     require_once 'lib/search/refresh-functions.php';
     refresh_index('trackers', $trackerId);
     if ($descriptionIsParsed == 'y') {
         $tikilib = TikiLib::lib('tiki');
         $tikilib->object_post_save(array('type' => 'tracker', 'object' => $trackerId, 'href' => "tiki-view_tracker.php?trackerId={$trackerId}", 'description' => $description), array('content' => $description));
     }
     return $trackerId;
 }
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:49,代碼來源:trackerlib.php

示例4: refresh_index_wiki

/**
 * @param $page
 */
function refresh_index_wiki($page)
{
    refresh_index('pages', $page);
}
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:7,代碼來源:refresh-functions.php

示例5: dir_replace_category

 /**
  * @param $parent
  * @param $categId
  * @param $name
  * @param $description
  * @param $childrenType
  * @param $viewableChildren
  * @param $allowSites
  * @param $showCount
  * @param $editorGroup
  * @return mixed
  */
 function dir_replace_category($parent, $categId, $name, $description, $childrenType, $viewableChildren, $allowSites, $showCount, $editorGroup)
 {
     if ($categId) {
         $query = "update `tiki_directory_categories` set `name`=?, `parent`=?, `description`=?, `childrenType`=?, `viewableChildren`=?, `allowSites`=?, `showCount`=?, `editorGroup`=?  where `categId`=?";
         $this->query($query, array($name, (int) $parent, $description, $childrenType, (int) $viewableChildren, $allowSites, $showCount, $editorGroup, (int) $categId));
     } else {
         $query = "insert into `tiki_directory_categories`(`parent`,`hits`,`name`,`description`,`childrenType`,`viewableChildren`,`allowSites`,`showCount`,`editorGroup`,`sites`) values(?,?,?,?,?,?,?,?,?,?)";
         $this->query($query, array((int) $parent, 0, $name, $description, $childrenType, (int) $viewableChildren, $allowSites, $showCount, $editorGroup, 0));
         $categId = $this->getOne("select max(`categId`) from `tiki_directory_categories` where `name`=?", array($name));
     }
     require_once 'lib/search/refresh-functions.php';
     refresh_index('directory_categories', $categId);
     return $categId;
 }
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:26,代碼來源:dirlib.php

示例6: replace_gallery

 /**
  * @param $galleryId
  * @param $name
  * @param $description
  * @param $theme
  * @param $user
  * @param $maxRows
  * @param $rowImages
  * @param $thumbSizeX
  * @param $thumbSizeY
  * @param $public
  * @param string $visible
  * @param string $sortorder
  * @param string $sortdirection
  * @param string $galleryimage
  * @param $parentgallery
  * @param string $showname
  * @param string $showimageid
  * @param string $showdescription
  * @param string $showcreated
  * @param string $showuser
  * @param string $showhits
  * @param string $showxysize
  * @param string $showfilesize
  * @param string $showfilename
  * @param string $defaultscale
  * @param string $geographic
  * @param string $showcategories
  * @return mixed
  */
 function replace_gallery($galleryId, $name, $description, $theme, $user, $maxRows, $rowImages, $thumbSizeX, $thumbSizeY, $public, $visible = 'y', $sortorder = 'created', $sortdirection = 'desc', $galleryimage = 'first', $parentgallery = -1, $showname = 'y', $showimageid = 'n', $showdescription = 'n', $showcreated = 'n', $showuser = 'n', $showhits = 'y', $showxysize = 'y', $showfilesize = 'n', $showfilename = 'n', $defaultscale = 'o', $geographic = 'n', $showcategories = 'n')
 {
     global $prefs;
     // if the user is admin or the user is the same user and the gallery exists then replace if not then
     // create the gallary if the name is unused.
     $name = strip_tags($name);
     $description = strip_tags($description);
     // check if the gallery already exists. if yes: do update, if no: update it
     if ($galleryId < 1) {
         $galleryId = $this->getOne("select `galleryId` from `tiki_galleries` where `name`=? and `parentgallery`=?", array($name, $parentgallery));
     }
     if ($galleryId > 0) {
         $query = "update `tiki_galleries` set `name`=?,`visible`=?, `geographic`=?,`maxRows`=? , `rowImages`=?,\n\t\t\t\t\t\t\t`thumbSizeX`=?, `thumbSizeY`=?, `description`=?, `theme`=?,\n\t\t\t\t\t\t\t`lastModif`=?, `public`=?, `sortorder`=?, `sortdirection`=?, `galleryimage`=?,\n\t\t\t\t\t\t\t`parentgallery`=?,`showname`=?,`showimageid`=?,`showdescription`=?,`showcategories`=?,\n\t\t\t\t\t\t\t`showcreated`=?,`showuser`=?,`showhits`=?,`showxysize`=?,`showfilesize`=?,\n\t\t\t\t\t\t\t`showfilename`=?,`defaultscale`=?, `user`=?\n\t\t\t\t\t\t\t\twhere `galleryId`=?";
         $result = $this->query($query, array($name, $visible, $geographic, (int) $maxRows, (int) $rowImages, (int) $thumbSizeX, (int) $thumbSizeY, $description, $theme, (int) $this->now, $public, $sortorder, $sortdirection, $galleryimage, (int) $parentgallery, $showname, $showimageid, $showdescription, $showcategories, $showcreated, $showuser, $showhits, $showxysize, $showfilesize, $showfilename, $defaultscale, $user, (int) $galleryId));
     } else {
         // Create a new record
         $query = "insert into\n\t\t\t\t\t\t\t`tiki_galleries`(`name`,`description`,`theme`,`created`,`user`,`lastModif`,`maxRows`,`rowImages`,`thumbSizeX`,`thumbSizeY`,`public`,`hits`,`visible`,`sortorder`,`sortdirection`,`galleryimage`,`parentgallery`,`showname`,`showimageid`,`showdescription`,`showcategories`,`showcreated`,`showuser`,`showhits`,`showxysize`,`showfilesize`,`showfilename`,`defaultscale`,`geographic`)\n\t\t\t\t\t\t\tvalues (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
         $bindvars = array($name, $description, $theme, (int) $this->now, $user, (int) $this->now, (int) $maxRows, (int) $rowImages, (int) $thumbSizeX, (int) $thumbSizeY, $public, 0, $visible, $sortorder, $sortdirection, $galleryimage, (int) $parentgallery, $showname, $showimageid, $showdescription, $showcategories, $showcreated, $showuser, $showhits, $showxysize, $showfilesize, $showfilename, $defaultscale, $geographic);
         $result = $this->query($query, $bindvars);
         $galleryId = $this->getOne("select max(`galleryId`) from `tiki_galleries` where `name`=? and `created`=?", array($name, (int) $this->now));
         TikiLib::events()->trigger('tiki.imagegallery.create', array('type' => 'imagegallery', 'object' => $id, 'user' => $user));
     }
     require_once 'lib/search/refresh-functions.php';
     refresh_index('galleries', $galleryId);
     return $galleryId;
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:56,代碼來源:imagegallib.php

示例7: refresh_index

 /**
  * @param $type
  * @param $object
  * @param bool $process
  * @return bool
  */
 function refresh_index($type, $object, $process = true)
 {
     require_once 'lib/search/refresh-functions.php';
     return refresh_index($type, $object, $process);
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:11,代碼來源:tikilib.php

示例8: uncategorize_user_tracker_item

	private function uncategorize_user_tracker_item($user, $group)
	{
		global $tikilib;
		$userid = $this->get_user_id($user);
		$tracker = $this->get_usertracker($userid);

		if ( $tracker && $tracker['usersTrackerId'] ) {
			$trklib = TikiLib::lib('trk');
			$categlib = TikiLib::lib('categ');
			$itemid = $trklib->get_item_id($tracker['usersTrackerId'], $tracker['usersFieldId'], $user);
			$cat = $categlib->get_object_categories('trackeritem', $itemid);
			$categId = $categlib->get_category_id($group);
			if (!$categId) {
				return false;
			}
			$cat = array_diff($cat, array($categId));
			$trklib->categorized_item($tracker["usersTrackerId"], $itemid, '', $cat, array(), true);
			require_once('lib/search/refresh-functions.php');
			refresh_index('trackeritem', $itemid);
		}
	}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:21,代碼來源:userslib.php

示例9: reindex_all_files_for_search_text

 function reindex_all_files_for_search_text()
 {
     $query = "select fileId, filename, filesize, filetype, data, path, galleryId from `tiki_files` where `archiveId`=?";
     $result = $this->query($query, array(0));
     $rows = array();
     while ($row = $result->fetchRow()) {
         $rows[] = $row;
     }
     foreach ($rows as $row) {
         $search_text = $this->get_search_text_for_data($row['data'], $row['path'], $row['filetype'], $row['galleryId']);
         if ($search_text !== false) {
             $query = "update `tiki_files` set `search_data`=? where `fileId`=?";
             $result = $this->query($query, array($search_text, $row['fileId']));
         }
     }
     include_once "lib/search/refresh-functions.php";
     refresh_index('files');
 }
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:18,代碼來源:filegallib.php

示例10: rebuild_index

function rebuild_index($pContentType, $pUnindexedOnly = false)
{
    global $gBitSystem, $gLibertySystem;
    $arguments = array();
    $whereClause = "";
    ini_set("max_execution_time", "3000");
    if (!$pUnindexedOnly) {
        delete_index_content_type($pContentType);
    }
    $query = "SELECT `content_id`, `content_type_guid` FROM `" . BIT_DB_PREFIX . "liberty_content`";
    if (!empty($pContentType) && $pContentType != "pages") {
        $whereClause = " WHERE `content_type_guid` = ?";
        $arguments[] = $pContentType;
    }
    if ($pUnindexedOnly) {
        if (empty($whereClause)) {
            $whereClause = " WHERE ";
        } else {
            $whereClause .= " AND ";
        }
        $whereClause .= "`content_id` NOT IN (SELECT DISTINCT `content_id` FROM `" . BIT_DB_PREFIX . "search_index`)";
    }
    $orderBy = " ORDER BY `content_type_guid` ";
    $result = $gBitSystem->mDb->query($query . $whereClause . $orderBy, $arguments);
    $count = 0;
    if ($result) {
        $count = $result->RecordCount();
        while ($res = $result->fetchRow()) {
            if (isset($gLibertySystem->mContentTypes[$res["content_type_guid"]])) {
                $type = $gLibertySystem->mContentTypes[$res["content_type_guid"]];
                require_once constant(strtoupper($type['handler_package']) . '_PKG_PATH') . $type['handler_file'];
                $obj = new $type['handler_class'](NULL, $res["content_id"]);
                refresh_index($obj);
                unset($obj);
            }
        }
    }
    return $count;
}
開發者ID:bitweaver,項目名稱:search,代碼行數:39,代碼來源:refresh_functions.php

示例11: replace_article


//.........這裏部分代碼省略.........
     if (empty($imgdata) || $useImage === 'n') {
         // remove image data if not using it
         $imgdata = '';
     }
     $query = 'select `name` from `tiki_topics` where `topicId` = ?';
     $topicName = $this->getOne($query, array($topicId));
     $size = $body ? mb_strlen($body) : mb_strlen($heading);
     $info = array('title' => $title, 'authorName' => $authorName, 'topicId' => (int) $topicId, 'topicName' => $topicName, 'size' => (int) $size, 'useImage' => $useImage, 'image_name' => $imgname, 'image_type' => $imgtype, 'image_size' => (int) $imgsize, 'image_data' => $imgdata, 'isfloat' => $isfloat, 'image_x' => (int) $image_x, 'image_y' => (int) $image_y, 'list_image_x' => (int) $list_image_x, 'list_image_y' => (int) $list_image_y, 'heading' => $heading, 'body' => $body, 'publishDate' => (int) $publishDate, 'expireDate' => (int) $expireDate, 'created' => (int) $this->now, 'author' => $user, 'type' => $type, 'rating' => (double) $rating, 'topline' => $topline, 'subtitle' => $subtitle, 'linkto' => $linkto, 'image_caption' => $image_caption, 'lang' => $lang, 'ispublished' => $ispublished);
     $article_table = $this->table('tiki_articles');
     if ($articleId) {
         $oldArticle = $this->get_article($articleId);
         $article_table->update($info, array('articleId' => (int) $articleId));
         // Clear article image cache because image may just have been changed
         $this->delete_image_cache('article', $articleId);
         $event = 'article_edited';
         $nots = $tikilib->get_event_watches('article_edited', '*');
         $nots2 = $tikilib->get_event_watches('topic_article_edited', $topicId);
         $smarty->assign('mail_action', 'Edit');
         $smarty->assign('mail_old_title', $oldArticle['title']);
         $smarty->assign('mail_old_publish_date', $oldArticle['publishDate']);
         $smarty->assign('mail_old_expiration_date', $oldArticle['expireDate']);
         $smarty->assign('mail_old_data', $oldArticle['heading'] . "\n----------------------\n" . $oldArticle['body']);
     } else {
         $articleId = $article_table->insert($info);
         global $prefs;
         if ($prefs['feature_score'] == 'y') {
             $this->score_event($user, 'article_new');
         }
         $event = 'article_submitted';
         $nots = $tikilib->get_event_watches('article_submitted', '*');
         $nots2 = $tikilib->get_event_watches('topic_article_created', $topicId);
         $smarty->assign('mail_action', 'New');
         // Create tracker item as well if feature is enabled
         if (!$fromurl && $prefs['tracker_article_tracker'] == 'y' && ($trackerId = $prefs['tracker_article_trackerId'])) {
             $trklib = TikiLib::lib('trk');
             $definition = Tracker_Definition::get($trackerId);
             if ($fieldId = $definition->getArticleField()) {
                 $addit = array();
                 $addit[] = array('fieldId' => $fieldId, 'type' => 'articles', 'value' => $articleId);
                 $itemId = $trklib->replace_item($trackerId, 0, array('data' => $addit));
                 TikiLib::lib('relation')->add_relation('tiki.article.attach', 'trackeritem', $itemId, 'article', $articleId);
             }
         }
     }
     $nots3 = array();
     foreach ($nots as $n) {
         $nots3[] = $n['email'];
     }
     foreach ($nots2 as $n) {
         if (!in_array($n['email'], $nots3)) {
             $nots[] = $n;
         }
     }
     if (is_array($emails) && (empty($from) || $from == $prefs['sender_email'])) {
         foreach ($emails as $n) {
             if (!in_array($n, $nots3)) {
                 $nots[] = array('email' => $n, 'language' => $prefs['site_language']);
             }
         }
     }
     global $prefs;
     if ($prefs['user_article_watch_editor'] != "y") {
         for ($i = count($nots) - 1; $i >= 0; --$i) {
             if ($nots[$i]['user'] == $user) {
                 unset($nots[$i]);
                 break;
             }
         }
     }
     if (!isset($_SERVER['SERVER_NAME'])) {
         $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
     }
     if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
         $reportsManager = Reports_Factory::build('Reports_Manager');
         $reportsManager->addToCache($nots, array('event' => $event, 'articleId' => $articleId, 'articleTitle' => $title, 'authorName' => $authorName, 'user' => $user));
     }
     if (count($nots) || is_array($emails)) {
         include_once 'lib/notifications/notificationemaillib.php';
         $smarty->assign('mail_site', $_SERVER['SERVER_NAME']);
         $smarty->assign('mail_title', $title);
         $smarty->assign('mail_postid', $articleId);
         $smarty->assign('mail_user', $user);
         $smarty->assign('mail_current_publish_date', $publishDate);
         $smarty->assign('mail_current_expiration_date', $expireDate);
         $smarty->assign('mail_current_data', $heading . "\n----------------------\n" . $body);
         sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl');
         if (is_array($emails) && !empty($from) && $from != $prefs['sender_email']) {
             $nots = array();
             foreach ($emails as $n) {
                 $nots[] = array('email' => $n, 'language' => $prefs['site_language']);
             }
             sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl', $from);
         }
     }
     require_once 'lib/search/refresh-functions.php';
     refresh_index('articles', $articleId);
     $tikilib = TikiLib::lib('tiki');
     $tikilib->object_post_save(array('type' => 'article', 'object' => $articleId, 'description' => substr($heading, 0, 200), 'name' => $title, 'href' => "tiki-read_article.php?articleId={$articleId}"), array('content' => $body . "\n" . $heading));
     return $articleId;
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:101,代碼來源:artlib.php

示例12: removeFriend

 function removeFriend($user, $oldFriend)
 {
     $follow = $this->getRelation('follow', $user, $oldFriend);
     $followInvert = $this->getRelation('follow.invert', $user, $oldFriend);
     $request = $this->getRelation('request', $user, $oldFriend);
     $requestInvert = $this->getRelation('request.invert', $user, $oldFriend);
     if ($follow) {
         $this->relationlib->remove_relation($follow);
         if ($this->networkType == 'friend') {
             // Friendship breakups are bidirectional, not follow ones
             $this->relationlib->remove_relation($followInvert);
         }
         require_once 'lib/search/refresh-functions.php';
         refresh_index('user', $user);
         refresh_index('user', $oldFriend);
         return true;
     } elseif ($request || $requestInvert) {
         $this->relationlib->remove_relation($request);
         $this->relationlib->remove_relation($requestInvert);
         require_once 'lib/search/refresh-functions.php';
         refresh_index('user', $user);
         refresh_index('user', $oldFriend);
         return true;
     } else {
         return false;
     }
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:27,代碼來源:sociallib.php

示例13: replace_tracker

 function replace_tracker($trackerId, $name, $description, $options)
 {
     $explicit = $options['useExplicitNames'] == "y" ? true : false;
     $createNewTracker = $trackerId == false;
     if (!$explicit || $this->check_table_name($name, $trackerId == true)) {
         if ($explicit && $trackerId) {
             $oldName = $this->get_table_id($trackerId, $explicit);
         } elseif (!$explicit) {
             // TODO code to change from (explicit/non explicit)
         }
         // -------------------
         if ($trackerId) {
             $query = "update `tiki_trackers` set `name`=?,`description`=?,`lastModif`=? where `trackerId`=?";
             $this->query($query, array($name, $description, (int) $this->now, (int) $trackerId));
         } else {
             $this->getOne("delete from `tiki_trackers` where `name`=?", array($name), false);
             $query = "insert into `tiki_trackers`(`name`,`description`,`created`,`lastModif`) values(?,?,?,?)";
             $this->query($query, array($name, $description, (int) $this->now, (int) $this->now));
             $trackerId = $this->getOne("select max(`trackerId`) from `tiki_trackers` where `name`=? and `created`=?", array($name, (int) $this->now));
         }
         $this->query("delete from `tiki_tracker_options` where `trackerId`=?", array((int) $trackerId));
         $rating = false;
         foreach ($options as $kopt => $opt) {
             $this->query("insert into `tiki_tracker_options`(`trackerId`,`name`,`value`) values(?,?,?)", array((int) $trackerId, $kopt, $opt));
             if ($kopt == 'useRatings' and $opt == 'y') {
                 $rating = true;
             } elseif ($kopt == 'ratingOptions') {
                 $ratingoptions = $opt;
             } elseif ($kopt == 'showRatings') {
                 $showratings = $opt;
             }
         }
         // -------------------
         // creation de la table des items
         // si elle n'existe pas deja.
         if ($createNewTracker && $trackerId) {
             $dsn = null;
             $this->create_value_table($trackerId, $explicit, $dsn);
         } elseif ($explicit) {
             $query = "alter table {$oldName} rename to " . $this->EXPLICIT_PREFIX . $name;
             $this->query($query);
         }
         // -------------------
         $ratingId = $this->get_field_id($trackerId, 'Rating');
         if ($rating) {
             if (!$ratingId) {
                 $ratingId = 0;
             }
             if (!isset($ratingoptions)) {
                 $ratingoptions = '';
             }
             if (!isset($showratings)) {
                 $showratings = 'n';
             }
             $this->replace_tracker_field($trackerId, $ratingId, 'Rating', 's', '-', '-', $showratings, 'y', '-', '-', 0, $ratingoptions);
         } else {
             $this->query('delete from `tiki_tracker_fields` where `fieldId`=?', array((int) $ratingId));
         }
         // -------------------
         global $prefs;
         if ($prefs['feature_search'] == 'y' && $prefs['feature_search_fulltext'] != 'y' && $prefs['search_refresh_index_mode'] == 'normal') {
             require_once 'lib/search/refresh-functions.php';
             refresh_index('trackers', $trackerId);
         }
         // -------------------
         return $trackerId;
         // -------------------
     }
     return false;
 }
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:70,代碼來源:trkWithMirrorTablesLib.php

示例14: post_new_comment

 function post_new_comment($objectId, $parentId, $userName, $title, $data, &$message_id, $in_reply_to = '', $type = 'n', $summary = '', $smiley = '', $contributions = '', $anonymous_name = '')
 {
     if (!$userName) {
         $_SESSION["lastPost"] = $this->now;
     }
     if (!isset($_SERVER['REMOTE_ADDR'])) {
         $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     }
     // Check for banned userName or banned IP or IP in banned range
     // Check for duplicates.
     $title = strip_tags($title);
     if (!$userName) {
         if ($anonymous_name) {
             $userName = $anonymous_name . ' ' . tra('(not registered)');
         } else {
             $userName = tra('Anonymous');
         }
     } else {
         if ($this->getOne("select count(*) from \n\t\t\t`tiki_user_postings` where `user`=?", array($userName), false)) {
             $query = "update `tiki_user_postings` " . "set `last`=?, `posts` = `posts` + 1 where `user`=?";
             $this->query($query, array((int) $this->now, $userName));
         } else {
             $posts = $this->getOne("select count(*) " . "from `tiki_comments` where `userName`=?", array($userName), false);
             if (!$posts) {
                 $posts = 1;
             }
             $query = "insert into \n\t\t    `tiki_user_postings`(`user`,`first`,`last`,`posts`) \n\t\t    values( ?, ?, ?, ? )";
             $this->query($query, array($userName, (int) $this->now, (int) $this->now, (int) $posts));
         }
         // Calculate max
         $max = $this->getOne("select max(`posts`) from `tiki_user_postings`", array());
         $min = $this->getOne("select min(`posts`) from `tiki_user_postings`", array());
         if ($min == 0) {
             $min = 1;
         }
         $ids = $this->getOne("select count(*) from `tiki_user_postings`", array());
         $tot = $this->getOne("select sum(`posts`) from `tiki_user_postings`", array());
         $average = $tot / $ids;
         $range1 = ($min + $average) / 2;
         $range2 = ($max + $average) / 2;
         $posts = $this->getOne("select `posts` " . "from `tiki_user_postings` where `user`=?", array($userName), false);
         if ($posts == $max) {
             $level = 5;
         } elseif ($posts > $range2) {
             $level = 4;
         } elseif ($posts > $average) {
             $level = 3;
         } elseif ($posts > $range1) {
             $level = 2;
         } else {
             $level = 1;
         }
         $query = "update `tiki_user_postings` " . "set `level`=? where `user`=?";
         $this->query($query, array($level, $userName));
     }
     $hash = md5($title . $data);
     $query = "select `threadId` from `tiki_comments` where `hash`=?";
     $result = $this->query($query, array($hash));
     // print( "<pre>result:" );
     // print_r( $result );
     // print( "</pre>" );
     // Check if we were passed a message-id.
     if (!$message_id) {
         // Construct a message id via proctological
         // extraction.  -rlpowell
         $message_id = $userName . "-" . $parentId . "-" . substr($hash, 0, 10) . "@" . $_SERVER["SERVER_NAME"];
     }
     // Break out the type and object parameters.
     $object = explode(":", $objectId, 2);
     // If this post was not already found.
     if (!$result->numRows()) {
         $query = "insert into\n\t\t`tiki_comments`(`objectType`, `object`,\n\t\t\t`commentDate`, `userName`, `title`, `data`, `votes`,\n\t\t\t`points`, `hash`, `parentId`, `average`, `hits`,\n\t\t\t`type`, `summary`, `smiley`, `user_ip`,\n\t\t\t`message_id`, `in_reply_to`)\n\t\tvalues ( ?, ?, ?, ?, ?, ?,\n\t\t\t0, 0, ?, ?, 0, 0, ?, ?, \n\t\t\t?, ?, ?, ?)";
         $result = $this->query($query, array($object[0], (string) $object[1], (int) $this->now, $userName, $title, $data, $hash, (int) $parentId, $type, $summary, $smiley, $_SERVER["REMOTE_ADDR"], $message_id, (string) $in_reply_to));
     }
     $threadId = $this->getOne("select `threadId` from\n\t\t`tiki_comments` where `hash`=?", array($hash));
     /* Force an index refresh of the data */
     include_once "lib/search/refresh-functions.php";
     refresh_index_comments($threadId);
     global $prefs;
     if ($prefs['feature_actionlog'] == 'y') {
         global $logslib;
         include_once 'lib/logs/logslib.php';
         global $tikilib;
         if ($parentId == 0) {
             $l = strlen($data);
         } else {
             $l = $tikilib->strlen_quoted($data);
         }
         if ($object[0] == 'forum') {
             $logslib->add_action($parentId == 0 ? 'Posted' : 'Replied', $object[1], $object[0], 'comments_parentId=' . $threadId . '&amp;add=' . $l, '', '', '', '', $contributions);
         } else {
             $logslib->add_action($parentId == 0 ? 'Posted' : 'Replied', $object[1], 'comment', 'type=' . $object[0] . '&amp;add=' . $l . '#threadId' . $threadId, '', '', '', '', $contributions);
         }
     }
     if ($prefs['feature_contribution'] == 'y') {
         global $contributionlib;
         include_once 'lib/contribution/contributionlib.php';
         $contributionlib->assign_contributions($contributions, $threadId, 'comment', $title, '', '');
     }
     if ($prefs['feature_search'] == 'y' && $prefs['feature_search_fulltext'] != 'y' && $prefs['search_refresh_index_mode'] == 'normal') {
//.........這裏部分代碼省略.........
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:101,代碼來源:commentslib.php

示例15: index_posts_by_forum

 /**
  * Re-indexes the forum posts within a specified forum
  * @param $forumId
  */
 private function index_posts_by_forum($forumId)
 {
     $topics = $this->get_forum_topics($forumId);
     foreach ($topics as $topic) {
         if ($element === end($array)) {
             //if element is the last in the array, then run the process.
             refresh_index('forum post', $topic['threadId'], true);
         } else {
             refresh_index('forum post', $topic['threadId'], false);
             //don't run the process right away (re: false), wait until last element
         }
     }
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:17,代碼來源:commentslib.php


注:本文中的refresh_index函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。