Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
modified : configuration and documentation added in the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fahad-cb committed Jan 3, 2019
1 parent b6dfa27 commit 26eba46
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 7 deletions.
110 changes: 110 additions & 0 deletions upload/plugins/cb_elastic_search/admin/configure.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<span class="page_title">ElasticSearch </span>
<div class="row">
<div class="col-lg-12 mrgnt15">
<span class="mandtory"><h3>Configurations</h3></span>
</div>
<div class="col-lg-11">
<div class="row">
<form id="index" method="post">
<div class="col-md-4">
<label for="elastic_server_ip">Elastic Server IP</label>
<input type="text" name="elastic_server_ip" class="form-control" value="{config('elastic_server_ip')}">
<p>e.g the URL on which elastic server is listening</p>
</div>
<!-- <div class="col-md-4">
<label for="elastic_server_port">Elastic Server Port</label>
<input type="text" name="elastic_server_port" class="form-control" value="{config('elastic_server_port')}">
<p>e.g the port on which elastic server is listening</p>
</div> -->
<div class="col-md-2" style="margin-top: 25px;">
<input type="submit" name="submit" id="submit" class="btn btn-md btn-success" value="Update">
</div>
<div class="col-md-6">
{if is_es_server_running()}
<span class="alert alert-success"> Elastic Server is running Up !
<i class="glyphicon glyphicon-ok"></i>
</span>
{else}
<span class="alert alert-warning"> Elastic Server not running or configured !
<i class="glyphicon glyphicon-warning-sign"></i>
</span>
{/if}
</div>
</form>
</div>
<div class="row" style="margin-top: 25px;margin-left: 15px;" >
<div class="col-lg-12 results" style="background: #f8f8f8;border: 1px solid #d4d4d4"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 mrgnt15">
<section class="clearfix form-elements cb-uikit">
<header class="clearfix">
<h2 class="">Documentation</h2>
</header>
<div class="clearfix">
<h3 class="greycolor text_cent">Information About Plugin</h3>
<ul>
<li><strong>Last update:</strong> Jan, 2019</li>
<li><strong>Authors:</strong>Fahad abbas</li>
<li><strong>Author Website:</strong> http://clipbucket.com</li>
<li><strong>Version:</strong> 1.0</li>
<li><strong>ClipBucket Version:</strong> 4.2.x</li>
</ul>
</div>
<div class="clearfix" style="margin-bottom: 20px;">
<h3 class="greycolor text_cent">Why You Need Elastic Search module?</h3>
<p>To simply make website search more efficient for users. A full text search Engine which will make clipbucket's Search Experience a way better ! </p>
</div>
<div class="clearfix" style="margin-bottom: 20px;">
<span class="alert alert-info" style="margin-top: 50px;"><strong>Note : </strong> To Run this plugin make sure your elastic server is running up ! </span>
</div>

<div class="clearfix">
<div class="clearfix">
<h3>Indexer</h3>
<pre>Elastic Search Indexer helps you Index your Videos,Channels and Photos with Elastic Search Server.</pre>
<h4>Request</h4>
<pre>Update,Select,Delete,Add This menu lets you select the request type for Mapping and Indexing. <strong>`Update` </strong>is used to add and update both.</pre>
<h4>Type</h4>
<pre>This menu lets you decide wheather Map or Index, <strong>Note : Indexing is always done after Mapping.</strong> </pre>
<h4>Offset</h4>
<pre >It is used to specify the offset of the first row to be returned.</pre>
<h4>Count</h4>
<pre >It is used to specify the maximum number of rows to be returned. </pre>
<h4>Id</h4>
<pre>To Index Specific Id , it will ignore Offset and Count Parameter and it is only used while indexing.</pre>
<h4>Mode</h4>
<pre >This lets you decide between Videos,Channels and Photos.
</pre>
</div>
</div>
</section>
</div>
</div>


<style>
pre {
word-wrap: break-word;
padding: 6px 10px;
line-height: 4px;
margin-bottom: 20px;
width: 100%
}
.code{
font-family: Consolas,'Liberation Mono',Courier,monospace;
border: 1px solid #ccc;
color: #333;
background: #e4e4e4;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
border: 1px solid #ccc;
/*border: 1px solid #001;
width: auto*/
}
</style>


29 changes: 29 additions & 0 deletions upload/plugins/cb_elastic_search/admin/configure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/*
***************************************************************
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
| @ Author : ArslanHassan
| @ Software : ClipBucket , © PHPBucket.com
****************************************************************
*/

if(!defined('IN_CLIPBUCKET'))
exit('Invalid access');

$rows = array("elastic_server_ip");
if (isset($_POST['submit'])){
foreach($rows as $field){
$value = ($_POST[$field]);
if(in_array($field,$num_array)){
if($value <= 0 || !is_numeric($value)){
$value = 1;
}
}
$myquery->Set_Website_Details($field,$value);
}
}

$template = 'configure.html';
template_files($template,CB_ES_ADMIN_DIR);

?>
8 changes: 4 additions & 4 deletions upload/plugins/cb_elastic_search/admin/index_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<div class="col-md-2">
<label for="offset">Request</label>
<select class="form-control" name="method">
<option value="put" selected>PUT</option>
<option value="get">GET</option>
<option value="delete">DELETE</option>
<option value="post">POST</option>
<option value="put" selected>Update</option>
<option value="get">List</option>
<option value="delete">Delete</option>
<option value="post">Add</option>
</select>
</div>
<div class="col-md-2">
Expand Down
3 changes: 1 addition & 2 deletions upload/plugins/cb_elastic_search/elasticSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ class ElasticSearch
function __construct($index=false)
{

$this->apiUrl = $_SERVER["REQUEST_SCHEME"]."://".config('elastic_server_ip').":9200";

$this->apiUrl = config('elastic_server_ip');
$this->index = $index;
}

Expand Down
14 changes: 14 additions & 0 deletions upload/plugins/cb_elastic_search/elastic_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@

$Cbucket->links['search_result'] = array('module.php','module.php');

//fields required for search form
function elastic_mode_search() {
echo '<input type="hidden" name="s" value="elastic">';
echo '<input type="hidden" name="p" value="search">';
}


/*ini_set('display_errors', '-1');
error_reporting(E_ALL);*/
function is_es_server_running(){
return checkRemoteFile(config('elastic_server_ip'));
}

/*if (is_es_server_running()){
exit("YES");
}else{
exit("NO");
}*/

//Elastic Search Class
include "elasticSearch.php";

Expand All @@ -52,3 +65,4 @@ function elastic_mode_search() {
register_module('elastic_search',CB_ES_DIR.'/search.php');

add_admin_menu("Elastic Search","ES Indexer",'index_data.php',CB_ES.'/admin');
add_admin_menu("Elastic Search","Configure",'configure.php',CB_ES.'/admin');
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


$db->Execute("INSERT INTO ".tbl('config')." (`configid`, `name`, `value`) VALUES
(1, 'elastic_server_ip', 'localhost');");
(NULL, 'elastic_server_ip', 'localhost');");

?>
Empty file modified upload/plugins/cb_elastic_search/test.html
100644 → 100755
Empty file.

0 comments on commit 26eba46

Please sign in to comment.