Could you make a test of this modification?
It is right history to regulate this problem definitively.
Replace the line :
$sql_mid_mod = "SELECT mid FROM ".$xoopsDB->prefix('modules')." WHERE dirname = '$mydirname'";
$mcx_sql = $xoopsDB->query( "SELECT bid FROM ".$xoopsDB->prefix("newblocks")." WHERE mid=($sql_mid_mod) AND show_func='pical_minical_ex_show'" ) ;
By :
$mcx_sql = $xoopsDB->query( "SELECT bid FROM ".$xoopsDB->prefix("modules")." AS module, ".$xoopsDB->prefix("newblocks")." AS block WHERE (block.mid=module.mid and module.dirname='".$mydirname."' AND block.show_func='pical_minical_ex_show')");
Locally that functions. And on your server???