Ejemplo n.º 1
0
 /**
  * Controller
  */
 public function process()
 {
     if (!Phpfox::isUser()) {
         exit;
     }
     $aImage = Phpfox_File::instance()->load('image', array('jpg', 'gif', 'png'));
     if ($aImage === false) {
         return j('#js_image_error')->show();
     }
     $aParts = explode('x', $this->request()->get('ad_size'));
     if ($sFileName = Phpfox_File::instance()->upload('image', Phpfox::getParam('ad.dir_image'), Phpfox::getUserId() . uniqid())) {
         Phpfox_Image::instance()->createThumbnail(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('ad.dir_image') . sprintf($sFileName, '_thumb'), Phpfox::getParam('ad.multi_ad') ? 100 : $aParts[0] / 3, Phpfox::getParam('ad.multi_ad') ? 72 : $aParts[1] - 20);
         Phpfox_File::instance()->unlink(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''));
         rename(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, '_thumb'), Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''));
         // http://www.phpfox.com/tracker/view/14922/ -> If CDN, the unlink function above deletes the image!!
         if (Phpfox::getParam('core.allow_cdn')) {
             Phpfox::getLib('cdn')->put(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''));
         }
         return ['run' => '$(\'.js_ad_image\').html(\'<a href="#ad-link"><img src="' . Phpfox::getParam('ad.url_image') . sprintf($sFileName, '') . '" alt="" /></a>\').show(); window.parent.$(\'#js_image_holder_message\').hide(); window.parent.$(\'#js_image_holder_link\').show(); window.parent.$(\'#js_image_id\').val(\'' . sprintf($sFileName, '') . '\');'];
     }
     exit;
 }
Ejemplo n.º 2
0
    {
        $a1 = "old string";
        $a2 = "old string";
        echo "about to include included_var_overwrite.php\n";
        include "included_var_overwrite.php";
        if ($a1 == "old value" or $a2 == "my old value") {
            fail(__FILE__, __LINE__, "var overwrite within class");
        }
    }
}
$h = new H();
var_dump($h);
$h = $h->g();
var_dump($h);
# the included file using varaibles from this file
$i1 = "some value";
$i2 = "another value";
echo "about to include included_use_existing_vars.php\n";
include "included_use_existing_vars.php";
# the included file using functions from this file
echo "about to include included_use_vars_in_function.php\n";
include "included_use_vars_in_function.php";
$j = j(1, 2);
var_dump($j);
# the included file using classes from this file
echo "about to include included_use_vars_in_classes.php\n";
include "included_use_vars_in_classes.php";
$k = new K();
var_dump($k);
$k = $k->kk();
var_dump($k);
Ejemplo n.º 3
0
<?php

a('b');
?>

<?php 
echo C . D::e('f' . $g);
$h = i();
j();
/* comments */
Ejemplo n.º 4
0
<?php

'a' . ($b['c'] == 'd' ? "e{$f}g{$h['i']}" . j('k') . "l" . m('n') . "o" : "p{$q}r{$s['t']}u" . ($v['w'] != X ? "y" . z('aa') . "'ab" : "ac" . ad('ae') . "af") . "ag" . ah('ai') . "aj") . "ak";
Ejemplo n.º 5
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Read', function ($Call) {
    if (preg_match('/<\\?xml/', $Call['Value'])) {
        return jd(j(simplexml_load_string($Call['Value'], null, LIBXML_NOCDATA), JSON_NUMERIC_CHECK), true);
    } else {
        return jd(j(simplexml_load_string('<root>' . $Call['Value'] . '</root>'), JSON_NUMERIC_CHECK), true);
    }
});
Ejemplo n.º 6
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Open', function ($Call) {
    return F::Run('IO.Storage.Redis', 'Open', $Call);
});
setFn('Read', function ($Call) {
    F::Log('Pull: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
    if (($Result = $Call['Link']->lPop($Call['Scope'] . $Call['Queue'])) !== false) {
        return [jd($Result, true)];
    } else {
        return null;
    }
});
setFn('Write', function ($Call) {
    F::Log('Push: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
    return $Call['Link']->rPush($Call['Scope'] . $Call['Queue'], j($Call['Data']));
});
setFn('Count', function ($Call) {
    F::Log('Count: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
    return $Call['Link']->lLen($Call['Scope'] . $Call['Queue']);
});
Ejemplo n.º 7
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description: 
 * @package Codeine
 * @version 8.x
 */
setFn('Read', function ($Call) {
    $Result = jd($Call['Value'], true);
    if (json_last_error() > 0) {
        F::Log('JSON: ' . json_last_error_msg(), LOG_ERR);
        F::Log($Call['Value'], LOG_ERR);
    }
    return $Result;
});
setFn('Write', function ($Call) {
    return j($Call['Value'], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
});
setFn('Write.Call', function ($Call) {
    $Call['Value'] = j($Call['Value']);
    return $Call;
});
Ejemplo n.º 8
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    if ($Call['Case']['Result']['Actual'] == $Call['Case']['Assert']['Equal']) {
        $Decision = true;
    } else {
        $Call['Failure'] = true;
        $Decision = false;
        F::Log(j($Call['Case']['Result']['Actual']) . ' is not equal ' . j($Call['Case']['Assert']['Equal']), LOG_WARNING, 'Developer');
    }
    return $Decision;
});
Ejemplo n.º 9
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Make', function ($Call) {
    $Data = [];
    if (count($Call['Value']) > 0) {
        foreach ($Call['Value'] as $K => $V) {
            if ($K > 0) {
                $Data[] = [$Call['Name'] => $V];
            }
        }
    }
    $Call['Data'] = j($Data, JSON_UNESCAPED_UNICODE);
    return $Call;
});
Ejemplo n.º 10
0
 function insert($p_value, $p_prefix)
 {
     $sql = "insert into document_type(dt_value,dt_prefix) values (\$1,\$2)";
     try {
         if ($this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))', array($p_value)) > 0) {
             throw new Exception('Nom en double');
         }
         if (strlen(trim($p_value)) > 0) {
             $this->db->exec_sql($sql, array($p_value, $p_prefix));
         }
     } catch (Exception $e) {
         alert(j(_("Impossible d'ajouter [{$p_value}] ") . $e->getMessage()));
     }
 }
Ejemplo n.º 11
0
<?php

$a = $_GET['b'] ?? 'c';
$d = E::f($g) ?? $h;
$i = j('l') ?? l;
Ejemplo n.º 12
0
    return true;
});
setFn('Execute', function ($Call) {
    F::Log($Call['Command'], LOG_INFO);
    return $Call['Link']->execute($Call['Command']);
});
setFn('Count', function ($Call) {
    $Call['Scope'] = strtr($Call['Scope'], '.', '_');
    if (isset($Call['Where']) and $Call['Where'] !== null) {
        $Call = F::Apply(null, 'Where', $Call);
        if (isset($Call['Distinct']) && $Call['Distinct']) {
            F::Log('db.*' . $Call['Scope'] . '*.distinct(' . j($Call['Where']) . ')', LOG_INFO, 'Administrator');
            $Data = $Call['Link']->{$Call}['Scope']->distinct($Call['Fields'][0], $Call['Where']);
            return count($Data);
        } else {
            F::Log('db.*' . $Call['Scope'] . '*.count(' . j($Call['Where']) . ')', LOG_INFO, 'Administrator');
            $Cursor = $Call['Link']->{$Call}['Scope']->count($Call['Where']);
        }
    } else {
        if (isset($Call['Distinct']) && $Call['Distinct']) {
            F::Log('db.*' . $Call['Scope'] . '*.distinct()', LOG_INFO, 'Administrator');
            $Data = $Call['Link']->{$Call}['Scope']->distinct($Call['Fields'][0]);
            return count($Data);
        } else {
            F::Log('db.*' . $Call['Scope'] . '*.count()', LOG_INFO, 'Administrator');
            $Cursor = $Call['Link']->{$Call}['Scope']->count();
        }
    }
    if ($Cursor) {
        return $Cursor;
    } else {
Ejemplo n.º 13
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Process', function ($Call) {
    if (isset($Call['Node']['Unique']) && $Call['Node']['Unique'] && isset($Call['Data'][$Call['Name']])) {
        if ($Call['Name'] !== 'ID') {
            $Where = [$Call['Name'] => $Call['Data'][$Call['Name']], 'ID' => ['$ne' => $Call['Data']['ID']]];
            $Limit = 0;
        } else {
            if ($Call['Purpose'] == 'Create') {
                $Limit = 0;
            } else {
                $Limit = 1;
            }
            $Where = ['ID' => $Call['Data']['ID']];
        }
        F::Log('Checking unique *' . $Call['Name'] . '* value *' . $Call['Data'][$Call['Name']] . '* (' . $Call['Purpose'] . ')', LOG_INFO);
        $Count = F::Run('Entity', 'Count', ['Entity' => $Call['Entity'], 'Where' => $Where]);
        if ($Count > $Limit) {
            F::Log('Non-unique (' . $Count . '/' . $Limit . ') ' . $Call['Name'] . ' value: ' . j($Call['Data'][$Call['Name']]) . ' ', LOG_ERR);
            return 'Unique';
        }
    }
    return true;
});
Ejemplo n.º 14
0
             }
         }
         if (!isset($Rule['Weight'])) {
             $Rule['Weight'] = $Call['Weight'];
         }
         if ($Rule['Weight'] >= $Call['Weight']) {
             if (isset($Rule['Run']) && F::Diff($Rule['Run'], $Call) === null) {
                 if (!isset($Rule['Expression']) || F::Live($Rule['Expression'], $Call)) {
                     F::Log('Rule ' . $Name . ' applied', LOG_DEBUG, 'Security');
                     $Call['Decision'] = $Rule['Decision'];
                     $Call['Weight'] = $Rule['Weight'];
                     $Call['Rule'] = $Name;
                 }
             } else {
                 if (isset($Rule['Debug'])) {
                     F::Log('Diff ' . $Name . ' (Rule, Call)' . j(F::Diff($Rule['Run'], $Call)), LOG_INFO, 'Security');
                 }
             }
             if (isset($Call['Service']) && isset($Rule['Run']['Service']) && isset($Rule['Run']['Method']) && isset($Rule['Message'])) {
                 if ($Call['Service'] == $Rule['Run']['Service'] && $Call['Method'] == $Rule['Run']['Method']) {
                     $Call['Message'] = $Rule['Message'];
                 }
             }
         }
     }
 } else {
     F::Log('No rules loaded', LOG_WARNING);
 }
 if (isset($Call['Rule'])) {
     F::Log('Rule *' . $Call['Rule'] . '* decision *' . $Call['Decision'] . '* with weight ' . $Call['Weight'], LOG_INFO, 'Security');
 }
Ejemplo n.º 15
0
if (isset($_REQUEST['plugin_code'])) {
    if (LOGINPUT) {
        $file_loginput = fopen($_ENV['TMP'] . '/scenario-' . $_SERVER['REQUEST_TIME'] . '.php', 'a+');
        fwrite($file_loginput, "<?php \n");
        fwrite($file_loginput, '//@description:' . $_REQUEST['plugin_code'] . "\n");
        fwrite($file_loginput, '$_GET=' . var_export($_GET, true));
        fwrite($file_loginput, ";\n");
        fwrite($file_loginput, '$_POST=' . var_export($_POST, true));
        fwrite($file_loginput, ";\n");
        fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
        fwrite($file_loginput, "\n");
        fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
        fwrite($file_loginput, "\n");
        fwrite($file_loginput, ' $_REQUEST=array_merge($_GET,$_POST);');
        fwrite($file_loginput, "\n");
        fwrite($file_loginput, "include '" . basename(__FILE__) . "';\n");
        fclose($file_loginput);
    }
    $ext = new Extension($cn);
    if ($ext->search($_REQUEST['plugin_code']) != -1) {
        /* security */
        if (!isset($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0) {
            exit;
        }
        /* call the ajax script */
        require_once NOALYSS_PLUGIN . DIRECTORY_SEPARATOR . dirname(trim($ext->getp('me_file'))) . DIRECTORY_SEPARATOR . 'ajax.php';
    } else {
        alert(j(_("Cette extension n'existe pas ")));
        exit;
    }
}
Ejemplo n.º 16
0
 public function process()
 {
     $Session = new Core\Session();
     $key = 'admincp_flavor_' . $this->request()->get('id');
     if ($flavor = $this->request()->get('flavor')) {
         $Session->set($key, $flavor);
     }
     $Theme = $this->template()->theme()->get($this->request()->get('id'));
     if ($flavor = $Session->get($key)) {
         $Theme->setFlavor($flavor);
     }
     if ($default = $this->request()->get('default')) {
         return $Theme->setDefault();
     } else {
         if ($flavorId = $this->request()->get('flavor-delete')) {
             $Session->remove($key);
             $Theme->deleteFlavor($flavorId);
             $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Flavor successfully deleted.');
         } else {
             if ($this->request()->get('export')) {
                 $Theme->export();
             } else {
                 if ($this->request()->get('merge')) {
                     $Theme->merge();
                     $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Successfully merged the theme.');
                 } else {
                     if ($this->request()->get('rebuild')) {
                         $Theme->rebuild();
                         $this->url()->send('admincp.theme.manage', ['id' => $this->request()->get('id')], 'Successfully merged the theme.');
                     }
                 }
             }
         }
     }
     $Service = new Core\Theme\Service($Theme);
     if ($design = $this->request()->get('design')) {
         $Service->design()->set($design);
         return ['posted' => true];
     }
     $Request = $this->request();
     if ($Request->getHeader('X-File-Name')) {
         $dir = PHPFOX_DIR_FILE . 'logos/';
         if (!is_dir($dir)) {
             mkdir($dir);
         }
         $file = uniqid() . '.' . \Phpfox_File::instance()->extension($Request->getHeader('X-File-Name'));
         if (isset($_FILES['ajax_upload'])) {
             $_FILES['image'] = $_FILES['ajax_upload'];
             file_put_contents($dir . $file, file_get_contents($_FILES['image']['tmp_name']));
         } else {
             file_put_contents($dir . $file, file_get_contents('php://input'));
         }
         $url = str_replace(['/index.php', 'http://'], ['', '//'], \Phpfox::getParam('core.path')) . 'PF.Base/file/logos/' . $file;
         return ['run' => "\$('input[name=\"design[logoUrl]\"]').val(\"'{$url}'\").trigger('change');"];
     }
     if ($load = $this->request()->get('load')) {
         if ($this->request()->isPost()) {
             $content = $this->request()->get('content');
             switch ($load) {
                 case 'html':
                     $Service->html()->set($content);
                     break;
                 case 'css':
                     $Service->css()->set($content);
                     break;
                 case 'javascript':
                     $Service->js()->set($content);
                     break;
             }
             return ['posting' => true];
         }
         $data = '';
         switch ($load) {
             case 'html':
                 $data = $Service->html()->get();
                 break;
             case 'css':
                 $data = $Service->css()->get();
                 break;
             case 'javascript':
                 $data = $Service->js()->get();
                 break;
         }
         return ['ace' => $data, 'run' => "\$AceEditor.mode('{$load}'); " . (string) j('.ace_editor')->data('ace-mode', $load)->data('ace-save', $this->url()->makeUrl('admincp.theme.manage', ['id' => $this->request()->get('id'), 'load' => $load]))];
     } else {
         $this->template()->assign('design', $Service->design()->get());
     }
     $this->template()->setTitle('Theme Manager');
     $this->template()->setTemplate('blank');
     $this->template()->setHeader(['colorpicker.css' => 'style_css', 'colorpicker/js/colpick.js' => 'static_script']);
     $this->template()->assign(['theme' => $Theme, 'flavors' => $Theme->flavors()]);
 }
Ejemplo n.º 17
0
<?php

$a++;
$b++;
$c++;
$d++;
$e = $f + 1;
$g;
h($i);
j($k);
Ejemplo n.º 18
0
     }
     // Set the pages title, section title, h1 tag, sub-menu and template file
     return $Controller->section('PHPfox App Base', '/base')->h1('Forms', '/base/forms')->title('Forms')->menu($Base->menu())->render('forms.html', ['formData' => $formData]);
 });
 /**
  * @route /base/adding-a-feed
  * Learn how to add a new feed
  */
 (new Core\Route('/adding-a-feed', function (Core\Controller $Controller) use($Base) {
     // Check to see if we posted anything
     if ($Controller->request->isPost()) {
         $Feed = new \Api\Feed();
         // Create a new post. Make sure to pass your "type_id", which is your App id
         $feed = $Feed->post(['type_id' => 'PHPfox_Base', 'content' => $Controller->request->get('val')['status']]);
         // Use jquery to output the new feed object
         return j('#ajax_output')->html('<div class="message"><pre>' . print_r($feed, true) . '</pre></div>');
     }
     // Set the pages title, section title, h1 tag, sub-menu and template file
     return $Controller->section('PHPfox App Base', '/base')->h1('Adding a Feed', '/base/adding-a-feed')->title('Adding a Feed')->menu($Base->menu())->render('adding-a-feed.html', []);
 }))->auth(true);
 /**
  * @route /base/database
  * Small example of how to connect to a Model and run a function
  */
 new Core\Route('/database', function (Core\Controller $Controller) use($Base) {
     // Load our User Model, which will be located at: /PF.Site/PHPfox_Base/Model/User.php
     $User = new \Apps\PHPfox_Base\Model\User();
     // Run the random() function provded by the Model
     $randomUsers = $User->random();
     // Set the pages title, section title, h1 tag, sub-menu and template file
     return $Controller->section('PHPfox App Base', '/base')->h1('Database', '/base/forms')->title('Database')->menu($Base->menu())->render('database.html', ['users' => $randomUsers]);
Ejemplo n.º 19
0
function alert($p_msg, $buffer = false)
{
    $r = '<script>';
    $r .= 'alert_box(\'' . j($p_msg) . '\')';
    $r .= '</script>';
    if ($buffer) {
        return $r;
    }
    echo $r;
}
Ejemplo n.º 20
0
 * @author bergstein@trickyplan.com
 * @description
 * @package Codeine
 * @version 8.x
 */
setFn('Write', function ($Call) {
    if (is_scalar($Call['Value'])) {
        if (mb_strlen($Call['Value']) > $Call['Literal']['String']['Write Size']) {
            return mb_substr((string) $Call['Value'], 0, $Call['Literal']['String']['Write Size']);
        } else {
            return (string) $Call['Value'];
        }
    } elseif (is_null($Call['Value'])) {
        return null;
    } else {
        F::Log('Value not a string: ' . j($Call['Value']), LOG_WARNING);
        return null;
    }
});
setFn('Where', function ($Call) {
    //        if (is_string($Call['Value']))
    if (is_scalar($Call['Value'])) {
        return (string) htmlspecialchars($Call['Value']);
    } else {
        return null;
    }
});
setFn('Read', function ($Call) {
    //        if (is_string($Call['Value']))
    if (is_scalar($Call['Value'])) {
        if (mb_strlen($Call['Value']) > $Call['Literal']['String']['Read Size']) {
Ejemplo n.º 21
0
}
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
require_once NOALYSS_INCLUDE . '/ac_common.php';
require_once NOALYSS_INCLUDE . '/constant.php';
require_once NOALYSS_INCLUDE . '/function_javascript.php';
require_once NOALYSS_INCLUDE . '/class_extension.php';
require_once NOALYSS_INCLUDE . '/class_html_input.php';
require_once NOALYSS_INCLUDE . '/class_iselect.php';
require_once NOALYSS_INCLUDE . '/constant.security.php';
require_once NOALYSS_INCLUDE . '/class_user.php';
/**
 * included from do.php + extension_choice.inc.php
 */
// find file and check security
global $cn, $g_user;
$ext = new Extension($cn);
if ($ext->search($_REQUEST['plugin_code']) == -1) {
    echo_warning("plugin non trouvé");
    return;
}
if ($ext->can_request($g_user->login) == -1) {
    alert("Plugin non authorisé");
    return;
}
if (!file_exists(NOALYSS_PLUGIN . '/' . trim($ext->me_file))) {
    alert(j(_("Ce fichier n'existe pas ")));
    return;
}
echo '<div class="content">';
require_once NOALYSS_PLUGIN . DIRECTORY_SEPARATOR . trim($ext->me_file);
Ejemplo n.º 22
0
                    if (($Matched = F::Dot($Call, $Submatch)) !== null) {
                        $Match = $Submatch;
                        break;
                    }
                }
            }
            if (($Matched = F::Dot($Call, $Match)) !== null) {
                if (is_array($Matched)) {
                    $Matched = j($Matched);
                }
                if ($Matched === false || $Matched === 0) {
                    $Matched = '0';
                }
                $Call['Parsed'][1][$IX] = $Matched;
                F::Log('Call to *' . $Match . '* resolved as ' . $Call['Parsed'][1][$IX], LOG_DEBUG);
            } else {
                F::Log('Call to *' . $Match . '* cannot resolved', $Call['Verbosity']['Calltag']['Unresolved']);
                if (isset($Call['Remove empty'])) {
                    $Call['Parsed'][1][$IX] = '';
                } else {
                    unset($Call['Parsed'][0][$IX], $Call['Parsed'][1][$IX]);
                }
            }
        }
        $Call['Output'] = str_replace($Call['Parsed'][0], $Call['Parsed'][1], $Call['Output']);
    }
    if (preg_match_all('@<call/>@SsUu', $Call['Output'], $Pockets)) {
        $Call['Output'] = str_replace($Call['Parsed'][0], '<pre>' . htmlentities(j($Call, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) . '</pre>', $Call['Output']);
    }
    return $Call;
});
Ejemplo n.º 23
0
echo '<div class="topmenu">';
@html_page_start($_SESSION['g_theme']);
$cn = new Database(dossier::id());
global $g_user;
$g_user = new User($cn);
$g_user->check();
$only_plugin = $g_user->check_dossier(dossier::id());
/* javascript file */
echo load_all_script();
/* show all the extension we can access */
$a = new ISelect('plugin_code');
$a->value = Extension::make_array($cn);
$a->selected = isset($_REQUEST['plugin_code']) ? strtoupper($_REQUEST['plugin_code']) : '';
/* no plugin available */
if (count($a->value) == 0) {
    alert(j(_("Aucune extension  disponible")));
    exit;
}
/* only one plugin available then we don't propose a choice*/
if (count($a->value) == 1) {
    $_REQUEST['plugin_code'] = $a->value[0]['value'];
}
echo '</div>';
/*else
{
	if (!isset($_REQUEST['ac'])) echo_warning ("ac non positionné");
    echo '<form method="get" action="do.php">';
    echo Dossier::hidden();
    echo HtmlInput::request_to_hidden(array('plugin_code','ac'));
    echo _('Extension').$a->input().HtmlInput::submit('go',_("Choix de l'extension"));
    echo '</form>';
Ejemplo n.º 24
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Write', function ($Call) {
    return jd($Call['Value']);
});
setFn('Read', function ($Call) {
    return j($Call['Value']);
});
Ejemplo n.º 25
0
<?php

f(g(h(i(j('y')))));
Ejemplo n.º 26
0
 public static function Log($Message, $Verbose = 7, $Channel = 'Developer', $AppendStack = true)
 {
     if ($Verbose <= self::$_Verbose[$Channel] or isset($_SERVER['Verbose']) && $Verbose <= $_SERVER['Verbose'] or self::$_Staring) {
         if (is_scalar($Message)) {
         } else {
             $Message = j($Message, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
         }
         /*                if ((self::Environment() == 'Development') && (self::$_Perfect === true) && $Verbose < LOG_WARNING)
                           trigger_error($Message);*/
         // $Message = self::$_Service.': '.$Message;
         $Time = sprintf('%.3F', microtime(true) - Started);
         if (PHP_SAPI === 'cli') {
             $Head = "" . $Time . "" . "\t[" . $Channel . "]\t" . self::$_Service . ":\t";
             if ($Verbose <= self::$_Verbose[$Channel] or !self::$_Live) {
                 switch (round($Verbose)) {
                     case LOG_EMERG:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_ALERT:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_CRIT:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_ERR:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_WARNING:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_DEBUG:
                         if (self::$_Debug) {
                             fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         }
                         break;
                     case LOG_USER:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_INFO:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     case LOG_NOTICE:
                         fwrite(STDERR, $Head . " " . $Message . " " . PHP_EOL);
                         break;
                     default:
                         fwrite(STDERR, $Head . $Message . PHP_EOL);
                         break;
                 }
             }
         } else {
             if ($Verbose < LOG_NOTICE and $AppendStack) {
                 self::$_Log[$Channel][] = [$Verbose, $Time, $Message, self::$_Service . ':' . self::$_Method, self::$_Stack->count(), F::Stack()];
             } else {
                 self::$_Log[$Channel][] = [$Verbose, $Time, $Message, self::$_Service . ':' . self::$_Method, self::$_Stack->count()];
             }
         }
     }
     return $Message;
 }
Ejemplo n.º 27
0
  </tr>
  <?php 
}
?>
  </table>
  </div>
  <script language="javascript">
function addFiles() {
try {
	docAdded=document.getElementById('add_file');
	new_element=document.createElement('li');
	new_element.innerHTML='<input class="inp" type="file" value="" name="file_upload[]"/><label>Description</label> <input type="input" class="input_text" name="input_desc[]" >';
	docAdded.appendChild(new_element);
}
catch(exception) { alert('<?php 
echo j(_('Je ne peux pas ajouter de fichier'));
?>
'); alert(exception.message);}
}
</script>
<?php 
if ($p_view != 'READ') {
    ?>
  <div class="noprint">
     <h3 >Fichiers à ajouter: </h3>
    <ol id='add_file'  >
      <li>
        <?php 
    echo $upload->input();
    ?>
        <label><?php 
Ejemplo n.º 28
0
<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Render', function ($Call) {
    $Call = F::Hook('beforeJSONRender', $Call);
    $Call = F::Run('View.Pipeline', 'Do', $Call);
    $Call['Output'] = j($Call['Output']['Content']);
    $Call = F::Hook('afterJSONRender', $Call);
    return $Call;
});
Ejemplo n.º 29
0
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    return F::Run(null, $Call['HTTP']['Method'], $Call);
});
setFn('GET', function ($Call) {
    $Call['Layouts'][] = ['Scope' => 'Parser', 'ID' => 'URL'];
    return $Call;
});
setFn('POST', function ($Call) {
    $Call['URL'] = $Call['Request']['Data']['URL'];
    $Call['Data'] = F::Run('Parser.URL', 'Parse', $Call);
    $Call['Output']['Content'][] = ['Type' => 'Block', 'Value' => j($Call['Data'])];
    return $Call;
});
setFn('Parse', function ($Call) {
    if ($Call['Schema'] = F::Run('Parser', 'Discovery', $Call)) {
        F::Log('Schema is ' . $Call['Schema'], LOG_INFO);
        $Schema = F::loadOptions('Parser/' . $Call['Schema']);
        $Call = F::Merge($Call, $Schema);
        $Result = F::Live($Call['Parser']['URL']['Backend'], ['Where' => ['ID' => $Call['URL']]]);
        $Result = array_pop($Result);
        $Call = F::Run('Parser', 'Do', $Call, ['Markup' => $Result]);
        $Slices = explode('/', $Call['Schema']);
        $Call['Entity'] = array_pop($Slices);
        $Call['Data']['Source'] = $Call['URL'];
        if (isset($Call['Parser']['Create']['Auto']) && $Call['Parser']['Create']['Auto']) {
            $Call['Data'] = F::Run('Entity', 'Create', $Call, ['One' => true]);
Ejemplo n.º 30
0
        foreach ($Test['Suites'] as $SuiteName => $Suite) {
            foreach ($Suite as $CaseName => $Call['Case']) {
                $Call['Case']['Result']['Actual'] = F::Live($Call['Case']['Run'], $Call);
                if (isset($Call['Case']['Output']['Content'])) {
                    $Call['Case']['Result']['Actual'] = print_r($Call['Return']['Output']['Content'], true);
                }
                foreach ($Call['Case']['Assert'] as $Assert => $Call['Checker']) {
                    $TestTime = microtime(true);
                    // FIXME
                    $Call['Decision'] = F::Run('Test.Assert.' . $Assert, 'Do', $Call);
                    $TestTime = microtime(true) - $TestTime;
                }
                if (isset($Call['Case']['Result Key'])) {
                    $Call['Case']['Result']['Actual'] = F::Dot($Call['Case']['Result']['Actual'], $Call['Case']['Result Key']);
                }
                $Call['Test']['Report'][$Call['Test']['Name'] . $SuiteName . $CaseName] = [$Call['Test']['Name'], $SuiteName, $CaseName, '<pre>' . j($Call['Case']['Result']['Actual']) . '</pre>', round($TestTime, 5) * 1000, '_Class' => $Call['Decision'] ? 'success' : 'danger'];
                $Call['Decision'] ? F::Log('Test case ' . $CaseName . ' passed', LOG_INFO) : F::Log('Test case ' . $CaseName . ' failed', LOG_ERR);
            }
        }
    } else {
        $Call = F::Hook('onTestNotFound', $Call);
    }
    return $Call;
});
setFn('Do', function ($Call) {
    $Paths = F::getPaths();
    $Options = [];
    if (isset($Call['Test']['Name'])) {
        F::Log('Test *' . $Call['Test']['Name'] . '* selected', LOG_INFO);
        $VCall = F::Apply(null, 'Run', ['Test' => $Call['Test']['Name']], $Call);
        $Call['Test']['Report'] = F::Merge($Call['Test']['Report'], $VCall['Test']['Report']);