Пример #1
0
" size="80" name="sbr_name" class="b-combo__input-text" id="sbr_name">
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table b-layout__table_width_full b-layout__table_margbot_20">
        <tr class="b-layout__tr">
            <td class="b-layout__left b-layout__left_width_150">
                <div class="b-layout__txt b-layout__txt_padtop_5">Название этапа</div>
            </td>
            <td class="b-layout__right">
                <div class="b-combo">
                    <div class="b-combo__input">
                        <input type="text" value="<?php 
    echo html_attr($op['stage_name']);
    ?>
" maxlength="<?php 
    echo sbr::NAME_LENGTH;
    ?>
" size="80" name="stage_name" class="b-combo__input-text" id="stage_name">
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <?php 
}
//if
?>
	<div class="b-textarea b-textarea_padtop_10">
Пример #2
0
        ?>
][add_wt_switch]" onchange="SBR.getStageByItem(this).setWTime(null,1)">
                                      <option value="+"<?php 
        echo $stage->data['add_wt_switch'] == '+' ? ' selected="selected"' : '';
        ?>
>Добавить</option>
                                      <option value="-"<?php 
        echo $stage->data['add_wt_switch'] == '-' ? ' selected="selected"' : '';
        ?>
>Отнять</option>
                                    </select>
                                    <input name="stages[<?php 
        echo $num;
        ?>
][add_work_time]" type="text" size="4" value="<?php 
        echo html_attr($stage->data['add_work_time']);
        ?>
" maxlength="3" onfocus="SBR.adErrCls(this)" onchange="SBR.getStageByItem(this).setWTime(this.value)" onkeyup="SBR.getStageByItem(this).setWTime(this.value, null, true)" onkeydown="return SBR.cancelEnter(event)"/> (дней)
                                </span>
                            <?php 
    }
    ?>
                        </div>
                    </div>
                </div>
                <b class="b2"></b>
                <b class="b1"></b>
            <input type="hidden" name="stages[<?php 
    echo $num;
    ?>
][id]" value="<?php 
Пример #3
0
    $selop->ListData = array_keys($GLOBALS['filter_operators']);
    $selop->SelectName = "FilterOperator[{$i}]";
    $selop->SelectedData = $FilterOperator[$i];
    $selop->Render();
    echo $selop->HTML;
    ?>
			</div>
			<div class="col-md-2 vspacer-md">
				<?php 
    /* Comparison expression */
    ?>
				<input name="FilterValue[<?php 
    echo $i;
    ?>
]" value="<?php 
    echo html_attr($FilterValue[$i]);
    ?>
" class="form-control">
			</div>
			<div class="col-md-2 vspacer-md">
				<button type="button" class="btn btn-default clear_filter" id="filter_<?php 
    echo $i;
    ?>
"><i class="glyphicon glyphicon-trash text-danger"></i></button>
			</div>
		</div>
		<?php 
}
?>

<script>
Пример #4
0
    exit;
}
?>

<form method="post" action="" id="frm">
    <?php 
foreach ($_POST as $k => $v) {
    if ($k == 'u_token_key') {
        continue;
    }
    ?>
    <input type="hidden" name="<?php 
    echo $k;
    ?>
" value="<?php 
    echo html_attr($v);
    ?>
"/>
    <?php 
}
?>
    <input type="hidden" name="step" id="step_fld" value="1"/>
    <input type="hidden" name="u_token_key" value="<?php 
echo $_SESSION['rand'];
?>
"/>
</form>
<?php 
if (!$lc || !$lc->id) {
    ?>
<script>
Пример #5
0
 public function set_attributes($tag = 'body', $attributes)
 {
     // $attributes: string or array
     $tag = strtolower($tag);
     if (!in_array($tag, array('body', 'html'))) {
         return;
     }
     $this->_ci->load->_ci_cached_vars['template_' . $tag . '_tag_attributes'] = html_attr($attributes);
 }
Пример #6
0
 function Render()
 {
     // get post and get variables
     global $Translation, $adminConfig;
     $FiltersPerGroup = 4;
     $buttonWholeWidth = 136;
     $current_view = '';
     /* TV, DV, TVDV, TVP, DVP, Filters */
     $Embedded = intval($_REQUEST['Embedded']);
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         $SortField = $_GET["SortField"];
         $SortDirection = $_GET["SortDirection"];
         $FirstRecord = $_GET["FirstRecord"];
         $ScrollUp_y = $_GET["ScrollUp_y"];
         $ScrollDn_y = $_GET["ScrollDn_y"];
         $Previous_x = $_GET["Previous_x"];
         $Next_x = $_GET["Next_x"];
         $Filter_x = $_GET["Filter_x"];
         $SaveFilter_x = $_GET["SaveFilter_x"];
         $NoFilter_x = $_GET["NoFilter_x"];
         $CancelFilter = $_GET["CancelFilter"];
         $ApplyFilter = $_GET["ApplyFilter"];
         $Search_x = $_GET["Search_x"];
         $SearchString = get_magic_quotes_gpc() ? stripslashes($_GET['SearchString']) : $_GET['SearchString'];
         $CSV_x = $_GET["CSV_x"];
         $FilterAnd = $_GET["FilterAnd"];
         $FilterField = $_GET["FilterField"];
         $FilterOperator = $_GET["FilterOperator"];
         if (is_array($_GET['FilterValue'])) {
             foreach ($_GET['FilterValue'] as $fvi => $fv) {
                 $FilterValue[$fvi] = get_magic_quotes_gpc() ? stripslashes($fv) : $fv;
             }
         }
         $Print_x = $_GET['Print_x'];
         $PrintTV = $_GET['PrintTV'];
         $PrintDV = $_GET['PrintDV'];
         $SelectedID = get_magic_quotes_gpc() ? stripslashes($_GET['SelectedID']) : $_GET['SelectedID'];
         $insert_x = $_GET['insert_x'];
         $update_x = $_GET['update_x'];
         $delete_x = $_GET['delete_x'];
         $SkipChecks = $_GET['confirmed'];
         $deselect_x = $_GET['deselect_x'];
         $addNew_x = $_GET['addNew_x'];
         $dvprint_x = $_GET['dvprint_x'];
         $DisplayRecords = in_array($_GET['DisplayRecords'], array('user', 'group')) ? $_GET['DisplayRecords'] : 'all';
     } else {
         $SortField = $_POST['SortField'];
         $SortDirection = $_POST['SortDirection'];
         $FirstRecord = $_POST['FirstRecord'];
         $ScrollUp_y = $_POST['ScrollUp_y'];
         $ScrollDn_y = $_POST['ScrollDn_y'];
         $Previous_x = $_POST['Previous_x'];
         $Next_x = $_POST['Next_x'];
         $Filter_x = $_POST['Filter_x'];
         $SaveFilter_x = $_POST['SaveFilter_x'];
         $NoFilter_x = $_POST['NoFilter_x'];
         $CancelFilter = $_POST['CancelFilter'];
         $ApplyFilter = $_POST['ApplyFilter'];
         $Search_x = $_POST['Search_x'];
         $SearchString = get_magic_quotes_gpc() ? stripslashes($_POST['SearchString']) : $_POST['SearchString'];
         $CSV_x = $_POST['CSV_x'];
         $FilterAnd = $_POST['FilterAnd'];
         $FilterField = $_POST['FilterField'];
         $FilterOperator = $_POST['FilterOperator'];
         if (is_array($_POST['FilterValue'])) {
             foreach ($_POST['FilterValue'] as $fvi => $fv) {
                 $FilterValue[$fvi] = get_magic_quotes_gpc() ? stripslashes($fv) : $fv;
             }
         }
         $Print_x = $_POST['Print_x'];
         $PrintTV = $_POST['PrintTV'];
         $PrintDV = $_POST['PrintDV'];
         $SelectedID = get_magic_quotes_gpc() ? stripslashes($_POST['SelectedID']) : $_POST['SelectedID'];
         $insert_x = $_POST['insert_x'];
         $update_x = $_POST['update_x'];
         $delete_x = $_POST['delete_x'];
         $SkipChecks = $_POST['confirmed'];
         $deselect_x = $_POST['deselect_x'];
         $addNew_x = $_POST['addNew_x'];
         $dvprint_x = $_POST['dvprint_x'];
         $DisplayRecords = in_array($_POST['DisplayRecords'], array('user', 'group')) ? $_POST['DisplayRecords'] : 'all';
     }
     // insure authenticity of user inputs:
     if (!$this->AllowDelete) {
         $delete_x = '';
     }
     if (!$this->AllowDeleteOfParents) {
         $SkipChecks = '';
     }
     if (!$this->AllowInsert) {
         $insert_x = '';
         $addNew_x = '';
     }
     if (!$this->AllowUpdate) {
         $update_x = '';
     }
     if (!$this->AllowFilters) {
         $Filter_x = '';
     }
     if (!$this->AllowPrinting) {
         $Print_x = '';
         $PrintDV = '';
         $PrintTV = '';
     }
     if (!$this->AllowPrintingMultiSelection) {
         $PrintDV = '';
         $PrintTV = '';
     }
     if (!$this->QuickSearch) {
         $SearchString = '';
     }
     if (!$this->AllowCSV) {
         $CSV_x = '';
     }
     // enforce record selection if user has edit/delete permissions on the current table
     $AllowPrintDV = 1;
     $this->Permissions = getTablePermissions($this->TableName);
     if ($this->Permissions[3] || $this->Permissions[4]) {
         // current user can edit or delete?
         $this->AllowSelection = 1;
     } elseif (!$this->AllowSelection) {
         $SelectedID = '';
         $AllowPrintDV = 0;
         $PrintDV = '';
     }
     if (!$this->AllowSelection || !$SelectedID) {
         $dvprint_x = '';
     }
     $this->QueryFieldsIndexed = reIndex($this->QueryFieldsFilters);
     // determine type of current view: TV, DV, TVDV, TVP, DVP or Filters?
     if ($this->SeparateDV) {
         $current_view = 'TV';
         if ($Print_x != '' || $PrintTV != '') {
             $current_view = 'TVP';
         } elseif ($dvprint_x != '' || $PrintDV != '') {
             $current_view = 'DVP';
         } elseif ($Filter_x != '') {
             $current_view = 'Filters';
         } elseif ($SelectedID && !$deselect_x && !$delete_x || $addNew_x != '') {
             $current_view = 'DV';
         }
     } else {
         $current_view = 'TVDV';
         if ($Print_x != '' || $PrintTV != '') {
             $current_view = 'TVP';
         } elseif ($dvprint_x != '' || $PrintDV != '') {
             $current_view = 'DVP';
         } elseif ($Filter_x != '') {
             $current_view = 'Filters';
         }
     }
     $this->HTML .= '<div class="row"><div class="col-xs-11 col-md-12">';
     $this->HTML .= '<form ' . (datalist_image_uploads_exist ? 'enctype="multipart/form-data" ' : '') . 'method="post" name="myform" action="' . $this->ScriptFileName . '">';
     if ($Embedded) {
         $this->HTML .= '<input name="Embedded" value="1" type="hidden" />';
     }
     $this->HTML .= '<script>';
     $this->HTML .= 'function enterAction(){';
     $this->HTML .= '   if($$("input[name=SearchString]:focus")[0] != undefined){ $("Search").click(); }';
     $this->HTML .= '   return false;';
     $this->HTML .= '}';
     $this->HTML .= '</script>';
     $this->HTML .= '<input id="EnterAction" type="submit" style="position: absolute; left: 0px; top: -250px;" onclick="return enterAction();">';
     $this->ContentType = 'tableview';
     // default content type
     if ($PrintTV != '') {
         $Print_x = 1;
         $_POST['Print_x'] = 1;
     }
     // handle user commands ...
     if ($deselect_x != '') {
         $SelectedID = '';
         $this->showTV();
     } elseif ($insert_x != '') {
         $SelectedID = call_user_func($this->TableName . '_insert');
         // redirect to a safe url to avoid refreshing and thus
         // insertion of duplicate records.
         $url = $this->RedirectAfterInsert;
         $insert_status = 'record-added-ok=' . rand();
         if (!$SelectedID) {
             $insert_status = 'record-added-error=' . rand();
         }
         // compose filters and sorting
         foreach ($this->filterers as $filterer => $caption) {
             if ($_REQUEST['filterer_' . $filterer] != '') {
                 $filtersGET .= '&filterer_' . $filterer . '=' . urlencode($_REQUEST['filterer_' . $filterer]);
             }
         }
         for ($i = 1; $i <= 20 * $FiltersPerGroup; $i++) {
             // Number of filters allowed
             if ($FilterField[$i] != '' && $FilterOperator[$i] != '' && ($FilterValue[$i] != '' || strstr($FilterOperator[$i], 'Empty'))) {
                 $filtersGET .= "&FilterAnd[{$i}]={$FilterAnd[$i]}&FilterField[{$i}]={$FilterField[$i]}&FilterOperator[{$i}]={$FilterOperator[$i]}&FilterValue[{$i}]=" . urlencode($FilterValue[$i]);
             }
         }
         $filtersGET .= "&SortField={$SortField}&SortDirection={$SortDirection}&FirstRecord={$FirstRecord}&Embedded={$Embedded}";
         $filtersGET .= "&DisplayRecords={$DisplayRecords}";
         $filtersGET .= '&SearchString=' . urlencode($SearchString);
         $filtersGET = substr($filtersGET, 1);
         // remove initial &
         if ($url) {
             /* if designer specified a redirect-after-insert url */
             $url .= (strpos($url, '?') !== false ? '&' : '?') . $insert_status;
             $url .= strpos($url, $this->ScriptFileName) !== false ? "&{$filtersGET}" : '';
             $url = str_replace("#ID#", urlencode($SelectedID), $url);
         } else {
             /* if no redirect-after-insert url, use default */
             $url = "{$this->ScriptFileName}?{$insert_status}&{$filtersGET}";
             /* if DV and TV in same page, select new record */
             if (!$this->SeparateDV) {
                 $url .= '&SelectedID=' . urlencode($SelectedID);
             }
         }
         @header('Location: ' . $url);
         $this->HTML .= "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;url=" . $url . "\">";
         return;
     } elseif ($delete_x != '') {
         $d = call_user_func($this->TableName . '_delete', $SelectedID, $this->AllowDeleteOfParents, $SkipChecks);
         if ($d) {
             //$_REQUEST['record-deleted-error'] = 1;
             $this->HTML .= error_message($d);
         } else {
             $_REQUEST['record-deleted-ok'] = 1;
             $SelectedID = '';
             $this->showTV();
         }
     } elseif ($update_x != '') {
         $updated = call_user_func($this->TableName . '_update', $SelectedID);
         $update_status = 'record-updated-ok=' . rand();
         if ($updated === false) {
             $update_status = 'record-updated-error=' . rand();
         }
         // compose filters and sorting
         foreach ($this->filterers as $filterer => $caption) {
             if ($_REQUEST['filterer_' . $filterer] != '') {
                 $filtersGET .= '&filterer_' . $filterer . '=' . urlencode($_REQUEST['filterer_' . $filterer]);
             }
         }
         for ($i = 1; $i <= 20 * $FiltersPerGroup; $i++) {
             // Number of filters allowed
             if ($FilterField[$i] != '' && $FilterOperator[$i] != '' && ($FilterValue[$i] != '' || strstr($FilterOperator[$i], 'Empty'))) {
                 $filtersGET .= "&FilterAnd[{$i}]={$FilterAnd[$i]}&FilterField[{$i}]={$FilterField[$i]}&FilterOperator[{$i}]={$FilterOperator[$i]}&FilterValue[{$i}]=" . urlencode($FilterValue[$i]);
             }
         }
         $filtersGET .= "&SortField={$SortField}&SortDirection={$SortDirection}&FirstRecord={$FirstRecord}&Embedded={$Embedded}";
         $filtersGET .= "&DisplayRecords={$DisplayRecords}";
         $filtersGET .= '&SearchString=' . urlencode($SearchString);
         $filtersGET = substr($filtersGET, 1);
         // remove initial &
         $redirectUrl = $this->ScriptFileName . '?SelectedID=' . urlencode($SelectedID) . '&' . $filtersGET . '&' . $update_status;
         @header("Location: {$redirectUrl}");
         $this->HTML .= '<META HTTP-EQUIV="Refresh" CONTENT="0;url=' . $redirectUrl . '">';
         return;
     } elseif ($addNew_x != '') {
         $SelectedID = '';
         $this->hideTV();
     } elseif ($Print_x != '') {
         // print code here ....
         $this->AllowNavigation = 0;
         $this->AllowSelection = 0;
     } elseif ($SaveFilter_x != '' && $this->AllowSavingFilters) {
         $SourceCode .= '<form method="post" action="' . $_SERVER['HTTP_REFERER'] . '">' . "\n";
         for ($i = 1; $i <= 20 * $FiltersPerGroup; $i++) {
             // Number of filters allowed
             if ($i % $FiltersPerGroup == 1 && $i != 1 && $FilterAnd[$i] != '') {
                 $SourceCode .= "\t<input name=\"FilterAnd[{$i}]\" value=\"{$FilterAnd[$i]}\" type=\"hidden\">\n";
             }
             if ($FilterField[$i] != '' && $FilterOperator[$i] != '' && ($FilterValue[$i] != '' || strstr($FilterOperator[$i], 'Empty'))) {
                 if (!strstr($SourceCode, "\t<input name=\"FilterAnd[{$i}]\" value=\"")) {
                     $SourceCode .= "\t<input name=\"FilterAnd[{$i}]\" value=\"{$FilterAnd[$i]}\" type=\"hidden\">\n";
                 }
                 $SourceCode .= "\t<input name=\"FilterField[{$i}]\" value=\"{$FilterField[$i]}\" type=\"hidden\">\n";
                 $SourceCode .= "\t<input name=\"FilterOperator[{$i}]\" value=\"{$FilterOperator[$i]}\" type=\"hidden\">\n";
                 $SourceCode .= "\t<input name=\"FilterValue[{$i}]\" value=\"" . html_attr($FilterValue[$i]) . "\" type=\"hidden\">\n\n";
             }
         }
         $SourceCode .= "\n\t<input type=\"submit\" value=\"Show Filtered Data\">\n";
         $SourceCode .= "</form>";
         $this->HTML .= '<div class="row"><div class="col-md-6 col-md-offset-3">';
         $this->HTML .= '<div class="panel panel-info">';
         $this->HTML .= '<div class="panel-heading"><h3 class="panel-title">' . $Translation["saved filters title"] . "</h3></div>";
         $this->HTML .= '<div class="panel-body">';
         $this->HTML .= $Translation["saved filters instructions"];
         $this->HTML .= '<textarea class="form-control vspacer-lg" rows="12" wrap="off">' . $SourceCode . '</textarea>';
         $this->HTML .= '<button type="submit" class="btn btn-default btn-block"><i class="glyphicon glyphicon-remove"></i> ' . $Translation['hide code'] . '</button>';
         $this->HTML .= '</div>';
         $this->HTML .= '</div>';
         $this->HTML .= '</div></div>';
     } elseif ($Filter_x != '') {
         $orderBy = array();
         if ($SortField) {
             $sortFields = explode(',', $SortField);
             $i = 0;
             foreach ($sortFields as $sf) {
                 $tob = preg_split('/\\s+/', $sf, 2);
                 $orderBy[] = array(trim($tob[0]) => strtolower(trim($tob[1])) == 'desc' ? 'desc' : 'asc');
                 $i++;
             }
             $orderBy[$i - 1][$tob[0]] = strtolower(trim($SortDirection)) == 'desc' ? 'desc' : 'asc';
         }
         $currDir = dirname(__FILE__) . '/hooks';
         // path to hooks folder
         $mi = getMemberInfo();
         $uff = "{$currDir}/{$this->TableName}.filters.{$mi['username']}.php";
         // user-specific filter file
         $gff = "{$currDir}/{$this->TableName}.filters.{$mi['group']}.php";
         // group-specific filter file
         $tff = "{$currDir}/{$this->TableName}.filters.php";
         // table-specific filter file
         /*
         	if no explicit filter file exists, look for filter files in the hooks folder in this order:
         		1. tablename.filters.username.php ($uff)
         		2. tablename.filters.groupname.php ($gff)
         		3. tablename.filters.php ($tff)
         */
         if (!is_file($this->FilterPage)) {
             $this->FilterPage = 'defaultFilters.php';
             if (is_file($uff)) {
                 $this->FilterPage = $uff;
             } elseif (is_file($gff)) {
                 $this->FilterPage = $gff;
             } elseif (is_file($tff)) {
                 $this->FilterPage = $tff;
             }
         }
         if ($this->FilterPage != '') {
             ob_start();
             @(include $this->FilterPage);
             $out = ob_get_contents();
             ob_end_clean();
             $this->HTML .= $out;
         }
         // hidden variables ....
         $this->HTML .= '<input name="SortField" value="' . $SortField . '" type="hidden" />';
         $this->HTML .= '<input name="SortDirection" type="hidden" value="' . $SortDirection . '" />';
         $this->HTML .= '<input name="FirstRecord" type="hidden" value="1" />';
         $this->ContentType = 'filters';
         return;
     } elseif ($NoFilter_x != '') {
         // clear all filters ...
         for ($i = 1; $i <= datalist_filters_count * $FiltersPerGroup; $i++) {
             // Number of filters allowed
             $FilterField[$i] = '';
             $FilterOperator[$i] = '';
             $FilterValue[$i] = '';
         }
         $DisplayRecords = 'all';
         $SearchString = '';
         $FirstRecord = 1;
         // clear filterers
         foreach ($this->filterers as $filterer => $caption) {
             $_REQUEST['filterer_' . $filterer] = '';
         }
     } elseif ($SelectedID) {
         $this->hideTV();
     }
     // apply lookup filterers to the query
     foreach ($this->filterers as $filterer => $caption) {
         if ($_REQUEST['filterer_' . $filterer] != '') {
             if ($this->QueryWhere == '') {
                 $this->QueryWhere = "where ";
             } else {
                 $this->QueryWhere .= " and ";
             }
             $this->QueryWhere .= "`{$this->TableName}`.`{$filterer}`='" . makeSafe($_REQUEST['filterer_' . $filterer]) . "' ";
             break;
             // currently, only one filterer can be applied at a time
         }
     }
     // apply quick search to the query
     if ($SearchString != '') {
         if ($Search_x != '') {
             $FirstRecord = 1;
         }
         if ($this->QueryWhere == '') {
             $this->QueryWhere = "where ";
         } else {
             $this->QueryWhere .= " and ";
         }
         foreach ($this->QueryFieldsQS as $fName => $fCaption) {
             if (strpos($fName, '<img') === False) {
                 $this->QuerySearchableFields[$fName] = $fCaption;
             }
         }
         $this->QueryWhere .= '(' . implode(" LIKE '%" . makeSafe($SearchString) . "%' or ", array_keys($this->QuerySearchableFields)) . " LIKE '%" . makeSafe($SearchString) . "%')";
     }
     // set query filters
     $QueryHasWhere = 0;
     if (strpos($this->QueryWhere, 'where ') !== FALSE) {
         $QueryHasWhere = 1;
     }
     $WhereNeedsClosing = 0;
     for ($i = 1; $i <= datalist_filters_count * $FiltersPerGroup; $i += $FiltersPerGroup) {
         // Number of filters allowed
         // test current filter group
         $GroupHasFilters = 0;
         for ($j = 0; $j < $FiltersPerGroup; $j++) {
             if ($FilterField[$i + $j] != '' && $this->QueryFieldsIndexed[$FilterField[$i + $j]] != '' && $FilterOperator[$i + $j] != '' && ($FilterValue[$i + $j] != '' || strstr($FilterOperator[$i + $j], 'Empty'))) {
                 $GroupHasFilters = 1;
                 break;
             }
         }
         if ($GroupHasFilters) {
             if (!stristr($this->QueryWhere, "where ")) {
                 $this->QueryWhere = "where (";
             } elseif ($QueryHasWhere) {
                 $this->QueryWhere .= " and (";
                 $QueryHasWhere = 0;
             }
             $this->QueryWhere .= " <FilterGroup> " . $FilterAnd[$i] . " (";
             for ($j = 0; $j < $FiltersPerGroup; $j++) {
                 if ($FilterField[$i + $j] != '' && $this->QueryFieldsIndexed[$FilterField[$i + $j]] != '' && $FilterOperator[$i + $j] != '' && ($FilterValue[$i + $j] != '' || strstr($FilterOperator[$i + $j], 'Empty'))) {
                     if ($FilterAnd[$i + $j] == '') {
                         $FilterAnd[$i + $j] = 'and';
                     }
                     // test for date/time fields
                     $tries = 0;
                     $isDateTime = FALSE;
                     $isDate = FALSE;
                     $fieldName = str_replace('`', '', $this->QueryFieldsIndexed[$FilterField[$i + $j]]);
                     list($tn, $fn) = explode('.', $fieldName);
                     while (!($res = sql("show columns from `{$tn}` like '{$fn}'", $eo)) && $tries < 2) {
                         $tn = substr($tn, 0, -1);
                         $tries++;
                     }
                     if ($row = @mysql_fetch_array($res)) {
                         if ($row['Type'] == 'date' || $row['Type'] == 'time') {
                             $isDateTime = TRUE;
                             if ($row['Type'] == 'date') {
                                 $isDate = True;
                             }
                         }
                     }
                     // end of test
                     if ($FilterOperator[$i + $j] == 'isEmpty' && !$isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " (" . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "='' or " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " is NULL) </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'isNotEmpty' && !$isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "!='' </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'isEmpty' && $isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " (" . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "=0 or " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " is NULL) </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'isNotEmpty' && $isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "!=0 </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'like' && !strstr($FilterValue[$i + $j], "%") && !strstr($FilterValue[$i + $j], "_")) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '%" . makeSafe($FilterValue[$i + $j]) . "%' </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'not like' && !strstr($FilterValue[$i + $j], "%") && !strstr($FilterValue[$i + $j], "_")) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '%" . makeSafe($FilterValue[$i + $j]) . "%' </FilterItem>";
                     } elseif ($isDate) {
                         $dateValue = toMySQLDate($FilterValue[$i + $j]);
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '{$dateValue}' </FilterItem>";
                     } else {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '" . makeSafe($FilterValue[$i + $j]) . "' </FilterItem>";
                     }
                 }
             }
             $this->QueryWhere .= ") </FilterGroup>";
             $WhereNeedsClosing = 1;
         }
     }
     if ($WhereNeedsClosing) {
         $this->QueryWhere .= ")";
     }
     // set query sort
     if (!stristr($this->QueryOrder, "order by ") && $SortField != '' && $this->AllowSorting) {
         $actualSortField = $SortField;
         foreach ($this->SortFields as $fieldNum => $fieldSort) {
             $actualSortField = str_replace(" {$fieldNum} ", " {$fieldSort} ", " {$actualSortField} ");
             $actualSortField = str_replace(",{$fieldNum} ", ",{$fieldSort} ", " {$actualSortField} ");
         }
         $this->QueryOrder = "order by {$actualSortField} {$SortDirection}";
     }
     // clean up query
     $this->QueryWhere = str_replace('( <FilterGroup> and ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('( <FilterGroup> or ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('( <FilterItem> and ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('( <FilterItem> or ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('<FilterGroup>', '', $this->QueryWhere);
     $this->QueryWhere = str_replace('</FilterGroup>', '', $this->QueryWhere);
     $this->QueryWhere = str_replace('<FilterItem>', '', $this->QueryWhere);
     $this->QueryWhere = str_replace('</FilterItem>', '', $this->QueryWhere);
     // if no 'order by' clause found, apply default sorting if specified
     if ($this->DefaultSortField != '' && $this->QueryOrder == '') {
         $this->QueryOrder = "order by " . $this->DefaultSortField . " " . $this->DefaultSortDirection;
     }
     // get count of matching records ...
     $TempQuery = 'SELECT count(1) from ' . $this->QueryFrom . ' ' . $this->QueryWhere;
     $RecordCount = sqlValue($TempQuery);
     $FieldCountTV = count($this->QueryFieldsTV);
     $FieldCountCSV = count($this->QueryFieldsCSV);
     $FieldCountFilters = count($this->QueryFieldsFilters);
     if (!$RecordCount) {
         $FirstRecord = 1;
     }
     // disable multi-selection if too many records to avoid browser performance issues
     if ($RecordCount > datalist_max_records_multi_selection) {
         $this->AllowPrintingMultiSelection = 0;
     }
     // Output CSV on request
     if ($CSV_x != '') {
         $this->HTML = '';
         if (datalist_db_encoding == 'UTF-8') {
             $this->HTML = "";
         }
         // BOM characters for UTF-8 output
         // execute query for CSV output
         $fieldList = '';
         foreach ($this->QueryFieldsCSV as $fn => $fc) {
             $fieldList .= "{$fn} as `{$fc}`, ";
         }
         $fieldList = substr($fieldList, 0, -2);
         $csvQuery = 'SELECT ' . $fieldList . ' from ' . $this->QueryFrom . ' ' . $this->QueryWhere . ' ' . $this->QueryOrder;
         // hook: table_csv
         if (function_exists($this->TableName . '_csv')) {
             $args = array();
             $mq = call_user_func($this->TableName . '_csv', $csvQuery, getMemberInfo(), $args);
             $csvQuery = $mq ? $mq : $csvQuery;
         }
         $result = sql($csvQuery, $eo);
         // output CSV field names
         for ($i = 0; $i < $FieldCountCSV; $i++) {
             $this->HTML .= "\"" . mysql_field_name($result, $i) . "\"" . $this->CSVSeparator;
         }
         $this->HTML .= "\n\n";
         // output CSV data
         while ($row = mysql_fetch_row($result)) {
             for ($i = 0; $i < $FieldCountCSV; $i++) {
                 $this->HTML .= "\"" . str_replace(array("\r\n", "\r", "\n", '"'), array(' ', ' ', ' ', '""'), strip_tags($row[$i])) . "\"" . $this->CSVSeparator;
             }
             $this->HTML .= "\n\n";
         }
         $this->HTML = str_replace($this->CSVSeparator . "\n\n", "\n", $this->HTML);
         $this->HTML = substr($this->HTML, 0, -1);
         // clean any output buffers
         while (@ob_end_clean()) {
         }
         // output CSV HTTP headers ...
         header('HTTP/1.1 200 OK');
         header('Date: ' . @date("D M j G:i:s T Y"));
         header('Last-Modified: ' . @date("D M j G:i:s T Y"));
         header("Content-Type: application/force-download");
         header("Content-Length: " . (string) strlen($this->HTML));
         header("Content-Transfer-Encoding: Binary");
         header("Content-Disposition: attachment; filename={$this->TableName}.csv");
         // send output and quit script
         echo $this->HTML;
         exit;
     }
     $t = time();
     // just a random number for any purpose ...
     // should SelectedID be reset on clicking TV buttons?
     $resetSelection = $this->SeparateDV ? "document.myform.SelectedID.value = '';" : "document.myform.writeAttribute('novalidate', 'novalidate');";
     if ($current_view == 'DV') {
         $this->HTML .= '<div class="page-header">';
         $this->HTML .= '<h1>';
         $this->HTML .= '<img src="' . $this->TableIcon . '"> ' . $this->TableTitle;
         $this->HTML .= '</h1>';
         $this->HTML .= '</div>';
     }
     // quick search and TV action buttons
     if (!$this->HideTableView && !($dvprint_x && $this->AllowSelection && $SelectedID) && !$PrintDV) {
         $buttons_html = $quick_search_html = '';
         if ($Print_x == '') {
             // display 'Add New' icon
             if ($this->Permissions[1] && $this->SeparateDV) {
                 $buttons_html .= '<button type="submit" id="addNew" name="addNew_x" value="1" class="btn btn-success"><i class="glyphicon glyphicon-plus-sign"></i> ' . $Translation['Add New'] . '</button>';
                 $buttonsCount++;
             }
             // display Print icon
             if ($this->AllowPrinting) {
                 $buttons_html .= '<button onClick="document.myform.NoDV.value=1; ' . $resetSelection . ' return true;" type="submit" name="Print_x" id="Print" value="1" class="btn btn-default"><i class="glyphicon glyphicon-print"></i> ' . $Translation['Print Preview'] . '</button>';
                 $buttonsCount++;
             }
             // display CSV icon
             if ($this->AllowCSV) {
                 $buttons_html .= '<button onClick="document.myform.NoDV.value=1; ' . $resetSelection . ' return true;" type="submit" name="CSV_x" id="CSV" value="1" class="btn btn-default"><i class="glyphicon glyphicon-download-alt"></i> ' . $Translation['CSV'] . '</button>';
                 $buttonsCount++;
             }
             // display Filter icon
             if ($this->AllowFilters) {
                 $buttons_html .= '<button onClick="document.myform.NoDV.value=1; ' . $resetSelection . ' return true;" type="submit" name="Filter_x" id="Filter" value="1" class="btn btn-default"><i class="glyphicon glyphicon-filter"></i> ' . $Translation['filter'] . '</button>';
                 $buttonsCount++;
             }
             // display Show All icon
             if ($this->AllowFilters) {
                 $buttons_html .= '<button onClick="document.myform.NoDV.value=1; ' . $resetSelection . ' return true;" type="submit" name="NoFilter_x" id="NoFilter" value="1" class="btn btn-default"><i class="glyphicon glyphicon-remove-circle"></i> ' . $Translation['Reset Filters'] . '</button>';
                 $buttonsCount++;
             }
             $quick_search_html .= '<div class="input-group" id="quick-search">';
             $quick_search_html .= '<input tabindex="1" type="text" name="SearchString" value="' . htmlspecialchars($SearchString, ENT_QUOTES) . '" class="form-control" placeholder="' . htmlspecialchars($this->QuickSearchText) . '">';
             $quick_search_html .= '<span class="input-group-btn">';
             $quick_search_html .= '<button tabindex="2" name="Search_x" value="1" id="Search" type="submit" onClick="' . $resetSelection . ' document.myform.NoDV.value=1; return true;"  class="btn btn-default" title="' . htmlspecialchars($this->QuickSearchText) . '"><i class="glyphicon glyphicon-search"></i></button>';
             $quick_search_html .= '<button tabindex="3" name="NoFilter_x" value="1" id="NoFilter_x" type="submit" onClick="' . $resetSelection . ' document.myform.NoDV.value=1; return true;"  class="btn btn-default" title="' . htmlspecialchars($Translation['Reset Filters']) . '"><i class="glyphicon glyphicon-remove-circle"></i></button>';
             $quick_search_html .= '</span>';
             $quick_search_html .= '</div>';
         }
         $this->HTML .= '<div class="page-header">';
         $this->HTML .= '<h1>';
         $this->HTML .= '<div class="row">';
         $this->HTML .= '<div class="col-sm-8">';
         $this->HTML .= '<img src="' . $this->TableIcon . '"> ' . $this->TableTitle;
         $this->HTML .= '</div>';
         if ($this->QuickSearch) {
             $this->HTML .= '<div class="col-sm-4">';
             $this->HTML .= $quick_search_html;
             $this->HTML .= '</div>';
         }
         $this->HTML .= '</div>';
         $this->HTML .= '</h1>';
         $this->HTML .= '</div>';
         $this->HTML .= '<div id="topButtons">';
         $this->HTML .= '<div class="btn-group btn-group-lg visible-md visible-lg">' . $buttons_html . '</div>';
         $this->HTML .= '<div class="btn-group-vertical btn-group-lg visible-xs visible-sm">' . $buttons_html . '</div>';
         $this->HTML .= '<div class="clearfix"></div><p></p>';
         $this->HTML .= '</div>';
         if ($Print_x) {
             if ($this->AllowPrintingMultiSelection) {
                 $withSelected = '' . '<div class="btn-group hidden btn-group-lg" id="withSelected">' . '<button class="btn btn-default" type="submit" name="PrintTV" value="1"><i class="glyphicon glyphicon-print"></i> ' . $Translation['Print Preview Table View'] . '</button>' . ($AllowPrintDV ? '<button id="PrintDV" class="btn btn-default" type="submit" name="PrintDV" value="1"><i class="glyphicon glyphicon-print"></i> ' . $Translation['Print Preview Detail View'] . '</button>' : '') . '<button class="btn btn-default" type="submit" name="Print_x" value="1"><i class="glyphicon glyphicon-remove-circle"></i> ' . $Translation['Cancel Selection'] . '</button>' . '</div>' . '<script>' . 'var countSelected = 0; ' . 'jQuery(function(){' . 'setInterval("' . 'if(countSelected){ jQuery(\'#withSelected\').removeClass(\'hidden\'); }else{ jQuery(\'#withSelected\').addClass(\'hidden\'); }' . '", 500); ' . '});' . '</script>';
             }
             /* fix top margin for print-preview */
             $this->HTML .= '<style>body{ padding-top: 0 !important; }</style>';
             /* disable links inside table body to prevent printing their href */
             $this->HTML .= '<script>jQuery(function(){ jQuery("tbody a").removeAttr("href").removeAttr("rel"); });</script>';
             /* action buttons */
             $this->HTML .= '<div class="hidden-print">';
             $this->HTML .= '<div class="btn-toolbar">';
             $this->HTML .= '<div class="btn-group btn-group-lg">';
             $this->HTML .= '<button class="btn btn-primary" type="button" id="sendToPrinter" onClick="window.print();"><i class="glyphicon glyphicon-print"></i> ' . $Translation['Print'] . '</button>';
             $this->HTML .= '</div>';
             $this->HTML .= '<div class="btn-group btn-group-lg">';
             $this->HTML .= '<button class="btn btn-warning" type="submit"><i class="glyphicon glyphicon-remove-circle"></i> ' . $Translation['Cancel Printing'] . '</button>';
             $this->HTML .= '</div>';
             $this->HTML .= $withSelected;
             $this->HTML .= '</div>';
             $this->HTML .= '<div class="clearfix"></div><p></p>';
             $this->HTML .= '</div>';
         }
         // script for focusing into the search box on loading the page
         $this->HTML .= '<script>document.observe("dom:loaded", function() { if($$("input[name=SearchString]")){ $$("input[name=SearchString]")[0].focus(); } });</script>';
     }
     // begin table and display table title
     if (!$this->HideTableView && !($dvprint_x && $this->AllowSelection && $SelectedID) && !$PrintDV && !$Embedded) {
         $this->HTML .= '<div class="table-responsive"><table class="table table-striped table-bordered table-hover">';
         $this->HTML .= '<thead><tr>';
         if ($Print_x == '' || !$this->AllowPrintingMultiSelection) {
             $this->HTML .= '<th style="width: 18px;">' . ($this->AllowSelection ? '&nbsp;' : '') . "</th>";
         }
         if ($this->AllowPrintingMultiSelection && $Print_x != '') {
             $this->HTML .= '<th style="width: 18px;" class="text-center"><input class="hidden-print" type="checkbox" title="' . htmlspecialchars($Translation['Select all records']) . '" id="toggleAll" onclick="toggleAllRecords();"></th>';
         }
         // Templates
         if ($this->Template != '') {
             $rowTemplate = @implode('', @file('./' . $this->Template));
             if (!$rowTemplate) {
                 $rowTemplate = '';
                 $selrowTemplate = '';
             } else {
                 if ($this->SelectedTemplate != '') {
                     $selrowTemplate = @implode('', @file('./' . $this->SelectedTemplate));
                     if (!$selrowTemplate) {
                         $selrowTemplate = '';
                     }
                 } else {
                     $selrowTemplate = '';
                 }
             }
         } else {
             $rowTemplate = '';
             $selrowTemplate = '';
         }
         // process translations
         if ($rowTemplate) {
             foreach ($Translation as $symbol => $trans) {
                 $rowTemplate = str_replace("<%%TRANSLATION({$symbol})%%>", $trans, $rowTemplate);
             }
         }
         if ($selrowTemplate) {
             foreach ($Translation as $symbol => $trans) {
                 $selrowTemplate = str_replace("<%%TRANSLATION({$symbol})%%>", $trans, $selrowTemplate);
             }
         }
         // End of templates
         // $this->ccffv: map $FilterField values to field captions as stored in ColCaption
         $this->ccffv = array();
         foreach ($this->ColCaption as $captionIndex => $caption) {
             $ffv = 1;
             foreach ($this->QueryFieldsFilters as $uselessKey => $filterCaption) {
                 if ($caption == $filterCaption) {
                     $this->ccffv[$captionIndex] = $ffv;
                 }
                 $ffv++;
             }
         }
         // display table headers
         $totalColWidth = array_sum($this->ColWidth);
         $forceHeaderWidth = false;
         if ($rowTemplate == '' || $this->ShowTableHeader) {
             for ($i = 0; $i < count($this->ColCaption); $i++) {
                 /* Sorting icon and link */
                 $sort1 = $sort2 = $filterHint = '';
                 if ($this->AllowSorting == 1) {
                     if ($current_view != 'TVP') {
                         $sort1 = "<a href=\"{$this->ScriptFileName}?SortDirection=asc&SortField=" . $this->ColNumber[$i] . "\" onClick=\"{$resetSelection} document.myform.NoDV.value=1; document.myform.SortDirection.value='asc'; document.myform.SortField.value = '" . $this->ColNumber[$i] . "'; document.myform.submit(); return false;\" class=\"TableHeader\">";
                         $sort2 = "</a>";
                     }
                     if ($this->ColNumber[$i] == $SortField) {
                         $SortDirection = $SortDirection == "asc" ? "desc" : "asc";
                         if ($current_view != 'TVP') {
                             $sort1 = "<a href=\"{$this->ScriptFileName}?SortDirection={$SortDirection}&SortField=" . $this->ColNumber[$i] . "\" onClick=\"{$resetSelection} document.myform.NoDV.value=1; document.myform.SortDirection.value='{$SortDirection}'; document.myform.SortField.value = " . $this->ColNumber[$i] . "; document.myform.submit(); return false;\" class=\"TableHeader\">";
                         }
                         $sort2 = " <i class=\"text-warning glyphicon glyphicon-sort-by-attributes" . ($SortDirection == 'desc' ? '' : '-alt') . "\"></i>{$sort2}";
                         $SortDirection = $SortDirection == "asc" ? "desc" : "asc";
                     }
                 } else {
                     $sort1 = '';
                     $sort2 = '';
                 }
                 /* Filtering icon and hint */
                 if ($this->AllowFilters && is_array($FilterField)) {
                     // check to see if there is any filter applied on the current field
                     if (isset($this->ccffv[$i]) && in_array($this->ccffv[$i], $FilterField)) {
                         // render filter icon
                         $filterHint = '&nbsp;<button type="submit" class="btn btn-default btn-xs' . ($current_view == 'TVP' ? ' disabled' : '') . '" name="Filter_x" value="1" title="' . htmlspecialchars($Translation['filtered field']) . '"><i class="glyphicon glyphicon-filter"></i></button>';
                     }
                 }
                 $this->HTML .= "\t<th class=\"{$this->TableName}-{$this->ColFieldName[$i]}\" " . ($forceHeaderWidth ? ' style="width: ' . ($this->ColWidth[$i] ? $this->ColWidth[$i] : 100) . 'px;"' : '') . ">{$sort1}{$this->ColCaption[$i]}{$sort2}{$filterHint}</th>\n";
             }
         } else {
             // Display a Sort by drop down
             $this->HTML .= "\t<th><td colspan=" . (count($this->ColCaption) + 1) . ">";
             if ($this->AllowSorting == 1) {
                 $sortCombo = new Combo();
                 for ($i = 0; $i < count($this->ColCaption); $i++) {
                     $sortCombo->ListItem[] = $this->ColCaption[$i];
                     $sortCombo->ListData[] = $this->ColNumber[$i];
                 }
                 $sortCombo->SelectName = "FieldsList";
                 $sortCombo->SelectedData = $SortField;
                 $sortCombo->Class = 'TableBody';
                 $sortCombo->SelectedClass = 'TableBodySelected';
                 $sortCombo->Render();
                 $d = $sortCombo->HTML;
                 $d = str_replace('<select ', "<select onChange=\"document.myform.SortDirection.value='{$SortDirection}'; document.myform.SortField.value=document.myform.FieldsList.value; document.myform.NoDV.value=1; document.myform.submit();\" ", $d);
                 if ($SortField) {
                     $SortDirection = $SortDirection == "desc" ? "asc" : "desc";
                     $sort = "<a href=\"javascript: document.myform.NoDV.value=1; document.myform.SortDirection.value='{$SortDirection}'; document.myform.SortField.value='{$SortField}'; document.myform.submit();\" class=TableHeader><img src={$SortDirection}.gif border=0 width=11 height=11 hspace=3></a>";
                     $SortDirection = $SortDirection == "desc" ? "asc" : "desc";
                 } else {
                     $sort = '';
                 }
                 $this->HTML .= $Translation['order by'] . " {$d} {$sort}";
             }
             $this->HTML .= "</td></th>\n";
         }
         // table view navigation code ...
         if ($RecordCount && $this->AllowNavigation && $RecordCount > $this->RecordsPerPage) {
             while ($FirstRecord > $RecordCount) {
                 $FirstRecord -= $this->RecordsPerPage;
             }
             if ($FirstRecord == '' || $FirstRecord < 1) {
                 $FirstRecord = 1;
             }
             if ($Previous_x != '') {
                 $FirstRecord -= $this->RecordsPerPage;
                 if ($FirstRecord <= 0) {
                     $FirstRecord = 1;
                 }
             } elseif ($Next_x != '') {
                 $FirstRecord += $this->RecordsPerPage;
                 if ($FirstRecord > $RecordCount) {
                     $FirstRecord = $RecordCount - $RecordCount % $this->RecordsPerPage + 1;
                 }
                 if ($FirstRecord > $RecordCount) {
                     $FirstRecord = $RecordCount - $this->RecordsPerPage + 1;
                 }
                 if ($FirstRecord <= 0) {
                     $FirstRecord = 1;
                 }
             }
         } elseif ($RecordCount) {
             $FirstRecord = 1;
             $this->RecordsPerPage = 2000;
             // a limit on max records in print preview to avoid performance drops
         }
         // end of table view navigation code
         $this->HTML .= "\n\t</tr>\n\n</thead>\n\n<tbody><!-- tv data below -->\n";
         $i = 0;
         $hc = new CI_Input();
         $hc->charset = datalist_db_encoding;
         if ($RecordCount) {
             $i = $FirstRecord;
             // execute query for table view
             $fieldList = '';
             foreach ($this->QueryFieldsTV as $fn => $fc) {
                 $fieldList .= "{$fn} as `{$fc}`, ";
             }
             $fieldList = substr($fieldList, 0, -2);
             if ($this->PrimaryKey) {
                 $fieldList .= ", {$this->PrimaryKey} as '" . str_replace('`', '', $this->PrimaryKey) . "'";
             }
             $tvQuery = 'SELECT ' . $fieldList . ' from ' . $this->QueryFrom . ' ' . $this->QueryWhere . ' ' . $this->QueryOrder;
             $result = sql($tvQuery . " limit " . ($i - 1) . ",{$this->RecordsPerPage}", $eo);
             while (($row = mysql_fetch_array($result)) && $i < $FirstRecord + $this->RecordsPerPage) {
                 $alt = ($i - $FirstRecord) % 2;
                 if ($PrintTV && $_POST["select_{$row[$FieldCountTV]}"] != 1) {
                     continue;
                 }
                 $class = "TableBody" . ($alt ? 'Selected' : '') . ($fNumeric ? 'Numeric' : '');
                 if ($Print_x == '' || !$this->AllowPrintingMultiSelection) {
                     $this->HTML .= $SelectedID == $row[$FieldCountTV] ? '<tr class="active"><td class="text-center"><i class="glyphicon glyphicon-chevron-right"></i></td>' : '<tr><td class="text-center">&nbsp;</td>';
                 }
                 if ($this->AllowPrintingMultiSelection && $Print_x != '') {
                     $this->HTML .= "<tr><td class=\"text-center\"><input class=\"hidden-print\" type=\"checkbox\" id=\"select_{$row[$FieldCountTV]}\" name=\"select_{$row[$FieldCountTV]}\" value=\"1\" onclick=\"if(\$('select_{$row[$FieldCountTV]}').checked) countSelected++; else countSelected--;\"></td>";
                     $toggleAllScript .= "\$('select_{$row[$FieldCountTV]}').checked=s;";
                 }
                 // templates
                 if ($rowTemplate != '') {
                     if ($this->AllowSelection == 1 && $SelectedID == $row[$FieldCountTV] && $selrowTemplate != '') {
                         $rowTemp = $selrowTemplate;
                     } else {
                         $rowTemp = $rowTemplate;
                     }
                     if ($this->AllowSelection == 1 && $SelectedID != $row[$FieldCountTV]) {
                         $rowTemp = str_replace('<%%SELECT%%>', "<a onclick=\"document.myform.SelectedField.value=this.parentNode.cellIndex; document.myform.SelectedID.value='" . addslashes($row[$FieldCountTV]) . "'; document.myform.submit(); return false;\" href=\"{$this->ScriptFileName}?SelectedID=" . htmlspecialchars($row[$FieldCountTV], ENT_QUOTES) . "\" class=\"{$class}\" style=\"display: block; padding:0px;\">", $rowTemp);
                         $rowTemp = str_replace('<%%ENDSELECT%%>', '</a>', $rowTemp);
                     } else {
                         $rowTemp = str_replace('<%%SELECT%%>', '', $rowTemp);
                         $rowTemp = str_replace('<%%ENDSELECT%%>', '', $rowTemp);
                     }
                     for ($j = 0; $j < $FieldCountTV; $j++) {
                         $fieldTVCaption = current(array_slice($this->QueryFieldsTV, $j, 1));
                         $fd = $hc->xss_clean(nl2br($row[$j]));
                         /* Sanitize output against XSS attacks */
                         /*
                         	the TV template could contain field placeholders in the format 
                         	<%%FIELD_n%%> or <%%VALUE(Field name)%%> 
                         */
                         $rowTemp = str_replace("<%%FIELD_{$j}%%>", thisOr($fd), $rowTemp);
                         $rowTemp = str_replace("<%%VALUE({$fieldTVCaption})%%>", thisOr($fd), $rowTemp);
                         if (thisOr($fd) == '&nbsp;' && preg_match('/<a href=".*?&nbsp;.*?<\\/a>/i', $rowTemp, $m)) {
                             $rowTemp = str_replace($m[0], '', $rowTemp);
                         }
                     }
                     if ($alt && $SelectedID != $row[$FieldCountTV]) {
                         $rowTemp = str_replace("TableBody", "TableBodySelected", $rowTemp);
                         $rowTemp = str_replace("TableBodyNumeric", "TableBodySelectedNumeric", $rowTemp);
                         $rowTemp = str_replace("SelectedSelected", "Selected", $rowTemp);
                     }
                     if ($SearchString != '') {
                         $rowTemp = highlight($SearchString, $rowTemp);
                     }
                     $this->HTML .= $rowTemp;
                     $rowTemp = '';
                 } else {
                     // end of templates
                     for ($j = 0; $j < $FieldCountTV; $j++) {
                         $fType = mysql_field_type($result, $j);
                         $fNumeric = stristr($fType, 'int') || stristr($fType, 'float') || stristr($fType, 'decimal') || stristr($fType, 'numeric') || stristr($fType, 'real') || stristr($fType, 'double') ? true : false;
                         if ($this->AllowSelection == 1) {
                             $sel1 = "<a href=\"{$this->ScriptFileName}?SelectedID=" . htmlspecialchars($row[$FieldCountTV], ENT_QUOTES) . "\" onclick=\"document.myform.SelectedID.value='" . addslashes($row[$FieldCountTV]) . "'; document.myform.submit(); return false;\" class=\"{$class}\" style=\"padding:0px;\">";
                             $sel2 = "</a>";
                         } else {
                             $sel1 = '';
                             $sel2 = '';
                         }
                         $this->HTML .= "<td valign=top class={$class}><div class={$class}>&nbsp;{$sel1}" . $row[$j] . "{$sel2}&nbsp;</div></td>";
                     }
                 }
                 $this->HTML .= "</tr>\n";
                 $i++;
             }
             $i--;
         }
         $this->HTML = preg_replace("/<a href=\"(mailto:)?&nbsp;[^\n]*title=\"&nbsp;\"><\\/a>/", '&nbsp;', $this->HTML);
         $this->HTML = preg_replace("/<a [^>]*>(&nbsp;)*<\\/a>/", '&nbsp;', $this->HTML);
         $this->HTML = preg_replace("/<%%.*%%>/U", '&nbsp;', $this->HTML);
         // end of data
         $this->HTML .= '<!-- tv data above -->';
         $this->HTML .= "\n</tbody>";
         if ($Print_x == '') {
             // TV
             $pagesMenu = '';
             if ($RecordCount > $this->RecordsPerPage) {
                 $pagesMenuId = "{$this->TableName}_pagesMenu";
                 $pagesMenu = $Translation['go to page'] . ' <select class="input-sm" id="' . $pagesMenuId . '" onChange="document.myform.writeAttribute(\'novalidate\', \'novalidate\'); document.myform.NoDV.value=1; document.myform.FirstRecord.value=(this.value * ' . $this->RecordsPerPage . '+1); document.myform.submit();">';
                 $pagesMenu .= '</select>';
                 $pagesMenu .= '<script>';
                 $pagesMenu .= 'var lastPage = ' . (ceil($RecordCount / $this->RecordsPerPage) - 1) . ';';
                 $pagesMenu .= 'var currentPage = ' . ($FirstRecord - 1) / $this->RecordsPerPage . ';';
                 $pagesMenu .= 'var pagesMenu = document.getElementById("' . $pagesMenuId . '");';
                 $pagesMenu .= 'var lump = ' . datalist_max_page_lump . ';';
                 $pagesMenu .= 'if(lastPage <= lump * 3){';
                 $pagesMenu .= '  addPageNumbers(0, lastPage);';
                 $pagesMenu .= '}else{';
                 $pagesMenu .= '  addPageNumbers(0, lump - 1);';
                 $pagesMenu .= '  if(currentPage < lump) addPageNumbers(lump, currentPage + lump / 2);';
                 $pagesMenu .= '  if(currentPage >= lump && currentPage < (lastPage - lump)){';
                 $pagesMenu .= '    addPageNumbers(';
                 $pagesMenu .= '      Math.max(currentPage - lump / 2, lump),';
                 $pagesMenu .= '      Math.min(currentPage + lump / 2, lastPage - lump - 1)';
                 $pagesMenu .= '    );';
                 $pagesMenu .= '  }';
                 $pagesMenu .= '  if(currentPage >= (lastPage - lump)) addPageNumbers(currentPage - lump / 2, lastPage - lump - 1);';
                 $pagesMenu .= '  addPageNumbers(lastPage - lump, lastPage);';
                 $pagesMenu .= '}';
                 $pagesMenu .= 'function addPageNumbers(fromPage, toPage){';
                 $pagesMenu .= '  var ellipsesIndex = 0;';
                 $pagesMenu .= '  if(fromPage > toPage) return;';
                 $pagesMenu .= '  if(fromPage > 0){';
                 $pagesMenu .= '    if(pagesMenu.options[pagesMenu.options.length - 1].text != fromPage){';
                 $pagesMenu .= '      ellipsesIndex = pagesMenu.options.length;';
                 $pagesMenu .= '      fromPage--;';
                 $pagesMenu .= '    }';
                 $pagesMenu .= '  }';
                 $pagesMenu .= '  for(i = fromPage; i <= toPage; i++){';
                 $pagesMenu .= '    var option = document.createElement("option");';
                 $pagesMenu .= '    option.text = (i + 1);';
                 $pagesMenu .= '    option.value = i;';
                 $pagesMenu .= '    if(i == currentPage){ option.selected = "selected"; }';
                 $pagesMenu .= '    try{';
                 $pagesMenu .= '      /* for IE earlier than version 8 */';
                 $pagesMenu .= '      pagesMenu.add(option, pagesMenu.options[null]);';
                 $pagesMenu .= '    }catch(e){';
                 $pagesMenu .= '      pagesMenu.add(option, null);';
                 $pagesMenu .= '    }';
                 $pagesMenu .= '  }';
                 $pagesMenu .= '  if(ellipsesIndex > 0){';
                 $pagesMenu .= '    pagesMenu.options[ellipsesIndex].text = " ... ";';
                 $pagesMenu .= '  }';
                 $pagesMenu .= '}';
                 $pagesMenu .= '</script>';
             }
             $this->HTML .= "\n\t";
             if ($i) {
                 // 1 or more records found
                 $this->HTML .= "<tfoot><tr><td colspan=" . (count($this->ColCaption) + 1) . '>';
                 $this->HTML .= $Translation['records x to y of z'];
                 $this->HTML .= '</td></tr></tfoot>';
             }
             if (!$i) {
                 // no records found
                 $this->HTML .= "<tfoot><tr><td colspan=" . (count($this->ColCaption) + 1) . '>';
                 $this->HTML .= '<div class="alert alert-warning">';
                 $this->HTML .= '<i class="glyphicon glyphicon-warning-sign"></i> ';
                 $this->HTML .= $Translation['No matches found!'];
                 $this->HTML .= '</div>';
                 $this->HTML .= '</td></tr></tfoot>';
             }
         } else {
             // TVP
             if ($i) {
                 $this->HTML .= "\n\t<tfoot><tr><td colspan=" . (count($this->ColCaption) + 1) . '>' . $Translation['records x to y of z'] . '</td></tr></tfoot>';
             }
             if (!$i) {
                 $this->HTML .= "\n\t<tfoot><tr><td colspan=" . (count($this->ColCaption) + 1) . '>' . $Translation['No matches found!'] . '</td></tr></tfoot>';
             }
         }
         $this->HTML = str_replace("<FirstRecord>", number_format($FirstRecord), $this->HTML);
         $this->HTML = str_replace("<LastRecord>", number_format($i), $this->HTML);
         $this->HTML = str_replace("<RecordCount>", number_format($RecordCount), $this->HTML);
         $tvShown = true;
         $this->HTML .= "</table></div>\n";
         if ($Print_x == '' && $i) {
             // TV
             $this->HTML .= '<div class="row">';
             $this->HTML .= '<div class="col-sm-4 col-md-3 col-lg-2 vspacer-lg">';
             $this->HTML .= '<button onClick="' . $resetSelection . ' document.myform.NoDV.value = 1; return true;" type="submit" name="Previous_x" id="Previous" value="1" class="btn btn-default btn-block"><i class="glyphicon glyphicon-chevron-left"></i> ' . $Translation['Previous'] . '</button>';
             $this->HTML .= '</div>';
             $this->HTML .= '<div class="col-sm-4 col-md-4 col-lg-2 col-md-offset-1 col-lg-offset-3 text-center vspacer-lg">';
             $this->HTML .= $pagesMenu;
             $this->HTML .= '</div>';
             $this->HTML .= '<div class="col-sm-4 col-md-3 col-lg-2 col-md-offset-1 col-lg-offset-3 text-right vspacer-lg">';
             $this->HTML .= '<button onClick="' . $resetSelection . ' document.myform.NoDV.value=1; return true;" type="submit" name="Next_x" id="Next" value="1" class="btn btn-default btn-block">' . $Translation['Next'] . ' <i class="glyphicon glyphicon-chevron-right"></i></button>';
             $this->HTML .= '</div>';
             $this->HTML .= '</div>';
         }
     }
     /* that marks the end of the TV table */
     // hidden variables ....
     foreach ($this->filterers as $filterer => $caption) {
         if ($_REQUEST['filterer_' . $filterer] != '') {
             $this->HTML .= "<input name=\"filterer_{$filterer}\" value=\"" . htmlspecialchars($_REQUEST['filterer_' . $filterer]) . "\" type=\"hidden\" />";
             break;
             // currently, only one filterer can be applied at a time
         }
     }
     $this->HTML .= "<input name=SortField value='{$SortField}' type=hidden>";
     $this->HTML .= "<input name=SelectedID value=\"{$SelectedID}\" type=hidden>";
     $this->HTML .= "<input name=SelectedField value=\"\" type=hidden>";
     $this->HTML .= "<input name=SortDirection type=hidden value='{$SortDirection}'>";
     $this->HTML .= "<input name=FirstRecord type=hidden value='{$FirstRecord}'>";
     $this->HTML .= "<input name=NoDV type=hidden value=''>";
     if ($this->QuickSearch && !strpos($this->HTML, 'SearchString')) {
         $this->HTML .= '<input name="SearchString" type="hidden" value="' . htmlspecialchars($SearchString, ENT_QUOTES) . '">';
     }
     // hidden variables: filters ...
     $FiltersCode = '';
     for ($i = 1; $i <= datalist_filters_count * $FiltersPerGroup; $i++) {
         // Number of filters allowed
         if ($i % $FiltersPerGroup == 1 && $i != 1 && $FilterAnd[$i] != '') {
             $FiltersCode .= "<input name=\"FilterAnd[{$i}]\" value=\"{$FilterAnd[$i]}\" type=\"hidden\">\n";
         }
         if ($FilterField[$i] != '' && $FilterOperator[$i] != '' && ($FilterValue[$i] != '' || strstr($FilterOperator[$i], 'Empty'))) {
             if (!strstr($FiltersCode, "<input name=\"FilterAnd[{$i}]\" value=")) {
                 $FiltersCode .= "<input name=\"FilterAnd[{$i}]\" value=\"{$FilterAnd[$i]}\" type=\"hidden\">\n";
             }
             $FiltersCode .= "<input name=\"FilterField[{$i}]\" value=\"{$FilterField[$i]}\" type=\"hidden\">\n";
             $FiltersCode .= "<input name=\"FilterOperator[{$i}]\" value=\"{$FilterOperator[$i]}\" type=\"hidden\">\n";
             $FiltersCode .= "<input name=\"FilterValue[{$i}]\" value=\"" . htmlspecialchars($FilterValue[$i], ENT_QUOTES) . "\" type=\"hidden\">\n";
         }
     }
     $FiltersCode .= "<input name=\"DisplayRecords\" value=\"{$DisplayRecords}\" type=\"hidden\" />";
     $this->HTML .= $FiltersCode;
     // display details form ...
     if (($this->AllowSelection || $this->AllowInsert || $this->AllowUpdate || $this->AllowDelete) && $Print_x == '' && !$PrintDV) {
         if ($this->SeparateDV && $this->HideTableView || !$this->SeparateDV) {
             $dvCode = call_user_func("{$this->TableName}_form", $SelectedID, $this->AllowUpdate, $this->HideTableView && $SelectedID ? 0 : $this->AllowInsert, $this->AllowDelete, $this->SeparateDV);
             $this->HTML .= "\n\t<div class=\"panel panel-default\">{$dvCode}</div>";
             $this->HTML .= $this->SeparateDV ? '<input name="SearchString" value="' . htmlspecialchars($SearchString, ENT_QUOTES) . '" type="hidden">' : '';
             if ($dvCode) {
                 $this->ContentType = 'detailview';
                 $dvShown = true;
             }
         }
     }
     // display multiple printable detail views
     if ($PrintDV) {
         $dvCode = '';
         $_POST['dvprint_x'] = $_GET['dvprint_x'] = $_REQUEST['dvprint_x'] = 1;
         // hidden vars
         foreach ($this->filterers as $filterer => $caption) {
             if ($_REQUEST['filterer_' . $filterer] != '') {
                 $this->HTML .= "<input name=\"filterer_{$filterer}\" value=\"" . htmlspecialchars($_REQUEST['filterer_' . $filterer]) . "\" type=\"hidden\" />";
                 break;
                 // currently, only one filterer can be applied at a time
             }
         }
         $this->HTML .= '<input type="hidden" name="Print_x" value="1">' . "\n";
         $this->HTML .= '<input type="hidden" name="PrintTV" value="1">' . "\n";
         // count selected records
         $selectedRecords = 0;
         foreach ($_POST as $n => $v) {
             if (strpos($n, 'select_') === 0) {
                 $id = str_replace('select_', '', $n);
                 $selectedRecords++;
                 $this->HTML .= '<input type="hidden" name="select_' . $id . '" value="1">' . "\n";
             }
         }
         if ($selectedRecords <= datalist_max_records_dv_print) {
             // if records selected > {datalist_max_records_dv_print} don't show DV preview to avoid db performance issues.
             foreach ($_POST as $n => $v) {
                 if (strpos($n, 'select_') === 0) {
                     $id = str_replace('select_', '', $n);
                     $dvCode .= call_user_func($this->TableName . '_form', $id, 0, 0, 0, 1);
                 }
             }
             if ($dvCode != '') {
                 $dvCode = preg_replace('/<input .*?type="?image"?.*?>/', '', $dvCode);
                 $this->HTML .= $dvCode;
             }
         } else {
             $this->HTML .= error_message($Translation['Maximum records allowed to enable this feature is'] . ' ' . datalist_max_records_dv_print);
             $this->HTML .= '<input type="submit" class="print-button" value="' . $Translation['Print Preview Table View'] . '">';
         }
     }
     if ($this->AllowPrintingMultiSelection && $Print_x != '') {
         $this->HTML .= "<script>function toggleAllRecords(){ var s=\$('toggleAll').checked; {$toggleAllScript} if(s) countSelected={$RecordCount}; else countSelected=0; }</script>\n";
     }
     $this->HTML .= "</form>";
     $this->HTML .= '</div><div class="col-xs-1 md-hidden lg-hidden"></div></div>';
     // $this->HTML .= '<font face="garamond">'.htmlspecialchars($tvQuery).'</font>';  // uncomment this line for debugging the table view query
     if ($dvShown && $tvShown) {
         $this->ContentType = 'tableview+detailview';
     }
     if ($dvprint_x != '') {
         $this->ContentType = 'print-detailview';
     }
     if ($Print_x != '') {
         $this->ContentType = 'print-tableview';
     }
     if ($PrintDV != '') {
         $this->ContentType = 'print-detailview';
     }
     // call detail view javascript hook file if found
     $dvJSHooksFile = dirname(__FILE__) . '/hooks/' . $this->TableName . '-dv.js';
     if (is_file($dvJSHooksFile) && ($this->ContentType == 'detailview' || $this->ContentType == 'tableview+detailview')) {
         $this->HTML .= "\n<script src=\"hooks/{$this->TableName}-dv.js\"></script>\n";
     }
 }
Пример #7
0
            </div>
            <div class="cl-form-video" id="msgs_yt_box<?php 
echo $msg['id'];
?>
" style="height:auto">
                <?php 
if ($error['yt_link']) {
    ?>
<div style="color:red"><?php 
    echo $error['yt_link'];
    ?>
</div><?php 
}
?>
                <input type="text" name="yt_link" value="<?php 
echo html_attr($msg['yt_link']);
?>
" />&nbsp;
                <label>Например:&nbsp;http://www.youtube.com/watch?v=bNF_P281Uu4</label>
            </div>
            <div class="cl-form-btns">
                <?php 
if (!$is_main) {
    ?>
                  <a href="javascript:;" class="lnk-dot-grey cl-form-cancel" onclick="SBR_STAGE.delMsgForm(<?php 
    echo $msg['id'] ? $msg['id'] : $msg['parent_id'];
    ?>
)">Отменить</a>
                <?php 
}
?>
Пример #8
0
 /**
  * JS
  *
  * Helps generate JavaScript asset HTML.
  *
  * @access      public
  * @param       string    the name of the file or asset
  * @param       string    optional, module name
  * @return      string    HTML code for JavaScript asset
  */
 public function js($asset_name, $module_name = NULL, $attributes = array(), $location_type = '')
 {
     $attributes = html_attr($attributes);
     $location_type = 'js_' . (in_array($location_type, array('url', 'path')) ? $location_type : 'path');
     return '
 <script type="text/javascript" src="' . $this->{$location_type}($asset_name, $module_name) . '"' . $attributes . '></script>';
 }
Пример #9
0
echo $is_edit ? ' form-nr-docs-edit' : '';
?>
">
	<b class="b1"></b>
	<b class="b2"></b>
	<div class="form-in">
          <form action="." method="post" enctype="multipart/form-data" id="<?php 
echo $is_edit ? 'docsEditFrm' : 'docsAddFrm';
?>
">
              <div class="form-block first">
                  <div class="form-el">
                      <label class="form-label3">Название документа:</label>
                      <span class="nra-doc-title">
                          <input type="text" name="name" value="<?php 
echo html_attr($doc['name']);
?>
" maxlength="40" />
                      </span>
                      <div class="tip" style="left:585px"></div>
                      <span class="form-hint">Максимум 40 символов</span>
                  </div>
                  <div class="form-el">
                      <label class="form-label3">Этап проекта:</label>
                      <span class="nra-doc-sel">
                          <select name="stage_id">
                              <option value="0">Весь проект</option>
                              <?php 
foreach ($sbr->stages as $stg) {
    ?>
                              <option value="<?php 
 /**
  * Modifies the auto_link helper (url_helper) by accepting as an optional third
  * argument an array of html attributes for the anchor tags (just like the anchor helper).
  *
  * This array is supplied as the third argument, replacing the
  * optional argument $pop in the original helper.
  *
  * This modified helper attempts to be backward compatible with the use of the
  * original helper by accepting TRUE and FALSE as possible values for the $attributes
  * argument, and giving output identical to the original usage of the helper.
  *
  * use:  auto_link($string, 'url' , array('class' => 'external', 'target'=>'_blank'));
  * use:  auto_link($string, 'email', array('class' => 'email_link' , 'style' => 'color:red;'));
  * use(legacy): auto_link($string, 'url' , TRUE);
  *
  * @link https://github.com/EllisLab/CodeIgniter/wiki/auto-link
  * @author Derek Jones (original author)
  * @author Ivan Tcholakov (adaptation)
  *
  * @see url_helper
  * @link https://codeigniter.com/user_guide/helpers/url_helper.html
  * @param string $str
  * @param string $type
  * @param mixed $attributes
  * @return string
  */
 function auto_link($str, $type = 'both', $attributes = '')
 {
     static $html_helper_loaded = null;
     if ($html_helper_loaded !== true) {
         get_instance()->load->helper('html');
         $html_helper_loaded = true;
     }
     // MAKE THE THIRD ARGUMENT BACKWARD COMPATIBLE
     // here we deal with the original third argument $pop
     // which could be TRUE or FALSE, and was FALSE by default.
     if ($attributes === TRUE) {
         $attributes = ' target="_blank"';
     } elseif ($attributes === FALSE) {
         $attributes = '';
     }
     if (!empty($attributes)) {
         $attributes = html_attr($attributes);
     }
     // Find and replace any URLs.
     // Modified by Ivan Tcholakov, 19-DEC-2013.
     //if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER))
     if ($type !== 'email' && preg_match_all('#(\\w*://|www\\.)[^\\s()<>;]+(\\w|/)#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
         // We process the links in reverse order (last -> first) so that
         // the returned string offsets from preg_match_all() are not
         // moved as we add more HTML.
         foreach (array_reverse($matches) as $match) {
             // $match[0] is the matched string/link
             // $match[1] is either a protocol prefix or 'www.'
             //
             // With PREG_OFFSET_CAPTURE, both of the above is an array,
             // where the actual value is held in [0] and its offset at the [1] index.
             $a = '<a href="' . (strpos($match[1][0], '/') ? '' : 'http://') . $match[0][0] . '"' . $attributes . '>' . $match[0][0] . '</a>';
             $str = substr_replace($str, $a, $match[0][1], strlen($match[0][0]));
         }
     }
     // Find and replace any emails.
     if ($type !== 'url' && preg_match_all('#([\\w\\.\\-\\+]+@[a-z0-9\\-]+\\.[a-z0-9\\-\\.]+[^[:punct:]\\s])#i', $str, $matches, PREG_OFFSET_CAPTURE)) {
         foreach (array_reverse($matches[0]) as $match) {
             if (filter_var($match[0], FILTER_VALIDATE_EMAIL) !== FALSE) {
                 $str = substr_replace($str, safe_mailto($match[0], '', $attributes), $match[1], strlen($match[0]));
             }
         }
     }
     return $str;
 }
Пример #11
0
                            <option value="<?php 
    echo $exc;
    ?>
"<?php 
    echo $exc == $sbr_all['filter']['cost_sys'] ? ' selected="selected"' : '';
    ?>
><?php 
    echo $exn[2];
    ?>
</option>
                          <?php 
}
?>
                        </select></td>
                        <td><div class="b-input"><input class="b-input__text" type="text" name="filter[work_time]" value="<?php 
echo html_attr($sbr_all['filter']['work_time']);
?>
" onkeydown="if(event.keyCode==13)SBR.form.submit()" onfocus="this.select()" /></div></td>
                        <td><select name="filter[status]" onchange="SBR.form.submit()">
                            <option value="-1">Все</option>
                            <option value="<?php 
echo sbr_adm::STATUS_RESERVED;
?>
"<?php 
echo sbr_adm::STATUS_RESERVED == $sbr_all['filter']['status'] ? ' selected="selected"' : '';
?>
>зарезервировано</option>
                          <?php 
foreach (sbr_stages::$ss_classes as $st => $ssc) {
    ?>
                            <option value="<?php 
Пример #12
0
/**
 * HTML attributes
 *
 * @param string $name
 * @param array $attrs
 * @param string $value
 * @param bool $empty
 *
 * @return string
 */
function html_tag(string $name, array $attrs = [], string $value = null, bool $empty = false) : string
{
    return '<' . $name . html_attr($attrs) . ($empty ? ' />' : '>' . $value . '</' . $name . '>');
}
Пример #13
0
?>
" onkeydown="if(event.keyCode==13)SBR.form.submit()" onfocus="this.select()">
                                </div>
                            </td>
                            <td>
                                <div class="b-input">
                                    <input class="b-input__text" type="text" name="filter[arbitr_name]" value="<?php 
echo html_attr($filter['arbitr_name']);
?>
" onkeydown="if(event.keyCode==13)SBR.form.submit()" onfocus="this.select()">
                                </div>
                            </td>
                            <td>
                                <div class="b-input">
                                    <input class="b-input__text" type="text" name="filter[days_left]" value="<?php 
echo html_attr($filter['days_left']);
?>
" onkeydown="if(event.keyCode==13)SBR.form.submit()" onfocus="this.select()">
                                </div>
                            </td>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <td colspan="6">
                                <div class="pager">
                                    <?php 
echo new_paginator($page, ceil($page_count / sbr_adm::PAGE_SIZE), 10, "%s?site=admin&mode=arbitrage{$filter_prms}&dir_col={$dir_col}&dir={$dir}&page=%d%s");
?>
                                </div>
                            </td>
 /**
  * Creates HTML attribute string from array
  *
  * @param string|array $attributes Attribute array
  *
  * @return string Attribute string
  *
  * @deprecated Use html_attr().
  */
 function get_attributes_string($attributes)
 {
     return html_attr($attributes);
 }
Пример #15
0
 function html_tag_open($tag, $attributes = array())
 {
     return '<' . $tag . html_attr($attributes) . '>';
 }
Пример #16
0
                   class="b-layout__table b-layout__table_width_full b-layout__table_margbot_20  b-layout_hide reqvs-fields reqvs-2-<?php 
    echo implode(' reqvs-2-', $reqvs_fields[$f_name][1]);
    ?>
">
                <tbody>
                    <tr class="b-layout__tr">
                        <td class="b-layout__left b-layout__left_width_160">
                            <div class="b-layout__txt b-layout__txt_padtop_5"><?php 
    echo $f_name == 'fio' ? 'ФИО представителя' : $reqvs_fields[$f_name][0];
    ?>
</div>
                        </td>
                        <td class="b-layout__right ">
                            <div class="b-combo b-input-hint">
                                <label onclick="$(this).getNext().getElement('input').focus()" class="b-input-hint__label b-input-hint__label_overflow_hidden <?php 
    echo html_attr($f_value) != '' ? "b-input-hint__label_hide" : "";
    ?>
" for="i_2_<?php 
    echo $f_name;
    ?>
" id="example-<?php 
    echo $f_name;
    ?>
"><?php 
    echo $f_name != 'bank_rf_bik' ? $example : '123456789';
    ?>
</label>
                                <div class="b-combo__input b-combo__input_width_<?php 
    echo $f_name == 'full_name' || $f_name == 'address_jry' || $f_name == 'address_fct' ? 400 : 190;
    ?>
 <?php 
Пример #17
0
                        <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table b-layout__table_width_full b-layout__table_margbot_10">
                            <tr class="b-layout__tr">
                                <td class="b-layout__left b-layout__left_width_140">
                                    <div class="b-layout__txt b-layout__txt_padtop_5">Бюджет</div>
                                </td>
                                <td class="b-layout__right">
                                    <div class="b-combo b-combo_inline-block">
                                        <div class="b-combo__input b-combo__input_width_70 <?php 
    echo $sbr->reserved_id || $sbr->isReserveProcess() || $sbr->data['status'] >= sbr::STATUS_CHANGED ? 'b-combo__input_disabled' : '';
    ?>
 <?php 
    echo $sbr->error['cost'][$k] ? "b-combo__input_error" : "";
    ?>
">
                                            <input class="b-combo__input-text" type="text" value="<?php 
    echo html_attr($stage->data['cost']);
    ?>
" maxlength="12" size="80" name="cost" <?php 
    echo $sbr->reserved_id || $sbr->isReserveProcess() || $sbr->data['status'] >= sbr::STATUS_CHANGED ? 'readonly' : '';
    ?>
/>
                                        </div>
                                    </div>
                                    <span class="b-layout__txt b-layout__txt_width_60 b-layout__txt_inline-block b-layout__txt_padtop_5">&#160;руб.</span>
                                    <span class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_inline-block b-layout__txt_padtop_5"> &mdash; минимальный бюджет &mdash; <span class="mincost-val"><?php 
    echo sbr_stages::MIN_COST_RUR;
    ?>
</span> руб.</span><br/>
                                    <span id="alert_frl_is_fiz" class="b-layout__txt b-layout__txt_padleft_150 b-layout__txt_fontsize_11 b-layout__txt_inline-block b-layout__txt_padtop_5 b-layout__txt_hide" style="padding-left:138px;"> &mdash; максимальный бюджет &mdash; <?php 
    echo number_format($sbr->usd2rur(sbr::MAX_COST_USD_FIZ), 2, '.', ' ');
    ?>
Пример #18
0
            ?>
&f=imgurl&i=<?php 
            echo urlencode($record[$config['child-primary-key-index']]);
            ?>
" target="_blank"><?php 
            echo $record[1];
            ?>
</a><?php 
        }
        ?>
</td>
						<td class="<?php 
        echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}";
        ?>
" id="<?php 
        echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}-" . html_attr($record[$config['child-primary-key-index']]);
        ?>
"><?php 
        if ($record[2]) {
            ?>
<a href="link.php?t=<?php 
            echo $parameters['ChildTable'];
            ?>
&f=linkurl&i=<?php 
            echo urlencode($record[$config['child-primary-key-index']]);
            ?>
" target="_blank"><?php 
            echo $record[2];
            ?>
</a><?php 
        }
Пример #19
0
">
                            <?php 
    echo $addit_html;
    ?>
                        </div>
                    </div> &#160;&#160;
                        <?php 
    if ($setting['field'] == 'phone' && !$setting['auth'] && $reqvs[$form_type][$key] != '' && !$bDisabled || $setting['field'] == 'phone' && $setting['auth']) {
        ?>
                        <div class="b-layout b-layout_inline-block b-layout_padtop_10_iphone b-layout_block_iphone">
                            <?php 
        if ($setting['field'] == 'phone' && !$setting['auth'] && $reqvs[$form_type][$key] != '' && !$bDisabled) {
            ?>
                            <span class="c_sms_main">
                                <a href="javascript:void(0)"class="b-button b-button_flat b-button_flat_grey" data-phone="<?php 
            echo html_attr($reqvs[$form_type][$key]);
            ?>
">Активировать</a>
                            </span>
                            <?php 
        } elseif ($setting['field'] == 'phone' && $setting['auth']) {
            //if
            ?>
                            <div class="b-layout__txt b-layout__txt_padtop_7 b-layout__txt_nowrap b-layout__txt_inline-block"><span class="b-icon b-icon_sbr_gok b-icon_top_2"></span>Активирован <a href="/users/<?php 
            echo $_SESSION['login'];
            ?>
/setup/main/" target="_blank" >Изменить номер телефона</a></div>
                            <?php 
        }
        //elseif
        ?>
        echo "{$parameters['ChildTable']}-{$config['display-field-names'][11]}";
        ?>
" id="<?php 
        echo "{$parameters['ChildTable']}-{$config['display-field-names'][11]}-" . html_attr($record[$config['child-primary-key-index']]);
        ?>
"><?php 
        if ($record[11]) {
            ?>
<a href="link.php?t=<?php 
            echo $parameters['ChildTable'];
            ?>
&f=HomePage&i=<?php 
            echo urlencode($record[$config['child-primary-key-index']]);
            ?>
" target="_blank" class="btn btn-default" title="<?php 
            echo html_attr($record[11]);
            ?>
"><i class="glyphicon glyphicon-globe text-info"></i></a><?php 
        }
        ?>
</td>
					</tr>
					<?php 
    }
}
?>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="<?php 
echo count($config['display-fields']);
Пример #21
0
    echo $exc;
    ?>
"<?php 
    echo $exc == $sbr_payouts['filter']['sys'] ? ' selected="selected"' : '';
    ?>
 ><?php 
    echo $exn[2];
    ?>
</option>
                            <?php 
}
?>
                          </select>
                        </td>
                        <td><input type="text" name="filter[account_num]" value="<?php 
echo html_attr($sbr_payouts['filter']['account_num']);
?>
" onkeydown="if(event.keyCode==13)SBR.form.submit()" onfocus="this.select()" /></td>
                        <td>
                          <select name="filter[completed]" onchange="SBR.form.submit()">
                            <option value="0">Все</option>
                            <option value="1"<?php 
echo 1 == $sbr_payouts['filter']['completed'] ? ' selected="selected"' : '';
?>
>Выплачены</option>
                            <option value="2"<?php 
echo 2 == $sbr_payouts['filter']['completed'] ? ' selected="selected"' : '';
?>
>Не выплачены</option>
                          </select>
                        </td>