コード例 #1
0
ファイル: request.php プロジェクト: vanie3/appland
 public static function checkToken($method = 'post')
 {
     $token = MSession::getFormToken();
     if (!self::getVar($token, '', $method, 'alnum')) {
         $session = MFactory::getSession();
         if ($session->isNew()) {
             // Redirect to login screen.
             $app = MFactory::getApplication();
             $return = MRoute::_('index.php');
             $app->redirect($return, MText::_('MLIB_ENVIRONMENT_SESSION_EXPIRED'));
             $app->close();
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
コード例 #2
0
ファイル: default.php プロジェクト: vanie3/appland
				</th>
				<th class="title">
					<?php 
echo MText::_('COM_MIWOSQL_QUERY');
?>
				</th>
			</tr>
		</thead>
		<tbody>
		<?php 
$k = 0;
$n = count($this->items);
for ($i = 0; $i < $n; $i++) {
    $row = $this->items[$i];
    $edit_link = MRoute::_('index.php?option=com_miwosql&controller=queries&task=edit&cid[]=' . $row->id);
    $run_link = MRoute::_('index.php?option=com_miwosql&ja_qry_g=' . $row->query);
    $checked = MHTML::_('grid.id', $i, $row->id);
    ?>
			<tr class="<?php 
    echo "row{$k}";
    ?>
">
				<td>
					<?php 
    echo $this->pagination->getRowOffset($i);
    ?>
				</td>
				<td>
					<?php 
    echo $checked;
    ?>
コード例 #3
0
ファイル: wordpress.php プロジェクト: vanie3/appland
 public function menu()
 {
     MFactory::getLanguage()->load('com_' . $this->context, MPATH_ADMINISTRATOR);
     $title = $this->title;
     if (empty($this->title)) {
         $title = MText::_('COM_' . strtoupper($this->context));
     }
     mimport('framework.filesystem.file');
     $img = '';
     if (MFile::exists(MPATH_WP_PLG . '/' . $this->context . '/admin/assets/images/icon-16-' . $this->context . '.png')) {
         $img = plugins_url($this->context . '/admin/assets/images/icon-16-' . $this->context . '.png');
     }
     add_menu_page($title, $title, 'manage_options', $this->context, array($this, 'display'), $img, $this->menu_id);
     if ($this->has_config == true) {
         add_submenu_page($this->context, MText::_('COM_' . strtoupper($this->context) . '_CPANEL_CONFIGURATION'), MText::_('COM_' . strtoupper($this->context) . '_CPANEL_CONFIGURATION'), 'manage_options', MRoute::_('index.php?option=com_' . $this->context . '&view=config'));
     }
     $toolbar_file = MPATH_WP_PLG . '/' . $this->context . '/admin/toolbar.php';
     if (file_exists($toolbar_file)) {
         require_once $toolbar_file;
     }
     if (!empty($views)) {
         foreach ($views as $key => $val) {
             if (empty($key)) {
                 continue;
             }
             add_submenu_page($this->context, $val, $val, 'manage_options', MRoute::_('index.php?option=com_' . $this->context . $key));
         }
     }
 }
コード例 #4
0
ファイル: session.php プロジェクト: vanie3/appland
 public static function checkToken($method = 'post')
 {
     if ($method == 'default') {
         trigger_error("MSession::checkToken() doesn't support 'default' for the method parameter.", E_USER_ERROR);
         return false;
     }
     $token = self::getFormToken();
     $app = MFactory::getApplication();
     if (!MRequest::getVar($token, '', $method, 'alnum')) {
         $session = MFactory::getSession();
         if ($session->isNew()) {
             // Redirect to login screen.
             $app->redirect(MRoute::_('index.php'), MText::_('MLIB_ENVIRONMENT_SESSION_EXPIRED'));
             $app->close();
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
コード例 #5
0
ファイル: miwosql.php プロジェクト: vanie3/appland
 public function _getHtmlTable($query, $num, $db)
 {
     // trim long query for output
     $show_query = strlen(trim($query)) > 100 ? substr($query, 0, 50) . '...' : $query;
     // run query
     $db->setQuery($query);
     $rows = $db->loadAssocList();
     $aff_rows = $db->getAffectedRows();
     $num++;
     $body = "<br> {$num}. [ " . $show_query . " ], ";
     $body .= 'rows: ' . $aff_rows;
     $body .= '<br />';
     $table = self::_getTableFromSQL($query);
     // get table name from query string
     $_sel = substr(strtolower($query), 0, 6) == 'select' && !strpos(strtolower($query), 'procedure analyse');
     // If return rows then display table
     if (!empty($rows)) {
         // Begin form and table
         $body .= '<br />';
         $body .= '<div style="overflow: auto;">';
         $body .= '<table class="wp-list-table widefat">';
         $body .= "<thead>";
         $body .= "<tr>";
         // Display table header
         if ($_sel) {
             $body .= '<th>' . MText::_('COM_MIWOSQL_ACTION') . '</th>';
         }
         $k_arr = $rows[0];
         $f = 1;
         $key = '';
         foreach ($k_arr as $var => $val) {
             if ($f) {
                 $f = 0;
                 $key = $var;
             }
             if (preg_match("/[a-zA-Z]+/", $var, $array)) {
                 $body .= '<th>' . $var . "</th>";
             }
         }
         $body .= "</tr>";
         $body .= "</thead>";
         // Get unique field of table
         $uniq_fld = self::_isTable($table) ? self::_getUniqFld($table) : '';
         $key = empty($uniq_fld) ? $key : $uniq_fld;
         // Display table rows
         $k = 0;
         $i = 0;
         foreach ($rows as $row) {
             $body .= '<tbody>';
             $body .= '<tr valign="top" class="row' . $k . '">';
             if ($_sel) {
                 $edit_link = MRoute::_('index.php?option=com_miwosql&task=edit&ja_tbl_g=' . base64_encode($table) . '&ja_qry_g=' . base64_encode($query) . '&key=' . $key . '&id=' . $row[$key]);
                 $delete_link = MRoute::_('index.php?option=com_miwosql&controller=miwosql&task=delete&ja_tbl_g=' . base64_encode($table) . '&ja_qry_g=' . base64_encode($query) . '&key=' . $key . '&id=' . $row[$key]);
                 $body .= '<td align="left" nowrap>';
                 $body .= '<a href="' . $edit_link . '">';
                 $body .= '<img border="0" src="' . MURL_MIWOSQL . '/admin/assets/images/icon-16-edit.png" alt="' . MText::_('COM_MIWOSQL_EDIT') . '" title="' . MText::_('COM_MIWOSQL_EDIT') . '" />';
                 $body .= '</a>';
                 $body .= '&nbsp;';
                 $body .= '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this record?\')) {this.href=\'' . $delete_link . '\'};">';
                 $body .= '<img border="0" src="' . MURL_MIWOSQL . '/admin/assets/images/icon-16-delete.png" alt="' . MText::_('COM_MIWOSQL_DELETE') . '" title="' . MText::_('COM_MIWOSQL_DELETE') . '" />';
                 $body .= '</a>';
                 $body .= '</td>';
             }
             foreach ($row as $var => $val) {
                 if (preg_match("/[a-zA-Z]+/", $var, $array)) {
                     $body .= '<td>&nbsp;' . htmlspecialchars(substr($val, 0, 100)) . "&nbsp;</td>\n";
                 }
             }
             $body .= "</tbody>";
             $body .= "</tr>";
             $k = 1 - $k;
             $i++;
         }
         // End table and form
         $body .= '</table>';
         $body .= '<br />';
         $body .= '</div>';
         $body .= '<input type="hidden" name="key" value="' . $key . '">';
     } else {
         // Display DB errors
         $body .= '<small style="color:red;">' . $db->_errorMsg . '</small><br/>';
     }
     return $body . '<br />';
 }
コード例 #6
0
ファイル: link.php プロジェクト: vanie3/appland
 protected function _getCommand($url)
 {
     return MRoute::_($url);
 }
コード例 #7
0
ファイル: pagination.php プロジェクト: vanie3/appland
 protected function _buildDataObject()
 {
     // Initialise variables.
     $data = new stdClass();
     // Build the additional URL parameters string.
     $params = '';
     if (!empty($this->_additionalUrlParams)) {
         foreach ($this->_additionalUrlParams as $key => $value) {
             $params .= '&' . $key . '=' . $value;
         }
     }
     $data->all = new MPaginationObject(MText::_('MLIB_HTML_VIEW_ALL'), $this->prefix);
     if (!$this->_viewall) {
         $data->all->base = '0';
         $data->all->link = MRoute::_($params . '&' . $this->prefix . 'limitstart=');
     }
     // Set the start and previous data objects.
     $data->start = new MPaginationObject(MText::_('MLIB_HTML_START'), $this->prefix);
     $data->previous = new MPaginationObject(MText::_('MPREV'), $this->prefix);
     if ($this->get('pages.current') > 1) {
         $page = ($this->get('pages.current') - 2) * $this->limit;
         // Set the empty for removal from route
         //$page = $page == 0 ? '' : $page;
         $data->start->base = '0';
         $data->start->link = MRoute::_($params . '&' . $this->prefix . 'limitstart=0');
         $data->previous->base = $page;
         $data->previous->link = MRoute::_($params . '&' . $this->prefix . 'limitstart=' . $page);
     }
     // Set the next and end data objects.
     $data->next = new MPaginationObject(MText::_('MNEXT'), $this->prefix);
     $data->end = new MPaginationObject(MText::_('MLIB_HTML_END'), $this->prefix);
     if ($this->get('pages.current') < $this->get('pages.total')) {
         $next = $this->get('pages.current') * $this->limit;
         $end = ($this->get('pages.total') - 1) * $this->limit;
         $data->next->base = $next;
         $data->next->link = MRoute::_($params . '&' . $this->prefix . 'limitstart=' . $next);
         $data->end->base = $end;
         $data->end->link = MRoute::_($params . '&' . $this->prefix . 'limitstart=' . $end);
     }
     $data->pages = array();
     $stop = $this->get('pages.stop');
     for ($i = $this->get('pages.start'); $i <= $stop; $i++) {
         $offset = ($i - 1) * $this->limit;
         // Set the empty for removal from route
         //$offset = $offset == 0 ? '' : $offset;
         $data->pages[$i] = new MPaginationObject($i, $this->prefix);
         if ($i != $this->get('pages.current') || $this->_viewall) {
             $data->pages[$i]->base = $offset;
             $data->pages[$i]->link = MRoute::_($params . '&' . $this->prefix . 'limitstart=' . $offset);
         }
     }
     return $data;
 }