Skip to content

Instantly share code, notes, and snippets.

View joebordes's full-sized avatar

Joe Bordes joebordes

View GitHub Profile
@joebordes
joebordes / addfilestophar.md
Last active September 1, 2019 23:23
Add files to an executable phar: phpcs security rules
  • Create a temporary directory
  • Copy the phar file you want to add the files to cp /home/joe/bin/phpcs73.phar .
  • create another temporary directory mkdir k
  • copy inside the structure you want to have in the phar. For example, inside the phpcs73.phar file there is a structure like this: src/Standards/ (you can see the contents and structure of your phar with phar list -f file.phar and I want to copy the new rules inside that directory so I create k/src/Standards/Security
@joebordes
joebordes / wsinit.php
Created July 31, 2019 11:12
Initialize webservice on module
<?php
// Turn on debugging level
$Vtiger_Utils_Log = true;
include_once 'vtlib/Vtiger/Module.php';
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$usr = new Users();
$current_user = Users::getActiveAdminUser();
@joebordes
joebordes / execwf.php
Created December 14, 2018 09:40
Force events and workflow on records
<?php
// Turn on debugging level
$Vtiger_Utils_Log = true;
include_once 'vtlib/Vtiger/Module.php';
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$usr = new Users();
$current_user = Users::getActiveAdminUser();
@joebordes
joebordes / LayoutEditorSequenceInformation.diff
Created March 26, 2018 13:56
Show sequence information of blocks and fields in Layout Editor
diff --git a/Smarty/templates/Settings/LayoutBlockEntries.tpl b/Smarty/templates/Settings/LayoutBlockEntries.tpl
index 7f4fbf7..5c7900c 100644
--- a/Smarty/templates/Settings/LayoutBlockEntries.tpl
+++ b/Smarty/templates/Settings/LayoutBlockEntries.tpl
@@ -257,6 +257,7 @@
<img src="{'arrow_up.png'|@vtiger_imageurl:$THEME}" border="0" style="cursor:pointer;" onclick="changeBlockorder('block_up','{$entries.tabid}','{$entries.blockid}','{$MODULE}') " alt="{$MOD.
<img src="{'arrow_down.png'|@vtiger_imageurl:$THEME}" border="0" style="cursor:pointer;" onclick="changeBlockorder('block_down','{$entries.tabid}','{$entries.blockid}','{$MODULE}') " alt="{$
{/if}
+ <span style="font-size: smaller">({$entries.sequence})</span>
</td>
@joebordes
joebordes / README.md
Last active February 27, 2018 19:40
find duplicate keys in php array
  • use checkdupkey from the command line to give it file names and get back a list of the ones that have duplicate keys
  • duparraykey.php does the magic and returns 0/1 as an exit code so it can be automated on the command line
  • repeatedlabels.php does the same magic as duparraykey.php but it is prepared to show you a list of the duplicated keys in the browser.

The idea is to run checkdupkey on your arrays and use repeatedlabels.php on the positive ones in order to fix them

License: MIT

HTH

@joebordes
joebordes / showAppMsg.php
Created September 21, 2017 17:32
coreBOS Application Message outputs
<?php
include_once('vtlib/Vtiger/Module.php');
require_once('Smarty_setup.php');
$smarty = new vtigerCRM_Smarty();
$smarty->assign('APP', $app_strings);
$smarty->assign('ERROR_MESSAGE_CLASS', 'cb-alert-warning');
$smarty->assign('ERROR_MESSAGE', 'This is a WARNING message.');
$smarty->display('applicationmessage.tpl');
$smarty->assign('ERROR_MESSAGE_CLASS', 'cb-alert-danger');
$smarty->assign('ERROR_MESSAGE', 'This is a DANGER message.');
@joebordes
joebordes / MissingModulePHP53.diff
Created September 15, 2017 21:52
Patch to get coreBOS working on PHP 5.3
diff --git a/index.php b/index.php
index 8aaea9b..f422c3c 100644
--- a/index.php
+++ b/index.php
@@ -118,8 +118,8 @@ $is_action = false;
if (isset($_REQUEST['module'])) {
$module = vtlib_purify($_REQUEST['module']);
if (!preg_match('/[\/.]/',$module)) {
- $dir = @scandir($root_directory.'modules', SCANDIR_SORT_NONE);
- $in_dir = @scandir($root_directory.'modules/'.$module, SCANDIR_SORT_NONE);
<?php
include 'vtlib/Vtiger/Module.php';
require_once('include/events/include.inc');
global $current_user, $adb;
$current_user = Users::getActiveAdminUser();
$workflowManager = new VTWorkflowManager($adb);
$taskManager = new VTTaskManager($adb);
$calendarWorkflow = $workflowManager->newWorkFlow("cbCalendar");
@joebordes
joebordes / kui_autocomplete_on_leads.diff
Created June 26, 2017 23:47
coreboscrm: Get crmid from KUI company lead field on select
diff --git a/Smarty/templates/EditViewUI.tpl b/Smarty/templates/EditViewUI.tpl
index 6aa464f..4e44736 100644
--- a/Smarty/templates/EditViewUI.tpl
+++ b/Smarty/templates/EditViewUI.tpl
@@ -123,7 +123,10 @@ alt="{'LBL_CLEAR'|@getTranslatedString}" title="{'LBL_CLEAR'|@getTranslatedStrin
</td>
<td width=30% align=left class="dvtCellInfo">
<input type="text" name="{$fldname}" id="{$fldname}" tabindex="{$vt_tab}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
- {if isset($AccountContactLead_Duplicates_Hint) && $AccountContactLead_Duplicates_Hint eq 'yes'}
+ {if true}
@joebordes
joebordes / addFooterLink.php
Last active August 4, 2017 15:49
coreBOS javascript hooks