# Basic Understandings

Before we move forward, there is a basic understanding that you must have. This will give you a much broader command about how the code is written, how its connected and how you can made your favorite changes.

## Languages, DB, Tools and Libraries

### PHP

Version 7.3, We intent to upgrade but not sure When

### MYSQL/MariaDB

We used Mysqli driver

### [Smarty Templating Engine](https://www.smarty.net/)

we use Smarty Templating Engine for PHP to render the template, there is no specific purpose, its just easy to carry the objects and keep the front end totally seperate.

### FFMPEG

We use FFMPEG for video conversion

### VideoJS Video Player

we use video JS for Video Player, previously it was JWPlayer then they went stupid.

### Other Stuff

No Rest API system At the moment...Uh oh.

{% hint style="info" %}
We have made Functions for each object in order to easy access them across the project for example

We have a user object user.class.php and its initiated as `$userquery`. To get a Userid we use this method

**`$userquery->udetails['userid'];`**

Then we wrote  a function in file functions\_users.php and now we can fetch userid as

`userid();`
{% endhint %}

All objects names and function names are following pattern

{object}.class.php and function&#x73;*{object}.class.php e.g users.class.php and functions\_userrs.php*

## Objects, Classes & Functions

Each Object or class is mentioned in the **includes/classes/** folder. We have following Major Objects, there are more but we will cover the basics.

### [videos.class.php](/fundamentals/basic-understandings/videos-class-and-functions.md)

This manages all the Operations related to the Videos, from Edit, Publishing and other important Stuff.&#x20;

### **actions.class.php**

For those methods that are common accross all objects e.g Add\_*to\_*&#x66;avorites is called in video, photos and groups so we use one class, re initate it in the object and call it e.g

in videoc.class.php we

```
$this->action = new cbactions();

then call this->action->add_to_Favorites
```

### **ads.class.php**

&#x20;For managing Ads System

### **caldate.class.php**

Honestly, this class does not even make sense anymore. It was for calculate dates.

### category.class.php

Category system is integral part of ClipBucket, we Extend the category system to all major objects. e.g CBVideo in video.class.php is extended from CBCategory.&#x20;

It manages the category system for all objects, we can even use on category system for multiple objects.

### cbemail.class.php

For sending emails and setting email templates.

### cbfeeds.class.php

ClipBucket has a built in Feeds system, this basically records all major activies of the users.

### cbpage.class.php

Found in the admin area, CBPage is a page management class

### ClipBucket.class.php

Core Class of ClipBucket, initiates and maintain all operations of ClipBucket

### collections.class.php

Advance Playlist system. Collections class is for Managing the collections across ClipBucket. Collections can be used as Playlists for videos while Albums for Photos and Music.

We create thsi class in each major object to use it as specific collection for example in video.class.php we created $this->collection = new Collections(); to assign a collection to a $vod object.

### [db.class.php](#db.class.php)

Database object class. Basically does very basic handling, nothing fancy. The good thing is all DB queries are went through this object so we can manipulate or log everything here.

### errorhandlers.class.php

Unlike the original PHP Error Handler, its just to log ClipBucket operations for example 'Invalid username & password' is an error, we log using this object

### form.class.php

Its one of the classic forms class of ClipBucket, this basically takes an array and returns a fully fledged HTML Form element. I request you to read it throughly, experiment with it before using it.

This acctually helped us achieve dynamic form fields for signup and upload. which, in future we are dumping and replacing with json forms.

### gravatar.class.php

Just as the name suggests

### groups.class.php

For managing all operations related to the groups system in ClipBucket, Groups system is similar to the FB groups but .. a very small part of it.

### lang.class.php

Language manegement system

### log.class.php

Unlike the name, its basically an activity recorder and Records and manages all activities related to any object. This Object is re-initiated in all major objects e.g videos, photos, etc. We store all activities in actions table.&#x20;

### mass\_upload.class.php

This class was used to handle multiple videos at once

### menuhandler.class.php

For creating front end and backend menus include Admin Area Menu

### my\_queries.class.php

In earlier versions of ClipBucket, there were no seperate classes, so myquery class was used. now its a stalled.

### objects.class.php

For small Objects to display e.g list of template with a dropdown. You can say 'widgets' in other terms

### pages.class.php

Dont confuse it with CBPages, pages.class.php is actually used for Pagination and creating links.

### photos.class.php

This is for managing photos operations

### player.class.php

for player operations, like changing height, which player to use etc.

### playlist.class.php

Collections should have been used but in earlier version playlist was used. we intended to replace it but we didnt so playlist still exists and is current linked to videos only.

### plugin.class.php

THe magical Plguins class for manaing plugins

### pm.class.php

Pm is for Private Messaging, yes ClipBucket also offers that.

### reindex.class.php

For Re-indexing the data such as No for videos of a user tc..

### search.class.php

Search object is re initiated in each object to setup its search functionality just like actions and collections.

e.g in videos.class.php -> init\_search function

```
$this->search = new cbsearch;
```

and $vdo->search->search() will return the results

### session.class.php

For handling sessions ... and cookies

### [template.class.php](/fundamentals/basic-understandings/template-class-and-functions.md)

for managing the template system of ClipBucket

### upload.class.php

For handling the video uploading, however..it was stupid to have one seperate class.

### [user.class.php](/fundamentals/basic-understandings/user-class-and-functions.md)

for handlng alll user related operations

### [video.class.php](/fundamentals/basic-understandings/videos-class-and-functions.md)

For handling videos operations

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clipbucket.com/fundamentals/basic-understandings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
