本文整理汇总了PHP中Settings::getOperativeMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::getOperativeMode方法的具体用法?PHP Settings::getOperativeMode怎么用?PHP Settings::getOperativeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::getOperativeMode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildFromFileSystem
/**
*
* @param unknown $fileSystemElement
*/
protected function buildFromFileSystem($fileSystemElement)
{
$this->tags = array();
$folder_contents = scandir($fileSystemElement);
$debug = Settings::getOperativeMode() != "release";
if ($debug) {
echo "<br><br>";
}
foreach ($folder_contents as $k => $v) {
if ($v != "." && $v != "..") {
$tagLibraryIndex = explode(".", $v)[0];
if ($debug) {
var_dump($tagLibraryIndex);
}
if (is_dir($fileSystemElement . "/" . $v)) {
if ($debug) {
echo "<br>**" . $v . " is dir<br>";
}
$this->tags[$tagLibraryIndex] = new TagLibrary(null, $fileSystemElement . "/" . $v, "as_file_system_element");
} else {
if ($debug) {
echo "<br>**" . $v . " is not dir<br>";
}
$this->tags[$tagLibraryIndex] = new $tagLibraryIndex(null, $fileSystemElement . "/" . $v, "as_file_system_element");
}
}
}
}
示例2: add
public function add($entity = null)
{
$baseEntityPrimaryKeyName = $entity->fields[0]->name;
$baseEntityPrimaryKeyValue = $_REQUEST[$entity->fields[0]->name];
$where_conditions = array($entity->fields[0]->name => $baseEntityPrimaryKeyValue);
if (Settings::getOperativeMode() == 'debug') {
echo '<br> add in ImageForm debug';
echo '<br>$_REQUESTin imageform<br>';
var_dump($_REQUEST);
}
if (isset($_REQUEST[$this->formHash . "_" . $this->attributeName]) && $_REQUEST[$this->formHash . "_" . $this->attributeName]["size"] != 0) {
$this->createImage();
$imageEntity = DB::getInstance()->getEntityByName("sys_image");
if ($imageEntity->loaded) {
$set_values = array($this->attributeName => $imageEntity->instances[0]->getKeyFieldValue());
}
} else {
/* If foto was uploaded a new foto entity is created */
if (isset($_REQUEST[$this->formHash . "_" . $this->attributeName])) {
$set_values = array($this->attributeName => $_REQUEST[$this->formHash . "_" . $this->attributeName]);
} else {
/*otherwise everything is removed*/
$set_values = array($this->attributeName => 0);
}
}
$entity->update($where_conditions, $set_values);
}
示例3: setOperativeMode
public static function setOperativeMode($mode)
{
self::$operative_mode = $mode;
if (Settings::getOperativeMode() == "release") {
error_reporting(E_ERROR);
} else {
error_reporting(E_ALL);
}
}
示例4: build
/**
* @access public
* @param v : values for this field in the form
* @param preload
* @ParamType v
* @ParamType preload
*/
public function build($preload)
{
if (Settings::getOperativeMode() == 'debug') {
echo '<br />debug TitleField widget';
var_dump($this->name);
}
$content = '<div class="page_heading">';
$content .= '<h1 class="text_uppercase">' . $this->name . '</h1></div>';
return $content;
}
示例5: update
public function update($where_conditions, $set_parameters)
{
if (Settings::getOperativeMode() == 'debug') {
echo '<br />method update EntityImage ';
var_dump($set_parameters);
}
if (isset($set_parameters['file'])) {
$set_parameters['filename'] = 'upload/' . $set_parameters['file']['name'];
$set_parameters['filetype'] = $set_parameters['file']['type'];
$set_parameters['size'] = $set_parameters['file']['size'];
}
return parent::update($where_conditions, $set_parameters);
}
示例6: update
public function update($where_conditions, $set_parameters)
{
if (Settings::getOperativeMode() == 'release') {
echo '<br /><br><br>method update EntityImage<br><br> ';
var_dump($set_parameters);
}
if (isset($set_parameters['file'])) {
$set_parameters['filename'] = $set_parameters['file']['name'];
$set_parameters['filetype'] = $set_parameters['file']['type'];
$set_parameters['size'] = $set_parameters['file']['size'];
$set_parameters['data'] = mysql_real_escape_string(base64_encode(file_get_contents($set_parameters['file']['tmp_name'])));
}
parent::update($where_conditions, $set_parameters);
}
示例7: build
/**
* @access public
* @param preload
* @ParamType string
*/
public function build($preload)
{
$value = "";
$preloadedId = 0;
if ($this->form->entity->loaded && $preload == PRELOAD) {
$entityInstance = $this->form->entity->instances[0];
$preloadedId = $entityInstance->getFieldValue($this->name);
if (Settings::getOperativeMode() == 'debug') {
echo '<br />ImageField debugmode';
var_dump($preloadedId);
}
}
$key = $this->form->formHash;
$widget = new Skinlet("widget/ImageField");
$widget->setContent("label", $this->label);
$widget->setContent("name", $key . '_' . $this->name);
$widget->setContent("formHash", $key);
$widget->setContent("loggedUsername", $_SESSION["user"]["username"]);
$widget->setContent("preloadedImageId", $preloadedId);
return $widget->get();
}
示例8: save
/**
*
* (non-PHPdoc)
* @see baseType::save($commaId)
* @access public
* @param commaId
* @ParamType commaId
*/
public function save($commaId)
{
if (Settings::getOperativeMode() == 'release') {
echo '<br />debug save FileType';
}
if (is_uploaded_file($_FILES[$this->name]['tmp_name'])) {
$filename = $_FILES[$this->name]['name'];
$filesize = $_FILES[$this->name]['size'];
$filetype = $_FILES[$this->name]['type'];
$fp = fopen($_FILES[$this->name]['tmp_name'], "r");
$buffer = file_get_contents($_FILES[$this->name]['tmp_name']);
if (get_magic_quotes_gpc()) {
/*
Here instead of trim one should use stripslashes but doesn't work.
*/
$buffer = mysql_real_escape_string(trim($buffer));
} else {
/*
It could be that here something different is required.
*/
$buffer = mysql_real_escape_string(trim($buffer));
}
fclose($fp);
} else {
$buffer = "";
$filename = "";
$filezize = 0;
$filetype = "";
}
$buffer = isset($buffer) ? $buffer : "";
$query .= Parser::first_comma($commaId, ", ") . "'{$buffer}'";
$filename = isset($filename) ? $filename : "";
$query .= Parser::first_comma($commaId, ", ") . "'{$filename}'";
$filesize = isset($filesize) ? $filesize : "";
$query .= Parser::first_comma($commaId, ", ") . "'{$filesize}'";
$filetype = isset($filetype) ? $filetype : "";
$query .= Parser::first_comma($commaId, ", ") . "'{$filetype}'";
return $query;
}
示例9: realpath
<?php
/**
* Configurations inclusion
*/
require_once realpath(dirname(__FILE__)) . "/settings.inc.php";
if (Settings::getOperativeMode() == "release") {
error_reporting(E_ERROR);
}
require_once realpath(dirname(__FILE__)) . "/config.inc.php";
require_once realpath(dirname(__FILE__)) . "/message.inc.php";
require_once realpath(dirname(__FILE__)) . "/parser.inc.php";
require_once realpath(dirname(__FILE__)) . "/db.inc.php";
//$RESERVEDWORDS = Array('page');
class beContent
{
var $files, $selfrefs, $entities, $currentform, $comments;
private static $instance = null;
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new beContent();
}
return self::$instance;
}
function beContent()
{
}
}
$config = Config::getInstance()->getConfigurations();
/** SQL INJECTION PREVENTION PROCEDURE
示例10: loadFromFileSystem
public function loadFromFileSystem()
{
$this->supportedTaglibraries = array();
$folder_contents = scandir(realpath(dirname(__FILE__)) . "/catalog");
$debug = Settings::getOperativeMode() != "release";
if ($debug) {
echo "<br><br>";
}
foreach ($folder_contents as $k => $v) {
if ($v != "." && $v != "..") {
$tagLibraryIndex = explode(".", $v)[0];
if ($debug) {
var_dump($tagLibraryIndex);
}
if (is_dir(realpath(dirname(__FILE__) . "/catalog/" . $v))) {
if ($debug) {
echo "<br>**" . $v . " is dir<br>";
}
$this->supportedTaglibraries[$tagLibraryIndex] = new TagLibrary(null, dirname(__FILE__) . "/catalog/" . $v, "as_file_system_element");
} else {
if ($debug) {
echo "<br>**" . $v . " is not dir<br>";
}
$this->supportedTaglibraries[$tagLibraryIndex] = new $tagLibraryIndex(null, dirname(__FILE__) . "/catalog/" . $v, "as_file_system_element");
}
}
}
}
示例11: add
/**
* This metod is called to insert a new instance of an entity in database
*/
function add($baseEntity = null)
{
if (!isset($_REQUEST['page'])) {
$page = 0;
} else {
$page = $_REQUEST['page'];
}
/**
* retrieving all form elements in $_REQUEST
*/
/*
* FIXME
* creazione di una nuova baseEntity da legare ad una image non funziona correttamente.
* funziona se l'immagine è da creare ma se l'immagine è già presente non funziona correttamente
*/
foreach ($this->elements as $k => $v) {
if ($v->type == CHECKBOX) {
$token = explode(":", $v->values[1]);
if (!isset($_REQUEST[$token[1]])) {
$_REQUEST[$token[1]] = '';
}
} else {
foreach ($_FILES as $key => $value) {
$_REQUEST[$key] = $value;
}
}
}
/**
* the entity that is related to the main form
*/
$baseEntity = $this->entity;
/**
* Saving
*/
if (!$baseEntity->save($_REQUEST)) {
/**
* problems saving
*/
echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_GENERIC) . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
} else {
/*passing the key value for the just inserted entity*/
$_REQUEST[$this->entity->fields[0]->name] = $baseEntity->instances[0]->getKeyFieldValue();
foreach ($this->triggeredForms as $formKey => $form) {
$form->add($baseEntity);
}
}
if (Settings::getOperativeMode() == "debug") {
echo '<br />Form add debug';
echo '<br>form var_dump $request<br>';
var_dump($_REQUEST);
echo '<br />$_file ';
var_dump($_FILES);
}
if (!$this->debugmode) {
header("Location:{$_SERVER['SCRIPT_NAME']}?action=report");
}
return $content;
}
示例12: update
/**
*
* this method is responsible to update parameters of an entity
*
*
* @access public
* @param where_conditions
* @param set_parameters
* @ParamType where_conditions
* @ParamType set_parameters
*/
public function update($where_conditions, $set_parameters)
{
if (Settings::getOperativeMode() == 'release') {
echo '<br> Entity->update var_dump set_parameters<br>';
var_dump($set_parameters);
}
$query = "UPDATE {$this->name}";
$set_clause = "";
$where_clause = "";
$set_check = false;
$setId = md5(uniqid(mt_rand()));
foreach ($set_parameters as $k => $v) {
if ($this->existsField($k)) {
$set_clause .= $this->getField($k)->update($setId, $v);
$set_check = true;
}
}
$whereId = md5(uniqid(mt_rand()));
$where_check = false;
foreach ($where_conditions as $k => $v) {
if ($this->existsField($k)) {
$where_clause .= $this->getField($k)->generateSelectQueryPart($v, $this->name, $whereId);
$where_check = true;
}
}
if ($set_check) {
$query .= " SET " . $set_clause;
}
if ($where_check) {
$query .= " WHERE " . $where_clause;
}
$query .= " ;";
if (!$this->debugmode) {
echo "Entity::update for " . $this->name . ", query= <br>" . $query . "<br>";
}
if ($set_check) {
$turnback = mysql_query($query);
} else {
$turnback = $set_check;
}
return $turnback;
}
示例13: build
/**
* @access public
* @param preload
* @ParamType preload string
*/
public function build($preload)
{
$content = "";
switch ($this->orientation) {
case RIGHT:
$mainEntity = $this->form->entity->entity_1;
$secondaryEntity = $this->form->entity->entity_2;
$mainEntityRoleName = $this->form->entity->roleName1;
$secondaryEntityRoleName = $this->form->entity->roleName2;
break;
case LEFT:
$mainEntity = $this->form->entity->entity_2;
$secondaryEntity = $this->form->entity->entity_1;
$mainEntityRoleName = $this->form->entity->roleName2;
$secondaryEntityRoleName = $this->form->entity->roleName1;
break;
}
if (Settings::getOperativeMode() == 'debug') {
echo '<br />Relation Manager Field';
echo ' entity_1';
var_dump($mainEntity->name);
echo ' entity_2';
var_dump($secondaryEntity->name);
echo '<br />Orientation';
echo $this->orientation;
}
$relAttributes = $this->form->entity->fields;
/**
* Retrieving all instances for this entity
* (Observation, at this point a query filter as to be added)
*/
$secondaryEntity->retrieveAndLink();
if ($preload == PRELOAD && $mainEntity->loaded) {
$where_conditions = array($mainEntity->fields[0]->name . "_" . $mainEntity->name => $mainEntity->instances[0]->getKeyFieldValue());
$this->form->entity->retrieveAndLink($where_conditions);
}
foreach ($secondaryEntity->instances as $k => $instance) {
$presentation = $secondaryEntity->getPresentation();
$presentation = explode(", ", $presentation['fields']);
$text = "";
foreach ($presentation as $a => $v) {
$text = $instance->getFieldValue($v);
}
$key = md5(microtime()) . "_" . $this->form->formHash;
$name = "{$secondaryEntity->fields[0]->name}_{$secondaryEntity->name}_" . $key;
$relationExists = false;
$checked = "";
$foundRelation = null;
if ($preload == PRELOAD) {
foreach ($this->form->entity->instances as $relationInstanceKey => $relationInstance) {
if ($relationInstance->getFieldValue($secondaryEntityRoleName) == $instance->getKeyFieldValue() && $relationInstance->getFieldValue($mainEntityRoleName) == $mainEntity->instances[0]->getKeyFieldValue()) {
$relationExists = true;
$foundRelation = $relationInstance;
$checked = 'checked';
}
}
}
$content .= '<!--relation manager fields -->';
$content .= '<fieldset class="items">';
$content .= '<div id="ck-button">';
$content .= '<label>';
$content .= '<input class="" id="' . $name . '" type="checkbox" name="' . $name . '" value="' . $instance->getKeyFieldValue() . '" ' . $checked . ' />';
$content .= '<span>' . $text . '</span>';
$content .= '</label>';
$content .= '</div>';
$content .= '<div class="clear"> </div>';
// $content .= '<input class="mb20 h23 no_mt" id=" '. $name.' " type="checkbox" name=" '.$name.'" value="'.$instance->getKeyFieldValue().'"checked="'.$checked.'" />';
// $content .= '<label class="flt_lft line_height23 w150 right_align mr20" for="'.$name.'">'.$text.'</label>';
// $content .= '<div class="clear"> </div>';
for ($i = 3; $i < sizeof($this->form->entity->fields); $i++) {
$value = "";
if ($relationExists) {
$value = $foundRelation->getFieldValue($this->form->entity->fields[$i]->name);
}
$content .= '<div class="">';
$content .= '<label class="">' . $this->form->attributesNames[$relAttributes[$i]->name] . '</label>';
$content .= '<input class="" type="text" name="' . $relAttributes[$i]->name . '_' . $key . '" value="' . $value . '" />';
$content .= '</div>';
$content .= '<div class="clear"> </div>';
}
$content .= '</fieldset>';
}
$relationManagerSkinlet = new Skinlet("widget/RelationManager");
$relationManagerSkinlet->setContent("label", $this->label);
$relationManagerSkinlet->setContent("instances", $content);
return $relationManagerSkinlet->get();
}
示例14: build
/**
* @access public
* @param preload
* @ParamType preload string
*/
public function build($preload)
{
/**
* retrieving the field that has the same name of the graphic element that we're creating
*/
//$field_to_modify = $this->form->entity->getField($v['name']);
$field_to_modify = $this->form->entity->getField($this->name);
/**
* Observation, this time the field is a file so four fields are involved in the operation,
* for this reason four variables must be initialized
*/
$field_to_modify_type = $this->form->entity->getField($v['name'] . "_type");
$field_to_modify_filename = $this->form->entity->getField($v['name'] . "_filename");
$field_to_modify_reference = $this->form->entity->getField($v['name'] . "_reference");
if (Settings::getOperativeMode() == 'debug') {
echo '<br />debug in File Field widgets ';
echo '<br />field to modify ';
var_dump($field_to_modify);
echo '<br />field to modify type ';
var_dump($field_to_modify_type);
echo '<br />field to modify filename ';
var_dump($field_to_modify_filename);
echo '<br />field to modify reference ';
var_dump($field_to_modify_reference);
echo '<br />preload ';
var_dump($preload);
echo '<br />$v ';
var_dump($v);
}
if ($preload) {
if (isset($this->form->helpers[$v['name']])) {
$content .= " <td>{$v["label"]} <a href=# title=\"{$this->form->helpers[$v['name']]}\"><img src=\"img/form/help.gif\" class=\"helper\"></a> </td>\n";
} else {
$label = $v['label'];
//$content .= '<label>'.$v["label"].'</label>';
}
$name = $v['name'];
$value = $field_to_modify_filename;
//input hidden name + value
//$content .= "<input class=\"inl_blks cells mb20\" type=\"file\" name=\"{$v['name']}\"/>
// <input type=\"hidden\" name=\"{$v['name']}_hidden\" value=\"{$field_to_modify_filename}\" />\n";
if ($_REQUEST[$v['name']]) {
switch ($field_to_modify_type) {
case "image/jpeg":
case "image/gif":
/* IMAGE */
$content .= " <div class=\"image-show\" id=\"{$v['name']}\" >\n\n\t\t\t\t\t\t <input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled />\n\t\t\t\t\t\t <img src=\"img/beContent/show-gray.jpg\" onClick=\"image_show('{$v['name']}')\">\n\t\t\t\t\t\t <div id=\"{$v['name']}_img\">";
$content .= "<span>" . $field_to_modify_type . "</span><br />\n<img class=\"left\" src=\"show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}&width=188\">\n</div>\n</div>";
$content .= " <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_delete\" value=\"*\"> " . Message::getInstance()->getMessage(MSG_FILE_DELETE);
break;
case "video/x-flv":
case "application/octet-stream":
/*
FLASH VIDEO FLV
The extension should be checked since anything can be
uploaded here.
*/
$content .= " <div class=\"image-show\" id=\"{$v['name']}\" >\n<input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled /><img src=\"img/beContent/show-gray.jpg\" onClick=\"image_show('{$v['name']}')\">\n<div id=\"{$v['name']}_img\">\n";
$src = "show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}";
$width = 200;
$height = 150;
$content .= "<script type=\"text/javascript\">\nAC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','{$width}','height','{$height}','id','FLVPlayer2','src','FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','FLVPlayer_Progressive' );\n</script>\n<noscript>\n<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"{$width}\" height=\"{$height}\" id=\"FLVPlayer2\">\n<param name=\"movie\" value=\"FLVPlayer_Progressive.swf\" />\n<param name=\"salign\" value=\"lt\" />\n<param name=\"scale\" value=\"noscale\" />\n<param name=\"FlashVars\" value=\"&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false\" />\n<embed src=\"FLVPlayer_Progressive.swf\" flashvars=\"&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false\" scale=\"noscale\" width=\"{$width}\" height=\"{$height}\" name=\"FLVPlayer\" salign=\"LT\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" />\n</object>\n</noscript>\n";
$content .= "</div>\n";
break;
default:
/* UNKNOWN MIME TYPE */
$content .= " <div class=\"image-show\" id=\"{$v['name']}\" ><input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled /><a target=\"_blank\" title=\"{$field_to_modify_filename}\" href=\"show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}\"><img src=\"img/beContent/show-gray-link.jpg\"></a></div>";
$content .= "<input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_delete\" value=\"*\"> " . Message::getInstance()->getMessage(MSG_FILE_DELETE);
break;
}
$content .= "\n";
} else {
/* EMPTY */
$content .= " <div class=\"image-show\" ><input type=\"text\" class=\"file\" value=\"" . Message::getInstance()->getMessage(MSG_FILE_NONE) . "\" disabled /><img src=\"img/beContent/show-gray-disabled.jpg\"></div> </td>\n";
#$content .= "(".Message::getInstance()->getMessage(MSG_FILE_NONE).") </td>\n";
}
} else {
if (isset($this->form->helpers[$v['name']])) {
$content .= " <td>{$v["label"]} <a href=# title=\"{$this->form->helpers[$v['name']]}\"><img src=\"img/form/help.gif\" class=\"helper\"></a> </td>\n";
} else {
echo $label = $v['label'];
//$content .= '<label>'.$v["label"].'</label>';
}
//$this->name = $v['name'];
//$content .= '<input type="file" name="'.$v['name'].'" />';
}
$widget = new Skinlet("widget/FileField");
$widget->setContent("label", $this->label);
$widget->setContent("name", $this->name);
$widget->setContent('value', $value);
$widget->setContent("loggedUsername", $_SESSION["user"]["username"]);
$widget->setContent("preloadedImageId", $preloadedId);
return $widget->get();
}