### Dockerfile Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/dockerfile/index.html A sample Dockerfile demonstrating the installation of the Ghost blogging platform and the setup of a development environment. This snippet illustrates common Dockerfile instructions. ```dockerfile # Install Ghost blogging platform and run development environment # # VERSION 1.0.0 FROM ubuntu:12.10 MAINTAINER Amer Grgic "amer@livebyt.es" WORKDIR /data/ghost # Install dependencies for nginx installation RUN apt-get update RUN apt-get install -y python g++ make software-properties-common --force-yes RUN add-apt-repository ppa:chris-lea/node.js RUN apt-get update # Install unzip RUN apt-get install -y unzip # Install curl RUN apt-get install -y curl # Install nodejs & npm RUN apt-get install -y rlwrap RUN apt-get install -y nodejs # Download Ghost v0.4.1 RUN curl -L https://ghost.org/zip/ghost-latest.zip -o /tmp/ghost.zip # Unzip Ghost zip to /data/ghost RUN unzip -uo /tmp/ghost.zip -d /data/ghost # Add custom config js to /data/ghost ADD ./config.example.js /data/ghost/config.js # Install Ghost with NPM RUN cd /data/ghost/ && npm install --production # Expose port 2368 EXPOSE 2368 # Run Ghost CMD ["npm","start"] ``` -------------------------------- ### Configure and Start ADODB Session with Non-Persistent Connection Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-session.htm Use this example to configure ADODB session handling and start a session with non-persistent connections. Ensure the session handler file is included before configuration. ```php include_once("adodb/session/adodb-session2.php"); $driver = 'mysql'; $host = 'localhost'; $user = 'auser'; $pwd = 'secret'; $database = 'sessiondb'; ADOdb_Session::config($driver, $host, $user, $password, $database, $options=false); ADOdb_session::Persist($connectMode=false); session_start(); ``` -------------------------------- ### getinfo Method Example Request Source: https://github.com/vtecrm/vtenext/blob/main/include/ckeditor/filemanager/ReadMe.txt An example HTTP GET request to the connector for the 'getinfo' mode, specifying the file path and requesting file size. ```http [path to connector]?mode=getinfo&path=/UserFiles/Image/logo.png&getsize=true ``` -------------------------------- ### Shell Script Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/shell/index.html This snippet demonstrates a typical shell script for cloning a repository, generating HTTPS credentials, and starting a server. It also includes commands to stop the server. ```shell #!/bin/bash # clone the repository git clone http://github.com/garden/tree # generate HTTPS credentials cd tree openssl genrsa -aes256 -out https.key 1024 openssl req -new -nodes -key https.key -out https.csr openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt cp https.key{,.orig} openssl rsa -in https.key.orig -out https.key # start the server in HTTPS mode cd web sudo node ../server.js 443 'yes' >> ../node.log & # here is how to stop the server for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do sudo kill -9 $pid 2> /dev/null done exit 0 ``` -------------------------------- ### Global Cron Setup Example Source: https://github.com/vtecrm/vtenext/blob/main/cron/README-NewCronServiceSetup.txt Example of how to add the VTE cron script to the system's crontab file. Ensure the paths and user are correct for your system. ```bash */1 * * * * root /var/www/vte_root/cron/RunCron.sh >> /var/www/vte_root/logs/cron.log 2>&1 ``` -------------------------------- ### Puppet Module Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/puppet/index.html An example of a Puppet module for installing and configuring AutoMySQLBackup. This demonstrates class definition, parameter inheritance, and resource declaration within Puppet. ```puppet # == Class: automysqlbackup # # Puppet module to install AutoMySQLBackup for periodic MySQL backups. # # class { # 'automysqlbackup': # backup_dir => '/mnt/backups', # } # class automysqlbackup ( $bin_dir = $automysqlbackup::params::bin_dir, $etc_dir = $automysqlbackup::params::etc_dir, $backup_dir = $automysqlbackup::params::backup_dir, $install_multicore = undef, $config = {}, $config_defaults = {}, ) inherits automysqlbackup::params { # Ensure valid paths are assigned validate_absolute_path($bin_dir) validate_absolute_path($etc_dir) validate_absolute_path($backup_dir) # Create a subdirectory in /etc for config files file { $etc_dir: ensure => directory, owner => 'root', group => 'root', mode => '0750', } # Create an example backup file, useful for reference file { "${etc_dir}/automysqlbackup.conf.example": ensure => file, owner => 'root', group => 'root', mode => '0660', source => 'puppet:///modules/automysqlbackup/automysqlbackup.conf', } # Add files from the developer file { "${etc_dir}/AMB_README": source => 'puppet:///modules/automysqlbackup/AMB_README', } file { "${etc_dir}/AMB_LICENSE": source => 'puppet:///modules/automysqlbackup/AMB_LICENSE', } # Install the actual binary file file { "${bin_dir}/automysqlbackup": ensure => file, owner => 'root', group => 'root', mode => '0755', source => 'puppet:///modules/automysqlbackup/automysqlbackup', } # Create the base backup directory file { $backup_dir: ensure => directory, owner => 'root', group => 'root', mode => '0755', } # If you'd like to keep your config in hiera and pass it to this class if !empty($config) { create_resources('automysqlbackup::backup', $config, $config_defaults) } # If using RedHat family, must have the RPMforge repo's enabled if $install_multicore { package { ['pigz', 'pbzip2']: ensure => installed } } } ``` -------------------------------- ### Install php-amqplib with Composer Source: https://github.com/vtecrm/vtenext/blob/main/vendor/videlalvaro/php-amqplib/README.md Install the library using Composer. This command fetches the library and its dependencies. ```bash $ composer require php-amqplib/php-amqplib ``` -------------------------------- ### Default Session Setup Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-session.old.htm Basic setup for default ADODB session management. Ensure adodb.inc.php and adodb-session.php are included and session variables are started. ```php include('adodb/adodb.inc.php'); $ADODB_SESSION_DRIVER='mysql'; $ADODB_SESSION_CONNECT='localhost'; $ADODB_SESSION_USER ='scott'; $ADODB_SESSION_PWD ='tiger'; $ADODB_SESSION_DB ='sessiondb'; include('adodb/session/adodb-session.php'); session_start(); # # Test session vars, the following should increment on refresh # $_SESSION['AVAR'] += 1; print "

\$\_SESSION['AVAR']={\$\_SESSION['AVAR']}

"; ``` -------------------------------- ### Install league/oauth2-client via Composer Source: https://github.com/vtecrm/vtenext/blob/main/vendor/league/oauth2-client/README.md This command installs the league/oauth2-client library using Composer. Ensure you have Composer installed and configured in your project. ```bash $composer require league/oauth2-client ``` -------------------------------- ### Start Transaction and Complete Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Shows how to start a transaction and then complete it, implying a commit if no errors occur. ```php $db->StartTrans(); $db->Execute(...); $db->Execute(...); $db->CompleteTrans(); ``` -------------------------------- ### Get Folder Response Example Source: https://github.com/vtecrm/vtenext/blob/main/include/ckeditor/filemanager/ReadMe.txt Example response structure for the getfolder method, showing file properties. ```JSON [ "/UserFiles/Image/logo.png" = { Path: "/UserFiles/Image/logo.png", Filename: "logo.png", File Type: "png", Preview: "/UserFiles/Image/logo.png", Properties: { Date Created: null, Date Modified: "02/09/2007 14:01:06", Height: 14, Width: 14, Size: 384 }, Error: "", Code: 0 }, "/UserFiles/Image/icon.png" = { Path: "/UserFiles/Image/icon.png", Filename: "icon.png", File Type: "png", Preview: "/UserFiles/Image/icon.png", Properties: { Date Created: null, Date Modified: "02/09/2007 14:01:06", Height: 14, Width: 14, Size: 384 }, Error: "", Code: 0 } ] ``` -------------------------------- ### Install HubSpot PHP Client Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/vendor/hubspot/hubspot-php/README.md Install the HubSpot PHP client library using Composer. ```bash composer require "hubspot/hubspot-php" ``` -------------------------------- ### Install Dependencies Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/vendor/hubspot/hubspot-php/CONTRIBUTING.md Install project dependencies using Composer. ```bash composer install ``` -------------------------------- ### Basic ADOdb Connection Example Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-datadict.htm A simplified example of creating an ADOdb connection with specific host, user, password, and database. ```php $db = ADONewConnection( 'mysql' ); $db->Connect( 'host', 'user', 'password', 'database' ); ``` -------------------------------- ### Install getallheaders for PHP < 5.6 Source: https://github.com/vtecrm/vtenext/blob/main/vendor/ralouphie/getallheaders/README.md Use this command to install the library for PHP versions older than 5.6. ```bash composer require ralouphie/getallheaders "^2" ``` -------------------------------- ### Install Salesforce OAuth2 Provider Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/vendor/stevenmaguire/oauth2-salesforce/README.md Install the package using Composer. ```bash composer require stevenmaguire/oauth2-salesforce ``` -------------------------------- ### Install phpseclib 1.0 via PEAR Source: https://github.com/vtecrm/vtenext/blob/main/vendor/phpseclib/phpseclib/README.md Instructions for installing phpseclib version 1.0 using the PEAR package manager. ```sh See phpseclib PEAR Channel Documentation ``` -------------------------------- ### Gas Mode Syntax Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/gas/index.html An example demonstrating the syntax highlighting for Gas mode, including multi-line and single-line comments, directives, labels, and string literals. This example showcases the basic structure and elements recognized by the Gas mode. ```gas .syntax unified .global main /* * A * multi-line * comment. */ @ A single line comment. main: push {sp, lr} ldr r0, =message bl puts mov r0, #0 pop {sp, pc} message: .asciz "Hello world!
" ``` -------------------------------- ### Install PHP Option with Composer Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/VteSyncLib/src/Connector/Jira/vendor/phpoption/phpoption/README.md Install the phpoption library using Composer by adding it to your composer.json file or running the command. ```bash composer require phpoption/phpoption ``` -------------------------------- ### Basic Active Record Setup and Usage Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-active-record.htm Demonstrates the initial setup of ADOdb Active Record, including database connection, table creation, and basic record manipulation (save, load). ```php include('../adodb.inc.php'); include('../adodb-active-record.inc.php'); // uncomment the following if you want to test exceptions #if (PHP_VERSION >= 5) include('../adodb-exceptions.inc.php'); $db = NewADOConnection('mysql://root@localhost/northwind'); $db->debug=1; ADOdb_Active_Record::SetDatabaseAdapter($db); $db->Execute("CREATE TEMPORARY TABLE `persons` ( `id` int(10) unsigned NOT NULL auto_increment, `name_first` varchar(100) NOT NULL default '', `name_last` varchar(100) NOT NULL default '', `favorite_color` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM; "); class person extends ADOdb_Active_Record{} $person = new person(); echo "

Output of getAttributeNames: "; var_dump($person->getAttributeNames()); $person = new person(); $person->name_first = 'Andi'; $person->name_last = 'Gutmans'; $person->save(); // this save() will fail on INSERT as favorite_color is a must fill... $person = new person(); $person->name_first = 'Andi'; $person->name_last = 'Gutmans'; $person->favorite_color = 'blue'; $person->save(); // this save will perform an INSERT successfully echo "

The Insert ID generated:"; print_r($person->id); $person->favorite_color = 'red'; $person->save(); // this save() will perform an UPDATE $person = new person(); $person->name_first = 'John'; $person->name_last = 'Lim'; $person->favorite_color = 'lavender'; $person->save(); // this save will perform an INSERT successfully // load record where id=2 into a new ADOdb_Active_Record $person2 = new person(); $person2->Load('id=2'); var_dump($person2); // retrieve an array of records $activeArr = $db->GetActiveRecordsClass($class = "person",$table = "persons","id=".$db->Param(0),array(2)); $person2 = $activeArr[0]; echo "

Name first (should be John): ",$person->name_first, "
Class = ",get_class($person2); ``` -------------------------------- ### Set up Materialize Documentation Locally Source: https://github.com/vtecrm/vtenext/blob/main/themes/next/scss/materialize/README.md Commands to clone the Materialize repository, install dependencies, and prepare the documentation for local viewing. ```bash git clone https://github.com/Dogfalo/materialize cd materialize npm install ``` -------------------------------- ### CreateSequence Example Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Creates a database sequence with a specified name and starting ID. The next call to GenID() will use this starting ID. ```php $conn->CreateSequence('my_sequence', 100); ``` -------------------------------- ### ADOdb StartTrans Example Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Demonstrates the initiation of a monitored transaction in ADOdb. ```php $db->StartTrans(); ``` -------------------------------- ### Connect to Database and Fetch Rows Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/readme.htm Demonstrates how to establish a database connection using ADONewConnection, set debug mode, connect to the server, execute a query, and retrieve all rows from the result set. Customize connection settings and driver as needed. ```php debug = true; $db->**Connect**($server, $user, $password, $database); $rs = $db->**Execute**('select * from some_small_table'); print "

";
print_r($rs->**GetRows**());
print "
"; ?> ``` -------------------------------- ### Get All Contacts Endpoint Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/vendor/hubspot/hubspot-php/CONTRIBUTING.md Example of a method to retrieve all contacts for a portal. It handles pagination using 'vid-offset' and 'has-more' fields. ```php /** * For a given portal, return all contacts that have been created in the portal. * * A paginated list of contacts will be returned to you, with a maximum of 100 contacts per page. * * Please Note: There are 2 fields here to pay close attention to: the "has-more" field that will let you know * whether there are more contacts that you can pull from this portal, and the "vid-offset" field which will let * you know where you are in the list of contacts. You can then use the "vid-offset" field in the "vidOffset" * parameter described below. * * @see http://developers.hubspot.com/docs/methods/contacts/get_contacts * * @param array $params Array of optional parameters ['count', 'property', 'vidOffset'] * @return \SevenShores\Hubspot\Http\Response */ function all($params = []) { $endpoint = "https://api.hubapi.com/contacts/v1/lists/all/contacts/all"; $queryString = build_query_string($params); return $this->client->request('get', $endpoint, [], $queryString); } ``` -------------------------------- ### Stylus Syntax Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/stylus/index.html Demonstrates basic Stylus syntax including selectors, properties, variables, and mixins. ```stylus /* Stylus mode */ #id .class article font-family: Arial, sans-serif #id, .class, article { font-family: Arial, sans-serif } // Variables font-size-base = 16px line-height-base = 1.5 font-family-base = "Helvetica Neue", Helvetica, Arial, sans-serif text-color = lighten(#000, 20%) body { font: 400 16px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif color: #333 } // Variables link-color = darken(#428bca, 6.5%) link-hover-color = darken(link-color, 15%) link-decoration = none link-hover-decoration = false // Mixin tab-focus() { outline: thin dotted outline: 5px auto -webkit-focus-ring-color outline-offset: -2px } a { color: link-color if link-decoration { text-decoration: link-decoration } &:hover, &:focus { color: link-hover-color } &:focus { tab-focus() } } a:hover, a:focus { color: #2f6ea7 } a:focus { outline: thin dotted outline: 5px auto -webkit-focus-ring-color outline-offset: -2px } ``` -------------------------------- ### Get Jira Issue Worklogs Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/VteSyncLib/src/Connector/Jira/vendor/lesstif/php-jira-rest-client/README.md Provides examples for retrieving all worklogs associated with a Jira issue and for fetching a specific worklog by its ID. ```php getWorklog($issueKey)->getWorklogs(); var_dump($worklogs); // get worklog by id $wlId = 12345; $wl = $issueService->getWorklogById($issueKey, $wlId); var_dump($wl); } catch (JiraException $e) { $this->assertTrue(false, 'testSearch Failed : '.$e->getMessage()); } ``` -------------------------------- ### Basic Database Connection and Query Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Demonstrates how to connect to a database, set debugging, execute a query, and fetch results. Ensure PHP 4.0.5 or later is installed and connection settings are customized. ```php debug = true; $db->Connect($server, $user, $password, $database); $rs = $db->Execute('select * from some_small_table'); print "
"; 
print_r($rs->GetRows()); 
print "
"; ?> ``` -------------------------------- ### SelectLimit with offset to get last rows Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Retrieves rows starting from a specific offset to the end of the result set. Useful for pagination. ```php $connection->SelectLimit('SELECT * FROM TABLE',-1,10) ``` -------------------------------- ### Add Worklog to Jira Issue (API V2) Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/VteSyncLib/src/Connector/Jira/vendor/lesstif/php-jira-rest-client/README.md Example of adding a worklog entry to a Jira issue using the V2 API. Requires setting comment, start date, and time spent. ```php setComment('I did some work here.') ->setStarted("2016-05-28 12:35:54") ->setTimeSpent('1d 2h 3m'); $issueService = new IssueService(); $ret = $issueService->addWorklog($issueKey, $workLog); $workLogid = $ret->{'idържа'; var_dump($ret); } catch (JiraException $e) { $this->assertTrue(false, 'Create Failed : '.$e->getMessage()); } ``` -------------------------------- ### Paginate Through All Contacts Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/vendor/hubspot/hubspot-php/README.md Retrieve a paginated list of contacts, specifying the number of results, desired properties, and an offset. This example retrieves 10 contacts, only their first and last names, starting from a specific offset. ```php $response = $hubspot->contacts()->all([ 'count' => 10, 'property' => ['firstname', 'lastname'], 'vidOffset' => 123456, ]); ``` -------------------------------- ### Basic Prepared Statement Execution Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Demonstrates preparing and executing a simple SQL statement with parameter binding. ```php $sql = "insert into table (col1,col2) values (:a,:b)"; $stmt = $DB->Prepare($sql); $stmt = $DB->Execute($stmt,array('one','two')); ``` -------------------------------- ### Composer Install Command Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/VteSyncLib/src/Connector/Jira/vendor/lesstif/php-jira-rest-client/README.md Runs Composer's install command to finalize the installation. ```sh php composer.phar install ``` -------------------------------- ### Install Smarty Development Wrapper Source: https://github.com/vtecrm/vtenext/blob/main/gdpr/include/smarty/README.md Install a wrapper package that installs all three Smarty development packages (core, phpunit, lexer/parser) for version 3.1.19. ```json "require": { "smarty/smarty-dev": "3.1.19" } ``` -------------------------------- ### Module Installation Logic Source: https://github.com/vtecrm/vtenext/blob/main/modules/Settings/ModuleMaker/templates/install.php.txt Core logic for installing a new module, including saving, event triggering, webservice initialization, and default sharing. ```PHP $tabid = $newModule->save(); if (empty($tabid)) throw new InstallException("Unable to install the module properly"); // trigger events Vtecrm_Module::fireEvent($newModule->name, Vtecrm_Module::EVENT_MODULE_POSTINSTALL); // initialize webservice Vtecrm_Webservice::initialize($newModule); // set Default sharing $newModule->setDefaultSharing($module_default_sharing ?: 'Private'); // add it to the menu $menuInstance = Vtecrm_Menu::getInstance('Tools'); $menuInstance->addModule($newModule); ``` -------------------------------- ### Basic Table and Index Creation Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-datadict.htm Demonstrates creating a table with three fields and then creating indexes on those fields using ADOdb's Data Dictionary. ```php include_once('adodb.inc.php'); # First create a normal connection $db = NewADOConnection('mysql'); $db->Connect(...); # Then create a data dictionary object, using this connection $dict = NewDataDictionary($db); # We have a portable declarative data dictionary format in ADOdb, similar to SQL. # Field types use 1 character codes, and fields are separated by commas. # The following example creates three fields: "col1", "col2" and "col3": $flds = " col1 C(32) NOTNULL DEFAULT 'abc', col2 I DEFAULT 0, col3 N(12.2) "; # We demonstrate creating tables and indexes $sqlarray = $dict->CreateTableSQL($tabname, $flds, $taboptarray); $dict->ExecuteSQLArray($sqlarray); $idxflds = 'co11, col2'; $sqlarray = $dict->CreateIndexSQL($idxname, $tabname, $idxflds); $dict->ExecuteSQLArray($sqlarray); ``` -------------------------------- ### LiveScript Prelude Installation Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/livescript/index.html A meta-function to install the LiveScript prelude onto a target object if it doesn't already have one. It checks for `target.prelude.isInstalled` before proceeding. ```livescript export installPrelude = !(target) -> unless target.prelude?isInstalled target <<< out$ # using out$ generated by livescript target <<< target.prelude.isInstalled = true export prelude = out$ ``` -------------------------------- ### XML Service Description Example Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/vendor/guzzlehttp/guzzle/UPGRADING.md This is an example of an XML service description before conversion. ```xml Get a list of groups Uses a search query to get a list of groups Create a group Delete a group by ID Update a group ``` -------------------------------- ### Asterisk Dialplan Configuration Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/asterisk/index.html A sample configuration snippet for extensions.conf, demonstrating various dialplan contexts, extensions, and commands. ```asterisk ; extensions.conf - the Asterisk dial plan ; ; If static is set to no, or omitted, then the pbx_config will rewrite ; this file when extensions are modified. Remember that all comments ; made in the file will be lost when that happens. static=yes #include "/etc/asterisk/additional_general.conf" [iaxprovider] switch => IAX2/user:[key]@myserver/mycontext [dynamic] #exec /usr/bin/dynamic-peers.pl [trunkint] ; ; International long distance through trunk ; exten => _9011.,1,Macro(dundi-e164,${EXTEN:4}) exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})}) [local] ; ; Master context for local, toll-free, and iaxtel calls only ; ignorepat => 9 include => default [demo] include => stdexten ; ; We start with what to do when a call first comes in. ; exten => s,1,Wait(1) ; Wait a second, just for fun same => n,Answer ; Answer the line same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message same => n(instruct),BackGround(demo-instruct) ; Play some instructions same => n,WaitExten ; Wait for an extension to be dialed. exten => 2,1,BackGround(demo-moreinfo) ; Give some more information. exten => 2,n,Goto(s,instruct) exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french exten => 3,n,Goto(s,restart) ; Start with the congratulations exten => 1000,1,Goto(default,s,1) ; ; ; We also create an example user, 1234, who is on the console and has ; voicemail, etc. ; exten => 1234,1,Playback(transfer,skip) ; "Please hold while..." ; (but skip if channel is not up) exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)})) exten => 1234,n,Goto(default,s,1) ; exited Voicemail exten => 1235,1,Voicemail(1234,u) ; Right to voicemail exten => 1236,1,Dial(Console/dsp) ; Ring forever exten => 1236,n,Voicemail(1234,b) ; Unless busy ; ; # for when they're done with the demo ; exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo" exten => #,n,Hangup ; Hang them up. ; ; A timeout and "invalid extension rule" ; exten => t,1,Goto(#,1) ; If they take too long, give up exten => i,1,Playback(invalid) ; "That's not valid, try again" ; ; Create an extension, 500, for dialing the ; Asterisk demo. ; exten => 500,1,Playback(demo-abouttotry); Let them know what's going on exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site exten => 500,n,Goto(s,6) ; Return to the start over message. ; ; Create an extension, 600, for evaluating echo latency. ; exten => 600,1,Playback(demo-echotest) ; Let them know what's going on exten => 600,n,Echo ; Do the echo test exten => 600,n,Playback(demo-echodone) ; Let them know it's over exten => 600,n,Goto(s,6) ; Start over ; ; You can use the Macro Page to intercom a individual user exten => 76245,1,Macro(page,SIP/Grandstream1) ; or if your peernames are the same as extensions exten => _7XXX,1,Macro(page,SIP/${EXTEN}) ; ; System Wide Page at extension 7999 ; exten => 7999,1,Set(TIMEOUT(absolute)=60) exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n) ; Give voicemail at extension 8500 ; exten => 8500,1,VoicemailMain exten => 8500,n,Goto(s,6) ``` -------------------------------- ### Install Composer Source: https://github.com/vtecrm/vtenext/blob/main/vendor/guzzlehttp/guzzle/README.md This snippet shows the command to download and install the Composer dependency manager. ```bash curl -sS https://getcomposer.org/installer | php ``` -------------------------------- ### ADOdb GetInsertSQL Example Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Example of generating an SQL INSERT statement using GetInsertSQL. ```php // Example usage for GetInsertSQL (requires a recordset $rs or table name) // $sql = GetInsertSQL($rs, $arrFields); ``` -------------------------------- ### Use Core Classes Source: https://github.com/vtecrm/vtenext/blob/main/vendor/videlalvaro/php-amqplib/README.md Import the necessary classes for establishing a connection and creating messages. ```php use PhpAmqpLib\Connection\AMQPStreamConnection; use PhpAmqpLib\Message\AMQPMessage; ``` -------------------------------- ### ADOdb GetUpdateSQL Example Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Example of generating an SQL UPDATE statement using GetUpdateSQL. ```php // Example usage for GetUpdateSQL (requires a recordset $rs) // $sql = GetUpdateSQL($rs, $arrFields); ``` -------------------------------- ### Turtle RDF Data Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/turtle/index.html An example of data formatted in the Turtle RDF syntax. ```turtle @prefix foaf: . @prefix geo: . @prefix rdf: . a foaf:Person; foaf:interest ; foaf:based_near [ geo:lat "34.0736111" ; geo:lon "-118.3994444" ] ``` -------------------------------- ### Pascal Syntax Examples Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/pascal/index.html Demonstrates basic Pascal control flow structures including while, if-else, for, repeat-until, and case statements. ```pascal while a <> b do writeln('Waiting'); if a > b then writeln('Condition met') else writeln('Condition not met'); for i := 1 to 10 do writeln('Iteration: ', i:1); repeat a := a + 1 until a = 10; case i of 0: write('zero'); 1: write('one'); 2: write('two') end; ``` -------------------------------- ### Jinja2 Syntax Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/jinja2/index.html Demonstrates various Jinja2 template syntax elements including comments, loops, conditional expressions, function calls, includes, and path generation. ```html {# this is a comment #} {%- for item in li -%}
  • {{ item.label }}
  • {% endfor -%} {{ item.sand == true and item.keyword == false ? 1 : 0 }} {{ app.get(55, 1.2, true) }} {% if app.get('_route') == ('_home') %}home{% endif %} {% if app.session.flashbag.has('message') %} {% for message in app.session.flashbag.get('message') %} {{ message.content }} {% endfor %} {% endif %} {{ path('_home', {'section': app.request.get('section')}) }} {{ path('_home', { 'section': app.request.get('section'), 'boolean': true, 'number': 55.33 }) }} {% include ('test.incl.html.twig') %} ``` -------------------------------- ### LDAP Connection and Query Example Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/docs-adodb.htm Connect to an LDAP server, set connection options, and execute queries. Requires ADOdb to be included. ```php require('/path/to/adodb.inc.php'); $LDAP_CONNECT_OPTIONS = Array( Array ("OPTION_NAME"=>LDAP_OPT_DEREF, "OPTION_VALUE"=>2), Array ("OPTION_NAME"=>LDAP_OPT_SIZELIMIT,"OPTION_VALUE"=>100), Array ("OPTION_NAME"=>LDAP_OPT_TIMELIMIT,"OPTION_VALUE"=>30), Array ("OPTION_NAME"=>LDAP_OPT_PROTOCOL_VERSION,"OPTION_VALUE"=>3), Array ("OPTION_NAME"=>LDAP_OPT_ERROR_NUMBER,"OPTION_VALUE"=>13), Array ("OPTION_NAME"=>LDAP_OPT_REFERRALS,"OPTION_VALUE"=>FALSE), Array ("OPTION_NAME"=>LDAP_OPT_RESTART,"OPTION_VALUE"=>FALSE) ); $host = 'ldap.baylor.edu'; $ldapbase = 'ou=People,o=Baylor University,c=US'; $ldap = NewADOConnection( 'ldap' ); $ldap->Connect( $host, $user_name='', $password='', $ldapbase ); echo "
    ";
    print_r( $ldap->ServerInfo() );
    
    $ldap->SetFetchMode(ADODB_FETCH_ASSOC);
    $userName = 'eldridge';
    $filter="(|(CN=$userName")(sn=$userName")(givenname=$userName")(uid=$userName*))";
    
    $rs = $ldap->Execute( $filter );
    if ($rs)
    		while ($arr = $rs->FetchRow()) {
    			 print_r($arr);		
    		}
    
    $rs = $ldap->Execute( $filter );
    if ($rs) 
    		while (!$rs->EOF) {
     				print_r($rs->fields);	 
    				$rs->MoveNext();
    		}
    
    print_r( $ldap->GetArray( $filter ) );
    print_r( $ldap->GetRow( $filter ) );
    
    $ldap->Close();
    echo "
    "; ``` -------------------------------- ### Install PSR Log via Composer Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/VteSyncLib/src/Connector/Jira/vendor/psr/log/README.md Install the PSR log package using Composer. ```bash composer require psr/log ``` -------------------------------- ### getinfo Method Example Response Source: https://github.com/vtecrm/vtenext/blob/main/include/ckeditor/filemanager/ReadMe.txt An example JSON response for the 'getinfo' method, providing details about a file including its path, type, preview, and properties like creation date, modification date, height, width, and size. ```json { Path: "/UserFiles/Image/logo.png", Filename: "logo.png", "File Type": "png", Preview: "/UserFiles/Image/logo.png", Properties: { "Date Created": null, "Date Modified": "02/09/2007 14:01:06", Height: 14, Width: 14, Size: 384 }, Error: "", Code: 0 } ``` -------------------------------- ### Install Smarty Lexer/Parser Generator Source: https://github.com/vtecrm/vtenext/blob/main/gdpr/include/smarty/README.md Install the Smarty 3.1.19 lexer/parser generator via Composer. ```json "require": { "smarty/smarty-lexer": "3.1.19" } ``` -------------------------------- ### XQuery Basic Syntax and Comments Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/xquery/index.html Demonstrates basic XQuery syntax, including version declaration, comments, let bindings, and element construction. ```xquery xquery version "1.0-ml"; (: this is : a "comment" :) let $let := "test"function() $var {function()} {$var} let $joe:=1 return element element { attribute attribute { 1 }, element test { 'a' }, attribute foo { "bar" }, fn:doc() [ foo/@bar eq $let ], //x } (: a more 'evil' test :) ``` -------------------------------- ### Solr Query Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/solr/index.html An example of a Solr query demonstrating various search operators and filters. ```solr author:Camus title:"The Rebel" and author:Camus philosophy:Existentialism -author:Kierkegaard hardToSpell:Dostoevsky~ published:[194* TO 1960] and author:(Sartre or "Simone de Beauvoir") ``` -------------------------------- ### Get Configuration Directory Source: https://github.com/vtecrm/vtenext/blob/main/gdpr/include/smarty/SMARTY_3.1_NOTES.txt Retrieves the configuration directory. Can specify an index to get a specific directory. ```php array|string getConfigDir( [string $index] ) ``` -------------------------------- ### Get Template Directory Source: https://github.com/vtecrm/vtenext/blob/main/gdpr/include/smarty/SMARTY_3.1_NOTES.txt Retrieves the template directory. Can specify an index to get a specific directory. ```php array|string getTemplateDir( [string $index] ) ``` -------------------------------- ### ADODB Connection Initialization Source: https://github.com/vtecrm/vtenext/blob/main/adodb/docs/tute.htm This snippet shows the initial steps for connecting to a database using ADODB. It includes the necessary include file and the creation of a database connection object, specifying the database driver. ```php **include("adodb.inc.php");** $db = **NewADOConnection**('mysql'); $db->**Connect**("localhost", "root", "password", "mydb"); ``` -------------------------------- ### Properties File Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/properties/index.html A sample properties file demonstrating comments, key-value pairs, multi-line values, and Unicode characters. This format is recognized by the text/x-properties and text/x-ini MIME types. ```properties # This is a properties file a.key = A value another.key = http://example.com ! Exclamation mark as comment but.not=Within ! A value # indeed # Spaces at the beginning of a line spaces.before.key=value backslash=Used for multi\ line entries,\ that's convenient. # Unicode sequences unicode.key=This is \u0020 Unicode no.multiline=here # Colons colons : can be used too # Spaces spaces\ in\ keys=Not very common... ``` -------------------------------- ### Install Materialize CSS with Atmosphere Source: https://github.com/vtecrm/vtenext/blob/main/themes/next/scss/materialize/README.md Install the Materialize CSS framework for Meteor projects using Atmosphere. ```bash meteor add materialize:materialize ``` -------------------------------- ### Kotlin Server HTTP Example Source: https://github.com/vtecrm/vtenext/blob/main/include/js/codemirror/mode/kotlin/index.html An example of a Kotlin HTTP server implementation using Netty, demonstrating server bootstrap and lifecycle management. ```kotlin package org.wasabi.http import java.util.concurrent.Executors import java.net.InetSocketAddress import org.wasabi.app.AppConfiguration import io.netty.bootstrap.ServerBootstrap import io.netty.channel.nio.NioEventLoopGroup import io.netty.channel.socket.nio.NioServerSocketChannel import org.wasabi.app.AppServer public class HttpServer(private val appServer: AppServer) { val bootstrap: ServerBootstrap val primaryGroup: NioEventLoopGroup val workerGroup: NioEventLoopGroup init { // Define worker groups primaryGroup = NioEventLoopGroup() workerGroup = NioEventLoopGroup() // Initialize bootstrap of server bootstrap = ServerBootstrap() bootstrap.group(primaryGroup, workerGroup) bootstrap.channel(javaClass()) bootstrap.childHandler(NettyPipelineInitializer(appServer)) } public fun start(wait: Boolean = true) { val channel = bootstrap.bind(appServer.configuration.port)?.sync()?.channel() if (wait) { channel?.closeFuture()?.sync() } } public fun stop() { // Shutdown all event loops primaryGroup.shutdownGracefully() workerGroup.shutdownGracefully() // Wait till all threads are terminated primaryGroup.terminationFuture().sync() workerGroup.terminationFuture().sync() } } ``` -------------------------------- ### Install Materialize CSS with Bower Source: https://github.com/vtecrm/vtenext/blob/main/themes/next/scss/materialize/README.md Install the Materialize CSS framework using Bower for project integration. ```bash bower install materialize ``` -------------------------------- ### Jira Configuration via .env file Source: https://github.com/vtecrm/vtenext/blob/main/modules/VteSync/VteSyncLib/src/Connector/Jira/vendor/lesstif/php-jira-rest-client/README.md Example .env file content for configuring Jira connection details, including host, user, and password/API token. ```dotenv JIRA_HOST="https://your-jira.host.com" JIRA_USER="jira-username" JIRA_PASS="jira-password-OR-api-token" # to enable session cookie authorization # COOKIE_AUTH_ENABLED=true # COOKIE_FILE=storage/jira-cookie.txt # if you are behind a proxy, add proxy settings PROXY_SERVER="your-proxy-server" PROXY_PORT="proxy-port" PROXY_USER="proxy-username" PROXY_PASSWORD="proxy-password" JIRA_REST_API_V3=false ``` -------------------------------- ### Install Materialize CSS with npm Source: https://github.com/vtecrm/vtenext/blob/main/themes/next/scss/materialize/README.md Install the Materialize CSS framework using npm for project integration. ```bash npm install materialize-css ```