Esempio n. 1
0
// php -f filename.php -- "a string argument"
// ==> That command in shell will put the passed string at $argv[1].
//     $argv[0] holds the name of the file.
//
// php filename.php -- "a string argument"
// ==> This puts it at $argv[2] b/c 'filename.php' and '--' are also passed as arguments.
$filter = false;
// Make sure we have an arg to search for. When argc == 1 it just shows that
// the first arg is the name of the file ('main.php'), which means there is still
// no argument. If we pass something like php -f main.php -- "" that empty string
// will register as an arg at argv[1], thus I must handle that case.
// This should probably be one statement, will worry about that later.
if ($argc <= 1) {
    no_result('Start typing a macro name...', 'No string was given.');
} elseif (!$argv[1]) {
    no_result('Start typing a macro name...', 'Just type out the name of a macro.');
}
$filter = strtolower($argv[1]);
/**
 * Function to call if no result is found, or if they enter nothing.
 * @return xml
 */
function no_result($message = '', $submessage = '')
{
    global $w;
    // Need this to output the messages
    // Defaults
    if (!$message) {
        $message = 'No results found.';
    }
    if (!$submessage) {
Esempio n. 2
0
				<a class="button win-forward" href="<?php 
        echo site_url('index/view/' . $name['slugname'] . '/' . $list['id']);
        ?>
">浏览 <span class="icon-arrow-right"></span></a>
		</td>
	</tr>
	<?php 
    }
    ?>
	<?php 
} else {
    ?>
	<tr class="red">
		<td colspan="7" class="text-center">
			<?php 
    no_result('没有内容');
    ?>
			<a class="button bg-main"
				href="<?php 
    echo site_url('admin/content/add/' . $name['slugname']);
    ?>
">添加</a>
		</td>
	</tr>
	<?php 
}
?>
</table>

<div class="panel-foot text-center clearfix">
	<div class="float-left padding-top">
Esempio n. 3
0
    $action = 'search' ;
  }
  
  // detail
  if ((isset($_GET['entity_id'])) and ($_GET['entity_id'] != 0)) {
    $action = 'detail' ;
  }
  
  $func = 'get_'.$entity.'_'.$action ;
  if (!function_exists($func)) {
    internal_error("Can't find function ".sanitize_param($func)) ;
  }

  return $func() ;
}

// Do the job

$xml = dispatch() ;

if ($xml == '') {
  no_result() ;
}
else {
  header('Content-type: text/xml') ;
  echo $xml ;
}

?>