Skip to content

Instantly share code, notes, and snippets.

View Shnoulle's full-sized avatar
🏠
Working from home

Denis Chenu Shnoulle

🏠
Working from home
View GitHub Profile
@Shnoulle
Shnoulle / sql_import_class.php
Created May 11, 2023 09:12 — forked from nmcgann/sql_import_class.php
PHP SQL Import Class to read an SQL dump file and run it as SQL statements over a PDO connection
<?php
/**
* Sql_import class.
*
* Reads a SQL file (e.g. a dump from phpmyadmin) and executes it programmatically.
*
* Handles procedures, triggers etc. and can load large dumps. Great for
* installer scripts to load up a db schema and populate with initial data.
*
* Came from: http://stackoverflow.com/questions/147821/loading-sql-files-from-within-php
<?php
/**
* Description
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2017 Denis Chenu <http://www.sondages.pro>
* @license WTFPL
* @version 0.0.1
*
* This program is free software: you can redistribute it and/or modify
<?php
/**
* Description
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2017 Denis Chenu <http://www.sondages.pro>
* @license WTFPL
* @version 0.0.1
*
*/
@Shnoulle
Shnoulle / cliEvent.php
Last active July 2, 2019 17:01
LimeSurvey CLI event example
<?php
/**
* CLI events of LimeSurvey
* To be move to limesurvey/plugins/cliEvent directory
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2016-2019 Denis Chenu <http://www.sondages.pro>
* @license WTFPL (Do What The Fuck You Want to Public License)
* @version 0.1.0
*
@Shnoulle
Shnoulle / rcExample.php
Last active March 7, 2017 09:53
Exemple of permission usage
<?php
require_once './jsonrpcphp/includes/jsonRPCClient.php';
$rpcUrl="http://example.org/plugins/unsecure?plugin=extendRemoteControl&function=action";
$rpcUser="rcUser";
$rpcPassword="rcPassword";
$iSurveyId=1234;
$lsJSONRPCClient = new jsonRPCClient($rpcUrl);
@Shnoulle
Shnoulle / Keybase proof shnoulle
Created February 14, 2017 15:55
Keybase proof shnoulle
### Keybase proof
I hereby claim:
* I am shnoulle on github.
* I am shnoulle (https://keybase.io/shnoulle) on keybase.
* I have a public key ASCJ2FRtJOBNorXKgNCT1aNCktrBcQpqlwQ6vcvgHgdA-go
To claim this, I am signing this object:
@Shnoulle
Shnoulle / YiiMultipleCache.php
Created July 17, 2016 14:10
YiiMultipleCache
/* in config */
'myCache'=>array(
'class'=>'system.caching.CDbCache',
'gCProbability'=>1000,
),
/* Usage */
Yii::app()->myCache->get($cacheId);// Get from cache
Yii::app()->myCache->set($cacheId,$oObject);// Set in cache (+ another specifi options here
'messages' => array(
'class' => 'CGettextMessageSource',
'cachingDuration'=>3600,
'forceTranslation' => true,
'useMoFile' => true,
'basePath' => __DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale'
),
'messagesPlugin' => array(
'class' => 'PluginMessageSource', // to be created
'cachingDuration'=>3600,
<?php
/**
* extend admin statitics with own controller extending the LS core controller
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2016 Denis Chenu <http://www.sondages.pro>
* @license WTFPL
* @version 0.0.0
*
* This program is free software: you can redistribute it and/or modify
@Shnoulle
Shnoulle / addAnAttribute.php
Created July 16, 2016 10:21
Adding an attribute by plugins (Solution 2)
<?php
/**
* extend admin statitics with own controller extending the LS core controller
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2016 Denis Chenu <http://www.sondages.pro>
* @license WTFPL
* @version 0.0.0
*
* This program is free software: you can redistribute it and/or modify