Example #1
0
 public function test_call()
 {
     $this->set_prefix('caller');
     $caller = call();
     $this->test(1, $caller, 'Instance create');
     $this->test(2, call() === $caller, 'Instance retrieval');
     $this->set_prefix('helpers');
     $this->test(1, function_exists('test_useful_test'));
     helper('__useful_test');
     $this->test(2, function_exists('test_useful_test'));
     $this->test(3, test_useful_test());
     $this->test(4, test_useful_test_again());
     $this->test(5, function_exists('test_useful_sub_test_advanced'));
     helper('__useful_sub_test');
     $this->test(6, test_useful_sub_test_advanced());
     $this->set_prefix('do_call');
     $this->test(1, call('__useful_test::get_caller_module_path'));
     $this->test(2, call('__useful_test'));
     $this->test(3, call('__useful_test_again'));
     $this->test(4, call('__useful_sub_test_advanced'));
     $this->set_prefix('direct');
     $this->test(1, call()->__useful_test());
     $this->test(2, call()->__useful_sub_test_advanced());
     $this->test(3, call()->__useful_test->get_caller_module_path());
     $this->test(4, call()->__useful_same->test());
     $this->set_prefix('exception');
     $this->exception_test(1, 'exception_invalid_caller');
 }
Example #2
0
function helper($element)
{
    if ($element instanceof DOMText) {
        return htmlspecialchars($element->nodeValue);
    } else {
        $body = '';
        foreach ($element->childNodes as $child) {
            $body .= helper($child);
        }
        if ($element instanceof DOMElement) {
            $attrs = array();
            foreach ($element->attributes as $attr) {
                $attrs[] = htmlspecialchars($attr->name) . '="' . htmlspecialchars($attr->value) . '"';
            }
            if ($attrs) {
                $attrs = ' ' . implode(' ', $attrs);
            } else {
                $attrs = '';
            }
            return '<' . $element->tagName . $attrs . '>' . $body . '</' . $element->tagName . '>';
        } else {
            return $body;
        }
    }
}
Example #3
0
 public function postIndex(Request $request)
 {
     if (Auth::attempt(['username' => $request->username, 'password' => $request->password])) {
         return redirect(helper()->urlBackend('/'));
     } else {
         return redirect()->back()->withInput()->withError('Login Failed , Check Your Password or Username');
     }
 }
Example #4
0
function helper($model, $left, $right)
{
    $middle = $model->get_middle($left[NODE_ID], $right[NODE_ID]);
    if ($middle != NULL) {
        helper($model, $left, $middle[NODE_ID]);
        render($middle, $left);
        helper($model, $middle[NODE_ID], $right_);
    }
}
Example #5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $action = helper()->segmentAction();
     $right = helper()->getRight($action);
     if ($right == 'true' || $right == 'go') {
         return $next($request);
     } else {
         return redirect('401');
     }
 }
 function __construct()
 {
     helper('string');
     $this->ChannelUnit = new ChannelUnit(intval($this->ChannelID));
     if ($this->ChannelUnit->ChannelInfos['issystem'] != -1) {
         $this->MainTable = '#@__archives';
     } else {
         $this->MainTable = $this->ChannelUnit->ChannelInfos['addtable'];
     }
 }
Example #7
0
function buildjson($curr)
{
    global $id;
    $result = mysql_query("SELECT * FROM  `{$id}` WHERE  `ID` = {$curr}");
    if (!$result) {
        die(mysql_error());
    }
    $row = mysql_fetch_array($result);
    $tmp = '{id:\\"' . $row['ID'] . '\\",name:\\"' . $row['Title'] . '\\",data:{$color:\\"' . ncolor($row['rNum'], $row['rTotal']) . '\\",$author:\\"' . $row['Author'] . '\\", $content:\\"' . $row['Content'] . '\\"},children:[' . helper($curr) . ']}';
    return $tmp;
}
Example #8
0
function helper($model, $left, $right)
{
    global $graphstr;
    $middle = $model->get_middle($left[NODE_ID], $right[NODE_ID]);
    if ($middle != NULL) {
        #echo $left[NODE_CONTENT] . "<br/>";
        #echo $middle[NODE_CONTENT] . "<br/>";
        #echo $right[NODE_CONTENT] . "<br/><br/>";
        render($middle[NODE_CONTENT], $left[NODE_CONTENT]);
        helper($model, $left, $middle);
        helper($model, $middle, $right);
    }
}
Example #9
0
 public function getDelete($id)
 {
     $model = $this->model->find($id);
     if (!empty($model->id)) {
         try {
             $model->delete();
             return redirect(helper()->urlAction() . '/index')->withSuccess('Data has been deleted');
         } catch (\Exception $e) {
             return redirect(helper()->urlAction() . '/index')->withSuccess('Data Cannot be deleted');
         }
     } else {
         return redirect('404');
     }
 }
Example #10
0
function helper($root, $target, &$path, &$result)
{
    if ($root == null) {
        return;
    }
    if ($root->left == null && $root->right == null) {
        if ($root->val == $target) {
            $path[] = $root->val;
            $result[] = $path;
            array_pop($path);
        }
        return;
    }
    $path[] = $root->val;
    helper($root->left, $target, $path, $result);
    helper($root->right, $target, $path, $result);
    array_pop($path);
}
function longestPalindrome($s)
{
    print $s;
    if ($s == "") {
        return;
    }
    if (strlen($s) == 1) {
        return $s;
    }
    $longest = substr($s, 0, 1);
    for ($i = 0; $i < strlen($s); $i++) {
        $tmp = helper($s, $i, $i);
        if (strlen($tmp) > strlen($longest)) {
            $longest = $tmp;
        }
        $tmp = helper($s, $i, $i + 1);
        if (strlen($tmp) > strlen($longest)) {
            $longest = $tmp;
        }
    }
    print $longest;
}
Example #12
0
 public function getFormvalidation()
 {
     $inputs = Input::all();
     $model = $inputs['model'];
     $unique_id = $inputs['unique_id'];
     unset($inputs['model']);
     unset($inputs['unique_id']);
     $modelFix = helper()->injectModel($model);
     if (!$modelFix->messages) {
         $messages = [];
     } else {
         $messages = $modelFix->messages;
     }
     $validation = Validator::make($inputs, $modelFix->rules($unique_id), $messages);
     if ($validation->fails()) {
         $status = 'fails';
         $errors = $validation->getMessageBag()->toArray();
     } else {
         $status = 'true';
         $errors = '';
     }
     return \Response::json(['status' => $status, 'errors' => $errors]);
 }
Example #13
0
?>
                        </td>
                    <? endif; ?>
                    <td>
                        <?php 
echo $debate->created_by_name;
?>
                    </td>
                    <td>
                        <?php 
echo @helper('date.humanize', array('date' => $debate->created_on));
?>
                    </td>
                    <td>
                        <?php 
echo @helper('grid.order', array('row' => $debate, 'total' => $total));
?>
                    </td>
                    <td>
                        <?php 
echo $debate->id;
?>
                    </td>
                </tr>
            <? endforeach; ?>

            <? if (!count($debates)) : ?>
                <tr>
                    <td colspan="10" align="center" style="text-align: center;">
                        <?php 
echo @text('NO_ITEMS');
Example #14
0
	<? foreach ($contacts as $contact) : ?>
		<tr>
			<td width="20" align="center">
				<?= @helper('grid.checkbox', array('row' => $contact))?>
			</td>				
			<td align="left">
				<a href="<?= @route('view=contact&id='.$contact->id); ?>">
	   				<?= @escape($contact->name); ?>
	   			</a>
			</td>
			<td align="center">
				<?= @helper('grid.enable', array('row' => $contact)); ?>
            </td>
			<td align="center">
				<?= @helper('grid.order', array('row' => $contact)); ?>
			</td>
			<td align="center">
				<?= @helper('grid.access', array('row' => $contact)) ?>
			</td>
			<td align="left">
				<?  if($contact->user_id) : ?>
				    <a href="<?= @route('option=com_users&view=user&id='.$contact->user_id) ?>">
				       <?= $contact->username; ?>
					</a>
				<? endif; ?>
			</td>
		</tr>
	<? endforeach; ?>
	</tbody>	
</table>
</form>
Example #15
0
<?php 
echo @helper('behavior.validator');
?>

<script src="media://lib_koowa/js/koowa.js" />
<style src="media://lib_koowa/css/koowa.css" />

<form action="" method="post" class="-koowa-form" id="group-form">
    <div class="grid_8">
        <div class="panel title group">
            <input class="inputbox required" type="text" name="name" id="title" size="40" maxlength="255" value="<?php 
echo $group->name;
?>
" placeholder="<?php 
echo @text('Name');
?>
" />
        </div>
        
        <div class="panel">
            <h3><?php 
echo @text('Group');
?>
</h3>
        	<?php 
echo @helper('select.groups', array('name' => 'target_id', 'selected' => $group->parent_id, 'exclude' => $group));
?>
       	</div>
    </div>
</form>
Example #16
0
<?php

/**
 * @version     $Id: module.php 632 2011-03-20 14:28:45Z cristiano.cucco $
 * @category    Nooku
 * @package     Nooku_Server
 * @subpackage  Banners
 * @copyright   Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */
defined('KOOWA') or die('Restricted access');
?>

<ul class="module-events">
<? foreach ($events as $event) : ?>
	<li><?php 
echo $event->title;
?>
<br /><small><?php 
echo @helper('date.humanize', array('date' => $event->start_date));
?>
</small></li>
<? endforeach ?>
</ul>
<? // Download count field ?>
<div class="koowa_grid__row">
    <div class="control-group koowa_grid__item one-whole">
        <label class="control-label"><?= translate('Downloads'); ?></label>
        <div class="controls" id="hits-container">
            <p class="help-inline">
                <?= $document->hits; ?>
            </p>
            <? if ($document->hits): ?>
                <a href="#" class="btn btn-default btn-small"><?= translate('Reset'); ?></a>
            <? endif; ?>
        </div>
    </div>
</div>

<? // Modified by field ?>
<? if ($document->modified_by): ?>
<div class="koowa_grid__row">
    <div class="control-group koowa_grid__item one-whole">
        <label class="control-label"><?= translate('Modified by'); ?></label>
        <div class="controls">
            <span class="help-info">
            <?= object('user.provider')->load($document->modified_by)->getName(); ?>
            <?= translate('on') ?>
            <?= helper('date.format', array('date' => $document->modified_on)); ?>
            </span>
        </div>
    </div>
</div>
<? endif; ?>
    }
    ?>
                    <?php 
    if ($page->hidden) {
        ?>
                        <span class="label label-info"><?php 
        echo translate('Hidden');
        ?>
</span>
                    <?php 
    }
    ?>
                </td>
                <td align="center">
                    <?php 
    echo helper('grid.order', array('row' => $page, 'total' => $total));
    ?>
                </td>
                <td>
                    <?php 
    echo $page->getTypeDescription();
    ?>
                </td>
            </tr>
            <?php 
}
?>
        </tbody>
    </table>
</form>
Example #19
0
    ?>
</span> 
				
				<?php 
    if ($item->isLeadable()) {
        ?>
				/ <?php 
        echo $item->leaderCount;
        ?>
				<span class="stat-name"><?php 
        echo @text('COM-ACTORS-SOCIALGRAPH-LEADERS');
        ?>
</span>
				<?php 
    }
    ?>
				</div>
			
			</div>
		</div>

		<div class="entity-description">
			<?php 
    echo @helper('text.truncate', @content($item->body, array('exclude' => array('syntax', 'video'))), array('consider_html' => true, 'length' => 150));
    ?>
		</div>
	</div>
<?php 
}
?>
</div>
Example #20
0
echo @template('form_accordion', array('params' => $module->params, 'id' => 'param-page', 'title' => 'Module Parameters'));
?>

		<? if($module->params->getNumParams('advanced')) : ?>
		<?php 
echo @template('form_accordion', array('params' => $module->params, 'group' => 'advanced'));
?>
		<? endif ?>
	
		<? if($module->params->getNumParams('other')) : ?>
		<?php 
echo @template('form_accordion', array('params' => $module->params, 'group' => 'other'));
?>
		<? endif ?>
	<?php 
echo @helper('accordion.endPane');
?>
</div>
<div class="clr"></div>

<? if(!$module->type || $module->type == 'custom' || $module->type == 'mod_custom') : ?>
<fieldset class="adminform">
	<legend><?php 
echo @text('Custom Output');
?>
</legend>
	
	<?php 
echo @editor(array('name' => 'content', 'content' => @escape($module->content), 'height' => 400, 'cols' => 60, 'buttons' => array('pagebreak', 'readmore')));
?>
</fieldset>
Example #21
0
">
            <?php 
echo @escape($topic->title);
?>
        </a>
	</h3>
	
	<div class="entity-description">
	<?php 
echo @helper('text.truncate', @content($topic->body, array('exclude' => 'gist')), array('length' => 200, 'consider_html' => true));
?>
	</div>
	
	<div class="entity-meta">
		<ul class="an-meta inline">	
			<li><?php 
echo sprintf(@text('LIB-AN-MEDIUM-NUMBER-OF-COMMENTS'), $topic->numOfComments);
?>
</li>
		</ul>
		
		<div class="an-meta vote-count-wrapper" id="vote-count-wrapper-<?php 
echo $topic->id;
?>
">
			<?php 
echo @helper('ui.voters', $topic);
?>
		</div>
	</div>
</div>
Example #22
0
<?php

defined('KOOWA') or die('Restricted access');
?>

<?php 
echo @helper('ui.nodes', $item->tagables);
Example #23
0
<?php

defined('KOOWA') or die('Restricted access');
?>

<div class="row">
	<div class="span6">
	    
	    <?php 
echo @helper('ui.header');
?>
	    
        <div class="an-entities">
        <?php 
foreach ($packages as $package) {
    ?>
            <?php 
    echo @view('package')->layout('list')->package($package);
    ?>
        <?php 
}
?>
        </div>
	</div>
</div>
Example #24
0
                </span>
            </p>


            <p class="module_task__info">

                <?php 
        // Created
        ?>
                <?php 
        if ($module->params->show_created) {
            ?>
                <span class="module_task__date">
                    <?php 
            echo helper('date.format', array('date' => $task->created_on));
            ?>
                </span>
                <?php 
        }
        ?>
            </p>
        </li>
    <?php 
    }
    ?>
    </ul>
</div>

<?php 
}
Example #25
0
<? foreach($comments as $comment) :?>
<div class="comment">
    <div class="comment-header">
        <?php 
echo $comment->created_by == $user->id ? @text('You') : $comment->created_by_name;
?>
&nbsp;<?php 
echo @text('wrote');
?>
        <time datetime="<?php 
echo $comment->created_on;
?>
" pubdate><?php 
echo @helper('date.humanize', array('date' => $comment->created_on));
?>
</time>
    </div>
    <p><?php 
echo @escape($comment->text);
?>
</p>
</div>
<? endforeach ?>
Example #26
0
<?php

defined('KOOWA') or die('Restricted access');
?>

<?php 
if (!empty($menubar)) {
    echo @helper('ui.menubar', array('menubar' => $menubar));
}
if (!empty($actorbar)) {
    echo @helper('ui.actorbar', array('actorbar' => $actorbar));
}
if (!empty($toolbar)) {
    echo @helper('ui.toolbar', array('toolbar' => $toolbar));
}
Example #27
0
<?= @helper('tabs.startPanel', array('id' => 'system', 'title' => @text('General'))) ?>
    <h2><?= @text('General') ?></h2>
    <?= @template('default_path'); ?>
    <?= @template('default_server'); ?>
    <?= @template('default_debug'); ?> 
    <?= @template('default_cache'); ?> 
    <?= @template('default_session'); ?>
    <?= @template('default_locale'); ?> 
<?= @helper('tabs.endPanel') ?>
	
<?= @helper('tabs.startPanel', array('id' => 'site', 'title' => @text('Frontend'))) ?>
	<h2><?= @text('Frontend') ?></h2>
	<?= @template('default_site'); ?>
	<?= @template('default_seo'); ?>
<?= @helper('tabs.endPanel') ?>
	
<?= @helper('tabs.startPanel', array('id' => 'mail', 'title' => @text('Mail'))) ?>
    <h2><?= @text('Mail') ?></h2>
   	<?= @template('default_mail'); ?>  
<?= @helper('tabs.endPanel') ?>
 	
<?= @helper('tabs.startPanel', array('id' => 'ftp', 'title' => @text('FTP'))) ?>
	<h2><?= @text('FTP') ?></h2>
	<?= @template('default_ftp'); ?> 
 <?= @helper('tabs.endPanel') ?>
 	
 <?= @helper('tabs.startPanel', array('id' => 'database', 'title' => @text('Database'))) ?>
 	<h2><?= @text('Database') ?></h2>
	<?= @template('default_database'); ?> 
 <?= @helper('tabs.endPanel') ?>
Example #28
0
                          class="input-block-level"
                          maxlength="100"
                          minlength="10"
                        />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="person-usertype">
                        <?php 
echo @text('COM-PEOPLE-USERTYPE');
?>
                    </label>
                    <div class="controls">
                        <?php 
echo @helper('usertypes');
?>
                    </div>
                </div>
            </fieldset>

            <div class="form-actions">
                <a href="<?php 
echo @route('view=people');
?>
" class="btn">
                    <?php 
echo @text('LIB-AN-ACTION-CANCEL');
?>
                </a>
                <button type="submit" class="btn btn-primary">
?>
</label>
    <div>
        <?php 
echo helper('com:users.listbox.groups', array('selected' => $page->users_group_id, 'name' => 'users_group_id'));
?>
    </div>
</div>
<div>
    <label for="parent"><?php 
echo translate('Menu');
?>
</label>
    <div id="parent" class="controls">
        <?php 
echo helper('listbox.menus', array('selected' => $state->menu));
?>
    </div>
</div>
<div>
    <label for="parent"><?php 
echo translate('Parent');
?>
</label>
    <div id="pages-parent" class="controls">
        <?php 
echo helper('listbox.parents', array('page' => $page, 'menu' => $state->menu, 'selected' => $parent_id, 'attribs'));
?>
    </div>
</div>
<?php

/**
 * Nooku Framework - http://www.nooku.org
 *
 * @copyright	Copyright (C) 2011 - 2013 Johan Janssens and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		git://git.assembla.com/nooku-framework.git for the canonical source repository
 */
?>

<?php 
echo helper('behavior.validator');
?>

<!--
<script src="assets://js/koowa.js" />
<style src="assets://css/koowa.css" />
-->

<ktml:module position="actionbar">
    <ktml:toolbar type="actionbar">
</ktml:module>

<form action="" method="post" id="contact-form" class="-koowa-form">
	<input type="hidden" name="id" value="<?php 
echo $contact->id;
?>
" />
	<input type="hidden" name="access" value="0" />
	<input type="hidden" name="published" value="0" />