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


PHP TikiLib::events方法代碼示例

本文整理匯總了PHP中TikiLib::events方法的典型用法代碼示例。如果您正苦於以下問題:PHP TikiLib::events方法的具體用法?PHP TikiLib::events怎麽用?PHP TikiLib::events使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TikiLib的用法示例。


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

示例1: action_toggle

 /**
  * Function to toggle relation. Sets relation when none set and then if there is a relation, it unsets.
  * @param $input
  * @return array with "relationId" as param. Null if relation is removed.
  * @throws Exception
  * @throws Services_Exception
  */
 function action_toggle($input)
 {
     $relation = $input->relation->none();
     $target_type = $input->target_type->none();
     $target_id = $input->target_id->none();
     $source_type = $input->source_type->none();
     $source_id = $input->source_id->none();
     // ensure the target, source, and relation info are passed to the service
     if (!$target_type || !$target_id || !$source_type || !$source_id || !$relation) {
         throw new Services_Exception(tr('Invalid input'), 400);
     }
     $relationlib = TikiLib::lib('relation');
     $tx = TikiDb::get()->begin();
     $relationId = $relationlib->get_relation_id($relation, $source_type, $source_id, $target_type, $target_id);
     // If there is not an existing relation, add the relation and trigger the add relation event.
     if (!$relationId) {
         $relationId = $relationlib->add_relation($relation, $source_type, $source_id, $target_type, $target_id);
         TikiLib::events()->trigger('tiki.relation.add', array('id' => $relationId, 'target_type' => $target_type, 'target_id' => $target_id, 'source_type' => $source_type, 'source_id' => $source_id, 'relation' => $relation));
     } else {
         //if there is a relation, remove the relation, trigger the event, and set the relationId to null
         $relationlib->remove_relation($relationId);
         TikiLib::events()->trigger('tiki.relation.remove', array('id' => $relationId, 'target_type' => $target_type, 'target_id' => $target_id, 'source_type' => $source_type, 'source_id' => $source_id, 'relation' => $relation));
         $relationId = null;
         // set the
     }
     $tx->commit();
     //return the relationId (new relation if added, null if removed)
     return array('relation_id' => $relationId);
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:36,代碼來源:Controller.php

示例2: smarty_function_rating

function smarty_function_rating($params, $smarty)
{
    global $prefs, $user;
    $ratinglib = TikiLib::lib('rating');
    if (!isset($params['type'], $params['id'])) {
        return tra('No object information provided for rating.');
    }
    $type = $params['type'];
    $id = $params['id'];
    if (isset($params['changemandated']) && $params['changemandated'] == 'y') {
        $changemandated = true;
        // needed to fix multiple submission problem in comments
    } else {
        $changemandated = false;
    }
    if (isset($_REQUEST['rating_value'][$type][$id], $_REQUEST['rating_prev'][$type][$id])) {
        $value = $_REQUEST['rating_value'][$type][$id];
        $prev = $_REQUEST['rating_prev'][$type][$id];
        if ((!$changemandated || $value != $prev) && $ratinglib->record_vote($type, $id, $value)) {
            // Handle type-specific actions
            if ($type == 'comment') {
                if ($user) {
                    $commentslib = TikiLib::lib('comments');
                    $commentslib->vote_comment($id, $user, $value);
                }
            }
            $tikilib = TikiLib::lib('tiki');
            if ($type == 'comment') {
                $forum_id = $commentslib->get_comment_forum_id($id);
                $forum_info = $commentslib->get_forum($forum_id);
                $thread_info = $commentslib->get_comment($id, null, $forum_info);
                $item_user = $thread_info['userName'];
            } elseif ($type == 'article') {
                $artlib = TikiLib::lib('art');
                $res = $artlib->get_article($id);
                $item_user = $res['author'];
            }
            if ($value == '1') {
                TikiLib::events()->trigger('tiki.social.rating.add', array('type' => $type, 'object' => $id, 'author' => $item_user, 'user' => $user));
            } elseif ($value == '2') {
                TikiLib::events()->trigger('tiki.social.rating.remove', array('type' => $type, 'object' => $id, 'author' => $item_user, 'user' => $user));
            }
        } elseif ($value != $prev) {
            return tra('An error occurred.');
        }
    }
    $vote = $ratinglib->get_vote($type, $id);
    $options = $ratinglib->get_options($type, $id, false, $hasLabels);
    if ($prefs['rating_smileys'] == 'y') {
        $smiles = $ratinglib->get_options_smiles($type, $id);
        $smarty->assign('rating_smiles', $smiles);
    }
    $smarty->assign('rating_type', $type);
    $smarty->assign('rating_id', $id);
    $smarty->assign('rating_options', $options);
    $smarty->assign('current_rating', $vote);
    $smarty->assign('rating_has_labels', $hasLabels);
    return $smarty->fetch('rating.tpl');
}
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:59,代碼來源:function.rating.php

示例3: commit

 function commit()
 {
     $done = TikiLib::lib('unifiedsearch')->endBatch($this->token);
     if ($done) {
         $events = TikiLib::events();
         $events->trigger('tiki.commit.after');
     }
 }
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:8,代碼來源:Transaction.php

示例4: addDocument

 function addDocument(array $document)
 {
     $matches = $this->parent->getMatchingQueries($document);
     if (count($matches)) {
         $raw = TikiLib::lib('unifiedsearch')->getRawArray($document);
         foreach ($matches as $match) {
             list($priority, $id) = explode('-', $match, 2);
             TikiLib::events()->trigger('tiki.query.' . $priority, array('query' => $id, 'priority' => $priority, 'user' => $GLOBALS['user'], 'type' => $raw['object_type'], 'object' => $raw['object_id']));
         }
     }
     return $this->parent->addDocument($document);
 }
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:12,代碼來源:QueryAlertDecorator.php

示例5: process

 function process($controller, $action, JitFilter $request)
 {
     $access = TikiLib::lib('access');
     try {
         $this->preExecute();
         $output = $this->attemptProcess($controller, $action, $request);
         if (isset($output['FORWARD'])) {
             $output['FORWARD'] = array_merge(array('controller' => $controller, 'action' => $action), $output['FORWARD']);
         }
         if ($access->is_serializable_request()) {
             echo $access->output_serialized($output);
         } else {
             TikiLib::events()->trigger('tiki.process.render');
             echo $this->render($controller, $action, $output, $request);
         }
     } catch (Services_Exception_FieldError $e) {
         if ($request->modal->int() && $access->is_xml_http_request()) {
             // Special handling for modal dialog requests
             // Do not send an error code as bootstrap will just blank out
             // Render the error as a modal
             $smarty = TikiLib::lib('smarty');
             $smarty->assign('title', tr('Oops'));
             $smarty->assign('detail', ['message' => $e->getMessage()]);
             $smarty->display("extends:internal/modal.tpl|error-ajax.tpl");
         } else {
             $access->display_error(NULL, $e->getMessage(), $e->getCode());
         }
     } catch (Exception $e) {
         if ($request->modal->int() && $access->is_xml_http_request()) {
             // Special handling for modal dialog requests
             // Do not send an error code as bootstrap will just blank out
             // Render the error as a modal
             $smarty = TikiLib::lib('smarty');
             $smarty->assign('title', tr('Oops'));
             $smarty->assign('detail', ['message' => $e->getMessage()]);
             $smarty->display("extends:internal/modal.tpl|error-ajax.tpl");
         } else {
             $access->display_error(NULL, $e->getMessage(), $e->getCode());
         }
     }
 }
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:41,代碼來源:Broker.php

示例6: action_toggle

 function action_toggle($input)
 {
     global $user;
     if (!$user) {
         throw new Services_Exception(tr('Must be authenticated'), 403);
     }
     $type = $input->type->none();
     $object = $input->object->none();
     $target = $input->target->int();
     if (!$type || !$object) {
         throw new Services_Exception(tr('Invalid input'), 400);
     }
     $relationlib = TikiLib::lib('relation');
     $tx = TikiDb::get()->begin();
     $relations = $this->action_list($input);
     $relationId = $this->getCurrentRelation($relations, $user, $type, $object);
     if ($type == 'trackeritem') {
         $parentobject = TikiLib::lib('trk')->get_tracker_for_item($object);
     } else {
         $parentobject = 'not implemented';
     }
     if ($target) {
         if (!$relationId) {
             $relationId = $relationlib->add_relation('tiki.user.favorite', 'user', $user, $type, $object);
             $relations[$relationId] = "{$type}:{$object}";
             $this->handleScore($type, $object);
             TikiLib::events()->trigger('tiki.social.favorite.add', array('type' => $type, 'object' => $object, 'parentobject' => $parentobject, 'user' => $user));
         }
     } else {
         if ($relationId) {
             $relationlib->remove_relation($relationId);
             unset($relations[$relationId]);
             TikiLib::events()->trigger('tiki.social.favorite.remove', array('type' => $type, 'object' => $object, 'parentobject' => $parentobject, 'user' => $user));
         }
     }
     $tx->commit();
     return array('list' => $relations);
 }
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:38,代碼來源:FavoriteController.php

示例7: if

} else if ({$not_comparing}) {
\t\$("input[name=newver]:eq(0)").prop("checked", "checked").change();
\t\$("input[name=oldver]:eq(1)").prop("checked", "checked").change();
}
JS
);
if (isset($_REQUEST["compare"])) {
    histlib_helper_setup_diff($page, $oldver, $newver);
    if (isset($approved_versions)) {
        $smarty->assign('flaggedrev_compare_approve', !in_array($newver, $approved_versions));
    }
} else {
    $smarty->assign('diff_style', $info['is_html'] === '1' ? 'htmldiff' : $prefs['default_wiki_diff_style']);
}
if ($info["flag"] == 'L') {
    $smarty->assign('lock', true);
} else {
    $smarty->assign('lock', false);
}
if (isset($_REQUEST['nohistory'])) {
    $smarty->assign('noHistory', true);
}
ask_ticket('page-history');
TikiLib::events()->trigger('tiki.wiki.view', array_merge(array('type' => 'wiki page', 'object' => $page, 'user' => $GLOBALS['user']), $info));
// disallow robots to index page:
$smarty->assign('page_user', $info['user']);
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
include_once 'tiki-section_options.php';
// Display the template
$smarty->assign('mid', 'tiki-pagehistory.tpl');
$smarty->display("tiki.tpl");
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:31,代碼來源:tiki-pagehistory.php

示例8: _move

 /**
  * Move file into another parent dir and/or rename.
  * Return new file path or false.
  *
  * @param  string  $source  source file path
  * @param  string  $targetDir  target dir path
  * @param  string  $name    file name
  * @return string|bool
  **/
 protected function _move($source, $targetDir, $name)
 {
     $ar = explode('_', $source);
     if (count($ar) === 2) {
         $isgal = $ar[0] === 'd';
         $source = $ar[1];
     } else {
         $isgal = true;
     }
     $name = trim(strip_tags($name));
     if (!$isgal) {
         $srcDirId = $this->options['accessControlData']['parentIds']['files'][$this->pathToId($source)];
     } else {
         $srcDirId = $this->pathToId($source);
     }
     $srcPerms = TikiLib::lib('tiki')->get_perm_object($srcDirId, 'file gallery', TikiLib::lib('filegal')->get_file_gallery_info($srcDirId));
     $targetDirId = $this->pathToId($targetDir);
     if ($srcDirId == $targetDirId) {
         $targetPerms = $srcPerms;
     } else {
         $targetPerms = TikiLib::lib('tiki')->get_perm_object($targetDirId, 'file gallery', TikiLib::lib('filegal')->get_file_gallery_info($targetDirId));
     }
     $canMove = $srcPerms['tiki_p_admin_file_galleries'] === 'y' && $targetPerms['tiki_p_admin_file_galleries'] === 'y' || $srcPerms['tiki_p_remove_files'] === 'y' && $targetPerms['tiki_p_upload_files'] === 'y';
     if ($isgal) {
         if ($canMove) {
             $result = $this->fileGalleriesTable->update(array('name' => $name, 'parentId' => $targetDirId), array('galleryId' => $srcDirId));
             if ($result) {
                 TikiLib::events()->trigger('tiki.filegallery.update', ['type' => 'file gallery', 'object' => $srcDirId]);
                 return 'd_' . $srcDirId;
             }
         }
     } else {
         if ($srcPerms['tiki_p_edit_gallery_file'] === 'y' && ($srcDirId !== $targetDirId || $canMove)) {
             $result = $this->filesTable->update(array('name' => $name, 'galleryId' => $targetDirId), array('fileId' => $this->pathToId($source)));
             if ($result) {
                 TikiLib::events()->trigger('tiki.file.update', ['type' => 'file', 'object' => $this->pathToId($source)]);
                 return 'f_' . $this->pathToId($source);
             }
         }
     }
     return '';
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:51,代碼來源:elFinderVolumeTikiFiles.class.php

示例9: tra

        }
    }
}
if ((!isset($_REQUEST["trackerId"]) || !$_REQUEST["trackerId"]) && isset($_REQUEST["itemId"])) {
    $item_info = $trklib->get_tracker_item($_REQUEST["itemId"]);
    $_REQUEST['trackerId'] = $item_info['trackerId'];
}
if (!isset($_REQUEST["trackerId"]) || !$_REQUEST["trackerId"]) {
    $smarty->assign('msg', tra("No tracker indicated"));
    $smarty->display("error.tpl");
    die;
}
if (isset($_REQUEST["itemId"])) {
    $item_info = $trklib->get_tracker_item($_REQUEST["itemId"]);
    $currentItemId = $_REQUEST["itemId"];
    TikiLib::events()->trigger('tiki.trackeritem.view', array('type' => 'trackeritem', 'object' => $currentItemId, 'owner' => $item_info['createdBy'], 'user' => $GLOBALS['user']));
}
$definition = Tracker_Definition::get($_REQUEST['trackerId']);
$xfields = array('data' => $definition->getFields());
$smarty->assign('tracker_is_multilingual', $prefs['feature_multilingual'] == 'y' && $definition->getLanguageField());
if (!isset($utid) and !isset($gtid) and (!isset($_REQUEST["itemId"]) or !$_REQUEST["itemId"]) and !isset($_REQUEST["offset"])) {
    $smarty->assign('msg', tra("No item indicated"));
    $smarty->display("error.tpl");
    die;
}
if ($prefs['feature_groupalert'] == 'y') {
    $groupforalert = $groupalertlib->GetGroup('tracker', $_REQUEST['trackerId']);
    if ($groupforalert != "") {
        $showeachuser = $groupalertlib->GetShowEachUser('tracker', $_REQUEST['trackerId'], $groupforalert);
        $listusertoalert = $userlib->get_users(0, -1, 'login_asc', '', '', false, $groupforalert, '');
        $smarty->assign_by_ref('listusertoalert', $listusertoalert['data']);
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:31,代碼來源:tiki-view_tracker_item.php

示例10: replace_file

 function replace_file($id, $name, $description, $filename, $data, $size, $type, $creator, $path, $comment = '', $gal_info, $didFileReplace, $author = '', $created = '', $lockedby = NULL, $deleteAfter = NULL)
 {
     global $prefs, $user;
     if (!$this->is_filename_valid($filename)) {
         return false;
     }
     $this->transformImage($path, $data, $size, $gal_info, $type);
     $filesTable = $this->table('tiki_files');
     $fileDraftsTable = $this->table('tiki_file_drafts');
     $galleriesTable = $this->table('tiki_file_galleries');
     $initialFileId = $id;
     // Update the fields in the database
     $name = trim(strip_tags($name));
     $description = strip_tags($description);
     // User avatar full images are always using db and not file location (at the curent state of feature)
     if (isset($prefs['user_store_file_gallery_picture']) && $prefs['user_store_file_gallery_picture'] == 'y' && $prefs["user_picture_gallery_id"] == $gal_info['galleryId']) {
         $userPictureGallery = true;
     } else {
         $userPictureGallery = false;
     }
     $checksum = $this->get_file_checksum($gal_info['galleryId'], $path, $data);
     $search_data = '';
     if ($prefs['fgal_enable_auto_indexing'] != 'n') {
         $search_data = $this->get_search_text_for_data($data, $path, $type, $gal_info['galleryId']);
         if ($search_data === false) {
             return false;
         }
     }
     $oldPath = '';
     if ($prefs['feature_file_galleries_save_draft'] == 'y') {
         $oldPath = $fileDraftsTable->fetchOne('path', array('fileId' => $id, 'user' => $user));
     } else {
         $oldPath = $filesTable->fetchOne('path', array('fileId' => $id));
     }
     if ($gal_info['archives'] == -1 || !$didFileReplace) {
         // no archive
         if ($prefs['feature_file_galleries_save_draft'] == 'y') {
             $result = $filesTable->update(array('name' => $name, 'description' => $description, 'lastModifUser' => $user, 'lastModif' => $this->now, 'author' => $author, 'user' => $creator), array('fileId' => $id));
             if (!$result) {
                 return false;
             }
             if ($didFileReplace) {
                 if (!$this->insert_draft($id, $filename, $size, $type, $data, $user, $path, $checksum, $lockedby)) {
                     return false;
                 }
             }
         } else {
             $result = $filesTable->update(array('name' => $name, 'description' => $description, 'filename' => $filename, 'filesize' => $size, 'filetype' => $type, 'data' => $data, 'lastModifUser' => $user, 'lastModif' => $this->now, 'path' => $path, 'hash' => $checksum, 'search_data' => $search_data, 'author' => $author, 'user' => $creator, 'lockedby' => $lockedby, 'deleteAfter' => $deleteAfter), array('fileId' => $id));
             if (!$result) {
                 return false;
             }
         }
         if ($didFileReplace && !empty($oldPath)) {
             $savedir = $this->get_gallery_save_dir($gal_info['galleryId'], $gal_info);
             unlink($savedir . $oldPath);
         }
         TikiLib::events()->trigger('tiki.file.update', array('type' => 'file', 'object' => $id, 'galleryId' => $gal_info['galleryId'], 'initialFileId' => $initialFileId, 'filetype' => $type));
     } else {
         //archive the old file : change archive_id, take away from indexation and categorization
         if ($prefs['feature_file_galleries_save_draft'] == 'y') {
             $this->insert_draft($id, $filename, $size, $type, $data, $user, $path, $checksum, $lockedby);
         } else {
             $id = $this->save_archive($id, $gal_info['galleryId'], $gal_info['archives'], $name, $description, $filename, $data, $size, $type, $creator, $path, $comment, $author, $created, $lockedby);
         }
     }
     if ($gal_info['galleryId']) {
         $galleriesTable->update(array('lastModif' => $this->now), array('galleryId' => $gal_info['galleryId']));
     }
     return $id;
 }
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:70,代碼來源:filegallib.php

示例11: set_avatar_from_url

 /**
  * sets the avatar from a given image file's URL
  *
  * @return string	URL for the current page
  */
 function set_avatar_from_url($url, $userwatch = "", $name = "")
 {
     global $user, $prefs;
     $access = TikiLib::lib('access');
     $access->check_feature('feature_userPreferences');
     $access->check_user($user);
     $userprefslib = TikiLib::lib('userprefs');
     $imagegallib = TikiLib::lib('imagegal');
     if (empty($userwatch)) {
         $userwatch = $user;
     }
     $data = file_get_contents($url);
     list($iwidth, $iheight, $itype, $iattr) = getimagesize($url);
     $itype = image_type_to_mime_type($itype);
     // Get proper file size of image
     $imgdata = get_headers($url, true);
     if (isset($imgdata['Content-Length'])) {
         # Return file size
         $size = (int) $imgdata['Content-Length'];
     }
     // Store full-size file gallery image if that is required
     if ($prefs["user_store_file_gallery_picture"] == 'y') {
         $fgImageId = $userprefslib->set_file_gallery_image($userwatch, $name, $size, $itype, $data);
     }
     // Store small avatar
     if ($prefs['user_small_avatar_size']) {
         $avsize = $prefs['user_small_avatar_size'];
     } else {
         $avsize = "45";
         //default
     }
     if (($iwidth == $avsize and $iheight <= $avsize) || ($iwidth <= $avsize and $iheight == $avsize)) {
         $userprefslib->set_user_avatar($userwatch, 'u', '', $name, $size, $itype, $data);
     } else {
         if (function_exists("ImageCreateFromString") && !strstr($type, "gif")) {
             $img = imagecreatefromstring($data);
             $size_x = imagesx($img);
             $size_y = imagesy($img);
             /* if the square crop is set, crop the image before resizing */
             if ($prefs['user_small_avatar_square_crop']) {
                 $crop_size = min($size_x, $size_y);
                 $offset_x = ($size_x - $crop_size) / 2;
                 $offset_y = ($size_y - $crop_size) / 2;
                 $crop_array = array('x' => $offset_x, 'y' => $offset_y, 'width' => $crop_size, 'height' => $crop_size);
                 $img = imagecrop($img, $crop_array);
                 $size_x = $size_y = $crop_size;
             }
             if ($size_x > $size_y) {
                 $tscale = (int) $size_x / $avsize;
             } else {
                 $tscale = (int) $size_y / $avsize;
             }
             $tw = (int) ($size_x / $tscale);
             $ty = (int) ($size_y / $tscale);
             if ($tw > $size_x) {
                 $tw = $size_x;
             }
             if ($ty > $size_y) {
                 $ty = $size_y;
             }
             if (chkgd2()) {
                 $t = imagecreatetruecolor($tw, $ty);
                 imagecopyresampled($t, $img, 0, 0, 0, 0, $tw, $ty, $size_x, $size_y);
             } else {
                 $t = imagecreate($tw, $ty);
                 $imagegallib->ImageCopyResampleBicubic($t, $img, 0, 0, 0, 0, $tw, $ty, $size_x, $size_y);
             }
             // CHECK IF THIS TEMP IS WRITEABLE OR CHANGE THE PATH TO A WRITEABLE DIRECTORY
             $tmpfname = tempnam($prefs['tmpDir'], "TMPIMG");
             imagejpeg($t, $tmpfname);
             // Now read the information
             $fp = fopen($tmpfname, "rb");
             $t_data = fread($fp, filesize($tmpfname));
             fclose($fp);
             unlink($tmpfname);
             $t_type = 'image/jpeg';
             $userprefslib->set_user_avatar($userwatch, 'u', '', $name, $size, $t_type, $t_data);
         } else {
             $userprefslib->set_user_avatar($userwatch, 'u', '', $name, $size, $type, $data);
         }
     }
     TikiLib::events()->trigger('tiki.user.avatar', array('type' => 'user', 'object' => $userwatch, 'user' => $userwatch));
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:88,代碼來源:avatarlib.php

示例12: header

<?php

// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
// This script may only be included - so its better to die if called directly.
if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) {
    header('location: index.php');
    exit;
}
if (isset($_REQUEST['userfeatures'])) {
    check_ticket('admin-inc-community');
}
$smarty->assign('event_graph', TikiLib::events()->getEventGraph());
$command_parts = [realpath(__DIR__ . '/../console.php'), 'notification:digest', $url_host, 7];
if ($url_port) {
    $command_parts[] = '--port=' . $url_port;
}
if ($tikiroot != '/') {
    $command_parts[] = '--path=' . $tikiroot;
}
if ($url_scheme == 'https') {
    $command_parts[] = '--ssl';
}
$command = implode(' ', $command_parts);
$smarty->assign('monitor_command', $command);
ask_ticket('admin-inc-community');
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:29,代碼來源:include_community.php

示例13: getElasticConnection

 private function getElasticConnection($useMasterOnly)
 {
     global $prefs;
     static $connections = [];
     $target = $prefs['unified_elastic_url'];
     if (!$useMasterOnly && $prefs['federated_elastic_url']) {
         $target = $prefs['federated_elastic_url'];
     }
     if (!empty($connections[$target])) {
         return $connections[$target];
     }
     $connection = new Search_Elastic_Connection($target);
     $connection->startBulk();
     $connection->persistDirty(TikiLib::events());
     $connections[$target] = $connection;
     return $connection;
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:17,代碼來源:searchlib-unified.php

示例14: add_file_hit

 function add_file_hit($id)
 {
     global $prefs, $user;
     $files = $this->table('tiki_files');
     if (StatsLib::is_stats_hit()) {
         // Enforce max download per file
         if ($prefs['fgal_limit_hits_per_file'] == 'y') {
             $limit = $this->get_download_limit($id);
             if ($limit > 0) {
                 $count = $files->fetchCount(array('fileId' => $id, 'hits' => $files->lesserThan($limit)));
                 if (!$count) {
                     return false;
                 }
             }
         }
         $files->update(array('hits' => $files->increment(1), 'lastDownload' => $this->now), array('fileId' => (int) $id));
     } else {
         $files->update(array('lastDownload' => $this->now), array('fileId' => (int) $id));
     }
     if ($prefs['feature_score'] == 'y' && $prefs['fgal_prevent_negative_score'] == 'y') {
         $score = TikiLib::lib('score')->get_user_score($user);
         if ($score < 0) {
             return false;
         }
     }
     $owner = $files->fetchOne('user', array('fileId' => (int) $id));
     TikiLib::events()->trigger('tiki.file.download', array('type' => 'file', 'object' => $id, 'user' => $user, 'owner' => $owner));
     return true;
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:29,代碼來源:filegallib.php

示例15: isset

     //////////////////////////////////////////////////////////////////////////////////
     // hollmeer: send with gpg-armor block etc included				//
     // A changed encryption-related version was copied from lib/messu/messulib.pgp  //
     // into lib/openpgp/openpgplib.php for prepending/appending content into	//
     // message body									//
     if ($prefs['openpgp_gpg_pgpmimemail'] == 'y') {
         // USE PGP/MIME MAIL VERSION
         $result = $openpgplib->post_message_with_pgparmor_attachment($a_user, $user, $_REQUEST['to'], $_REQUEST['cc'], $_REQUEST['subject'], $_REQUEST['body'], $prepend_email_body, $user_armor, $_REQUEST['priority'], $_REQUEST['replyto_hash'], isset($_REQUEST['replytome']) ? 'y' : '', isset($_REQUEST['bccme']) ? 'y' : '');
     } else {
         // USE ORIGINAL TIKI MAIL VERSION
         $result = $messulib->post_message($a_user, $user, $_REQUEST['to'], $_REQUEST['cc'], $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority'], $_REQUEST['replyto_hash'], isset($_REQUEST['replytome']) ? 'y' : '', isset($_REQUEST['bccme']) ? 'y' : '');
     }
     // 										//
     //////////////////////////////////////////////////////////////////////////////////
     if ($result) {
         TikiLib::events()->trigger('tiki.user.message', array('type' => 'user', 'object' => $a_user, 'user' => $user));
         // if this is a reply flag the original messages replied to
         if ($_REQUEST['replyto_hash'] != '') {
             $messulib->mark_replied($a_user, $_REQUEST['replyto_hash']);
         }
     } else {
         $message = tra('An error occurred, please check your mail settings and try again');
     }
 }
 // Insert a copy of the message in the sent box of the sender
 $messulib->save_sent_message($user, $user, $_REQUEST['to'], $_REQUEST['cc'], $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority'], $_REQUEST['replyto_hash']);
 $smarty->assign('message', $message);
 if ($prefs['feature_actionlog'] == 'y') {
     if (isset($_REQUEST['reply']) && $_REQUEST['reply'] == 'y') {
         $logslib->add_action('Replied', '', 'message', 'add=' . $tikilib->strlen_quoted($_REQUEST['body']));
     } else {
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:31,代碼來源:messu-compose.php


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