• You are not logged in.
  • 1

Tiny step ahead

  • Started by wimc
  • 6 Replies
  • wimc
  • Member
  • Reputation: 8
  • From: Washington State
  • Registered: 15-06-2015
  • Posts: 72

For the search friendly URLs. Made another file named file_based_fancy_2.php

Urls on my site are for example:

  • /user/2-william

  • /forum/1-testing

  • /topic/1-test123

If I decide to use it, or any other of the search friendly urls.

Offline
  • 0
  • Chris98
  • Project Manager
  • Reputation: 51
  • From: England, United Kingdom
  • Registered: 15-04-2015
  • Posts: 512

This isn't possible at the moment; you'd have to actually modify the core - which shouldn't be done for the auto-updates .....

Currently, you only have the option to choose between the default URL schemes. But I'll ensure that there is proper documentation on how to do this best, and (maybe not in the next version, but soon) you can just drop a single file into the /include/url/ folder and when going to administration options, you will see it listed as an option there.

I'm afraid though, that progress on 1.0.8 has halted for a few days, my laptop is broken, which is where my test server is installed and configured on. I'm still trying to push ahead with it, but it may take a bit longer than originally thought now.

Kind regards,
Christopher Marshall
chris [at] get-aura [dot] org

Project Manager

Offline
  • 0
  • wimc
  • Member
  • Reputation: 8
  • From: Washington State
  • Registered: 15-06-2015
  • Posts: 72

Edited 2 files, and added one file_based_fancy_2.php in /include/url/

/admin_options.php

<option value="file_based_fancy"<?php if ($panther_config['o_url_type'] == 'file_based_fancy') echo ' selected="selected"' ?>><?php echo $lang_admin_options['File based fancy'] ?></option>

After added <option value="file_based_fancy_2"<?php if ($panther_config['o_url_type'] == 'file_based_fancy_2') echo ' selected="selected"' ?>><?php echo $lang_admin_options['File based fancy 2'] ?></option>

/lang/English/admin_options.php

'File based fancy' => 'File based (fancy)',

After added 'File based fancy 2' => 'File based (fancy) 2',

Thats what I did above.

Would attach the file file_based_fancy_2.php, but nothing happens.

<?php

/**
 *
 * This file is part of the Panther Forum Software package.
 *
 * @link      https://www.get-aura.org/
 * @copyright Copyright (c) Panther <https://www.get-aura.org/>
 * @license   GNU General Public License (GPL-3.0), Version 3, 29 June 2007 <http://opensource.org/licenses/GPL-3.0>
 *
 * For full information, please see README.md, CHANGELOG.md and LICENSE.md files which are located in the root folder.
 *
 */

// Make sure no one attempts to run this script "directly"
if (!defined('PANTHER'))
    exit;

$panther_url = array(
    'insertion_find' => '',
    'insertion_replace' => '-$1',
    'change_email' => 'change-email$1',
    'change_email_key' => 'change-email$1-$2',
    'change_password' => 'change-pass$1',
    'upload_avatar' => 'upload-avatar-$1-$2',
    'use_gravatar' => 'use-gravatar-$1-$2',
    'change_password_key' => 'change-pass$1-$2',
    'delete' => 'delete$1',
    'delete_avatar' => 'delete-avatar-$1-$2',
    'edit' => 'edit$1',
    'edit_edit' => 'edit$1-edit',
    'email' => 'email$1',
    'forum' => 'forum/$1-$2',
    'forum_paginate' => 'forum/$1-$2',
    'forum_noid' => 'forum/',
    'forum_page' => 'forum/$1-$3-p$2',
    'attachment' => 'attachment$1',
    'attachment_download' => 'attachment-download$1',
    'online' => 'online',
    'index' => '',
    'inbox' => 'inbox',
    'send_message' => 'pms_send',
    'forum_rss' => 'feed-rss-forum$1.xml',
    'forum_atom' => 'feed-atom-forum$1.xml',
    'leaders' => 'leaders',
    'forum_subscribe' => 'subscribe-forum$1',
    'forum_unsubscribe' => 'unsubscribe-forum$1',
    'index_rss' => 'feed-rss.xml',
    'index_atom' => 'feed-rss.xml',
    'login' => 'login',
    'login_in' => 'login-do',
    'logout' => 'logout$1-$2',
    'mark_read' => 'markread',
    'mark_forum_read' => 'mark-forum-read$1',
    'new_topic' => 'new-topic$1',
    'new_topic_post' => 'new-topic$1-post',
    'new_reply_post' => 'new-reply$1-post',
    'new_reply' => 'new-reply$1',
    'quote' => 'new-reply$1-$2',
    'post' => 'post$1#p$1',
    'profile' => 'user/$1-$2',
    'profile_essentials' => 'profile-essentials$1',
    'profile_personal' => 'profile-personal$1',
    'profile_messaging' => 'profile-messaging$1',
    'profile_personality' => 'profile-personality$1',
    'profile_display' => 'profile-display$1',
    'profile_privacy' => 'profile-privacy$1',
    'profile_rep_received' => 'profile-rep_received$1',
    'profile_rep_given' => 'profile-rep_given$1',
    'profile_admin' => 'profile-admin$1',
    'register' => 'register',
    'register_register' => 'register-do',
    'report' => 'report$1',
    'request_password' => 'request-password',
    'rules' => 'rules',
    'search' => 'search',
    'search_cache' => 'search-$1',
    'search_unanswered' => 'show-unanswered',
    'search_action' => 'search-action$1',
    'search_result' => 'search?action=search&amp;keywords=$1&amp;author=$2&amp;forums=$3&amp;search_in=$4&amp;sort_by=$5&amp;sort_dir=$6&amp;show_as=$7',
    'search_new' => 'show-new',
    'search_replies' => 'show-replies',
    'search_recent' => 'show-recent',
    'inbox' => 'pms_inbox',
    'box' => 'pms_inbox?id=$1',
    'pms_delete' => 'pms-delete-$1',
    'pms_folders' => 'pms-folders',
    'pms_blocked' => 'pms-blocked',
    'pms_edit' => 'pms-edit-$1',
    'pms_quote' => 'pms_send?tid=$1&qid=$2',
    'pms_view' => 'pms-view-$1',
    'pms_post' => 'pms-post$1#p$1',
    'send_message' => 'pms_send',
    'pms_reply' => 'pms_send?tid=$1',
    'pms_new' => 'pms-view-$1-new',
    'pms_last' => 'pms-view-$1-last',
    'profile_promote' => 'promote$1-$2',
    'search_new_results' => 'show-new-posts$1',
    'search_subscriptions' => 'show-subscriptions$1',
    'search_user_posts' => 'show-user-posts$1',
    'search_user_topics' => 'show-user-topics$1',
    'topic_subscribe' => 'subscribe-topic$1',
    'topic' => 'topic/$1-$2',
    'topic_paginate' => 'topic/$1-$2',
    'topic_rss' => 'feed-rss-topic$1.xml',
    'topic_atom' => 'feed-atom-topic$1.xml',
    'topic_new_posts' => 'topic/$1-$2-new',
    'topic_page' => 'topic/$1-$3-p$2',
    'topic_last_post' => 'topic/$1-$2-last',
    'topic_unsubscribe' => 'unsubscribe-topic$1',
    'userlist' => 'userlist',
    'userlist_group' => 'show-group$1',
    'userlist_result' => 'userlist#?username=$1&show_group=$2&sort_by=$3&sort_dir=$4',
    'page' => 'p$1',
    'moderate_forum' => 'moderate-forum$1',
    'moderate_forum_p' => 'moderate-forum$1-p$2',
    'moderate_topic_p' => 'moderate-forum$1-topic$2-p$3',
    'get_host' => 'get-host$1',
    'help' => 'help#$1',
    'unapprove' => 'moderate-forum$1-unapprove$2-$3',
    'move' => 'moderate-forum$1-move_topics$2-$3',
    'open' => 'moderate-forum$1-open$2-$3',
    'close' => 'moderate-forum$1-close$2-$3',
    'stick' => 'moderate-forum$1-stick$2-$3',
    'unstick' => 'moderate-forum$1-unstick$2-$3',
    'unarchive' => 'moderate-forum$1-unarchive$2-$3',
    'archive' => 'moderate-forum$1-archive$2-$3',
    'moderate_topic' => 'moderate-forum$1-topic$2',
    'moderate_all' => 'moderate-forum$1-topic$2-all',
    'moderate_multi' => 'moderate-forum$1-multi_moderate$2-$3',
    'admin_index' => 'admin/index',
    'admin_bans' => 'admin/bans',
    'admin_categories' => 'admin/categories',
    'admin_permissions' => 'admin/permissions',
    'announcement_fid' => 'forum-$2/announcement-$1-$3',
    'announcement' => 'forum-$2/announcement-$1',
    'admin_censoring' => 'admin/censoring',
    'admin_forums' => 'admin/forums',
    'admin_updates' => 'admin/updates',
    'admin_groups' => 'admin/groups',
    'admin_loader' => 'admin/loader?plugin=$1',
    'admin_maintenance' => 'admin/maintenance',
    'admin_options' => 'admin/options',
    'admin_ranks' => 'admin/ranks',
    'admin_deleted' => 'admin/deleted',
    'admin_reports' => 'admin/reports',
    'admin_posts' => 'admin/posts',
    'admin_moderate' => 'admin/moderate',
    'upload_image' => 'admin/upload-image$1',
    'delete_image' => 'admin/delete-image$1',
    'add_announcement' => 'add-announcements',
    'edit_announcement' => 'edit-announcements$1',
    'delete_announcement' => 'delete-announcements$1',
    'admin_announcements' => 'admin/announcements',
    'admin_attachments' => 'admin/attachments',
    'admin_users' => 'admin/users',
    'admin_robots' => 'admin/robots',
    'admin_archive' => 'admin/archive',
    'admin_smilies' => 'admin/smilies',
    'admin_restrictions' => 'admin/restrictions',
    'admin_statistics' => 'admin/statistics',
    'admin_forums_action' => 'admin/forums-$1',
    'edit_forum' => 'edit-forum$1',
    'del_forum' => 'del-forum$1',
    'del_group' => 'delete-group$1',
    'edit_group' => 'edit-group$1',
    'admin_options_direct' => 'admin/options#$1',
    'remove_install_file' => 'remove_install_file',
    'check_upgrade' => 'check_upgrade',
    'phpinfo' => 'phpinfo',
    'save_notes' => 'save_notes',
    'admin_moderate_add' => 'add-moderate',
    'admin_moderate_edit' => 'edit-moderate$1',
    'admin_moderate_delete' => 'delete-moderate$1',
    'admin_restrictions_query' => 'admin/restrictions?$1',
    'admin_reports_zap' => 'zap-report',
    'admin_users_users' => 'show_users$1',
    'admin_users_ip_stats' => 'ip_stats$1',
    'edit_ban' => 'edit_ban$1',
    'del_ban' => 'delete_ban$1',
    'admin_bans_add' => 'add_ban$1',
    'more_bans' => 'more-ban-options',
    'admin_warnings' => 'admin/warnings',
    'admin_addons' => 'admin/addons',
    'warning_del_level' => 'del_level$1',
    'warning_edit_level' => 'edit_level$1',
    'warning_del_type' => 'del_type$1',
    'warning_edit_type' => 'edit_type$1',
    'warnings_recent' => 'warnings?action=show_recent',
    'warnings' => 'warnings',
    'warning_view' => 'warnings?view=$1',
    'warning_details' => 'warnings?details=$1',
    'warn_user' => 'warnings?warn=$1',
    'warn_pid' => 'warnings?warn=$1&pid=$2'
);

$rewrite_rules = array(
    '/^change[-]?(email|pass)(word)?[-]?([0-9]+)[-]([a-zA-Z0-9]+)(\.?)?$/i' => 'profile.php?action=change_$1&id=$3&key=$4',
    '/^change[-]?(email|pass)(word)?[-]?([0-9]+)(\.?)?$/i' => 'profile.php?action=change_$1&id=$3',
    '/^user[\/]([0-9]+)?[-]([a-z0-9-]+)(\.?)?$/i' => 'profile.php?id=$1',
    '/^profile[-]?([a-z_]+)?([0-9]+)(\.?)?$/i' => 'profile.php?section=$1&id=$2',
    '/^(delete|edit)?([0-9]+)(\.?)?$/i' => '$1.php?id=$2',
    '/^(delete|upload|use)[-]?(avatar|gravatar)?[-]?([0-9]+)?[-]([a-z0-9]+)(\.?)?$/i' => 'profile.php?action=$1_$2&id=$3&csrf_token=$4',
    '/^logout[-]?([0-9]+)[-]([a-z0-9]+)(\.?)?$/i' => 'login.php?action=out&id=$1&csrf_token=$2',
    '/^edit([0-9]+)[-]?edit(\.?)?$/i' => 'edit.php?action=edit&id=$1',
    '/^attachment[-]?([0-9]+)(\.?)?$/i' => 'attachment.php?item=$1',
    '/^attachment[-]?download([0-9]+)(\.?)?$/i' => 'attachment.php?item=$1&download=1',
    '/^feed[-]?(rss|atom)[-]?(f|t)(orum|opic)[-]?([0-9]+)[-]?(\.xml?|\/)?$/i' => 'extern.php?action=feed&$2id=$4&type=$1',
    '/^feed[-]?(rss|atom)(\.xml?|\/)?$/i' => 'extern.php?action=feed&type=$1',
    '/^leaders(\.?)?$/i' => 'misc.php?action=leaders',
    '/^(subscribe|unsubscribe)[-]forum[-]?([0-9]+)(\.?)?$/i' => 'misc.php?action=$1&fid=$2',
    '/^(subscribe|unsubscribe)[-]topic[-]?([0-9]+)(\.?)?$/i' => 'misc.php?action=$1&tid=$2',
    '/^(markread|rules)(\.?)?$/i' => 'misc.php?action=$1',
    '/^(login|search|register|online|index|pms_inbox|pms_send|warnings)(\.?)?$/i' => '$1.php',
    '/^register[-]?do(\.?)?$/i' => 'register.php?action=register',
    '/^login[-]?do(\.?)?$/i' => 'login.php?action=in',
    '/^post[-]?([0-9]+)(\.?)?$/i' => 'viewtopic.php?pid=$1',
    '/^promote([0-9]+)[-]?([0-9]+)(\.?)?$/i' => 'profile.php?action=promote&id=$1&pid=$2',
    '/^pms[-]view[-]?([0-9]+)[-](new|last)(\.?)?$/i' => 'pms_view.php?tid=$1&action=$2',
    '/^pms[-]view[-]?([0-9]+)[-]p(age)?([0-9]+)(\.?)?$/i' => 'pms_view.php?tid=$1&p=$3',
    '/^pms[-](view|send)[-]?([0-9]+)(\.?)?$/i' => 'pms_$1.php?tid=$2',
    '/^pms[-]post[-]?([0-9]+)(\.?)?$/i' => 'pms_view.php?pid=$1#p$1',
    '/^pms[-](delete|edit)[-]?([0-9]+)(\.?)?$/i' => 'pms_misc.php?action=$1&pid=$2',
    '/^pms[-](folders|blocked)(\.?)?$/i' => 'pms_misc.php?action=$1',
    '/^pms[-]quote[-]([0-9]+)[-]([0-9]+)(\.?)?$/i' => 'pms_send.php?tid=$1&qid=$2',
    '/^pms_inbox[-]?([0-9]+)(\.?)?$/i' => 'pms_inbox.php?id=$1',
    '/^(forum|topic)[\/]?([0-9]+)[-]([a-z0-9-]+)[-]p(age)?[-]?([0-9]+)(\.?)?$/i' => 'view$1.php?id=$2&p=$5',
    '/^(forum|topic)[\/]?([0-9]+)[-]([a-z0-9-]+)(\.?)?$/i' => 'view$1.php?id=$2',
    '/^topic[-]?([0-9]+)(new|last)(\.?)?$/i' => 'viewtopic.php?id=$1&action=$2',
    '/^mark[-]forum[-]read?([0-9]+)(\.?)?$/i' => 'misc.php?action=markforumread&fid=$1',
    '/^new[-]?topic[-]?([0-9]+)[-]post(\.?)?$/i' => 'post.php?fid=$1&action=post',
    '/^new[-]?reply[-]?([0-9]+)(\.?)?$/i' => 'post.php?tid=$1',
    '/^new[-]?reply[-]?([0-9]+)[-]post(\.?)?$/i' => 'post.php?tid=$1&action=post',
    '/^new[-]?topic[-]?([0-9]+)(\.?)?$/i' => 'post.php?fid=$1',
    '/^new[-]?topic[-]?([0-9]+)[-]post(\.?)?$/i' => 'post.php?fid=$1&action=post',
    '/^new[-]?reply[-]?([0-9]+)[-]?([0-9]+)(\.?)?$/i' => 'post.php?tid=$1&qid=$2',
    '/^request[-]?password(\.?)?$/i' => 'login.php?action=forget',
    '/^request[-]?password2(\.?)?$/i' => 'login.php?action=forget_2',
    '/^(delete)[-]?(avatar|user)?[-]?([0-9]+)?(\.?)?$/i' => 'profile.php?action=$1_$2&id=$3',
    '/^show[-]?new[-]posts([0-9-]+)(\.?)?$/i' => 'search.php?action=show_new&fid=$1',
    '/^(email|report)[-]?([0-9]+)?(\.?)?$/i' => 'misc.php?$1=$2',
    '/^search[-]?([0-9]+)(\.?)?$/i' => 'search.php?search_id=$1',
    '/^search[-]?([0-9]+)[-]?p(age)?[-]?([0-9]+)(\.?)?$/i' => 'search.php?search_id=$1&p=$3',
    '/^show[-]?(recent|new|replies|unanswered)(\.?)?$/i' => 'search.php?action=show_$1',
    '/^show[-]user[-]?(posts|topics)[-]?([0-9]+)(\.?)?$/i' => 'search.php?action=show_user_$1&user_id=$2',
    '/^get-host[-]?([0-9]+|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(\.?)?$/i' => 'moderate.php?get_host=$1',
    '/^forum[-]?([0-9]+)[\/]announcement[-]([0-9]+)(|[-][a-zA-Z0-9-_]+)(\.?)?$/i' => 'announcement.php?fid=$1&id=$2&title=$3',
    '/^help(\.?)?$/i' => 'help.php',
    '/^show[-]?subscriptions[-]?([0-9]+)(\.?)?$/i' => 'search.php?action=show_subscriptions&user_id=$1',
    '/^userlist[\/](|[\/]?p([0-9]+)[\.])?$/i' => 'userlist.php?p=$2',
    '/^show-group([0-9]+)(\.?)?$/i' => 'userlist.php?show_group=$1',
    '/^moderate[-]?forum([0-9]+)(\.?)?$/i' => 'moderate.php?fid=$1',
    '/^moderate[-]?forum([0-9]+)[-]?p(age)?[-]?([0-9]+)(\.?)?$/i' => 'moderate.php?fid=$1&p=$3',
    '/^moderate[-]?forum([0-9]+)[-]topic([0-9]+)(\.?)?$/i' => 'moderate.php?fid=$1&tid=$2',
    '/^moderate[-]?forum([0-9]+)[-]topic([0-9]+)[-]all(\.?)?$/i' => 'moderate.php?fid=$1&tid=$2&action=all',
    '/^moderate[-]?forum([0-9]+)[-]topic([0-9]+)[-]?p(age)?[-]?([0-9]+)(\.?)?$/i' => 'moderate.php?fid=$1&tid=$2&p=$4',
    '/^moderate[-]?forum([0-9]+)[-](move_topics|open|close|unstick|stick|multi_moderate|unarchive|archive|unapprove)([0-9]+)[-](|[a-z0-9]+)(\.?)?$/i' => 'moderate.php?fid=$1&$2=$3&csrf_token=$4',
    '/^admin[\/]?(index|bans|categories|users|permissions|censoring|forums|groups|loader|maintenance|options|ranks|reports|posts|moderate|restrictions|statistics|updates|archive|deleted|smilies|warnings|attachments|robots|announcements|addons)(\.?)?$/i' => 'admin_$1.php',
    '/^admin[\/]?(delete|upload)[-]image([0-9]+)(\.?)?$/i' => 'admin_groups.php?action=$1_image&id=$2',
    '/^admin[\/]?forums[-][a-z_](\.?)?$/i' => 'admin_forums.php?action=$1',
    '/^admin[\/]?forums[-](addel)(\.?)?$/i' => 'admin_forums.php?action=$1',
    '/^(edit|del)[-]?forum([0-9]+)(\.?)?$/i' => 'admin_forums.php?$1_forum=$2',
    '/^(edit|delete)[-]?group([0-9]+)(\.?)?$/i' => 'admin_groups.php?$1_group=$2',
    '/^(remove_install_file|check_upgrade|phpinfo|save_notes)(\.?)?$/i' => 'admin_index.php?action=$1',
    '/^(add|edit|delete)[-](moderate|announcements)(|[0-9]+)(\.?)?$/i' => 'admin_$2.php?action=$1&id=$3',
    '/^zap-report(\.?)?$/i' => 'admin_reports.php?action=zap',
    '/^(show_users|ip_stats)([0-9]+|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}+)(\.?)?$/i' => 'admin_users.php?$1=$2',
    '/^(edit_ban|delete_ban|add_ban)([0-9]+)(\.?)?$/i' => 'admin_bans.php?$1=$2',
    '/^more-ban-options(\.?)?$/i' => 'admin_bans.php?action=more',
    '/^(del_level|edit_level|del_type|edit_type)([0-9]+)(\.?)?$/i' => 'admin_warnings.php?$1=$2'
);
  • Last edited by wimc (14-07-2015 03:12:18)
Offline
  • 0
  • Chris98
  • Project Manager
  • Reputation: 51
  • From: England, United Kingdom
  • Registered: 15-04-2015
  • Posts: 512

In the next couple of versions, we'll make it so it's just putting the file in the URL directory. It should then be easier.

Would attach the file file_based_fancy_2.php, but nothing happens.

.php files aren't allowed to be uploaded on their own, it's a default attachment restriction. You should compress it in a .zip and then attach it. Maybe there should be a message, but the reason it does that is because you won't lose the content of your updated post.

Kind regards,
Christopher Marshall
chris [at] get-aura [dot] org

Project Manager

Offline
  • 0
  • wimc
  • Member
  • Reputation: 8
  • From: Washington State
  • Registered: 15-06-2015
  • Posts: 72

Should have known that uploading an PHP wasn't allowed, and I didn't even think of zipping up the file.

I am very slowly learning some code, but I'll never ever be good enough for adding/making MODs.

Offline
  • 0

Users in this topic: 0 guests, 0 registered users

  • 1