当前位置: 首页>>代码示例>>PHP>>正文


PHP processTitle函数代码示例

本文整理汇总了PHP中processTitle函数的典型用法代码示例。如果您正苦于以下问题:PHP processTitle函数的具体用法?PHP processTitle怎么用?PHP processTitle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了processTitle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 function run()
 {
     //if (preg_match('/~/', $this->src)) {
     // $this->src=preg_replace('/\/~(.+?)\//', '/', $this->src);
     //}
     if ($this->live) {
         $out['LIVE'] = $this->live;
     }
     if ($this->userpassword) {
         $this->userpassword = processTitle($this->userpassword);
         $tmp = explode(':', $this->userpassword);
         $this->username = $tmp[0];
         $this->password = $tmp[1];
     }
     if ($this->url) {
         $this->url = processTitle($this->url);
         $this->username = processTitle($this->username);
         $this->password = processTitle($this->password);
         $filename = 'thumb_' . md5($this->url) . basename(preg_replace('/\\W/', '', $this->url));
         if (preg_match('/\\.cgi$/is', $filename)) {
             $filename = str_replace('.cgi', '.jpg', $filename);
         }
         $this->src = ROOT . 'cached/' . $filename;
         /*
          */
         $this->src_def = urlencode('/cached/' . $filename);
     } else {
         preg_match('/(.*)?\\/.*$/', $_SERVER['PHP_SELF'], $match);
         $this->src_def = urlencode('http://' . $_SERVER['SERVER_NAME'] . $match[1] . $this->src);
     }
     $out['REQUESTED'] = $this->src;
     if (file_exists($this->src) || $this->url) {
         //$lst=GetImageSize($this->src);
         $out['REAL_WIDTH'] = $lst[0];
         $out['REAL_HEIGHT'] = $lst[1];
         $out['URL'] = base64_encode($this->url);
         $out['USERNAME'] = urlencode($this->username);
         $out['PASSWORD'] = urlencode($this->password);
         $image_format = $lst[2];
         $out['UNIQ'] = rand(1, time());
         $out['WIDTH'] = $this->width;
         $out['HEIGHT'] = $this->height;
         $out['MAX_HEIGHT'] = $this->max_height;
         $out['MAX_WIDTH'] = $this->max_width;
         $out['CLOSE'] = $this->close;
         /*
         $out['BGCOLOR']=(($this->bgcolor[0]='#')?substr($this->bgcolor,1):$this->bgcolor);
         $out['COLOR']=(($this->color[0]='#')?substr($this->color,1):$this->color);
         */
         $out['ENLARGE'] = $this->enlarge;
         $out['SRC'] = urlencode($this->src);
         $out['SRC_REAL'] = $this->src_def;
         //echo $out['SRC_REAL']."<br>";
     }
     $this->data = $out;
     $p = new parser(DIR_TEMPLATES . $this->name . "/" . $this->name . ".html", $this->data, $this);
     $this->result = $p->result;
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:58,代码来源:thumb.class.php

示例2: foreach

      } else {
       $option['TITLE']=$option['VALUE'];
      }
      if ($option['VALUE']==$item['CUR_VALUE']) {
       $option['SELECTED']=1;
      }
      $item['OPTIONS'][]=$option;
     }
    }
    $res[$i]=$item;
   }

   if ($this->owner->name!='panel') {
    $res[$i]['TITLE']=processTitle($res[$i]['TITLE'], $this);
    if ($res[$i]['TYPE']=='custom') {
     $res[$i]['DATA']=processTitle($res[$i]['DATA'], $this);
    }
   }


    foreach($res[$i] as $k=>$v) {
     if (!is_array($res[$i][$k]) && $k!='DATA') {
      $res[$i][$k]=addslashes($v);
     }
    }

    $tmp=SQLSelectOne("SELECT COUNT(*) as TOTAL FROM commands WHERE PARENT_ID='".$res[$i]['ID']."'");
    if ($tmp['TOTAL']) {
     $res[$i]['RESULT']=$tmp['TOTAL'];
    }
   }
开发者ID:novozhenets,项目名称:majordomo,代码行数:31,代码来源:commands_search.inc.php

示例3: processUrl

?>

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="../css/page.css" type="text/css" rel="stylesheet" />
    <title>Result List</title>
</head>	
<body >
    <div>
        <ul id="ul-geneNetwork">
            <?php 
for ($i = 0; $i < count($urlList[0]); $i++) {
    ?>
            <li id="li-geneNetwork"><a href="<?php 
    echo processUrl($urlList[0][$i]);
    ?>
"><?php 
    echo processTitle($titleList[0][$i]);
    ?>
</a></li>
            <?php 
}
?>
        </ul>
    </div>
</body>
</html>

开发者ID:ycduan,项目名称:UESTC_Software2015,代码行数:29,代码来源:mapEntirePathway.php

示例4: checkAllVars

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function checkAllVars($force = 0)
 {
     // ping hosts
     if ($force) {
         $pings = SQLSelect("SELECT * FROM webvars WHERE 1");
     } else {
         $pings = SQLSelect("SELECT * FROM webvars WHERE CHECK_NEXT<=NOW()");
     }
     $total = count($pings);
     for ($i = 0; $i < $total; $i++) {
         $host = $pings[$i];
         if (!$force) {
             echo date('H:i:s') . " Checking webvar: " . processTitle($host['HOSTNAME']) . "\n";
         }
         if (!$host['HOSTNAME']) {
             continue;
         }
         $online_interval = $host['ONLINE_INTERVAL'];
         if (!$online_interval) {
             $online_interval = 60;
         }
         $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $online_interval);
         SQLUpdate('webvars', $host);
         // checking
         //web host
         $old_status = $host['LATEST_VALUE'];
         if ($host['AUTH'] && $host['USERNAME']) {
             $content = getURL(processTitle($host['HOSTNAME']), $host['ONLINE_INTERVAL'], $host['USERNAME'], $host['PASSWORD']);
         } else {
             $content = getURL(processTitle($host['HOSTNAME']), $host['ONLINE_INTERVAL']);
         }
         if ($host['ENCODING'] != '') {
             $content = iconv($host['ENCODING'], "UTF-8", $content);
         }
         $ok = 1;
         $new_status = '';
         if ($host['SEARCH_PATTERN']) {
             if (preg_match('/' . $host['SEARCH_PATTERN'] . '/is', $content, $m)) {
                 //$new_status=$m[1];
                 $total1 = count($m);
                 for ($i1 = 1; $i1 < $total1; $i1++) {
                     $new_status .= $m[$i1];
                 }
             } else {
                 $ok = 0;
                 // result did not matched
             }
         } else {
             $new_status = $content;
         }
         if ($host['CHECK_PATTERN'] && !preg_match('/' . $host['CHECK_PATTERN'] . '/is', $new_status)) {
             $ok = 0;
             // result did not pass the check
         }
         if (strlen($new_status) > 50 * 1024) {
             $new_status = substr($new_status, 0, 50 * 1024);
         }
         if (!$ok) {
             $host['LOG'] = date('Y-m-d H:i:s') . ' incorrect value:' . $new_status . "\n" . $host['LOG'];
             $tmp = explode("\n", $host['LOG']);
             $total = count($tmp);
             if ($total > 50) {
                 $tmp = array_slice($tmp, 0, 50);
                 $host['LOG'] = implode("\n", $tmp);
             }
             SQLUpdate('webvars', $host);
             continue;
         }
         $host['CHECK_LATEST'] = date('Y-m-d H:i:s');
         $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $online_interval);
         if ($old_status != $new_status) {
             $host['LOG'] = date('Y-m-d H:i:s') . ' new value:' . $new_status . "\n" . $host['LOG'];
             $tmp = explode("\n", $host['LOG']);
             $total = count($tmp);
             if ($total > 50) {
                 $tmp = array_slice($tmp, 0, 50);
                 $host['LOG'] = implode("\n", $tmp);
             }
         }
         $host['LATEST_VALUE'] = $new_status;
         SQLUpdate('webvars', $host);
         if ($host['LINKED_OBJECT'] != '' && $host['LINKED_PROPERTY'] != '') {
             getObject($host['LINKED_OBJECT'])->setProperty($host['LINKED_PROPERTY'], $new_status);
         }
         if ($old_status != $new_status && $old_status != '') {
             $params = array('VALUE' => $new_status);
             // do some status change actions
             $run_script_id = 0;
             $run_code = '';
             // got online
             if ($host['SCRIPT_ID']) {
                 $run_script_id = $host['SCRIPT_ID'];
             } elseif ($host['CODE']) {
//.........这里部分代码省略.........
开发者ID:cdkisa,项目名称:majordomo,代码行数:101,代码来源:webvars.class.php

示例5: updateDisplay

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function updateDisplay($id)
 {
     if (!defined('ONEWIRE_SERVER')) {
         return 0;
     }
     $rec = SQLSelectOne("SELECT * FROM owdisplays WHERE ID='" . $id . "'");
     if (!$rec['ID']) {
         return 0;
     }
     $ow = new OWNet(ONEWIRE_SERVER);
     $device = '/' . $rec['UDID'];
     $rec['UPDATE_LATEST'] = time();
     $rec['UPDATE_NEXT'] = time() + (int) $rec['UPDATE_INTERVAL'];
     $rec['VALUE'] = str_replace("\r", '', $rec['VALUE']);
     $text = explode("\n", $rec['VALUE']);
     for ($i = 1; $i <= $rec['ROWS']; $i++) {
         $line = $i . ",1:" . $text[$i - 1];
         $line = processTitle($line);
         $ow->set($device . "/LCD_H/screenyx", str_pad($line, 40));
     }
     SQLUpdate('owdisplays', $rec);
 }
开发者ID:sergejey,项目名称:majordomo-onewire,代码行数:29,代码来源:onewire.class.php

示例6: checkAllHosts

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function checkAllHosts($limit = 1000)
 {
     // ping hosts
     $pings = SQLSelect("SELECT * FROM pinghosts WHERE CHECK_NEXT<=NOW() ORDER BY CHECK_NEXT LIMIT " . $limit);
     $total = count($pings);
     for ($i = 0; $i < $total; $i++) {
         $host = $pings[$i];
         echo "Checking " . $host['HOSTNAME'] . "\n";
         $online_interval = $host['ONLINE_INTERVAL'];
         if (!$online_interval) {
             $online_interval = 60;
         }
         $offline_interval = $host['OFFLINE_INTERVAL'];
         if (!$offline_interval) {
             $offline_interval = $online_interval;
         }
         if ($host['STATUS'] == '1') {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $online_interval);
         } else {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $offline_interval);
         }
         SQLUpdate('pinghosts', $host);
         $online = 0;
         // checking
         if (!$host['TYPE']) {
             //ping host
             $online = ping(processTitle($host['HOSTNAME']));
         } else {
             //web host
             $online = getURL(processTitle($host['HOSTNAME']), 0);
             SaveFile("./cached/host_" . $host['ID'] . '.html', $online);
             if ($host['SEARCH_WORD'] != '' && !is_integer(strpos($online, $host['SEARCH_WORD']))) {
                 $online = 0;
             }
             if ($online) {
                 $online = 1;
             }
         }
         if ($online) {
             $new_status = 1;
         } else {
             $new_status = 2;
         }
         $old_status = $host['STATUS'];
         if ($host['COUNTER_REQUIRED']) {
             $old_status_expected = $host['STATUS_EXPECTED'];
             $host['STATUS_EXPECTED'] = $new_status;
             if ($old_status_expected != $host['STATUS_EXPECTED']) {
                 $host['COUNTER_CURRENT'] = 0;
                 $host['LOG'] = date('Y-m-d H:i:s') . ' tries counter reset (status: ' . $host['STATUS_EXPECTED'] . ')' . "\n" . $host['LOG'];
             } elseif ($host['STATUS'] != $host['STATUS_EXPECTED']) {
                 $host['COUNTER_CURRENT']++;
                 $host['LOG'] = date('Y-m-d H:i:s') . ' tries counter increased to ' . $host['COUNTER_CURRENT'] . ' (status: ' . $host['STATUS_EXPECTED'] . ')' . "\n" . $host['LOG'];
             }
             if ($host['COUNTER_CURRENT'] >= $host['COUNTER_REQUIRED']) {
                 $host['STATUS'] = $host['STATUS_EXPECTED'];
                 $host['COUNTER_CURRENT'] = 0;
             } else {
                 $interval = min($online_interval, $offline_interval, 20);
                 $online_interval = $interval;
                 $offline_interval = $interval;
             }
         } else {
             $host['STATUS'] = $new_status;
             $host['STATUS_EXPECTED'] = $host['STATUS'];
             $host['COUNTER_CURRENT'] = 0;
         }
         $host['CHECK_LATEST'] = date('Y-m-d H:i:s');
         if ($host['LINKED_OBJECT'] != '' && $host['LINKED_PROPERTY'] != '') {
             setGlobal($host['LINKED_OBJECT'] . '.' . $host['LINKED_PROPERTY'], $host['STATUS']);
         }
         if ($host['STATUS'] == '1') {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $online_interval);
         } else {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $offline_interval);
         }
         if ($old_status != $host['STATUS']) {
             if ($host['STATUS'] == 2) {
                 $host['LOG'] .= date('Y-m-d H:i:s') . ' Host is offline' . "\n";
             } elseif ($host['STATUS'] == 1) {
                 $host['LOG'] .= date('Y-m-d H:i:s') . ' Host is online' . "\n";
             }
             $tmp = explode("\n", $host['LOG']);
             $total = count($tmp);
             if ($total > 50) {
                 $tmp = array_slice($tmp, 0, 50);
                 $host['LOG'] = implode("\n", $tmp);
             }
         }
         SQLUpdate('pinghosts', $host);
         if ($old_status != $host['STATUS'] && $old_status != 0) {
             // do some status change actions
             $run_script_id = 0;
//.........这里部分代码省略.........
开发者ID:cdkisa,项目名称:majordomo,代码行数:101,代码来源:pinghosts.class.php

示例7: getElements

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function getElements($qry = '1', $options = 0)
 {
     $elements = SQLSelect("SELECT * FROM elements WHERE {$qry} ORDER BY PRIORITY DESC, TITLE");
     /*
     $totale=count($elements);
     $res2=array();
     for($ie=0;$ie<$totale;$ie++) {
     if (checkAccess('scene_elements', $elements[$ie]['ID'])) {
       $res2[]=$elements[$ie];
      }
     }
     $elements=$res2;
     */
     $totale = count($elements);
     for ($ie = 0; $ie < $totale; $ie++) {
         if ($elements[$ie]['CSS_STYLE']) {
             $this->all_styles[$elements[$ie]['CSS_STYLE']] = 1;
             if (!is_array($options) || $options['ignore_css_image'] != 1) {
                 $elements[$ie]['CSS_IMAGE'] = $this->getCSSImage($elements[$ie]['TYPE'], $elements[$ie]['CSS_STYLE']);
             }
         }
         if ($elements[$ie]['PRIORITY']) {
             $elements[$ie]['ZINDEX'] = round($elements[$ie]['PRIORITY'] / 10);
         }
         if ($elements[$ie]['TYPE'] == 'img') {
             $elements[$ie]['BACKGROUND'] = 0;
         }
         $positions[$elements[$ie]['ID']]['TOP'] = $elements[$ie]['TOP'];
         $positions[$elements[$ie]['ID']]['LEFT'] = $elements[$ie]['LEFT'];
         $states = SQLSelect("SELECT * FROM elm_states WHERE ELEMENT_ID='" . $elements[$ie]['ID'] . "' ORDER BY PRIORITY DESC, TITLE");
         $total_s = count($states);
         for ($is = 0; $is < $total_s; $is++) {
             if ($elements[$ie]['TYPE'] == 'img') {
                 unset($states[$is]['HTML']);
             }
             if ($states[$is]['HTML'] != '') {
                 $states[$is]['HTML'] = processTitle($states[$is]['HTML']);
             }
             if (!is_array($options) || $options['ignore_state'] != 1) {
                 startMeasure('checkstates');
                 $states[$is]['STATE'] = $this->checkState($states[$is]['ID']);
                 endMeasure('checkstates');
             }
         }
         $elements[$ie]['STATES'] = $states;
         if ($elements[$ie]['TYPE'] == 'container') {
             if (!is_array($options) || $options['ignore_sub'] != 1) {
                 startMeasure('getSubElements');
                 $elements[$ie]['ELEMENTS'] = $this->getElements("CONTAINER_ID=" . (int) $elements[$ie]['ID'], $options);
                 endMeasure('getSubElements');
             }
         }
     }
     for ($ie = 0; $ie < $totale; $ie++) {
         if ($elements[$ie]['LINKED_ELEMENT_ID']) {
             $elements[$ie]['TOP'] = $positions[$elements[$ie]['LINKED_ELEMENT_ID']]['TOP'] + $elements[$ie]['TOP'];
             $elements[$ie]['LEFT'] = $positions[$elements[$ie]['LINKED_ELEMENT_ID']]['LEFT'] + $elements[$ie]['LEFT'];
             $positions[$elements[$ie]['ID']]['TOP'] = $elements[$ie]['TOP'];
             $positions[$elements[$ie]['ID']]['LEFT'] = $elements[$ie]['LEFT'];
         }
     }
     return $elements;
 }
开发者ID:NioFBI,项目名称:majordomo,代码行数:70,代码来源:scenes.class.php

示例8: count

$old_category = '';
if ($res[0]['ID']) {
    $total = count($res);
    for ($i = 0; $i < $total; $i++) {
        if (!$res[$i]['CATEGORY']) {
            $res[$i]['CATEGORY'] = LANG_OTHER;
        }
        $res[$i]['DESCRIPTION'] = nl2br(htmlspecialchars($res[$i]['DESCRIPTION']));
        if ($res[$i]['CATEGORY'] != $old_category) {
            $out['TOTAL_CATEGORIES']++;
            $old_category = $res[$i]['CATEGORY'];
            $res[$i]['NEW_CATEGORY'] = 1;
            if ($i > 0) {
                echo '</category>' . "\n";
            }
            echo '<category name="' . LANG_MODULE_SCRIPTS . ': ' . processTitle($res[$i]['CATEGORY']) . '">' . "\n";
        }
        echo '<block type="majordomo_script_' . $res[$i]['ID'] . '"></block>' . "\n";
        if ($i == $total - 1) {
            $res[$i]['LAST'] = 1;
        }
    }
    echo '</category>';
}
?>

  </xml>
  </body>
</html>
<?php 
$session->save();
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:index.php

示例9: count

     $total = count($commands);
     for ($i = 0; $i < $total; $i++) {
         $cmd_values[$commands[$i]['ID']] = $commands[$i]['CUR_VALUE'];
         $cmd_titles[$commands[$i]['ID']] = $commands[$i]['RENDER_TITLE'];
         $cmd_data[$commands[$i]['ID']] = $commands[$i]['RENDER_DATA'];
     }
 }
 if (time() - $checked_time > 10) {
     $checked_time = time();
     // update data
     $sqlQuery = "SELECT *\n                        FROM commands\n                       WHERE AUTO_UPDATE > 0\n                         AND (NOW() - RENDER_UPDATED) > AUTO_UPDATE";
     $commands = SQLSelect($sqlQuery);
     $total = count($commands);
     for ($i = 0; $i < $total; $i++) {
         $commands[$i]['RENDER_TITLE'] = processTitle($commands[$i]['TITLE'], $connect);
         $commands[$i]['RENDER_DATA'] = processTitle($commands[$i]['DATA'], $connect);
         $commands[$i]['RENDER_UPDATED'] = date('Y-m-d H:i:s');
         SQLUpdate('commands', $commands[$i]);
         $resultMessage = date('Y-m-d H:i:s');
         $resultMessage .= ' Updating auto update item (id ' . $commands[$i]['ID'];
         $resultMessage .= ' time ' . $commands[$i]['AUTO_UPDATE'] . '): ' . $commands[$i]['TITLE'] . "\n";
         echo $resultMessage;
     }
     // sending changes if any
     $sqlQuery = "SELECT *\n                        FROM commands";
     $commands = SQLSelect($sqlQuery);
     $total = count($commands);
     $changed_data = array();
     for ($i = 0; $i < $total; $i++) {
         if ($cmd_values[$commands[$i]['ID']] != $commands[$i]['CUR_VALUE']) {
             $cmd_values[$commands[$i]['ID']] = $commands[$i]['CUR_VALUE'];
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:cycle_connect.php

示例10: checkPattern

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function checkPattern($id, $from_user_id = 0)
 {
     global $session;
     global $pattern_matched;
     $this_pattern_matched = 0;
     $condition_matched = 0;
     $rec = SQLSelectOne("SELECT * FROM patterns WHERE ID='" . (int) $id . "'");
     if ($rec['PATTERN_TYPE'] == 1) {
         //conditional pattern
         $value = getGlobal($rec['LINKED_OBJECT'] . '.' . $rec['LINKED_PROPERTY']);
         $condition_value = $rec['CONDITION_VALUE'];
         if (($rec['CONDITION'] == 2 || $rec['CONDITION'] == 3) && $condition_value != '' && !is_numeric($condition_value) && !preg_match('/^%/', $condition_value)) {
             $condition_value = '%' . $condition_value . '%';
         }
         if (is_integer(strpos($condition_value, "%"))) {
             $condition_value = processTitle($condition_value);
         }
         if ($rec['CONDITION'] == 1 && $value == $condition_value) {
             $status = 1;
         } elseif ($rec['CONDITION'] == 2 && (double) $value >= (double) $condition_value) {
             $status = 1;
         } elseif ($rec['CONDITION'] == 3 && (double) $value < (double) $condition_value) {
             $status = 1;
         } elseif ($rec['CONDITION'] == 4 && $value != $condition_value) {
             $status = 1;
         } else {
             $status = 0;
         }
         if ($status == 1 && !$rec['ACTIVE_STATE']) {
             $rec['ACTIVE_STATE'] = 1;
             SQLUpdate('patterns', $rec);
             $condition_matched = 1;
         } elseif ($status == 0 && $rec['ACTIVE_STATE']) {
             $rec['ACTIVE_STATE'] = 0;
             SQLUpdate('patterns', $rec);
             if ($rec['SCRIPT_EXIT']) {
                 $this->runPatternExitAction($rec['ID'], $rec['SCRIPT_EXIT']);
             }
             //to-do: state exit script
         }
     } else {
         if ($rec['SKIPSYSTEM'] && !$from_user_id) {
             return 0;
         }
         if (!$rec['PATTERN']) {
             $pattern = $rec['TITLE'];
         } else {
             $pattern = $rec['PATTERN'];
         }
         $pattern = str_replace("\r", '', $pattern);
         if ($pattern == '') {
             return 0;
         }
         if ($rec['EXECUTED'] > 0 && $rec['TIME_LIMIT'] && time() - $rec['EXECUTED'] <= $rec['TIME_LIMIT']) {
             return 0;
         }
         $lines_pattern = explode("\n", $pattern);
         $total_lines = count($lines_pattern);
         if (!$rec['TIME_LIMIT']) {
             $messages = SQLSelect("SELECT MESSAGE FROM shouts ORDER BY ID DESC LIMIT " . (int) $total_lines);
             $messages = array_reverse($messages);
         } else {
             $start_from = time() - $rec['TIME_LIMIT'];
             $messages = SQLSelect("SELECT MESSAGE FROM shouts WHERE ADDED>=('" . date('Y-m-d H:i:s', $start_from) . "') ORDER BY ADDED");
         }
         $total = count($messages);
         if (!$total) {
             return 0;
         }
         $lines = array();
         for ($i = 0; $i < $total; $i++) {
             $lines[] = $messages[$i]['MESSAGE'];
         }
         $history = implode('@@@@', $lines);
         $check = implode('@@@@', $lines_pattern);
         if (preg_match('/' . $check . '/isu', $history, $matches)) {
             $condition_matched = 1;
         }
     }
     if ($condition_matched) {
         if (checkAccess('pattern', $rec['ID'])) {
             $is_common = 0;
             if ($rec['PARENT_ID']) {
                 $parent_rec = SQLSelectOne("SELECT IS_COMMON_CONTEXT FROM patterns WHERE ID='" . $rec['PARENT_ID'] . "'");
                 $is_common = (int) $parent_rec['IS_COMMON_CONTEXT'];
             }
             if (context_getcurrent()) {
                 $history = context_get_history() . ' ' . $history;
             }
             if ($rec['IS_CONTEXT']) {
                 context_activate($rec['ID'], 1, $history);
             } elseif ($rec['MATCHED_CONTEXT_ID']) {
                 context_activate($rec['MATCHED_CONTEXT_ID'], 0, $history);
//.........这里部分代码省略.........
开发者ID:AirKing555,项目名称:majordomo,代码行数:101,代码来源:patterns.class.php

示例11: processMenuItem

 /**
  * Title
  *
  * Description
  *
  * @access public
  */
 function processMenuItem($item_id, $set_value = false, $new_value = 0)
 {
     if (preg_match('/(\\d+)\\_(\\d+)/', $item_id, $m)) {
         $dynamic_item = 1;
         $real_part = $m[1];
         $object_part = $m[2];
     } else {
         $dynamic_item = 0;
         $real_part = $item_id;
         $object_part = 0;
     }
     $item = SQLSelectOne("SELECT * FROM commands WHERE ID='" . (int) $real_part . "'");
     if ($object_part) {
         $object_rec = SQLSelectOne("SELECT ID, TITLE FROM objects WHERE ID=" . (int) $object_part);
         $item['DATA'] = str_replace('%' . $item['LINKED_OBJECT'] . '.', '%' . $object_rec['TITLE'] . '.', $item['DATA']);
         $item['TITLE'] = $object_rec['TITLE'];
         $item['LINKED_OBJECT'] = $object_rec['TITLE'];
     }
     if ($item['ID']) {
         $item['ID'] = $item_id;
         if ($object_part) {
             $data = getGlobal($object_rec['TITLE'] . '.' . $item['LINKED_PROPERTY']);
         } else {
             if ($set_value) {
                 $item['CUR_VALUE'] = $new_value;
             }
             $data = $item['CUR_VALUE'];
         }
         $item['VALUE'] = $data;
         if ($item['TYPE'] == 'custom') {
             if (preg_match('/\\[#modul/is', $item['DATA'])) {
                 unset($item['LABEL']);
                 return $item;
             }
             //$item['DATA']=processTitle($item['DATA'], $this);
             $data = $item['DATA'];
         } else {
             //$item['TITLE']=processTitle($item['TITLE'], $this);
             $data = $item['TITLE'];
         }
         $data = processTitle($data, $this);
         if (preg_match('/#[\\w\\d]{6}/is', $data, $m)) {
             $color = $m[0];
             $data = trim(str_replace($m[0], '<style>#item' . $item['ID'] . ' .ui-btn-active {background-color:' . $color . ';border-color:' . $color . '}</style>', $data));
         }
         $item['LABEL'] = $data;
     }
     return $item;
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:56,代码来源:commands.class.php

示例12: admin

/**
* BackEnd
*
* Module backend
*
* @access public
*/
function admin(&$out) {

 global $ajax;
 if ($ajax) {

  global $op;
  global $item_id;


  if ($op=='get_label') {
   $item=SQLSelectOne("SELECT * FROM commands WHERE ID='".(int)$item_id."'");
   if ($item['ID']) {
    if ($item['TYPE']=='custom') {
     echo processTitle($item['DATA'], $this);
    } else {
     echo processTitle($item['TITLE'], $this);
    }
    exit;
   }
  }

  if ($op=='get_value') {
   $item=SQLSelectOne("SELECT * FROM commands WHERE ID='".(int)$item_id."'");
   if ($item['ID']) {
    echo $item['CUR_VALUE'];
    exit;
   }
  }


  if ($op=='value_changed') {
   global $new_value;
   $item=SQLSelectOne("SELECT * FROM commands WHERE ID='".(int)$item_id."'");
   if ($item['ID']) {
    $item['CUR_VALUE']=$new_value;
    SQLUpdate('commands', $item);
    if ($item['LINKED_PROPERTY']!='') {
     $old_value=gg($item['LINKED_OBJECT'].'.'.$item['LINKED_PROPERTY']);
     sg($item['LINKED_OBJECT'].'.'.$item['LINKED_PROPERTY'], $item['CUR_VALUE'], 1);
     //DebMes("setting property ".$item['LINKED_OBJECT'].".".$item['LINKED_PROPERTY']." to ".$item['CUR_VALUE']);
    }

    $params=array('VALUE'=>$item['CUR_VALUE']);
    if (isSet($old_value)) {
     $params['OLD_VALUE']=$old_value;
    }

    if ($item['ONCHANGE_METHOD']!='') {
     getObject($item['ONCHANGE_OBJECT'])->callMethod($item['ONCHANGE_METHOD'], $params);
     //DebMes("calling method ".$item['ONCHANGE_OBJECT'].".".$item['ONCHANGE_METHOD']." with ".$item['CUR_VALUE']);
    }

    if ($item['SCRIPT_ID']) {
     //DebMes('Running on_change script #'.$item['SCRIPT_ID']);
     runScript($item['SCRIPT_ID'], $params);
    }
    if ($item['CODE']) {
     //DebMes("Running on_change code");
     eval($item['CODE']);
    }

   }
   echo "OK";exit;
  }

 }



 if (isset($this->data_source) && !$_GET['data_source'] && !$_POST['data_source']) {
  $out['SET_DATASOURCE']=1;
 }
 if ($this->data_source=='commands' || $this->data_source=='') {
  if ($this->view_mode=='' || $this->view_mode=='search_commands') {
   $this->search_commands($out);
  }
  if ($this->view_mode=='edit_commands') {
   $this->edit_commands($out, $this->id);
  }
  if ($this->view_mode=='delete_commands') {
   $this->delete_commands($this->id);
   $this->redirect("?");
  }
 }
}
开发者ID:novozhenets,项目名称:majordomo,代码行数:92,代码来源:commands.class.php

示例13: usual

 /**
 * FrontEnd
 *
 * Module frontend
 *
 * @access public
 */
 function usual(&$out)
 {
     global $ajax;
     if ($ajax) {
         global $op;
         header("HTTP/1.0: 200 OK\n");
         header('Content-Type: text/html; charset=utf-8');
         if ($op == 'checkAllStates') {
             $qry = "1";
             if (preg_match('/(\\d+)\\.html/', $_SERVER["REQUEST_URI"], $m)) {
                 $qry .= " AND scenes.ID='" . $m[1] . "'";
             }
             $states = SQLSelect("SELECT elm_states.ID, elm_states.TITLE, elm_states.HTML, elements.SCENE_ID, elm_states.SWITCH_SCENE, elements.TYPE FROM elm_states, elements WHERE elm_states.ELEMENT_ID=elements.ID AND {$qry}");
             $total = count($states);
             for ($i = 0; $i < $total; $i++) {
                 $states[$i]['STATE'] = $this->checkState($states[$i]['ID']);
                 if ($states[$i]['TYPE'] == 'html') {
                     $states[$i]['HTML'] = processTitle($states[$i]['HTML'], $this);
                 }
             }
             echo json_encode($states);
         }
         if ($op == 'click') {
             global $id;
             $state = SQLSelectOne("SELECT * FROM elm_states WHERE ID='" . $id . "'");
             $params = array('STATE' => $state['TITLE']);
             if ($state['ACTION_OBJECT'] && $state['ACTION_METHOD']) {
                 callMethod($state['ACTION_OBJECT'] . '.' . $state['ACTION_METHOD'], $params);
             }
             if ($state['SCRIPT_ID']) {
                 runScript($state['SCRIPT_ID'], $params);
             }
             echo "OK";
         }
         if ($op == 'position') {
             global $id;
             global $posx;
             global $posy;
             global $width;
             global $height;
             if ($id && $posx && $posy && $width && $height) {
                 $state = SQLSelectOne("SELECT * FROM elm_states WHERE ID='" . $id . "'");
                 $state['WINDOW_POSX'] = $posx;
                 $state['WINDOW_POSY'] = $posy;
                 $state['WINDOW_WIDTH'] = $width;
                 $state['WINDOW_HEIGHT'] = $height;
                 SQLUpdate('elm_states', $state);
             }
             //
             echo "OK";
         }
         exit;
     }
     $this->admin($out);
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:62,代码来源:scenes.class.php

示例14: AND

         $qry.=" AND (commands.ID='".(int)$_GET['parent']."')";
        }
        */
        $out['IFRAME_MODE'] = 1;
    }
    if ($this->parent_item != '') {
        //$out['IFRAME_MODE']=1;
        $tmp = SQLSelectOne("SELECT ID FROM commands WHERE PARENT_ID='" . $_GET['parent'] . "'");
        if ($tmp['ID']) {
            $qry .= " AND (commands.PARENT_ID='" . $this->parent_item . "')";
        } else {
            $qry .= " AND (commands.ID='" . $this->parent_item . "')";
        }
        //$qry.=" AND PARENT_ID='".$this->parent_item."'";
        $parent_rec = SQLSelectOne("SELECT * FROM commands WHERE ID='" . $this->parent_item . "'");
        $parent_rec['TITLE'] = processTitle($parent_rec['TITLE'], $this);
        if ($paret_rec['SUB_PRELOAD']) {
            $parent_rec['ID'] = $parent_rec['PARENT_ID'];
        }
        foreach ($parent_rec as $k => $v) {
            $out['PARENT_' . $k] = $v;
        }
    } elseif ($this->id) {
        $qry .= " AND ID=" . (int) $this->id;
        $out['ONE_ITEM_MODE'] = 1;
        $this->pda = 1;
        $out['PDA'] = 1;
    } elseif (!$_GET['parent']) {
        $qry .= " AND PARENT_ID=0";
    }
}
开发者ID:AirKing555,项目名称:majordomo,代码行数:31,代码来源:commands_search.inc.php

示例15: usual

/**
* FrontEnd
*
* Module frontend
*
* @access public
*/
function usual(&$out) {

 global $ajax;
 if ($ajax) {
    global $op;
    header ("HTTP/1.0: 200 OK\n");
    header ('Content-Type: text/html; charset=utf-8');
    if ($op=='checkAllStates') {
     $states=SQLSelect("SELECT elm_states.ID, elm_states.TITLE, elm_states.HTML, elements.SCENE_ID, elm_states.SWITCH_SCENE, elements.TYPE FROM elm_states, elements WHERE elm_states.ELEMENT_ID=elements.ID");
     $total=count($states);
     for($i=0;$i<$total;$i++) {
      $states[$i]['STATE']=$this->checkState($states[$i]['ID']);
      if ($states[$i]['TYPE']=='html') {
       $states[$i]['HTML']=processTitle($states[$i]['HTML'], $this);
      }
     }
     echo json_encode($states);
    }
    if ($op=='click') {
     global $id;
     $state=SQLSelectOne("SELECT * FROM elm_states WHERE ID='".$id."'");
     if ($state['SCRIPT_ID']) {
      $params=array('STATE'=>$state['TITLE']);
      runScript($state['SCRIPT_ID'], $params);
      echo "OK";
     }
    }
    exit;
 }

 $this->admin($out);
}
开发者ID:novozhenets,项目名称:majordomo,代码行数:39,代码来源:scenes.class.php


注:本文中的processTitle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。